[
  {
    "path": ".clang-format",
    "content": "# Config for clang-format version 16\n\n# Standard\nBasedOnStyle: llvm\nStandard: c++20\n\n# Indentation\nIndentWidth: 2\nColumnLimit: 140\n\n# Includes\nSortIncludes: CaseSensitive\nSortUsingDeclarations: true\n\n# Pointer and reference alignment\nPointerAlignment: Left\nReferenceAlignment: Left\nReflowComments: true\n\n# Line breaking options\nBreakBeforeBraces: Attach\nBreakConstructorInitializers: BeforeColon\nAlwaysBreakTemplateDeclarations: true\nAllowShortFunctionsOnASingleLine: Empty\nIndentCaseLabels: true\nNamespaceIndentation: Inner\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: mrousavy\npatreon: # Replace with a single Patreon username\nopen_collective: # Replace with a single Open Collective username\nko_fi: mrousavy\ntidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\notechie: # Replace with a single Otechie username\ncustom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\n\nupdates:\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      interval: \"weekly\"\n    labels:\n      - \"dependencies\"\n  - package-ecosystem: \"gradle\"\n    directory: \"/packages/react-native-mmkv/android/\"\n    schedule:\n      interval: \"weekly\"\n    labels:\n      - \"dependencies\"\n"
  },
  {
    "path": ".github/workflows/build-android-release.yml",
    "content": "name: Build Android (Release)\n\non:\n  release:\n    types: [published]\n  pull_request:\n    paths:\n      - '.github/workflows/build-android-release.yml'\n\njobs:\n  build_release:\n    name: Build Android Example App (release, new architecture)\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v6\n      - uses: oven-sh/setup-bun@v2\n\n      - name: Install npm dependencies (bun)\n        run: bun install\n      - name: Install npm dependencies in example/ (bun)\n        working-directory: example\n        run: bun install\n\n      - name: Setup JDK 17\n        uses: actions/setup-java@v5\n        with:\n          distribution: 'zulu'\n          java-version: 17\n          java-package: jdk\n\n      - name: Run Gradle Build for example/android/\n        working-directory: example\n        run: bun run build:android-release\n\n      - name: Upload APK to Release\n        uses: actions/upload-release-asset@v1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        with:\n          upload_url: ${{ github.event.release.upload_url }}\n          asset_path: example/android/app/build/outputs/apk/release/app-release.apk\n          asset_name: \"MmkvExample-${{ github.event.release.tag_name }}.apk\"\n          asset_content_type: application/vnd.android.package-archive\n\n      # Gradle cache doesn't like daemons\n      - name: Stop Gradle Daemon\n        working-directory: example/android\n        run: ./gradlew --stop\n"
  },
  {
    "path": ".github/workflows/build-android.yml",
    "content": "name: Build Android\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - '.github/workflows/build-android.yml'\n      - 'example/android/**'\n      - '**/nitrogen/generated/shared/**'\n      - '**/nitrogen/generated/android/**'\n      - 'packages/react-native-mmkv/cpp/**'\n      - 'packages/react-native-mmkv/android/**'\n      - '**/bun.lock'\n      - '**/react-native.config.js'\n      - '**/nitro.json'\n  pull_request:\n    paths:\n      - '.github/workflows/build-android.yml'\n      - 'example/android/**'\n      - '**/nitrogen/generated/shared/**'\n      - '**/nitrogen/generated/android/**'\n      - 'packages/react-native-mmkv/cpp/**'\n      - 'packages/react-native-mmkv/android/**'\n      - '**/bun.lock'\n      - '**/react-native.config.js'\n      - '**/nitro.json'\n\njobs:\n  build:\n    name: Build Android Example App\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v6\n      - uses: oven-sh/setup-bun@v2\n\n      - name: Install npm dependencies (bun)\n        run: bun install\n\n      - name: Setup JDK 17\n        uses: actions/setup-java@v5\n        with:\n          distribution: 'zulu'\n          java-version: 17\n          java-package: jdk\n\n      - name: Restore Gradle cache\n        uses: actions/cache@v5\n        with:\n          path: |\n            ~/.gradle/caches\n          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}\n          restore-keys: |\n            ${{ runner.os }}-gradle-\n      - name: Run Gradle Build for example/android/\n        working-directory: example/android\n        run: ./gradlew assembleDebug --no-daemon --build-cache\n\n      # Gradle cache doesn't like daemons\n      - name: Stop Gradle Daemon\n        working-directory: example/android\n        run: ./gradlew --stop\n"
  },
  {
    "path": ".github/workflows/build-ios-release.yml",
    "content": "name: Build iOS (Release)\n\non:\n  release:\n    types: [published]\n  pull_request:\n    paths:\n      - '.github/workflows/build-ios-release.yml'\n\njobs:\n  build_release:\n    name: Build iOS Example App (release, new architecture)\n    runs-on: macos-latest\n    steps:\n      - uses: actions/checkout@v6\n      - uses: oven-sh/setup-bun@v2\n\n      - name: Install npm dependencies (bun)\n        run: bun install\n      - name: Install npm dependencies in example/ (bun)\n        working-directory: example\n        run: bun install\n\n      - name: Setup Ruby (bundle)\n        uses: ruby/setup-ruby@v1\n        with:\n          ruby-version: 2.7.2\n          bundler-cache: true\n          working-directory: example\n\n      - name: Select Xcode 16.4\n        run: sudo xcode-select -s \"/Applications/Xcode_16.4.app/Contents/Developer\"\n\n      - name: Restore Pods cache\n        uses: actions/cache@v5\n        with:\n          path: example/ios/Pods\n          key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock', '**/Gemfile.lock') }}\n          restore-keys: |\n            ${{ runner.os }}-pods-\n      - name: Install Pods\n        working-directory: example\n        run: bun pods\n\n      - name: Build App (Release, Simulator)\n        working-directory: example/ios\n        run: |\n          set -o pipefail\n          xcodebuild \\\n            CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \\\n            -derivedDataPath build -UseModernBuildSystem=YES \\\n            -workspace MmkvExample.xcworkspace \\\n            -scheme MmkvExample \\\n            -sdk iphonesimulator \\\n            -configuration Release \\\n            -destination 'generic/platform=iOS Simulator' \\\n            build \\\n            CODE_SIGNING_ALLOWED=NO\n\n      - name: Package .app for Simulator\n        run: |\n          cd example/ios/build/Build/Products/Release-iphonesimulator\n          zip -r ../../../../../../MmkvExample-Release-Simulator.zip MmkvExample.app\n\n      - name: Upload .app to Release\n        uses: actions/upload-release-asset@v1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        with:\n          upload_url: ${{ github.event.release.upload_url }}\n          asset_path: MmkvExample-Release-Simulator.zip\n          asset_name: \"MmkvExample-Simulator-${{ github.event.release.tag_name }}.app.zip\"\n          asset_content_type: application/zip\n"
  },
  {
    "path": ".github/workflows/build-ios.yml",
    "content": "name: Build iOS\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - '.github/workflows/build-ios.yml'\n      - 'example/ios/**'\n      - '**/nitrogen/generated/shared/**'\n      - '**/nitrogen/generated/ios/**'\n      - 'packages/react-native-mmkv/cpp/**'\n      - 'packages/react-native-mmkv/ios/**'\n      - '**/Podfile.lock'\n      - '**/*.podspec'\n      - '**/react-native.config.js'\n      - '**/nitro.json'\n  pull_request:\n    paths:\n      - '.github/workflows/build-ios.yml'\n      - 'example/ios/**'\n      - '**/nitrogen/generated/shared/**'\n      - '**/nitrogen/generated/ios/**'\n      - 'packages/react-native-mmkv/cpp/**'\n      - 'packages/react-native-mmkv/ios/**'\n      - '**/Podfile.lock'\n      - '**/*.podspec'\n      - '**/react-native.config.js'\n      - '**/nitro.json'\n\nenv:\n  USE_CCACHE: 1\n  # Must match the runner's architecture (macOS-15 runners are arm64)\n  ARCH: arm64\n\njobs:\n  build:\n    name: Build iOS Example App\n    runs-on: macOS-15\n    steps:\n      - uses: actions/checkout@v6\n      - uses: oven-sh/setup-bun@v2\n\n      - name: Install npm dependencies (bun)\n        run: bun install\n\n      - name: Restore ccache\n        uses: hendrikmuhs/ccache-action@v1.2\n\n      - name: Setup Ruby (bundle)\n        uses: ruby/setup-ruby@v1\n        with:\n          ruby-version: 2.7.2\n          bundler-cache: true\n          working-directory: example\n\n      - name: Select Xcode 16.4\n        run: sudo xcode-select -s \"/Applications/Xcode_16.4.app/Contents/Developer\"\n\n      - name: Restore Pods cache\n        uses: actions/cache@v5\n        with:\n          path: example/ios/Pods\n          key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock', '**/Gemfile.lock') }}\n          restore-keys: |\n            ${{ runner.os }}-pods-\n      - name: Install Pods\n        working-directory: example\n        run: bun pods\n\n      - name: Build App\n        working-directory: example/ios\n        run: \"set -o pipefail && xcodebuild \\\n          CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \\\n          -derivedDataPath build -UseModernBuildSystem=YES \\\n          -workspace MmkvExample.xcworkspace \\\n          -scheme MmkvExample \\\n          -sdk iphonesimulator \\\n          -configuration Debug \\\n          -destination 'generic/platform=iOS Simulator,arch=${{ env.ARCH }}' \\\n          build \\\n          CODE_SIGNING_ALLOWED=NO\"\n"
  },
  {
    "path": ".github/workflows/harness-android.yml",
    "content": "name: Harness Android\n\non:\n  workflow_dispatch:\n    inputs:\n      device_api_level:\n        description: \"Android API level for the emulator\"\n        required: false\n        default: \"35\"\n        type: string\n      device_arch:\n        description: \"Device architecture (x86_64, arm64-v8a)\"\n        required: false\n        default: \"x86_64\"\n        type: choice\n        options:\n          - x86_64\n          - arm64-v8a\n      device_profile:\n        description: \"Device profile\"\n        required: false\n        default: \"pixel_7\"\n        type: string\n      avd_name:\n        description: \"AVD name\"\n        required: false\n        default: \"Pixel_8_API_35\"\n        type: string\n  push:\n    branches:\n      - main\n    paths:\n      - \".github/workflows/harness-android.yml\"\n      - \"example/android/**\"\n      - \"**/nitrogen/generated/shared/**\"\n      - \"**/nitrogen/generated/android/**\"\n      - \"packages/react-native-mmkv/cpp/**\"\n      - \"packages/react-native-mmkv/android/**\"\n      - \"**/bun.lock\"\n      - \"**/react-native.config.js\"\n      - \"**/nitro.json\"\n      - \"example/__tests__/**\"\n      - \"example/rn-harness.config.mjs\"\n  pull_request:\n    paths:\n      - \".github/workflows/harness-android.yml\"\n      - \"example/android/**\"\n      - \"**/nitrogen/generated/shared/**\"\n      - \"**/nitrogen/generated/android/**\"\n      - \"packages/react-native-mmkv/cpp/**\"\n      - \"packages/react-native-mmkv/android/**\"\n      - \"**/bun.lock\"\n      - \"**/react-native.config.js\"\n      - \"**/nitro.json\"\n      - \"example/__tests__/**\"\n      - \"example/rn-harness.config.mjs\"\n\nenv:\n  # Device configuration - can be overridden by workflow_dispatch inputs\n  DEVICE_API_LEVEL: ${{ github.event.inputs.device_api_level || '35' }}\n  DEVICE_ARCH: ${{ github.event.inputs.device_arch || 'x86_64' }}\n  DEVICE_PROFILE: ${{ github.event.inputs.device_profile || 'pixel_7' }}\n  AVD_NAME: ${{ github.event.inputs.avd_name || 'Pixel_8_API_35' }}\n\njobs:\n  harness_android_new:\n    name: Harness Android (new architecture)\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v6\n      - uses: oven-sh/setup-bun@v2\n\n      - name: Install npm dependencies (bun)\n        run: bun install\n\n      - name: Setup JDK 17\n        uses: actions/setup-java@v5\n        with:\n          distribution: \"zulu\"\n          java-version: 17\n          java-package: jdk\n\n      - name: Restore Gradle cache\n        uses: actions/cache@v5\n        with:\n          path: |\n            ~/.gradle/caches\n          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}\n          restore-keys: |\n            ${{ runner.os }}-gradle-\n\n      - name: Build Android app\n        working-directory: example/android\n        run: ./gradlew assembleDebug --no-daemon --build-cache\n\n      - name: Enable KVM group perms\n        run: |\n          echo 'KERNEL==\"kvm\", GROUP=\"kvm\", MODE=\"0666\", OPTIONS+=\"static_node=kvm\"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules\n          sudo udevadm control --reload-rules\n          sudo udevadm trigger --name-match=kvm\n          ls /dev/kvm\n\n      - name: AVD cache\n        uses: actions/cache@v5\n        id: avd-cache\n        with:\n          path: |\n            ~/.android/avd/*\n            ~/.android/adb*\n          key: avd-${{ env.DEVICE_API_LEVEL }}-${{ env.DEVICE_ARCH }}\n\n      - name: Create AVD and generate snapshot for caching\n        if: steps.avd-cache.outputs.cache-hit != 'true'\n        uses: reactivecircus/android-emulator-runner@v2\n        with:\n          api-level: ${{ env.DEVICE_API_LEVEL }}\n          arch: ${{ env.DEVICE_ARCH }}\n          profile: ${{ env.DEVICE_PROFILE }}\n          disk-size: 1G\n          heap-size: 1G\n          force-avd-creation: false\n          avd-name: ${{ env.AVD_NAME }}\n          disable-animations: true\n          emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none\n          script: echo \"Generated AVD snapshot for caching.\"\n\n      - name: Run Harness E2E tests\n        uses: reactivecircus/android-emulator-runner@v2\n        with:\n          working-directory: example\n          api-level: ${{ env.DEVICE_API_LEVEL }}\n          arch: ${{ env.DEVICE_ARCH }}\n          force-avd-creation: false\n          avd-name: ${{ env.AVD_NAME }}\n          disable-animations: true\n          emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none\n          script: |\n            adb install -r \"./android/app/build/outputs/apk/debug/app-debug.apk\"\n            bun run test:harness --harnessRunner android\n\n      # Gradle cache doesn't like daemons\n      - name: Stop Gradle Daemon\n        working-directory: example/android\n        run: ./gradlew --stop\n"
  },
  {
    "path": ".github/workflows/harness-ios.yml",
    "content": "name: Harness iOS\n\non:\n  workflow_dispatch:\n    inputs:\n      device_model:\n        description: \"iOS Simulator device model\"\n        required: false\n        default: \"iPhone 16 Pro\"\n        type: string\n      ios_version:\n        description: \"iOS version\"\n        required: false\n        default: \"18.6\"\n        type: string\n      xcode_version:\n        description: \"Xcode version\"\n        required: false\n        default: \"16.4.0\"\n        type: string\n  push:\n    branches:\n      - main\n    paths:\n      - \".github/workflows/harness-ios.yml\"\n      - \"example/ios/**\"\n      - \"**/nitrogen/generated/shared/**\"\n      - \"**/nitrogen/generated/ios/**\"\n      - \"packages/react-native-mmkv/cpp/**\"\n      - \"packages/react-native-mmkv/ios/**\"\n      - \"**/Podfile.lock\"\n      - \"**/*.podspec\"\n      - \"**/react-native.config.js\"\n      - \"**/nitro.json\"\n      - \"example/__tests__/**\"\n      - \"example/rn-harness.config.mjs\"\n  pull_request:\n    paths:\n      - \".github/workflows/harness-ios.yml\"\n      - \"example/ios/**\"\n      - \"**/nitrogen/generated/shared/**\"\n      - \"**/nitrogen/generated/ios/**\"\n      - \"packages/react-native-mmkv/cpp/**\"\n      - \"packages/react-native-mmkv/ios/**\"\n      - \"**/Podfile.lock\"\n      - \"**/*.podspec\"\n      - \"**/react-native.config.js\"\n      - \"**/nitro.json\"\n      - \"example/__tests__/**\"\n      - \"example/rn-harness.config.mjs\"\n\nenv:\n  # Device configuration - can be overridden by workflow_dispatch inputs\n  DEVICE_MODEL: ${{ github.event.inputs.device_model || 'iPhone 16 Pro' }}\n  IOS_VERSION: ${{ github.event.inputs.ios_version || '18.6' }}\n  XCODE_VERSION: ${{ github.event.inputs.xcode_version || '16.4.0' }}\n  USE_CCACHE: 1\n  DEVELOPER_DIR: /Applications/Xcode_${{ github.event.inputs.xcode_version || '16.4.0' }}.app/Contents/Developer\n\njobs:\n  harness_ios_new:\n    name: Harness iOS (new architecture)\n    runs-on: macos-latest\n    steps:\n      - uses: actions/checkout@v6\n      - uses: oven-sh/setup-bun@v2\n\n      - name: Install npm dependencies (bun)\n        run: bun install\n\n      - name: Restore ccache\n        uses: hendrikmuhs/ccache-action@v1.2\n\n      - name: Setup Ruby (bundle)\n        uses: ruby/setup-ruby@v1\n        with:\n          ruby-version: 2.7.2\n          bundler-cache: true\n          working-directory: example\n\n      - name: Select Xcode ${{ env.XCODE_VERSION }}\n        run: sudo xcode-select -s \"/Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer\"\n\n      - name: Restore Pods cache\n        uses: actions/cache@v5\n        with:\n          path: example/ios/Pods\n          key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock', '**/Gemfile.lock') }}\n          restore-keys: |\n            ${{ runner.os }}-pods-\n\n      - name: Install Pods\n        working-directory: example\n        run: bun pods\n\n      - name: Build iOS app\n        working-directory: example/ios\n        run: \"set -o pipefail && xcodebuild \\\n          CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \\\n          -derivedDataPath build -UseModernBuildSystem=YES \\\n          -workspace MmkvExample.xcworkspace \\\n          -scheme MmkvExample \\\n          -sdk iphonesimulator \\\n          -configuration Debug \\\n          -destination 'platform=iOS Simulator,name=${{ env.DEVICE_MODEL }}' \\\n          build \\\n          CODE_SIGNING_ALLOWED=NO\"\n\n      - name: Setup iOS Simulator\n        uses: futureware-tech/simulator-action@v5\n        with:\n          model: ${{ env.DEVICE_MODEL }}\n          os: iOS\n          os_version: ${{ env.IOS_VERSION }}\n          wait_for_boot: true\n          erase_before_boot: false\n\n      - name: Install app\n        run: |\n          xcrun simctl install booted example/ios/build/Build/Products/Debug-iphonesimulator/MmkvExample.app\n\n      - name: Run Harness E2E tests\n        working-directory: example\n        run: |\n          bun run test:harness --harnessRunner ios\n"
  },
  {
    "path": ".github/workflows/lint-cpp.yml",
    "content": "name: Validate C++\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - '.github/workflows/lint-cpp.yml'\n      - '**/*.h'\n      - '**/*.hpp'\n      - '**/*.cpp'\n      - '**/*.c'\n      - '**/*.mm'\n  pull_request:\n    paths:\n      - '.github/workflows/lint-cpp.yml'\n      - '**/*.h'\n      - '**/*.hpp'\n      - '**/*.cpp'\n      - '**/*.c'\n      - '**/*.mm'\n\njobs:\n  lint:\n    name: Check clang-format\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        path:\n        - 'packages/react-native-mmkv/android/src/main/cpp'\n        - 'packages/react-native-mmkv/cpp'\n        - 'packages/react-native-mmkv/ios'\n    steps:\n      - uses: actions/checkout@v6\n      - uses: oven-sh/setup-bun@v2\n\n      - name: Install npm dependencies (bun)\n        run: bun install\n\n      - name: Run clang-format style check\n        uses: jidicula/clang-format-action@v4.17.0\n        with:\n          clang-format-version: '18'\n          check-path: ${{ matrix.path }}\n\n"
  },
  {
    "path": ".github/workflows/lint-typescript.yml",
    "content": "name: Lint TypeScript\n\npermissions:\n  checks: write\n  contents: read\n  pull-requests: read\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - '.github/workflows/lint-typescript.yml'\n      - 'config'\n      - '**/*.ts'\n      - '**/*.tsx'\n      - '**/*.js'\n      - '**/*.jsx'\n      - '**/*.json'\n      - '**/*.lockb'\n      - '**/package.json'\n  pull_request:\n    paths:\n      - '.github/workflows/lint-typescript.yml'\n      - 'config'\n      - '**/*.ts'\n      - '**/*.tsx'\n      - '**/*.js'\n      - '**/*.jsx'\n      - '**/*.json'\n      - '**/*.lockb'\n      - '**/package.json'\n\njobs:\n  tsc:\n    name: Compile TypeScript (tsc)\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v6\n      - uses: oven-sh/setup-bun@v2\n      - uses: reviewdog/action-setup@v1\n\n      - name: Install npm dependencies (bun)\n        run: bun install\n\n      - name: Run TypeScript (tsc)\n        run: |\n          bun typecheck | reviewdog -name=\"tsc\" -efm=\"%f(%l,%c): error TS%n: %m\" -reporter=\"github-pr-review\" -filter-mode=\"nofilter\" -fail-on-error -tee\n        env:\n          REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\n  lint:\n    name: Lint JS (eslint, prettier)\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v6\n      - uses: oven-sh/setup-bun@v2\n      - uses: reviewdog/action-setup@v1\n\n      - name: Install npm dependencies (bun)\n        run: bun install\n\n      - name: Run ESLint CI in example/\n        working-directory: example\n        run: bun lint-ci\n      - name: Run ESLint CI in packages/react-native-mmkv\n        working-directory: packages/react-native-mmkv\n        run: bun lint-ci\n\n      - name: Run ESLint with auto-fix in example/\n        working-directory: example\n        run: bun lint\n      - name: Run ESLint with auto-fix in packages/react-native-mmkv\n        working-directory: packages/react-native-mmkv\n        run: bun lint\n\n      - name: Verify no files have changed after auto-fix\n        run: git diff --exit-code HEAD -- . ':(exclude)bun.lock'\n"
  },
  {
    "path": ".github/workflows/run-nitrogen.yml",
    "content": "name: Run Nitrogen\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - '.github/workflows/run-nitrogen.yml'\n      - '**/*.ts'\n      - '**/*.tsx'\n      - '**/*.js'\n      - '**/*.jsx'\n      - '**/*.json'\n      - '**/*.lockb'\n      - '**/nitro.json'\n      - '**/package.json'\n  pull_request:\n    paths:\n      - '.github/workflows/run-nitrogen.yml'\n      - '**/*.ts'\n      - '**/*.tsx'\n      - '**/*.js'\n      - '**/*.jsx'\n      - '**/*.json'\n      - '**/*.lockb'\n      - '**/nitro.json'\n      - '**/package.json'\n\njobs:\n  lint:\n    name: Run Nitrogen for react-native-mmkv\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v6\n      - uses: oven-sh/setup-bun@v2\n\n      - name: Install npm dependencies (bun)\n        run: bun install\n\n      - name: Build all packages\n        run: bun mmkv build\n\n      - name: Run nitrogen in packages/react-native-mmkv\n        working-directory: packages/react-native-mmkv\n        run: bun i && bun specs\n\n      - name: Verify no files have changed after nitrogen\n        run: git diff --exit-code HEAD -- . ':(exclude)bun.lock'\n"
  },
  {
    "path": ".github/workflows/test-js.yml",
    "content": "name: Test JS\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - '.github/workflows/test-js.yml'\n      - 'packages/react-native-mmkv/**'\n  pull_request:\n    paths:\n      - '.github/workflows/test-js.yml'\n      - 'packages/react-native-mmkv/**'\n\njobs:\n  test:\n    name: Test JS\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v6\n    - uses: oven-sh/setup-bun@v2\n\n    - name: Install npm dependencies (bun)\n      run: bun install\n\n    - name: Run Jest\n      run: bun run test\n"
  },
  {
    "path": ".github/workflows/update-lockfiles.yml",
    "content": "name: 'Update Lockfiles (bun.lock + Podfile.lock)'\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - \".github/workflows/update-lockfiles.yml\"\n  pull_request:\n    paths:\n      - \".github/workflows/update-lockfiles.yml\"\n      - \"package.json\"\n      - \"**/package.json\"\n\npermissions:\n  contents: write\n\njobs:\n  update-lockfiles:\n    name: \"Update lockfiles (Podfile.lock)\"\n    if: github.actor == 'dependabot[bot]'\n    runs-on: macOS-latest\n    steps:\n      - uses: actions/checkout@v6\n        with:\n          fetch-depth: 0\n          ref: ${{ github.event.pull_request.head.ref }}\n\n      - uses: oven-sh/setup-bun@v2\n\n      - name: Setup Ruby (bundle)\n        uses: ruby/setup-ruby@v1\n        with:\n          ruby-version: 2.7.2\n          bundler-cache: true\n          working-directory: example/ios\n\n      - run: |\n          bun install\n\n          cd example\n          bundle install\n          bun pods\n          cd ..\n\n          cd docs\n          bun install\n          cd ..\n\n          git add bun.lock\n          git add example/ios/Podfile.lock\n          git add example/Gemfile.lock\n\n          git config --global user.name 'dependabot[bot]'\n          git config --global user.email 'dependabot[bot]@users.noreply.github.com'\n          git commit --amend --no-edit\n          git push --force\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\n**/node_modules/\n\n# no yarn/npm in the root repo!\n/package-lock.json\n/yarn.lock\n\n.xcode.env.local\n.vscode\n\n# build\n.cache\nbuild\ncompile_commands.json\n\n**/tsconfig.tsbuildinfo\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "\n# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participation in our\ncommunity a harassment-free experience for everyone, regardless of age, body\nsize, visible or invisible disability, ethnicity, sex characteristics, gender\nidentity and expression, level of experience, education, socio-economic status,\nnationality, personal appearance, race, caste, color, religion, or sexual\nidentity and orientation.\n\nWe pledge to act and interact in ways that contribute to an open, welcoming,\ndiverse, inclusive, and healthy community.\n\n## Our Standards\n\nExamples of behavior that contributes to a positive environment for our\ncommunity include:\n\n* Demonstrating empathy and kindness toward other people\n* Being respectful of differing opinions, viewpoints, and experiences\n* Giving and gracefully accepting constructive feedback\n* Accepting responsibility and apologizing to those affected by our mistakes,\n  and learning from the experience\n* Focusing on what is best not just for us as individuals, but for the overall\n  community\n\nExamples of unacceptable behavior include:\n\n* The use of sexualized language or imagery, and sexual attention or advances of\n  any kind\n* Trolling, insulting or derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or email address,\n  without their explicit permission\n* Other conduct which could reasonably be considered inappropriate in a\n  professional setting\n\n## Enforcement Responsibilities\n\nCommunity leaders are responsible for clarifying and enforcing our standards of\nacceptable behavior and will take appropriate and fair corrective action in\nresponse to any behavior that they deem inappropriate, threatening, offensive,\nor harmful.\n\nCommunity leaders have the right and responsibility to remove, edit, or reject\ncomments, commits, code, wiki edits, issues, and other contributions that are\nnot aligned to this Code of Conduct, and will communicate reasons for moderation\ndecisions when appropriate.\n\n## Scope\n\nThis Code of Conduct applies within all community spaces, and also applies when\nan individual is officially representing the community in public spaces.\nExamples of representing our community include using an official e-mail address,\nposting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported to the community leaders responsible for enforcement at\n[INSERT CONTACT METHOD].\nAll complaints will be reviewed and investigated promptly and fairly.\n\nAll community leaders are obligated to respect the privacy and security of the\nreporter of any incident.\n\n## Enforcement Guidelines\n\nCommunity leaders will follow these Community Impact Guidelines in determining\nthe consequences for any action they deem in violation of this Code of Conduct:\n\n### 1. Correction\n\n**Community Impact**: Use of inappropriate language or other behavior deemed\nunprofessional or unwelcome in the community.\n\n**Consequence**: A private, written warning from community leaders, providing\nclarity around the nature of the violation and an explanation of why the\nbehavior was inappropriate. A public apology may be requested.\n\n### 2. Warning\n\n**Community Impact**: A violation through a single incident or series of\nactions.\n\n**Consequence**: A warning with consequences for continued behavior. No\ninteraction with the people involved, including unsolicited interaction with\nthose enforcing the Code of Conduct, for a specified period of time. This\nincludes avoiding interactions in community spaces as well as external channels\nlike social media. Violating these terms may lead to a temporary or permanent\nban.\n\n### 3. Temporary Ban\n\n**Community Impact**: A serious violation of community standards, including\nsustained inappropriate behavior.\n\n**Consequence**: A temporary ban from any sort of interaction or public\ncommunication with the community for a specified period of time. No public or\nprivate interaction with the people involved, including unsolicited interaction\nwith those enforcing the Code of Conduct, is allowed during this period.\nViolating these terms may lead to a permanent ban.\n\n### 4. Permanent Ban\n\n**Community Impact**: Demonstrating a pattern of violation of community\nstandards, including sustained inappropriate behavior, harassment of an\nindividual, or aggression toward or disparagement of classes of individuals.\n\n**Consequence**: A permanent ban from any sort of public interaction within the\ncommunity.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage],\nversion 2.1, available at\n[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].\n\nCommunity Impact Guidelines were inspired by\n[Mozilla's code of conduct enforcement ladder][Mozilla CoC].\n\nFor answers to common questions about this code of conduct, see the FAQ at\n[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at\n[https://www.contributor-covenant.org/translations][translations].\n\n[homepage]: https://www.contributor-covenant.org\n[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html\n[Mozilla CoC]: https://github.com/mozilla/diversity\n[FAQ]: https://www.contributor-covenant.org/faq\n[translations]: https://www.contributor-covenant.org/translations\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\nContributions are always welcome, no matter how large or small!\n\nWe want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md).\n\n## Development workflow\n\nTo get started with the project, run `bun i` in the root directory to install the required dependencies for all packages & apps:\n\n```sh\nbun i\n```\n\nThe [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.\n\nIt is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.\n\nIf you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/MmkvExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-mmkv`.\n\nTo edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-mmkv` under `Android`.\n\nYou can use various commands from the root directory to work with the project.\n\nTo start the packager:\n\n```sh\nbun example start\n```\n\nTo run the example app on Android:\n\n```sh\nbun example android\n```\n\nTo run the example app on iOS:\n\n```sh\nbun example ios\n```\n\nTo confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:\n\n```sh\nRunning \"MmkvExample\" with {\"fabric\":true,\"initialProps\":{\"concurrentRoot\":true},\"rootTag\":1}\n```\n\nNote the `\"fabric\":true` and `\"concurrentRoot\":true` properties.\n\nMake sure your code passes TypeScript and ESLint. Run the following to verify:\n\n```sh\nbun typecheck\nbun lint\n```\n\nTo fix formatting errors, run the following:\n\n```sh\nbun lint --fix\n```\n\nRemember to add tests for your change if possible. Run the unit tests by:\n\n```sh\n# `bun test` uses bun's test runner, which isn't compatible with flow notation\n# in RN.  So use `bun run test`\nbun run test\n```\n\n### Commit message convention\n\nWe follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:\n\n- `fix`: bug fixes, e.g. fix crash due to deprecated method.\n- `feat`: new features, e.g. add new method to the module.\n- `refactor`: code refactor, e.g. migrate from class components to hooks.\n- `docs`: changes into documentation, e.g. add usage example for the module..\n- `test`: adding or updating tests, e.g. add integration tests using detox.\n- `chore`: tooling changes, e.g. change CI config.\n\nOur pre-commit hooks verify that your commit message matches this format when committing.\n\n### Linting and tests\n\n[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)\n\nWe use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.\n\nOur pre-commit hooks verify that the linter and tests pass when committing.\n\n### Publishing to npm\n\nWe use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.\n\nTo publish new versions, run the following:\n\n```sh\nbun release\n```\n\n### Scripts\n\nThe `package.json` file contains various scripts for common tasks:\n\n- `bun`: setup project by installing dependencies.\n- `bun typecheck`: type-check files with TypeScript.\n- `bun lint`: lint files with ESLint.\n- `bun test`: run unit tests with Jest.\n- `bun example start`: start the Metro server for the example app.\n- `bun example android`: run the example app on Android.\n- `bun example ios`: run the example app on iOS.\n\n### Sending a pull request\n\n> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).\n\nWhen you're sending a pull request:\n\n- Prefer small pull requests focused on one change.\n- Verify that linters and tests are passing.\n- Review the documentation to make sure it looks good.\n- Follow the pull request template when opening a pull request.\n- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2024 Marc Rousavy\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "| **V4 Docs** | [old V3 Docs](./README_V3.md) |\n|:---|:---|\n\n<a href=\"https://margelo.com\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"./docs/img/banner-dark.webp\" />\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"./docs/img/banner-light.webp\" />\n    <img alt=\"react-native-mmkv\" src=\"./docs/img/banner-light.webp\" />\n  </picture>\n</a>\n\n<div align=\"center\">\n  <h1 align=\"center\">MMKV</h1>\n  <h3 align=\"center\">The fastest key/value storage for React Native.</h3>\n</div>\n\n<div align=\"center\">\n  <a align=\"center\" href=\"https://github.com/mrousavy?tab=followers\">\n    <img src=\"https://img.shields.io/github/followers/mrousavy?label=Follow%20%40mrousavy&style=social\" />\n  </a>\n  <br/>\n  <a align=\"center\" href=\"https://twitter.com/mrousavy\">\n    <img src=\"https://img.shields.io/twitter/follow/mrousavy?label=Follow%20%40mrousavy&style=social\" />\n  </a>\n  <br />\n  <a href=\"https://github.com/sponsors/mrousavy\">\n    <img align=\"right\" width=\"160\" alt=\"This library helped you? Consider sponsoring!\" src=\".github/funding-octocat.svg\">\n  </a>\n</div>\n<br/>\n\n\n* **MMKV** is an efficient, small mobile key-value storage framework developed by WeChat. See [Tencent/MMKV](https://github.com/Tencent/MMKV) for more information\n* **react-native-mmkv** is a library that allows you to easily use **MMKV** inside your React Native app through fast and direct JS bindings to the native C++ library.\n\n## Features\n\n* **Get** and **set** strings, booleans, numbers and ArrayBuffers\n* **Fully synchronous** calls, no async/await, no Promises, no Bridge.\n* **Encryption** support (secure storage)\n* **Multiple instances** support (separate user-data with global data)\n* **Customizable storage location**\n* **High performance** because everything is **written in C++**\n* **~30x faster than AsyncStorage**\n* Uses [**JSI**](https://reactnative.dev/docs/the-new-architecture/landing-page#fast-javascriptnative-interfacing) and [**C++ NitroModules**](https://github.com/mrousavy/nitro) instead of the \"old\" Bridge\n* **iOS**, **Android** and **Web** support\n* Easy to use **React Hooks** API\n\n> [!IMPORTANT]\n> - **You're looking at MMKV V4. If you're still on V3, check out the [V3 docs here](./README_V3.md)**!\n> - react-native-mmkv **V4** is now a [Nitro Module](https://nitro.margelo.com). See the [V4 Upgrade Guide](./docs/V4_UPGRADE_GUIDE.md) for more information.\n\n## Benchmark\n\n[StorageBenchmark](https://github.com/mrousavy/StorageBenchmark) compares popular storage libraries against each other by reading a value from storage for 1000 times:\n\n<div align=\"center\">\n  <a href=\"https://github.com/mrousavy/StorageBenchmark\">\n    <img src=\"./docs/img/benchmark_1000_get.png\" />\n  </a>\n  <p>\n    <b>MMKV vs other storage libraries</b>: Reading a value from Storage 1000 times. <br/>\n    Measured in milliseconds on an iPhone 11 Pro, lower is better. <br/>\n  </p>\n</div>\n\n## Installation\n\n### React Native\n\n```sh\nnpm install react-native-mmkv react-native-nitro-modules\ncd ios && pod install\n```\n\n### Expo\n\n```sh\nnpx expo install react-native-mmkv react-native-nitro-modules\nnpx expo prebuild\n```\n\n## Usage\n\n### Create a new instance\n\nTo create a new instance of the MMKV storage, use the `MMKV` constructor. It is recommended that you re-use this instance throughout your entire app instead of creating a new instance each time, so `export` the `storage` object.\n\n#### Default\n\n```ts\nimport { createMMKV } from 'react-native-mmkv'\n\nexport const storage = createMMKV()\n```\n\nThis creates a new storage instance using the default MMKV storage ID (`mmkv.default`).\n\n#### App Groups or Extensions\n\nIf you want to share MMKV data between your app and other apps or app extensions in the same group, open `Info.plist` and create an `AppGroupIdentifier` key with your app group's value. MMKV will then automatically store data inside the app group which can be read and written to from other apps or app extensions in the same group by making use of MMKV's multi processing mode.\nSee [Configuring App Groups](https://developer.apple.com/documentation/xcode/configuring-app-groups).\n\n#### Customize\n\n```ts\nimport { createMMKV } from 'react-native-mmkv'\n\nexport const storage = createMMKV({\n  id: `user-${userId}-storage`,\n  path: `${USER_DIRECTORY}/storage`,\n  encryptionKey: 'hunter2',\n  encryptionType: 'AES-256',\n  mode: 'multi-process',\n  readOnly: false,\n  compareBeforeSet: false,\n})\n```\n\nThis creates a new storage instance using a custom MMKV storage ID. By using a custom storage ID, your storage is separated from the default MMKV storage of your app.\n\nThe following values can be configured:\n\n* `id`: The MMKV instance's ID. If you want to use multiple instances, use different IDs. For example, you can separate the global app's storage and a logged-in user's storage. (required if `path` or `encryptionKey` fields are specified, otherwise defaults to: `'mmkv.default'`)\n* `path`: The MMKV instance's root path. By default, MMKV stores file inside `$(Documents)/mmkv/`. You can customize MMKV's root directory on MMKV initialization (documentation: [iOS](https://github.com/Tencent/MMKV/wiki/iOS_advance#customize-location) / [Android](https://github.com/Tencent/MMKV/wiki/android_advance#customize-location))\n* `encryptionKey`: The MMKV instance's encryption/decryption key. By default, MMKV stores all key-values in plain text on file, relying on iOS's/Android's sandbox to make sure the file is encrypted. Should you worry about information leaking, you can choose to encrypt MMKV. (documentation: [iOS](https://github.com/Tencent/MMKV/wiki/iOS_advance#encryption) / [Android](https://github.com/Tencent/MMKV/wiki/android_advance#encryption))\n* `encryptionType`: The MMKV instance's encryption/decryption algorithm. By default, AES-128 encryption will be used, but you can switch to AES-256 for advanced security.\n* `mode`: The MMKV's process behaviour - when set to `multi-process`, the MMKV instance will assume data can be changed from the outside (e.g. App Clips, Extensions or App Groups).\n* `readOnly`: Whether this MMKV instance should be in read-only mode. This is typically more efficient and avoids unwanted writes to the data if not needed. Any call to `set(..)` will throw.\n* `compareBeforeSet`: Whether this MMKV instance will compare values for equality before writing them to disk. By default this is disabled, enabling it might improve performance if values are repeatedly written to disk, even if they are already persisted.\n\n### Set\n\n```ts\nstorage.set('user.name', 'Marc')\nstorage.set('user.age', 21)\nstorage.set('is-mmkv-fast-asf', true)\n```\n\n### Get\n\n```ts\nconst username = storage.getString('user.name') // 'Marc'\nconst age = storage.getNumber('user.age') // 21\nconst isMmkvFastAsf = storage.getBoolean('is-mmkv-fast-asf') // true\n```\n\n### Hooks\n\n```ts\nconst [username, setUsername] = useMMKVString('user.name')\nconst [age, setAge] = useMMKVNumber('user.age')\nconst [isMmkvFastAsf, setIsMmkvFastAsf] = useMMKVBoolean('is-mmkv-fast-asf')\n```\n\n### Keys\n\n```ts\n// checking if a specific key exists\nconst hasUsername = storage.contains('user.name')\n\n// getting all keys\nconst keys = storage.getAllKeys() // ['user.name', 'user.age', 'is-mmkv-fast-asf']\n\n// delete a specific key + value\nconst wasRemoved = storage.remove('user.name')\n\n// delete all keys\nstorage.clearAll()\n```\n\n### Objects\n\n```ts\nconst user = {\n  username: 'Marc',\n  age: 21\n}\n\n// Serialize the object into a JSON string\nstorage.set('user', JSON.stringify(user))\n\n// Deserialize the JSON string into an object\nconst jsonUser = storage.getString('user') // { 'username': 'Marc', 'age': 21 }\nconst userObject = JSON.parse(jsonUser)\n```\n\n### Encryption\n\n```ts\n// encrypt all data with a private key using AES-128\nstorage.encrypt('hunter2')\n// encrypt all data with a private key using AES-256\nstorage.encrypt('hunter2again', 'AES-256')\n\n// remove encryption\nstorage.decrypt()\n```\n\n### Buffers\n\n```ts\nconst buffer = new ArrayBuffer(3)\nconst dataWriter = new Uint8Array(buffer)\ndataWriter[0] = 1\ndataWriter[1] = 100\ndataWriter[2] = 255\nstorage.set('someToken', buffer)\n\nconst buffer = storage.getBuffer('someToken')\nconsole.log(buffer) // [1, 100, 255]\n```\n\n### Size\n\n```ts\n// get size of MMKV storage in bytes\nconst size = storage.size\nif (size >= 4096) {\n  // clean unused keys and clear memory cache\n  storage.trim()\n}\n```\n\n### Importing all data from another MMKV instance\n\nTo import all keys and values from another MMKV instance, use `importAllFrom(...)`:\n\n```ts\nconst storage = createMMKV(...)\nconst otherStorage = createMMKV(...)\n\nconst importedCount = storage.importAllFrom(otherStorage)\n```\n\n### Check if an MMKV instance exists\n\nTo check if an MMKV instance exists, use `existsMMKV(...)`:\n\n```ts\nimport { existsMMKV } from 'react-native-mmkv'\n\nconst exists = existsMMKV('my-instance')\n```\n\n### Delete an MMKV instance\n\nTo delete an MMKV instance, use `deleteMMKV(...)`:\n\n```ts\nimport { deleteMMKV } from 'react-native-mmkv'\n\nconst wasDeleted = deleteMMKV('my-instance')\n```\n\n### Log Level\n\nBy default, MMKV logs at `Debug` level in debug builds and `Warning` level in release builds. You can override this at build time to control the verbosity of MMKV's native logs.\n\n| Value | Level |\n|-------|-------|\n| 0 | Debug |\n| 1 | Info |\n| 2 | Warning |\n| 3 | Error |\n| 4 | None |\n\n#### Android\n\nSet `MMKV_logLevel` in your app's `android/gradle.properties`:\n\n```properties\nMMKV_logLevel=4\n```\n\n#### iOS\n\nSet `$MMKVLogLevel` in your app's `ios/Podfile`, then run `pod install`:\n\n```ruby\n$MMKVLogLevel = 4\n```\n\nOr use an environment variable during `pod install`:\n\n```sh\nMMKV_LOG_LEVEL=4 pod install\n```\n\n## Testing with Jest or Vitest\n\nA mocked MMKV instance is automatically used when testing with Jest or Vitest, so you will be able to use `createMMKV()` as per normal in your tests. Refer to [`example/__tests__/MMKV.harness.ts`](example/__tests__/MMKV.harness.ts) for an example using Jest.\n\n## Documentation\n\n* [Hooks](./docs/HOOKS.md)\n* [Value-change Listeners](./docs/LISTENERS.md)\n* [Migrate from AsyncStorage](./docs/MIGRATE_FROM_ASYNC_STORAGE.md)\n* [Using MMKV with redux-persist](./docs/WRAPPER_REDUX.md)\n* [Using MMKV with recoil](./docs/WRAPPER_RECOIL.md)\n* [Using MMKV with mobx-persist-storage](./docs/WRAPPER_MOBX.md)\n* [Using MMKV with mobx-persist](./docs/WRAPPER_MOBXPERSIST.md)\n* [Using MMKV with zustand persist-middleware](./docs/WRAPPER_ZUSTAND_PERSIST_MIDDLEWARE.md)\n* [Using MMKV with jotai](./docs/WRAPPER_JOTAI.md)\n* [Using MMKV with react-query](./docs/WRAPPER_REACT_QUERY.md)\n* [Using MMKV with Tinybase](./docs/WRAPPER_TINYBASE.md)\n* [How is this library different from **react-native-mmkv-storage**?](https://github.com/mrousavy/react-native-mmkv/issues/100#issuecomment-886477361)\n\n## LocalStorage and In-Memory Storage (Web)\n\nIf a user chooses to disable LocalStorage in their browser, the library will automatically provide a limited in-memory storage as an alternative. However, this in-memory storage won't persist data, and users may experience data loss if they refresh the page or close their browser. To optimize user experience, consider implementing a suitable solution within your app to address this scenario.\n\n## Limitations\n\n- react-native-mmkv V4 requires react-native 0.74 or higher.\n- react-native-mmkv V4 requires [the new architecture](https://reactnative.dev/docs/the-new-architecture/landing-page)/TurboModules to be enabled.\n- Since react-native-mmkv uses JSI for synchronous native method invocations, remote debugging (e.g. with Chrome) is no longer possible. Instead, you should use [Flipper](https://fbflipper.com) or [React DevTools](https://react.dev/learn/react-developer-tools).\n\n## Integrations\n\n### Rozenite\n\nUse [@rozenite/mmkv-plugin](https://www.rozenite.dev/docs/official-plugins/mmkv) to debug your MMKV storage using Rozenite.\n\n### Reactotron\n\nUse [reactotron-react-native-mmkv](https://www.npmjs.com/package/reactotron-react-native-mmkv) to automatically log writes to your MMKV storage using Reactotron. [See the docs for how to setup this plugin with Reactotron.](https://www.npmjs.com/package/reactotron-react-native-mmkv)\n\n## Community Discord\n\n[**Join the Margelo Community Discord**](https://margelo.com/discord) to chat about react-native-mmkv or other Margelo libraries.\n\n## Adopting at scale\n\nreact-native-mmkv is provided _as is_, I work on it in my free time.\n\nIf you're integrating react-native-mmkv in a production app, consider [funding this project](https://github.com/sponsors/mrousavy) and <a href=\"mailto:me@mrousavy.com?subject=Adopting react-native-mmkv at scale\">contact me</a> to receive premium enterprise support, help with issues, prioritize bugfixes, request features, help at integrating react-native-mmkv, and more.\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n## License\n\nMIT\n"
  },
  {
    "path": "README_V3.md",
    "content": "| [V4 Docs](./README.md) | **old V3 Docs** |\n|:---|:---|\n\n<a href=\"https://margelo.com\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"./docs/img/banner-dark.png\" />\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"./docs/img/banner-light.png\" />\n    <img alt=\"react-native-mmkv\" src=\"./docs/img/banner-light.png\" />\n  </picture>\n</a>\n\n<div align=\"center\">\n  <h1 align=\"center\">MMKV</h1>\n  <h3 align=\"center\">The fastest key/value storage for React Native.</h3>\n</div>\n\n<div align=\"center\">\n  <a align=\"center\" href=\"https://github.com/mrousavy?tab=followers\">\n    <img src=\"https://img.shields.io/github/followers/mrousavy?label=Follow%20%40mrousavy&style=social\" />\n  </a>\n  <br/>\n  <a align=\"center\" href=\"https://twitter.com/mrousavy\">\n    <img src=\"https://img.shields.io/twitter/follow/mrousavy?label=Follow%20%40mrousavy&style=social\" />\n  </a>\n  <br />\n  <a href=\"https://github.com/sponsors/mrousavy\">\n    <img align=\"right\" width=\"160\" alt=\"This library helped you? Consider sponsoring!\" src=\".github/funding-octocat.svg\">\n  </a>\n</div>\n<br/>\n\n\n* **MMKV** is an efficient, small mobile key-value storage framework developed by WeChat. See [Tencent/MMKV](https://github.com/Tencent/MMKV) for more information\n* **react-native-mmkv** is a library that allows you to easily use **MMKV** inside your React Native app through fast and direct JS bindings to the native C++ library.\n\n## Features\n\n* **Get** and **set** strings, booleans, numbers and ArrayBuffers\n* **Fully synchronous** calls, no async/await, no Promises, no Bridge.\n* **Encryption** support (secure storage)\n* **Multiple instances** support (separate user-data with global data)\n* **Customizable storage location**\n* **High performance** because everything is **written in C++**\n* **~30x faster than AsyncStorage**\n* Uses [**JSI**](https://reactnative.dev/docs/the-new-architecture/landing-page#fast-javascriptnative-interfacing) and [**C++ TurboModules**](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/turbo-modules-xplat.md) instead of the \"old\" Bridge\n* **iOS**, **Android** and **Web** support\n* Easy to use **React Hooks** API\n\n> [!IMPORTANT]\n> - **You're looking at MMKV V3. If you want to upgrade to the beta, check out the [V4 docs here](./README.md)**!\n> react-native-mmkv V3 is now a pure C++ TurboModule, and **requires the new architecture to be enabled**. (react-native 0.75+)\n> - If you want to use react-native-mmkv 3.x.x, you need to enable the new architecture in your app (see [\"Enable the New Architecture for Apps\"](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/enable-apps.md))\n> - For React-Native 0.74.x, use react-native-mmkv 3.0.1. For React-Native 0.75.x and higher, use react-native-mmkv 3.0.2 or higher.\n> - If you cannot use the new architecture yet, downgrade to react-native-mmkv 2.x.x for now.\n\n## Benchmark\n\n[StorageBenchmark](https://github.com/mrousavy/StorageBenchmark) compares popular storage libraries against each other by reading a value from storage for 1000 times:\n\n<div align=\"center\">\n  <a href=\"https://github.com/mrousavy/StorageBenchmark\">\n    <img src=\"./docs/img/benchmark_1000_get.png\" />\n  </a>\n  <p>\n    <b>MMKV vs other storage libraries</b>: Reading a value from Storage 1000 times. <br/>\n    Measured in milliseconds on an iPhone 11 Pro, lower is better. <br/>\n  </p>\n</div>\n\n## Installation\n\n### React Native\n\n```sh\nyarn add react-native-mmkv\ncd ios && pod install\n```\n\n### Expo\n\n```sh\nnpx expo install react-native-mmkv\nnpx expo prebuild\n```\n\n## Usage\n\n### Create a new instance\n\nTo create a new instance of the MMKV storage, use the `MMKV` constructor. It is recommended that you re-use this instance throughout your entire app instead of creating a new instance each time, so `export` the `storage` object.\n\n#### Default\n\n```js\nimport { MMKV } from 'react-native-mmkv'\n\nexport const storage = new MMKV()\n```\n\nThis creates a new storage instance using the default MMKV storage ID (`mmkv.default`).\n\n#### App Groups or Extensions\n\nIf you want to share MMKV data between your app and other apps or app extensions in the same group, open `Info.plist` and create an `AppGroup` key with your app group's value. MMKV will then automatically store data inside the app group which can be read and written to from other apps or app extensions in the same group by making use of MMKV's multi processing mode.\nSee [Configuring App Groups](https://developer.apple.com/documentation/xcode/configuring-app-groups).\n\n#### Customize\n\n```js\nimport { MMKV, Mode } from 'react-native-mmkv'\n\nexport const storage = new MMKV({\n  id: `user-${userId}-storage`,\n  path: `${USER_DIRECTORY}/storage`,\n  encryptionKey: 'hunter2',\n  mode: Mode.MULTI_PROCESS,\n  readOnly: false\n})\n```\n\nThis creates a new storage instance using a custom MMKV storage ID. By using a custom storage ID, your storage is separated from the default MMKV storage of your app.\n\nThe following values can be configured:\n\n* `id`: The MMKV instance's ID. If you want to use multiple instances, use different IDs. For example, you can separate the global app's storage and a logged-in user's storage. (required if `path` or `encryptionKey` fields are specified, otherwise defaults to: `'mmkv.default'`)\n* `path`: The MMKV instance's root path. By default, MMKV stores file inside `$(Documents)/mmkv/`. You can customize MMKV's root directory on MMKV initialization (documentation: [iOS](https://github.com/Tencent/MMKV/wiki/iOS_advance#customize-location) / [Android](https://github.com/Tencent/MMKV/wiki/android_advance#customize-location))\n* `encryptionKey`: The MMKV instance's encryption/decryption key. By default, MMKV stores all key-values in plain text on file, relying on iOS's/Android's sandbox to make sure the file is encrypted. Should you worry about information leaking, you can choose to encrypt MMKV. (documentation: [iOS](https://github.com/Tencent/MMKV/wiki/iOS_advance#encryption) / [Android](https://github.com/Tencent/MMKV/wiki/android_advance#encryption))\n* `mode`: The MMKV's process behaviour - when set to `MULTI_PROCESS`, the MMKV instance will assume data can be changed from the outside (e.g. App Clips, Extensions or App Groups).\n* `readOnly`: Whether this MMKV instance should be in read-only mode. This is typically more efficient and avoids unwanted writes to the data if not needed. Any call to `set(..)` will throw.\n\n### Set\n\n```js\nstorage.set('user.name', 'Marc')\nstorage.set('user.age', 21)\nstorage.set('is-mmkv-fast-asf', true)\n```\n\n### Get\n\n```js\nconst username = storage.getString('user.name') // 'Marc'\nconst age = storage.getNumber('user.age') // 21\nconst isMmkvFastAsf = storage.getBoolean('is-mmkv-fast-asf') // true\n```\n\n### Hooks\n\n```js\nconst [username, setUsername] = useMMKVString('user.name')\nconst [age, setAge] = useMMKVNumber('user.age')\nconst [isMmkvFastAsf, setIsMmkvFastAf] = useMMKVBoolean('is-mmkv-fast-asf')\n```\n\n### Keys\n\n```js\n// checking if a specific key exists\nconst hasUsername = storage.contains('user.name')\n\n// getting all keys\nconst keys = storage.getAllKeys() // ['user.name', 'user.age', 'is-mmkv-fast-asf']\n\n// delete a specific key + value\nstorage.delete('user.name')\n\n// delete all keys\nstorage.clearAll()\n```\n\n### Objects\n\n```js\nconst user = {\n  username: 'Marc',\n  age: 21\n}\n\n// Serialize the object into a JSON string\nstorage.set('user', JSON.stringify(user))\n\n// Deserialize the JSON string into an object\nconst jsonUser = storage.getString('user') // { 'username': 'Marc', 'age': 21 }\nconst userObject = JSON.parse(jsonUser)\n```\n\n### Encryption\n\n```js\n// encrypt all data with a private key\nstorage.recrypt('hunter2')\n\n// remove encryption\nstorage.recrypt(undefined)\n```\n\n### Buffers\n\n```js\nconst buffer = new ArrayBuffer(3)\nconst dataWriter = new Uint8Array(buffer)\ndataWriter[0] = 1\ndataWriter[1] = 100\ndataWriter[2] = 255\nstorage.set('someToken', buffer)\n\nconst buffer = storage.getBuffer('someToken')\nconsole.log(buffer) // [1, 100, 255]\n```\n\n### Size\n\n```js\n// get size of MMKV storage in bytes\nconst size = storage.size\nif (size >= 4096) {\n  // clean unused keys and clear memory cache\n  storage.trim()\n}\n```\n\n## Testing with Jest or Vitest\n\nA mocked MMKV instance is automatically used when testing with Jest or Vitest, so you will be able to use `new MMKV()` as per normal in your tests. Refer to [package/example/test/MMKV.test.ts](package/example/test/MMKV.test.ts) for an example using Jest.\n\n## Documentation\n\n* [Hooks](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/HOOKS.md)\n* [Value-change Listeners](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/LISTENERS.md)\n* [Migrate from AsyncStorage](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/MIGRATE_FROM_ASYNC_STORAGE.md)\n* [Using MMKV with redux-persist](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/WRAPPER_REDUX.md)\n* [Using MMKV with recoil](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/WRAPPER_RECOIL.md)\n* [Using MMKV with mobx-persist-storage](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/WRAPPER_MOBX.md)\n* [Using MMKV with mobx-persist](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/WRAPPER_MOBXPERSIST.md)\n* [Using MMKV with zustand persist-middleware](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/WRAPPER_ZUSTAND_PERSIST_MIDDLEWARE.md)\n* [Using MMKV with jotai](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/WRAPPER_JOTAI.md)\n* [Using MMKV with react-query](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/WRAPPER_REACT_QUERY.md)\n* [Using MMKV with Tinybase](https://github.com/mrousavy/react-native-mmkv/blob/v3/docs/WRAPPER_TINYBASE.md)\n* [How is this library different from **react-native-mmkv-storage**?](https://github.com/mrousavy/react-native-mmkv/issues/100#issuecomment-886477361)\n\n## LocalStorage and In-Memory Storage (Web)\n\nIf a user chooses to disable LocalStorage in their browser, the library will automatically provide a limited in-memory storage as an alternative. However, this in-memory storage won't persist data, and users may experience data loss if they refresh the page or close their browser. To optimize user experience, consider implementing a suitable solution within your app to address this scenario.\n\n## Limitations\n\n- react-native-mmkv V3 requires react-native 0.74 or higher.\n- react-native-mmkv V3 requires [the new architecture](https://reactnative.dev/docs/the-new-architecture/landing-page)/TurboModules to be enabled.\n- Since react-native-mmkv uses JSI for synchronous native method invocations, remote debugging (e.g. with Chrome) is no longer possible. Instead, you should use [Flipper](https://fbflipper.com) or [React DevTools](https://react.dev/learn/react-developer-tools).\n\n## Integrations\n\n### Flipper\n\nUse [flipper-plugin-react-native-mmkv](https://github.com/muchobien/flipper-plugin-react-native-mmkv) to debug your MMKV storage using Flipper. You can also simply `console.log` an MMKV instance.\n\n### Reactotron\n\nUse [reactotron-react-native-mmkv](https://www.npmjs.com/package/reactotron-react-native-mmkv) to automatically log writes to your MMKV storage using Reactotron. [See the docs for how to setup this plugin with Reactotron.](https://www.npmjs.com/package/reactotron-react-native-mmkv)\n\n## Community Discord\n\n[**Join the Margelo Community Discord**](https://margelo.com/discord) to chat about react-native-mmkv or other Margelo libraries.\n\n## Adopting at scale\n\nreact-native-mmkv is provided _as is_, I work on it in my free time.\n\nIf you're integrating react-native-mmkv in a production app, consider [funding this project](https://github.com/sponsors/mrousavy) and <a href=\"mailto:me@mrousavy.com?subject=Adopting react-native-mmkv at scale\">contact me</a> to receive premium enterprise support, help with issues, prioritize bugfixes, request features, help at integrating react-native-mmkv, and more.\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n## License\n\nMIT\n"
  },
  {
    "path": "babel.config.js",
    "content": "module.exports = {\n  presets: ['module:@react-native/babel-preset'],\n  env: {\n    test: {\n      presets: [\n        ['@babel/preset-env', { targets: { node: 'current' } }],\n        ['@babel/preset-react', { runtime: 'automatic' }],\n        '@babel/preset-typescript'\n      ]\n    }\n  }\n}\n"
  },
  {
    "path": "bunfig.toml",
    "content": "[test]\n# Configure bun test to only run tests in specific directories\n# This prevents bun test from interfering with Jest tests\nroot = \"packages/react-native-mmkv/__bun_tests__\"\n\n[install]\n# Opt out from isolated installs\nlinker = \"hoisted\""
  },
  {
    "path": "docs/HOOKS.md",
    "content": "# Hooks\n\nreact-native-mmkv provides an easy to use React-Hooks API to be used in Function Components.\n\n## Reactively use individual keys\n\n```tsx\nfunction App() {\n  const [username, setUsername] = useMMKVString(\"user.name\")\n  const [age, setAge] = useMMKVNumber(\"user.age\")\n  const [isPremiumUser, setIsPremiumUser] = useMMKVBoolean(\"user.isPremium\")\n  const [privateKey, setPrivateKey] = useMMKVBuffer(\"user.privateKey\")\n}\n```\n\n## Clear a key\n\n```tsx\nfunction App() {\n  const [username, setUsername] = useMMKVString(\"user.name\")\n  // ...\n  const onLogout = useCallback(() => {\n    setUsername(undefined)\n  }, [])\n}\n```\n\n## Objects\n\n```tsx\ntype User = {\n  id: string\n  username: string\n  age: number\n}\n\nfunction App() {\n  const [user, setUser] = useMMKVObject<User>(\"user\")\n}\n```\n\n## Reactively use an MMKV Instance\n\n```tsx\nfunction App() {\n  const storage = useMMKV()\n  // ...\n  const onLogin = useCallback((username) => {\n    storage.set(\"user.name\", \"Marc\")\n  }, [storage])\n}\n```\n\n## Reactively use individual keys from custom instances\n\n```tsx\nfunction App() {\n  const globalStorage = useMMKV()\n  const userStorage = useMMKV({ id: `${userId}.storage` })\n\n  const [username, setUsername] = useMMKVString(\"user.name\", userStorage)\n}\n```\n\n## Listen to value changes\n\n```tsx\nfunction App() {\n  useMMKVListener((key) => {\n    console.log(`Value for \"${key}\" changed!`)\n  })\n}\n```\n\n## Listen to value changes on a specific instance\n\n```tsx\nfunction App() {\n  const storage = useMMKV({ id: `${userId}.storage` })\n\n  useMMKVListener((key) => {\n    console.log(`Value for \"${key}\" changed in user storage!`)\n  }, storage)\n}\n```\n\n## Listen to all keys in an instance\n\n```tsx\nfunction App() {\n  const storage = useMMKV()\n  const keys = useMMKVKeys(storage)\n}\n```\n"
  },
  {
    "path": "docs/LISTENERS.md",
    "content": "# Listeners\n\nMMKV instances also contain an observer/listener registry.\n\n### Add a listener when a `key`'s `value` changes.\n\n```ts\nconst storage = createMMKV()\n\nconst listener = storage.addOnValueChangedListener((changedKey) => {\n  const newValue = storage.getString(changedKey)\n  console.log(`\"${changedKey}\" new value: ${newValue}`)\n})\n```\n\nDon't forget to remove the listener when no longer needed. For example, when the user logs out:\n\n```ts\nfunction SettingsScreen() {\n  // ...\n\n  const onLogout = useCallback(() => {\n    // ...\n    listener.remove()\n  }, [])\n\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/MIGRATE_FROM_ASYNC_STORAGE.md",
    "content": "# Migrate from AsyncStorage\n\nHere's a migration script to copy all values from AsyncStorage to MMKV, and delete them from AsyncStorage afterwards.\n\n<table>\n<tr>\n<th><code>storage.ts</code></th>\n</tr>\n<tr>\n<td>\n\n```ts\nimport AsyncStorage from '@react-native-async-storage/async-storage';\nimport { createMMKV } from 'react-native-mmkv';\n\nexport const storage = createMMKV();\n\n// TODO: Remove `hasMigratedFromAsyncStorage` after a while (when everyone has migrated)\nexport const hasMigratedFromAsyncStorage = storage.getBoolean(\n  'hasMigratedFromAsyncStorage',\n);\n\n// TODO: Remove `hasMigratedFromAsyncStorage` after a while (when everyone has migrated)\nexport async function migrateFromAsyncStorage(): Promise<void> {\n  console.log('Migrating from AsyncStorage -> MMKV...');\n  const start = global.performance.now();\n\n  const keys = await AsyncStorage.getAllKeys();\n\n  for (const key of keys) {\n    try {\n      const value = await AsyncStorage.getItem(key);\n\n      if (value != null) {\n        if (['true', 'false'].includes(value)) {\n          storage.set(key, value === 'true');\n        } else {\n          storage.set(key, value);\n        }\n\n        AsyncStorage.removeItem(key);\n      }\n    } catch (error) {\n      console.error(\n        `Failed to migrate key \"${key}\" from AsyncStorage to MMKV!`,\n        error,\n      );\n      throw error;\n    }\n  }\n\n  storage.set('hasMigratedFromAsyncStorage', true);\n\n  const end = global.performance.now();\n  console.log(`Migrated from AsyncStorage -> MMKV in ${end - start}ms!`);\n}\n```\n\n</td>\n</tr>\n</table>\n\n\n\n\n<table>\n<tr>\n<th><code>App.tsx</code></th>\n</tr>\n<tr>\n<td>\n\n```tsx\n...\nimport { hasMigratedFromAsyncStorage, migrateFromAsyncStorage } from './storage';\n...\n\nexport default function App() {\n  // TODO: Remove `hasMigratedFromAsyncStorage` after a while (when everyone has migrated)\n  const [hasMigrated, setHasMigrated] = useState(hasMigratedFromAsyncStorage);\n\n  ...\n\n  useEffect(() => {\n    if (!hasMigratedFromAsyncStorage) {\n      InteractionManager.runAfterInteractions(async () => {\n        try {\n          await migrateFromAsyncStorage()\n          setHasMigrated(true)\n        } catch (e) {\n          // TODO: fall back to AsyncStorage? Wipe storage clean and use MMKV? Crash app?\n        }\n      });\n    }\n  }, []);\n\n  if (!hasMigrated) {\n    // show loading indicator while app is migrating storage...\n    return (\n      <View style={{ justifyContent: 'center', alignItems: 'center' }}>\n        <ActivityIndicator color=\"black\" />\n      </View>\n    );\n  }\n\n  return (\n    <YourAppsCode />\n  );\n}\n```\n\n</td>\n</tr>\n</table>\n"
  },
  {
    "path": "docs/V4_UPGRADE_GUIDE.md",
    "content": "# V4 Upgrade Guide\n\nreact-native-mmkv v4 has been fully rewritten to [nitro](https://nitro.margelo.com), which greatly simplifies the codebase, optimized native calls, and optimized the implementation.\nIdeally, this means;\n\n- **Backwards compatible for old architecture** again thanks to Nitro 🥳\n- Easier to maintain, allows for PRs from people without JSI experience 🫂\n- Lightweight & fast native calls thanks to Nitro 🔥\n\nAlso, the core MMKV library is now consumed from the official distribution channels - that is **CocoaPods** on iOS, and **Gradle Prefabs** on Android.\nThis means you can use MMKV Core from _your native code_ again by just adding it to your `Podfile`/`build.gradle` dependencies!\n\n## Breaking changes\n\nThere have been a few breaking changes. This guide will help you migrate over from V3 to V4:\n\n### Nitro Modules dependency\n\nSince react-native-mmkv is now a Nitro Module, you need to install the [react-native-nitro-modules](https://github.com/mrousavy/nitro) core dependency in your app:\n\n```sh\nnpm install react-native-nitro-modules\n```\n\n> Nitro requires **react-native 0.75.0** or higher. See [the Troubleshooting guide](https://nitro.margelo.com/docs/troubleshooting) if you run into any issues.\n\n### `new MMKV(...)` -> `createMMKV(...)`\n\nThe `MMKV` JS-class no longer exists - instead it is now purely native. This means, you have to change your MMKV creation code:\n\n```diff\n- const storage = new MMKV()\n+ const storage = createMMKV()\n```\n\n### `.delete(...)` -> `.remove(...)`\n\nThe `MMKV.delete(...)` function has been renamed to `MMKV.remove(...)`, since `delete` is a reserved keyword in C++:\n\n```diff\n- storage.delete('my-key')\n+ storage.remove('my-key')\n```\n\n### `AppGroup` -> `AppGroupIdentifier`\n\nTo better comply with Apple's naming, I changed the `AppGroup` key to `AppGroupIdentifier`. If you used MMKV with App Groups, make sure you change the key in your `Info.plist`:\n\n```diff\n- <key>AppGroup</key>\n+ <key>AppGroupIdentifier</key>\n```\n\n\n## Troubleshooting\n\n### iOS build failed: `The following Swift pods cannot yet be integrated as static libraries`\n\nIf you get an iOS `pod install` error that looks like this:\n\n```\n⚠️  Something went wrong running `pod install` in the `ios` directory.\nCommand `pod install` failed.\n└─ Cause: The following Swift pods cannot yet be integrated as static libraries:\n\nThe Swift pod `NitroMmkv` depends upon `MMKVCore`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.\n```\n\n..you are likely on an old version of `MMKVCore`. Make sure to update to a version that includes [this PR](https://github.com/Tencent/MMKV/pull/1579) (v2.2.4 or higher), or add this to your `Podfile`:\n\n```rb\npod 'MMKVCore', :modular_headers => true\n```\n\nIf you are on the latest react-native-mmkv V4 version, it should include a working `MMKVCore` by default - so you shouldn't see this error unless you manually added a dependency on `MMKVCore`/`MMKV` to your `Podfile`.\n"
  },
  {
    "path": "docs/WRAPPER_JOTAI.md",
    "content": "# jotai wrapper\n\nIf you want to use MMKV with [Jotai](https://github.com/pmndrs/jotai), create the following `atomWithMMKV` function:\n\n```ts\nimport { atomWithStorage, createJSONStorage } from 'jotai/utils';\nimport { createMMKV } from 'react-native-mmkv';\n\nconst storage = createMMKV();\n\nfunction getItem(key: string): string | null {\n  const value = storage.getString(key)\n  return value ? value : null\n}\n\nfunction setItem(key: string, value: string): void {\n  storage.set(key, value)\n}\n\nfunction removeItem(key: string): void {\n  storage.remove(key);\n}\n\nfunction subscribe(\n  key: string,\n  callback: (value: string | null) => void\n): () => void {\n  const listener = (changedKey: string) => {\n    if (changedKey === key) {\n      callback(getItem(key))\n    }\n  }\n\n  const { remove } = storage.addOnValueChangedListener(listener)\n\n  return () => {\n    remove()\n  }\n}\n\nexport const atomWithMMKV = <T>(key: string, initialValue: T) =>\n  atomWithStorage<T>(\n    key,\n    initialValue,\n    createJSONStorage<T>(() => ({\n      getItem,\n      setItem,\n      removeItem,\n      subscribe,\n    })),\n    { getOnInit: true }\n  );\n```\n\nThen simply use `atomWithMMKV(..)` instead of `atom(..)` when creating an atom you'd like to persist accross app starts.\n\n```ts\nconst myAtom = atomWithMMKV('my-atom-key', 'value');\n```\n\n*Note:* `createJSONStorage` handles `JSON.stringify()`/`JSON.parse()` when setting and returning the stored value.\n\nSee the official Jotai doc here: https://jotai.org/docs/utils/atom-with-storage\n"
  },
  {
    "path": "docs/WRAPPER_MOBX.md",
    "content": "# mobx-persist-store wrapper\n\nIf you want to use MMKV with [mobx-persist-store](https://github.com/quarrant/mobx-persist-store), create the following `storage` object:\n\n```ts\nimport { configurePersistable } from 'mobx-persist-store'\nimport { createMMKV } from \"react-native-mmkv\"\n\nconst storage = createMMKV()\n\nconfigurePersistable({\n  storage: {\n    setItem: (key, data) => storage.set(key, data),\n    getItem: (key) => storage.getString(key),\n    removeItem: (key) => storage.remove(key),\n  },\n})\n```\n"
  },
  {
    "path": "docs/WRAPPER_MOBXPERSIST.md",
    "content": "# mobx-persist wrapper\n\nIf you want to use MMKV with [mobx-persist](https://github.com/pinqy520/mobx-persist), create the following `hydrate` function:\n\n```ts\nimport { create } from \"mobx-persist\"\nimport { createMMKV } from \"react-native-mmkv\"\n\nconst storage = createMMKV()\n\nconst mmkvStorage = {\n  clear: () => {\n    storage.clearAll()\n    return Promise.resolve()\n  },\n  setItem: (key, value) => {\n    storage.set(key, value)\n    return Promise.resolve(true)\n  },\n  getItem: (key) => {\n    const value = storage.getString(key)\n    return Promise.resolve(value)\n  },\n  removeItem: (key) => {\n    storage.remove(key)\n    return Promise.resolve()\n  },\n}\n\nconst hydrate = create({\n  storage: mmkvStorage,\n  jsonify: true,\n})\n\n```\n\nYou can see a full working example [here](https://github.com/riamon-v/rn-mmkv-with-mobxpersist)\n"
  },
  {
    "path": "docs/WRAPPER_REACT_QUERY.md",
    "content": "# react-query wrapper\n\nIf you want to use MMKV with [react-query](https://tanstack.com/query/latest/docs/framework/react/overview), follow further steps:\n\n1. Install `react-query` persist packages\n\n```sh\nyarn add @tanstack/query-async-storage-persister @tanstack/react-query-persist-client\n```\n\n2. Add next code into your app\n\n```ts\nimport { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister'\nimport { createMMKV } from \"react-native-mmkv\"\n\nconst storage = createMMKV();\n\nconst clientStorage = {\n  setItem: (key, value) => {\n    storage.set(key, value);\n  },\n  getItem: (key) => {\n    const value = storage.getString(key);\n    return value === undefined ? null : value;\n  },\n  removeItem: (key) => {\n    storage.remove(key);\n  },\n};\n\nexport const clientPersister = createAsyncStoragePersister({ storage: clientStorage });\n```\n\n3. Use created `clientPersister` in your root component (eg. `App.tsx`)\n\n```tsx\nimport { PersistQueryClientProvider } from '@tanstack/react-query-persist-client'\n\nconst App = () => {\n  return (\n    <PersistQueryClientProvider persistOptions={{ persister: clientPersister }}>\n      {...}\n    </PersistQueryClientProvider>\n  );\n};\n```\n\nFor more information check their official [docs](https://tanstack.com/query/latest/docs/framework/react/plugins/createAsyncStoragePersister)\n"
  },
  {
    "path": "docs/WRAPPER_RECOIL.md",
    "content": "# recoil storage wrapper\n\nIf you want to use MMKV with [recoil](https://recoiljs.org/), Use the following persist code:\n\n```tsx\nconst persistAtom = (key) => ({ setSelf, onSet }) => {\n  setSelf(() => {\n    let data = storage.getString(key);\n    if (data != null){\n      return JSON.parse(data);\n    } else {\n      return new DefaultValue();\n    }\n  });\n\n  onSet((newValue, _, isReset) => {\n    if (isReset) {\n      storage.remove(key);\n    } else {\n      storage.set(key, JSON.stringify(newValue));\n    }\n  });\n};\n```\n"
  },
  {
    "path": "docs/WRAPPER_REDUX.md",
    "content": "# redux-persist storage wrapper\n\nIf you want to use MMKV with [redux-persist](https://github.com/rt2zz/redux-persist), create the following `storage` object:\n\n```ts\nimport { Storage } from 'redux-persist'\nimport { createMMKV } from \"react-native-mmkv\"\n\nconst storage = createMMKV()\n\nexport const reduxStorage: Storage = {\n  setItem: (key, value) => {\n    storage.set(key, value)\n    return Promise.resolve(true)\n  },\n  getItem: (key) => {\n    const value = storage.getString(key)\n    return Promise.resolve(value)\n  },\n  removeItem: (key) => {\n    storage.remove(key)\n    return Promise.resolve()\n  },\n}\n```\n"
  },
  {
    "path": "docs/WRAPPER_TINYBASE.md",
    "content": "#  tinybase wrapper\n\nIf you want to use MMKV with [Tinybase](https://tinybase.org/api/persister-react-native-mmkv), follow these steps:\n\n```ts\nimport { createMMKV } from 'react-native-mmkv'\nimport { createStore } from 'tinybase';\nimport { createReactNativeMmkvPersister } from 'tinybase/persisters/persister-react-native-mmkv';\n\nconst storage = createMMKV()\nconst store = createStore().setTables({ pets: { fido: { species: 'dog' } } });\nconst persister = createReactNativeMmkvPersister(store, storage);\n\nawait persister.save();\n```\n\nSimilarly, to set up with the react hook:\n\n```tsx\nconst storage = createMMKV()\n\nconst App = () => {\n  useCreatePersister(\n    store,\n    store => createReactNativeMmkvPersister(store, storage),\n    [],\n    async persister => {\n      // ...\n    },\n  );\n}\n```\n\nFor more information check their official [docs](https://tinybase.org/api/persister-react-native-mmkv/functions/creation/createreactnativemmkvpersister/)\n"
  },
  {
    "path": "docs/WRAPPER_ZUSTAND_PERSIST_MIDDLEWARE.md",
    "content": "# zustand persist-middleware wrapper\n\nIf you want to use MMKV with [zustand persist-middleware](https://github.com/pmndrs/zustand#persist-middleware), create the following `storage` object:\n\n```ts\nimport { StateStorage } from 'zustand/middleware'\nimport { createMMKV } from 'react-native-mmkv'\n\nconst storage = createMMKV()\n\nconst zustandStorage: StateStorage = {\n  setItem: (name, value) => {\n    return storage.set(name, value)\n  },\n  getItem: (name) => {\n    const value = storage.getString(name)\n    return value ?? null\n  },\n  removeItem: (name) => {\n    return storage.remove(name)\n  },\n}\n```\n"
  },
  {
    "path": "example/.eslintrc.js",
    "content": "module.exports = {\n  root: true,\n  extends: '@react-native',\n};\n"
  },
  {
    "path": "example/.gitignore",
    "content": "# OSX\n#\n.DS_Store\n\n# Xcode\n#\nbuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!default.perspectivev3\nxcuserdata\n*.xccheckout\n*.moved-aside\nDerivedData\n*.hmap\n*.ipa\n*.xcuserstate\n**/.xcode.env.local\n\n# Android/IntelliJ\n#\nbuild/\n.idea\n.gradle\nlocal.properties\n*.iml\n*.hprof\n.cxx/\n*.keystore\n!debug.keystore\n.kotlin/\n\n# node.js\n#\nnode_modules/\nnpm-debug.log\nyarn-error.log\n\n# fastlane\n#\n# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the\n# screenshots whenever they are needed.\n# For more information about the recommended setup visit:\n# https://docs.fastlane.tools/best-practices/source-control/\n\n**/fastlane/report.xml\n**/fastlane/Preview.html\n**/fastlane/screenshots\n**/fastlane/test_output\n\n# Bundle artifact\n*.jsbundle\n\n# Ruby / CocoaPods\n**/Pods/\n/vendor/bundle/\n\n# Temporary files created by Metro to check the health of the file watcher\n.metro-health-check*\n\n# testing\n/coverage\n\n# Yarn\n.yarn/*\n!.yarn/patches\n!.yarn/plugins\n!.yarn/releases\n!.yarn/sdks\n!.yarn/versions\n"
  },
  {
    "path": "example/.prettierrc.js",
    "content": "module.exports = {\n  arrowParens: 'avoid',\n  singleQuote: true,\n  trailingComma: 'all',\n};\n"
  },
  {
    "path": "example/.watchmanconfig",
    "content": "{}\n"
  },
  {
    "path": "example/Gemfile",
    "content": "source 'https://rubygems.org'\n\n# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version\nruby \">= 2.6.10\"\n\n# Exclude problematic versions of cocoapods and activesupport that causes build failures.\ngem 'cocoapods', '>= 1.13', '!= 1.15.1', '!= 1.15.0'\ngem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'\ngem 'xcodeproj', '< 1.26.0'\ngem 'concurrent-ruby', '< 1.3.4'\n\n# Ruby 3.4.0 has removed some libraries from the standard library.\ngem 'bigdecimal'\ngem 'logger'\ngem 'benchmark'\ngem 'mutex_m'\n"
  },
  {
    "path": "example/README.md",
    "content": "This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).\n\n# Getting Started\n\n> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding.\n\n## Step 1: Start Metro\n\nFirst, you will need to run **Metro**, the JavaScript build tool for React Native.\n\nTo start the Metro dev server, run the following command from the root of your React Native project:\n\n```sh\n# Using npm\nnpm start\n\n# OR using Yarn\nyarn start\n```\n\n## Step 2: Build and run your app\n\nWith Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:\n\n### Android\n\n```sh\n# Using npm\nnpm run android\n\n# OR using Yarn\nyarn android\n```\n\n### iOS\n\nFor iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).\n\nThe first time you create a new project, run the Ruby bundler to install CocoaPods itself:\n\n```sh\nbundle install\n```\n\nThen, and every time you update your native dependencies, run:\n\n```sh\nbundle exec pod install\n```\n\nFor more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html).\n\n```sh\n# Using npm\nnpm run ios\n\n# OR using Yarn\nyarn ios\n```\n\nIf everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.\n\nThis is one way to run your app — you can also build it directly from Android Studio or Xcode.\n\n## Step 3: Modify your app\n\nNow that you have successfully run the app, let's make changes!\n\nOpen `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh).\n\nWhen you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:\n\n- **Android**: Press the <kbd>R</kbd> key twice or select **\"Reload\"** from the **Dev Menu**, accessed via <kbd>Ctrl</kbd> + <kbd>M</kbd> (Windows/Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (macOS).\n- **iOS**: Press <kbd>R</kbd> in iOS Simulator.\n\n## Congratulations! :tada:\n\nYou've successfully run and modified your React Native App. :partying_face:\n\n### Now what?\n\n- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).\n- If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started).\n\n# Troubleshooting\n\nIf you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.\n\n# Learn More\n\nTo learn more about React Native, take a look at the following resources:\n\n- [React Native Website](https://reactnative.dev) - learn more about React Native.\n- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.\n- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.\n- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.\n- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.\n"
  },
  {
    "path": "example/__tests__/MMKV.harness.ts",
    "content": "import {\n  describe,\n  it,\n  expect,\n  beforeEach,\n  afterEach,\n} from 'react-native-harness';\nimport { MMKV, createMMKV, deleteMMKV, existsMMKV } from 'react-native-mmkv';\n\nconst waitForNextTick = async () => {\n  await new Promise<void>(resolve => setTimeout(resolve, 0));\n};\n\ndescribe('MMKV Core Functionality', () => {\n  let storage: MMKV;\n\n  beforeEach(() => {\n    storage = createMMKV();\n    storage.clearAll(); // Start with clean state\n  });\n\n  afterEach(() => {\n    storage.clearAll(); // Clean up after each test\n  });\n\n  describe('Basic CRUD Operations', () => {\n    it('should store and retrieve string values correctly', () => {\n      const testKey = 'testString';\n      const testValue = 'Hello MMKV!';\n\n      storage.set(testKey, testValue);\n\n      expect(storage.getString(testKey)).toStrictEqual(testValue);\n      expect(storage.contains(testKey)).toBe(true);\n      expect(storage.getAllKeys()).toContain(testKey);\n    });\n\n    it('should store and retrieve number values correctly', () => {\n      const testKey = 'testNumber';\n      const testValue = 42.5;\n\n      storage.set(testKey, testValue);\n\n      expect(storage.getNumber(testKey)).toStrictEqual(testValue);\n      expect(storage.contains(testKey)).toBe(true);\n    });\n\n    it('should store and retrieve boolean values correctly', () => {\n      const testKey = 'testBoolean';\n\n      storage.set(testKey, true);\n      expect(storage.getBoolean(testKey)).toStrictEqual(true);\n\n      storage.set(testKey, false);\n      expect(storage.getBoolean(testKey)).toStrictEqual(false);\n    });\n\n    it('should store and retrieve values with correct types', () => {\n      storage.set('stringKey', 'value');\n      storage.set('numberKey', 123);\n      storage.set('booleanKey', true);\n\n      // Correct type access should work\n      expect(storage.getString('stringKey')).toStrictEqual('value');\n      expect(storage.getNumber('numberKey')).toStrictEqual(123);\n      expect(storage.getBoolean('booleanKey')).toStrictEqual(true);\n    });\n\n    it('should handle type interpretation from raw bytes', () => {\n      // MMKV stores raw bytes, so reading with wrong type may return interpreted values\n      // rather than undefined, depending on the underlying byte representation\n      storage.set('numberKey', 42);\n\n      // Reading a number as string/boolean may return some interpreted value\n      // We just verify it doesn't crash and returns something\n      const stringResult = storage.getString('numberKey');\n      const booleanResult = storage.getBoolean('numberKey');\n\n      // These may or may not be undefined depending on byte interpretation\n      expect(typeof stringResult).toBeDefined();\n      expect(typeof booleanResult).toBeDefined();\n\n      // But the correct type should still work\n      expect(storage.getNumber('numberKey')).toStrictEqual(42);\n    });\n\n    it('should remove values correctly', () => {\n      const testKey = 'removeTest';\n\n      storage.set(testKey, 'value');\n      expect(storage.contains(testKey)).toBe(true);\n\n      storage.remove(testKey);\n      expect(storage.contains(testKey)).toBe(false);\n      expect(storage.getString(testKey)).toBeUndefined();\n      expect(storage.getAllKeys()).not.toContain(testKey);\n    });\n\n    it('should clear all values correctly', () => {\n      storage.set('key1', 'value1');\n      storage.set('key2', 42);\n      storage.set('key3', true);\n\n      expect(storage.getAllKeys().length).toBeGreaterThan(0);\n\n      storage.clearAll();\n      expect(storage.getAllKeys()).toEqual([]);\n    });\n\n    it('should return undefined for non-existent keys', () => {\n      const nonExistentKey = 'doesNotExist';\n\n      expect(storage.getString(nonExistentKey)).toBeUndefined();\n      expect(storage.getNumber(nonExistentKey)).toBeUndefined();\n      expect(storage.getBoolean(nonExistentKey)).toBeUndefined();\n      expect(storage.getBuffer(nonExistentKey)).toBeUndefined();\n      expect(storage.contains(nonExistentKey)).toBe(false);\n    });\n  });\n\n  describe('Key Management', () => {\n    it('should handle getAllKeys correctly', () => {\n      const keys = ['key1', 'key2', 'key3'];\n\n      keys.forEach((key, index) => {\n        storage.set(key, `value${index}`);\n      });\n\n      const retrievedKeys = storage.getAllKeys();\n      keys.forEach(key => {\n        expect(retrievedKeys).toContain(key);\n      });\n    });\n\n    it('should handle special characters in keys', () => {\n      const specialKeys = [\n        'key with spaces',\n        'key-with-dashes',\n        'key_with_underscores',\n        'key.with.dots',\n        'key/with/slashes',\n        'émoji-key-🚀',\n      ];\n\n      specialKeys.forEach(key => {\n        storage.set(key, 'test value');\n        expect(storage.getString(key)).toStrictEqual('test value');\n        expect(storage.contains(key)).toBe(true);\n      });\n    });\n  });\n\n  describe('Value Overwriting', () => {\n    it('should overwrite existing values', () => {\n      const key = 'overwriteTest';\n\n      storage.set(key, 'original');\n      expect(storage.getString(key)).toStrictEqual('original');\n\n      storage.set(key, 'updated');\n      expect(storage.getString(key)).toStrictEqual('updated');\n    });\n\n    it('should handle type changes for the same key', () => {\n      const key = 'typeChangeTest';\n\n      storage.set(key, 'string value');\n      expect(storage.getString(key)).toStrictEqual('string value');\n\n      storage.set(key, 42);\n      expect(storage.getNumber(key)).toStrictEqual(42);\n\n      storage.set(key, true);\n      expect(storage.getBoolean(key)).toStrictEqual(true);\n    });\n  });\n\n  describe('Edge Cases', () => {\n    it('should handle empty string values', () => {\n      const key = 'emptyString';\n      storage.set(key, '');\n\n      expect(storage.getString(key)).toStrictEqual('');\n      expect(storage.contains(key)).toBe(true);\n    });\n\n    it('should handle zero and negative numbers', () => {\n      storage.set('zero', 0);\n      storage.set('negative', -42.5);\n\n      expect(storage.getNumber('zero')).toStrictEqual(0);\n      expect(storage.getNumber('negative')).toStrictEqual(-42.5);\n    });\n\n    it('should handle very long strings', () => {\n      const longString = 'A'.repeat(10000);\n      const key = 'longString';\n\n      storage.set(key, longString);\n      expect(storage.getString(key)).toStrictEqual(longString);\n    });\n\n    it('should handle many keys', () => {\n      const keyCount = 1000;\n      const keys: string[] = [];\n\n      for (let i = 0; i < keyCount; i++) {\n        const key = `key${i}`;\n        keys.push(key);\n        storage.set(key, i);\n      }\n\n      // Verify all keys exist\n      const allKeys = storage.getAllKeys();\n      expect(allKeys.length).toBeGreaterThanOrEqual(keyCount);\n\n      // Verify random samples\n      for (let i = 0; i < 10; i++) {\n        const randomIndex = Math.floor(Math.random() * keyCount);\n        const key = `key${randomIndex}`;\n        expect(storage.getNumber(key)).toStrictEqual(randomIndex);\n      }\n    });\n  });\n\n  describe('ArrayBuffer/Buffer Operations', () => {\n    it('should store and retrieve ArrayBuffer correctly', () => {\n      const key = 'bufferTest';\n      const data = new Uint8Array([1, 2, 3, 4, 5, 255]);\n      const buffer = data.buffer;\n\n      storage.set(key, buffer);\n\n      const retrieved = storage.getBuffer(key);\n      expect(retrieved).toBeDefined();\n      expect(retrieved!.byteLength).toStrictEqual(buffer.byteLength);\n\n      const retrievedArray = new Uint8Array(retrieved!);\n      expect(retrievedArray).toEqual(data);\n    });\n\n    it('should handle empty ArrayBuffer', () => {\n      const key = 'emptyBuffer';\n      const emptyBuffer = new ArrayBuffer(0);\n\n      storage.set(key, emptyBuffer);\n\n      const retrieved = storage.getBuffer(key);\n      expect(retrieved).toBeDefined();\n      expect(retrieved!.byteLength).toStrictEqual(0);\n    });\n\n    it('should handle large ArrayBuffer', () => {\n      const key = 'largeBuffer';\n      const size = 1024 * 1024; // 1MB\n      const data = new Uint8Array(size);\n\n      // Fill with pattern\n      for (let i = 0; i < size; i++) {\n        data[i] = i % 256;\n      }\n\n      storage.set(key, data.buffer);\n\n      const retrieved = storage.getBuffer(key);\n      expect(retrieved).toBeDefined();\n      expect(retrieved!.byteLength).toStrictEqual(size);\n\n      const retrievedArray = new Uint8Array(retrieved!);\n      // Check pattern at random positions\n      for (let i = 0; i < 100; i++) {\n        const pos = Math.floor(Math.random() * size);\n        expect(retrievedArray[pos]).toStrictEqual(pos % 256);\n      }\n    });\n\n    it('should handle different typed arrays', () => {\n      const int16Data = new Int16Array([1000, -1000, 32767, -32768]);\n      const float32Data = new Float32Array([3.14159, -2.718, 1.414]);\n      const uint32Data = new Uint32Array([0, 1, 4294967295]);\n\n      storage.set('int16', int16Data.buffer);\n      storage.set('float32', float32Data.buffer);\n      storage.set('uint32', uint32Data.buffer);\n\n      const int16Retrieved = new Int16Array(storage.getBuffer('int16')!);\n      const float32Retrieved = new Float32Array(storage.getBuffer('float32')!);\n      const uint32Retrieved = new Uint32Array(storage.getBuffer('uint32')!);\n\n      expect(int16Retrieved).toEqual(int16Data);\n      expect(float32Retrieved).toEqual(float32Data);\n      expect(uint32Retrieved).toEqual(uint32Data);\n    });\n\n    it('should handle buffer type interpretation', () => {\n      const key = 'bufferTypeTest';\n      const data = new Uint8Array([65, 66, 67]); // 'ABC' in ASCII\n\n      storage.set(key, data.buffer);\n\n      // Buffer should be retrievable as buffer\n      expect(storage.getBuffer(key)).toBeDefined();\n\n      // Other types may return interpreted values from the raw bytes\n      // We just verify they don't crash\n      const stringResult = storage.getString(key);\n      const numberResult = storage.getNumber(key);\n      const booleanResult = storage.getBoolean(key);\n\n      // These may or may not be undefined depending on byte interpretation\n      expect(() => stringResult).not.toThrow();\n      expect(() => numberResult).not.toThrow();\n      expect(() => booleanResult).not.toThrow();\n    });\n  });\n});\n\ndescribe('MMKV Configuration & Multiple Instances', () => {\n  afterEach(() => {\n    // Clean up all test instances\n    try {\n      createMMKV({ id: 'test-instance-1' }).clearAll();\n      createMMKV({ id: 'test-instance-2' }).clearAll();\n      createMMKV({ id: 'encrypted-instance' }).clearAll();\n    } catch {\n      // Instances might not exist, that's okay\n    }\n  });\n\n  describe('Instance Configuration', () => {\n    it('should create instances with different IDs', () => {\n      const storage1 = createMMKV({ id: 'test-instance-1' });\n      const storage2 = createMMKV({ id: 'test-instance-2' });\n\n      // Set values in different instances\n      storage1.set('shared-key', 'value-from-instance-1');\n      storage2.set('shared-key', 'value-from-instance-2');\n\n      // Values should be isolated\n      expect(storage1.getString('shared-key')).toStrictEqual(\n        'value-from-instance-1',\n      );\n      expect(storage2.getString('shared-key')).toStrictEqual(\n        'value-from-instance-2',\n      );\n    });\n\n    it('should handle default instance vs custom instance isolation', () => {\n      const defaultStorage = createMMKV();\n      const customStorage = createMMKV({ id: 'custom-test' });\n\n      const key = 'isolation-test';\n      defaultStorage.set(key, 'default-value');\n      customStorage.set(key, 'custom-value');\n\n      expect(defaultStorage.getString(key)).toStrictEqual('default-value');\n      expect(customStorage.getString(key)).toStrictEqual('custom-value');\n\n      // Clean up custom instance\n      customStorage.clearAll();\n    });\n\n    it('should reuse same instance for same configuration', () => {\n      const config = { id: 'reuse-test' };\n      const storage1 = createMMKV(config);\n      const storage2 = createMMKV(config);\n\n      storage1.set('test-key', 'test-value');\n\n      // Both references should point to same instance\n      expect(storage2.getString('test-key')).toStrictEqual('test-value');\n\n      // Clean up\n      storage1.clearAll();\n    });\n  });\n\n  describe('Instance Management', () => {\n    it('should handle multiple instances independently', () => {\n      const instances = Array.from({ length: 5 }, (_, i) =>\n        createMMKV({ id: `multi-instance-${i}` }),\n      );\n\n      // Set different values in each instance\n      instances.forEach((instance, i) => {\n        instance.set('instance-number', i);\n        instance.set('instance-name', `instance-${i}`);\n      });\n\n      // Verify isolation\n      instances.forEach((instance, i) => {\n        expect(instance.getNumber('instance-number')).toStrictEqual(i);\n        expect(instance.getString('instance-name')).toStrictEqual(\n          `instance-${i}`,\n        );\n      });\n\n      // Clean up\n      instances.forEach(instance => instance.clearAll());\n    });\n\n    it('should import other keys properly', () => {\n      const storage1 = createMMKV({ id: 'first-storage' })\n      const storage2 = createMMKV({ id: 'second-storage' })\n      storage1.clearAll()\n      storage2.clearAll()\n\n      expect(storage1.getAllKeys()).toEqual([])\n      expect(storage2.getAllKeys()).toEqual([])\n\n      storage1.set('key1', 'value1')\n      storage1.set('key2', 42)\n      storage1.set('key3', true)\n\n      expect(storage1.getAllKeys().length).toStrictEqual(3)\n      expect(storage2.getAllKeys().length).toStrictEqual(0)\n\n      storage2.importAllFrom(storage1)\n\n      expect(storage1.getAllKeys().length).toStrictEqual(3)\n      expect(storage2.getAllKeys().length).toStrictEqual(3)\n\n      expect(storage2.getString('key1')).toStrictEqual('value1')\n      expect(storage2.getNumber('key2')).toStrictEqual(42)\n      expect(storage2.getBoolean('key3')).toStrictEqual(true)\n    })\n\n    it('should handle instance properties correctly', () => {\n      const storage = createMMKV({ id: 'properties-test' });\n\n      // Initially empty\n      expect(storage.getAllKeys()).toEqual([]);\n\n      // Add some data\n      storage.set('key1', 'value1');\n      storage.set('key2', 42);\n\n      expect(typeof storage.length).toBe('number');\n      expect(storage.length).toStrictEqual(2);\n      expect(storage.getAllKeys().length).toStrictEqual(2);\n\n      // Clean up\n      storage.clearAll();\n    });\n  });\n});\n\ndescribe('MMKV Encryption & Security', () => {\n  afterEach(() => {\n    // Clean up encrypted instances\n    try {\n      createMMKV({ id: 'encrypted-test-128' }).clearAll();\n      createMMKV({ id: 'recrypt-test-128' }).clearAll();\n      createMMKV({ id: 'encrypted-test-256' }).clearAll();\n      createMMKV({ id: 'recrypt-test-256' }).clearAll();\n    } catch {\n      // Instances might not exist, that's okay\n    }\n  });\n\n  describe('Encryption (AES-128)', () => {\n    it('should create encrypted instance and store data', () => {\n      const encryptionKey = 'test-key-123456';\n      const storage = createMMKV({\n        id: 'encrypted-test-128',\n        encryptionKey,\n      });\n\n      storage.set('secret-data', 'confidential information');\n      storage.set('secret-number', 42);\n      storage.set('secret-boolean', true);\n\n      expect(storage.getString('secret-data')).toStrictEqual(\n        'confidential information',\n      );\n      expect(storage.getNumber('secret-number')).toStrictEqual(42);\n      expect(storage.getBoolean('secret-boolean')).toStrictEqual(true);\n    });\n\n    it('should isolate encrypted and non-encrypted instances', () => {\n      const plainStorage = createMMKV({ id: 'plain-test' });\n      const encryptedStorage = createMMKV({\n        id: 'encrypted-isolation-test-128',\n        encryptionKey: 'secret-key-456',\n      });\n\n      const key = 'shared-key';\n      plainStorage.set(key, 'plain-value');\n      encryptedStorage.set(key, 'encrypted-value');\n\n      expect(plainStorage.getString(key)).toStrictEqual('plain-value');\n      expect(encryptedStorage.getString(key)).toStrictEqual('encrypted-value');\n\n      // Clean up\n      plainStorage.clearAll();\n      encryptedStorage.clearAll();\n    });\n\n    it('should handle recryption', () => {\n      const storage = createMMKV({ id: 'recrypt-test-128' });\n\n      expect(storage.isEncrypted).toStrictEqual(false)\n\n      // Set data without encryption\n      storage.set('data-key', 'original-data');\n      expect(storage.getString('data-key')).toStrictEqual('original-data');\n\n      // Encrypt the storage\n      storage.encrypt('new-encryption-key');\n      expect(storage.isEncrypted).toStrictEqual(true)\n      expect(storage.getString('data-key')).toStrictEqual('original-data');\n\n      // Change encryption key\n      storage.encrypt('different-key-123');\n      expect(storage.isEncrypted).toStrictEqual(true)\n      expect(storage.getString('data-key')).toStrictEqual('original-data');\n\n      // Remove encryption\n      storage.decrypt();\n      expect(storage.isEncrypted).toStrictEqual(false)\n      expect(storage.getString('data-key')).toStrictEqual('original-data');\n    });\n\n    it('should handle encryption key validation', () => {\n      // Test maximum key length (16 bytes)\n      const maxKey = '1234567890123456'; // exactly 16 characters\n      const storage = createMMKV({\n        id: 'key-validation-test',\n        encryptionKey: maxKey,\n      });\n\n      expect(storage.isEncrypted).toStrictEqual(true)\n      storage.set('test', 'value');\n      expect(storage.getString('test')).toStrictEqual('value');\n\n      storage.clearAll();\n    });\n  });\n\n  describe('Encryption (AES-256)', () => {\n    it('should create encrypted instance and store data', () => {\n      const encryptionKey = 'test-key-123456-longer-than-16';\n      const storage = createMMKV({\n        id: 'encrypted-test-256',\n        encryptionKey,\n        encryptionType: 'AES-256',\n      });\n\n      storage.set('secret-data', 'confidential information');\n      storage.set('secret-number', 42);\n      storage.set('secret-boolean', true);\n\n      expect(storage.getString('secret-data')).toStrictEqual(\n        'confidential information',\n      );\n      expect(storage.getNumber('secret-number')).toStrictEqual(42);\n      expect(storage.getBoolean('secret-boolean')).toStrictEqual(true);\n    });\n\n    it('should isolate encrypted and non-encrypted instances', () => {\n      const plainStorage = createMMKV({ id: 'plain-test' });\n      const encryptedStorage = createMMKV({\n        id: 'encrypted-isolation-test-256',\n        encryptionKey: 'secret-key-456',\n        encryptionType: 'AES-256',\n      });\n\n      const key = 'shared-key';\n      plainStorage.set(key, 'plain-value');\n      encryptedStorage.set(key, 'encrypted-value');\n\n      expect(plainStorage.getString(key)).toStrictEqual('plain-value');\n      expect(encryptedStorage.getString(key)).toStrictEqual('encrypted-value');\n\n      // Clean up\n      plainStorage.clearAll();\n      encryptedStorage.clearAll();\n    });\n\n    it('should handle recryption', () => {\n      // TODO: Add encryptionType to recrypt\n      const storage = createMMKV({ id: 'recrypt-test-256' });\n      expect(storage.isEncrypted).toStrictEqual(false)\n\n      // Set data without encryption\n      storage.set('data-key', 'original-data');\n      expect(storage.getString('data-key')).toStrictEqual('original-data');\n\n      // Encrypt the storage\n      storage.encrypt('new-encryption-key', 'AES-256');\n      expect(storage.isEncrypted).toStrictEqual(true)\n      expect(storage.getString('data-key')).toStrictEqual('original-data');\n\n      // Change encryption key\n      storage.encrypt('different-key-123', 'AES-256');\n      expect(storage.isEncrypted).toStrictEqual(true)\n      expect(storage.getString('data-key')).toStrictEqual('original-data');\n\n      // Remove encryption\n      storage.decrypt()\n      expect(storage.isEncrypted).toStrictEqual(false)\n      expect(storage.getString('data-key')).toStrictEqual('original-data');\n    });\n\n    it('should handle encryption key validation', () => {\n      // Test maximum key length (32 bytes)\n      const maxKey = '12345678901234561234567890123456'; // exactly 32 characters\n      const storage = createMMKV({\n        id: 'key-validation-test',\n        encryptionKey: maxKey,\n        encryptionType: 'AES-256',\n      });\n\n      storage.set('test', 'value');\n      expect(storage.getString('test')).toStrictEqual('value');\n\n      storage.clearAll();\n    });\n  });\n});\n\ndescribe('MMKV Read-Only Mode', () => {\n  // Note: MMKV caches instances by ID, so once an ID is opened with a given\n  // mode it cannot be reopened with a different mode in the same process.\n  // These tests use an ID that is only ever opened as read-only.\n\n  it('should report isReadOnly as true', () => {\n    const storage = createMMKV({ id: 'read-only-fresh-test', readOnly: true });\n    expect(storage.isReadOnly).toStrictEqual(true);\n  });\n\n  it('should report isReadOnly as false for writable instance', () => {\n    const storage = createMMKV({ id: 'writable-mode-test' });\n    expect(storage.isReadOnly).toStrictEqual(false);\n    storage.clearAll();\n  });\n\n  it('should throw when trying to set a value', () => {\n    const storage = createMMKV({ id: 'read-only-set-test', readOnly: true });\n    expect(() => storage.set('key', 'value')).toThrow();\n  });\n\n  it('should not remove values in read-only mode', () => {\n    const storage = createMMKV({ id: 'read-only-remove-test', readOnly: true });\n    // MMKV silently no-ops remove on read-only instances\n    expect(storage.remove('key')).toStrictEqual(false);\n  });\n\n  it('should not clear values in read-only mode', () => {\n    const storage = createMMKV({ id: 'read-only-clear-test', readOnly: true });\n    // MMKV silently no-ops clearAll on read-only instances\n    storage.clearAll();\n    expect(storage.length).toStrictEqual(0);\n  });\n\n  it('should support contains and getAllKeys on empty read-only instance', () => {\n    const storage = createMMKV({ id: 'read-only-keys-test', readOnly: true });\n\n    expect(storage.contains('nonexistent')).toBe(false);\n    expect(storage.getAllKeys()).toEqual([]);\n    expect(storage.length).toStrictEqual(0);\n  });\n});\n\n\ndescribe('MMKV Compare Before Set', () => {\n  afterEach(() => {\n    try {\n      createMMKV({ id: 'compare-before-set-test' }).clearAll();\n      createMMKV({ id: 'compare-disabled-test' }).clearAll();\n    } catch {\n      // Instances might not exist, that's okay\n    }\n  });\n\n  it('should create instance with compareBeforeSet enabled', () => {\n    const storage = createMMKV({\n      id: 'compare-before-set-test',\n      compareBeforeSet: true,\n    });\n\n    storage.set('key', 'value');\n    expect(storage.getString('key')).toStrictEqual('value');\n\n    storage.set('key', 'updated');\n    expect(storage.getString('key')).toStrictEqual('updated');\n  });\n\n  it('should create instance with compareBeforeSet disabled', () => {\n    const storage = createMMKV({\n      id: 'compare-disabled-test',\n      compareBeforeSet: false,\n    });\n\n    storage.set('key', 'value');\n    expect(storage.getString('key')).toStrictEqual('value');\n\n    storage.set('key', 'updated');\n    expect(storage.getString('key')).toStrictEqual('updated');\n  });\n\n  it('should not change byteSize when setting same value with compareBeforeSet', () => {\n    const storage = createMMKV({\n      id: 'compare-before-set-test',\n      compareBeforeSet: true,\n    });\n\n    storage.set('str', 'hello');\n    storage.set('num', 42);\n    storage.set('bool', true);\n    storage.set('buf', new Uint8Array([1, 2, 3]).buffer);\n\n    const sizeAfterInitialSet = storage.byteSize;\n\n    // Set same values again\n    storage.set('str', 'hello');\n    storage.set('num', 42);\n    storage.set('bool', true);\n    storage.set('buf', new Uint8Array([1, 2, 3]).buffer);\n\n    // byteSize should not have changed\n    expect(storage.byteSize).toStrictEqual(sizeAfterInitialSet);\n  });\n\n  it('should change byteSize when setting a different value with compareBeforeSet', () => {\n    const storage = createMMKV({\n      id: 'compare-before-set-test',\n      compareBeforeSet: true,\n    });\n\n    storage.set('key', 'short');\n    const sizeAfterInitialSet = storage.byteSize;\n\n    // Set a longer value - byteSize should increase\n    storage.set('key', 'a much longer string value that takes more space');\n    expect(storage.byteSize).toBeGreaterThan(sizeAfterInitialSet);\n  });\n});\n\ndescribe('MMKV Storage Management', () => {\n  let storage: MMKV;\n\n  beforeEach(() => {\n    storage = createMMKV({ id: 'storage-management-test' });\n    storage.clearAll();\n  });\n\n  afterEach(() => {\n    storage.clearAll();\n  });\n\n  describe('Storage Size & Management', () => {\n    it('should track storage byte size correctly', () => {\n      const initialSize = storage.byteSize;\n\n      storage.set('test-key', 'test-value');\n      expect(storage.byteSize).toBeGreaterThan(initialSize);\n\n      const sizeAfterSet = storage.byteSize;\n\n      storage.set('another-key', 'another-value');\n      expect(storage.byteSize).toBeGreaterThan(sizeAfterSet);\n    });\n\n    it('should track storage key length correctly', () => {\n      const initialLength = storage.length;\n\n      storage.set('test-key', 'test-value');\n      expect(storage.length).toStrictEqual(initialLength + 1);\n\n      const lengthAfterSet = storage.length;\n\n      storage.set('another-key', 'another-value');\n      expect(storage.length).toBeGreaterThan(lengthAfterSet);\n    });\n\n    it('should handle trim operation', () => {\n      // Add some data\n      for (let i = 0; i < 100; i++) {\n        storage.set(`key-${i}`, `value-${i}`);\n      }\n\n      const sizeBeforeTrim = storage.byteSize;\n      expect(sizeBeforeTrim).toBeGreaterThan(0);\n\n      // Remove half the data\n      for (let i = 0; i < 50; i++) {\n        storage.remove(`key-${i}`);\n      }\n\n      // Trim should clean up unused space\n      storage.trim();\n\n      // Verify remaining data is still accessible\n      for (let i = 50; i < 100; i++) {\n        expect(storage.getString(`key-${i}`)).toStrictEqual(`value-${i}`);\n      }\n    });\n\n    it('should handle clearAll correctly', () => {\n      // Add various types of data\n      storage.set('string-key', 'string-value');\n      storage.set('number-key', 123.456);\n      storage.set('boolean-key', true);\n      storage.set('buffer-key', new Uint8Array([1, 2, 3]).buffer);\n\n      expect(storage.getAllKeys().length).toStrictEqual(4);\n      expect(storage.byteSize).toBeGreaterThan(0);\n      expect(storage.length).toBeGreaterThan(0);\n\n      storage.clearAll();\n\n      expect(storage.getAllKeys()).toEqual([]);\n      expect(storage.contains('string-key')).toBe(false);\n      expect(storage.contains('number-key')).toBe(false);\n      expect(storage.contains('boolean-key')).toBe(false);\n      expect(storage.contains('buffer-key')).toBe(false);\n      expect(storage.length).toBe(0)\n    });\n\n    it('should handle storage operations after clearAll', () => {\n      // Add data, clear, then add again\n      storage.set('initial-key', 'initial-value');\n      expect(storage.getString('initial-key')).toStrictEqual('initial-value');\n\n      storage.clearAll();\n      expect(storage.getString('initial-key')).toBeUndefined();\n\n      storage.set('new-key', 'new-value');\n      expect(storage.getString('new-key')).toStrictEqual('new-value');\n      expect(storage.getAllKeys()).toEqual(['new-key']);\n    });\n  });\n\n  describe('Performance & Stress Tests', () => {\n    it('should handle rapid consecutive operations', () => {\n      const iterations = 1000;\n\n      // Rapid writes\n      for (let i = 0; i < iterations; i++) {\n        storage.set(`rapid-${i}`, i);\n      }\n\n      // Rapid reads\n      for (let i = 0; i < iterations; i++) {\n        expect(storage.getNumber(`rapid-${i}`)).toStrictEqual(i);\n      }\n\n      // Rapid removes\n      for (let i = 0; i < iterations; i += 2) {\n        storage.remove(`rapid-${i}`);\n      }\n\n      // Verify remaining data\n      for (let i = 1; i < iterations; i += 2) {\n        expect(storage.getNumber(`rapid-${i}`)).toStrictEqual(i);\n      }\n    });\n\n    it('should handle mixed operations efficiently', () => {\n      const operations = 500;\n\n      for (let i = 0; i < operations; i++) {\n        // Mix of different operations\n        storage.set(`mixed-string-${i}`, `value-${i}`);\n        storage.set(`mixed-number-${i}`, i * 1.5);\n        storage.set(`mixed-boolean-${i}`, i % 2 === 0);\n\n        if (i % 10 === 0) {\n          storage.getAllKeys();\n          storage.trim();\n        }\n\n        if (i % 3 === 0) {\n          storage.contains(`mixed-string-${i}`);\n        }\n      }\n\n      // Verify data integrity\n      const keys = storage.getAllKeys();\n      expect(keys.length).toBeGreaterThan(operations * 2); // At least 2/3 of the keys should exist\n\n      // Random verification\n      for (let i = 0; i < 50; i++) {\n        const randomIndex = Math.floor(Math.random() * operations);\n        expect(storage.getString(`mixed-string-${randomIndex}`)).toStrictEqual(\n          `value-${randomIndex}`,\n        );\n        expect(storage.getNumber(`mixed-number-${randomIndex}`)).toStrictEqual(\n          randomIndex * 1.5,\n        );\n        expect(\n          storage.getBoolean(`mixed-boolean-${randomIndex}`),\n        ).toStrictEqual(randomIndex % 2 === 0);\n      }\n    });\n  });\n});\n\n\ndescribe('MMKV Multi-Process Mode', () => {\n  afterEach(() => {\n    try {\n      createMMKV({ id: 'multi-process-test' }).clearAll();\n    } catch {\n      // Instance might not exist, that's okay\n    }\n  });\n\n  it('should create an instance in multi-process mode', () => {\n    const storage = createMMKV({\n      id: 'multi-process-test',\n      mode: 'multi-process',\n    });\n\n    storage.set('key', 'value');\n    expect(storage.getString('key')).toStrictEqual('value');\n  });\n\n  it('should store and retrieve all value types in multi-process mode', () => {\n    const storage = createMMKV({\n      id: 'multi-process-test',\n      mode: 'multi-process',\n    });\n\n    storage.set('str', 'hello');\n    storage.set('num', 3.14);\n    storage.set('bool', true);\n    storage.set('buf', new Uint8Array([10, 20, 30]).buffer);\n\n    expect(storage.getString('str')).toStrictEqual('hello');\n    expect(storage.getNumber('num')).toStrictEqual(3.14);\n    expect(storage.getBoolean('bool')).toStrictEqual(true);\n    expect(new Uint8Array(storage.getBuffer('buf')!)).toEqual(\n      new Uint8Array([10, 20, 30])\n    );\n  });\n\n  it('should support remove, contains and clearAll in multi-process mode', () => {\n    const storage = createMMKV({\n      id: 'multi-process-test',\n      mode: 'multi-process',\n    });\n\n    storage.set('a', 'one');\n    storage.set('b', 'two');\n    expect(storage.contains('a')).toBe(true);\n\n    storage.remove('a');\n    expect(storage.contains('a')).toBe(false);\n    expect(storage.getString('b')).toStrictEqual('two');\n\n    storage.clearAll();\n    expect(storage.getAllKeys()).toEqual([]);\n  });\n\n  it('should support encryption in multi-process mode', () => {\n    const storage = createMMKV({\n      id: 'multi-process-encrypted-test',\n      mode: 'multi-process',\n      encryptionKey: 'secret-key-12345',\n    });\n\n    storage.set('secret', 'data');\n    expect(storage.getString('secret')).toStrictEqual('data');\n    expect(storage.isEncrypted).toStrictEqual(true);\n\n    storage.clearAll();\n  });\n});\n\ndescribe('MMKV Listeners & Observers', () => {\n  let storage: MMKV;\n\n  beforeEach(() => {\n    storage = createMMKV({ id: 'listener-test' });\n    storage.clearAll();\n  });\n\n  afterEach(() => {\n    storage.clearAll();\n  });\n\n  describe('Value Change Listeners', () => {\n    it('should trigger listeners on value changes', async () => {\n      const changedKeys: string[] = [];\n\n      const listener = storage.addOnValueChangedListener(key => {\n        changedKeys.push(key);\n      });\n\n      storage.set('test-key-1', 'value1');\n      storage.set('test-key-2', 42);\n      storage.set('test-key-3', true);\n\n      // Wait for the listeners to trigger\n      await waitForNextTick();\n\n      expect(changedKeys).toContain('test-key-1');\n      expect(changedKeys).toContain('test-key-2');\n      expect(changedKeys).toContain('test-key-3');\n\n      listener.remove();\n    });\n\n    it('should trigger listeners on value updates', async () => {\n      const changedKeys: string[] = [];\n\n      const listener = storage.addOnValueChangedListener(key => {\n        changedKeys.push(key);\n      });\n\n      const testKey = 'update-test';\n      storage.set(testKey, 'original');\n      storage.set(testKey, 'updated');\n      storage.set(testKey, 'final');\n\n      // Wait for the listeners to trigger\n      await waitForNextTick();\n\n      const keyChanges = changedKeys.filter(k => k === testKey);\n      expect(keyChanges.length).toStrictEqual(3);\n\n      listener.remove();\n    });\n\n    it('should trigger listeners on value removal', async () => {\n      const changedKeys: string[] = [];\n\n      const listener = storage.addOnValueChangedListener(key => {\n        changedKeys.push(key);\n      });\n\n      const testKey = 'remove-test';\n      storage.set(testKey, 'value');\n\n      await waitForNextTick();\n      storage.remove(testKey);\n\n      // Wait for the listeners to trigger\n      await waitForNextTick();\n\n      expect(changedKeys.filter(k => k === testKey).length).toStrictEqual(2);\n\n      listener.remove();\n    });\n\n    it('should handle multiple listeners correctly', async () => {\n      const listener1Changes: string[] = [];\n      const listener2Changes: string[] = [];\n\n      const listener1 = storage.addOnValueChangedListener(key => {\n        listener1Changes.push(key);\n      });\n\n      const listener2 = storage.addOnValueChangedListener(key => {\n        listener2Changes.push(key);\n      });\n\n      storage.set('multi-listener-test', 'value');\n\n      // Wait for the listeners to trigger\n      await waitForNextTick();\n\n      expect(listener1Changes).toContain('multi-listener-test');\n      expect(listener2Changes).toContain('multi-listener-test');\n\n      listener1.remove();\n      listener2.remove();\n    });\n\n    it('should stop triggering after listener removal', async () => {\n      const changedKeys: string[] = [];\n\n      const listener = storage.addOnValueChangedListener(key => {\n        changedKeys.push(key);\n      });\n\n      storage.set('before-removal', 'value');\n\n      // Wait for the listeners to trigger\n      await waitForNextTick();\n\n      expect(changedKeys).toContain('before-removal');\n\n      listener.remove();\n\n      storage.set('after-removal', 'value');\n\n      // Wait for potential listeners to trigger (but they shouldn't)\n      await waitForNextTick();\n\n      expect(changedKeys).not.toContain('after-removal');\n    });\n\n    it('should handle listener removal multiple times safely', () => {\n      const listener = storage.addOnValueChangedListener(() => { });\n\n      // Should not throw errors\n      listener.remove();\n      listener.remove();\n      listener.remove();\n    });\n\n    it('should not trigger listeners for clearAll', async () => {\n      const changedKeys: string[] = [];\n\n      const listener = storage.addOnValueChangedListener(key => {\n        changedKeys.push(key);\n      });\n\n      storage.set('key1', 'value1');\n      storage.set('key2', 'value2');\n\n      // Wait for the listeners to trigger\n      await waitForNextTick();\n\n      storage.clearAll();\n\n      // Wait for the listeners to trigger\n      await waitForNextTick();\n\n      // We did 2x set and a clearAll (clears 2x keys)\n      expect(changedKeys.length).toStrictEqual(4);\n\n      listener.remove();\n    });\n  });\n});\n\ndescribe('Deleting instances and checking if they exist', () => {\n  beforeEach(() => {\n    deleteMMKV('some-instance')\n    deleteMMKV('some-non-existing-instance')\n  })\n\n  describe('Checking if an instance exists', () => {\n    it('should exist', () => {\n      createMMKV({ id: 'some-instance' })\n      const exists = existsMMKV('some-instance')\n      expect(exists).toStrictEqual(true)\n    })\n\n    it('should not exist', () => {\n      const exists = existsMMKV('some-non-existing-instance')\n      expect(exists).toStrictEqual(false)\n    })\n  })\n\n  describe('Deleting an instance', () => {\n    it('should delete properly', () => {\n      createMMKV({ id: 'some-instance' })\n      const wasDeleted = deleteMMKV('some-instance')\n      expect(wasDeleted).toStrictEqual(true)\n    })\n\n    it('should delete properly and exists should be false', () => {\n      createMMKV({ id: 'some-instance' })\n      const wasDeleted = deleteMMKV('some-instance')\n      expect(wasDeleted).toStrictEqual(true)\n      const exists = existsMMKV('some-instance')\n      expect(exists).toStrictEqual(false)\n    })\n\n    it('should not delete', () => {\n      const wasDeleted = deleteMMKV('some-non-existing-instance')\n      expect(wasDeleted).toStrictEqual(false)\n    })\n  })\n})\n\ndescribe('MMKV Error Handling & Edge Cases', () => {\n  let storage: MMKV;\n\n  beforeEach(() => {\n    storage = createMMKV({ id: 'error-handling-test' });\n    storage.clearAll();\n  });\n\n  afterEach(() => {\n    storage.clearAll();\n  });\n\n  describe('Error Scenarios', () => {\n    it('should handle invalid key operations gracefully', () => {\n      // Empty string key should throw\n      expect(() => {\n        storage.set('', 'empty-key-value');\n      }).toThrow()\n    });\n\n    it('should handle concurrent operations', () => {\n      // Simulate concurrent operations\n      const promises = [];\n\n      for (let i = 0; i < 100; i++) {\n        promises.push(\n          Promise.resolve().then(() => {\n            storage.set(`concurrent-${i}`, i);\n            return storage.getNumber(`concurrent-${i}`);\n          }),\n        );\n      }\n\n      return Promise.all(promises).then(results => {\n        results.forEach((value, index) => {\n          expect(value).toStrictEqual(index);\n        });\n      });\n    });\n\n    it('should handle Unicode and special characters', () => {\n      const unicodeTests = [\n        { key: 'emoji', value: '🚀🎉✨' },\n        { key: 'chinese', value: '你好世界' },\n        { key: 'arabic', value: 'مرحبا بالعالم' },\n        { key: 'russian', value: 'Привет мир' },\n        { key: 'japanese', value: 'こんにちは世界' },\n        { key: 'mixed', value: 'Hello 🌍 नमस्ते 🙏' },\n      ];\n\n      unicodeTests.forEach(test => {\n        storage.set(test.key, test.value);\n        expect(storage.getString(test.key)).toStrictEqual(test.value);\n      });\n    });\n\n    it('should handle extreme number values', () => {\n      const extremeNumbers = [\n        { key: 'max-safe', value: Number.MAX_SAFE_INTEGER },\n        { key: 'min-safe', value: Number.MIN_SAFE_INTEGER },\n        { key: 'max-value', value: Number.MAX_VALUE },\n        { key: 'min-value', value: Number.MIN_VALUE },\n        { key: 'infinity', value: Infinity },\n        { key: 'negative-infinity', value: -Infinity },\n        { key: 'nan', value: NaN },\n      ];\n\n      extremeNumbers.forEach(test => {\n        storage.set(test.key, test.value);\n        const retrieved = storage.getNumber(test.key);\n\n        if (isNaN(test.value)) {\n          expect(isNaN(retrieved!)).toBe(true);\n        } else {\n          expect(retrieved).toStrictEqual(test.value);\n        }\n      });\n    });\n\n    it('should maintain data integrity across operations', () => {\n      // Create a complex data set\n      const testData = {\n        strings: Array.from({ length: 50 }, (_, i) => ({\n          key: `str-${i}`,\n          value: `string-value-${i}`,\n        })),\n        numbers: Array.from({ length: 50 }, (_, i) => ({\n          key: `num-${i}`,\n          value: Math.random() * 1000,\n        })),\n        booleans: Array.from({ length: 50 }, (_, i) => ({\n          key: `bool-${i}`,\n          value: i % 2 === 0,\n        })),\n      };\n\n      // Set all data\n      [...testData.strings, ...testData.numbers, ...testData.booleans].forEach(\n        item => {\n          storage.set(item.key, item.value);\n        },\n      );\n\n      // Perform random operations\n      for (let i = 0; i < 100; i++) {\n        const operation = Math.floor(Math.random() * 4);\n        switch (operation) {\n          case 0: // Random read\n            const randomKey = `str-${Math.floor(Math.random() * 50)}`;\n            storage.getString(randomKey);\n            break;\n          case 1: // Random update\n            const updateKey = `num-${Math.floor(Math.random() * 50)}`;\n            storage.set(updateKey, Math.random() * 2000);\n            break;\n          case 2: // Check contains\n            const checkKey = `bool-${Math.floor(Math.random() * 50)}`;\n            storage.contains(checkKey);\n            break;\n          case 3: // Get all keys\n            storage.getAllKeys();\n            break;\n        }\n      }\n\n      // Verify data integrity for strings and booleans (numbers were updated)\n      testData.strings.forEach(item => {\n        expect(storage.getString(item.key)).toStrictEqual(item.value);\n      });\n\n      testData.booleans.forEach(item => {\n        expect(storage.getBoolean(item.key)).toStrictEqual(item.value);\n      });\n\n      // Verify all keys still exist\n      const allKeys = storage.getAllKeys();\n      expect(allKeys.length).toStrictEqual(150);\n    });\n  });\n});\n"
  },
  {
    "path": "example/android/app/build.gradle",
    "content": "apply plugin: \"com.android.application\"\napply plugin: \"org.jetbrains.kotlin.android\"\napply plugin: \"com.facebook.react\"\n\n/**\n * This is the configuration block to customize your React Native Android app.\n * By default you don't need to apply any configuration, just uncomment the lines you need.\n */\nreact {\n    /* Folders */\n    //   The root of your project, i.e. where \"package.json\" lives. Default is '../..'\n    // root = file(\"../../\")\n    //   The folder where the react-native NPM package is. Default is ../../node_modules/react-native\n    reactNativeDir = file(\"../../../node_modules/react-native\")\n    //   The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen\n    codegenDir = file(\"../../../node_modules/@react-native/codegen\")\n    //   The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js\n    cliFile = file(\"../../../node_modules/react-native/cli.js\")\n\n    /* Variants */\n    //   The list of variants to that are debuggable. For those we're going to\n    //   skip the bundling of the JS bundle and the assets. By default is just 'debug'.\n    //   If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.\n    // debuggableVariants = [\"liteDebug\", \"prodDebug\"]\n\n    /* Bundling */\n    //   A list containing the node command and its flags. Default is just 'node'.\n    // nodeExecutableAndArgs = [\"node\"]\n    //\n    //   The command to run when bundling. By default is 'bundle'\n    // bundleCommand = \"ram-bundle\"\n    //\n    //   The path to the CLI configuration file. Default is empty.\n    // bundleConfig = file(../rn-cli.config.js)\n    //\n    //   The name of the generated asset file containing your JS bundle\n    // bundleAssetName = \"MyApplication.android.bundle\"\n    //\n    //   The entry file for bundle generation. Default is 'index.android.js' or 'index.js'\n    // entryFile = file(\"../js/MyApplication.android.js\")\n    //\n    //   A list of extra flags to pass to the 'bundle' commands.\n    //   See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle\n    // extraPackagerArgs = []\n\n    /* Hermes Commands */\n    //   The hermes compiler command to run. By default it is 'hermesc'\n    hermesCommand = \"$rootDir/../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc\"\n    //\n    //   The list of flags to pass to the Hermes compiler. By default is \"-O\", \"-output-source-map\"\n    // hermesFlags = [\"-O\", \"-output-source-map\"]\n\n    /* Autolinking */\n    autolinkLibrariesWithApp()\n}\n\n/**\n * Set this to true to Run Proguard on Release builds to minify the Java bytecode.\n */\ndef enableProguardInReleaseBuilds = false\n\n/**\n * The preferred build flavor of JavaScriptCore (JSC)\n *\n * For example, to use the international variant, you can use:\n * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`\n *\n * The international variant includes ICU i18n library and necessary data\n * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that\n * give correct results when using with locales other than en-US. Note that\n * this variant is about 6MiB larger per architecture than default.\n */\ndef jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'\n\nandroid {\n    ndkVersion rootProject.ext.ndkVersion\n    buildToolsVersion rootProject.ext.buildToolsVersion\n    compileSdk rootProject.ext.compileSdkVersion\n\n    namespace \"com.mrousavy.mmkv.example\"\n    defaultConfig {\n        applicationId \"com.mrousavy.mmkv.example\"\n        minSdkVersion rootProject.ext.minSdkVersion\n        targetSdkVersion rootProject.ext.targetSdkVersion\n        versionCode 1\n        versionName \"1.0\"\n    }\n    signingConfigs {\n        debug {\n            storeFile file('debug.keystore')\n            storePassword 'android'\n            keyAlias 'androiddebugkey'\n            keyPassword 'android'\n        }\n    }\n    buildTypes {\n        debug {\n            signingConfig signingConfigs.debug\n        }\n        release {\n            // Caution! In production, you need to generate your own keystore file.\n            // see https://reactnative.dev/docs/signed-apk-android.\n            signingConfig signingConfigs.debug\n            minifyEnabled enableProguardInReleaseBuilds\n            proguardFiles getDefaultProguardFile(\"proguard-android.txt\"), \"proguard-rules.pro\"\n        }\n    }\n}\n\ndependencies {\n    // The version of react-native is set by the React Native Gradle Plugin\n    implementation(\"com.facebook.react:react-android\")\n\n    if (hermesEnabled.toBoolean()) {\n        implementation(\"com.facebook.react:hermes-android\")\n    } else {\n        implementation jscFlavor\n    }\n}\n"
  },
  {
    "path": "example/android/app/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n"
  },
  {
    "path": "example/android/app/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <uses-permission android:name=\"android.permission.INTERNET\" />\n\n    <application\n      android:name=\".MainApplication\"\n      android:label=\"@string/app_name\"\n      android:icon=\"@mipmap/ic_launcher\"\n      android:roundIcon=\"@mipmap/ic_launcher_round\"\n      android:allowBackup=\"false\"\n      android:theme=\"@style/AppTheme\"\n      android:usesCleartextTraffic=\"${usesCleartextTraffic}\"\n      android:supportsRtl=\"true\">\n      <activity\n        android:name=\".MainActivity\"\n        android:label=\"@string/app_name\"\n        android:configChanges=\"keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode\"\n        android:launchMode=\"singleTask\"\n        android:windowSoftInputMode=\"adjustResize\"\n        android:exported=\"true\">\n        <intent-filter>\n            <action android:name=\"android.intent.action.MAIN\" />\n            <category android:name=\"android.intent.category.LAUNCHER\" />\n        </intent-filter>\n      </activity>\n    </application>\n</manifest>\n"
  },
  {
    "path": "example/android/app/src/main/java/com/mrousavy/mmkv/example/MainActivity.kt",
    "content": "package com.mrousavy.mmkv.example\n\nimport com.facebook.react.ReactActivity\nimport com.facebook.react.ReactActivityDelegate\nimport com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled\nimport com.facebook.react.defaults.DefaultReactActivityDelegate\n\nclass MainActivity : ReactActivity() {\n\n  /**\n   * Returns the name of the main component registered from JavaScript. This is used to schedule\n   * rendering of the component.\n   */\n  override fun getMainComponentName(): String = \"MmkvExample\"\n\n  /**\n   * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]\n   * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]\n   */\n  override fun createReactActivityDelegate(): ReactActivityDelegate =\n      DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)\n}\n"
  },
  {
    "path": "example/android/app/src/main/java/com/mrousavy/mmkv/example/MainApplication.kt",
    "content": "package com.mrousavy.mmkv.example\n\nimport android.app.Application\nimport com.facebook.react.PackageList\nimport com.facebook.react.ReactApplication\nimport com.facebook.react.ReactHost\nimport com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative\nimport com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost\n\nclass MainApplication : Application(), ReactApplication {\n\n override val reactHost: ReactHost by lazy {\n    getDefaultReactHost(\n      context = applicationContext,\n      packageList =\n        PackageList(this).packages.apply {\n          // no extra packages\n        },\n    )\n  }\n\n  override fun onCreate() {\n    super.onCreate()\n    loadReactNative(this)\n  }\n}\n"
  },
  {
    "path": "example/android/app/src/main/res/drawable/rn_edit_text_material.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2014 The Android Open Source Project\n\n     Licensed under the Apache License, Version 2.0 (the \"License\");\n     you may not use this file except in compliance with the License.\n     You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n     Unless required by applicable law or agreed to in writing, software\n     distributed under the License is distributed on an \"AS IS\" BASIS,\n     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n     See the License for the specific language governing permissions and\n     limitations under the License.\n-->\n<inset xmlns:android=\"http://schemas.android.com/apk/res/android\"\n       android:insetLeft=\"@dimen/abc_edit_text_inset_horizontal_material\"\n       android:insetRight=\"@dimen/abc_edit_text_inset_horizontal_material\"\n       android:insetTop=\"@dimen/abc_edit_text_inset_top_material\"\n       android:insetBottom=\"@dimen/abc_edit_text_inset_bottom_material\"\n       >\n\n    <selector>\n        <!--\n          This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).\n          The item below with state_pressed=\"false\" and state_focused=\"false\" causes a NullPointerException.\n          NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'\n\n          <item android:state_pressed=\"false\" android:state_focused=\"false\" android:drawable=\"@drawable/abc_textfield_default_mtrl_alpha\"/>\n\n          For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.\n        -->\n        <item android:state_enabled=\"false\" android:drawable=\"@drawable/abc_textfield_default_mtrl_alpha\"/>\n        <item android:drawable=\"@drawable/abc_textfield_activated_mtrl_alpha\"/>\n    </selector>\n\n</inset>\n"
  },
  {
    "path": "example/android/app/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">MmkvExample</string>\n</resources>\n"
  },
  {
    "path": "example/android/app/src/main/res/values/styles.xml",
    "content": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.DayNight.NoActionBar\">\n        <!-- Customize your theme here. -->\n        <item name=\"android:editTextBackground\">@drawable/rn_edit_text_material</item>\n    </style>\n\n</resources>\n"
  },
  {
    "path": "example/android/build.gradle",
    "content": "buildscript {\n    ext {\n        buildToolsVersion = \"36.0.0\"\n        minSdkVersion = 24\n        compileSdkVersion = 36\n        targetSdkVersion = 36\n        ndkVersion = \"27.1.12297006\"\n        kotlinVersion = \"2.1.20\"\n    }\n    repositories {\n        google()\n        mavenCentral()\n    }\n    dependencies {\n        classpath(\"com.android.tools.build:gradle\")\n        classpath(\"com.facebook.react:react-native-gradle-plugin\")\n        classpath(\"org.jetbrains.kotlin:kotlin-gradle-plugin\")\n    }\n}\n\napply plugin: \"com.facebook.react.rootproject\"\n"
  },
  {
    "path": "example/android/gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-9.0.0-bin.zip\nnetworkTimeout=10000\nvalidateDistributionUrl=true\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "example/android/gradle.properties",
    "content": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\n# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m\norg.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m\n\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\n\n# AndroidX package structure to make it clearer which packages are bundled with the\n# Android operating system, and which are packaged with your app's APK\n# https://developer.android.com/topic/libraries/support-library/androidx-rn\nandroid.useAndroidX=true\n\n# Use this property to specify which architecture you want to build.\n# You can also override it from the CLI using\n# ./gradlew <task> -PreactNativeArchitectures=x86_64\nreactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64\n\n# Use this property to enable support to the new architecture.\n# This will allow you to use TurboModules and the Fabric render in\n# your application. You should enable this flag either if you want\n# to write custom TurboModules/Fabric components OR use libraries that\n# are providing them.\nnewArchEnabled=true\n\n# Use this property to enable or disable the Hermes JS engine.\n# If set to false, you will be using JSC instead.\nhermesEnabled=true\n\n# Use this property to enable edge-to-edge display support.\n# This allows your app to draw behind system bars for an immersive UI.\n# Note: Only works with ReactActivity and should not be used with custom Activity.\nedgeToEdgeEnabled=false\n"
  },
  {
    "path": "example/android/gradlew",
    "content": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n# SPDX-License-Identifier: Apache-2.0\n#\n\n##############################################################################\n#\n#   Gradle start up script for POSIX generated by Gradle.\n#\n#   Important for running:\n#\n#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is\n#       noncompliant, but you have some other compliant shell such as ksh or\n#       bash, then to run this script, type that shell name before the whole\n#       command line, like:\n#\n#           ksh Gradle\n#\n#       Busybox and similar reduced shells will NOT work, because this script\n#       requires all of these POSIX shell features:\n#         * functions;\n#         * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,\n#           «${var#prefix}», «${var%suffix}», and «$( cmd )»;\n#         * compound commands having a testable exit status, especially «case»;\n#         * various built-in commands including «command», «set», and «ulimit».\n#\n#   Important for patching:\n#\n#   (2) This script targets any POSIX shell, so it avoids extensions provided\n#       by Bash, Ksh, etc; in particular arrays are avoided.\n#\n#       The \"traditional\" practice of packing multiple parameters into a\n#       space-separated string is a well documented source of bugs and security\n#       problems, so this is (mostly) avoided, by progressively accumulating\n#       options in \"$@\", and eventually passing that to Java.\n#\n#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,\n#       and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;\n#       see the in-line comments for details.\n#\n#       There are tweaks for specific operating systems such as AIX, CygWin,\n#       Darwin, MinGW, and NonStop.\n#\n#   (3) This script is generated from the Groovy template\n#       https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt\n#       within the Gradle project.\n#\n#       You can find Gradle at https://github.com/gradle/gradle/.\n#\n##############################################################################\n\n# Attempt to set APP_HOME\n\n# Resolve links: $0 may be a link\napp_path=$0\n\n# Need this for daisy-chained symlinks.\nwhile\n    APP_HOME=${app_path%\"${app_path##*/}\"}  # leaves a trailing /; empty if no leading path\n    [ -h \"$app_path\" ]\ndo\n    ls=$( ls -ld \"$app_path\" )\n    link=${ls#*' -> '}\n    case $link in             #(\n      /*)   app_path=$link ;; #(\n      *)    app_path=$APP_HOME$link ;;\n    esac\ndone\n\n# This is normally unused\n# shellcheck disable=SC2034\nAPP_BASE_NAME=${0##*/}\n# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)\nAPP_HOME=$( cd -P \"${APP_HOME:-./}\" > /dev/null && printf '%s\\n' \"$PWD\" ) || exit\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=maximum\n\nwarn () {\n    echo \"$*\"\n} >&2\n\ndie () {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n} >&2\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"$( uname )\" in                #(\n  CYGWIN* )         cygwin=true  ;; #(\n  Darwin* )         darwin=true  ;; #(\n  MSYS* | MINGW* )  msys=true    ;; #(\n  NONSTOP* )        nonstop=true ;;\nesac\n\nCLASSPATH=\"\\\\\\\"\\\\\\\"\"\n\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=$JAVA_HOME/jre/sh/java\n    else\n        JAVACMD=$JAVA_HOME/bin/java\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=java\n    if ! command -v java >/dev/null 2>&1\n    then\n        die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nfi\n\n# Increase the maximum file descriptors if we can.\nif ! \"$cygwin\" && ! \"$darwin\" && ! \"$nonstop\" ; then\n    case $MAX_FD in #(\n      max*)\n        # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.\n        # shellcheck disable=SC2039,SC3045\n        MAX_FD=$( ulimit -H -n ) ||\n            warn \"Could not query maximum file descriptor limit\"\n    esac\n    case $MAX_FD in  #(\n      '' | soft) :;; #(\n      *)\n        # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.\n        # shellcheck disable=SC2039,SC3045\n        ulimit -n \"$MAX_FD\" ||\n            warn \"Could not set maximum file descriptor limit to $MAX_FD\"\n    esac\nfi\n\n# Collect all arguments for the java command, stacking in reverse order:\n#   * args from the command line\n#   * the main class name\n#   * -classpath\n#   * -D...appname settings\n#   * --module-path (only if needed)\n#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.\n\n# For Cygwin or MSYS, switch paths to Windows format before running java\nif \"$cygwin\" || \"$msys\" ; then\n    APP_HOME=$( cygpath --path --mixed \"$APP_HOME\" )\n    CLASSPATH=$( cygpath --path --mixed \"$CLASSPATH\" )\n\n    JAVACMD=$( cygpath --unix \"$JAVACMD\" )\n\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    for arg do\n        if\n            case $arg in                                #(\n              -*)   false ;;                            # don't mess with options #(\n              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath\n                    [ -e \"$t\" ] ;;                      #(\n              *)    false ;;\n            esac\n        then\n            arg=$( cygpath --path --ignore --mixed \"$arg\" )\n        fi\n        # Roll the args list around exactly as many times as the number of\n        # args, so each arg winds up back in the position where it started, but\n        # possibly modified.\n        #\n        # NB: a `for` loop captures its iteration list before it begins, so\n        # changing the positional parameters here affects neither the number of\n        # iterations, nor the values presented in `arg`.\n        shift                   # remove old arg\n        set -- \"$@\" \"$arg\"      # push replacement arg\n    done\nfi\n\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS='\"-Xmx64m\" \"-Xms64m\"'\n\n# Collect all arguments for the java command:\n#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,\n#     and any embedded shellness will be escaped.\n#   * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be\n#     treated as '${Hostname}' itself on the command line.\n\nset -- \\\n        \"-Dorg.gradle.appname=$APP_BASE_NAME\" \\\n        -classpath \"$CLASSPATH\" \\\n        -jar \"$APP_HOME/gradle/wrapper/gradle-wrapper.jar\" \\\n        \"$@\"\n\n# Stop when \"xargs\" is not available.\nif ! command -v xargs >/dev/null 2>&1\nthen\n    die \"xargs is not available\"\nfi\n\n# Use \"xargs\" to parse quoted args.\n#\n# With -n1 it outputs one arg per line, with the quotes and backslashes removed.\n#\n# In Bash we could simply go:\n#\n#   readarray ARGS < <( xargs -n1 <<<\"$var\" ) &&\n#   set -- \"${ARGS[@]}\" \"$@\"\n#\n# but POSIX shell has neither arrays nor command substitution, so instead we\n# post-process each arg (as a line of input to sed) to backslash-escape any\n# character that might be a shell metacharacter, then use eval to reverse\n# that process (while maintaining the separation between arguments), and wrap\n# the whole thing up as a single \"set\" statement.\n#\n# This will of course break if any of these variables contains a newline or\n# an unmatched quote.\n#\n\neval \"set -- $(\n        printf '%s\\n' \"$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\" |\n        xargs -n1 |\n        sed ' s~[^-[:alnum:]+,./:=@_]~\\\\&~g; ' |\n        tr '\\n' ' '\n    )\" '\"$@\"'\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "example/android/gradlew.bat",
    "content": "@REM Copyright (c) Meta Platforms, Inc. and affiliates.\r\n@REM\r\n@REM This source code is licensed under the MIT license found in the\r\n@REM LICENSE file in the root directory of this source tree.\r\n\r\n@rem\r\n@rem Copyright 2015 the original author or authors.\r\n@rem\r\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\r\n@rem you may not use this file except in compliance with the License.\r\n@rem You may obtain a copy of the License at\r\n@rem\r\n@rem      https://www.apache.org/licenses/LICENSE-2.0\r\n@rem\r\n@rem Unless required by applicable law or agreed to in writing, software\r\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\r\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n@rem See the License for the specific language governing permissions and\r\n@rem limitations under the License.\r\n@rem\r\n@rem SPDX-License-Identifier: Apache-2.0\r\n@rem\r\n\r\n@if \"%DEBUG%\"==\"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\"==\"\" set DIRNAME=.\r\n@rem This is normally unused\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\r\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif %ERRORLEVEL% equ 0 goto execute\r\n\r\necho. 1>&2\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2\r\necho. 1>&2\r\necho Please set the JAVA_HOME variable in your environment to match the 1>&2\r\necho location of your Java installation. 1>&2\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto execute\r\n\r\necho. 1>&2\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2\r\necho. 1>&2\r\necho Please set the JAVA_HOME variable in your environment to match the 1>&2\r\necho location of your Java installation. 1>&2\r\n\r\ngoto fail\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=\r\n\r\n\r\n@rem Execute Gradle\r\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" -jar \"%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\" %*\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif %ERRORLEVEL% equ 0 goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nset EXIT_CODE=%ERRORLEVEL%\r\nif %EXIT_CODE% equ 0 set EXIT_CODE=1\r\nif not \"\"==\"%GRADLE_EXIT_CONSOLE%\" exit %EXIT_CODE%\r\nexit /b %EXIT_CODE%\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "example/android/settings.gradle",
    "content": "pluginManagement { includeBuild(\"../../node_modules/@react-native/gradle-plugin\") }\nplugins { id(\"com.facebook.react.settings\") }\nextensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }\nrootProject.name = 'MmkvExample'\ninclude ':app'\nincludeBuild('../../node_modules/@react-native/gradle-plugin')\n"
  },
  {
    "path": "example/app.json",
    "content": "{\n  \"name\": \"MmkvExample\",\n  \"displayName\": \"MmkvExample\"\n}\n"
  },
  {
    "path": "example/babel.config.js",
    "content": "module.exports = {\n  presets: [\n    'module:@react-native/babel-preset',\n    'react-native-harness/babel-preset',\n  ],\n};\n"
  },
  {
    "path": "example/index.js",
    "content": "/**\n * @format\n */\n\nimport { AppRegistry } from 'react-native';\nimport App from './src/App';\nimport { name as appName } from './app.json';\n\nAppRegistry.registerComponent(appName, () => App);\n"
  },
  {
    "path": "example/ios/.xcode.env",
    "content": "# This `.xcode.env` file is versioned and is used to source the environment\n# used when running script phases inside Xcode.\n# To customize your local environment, you can create an `.xcode.env.local`\n# file that is not versioned.\n\n# NODE_BINARY variable contains the PATH to the node executable.\n#\n# Customize the NODE_BINARY variable here.\n# For example, to use nvm with brew, add the following line\n# . \"$(brew --prefix nvm)/nvm.sh\" --no-use\nexport NODE_BINARY=$(command -v node)\n"
  },
  {
    "path": "example/ios/MmkvExample/AppDelegate.swift",
    "content": "import UIKit\nimport React\nimport React_RCTAppDelegate\nimport ReactAppDependencyProvider\n\n@main\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n  var window: UIWindow?\n\n  var reactNativeDelegate: ReactNativeDelegate?\n  var reactNativeFactory: RCTReactNativeFactory?\n\n  func application(\n    _ application: UIApplication,\n    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil\n  ) -> Bool {\n    let delegate = ReactNativeDelegate()\n    let factory = RCTReactNativeFactory(delegate: delegate)\n    delegate.dependencyProvider = RCTAppDependencyProvider()\n\n    reactNativeDelegate = delegate\n    reactNativeFactory = factory\n\n    window = UIWindow(frame: UIScreen.main.bounds)\n\n    factory.startReactNative(\n      withModuleName: \"MmkvExample\",\n      in: window,\n      launchOptions: launchOptions\n    )\n\n    return true\n  }\n}\n\nclass ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {\n  override func sourceURL(for bridge: RCTBridge) -> URL? {\n    self.bundleURL()\n  }\n\n  override func bundleURL() -> URL? {\n#if DEBUG\n    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: \"index\")\n#else\n    Bundle.main.url(forResource: \"main\", withExtension: \"jsbundle\")\n#endif\n  }\n}\n"
  },
  {
    "path": "example/ios/MmkvExample/Images.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"ios-marketing\",\n      \"scale\" : \"1x\",\n      \"size\" : \"1024x1024\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "example/ios/MmkvExample/Images.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "example/ios/MmkvExample/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CADisableMinimumFrameDurationOnPhone</key>\n\t<true/>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>MmkvExample</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>$(MARKETING_VERSION)</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>$(CURRENT_PROJECT_VERSION)</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>NSAppTransportSecurity</key>\n\t<dict>\n\t\t<key>NSAllowsArbitraryLoads</key>\n\t\t<false/>\n\t\t<key>NSAllowsLocalNetworking</key>\n\t\t<true/>\n\t</dict>\n\t<key>NSLocationWhenInUseUsageDescription</key>\n\t<string></string>\n\t<key>RCTNewArchEnabled</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>arm64</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UIViewControllerBasedStatusBarAppearance</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "example/ios/MmkvExample/LaunchScreen.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"15702\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\" useSafeAreas=\"YES\" colorMatched=\"YES\" initialViewController=\"01J-lp-oVM\">\n    <device id=\"retina4_7\" orientation=\"portrait\" appearance=\"light\"/>\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"15704\"/>\n        <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <scenes>\n        <!--View Controller-->\n        <scene sceneID=\"EHf-IW-A2E\">\n            <objects>\n                <viewController id=\"01J-lp-oVM\" sceneMemberID=\"viewController\">\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"Ze5-6b-2t3\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"667\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <subviews>\n                            <label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"MmkvExample\" textAlignment=\"center\" lineBreakMode=\"middleTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"18\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"GJd-Yh-RWb\">\n                                <rect key=\"frame\" x=\"0.0\" y=\"202\" width=\"375\" height=\"43\"/>\n                                <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"36\"/>\n                                <nil key=\"highlightedColor\"/>\n                            </label>\n                            <label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"Powered by React Native\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"9\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"MN2-I3-ftu\">\n                                <rect key=\"frame\" x=\"0.0\" y=\"626\" width=\"375\" height=\"21\"/>\n                                <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"17\"/>\n                                <nil key=\"highlightedColor\"/>\n                            </label>\n                        </subviews>\n                        <color key=\"backgroundColor\" systemColor=\"systemBackgroundColor\" cocoaTouchSystemColor=\"whiteColor\"/>\n                        <constraints>\n                            <constraint firstItem=\"Bcu-3y-fUS\" firstAttribute=\"bottom\" secondItem=\"MN2-I3-ftu\" secondAttribute=\"bottom\" constant=\"20\" id=\"OZV-Vh-mqD\"/>\n                            <constraint firstItem=\"Bcu-3y-fUS\" firstAttribute=\"centerX\" secondItem=\"GJd-Yh-RWb\" secondAttribute=\"centerX\" id=\"Q3B-4B-g5h\"/>\n                            <constraint firstItem=\"MN2-I3-ftu\" firstAttribute=\"centerX\" secondItem=\"Bcu-3y-fUS\" secondAttribute=\"centerX\" id=\"akx-eg-2ui\"/>\n                            <constraint firstItem=\"MN2-I3-ftu\" firstAttribute=\"leading\" secondItem=\"Bcu-3y-fUS\" secondAttribute=\"leading\" id=\"i1E-0Y-4RG\"/>\n                            <constraint firstItem=\"GJd-Yh-RWb\" firstAttribute=\"centerY\" secondItem=\"Ze5-6b-2t3\" secondAttribute=\"bottom\" multiplier=\"1/3\" constant=\"1\" id=\"moa-c2-u7t\"/>\n                            <constraint firstItem=\"GJd-Yh-RWb\" firstAttribute=\"leading\" secondItem=\"Bcu-3y-fUS\" secondAttribute=\"leading\" symbolic=\"YES\" id=\"x7j-FC-K8j\"/>\n                        </constraints>\n                        <viewLayoutGuide key=\"safeArea\" id=\"Bcu-3y-fUS\"/>\n                    </view>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"iYj-Kq-Ea1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"52.173913043478265\" y=\"375\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "example/ios/MmkvExample/PrivacyInfo.xcprivacy",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>NSPrivacyAccessedAPITypes</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>NSPrivacyAccessedAPIType</key>\n\t\t\t<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>\n\t\t\t<key>NSPrivacyAccessedAPITypeReasons</key>\n\t\t\t<array>\n\t\t\t\t<string>C617.1</string>\n\t\t\t</array>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>NSPrivacyAccessedAPIType</key>\n\t\t\t<string>NSPrivacyAccessedAPICategoryUserDefaults</string>\n\t\t\t<key>NSPrivacyAccessedAPITypeReasons</key>\n\t\t\t<array>\n\t\t\t\t<string>CA92.1</string>\n\t\t\t</array>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>NSPrivacyAccessedAPIType</key>\n\t\t\t<string>NSPrivacyAccessedAPICategorySystemBootTime</string>\n\t\t\t<key>NSPrivacyAccessedAPITypeReasons</key>\n\t\t\t<array>\n\t\t\t\t<string>35F9.1</string>\n\t\t\t</array>\n\t\t</dict>\n\t</array>\n\t<key>NSPrivacyCollectedDataTypes</key>\n\t<array/>\n\t<key>NSPrivacyTracking</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "example/ios/MmkvExample.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 54;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t0C80B921A6F3F58F76C31292 /* libPods-MmkvExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-MmkvExample.a */; };\n\t\t13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };\n\t\t761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };\n\t\t81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };\n\t\tD14B608BF8079920A6778F45 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t13B07F961A680F5B00A75B9A /* MmkvExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MmkvExample.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = MmkvExample/Images.xcassets; sourceTree = \"<group>\"; };\n\t\t13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = MmkvExample/Info.plist; sourceTree = \"<group>\"; };\n\t\t13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = MmkvExample/PrivacyInfo.xcprivacy; sourceTree = \"<group>\"; };\n\t\t3B4392A12AC88292D35C810B /* Pods-MmkvExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-MmkvExample.debug.xcconfig\"; path = \"Target Support Files/Pods-MmkvExample/Pods-MmkvExample.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t5709B34CF0A7D63546082F79 /* Pods-MmkvExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-MmkvExample.release.xcconfig\"; path = \"Target Support Files/Pods-MmkvExample/Pods-MmkvExample.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t5DCACB8F33CDC322A6C60F78 /* libPods-MmkvExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = \"libPods-MmkvExample.a\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = MmkvExample/AppDelegate.swift; sourceTree = \"<group>\"; };\n\t\t81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = MmkvExample/LaunchScreen.storyboard; sourceTree = \"<group>\"; };\n\t\tED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t13B07F8C1A680F5B00A75B9A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t0C80B921A6F3F58F76C31292 /* libPods-MmkvExample.a in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t13B07FAE1A68108700A75B9A /* MmkvExample */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t13B07FB51A68108700A75B9A /* Images.xcassets */,\n\t\t\t\t761780EC2CA45674006654EE /* AppDelegate.swift */,\n\t\t\t\t13B07FB61A68108700A75B9A /* Info.plist */,\n\t\t\t\t81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,\n\t\t\t\t13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */,\n\t\t\t);\n\t\t\tname = MmkvExample;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2D16E6871FA4F8E400B85C8A /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tED297162215061F000B7C4FE /* JavaScriptCore.framework */,\n\t\t\t\t5DCACB8F33CDC322A6C60F78 /* libPods-MmkvExample.a */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t832341AE1AAA6A7D00B99B32 /* Libraries */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = Libraries;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t83CBB9F61A601CBA00E9B192 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t13B07FAE1A68108700A75B9A /* MmkvExample */,\n\t\t\t\t832341AE1AAA6A7D00B99B32 /* Libraries */,\n\t\t\t\t83CBBA001A601CBA00E9B192 /* Products */,\n\t\t\t\t2D16E6871FA4F8E400B85C8A /* Frameworks */,\n\t\t\t\tBBD78D7AC51CEA395F1C20DB /* Pods */,\n\t\t\t);\n\t\t\tindentWidth = 2;\n\t\t\tsourceTree = \"<group>\";\n\t\t\ttabWidth = 2;\n\t\t\tusesTabs = 0;\n\t\t};\n\t\t83CBBA001A601CBA00E9B192 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t13B07F961A680F5B00A75B9A /* MmkvExample.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tBBD78D7AC51CEA395F1C20DB /* Pods */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3B4392A12AC88292D35C810B /* Pods-MmkvExample.debug.xcconfig */,\n\t\t\t\t5709B34CF0A7D63546082F79 /* Pods-MmkvExample.release.xcconfig */,\n\t\t\t);\n\t\t\tpath = Pods;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t13B07F861A680F5B00A75B9A /* MmkvExample */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget \"MmkvExample\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tC38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */,\n\t\t\t\t13B07F871A680F5B00A75B9A /* Sources */,\n\t\t\t\t13B07F8C1A680F5B00A75B9A /* Frameworks */,\n\t\t\t\t13B07F8E1A680F5B00A75B9A /* Resources */,\n\t\t\t\t00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,\n\t\t\t\t00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,\n\t\t\t\tE235C05ADACE081382539298 /* [CP] Copy Pods Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = MmkvExample;\n\t\t\tproductName = MmkvExample;\n\t\t\tproductReference = 13B07F961A680F5B00A75B9A /* MmkvExample.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t83CBB9F71A601CBA00E9B192 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastUpgradeCheck = 1210;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t13B07F861A680F5B00A75B9A = {\n\t\t\t\t\t\tLastSwiftMigration = 1120;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject \"MmkvExample\" */;\n\t\t\tcompatibilityVersion = \"Xcode 12.0\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = 83CBB9F61A601CBA00E9B192;\n\t\t\tproductRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t13B07F861A680F5B00A75B9A /* MmkvExample */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t13B07F8E1A680F5B00A75B9A /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,\n\t\t\t\t13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,\n\t\t\t\tD14B608BF8079920A6778F45 /* PrivacyInfo.xcprivacy in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"$(SRCROOT)/.xcode.env.local\",\n\t\t\t\t\"$(SRCROOT)/.xcode.env\",\n\t\t\t);\n\t\t\tname = \"Bundle React Native code and images\";\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"set -e\\n\\nWITH_ENVIRONMENT=\\\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\\\"\\nREACT_NATIVE_XCODE=\\\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\\\"\\n\\n/bin/sh -c \\\"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\\\"\\n\";\n\t\t};\n\t\t00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputFileListPaths = (\n\t\t\t\t\"${PODS_ROOT}/Target Support Files/Pods-MmkvExample/Pods-MmkvExample-frameworks-${CONFIGURATION}-input-files.xcfilelist\",\n\t\t\t);\n\t\t\tname = \"[CP] Embed Pods Frameworks\";\n\t\t\toutputFileListPaths = (\n\t\t\t\t\"${PODS_ROOT}/Target Support Files/Pods-MmkvExample/Pods-MmkvExample-frameworks-${CONFIGURATION}-output-files.xcfilelist\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"\\\"${PODS_ROOT}/Target Support Files/Pods-MmkvExample/Pods-MmkvExample-frameworks.sh\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\tC38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputFileListPaths = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"${PODS_PODFILE_DIR_PATH}/Podfile.lock\",\n\t\t\t\t\"${PODS_ROOT}/Manifest.lock\",\n\t\t\t);\n\t\t\tname = \"[CP] Check Pods Manifest.lock\";\n\t\t\toutputFileListPaths = (\n\t\t\t);\n\t\t\toutputPaths = (\n\t\t\t\t\"$(DERIVED_FILE_DIR)/Pods-MmkvExample-checkManifestLockResult.txt\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"diff \\\"${PODS_PODFILE_DIR_PATH}/Podfile.lock\\\" \\\"${PODS_ROOT}/Manifest.lock\\\" > /dev/null\\nif [ $? != 0 ] ; then\\n    # print error to STDERR\\n    echo \\\"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\\\" >&2\\n    exit 1\\nfi\\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\\necho \\\"SUCCESS\\\" > \\\"${SCRIPT_OUTPUT_FILE_0}\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\tE235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputFileListPaths = (\n\t\t\t\t\"${PODS_ROOT}/Target Support Files/Pods-MmkvExample/Pods-MmkvExample-resources-${CONFIGURATION}-input-files.xcfilelist\",\n\t\t\t);\n\t\t\tname = \"[CP] Copy Pods Resources\";\n\t\t\toutputFileListPaths = (\n\t\t\t\t\"${PODS_ROOT}/Target Support Files/Pods-MmkvExample/Pods-MmkvExample-resources-${CONFIGURATION}-output-files.xcfilelist\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"\\\"${PODS_ROOT}/Target Support Files/Pods-MmkvExample/Pods-MmkvExample-resources.sh\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t13B07F871A680F5B00A75B9A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t761780ED2CA45674006654EE /* AppDelegate.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t13B07F941A680F5B00A75B9A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-MmkvExample.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_TEAM = CJW62Q77E7;\n\t\t\t\tENABLE_BITCODE = NO;\n\t\t\t\tINFOPLIST_FILE = MmkvExample/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 15.1;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tOTHER_LDFLAGS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"-ObjC\",\n\t\t\t\t\t\"-lc++\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.mrousavy.mmkv.example;\n\t\t\t\tPRODUCT_NAME = MmkvExample;\n\t\t\t\tSWIFT_ENABLE_EXPLICIT_MODULES = NO;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t13B07F951A680F5B00A75B9A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-MmkvExample.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_TEAM = CJW62Q77E7;\n\t\t\t\tINFOPLIST_FILE = MmkvExample/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 15.1;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tOTHER_LDFLAGS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"-ObjC\",\n\t\t\t\t\t\"-lc++\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.mrousavy.mmkv.example;\n\t\t\t\tPRODUCT_NAME = MmkvExample;\n\t\t\t\tSWIFT_ENABLE_EXPLICIT_MODULES = NO;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t83CBBA201A601CBA00E9B192 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"c++20\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\t\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = \"\";\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 15.1;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t/usr/lib/swift,\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tLIBRARY_SEARCH_PATHS = (\n\t\t\t\t\t\"\\\"$(SDKROOT)/usr/lib/swift\\\"\",\n\t\t\t\t\t\"\\\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\\\"\",\n\t\t\t\t\t\"\\\"$(inherited)\\\"\",\n\t\t\t\t);\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tOTHER_CPLUSPLUSFLAGS = (\n\t\t\t\t\t\"$(OTHER_CFLAGS)\",\n\t\t\t\t\t\"-DFOLLY_NO_CONFIG\",\n\t\t\t\t\t\"-DFOLLY_MOBILE=1\",\n\t\t\t\t\t\"-DFOLLY_USE_LIBCPP=1\",\n\t\t\t\t\t\"-DFOLLY_CFG_NO_COROUTINES=1\",\n\t\t\t\t\t\"-DFOLLY_HAVE_CLOCK_GETTIME=1\",\n\t\t\t\t);\n\t\t\t\tREACT_NATIVE_PATH = \"${PODS_ROOT}/../../../node_modules/react-native\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) DEBUG\";\n\t\t\t\tSWIFT_ENABLE_EXPLICIT_MODULES = NO;\n\t\t\t\tUSE_HERMES = true;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t83CBBA211A601CBA00E9B192 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"c++20\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\t\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = \"\";\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 15.1;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t/usr/lib/swift,\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tLIBRARY_SEARCH_PATHS = (\n\t\t\t\t\t\"\\\"$(SDKROOT)/usr/lib/swift\\\"\",\n\t\t\t\t\t\"\\\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\\\"\",\n\t\t\t\t\t\"\\\"$(inherited)\\\"\",\n\t\t\t\t);\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tOTHER_CPLUSPLUSFLAGS = (\n\t\t\t\t\t\"$(OTHER_CFLAGS)\",\n\t\t\t\t\t\"-DFOLLY_NO_CONFIG\",\n\t\t\t\t\t\"-DFOLLY_MOBILE=1\",\n\t\t\t\t\t\"-DFOLLY_USE_LIBCPP=1\",\n\t\t\t\t\t\"-DFOLLY_CFG_NO_COROUTINES=1\",\n\t\t\t\t\t\"-DFOLLY_HAVE_CLOCK_GETTIME=1\",\n\t\t\t\t);\n\t\t\t\tREACT_NATIVE_PATH = \"${PODS_ROOT}/../../../node_modules/react-native\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_ENABLE_EXPLICIT_MODULES = NO;\n\t\t\t\tUSE_HERMES = true;\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget \"MmkvExample\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t13B07F941A680F5B00A75B9A /* Debug */,\n\t\t\t\t13B07F951A680F5B00A75B9A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject \"MmkvExample\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t83CBBA201A601CBA00E9B192 /* Debug */,\n\t\t\t\t83CBBA211A601CBA00E9B192 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;\n}\n"
  },
  {
    "path": "example/ios/MmkvExample.xcodeproj/xcshareddata/xcschemes/MmkvExample.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1210\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"13B07F861A680F5B00A75B9A\"\n               BuildableName = \"MmkvExample.app\"\n               BlueprintName = \"MmkvExample\"\n               ReferencedContainer = \"container:MmkvExample.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"00E356ED1AD99517003FC87E\"\n               BuildableName = \"MmkvExampleTests.xctest\"\n               BlueprintName = \"MmkvExampleTests\"\n               ReferencedContainer = \"container:MmkvExample.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"13B07F861A680F5B00A75B9A\"\n            BuildableName = \"MmkvExample.app\"\n            BlueprintName = \"MmkvExample\"\n            ReferencedContainer = \"container:MmkvExample.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"13B07F861A680F5B00A75B9A\"\n            BuildableName = \"MmkvExample.app\"\n            BlueprintName = \"MmkvExample\"\n            ReferencedContainer = \"container:MmkvExample.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "example/ios/MmkvExample.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:MmkvExample.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:Pods/Pods.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "example/ios/Podfile",
    "content": "# Resolve react_native_pods.rb with node to allow for hoisting\nrequire Pod::Executable.execute_command('node', ['-p',\n  'require.resolve(\n    \"react-native/scripts/react_native_pods.rb\",\n    {paths: [process.argv[1]]},\n  )', __dir__]).strip\n\nplatform :ios, min_ios_version_supported\nprepare_react_native_project!\n\nlinkage = ENV['USE_FRAMEWORKS']\nif linkage != nil\n  Pod::UI.puts \"Configuring Pod with #{linkage}ally linked Frameworks\".green\n  use_frameworks! :linkage => linkage.to_sym\nend\n\ntarget 'MmkvExample' do\n  config = use_native_modules!\n\n  use_react_native!(\n    :path => config[:reactNativePath],\n    # An absolute path to your application root.\n    :app_path => \"#{Pod::Config.instance.installation_root}/..\"\n  )\n\n  post_install do |installer|\n    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202\n    react_native_post_install(\n      installer,\n      config[:reactNativePath],\n      :mac_catalyst_enabled => false,\n      # :ccache_enabled => true\n    )\n  end\nend\n"
  },
  {
    "path": "example/jest.config.js",
    "content": "module.exports = {\n  projects: [\n    {\n      displayName: 'react-native-harness',\n      preset: 'react-native-harness',\n      testMatch: [\n        '<rootDir>/__tests__/**/*.(test|spec|harness).(js|jsx|ts|tsx)',\n      ],\n    },\n  ],\n};\n"
  },
  {
    "path": "example/metro.config.js",
    "content": "const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');\nconst path = require('path');\n\n/**\n * Metro configuration\n * https://reactnative.dev/docs/metro\n *\n * @type {import('@react-native/metro-config').MetroConfig}\n */\nconst config = {\n  watchFolders: [path.resolve(__dirname, '..')],\n};\n\nmodule.exports = mergeConfig(getDefaultConfig(__dirname), config);\n"
  },
  {
    "path": "example/package.json",
    "content": "{\n  \"name\": \"mmkv-example\",\n  \"version\": \"4.3.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"android\": \"react-native run-android\",\n    \"ios\": \"react-native run-ios\",\n    \"lint\": \"eslint \\\"**/*.{js,ts,tsx}\\\" --fix\",\n    \"lint-ci\": \"eslint \\\"**/*.{js,ts,tsx}\\\" -f @jamesacarr/github-actions\",\n    \"start\": \"react-native start\",\n    \"test\": \"jest\",\n    \"test:harness\": \"react-native-harness\",\n    \"bundle-install\": \"bundle install\",\n    \"pods\": \"bundle install && cd ios && bundle exec pod install\",\n    \"build:android-release\": \"cd android && ./gradlew assembleRelease --no-daemon\"\n  },\n  \"dependencies\": {\n    \"@react-native/new-app-screen\": \"0.82.0\",\n    \"react\": \"19.1.1\",\n    \"react-native\": \"0.82.0\",\n    \"react-native-mmkv\": \"*\",\n    \"react-native-nitro-modules\": \"0.35.0\",\n    \"react-native-safe-area-context\": \"^5.5.2\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.25.2\",\n    \"@babel/preset-env\": \"^7.25.3\",\n    \"@babel/runtime\": \"^7.28.3\",\n    \"@react-native-community/cli\": \"20.0.0\",\n    \"@react-native-community/cli-platform-android\": \"20.0.0\",\n    \"@react-native-community/cli-platform-ios\": \"20.0.0\",\n    \"@react-native/babel-preset\": \"0.82.0\",\n    \"@react-native/eslint-config\": \"0.82.0\",\n    \"@react-native/metro-config\": \"0.82.0\",\n    \"@react-native/typescript-config\": \"0.82.0\",\n    \"react-native-harness\": \"1.0.0-alpha.19\",\n    \"@react-native-harness/jest\": \"1.0.0-alpha.19\",\n    \"@react-native-harness/platform-android\": \"1.0.0-alpha.19\",\n    \"@react-native-harness/platform-apple\": \"1.0.0-alpha.19\",\n    \"@types/jest\": \"^29.5.13\",\n    \"@types/react\": \"^19.1.1\",\n    \"@types/react-test-renderer\": \"19.1.0\",\n    \"eslint\": \"^8.19.0\",\n    \"jest\": \"^30.2.0\",\n    \"prettier\": \"2.8.8\",\n    \"react-test-renderer\": \"19.1.1\",\n    \"typescript\": \"^5.8.3\"\n  },\n  \"engines\": {\n    \"node\": \">=20\"\n  }\n}\n"
  },
  {
    "path": "example/rn-harness.config.mjs",
    "content": "import {\n  androidPlatform,\n  androidEmulator,\n} from '@react-native-harness/platform-android';\nimport {\n  applePlatform,\n  appleSimulator,\n} from '@react-native-harness/platform-apple';\n\nconst config = {\n  entryPoint: './index.js',\n  appRegistryComponentName: 'MmkvExample',\n\n  runners: [\n    androidPlatform({\n      name: 'android',\n      device: androidEmulator('Pixel_8_API_35', {\n        apiLevel: 35,\n        profile: 'pixel_6',\n        diskSize: '1G',\n        heapSize: '1G',\n      }),\n      bundleId: 'com.mrousavy.mmkv.example',\n    }),\n    applePlatform({\n      name: 'ios',\n      device: appleSimulator('iPhone 16 Pro', '18.6'),\n      bundleId: 'com.mrousavy.mmkv.example',\n    }),\n  ],\n  defaultRunner: 'android',\n  bridgeTimeout: 120000,\n\n  resetEnvironmentBetweenTestFiles: true,\n  unstable__skipAlreadyIncludedModules: false,\n};\n\nexport default config;\n"
  },
  {
    "path": "example/src/App.tsx",
    "content": "import * as React from 'react';\n\nimport {\n  StyleSheet,\n  View,\n  TextInput,\n  Alert,\n  Button,\n  Text,\n  useColorScheme,\n} from 'react-native';\nimport { createMMKV, useMMKVListener, useMMKVString, useMMKVKeys } from 'react-native-mmkv';\n\nconst storage = createMMKV();\n\nexport default function App() {\n  const [text, setText] = React.useState<string>('');\n  const [key, setKey] = React.useState<string>('');\n  const keys = useMMKVKeys(storage)\n  const colorScheme = useColorScheme();\n\n  const [example, setExample] = useMMKVString('nitrooooo');\n\n  useMMKVListener((k) => {\n    console.log(`${k} changed! New size: ${storage.byteSize}`);\n  });\n\n  const save = React.useCallback(() => {\n    if (key == null || key.length < 1) {\n      Alert.alert('Empty key!', 'Enter a key first.');\n      return;\n    }\n    try {\n      console.log('setting...');\n      storage.set(key, text);\n      console.log('set.');\n    } catch (e) {\n      console.error('Error:', e);\n      Alert.alert('Failed to set value for key \"test\"!', JSON.stringify(e));\n    }\n  }, [key, text]);\n  const read = React.useCallback(() => {\n    if (key == null || key.length < 1) {\n      Alert.alert('Empty key!', 'Enter a key first.');\n      return;\n    }\n    try {\n      console.log('getting...');\n      const value = storage.getString(key);\n      console.log('got:', value);\n      Alert.alert('Result', `\"${key}\" = \"${value}\"`);\n    } catch (e) {\n      console.error('Error:', e);\n      Alert.alert('Failed to get value for key \"test\"!', JSON.stringify(e));\n    }\n  }, [key]);\n\n  React.useEffect(() => {\n    console.log(`Value of useMMKVString: ${example}`);\n    const interval = setInterval(() => {\n      setExample((val) => {\n        return val === 'nitrooooo' ? undefined : 'nitrooooo';\n      });\n    }, 1000);\n    return () => {\n      clearInterval(interval);\n    };\n  }, [example, setExample]);\n\n  const isDark = colorScheme === 'dark';\n  const dynamicStyles = createDynamicStyles(isDark);\n\n  return (\n    <View style={[styles.container, dynamicStyles.container]}>\n      <Text style={[styles.keys, dynamicStyles.keys]}>\n        Available Keys: {keys.join(', ')}\n      </Text>\n      <View style={styles.row}>\n        <Text style={[styles.title, dynamicStyles.title]}>Key:</Text>\n        <TextInput\n          placeholder=\"Key\"\n          placeholderTextColor={isDark ? '#999' : '#666'}\n          style={[styles.textInput, dynamicStyles.textInput]}\n          value={key}\n          onChangeText={setKey}\n        />\n      </View>\n      <View style={styles.row}>\n        <Text style={[styles.title, dynamicStyles.title]}>Value:</Text>\n        <TextInput\n          placeholder=\"Value\"\n          placeholderTextColor={isDark ? '#999' : '#666'}\n          style={[styles.textInput, dynamicStyles.textInput]}\n          value={text}\n          onChangeText={setText}\n        />\n      </View>\n      <Button onPress={save} title=\"Save to MMKV\" />\n      <Button onPress={read} title=\"Read from MMKV\" />\n    </View>\n  );\n}\n\nconst createDynamicStyles = (isDark: boolean) =>\n  StyleSheet.create({\n    container: {\n      backgroundColor: isDark ? '#000' : '#fff',\n    },\n    keys: {\n      color: isDark ? '#ccc' : '#666',\n    },\n    title: {\n      color: isDark ? '#fff' : '#000',\n    },\n    textInput: {\n      color: isDark ? '#fff' : '#000',\n      borderColor: isDark ? '#555' : '#000',\n      backgroundColor: isDark ? '#222' : '#fff',\n    },\n  });\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    alignItems: 'center',\n    justifyContent: 'center',\n    paddingHorizontal: 20,\n  },\n  keys: {\n    fontSize: 14,\n  },\n  title: {\n    fontSize: 16,\n    marginRight: 10,\n  },\n  row: {\n    flexDirection: 'row',\n    alignItems: 'center',\n  },\n  textInput: {\n    flex: 1,\n    marginVertical: 20,\n    borderWidth: StyleSheet.hairlineWidth,\n    borderRadius: 5,\n    padding: 10,\n  },\n});\n"
  },
  {
    "path": "example/tsconfig.json",
    "content": "{\n  \"extends\": \"@react-native/typescript-config\",\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"exclude\": [\"**/node_modules\", \"**/Pods\"]\n}\n"
  },
  {
    "path": "jest.config.js",
    "content": "module.exports = {\n  detectOpenHandles: true,\n  forceExit: true,\n  projects: [\n    {\n      displayName: 'react-native-mmkv',\n      testMatch: ['<rootDir>/packages/react-native-mmkv/src/**/__tests__/**/*.(ts|tsx|js)', '<rootDir>/packages/react-native-mmkv/src/**/*.(test|spec).(ts|tsx|js)'],\n      preset: 'react-native',\n      transform: {\n        '^.+\\\\.(js|jsx|ts|tsx)$': 'babel-jest'\n      },\n      transformIgnorePatterns: [\n        'node_modules/(?!(react-native|@react-native|react-native-.*)/)'\n      ],\n      moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],\n      testPathIgnorePatterns: ['<rootDir>/packages/react-native-mmkv/lib/'],\n      moduleNameMapper: {\n        '^react-native-nitro-modules$': '<rootDir>/packages/react-native-mmkv/__mocks__/react-native-nitro-modules.js'\n      },\n      collectCoverageFrom: [\n        'packages/react-native-mmkv/src/**/*.{ts,tsx}',\n        '!packages/react-native-mmkv/src/**/*.d.ts'\n      ]\n    },\n  ]\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"react-native-mmkv-monorepo\",\n  \"private\": true,\n  \"version\": \"4.3.0\",\n  \"repository\": \"https://github.com/mrousavy/react-native-mmkv.git\",\n  \"author\": \"Marc Rousavy <me@mrousavy.com> (https://github.com/mrousavy)\",\n  \"workspaces\": [\n    \"packages/react-native-mmkv\",\n    \"example\"\n  ],\n  \"scripts\": {\n    \"postinstall\": \"bun mmkv build\",\n    \"bootstrap\": \"bun i && bun run build && cd example && bundle install && bun pods\",\n    \"typecheck\": \"bun --filter=\\\"**\\\" typecheck\",\n    \"lint\": \"bun --filter=\\\"**\\\" lint\",\n    \"lint-ci\": \"bun --filter=\\\"**\\\" lint-ci\",\n    \"lint-cpp\": \"./scripts/clang-format.sh\",\n    \"release\": \"./scripts/release.sh\",\n    \"specs\": \"bun mmkv specs\",\n    \"mmkv\": \"bun --cwd packages/react-native-mmkv\",\n    \"example\": \"bun --cwd example\",\n    \"test\": \"jest\"\n  },\n  \"devDependencies\": {\n    \"@babel/preset-env\": \"^7.28.3\",\n    \"@babel/preset-react\": \"^7.27.1\",\n    \"@babel/preset-typescript\": \"^7.27.1\",\n    \"@jamesacarr/eslint-formatter-github-actions\": \"^0.2.0\",\n    \"@release-it-plugins/workspaces\": \"^5.0.3\",\n    \"@release-it/bumper\": \"^7.0.5\",\n    \"@release-it/conventional-changelog\": \"^10.0.1\",\n    \"@types/bun\": \"latest\",\n    \"release-it\": \"^19.0.4\"\n  },\n  \"release-it\": {\n    \"npm\": {\n      \"publish\": false\n    },\n    \"git\": {\n      \"commitMessage\": \"chore: release ${version}\",\n      \"tagName\": \"v${version}\",\n      \"requireCleanWorkingDir\": false\n    },\n    \"github\": {\n      \"release\": true\n    },\n    \"hooks\": {\n      \"before:release\": \"bun i && bun mmkv build\",\n      \"before:git\": \"bun i && git add bun.lock && bun example bundle-install && bun example pods && git add example/ios/Podfile.lock\"\n    },\n    \"plugins\": {\n      \"@release-it/bumper\": {\n        \"out\": [\n          {\n            \"file\": \"example/package.json\",\n            \"path\": \"version\"\n          }\n        ]\n      },\n      \"@release-it/conventional-changelog\": {\n        \"preset\": {\n          \"name\": \"conventionalcommits\",\n          \"types\": [\n            {\n              \"type\": \"feat\",\n              \"section\": \"✨ Features\"\n            },\n            {\n              \"type\": \"perf\",\n              \"section\": \"💨 Performance Improvements\"\n            },\n            {\n              \"type\": \"fix\",\n              \"section\": \"🐛 Bug Fixes\"\n            },\n            {\n              \"type\": \"chore(deps)\",\n              \"section\": \"🛠️ Dependency Upgrades\"\n            },\n            {\n              \"type\": \"docs\",\n              \"section\": \"📚 Documentation\"\n            }\n          ]\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/.gitignore",
    "content": "# OSX\n#\n.DS_Store\n\n# XDE\n.expo/\n\n# VSCode\n.vscode/\njsconfig.json\n\n# Xcode\n#\nbuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!default.perspectivev3\nxcuserdata\n*.xccheckout\n*.moved-aside\nDerivedData\n*.hmap\n*.ipa\n*.xcuserstate\nproject.xcworkspace\n\n# Android/IJ\n#\n.classpath\n.cxx\n.gradle\n.idea\n.project\n.settings\nlocal.properties\nandroid.iml\n\n# Cocoapods\n#\nexample/ios/Pods\n\n# Ruby\nexample/vendor/\n\n# node.js\n#\nnode_modules/\nnpm-debug.log\nyarn-debug.log\nyarn-error.log\n\n# BUCK\nbuck-out/\n\\.buckd/\nandroid/app/libs\nandroid/keystores/debug.keystore\n\n# Yarn\n.yarn/*\n!.yarn/patches\n!.yarn/plugins\n!.yarn/releases\n!.yarn/sdks\n!.yarn/versions\n\n# Expo\n.expo/\n\n# Turborepo\n.turbo/\n\n# generated by bob\nlib/\n"
  },
  {
    "path": "packages/react-native-mmkv/.watchmanconfig",
    "content": "{}"
  },
  {
    "path": "packages/react-native-mmkv/NitroMmkv.podspec",
    "content": "require \"json\"\n\npackage = JSON.parse(File.read(File.join(__dir__, \"package.json\")))\n\nPod::Spec.new do |s|\n  s.name         = \"NitroMmkv\"\n  s.version      = package[\"version\"]\n  s.summary      = package[\"description\"]\n  s.homepage     = package[\"homepage\"]\n  s.license      = package[\"license\"]\n  s.authors      = package[\"author\"]\n\n  s.platforms    = { :ios => min_ios_version_supported, :visionos => 1.0, :tvos => \"12.0\", :osx => \"10.14\" }\n  s.source       = { :git => \"https://github.com/mrousavy/react-native-mmkv.git\", :tag => \"#{s.version}\" }\n\n  s.source_files = [\n    # Implementation (Swift)\n    \"ios/**/*.{swift}\",\n    # Autolinking/Registration (Objective-C++)\n    \"ios/**/*.{m,mm}\",\n    # Implementation (C++ objects)\n    \"cpp/**/*.{hpp,cpp}\",\n  ]\n\n  # Add MMKV Core dependency\n  s.compiler_flags = '-x objective-c++'\n  s.dependency 'MMKVCore', '2.4.0'\n\n  # Optionally configure MMKV log level via Podfile ($MMKVLogLevel) or env var (MMKV_LOG_LEVEL)\n  mmkv_log_level = $MMKVLogLevel || ENV['MMKV_LOG_LEVEL']\n  gcc_preprocessor_defs = \"$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES\"\n  if mmkv_log_level != nil && mmkv_log_level.to_s != \"\"\n    gcc_preprocessor_defs += \" MMKV_LOG_LEVEL=#{mmkv_log_level}\"\n  end\n\n  # TODO: Remove when no one uses RN 0.79 anymore\n  # Add support for React Native 0.79 or below\n  s.pod_target_xcconfig = {\n    \"HEADER_SEARCH_PATHS\" => [\"${PODS_ROOT}/RCT-Folly\"],\n    \"GCC_PREPROCESSOR_DEFINITIONS\" => gcc_preprocessor_defs,\n    \"OTHER_CPLUSPLUSFLAGS\" => \"$(inherited) -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1\"\n  }\n\n  load 'nitrogen/generated/ios/NitroMmkv+autolinking.rb'\n  add_nitrogen_files(s)\n\n  s.dependency 'React-jsi'\n  s.dependency 'React-callinvoker'\n  install_modules_dependencies(s)\nend\n"
  },
  {
    "path": "packages/react-native-mmkv/README.md",
    "content": "# react-native-mmkv\n\nSee https://github.com/mrousavy/react-native-mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/__bun_tests__/use-jest-instead.test.ts",
    "content": "import { test } from 'bun:test'\n\ntest('❌ DO NOT USE `bun test` - Use `bun run test` instead!', () => {\n  console.error(`\n🚨 WRONG TEST RUNNER! 🚨\n\nYou ran: \\`bun test\\`\nYou should run: \\`bun run test\\`\n\nWhy?\n- This project uses Jest for testing React Native components\n- Bun's test runner doesn't support Flow syntax in React Native\n- Jest is configured with proper Babel transforms for TypeScript/JSX\n- MMKV's mock system is designed for Jest environment\n\nTo run tests correctly:\n  bun run test\n\nThis will use Jest with the proper configuration.\n  `)\n\n  throw new Error(\"Use 'bun run test' instead of 'bun test'!\")\n})\n"
  },
  {
    "path": "packages/react-native-mmkv/__mocks__/react-native-nitro-modules.js",
    "content": "// Mock for react-native-nitro-modules in Jest environment\nmodule.exports = {\n  NitroModules: {\n    createHybridObject: jest.fn(() => {\n      // Return a mock object that won't be used since MMKV has its own mock\n      return {}\n    }),\n  },\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/android/CMakeLists.txt",
    "content": "project(NitroMmkv)\ncmake_minimum_required(VERSION 3.9.0)\n\nset (PACKAGE_NAME NitroMmkv)\nset (CMAKE_VERBOSE_MAKEFILE ON)\nset (CMAKE_CXX_STANDARD 20)\n\n# Optionally configure MMKV log level (passed from Gradle as -DMMKV_LOG_LEVEL=<0-4>)\nif(DEFINED MMKV_LOG_LEVEL)\n  add_definitions(-DMMKV_LOG_LEVEL=${MMKV_LOG_LEVEL})\nendif()\n\n# Find all C++ files (shared and platform specifics)\nfile(GLOB_RECURSE shared_files RELATIVE ${CMAKE_SOURCE_DIR}\n     \"../cpp/**.cpp\"\n)\nfile(GLOB_RECURSE android_files RELATIVE ${CMAKE_SOURCE_DIR}\n     \"src/main/cpp/**.cpp\"\n)\n\n# Define C++ library and add all sources\nadd_library(${PACKAGE_NAME} SHARED\n            ${shared_files}\n            ${android_files}\n)\n\n# Find MMKV prefab package (from mmkv-shared gradle dependency)\nfind_package(mmkv REQUIRED CONFIG)\n\n# Add Nitrogen specs :)\ninclude(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroMmkv+autolinking.cmake)\n\n# Set up local includes\ninclude_directories(\n        \"src/main/cpp\"\n        \"../cpp\"\n)\n\nfind_library(LOG_LIB log)\n\n# Link all libraries together\ntarget_link_libraries(\n        ${PACKAGE_NAME}\n        ${LOG_LIB}\n        mmkv::mmkv                  # <-- MMKV core\n        android                     # <-- Android core\n)\n"
  },
  {
    "path": "packages/react-native-mmkv/android/build.gradle",
    "content": "buildscript {\n  repositories {\n    google()\n    mavenCentral()\n  }\n\n  dependencies {\n    classpath \"com.android.tools.build:gradle:9.1.0\"\n  }\n}\n\ndef reactNativeArchitectures() {\n  def value = rootProject.getProperties().get(\"reactNativeArchitectures\")\n  return value ? value.split(\",\") : [\"x86\", \"x86_64\", \"armeabi-v7a\", \"arm64-v8a\"]\n}\n\ndef isNewArchitectureEnabled() {\n  return rootProject.hasProperty(\"newArchEnabled\") && rootProject.getProperty(\"newArchEnabled\") == \"true\"\n}\n\napply plugin: \"com.android.library\"\napply plugin: 'org.jetbrains.kotlin.android'\napply from: '../nitrogen/generated/android/NitroMmkv+autolinking.gradle'\napply from: \"./fix-prefab.gradle\"\n\nif (isNewArchitectureEnabled()) {\n  apply plugin: \"com.facebook.react\"\n}\n\ndef getExtOrDefault(name) {\n  return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties[\"NitroMmkv_\" + name]\n}\n\ndef getExtOrIntegerDefault(name) {\n  return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties[\"NitroMmkv_\" + name]).toInteger()\n}\n\nandroid {\n  namespace \"com.margelo.nitro.mmkv\"\n\n  ndkVersion getExtOrDefault(\"ndkVersion\")\n  compileSdkVersion getExtOrIntegerDefault(\"compileSdkVersion\")\n\n  defaultConfig {\n    minSdkVersion getExtOrIntegerDefault(\"minSdkVersion\")\n    targetSdkVersion getExtOrIntegerDefault(\"targetSdkVersion\")\n    buildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\n\n    externalNativeBuild {\n      cmake {\n        cppFlags \"-frtti -fexceptions -Wall -Wextra -fstack-protector-all\"\n        def mmkvLogLevel = rootProject.hasProperty(\"MMKV_logLevel\") ? rootProject.property(\"MMKV_logLevel\") : null\n        if (mmkvLogLevel != null && mmkvLogLevel != \"\") {\n          arguments \"-DANDROID_STL=c++_shared\", \"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON\", \"-DMMKV_LOG_LEVEL=${mmkvLogLevel}\"\n        } else {\n          arguments \"-DANDROID_STL=c++_shared\", \"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON\"\n        }\n        abiFilters (*reactNativeArchitectures())\n\n        buildTypes {\n          debug {\n            cppFlags \"-O1 -g\"\n          }\n          release {\n            cppFlags \"-O2\"\n          }\n        }\n      }\n    }\n  }\n\n  externalNativeBuild {\n    cmake {\n      path \"CMakeLists.txt\"\n    }\n  }\n\n  packagingOptions {\n    excludes = [\n            \"META-INF\",\n            \"META-INF/**\",\n            \"**/libNitroModules.so\",\n            \"**/libc++_shared.so\",\n            \"**/libfbjni.so\",\n            \"**/libjsi.so\",\n            \"**/libfolly_json.so\",\n            \"**/libfolly_runtime.so\",\n            \"**/libglog.so\",\n            \"**/libhermes.so\",\n            \"**/libhermes-executor-debug.so\",\n            \"**/libhermes_executor.so\",\n            \"**/libreactnative.so\",\n            \"**/libreactnativejni.so\",\n            \"**/libturbomodulejsijni.so\",\n            \"**/libreact_nativemodule_core.so\",\n            \"**/libjscexecutor.so\"\n    ]\n  }\n\n  buildFeatures {\n    buildConfig true\n    prefab true\n  }\n\n  buildTypes {\n    release {\n      minifyEnabled false\n    }\n  }\n\n  lintOptions {\n    disable \"GradleCompatible\"\n  }\n\n  compileOptions {\n    sourceCompatibility JavaVersion.VERSION_1_8\n    targetCompatibility JavaVersion.VERSION_1_8\n  }\n\n  sourceSets {\n    main {\n      if (isNewArchitectureEnabled()) {\n        java.srcDirs += [\n          // React Codegen files\n          \"${project.buildDir}/generated/source/codegen/java\"\n        ]\n      }\n    }\n  }\n}\n\nrepositories {\n  mavenCentral()\n  google()\n}\n\n\ndependencies {\n  // For < 0.71, this will be from the local maven repo\n  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin\n  //noinspection GradleDynamicVersion\n  implementation \"com.facebook.react:react-native:+\"\n\n  // Add a dependency on NitroModules\n  implementation project(\":react-native-nitro-modules\")\n\n  // Add a dependency on mmkv core (this ships a C++ prefab)\n  implementation \"io.github.zhongwuzw:mmkv:2.4.0\"\n}\n\n"
  },
  {
    "path": "packages/react-native-mmkv/android/fix-prefab.gradle",
    "content": "tasks.configureEach { task ->\n  // Make sure that we generate our prefab publication file only after having built the native library\n  // so that not a header publication file, but a full configuration publication will be generated, which\n  // will include the .so file\n\n  def prefabConfigurePattern = ~/^prefab(.+)ConfigurePackage$/\n  def matcher = task.name =~ prefabConfigurePattern\n  if (matcher.matches()) {\n    def variantName = matcher[0][1]\n    task.outputs.upToDateWhen { false }\n    task.dependsOn(\"externalNativeBuild${variantName}\")\n  }\n}\n\nafterEvaluate {\n  def abis = reactNativeArchitectures()\n  rootProject.allprojects.each { proj ->\n    if (proj === rootProject) return\n\n    def dependsOnThisLib = proj.configurations.findAll { it.canBeResolved }.any { config ->\n      config.dependencies.any { dep ->\n        dep.group == project.group && dep.name == project.name\n      }\n    }\n    if (!dependsOnThisLib && proj != project) return\n\n    if (!proj.plugins.hasPlugin('com.android.application') && !proj.plugins.hasPlugin('com.android.library')) {\n      return\n    }\n\n    def variants = proj.android.hasProperty('applicationVariants') ? proj.android.applicationVariants : proj.android.libraryVariants\n    // Touch the prefab_config.json files to ensure that in ExternalNativeJsonGenerator.kt we will re-trigger the prefab CLI to\n    // generate a libnameConfig.cmake file that will contain our native library (.so).\n    // See this condition: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ExternalNativeJsonGenerator.kt;l=207-219?q=createPrefabBuildSystemGlue\n    variants.all { variant ->\n      def variantName = variant.name\n      abis.each { abi ->\n        def searchDir = new File(proj.projectDir, \".cxx/${variantName}\")\n        if (!searchDir.exists()) return\n        def matches = []\n        searchDir.eachDir { randomDir ->\n          def prefabFile = new File(randomDir, \"${abi}/prefab_config.json\")\n          if (prefabFile.exists()) matches << prefabFile\n        }\n        matches.each { prefabConfig ->\n          prefabConfig.setLastModified(System.currentTimeMillis())\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/android/gradle.properties",
    "content": "NitroMmkv_kotlinVersion=2.1.20\nNitroMmkv_minSdkVersion=23\nNitroMmkv_targetSdkVersion=36\nNitroMmkv_compileSdkVersion=36\nNitroMmkv_ndkVersion=27.1.12297006\n"
  },
  {
    "path": "packages/react-native-mmkv/android/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n</manifest>\n"
  },
  {
    "path": "packages/react-native-mmkv/android/src/main/cpp/cpp-adapter.cpp",
    "content": "#include \"NitroMmkvOnLoad.hpp\"\n#include <fbjni/fbjni.h>\n#include <jni.h>\n\nJNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {\n  return facebook::jni::initialize(vm, []() { margelo::nitro::mmkv::registerAllNatives(); });\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/android/src/main/java/com/margelo/nitro/mmkv/HybridMMKVPlatformContext.kt",
    "content": "package com.margelo.nitro.mmkv\n\nimport androidx.annotation.Keep\nimport com.facebook.common.internal.DoNotStrip\nimport com.margelo.nitro.NitroModules\n\n@DoNotStrip\n@Keep\nclass HybridMMKVPlatformContext: HybridMMKVPlatformContextSpec() {\n    override fun getBaseDirectory(): String {\n        val context = NitroModules.applicationContext ?: throw Error(\"Cannot get MMKV base directory - No Android Context available!\")\n        return context.filesDir.absolutePath + \"/mmkv\";\n    }\n\n    override fun getAppGroupDirectory(): String? {\n        // AppGroups do not exist on Android. It's iOS only.\n        throw Error(\"getAppGroupDirectory() is not supported on Android! It's iOS only.\")\n    }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/android/src/main/java/com/margelo/nitro/mmkv/NitroMmkvPackage.java",
    "content": "package com.margelo.nitro.mmkv;\n\nimport android.util.Log;\n\nimport androidx.annotation.Nullable;\n\nimport com.facebook.react.bridge.NativeModule;\nimport com.facebook.react.bridge.ReactApplicationContext;\nimport com.facebook.react.module.model.ReactModuleInfoProvider;\nimport com.facebook.react.TurboReactPackage;\nimport com.margelo.nitro.core.HybridObject;\n\nimport java.util.HashMap;\nimport java.util.function.Supplier;\n\npublic class NitroMmkvPackage extends TurboReactPackage {\n  @Nullable\n  @Override\n  public NativeModule getModule(String name, ReactApplicationContext reactContext) {\n    return null;\n  }\n\n  @Override\n  public ReactModuleInfoProvider getReactModuleInfoProvider() {\n    return () -> {\n        return new HashMap<>();\n    };\n  }\n\n  static {\n    NitroMmkvOnLoad.initializeNative();\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/babel.config.js",
    "content": "module.exports = {\n  presets: ['module:@react-native/babel-preset'],\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/cpp/HybridMMKV.cpp",
    "content": "//\n//  HybridMMKV.cpp\n//  react-native-mmkv\n//\n//  Created by Marc Rousavy on 21.08.2025.\n//\n\n#include \"HybridMMKV.hpp\"\n#include \"MMKVTypes.hpp\"\n#include \"MMKVValueChangedListenerRegistry.hpp\"\n#include \"ManagedMMBuffer.hpp\"\n#include <NitroModules/NitroLogger.hpp>\n\nnamespace margelo::nitro::mmkv {\n\nHybridMMKV::HybridMMKV(const Configuration& config) : HybridObject(TAG) {\n  MMKVMode mmkvMode = getMMKVMode(config);\n  if (config.readOnly.value_or(false)) {\n    mmkvMode = mmkvMode | MMKVMode::MMKV_READ_ONLY;\n  }\n  bool useAes256Encryption = config.encryptionType.value_or(EncryptionType::AES_128) == EncryptionType::AES_256;\n  std::string encryptionKey = config.encryptionKey.value_or(\"\");\n  std::string* encryptionKeyPtr = encryptionKey.size() > 0 ? &encryptionKey : nullptr;\n  std::string rootPath = config.path.value_or(\"\");\n  std::string* rootPathPtr = rootPath.size() > 0 ? &rootPath : nullptr;\n  bool compareBeforeSet = config.compareBeforeSet.value_or(false);\n\n  MMKVConfig mmkvConfig{.mode = mmkvMode,\n                        .aes256 = useAes256Encryption,\n                        .cryptKey = encryptionKeyPtr,\n                        .rootPath = rootPathPtr,\n                        .enableCompareBeforeSet = compareBeforeSet};\n\n  bool hasEncryptionKey = encryptionKey.size() > 0;\n  Logger::log(LogLevel::Info, TAG, \"Creating MMKV instance \\\"%s\\\"... (Path: %s, Encrypted: %s)\", config.id.c_str(), rootPath.c_str(),\n              hasEncryptionKey ? \"true\" : \"false\");\n\n  instance = MMKV::mmkvWithID(config.id, mmkvConfig);\n\n  if (instance == nullptr) [[unlikely]] {\n    // Check if instanceId is invalid\n    if (config.id.empty()) {\n      throw std::runtime_error(\"Failed to create MMKV instance! `id` cannot be empty!\");\n    }\n\n    if (useAes256Encryption) {\n      // With AES-256, the max key length is 32 bytes.\n      if (encryptionKey.size() > 32) [[unlikely]] {\n        throw std::runtime_error(\"Failed to create MMKV instance! `encryptionKey` cannot be longer \"\n                                 \"than 32 bytes with AES-256 encryption!\");\n      }\n    } else {\n      // With AES-128, the max key length is 16 bytes.\n      if (encryptionKey.size() > 16) [[unlikely]] {\n        throw std::runtime_error(\"Failed to create MMKV instance! `encryptionKey` cannot be longer \"\n                                 \"than 16 bytes with AES-128 encryption!\");\n      }\n    }\n\n    // Check if path is maybe invalid\n    if (rootPath.empty()) [[unlikely]] {\n      throw std::runtime_error(\"Failed to create MMKV instance! `path` cannot be empty!\");\n    }\n\n    throw std::runtime_error(\"Failed to create MMKV instance!\");\n  }\n}\n\nstd::string HybridMMKV::getId() {\n  return instance->mmapID();\n}\n\ndouble HybridMMKV::getLength() {\n  return instance->count();\n}\n\ndouble HybridMMKV::getSize() {\n  return getByteSize();\n}\n\ndouble HybridMMKV::getByteSize() {\n  return instance->actualSize();\n}\n\nbool HybridMMKV::getIsReadOnly() {\n  return instance->isReadOnly();\n}\n\nbool HybridMMKV::getIsEncrypted() {\n  return instance->isEncryptionEnabled();\n}\n\n// helper: overload pattern matching for lambdas\ntemplate <class... Ts>\nstruct overloaded : Ts... {\n  using Ts::operator()...;\n};\ntemplate <class... Ts>\noverloaded(Ts...) -> overloaded<Ts...>;\n\nvoid HybridMMKV::set(const std::string& key, const std::variant<bool, std::shared_ptr<ArrayBuffer>, std::string, double>& value) {\n  if (key.empty()) [[unlikely]] {\n    throw std::runtime_error(\"Cannot set a value for an empty key!\");\n  }\n\n  // Pattern-match each potential value in std::variant\n  bool successful = std::visit(overloaded{[&](bool b) {\n                                            // boolean\n                                            return instance->set(b, key);\n                                          },\n                                          [&](const std::shared_ptr<ArrayBuffer>& buf) {\n                                            // ArrayBuffer\n                                            MMBuffer buffer(buf->data(), buf->size(), MMBufferCopyFlag::MMBufferNoCopy);\n                                            return instance->set(std::move(buffer), key);\n                                          },\n                                          [&](const std::string& string) {\n                                            // string\n                                            return instance->set(string, key);\n                                          },\n                                          [&](double number) {\n                                            // number\n                                            return instance->set(number, key);\n                                          }},\n                               value);\n  if (!successful) [[unlikely]] {\n    throw std::runtime_error(\"Failed to set value for key \\\"\" + key + \"\\\"!\");\n  }\n\n  // Notify on changed\n  MMKVValueChangedListenerRegistry::notifyOnValueChanged(instance->mmapID(), key);\n}\n\nstd::optional<bool> HybridMMKV::getBoolean(const std::string& key) {\n  bool hasValue;\n  bool result = instance->getBool(key, /* defaultValue */ false, &hasValue);\n  if (hasValue) {\n    return result;\n  } else {\n    return std::nullopt;\n  }\n}\n\nstd::optional<std::string> HybridMMKV::getString(const std::string& key) {\n  std::string result;\n  bool hasValue = instance->getString(key, result, /* inplaceModification */ true);\n  if (hasValue) {\n    return result;\n  } else {\n    return std::nullopt;\n  }\n}\n\nstd::optional<double> HybridMMKV::getNumber(const std::string& key) {\n  bool hasValue;\n  double result = instance->getDouble(key, /* defaultValue */ 0.0, &hasValue);\n  if (hasValue) {\n    return result;\n  } else {\n    return std::nullopt;\n  }\n}\n\nstd::optional<std::shared_ptr<ArrayBuffer>> HybridMMKV::getBuffer(const std::string& key) {\n  MMBuffer result;\n  bool hasValue = instance->getBytes(key, result);\n  if (hasValue) {\n    return std::make_shared<ManagedMMBuffer>(std::move(result));\n  } else {\n    return std::nullopt;\n  }\n}\n\nbool HybridMMKV::contains(const std::string& key) {\n  return instance->containsKey(key);\n}\n\nbool HybridMMKV::remove(const std::string& key) {\n  bool wasRemoved = instance->removeValueForKey(key);\n  if (wasRemoved) {\n    // Notify on changed\n    MMKVValueChangedListenerRegistry::notifyOnValueChanged(instance->mmapID(), key);\n  }\n  return wasRemoved;\n}\n\nstd::vector<std::string> HybridMMKV::getAllKeys() {\n  return instance->allKeys();\n}\n\nvoid HybridMMKV::clearAll() {\n  auto keysBefore = getAllKeys();\n  instance->clearAll();\n  for (const auto& key : keysBefore) {\n    // Notify on changed\n    MMKVValueChangedListenerRegistry::notifyOnValueChanged(instance->mmapID(), key);\n  }\n}\n\nvoid HybridMMKV::recrypt(const std::optional<std::string>& key) {\n  if (key.has_value()) {\n    encrypt(key.value(), std::nullopt);\n  } else {\n    decrypt();\n  }\n}\n\nvoid HybridMMKV::encrypt(const std::string& key, std::optional<EncryptionType> encryptionType) {\n  bool isAes256Encryption = encryptionType == EncryptionType::AES_256;\n  bool successful = instance->reKey(key, isAes256Encryption);\n  if (!successful) {\n    throw std::runtime_error(\"Failed to encrypt MMKV instance!\");\n  }\n}\n\nvoid HybridMMKV::decrypt() {\n  bool successful = instance->reKey(\"\");\n  if (!successful) [[unlikely]] {\n    throw std::runtime_error(\"Failed to decrypt MMKV instance!\");\n  }\n}\n\nvoid HybridMMKV::trim() {\n  instance->trim();\n  instance->clearMemoryCache();\n}\n\nListener HybridMMKV::addOnValueChangedListener(const std::function<void(const std::string& /* key */)>& onValueChanged) {\n  // Add listener\n  auto mmkvID = instance->mmapID();\n  auto listenerID = MMKVValueChangedListenerRegistry::addListener(mmkvID, onValueChanged);\n\n  return Listener([=]() {\n    // remove()\n    MMKVValueChangedListenerRegistry::removeListener(mmkvID, listenerID);\n  });\n}\n\nMMKVMode HybridMMKV::getMMKVMode(const Configuration& config) {\n  if (!config.mode.has_value()) {\n    return ::mmkv::MMKV_SINGLE_PROCESS;\n  }\n  switch (config.mode.value()) {\n    case Mode::SINGLE_PROCESS:\n      return ::mmkv::MMKV_SINGLE_PROCESS;\n    case Mode::MULTI_PROCESS:\n      return ::mmkv::MMKV_MULTI_PROCESS;\n  }\n  throw std::runtime_error(\"Invalid MMKV Mode value!\");\n}\n\ndouble HybridMMKV::importAllFrom(const std::shared_ptr<HybridMMKVSpec>& other) {\n  auto hybridMMKV = std::dynamic_pointer_cast<HybridMMKV>(other);\n  if (hybridMMKV == nullptr) [[unlikely]] {\n    throw std::runtime_error(\"The given `MMKV` instance is not of type `HybridMMKV`!\");\n  }\n\n  size_t importedCount = instance->importFrom(hybridMMKV->instance);\n  return static_cast<double>(importedCount);\n}\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/cpp/HybridMMKV.hpp",
    "content": "//\n//  HybridMMKV.hpp\n//  react-native-mmkv\n//\n//  Created by Marc Rousavy on 21.08.2025.\n//\n\n#pragma once\n\n#include \"Configuration.hpp\"\n#include \"HybridMMKVSpec.hpp\"\n#include \"MMKVTypes.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\nclass HybridMMKV final : public HybridMMKVSpec {\npublic:\n  explicit HybridMMKV(const Configuration& configuration);\n\npublic:\n  // Properties\n  std::string getId() override;\n  double getSize() override;\n  double getByteSize() override;\n  double getLength() override;\n  bool getIsReadOnly() override;\n  bool getIsEncrypted() override;\n\npublic:\n  // Methods\n  void set(const std::string& key, const std::variant<bool, std::shared_ptr<ArrayBuffer>, std::string, double>& value) override;\n  std::optional<bool> getBoolean(const std::string& key) override;\n  std::optional<std::string> getString(const std::string& key) override;\n  std::optional<double> getNumber(const std::string& key) override;\n  std::optional<std::shared_ptr<ArrayBuffer>> getBuffer(const std::string& key) override;\n  bool contains(const std::string& key) override;\n  bool remove(const std::string& key) override;\n  std::vector<std::string> getAllKeys() override;\n  void clearAll() override;\n  void recrypt(const std::optional<std::string>& key) override;\n  void encrypt(const std::string& key, std::optional<EncryptionType> encryptionType) override;\n  void decrypt() override;\n  void trim() override;\n  Listener addOnValueChangedListener(const std::function<void(const std::string& /* key */)>& onValueChanged) override;\n  double importAllFrom(const std::shared_ptr<HybridMMKVSpec>& other) override;\n\nprivate:\n  static MMKVMode getMMKVMode(const Configuration& config);\n\nprivate:\n  MMKV* instance;\n};\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/cpp/HybridMMKVFactory.cpp",
    "content": "//\n//  HybridMMKVFactory.cpp\n//  react-native-mmkv\n//\n//  Created by Marc Rousavy on 21.08.2025.\n//\n\n#include \"HybridMMKVFactory.hpp\"\n#include \"HybridMMKV.hpp\"\n#include \"MMKVTypes.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\nstd::string HybridMMKVFactory::getDefaultMMKVInstanceId() {\n  return DEFAULT_MMAP_ID;\n}\n\nvoid HybridMMKVFactory::initializeMMKV(const std::string& rootPath) {\n  Logger::log(LogLevel::Info, TAG, \"Initializing MMKV with rootPath=%s\", rootPath.c_str());\n\n  MMKVLogLevel logLevel = static_cast<MMKVLogLevel>(MMKV_LOG_LEVEL);\n  MMKV::initializeMMKV(rootPath, logLevel);\n}\n\nstd::shared_ptr<HybridMMKVSpec> HybridMMKVFactory::createMMKV(const Configuration& configuration) {\n  return std::make_shared<HybridMMKV>(configuration);\n}\n\nbool HybridMMKVFactory::deleteMMKV(const std::string& id) {\n  return MMKV::removeStorage(id);\n}\n\nbool HybridMMKVFactory::existsMMKV(const std::string& id) {\n  return MMKV::checkExist(id);\n}\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/cpp/HybridMMKVFactory.hpp",
    "content": "//\n//  HybridMMKVFactory.hpp\n//  react-native-mmkv\n//\n//  Created by Marc Rousavy on 21.08.2025.\n//\n\n#pragma once\n\n#include \"HybridMMKVFactorySpec.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\nclass HybridMMKVFactory final : public HybridMMKVFactorySpec {\npublic:\n  HybridMMKVFactory() : HybridObject(TAG) {}\n\npublic:\n  std::string getDefaultMMKVInstanceId() override;\n  void initializeMMKV(const std::string& rootPath) override;\n\n  std::shared_ptr<HybridMMKVSpec> createMMKV(const Configuration& configuration) override;\n  bool deleteMMKV(const std::string& id) override;\n  bool existsMMKV(const std::string& id) override;\n};\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/cpp/MMKVTypes.hpp",
    "content": "//\n//  MMKVTypes.h\n//  react-native-mmkv\n//\n//  Created by Brad Anderson on 10.08.2025.\n//  Platform-specific MMKV type unification header\n//\n\n#pragma once\n\n// Platform-specific MMKV includes\n#ifdef __ANDROID__\n#include <MMKV/MMKV.h>\n\n// On Android, bring global namespace types into mmkv namespace for consistency\nnamespace mmkv {\nusing MMKV = ::MMKV;\nusing MMKVMode = ::MMKVMode;\nusing MMKVLogLevel = ::MMKVLogLevel;\n\n// Constants - bring into mmkv namespace\nconstexpr auto MMKVLogDebug = ::MMKVLogDebug;\nconstexpr auto MMKVLogInfo = ::MMKVLogInfo;\nconstexpr auto MMKVLogWarning = ::MMKVLogWarning;\nconstexpr auto MMKVLogError = ::MMKVLogError;\nconstexpr auto MMKVLogNone = ::MMKVLogNone;\n\nconstexpr auto MMKV_SINGLE_PROCESS = ::MMKV_SINGLE_PROCESS;\nconstexpr auto MMKV_MULTI_PROCESS = ::MMKV_MULTI_PROCESS;\nconstexpr auto MMKV_READ_ONLY = ::MMKVMode::MMKV_READ_ONLY;\n} // namespace mmkv\n\n#else\n#include <MMKVCore/MMKV.h>\n// iOS already has everything in mmkv:: namespace\n#endif\n\n/**\n * Unified MMKV namespace usage for cross-platform compatibility.\n *\n * After including this header, use:\n * - mmkv::MMKV for the main class\n * - mmkv::MMKVMode for mode enum\n * - mmkv::MMKVLogLevel for log level enum\n * - mmkv::MMBuffer for buffer type\n * - mmkv::MMKV_SINGLE_PROCESS / mmkv::MMKV_MULTI_PROCESS for modes\n * - mmkv::MMKVLogDebug, etc. for log levels\n */\n\nusing namespace mmkv;\n\n// Default MMKV log level if not configured at build time\n#ifndef MMKV_LOG_LEVEL\n#ifdef NITRO_DEBUG\n#define MMKV_LOG_LEVEL 0\n#else\n#define MMKV_LOG_LEVEL 3\n#endif\n#endif\n#if MMKV_LOG_LEVEL < 0 || MMKV_LOG_LEVEL > 4\n#error \"MMKV_LOG_LEVEL must be between 0 (Debug) and 4 (None)\"\n#endif\n"
  },
  {
    "path": "packages/react-native-mmkv/cpp/MMKVValueChangedListenerRegistry.cpp",
    "content": "//\n//  MMKVValueChangedListenerRegistry.cpp\n//  react-native-mmkv\n//\n//  Created by Marc Rousavy on 21.08.2025.\n//\n\n#include \"MMKVValueChangedListenerRegistry.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\n// static members\nstd::atomic<ListenerID> MMKVValueChangedListenerRegistry::_listenersCounter = 0;\nstd::unordered_map<MMKVID, std::vector<ListenerSubscription>> MMKVValueChangedListenerRegistry::_listeners;\n\nListenerID MMKVValueChangedListenerRegistry::addListener(const std::string& mmkvID,\n                                                         const std::function<void(const std::string& /* key */)>& callback) {\n  // 1. Get (or create) the listeners array for these MMKV instances\n  auto& listeners = _listeners[mmkvID];\n  // 2. Get (and increment) the listener ID counter\n  auto id = _listenersCounter.fetch_add(1);\n  // 3. Add the listener to our array\n  listeners.push_back(ListenerSubscription{\n      .id = id,\n      .callback = callback,\n  });\n  // 4. Return the ID used to unsubscribe later on\n  return id;\n}\n\nvoid MMKVValueChangedListenerRegistry::removeListener(const std::string& mmkvID, ListenerID id) {\n  // 1. Get the listeners array for these MMKV instances\n  auto entry = _listeners.find(mmkvID);\n  if (entry == _listeners.end()) {\n    // There's no more listeners for this instance anyways.\n    return;\n  }\n  // 2. Remove all listeners where the ID matches. Should only be one.\n  auto& listeners = entry->second;\n  listeners.erase(std::remove_if(listeners.begin(), listeners.end(), [id](const ListenerSubscription& e) { return e.id == id; }),\n                  listeners.end());\n}\n\nvoid MMKVValueChangedListenerRegistry::notifyOnValueChanged(const std::string& mmkvID, const std::string& key) {\n  // 1. Get all listeners for the specific MMKV ID\n  auto entry = _listeners.find(mmkvID);\n  if (entry == _listeners.end()) {\n    // There are no listeners. Return\n    return;\n  }\n  // 2. Call each listener.\n  auto& listeners = entry->second;\n  for (const auto& listener : listeners) {\n    listener.callback(key);\n  }\n}\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/cpp/MMKVValueChangedListenerRegistry.hpp",
    "content": "//\n//  MMKVValueChangedListenerRegistry.hpp\n//  react-native-mmkv\n//\n//  Created by Marc Rousavy on 21.08.2025.\n//\n\n#include \"MMKVTypes.hpp\"\n#include <atomic>\n#include <unordered_map>\n\nnamespace margelo::nitro::mmkv {\n\nusing ListenerID = size_t;\nusing MMKVID = std::string;\n\nstruct ListenerSubscription {\n  ListenerID id;\n  std::function<void(const std::string& /* key */)> callback;\n};\n\n/**\n * Listeners are tracked across instances - so we need an extra static class for\n * the registry.\n */\nclass MMKVValueChangedListenerRegistry final {\npublic:\n  MMKVValueChangedListenerRegistry() = delete;\n  ~MMKVValueChangedListenerRegistry() = delete;\n\npublic:\n  static ListenerID addListener(const std::string& mmkvID, const std::function<void(const std::string& /* key */)>& callback);\n  static void removeListener(const std::string& mmkvID, ListenerID id);\n\npublic:\n  static void notifyOnValueChanged(const std::string& mmkvID, const std::string& key);\n\nprivate:\n  static std::atomic<ListenerID> _listenersCounter;\n  static std::unordered_map<MMKVID, std::vector<ListenerSubscription>> _listeners;\n};\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/cpp/ManagedMMBuffer.hpp",
    "content": "//\n//  ManagedMMBuffer.h\n//  react-native-mmkv\n//\n//  Created by Marc Rousavy on 25.03.24.\n//\n\n#pragma once\n\n#include \"MMKVTypes.hpp\"\n#include <NitroModules/ArrayBuffer.hpp>\n\nnamespace margelo::nitro::mmkv {\n\n/**\n An ArrayBuffer subclass that manages MMBuffer memory (by ownership).\n */\nclass ManagedMMBuffer final : public ArrayBuffer {\npublic:\n  explicit ManagedMMBuffer(MMBuffer&& buffer) : _buffer(std::move(buffer)) {}\n\npublic:\n  bool isOwner() const noexcept override {\n    return true;\n  }\n\npublic:\n  uint8_t* data() override {\n    return static_cast<uint8_t*>(_buffer.getPtr());\n  }\n\n  size_t size() const override {\n    return _buffer.length();\n  }\n\nprivate:\n  MMBuffer _buffer;\n};\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/ios/HybridMMKVPlatformContext.swift",
    "content": "//\n//  HybridMMKVPlatformContext.h\n//  react-native-mmkv\n//\n//  Created by Marc Rousavy on 25.03.24.\n//\n\nimport Foundation\nimport NitroModules\n\nclass HybridMMKVPlatformContext: HybridMMKVPlatformContextSpec {\n  static var directory: FileManager.SearchPathDirectory {\n#if os(tvOS)\n    return .cachesDirectory\n#else\n    return .documentDirectory\n#endif\n  }\n  \n  func getBaseDirectory() throws -> String {\n    // Get user documents directory\n    let paths = FileManager.default.urls(for: Self.directory, in: .userDomainMask)\n    guard let documentsPath = paths.first else {\n      throw RuntimeError.error(withMessage: \"Cannot find base-path to store MMKV files!\")\n    }\n    \n    // append /mmkv to it\n    let basePath = documentsPath.appendingPathComponent(\"mmkv\", conformingTo: .directory)\n    return basePath.path\n  }\n  \n  func getAppGroupDirectory() throws -> String? {\n    // Read `AppGroupIdentifier` from `Info.plist`\n    guard let appGroupID = Bundle.main.object(forInfoDictionaryKey: \"AppGroupIdentifier\") as? String else {\n      return nil\n    }\n    // Get the URL for the AppGroup\n    guard let url = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupID) else {\n      throw RuntimeError.error(withMessage: \"Container for AppGroup \\\"\\(appGroupID)\\\" not accessible\")\n    }\n    return url.path\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/nitro.json",
    "content": "{\n  \"$schema\": \"https://nitro.margelo.com/nitro.schema.json\",\n  \"cxxNamespace\": [\n    \"mmkv\"\n  ],\n  \"ios\": {\n    \"iosModuleName\": \"NitroMmkv\"\n  },\n  \"android\": {\n    \"androidNamespace\": [\n      \"mmkv\"\n    ],\n    \"androidCxxLibName\": \"NitroMmkv\"\n  },\n  \"autolinking\": {\n    \"MMKVFactory\": {\n      \"cpp\": \"HybridMMKVFactory\"\n    },\n    \"MMKVPlatformContext\": {\n      \"swift\": \"HybridMMKVPlatformContext\",\n      \"kotlin\": \"HybridMMKVPlatformContext\"\n    }\n  },\n  \"ignorePaths\": [\n    \"**/node_modules\"\n  ],\n  \"gitAttributesGeneratedFlag\": false\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/.gitattributes",
    "content": "** linguist-generated=false\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/android/NitroMmkv+autolinking.cmake",
    "content": "#\n# NitroMmkv+autolinking.cmake\n# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n# https://github.com/mrousavy/nitro\n# Copyright © Marc Rousavy @ Margelo\n#\n\n# This is a CMake file that adds all files generated by Nitrogen\n# to the current CMake project.\n#\n# To use it, add this to your CMakeLists.txt:\n# ```cmake\n# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroMmkv+autolinking.cmake)\n# ```\n\n# Define a flag to check if we are building properly\nadd_definitions(-DBUILDING_NITROMMKV_WITH_GENERATED_CMAKE_PROJECT)\n\n# Enable Raw Props parsing in react-native (for Nitro Views)\nadd_definitions(-DRN_SERIALIZABLE_STATE)\n\n# Add all headers that were generated by Nitrogen\ninclude_directories(\n  \"../nitrogen/generated/shared/c++\"\n  \"../nitrogen/generated/android/c++\"\n  \"../nitrogen/generated/android/\"\n)\n\n# Add all .cpp sources that were generated by Nitrogen\ntarget_sources(\n  # CMake project name (Android C++ library name)\n  NitroMmkv PRIVATE\n  # Autolinking Setup\n  ../nitrogen/generated/android/NitroMmkvOnLoad.cpp\n  # Shared Nitrogen C++ sources\n  ../nitrogen/generated/shared/c++/HybridMMKVSpec.cpp\n  ../nitrogen/generated/shared/c++/HybridMMKVFactorySpec.cpp\n  ../nitrogen/generated/shared/c++/HybridMMKVPlatformContextSpec.cpp\n  # Android-specific Nitrogen C++ sources\n  ../nitrogen/generated/android/c++/JHybridMMKVPlatformContextSpec.cpp\n)\n\n# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake\n# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake\ntarget_compile_definitions(\n  NitroMmkv PRIVATE\n  -DFOLLY_NO_CONFIG=1\n  -DFOLLY_HAVE_CLOCK_GETTIME=1\n  -DFOLLY_USE_LIBCPP=1\n  -DFOLLY_CFG_NO_COROUTINES=1\n  -DFOLLY_MOBILE=1\n  -DFOLLY_HAVE_RECVMMSG=1\n  -DFOLLY_HAVE_PTHREAD=1\n  # Once we target android-23 above, we can comment\n  # the following line. NDK uses GNU style stderror_r() after API 23.\n  -DFOLLY_HAVE_XSI_STRERROR_R=1\n)\n\n# Add all libraries required by the generated specs\nfind_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++\nfind_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)\nfind_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library\n\n# Link all libraries together\ntarget_link_libraries(\n        NitroMmkv\n        fbjni::fbjni                              # <-- Facebook C++ JNI helpers\n        ReactAndroid::jsi                         # <-- RN: JSI\n        react-native-nitro-modules::NitroModules  # <-- NitroModules Core :)\n)\n\n# Link react-native (different prefab between RN 0.75 and RN 0.76)\nif(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)\n    target_link_libraries(\n        NitroMmkv\n        ReactAndroid::reactnative                 # <-- RN: Native Modules umbrella prefab\n    )\nelse()\n    target_link_libraries(\n        NitroMmkv\n        ReactAndroid::react_nativemodule_core     # <-- RN: TurboModules Core\n    )\nendif()\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/android/NitroMmkv+autolinking.gradle",
    "content": "///\n/// NitroMmkv+autolinking.gradle\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n/// This is a Gradle file that adds all files generated by Nitrogen\n/// to the current Gradle project.\n///\n/// To use it, add this to your build.gradle:\n/// ```gradle\n/// apply from: '../nitrogen/generated/android/NitroMmkv+autolinking.gradle'\n/// ```\n\nlogger.warn(\"[NitroModules] 🔥 NitroMmkv is boosted by nitro!\")\n\nandroid {\n  sourceSets {\n    main {\n      java.srcDirs += [\n        // Nitrogen files\n        \"${project.projectDir}/../nitrogen/generated/android/kotlin\"\n      ]\n    }\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/android/NitroMmkvOnLoad.cpp",
    "content": "///\n/// NitroMmkvOnLoad.cpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#ifndef BUILDING_NITROMMKV_WITH_GENERATED_CMAKE_PROJECT\n#error NitroMmkvOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?\n#endif\n\n#include \"NitroMmkvOnLoad.hpp\"\n\n#include <jni.h>\n#include <fbjni/fbjni.h>\n#include <NitroModules/HybridObjectRegistry.hpp>\n\n#include \"JHybridMMKVPlatformContextSpec.hpp\"\n#include \"HybridMMKVFactory.hpp\"\n#include <NitroModules/DefaultConstructableObject.hpp>\n\nnamespace margelo::nitro::mmkv {\n\nint initialize(JavaVM* vm) {\n  return facebook::jni::initialize(vm, []() {\n    ::margelo::nitro::mmkv::registerAllNatives();\n  });\n}\n\nstruct JHybridMMKVPlatformContextSpecImpl: public jni::JavaClass<JHybridMMKVPlatformContextSpecImpl, JHybridMMKVPlatformContextSpec::JavaPart> {\n  static auto constexpr kJavaDescriptor = \"Lcom/margelo/nitro/mmkv/HybridMMKVPlatformContext;\";\n  static std::shared_ptr<JHybridMMKVPlatformContextSpec> create() {\n    static auto constructorFn = javaClassStatic()->getConstructor<JHybridMMKVPlatformContextSpecImpl::javaobject()>();\n    jni::local_ref<JHybridMMKVPlatformContextSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);\n    return javaPart->getJHybridMMKVPlatformContextSpec();\n  }\n};\n\nvoid registerAllNatives() {\n  using namespace margelo::nitro;\n  using namespace margelo::nitro::mmkv;\n\n  // Register native JNI methods\n  margelo::nitro::mmkv::JHybridMMKVPlatformContextSpec::CxxPart::registerNatives();\n\n  // Register Nitro Hybrid Objects\n  HybridObjectRegistry::registerHybridObjectConstructor(\n    \"MMKVFactory\",\n    []() -> std::shared_ptr<HybridObject> {\n      static_assert(std::is_default_constructible_v<HybridMMKVFactory>,\n                    \"The HybridObject \\\"HybridMMKVFactory\\\" is not default-constructible! \"\n                    \"Create a public constructor that takes zero arguments to be able to autolink this HybridObject.\");\n      return std::make_shared<HybridMMKVFactory>();\n    }\n  );\n  HybridObjectRegistry::registerHybridObjectConstructor(\n    \"MMKVPlatformContext\",\n    []() -> std::shared_ptr<HybridObject> {\n      return JHybridMMKVPlatformContextSpecImpl::create();\n    }\n  );\n}\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/android/NitroMmkvOnLoad.hpp",
    "content": "///\n/// NitroMmkvOnLoad.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#include <jni.h>\n#include <functional>\n#include <NitroModules/NitroDefines.hpp>\n\nnamespace margelo::nitro::mmkv {\n\n  [[deprecated(\"Use registerNatives() instead.\")]]\n  int initialize(JavaVM* vm);\n\n  /**\n   * Register the native (C++) part of NitroMmkv, and autolinks all Hybrid Objects.\n   * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),\n   * inside a `facebook::jni::initialize(vm, ...)` call.\n   * Example:\n   * ```cpp (cpp-adapter.cpp)\n   * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {\n   *   return facebook::jni::initialize(vm, []() {\n   *     // register all NitroMmkv HybridObjects\n   *     margelo::nitro::mmkv::registerNatives();\n   *     // any other custom registrations go here.\n   *   });\n   * }\n   * ```\n   */\n  void registerAllNatives();\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/android/c++/JHybridMMKVPlatformContextSpec.cpp",
    "content": "///\n/// JHybridMMKVPlatformContextSpec.cpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#include \"JHybridMMKVPlatformContextSpec.hpp\"\n\n\n\n#include <string>\n#include <optional>\n\nnamespace margelo::nitro::mmkv {\n\n  std::shared_ptr<JHybridMMKVPlatformContextSpec> JHybridMMKVPlatformContextSpec::JavaPart::getJHybridMMKVPlatformContextSpec() {\n    auto hybridObject = JHybridObject::JavaPart::getJHybridObject();\n    auto castHybridObject = std::dynamic_pointer_cast<JHybridMMKVPlatformContextSpec>(hybridObject);\n    if (castHybridObject == nullptr) [[unlikely]] {\n      throw std::runtime_error(\"Failed to downcast JHybridObject to JHybridMMKVPlatformContextSpec!\");\n    }\n    return castHybridObject;\n  }\n\n  jni::local_ref<JHybridMMKVPlatformContextSpec::CxxPart::jhybriddata> JHybridMMKVPlatformContextSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {\n    return makeCxxInstance(jThis);\n  }\n\n  std::shared_ptr<JHybridObject> JHybridMMKVPlatformContextSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {\n    auto castJavaPart = jni::dynamic_ref_cast<JHybridMMKVPlatformContextSpec::JavaPart>(javaPart);\n    if (castJavaPart == nullptr) [[unlikely]] {\n      throw std::runtime_error(\"Failed to cast JHybridObject::JavaPart to JHybridMMKVPlatformContextSpec::JavaPart!\");\n    }\n    return std::make_shared<JHybridMMKVPlatformContextSpec>(castJavaPart);\n  }\n\n  void JHybridMMKVPlatformContextSpec::CxxPart::registerNatives() {\n    registerHybrid({\n      makeNativeMethod(\"initHybrid\", JHybridMMKVPlatformContextSpec::CxxPart::initHybrid),\n    });\n  }\n\n  // Properties\n  \n\n  // Methods\n  std::string JHybridMMKVPlatformContextSpec::getBaseDirectory() {\n    static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>(\"getBaseDirectory\");\n    auto __result = method(_javaPart);\n    return __result->toStdString();\n  }\n  std::optional<std::string> JHybridMMKVPlatformContextSpec::getAppGroupDirectory() {\n    static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>(\"getAppGroupDirectory\");\n    auto __result = method(_javaPart);\n    return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;\n  }\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/android/c++/JHybridMMKVPlatformContextSpec.hpp",
    "content": "///\n/// HybridMMKVPlatformContextSpec.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n#include <NitroModules/JHybridObject.hpp>\n#include <fbjni/fbjni.h>\n#include \"HybridMMKVPlatformContextSpec.hpp\"\n\n\n\n\nnamespace margelo::nitro::mmkv {\n\n  using namespace facebook;\n\n  class JHybridMMKVPlatformContextSpec: public virtual HybridMMKVPlatformContextSpec, public virtual JHybridObject {\n  public:\n    struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {\n      static auto constexpr kJavaDescriptor = \"Lcom/margelo/nitro/mmkv/HybridMMKVPlatformContextSpec;\";\n      std::shared_ptr<JHybridMMKVPlatformContextSpec> getJHybridMMKVPlatformContextSpec();\n    };\n    struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {\n      static auto constexpr kJavaDescriptor = \"Lcom/margelo/nitro/mmkv/HybridMMKVPlatformContextSpec$CxxPart;\";\n      static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);\n      static void registerNatives();\n      using HybridBase::HybridBase;\n    protected:\n      std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;\n    };\n\n  public:\n    explicit JHybridMMKVPlatformContextSpec(const jni::local_ref<JHybridMMKVPlatformContextSpec::JavaPart>& javaPart):\n      HybridObject(HybridMMKVPlatformContextSpec::TAG),\n      JHybridObject(javaPart),\n      _javaPart(jni::make_global(javaPart)) {}\n    ~JHybridMMKVPlatformContextSpec() override {\n      // Hermes GC can destroy JS objects on a non-JNI Thread.\n      jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });\n    }\n\n  public:\n    inline const jni::global_ref<JHybridMMKVPlatformContextSpec::JavaPart>& getJavaPart() const noexcept {\n      return _javaPart;\n    }\n\n  public:\n    // Properties\n    \n\n  public:\n    // Methods\n    std::string getBaseDirectory() override;\n    std::optional<std::string> getAppGroupDirectory() override;\n\n  private:\n    jni::global_ref<JHybridMMKVPlatformContextSpec::JavaPart> _javaPart;\n  };\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/android/kotlin/com/margelo/nitro/mmkv/HybridMMKVPlatformContextSpec.kt",
    "content": "///\n/// HybridMMKVPlatformContextSpec.kt\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\npackage com.margelo.nitro.mmkv\n\nimport androidx.annotation.Keep\nimport com.facebook.jni.HybridData\nimport com.facebook.proguard.annotations.DoNotStrip\nimport com.margelo.nitro.core.HybridObject\n\n/**\n * A Kotlin class representing the MMKVPlatformContext HybridObject.\n * Implement this abstract class to create Kotlin-based instances of MMKVPlatformContext.\n */\n@DoNotStrip\n@Keep\n@Suppress(\n  \"KotlinJniMissingFunction\", \"unused\",\n  \"RedundantSuppression\", \"RedundantUnitReturnType\", \"SimpleRedundantLet\",\n  \"LocalVariableName\", \"PropertyName\", \"PrivatePropertyName\", \"FunctionName\"\n)\nabstract class HybridMMKVPlatformContextSpec: HybridObject() {\n  // Properties\n  \n\n  // Methods\n  @DoNotStrip\n  @Keep\n  abstract fun getBaseDirectory(): String\n  \n  @DoNotStrip\n  @Keep\n  abstract fun getAppGroupDirectory(): String?\n\n  // Default implementation of `HybridObject.toString()`\n  override fun toString(): String {\n    return \"[HybridObject MMKVPlatformContext]\"\n  }\n\n  // C++ backing class\n  @DoNotStrip\n  @Keep\n  protected open class CxxPart(javaPart: HybridMMKVPlatformContextSpec): HybridObject.CxxPart(javaPart) {\n    // C++ JHybridMMKVPlatformContextSpec::CxxPart::initHybrid(...)\n    external override fun initHybrid(): HybridData\n  }\n  override fun createCxxPart(): CxxPart {\n    return CxxPart(this)\n  }\n\n  companion object {\n    protected const val TAG = \"HybridMMKVPlatformContextSpec\"\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/android/kotlin/com/margelo/nitro/mmkv/NitroMmkvOnLoad.kt",
    "content": "///\n/// NitroMmkvOnLoad.kt\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\npackage com.margelo.nitro.mmkv\n\nimport android.util.Log\n\ninternal class NitroMmkvOnLoad {\n  companion object {\n    private const val TAG = \"NitroMmkvOnLoad\"\n    private var didLoad = false\n    /**\n     * Initializes the native part of \"NitroMmkv\".\n     * This method is idempotent and can be called more than once.\n     */\n    @JvmStatic\n    fun initializeNative() {\n      if (didLoad) return\n      try {\n        Log.i(TAG, \"Loading NitroMmkv C++ library...\")\n        System.loadLibrary(\"NitroMmkv\")\n        Log.i(TAG, \"Successfully loaded NitroMmkv C++ library!\")\n        didLoad = true\n      } catch (e: Error) {\n        Log.e(TAG, \"Failed to load NitroMmkv C++ library! Is it properly installed and linked? \" +\n                    \"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)\", e)\n        throw e\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/ios/NitroMmkv+autolinking.rb",
    "content": "#\n# NitroMmkv+autolinking.rb\n# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n# https://github.com/mrousavy/nitro\n# Copyright © Marc Rousavy @ Margelo\n#\n\n# This is a Ruby script that adds all files generated by Nitrogen\n# to the given podspec.\n#\n# To use it, add this to your .podspec:\n# ```ruby\n# Pod::Spec.new do |spec|\n#   # ...\n#\n#   # Add all files generated by Nitrogen\n#   load 'nitrogen/generated/ios/NitroMmkv+autolinking.rb'\n#   add_nitrogen_files(spec)\n# end\n# ```\n\ndef add_nitrogen_files(spec)\n  Pod::UI.puts \"[NitroModules] 🔥 NitroMmkv is boosted by nitro!\"\n\n  spec.dependency \"NitroModules\"\n\n  current_source_files = Array(spec.attributes_hash['source_files'])\n  spec.source_files = current_source_files + [\n    # Generated cross-platform specs\n    \"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}\",\n    # Generated bridges for the cross-platform specs\n    \"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}\",\n  ]\n\n  current_public_header_files = Array(spec.attributes_hash['public_header_files'])\n  spec.public_header_files = current_public_header_files + [\n    # Generated specs\n    \"nitrogen/generated/shared/**/*.{h,hpp}\",\n    # Swift to C++ bridging helpers\n    \"nitrogen/generated/ios/NitroMmkv-Swift-Cxx-Bridge.hpp\"\n  ]\n\n  current_private_header_files = Array(spec.attributes_hash['private_header_files'])\n  spec.private_header_files = current_private_header_files + [\n    # iOS specific specs\n    \"nitrogen/generated/ios/c++/**/*.{h,hpp}\",\n    # Views are framework-specific and should be private\n    \"nitrogen/generated/shared/**/views/**/*\"\n  ]\n\n  current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}\n  spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({\n    # Use C++ 20\n    \"CLANG_CXX_LANGUAGE_STANDARD\" => \"c++20\",\n    # Enables C++ <-> Swift interop (by default it's only ObjC)\n    \"SWIFT_OBJC_INTEROP_MODE\" => \"objcxx\",\n    # Enables stricter modular headers\n    \"DEFINES_MODULE\" => \"YES\",\n  })\nend\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/ios/NitroMmkv-Swift-Cxx-Bridge.cpp",
    "content": "///\n/// NitroMmkv-Swift-Cxx-Bridge.cpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#include \"NitroMmkv-Swift-Cxx-Bridge.hpp\"\n\n// Include C++ implementation defined types\n#include \"HybridMMKVPlatformContextSpecSwift.hpp\"\n#include \"NitroMmkv-Swift-Cxx-Umbrella.hpp\"\n#include <NitroModules/NitroDefines.hpp>\n\nnamespace margelo::nitro::mmkv::bridge::swift {\n\n  // pragma MARK: std::shared_ptr<HybridMMKVPlatformContextSpec>\n  std::shared_ptr<HybridMMKVPlatformContextSpec> create_std__shared_ptr_HybridMMKVPlatformContextSpec_(void* NON_NULL swiftUnsafePointer) noexcept {\n    NitroMmkv::HybridMMKVPlatformContextSpec_cxx swiftPart = NitroMmkv::HybridMMKVPlatformContextSpec_cxx::fromUnsafe(swiftUnsafePointer);\n    return std::make_shared<margelo::nitro::mmkv::HybridMMKVPlatformContextSpecSwift>(swiftPart);\n  }\n  void* NON_NULL get_std__shared_ptr_HybridMMKVPlatformContextSpec_(std__shared_ptr_HybridMMKVPlatformContextSpec_ cppType) {\n    std::shared_ptr<margelo::nitro::mmkv::HybridMMKVPlatformContextSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::mmkv::HybridMMKVPlatformContextSpecSwift>(cppType);\n    #ifdef NITRO_DEBUG\n    if (swiftWrapper == nullptr) [[unlikely]] {\n      throw std::runtime_error(\"Class \\\"HybridMMKVPlatformContextSpec\\\" is not implemented in Swift!\");\n    }\n    #endif\n    NitroMmkv::HybridMMKVPlatformContextSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();\n    return swiftPart.toUnsafe();\n  }\n\n} // namespace margelo::nitro::mmkv::bridge::swift\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/ios/NitroMmkv-Swift-Cxx-Bridge.hpp",
    "content": "///\n/// NitroMmkv-Swift-Cxx-Bridge.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n// Forward declarations of C++ defined types\n// Forward declaration of `HybridMMKVPlatformContextSpec` to properly resolve imports.\nnamespace margelo::nitro::mmkv { class HybridMMKVPlatformContextSpec; }\n\n// Forward declarations of Swift defined types\n// Forward declaration of `HybridMMKVPlatformContextSpec_cxx` to properly resolve imports.\nnamespace NitroMmkv { class HybridMMKVPlatformContextSpec_cxx; }\n\n// Include C++ defined types\n#include \"HybridMMKVPlatformContextSpec.hpp\"\n#include <NitroModules/Result.hpp>\n#include <exception>\n#include <memory>\n#include <optional>\n#include <string>\n\n/**\n * Contains specialized versions of C++ templated types so they can be accessed from Swift,\n * as well as helper functions to interact with those C++ types from Swift.\n */\nnamespace margelo::nitro::mmkv::bridge::swift {\n\n  // pragma MARK: std::optional<std::string>\n  /**\n   * Specialized version of `std::optional<std::string>`.\n   */\n  using std__optional_std__string_ = std::optional<std::string>;\n  inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {\n    return std::optional<std::string>(value);\n  }\n  inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {\n    return optional.has_value();\n  }\n  inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {\n    return optional.value();\n  }\n  \n  // pragma MARK: std::shared_ptr<HybridMMKVPlatformContextSpec>\n  /**\n   * Specialized version of `std::shared_ptr<HybridMMKVPlatformContextSpec>`.\n   */\n  using std__shared_ptr_HybridMMKVPlatformContextSpec_ = std::shared_ptr<HybridMMKVPlatformContextSpec>;\n  std::shared_ptr<HybridMMKVPlatformContextSpec> create_std__shared_ptr_HybridMMKVPlatformContextSpec_(void* NON_NULL swiftUnsafePointer) noexcept;\n  void* NON_NULL get_std__shared_ptr_HybridMMKVPlatformContextSpec_(std__shared_ptr_HybridMMKVPlatformContextSpec_ cppType);\n  \n  // pragma MARK: std::weak_ptr<HybridMMKVPlatformContextSpec>\n  using std__weak_ptr_HybridMMKVPlatformContextSpec_ = std::weak_ptr<HybridMMKVPlatformContextSpec>;\n  inline std__weak_ptr_HybridMMKVPlatformContextSpec_ weakify_std__shared_ptr_HybridMMKVPlatformContextSpec_(const std::shared_ptr<HybridMMKVPlatformContextSpec>& strong) noexcept { return strong; }\n  \n  // pragma MARK: Result<std::string>\n  using Result_std__string_ = Result<std::string>;\n  inline Result_std__string_ create_Result_std__string_(const std::string& value) noexcept {\n    return Result<std::string>::withValue(value);\n  }\n  inline Result_std__string_ create_Result_std__string_(const std::exception_ptr& error) noexcept {\n    return Result<std::string>::withError(error);\n  }\n  \n  // pragma MARK: Result<std::optional<std::string>>\n  using Result_std__optional_std__string__ = Result<std::optional<std::string>>;\n  inline Result_std__optional_std__string__ create_Result_std__optional_std__string__(const std::optional<std::string>& value) noexcept {\n    return Result<std::optional<std::string>>::withValue(value);\n  }\n  inline Result_std__optional_std__string__ create_Result_std__optional_std__string__(const std::exception_ptr& error) noexcept {\n    return Result<std::optional<std::string>>::withError(error);\n  }\n\n} // namespace margelo::nitro::mmkv::bridge::swift\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/ios/NitroMmkv-Swift-Cxx-Umbrella.hpp",
    "content": "///\n/// NitroMmkv-Swift-Cxx-Umbrella.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n// Forward declarations of C++ defined types\n// Forward declaration of `HybridMMKVPlatformContextSpec` to properly resolve imports.\nnamespace margelo::nitro::mmkv { class HybridMMKVPlatformContextSpec; }\n\n// Include C++ defined types\n#include \"HybridMMKVPlatformContextSpec.hpp\"\n#include <NitroModules/Result.hpp>\n#include <exception>\n#include <memory>\n#include <optional>\n#include <string>\n\n// C++ helpers for Swift\n#include \"NitroMmkv-Swift-Cxx-Bridge.hpp\"\n\n// Common C++ types used in Swift\n#include <NitroModules/ArrayBufferHolder.hpp>\n#include <NitroModules/AnyMapUtils.hpp>\n#include <NitroModules/RuntimeError.hpp>\n#include <NitroModules/DateToChronoDate.hpp>\n\n// Forward declarations of Swift defined types\n// Forward declaration of `HybridMMKVPlatformContextSpec_cxx` to properly resolve imports.\nnamespace NitroMmkv { class HybridMMKVPlatformContextSpec_cxx; }\n\n// Include Swift defined types\n#if __has_include(\"NitroMmkv-Swift.h\")\n// This header is generated by Xcode/Swift on every app build.\n// If it cannot be found, make sure the Swift module's name (= podspec name) is actually \"NitroMmkv\".\n#include \"NitroMmkv-Swift.h\"\n// Same as above, but used when building with frameworks (`use_frameworks`)\n#elif __has_include(<NitroMmkv/NitroMmkv-Swift.h>)\n#include <NitroMmkv/NitroMmkv-Swift.h>\n#else\n#error NitroMmkv's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually \"NitroMmkv\", and try building the app first.\n#endif\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/ios/NitroMmkvAutolinking.mm",
    "content": "///\n/// NitroMmkvAutolinking.mm\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#import <Foundation/Foundation.h>\n#import <NitroModules/HybridObjectRegistry.hpp>\n#import \"NitroMmkv-Swift-Cxx-Umbrella.hpp\"\n#import <type_traits>\n\n#include \"HybridMMKVFactory.hpp\"\n#include \"HybridMMKVPlatformContextSpecSwift.hpp\"\n\n@interface NitroMmkvAutolinking : NSObject\n@end\n\n@implementation NitroMmkvAutolinking\n\n+ (void) load {\n  using namespace margelo::nitro;\n  using namespace margelo::nitro::mmkv;\n\n  HybridObjectRegistry::registerHybridObjectConstructor(\n    \"MMKVFactory\",\n    []() -> std::shared_ptr<HybridObject> {\n      static_assert(std::is_default_constructible_v<HybridMMKVFactory>,\n                    \"The HybridObject \\\"HybridMMKVFactory\\\" is not default-constructible! \"\n                    \"Create a public constructor that takes zero arguments to be able to autolink this HybridObject.\");\n      return std::make_shared<HybridMMKVFactory>();\n    }\n  );\n  HybridObjectRegistry::registerHybridObjectConstructor(\n    \"MMKVPlatformContext\",\n    []() -> std::shared_ptr<HybridObject> {\n      std::shared_ptr<HybridMMKVPlatformContextSpec> hybridObject = NitroMmkv::NitroMmkvAutolinking::createMMKVPlatformContext();\n      return hybridObject;\n    }\n  );\n}\n\n@end\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/ios/NitroMmkvAutolinking.swift",
    "content": "///\n/// NitroMmkvAutolinking.swift\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\nimport NitroModules\n\n// TODO: Use empty enums once Swift supports exporting them as namespaces\n//       See: https://github.com/swiftlang/swift/pull/83616\npublic final class NitroMmkvAutolinking {\n  public typealias bridge = margelo.nitro.mmkv.bridge.swift\n\n  public static func createMMKVPlatformContext() -> bridge.std__shared_ptr_HybridMMKVPlatformContextSpec_ {\n    let hybridObject = HybridMMKVPlatformContext()\n    return { () -> bridge.std__shared_ptr_HybridMMKVPlatformContextSpec_ in\n      let __cxxWrapped = hybridObject.getCxxWrapper()\n      return __cxxWrapped.getCxxPart()\n    }()\n  }\n  \n  public static func isMMKVPlatformContextRecyclable() -> Bool {\n    return HybridMMKVPlatformContext.self is any RecyclableView.Type\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/ios/c++/HybridMMKVPlatformContextSpecSwift.cpp",
    "content": "///\n/// HybridMMKVPlatformContextSpecSwift.cpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#include \"HybridMMKVPlatformContextSpecSwift.hpp\"\n\nnamespace margelo::nitro::mmkv {\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/ios/c++/HybridMMKVPlatformContextSpecSwift.hpp",
    "content": "///\n/// HybridMMKVPlatformContextSpecSwift.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n#include \"HybridMMKVPlatformContextSpec.hpp\"\n\n// Forward declaration of `HybridMMKVPlatformContextSpec_cxx` to properly resolve imports.\nnamespace NitroMmkv { class HybridMMKVPlatformContextSpec_cxx; }\n\n\n\n#include <string>\n#include <optional>\n\n#include \"NitroMmkv-Swift-Cxx-Umbrella.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\n  /**\n   * The C++ part of HybridMMKVPlatformContextSpec_cxx.swift.\n   *\n   * HybridMMKVPlatformContextSpecSwift (C++) accesses HybridMMKVPlatformContextSpec_cxx (Swift), and might\n   * contain some additional bridging code for C++ <> Swift interop.\n   *\n   * Since this obviously introduces an overhead, I hope at some point in\n   * the future, HybridMMKVPlatformContextSpec_cxx can directly inherit from the C++ class HybridMMKVPlatformContextSpec\n   * to simplify the whole structure and memory management.\n   */\n  class HybridMMKVPlatformContextSpecSwift: public virtual HybridMMKVPlatformContextSpec {\n  public:\n    // Constructor from a Swift instance\n    explicit HybridMMKVPlatformContextSpecSwift(const NitroMmkv::HybridMMKVPlatformContextSpec_cxx& swiftPart):\n      HybridObject(HybridMMKVPlatformContextSpec::TAG),\n      _swiftPart(swiftPart) { }\n\n  public:\n    // Get the Swift part\n    inline NitroMmkv::HybridMMKVPlatformContextSpec_cxx& getSwiftPart() noexcept {\n      return _swiftPart;\n    }\n\n  public:\n    inline size_t getExternalMemorySize() noexcept override {\n      return _swiftPart.getMemorySize();\n    }\n    bool equals(const std::shared_ptr<HybridObject>& other) override {\n      if (auto otherCast = std::dynamic_pointer_cast<HybridMMKVPlatformContextSpecSwift>(other)) {\n        return _swiftPart.equals(otherCast->_swiftPart);\n      }\n      return false;\n    }\n    void dispose() noexcept override {\n      _swiftPart.dispose();\n    }\n    std::string toString() override {\n      return _swiftPart.toString();\n    }\n\n  public:\n    // Properties\n    \n\n  public:\n    // Methods\n    inline std::string getBaseDirectory() override {\n      auto __result = _swiftPart.getBaseDirectory();\n      if (__result.hasError()) [[unlikely]] {\n        std::rethrow_exception(__result.error());\n      }\n      auto __value = std::move(__result.value());\n      return __value;\n    }\n    inline std::optional<std::string> getAppGroupDirectory() override {\n      auto __result = _swiftPart.getAppGroupDirectory();\n      if (__result.hasError()) [[unlikely]] {\n        std::rethrow_exception(__result.error());\n      }\n      auto __value = std::move(__result.value());\n      return __value;\n    }\n\n  private:\n    NitroMmkv::HybridMMKVPlatformContextSpec_cxx _swiftPart;\n  };\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/ios/swift/HybridMMKVPlatformContextSpec.swift",
    "content": "///\n/// HybridMMKVPlatformContextSpec.swift\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\nimport NitroModules\n\n/// See ``HybridMMKVPlatformContextSpec``\npublic protocol HybridMMKVPlatformContextSpec_protocol: HybridObject {\n  // Properties\n  \n\n  // Methods\n  func getBaseDirectory() throws -> String\n  func getAppGroupDirectory() throws -> String?\n}\n\npublic extension HybridMMKVPlatformContextSpec_protocol {\n  /// Default implementation of ``HybridObject.toString``\n  func toString() -> String {\n    return \"[HybridObject MMKVPlatformContext]\"\n  }\n}\n\n/// See ``HybridMMKVPlatformContextSpec``\nopen class HybridMMKVPlatformContextSpec_base {\n  private weak var cxxWrapper: HybridMMKVPlatformContextSpec_cxx? = nil\n  public init() { }\n  public func getCxxWrapper() -> HybridMMKVPlatformContextSpec_cxx {\n  #if DEBUG\n    guard self is any HybridMMKVPlatformContextSpec else {\n      fatalError(\"`self` is not a `HybridMMKVPlatformContextSpec`! Did you accidentally inherit from `HybridMMKVPlatformContextSpec_base` instead of `HybridMMKVPlatformContextSpec`?\")\n    }\n  #endif\n    if let cxxWrapper = self.cxxWrapper {\n      return cxxWrapper\n    } else {\n      let cxxWrapper = HybridMMKVPlatformContextSpec_cxx(self as! any HybridMMKVPlatformContextSpec)\n      self.cxxWrapper = cxxWrapper\n      return cxxWrapper\n    }\n  }\n}\n\n/**\n * A Swift base-protocol representing the MMKVPlatformContext HybridObject.\n * Implement this protocol to create Swift-based instances of MMKVPlatformContext.\n * ```swift\n * class HybridMMKVPlatformContext : HybridMMKVPlatformContextSpec {\n *   // ...\n * }\n * ```\n */\npublic typealias HybridMMKVPlatformContextSpec = HybridMMKVPlatformContextSpec_protocol & HybridMMKVPlatformContextSpec_base\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/ios/swift/HybridMMKVPlatformContextSpec_cxx.swift",
    "content": "///\n/// HybridMMKVPlatformContextSpec_cxx.swift\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\nimport NitroModules\n\n/**\n * A class implementation that bridges HybridMMKVPlatformContextSpec over to C++.\n * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.\n *\n * Also, some Swift types need to be bridged with special handling:\n * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)\n * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper\n * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++\n */\nopen class HybridMMKVPlatformContextSpec_cxx {\n  /**\n   * The Swift <> C++ bridge's namespace (`margelo::nitro::mmkv::bridge::swift`)\n   * from `NitroMmkv-Swift-Cxx-Bridge.hpp`.\n   * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.\n   */\n  public typealias bridge = margelo.nitro.mmkv.bridge.swift\n\n  /**\n   * Holds an instance of the `HybridMMKVPlatformContextSpec` Swift protocol.\n   */\n  private var __implementation: any HybridMMKVPlatformContextSpec\n\n  /**\n   * Holds a weak pointer to the C++ class that wraps the Swift class.\n   */\n  private var __cxxPart: bridge.std__weak_ptr_HybridMMKVPlatformContextSpec_\n\n  /**\n   * Create a new `HybridMMKVPlatformContextSpec_cxx` that wraps the given `HybridMMKVPlatformContextSpec`.\n   * All properties and methods bridge to C++ types.\n   */\n  public init(_ implementation: any HybridMMKVPlatformContextSpec) {\n    self.__implementation = implementation\n    self.__cxxPart = .init()\n    /* no base class */\n  }\n\n  /**\n   * Get the actual `HybridMMKVPlatformContextSpec` instance this class wraps.\n   */\n  @inline(__always)\n  public func getHybridMMKVPlatformContextSpec() -> any HybridMMKVPlatformContextSpec {\n    return __implementation\n  }\n\n  /**\n   * Casts this instance to a retained unsafe raw pointer.\n   * This acquires one additional strong reference on the object!\n   */\n  public func toUnsafe() -> UnsafeMutableRawPointer {\n    return Unmanaged.passRetained(self).toOpaque()\n  }\n\n  /**\n   * Casts an unsafe pointer to a `HybridMMKVPlatformContextSpec_cxx`.\n   * The pointer has to be a retained opaque `Unmanaged<HybridMMKVPlatformContextSpec_cxx>`.\n   * This removes one strong reference from the object!\n   */\n  public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridMMKVPlatformContextSpec_cxx {\n    return Unmanaged<HybridMMKVPlatformContextSpec_cxx>.fromOpaque(pointer).takeRetainedValue()\n  }\n\n  /**\n   * Gets (or creates) the C++ part of this Hybrid Object.\n   * The C++ part is a `std::shared_ptr<HybridMMKVPlatformContextSpec>`.\n   */\n  public func getCxxPart() -> bridge.std__shared_ptr_HybridMMKVPlatformContextSpec_ {\n    let cachedCxxPart = self.__cxxPart.lock()\n    if Bool(fromCxx: cachedCxxPart) {\n      return cachedCxxPart\n    } else {\n      let newCxxPart = bridge.create_std__shared_ptr_HybridMMKVPlatformContextSpec_(self.toUnsafe())\n      __cxxPart = bridge.weakify_std__shared_ptr_HybridMMKVPlatformContextSpec_(newCxxPart)\n      return newCxxPart\n    }\n  }\n\n  \n\n  /**\n   * Get the memory size of the Swift class (plus size of any other allocations)\n   * so the JS VM can properly track it and garbage-collect the JS object if needed.\n   */\n  @inline(__always)\n  public var memorySize: Int {\n    return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize\n  }\n\n  /**\n   * Compares this object with the given [other] object for reference equality.\n   */\n  @inline(__always)\n  public func equals(other: HybridMMKVPlatformContextSpec_cxx) -> Bool {\n    return self.__implementation === other.__implementation\n  }\n\n  /**\n   * Call dispose() on the Swift class.\n   * This _may_ be called manually from JS.\n   */\n  @inline(__always)\n  public func dispose() {\n    self.__implementation.dispose()\n  }\n\n  /**\n   * Call toString() on the Swift class.\n   */\n  @inline(__always)\n  public func toString() -> String {\n    return self.__implementation.toString()\n  }\n\n  // Properties\n  \n\n  // Methods\n  @inline(__always)\n  public final func getBaseDirectory() -> bridge.Result_std__string_ {\n    do {\n      let __result = try self.__implementation.getBaseDirectory()\n      let __resultCpp = std.string(__result)\n      return bridge.create_Result_std__string_(__resultCpp)\n    } catch (let __error) {\n      let __exceptionPtr = __error.toCpp()\n      return bridge.create_Result_std__string_(__exceptionPtr)\n    }\n  }\n  \n  @inline(__always)\n  public final func getAppGroupDirectory() -> bridge.Result_std__optional_std__string__ {\n    do {\n      let __result = try self.__implementation.getAppGroupDirectory()\n      let __resultCpp = { () -> bridge.std__optional_std__string_ in\n        if let __unwrappedValue = __result {\n          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))\n        } else {\n          return .init()\n        }\n      }()\n      return bridge.create_Result_std__optional_std__string__(__resultCpp)\n    } catch (let __error) {\n      let __exceptionPtr = __error.toCpp()\n      return bridge.create_Result_std__optional_std__string__(__exceptionPtr)\n    }\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/shared/c++/Configuration.hpp",
    "content": "///\n/// Configuration.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n#if __has_include(<NitroModules/JSIConverter.hpp>)\n#include <NitroModules/JSIConverter.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n#if __has_include(<NitroModules/NitroDefines.hpp>)\n#include <NitroModules/NitroDefines.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n#if __has_include(<NitroModules/JSIHelpers.hpp>)\n#include <NitroModules/JSIHelpers.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n#if __has_include(<NitroModules/PropNameIDCache.hpp>)\n#include <NitroModules/PropNameIDCache.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n\n// Forward declaration of `EncryptionType` to properly resolve imports.\nnamespace margelo::nitro::mmkv { enum class EncryptionType; }\n// Forward declaration of `Mode` to properly resolve imports.\nnamespace margelo::nitro::mmkv { enum class Mode; }\n\n#include <string>\n#include <optional>\n#include \"EncryptionType.hpp\"\n#include \"Mode.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\n  /**\n   * A struct which can be represented as a JavaScript object (Configuration).\n   */\n  struct Configuration final {\n  public:\n    std::string id     SWIFT_PRIVATE;\n    std::optional<std::string> path     SWIFT_PRIVATE;\n    std::optional<std::string> encryptionKey     SWIFT_PRIVATE;\n    std::optional<EncryptionType> encryptionType     SWIFT_PRIVATE;\n    std::optional<Mode> mode     SWIFT_PRIVATE;\n    std::optional<bool> readOnly     SWIFT_PRIVATE;\n    std::optional<bool> compareBeforeSet     SWIFT_PRIVATE;\n\n  public:\n    Configuration() = default;\n    explicit Configuration(std::string id, std::optional<std::string> path, std::optional<std::string> encryptionKey, std::optional<EncryptionType> encryptionType, std::optional<Mode> mode, std::optional<bool> readOnly, std::optional<bool> compareBeforeSet): id(id), path(path), encryptionKey(encryptionKey), encryptionType(encryptionType), mode(mode), readOnly(readOnly), compareBeforeSet(compareBeforeSet) {}\n\n  public:\n    friend bool operator==(const Configuration& lhs, const Configuration& rhs) = default;\n  };\n\n} // namespace margelo::nitro::mmkv\n\nnamespace margelo::nitro {\n\n  // C++ Configuration <> JS Configuration (object)\n  template <>\n  struct JSIConverter<margelo::nitro::mmkv::Configuration> final {\n    static inline margelo::nitro::mmkv::Configuration fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {\n      jsi::Object obj = arg.asObject(runtime);\n      return margelo::nitro::mmkv::Configuration(\n        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"id\"))),\n        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"path\"))),\n        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"encryptionKey\"))),\n        JSIConverter<std::optional<margelo::nitro::mmkv::EncryptionType>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"encryptionType\"))),\n        JSIConverter<std::optional<margelo::nitro::mmkv::Mode>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"mode\"))),\n        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"readOnly\"))),\n        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"compareBeforeSet\")))\n      );\n    }\n    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::mmkv::Configuration& arg) {\n      jsi::Object obj(runtime);\n      obj.setProperty(runtime, PropNameIDCache::get(runtime, \"id\"), JSIConverter<std::string>::toJSI(runtime, arg.id));\n      obj.setProperty(runtime, PropNameIDCache::get(runtime, \"path\"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.path));\n      obj.setProperty(runtime, PropNameIDCache::get(runtime, \"encryptionKey\"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.encryptionKey));\n      obj.setProperty(runtime, PropNameIDCache::get(runtime, \"encryptionType\"), JSIConverter<std::optional<margelo::nitro::mmkv::EncryptionType>>::toJSI(runtime, arg.encryptionType));\n      obj.setProperty(runtime, PropNameIDCache::get(runtime, \"mode\"), JSIConverter<std::optional<margelo::nitro::mmkv::Mode>>::toJSI(runtime, arg.mode));\n      obj.setProperty(runtime, PropNameIDCache::get(runtime, \"readOnly\"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.readOnly));\n      obj.setProperty(runtime, PropNameIDCache::get(runtime, \"compareBeforeSet\"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.compareBeforeSet));\n      return obj;\n    }\n    static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {\n      if (!value.isObject()) {\n        return false;\n      }\n      jsi::Object obj = value.getObject(runtime);\n      if (!nitro::isPlainObject(runtime, obj)) {\n        return false;\n      }\n      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"id\")))) return false;\n      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"path\")))) return false;\n      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"encryptionKey\")))) return false;\n      if (!JSIConverter<std::optional<margelo::nitro::mmkv::EncryptionType>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"encryptionType\")))) return false;\n      if (!JSIConverter<std::optional<margelo::nitro::mmkv::Mode>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"mode\")))) return false;\n      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"readOnly\")))) return false;\n      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"compareBeforeSet\")))) return false;\n      return true;\n    }\n  };\n\n} // namespace margelo::nitro\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/shared/c++/EncryptionType.hpp",
    "content": "///\n/// EncryptionType.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n#if __has_include(<NitroModules/NitroHash.hpp>)\n#include <NitroModules/NitroHash.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n#if __has_include(<NitroModules/JSIConverter.hpp>)\n#include <NitroModules/JSIConverter.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n#if __has_include(<NitroModules/NitroDefines.hpp>)\n#include <NitroModules/NitroDefines.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n\nnamespace margelo::nitro::mmkv {\n\n  /**\n   * An enum which can be represented as a JavaScript union (EncryptionType).\n   */\n  enum class EncryptionType {\n    AES_128      SWIFT_NAME(aes128) = 0,\n    AES_256      SWIFT_NAME(aes256) = 1,\n  } CLOSED_ENUM;\n\n} // namespace margelo::nitro::mmkv\n\nnamespace margelo::nitro {\n\n  // C++ EncryptionType <> JS EncryptionType (union)\n  template <>\n  struct JSIConverter<margelo::nitro::mmkv::EncryptionType> final {\n    static inline margelo::nitro::mmkv::EncryptionType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {\n      std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);\n      switch (hashString(unionValue.c_str(), unionValue.size())) {\n        case hashString(\"AES-128\"): return margelo::nitro::mmkv::EncryptionType::AES_128;\n        case hashString(\"AES-256\"): return margelo::nitro::mmkv::EncryptionType::AES_256;\n        default: [[unlikely]]\n          throw std::invalid_argument(\"Cannot convert \\\"\" + unionValue + \"\\\" to enum EncryptionType - invalid value!\");\n      }\n    }\n    static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::mmkv::EncryptionType arg) {\n      switch (arg) {\n        case margelo::nitro::mmkv::EncryptionType::AES_128: return JSIConverter<std::string>::toJSI(runtime, \"AES-128\");\n        case margelo::nitro::mmkv::EncryptionType::AES_256: return JSIConverter<std::string>::toJSI(runtime, \"AES-256\");\n        default: [[unlikely]]\n          throw std::invalid_argument(\"Cannot convert EncryptionType to JS - invalid value: \"\n                                    + std::to_string(static_cast<int>(arg)) + \"!\");\n      }\n    }\n    static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {\n      if (!value.isString()) {\n        return false;\n      }\n      std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);\n      switch (hashString(unionValue.c_str(), unionValue.size())) {\n        case hashString(\"AES-128\"):\n        case hashString(\"AES-256\"):\n          return true;\n        default:\n          return false;\n      }\n    }\n  };\n\n} // namespace margelo::nitro\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/shared/c++/HybridMMKVFactorySpec.cpp",
    "content": "///\n/// HybridMMKVFactorySpec.cpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#include \"HybridMMKVFactorySpec.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\n  void HybridMMKVFactorySpec::loadHybridMethods() {\n    // load base methods/properties\n    HybridObject::loadHybridMethods();\n    // load custom methods/properties\n    registerHybrids(this, [](Prototype& prototype) {\n      prototype.registerHybridGetter(\"defaultMMKVInstanceId\", &HybridMMKVFactorySpec::getDefaultMMKVInstanceId);\n      prototype.registerHybridMethod(\"initializeMMKV\", &HybridMMKVFactorySpec::initializeMMKV);\n      prototype.registerHybridMethod(\"createMMKV\", &HybridMMKVFactorySpec::createMMKV);\n      prototype.registerHybridMethod(\"deleteMMKV\", &HybridMMKVFactorySpec::deleteMMKV);\n      prototype.registerHybridMethod(\"existsMMKV\", &HybridMMKVFactorySpec::existsMMKV);\n    });\n  }\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/shared/c++/HybridMMKVFactorySpec.hpp",
    "content": "///\n/// HybridMMKVFactorySpec.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n#if __has_include(<NitroModules/HybridObject.hpp>)\n#include <NitroModules/HybridObject.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n\n// Forward declaration of `HybridMMKVSpec` to properly resolve imports.\nnamespace margelo::nitro::mmkv { class HybridMMKVSpec; }\n// Forward declaration of `Configuration` to properly resolve imports.\nnamespace margelo::nitro::mmkv { struct Configuration; }\n\n#include <string>\n#include <memory>\n#include \"HybridMMKVSpec.hpp\"\n#include \"Configuration.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\n  using namespace margelo::nitro;\n\n  /**\n   * An abstract base class for `MMKVFactory`\n   * Inherit this class to create instances of `HybridMMKVFactorySpec` in C++.\n   * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.\n   * @example\n   * ```cpp\n   * class HybridMMKVFactory: public HybridMMKVFactorySpec {\n   * public:\n   *   HybridMMKVFactory(...): HybridObject(TAG) { ... }\n   *   // ...\n   * };\n   * ```\n   */\n  class HybridMMKVFactorySpec: public virtual HybridObject {\n    public:\n      // Constructor\n      explicit HybridMMKVFactorySpec(): HybridObject(TAG) { }\n\n      // Destructor\n      ~HybridMMKVFactorySpec() override = default;\n\n    public:\n      // Properties\n      virtual std::string getDefaultMMKVInstanceId() = 0;\n\n    public:\n      // Methods\n      virtual void initializeMMKV(const std::string& rootPath) = 0;\n      virtual std::shared_ptr<HybridMMKVSpec> createMMKV(const Configuration& configuration) = 0;\n      virtual bool deleteMMKV(const std::string& id) = 0;\n      virtual bool existsMMKV(const std::string& id) = 0;\n\n    protected:\n      // Hybrid Setup\n      void loadHybridMethods() override;\n\n    protected:\n      // Tag for logging\n      static constexpr auto TAG = \"MMKVFactory\";\n  };\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/shared/c++/HybridMMKVPlatformContextSpec.cpp",
    "content": "///\n/// HybridMMKVPlatformContextSpec.cpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#include \"HybridMMKVPlatformContextSpec.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\n  void HybridMMKVPlatformContextSpec::loadHybridMethods() {\n    // load base methods/properties\n    HybridObject::loadHybridMethods();\n    // load custom methods/properties\n    registerHybrids(this, [](Prototype& prototype) {\n      prototype.registerHybridMethod(\"getBaseDirectory\", &HybridMMKVPlatformContextSpec::getBaseDirectory);\n      prototype.registerHybridMethod(\"getAppGroupDirectory\", &HybridMMKVPlatformContextSpec::getAppGroupDirectory);\n    });\n  }\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/shared/c++/HybridMMKVPlatformContextSpec.hpp",
    "content": "///\n/// HybridMMKVPlatformContextSpec.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n#if __has_include(<NitroModules/HybridObject.hpp>)\n#include <NitroModules/HybridObject.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n\n\n\n#include <string>\n#include <optional>\n\nnamespace margelo::nitro::mmkv {\n\n  using namespace margelo::nitro;\n\n  /**\n   * An abstract base class for `MMKVPlatformContext`\n   * Inherit this class to create instances of `HybridMMKVPlatformContextSpec` in C++.\n   * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.\n   * @example\n   * ```cpp\n   * class HybridMMKVPlatformContext: public HybridMMKVPlatformContextSpec {\n   * public:\n   *   HybridMMKVPlatformContext(...): HybridObject(TAG) { ... }\n   *   // ...\n   * };\n   * ```\n   */\n  class HybridMMKVPlatformContextSpec: public virtual HybridObject {\n    public:\n      // Constructor\n      explicit HybridMMKVPlatformContextSpec(): HybridObject(TAG) { }\n\n      // Destructor\n      ~HybridMMKVPlatformContextSpec() override = default;\n\n    public:\n      // Properties\n      \n\n    public:\n      // Methods\n      virtual std::string getBaseDirectory() = 0;\n      virtual std::optional<std::string> getAppGroupDirectory() = 0;\n\n    protected:\n      // Hybrid Setup\n      void loadHybridMethods() override;\n\n    protected:\n      // Tag for logging\n      static constexpr auto TAG = \"MMKVPlatformContext\";\n  };\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/shared/c++/HybridMMKVSpec.cpp",
    "content": "///\n/// HybridMMKVSpec.cpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#include \"HybridMMKVSpec.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\n  void HybridMMKVSpec::loadHybridMethods() {\n    // load base methods/properties\n    HybridObject::loadHybridMethods();\n    // load custom methods/properties\n    registerHybrids(this, [](Prototype& prototype) {\n      prototype.registerHybridGetter(\"id\", &HybridMMKVSpec::getId);\n      prototype.registerHybridGetter(\"length\", &HybridMMKVSpec::getLength);\n      prototype.registerHybridGetter(\"size\", &HybridMMKVSpec::getSize);\n      prototype.registerHybridGetter(\"byteSize\", &HybridMMKVSpec::getByteSize);\n      prototype.registerHybridGetter(\"isReadOnly\", &HybridMMKVSpec::getIsReadOnly);\n      prototype.registerHybridGetter(\"isEncrypted\", &HybridMMKVSpec::getIsEncrypted);\n      prototype.registerHybridMethod(\"set\", &HybridMMKVSpec::set);\n      prototype.registerHybridMethod(\"getBoolean\", &HybridMMKVSpec::getBoolean);\n      prototype.registerHybridMethod(\"getString\", &HybridMMKVSpec::getString);\n      prototype.registerHybridMethod(\"getNumber\", &HybridMMKVSpec::getNumber);\n      prototype.registerHybridMethod(\"getBuffer\", &HybridMMKVSpec::getBuffer);\n      prototype.registerHybridMethod(\"contains\", &HybridMMKVSpec::contains);\n      prototype.registerHybridMethod(\"remove\", &HybridMMKVSpec::remove);\n      prototype.registerHybridMethod(\"getAllKeys\", &HybridMMKVSpec::getAllKeys);\n      prototype.registerHybridMethod(\"clearAll\", &HybridMMKVSpec::clearAll);\n      prototype.registerHybridMethod(\"recrypt\", &HybridMMKVSpec::recrypt);\n      prototype.registerHybridMethod(\"encrypt\", &HybridMMKVSpec::encrypt);\n      prototype.registerHybridMethod(\"decrypt\", &HybridMMKVSpec::decrypt);\n      prototype.registerHybridMethod(\"trim\", &HybridMMKVSpec::trim);\n      prototype.registerHybridMethod(\"addOnValueChangedListener\", &HybridMMKVSpec::addOnValueChangedListener);\n      prototype.registerHybridMethod(\"importAllFrom\", &HybridMMKVSpec::importAllFrom);\n    });\n  }\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/shared/c++/HybridMMKVSpec.hpp",
    "content": "///\n/// HybridMMKVSpec.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n#if __has_include(<NitroModules/HybridObject.hpp>)\n#include <NitroModules/HybridObject.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n\n// Forward declaration of `EncryptionType` to properly resolve imports.\nnamespace margelo::nitro::mmkv { enum class EncryptionType; }\n// Forward declaration of `Listener` to properly resolve imports.\nnamespace margelo::nitro::mmkv { struct Listener; }\n// Forward declaration of `HybridMMKVSpec` to properly resolve imports.\nnamespace margelo::nitro::mmkv { class HybridMMKVSpec; }\n\n#include <string>\n#include <NitroModules/ArrayBuffer.hpp>\n#include <variant>\n#include <optional>\n#include <vector>\n#include \"EncryptionType.hpp\"\n#include \"Listener.hpp\"\n#include <functional>\n#include <memory>\n#include \"HybridMMKVSpec.hpp\"\n\nnamespace margelo::nitro::mmkv {\n\n  using namespace margelo::nitro;\n\n  /**\n   * An abstract base class for `MMKV`\n   * Inherit this class to create instances of `HybridMMKVSpec` in C++.\n   * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.\n   * @example\n   * ```cpp\n   * class HybridMMKV: public HybridMMKVSpec {\n   * public:\n   *   HybridMMKV(...): HybridObject(TAG) { ... }\n   *   // ...\n   * };\n   * ```\n   */\n  class HybridMMKVSpec: public virtual HybridObject {\n    public:\n      // Constructor\n      explicit HybridMMKVSpec(): HybridObject(TAG) { }\n\n      // Destructor\n      ~HybridMMKVSpec() override = default;\n\n    public:\n      // Properties\n      virtual std::string getId() = 0;\n      virtual double getLength() = 0;\n      virtual double getSize() = 0;\n      virtual double getByteSize() = 0;\n      virtual bool getIsReadOnly() = 0;\n      virtual bool getIsEncrypted() = 0;\n\n    public:\n      // Methods\n      virtual void set(const std::string& key, const std::variant<bool, std::shared_ptr<ArrayBuffer>, std::string, double>& value) = 0;\n      virtual std::optional<bool> getBoolean(const std::string& key) = 0;\n      virtual std::optional<std::string> getString(const std::string& key) = 0;\n      virtual std::optional<double> getNumber(const std::string& key) = 0;\n      virtual std::optional<std::shared_ptr<ArrayBuffer>> getBuffer(const std::string& key) = 0;\n      virtual bool contains(const std::string& key) = 0;\n      virtual bool remove(const std::string& key) = 0;\n      virtual std::vector<std::string> getAllKeys() = 0;\n      virtual void clearAll() = 0;\n      virtual void recrypt(const std::optional<std::string>& key) = 0;\n      virtual void encrypt(const std::string& key, std::optional<EncryptionType> encryptionType) = 0;\n      virtual void decrypt() = 0;\n      virtual void trim() = 0;\n      virtual Listener addOnValueChangedListener(const std::function<void(const std::string& /* key */)>& onValueChanged) = 0;\n      virtual double importAllFrom(const std::shared_ptr<HybridMMKVSpec>& other) = 0;\n\n    protected:\n      // Hybrid Setup\n      void loadHybridMethods() override;\n\n    protected:\n      // Tag for logging\n      static constexpr auto TAG = \"MMKV\";\n  };\n\n} // namespace margelo::nitro::mmkv\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/shared/c++/Listener.hpp",
    "content": "///\n/// Listener.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n#if __has_include(<NitroModules/JSIConverter.hpp>)\n#include <NitroModules/JSIConverter.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n#if __has_include(<NitroModules/NitroDefines.hpp>)\n#include <NitroModules/NitroDefines.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n#if __has_include(<NitroModules/JSIHelpers.hpp>)\n#include <NitroModules/JSIHelpers.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n#if __has_include(<NitroModules/PropNameIDCache.hpp>)\n#include <NitroModules/PropNameIDCache.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n\n\n\n#include <functional>\n\nnamespace margelo::nitro::mmkv {\n\n  /**\n   * A struct which can be represented as a JavaScript object (Listener).\n   */\n  struct Listener final {\n  public:\n    std::function<void()> remove     SWIFT_PRIVATE;\n\n  public:\n    Listener() = default;\n    explicit Listener(std::function<void()> remove): remove(remove) {}\n\n  public:\n    // Listener is not equatable because these properties are not equatable: remove\n  };\n\n} // namespace margelo::nitro::mmkv\n\nnamespace margelo::nitro {\n\n  // C++ Listener <> JS Listener (object)\n  template <>\n  struct JSIConverter<margelo::nitro::mmkv::Listener> final {\n    static inline margelo::nitro::mmkv::Listener fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {\n      jsi::Object obj = arg.asObject(runtime);\n      return margelo::nitro::mmkv::Listener(\n        JSIConverter<std::function<void()>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"remove\")))\n      );\n    }\n    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::mmkv::Listener& arg) {\n      jsi::Object obj(runtime);\n      obj.setProperty(runtime, PropNameIDCache::get(runtime, \"remove\"), JSIConverter<std::function<void()>>::toJSI(runtime, arg.remove));\n      return obj;\n    }\n    static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {\n      if (!value.isObject()) {\n        return false;\n      }\n      jsi::Object obj = value.getObject(runtime);\n      if (!nitro::isPlainObject(runtime, obj)) {\n        return false;\n      }\n      if (!JSIConverter<std::function<void()>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, \"remove\")))) return false;\n      return true;\n    }\n  };\n\n} // namespace margelo::nitro\n"
  },
  {
    "path": "packages/react-native-mmkv/nitrogen/generated/shared/c++/Mode.hpp",
    "content": "///\n/// Mode.hpp\n/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.\n/// https://github.com/mrousavy/nitro\n/// Copyright © Marc Rousavy @ Margelo\n///\n\n#pragma once\n\n#if __has_include(<NitroModules/NitroHash.hpp>)\n#include <NitroModules/NitroHash.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n#if __has_include(<NitroModules/JSIConverter.hpp>)\n#include <NitroModules/JSIConverter.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n#if __has_include(<NitroModules/NitroDefines.hpp>)\n#include <NitroModules/NitroDefines.hpp>\n#else\n#error NitroModules cannot be found! Are you sure you installed NitroModules properly?\n#endif\n\nnamespace margelo::nitro::mmkv {\n\n  /**\n   * An enum which can be represented as a JavaScript union (Mode).\n   */\n  enum class Mode {\n    SINGLE_PROCESS      SWIFT_NAME(singleProcess) = 0,\n    MULTI_PROCESS      SWIFT_NAME(multiProcess) = 1,\n  } CLOSED_ENUM;\n\n} // namespace margelo::nitro::mmkv\n\nnamespace margelo::nitro {\n\n  // C++ Mode <> JS Mode (union)\n  template <>\n  struct JSIConverter<margelo::nitro::mmkv::Mode> final {\n    static inline margelo::nitro::mmkv::Mode fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {\n      std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);\n      switch (hashString(unionValue.c_str(), unionValue.size())) {\n        case hashString(\"single-process\"): return margelo::nitro::mmkv::Mode::SINGLE_PROCESS;\n        case hashString(\"multi-process\"): return margelo::nitro::mmkv::Mode::MULTI_PROCESS;\n        default: [[unlikely]]\n          throw std::invalid_argument(\"Cannot convert \\\"\" + unionValue + \"\\\" to enum Mode - invalid value!\");\n      }\n    }\n    static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::mmkv::Mode arg) {\n      switch (arg) {\n        case margelo::nitro::mmkv::Mode::SINGLE_PROCESS: return JSIConverter<std::string>::toJSI(runtime, \"single-process\");\n        case margelo::nitro::mmkv::Mode::MULTI_PROCESS: return JSIConverter<std::string>::toJSI(runtime, \"multi-process\");\n        default: [[unlikely]]\n          throw std::invalid_argument(\"Cannot convert Mode to JS - invalid value: \"\n                                    + std::to_string(static_cast<int>(arg)) + \"!\");\n      }\n    }\n    static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {\n      if (!value.isString()) {\n        return false;\n      }\n      std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);\n      switch (hashString(unionValue.c_str(), unionValue.size())) {\n        case hashString(\"single-process\"):\n        case hashString(\"multi-process\"):\n          return true;\n        default:\n          return false;\n      }\n    }\n  };\n\n} // namespace margelo::nitro\n"
  },
  {
    "path": "packages/react-native-mmkv/package.json",
    "content": "{\n  \"name\": \"react-native-mmkv\",\n  \"version\": \"4.3.0\",\n  \"description\": \"⚡️ The fastest key/value storage for React Native.\",\n  \"main\": \"lib/index\",\n  \"module\": \"lib/index\",\n  \"types\": \"lib/index.d.ts\",\n  \"react-native\": \"src/index\",\n  \"source\": \"src/index\",\n  \"files\": [\n    \"src\",\n    \"react-native.config.js\",\n    \"lib\",\n    \"nitrogen\",\n    \"android/build.gradle\",\n    \"android/gradle.properties\",\n    \"android/fix-prefab.gradle\",\n    \"android/CMakeLists.txt\",\n    \"android/src\",\n    \"ios/**/*.h\",\n    \"ios/**/*.m\",\n    \"ios/**/*.mm\",\n    \"ios/**/*.cpp\",\n    \"ios/**/*.swift\",\n    \"cpp/**/*.h\",\n    \"cpp/**/*.hpp\",\n    \"cpp/**/*.cpp\",\n    \"app.plugin.js\",\n    \"nitro.json\",\n    \"*.podspec\",\n    \"README.md\"\n  ],\n  \"scripts\": {\n    \"typecheck\": \"tsc --noEmit\",\n    \"clean\": \"rm -rf android/build node_modules/**/android/build lib\",\n    \"lint\": \"eslint \\\"**/*.{js,ts,tsx}\\\" --fix\",\n    \"lint-ci\": \"eslint \\\"**/*.{js,ts,tsx}\\\" -f @jamesacarr/github-actions\",\n    \"typescript\": \"tsc\",\n    \"specs\": \"tsc && nitrogen --logLevel=\\\"debug\\\"\",\n    \"build\": \"tsc --noEmit false\",\n    \"release\": \"release-it\",\n    \"test\": \"jest\"\n  },\n  \"keywords\": [\n    \"react-native\",\n    \"nitro\"\n  ],\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/mrousavy/react-native-mmkv.git\"\n  },\n  \"author\": \"Marc Rousavy <me@mrousavy.com> (https://github.com/mrousavy)\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/mrousavy/react-native-mmkv/issues\"\n  },\n  \"homepage\": \"https://github.com/mrousavy/react-native-mmkv#readme\",\n  \"publishConfig\": {\n    \"registry\": \"https://registry.npmjs.org/\"\n  },\n  \"devDependencies\": {\n    \"@expo/config-plugins\": \"^10.1.2\",\n    \"@react-native/eslint-config\": \"0.82.0\",\n    \"@testing-library/react-native\": \"^13.3.1\",\n    \"@types/jest\": \"^29.5.12\",\n    \"@types/react\": \"^19.0.6\",\n    \"eslint\": \"^8.57.0\",\n    \"eslint-config-prettier\": \"^9.1.0\",\n    \"eslint-plugin-prettier\": \"^5.2.1\",\n    \"nitrogen\": \"0.35.0\",\n    \"prettier\": \"^3.3.3\",\n    \"react\": \"19.1.1\",\n    \"react-native\": \"0.82.0\",\n    \"react-native-nitro-modules\": \"0.35.0\",\n    \"typescript\": \"^5.8.3\"\n  },\n  \"peerDependencies\": {\n    \"react\": \"*\",\n    \"react-native\": \"*\",\n    \"react-native-nitro-modules\": \"*\"\n  },\n  \"eslintConfig\": {\n    \"root\": true,\n    \"extends\": [\n      \"@react-native\",\n      \"prettier\"\n    ],\n    \"plugins\": [\n      \"prettier\"\n    ],\n    \"rules\": {\n      \"prettier/prettier\": [\n        \"warn\",\n        {\n          \"quoteProps\": \"consistent\",\n          \"singleQuote\": true,\n          \"tabWidth\": 2,\n          \"trailingComma\": \"es5\",\n          \"useTabs\": false\n        }\n      ]\n    }\n  },\n  \"eslintIgnore\": [\n    \"node_modules/\",\n    \"lib/\"\n  ],\n  \"release-it\": {\n    \"npm\": {\n      \"publish\": true\n    },\n    \"git\": false,\n    \"github\": {\n      \"release\": false\n    },\n    \"hooks\": {\n      \"before:init\": \"bun typecheck\",\n      \"after:bump\": \"bun run build\"\n    }\n  },\n  \"prettier\": {\n    \"quoteProps\": \"consistent\",\n    \"singleQuote\": true,\n    \"tabWidth\": 2,\n    \"trailingComma\": \"es5\",\n    \"useTabs\": false,\n    \"semi\": false\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/react-native.config.js",
    "content": "// https://github.com/react-native-community/cli/blob/main/docs/dependencies.md\n\nmodule.exports = {\n  dependency: {\n    platforms: {\n      /**\n       * @type {import('@react-native-community/cli-types').IOSDependencyParams}\n       */\n      ios: {},\n      /**\n       * @type {import('@react-native-community/cli-types').AndroidDependencyParams}\n       */\n      android: {},\n    },\n  },\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/__tests__/hooks.test.tsx",
    "content": "import React from 'react'\nimport { Button, Text } from 'react-native'\nimport {\n  act,\n  fireEvent,\n  render,\n  renderHook,\n  screen,\n  cleanup,\n  waitFor,\n} from '@testing-library/react-native'\nimport { createMMKV, useMMKVNumber, useMMKVString } from '..'\n\nconst mmkv = createMMKV()\n\nbeforeEach(() => {\n  mmkv.clearAll()\n  mmkv.trim()\n})\n\nafterEach(() => {\n  cleanup()\n})\n\ntest('hooks update when the value is changed directly through the instance', () => {\n  const { result } = renderHook(() => useMMKVString('string-key', mmkv))\n\n  expect(result.current[0]).toBeUndefined()\n\n  // First, make a \"normal\" change\n  act(() => {\n    result.current[1]('value 1')\n  })\n\n  expect(result.current[0]).toStrictEqual('value 1')\n\n  // Now, make the change directly through the instance.\n  act(() => {\n    mmkv.set('string-key', 'value 2')\n  })\n  expect(result.current[0]).toStrictEqual('value 2')\n})\n\ntest('functional updates to hooks', () => {\n  const Component: React.FC = () => {\n    const [state, setState] = React.useState(0)\n    const [value, setValue] = useMMKVNumber('number-key', mmkv)\n\n    return (\n      <>\n        <Button\n          testID=\"button\"\n          title=\"Double Increment Me\"\n          onPress={() => {\n            // Increment the state value twice, using the function form of useState.\n            setState((current) => current + 1)\n            setState((current) => current + 1)\n\n            // Increment the MMKV value twice, using the same function form.\n            setValue((current) => (current ?? 0) + 1)\n            setValue((current) => (current ?? 0) + 1)\n          }}\n        />\n        <Text testID=\"state-value\">State: {state.toString()}</Text>\n        <Text testID=\"mmkv-value\">MMKV: {(value ?? 0).toString()}</Text>\n      </>\n    )\n  }\n\n  render(<Component />)\n\n  const button = screen.getByTestId('button')\n\n  // Why these assertions:\n  // https://github.com/mrousavy/react-native-mmkv/issues/599\n  fireEvent.press(button)\n  expect(screen.getByTestId('state-value').children).toStrictEqual([\n    'State: ',\n    '2',\n  ])\n  expect(screen.getByTestId('mmkv-value').children).toStrictEqual([\n    'MMKV: ',\n    '2',\n  ])\n\n  fireEvent.press(button)\n  expect(screen.getByTestId('state-value').children).toStrictEqual([\n    'State: ',\n    '4',\n  ])\n  expect(screen.getByTestId('mmkv-value').children).toStrictEqual([\n    'MMKV: ',\n    '4',\n  ])\n})\n\ntest('useMMKV hook does not miss updates that happen during subscription setup', async () => {\n  const raceKey = 'race-key'\n  const raceMMKV = createMMKV()\n\n  let simulatedRaceDone = false\n  const originalSubscribe = raceMMKV.addOnValueChangedListener.bind(raceMMKV)\n  raceMMKV.addOnValueChangedListener = ((listener) => {\n    if (!simulatedRaceDone) {\n      simulatedRaceDone = true\n      raceMMKV.set(raceKey, 'updated-before-subscribe')\n    }\n    return originalSubscribe(listener)\n  }) as typeof raceMMKV.addOnValueChangedListener\n\n  const { result } = renderHook(() => useMMKVString(raceKey, raceMMKV))\n\n  await waitFor(() => {\n    expect(result.current[0]).toBe('updated-before-subscribe')\n  })\n})\n\ntest('useMMKV hook stays consistent during rapid updates', async () => {\n  const raceKey = 'rapid-key'\n  const { result } = renderHook(() => useMMKVNumber(raceKey, mmkv))\n\n  act(() => {\n    for (let i = 1; i <= 100; i++) {\n      mmkv.set(raceKey, i)\n    }\n  })\n\n  await waitFor(() => {\n    expect(result.current[0]).toBe(100)\n  })\n})\n"
  },
  {
    "path": "packages/react-native-mmkv/src/addMemoryWarningListener/addMemoryWarningListener.mock.ts",
    "content": "import type { MMKV } from '../specs/MMKV.nitro'\n\nexport function addMemoryWarningListener(_mmkv: MMKV): void {\n  // This is no-op in a mocked environment.\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/addMemoryWarningListener/addMemoryWarningListener.ts",
    "content": "import { AppState } from 'react-native'\nimport type { NativeEventSubscription } from 'react-native'\nimport type { MMKV } from '../specs/MMKV.nitro'\n\nexport function addMemoryWarningListener(mmkv: MMKV): void {\n  if (global.WeakRef != null && global.FinalizationRegistry != null) {\n    // 1. Weakify MMKV so we can safely use it inside the memoryWarning event listener\n    const weakMmkv = new WeakRef(mmkv)\n    const listener = AppState.addEventListener('memoryWarning', () => {\n      // 0. Everytime we receive a memoryWarning, we try to trim the MMKV instance (if it is still valid)\n      weakMmkv.deref()?.trim()\n    })\n    // 2. Add a listener to when the MMKV instance is deleted\n    const finalization = new FinalizationRegistry(\n      (l: NativeEventSubscription) => {\n        // 3. When MMKV is deleted, this listener will be called with the memoryWarning listener.\n        l.remove()\n      }\n    )\n    // 2.1. Bind the listener to the actual MMKV instance.\n    finalization.register(mmkv, listener)\n  } else {\n    // WeakRef/FinalizationRegistry is not implemented in this engine.\n    // Just add the listener, even if it retains MMKV strong forever.\n    AppState.addEventListener('memoryWarning', () => {\n      mmkv.trim()\n    })\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/addMemoryWarningListener/addMemoryWarningListener.web.ts",
    "content": "import type { MMKV } from '../specs/MMKV.nitro'\n\nexport const addMemoryWarningListener = (_mmkv: MMKV): void => {\n  //no-op function, there is not a web equivalent to memory warning\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/createMMKV/createMMKV.ts",
    "content": "import type { MMKV } from '../specs/MMKV.nitro'\nimport type { Configuration } from '../specs/MMKVFactory.nitro'\nimport { Platform } from 'react-native'\nimport { addMemoryWarningListener } from '../addMemoryWarningListener/addMemoryWarningListener'\nimport { isTest } from '../isTest'\nimport { createMockMMKV } from './createMockMMKV'\nimport { getMMKVFactory, getPlatformContext } from '../getMMKVFactory'\n\nexport function createMMKV(configuration?: Configuration): MMKV {\n  if (isTest()) {\n    // In a test environment, we mock the MMKV instance.\n    return createMockMMKV(configuration)\n  }\n\n  const factory = getMMKVFactory()\n\n  // Pre-parse the config\n  let config = configuration ?? { id: factory.defaultMMKVInstanceId }\n\n  if (Platform.OS === 'ios') {\n    if (config.path == null) {\n      // If the user set an App Group directory in Info.plist, let's use\n      // the App Group as a MMKV path:\n      const platformContext = getPlatformContext()\n      const appGroupDirectory = platformContext.getAppGroupDirectory()\n      if (appGroupDirectory != null) {\n        config.path = appGroupDirectory\n      }\n    }\n  }\n\n  // Creates the C++ MMKV HybridObject\n  const mmkv = factory.createMMKV(config)\n  // Add a hook that trims the storage when we get a memory warning\n  addMemoryWarningListener(mmkv)\n  return mmkv\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/createMMKV/createMMKV.web.ts",
    "content": "import type { MMKV } from '../specs/MMKV.nitro'\nimport type { Configuration } from '../specs/MMKVFactory.nitro'\nimport { createTextDecoder } from '../web/createTextDecoder'\nimport { createTextEncoder } from '../web/createTextEncoder'\nimport {\n  getLocalStorage,\n  LOCAL_STORAGE_KEY_WILDCARD,\n} from '../web/getLocalStorage'\n\nexport function createMMKV(\n  config: Configuration = { id: 'mmkv.default' }\n): MMKV {\n  if (config.encryptionKey != null) {\n    throw new Error(\"MMKV: 'encryptionKey' is not supported on Web!\")\n  }\n  if (config.path != null) {\n    throw new Error(\"MMKV: 'path' is not supported on Web!\")\n  }\n\n  const textDecoder = createTextDecoder()\n  const textEncoder = createTextEncoder()\n  const listeners = new Set<(key: string) => void>()\n\n  if (config.id.includes(LOCAL_STORAGE_KEY_WILDCARD)) {\n    throw new Error('MMKV: `id` cannot contain the backslash character (`\\\\`)!')\n  }\n\n  const keyPrefix = `${config.id}${LOCAL_STORAGE_KEY_WILDCARD}` // mmkv.default\\\\\n  const prefixedKey = (key: string) => {\n    if (key.includes('\\\\')) {\n      throw new Error(\n        'MMKV: `key` cannot contain the backslash character (`\\\\`)!'\n      )\n    }\n    return `${keyPrefix}${key}`\n  }\n\n  const callListeners = (key: string) => {\n    listeners.forEach((l) => l(key))\n  }\n\n  return {\n    id: config.id,\n    get length(): number {\n      return getLocalStorage().length\n    },\n    get size(): number {\n      return this.byteSize\n    },\n    get byteSize(): number {\n      // estimate - assumes UTF8\n      return JSON.stringify(getLocalStorage()).length\n    },\n    isReadOnly: false,\n    isEncrypted: false,\n    clearAll: () => {\n      const storage = getLocalStorage()\n      const keys = Object.keys(storage)\n      for (const key of keys) {\n        if (key.startsWith(keyPrefix)) {\n          storage.removeItem(key)\n          callListeners(key)\n        }\n      }\n    },\n    remove: (key) => {\n      const storage = getLocalStorage()\n      storage.removeItem(prefixedKey(key))\n      const wasRemoved = storage.getItem(prefixedKey(key)) === null\n      if (wasRemoved) callListeners(key)\n      return wasRemoved\n    },\n    set: (key, value) => {\n      const storage = getLocalStorage()\n      if (key === '') throw new Error('Cannot set a value for an empty key!')\n      if (value instanceof ArrayBuffer) {\n        storage.setItem(prefixedKey(key), textDecoder.decode(value))\n      } else {\n        storage.setItem(prefixedKey(key), String(value))\n      }\n      callListeners(key)\n    },\n    getString: (key) => {\n      const storage = getLocalStorage()\n      return storage.getItem(prefixedKey(key)) ?? undefined\n    },\n    getNumber: (key) => {\n      const storage = getLocalStorage()\n      const value = storage.getItem(prefixedKey(key))\n      if (value == null) return undefined\n      return Number(value)\n    },\n    getBoolean: (key) => {\n      const storage = getLocalStorage()\n      const value = storage.getItem(prefixedKey(key))\n      if (value == null) return undefined\n      return value === 'true'\n    },\n    getBuffer: (key) => {\n      const storage = getLocalStorage()\n      const value = storage.getItem(prefixedKey(key))\n      if (value == null) return undefined\n      return textEncoder.encode(value).buffer\n    },\n    getAllKeys: () => {\n      const storage = getLocalStorage()\n      const keys = Object.keys(storage)\n      return keys\n        .filter((key) => key.startsWith(keyPrefix))\n        .map((key) => key.slice(keyPrefix.length))\n    },\n    contains: (key) => {\n      const storage = getLocalStorage()\n      return storage.getItem(prefixedKey(key)) != null\n    },\n    recrypt: () => {\n      throw new Error('`recrypt(..)` is not supported on Web!')\n    },\n    encrypt: () => {\n      throw new Error('`encrypt(..)` is not supported on Web!')\n    },\n    decrypt: () => {\n      throw new Error('`decrypt(..)` is not supported on Web!')\n    },\n    trim: () => {\n      // no-op\n    },\n    dispose: () => {},\n    equals: () => false,\n    name: 'MMKV',\n    addOnValueChangedListener: (listener) => {\n      listeners.add(listener)\n      return {\n        remove: () => {\n          listeners.delete(listener)\n        },\n      }\n    },\n    importAllFrom: (other) => {\n      const storage = getLocalStorage()\n      const keys = other.getAllKeys()\n      let imported = 0\n      for (const key of keys) {\n        const string = other.getString(key)\n        if (string != null) {\n          storage.set(key, string)\n          imported++\n        }\n      }\n      return imported\n    },\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/createMMKV/createMockMMKV.ts",
    "content": "import type { MMKV } from '../specs/MMKV.nitro'\nimport type { Configuration } from '../specs/MMKVFactory.nitro'\n\n/**\n * Mock MMKV instance when used in a Jest/Test environment.\n */\nexport function createMockMMKV(\n  config: Configuration = { id: 'mmkv.default' }\n): MMKV {\n  const storage = new Map<string, string | boolean | number | ArrayBuffer>()\n  const listeners = new Set<(key: string) => void>()\n\n  const notifyListeners = (key: string) => {\n    listeners.forEach((listener) => {\n      listener(key)\n    })\n  }\n\n  return {\n    id: config.id,\n    get length(): number {\n      return storage.size\n    },\n    get size(): number {\n      return this.byteSize\n    },\n    get byteSize(): number {\n      // estimate - assumes UTF8\n      return JSON.stringify(storage).length\n    },\n    isReadOnly: false,\n    isEncrypted: false,\n    clearAll: () => {\n      const keysBefore = storage.keys()\n      storage.clear()\n      // Notify all listeners for all keys that were cleared\n      for (const key of keysBefore) {\n        notifyListeners(key)\n      }\n    },\n    remove: (key) => {\n      const deleted = storage.delete(key)\n      if (deleted) {\n        notifyListeners(key)\n      }\n      return deleted\n    },\n    set: (key, value) => {\n      if (key === '') throw new Error('Cannot set a value for an empty key!')\n      storage.set(key, value)\n      notifyListeners(key)\n    },\n    getString: (key) => {\n      const result = storage.get(key)\n      return typeof result === 'string' ? result : undefined\n    },\n    getNumber: (key) => {\n      const result = storage.get(key)\n      return typeof result === 'number' ? result : undefined\n    },\n    getBoolean: (key) => {\n      const result = storage.get(key)\n      return typeof result === 'boolean' ? result : undefined\n    },\n    getBuffer: (key) => {\n      const result = storage.get(key)\n      return result instanceof ArrayBuffer ? result : undefined\n    },\n    getAllKeys: () => Array.from(storage.keys()),\n    contains: (key) => storage.has(key),\n    recrypt: () => {\n      console.warn('Encryption is not supported in mocked MMKV instances!')\n    },\n    encrypt: () => {\n      console.warn('Encryption is not supported in mocked MMKV instances!')\n    },\n    decrypt: () => {\n      console.warn('Encryption is not supported in mocked MMKV instances!')\n    },\n    trim: () => {\n      // no-op\n    },\n    name: 'MMKV',\n    dispose: () => {},\n    equals: () => {\n      return false\n    },\n    addOnValueChangedListener: (listener) => {\n      listeners.add(listener)\n      return {\n        remove: () => {\n          listeners.delete(listener)\n        },\n      }\n    },\n    importAllFrom: (other) => {\n      const keys = other.getAllKeys()\n      let imported = 0\n      for (const key of keys) {\n        const data = other.getBuffer(key)\n        if (data != null) {\n          storage.set(key, data)\n          imported++\n        }\n      }\n      return imported\n    },\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/createMMKV/getDefaultMMKVInstance.ts",
    "content": "import type { MMKV } from '../specs/MMKV.nitro'\nimport { createMMKV } from './createMMKV'\n\nlet defaultInstance: MMKV | null = null\nexport function getDefaultMMKVInstance(): MMKV {\n  if (defaultInstance == null) {\n    defaultInstance = createMMKV()\n  }\n  return defaultInstance\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/deleteMMKV/deleteMMKV.ts",
    "content": "import { getMMKVFactory } from '../getMMKVFactory'\nimport { isTest } from '../isTest'\n\nexport function deleteMMKV(id: string): boolean {\n  if (isTest()) {\n    return true\n  }\n\n  const factory = getMMKVFactory()\n  return factory.deleteMMKV(id)\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/deleteMMKV/deleteMMKV.web.ts",
    "content": "import {\n  getLocalStorage,\n  LOCAL_STORAGE_KEY_WILDCARD,\n} from '../web/getLocalStorage'\n\nexport function deleteMMKV(id: string): boolean {\n  const storage = getLocalStorage()\n  const prefix = id + LOCAL_STORAGE_KEY_WILDCARD\n  let wasRemoved = false\n\n  const keys = Object.keys(storage)\n  for (const key of keys) {\n    if (key.startsWith(prefix)) {\n      storage.removeItem(key)\n      wasRemoved = true\n    }\n  }\n\n  return wasRemoved\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/existsMMKV/existsMMKV.ts",
    "content": "import { getMMKVFactory } from '../getMMKVFactory'\nimport { isTest } from '../isTest'\n\nexport function existsMMKV(id: string): boolean {\n  if (isTest()) {\n    return true\n  }\n\n  const factory = getMMKVFactory()\n  return factory.existsMMKV(id)\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/existsMMKV/existsMMKV.web.ts",
    "content": "import {\n  getLocalStorage,\n  LOCAL_STORAGE_KEY_WILDCARD,\n} from '../web/getLocalStorage'\n\nexport function existsMMKV(id: string): boolean {\n  const storage = getLocalStorage()\n  const prefix = id + LOCAL_STORAGE_KEY_WILDCARD\n  const keys = Object.keys(storage)\n  return keys.some((k) => k.startsWith(prefix))\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/getMMKVFactory.ts",
    "content": "import { NitroModules } from 'react-native-nitro-modules'\nimport type { MMKVFactory } from './specs/MMKVFactory.nitro'\nimport type { MMKVPlatformContext } from './specs/MMKVPlatformContext.nitro'\n\nlet factory: MMKVFactory | undefined\nlet platformContext: MMKVPlatformContext | undefined\n\nexport function getPlatformContext(): MMKVPlatformContext {\n  if (platformContext == null) {\n    // Lazy-init the platform-context HybridObject\n    platformContext = NitroModules.createHybridObject<MMKVPlatformContext>(\n      'MMKVPlatformContext'\n    )\n  }\n  return platformContext\n}\n\nexport function getMMKVFactory(): MMKVFactory {\n  if (factory == null) {\n    // Lazy-init the factory HybridObject\n    factory = NitroModules.createHybridObject<MMKVFactory>('MMKVFactory')\n    const context = getPlatformContext()\n    const baseDirectory = context.getBaseDirectory()\n    factory.initializeMMKV(baseDirectory)\n  }\n\n  return factory\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/hooks/createMMKVHook.ts",
    "content": "import { useCallback, useSyncExternalStore } from 'react'\nimport { getDefaultMMKVInstance } from '../createMMKV/getDefaultMMKVInstance'\nimport type { MMKV } from '../specs/MMKV.nitro'\n\nexport function createMMKVHook<\n  T extends (boolean | number | string | ArrayBufferLike) | undefined,\n  TSet extends T | undefined,\n  TSetAction extends TSet | ((current: T) => TSet),\n>(getter: (instance: MMKV, key: string) => T) {\n  return (\n    key: string,\n    instance?: MMKV\n  ): [value: T, setValue: (value: TSetAction) => void] => {\n    const mmkv = instance ?? getDefaultMMKVInstance()\n\n    const value = useSyncExternalStore(\n      useCallback(\n        (onStoreChange: () => void) => {\n          const listener = mmkv.addOnValueChangedListener((changedKey) => {\n            if (changedKey === key) {\n              onStoreChange()\n            }\n          })\n          return () => listener.remove()\n        },\n        [key, mmkv]\n      ),\n      useCallback(() => getter(mmkv, key), [key, mmkv]),\n      useCallback(() => getter(mmkv, key), [key, mmkv])\n    )\n\n    // update value by user set\n    const set = useCallback(\n      (v: TSetAction) => {\n        const newValue = typeof v === 'function' ? v(getter(mmkv, key)) : v\n        switch (typeof newValue) {\n          case 'number':\n          case 'string':\n          case 'boolean':\n            mmkv.set(key, newValue)\n            break\n          case 'undefined':\n            mmkv.remove(key)\n            break\n          case 'object':\n            if (newValue instanceof ArrayBuffer) {\n              mmkv.set(key, newValue)\n              break\n            } else {\n              throw new Error(\n                `MMKV: Type object (${newValue}) is not supported!`\n              )\n            }\n          default:\n            throw new Error(`MMKV: Type ${typeof newValue} is not supported!`)\n        }\n      },\n      [key, mmkv]\n    )\n\n    return [value, set]\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/hooks/useMMKV.ts",
    "content": "import { useRef } from 'react'\nimport type { MMKV } from '../specs/MMKV.nitro'\nimport type { Configuration } from '../specs/MMKVFactory.nitro'\nimport { getDefaultMMKVInstance } from '../createMMKV/getDefaultMMKVInstance'\nimport { createMMKV } from '../createMMKV/createMMKV'\n\nfunction isConfigurationEqual(\n  left?: Configuration,\n  right?: Configuration\n): boolean {\n  if (left == null || right == null) return left == null && right == null\n\n  return (\n    left.encryptionKey === right.encryptionKey &&\n    left.id === right.id &&\n    left.path === right.path &&\n    left.mode === right.mode\n  )\n}\n\n/**\n * Use the default, shared MMKV instance.\n */\nexport function useMMKV(): MMKV\n/**\n * Use a custom MMKV instance with the given configuration.\n * @param configuration The configuration to initialize the MMKV instance with. Does not have to be memoized.\n */\nexport function useMMKV(configuration: Configuration): MMKV\nexport function useMMKV(configuration?: Configuration): MMKV {\n  const instance = useRef<MMKV>(undefined)\n  const lastConfiguration = useRef<Configuration>(undefined)\n\n  if (configuration == null) return getDefaultMMKVInstance()\n\n  if (\n    instance.current == null ||\n    !isConfigurationEqual(lastConfiguration.current, configuration)\n  ) {\n    lastConfiguration.current = configuration\n    instance.current = createMMKV(configuration)\n  }\n\n  return instance.current\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/hooks/useMMKVBoolean.ts",
    "content": "import { createMMKVHook } from './createMMKVHook'\n\n/**\n * Use the boolean value of the given `key` from the given MMKV storage instance.\n *\n * If no instance is provided, a shared default instance will be used.\n *\n * @example\n * ```ts\n * const [isPremiumAccount, setIsPremiumAccount] = useMMKVBoolean(\"user.isPremium\")\n * ```\n */\nexport const useMMKVBoolean = createMMKVHook((instance, key) =>\n  instance.getBoolean(key)\n)\n"
  },
  {
    "path": "packages/react-native-mmkv/src/hooks/useMMKVBuffer.ts",
    "content": "import { createMMKVHook } from './createMMKVHook'\n\n/**\n * Use the buffer value (unsigned 8-bit (0-255)) of the given `key` from the given MMKV storage instance.\n *\n * If no instance is provided, a shared default instance will be used.\n *\n * @example\n * ```ts\n * const [privateKey, setPrivateKey] = useMMKVBuffer(\"user.privateKey\")\n * ```\n */\nexport const useMMKVBuffer = createMMKVHook((instance, key) =>\n  instance.getBuffer(key)\n)\n"
  },
  {
    "path": "packages/react-native-mmkv/src/hooks/useMMKVKeys.ts",
    "content": "import { useState } from 'react'\nimport type { MMKV } from '../specs/MMKV.nitro'\nimport { getDefaultMMKVInstance } from '../createMMKV/getDefaultMMKVInstance'\nimport { useMMKVListener } from './useMMKVListener'\n\n/**\n * Get a list of all keys that exist in the given MMKV {@linkcode instance}.\n * The keys update when new keys are added or removed.\n * @param instance The instance to listen to changes to (or the default instance)\n *\n * @example\n * ```ts\n * useMMKVKeys(instance)\n * ```\n */\nexport function useMMKVKeys(instance?: MMKV): string[] {\n  const mmkv = instance ?? getDefaultMMKVInstance()\n  const [allKeys, setKeys] = useState<string[]>(() => mmkv.getAllKeys())\n\n  useMMKVListener((key) => {\n    // a key changed\n    setKeys((keys) => {\n      const currentlyHasKey = keys.includes(key)\n      const hasKey = mmkv.contains(key)\n      if (hasKey !== currentlyHasKey) {\n        // Re-fetch the keys from native\n        return mmkv.getAllKeys()\n      } else {\n        // We are up-to-date.\n        return keys\n      }\n    })\n  }, mmkv)\n\n  return allKeys\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/hooks/useMMKVListener.ts",
    "content": "import { useEffect, useRef } from 'react'\nimport type { MMKV } from '../specs/MMKV.nitro'\nimport { getDefaultMMKVInstance } from '../createMMKV/getDefaultMMKVInstance'\n\n/**\n * Listen for changes in the given MMKV storage instance.\n * If no instance is passed, the default instance will be used.\n * @param valueChangedListener The function to call whenever a value inside the storage instance changes\n * @param instance The instance to listen to changes to (or the default instance)\n *\n * @example\n * ```ts\n * useMMKVListener((key) => {\n *   console.log(`Value for \"${key}\" changed!`)\n * })\n * ```\n */\nexport function useMMKVListener(\n  valueChangedListener: (key: string) => void,\n  instance?: MMKV\n): void {\n  const ref = useRef(valueChangedListener)\n  ref.current = valueChangedListener\n\n  const mmkv = instance ?? getDefaultMMKVInstance()\n\n  useEffect(() => {\n    const listener = mmkv.addOnValueChangedListener((changedKey) => {\n      ref.current(changedKey)\n    })\n    return () => listener.remove()\n  }, [mmkv])\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/hooks/useMMKVNumber.ts",
    "content": "import { createMMKVHook } from './createMMKVHook'\n\n/**\n * Use the number value of the given `key` from the given MMKV storage instance.\n *\n * If no instance is provided, a shared default instance will be used.\n *\n * @example\n * ```ts\n * const [age, setAge] = useMMKVNumber(\"user.age\")\n * ```\n */\nexport const useMMKVNumber = createMMKVHook((instance, key) =>\n  instance.getNumber(key)\n)\n"
  },
  {
    "path": "packages/react-native-mmkv/src/hooks/useMMKVObject.ts",
    "content": "import { useCallback, useMemo } from 'react'\nimport type { MMKV } from '../specs/MMKV.nitro'\nimport { useMMKVString } from './useMMKVString'\n\n/**\n * Use an object value of the given `key` from the given MMKV storage instance.\n *\n * If no instance is provided, a shared default instance will be used.\n *\n * The object will be serialized using `JSON`.\n *\n * @example\n * ```ts\n * const [user, setUser] = useMMKVObject<User>(\"user\")\n * ```\n */\nexport function useMMKVObject<T>(\n  key: string,\n  instance?: MMKV\n): [\n  value: T | undefined,\n  setValue: (\n    value: T | undefined | ((prevValue: T | undefined) => T | undefined)\n  ) => void,\n] {\n  const [json, setJson] = useMMKVString(key, instance)\n\n  const value = useMemo(() => {\n    if (json == null) return undefined\n    return JSON.parse(json) as T\n  }, [json])\n\n  const setValue = useCallback(\n    (v: (T | undefined) | ((prev: T | undefined) => T | undefined)) => {\n      if (v instanceof Function) {\n        setJson((currentJson) => {\n          const currentValue =\n            currentJson != null ? (JSON.parse(currentJson) as T) : undefined\n          const newValue = v(currentValue)\n          // Store the Object as a serialized Value or clear the value\n          return newValue != null ? JSON.stringify(newValue) : undefined\n        })\n      } else {\n        // Store the Object as a serialized Value or clear the value\n        const newValue = v != null ? JSON.stringify(v) : undefined\n        setJson(newValue)\n      }\n    },\n    [setJson]\n  )\n\n  return [value, setValue]\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/hooks/useMMKVString.ts",
    "content": "import { createMMKVHook } from './createMMKVHook'\n\n/**\n * Use the string value of the given `key` from the given MMKV storage instance.\n *\n * If no instance is provided, a shared default instance will be used.\n *\n * @example\n * ```ts\n * const [username, setUsername] = useMMKVString(\"user.name\")\n * ```\n */\nexport const useMMKVString = createMMKVHook((instance, key) =>\n  instance.getString(key)\n)\n"
  },
  {
    "path": "packages/react-native-mmkv/src/index.ts",
    "content": "// All types\nexport type { MMKV } from './specs/MMKV.nitro'\nexport type { Configuration, Mode } from './specs/MMKVFactory.nitro'\n\n// The create function\nexport { createMMKV } from './createMMKV/createMMKV'\n\n// Exists + Delete\nexport { existsMMKV } from './existsMMKV/existsMMKV'\nexport { deleteMMKV } from './deleteMMKV/deleteMMKV'\n\n// All the hooks\nexport { useMMKV } from './hooks/useMMKV'\nexport { useMMKVBoolean } from './hooks/useMMKVBoolean'\nexport { useMMKVBuffer } from './hooks/useMMKVBuffer'\nexport { useMMKVNumber } from './hooks/useMMKVNumber'\nexport { useMMKVObject } from './hooks/useMMKVObject'\nexport { useMMKVString } from './hooks/useMMKVString'\nexport { useMMKVListener } from './hooks/useMMKVListener'\nexport { useMMKVKeys } from './hooks/useMMKVKeys'\n"
  },
  {
    "path": "packages/react-native-mmkv/src/isTest.ts",
    "content": "export function isTest(): boolean {\n  if (global.process == null) {\n    // In a WebBrowser/Electron the `process` variable does not exist\n    return false\n  }\n  return (\n    process.env.JEST_WORKER_ID != null || process.env.VITEST_WORKER_ID != null\n  )\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/specs/MMKV.nitro.ts",
    "content": "import type { HybridObject } from 'react-native-nitro-modules'\nimport type { EncryptionType } from './MMKVFactory.nitro'\n\nexport interface Listener {\n  remove: () => void\n}\n\nexport interface MMKV extends HybridObject<{ ios: 'c++'; android: 'c++' }> {\n  /**\n   * Get the ID of this {@linkcode MMKV} instance.\n   */\n  readonly id: string\n  /**\n   * Get the current amount of key/value pairs stored in\n   * this storage.\n   */\n  readonly length: number\n  /**\n   * Get the current total size of the storage, in bytes.\n   * @deprecated Use {@linkcode byteSize} instead.\n   */\n  readonly size: number\n  /**\n   * Get the current total size of the storage, in bytes.\n   */\n  readonly byteSize: number\n  /**\n   * Get whether this instance is in read-only mode or not.\n   * If this is `true`, you can only use \"get\"-functions.\n   */\n  readonly isReadOnly: boolean\n  /**\n   * Get whether this instance is encrypted, or not.\n   * @see {@linkcode encrypt | encrypt(...)}\n   * @see {@linkcode decrypt | decrypt()}\n   */\n  readonly isEncrypted: boolean\n  /**\n   * Set a {@linkcode value} for the given {@linkcode key}.\n   *\n   * @throws an Error if the {@linkcode key} is empty.\n   * @throws an Error if the {@linkcode value} cannot be set.\n   */\n  set(key: string, value: boolean | string | number | ArrayBuffer): void\n  /**\n   * Get the boolean value for the given `key`, or `undefined` if it does not exist.\n   *\n   * @default undefined\n   */\n  getBoolean(key: string): boolean | undefined\n  /**\n   * Get the string value for the given `key`, or `undefined` if it does not exist.\n   *\n   * @default undefined\n   */\n  getString(key: string): string | undefined\n  /**\n   * Get the number value for the given `key`, or `undefined` if it does not exist.\n   *\n   * @default undefined\n   */\n  getNumber(key: string): number | undefined\n  /**\n   * Get a raw buffer of unsigned 8-bit (0-255) data.\n   *\n   * @default undefined\n   */\n  getBuffer(key: string): ArrayBuffer | undefined\n  /**\n   * Checks whether the given `key` is being stored in this MMKV instance.\n   */\n  contains(key: string): boolean\n  /**\n   * Removes the given `key`.\n   * @returns true if the key was removed, false otherwise\n   */\n  remove(key: string): boolean\n  /**\n   * Get all keys.\n   *\n   * @default []\n   */\n  getAllKeys(): string[]\n  /**\n   * Clears all keys/values.\n   */\n  clearAll(): void\n  /**\n   * Sets (or updates) the encryption-key to encrypt all data in this MMKV instance with.\n   *\n   * To remove encryption, pass `undefined` as a key.\n   *\n   * Encryption keys can have a maximum length of 16 bytes.\n   *\n   * @throws an Error if the instance cannot be recrypted.\n   * @deprecated Use {@linkcode encrypt | encrypt(...)} or {@linkcode decrypt | decrypt()} instead.\n   */\n  recrypt(key: string | undefined): void\n  /**\n   * Encrypts the data in this MMKV instance with the\n   * given {@linkcode key} and {@linkcode encryptionType}.\n   *\n   * If this MMKV instance is already encrypted ({@linkcode isEncrypted}),\n   * it will re-encrypt the data.\n   *\n   * Future attempts to open this MMKV instance will require the same\n   * {@linkcode key} and {@linkcode encryptionType}, otherwise reads\n   * will fail.\n   *\n   * The {@linkcode key} must be 16-bytes in {@linkcode EncryptionType | 'AES-128'}\n   * encryption (the default), or 32-bytes in {@linkcode EncryptionType | 'AES-256'}\n   * encryption.\n   *\n   * @param key The encryption key to use. In AES-128 this must be 16-bytes, in AES-256 it must be 32-bytes long.\n   * @param encryptionType The encryption type to use. Default: AES-128\n   */\n  encrypt(key: string, encryptionType?: EncryptionType): void\n  /**\n   * Decrypts the data in this MMKV instance and removes\n   * the encryption key.\n   *\n   * Future attempts to open this MMKV instance must be done\n   * without an encryption key, as it is now plain-text.\n   */\n  decrypt(): void\n  /**\n   * Trims the storage space and clears memory cache.\n   *\n   * Since MMKV does not resize itself after deleting keys, you can call `trim()`\n   * after deleting a bunch of keys to manually trim the memory- and\n   * disk-file to reduce storage and memory usage.\n   *\n   * In most applications, this is not needed at all.\n   */\n  trim(): void\n  /**\n   * Adds a value changed listener. The Listener will be called whenever any value\n   * in this storage instance changes (set or delete).\n   *\n   * To unsubscribe from value changes, call `remove()` on the Listener.\n   */\n  addOnValueChangedListener(onValueChanged: (key: string) => void): Listener\n\n  /**\n   * Imports all keys and values from the\n   * given other {@linkcode MMKV} instance.\n   * @returns the number of imported keys/values.\n   */\n  importAllFrom(other: MMKV): number\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/specs/MMKVFactory.nitro.ts",
    "content": "import type { HybridObject } from 'react-native-nitro-modules'\nimport type { MMKV } from './MMKV.nitro'\n\n/**\n * Configures the mode of the MMKV instance.\n * - `single-process`: The MMKV instance is only used from a single process (this app).\n * - `multi-process`: The MMKV instance may be used from multiple processes, such as app clips, share extensions or background services.\n */\nexport type Mode = 'single-process' | 'multi-process'\n\n/**\n * Configures the encryption algorithm for the MMKV instance.\n * - `AES-128`: Uses AES-128 encryption (default).\n * - `AES-256`: Uses AES-256 encryption for enhanced security.\n */\nexport type EncryptionType = 'AES-128' | 'AES-256'\n\n/**\n * Used for configuration of a single MMKV instance.\n */\nexport interface Configuration {\n  /**\n   * The MMKV instance's ID. If you want to use multiple instances, make sure to use different IDs!\n   *\n   * @example\n   * ```ts\n   * const userStorage = createMMKV({ id: `user-${userId}-storage` })\n   * const globalStorage = createMMKV({ id: 'global-app-storage' })\n   * ```\n   *\n   * @default 'mmkv.default'\n   */\n  id: string\n  /**\n   * The MMKV instance's root path. By default, MMKV stores file inside `$(Documents)/mmkv/`. You can customize MMKV's root directory on MMKV initialization:\n\n   * @example\n   * ```ts\n   * const temporaryStorage = createMMKV({ path: '/tmp/' })\n   * ```\n   *\n   * @note On iOS, if an `AppGroup` is set in `Info.plist` and `path` is `undefined`, MMKV will use the `AppGroup` directory.\n   * App Groups allow you to share MMKV storage between apps, widgets and extensions within the same AppGroup bundle.\n   * For more information, see [the `Configuration` section](https://github.com/Tencent/MMKV/wiki/iOS_tutorial#configuration).\n   *\n   * @default undefined\n   */\n  path?: string\n  /**\n   * The MMKV instance's encryption/decryption key. By default, MMKV stores all key-values in plain text on file, relying on iOS's sandbox to make sure the file is encrypted. Should you worry about information leaking, you can choose to encrypt MMKV.\n   *\n   * Encryption keys can have a maximum length of 16 bytes with AES-128 encryption and 32 bytes with AES-256 encryption.\n   *\n   * @example\n   * ```ts\n   * const secureStorage = createMMKV({ encryptionKey: 'my-encryption-key!' })\n   * ```\n   *\n   * @default undefined\n   */\n  encryptionKey?: string\n  /**\n   * The encryption algorithm to use when an encryption key is provided.\n   *\n   * @example\n   * ```ts\n   * const secureStorage = createMMKV({\n   *   id: 'secure-storage',\n   *   encryptionKey: 'my-encryption-key!',\n   *   encryptionType: 'AES-256'\n   * })\n   * ```\n   *\n   * @default 'AES-128'\n   */\n  encryptionType?: EncryptionType\n  /**\n   * Configure the processing mode for MMKV.\n   *\n   * @default 'single-process'\n   */\n  mode?: Mode\n  /**\n   * If `true`, the MMKV instance can only read from the storage, but not write to it.\n   * This is more efficient if you do not need to write to it.\n   * @default false\n   */\n  readOnly?: boolean\n  /**\n   * If `true`, MMKV will internally compare a value for equality before writing to\n   * disk, and if the new value is equal to what is already stored, it will skip\n   * the file write.\n   * Treat this as an optional performance optimization.\n   * @default false\n   */\n  compareBeforeSet?: boolean\n}\n\nexport interface MMKVFactory\n  extends HybridObject<{ ios: 'c++'; android: 'c++' }> {\n  /**\n   * Initialize the MMKV library with the given root path.\n   * This has to be called once, before using {@linkcode createMMKV}.\n   */\n  initializeMMKV(rootPath: string): void\n\n  /**\n   * Create a new {@linkcode MMKV} instance with the given {@linkcode Configuration}\n   */\n  createMMKV(configuration: Configuration): MMKV\n\n  /**\n   * Deletes the MMKV instance with the\n   * given {@linkcode id}.\n   */\n  deleteMMKV(id: string): boolean\n\n  /**\n   * Returns `true` if an MMKV instance with the\n   * given {@linkcode id} exists, `false` otherwise.\n   */\n  existsMMKV(id: string): boolean\n\n  /**\n   * Get the default MMKV instance's ID.\n   * @default 'mmkv.default'\n   */\n  readonly defaultMMKVInstanceId: string\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/specs/MMKVPlatformContext.nitro.ts",
    "content": "import type { HybridObject } from 'react-native-nitro-modules'\n\nexport interface MMKVPlatformContext\n  extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {\n  /**\n   * Get the MMKV base directory\n   */\n  getBaseDirectory(): string\n  /**\n   * Get the MMKV AppGroup's directory.\n   * The AppGroup can be set in your App's `Info.plist`, and will enable\n   * data sharing between main app, companions (e.g. watch app) and extensions.\n   * @platform iOS\n   * @default undefined\n   */\n  getAppGroupDirectory(): string | undefined\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/web/createTextDecoder.ts",
    "content": "export function createTextDecoder(): TextDecoder {\n  const g = global ?? globalThis ?? window\n  if (g.TextDecoder != null) {\n    return new g.TextDecoder()\n  } else {\n    return {\n      decode: () => {\n        throw new Error('TextDecoder is not supported in this environment!')\n      },\n      encoding: 'utf-8',\n      fatal: false,\n      ignoreBOM: false,\n    }\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/web/createTextEncoder.ts",
    "content": "export function createTextEncoder(): TextEncoder {\n  const g = global ?? globalThis ?? window\n  if (g.TextEncoder != null) {\n    return new g.TextEncoder()\n  } else {\n    return {\n      encode: () => {\n        throw new Error('TextEncoder is not supported in this environment!')\n      },\n      encodeInto: () => {\n        throw new Error('TextEncoder is not supported in this environment!')\n      },\n      encoding: 'utf-8',\n    }\n  }\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/src/web/getLocalStorage.ts",
    "content": "export const LOCAL_STORAGE_KEY_WILDCARD = '\\\\'\n\nconst canUseDOM =\n  typeof window !== 'undefined' && window.document?.createElement != null\n\nconst hasAccessToLocalStorage = () => {\n  try {\n    // throws ACCESS_DENIED error\n    window.localStorage\n\n    return true\n  } catch {\n    return false\n  }\n}\nconst inMemoryStorage = new Map<string, string>()\n\nexport function getLocalStorage(): Storage {\n  if (!canUseDOM) {\n    throw new Error(\n      'Tried to access storage on the server. Did you forget to call this in useEffect?'\n    )\n  }\n\n  if (!hasAccessToLocalStorage()) {\n    return {\n      getItem: (key: string) => inMemoryStorage.get(key) ?? null,\n      setItem: (key: string, value: string) => inMemoryStorage.set(key, value),\n      removeItem: (key: string) => inMemoryStorage.delete(key),\n      clear: () => inMemoryStorage.clear(),\n      length: inMemoryStorage.size,\n      key: (index: number) => Object.keys(inMemoryStorage).at(index) ?? null,\n    } as Storage\n  }\n\n  const domStorage =\n    global?.localStorage ?? window?.localStorage ?? localStorage\n  if (domStorage == null) {\n    throw new Error(`Could not find 'localStorage' instance!`)\n  }\n  return domStorage\n}\n"
  },
  {
    "path": "packages/react-native-mmkv/tsconfig.json",
    "content": "{\n  \"include\": [\n    \"src\"\n  ],\n  \"compilerOptions\": {\n    \"composite\": true,\n    \"outDir\": \"lib\",\n    \"rootDir\": \"src\",\n    \"allowUnreachableCode\": false,\n    \"allowUnusedLabels\": false,\n    \"esModuleInterop\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"jsx\": \"react\",\n    \"lib\": [\"esnext\", \"DOM\"],\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"node\",\n    \"noEmit\": false,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noImplicitReturns\": true,\n    \"noImplicitUseStrict\": false,\n    \"noStrictGenericChecks\": false,\n    \"noUncheckedIndexedAccess\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"target\": \"esnext\",\n    \"verbatimModuleSyntax\": true\n  }\n}\n"
  },
  {
    "path": "scripts/clang-format.sh",
    "content": "#!/bin/bash\n\nset -e\n\nCPP_DIRS=(\n  # react-native-mmkv\n  \"packages/react-native-mmkv/android/src/main/cpp\"\n  \"packages/react-native-mmkv/cpp\"\n  \"packages/react-native-mmkv/ios\"\n)\n\nif which clang-format >/dev/null; then\n  DIRS=$(printf \"%s \" \"${CPP_DIRS[@]}\")\n  find $DIRS -type f \\( -name \"*.h\" -o -name \"*.hpp\" -o -name \"*.cpp\" -o -name \"*.m\" -o -name \"*.mm\" -o -name \"*.c\" \\) -print0 | while read -d $'\\0' file; do\n    clang-format -style=file:./.clang-format -i \"$file\"\n  done\nelse\n  echo \"error: clang-format not installed, install with 'brew install clang-format' (or manually from https://clang.llvm.org/docs/ClangFormat.html)\"\n  exit 1\nfi\n"
  },
  {
    "path": "scripts/release.sh",
    "content": "#!/bin/bash\n\nset -e\n\necho \"Starting the release process...\"\necho \"Provided options: $@\"\n\necho \"Publishing 'react-native-mmkv' to NPM\"\ncd packages/react-native-mmkv\nbun release $@\n\necho \"Creating a Git bump commit and GitHub release\"\ncd ../..\nbun run release-it $@\n\necho \"Successfully released react-native-mmkv!\"\n"
  }
]