From 00f52abf87d7b10bd24a818163bfce591d83327a Mon Sep 17 00:00:00 2001 From: Eryk Kulikowski Date: Mon, 4 May 2026 13:36:10 +0200 Subject: [PATCH 01/73] Add tagging field to S3 upload destination response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When S3 tagging is enabled (DISABLE_S3_TAGGING is false or unset), generateTemporaryS3UploadUrls now includes "tagging": "dv-state=temp" in the JSON response. The client reads this field and sets x-amz-tagging accordingly — making the server authoritative instead of duplicating the JVM setting on the client. Also adds doc/Architecture/reusable_frontend_components.md covering the cross-repo uploader and tree view design decisions. --- .../reusable_frontend_components.md | 170 ++++++++++++++++++ .../iq/dataverse/dataaccess/S3AccessIO.java | 6 + 2 files changed, 176 insertions(+) create mode 100644 doc/Architecture/reusable_frontend_components.md diff --git a/doc/Architecture/reusable_frontend_components.md b/doc/Architecture/reusable_frontend_components.md new file mode 100644 index 00000000000..36ef845c783 --- /dev/null +++ b/doc/Architecture/reusable_frontend_components.md @@ -0,0 +1,170 @@ +# Reusable Frontend Components — Architecture and Decisions + +**Primary tracking issue:** [IQSS/dataverse-frontend#468](https://github.com/IQSS/dataverse-frontend/issues/468) — Reusing file upload page as dvwebloader +**Feature completeness tracking:** [IQSS/dataverse-frontend#431](https://github.com/IQSS/dataverse-frontend/issues/431) — SPA file upload page missing features +**Tree view frontend:** [IQSS/dataverse-frontend#622](https://github.com/IQSS/dataverse-frontend/issues/622) + [#117](https://github.com/IQSS/dataverse-frontend/issues/117) +**Long-term goal:** [IQSS/dataverse#6691](https://github.com/IQSS/dataverse/issues/6691) — Tree view + download upgrade +**Bookmarkability:** [IQSS/dataverse#8694](https://github.com/IQSS/dataverse/issues/8694) +**Uploader branch:** `6691_reusable_components` (based on `12178_CSRF_session_cookie_CSRF_protections`) +**Tree view plan:** `dataverse-context/plans/6691-tree-view-selection-and-download.md` + +## Goal + +Upgrade the classic JSF upload experience by reusing the SPA upload components (currently developed in `dvwebloader` and `dataverse-frontend`). This includes: + +- **Folder upload** support in the classic UI path (new capability, required by #468). +- Improved upload UX parity between JSF and SPA. +- A direct JavaScript mount path to replace the current iframe-based dvwebloader integration. + +This is also the foundation for the tree-view component reuse (#6691): the same SPA-to-JSF integration pattern applies to the file list/tree view. + +## Cross-Repo PR Chain + +Changes are split across three repos in merge-order dependency: + +| Repo | PR | Purpose | +|---|---|---| +| `IQSS/dataverse-client-javascript` | #403 | Upload client changes (tagging fix, remove FilesConfig) | +| `IQSS/dataverse-frontend` | #898 | Standalone uploader + shared component extraction + folder upload | +| `gdcc/dvwebloader` | #44 | DVWebloader V2 — consumes #898 build output | + +The backend changes in this repo (`6691_reusable_components`) are a prerequisite for the client-js changes in #403. + +## Authentication: Session Cookie + +The standalone uploader uses **session cookie (JSESSIONID)** authentication, not API key. + +- `DATAVERSE_FEATURE_API_SESSION_AUTH=1` must be enabled on the Dataverse instance. +- `DATAVERSE_FEATURE_API_SESSION_AUTH_HARDENING=1` enforces Origin/Referer validation and requires the `X-Dataverse-CSRF-Token` header for mutating requests. +- `dataverse.siteUrl` must be set to the URL the browser uses (e.g. `http://localhost:8000` in dev, behind nginx). This value is used for Origin/Referer validation. +- API key auth is removed from the standalone uploader scope. The `key` URL parameter is no longer accepted. + +CSRF hardening (`#12178`) is a separate PR track and must not be mixed into the uploader PRs. This branch (`6691_reusable_components`) is based on the hardening branch to develop and test against the hardened behavior. + +## S3 Tagging: Server-Authoritative Design + +### Problem (old approach) + +The original `FilesConfig`/`useS3Tagging` client-side flag in `dataverse-client-javascript` duplicated the backend `dataverse.files..disable-tagging` JVM setting. The `x-amz-tagging` header is **part of the presigned URL signature** — when the server includes tagging in the signature, the header must be sent; when it omits tagging, the header must not be sent. A client-side boolean that has to stay in sync with a JVM setting will drift and cause silent upload failures. + +This resolves the open item in #431: "implement turning off tagging option for the file upload use case in DV-JS client" — but in the correct direction: the server tells the client, rather than the client being configured separately. + +### Correct design + +The server is authoritative. `S3AccessIO.generateTemporaryS3UploadUrls` now includes `"tagging": "dv-state=temp"` in the JSON response when tagging is enabled (i.e. when `DISABLE_S3_TAGGING` is false or unset). The field is absent when tagging is disabled. + +The JS client reads `destination.tagging` and, if present, sets `x-amz-tagging` to that value. No client-side configuration is needed. + +**Backend change:** `S3AccessIO.generateTemporaryS3UploadUrls` — adds `response.add("tagging", "dv-state=temp")` inside the existing `if (!taggingDisabled)` block. Non-breaking additive change (new optional field in existing response). + +**Client change:** `FileUploadDestination` gets `tagging?: string`. `DirectUploadClient.uploadSinglepartFile` uses it as the header value when present. `FilesConfig` and `useS3Tagging` are removed entirely. + +### Files changed + +| Repo | File | Change | +|---|---|---| +| `dataverse` | `src/main/java/edu/harvard/iq/dataverse/dataaccess/S3AccessIO.java` | Add `tagging` field to `generateTemporaryS3UploadUrls` response | +| `dataverse-client-javascript` | `src/files/domain/models/FileUploadDestination.ts` | Add `tagging?: string` | +| `dataverse-client-javascript` | `src/files/infra/repositories/transformers/fileUploadDestinationsTransformers.ts` | Map `tagging` through both singlepart and multipart paths | +| `dataverse-client-javascript` | `src/files/infra/clients/DirectUploadClient.ts` | Use `destination.tagging` as header value; remove `useS3Tagging` | +| `dataverse-client-javascript` | `src/files/index.ts` | Remove `FilesConfig` and lazy-init pattern | +| `dataverse-frontend` | `src/standalone-uploader/config.ts` | Remove `useS3Tagging`, `maxRetries`, `uploadTimeoutMs`, `apiKey` | +| `dataverse-frontend` | `src/standalone-uploader/index.tsx` | Switch to `SESSION_COOKIE` auth; remove `FilesConfig.init()` | + +## Cleanup Storage (Installations Without S3 Tagging) + +When S3 tagging is disabled, the `dv-state=temp` tag is never written to uploaded objects, so the normal cleanup mechanism (which looks for temp-tagged objects) does not fire. Orphaned temp files from failed or cancelled uploads will accumulate. + +The Dataverse API exposes `/api/datasets/{id}/cleanStorage` for this case. This is tracked as an open item in #431 and needs to be wired into the upload error/cancel path in `dataverse-client-javascript`. Scope decision (baseline vs follow-up PR) is pending. + +## Tree View Component + +The tree view work is tracked in detail in `dataverse-context/plans/6691-tree-view-selection-and-download.md`. Key architectural decisions summarised here. + +### Backend API (`6691-tree-view-download-api` branch) + +Paginated tree listing endpoint: + +``` +GET /api/datasets/{id}/versions/{versionId}/tree +``` + +Query params: `path`, `limit` (default 100, max 1000), `cursor` (opaque keyset token), `include` (`all|folders|files`), `order` (`NameAZ|NameZA`), `includeDeaccessioned`, `originals`. + +Response: `{ path, items[], nextCursor, limit, order, include, approximateCount }`. Folder items carry `type`, `name`, `path`, `counts`; file items add `id`, `size`, `contentType`, `access`, `checksum`, `downloadUrl`. Folders come first; stable keyset pagination prevents drift on concurrent writes. Invalid/stale cursors return `400`. + +Download model: `downloadUrl` points to the Dataverse Access API which redirects to a presigned S3 URL on S3-backed installs. The client performs HTTP Range chunked downloads directly against S3. For non-S3 installs, the client falls back to the standard download API without chunking. + +### SDK surfaces (`6691-tree-view-download-sdk` branch) + +Proposed additions to `dataverse-client-javascript`: + +```typescript +listDatasetTreeNode({ datasetId, versionId, path, limit, cursor, include, order }): Promise<{ items, nextCursor }> +iterateTreeNode({ ... }): AsyncGenerator // handles pagination automatically +``` + +Downloader: accepts `{ id, downloadUrl, size?, name }[]`, streams a ZIP via web streams using HTTP Range when available, retries each chunk (exponential backoff), yields progress events, supports per-file failure manifest. + +### SPA component config (proposed) + +```typescript +interface FileTreeConfig { + datasetPid: string; + siteUrl: string; + mode: 'view' | 'select' | 'manage'; + allowDownload: boolean; + allowDelete: boolean; + expandedFolders?: string[]; + selectedFileIds?: string[]; + onSelect?: (fileIds: string[]) => void; + onDownload?: (fileIds: string[]) => void; + onDelete?: (fileIds: string[]) => void; +} +``` + +Selection state is internal; iframe mode exposes state via `postMessage`. SPA mode can lift to shared context. `apiToken` is not in config — authentication is via session cookie. + +### Milestones + +- **M1** — Backend endpoint + Flyway migrations + SDK chunked ZIP downloader (`6691-tree-view-download-api`, `6691-tree-view-download-sdk`) +- **M2** — SPA: tree selection UI, bulk download action, bookmarkable URL state (`6691-tree-view-selection-download`), addresses #622, #117, #8694 +- **M3** — JSF: selection + download via SDK bundle; behavior aligned with SPA (`#12179` scope) +- **M4** — Polish: partial-failure manifest, performance tuning, docs, release notes + +## JSF Mount Strategy + +Direct JavaScript mount in JSF (`#12179`) is out of scope for the uploader baseline but is the target integration model for the tree-view component. Key constraints: + +- CSS/JS collision risk with JSF/PrimeFaces — components must be style-isolated. +- Integration contract between JSF and the SPA component (config object, events) must be documented before mount is implemented. +- Session cookie auth is the only viable auth mechanism in direct-mount mode (no API key in URL, no iframe boundary). + +## Dev Environment + +The dev environment (`dataverse-frontend/dev-env/docker-compose-dev.yml`) is configured with: + +```yaml +DATAVERSE_FEATURE_API_SESSION_AUTH: 1 +DATAVERSE_FEATURE_API_SESSION_AUTH_HARDENING: 1 +JVM_ARGS: -Ddataverse.siteUrl=http://localhost:8000 ... +``` + +The nginx proxy (`dev_nginx`) forwards browser traffic through port 8000. The `dataverse.siteUrl` must match this so that Origin/Referer validation passes. + +## Open Items + +**Uploader baseline:** +- Rebase `dataverse-client-javascript` #403 onto `develop` and publish a prerelease. +- Replace the `file:../dataverse-client-javascript` local link in `dataverse-frontend` #898 with the published version. +- Add folder upload to `dataverse-frontend` #898 (required by #468). +- Add tests for `parseUrlConfig()` and session-cookie auth path in `dataverse-frontend`. +- Decide scope for cleanup storage (#431 open item) — baseline or follow-up. +- Fix dvwebloader (#44) artifact path layout. +- Eventually rebase `6691_reusable_components` onto `develop` once `#12178` merges. + +**Tree view track:** +- Create `6691-tree-view-download-api` branch; implement paginated tree endpoint and Flyway migrations (see `dataverse-context/plans/6691-tree-view-selection-and-download.md` for full spec and implementation notes). +- Create `6691-tree-view-download-sdk` branch; implement `listDatasetTreeNode`, `iterateTreeNode`, ZIP streaming downloader. +- Create `6691-tree-view-selection-download` branch; implement SPA selection UI, bulk download, bookmarkable URL state. +- JSF mount (`#12179`): finalize integration contract before starting M3. diff --git a/src/main/java/edu/harvard/iq/dataverse/dataaccess/S3AccessIO.java b/src/main/java/edu/harvard/iq/dataverse/dataaccess/S3AccessIO.java index 6d3fe205639..660768e2b60 100644 --- a/src/main/java/edu/harvard/iq/dataverse/dataaccess/S3AccessIO.java +++ b/src/main/java/edu/harvard/iq/dataverse/dataaccess/S3AccessIO.java @@ -1138,6 +1138,12 @@ public JsonObjectBuilder generateTemporaryS3UploadUrls(String globalId, String s s3Presigner.close(); } + final boolean taggingDisabled = JvmSettings.DISABLE_S3_TAGGING.lookupOptional(Boolean.class, this.driverId) + .orElse(false); + if (!taggingDisabled) { + response.add("tagging", "dv-state=temp"); + } + response.add("partSize", minPartSize); return response; From b001447843a9af67eef09efeff89aa239fb6f5e0 Mon Sep 17 00:00:00 2001 From: Eryk Kulikowski Date: Mon, 4 May 2026 17:14:04 +0200 Subject: [PATCH 02/73] Add feature-flagged React uploader mount --- .../reusable_frontend_components.md | 36 +++++++++++++++---- .../iq/dataverse/settings/FeatureFlags.java | 8 +++++ .../iq/dataverse/util/SystemConfig.java | 5 +++ src/main/webapp/editFilesFragment.xhtml | 33 ++++++++++++++--- 4 files changed, 70 insertions(+), 12 deletions(-) diff --git a/doc/Architecture/reusable_frontend_components.md b/doc/Architecture/reusable_frontend_components.md index 36ef845c783..0d848d5e7af 100644 --- a/doc/Architecture/reusable_frontend_components.md +++ b/doc/Architecture/reusable_frontend_components.md @@ -25,8 +25,8 @@ Changes are split across three repos in merge-order dependency: | Repo | PR | Purpose | |---|---|---| | `IQSS/dataverse-client-javascript` | #403 | Upload client changes (tagging fix, remove FilesConfig) | -| `IQSS/dataverse-frontend` | #898 | Standalone uploader + shared component extraction + folder upload | -| `gdcc/dvwebloader` | #44 | DVWebloader V2 — consumes #898 build output | +| `IQSS/dataverse-frontend` | #898 | Standalone uploader + reusable component build + folder upload | +| `gdcc/dvwebloader` | #44 | DVWebloader V2 — consumes #898 build output, if still needed for external packaging | The backend changes in this repo (`6691_reusable_components`) are a prerequisite for the client-js changes in #403. @@ -134,12 +134,33 @@ Selection state is internal; iframe mode exposes state via `postMessage`. SPA mo ## JSF Mount Strategy -Direct JavaScript mount in JSF (`#12179`) is out of scope for the uploader baseline but is the target integration model for the tree-view component. Key constraints: +Direct JavaScript mount is now implemented for the uploader as a feature-flagged replacement path in JSF. The same pattern remains the target integration model for the tree-view component (`#12179`). Key constraints: - CSS/JS collision risk with JSF/PrimeFaces — components must be style-isolated. -- Integration contract between JSF and the SPA component (config object, events) must be documented before mount is implemented. +- Integration contract between JSF and the SPA component (config object, events) must stay documented and stable. - Session cookie auth is the only viable auth mechanism in direct-mount mode (no API key in URL, no iframe boundary). +### Uploader mount + +Dataverse exposes a feature flag, `dataverse.feature.react-uploader` (`DATAVERSE_FEATURE_REACT_UPLOADER` in environment form), that replaces the classic PrimeFaces file upload widget with the React uploader for add-files flows. File replace remains on the existing JSF path. + +The JSF fragment renders: + +```html +
+ + +``` + +The frontend build emits `dist-uploader/reusable-components/dv-uploader.js` plus shared chunks under `dist-uploader/reusable-components/chunks/`. This keeps the first component entry stable while allowing future reusable components to share React, i18n, vendor, and Dataverse shared UI/client chunks. + ## Dev Environment The dev environment (`dataverse-frontend/dev-env/docker-compose-dev.yml`) is configured with: @@ -147,10 +168,11 @@ The dev environment (`dataverse-frontend/dev-env/docker-compose-dev.yml`) is con ```yaml DATAVERSE_FEATURE_API_SESSION_AUTH: 1 DATAVERSE_FEATURE_API_SESSION_AUTH_HARDENING: 1 +DATAVERSE_FEATURE_REACT_UPLOADER: 1 JVM_ARGS: -Ddataverse.siteUrl=http://localhost:8000 ... ``` -The nginx proxy (`dev_nginx`) forwards browser traffic through port 8000. The `dataverse.siteUrl` must match this so that Origin/Referer validation passes. +The nginx proxy (`dev_nginx`) forwards browser traffic through port 8000. It also serves the reusable frontend build from `/dvwebloader/`, backed by `dataverse-frontend/dist-uploader`. The `dataverse.siteUrl` must match this so that Origin/Referer validation passes. ## Open Items @@ -158,9 +180,9 @@ The nginx proxy (`dev_nginx`) forwards browser traffic through port 8000. The `d - Rebase `dataverse-client-javascript` #403 onto `develop` and publish a prerelease. - Replace the `file:../dataverse-client-javascript` local link in `dataverse-frontend` #898 with the published version. - Add folder upload to `dataverse-frontend` #898 (required by #468). -- Add tests for `parseUrlConfig()` and session-cookie auth path in `dataverse-frontend`. +- Add tests for direct-embed config and session-cookie auth path in `dataverse-frontend`. - Decide scope for cleanup storage (#431 open item) — baseline or follow-up. -- Fix dvwebloader (#44) artifact path layout. +- Decide whether `dvwebloader` #44 is still required as a separate external packaging step now that JSF can mount the frontend build directly. - Eventually rebase `6691_reusable_components` onto `develop` once `#12178` merges. **Tree view track:** diff --git a/src/main/java/edu/harvard/iq/dataverse/settings/FeatureFlags.java b/src/main/java/edu/harvard/iq/dataverse/settings/FeatureFlags.java index e1c7e69f7db..343ef345bfe 100644 --- a/src/main/java/edu/harvard/iq/dataverse/settings/FeatureFlags.java +++ b/src/main/java/edu/harvard/iq/dataverse/settings/FeatureFlags.java @@ -30,6 +30,14 @@ public enum FeatureFlags { * @since Dataverse 5.14 */ API_SESSION_AUTH("api-session-auth"), + /** + * Enables the React-based file uploader in the JSF dataset file upload area. + * This is an experimental replacement for the classic PrimeFaces upload UI. + * + * @apiNote Raise flag by setting "dataverse.feature.react-uploader" + * @since Dataverse @TODO: + */ + REACT_UPLOADER("react-uploader"), /** * Enables API authentication via Bearer Token. * @apiNote Raise flag by setting "dataverse.feature.api-bearer-auth" diff --git a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java index a3596850b44..378749db2bd 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java @@ -8,6 +8,7 @@ import edu.harvard.iq.dataverse.authorization.AuthenticationServiceBean; import edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinAuthenticationProvider; import edu.harvard.iq.dataverse.authorization.providers.oauth2.AbstractOAuth2AuthenticationProvider; +import edu.harvard.iq.dataverse.settings.FeatureFlags; import edu.harvard.iq.dataverse.settings.JvmSettings; import edu.harvard.iq.dataverse.settings.SettingsServiceBean; import edu.harvard.iq.dataverse.validation.PasswordValidatorUtil; @@ -245,6 +246,10 @@ public static int getMinutesUntilPasswordResetTokenExpires() { public String getDataverseSiteUrl() { return getDataverseSiteUrlStatic(); } + + public boolean isReactUploaderEnabled() { + return FeatureFlags.REACT_UPLOADER.enabled(); + } /** * Lookup (or construct) the designated URL of this instance from configuration. diff --git a/src/main/webapp/editFilesFragment.xhtml b/src/main/webapp/editFilesFragment.xhtml index 86879c7ef91..fb2fb3f62b8 100644 --- a/src/main/webapp/editFilesFragment.xhtml +++ b/src/main/webapp/editFilesFragment.xhtml @@ -29,6 +29,7 @@ + @@ -130,6 +131,30 @@

+ + + +
+ + +
+ + - + From 988905610d6c2a37f60a3c5bf938308cd0a4693e Mon Sep 17 00:00:00 2001 From: Eryk Kulikowski Date: Tue, 5 May 2026 12:23:31 +0200 Subject: [PATCH 05/73] Add reusable-components operator guide and release notes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Operator-facing documentation for the reusable React components track: how to host the bundle, how to point the JSF page at it, and how versioning flows through npm → Docker image → JVM setting. - doc/sphinx-guides/source/container/running/reusable-components.rst is a new guide page modelled on previewers-provider in the demo guide. It explains the npm + sidecar-image distribution model, walks through three valid hosting choices (gdcc/dataverse-reusable- components container, operator-managed nginx, CDN), gives a sample Docker Compose service block, and cross-references the relevant feature flags + the frontend-side contract document. - frontend-dev.rst now links to the new page so readers landing on the SPA-frontend guide find the JSF integration story. - container/running/index.rst toctree includes the new page between frontend-dev and backend-dev. - installation/config.rst adds: - dataverse.feature.react-uploader (the existing flag, finally documented) with prerequisite notes. - dataverse.reusable-components.base-url next to dataverse.siteUrl, with examples for sidecar / nginx / CDN setups. - doc/release-notes/6691-reusable-frontend-components.md describes the React uploader feature flag, the new JVM setting, the S3 tagging server-authoritative change, the prerequisites for enabling the feature, and the cross-repo coordination. --- .../6691-reusable-frontend-components.md | 28 ++++ .../source/container/running/frontend-dev.rst | 2 + .../source/container/running/index.rst | 1 + .../container/running/reusable-components.rst | 142 ++++++++++++++++++ .../source/installation/config.rst | 22 +++ 5 files changed, 195 insertions(+) create mode 100644 doc/release-notes/6691-reusable-frontend-components.md create mode 100644 doc/sphinx-guides/source/container/running/reusable-components.rst diff --git a/doc/release-notes/6691-reusable-frontend-components.md b/doc/release-notes/6691-reusable-frontend-components.md new file mode 100644 index 00000000000..42c34efc996 --- /dev/null +++ b/doc/release-notes/6691-reusable-frontend-components.md @@ -0,0 +1,28 @@ +## Reusable Frontend Components — JSF Mount + +This release introduces the first reusable React component built in `dataverse-frontend` and embedded into the classic JSF UI: the React file uploader (DVWebloader v2). It is the foundation for further dual-mode components (e.g. the file tree view tracked in [#6691](https://github.com/IQSS/dataverse/issues/6691)). + +### What changed + +- **New feature flag** `dataverse.feature.react-uploader` (off by default). When enabled, the classic PrimeFaces upload widget on the dataset edit page is replaced with the React uploader. The file *replace* flow keeps using the JSF widget. +- **New JVM setting** `dataverse.reusable-components.base-url` (default `/dvwebloader`) tells the JSF page where to load the reusable component bundle from. Operators can point this at a same-origin path, a sidecar container (e.g. `gdcc/dataverse-reusable-components`), or a CDN URL. +- **Server-authoritative S3 tagging.** `S3AccessIO.generateTemporaryS3UploadUrls` now includes a `tagging` field in its JSON response when `dataverse.files..disable-tagging` is unset. The dataverse-client-javascript SDK reads this and decides whether to send the `x-amz-tagging` header — there is no more client-side flag to keep in sync. Non-breaking additive change. +- **Documentation.** A new guide page covers how to host the reusable component bundle and wire it into Dataverse: see [Reusable Frontend Components](https://guides.dataverse.org/en/latest/container/running/reusable-components.html). The matching frontend-side contract lives in the [`dataverse-frontend` repo](https://github.com/IQSS/dataverse-frontend/blob/develop/docs/reusable-components.md). + +### Prerequisites for using the React uploader + +1. `dataverse.feature.api-session-auth=true` so the bundle can call the API with the user's session cookie. **For production, also enable session-cookie API hardening** to mitigate CSRF risk (a separate feature track adds this). +2. The reusable component bundle must be reachable from the user's browser. The simplest setup is to run the `gdcc/dataverse-reusable-components` container alongside Dataverse and set `dataverse.reusable-components.base-url=http://:` to point at it. +3. `dataverse.siteUrl` must match the URL the browser actually uses, so that Origin/Referer checks pass when session-auth hardening is enabled. + +### What didn't change + +- File replace, batch operations, and any classic JSF panels render exactly as before when the flag is off. +- No new Java / Maven dependency on npm or Node tooling. The bundle is hosted, not bundled. + +### Cross-repo + +This release pairs with: + +- [`@iqss/dataverse-client-javascript`](https://github.com/IQSS/dataverse-client-javascript) for the `tagging` field on the upload destination response. +- [`dataverse-frontend`](https://github.com/IQSS/dataverse-frontend) for the React uploader bundle (`@iqss/dataverse-reusable-components` npm package and `gdcc/dataverse-reusable-components` Docker image, both versioned by the same semver). diff --git a/doc/sphinx-guides/source/container/running/frontend-dev.rst b/doc/sphinx-guides/source/container/running/frontend-dev.rst index 88d40c12053..9675c3ecd0c 100644 --- a/doc/sphinx-guides/source/container/running/frontend-dev.rst +++ b/doc/sphinx-guides/source/container/running/frontend-dev.rst @@ -8,3 +8,5 @@ Intro ----- The frontend (web interface) of Dataverse is being decoupled from the backend. This evolving codebase has its own repo at https://github.com/IQSS/dataverse-frontend which includes docs and scripts for running the backend of Dataverse in Docker. + +Selected React components from that repo can also be embedded directly into the classic JSF UI for installations that have not migrated to the SPA. See :doc:`reusable-components` for the integration model. diff --git a/doc/sphinx-guides/source/container/running/index.rst b/doc/sphinx-guides/source/container/running/index.rst index a02266f7cba..3252896dbda 100755 --- a/doc/sphinx-guides/source/container/running/index.rst +++ b/doc/sphinx-guides/source/container/running/index.rst @@ -10,4 +10,5 @@ Contents: metadata-blocks github-action frontend-dev + reusable-components backend-dev diff --git a/doc/sphinx-guides/source/container/running/reusable-components.rst b/doc/sphinx-guides/source/container/running/reusable-components.rst new file mode 100644 index 00000000000..9cf6cec906c --- /dev/null +++ b/doc/sphinx-guides/source/container/running/reusable-components.rst @@ -0,0 +1,142 @@ +Reusable Frontend Components +============================ + +.. contents:: |toctitle| + :local: + +Intro +----- + +Some Dataverse features can be served by React components built in +https://github.com/IQSS/dataverse-frontend and embedded directly into the +classic JSF UI. This lets institutions that have not migrated to the +single-page application (SPA) still benefit from new frontend work, +component by component, without replacing the whole UI. + +The first component shipped this way is the React file uploader (DVWebloader +v2), gated by the :ref:`dataverse.feature.react-uploader` feature flag. +Future components (e.g. the file tree view tracked in +`#6691 `_) will follow the same +pattern. + +For the frontend-side contract — the config interface, build pipeline, CSS +isolation, and how to make a new SPA component reusable — see +``docs/reusable-components.md`` in the +`dataverse-frontend `_ repo. + +How It Works +------------ + +Each reusable component is published from ``dataverse-frontend`` as part of +an npm package. The package contains a self-contained ESM bundle plus +shared chunks (React, i18n, vendor, design system) and locale files. A +JSF page loads the bundle with a single `` + + +Authentication is via session cookie (JSESSIONID). The +:ref:`dataverse.feature.api-session-auth` feature flag must be enabled. +For production deployments, also enable session-cookie API hardening (see +the security notice next to ``dataverse.feature.api-session-auth``). + +Where to Get the Bundle +----------------------- + +The npm package is published two places: + +- **GitHub Packages** for prereleases (per pull request and merge to develop). + Versions look like ``1.4.0-pr898.``. +- **npmjs.org** for tagged releases. Versions are plain semver, e.g. + ``1.4.0``. + +Operators have three reasonable ways to make the bundle reachable from a +browser: + +1. **Run the** ``gdcc/dataverse-reusable-components`` **container image** + alongside Dataverse (recommended for institutions that already use Docker + Compose). The image is a small nginx that serves the contents of the + matching npm package version. This mirrors the pattern used for the + :ref:`file-previewers-ct` (``previewers-provider``) sidecar. +2. **Pull the npm package and serve it from your existing nginx / proxy** + under any URL of your choosing. +3. **Reference a CDN URL** that mirrors the npm package, for example + ``https://cdn.jsdelivr.net/npm/@iqss/dataverse-reusable-components@/``. + This is the lightest option but requires outbound connectivity from the + user's browser. + +Whichever you pick, point Dataverse at it via +:ref:`dataverse.reusable-components.base-url`. + +.. _reusable-components-dev-compose: + +Sample Compose Service +---------------------- + +For development, a sidecar service can be added to ``docker-compose-dev.yml`` +following the same shape as the previewers provider: + +.. code-block:: yaml + + reusable_components: + container_name: dev_reusable_components + hostname: reusable-components + image: gdcc/dataverse-reusable-components:unstable + networks: + - dataverse + ports: + - "9090:80" + +The ``unstable`` tag tracks the latest develop build of the bundle. For +reproducible runs, pin a specific version (e.g. +``gdcc/dataverse-reusable-components:1.4.0``). + +The Dataverse container then needs the JVM setting: + +.. code-block:: text + + -Ddataverse.reusable-components.base-url=http://reusable-components + +If the setting is not provided, Dataverse falls back to ``/dvwebloader`` — +the default same-origin path used by the +``dataverse-frontend`` development environment. + +Configuration +------------- + +The relevant settings are documented in the Installation Guide: + +- :ref:`dataverse.feature.react-uploader` — turn on the React uploader for + the JSF dataset edit page. +- :ref:`dataverse.feature.api-session-auth` — required so the bundle can + call the API using the user's session cookie. +- :ref:`dataverse.reusable-components.base-url` — where the JSF page should + load the bundle from. + +Versioning +---------- + +The npm package, the Docker image, and the URL used by Dataverse are all +pinned by the same semver string. Bumping is a one-line change in +``docker-compose-dev.yml`` (``image:`` tag) plus a Dataverse restart in +production. There is no Java/npm bridge in the Dataverse build itself — +the bundle is hosted, not bundled. + +Cross-references +---------------- + +- :ref:`feature-flags` +- :ref:`file-previewers-ct` — companion pattern for static-content sidecars. +- The component contract on the frontend side: + https://github.com/IQSS/dataverse-frontend/blob/develop/docs/reusable-components.md diff --git a/doc/sphinx-guides/source/installation/config.rst b/doc/sphinx-guides/source/installation/config.rst index e5ed52acb83..d3abbdfb495 100644 --- a/doc/sphinx-guides/source/installation/config.rst +++ b/doc/sphinx-guides/source/installation/config.rst @@ -2668,6 +2668,19 @@ protocol, host, and port number and should not include a trailing slash. - We are absolutely aware that it's confusing to have both ``dataverse.fqdn`` and ``dataverse.siteUrl``. https://github.com/IQSS/dataverse/issues/6636 is about resolving this confusion. +.. _dataverse.reusable-components.base-url: + +dataverse.reusable-components.base-url +++++++++++++++++++++++++++++++++++++++ + +Base URL from which the Dataverse :doc:`reusable React component bundles ` (e.g. ``dv-uploader.js``) are loaded by JSF pages. Trailing slashes are trimmed automatically. + +The default value, ``/dvwebloader``, preserves backward compatibility with the ``dataverse-frontend`` development environment nginx alias and with operators who already host the bundle at that same-origin path. + +To run a sidecar container that hosts the bundle (the recommended setup for institutions still on JSF), set this to the URL of that container — for example ``http://reusable-components`` if you add the ``gdcc/dataverse-reusable-components`` service to your Docker Compose file. To use a CDN, set this to e.g. ``https://cdn.jsdelivr.net/npm/@iqss/dataverse-reusable-components@1.4.0``. + +Can also be set via *MicroProfile Config API* sources, e.g. the environment variable ``DATAVERSE_REUSABLE_COMPONENTS_BASE_URL``. + .. _dataverse.files.directory: dataverse.files.directory @@ -3935,6 +3948,15 @@ dataverse.feature.api-session-auth Enables API authentication via session cookie (JSESSIONID). **Caution: Enabling this feature flag exposes the installation to CSRF risks!** We expect this feature flag to be temporary (only used by frontend developers, see `#9063 `_) and for the feature to be removed in the future. +.. _dataverse.feature.react-uploader: + +dataverse.feature.react-uploader +++++++++++++++++++++++++++++++++ + +Replaces the classic PrimeFaces file upload widget on the JSF dataset edit page with the React file uploader (DVWebloader v2). Requires :ref:`dataverse.feature.api-session-auth` to be enabled and the JSF page to be able to reach the reusable component bundle (see :ref:`dataverse.reusable-components.base-url` and the :doc:`/container/running/reusable-components` guide). + +This flag has no effect on the file replace flow, which continues to use the classic JSF upload widget. + .. _dataverse.feature.api-bearer-auth: dataverse.feature.api-bearer-auth From d7dd36042751418de3ca4308cca28e3f5527e4bf Mon Sep 17 00:00:00 2001 From: Eryk Kulikowski Date: Tue, 5 May 2026 12:23:47 +0200 Subject: [PATCH 06/73] Refactor reusable_frontend_components.md as backend integration guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original document mixed cross-repo decision-log content with backend-side integration mechanics. Split that responsibility: - This document (in dataverse) is now strictly the BACKEND HALF of the dual-mode contract: how JSF pages mount React components built in dataverse-frontend, how feature flags gate the swap, how nginx hosts the bundle, and how to add a new JSF page that mounts an SPA component. - The matching FRONTEND HALF — config interfaces, build pipeline, CSS isolation, how to make a component reusable — lives in dataverse-frontend/docs/reusable-components.md (added in that repo). - Cross-repo decisions, branch tracking, and active-track notes move out of this file entirely; they belong in the working plan rather than in committed Dataverse documentation. The new content covers: - Why dual-mode + the integration pattern diagram. - Feature flag conventions and naming. - Authentication prerequisites (session-cookie + hardening). - Hosting options for the bundle (image / nginx / CDN). - A worked example of replacing a JSF widget with an SPA component (the uploader). - Adding a brand-new reusable component to a JSF page (the upcoming tree-view case). - Currently shipped components (uploader, tree-view planned). - Risks and trade-offs (Bootstrap collision, session-cookie, etc.). --- .../reusable_frontend_components.md | 320 ++++++++++-------- 1 file changed, 176 insertions(+), 144 deletions(-) diff --git a/doc/Architecture/reusable_frontend_components.md b/doc/Architecture/reusable_frontend_components.md index c41bb3b064d..2b3c2f93210 100644 --- a/doc/Architecture/reusable_frontend_components.md +++ b/doc/Architecture/reusable_frontend_components.md @@ -1,206 +1,238 @@ -# Reusable Frontend Components — Architecture and Decisions +# Reusable Frontend Components — Backend Integration Guide -**Primary tracking issue:** [IQSS/dataverse-frontend#468](https://github.com/IQSS/dataverse-frontend/issues/468) — Reusing file upload page as dvwebloader -**Feature completeness tracking:** [IQSS/dataverse-frontend#431](https://github.com/IQSS/dataverse-frontend/issues/431) — SPA file upload page missing features -**Tree view frontend:** [IQSS/dataverse-frontend#622](https://github.com/IQSS/dataverse-frontend/issues/622) + [#117](https://github.com/IQSS/dataverse-frontend/issues/117) -**Long-term goal:** [IQSS/dataverse#6691](https://github.com/IQSS/dataverse/issues/6691) — Tree view + download upgrade -**Bookmarkability:** [IQSS/dataverse#8694](https://github.com/IQSS/dataverse/issues/8694) -**Uploader branch:** `6691_reusable_components` (based on `12178_CSRF_session_cookie_CSRF_protections`) -**Tree view plan:** `dataverse-context/plans/6691-tree-view-selection-and-download.md` +This document is the **backend** half of the reusable frontend components contract: how Dataverse JSF pages mount React components built in [`dataverse-frontend`](https://github.com/IQSS/dataverse-frontend), how feature flags gate the swap, how nginx serves the bundles, and how to add a new JSF page that mounts an SPA component. -## Goal +The matching **frontend** half — the React contract, the build pipeline, CSS isolation, and how to make a component reusable in the first place — lives in [`docs/reusable-components.md`](https://github.com/IQSS/dataverse-frontend/blob/develop/docs/reusable-components.md) in the `dataverse-frontend` repo. Read both before changing the contract. -Upgrade the classic JSF upload experience by reusing the SPA upload components (currently developed in `dvwebloader` and `dataverse-frontend`). This includes: +Related issues: -- **Folder upload** support in the classic UI path (new capability, required by #468). -- Improved upload UX parity between JSF and SPA. -- A direct JavaScript mount path to replace the current iframe-based dvwebloader integration. +- [`IQSS/dataverse-frontend#468`](https://github.com/IQSS/dataverse-frontend/issues/468) — Reusing the file upload page (umbrella). +- [`IQSS/dataverse#6691`](https://github.com/IQSS/dataverse/issues/6691) — Tree view selection and download (next reusable component). +- [`IQSS/dataverse#12179`](https://github.com/IQSS/dataverse/issues/12179) — Direct JS mount in JSF for tree view. +- [`IQSS/dataverse#12178`](https://github.com/IQSS/dataverse/issues/12178) — Session-cookie API hardening (CSRF). -This is also the foundation for the tree-view component reuse (#6691): the same SPA-to-JSF integration pattern applies to the file list/tree view. +## Why this matters -## Cross-Repo PR Chain +Dataverse is mid-migration from JSF/PrimeFaces to a React SPA. We don't want two implementations of every feature, but the SPA can't replace JSF in one go. The reusable-components pattern lets a single React component be embedded into a JSF page, behind a feature flag, with the legacy widget as the fallback. When the flag is off, JSF behaves exactly as before; when it's on, the React component renders in place of the JSF widget and talks to the same API. -Changes are split across three repos in merge-order dependency: +This document covers: -| Repo | PR | Purpose | -|---|---|---| -| `IQSS/dataverse-client-javascript` | #403 | Upload client changes (tagging fix, remove FilesConfig) | -| `IQSS/dataverse-frontend` | #898 | Standalone uploader + reusable component build + folder upload | -| `gdcc/dvwebloader` | #44 | DVWebloader V2 — consumes #898 build output, if still needed for external packaging | +- [The integration pattern](#the-integration-pattern) +- [Feature flags](#feature-flags) +- [Authentication prerequisites](#authentication-prerequisites) +- [Hosting reusable bundles](#hosting-reusable-bundles) +- [Replacing a JSF widget with an SPA component](#replacing-a-jsf-widget-with-an-spa-component) +- [Adding a new reusable component to a JSF page](#adding-a-new-reusable-component-to-a-jsf-page) +- [Currently shipped components](#currently-shipped-components) +- [Risks and trade-offs](#risks-and-trade-offs) -The backend changes in this repo (`6691_reusable_components`) are a prerequisite for the client-js changes in #403. +## The integration pattern -## Authentication: Session Cookie +``` +┌──────────────────────── dataset.xhtml (JSF) ───────────────────────┐ +│ │ +│ ui:fragment rendered="#{!FeatureFlags.REACT_UPLOADER_ENABLED}" │ +│ ┌────────────────────────────────────────────────────────────┐ │ +│ │ Existing PrimeFaces widget (unchanged) │ │ +│ └────────────────────────────────────────────────────────────┘ │ +│ │ +│ ui:fragment rendered="#{FeatureFlags.REACT_UPLOADER_ENABLED}" │ +│ ┌────────────────────────────────────────────────────────────┐ │ +│ │
│ │ +│ │ │ │ +│ │ │ │ +│ └────────────────────────────────────────────────────────────┘ │ +│ │ +└────────────────────────────────────────────────────────────────────┘ + │ + │ /dvwebloader/* (nginx) + ▼ + dataverse-frontend/dist-uploader/ + reusable-components/dv-uploader.js + reusable-components/chunks/*.js +``` -The standalone uploader uses **session cookie (JSESSIONID)** authentication, not API key. +The backend's responsibility: -- `DATAVERSE_FEATURE_API_SESSION_AUTH=1` must be enabled on the Dataverse instance. -- `DATAVERSE_FEATURE_API_SESSION_AUTH_HARDENING=1` enforces Origin/Referer validation and requires the `X-Dataverse-CSRF-Token` header for mutating requests. -- `dataverse.siteUrl` must be set to the URL the browser uses (e.g. `http://localhost:8000` in dev, behind nginx). This value is used for Origin/Referer validation. -- API key auth is removed from the standalone uploader scope. The `key` URL parameter is no longer accepted. +1. Add a JVM feature flag. +2. Conditionally render `
` + ` + + + + + + +``` -Direct JavaScript mount is now implemented for the uploader as a feature-flagged replacement path in JSF. The same pattern remains the target integration model for the tree-view component (`#12179`). Key constraints: +Rules: -- CSS/JS collision risk with JSF/PrimeFaces — components must be style-isolated. -- Integration contract between JSF and the SPA component (config object, events) must stay documented and stable. -- Session cookie auth is the only viable auth mechanism in direct-mount mode (no API key in URL, no iframe boundary). +- Read every config value from JSF EL or a managed bean. Never hardcode. +- Do not URL-encode values; React handles this. +- The `
` and the ` - -``` +- Sphinx: `doc/sphinx-guides/source/installation/config.rst`, *Feature Flags* table, one row per new flag. +- Sphinx: a short note in the relevant section (e.g. *Uploading Files*) noting the feature flag and what changes when it's on. +- Release notes: `doc/release-notes/-.md`, referencing the umbrella issue and listing the env-var form, the docker-compose example, and the cross-repo PR chain. -The frontend build emits `dist-uploader/reusable-components/dv-uploader.js` plus shared chunks under `dist-uploader/reusable-components/chunks/`. This keeps the first component entry stable while allowing future reusable components to share React, i18n, vendor, and Dataverse shared UI/client chunks. +### 6. Smoke test -### CSS isolation +- Toggle the flag off → legacy JSF widget renders, behaves exactly as before. +- Toggle the flag on → React component renders, talks to the API via session cookie, completes the user flow without DB-level differences. -The bundle injects its CSS into `` via `vite-plugin-css-injected-by-js`. To keep the host JSF page intact: +## Adding a new reusable component to a JSF page -- The React render is wrapped in `
`. Embedded styles are scoped to this class; no `html`/`body`/`#root` rules are bundled. -- Page-level styling (background, font, viewport-fill) lives in `standalone-page.scss`, which ships only to the standalone demo HTML and is not part of the JSF-loaded bundle. -- Design-system styles use CSS Modules with hashed class names, so they cannot collide with JSF/PrimeFaces classes. +Greenfield case (no existing JSF widget to replace, but you want to add an SPA-driven feature on a JSF page): -**Known limitation — Bootstrap globals.** The bundle imports `bootstrap/dist/css/bootstrap.min.css` (Bootstrap 5.2.3) because react-bootstrap relies on it. Dataverse JSF pages already load Bootstrap 3.x. Where the two collide on shared selectors (`.btn`, `.form-control`, the grid system), the later-loaded stylesheet wins. The React component is fine because it loads later, but classic JSF panels rendered alongside the React uploader on the same page may pick up Bootstrap 5 styling on those selectors. PrimeFaces (`ui-*` classes) and Dataverse's own `panel`/`glyphicon` classes are unaffected. +1. **Build the SPA section first** in `dataverse-frontend`. Run it in the SPA. Iterate on the design before any JSF integration. +2. **Add a new entry to the reusable-components build.** See `dataverse-frontend/docs/reusable-components.md` § *Build pipeline*. +3. **Add a new JVM feature flag** in `FeatureFlags.java`. +4. **Add the `ui:fragment`** on the JSF page. The pattern is identical to the replacement case; you just don't need the off-branch with a legacy widget. +5. **Document and release-note** as above. -Future work — pick one and document it before unflagging this feature in production: -- PostCSS scope-prefix plugin to wrap every bundled CSS rule under `.dv-uploader-root`. -- Mount the React tree into a Shadow DOM root so injected ` +
diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetVersionTreeKeysetIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetVersionTreeKeysetIT.java index 3f4675b67f8..64306a80646 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetVersionTreeKeysetIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetVersionTreeKeysetIT.java @@ -260,7 +260,12 @@ public void rootListingIsKeysetStableAcrossPageSizes() { assertEquals(8, oracle.size(), "Expected 8 items at root"); assertFoldersBeforeFiles(oracle); - for (int limit : new int[] {1, 2, 3, 5, 7, 10}) { + // limit=4 makes the folder listing end exactly at the page boundary + // (4 folders, page full, files still unseen) — the regression case + // where the walk used to stop with nextCursor=null and silently drop + // every root file. limit=1 and limit=2 hit the same boundary on a + // later page; limit=8 fits everything exactly on one page. + for (int limit : new int[] {1, 2, 3, 4, 5, 7, 8, 10}) { List paged = pagedWalk(datasetId, null, null, null, limit, token); assertNoDuplicates(paged); assertEquals(oracle, paged, diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsTreeIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsTreeIT.java index 2e84c0fcf38..4d7c5468185 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsTreeIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsTreeIT.java @@ -406,7 +406,7 @@ public void draftVersionDoesNotEmitCacheableEtag() { Response response = UtilIT.getVersionTree(datasetId, DRAFT_VERSION, null, null, null, null, null, null, null, apiToken); response.then().assertThat().statusCode(OK.getStatusCode()); - // Drafts can change — no ETag, no immutable cache header. + // Drafts can change in place — no ETag, no cache headers. assertNull(response.getHeader("ETag"), "Draft versions must not emit a cacheable ETag"); } @@ -431,20 +431,27 @@ public void publishedVersionEmitsEtagAndHonoursIfNoneMatch() { Response first = UtilIT.getVersionTree(datasetId, LATEST, null, null, null, null, null, null, null, apiToken); + // `no-cache` (not `immutable`): the body is time-dependent — access + // markers flip when an embargo lapses or a retention period expires — + // so clients must revalidate; a matching ETag still gets a body-less + // 304 below. first.then().assertThat() .statusCode(OK.getStatusCode()) - .header("Cache-Control", equalTo("private, immutable")); + .header("Cache-Control", equalTo("private, no-cache")); String etag = first.getHeader("ETag"); assertNotNull(etag, "Published versions must emit an ETag"); - assert etag.startsWith("\"") && etag.endsWith("\"") : "ETag must be quoted: " + etag; + assert etag.startsWith("\"") && etag.endsWith("\"") : "ETag must be quoted exactly once: " + etag; + assert !etag.startsWith("\"\"") : "ETag must not be double-quoted: " + etag; + // Echo the ETag back exactly as received (the wire-quoted form) — + // this is what a real HTTP cache sends in If-None-Match. Response cached = io.restassured.RestAssured.given() .header(UtilIT.API_TOKEN_HTTP_HEADER, apiToken) .header("If-None-Match", etag) .get("/api/datasets/" + datasetId + "/versions/" + LATEST + "/tree"); cached.then().assertThat() .statusCode(jakarta.ws.rs.core.Response.Status.NOT_MODIFIED.getStatusCode()) - .header("Cache-Control", equalTo("private, immutable")); + .header("Cache-Control", equalTo("private, no-cache")); // Different query params must yield a different ETag. Response differentQuery = UtilIT.getVersionTree(datasetId, LATEST, diff --git a/src/test/java/edu/harvard/iq/dataverse/datasetversiontree/DatasetVersionTreeServiceTest.java b/src/test/java/edu/harvard/iq/dataverse/datasetversiontree/DatasetVersionTreeServiceTest.java index f12a03ce5d9..f2ebf478192 100644 --- a/src/test/java/edu/harvard/iq/dataverse/datasetversiontree/DatasetVersionTreeServiceTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/datasetversiontree/DatasetVersionTreeServiceTest.java @@ -3,6 +3,10 @@ import edu.harvard.iq.dataverse.DatasetVersion; import org.junit.jupiter.api.Test; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.List; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -32,6 +36,60 @@ void normalizesPath() { assertEquals("", DatasetVersionTreeService.normalizePath(null)); } + @Test + void normalizesPathLikeTheWriteSideSanitizer() { + // The read side mirrors what FileMetadata#setDirectoryLabel stores + // (StringUtil.sanitizeFileDirectory): backslash runs become slashes + // and leading '/', '-', '.', ' ' are stripped — a stored label's + // first segment can never start with those. + assertEquals("data/sub", DatasetVersionTreeService.normalizePath("data\\sub")); + assertEquals("hidden", DatasetVersionTreeService.normalizePath(".hidden")); + } + + @Test + void normalizesPathPreservesFolderTails() { + // The write-side sanitizer strips '.', ' ', '-' only at the ENDS of + // the whole stored label, so interior segments keep them — + // "data./sub" is storable and the tree emits its parent folder as + // path "data.". A folder path names such a prefix, so the tail must + // round-trip untouched (only trailing slashes are dropped). + assertEquals("data.", DatasetVersionTreeService.normalizePath("data.")); + assertEquals("data. ", DatasetVersionTreeService.normalizePath("data. ")); + assertEquals("data", DatasetVersionTreeService.normalizePath("data/")); + assertEquals("data.", DatasetVersionTreeService.normalizePath("data./")); + } + + @Test + void normalizesPathIsIdempotent() { + // The endpoint normalizes once up front and the service normalizes + // again; the two results must be identical. Junk/slash alternations + // are the trap: a single-pass strip would leave "./data" as "/data" + // on the first run and "data" on the second. + for (String raw : new String[]{"./data", "/.data", "data./", "/data//sub/", ".hidden"}) { + String once = DatasetVersionTreeService.normalizePath(raw); + assertEquals(once, DatasetVersionTreeService.normalizePath(once), + "not idempotent for: " + raw); + } + assertEquals("data", DatasetVersionTreeService.normalizePath("./data")); + } + + @Test + void junkOnlyPathsAreRejectedNotAliasedToRoot() { + // A non-blank path that normalizes to nothing names nothing storable; + // mapping it to "" would silently return the ROOT listing for + // requests like path=".." — a phantom folder holding the whole root. + assertThrows(DatasetVersionTreeService.InvalidQueryException.class, + () -> DatasetVersionTreeService.normalizePath("..")); + assertThrows(DatasetVersionTreeService.InvalidQueryException.class, + () -> DatasetVersionTreeService.normalizePath("-")); + assertThrows(DatasetVersionTreeService.InvalidQueryException.class, + () -> DatasetVersionTreeService.normalizePath(". ")); + assertThrows(DatasetVersionTreeService.InvalidQueryException.class, + () -> DatasetVersionTreeService.normalizePath("../.")); + // ...while pure root spellings stay valid. + assertEquals("", DatasetVersionTreeService.normalizePath("//")); + } + @Test void orderFromQueryRejectsBogus() { assertThrows(DatasetVersionTreeService.InvalidQueryException.class, @@ -77,4 +135,45 @@ void invalidCursorRejected() { DatasetVersionTreeService.Include.ALL, DatasetVersionTreeService.Order.NAME_AZ, false)); } + + @Test + void malformedCursorPayloadsRejectedAsInvalidNotServerError() { + // Structurally-valid Base64+JSON whose members have the wrong types + // or shape must surface as InvalidQueryException (the 400 path), not + // leak a ClassCastException / ArithmeticException out of + // decodeCursor as a 500. + for (String json : List.of( + "{\"p\":\"FOLDERS\",\"k\":[1],\"c\":5}", // number where the folder name belongs + "{\"p\":\"FILES\",\"k\":[\"a\",\"b\"],\"c\":5}", // string where the file id belongs + "{\"p\":\"FILES\",\"k\":[\"a\",1.5],\"c\":5}", // fractional file id + "{\"p\":\"FILES\",\"k\":\"a\",\"c\":5}", // k is not an array + "{\"p\":\"FILES\",\"k\":[],\"c\":5}", // files phase needs its keyset pair + "{\"p\":\"FOLDERS\",\"k\":[],\"c\":5}", // folders phase needs its key + "{\"p\":\"NOPE\",\"k\":[],\"c\":5}", // unknown phase marker + "{\"p\":\"FOLDERS\",\"k\":[\"data\"]}", // count snapshot missing — never minted by this server + "{\"p\":\"FOLDERS\",\"k\":[\"data\"],\"c\":-3}", // negative count snapshot + "[1,2]" // not a JSON object at all + )) { + String cursor = Base64.getUrlEncoder().withoutPadding() + .encodeToString(json.getBytes(StandardCharsets.UTF_8)); + assertThrows(DatasetVersionTreeService.InvalidQueryException.class, + () -> DatasetVersionTreeService.decodeCursor(cursor), + "should reject: " + json); + } + } + + @Test + void cursorRoundTrips() { + // Cursors are minted key-first and stamped with the walk's count + // snapshot just before encoding, exactly as listChildren does it. + var folders = DatasetVersionTreeService.TreeCursor.folders("Data \"2024\" – café") + .withApproximateCount(42); + assertEquals(folders, + DatasetVersionTreeService.decodeCursor(DatasetVersionTreeService.encodeCursor(folders))); + + var files = DatasetVersionTreeService.TreeCursor.files("a \\\"quoted\\\" name.txt", 7L) + .withApproximateCount(42); + assertEquals(files, + DatasetVersionTreeService.decodeCursor(DatasetVersionTreeService.encodeCursor(files))); + } } diff --git a/tests/integration-tests.txt b/tests/integration-tests.txt index c271657eaac..b056c0423b5 100644 --- a/tests/integration-tests.txt +++ b/tests/integration-tests.txt @@ -1 +1 @@ -DataversesIT,DatasetsIT,SwordIT,AdminIT,BuiltinUsersIT,UsersIT,UtilIT,ConfirmEmailIT,FileMetadataIT,FilesIT,SearchIT,InReviewWorkflowIT,HarvestingServerIT,HarvestingClientsIT,MoveIT,MakeDataCountApiIT,FileTypeDetectionIT,EditDDIIT,ExternalToolsIT,AccessIT,DuplicateFilesIT,DownloadFilesIT,LinkIT,DeleteUsersIT,DeactivateUsersIT,AuxiliaryFilesIT,InvalidCharactersIT,LicensesIT,NotificationsIT,BagIT,MetadataBlocksIT,NetcdfIT,SignpostingIT,FitsIT,LogoutIT,DataRetrieverApiIT,ProvIT,S3AccessIT,OpenApiIT,InfoIT,DatasetFieldsIT,SavedSearchIT,DatasetTypesIT,DataverseFeaturedItemsIT,SendFeedbackApiIT,CustomizationIT,JsonLDExportIT,WorkflowsIT,LDNInboxIT,LocalContextsIT,CorsIT +DataversesIT,DatasetsIT,SwordIT,AdminIT,BuiltinUsersIT,UsersIT,UtilIT,ConfirmEmailIT,FileMetadataIT,FilesIT,SearchIT,InReviewWorkflowIT,HarvestingServerIT,HarvestingClientsIT,MoveIT,MakeDataCountApiIT,FileTypeDetectionIT,EditDDIIT,ExternalToolsIT,AccessIT,DuplicateFilesIT,DownloadFilesIT,LinkIT,DeleteUsersIT,DeactivateUsersIT,AuxiliaryFilesIT,InvalidCharactersIT,LicensesIT,NotificationsIT,BagIT,MetadataBlocksIT,NetcdfIT,SignpostingIT,FitsIT,LogoutIT,DataRetrieverApiIT,ProvIT,DatasetsTreeIT,DatasetVersionTreeKeysetIT,S3AccessIT,OpenApiIT,InfoIT,DatasetFieldsIT,SavedSearchIT,DatasetTypesIT,DataverseFeaturedItemsIT,SendFeedbackApiIT,CustomizationIT,JsonLDExportIT,WorkflowsIT,LDNInboxIT,LocalContextsIT,CorsIT From 307a6f57be58f5246ace68e9710d8086a4ec6345 Mon Sep 17 00:00:00 2001 From: Eryk Kulikowski Date: Mon, 6 Jul 2026 13:49:32 +0200 Subject: [PATCH 70/73] Rebuild reusable-component bundles: retentionExpired access display, i18n'd labels with es translations, self-review fixes from dataverse-frontend --- .../chunks/auth-Befi4fhg.js | 1 + ...k3wcoA.js => dataverse-shared-Df2bJGqH.js} | 4 +- .../{i18n-CMHgdAUi.js => i18n-CDa8ZpJw.js} | 4 +- .../chunks/shadow-mount-BbV5d7vm.js | 1 - .../chunks/vendor-B5oGEj-7.js | 186 ++++++++++++++++++ .../chunks/vendor-DReq5CoA.js | 186 ------------------ .../reusable-components/dv-tree-view.js | 6 +- .../webapp/reusable-components/dv-uploader.js | 4 +- .../reusable-components/locales/en/files.json | 21 +- .../reusable-components/locales/es/files.json | 99 ++++++++++ 10 files changed, 314 insertions(+), 198 deletions(-) create mode 100644 src/main/webapp/reusable-components/chunks/auth-Befi4fhg.js rename src/main/webapp/reusable-components/chunks/{dataverse-shared-Dck3wcoA.js => dataverse-shared-Df2bJGqH.js} (99%) rename src/main/webapp/reusable-components/chunks/{i18n-CMHgdAUi.js => i18n-CDa8ZpJw.js} (99%) delete mode 100644 src/main/webapp/reusable-components/chunks/shadow-mount-BbV5d7vm.js create mode 100644 src/main/webapp/reusable-components/chunks/vendor-B5oGEj-7.js delete mode 100644 src/main/webapp/reusable-components/chunks/vendor-DReq5CoA.js diff --git a/src/main/webapp/reusable-components/chunks/auth-Befi4fhg.js b/src/main/webapp/reusable-components/chunks/auth-Befi4fhg.js new file mode 100644 index 00000000000..80298a7d610 --- /dev/null +++ b/src/main/webapp/reusable-components/chunks/auth-Befi4fhg.js @@ -0,0 +1 @@ +import{d as i}from"./vendor-B5oGEj-7.js";function h({rootElementId:t}){const e=document.getElementById(t);if(!e)throw new Error(`[shadow-mount] No element with id="${t}" found in the host page.`);let o=e.shadowRoot;if(!o)o=e.attachShadow({mode:"open"});else for(;o.firstChild;)o.removeChild(o.firstChild);const n=window.__dvPendingStyles??[];for(const s of n){const a=document.createElement("style");a.textContent=s,o.appendChild(a)}const d=document.createElement("div");return d.className="dv-reusable-root",o.appendChild(d),window.__dvShadowRoot=window.__dvShadowRoot??{},window.__dvShadowRoot[t]=o,{reactRoot:d,shadowRoot:o}}function w(t,e){const o=`${t}/api/v1`,n=e.getBearerToken!==void 0||e.bearerToken!==void 0?()=>e.getBearerToken?.()??e.bearerToken??null:void 0;if(n!==void 0){i.ApiConfig.init(o,i.DataverseApiAuthMechanism.BEARER_TOKEN,void 0,void 0,n);return}i.ApiConfig.init(o,i.DataverseApiAuthMechanism.SESSION_COOKIE)}export{w as c,h as m}; diff --git a/src/main/webapp/reusable-components/chunks/dataverse-shared-Dck3wcoA.js b/src/main/webapp/reusable-components/chunks/dataverse-shared-Df2bJGqH.js similarity index 99% rename from src/main/webapp/reusable-components/chunks/dataverse-shared-Dck3wcoA.js rename to src/main/webapp/reusable-components/chunks/dataverse-shared-Df2bJGqH.js index c2e0a89f015..9985cdc3cfc 100644 --- a/src/main/webapp/reusable-components/chunks/dataverse-shared-Dck3wcoA.js +++ b/src/main/webapp/reusable-components/chunks/dataverse-shared-Df2bJGqH.js @@ -1,4 +1,4 @@ -var dy=Object.defineProperty;var uy=(t,e,n)=>e in t?dy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ut=(t,e,n)=>uy(t,typeof e!="symbol"?e+"":e,n);import{r as g,j as T,R as A,a as xn}from"./react-Dtf48RLW.js";import{u as $t}from"./i18n-CMHgdAUi.js";import{m as py,S as fy,w as hy,a as my,d as De,E as gy,P as Ud,c as Hd,X as yy,y as lt,u as Hl,C as Kl,I as vy,e as by,f as xy,g as tf,F as wy,h as Ey}from"./vendor-DReq5CoA.js";const _n={"application/pdf":"Adobe PDF","image/pdf":"Adobe PDF","text/pdf":"Adobe PDF","application/x-pdf":"Adobe PDF","application/cnt":"Windows Help Contents File","application/msword":"MS Word","application/vnd.ms-excel":"MS Excel Spreadsheet","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"MS Excel Spreadsheet","application/vnd.ms-powerpoint":"MS Powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation":"MS Powerpoint","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"MS Word","application/vnd.oasis.opendocument.spreadsheet":"OpenOffice Spreadsheet","application/vnd.ms-excel.sheet.macroenabled.12":"MS Excel Spreadsheet","text/plain":"Plain Text","text/x-log":"Application Log","text/html":"HTML","application/x-tex":"LaTeX","text/x-tex":"LaTeX","text/markdown":"Markdown Text","text/x-markdown":"Markdown Text","text/x-r-markdown":"R Markdown Text","application/rtf":"Rich Text Format","text/x-rst":"reStructuredText","text/rtf":"Rich Text Format","text/richtext":"Rich Text Format","text/turtle":"Turtle RDF","application/xml":"XML","text/xml":"XML","text/x-c":"C++ Source","text/x-c++src":"C++ Source","text/css":"Cascading Style Sheet","text/x-fortran":"Fortran Source Code","application/java-vm":"Java Class","text/x-java-source":"Java Source Code","text/javascript":"Javascript Code","application/javascript":"Javascript Code","application/x-javascript":"Javascript Code","text/x-matlab":"MATLAB Source Code","text/x-mathematica":"Mathematica Input","text/x-objcsrc":"Objective-C Source Code","text/x-pascal":"Pascal Source Code","text/x-perl":"Perl Script","text/x-perl-script":"Perl Script","text/php":"PHP Source Code","application/postscript":"Postscript","text/x-python":"Python Source Code","text/x-python-script":"Python Source Code","text/x-r-source":"R Source Code","text/x-sh":"Shell Script","application/x-sh":"Shell Script","application/x-shellscript":"Shell Script","application/x-sql":"SQL Code","text/x-sql":"SQL Code","application/x-swc":"Shockwave Flash Component","application/x-msdownload":"Windows Executable","application/x-ipynb+json":"Jupyter Notebook","application/x-stata-ado":"Stata Ado Script","application/x-stata-do":"Stata Do Script","application/x-stata-dta":"Stata Data Script","application/x-stata-smcl":"Stata Markup and Control Language","text/x-stata-syntax":"Stata Syntax","application/x-stata-syntax":"Stata Syntax","text/x-spss-syntax":"SPSS Syntax","application/x-spss-syntax":"SPSS Syntax","application/x-spss-sps":"SPSS Script Syntax","text/x-sas-syntax":"SAS Syntax","application/x-sas-syntax":"SAS Syntax","type/x-r-syntax":"R Syntax","application/vnd.wolfram.mathematica.package":"Wolfram Mathematica Code","application/vnd.wolfram.mathematica":"Wolfram Mathematica Code","text/x-workflow-description-language":"Workflow Description Language","text/x-computational-workflow-language":"Computational Workflow Language","text/x-nextflow":"Nextflow Script","text/x-r-notebook":"R Notebook","text/x-ruby-script":"Ruby Source Code","text/x-dagman":"DAGMan Workflow","text/x-makefile":"Makefile Script","text/x-snakemake":"Snakemake Workflow","text/tab-separated-values":"Tab-Delimited","text/tsv":"Tab-Separated Values","text/comma-separated-values":"Comma Separated Values","text/x-comma-separated-values":"Comma Separated Values","text/csv":"Comma Separated Values","text/x-fixed-field":"Fixed Field Text Data","application/vnd.flographit":"FloGraphIt Media","application/x-r-data":"R Data","application/x-rlang-transport":"R Data","application/x-R-2":"R Binary","application/x-stata":"Stata Binary","application/x-stata-6":"Stata Binary","application/x-stata-13":"Stata 13 Binary","application/x-stata-14":"Stata 14 Binary","application/x-stata-15":"Stata 15 Binary","application/x-spss-por":"SPSS Portable","application/x-spss-portable":"SPSS Portable","application/x-spss-sav":"SPSS Binary","application/x-sas":"SAS","application/x-sas-transport":"SAS Transport","application/x-sas-system":"SAS System","application/x-sas-data":"SAS Data","application/x-sas-catalog":"SAS Catalog","application/x-sas-log":"SAS Log","application/x-sas-output":"SAS Output","application/softgrid-do":"Softgrid DTA Script","application/x-dvn-csvspss-zip":"CSV (w/SPSS card)","application/x-dvn-tabddi-zip":"TAB (w/DDI)","application/x-emf":"Extended Metafile","application/x-h5":"Hierarchical Data Format","application/x-hdf":"Hierarchical Data Format","application/x-hdf5":"Hierarchical Data Format","application/geo+json":"GeoJSON","application/json":"JSON","application/mathematica":"Mathematica","application/matlab-mat":"MATLAB Data","application/x-matlab-data":"MATLAB Data","application/x-matlab-figure":"MATLAB Figure","application/x-matlab-workspace":"MATLAB Workspace","text/x-vcard":"Virtual Contact File","application/x-xfig":"MATLAB Figure","application/x-msaccess":"MS Access","application/netcdf":"Network Common Data Form","application/x-netcdf":"Network Common Data Form","application/vnd.lotus-notes":"Notes Storage Facility","application/x-nsdstat":"NSDstat","application/vnd.realvnc.bed":"PLINK Binary","application/vnd.ms-pki.stl":"STL Format","application/vnd.isac.fcs":"FCS Data","application/java-serialized-object":"Java Serialized Object","chemical/x-xyz":"Co-Ordinate Animation","image/fits":"FITS","application/fits":"FITS","application/dbf":"dBASE Table for ESRI Shapefile","application/dbase":"dBASE Table for ESRI Shapefile","application/prj":"ESRI Shapefile","application/sbn":"ESRI Spatial Index","application/sbx":"ESRI Spatial Index","application/shp":"Shape","application/shx":"Shape","application/x-esri-shape":"ESRI Shapefile","application/vnd.google-earth.kml+xml":"Keyhole Markup Language","application/zipped-shapefile":"Zipped Shapefiles","application/zip":"ZIP Archive","application/x-zip-compressed":"ZIP Archive","application/vnd.antix.game-component":"ATX Archive","application/x-bzip":"Bzip Archive","application/x-bzip2":"Bzip Archive","application/vnd.google-earth.kmz":"Google Earth Archive","application/gzip":"Gzip Archive","application/x-gzip":"Gzip Archive","application/x-gzip-compressed":"Gzip Archive","application/rar":"RAR Archive","application/x-rar":"RAR Archive","application/x-rar-compressed":"RAR Archive","application/tar":"TAR Archive","application/x-tar":"TAR Archive","application/x-compressed":"Compressed Archive","application/x-compressed-tar":"TAR Archive","application/x-7z-compressed":"7Z Archive","application/x-xz":"XZ Archive","application/warc":"Web Archive","application/x-iso9660-image":"Optical Disc Image","application/vnd.eln+zip":"ELN Archive","image/gif":"GIF Image","image/jpeg":"JPEG Image","image/jp2":"JPEG-2000 Image","image/x-portable-bitmap":"Bitmap Image","image/x-portable-graymap":"Graymap Image","image/png":"PNG Image","image/x-portable-anymap":"Anymap Image","image/x-portable-pixmap":"Pixmap Image","application/x-msmetafile":"Enhanced Metafile","application/dicom":"DICOM Image","image/dicom-rle":"DICOM Image","image/nii":"NIfTI Image","image/cmu-raster":"Raster Image","image/x-rgb":"RGB Image","image/svg+xml":"SVG Image","image/tiff":"TIFF Image","image/bmp":"Bitmap Image","image/x-xbitmap":"Bitmap Image","image/RAW":"Bitmap Image","image/raw":"Bitmap Image","application/x-tgif":"TGIF File","image/x-xpixmap":"Pixmap Image","image/x-xwindowdump":"X Windows Dump","application/photoshop":"Photoshop Image","image/vnd.adobe.photoshop":"Photoshop Image","application/x-photoshop":"Photoshop Image","image/webp":"WebP Image","audio/x-aiff":"AIFF Audio","audio/mp3":"MP3 Audio","audio/mpeg":"MP3 Audio","audio/mp4":"MPEG-4 Audio","audio/x-m4a":"MPEG-4 Audio","audio/ogg":"OGG Audio","audio/wav":"Waveform Audio","audio/x-wav":"Waveform Audio","audio/x-wave":"Waveform Audio","video/avi":"AVI Video","video/x-msvideo":"AVI Video","video/mpeg":"MPEG Video","video/mp4":"MPEG-4 Video","video/x-m4v":"MPEG-4 Video","video/ogg":"OGG Video","video/quicktime":"Quicktime Video","video/webm":"WebM Video","text/xml-graphml":"GraphML Network Data","application/octet-stream":"Unknown","application/x-docker-file":"Docker Image File","application/x-vagrant-file":"Vagrant Image File","application/vnd.dataverse.file-package":"Dataverse Package",unknown:"Unknown"};var Wl=(t=>(t.BYTES="B",t.KILOBYTES="KB",t.MEGABYTES="MB",t.GIGABYTES="GB",t.TERABYTES="TB",t.PETABYTES="PB",t))(Wl||{});const go=class go{constructor(e,n){this.value=e,this.unit=n,[this.value,this.unit]=go.convertToLargestUnit(e,n)}toString(){return`${this.value%1===0?this.value.toFixed(0):(Math.round(this.value*10)/10).toString()} ${this.unit}`}toBytes(){return this.value*go.multiplier[this.unit]}static convertToLargestUnit(e,n){let r=e,o=n;for(;r>=1024&&o!=="PB";)r/=1024,o=this.getNextUnit(o);return[r,o]}static getNextUnit(e){switch(e){case"B":return"KB";case"KB":return"MB";case"MB":return"GB";case"GB":return"TB";case"TB":return"PB";default:return e}}};Ut(go,"multiplier",{B:1,KB:1024,MB:1024**2,GB:1024**3,TB:1024**4,PB:1024**5});let vi=go;class ky{constructor(e,n){this.value=e,this.original=n}toDisplayFormat(){return _n[this.value]||_n.unknown}get displayFormatIsUnknown(){return this.toDisplayFormat()===_n.unknown}get originalFormatIsUnknown(){return this.original===void 0||this.original===_n.unknown}}var Or=(t=>(t.NONE="NONE",t.MD5="MD5",t.SHA1="SHA-1",t.SHA256="SHA-256",t.SHA512="SHA-512",t))(Or||{});class Re{static isUniqueCombinationOfFilepathAndFilename({fileName:e,filePath:n,fileKey:r,allFiles:o}){return!o.filter(i=>i.key!==r).some(i=>`${i.fileDir}/${i.fileName}`==`${n}/${e}`)}static isValidFilePath(e){return/^[\w.\-\\/ ]*$/.test(e)}static isValidFileName(e){return/^[^:<>;#/"*|?\\]+$/.test(e)}static sanitizeFilePath(e){return e.replace(/[^\w.\-\\/ ]/g,"_")}static sanitizeFileName(e){return e.replace(/[:<>;#/"*|?\\]/g,"_")}static async getChecksum(e,n){return n===Or.NONE?"":n===Or.MD5?await this.getMD5Checksum(e):await this.getSubtleDigestChecksum(e,n)}static async getMD5Checksum(e){const r=e.size,o=py.md5.create();let i=0;for(;ii+s.length,0),r=new Uint8Array(n);let o=0;for(const i of e)r.set(i,o),o+=i.length;return r}static bufferToHex(e){return Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("")}}Ut(Re,"getFileKey",e=>e.webkitRelativePath||e.name),Ut(Re,"isDS_StoreFile",e=>e.name===".DS_Store");var ct=(t=>(t.UPLOADING="uploading",t.DONE="done",t.FAILED="failed",t.REMOVED="removed",t))(ct||{});const Oy=(t,e)=>{switch(e.type){case"ADD_FILE":{const{file:n}=e,r=Re.getFileKey(n);return t.files[r]?t:{...t,files:{...t.files,[r]:{key:r,progress:0,status:"uploading",fileName:Re.sanitizeFileName(n.name),fileDir:n.webkitRelativePath?Cy(Re.sanitizeFilePath(n.webkitRelativePath)):t.config.originalFile?.metadata.directory??"",fileType:n.type,fileSizeString:new vi(n.size,Wl.BYTES).toString(),fileSize:n.size,fileLastModified:n.lastModified,checksumAlgorithm:t.config.checksumAlgorithm,description:t.config.originalFile?.metadata.description??"",restricted:t.config.originalFile?.access.restricted??!1,tags:t.config.originalFile?.metadata.labels.map(o=>o.value)??[]}}}}case"UPDATE_FILE":{const{key:n,updates:r}=e;return t.files[n]?{...t,files:{...t.files,[n]:{...t.files[n],...r}}}:t}case"REMOVE_FILE":{const{key:n}=e;if(!t.files[n])return t;const r={...t.files};return delete r[n],{...t,files:r}}case"REMOVE_ALL_FILES":return{...t,files:{}};case"SET_IS_SAVING":return{...t,isSaving:e.isSaving};case"ADD_UPLOADING_TO_CANCEL":{const{key:n,cancel:r}=e;return{...t,uploadingToCancelMap:new Map(t.uploadingToCancelMap).set(n,r)}}case"REMOVE_UPLOADING_TO_CANCEL":{const{key:n}=e,r=new Map(t.uploadingToCancelMap);return r.delete(n),{...t,uploadingToCancelMap:r}}case"SET_REPLACE_OPERATION_INFO":return{...t,replaceOperationInfo:e.replaceOperationInfo};case"SET_ADD_FILES_TO_DATASET_OPERATION_INFO":return{...t,addFilesToDatasetOperationInfo:e.addFilesToDatasetOperationInfo};default:return t}},Cy=t=>{const e=t.split("/");return e.length>1?e.slice(0,e.length-1).join("/"):""},nf=g.createContext(void 0),JM=({children:t,initialConfig:e})=>{const[n,r]=g.useReducer(Oy,{config:e,files:{},uploadingToCancelMap:new Map,isSaving:!1,replaceOperationInfo:{success:!1,newFileIdentifier:null},addFilesToDatasetOperationInfo:{success:!1}}),o=g.useCallback(m=>r({type:"ADD_FILE",file:m}),[]),i=g.useCallback((m,y)=>r({type:"UPDATE_FILE",key:m,updates:y}),[]),s=g.useCallback(m=>r({type:"REMOVE_FILE",key:m}),[]),a=g.useCallback(()=>r({type:"REMOVE_ALL_FILES"}),[]),l=g.useCallback(m=>n.files[m],[n.files]),c=g.useCallback(m=>{r({type:"SET_IS_SAVING",isSaving:m})},[]),d=g.useCallback((m,y)=>{r({type:"ADD_UPLOADING_TO_CANCEL",key:m,cancel:y})},[]),u=g.useCallback(m=>{r({type:"REMOVE_UPLOADING_TO_CANCEL",key:m})},[]),p=g.useCallback(m=>{r({type:"SET_REPLACE_OPERATION_INFO",replaceOperationInfo:m})},[]),f=g.useCallback(m=>{r({type:"SET_ADD_FILES_TO_DATASET_OPERATION_INFO",addFilesToDatasetOperationInfo:m})},[]),h=g.useMemo(()=>Object.values(n.files).filter(m=>m.status===ct.DONE&&!!m.storageId&&(m.checksumAlgorithm===Or.NONE||m.checksumValue!==void 0)),[n.files]);return T.jsx(nf.Provider,{value:{fileUploaderState:n,uploadedFiles:h,addFile:o,updateFile:i,removeFile:s,removeAllFiles:a,getFileByKey:l,setIsSaving:c,addUploadingToCancel:d,removeUploadingToCancel:u,setReplaceOperationInfo:p,setAddFilesToDatasetOperationInfo:f},children:t})},Io=()=>{const t=g.useContext(nf);if(!t)throw new Error("useFileUploaderContext must be used within a FileUploaderProvider");return t};function Gl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var rf={exports:{}},Hr={};/** +var dy=Object.defineProperty;var uy=(t,e,n)=>e in t?dy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ut=(t,e,n)=>uy(t,typeof e!="symbol"?e+"":e,n);import{r as g,j as T,R as A,a as xn}from"./react-Dtf48RLW.js";import{u as $t}from"./i18n-CDa8ZpJw.js";import{m as py,S as fy,w as hy,a as my,d as De,E as gy,P as Ud,c as Hd,X as yy,y as lt,u as Hl,C as Kl,I as vy,e as by,f as xy,g as tf,F as wy,h as Ey}from"./vendor-B5oGEj-7.js";const _n={"application/pdf":"Adobe PDF","image/pdf":"Adobe PDF","text/pdf":"Adobe PDF","application/x-pdf":"Adobe PDF","application/cnt":"Windows Help Contents File","application/msword":"MS Word","application/vnd.ms-excel":"MS Excel Spreadsheet","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"MS Excel Spreadsheet","application/vnd.ms-powerpoint":"MS Powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation":"MS Powerpoint","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"MS Word","application/vnd.oasis.opendocument.spreadsheet":"OpenOffice Spreadsheet","application/vnd.ms-excel.sheet.macroenabled.12":"MS Excel Spreadsheet","text/plain":"Plain Text","text/x-log":"Application Log","text/html":"HTML","application/x-tex":"LaTeX","text/x-tex":"LaTeX","text/markdown":"Markdown Text","text/x-markdown":"Markdown Text","text/x-r-markdown":"R Markdown Text","application/rtf":"Rich Text Format","text/x-rst":"reStructuredText","text/rtf":"Rich Text Format","text/richtext":"Rich Text Format","text/turtle":"Turtle RDF","application/xml":"XML","text/xml":"XML","text/x-c":"C++ Source","text/x-c++src":"C++ Source","text/css":"Cascading Style Sheet","text/x-fortran":"Fortran Source Code","application/java-vm":"Java Class","text/x-java-source":"Java Source Code","text/javascript":"Javascript Code","application/javascript":"Javascript Code","application/x-javascript":"Javascript Code","text/x-matlab":"MATLAB Source Code","text/x-mathematica":"Mathematica Input","text/x-objcsrc":"Objective-C Source Code","text/x-pascal":"Pascal Source Code","text/x-perl":"Perl Script","text/x-perl-script":"Perl Script","text/php":"PHP Source Code","application/postscript":"Postscript","text/x-python":"Python Source Code","text/x-python-script":"Python Source Code","text/x-r-source":"R Source Code","text/x-sh":"Shell Script","application/x-sh":"Shell Script","application/x-shellscript":"Shell Script","application/x-sql":"SQL Code","text/x-sql":"SQL Code","application/x-swc":"Shockwave Flash Component","application/x-msdownload":"Windows Executable","application/x-ipynb+json":"Jupyter Notebook","application/x-stata-ado":"Stata Ado Script","application/x-stata-do":"Stata Do Script","application/x-stata-dta":"Stata Data Script","application/x-stata-smcl":"Stata Markup and Control Language","text/x-stata-syntax":"Stata Syntax","application/x-stata-syntax":"Stata Syntax","text/x-spss-syntax":"SPSS Syntax","application/x-spss-syntax":"SPSS Syntax","application/x-spss-sps":"SPSS Script Syntax","text/x-sas-syntax":"SAS Syntax","application/x-sas-syntax":"SAS Syntax","type/x-r-syntax":"R Syntax","application/vnd.wolfram.mathematica.package":"Wolfram Mathematica Code","application/vnd.wolfram.mathematica":"Wolfram Mathematica Code","text/x-workflow-description-language":"Workflow Description Language","text/x-computational-workflow-language":"Computational Workflow Language","text/x-nextflow":"Nextflow Script","text/x-r-notebook":"R Notebook","text/x-ruby-script":"Ruby Source Code","text/x-dagman":"DAGMan Workflow","text/x-makefile":"Makefile Script","text/x-snakemake":"Snakemake Workflow","text/tab-separated-values":"Tab-Delimited","text/tsv":"Tab-Separated Values","text/comma-separated-values":"Comma Separated Values","text/x-comma-separated-values":"Comma Separated Values","text/csv":"Comma Separated Values","text/x-fixed-field":"Fixed Field Text Data","application/vnd.flographit":"FloGraphIt Media","application/x-r-data":"R Data","application/x-rlang-transport":"R Data","application/x-R-2":"R Binary","application/x-stata":"Stata Binary","application/x-stata-6":"Stata Binary","application/x-stata-13":"Stata 13 Binary","application/x-stata-14":"Stata 14 Binary","application/x-stata-15":"Stata 15 Binary","application/x-spss-por":"SPSS Portable","application/x-spss-portable":"SPSS Portable","application/x-spss-sav":"SPSS Binary","application/x-sas":"SAS","application/x-sas-transport":"SAS Transport","application/x-sas-system":"SAS System","application/x-sas-data":"SAS Data","application/x-sas-catalog":"SAS Catalog","application/x-sas-log":"SAS Log","application/x-sas-output":"SAS Output","application/softgrid-do":"Softgrid DTA Script","application/x-dvn-csvspss-zip":"CSV (w/SPSS card)","application/x-dvn-tabddi-zip":"TAB (w/DDI)","application/x-emf":"Extended Metafile","application/x-h5":"Hierarchical Data Format","application/x-hdf":"Hierarchical Data Format","application/x-hdf5":"Hierarchical Data Format","application/geo+json":"GeoJSON","application/json":"JSON","application/mathematica":"Mathematica","application/matlab-mat":"MATLAB Data","application/x-matlab-data":"MATLAB Data","application/x-matlab-figure":"MATLAB Figure","application/x-matlab-workspace":"MATLAB Workspace","text/x-vcard":"Virtual Contact File","application/x-xfig":"MATLAB Figure","application/x-msaccess":"MS Access","application/netcdf":"Network Common Data Form","application/x-netcdf":"Network Common Data Form","application/vnd.lotus-notes":"Notes Storage Facility","application/x-nsdstat":"NSDstat","application/vnd.realvnc.bed":"PLINK Binary","application/vnd.ms-pki.stl":"STL Format","application/vnd.isac.fcs":"FCS Data","application/java-serialized-object":"Java Serialized Object","chemical/x-xyz":"Co-Ordinate Animation","image/fits":"FITS","application/fits":"FITS","application/dbf":"dBASE Table for ESRI Shapefile","application/dbase":"dBASE Table for ESRI Shapefile","application/prj":"ESRI Shapefile","application/sbn":"ESRI Spatial Index","application/sbx":"ESRI Spatial Index","application/shp":"Shape","application/shx":"Shape","application/x-esri-shape":"ESRI Shapefile","application/vnd.google-earth.kml+xml":"Keyhole Markup Language","application/zipped-shapefile":"Zipped Shapefiles","application/zip":"ZIP Archive","application/x-zip-compressed":"ZIP Archive","application/vnd.antix.game-component":"ATX Archive","application/x-bzip":"Bzip Archive","application/x-bzip2":"Bzip Archive","application/vnd.google-earth.kmz":"Google Earth Archive","application/gzip":"Gzip Archive","application/x-gzip":"Gzip Archive","application/x-gzip-compressed":"Gzip Archive","application/rar":"RAR Archive","application/x-rar":"RAR Archive","application/x-rar-compressed":"RAR Archive","application/tar":"TAR Archive","application/x-tar":"TAR Archive","application/x-compressed":"Compressed Archive","application/x-compressed-tar":"TAR Archive","application/x-7z-compressed":"7Z Archive","application/x-xz":"XZ Archive","application/warc":"Web Archive","application/x-iso9660-image":"Optical Disc Image","application/vnd.eln+zip":"ELN Archive","image/gif":"GIF Image","image/jpeg":"JPEG Image","image/jp2":"JPEG-2000 Image","image/x-portable-bitmap":"Bitmap Image","image/x-portable-graymap":"Graymap Image","image/png":"PNG Image","image/x-portable-anymap":"Anymap Image","image/x-portable-pixmap":"Pixmap Image","application/x-msmetafile":"Enhanced Metafile","application/dicom":"DICOM Image","image/dicom-rle":"DICOM Image","image/nii":"NIfTI Image","image/cmu-raster":"Raster Image","image/x-rgb":"RGB Image","image/svg+xml":"SVG Image","image/tiff":"TIFF Image","image/bmp":"Bitmap Image","image/x-xbitmap":"Bitmap Image","image/RAW":"Bitmap Image","image/raw":"Bitmap Image","application/x-tgif":"TGIF File","image/x-xpixmap":"Pixmap Image","image/x-xwindowdump":"X Windows Dump","application/photoshop":"Photoshop Image","image/vnd.adobe.photoshop":"Photoshop Image","application/x-photoshop":"Photoshop Image","image/webp":"WebP Image","audio/x-aiff":"AIFF Audio","audio/mp3":"MP3 Audio","audio/mpeg":"MP3 Audio","audio/mp4":"MPEG-4 Audio","audio/x-m4a":"MPEG-4 Audio","audio/ogg":"OGG Audio","audio/wav":"Waveform Audio","audio/x-wav":"Waveform Audio","audio/x-wave":"Waveform Audio","video/avi":"AVI Video","video/x-msvideo":"AVI Video","video/mpeg":"MPEG Video","video/mp4":"MPEG-4 Video","video/x-m4v":"MPEG-4 Video","video/ogg":"OGG Video","video/quicktime":"Quicktime Video","video/webm":"WebM Video","text/xml-graphml":"GraphML Network Data","application/octet-stream":"Unknown","application/x-docker-file":"Docker Image File","application/x-vagrant-file":"Vagrant Image File","application/vnd.dataverse.file-package":"Dataverse Package",unknown:"Unknown"};var Wl=(t=>(t.BYTES="B",t.KILOBYTES="KB",t.MEGABYTES="MB",t.GIGABYTES="GB",t.TERABYTES="TB",t.PETABYTES="PB",t))(Wl||{});const go=class go{constructor(e,n){this.value=e,this.unit=n,[this.value,this.unit]=go.convertToLargestUnit(e,n)}toString(){return`${this.value%1===0?this.value.toFixed(0):(Math.round(this.value*10)/10).toString()} ${this.unit}`}toBytes(){return this.value*go.multiplier[this.unit]}static convertToLargestUnit(e,n){let r=e,o=n;for(;r>=1024&&o!=="PB";)r/=1024,o=this.getNextUnit(o);return[r,o]}static getNextUnit(e){switch(e){case"B":return"KB";case"KB":return"MB";case"MB":return"GB";case"GB":return"TB";case"TB":return"PB";default:return e}}};Ut(go,"multiplier",{B:1,KB:1024,MB:1024**2,GB:1024**3,TB:1024**4,PB:1024**5});let vi=go;class ky{constructor(e,n){this.value=e,this.original=n}toDisplayFormat(){return _n[this.value]||_n.unknown}get displayFormatIsUnknown(){return this.toDisplayFormat()===_n.unknown}get originalFormatIsUnknown(){return this.original===void 0||this.original===_n.unknown}}var Or=(t=>(t.NONE="NONE",t.MD5="MD5",t.SHA1="SHA-1",t.SHA256="SHA-256",t.SHA512="SHA-512",t))(Or||{});class Re{static isUniqueCombinationOfFilepathAndFilename({fileName:e,filePath:n,fileKey:r,allFiles:o}){return!o.filter(i=>i.key!==r).some(i=>`${i.fileDir}/${i.fileName}`==`${n}/${e}`)}static isValidFilePath(e){return/^[\w.\-\\/ ]*$/.test(e)}static isValidFileName(e){return/^[^:<>;#/"*|?\\]+$/.test(e)}static sanitizeFilePath(e){return e.replace(/[^\w.\-\\/ ]/g,"_")}static sanitizeFileName(e){return e.replace(/[:<>;#/"*|?\\]/g,"_")}static async getChecksum(e,n){return n===Or.NONE?"":n===Or.MD5?await this.getMD5Checksum(e):await this.getSubtleDigestChecksum(e,n)}static async getMD5Checksum(e){const r=e.size,o=py.md5.create();let i=0;for(;ii+s.length,0),r=new Uint8Array(n);let o=0;for(const i of e)r.set(i,o),o+=i.length;return r}static bufferToHex(e){return Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("")}}Ut(Re,"getFileKey",e=>e.webkitRelativePath||e.name),Ut(Re,"isDS_StoreFile",e=>e.name===".DS_Store");var ct=(t=>(t.UPLOADING="uploading",t.DONE="done",t.FAILED="failed",t.REMOVED="removed",t))(ct||{});const Oy=(t,e)=>{switch(e.type){case"ADD_FILE":{const{file:n}=e,r=Re.getFileKey(n);return t.files[r]?t:{...t,files:{...t.files,[r]:{key:r,progress:0,status:"uploading",fileName:Re.sanitizeFileName(n.name),fileDir:n.webkitRelativePath?Cy(Re.sanitizeFilePath(n.webkitRelativePath)):t.config.originalFile?.metadata.directory??"",fileType:n.type,fileSizeString:new vi(n.size,Wl.BYTES).toString(),fileSize:n.size,fileLastModified:n.lastModified,checksumAlgorithm:t.config.checksumAlgorithm,description:t.config.originalFile?.metadata.description??"",restricted:t.config.originalFile?.access.restricted??!1,tags:t.config.originalFile?.metadata.labels.map(o=>o.value)??[]}}}}case"UPDATE_FILE":{const{key:n,updates:r}=e;return t.files[n]?{...t,files:{...t.files,[n]:{...t.files[n],...r}}}:t}case"REMOVE_FILE":{const{key:n}=e;if(!t.files[n])return t;const r={...t.files};return delete r[n],{...t,files:r}}case"REMOVE_ALL_FILES":return{...t,files:{}};case"SET_IS_SAVING":return{...t,isSaving:e.isSaving};case"ADD_UPLOADING_TO_CANCEL":{const{key:n,cancel:r}=e;return{...t,uploadingToCancelMap:new Map(t.uploadingToCancelMap).set(n,r)}}case"REMOVE_UPLOADING_TO_CANCEL":{const{key:n}=e,r=new Map(t.uploadingToCancelMap);return r.delete(n),{...t,uploadingToCancelMap:r}}case"SET_REPLACE_OPERATION_INFO":return{...t,replaceOperationInfo:e.replaceOperationInfo};case"SET_ADD_FILES_TO_DATASET_OPERATION_INFO":return{...t,addFilesToDatasetOperationInfo:e.addFilesToDatasetOperationInfo};default:return t}},Cy=t=>{const e=t.split("/");return e.length>1?e.slice(0,e.length-1).join("/"):""},nf=g.createContext(void 0),JM=({children:t,initialConfig:e})=>{const[n,r]=g.useReducer(Oy,{config:e,files:{},uploadingToCancelMap:new Map,isSaving:!1,replaceOperationInfo:{success:!1,newFileIdentifier:null},addFilesToDatasetOperationInfo:{success:!1}}),o=g.useCallback(m=>r({type:"ADD_FILE",file:m}),[]),i=g.useCallback((m,y)=>r({type:"UPDATE_FILE",key:m,updates:y}),[]),s=g.useCallback(m=>r({type:"REMOVE_FILE",key:m}),[]),a=g.useCallback(()=>r({type:"REMOVE_ALL_FILES"}),[]),l=g.useCallback(m=>n.files[m],[n.files]),c=g.useCallback(m=>{r({type:"SET_IS_SAVING",isSaving:m})},[]),d=g.useCallback((m,y)=>{r({type:"ADD_UPLOADING_TO_CANCEL",key:m,cancel:y})},[]),u=g.useCallback(m=>{r({type:"REMOVE_UPLOADING_TO_CANCEL",key:m})},[]),p=g.useCallback(m=>{r({type:"SET_REPLACE_OPERATION_INFO",replaceOperationInfo:m})},[]),f=g.useCallback(m=>{r({type:"SET_ADD_FILES_TO_DATASET_OPERATION_INFO",addFilesToDatasetOperationInfo:m})},[]),h=g.useMemo(()=>Object.values(n.files).filter(m=>m.status===ct.DONE&&!!m.storageId&&(m.checksumAlgorithm===Or.NONE||m.checksumValue!==void 0)),[n.files]);return T.jsx(nf.Provider,{value:{fileUploaderState:n,uploadedFiles:h,addFile:o,updateFile:i,removeFile:s,removeAllFiles:a,getFileByKey:l,setIsSaving:c,addUploadingToCancel:d,removeUploadingToCancel:u,setReplaceOperationInfo:p,setAddFilesToDatasetOperationInfo:f},children:t})},Io=()=>{const t=g.useContext(nf);if(!t)throw new Error("useFileUploaderContext must be used within a FileUploaderProvider");return t};function Gl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var rf={exports:{}},Hr={};/** * @license React * react-jsx-runtime.production.min.js * @@ -134,4 +134,4 @@ img.ProseMirror-separator { - `;const C=N=>{d.forEach(M=>a.classList.remove(M)),a.classList.add(N),l()};x.addEventListener("click",()=>C(fn.IMAGE_ALIGN_LEFT)),k.addEventListener("click",()=>C(fn.IMAGE_ALIGN_CENTER)),O.addEventListener("click",()=>C(fn.IMAGE_ALIGN_RIGHT)),b.append(x,k,O),s.appendChild(b)};i.setAttribute("style","display: flex;"),i.appendChild(s),s.classList.add("image-resize-container");const d=[fn.IMAGE_ALIGN_LEFT,fn.IMAGE_ALIGN_CENTER,fn.IMAGE_ALIGN_RIGHT],u=d.find(b=>o.includes(b));u&&s.classList.add(u);const p=o.match(/rte-w-(\d+)/);if(p){const b=p[0];s.classList.add(b)}s.appendChild(a),Object.entries(t.attrs).forEach(([b,x])=>{x!=null&&a.setAttribute(b,x)});const f=["top: -4px; left: -4px; cursor: nwse-resize;","top: -4px; right: -4px; cursor: nesw-resize;","bottom: -4px; left: -4px; cursor: nesw-resize;","bottom: -4px; right: -4px; cursor: nwse-resize;"];let h=!1,m,y;return s.addEventListener("click",()=>{if(s.childElementCount>3)for(let b=0;b<5;b++)s.removeChild(s.lastChild);c(),Array.from({length:4},(b,x)=>{const k=document.createElement("div");k.classList.add("resize-dot"),k.setAttribute("style",`position: absolute; ${f[x]}`);const O=C=>{var N;const M=((N=s.parentElement)==null?void 0:N.offsetWidth)||1,S=Math.min(100,Math.max(5,C/M*100)),R=`rte-w-${Math.round(S/5)*5}`;a.classList.forEach(P=>{/^rte-w-\d+$/.test(P)&&a.classList.remove(P)}),s.classList.forEach(P=>{/^rte-w-\d+$/.test(P)&&s.classList.remove(P)}),s.classList.add(R),a.classList.add(R)};k.addEventListener("pointerdown",C=>{C.preventDefault(),h=!0,m=C.clientX,y=s.offsetWidth;const N=S=>{if(!h)return;const R=x%2===0?-(S.clientX-m):S.clientX-m,P=y+R;O(P)},M=()=>{h&&(h=!1),l(),document.removeEventListener("pointermove",N),document.removeEventListener("pointerup",M)};document.addEventListener("pointermove",N),document.addEventListener("pointerup",M)},{passive:!1}),s.appendChild(k)})}),document.addEventListener("click",b=>{const x=b.target;if(!s.contains(x)&&s.childElementCount>3)for(let k=0;k<5;k++)s.removeChild(s.lastChild)}),{dom:i}}}}),vt={placeholder:"Write something …",linkDialog:{title:"Add Link",label:"Link",ok:"OK",cancel:"Cancel"},imageDialog:{title:"Add Image",label:"Image URL",altTextLabel:"Alternative text",altTextPlaceholder:'Describe the image for screen readers (e.g. "Group of young college students in a classroom")',ok:"OK",cancel:"Cancel"}},LA="_selected_h2wq9_37",ee={"editor-actions-wrapper":"_editor-actions-wrapper_h2wq9_26","editor-actions-button":"_editor-actions-button_h2wq9_33",selected:LA,"editor-actions-button-image":"_editor-actions-button-image_h2wq9_41"},He={heading:"heading",bold:"bold",italic:"italic",underline:"underline",strike:"strike",code:"code",codeBlock:"codeBlock",link:"link",blockquote:"blockquote",bulletList:"bulletList",orderedList:"orderedList"},FA=({editor:t,disabled:e,locales:n})=>{var r,o,i,s,a,l,c,d,u,p,f,h,m,y,b,x,k,O,C,N;const[M,S]=g.useState({open:!1,url:""}),[R,P]=g.useState({open:!1,url:"",altText:""}),D=()=>{var G;const ue=(G=t?.getAttributes("link"))==null?void 0:G.href;S({open:!0,url:ue??""})},L=()=>S({open:!1,url:""}),V=()=>{M.url?t?.chain().focus().extendMarkRange(He.link).setLink({href:M.url}).run():t?.chain().focus().extendMarkRange(He.link).unsetLink().run(),L()},K=()=>{var G,ue;const Fn=(G=t?.getAttributes("image"))==null?void 0:G.src,Jo=(ue=t?.getAttributes("image"))==null?void 0:ue.alt;P({open:!0,url:Fn??"",altText:Jo??""})},W=()=>{P({open:!1,url:"",altText:""})},Q=()=>{R.url&&t?.chain().focus().setImage({src:R.url,alt:R.altText}).run(),W()},B=()=>t?.chain().focus().toggleHeading({level:1}).run(),H=!e&&t?.isActive(He.heading,{level:1}),J=()=>t?.chain().focus().toggleHeading({level:2}).run(),be=!e&&t?.isActive(He.heading,{level:2}),Fe=()=>t?.chain().focus().toggleHeading({level:3}).run(),ge=!e&&t?.isActive(He.heading,{level:3}),ye=()=>t?.chain().focus().toggleBold().run(),xe=!e&&t?.isActive(He.bold),te=()=>t?.chain().focus().toggleItalic().run(),Me=!e&&t?.isActive(He.italic),mt=()=>t?.chain().focus().toggleUnderline().run(),Ye=!e&&t?.isActive(He.underline),Ct=()=>t?.chain().focus().toggleStrike().run(),gt=!e&&t?.isActive(He.strike),yt=()=>t?.chain().focus().toggleCode().run(),Vt=!e&&t?.isActive(He.code),St=()=>t?.chain().focus().toggleCodeBlock().run(),nt=!e&&t?.isActive(He.codeBlock),ne=()=>t?.chain().focus().toggleBlockquote().run(),Nt=!e&&t?.isActive(He.blockquote),Tt=()=>t?.chain().focus().toggleBulletList().run(),sr=!e&&t?.isActive(He.bulletList),Ur=()=>t?.chain().focus().toggleOrderedList().run(),rt=!e&&t?.isActive(He.orderedList),an=()=>t?.chain().focus().undo().run(),ar=()=>t?.chain().focus().redo().run(),ln=((r=n?.linkDialog)==null?void 0:r.title)??((o=vt.linkDialog)==null?void 0:o.title),cn=((i=n?.imageDialog)==null?void 0:i.title)??((s=vt.imageDialog)==null?void 0:s.title);return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:ee["editor-actions-wrapper"],children:[v.jsxs(fr,{children:[v.jsx(se,{onClick:B,className:`${ee["editor-actions-button"]} ${H?ee.selected:""}`,"aria-pressed":H,"aria-label":"Heading 1",disabled:e,title:"Heading 1",type:"button",variant:"secondary",size:"sm",icon:v.jsx(nd,{size:18})}),v.jsx(se,{onClick:J,className:`${ee["editor-actions-button"]} ${be?ee.selected:""}`,"aria-pressed":be,"aria-label":"Heading 2",disabled:e,title:"Heading 2",type:"button",variant:"secondary",size:"sm",icon:v.jsx(rd,{size:18})}),v.jsx(se,{onClick:Fe,className:`${ee["editor-actions-button"]} ${ge?ee.selected:""}`,"aria-pressed":ge,"aria-label":"Heading 3",disabled:e,title:"Heading 3",type:"button",variant:"secondary",size:"sm",icon:v.jsx(od,{size:18})})]}),v.jsxs(fr,{children:[v.jsx(se,{onClick:ye,className:`${ee["editor-actions-button"]} ${xe?ee.selected:""}`,"aria-pressed":xe,"aria-label":"Bold",disabled:e,title:"Bold",type:"button",variant:"secondary",size:"sm",icon:v.jsx(td,{size:18})}),v.jsx(se,{onClick:te,className:`${ee["editor-actions-button"]} ${Me?ee.selected:""}`,"aria-pressed":Me,"aria-label":"Italic",disabled:e,title:"Italic",type:"button",variant:"secondary",size:"sm",icon:v.jsx(id,{size:18})}),v.jsx(se,{onClick:mt,className:`${ee["editor-actions-button"]} ${Ye?ee.selected:""}`,"aria-pressed":Ye,"aria-label":"Underline",disabled:e,title:"Underline",type:"button",variant:"secondary",size:"sm",icon:v.jsx(ad,{size:18})}),v.jsx(se,{onClick:Ct,className:`${ee["editor-actions-button"]} ${gt?ee.selected:""}`,"aria-pressed":gt,"aria-label":"Strikethrough",disabled:e,title:"Strikethrough",type:"button",variant:"secondary",size:"sm",icon:v.jsx(sd,{size:18})})]}),v.jsxs(fr,{children:[v.jsx(se,{onClick:Tt,className:`${ee["editor-actions-button"]} ${sr?ee.selected:""}`,"aria-pressed":sr,"aria-label":"Unordered list",disabled:e,title:"Unordered list",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Qc,{size:18})}),v.jsx(se,{onClick:Ur,className:`${ee["editor-actions-button"]} ${rt?ee.selected:""}`,"aria-pressed":rt,"aria-label":"Ordered list",disabled:e,title:"Ordered list",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Zc,{size:18})})]}),v.jsxs(fr,{children:[v.jsx(se,{onClick:D,className:`${ee["editor-actions-button"]}`,"aria-label":"Add link",disabled:e,title:"Add link",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Yc,{size:18})}),v.jsx(se,{onClick:yt,className:`${ee["editor-actions-button"]} ${Vt?ee.selected:""}`,"aria-pressed":Vt,"aria-label":"Code",disabled:e,title:"Code",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Jc,{size:18})}),v.jsx(se,{onClick:St,className:`${ee["editor-actions-button"]} ${nt?ee.selected:""}`,"aria-pressed":nt,"aria-label":"Code block",disabled:e,title:"Code block",type:"button",variant:"secondary",size:"sm",icon:v.jsx(qc,{size:18})}),v.jsx(se,{onClick:ne,className:`${ee["editor-actions-button"]} ${Nt?ee.selected:""}`,"aria-pressed":Nt,"aria-label":"Blockquote",title:"Blockquote",type:"button",disabled:e,variant:"secondary",size:"sm",icon:v.jsx(Gc,{size:18})}),v.jsx(se,{onClick:K,className:`${ee["editor-actions-button"]} ${ee["editor-actions-button-image"]}`,"aria-label":"Add image",title:"Add image",type:"button",disabled:e,variant:"secondary",size:"sm",icon:v.jsx(Xc,{size:18})})]}),v.jsxs(fr,{children:[v.jsx(se,{onClick:an,className:`${ee["editor-actions-button"]}`,"aria-label":"Undo",disabled:e||!(t!=null&&t.can().undo()),title:"Undo",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Kc,{size:18})}),v.jsx(se,{onClick:ar,className:`${ee["editor-actions-button"]}`,"aria-label":"Redo",disabled:e||!(t!=null&&t.can().redo()),title:"Redo",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Wc,{size:18})})]})]}),v.jsxs(Ke,{show:M.open,onHide:L,size:"lg",ariaLabel:ln,children:[v.jsx(Ke.Header,{children:v.jsx(Ke.Title,{children:ln})}),v.jsx(Ke.Body,{children:v.jsxs(oe.Group,{controlId:"link-url",as:ze,children:[v.jsx(oe.Group.Label,{column:!0,children:((a=n?.linkDialog)==null?void 0:a.label)??((l=vt.linkDialog)==null?void 0:l.label)}),v.jsx(ze,{children:v.jsx(oe.Group.Input,{type:"text",value:M.url,autoFocus:!0,autoComplete:"off",onChange:G=>S(ue=>({...ue,url:G.target.value}))})})]})}),v.jsxs(Ke.Footer,{children:[v.jsx(se,{onClick:V,variant:"primary",type:"button",children:((c=n?.linkDialog)==null?void 0:c.ok)??((d=vt.linkDialog)==null?void 0:d.ok)}),v.jsx(se,{onClick:L,variant:"secondary",type:"button",children:((u=n?.linkDialog)==null?void 0:u.cancel)??((p=vt.linkDialog)==null?void 0:p.cancel)})]})]}),v.jsxs(Ke,{show:R.open,onHide:W,size:"lg",ariaLabel:cn,children:[v.jsx(Ke.Header,{children:v.jsx(Ke.Title,{children:cn})}),v.jsxs(Ke.Body,{children:[v.jsxs(oe.Group,{controlId:"image-url",as:ze,children:[v.jsx(oe.Group.Label,{column:!0,children:((f=n?.imageDialog)==null?void 0:f.label)??((h=vt.imageDialog)==null?void 0:h.label)}),v.jsx(ze,{children:v.jsx(oe.Group.Input,{type:"text",autoFocus:!0,autoComplete:"off",placeholder:"https://example.com/image.png",value:R.url,onChange:G=>P(ue=>({...ue,url:G.target.value}))})})]}),v.jsxs(oe.Group,{controlId:"image-alt-text",as:ze,children:[v.jsx(oe.Group.Label,{column:!0,children:((m=n?.imageDialog)==null?void 0:m.altTextLabel)??((y=vt.imageDialog)==null?void 0:y.altTextLabel)}),v.jsx(ze,{children:v.jsx(oe.Group.Input,{type:"text",value:R.altText,autoComplete:"off",placeholder:((b=n?.imageDialog)==null?void 0:b.altTextPlaceholder)??((x=vt.imageDialog)==null?void 0:x.altTextPlaceholder),onChange:G=>P(ue=>({...ue,altText:G.target.value}))})})]})]}),v.jsxs(Ke.Footer,{children:[v.jsx(se,{onClick:Q,variant:"primary",type:"button",children:((k=n?.imageDialog)==null?void 0:k.ok)??((O=vt.imageDialog)==null?void 0:O.ok)}),v.jsx(se,{onClick:W,variant:"secondary",type:"button",children:((C=n?.imageDialog)==null?void 0:C.cancel)??((N=vt.imageDialog)==null?void 0:N.cancel)})]})]})]})};var fn=(t=>(t.HEADING="rte-heading",t.PARAGRAPH="rte-paragraph",t.BOLD="rte-bold",t.ITALIC="rte-italic",t.STRIKE="rte-strike",t.BULLET_LIST="rte-bullet-list",t.ORDERED_LIST="rte-ordered-list",t.CODE="rte-code",t.CODE_BLOCK="rte-code-block",t.BLOCKQUOTE="rte-blockquote",t.UNDERLINE="rte-underline",t.LINK="rte-link",t.IMAGE="rte-img",t.IMAGE_ALIGN_LEFT="rte-img-left",t.IMAGE_ALIGN_CENTER="rte-img-center",t.IMAGE_ALIGN_RIGHT="rte-img-right",t))(fn||{});const BA=g.forwardRef(({initialValue:t,onChange:e,disabled:n,locales:r,editorContentId:o,editorContentAriaLabelledBy:i,invalid:s,ariaRequired:a},l)=>{const c=oT({extensions:[aA.configure({heading:{levels:[1,2,3],HTMLAttributes:{class:"rte-heading"}},paragraph:{HTMLAttributes:{class:"rte-paragraph"}},bold:{HTMLAttributes:{class:"rte-bold"}},italic:{HTMLAttributes:{class:"rte-italic"}},strike:{HTMLAttributes:{class:"rte-strike"}},bulletList:{HTMLAttributes:{class:"rte-bullet-list"}},orderedList:{HTMLAttributes:{class:"rte-ordered-list"}},code:{HTMLAttributes:{class:"rte-code"}},codeBlock:{HTMLAttributes:{class:"rte-code-block"}},blockquote:{HTMLAttributes:{class:"rte-blockquote"}}}),lA.configure({HTMLAttributes:{class:"rte-underline"}}),DA.configure({openOnClick:!1,autolink:!0,linkOnPaste:!0,HTMLAttributes:{class:"rte-link"}}),jA.configure({placeholder:r?.placeholder??vt.placeholder}),PA.configure({HTMLAttributes:{class:"rte-img"}})],content:t,editorProps:{attributes:{class:"rich-text-editor-content",...o&&{id:o},...i&&{"aria-labelledby":i},...n&&{disabled:"true"},...a&&{"aria-required":"true"},role:"textbox","aria-label":"rich text editor content"}},onUpdate:({editor:d})=>e&&e(d.getHTML())});return g.useEffect(()=>{c&&c.setEditable(!n,!1)},[n,c]),v.jsxs("div",{className:`rich-text-editor-wrapper ${s?"invalid":""}`,"data-testid":"rich-text-editor-wrapper",ref:l,tabIndex:0,children:[v.jsx(FA,{editor:c,disabled:n,locales:r}),v.jsx("div",{className:"editor-content-wrapper",children:v.jsx(qN,{editor:c})})]})});BA.displayName="RichTextEditor";const ZM=t=>{const[e,n]=g.useState(Or.MD5),[r,o]=g.useState(!0),[i,s]=g.useState(!1);return g.useEffect(()=>{(async()=>{o(!0);try{const l=await t.getFixityAlgorithm();n(l)}catch{s(!0)}finally{o(!1)}})()},[t]),{fixityAlgorithm:e,isLoadingFixityAlgorithm:r,errorLoadingFixityAlgorithm:i}},zA="_loading_config_grfox_1",$A="_dots_grfox_9",Yp={loading_config:zA,dots:$A},QM=()=>{const{t}=$t("shared",{keyPrefix:"fileUploader"});return T.jsxs("div",{className:Yp.loading_config,"data-testid":"loading-config-spinner",children:[T.jsx(sm,{animation:"border",variant:"primary"}),T.jsxs("span",{children:[t("loadingConfiguration")," ",T.jsxs("span",{className:Yp.dots,children:[T.jsx("span",{children:"."}),T.jsx("span",{children:"."}),T.jsx("span",{children:"."})]})]})]})};var _A=(t=>(t.HOME="/",t.SIGN_UP_JSF="/dataverseuser.xhtml?editMode=CREATE&redirectPage=%2Fdataverse.xhtml",t.LOG_IN_JSF="/loginpage.xhtml?redirectPage=%2Fdataverse.xhtml",t.LOG_OUT="/",t.DATASETS="/datasets",t.CREATE_DATASET="/datasets/:collectionId/create",t.UPLOAD_DATASET_FILES="/datasets/upload-files",t.EDIT_DATASET_METADATA="/datasets/edit-metadata",t.EDIT_DATASET_TERMS="/datasets/edit-terms",t.FILES="/files",t.EDIT_FILE_METADATA="/files/edit-metadata",t.FILES_REPLACE="/files/replace",t.COLLECTIONS_BASE="/collections",t.COLLECTIONS="/collections/:collectionId",t.CREATE_COLLECTION="/collections/:parentCollectionId/create",t.ACCOUNT="/account",t.EDIT_COLLECTION="/collections/:collectionId/edit",t.EDIT_FEATURED_ITEMS="/collections/:collectionId/edit-featured-items",t.FEATURED_ITEM="/featured-item/:parentCollectionId/:featuredItemId",t.NOT_FOUND_PAGE="/404",t.AUTH_CALLBACK="/auth-callback",t.SIGN_UP="/sign-up",t.ADVANCED_SEARCH="/collections/:collectionId/search",t))(_A||{}),VA=(t=>(t.VERSION="version",t.PERSISTENT_ID="persistentId",t.PAGE="page",t.COLLECTION_ID="collectionId",t.TAB="tab",t.FILE_ID="id",t.DATASET_VERSION="datasetVersion",t.REFERRER="referrer",t.AUTH_STATE="state",t.VALID_TOKEN_BUT_NOT_LINKED_ACCOUNT="validTokenButNotLinkedAccount",t.TOOL_TYPE="toolType",t))(VA||{});class eD{constructor(e,n){this.majorNumber=e,this.minorNumber=n}toString(){return this.majorNumber===void 0||this.minorNumber===void 0?":draft":`${this.majorNumber}.${this.minorNumber}`}toSearchParam(){return this.majorNumber===void 0||this.minorNumber===void 0?"DRAFT":this.toString()}}var bt=(t=>(t.REPLACE_FILE="replace-file",t.ADD_FILES_TO_DATASET="add-files-to-dataset",t))(bt||{});function Zp(t,e,n,r,o,i,s){const a=new AbortController;return t.uploadFile(e,{file:n},i,a,s).then(r).catch(o),()=>a.abort()}const UA=6;function HA(t){const{fileRepository:e,datasetPersistentId:n,checksumAlgorithm:r,addFile:o,updateFile:i,getFileByKey:s,addUploadingToCancel:a,removeUploadingToCancel:l,onFileSkipped:c,validateBeforeUpload:d}=t,u=g.useRef(new fy(UA)),p=g.useCallback(x=>{l(Re.getFileKey(x)),u.current.release(1)},[l]),f=g.useCallback(async x=>{const k=Re.getFileKey(x);try{if(r===Or.NONE)i(k,{checksumValue:""});else{const O=await Re.getChecksum(x,r);i(k,{checksumValue:O})}}finally{l(k),u.current.release(1)}},[r,i,l]),h=g.useCallback(async x=>{if(Re.isDS_StoreFile(x)){c?.("ds_store",x);return}const k=Re.getFileKey(x);if(s(k)){c?.("already_uploaded",x);return}if(d&&!await d(x))return;await u.current.acquire(1),o(x);const O=Zp(e,n,x,()=>{i(k,{status:ct.DONE}),f(x)},()=>{i(k,{status:ct.FAILED}),p(x)},C=>i(k,{progress:C}),C=>i(k,{storageId:C}));a(k,O)},[e,n,o,i,s,a,f,p,c,d]),m=g.useCallback(x=>{const k=x.createReader(),O=()=>{k.readEntries(C=>{C.length!==0&&(C.forEach(N=>{N.isFile?N.file(S=>{const R=new File([S],S.name,{type:S.type,lastModified:S.lastModified});Object.defineProperty(R,"webkitRelativePath",{value:N.fullPath?.startsWith("/")?N.fullPath.slice(1):N.fullPath??"",writable:!0}),h(R)}):N.isDirectory&&m(N)}),O())})};O()},[h]),y=g.useCallback((x,k)=>{let O=!1;Array.from(x).forEach(C=>{const N=C.webkitGetAsEntry();N?.isDirectory?(O=!0,m(N)):N?.isFile&&(O=!0,N.file(S=>{const R=new File([S],S.name,{type:S.type,lastModified:S.lastModified});Object.defineProperty(R,"webkitRelativePath",{value:N.fullPath?.startsWith("/")?N.fullPath.slice(1):N.fullPath??"",writable:!0}),h(R)}))}),!O&&k&&k.length>0&&Array.from(k).forEach(C=>{h(C)})},[m,h]),b=g.useCallback(async x=>{const k=Re.getFileKey(x);i(k,{status:ct.UPLOADING,progress:0}),await u.current.acquire(1);const O=Zp(e,n,x,()=>{i(k,{status:ct.DONE}),f(x)},()=>{i(k,{status:ct.FAILED}),p(x)},C=>i(k,{progress:C}),C=>i(k,{storageId:C}));a(k,O)},[e,n,i,a,f,p]);return{uploadOneFile:h,addFromDir:m,handleDroppedItems:y,retryUpload:b,semaphore:u.current}}const KA=hy(my),WA={buttonsStyling:!1,reverseButtons:!0,customClass:{popup:"swal-popup-custom",title:"swal-title-custom",htmlContainer:"swal-html-container-custom",actions:"swal-actions-custom",confirmButton:"btn btn-primary",denyButton:"btn btn-secondary",cancelButton:"btn btn-secondary"}},GA=KA.mixin(WA),qA="_helper_text_kqrvg_26",JA="_file_uploader_drop_zone_kqrvg_31",XA="_is_dragging_kqrvg_38",YA="_drag_drop_msg_kqrvg_43",ZA="_uploading_files_list_kqrvg_50",QA="_uploading_file_kqrvg_50",eM="_info_progress_wrapper_kqrvg_70",tM="_info_kqrvg_70",nM="_upload_progress_kqrvg_90",rM="_failed_message_kqrvg_93",oM="_failed_kqrvg_93",iM="_file_type_different_msg_kqrvg_131",it={helper_text:qA,file_uploader_drop_zone:JA,is_dragging:XA,drag_drop_msg:YA,uploading_files_list:ZA,uploading_file:QA,info_progress_wrapper:eM,info:tM,upload_progress:nM,failed_message:rM,failed:oM,file_type_different_msg:iM};async function sM(t,e){return e.getDatasetUploadLimits(t)}g.createContext({user:null,isLoadingUser:!0,sessionError:null,setUser:()=>{},refetchUserSession:()=>Promise.resolve()});const aM="Bearer token is validated, but there is no linked user account.";class lM{constructor(e){Ut(this,"error");this.error=e}getErrorMessage(){return this.error.message}getReason(){const e=this.error.message.match(/Reason was: (.*)/);return e?e[1]:null}getStatusCode(){const e=this.error.message.match(/\[(\d+)\]/);return e?parseInt(e[1]):null}getReasonWithoutStatusCode(){const e=this.getReason();if(!e)return null;const n=this.getStatusCode();return n===null?e:e.replace(`[${n}]`,"").trim()}isBearerTokenValidatedButNoLinkedUserAccountError(){const e=this.getReasonWithoutStatusCode()??this.getErrorMessage();return this.getStatusCode()===403&&e===aM}}function cM(t,e,n=sM){const[r,o]=g.useState({}),[i,s]=g.useState(!0),[a,l]=g.useState(null),c=g.useCallback(async()=>{if(!e){o({}),s(!1),l(null);return}s(!0),l(null);try{const d=await n(t,e);if(Object.keys(d).length===0){o({});return}o({maxFilesAvailableToUploadFormatted:d.numberOfFilesRemaining!==void 0?d.numberOfFilesRemaining.toLocaleString():void 0,storageQuotaRemainingFormatted:d.storageQuotaRemaining!==void 0?new vi(d.storageQuotaRemaining,Wl.BYTES).toString():void 0})}catch(d){if(o({}),d instanceof De.ReadError){const u=new lM(d),p=u.getReasonWithoutStatusCode()??u.getErrorMessage();l(p)}else l("Something went wrong getting the upload limits. Try again later.")}finally{s(!1)}},[t,e,n]);return g.useEffect(()=>{c()},[c]),{uploadLimit:r,isLoadingUploadLimits:i,errorUploadLimits:a,fetchUploadLimits:c}}const dM=1e3,uM=({fileRepository:t,datasetRepository:e,datasetPersistentId:n,fetchUploadLimits:r})=>{const{fileUploaderState:o,addFile:i,removeFile:s,updateFile:a,addUploadingToCancel:l,removeUploadingToCancel:c,getFileByKey:d}=Io(),{config:{operationType:u,originalFile:p,checksumAlgorithm:f},uploadingToCancelMap:h,isSaving:m}=o,{t:y}=$t("shared"),b=g.useRef(null),x=g.useRef(null),[k,O]=g.useState(!1),{uploadLimit:C}=cM(n,e,r),N=Object.keys(o.files).length,M=Object.values(o.files).filter(B=>B.status!==ct.DONE),S=u===bt.ADD_FILES_TO_DATASET?!0:N===0,R=g.useCallback(async B=>u===bt.REPLACE_FILE&&p.metadata.type.value!==B.type&&!await Q(p.metadata.type.value,B.type)?(b.current&&(b.current.value=""),!1):!0,[u,p]),{uploadOneFile:P,handleDroppedItems:D}=HA({fileRepository:t,datasetPersistentId:n,checksumAlgorithm:f,addFile:i,updateFile:a,getFileByKey:d,addUploadingToCancel:l,removeUploadingToCancel:c,validateBeforeUpload:R,onFileSkipped:(B,H)=>{if(B==="ds_store")lt.info(y("fileUploader.fileUploadSkipped.dsStore"));else if(B==="already_uploaded"){const J=d(Re.getFileKey(H));J&<.info(y("fileUploader.fileUploadSkipped.alreadyUploaded",{fileName:J.fileName}))}}}),L=B=>{const H=Array.from(B.target.files||[]);if(H&&H.length>0)for(const J of H)P(J);b.current&&(b.current.value="")},V=B=>{const H=Array.from(B.target.files||[]);if(H&&H.length>0)for(const J of H)P(J);x.current&&(x.current.value="")},K=B=>{if(B.preventDefault(),B.stopPropagation(),O(!1),m)return;if(u===bt.REPLACE_FILE&&N>0){lt.error(y("fileUploader.replaceFileAlreadyOneFileError"));return}const H=B.dataTransfer.items,J=B.dataTransfer.files;if(H.length>0){if(u===bt.REPLACE_FILE&&H.length>1){lt.error(y("fileUploader.replaceFileMultipleError"));return}D(H,J)}},W=(B,H)=>{const J=h.get(B);J&&(J(),lt.info(`Upload canceled - ${H}`)),c(B),s(B)},Q=async(B,H)=>(await GA.fire({titleText:y("fileUploader.fileTypeDifferentModal.title"),showDenyButton:!0,denyButtonText:y("cancel"),confirmButtonText:y("continue"),html:T.jsxs("div",{className:it.file_type_different_msg,children:[T.jsx(gy,{size:24}),T.jsx("span",{children:y("fileUploader.fileTypeDifferentModal.message",{originalFileType:_n[B]??y("unknown"),replacementFileType:_n[H]??y("unknown")})})]}),allowOutsideClick:!1,allowEscapeKey:!1})).isConfirmed;return T.jsx("div",{children:T.jsx(Qo,{defaultActiveKey:"0",children:T.jsxs(Qo.Item,{eventKey:"0",children:[T.jsx(Qo.Header,{children:y("fileUploader.accordionTitle")}),T.jsxs(Qo.Body,{children:[T.jsxs("p",{className:it.helper_text,children:[y("fileUploader.uploadWidgetHelp",{maxFilesPerUpload:dM.toLocaleString()}),C.maxFilesAvailableToUploadFormatted&&T.jsxs(T.Fragment,{children:[" ",y("fileUploader.uploadWidgetMaxFilesHelp",{maxFilesAvailableToUpload:C.maxFilesAvailableToUploadFormatted})]}),C.storageQuotaRemainingFormatted&&T.jsxs(T.Fragment,{children:[" ",y("fileUploader.uploadWidgetStorageQuotaHelp",{storageQuotaRemaining:C.storageQuotaRemainingFormatted})]})]}),T.jsxs(xr,{children:[T.jsxs(xr.Header,{children:[T.jsxs(se,{onClick:()=>b.current?.click(),disabled:!S||m,size:"sm",children:[T.jsx(Ud,{size:22})," ",u===bt.ADD_FILES_TO_DATASET?y("fileUploader.selectFileMultiple"):y("fileUploader.selectFileSingle")]}),u===bt.ADD_FILES_TO_DATASET&&T.jsxs(se,{onClick:()=>x.current?.click(),disabled:!S||m,size:"sm",className:"ms-2",children:[T.jsx(Ud,{size:22})," ",y("fileUploader.selectFolder")]})]}),T.jsx(xr.Body,{children:T.jsxs("div",{className:Hd(it.file_uploader_drop_zone,{[it.is_dragging]:k}),onDrop:K,onDragOver:B=>{B.preventDefault(),O(!0)},onDragEnter:()=>O(!0),onDragLeave:()=>O(!1),"data-testid":"file-uploader-drop-zone",children:[T.jsx("input",{ref:b,type:"file",onChange:L,multiple:u===bt.ADD_FILES_TO_DATASET,hidden:!0,disabled:!S||m}),T.jsx("input",{ref:x,type:"file",onChange:V,webkitdirectory:"",hidden:!0,disabled:!S||m}),M.length>0?T.jsx("ul",{className:it.uploading_files_list,children:M.map(B=>T.jsxs("li",{className:Hd(it.uploading_file,{[it.failed]:B.status===ct.FAILED}),children:[T.jsxs("div",{className:it.info_progress_wrapper,children:[T.jsxs("p",{className:it.info,children:[T.jsx("span",{children:B.fileDir?`${B.fileDir}/${B.fileName}`:B.fileName}),T.jsx("small",{children:B.fileSizeString})]}),B.status===ct.UPLOADING&&T.jsx("div",{className:it.upload_progress,children:T.jsx($E,{now:B.progress})}),B.status===ct.FAILED&&T.jsx("p",{className:it.failed_message,children:y("fileUploader.uploadFailed")})]}),T.jsx(se,{variant:"secondary",size:"sm",onClick:()=>W(B.key,B.fileName),children:T.jsx(yy,{title:y("fileUploader.cancelUpload")})})]},B.key))}):T.jsx("p",{className:it.drag_drop_msg,children:u===bt.ADD_FILES_TO_DATASET?y("fileUploader.dragDropMultiple"):y("fileUploader.dragDropSingle")})]})})]})]})]})})})},pM=g.memo(uM);function ay({indeterminate:t,...e}){const n=g.useRef(null);return g.useEffect(()=>{typeof t=="boolean"&&n.current&&(n.current.indeterminate=!e.checked&&t)},[n,t,e.checked]),T.jsx("input",{type:"checkbox","aria-label":"Select row",ref:n,...e})}function fM(t,e,n){return t.replace(e,n)}class ly{static toUploadedFileDTO(e,n,r,o,i,s,a,l,c,d){return{fileName:e,description:n,directoryLabel:r,categories:o,restrict:i,storageId:s,checksumValue:a,checksumType:l,mimeType:c===""?"application/octet-stream":c,...d&&{forceReplace:!0}}}}class cy{constructor(e){Ut(this,"error");this.error=e}getErrorMessage(){return this.error.message}getReason(){const e=this.error.message.match(/Reason was: (.*)/);return e?e[1]:null}getStatusCode(){const e=this.error.message.match(/\[(\d+)\]/);return e?parseInt(e[1]):null}getReasonWithoutStatusCode(){const e=this.getReason();if(!e)return null;const n=this.getStatusCode();return n===null?e:e.replace(`[${n}]`,"").trim()}}function hM(t){return"replace"in t&&typeof t.replace=="function"}const mM=t=>{const{setIsSaving:e,setReplaceOperationInfo:n,removeAllFiles:r}=Io(),{t:o}=$t("shared");return{submitReplaceFile:async(s,a)=>{if(!hM(t)){lt.error("File replacement is not supported in standalone mode");return}e(!0);const l=ly.toUploadedFileDTO(a.fileName,a.description,a.fileDir,a.tags,a.restricted,a.storageId,a.checksumValue,a.checksumAlgorithm,a.fileType,!0);try{const c=await fM(t,s,l);r(),n({success:!0,newFileIdentifier:c})}catch(c){if(c instanceof De.WriteError){const d=new cy(c),u=d.getReasonWithoutStatusCode()??d.getErrorMessage();lt.error(u)}else lt.error(o("fileUploader.defaultFileReplaceError"))}finally{e(!1)}}}};function gM(t,e,n){return t.addUploadedFiles(e,n)}const yM=(t,e)=>{const{setIsSaving:n,setAddFilesToDatasetOperationInfo:r,removeAllFiles:o}=Io(),{t:i}=$t("shared");return{submitUploadedFilesToDataset:async a=>{n(!0);const l=a.map(c=>ly.toUploadedFileDTO(c.fileName,c.description,c.fileDir,c.tags,c.restricted,c.storageId,c.checksumValue,c.checksumAlgorithm,c.fileType));try{await gM(t,e,l),o(),r({success:!0})}catch(c){if(c instanceof De.WriteError){const d=new cy(c),u=d.getReasonWithoutStatusCode()??d.getErrorMessage();lt.error(u)}else lt.error(i("fileUploader.defaultAddUploadedFilesToDatasetError"))}finally{n(!1)}}}},vM={"application/pdf":w.DOCUMENT,"image/pdf":w.DOCUMENT,"text/pdf":w.DOCUMENT,"application/x-pdf":w.DOCUMENT,"application/cnt":w.DOCUMENT,"application/msword":w.DOCUMENT,"application/vnd.ms-excel":w.DOCUMENT,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":w.DOCUMENT,"application/vnd.ms-powerpoint":w.DOCUMENT,"application/vnd.openxmlformats-officedocument.presentationml.presentation":w.DOCUMENT,"application/vnd.openxmlformats-officedocument.wordprocessingml.document":w.DOCUMENT,"application/vnd.oasis.opendocument.spreadsheet":w.DOCUMENT,"application/vnd.ms-excel.sheet.macroenabled.12":w.DOCUMENT,"text/plain":w.DOCUMENT,"text/x-log":w.DOCUMENT,"text/html":w.DOCUMENT,"application/x-tex":w.DOCUMENT,"text/x-tex":w.DOCUMENT,"text/markdown":w.DOCUMENT,"text/x-markdown":w.DOCUMENT,"text/x-r-markdown":w.DOCUMENT,"text/x-rst":w.DOCUMENT,"application/rtf":w.DOCUMENT,"text/rtf":w.DOCUMENT,"text/richtext":w.DOCUMENT,"text/turtle":w.DOCUMENT,"application/xml":w.DOCUMENT,"text/xml":w.DOCUMENT,"text/x-c":w.CODE,"text/x-c++src":w.CODE,"text/css":w.CODE,"text/x-objcsrc":w.CODE,"application/java-vm":w.CODE,"text/x-java-source":w.CODE,"text/javascript":w.CODE,"application/javascript":w.CODE,"application/x-javascript":w.CODE,"text/x-perl-script":w.CODE,"text/x-matlab":w.CODE,"text/x-mathematica":w.CODE,"text/php":w.CODE,"text/x-fortran":w.CODE,"text/x-pascal":w.CODE,"text/x-python":w.CODE,"text/x-python-script":w.CODE,"text/x-r-source":w.CODE,"text/x-sh":w.CODE,"application/x-sh":w.CODE,"application/x-shellscript":w.CODE,"application/x-sql":w.CODE,"text/x-sql":w.CODE,"application/x-swc":w.CODE,"application/x-msdownload":w.CODE,"application/x-ipynb+json":w.CODE,"application/x-stata-do":w.CODE,"text/x-stata-syntax":w.CODE,"application/x-stata-syntax":w.CODE,"text/x-spss-syntax":w.CODE,"application/x-spss-syntax":w.CODE,"text/x-sas-syntax":w.CODE,"application/x-sas-syntax":w.CODE,"type/x-r-syntax":w.CODE,"application/postscript":w.CODE,"application/vnd.wolfram.mathematica.package":w.CODE,"application/vnd.wolfram.mathematica":w.CODE,"text/x-workflow-description-language":w.CODE,"text/x-computational-workflow-language":w.CODE,"text/x-nextflow":w.CODE,"text/x-r-notebook":w.CODE,"text/x-ruby-script":w.CODE,"text/x-dagman":w.CODE,"text/x-makefile":w.CODE,"text/x-snakemake":w.CODE,"application/x-docker-file":w.CODE,"application/x-vagrant-file":w.CODE,"text/tab-separated-values":w.TABULAR,"text/tsv":w.TABULAR,"text/comma-separated-values":w.TABULAR,"text/x-comma-separated-values":w.TABULAR,"text/csv":w.TABULAR,"text/x-vcard":w.TABULAR,"text/x-fixed-field":w.TABULAR,"application/x-rlang-transport":w.TABULAR,"application/x-R-2":w.TABULAR,"application/x-stata":w.TABULAR,"application/x-stata-6":w.TABULAR,"application/x-stata-13":w.TABULAR,"application/x-stata-14":w.TABULAR,"application/x-stata-15":w.TABULAR,"application/x-stata-ado":w.TABULAR,"application/x-stata-dta":w.TABULAR,"application/x-stata-smcl":w.TABULAR,"application/x-spss-por":w.TABULAR,"application/x-spss-portable":w.TABULAR,"application/x-spss-sav":w.TABULAR,"application/x-spss-sps":w.TABULAR,"application/x-sas":w.TABULAR,"application/x-sas-transport":w.TABULAR,"application/x-sas-system":w.TABULAR,"application/x-sas-data":w.TABULAR,"application/x-sas-catalog":w.TABULAR,"application/x-sas-log":w.TABULAR,"application/x-sas-output":w.TABULAR,"application/x-r-data":w.TABULAR,"application/softgrid-do":w.TABULAR,"application/x-dvn-csvspss-zip":w.TABULAR,"application/x-dvn-tabddi-zip":w.TABULAR,"application/x-emf":w.TABULAR,"application/x-h5":w.TABULAR,"application/x-hdf":w.TABULAR,"application/x-hdf5":w.TABULAR,"application/geo+json":w.TABULAR,"application/json":w.TABULAR,"application/mathematica":w.TABULAR,"application/matlab-mat":w.TABULAR,"application/x-matlab-data":w.TABULAR,"application/x-matlab-figure":w.TABULAR,"application/x-matlab-workspace":w.TABULAR,"application/x-xfig":w.TABULAR,"application/x-msaccess":w.TABULAR,"application/netcdf":w.TABULAR,"application/x-netcdf":w.TABULAR,"application/vnd.lotus-notes":w.TABULAR,"application/x-nsdstat":w.TABULAR,"application/vnd.flographit":w.TABULAR,"application/vnd.realvnc.bed":w.TABULAR,"application/vnd.ms-pki.stl":w.TABULAR,"application/vnd.isac.fcs":w.TABULAR,"application/java-serialized-object":w.TABULAR,"chemical/x-xyz":w.TABULAR,"image/fits":w.FILE,"application/fits":w.FILE,"application/dbf":w.FILE,"application/dbase":w.FILE,"application/prj":w.FILE,"application/sbn":w.FILE,"application/sbx":w.FILE,"application/shp":w.FILE,"application/shx":w.FILE,"application/x-esri-shape":w.FILE,"application/vnd.google-earth.kml+xml":w.FILE,"application/zipped-shapefile":w.FILE,"application/zip":w.PACKAGE,"application/x-zip-compressed":w.PACKAGE,"application/vnd.antix.game-component":w.PACKAGE,"application/x-bzip":w.PACKAGE,"application/x-bzip2":w.PACKAGE,"application/vnd.google-earth.kmz":w.PACKAGE,"application/gzip":w.PACKAGE,"application/x-gzip":w.PACKAGE,"application/x-gzip-compressed":w.PACKAGE,"application/rar":w.PACKAGE,"application/x-rar":w.PACKAGE,"application/x-rar-compressed":w.PACKAGE,"application/tar":w.PACKAGE,"application/x-tar":w.PACKAGE,"application/x-compressed":w.PACKAGE,"application/x-compressed-tar":w.PACKAGE,"application/x-7z-compressed":w.PACKAGE,"application/x-xz":w.PACKAGE,"application/warc":w.PACKAGE,"application/x-iso9660-image":w.PACKAGE,"application/vnd.eln+zip":w.PACKAGE,"image/gif":w.IMAGE,"image/jpeg":w.IMAGE,"image/jp2":w.IMAGE,"image/x-portable-bitmap":w.IMAGE,"image/x-portable-graymap":w.IMAGE,"image/png":w.IMAGE,"image/x-portable-anymap":w.IMAGE,"image/x-portable-pixmap":w.IMAGE,"application/x-msmetafile":w.IMAGE,"application/dicom":w.IMAGE,"image/dicom-rle":w.IMAGE,"image/nii":w.IMAGE,"image/cmu-raster":w.IMAGE,"image/x-rgb":w.IMAGE,"image/svg+xml":w.IMAGE,"image/tiff":w.IMAGE,"image/bmp":w.IMAGE,"image/x-xbitmap":w.IMAGE,"image/RAW":w.IMAGE,"image/raw":w.IMAGE,"application/x-tgif":w.IMAGE,"image/x-xpixmap":w.IMAGE,"image/x-xwindowdump":w.IMAGE,"application/photoshop":w.IMAGE,"image/vnd.adobe.photoshop":w.IMAGE,"application/x-photoshop":w.IMAGE,"image/webp":w.IMAGE,"audio/x-aiff":w.AUDIO,"audio/mp3":w.AUDIO,"audio/mpeg":w.AUDIO,"audio/mp4":w.AUDIO,"audio/x-m4a":w.AUDIO,"audio/ogg":w.AUDIO,"audio/wav":w.AUDIO,"audio/x-wav":w.AUDIO,"audio/x-wave":w.AUDIO,"video/avi":w.VIDEO,"video/x-msvideo":w.VIDEO,"video/mpeg":w.VIDEO,"video/mp4":w.VIDEO,"video/x-m4v":w.VIDEO,"video/ogg":w.VIDEO,"video/quicktime":w.VIDEO,"video/webm":w.VIDEO,"text/xml-graphml":w.NETWORK,"application/octet-stream":w.FILE,"application/vnd.dataverse.file-package":w.TABULAR,default:w.FILE},bM=({itemIndex:t,defaultValue:e})=>{const{control:n}=Hl(),{t:r}=$t("shared"),o={required:r("fileMetadataForm.fields.fileName.required"),validate:(i,s)=>{const a=s.files[t];return Re.isValidFileName(i)?Re.isUniqueCombinationOfFilepathAndFilename({fileName:i,filePath:a.fileDir,fileKey:a.key,allFiles:s.files})?!0:r("fileMetadataForm.fields.fileName.invalid.duplicateCombination",{fileName:i}):r("fileMetadataForm.fields.fileName.invalid.characters")},maxLength:{value:255,message:r("fileMetadataForm.fields.fileName.invalid.maxLength",{maxLength:255})}};return T.jsxs(oe.Group,{controlId:`files.${t}.fileName`,as:or,children:[T.jsx(oe.Group.Label,{required:!0,column:!0,lg:2,children:r("fileMetadataForm.fields.fileName.label")}),T.jsx(ze,{lg:10,children:T.jsx(Kl,{name:`files.${t}.fileName`,control:n,defaultValue:e,rules:o,render:({field:{onChange:i,ref:s,value:a},fieldState:{invalid:l,error:c}})=>T.jsxs(T.Fragment,{children:[T.jsx(oe.Group.Input,{type:"text",value:a,onChange:i,isInvalid:l,"aria-required":!0,ref:s}),T.jsx(oe.Group.Feedback,{type:"invalid",children:c?.message})]})})})]})},xM=({itemIndex:t,defaultValue:e})=>{const{control:n}=Hl(),{t:r}=$t("shared"),o={validate:(i,s)=>{const a=s.files[t];return Re.isValidFilePath(i)?Re.isUniqueCombinationOfFilepathAndFilename({fileName:a.fileName,filePath:i,fileKey:a.key,allFiles:s.files})?!0:r("fileMetadataForm.fields.filePath.invalid.duplicateCombination",{fileName:i}):r("fileMetadataForm.fields.filePath.invalid.characters")},maxLength:{value:255,message:r("fileMetadataForm.fields.filePath.invalid.maxLength",{maxLength:255})}};return T.jsxs(oe.Group,{controlId:`files.${t}.fileDir`,as:or,children:[T.jsx(oe.Group.Label,{message:r("fileMetadataForm.fields.filePath.description"),column:!0,lg:2,children:r("fileMetadataForm.fields.filePath.label")}),T.jsx(ze,{lg:10,children:T.jsx(Kl,{name:`files.${t}.fileDir`,control:n,rules:o,render:({field:{onChange:i,ref:s,value:a},fieldState:{invalid:l,error:c}})=>T.jsxs(T.Fragment,{children:[T.jsx(oe.Group.Input,{type:"text",defaultValue:e,value:a,onChange:i,isInvalid:l,ref:s}),T.jsx(oe.Group.Feedback,{type:"invalid",children:c?.message})]})})})]})},wM=({itemIndex:t,defaultValue:e})=>{const{control:n}=Hl(),{t:r}=$t("shared"),o={maxLength:{value:255,message:r("fileMetadataForm.fields.description.invalid.maxLength",{maxLength:255})}};return T.jsxs(oe.Group,{controlId:`files.${t}.description`,as:or,children:[T.jsx(oe.Group.Label,{column:!0,lg:2,children:r("fileMetadataForm.fields.description.label")}),T.jsx(ze,{lg:10,children:T.jsx(Kl,{name:`files.${t}.description`,control:n,defaultValue:e,rules:o,render:({field:{onChange:i,ref:s,value:a},fieldState:{invalid:l,error:c}})=>T.jsxs(T.Fragment,{children:[T.jsx(oe.Group.TextArea,{value:a,onChange:i,isInvalid:l,rows:2,ref:s}),T.jsx(oe.Group.Feedback,{type:"invalid",children:c?.message})]})})})]})},EM="_icon_fields_wrapper_rs58e_37",kM="_icon_rs58e_37",OM="_form_fields_rs58e_58",CM="_file_extra_info_rs58e_68",SM="_remove_button_rs58e_80",Jr={icon_fields_wrapper:EM,icon:kM,form_fields:OM,file_extra_info:CM,remove_button:SM},NM=({file:t,isSelected:e,handleSelectFile:n,handleRemoveFile:r,itemIndex:o,isSaving:i})=>{const{t:s}=$t("shared"),a=vM[t.fileType]||w.OTHER;return T.jsxs("tr",{children:[T.jsx("th",{colSpan:1,children:T.jsx(ay,{checked:e,onChange:()=>n(t.key)})}),T.jsx("td",{colSpan:2,children:T.jsxs("div",{className:Jr.icon_fields_wrapper,children:[T.jsx("div",{className:Jr.icon,children:T.jsx(Hc,{name:a})}),T.jsxs("div",{className:Jr.form_fields,children:[T.jsx(bM,{itemIndex:o}),T.jsx(xM,{itemIndex:o}),T.jsx(wM,{itemIndex:o}),T.jsxs("div",{className:Jr.file_extra_info,children:[T.jsx(vy,{}),T.jsx("span",{children:t.fileSizeString}),"-",T.jsx("span",{children:_n[t.fileType]}),"-",T.jsxs("span",{children:[T.jsxs("i",{children:[t.checksumAlgorithm,":"]})," ",t.checksumValue]})]})]}),T.jsx("div",{children:T.jsx(VE,{type:"button",className:Jr.remove_button,onClick:()=>{r(o,t.key)},"aria-label":s("fileUploader.uploadedFilesList.removeFile"),disabled:i})})]})})]})},TM="_table_wrapper_e3j9i_26",AM="_edit_dropdown_e3j9i_78",MM="_edit_dropdown_icon_e3j9i_83",DM="_btns_container_e3j9i_119",Xr={table_wrapper:TM,edit_dropdown:AM,edit_dropdown_icon:MM,btns_container:DM},jM=({fileRepository:t,datasetPersistentId:e,onCancel:n})=>{const{t:r}=$t("shared"),{fileUploaderState:{files:o,isSaving:i,config:{operationType:s,originalFile:a}},uploadedFiles:l,removeFile:c}=Io(),d=g.useMemo(()=>Object.values(o).some(D=>D.status===ct.UPLOADING),[o]),{submitReplaceFile:u}=mM(t),{submitUploadedFilesToDataset:p}=yM(t,e),[f,h]=g.useState([]),m=f.length===l.length,y=f.length>0&&f.length{h(L=>L.includes(D)?L.filter(V=>V!==D):[...L,D])},x=()=>{f.length===l.length?h([]):h(l.map(D=>D.key))},k=by({mode:"onChange"}),{fields:O,remove:C}=xy({control:k.control,name:"files"});tf(()=>{const D=k.getValues("files"),L=l.filter(V=>!D.some(K=>K.key===V.key));k.setValue("files",[...D,...L],{shouldValidate:!0})},[k,l]);const N=D=>{bt.REPLACE_FILE===s&&u(a.id,D.files[0]),bt.ADD_FILES_TO_DATASET===s&&p(D.files)},M=(D,L)=>{C(D),c(L)},S=()=>{const D=O.filter(L=>!f.includes(L.key));k.setValue("files",D),h([]),f.forEach(L=>{c(L)})},R=()=>n(),P=D=>{if(D.key!=="Enter")return;const V=D.target instanceof HTMLButtonElement?D.target.type==="submit":!1,K=D.target instanceof HTMLTextAreaElement;V||K||D.preventDefault()};return T.jsx(wy,{...k,children:T.jsx("form",{onSubmit:k.handleSubmit(N),onKeyDown:P,noValidate:!0,"data-testid":"uploaded-files-list-form",children:T.jsx(ul,{children:T.jsx("div",{className:Xr.table_wrapper,children:T.jsxs(LE,{children:[T.jsx("thead",{children:T.jsxs("tr",{children:[T.jsx("th",{scope:"col",colSpan:1,children:T.jsx("div",{children:T.jsx(ay,{checked:m,indeterminate:y,onChange:x,disabled:i,"aria-label":r(m?"fileUploader.uploadedFilesList.deselectAllFiles":"fileUploader.uploadedFilesList.selectAllFiles")})})}),T.jsx("th",{scope:"col",colSpan:1,children:`${l.length} ${l.length>1?r("fileUploader.uploadedFilesList.uploadedFiles"):r("fileUploader.uploadedFilesList.uploadedFile")}`}),T.jsx("th",{scope:"col",colSpan:1,children:T.jsx("div",{className:Xr.edit_dropdown,children:T.jsx(l1,{id:"edit-selected-files-menu",icon:T.jsx(Ey,{className:Xr.edit_dropdown_icon}),title:"Edit",ariaLabel:r("fileUploader.uploadedFilesList.editSelectedFiles"),variant:"secondary",disabled:f.length===0||i,children:T.jsx(c1,{onClick:S,children:r("fileUploader.uploadedFilesList.removeSelectedFiles")})})})})]})}),T.jsx("tbody",{className:Xr.table_body,children:O.map((D,L)=>T.jsx(NM,{file:D,isSelected:f.includes(D.key),handleSelectFile:b,handleRemoveFile:M,itemIndex:L,isSaving:i},D.id))}),T.jsx("tfoot",{children:T.jsx("tr",{children:T.jsx("td",{colSpan:3,children:T.jsxs("div",{className:Xr.btns_container,children:[T.jsx(se,{type:"button",onClick:R,disabled:i,variant:"secondary",children:r("cancel")}),T.jsx(se,{type:"submit",disabled:i||d,children:T.jsxs(ul,{direction:"horizontal",gap:1,children:[r("saveChanges"),i&&T.jsx(sm,{variant:"light",animation:"border",size:"sm"})]})})]})})})})]})})})})})},tD=({fileRepository:t,datasetRepository:e,datasetPersistentId:n,fetchUploadLimits:r,onCancel:o})=>{const{t:i}=$t("shared"),{fileUploaderState:{replaceOperationInfo:s,addFilesToDatasetOperationInfo:a},uploadedFiles:l}=Io();return tf(()=>{s.success&&s.newFileIdentifier&<.success(i("fileUploader.fileReplacedSuccessfully")),a.success&<.success(i("fileUploader.filesAddedToDatasetSuccessfully"))},[s,a,i]),T.jsxs(ul,{gap:4,children:[T.jsx(pM,{fileRepository:t,datasetRepository:e,datasetPersistentId:n,fetchUploadLimits:r}),l.length>0&&T.jsx(jM,{fileRepository:t,datasetPersistentId:n,onCancel:o})]})};var xt=(t=>(t.ALL="all",t.FOLDERS="folders",t.FILES="files",t))(xt||{}),kr=(t=>(t.NAME_AZ="NameAZ",t.NAME_ZA="NameZA",t))(kr||{}),Ro=(t=>(t.FOLDER="folder",t.FILE="file",t))(Ro||{});const RM=t=>t.type==="folder",IM=t=>t.type==="file";async function nD(t,e){const{datasetPersistentId:n,datasetVersion:r,paths:o,limit:i=500,signal:s}=e,a=[],l=new Set,c=[...o];for(;c.length>0;){if(s?.aborted)throw new Error("Enumeration aborted");const d=c.shift();let u;do{const p=await t.getNode({datasetPersistentId:n,datasetVersion:r,path:d,limit:i,cursor:u});for(const f of p.items)IM(f)?l.has(f.id)||(l.add(f.id),a.push(f)):RM(f)&&c.push(f.path);u=p.nextCursor??void 0}while(u)}return a}class PM{constructor(e=1,n=10,r=0,o="Item"){this.page=e,this.pageSize=n,this.totalItems=r,this.itemName=o}get offset(){return(this.page-1)*this.pageSize}get pageStartItem(){return(this.page-1)*this.pageSize+1}get pageEndItem(){return Math.min(this.pageStartItem+this.pageSize-1,this.totalItems)}withTotal(e){return new this.constructor(this.page,this.pageSize,e)}goToPage(e){return new this.constructor(e,this.pageSize,this.totalItems)}goToPreviousPage(){if(!this.previousPage)throw new Error("No previous page");return this.goToPage(this.previousPage)}goToNextPage(){if(!this.nextPage)throw new Error("No next page");return this.goToPage(this.nextPage)}withPageSize(e){const n=(r,o)=>{const i=Math.ceil(((this.page-1)*r+1)/o);return i>0?i:1};return new this.constructor(n(this.pageSize,e),e,this.totalItems)}get totalPages(){return Math.ceil(this.totalItems/this.pageSize)}get hasPreviousPage(){return this.page>1}get hasNextPage(){return this.page1e3?1e3:Math.floor(t)}function $M(t){if(!t)return 0;if(!t.startsWith(Ul))throw new Error("Invalid cursor");const e=Number.parseInt(t.slice(Ul.length),10);if(!Number.isFinite(e)||e<0)throw new Error("Invalid cursor");return e}function _M(t){return`${Ul}${t}`}function VM(t){return t?t.replace(/\/+/g,"/").replace(/^\/+/,"").replace(/\/+$/,""):""}function UM(t,e,n,r,o){const i=new Map,s=[],a=e===""?"":`${e}/`;for(const c of t){const d=(c.metadata.directory??"").replace(/^\/+|\/+$/g,"");if(e!==""&&d!==e&&!d.startsWith(a))continue;if(d===e){s.push(HM(c,e,o));continue}const p=d.slice(a.length).split("/")[0];if(!p)continue;const f=a+p;let h=i.get(f);if(h||(h={name:p,path:f,fileCount:0,bytes:0,subfolderNames:new Set},i.set(f,h)),h.fileCount+=1,h.bytes+=c.metadata.size?.toBytes()??0,d!==f){const m=d.slice(f.length+1).split("/")[0];m&&h.subfolderNames.add(m)}}const l=Array.from(i.values()).map(c=>({type:Ro.FOLDER,name:c.name,path:c.path,counts:{files:c.fileCount,folders:c.subfolderNames.size,bytes:c.bytes}}));return ef(l,n),ef(s,n),r===xt.FOLDERS?l:r===xt.FILES?s:[...l,...s]}function HM(t,e,n){return{type:Ro.FILE,id:t.id,name:t.name,path:e===""?t.name:`${e}/${t.name}`,size:t.metadata.size.toBytes(),contentType:t.metadata.type.value,access:t.access,checksum:t.metadata.checksum?{type:t.metadata.checksum.algorithm,value:t.metadata.checksum.value}:void 0,downloadUrl:`${n}/${t.id}`}}function ef(t,e){const n=e===kr.NAME_ZA?-1:1;t.sort((r,o)=>n*r.name.localeCompare(o.name,void 0,{sensitivity:"base"}))}class jt{static toFileTreePage(e,n,r){return{path:e.path,items:e.items.map(o=>jt.toFileTreeItem(o)),nextCursor:e.nextCursor,limit:e.limit,order:jt.toFileTreeOrder(e.order,n),include:jt.toFileTreeInclude(e.include,r),approximateCount:e.approximateCount}}static toFileTreeItem(e){if(De.isFileTreeFolderNode(e))return jt.toFileTreeFolder(e);if(De.isFileTreeFileNode(e))return jt.toFileTreeFile(e);throw new Error(`Unknown file tree node type: ${e.type}`)}static toFileTreeFolder(e){return{type:Ro.FOLDER,name:e.name,path:e.path,counts:e.counts}}static toFileTreeFile(e){return{type:Ro.FILE,id:e.id,name:e.name,path:e.path,size:e.size,contentType:e.contentType,access:e.access?{restricted:e.access!=="public",latestVersionRestricted:e.access!=="public",canBeRequested:e.access==="restricted",requested:!1}:void 0,accessStatus:e.access,checksum:e.checksum,downloadUrl:e.downloadUrl}}static toSDKFileTreeOrder(e){if(e!==void 0)return e===kr.NAME_ZA?De.FileTreeOrder.NAME_ZA:De.FileTreeOrder.NAME_AZ}static toSDKFileTreeInclude(e){if(e!==void 0)switch(e){case xt.FOLDERS:return De.FileTreeInclude.FOLDERS;case xt.FILES:return De.FileTreeInclude.FILES;case xt.ALL:default:return De.FileTreeInclude.ALL}}static toFileTreeOrder(e,n){return e===De.FileTreeOrder.NAME_ZA?kr.NAME_ZA:e??n??kr.NAME_AZ}static toFileTreeInclude(e,n){switch(e){case De.FileTreeInclude.FOLDERS:return xt.FOLDERS;case De.FileTreeInclude.FILES:return xt.FILES;case De.FileTreeInclude.ALL:return xt.ALL;default:return n??xt.ALL}}static isEndpointMissing(e){if(e instanceof De.ReadError)return/\[(404|405|501)\]/.test(e.message);const n=e?.response?.status;return n===404||n===405||n===501}}class rD{constructor(e){Ut(this,"fallback");Ut(this,"endpointUnavailable",!1);this.fileRepository=e}async getNode(e){if(this.endpointUnavailable&&this.fallback)return this.fallback.getNode(e);try{const n=await De.listDatasetTreeNode.execute({datasetId:e.datasetPersistentId,datasetVersionId:e.datasetVersion.number.toString(),path:e.path,limit:e.limit,cursor:e.cursor,include:jt.toSDKFileTreeInclude(e.include),order:jt.toSDKFileTreeOrder(e.order),includeDeaccessioned:e.includeDeaccessioned,originals:e.originals});return jt.toFileTreePage(n,e.order,e.include)}catch(n){if(this.fileRepository&&jt.isEndpointMissing(n))return this.endpointUnavailable=!0,this.fallback||(this.fallback=new BM(this.fileRepository)),this.fallback.getNode(e);throw n}}}export{eD as D,tD as F,QM as L,bt as O,VA as Q,_A as R,Or as a,ZM as b,JM as c,kr as d,xt as e,RM as f,nD as g,se as h,IM as i,rD as j,Io as u}; + `;const C=N=>{d.forEach(M=>a.classList.remove(M)),a.classList.add(N),l()};x.addEventListener("click",()=>C(fn.IMAGE_ALIGN_LEFT)),k.addEventListener("click",()=>C(fn.IMAGE_ALIGN_CENTER)),O.addEventListener("click",()=>C(fn.IMAGE_ALIGN_RIGHT)),b.append(x,k,O),s.appendChild(b)};i.setAttribute("style","display: flex;"),i.appendChild(s),s.classList.add("image-resize-container");const d=[fn.IMAGE_ALIGN_LEFT,fn.IMAGE_ALIGN_CENTER,fn.IMAGE_ALIGN_RIGHT],u=d.find(b=>o.includes(b));u&&s.classList.add(u);const p=o.match(/rte-w-(\d+)/);if(p){const b=p[0];s.classList.add(b)}s.appendChild(a),Object.entries(t.attrs).forEach(([b,x])=>{x!=null&&a.setAttribute(b,x)});const f=["top: -4px; left: -4px; cursor: nwse-resize;","top: -4px; right: -4px; cursor: nesw-resize;","bottom: -4px; left: -4px; cursor: nesw-resize;","bottom: -4px; right: -4px; cursor: nwse-resize;"];let h=!1,m,y;return s.addEventListener("click",()=>{if(s.childElementCount>3)for(let b=0;b<5;b++)s.removeChild(s.lastChild);c(),Array.from({length:4},(b,x)=>{const k=document.createElement("div");k.classList.add("resize-dot"),k.setAttribute("style",`position: absolute; ${f[x]}`);const O=C=>{var N;const M=((N=s.parentElement)==null?void 0:N.offsetWidth)||1,S=Math.min(100,Math.max(5,C/M*100)),R=`rte-w-${Math.round(S/5)*5}`;a.classList.forEach(P=>{/^rte-w-\d+$/.test(P)&&a.classList.remove(P)}),s.classList.forEach(P=>{/^rte-w-\d+$/.test(P)&&s.classList.remove(P)}),s.classList.add(R),a.classList.add(R)};k.addEventListener("pointerdown",C=>{C.preventDefault(),h=!0,m=C.clientX,y=s.offsetWidth;const N=S=>{if(!h)return;const R=x%2===0?-(S.clientX-m):S.clientX-m,P=y+R;O(P)},M=()=>{h&&(h=!1),l(),document.removeEventListener("pointermove",N),document.removeEventListener("pointerup",M)};document.addEventListener("pointermove",N),document.addEventListener("pointerup",M)},{passive:!1}),s.appendChild(k)})}),document.addEventListener("click",b=>{const x=b.target;if(!s.contains(x)&&s.childElementCount>3)for(let k=0;k<5;k++)s.removeChild(s.lastChild)}),{dom:i}}}}),vt={placeholder:"Write something …",linkDialog:{title:"Add Link",label:"Link",ok:"OK",cancel:"Cancel"},imageDialog:{title:"Add Image",label:"Image URL",altTextLabel:"Alternative text",altTextPlaceholder:'Describe the image for screen readers (e.g. "Group of young college students in a classroom")',ok:"OK",cancel:"Cancel"}},LA="_selected_h2wq9_37",ee={"editor-actions-wrapper":"_editor-actions-wrapper_h2wq9_26","editor-actions-button":"_editor-actions-button_h2wq9_33",selected:LA,"editor-actions-button-image":"_editor-actions-button-image_h2wq9_41"},He={heading:"heading",bold:"bold",italic:"italic",underline:"underline",strike:"strike",code:"code",codeBlock:"codeBlock",link:"link",blockquote:"blockquote",bulletList:"bulletList",orderedList:"orderedList"},FA=({editor:t,disabled:e,locales:n})=>{var r,o,i,s,a,l,c,d,u,p,f,h,m,y,b,x,k,O,C,N;const[M,S]=g.useState({open:!1,url:""}),[R,P]=g.useState({open:!1,url:"",altText:""}),D=()=>{var G;const ue=(G=t?.getAttributes("link"))==null?void 0:G.href;S({open:!0,url:ue??""})},L=()=>S({open:!1,url:""}),V=()=>{M.url?t?.chain().focus().extendMarkRange(He.link).setLink({href:M.url}).run():t?.chain().focus().extendMarkRange(He.link).unsetLink().run(),L()},K=()=>{var G,ue;const Fn=(G=t?.getAttributes("image"))==null?void 0:G.src,Jo=(ue=t?.getAttributes("image"))==null?void 0:ue.alt;P({open:!0,url:Fn??"",altText:Jo??""})},W=()=>{P({open:!1,url:"",altText:""})},Q=()=>{R.url&&t?.chain().focus().setImage({src:R.url,alt:R.altText}).run(),W()},B=()=>t?.chain().focus().toggleHeading({level:1}).run(),H=!e&&t?.isActive(He.heading,{level:1}),J=()=>t?.chain().focus().toggleHeading({level:2}).run(),be=!e&&t?.isActive(He.heading,{level:2}),Fe=()=>t?.chain().focus().toggleHeading({level:3}).run(),ge=!e&&t?.isActive(He.heading,{level:3}),ye=()=>t?.chain().focus().toggleBold().run(),xe=!e&&t?.isActive(He.bold),te=()=>t?.chain().focus().toggleItalic().run(),Me=!e&&t?.isActive(He.italic),mt=()=>t?.chain().focus().toggleUnderline().run(),Ye=!e&&t?.isActive(He.underline),Ct=()=>t?.chain().focus().toggleStrike().run(),gt=!e&&t?.isActive(He.strike),yt=()=>t?.chain().focus().toggleCode().run(),Vt=!e&&t?.isActive(He.code),St=()=>t?.chain().focus().toggleCodeBlock().run(),nt=!e&&t?.isActive(He.codeBlock),ne=()=>t?.chain().focus().toggleBlockquote().run(),Nt=!e&&t?.isActive(He.blockquote),Tt=()=>t?.chain().focus().toggleBulletList().run(),sr=!e&&t?.isActive(He.bulletList),Ur=()=>t?.chain().focus().toggleOrderedList().run(),rt=!e&&t?.isActive(He.orderedList),an=()=>t?.chain().focus().undo().run(),ar=()=>t?.chain().focus().redo().run(),ln=((r=n?.linkDialog)==null?void 0:r.title)??((o=vt.linkDialog)==null?void 0:o.title),cn=((i=n?.imageDialog)==null?void 0:i.title)??((s=vt.imageDialog)==null?void 0:s.title);return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:ee["editor-actions-wrapper"],children:[v.jsxs(fr,{children:[v.jsx(se,{onClick:B,className:`${ee["editor-actions-button"]} ${H?ee.selected:""}`,"aria-pressed":H,"aria-label":"Heading 1",disabled:e,title:"Heading 1",type:"button",variant:"secondary",size:"sm",icon:v.jsx(nd,{size:18})}),v.jsx(se,{onClick:J,className:`${ee["editor-actions-button"]} ${be?ee.selected:""}`,"aria-pressed":be,"aria-label":"Heading 2",disabled:e,title:"Heading 2",type:"button",variant:"secondary",size:"sm",icon:v.jsx(rd,{size:18})}),v.jsx(se,{onClick:Fe,className:`${ee["editor-actions-button"]} ${ge?ee.selected:""}`,"aria-pressed":ge,"aria-label":"Heading 3",disabled:e,title:"Heading 3",type:"button",variant:"secondary",size:"sm",icon:v.jsx(od,{size:18})})]}),v.jsxs(fr,{children:[v.jsx(se,{onClick:ye,className:`${ee["editor-actions-button"]} ${xe?ee.selected:""}`,"aria-pressed":xe,"aria-label":"Bold",disabled:e,title:"Bold",type:"button",variant:"secondary",size:"sm",icon:v.jsx(td,{size:18})}),v.jsx(se,{onClick:te,className:`${ee["editor-actions-button"]} ${Me?ee.selected:""}`,"aria-pressed":Me,"aria-label":"Italic",disabled:e,title:"Italic",type:"button",variant:"secondary",size:"sm",icon:v.jsx(id,{size:18})}),v.jsx(se,{onClick:mt,className:`${ee["editor-actions-button"]} ${Ye?ee.selected:""}`,"aria-pressed":Ye,"aria-label":"Underline",disabled:e,title:"Underline",type:"button",variant:"secondary",size:"sm",icon:v.jsx(ad,{size:18})}),v.jsx(se,{onClick:Ct,className:`${ee["editor-actions-button"]} ${gt?ee.selected:""}`,"aria-pressed":gt,"aria-label":"Strikethrough",disabled:e,title:"Strikethrough",type:"button",variant:"secondary",size:"sm",icon:v.jsx(sd,{size:18})})]}),v.jsxs(fr,{children:[v.jsx(se,{onClick:Tt,className:`${ee["editor-actions-button"]} ${sr?ee.selected:""}`,"aria-pressed":sr,"aria-label":"Unordered list",disabled:e,title:"Unordered list",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Qc,{size:18})}),v.jsx(se,{onClick:Ur,className:`${ee["editor-actions-button"]} ${rt?ee.selected:""}`,"aria-pressed":rt,"aria-label":"Ordered list",disabled:e,title:"Ordered list",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Zc,{size:18})})]}),v.jsxs(fr,{children:[v.jsx(se,{onClick:D,className:`${ee["editor-actions-button"]}`,"aria-label":"Add link",disabled:e,title:"Add link",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Yc,{size:18})}),v.jsx(se,{onClick:yt,className:`${ee["editor-actions-button"]} ${Vt?ee.selected:""}`,"aria-pressed":Vt,"aria-label":"Code",disabled:e,title:"Code",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Jc,{size:18})}),v.jsx(se,{onClick:St,className:`${ee["editor-actions-button"]} ${nt?ee.selected:""}`,"aria-pressed":nt,"aria-label":"Code block",disabled:e,title:"Code block",type:"button",variant:"secondary",size:"sm",icon:v.jsx(qc,{size:18})}),v.jsx(se,{onClick:ne,className:`${ee["editor-actions-button"]} ${Nt?ee.selected:""}`,"aria-pressed":Nt,"aria-label":"Blockquote",title:"Blockquote",type:"button",disabled:e,variant:"secondary",size:"sm",icon:v.jsx(Gc,{size:18})}),v.jsx(se,{onClick:K,className:`${ee["editor-actions-button"]} ${ee["editor-actions-button-image"]}`,"aria-label":"Add image",title:"Add image",type:"button",disabled:e,variant:"secondary",size:"sm",icon:v.jsx(Xc,{size:18})})]}),v.jsxs(fr,{children:[v.jsx(se,{onClick:an,className:`${ee["editor-actions-button"]}`,"aria-label":"Undo",disabled:e||!(t!=null&&t.can().undo()),title:"Undo",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Kc,{size:18})}),v.jsx(se,{onClick:ar,className:`${ee["editor-actions-button"]}`,"aria-label":"Redo",disabled:e||!(t!=null&&t.can().redo()),title:"Redo",type:"button",variant:"secondary",size:"sm",icon:v.jsx(Wc,{size:18})})]})]}),v.jsxs(Ke,{show:M.open,onHide:L,size:"lg",ariaLabel:ln,children:[v.jsx(Ke.Header,{children:v.jsx(Ke.Title,{children:ln})}),v.jsx(Ke.Body,{children:v.jsxs(oe.Group,{controlId:"link-url",as:ze,children:[v.jsx(oe.Group.Label,{column:!0,children:((a=n?.linkDialog)==null?void 0:a.label)??((l=vt.linkDialog)==null?void 0:l.label)}),v.jsx(ze,{children:v.jsx(oe.Group.Input,{type:"text",value:M.url,autoFocus:!0,autoComplete:"off",onChange:G=>S(ue=>({...ue,url:G.target.value}))})})]})}),v.jsxs(Ke.Footer,{children:[v.jsx(se,{onClick:V,variant:"primary",type:"button",children:((c=n?.linkDialog)==null?void 0:c.ok)??((d=vt.linkDialog)==null?void 0:d.ok)}),v.jsx(se,{onClick:L,variant:"secondary",type:"button",children:((u=n?.linkDialog)==null?void 0:u.cancel)??((p=vt.linkDialog)==null?void 0:p.cancel)})]})]}),v.jsxs(Ke,{show:R.open,onHide:W,size:"lg",ariaLabel:cn,children:[v.jsx(Ke.Header,{children:v.jsx(Ke.Title,{children:cn})}),v.jsxs(Ke.Body,{children:[v.jsxs(oe.Group,{controlId:"image-url",as:ze,children:[v.jsx(oe.Group.Label,{column:!0,children:((f=n?.imageDialog)==null?void 0:f.label)??((h=vt.imageDialog)==null?void 0:h.label)}),v.jsx(ze,{children:v.jsx(oe.Group.Input,{type:"text",autoFocus:!0,autoComplete:"off",placeholder:"https://example.com/image.png",value:R.url,onChange:G=>P(ue=>({...ue,url:G.target.value}))})})]}),v.jsxs(oe.Group,{controlId:"image-alt-text",as:ze,children:[v.jsx(oe.Group.Label,{column:!0,children:((m=n?.imageDialog)==null?void 0:m.altTextLabel)??((y=vt.imageDialog)==null?void 0:y.altTextLabel)}),v.jsx(ze,{children:v.jsx(oe.Group.Input,{type:"text",value:R.altText,autoComplete:"off",placeholder:((b=n?.imageDialog)==null?void 0:b.altTextPlaceholder)??((x=vt.imageDialog)==null?void 0:x.altTextPlaceholder),onChange:G=>P(ue=>({...ue,altText:G.target.value}))})})]})]}),v.jsxs(Ke.Footer,{children:[v.jsx(se,{onClick:Q,variant:"primary",type:"button",children:((k=n?.imageDialog)==null?void 0:k.ok)??((O=vt.imageDialog)==null?void 0:O.ok)}),v.jsx(se,{onClick:W,variant:"secondary",type:"button",children:((C=n?.imageDialog)==null?void 0:C.cancel)??((N=vt.imageDialog)==null?void 0:N.cancel)})]})]})]})};var fn=(t=>(t.HEADING="rte-heading",t.PARAGRAPH="rte-paragraph",t.BOLD="rte-bold",t.ITALIC="rte-italic",t.STRIKE="rte-strike",t.BULLET_LIST="rte-bullet-list",t.ORDERED_LIST="rte-ordered-list",t.CODE="rte-code",t.CODE_BLOCK="rte-code-block",t.BLOCKQUOTE="rte-blockquote",t.UNDERLINE="rte-underline",t.LINK="rte-link",t.IMAGE="rte-img",t.IMAGE_ALIGN_LEFT="rte-img-left",t.IMAGE_ALIGN_CENTER="rte-img-center",t.IMAGE_ALIGN_RIGHT="rte-img-right",t))(fn||{});const BA=g.forwardRef(({initialValue:t,onChange:e,disabled:n,locales:r,editorContentId:o,editorContentAriaLabelledBy:i,invalid:s,ariaRequired:a},l)=>{const c=oT({extensions:[aA.configure({heading:{levels:[1,2,3],HTMLAttributes:{class:"rte-heading"}},paragraph:{HTMLAttributes:{class:"rte-paragraph"}},bold:{HTMLAttributes:{class:"rte-bold"}},italic:{HTMLAttributes:{class:"rte-italic"}},strike:{HTMLAttributes:{class:"rte-strike"}},bulletList:{HTMLAttributes:{class:"rte-bullet-list"}},orderedList:{HTMLAttributes:{class:"rte-ordered-list"}},code:{HTMLAttributes:{class:"rte-code"}},codeBlock:{HTMLAttributes:{class:"rte-code-block"}},blockquote:{HTMLAttributes:{class:"rte-blockquote"}}}),lA.configure({HTMLAttributes:{class:"rte-underline"}}),DA.configure({openOnClick:!1,autolink:!0,linkOnPaste:!0,HTMLAttributes:{class:"rte-link"}}),jA.configure({placeholder:r?.placeholder??vt.placeholder}),PA.configure({HTMLAttributes:{class:"rte-img"}})],content:t,editorProps:{attributes:{class:"rich-text-editor-content",...o&&{id:o},...i&&{"aria-labelledby":i},...n&&{disabled:"true"},...a&&{"aria-required":"true"},role:"textbox","aria-label":"rich text editor content"}},onUpdate:({editor:d})=>e&&e(d.getHTML())});return g.useEffect(()=>{c&&c.setEditable(!n,!1)},[n,c]),v.jsxs("div",{className:`rich-text-editor-wrapper ${s?"invalid":""}`,"data-testid":"rich-text-editor-wrapper",ref:l,tabIndex:0,children:[v.jsx(FA,{editor:c,disabled:n,locales:r}),v.jsx("div",{className:"editor-content-wrapper",children:v.jsx(qN,{editor:c})})]})});BA.displayName="RichTextEditor";const ZM=t=>{const[e,n]=g.useState(Or.MD5),[r,o]=g.useState(!0),[i,s]=g.useState(!1);return g.useEffect(()=>{(async()=>{o(!0);try{const l=await t.getFixityAlgorithm();n(l)}catch{s(!0)}finally{o(!1)}})()},[t]),{fixityAlgorithm:e,isLoadingFixityAlgorithm:r,errorLoadingFixityAlgorithm:i}},zA="_loading_config_grfox_1",$A="_dots_grfox_9",Yp={loading_config:zA,dots:$A},QM=()=>{const{t}=$t("shared",{keyPrefix:"fileUploader"});return T.jsxs("div",{className:Yp.loading_config,"data-testid":"loading-config-spinner",children:[T.jsx(sm,{animation:"border",variant:"primary"}),T.jsxs("span",{children:[t("loadingConfiguration")," ",T.jsxs("span",{className:Yp.dots,children:[T.jsx("span",{children:"."}),T.jsx("span",{children:"."}),T.jsx("span",{children:"."})]})]})]})};var _A=(t=>(t.HOME="/",t.SIGN_UP_JSF="/dataverseuser.xhtml?editMode=CREATE&redirectPage=%2Fdataverse.xhtml",t.LOG_IN_JSF="/loginpage.xhtml?redirectPage=%2Fdataverse.xhtml",t.LOG_OUT="/",t.DATASETS="/datasets",t.CREATE_DATASET="/datasets/:collectionId/create",t.UPLOAD_DATASET_FILES="/datasets/upload-files",t.EDIT_DATASET_METADATA="/datasets/edit-metadata",t.EDIT_DATASET_TERMS="/datasets/edit-terms",t.FILES="/files",t.EDIT_FILE_METADATA="/files/edit-metadata",t.FILES_REPLACE="/files/replace",t.COLLECTIONS_BASE="/collections",t.COLLECTIONS="/collections/:collectionId",t.CREATE_COLLECTION="/collections/:parentCollectionId/create",t.ACCOUNT="/account",t.EDIT_COLLECTION="/collections/:collectionId/edit",t.EDIT_FEATURED_ITEMS="/collections/:collectionId/edit-featured-items",t.FEATURED_ITEM="/featured-item/:parentCollectionId/:featuredItemId",t.NOT_FOUND_PAGE="/404",t.AUTH_CALLBACK="/auth-callback",t.SIGN_UP="/sign-up",t.ADVANCED_SEARCH="/collections/:collectionId/search",t))(_A||{}),VA=(t=>(t.VERSION="version",t.PERSISTENT_ID="persistentId",t.PAGE="page",t.COLLECTION_ID="collectionId",t.TAB="tab",t.FILE_ID="id",t.DATASET_VERSION="datasetVersion",t.REFERRER="referrer",t.AUTH_STATE="state",t.VALID_TOKEN_BUT_NOT_LINKED_ACCOUNT="validTokenButNotLinkedAccount",t.TOOL_TYPE="toolType",t))(VA||{});class eD{constructor(e,n){this.majorNumber=e,this.minorNumber=n}toString(){return this.majorNumber===void 0||this.minorNumber===void 0?":draft":`${this.majorNumber}.${this.minorNumber}`}toSearchParam(){return this.majorNumber===void 0||this.minorNumber===void 0?"DRAFT":this.toString()}}var bt=(t=>(t.REPLACE_FILE="replace-file",t.ADD_FILES_TO_DATASET="add-files-to-dataset",t))(bt||{});function Zp(t,e,n,r,o,i,s){const a=new AbortController;return t.uploadFile(e,{file:n},i,a,s).then(r).catch(o),()=>a.abort()}const UA=6;function HA(t){const{fileRepository:e,datasetPersistentId:n,checksumAlgorithm:r,addFile:o,updateFile:i,getFileByKey:s,addUploadingToCancel:a,removeUploadingToCancel:l,onFileSkipped:c,validateBeforeUpload:d}=t,u=g.useRef(new fy(UA)),p=g.useCallback(x=>{l(Re.getFileKey(x)),u.current.release(1)},[l]),f=g.useCallback(async x=>{const k=Re.getFileKey(x);try{if(r===Or.NONE)i(k,{checksumValue:""});else{const O=await Re.getChecksum(x,r);i(k,{checksumValue:O})}}finally{l(k),u.current.release(1)}},[r,i,l]),h=g.useCallback(async x=>{if(Re.isDS_StoreFile(x)){c?.("ds_store",x);return}const k=Re.getFileKey(x);if(s(k)){c?.("already_uploaded",x);return}if(d&&!await d(x))return;await u.current.acquire(1),o(x);const O=Zp(e,n,x,()=>{i(k,{status:ct.DONE}),f(x)},()=>{i(k,{status:ct.FAILED}),p(x)},C=>i(k,{progress:C}),C=>i(k,{storageId:C}));a(k,O)},[e,n,o,i,s,a,f,p,c,d]),m=g.useCallback(x=>{const k=x.createReader(),O=()=>{k.readEntries(C=>{C.length!==0&&(C.forEach(N=>{N.isFile?N.file(S=>{const R=new File([S],S.name,{type:S.type,lastModified:S.lastModified});Object.defineProperty(R,"webkitRelativePath",{value:N.fullPath?.startsWith("/")?N.fullPath.slice(1):N.fullPath??"",writable:!0}),h(R)}):N.isDirectory&&m(N)}),O())})};O()},[h]),y=g.useCallback((x,k)=>{let O=!1;Array.from(x).forEach(C=>{const N=C.webkitGetAsEntry();N?.isDirectory?(O=!0,m(N)):N?.isFile&&(O=!0,N.file(S=>{const R=new File([S],S.name,{type:S.type,lastModified:S.lastModified});Object.defineProperty(R,"webkitRelativePath",{value:N.fullPath?.startsWith("/")?N.fullPath.slice(1):N.fullPath??"",writable:!0}),h(R)}))}),!O&&k&&k.length>0&&Array.from(k).forEach(C=>{h(C)})},[m,h]),b=g.useCallback(async x=>{const k=Re.getFileKey(x);i(k,{status:ct.UPLOADING,progress:0}),await u.current.acquire(1);const O=Zp(e,n,x,()=>{i(k,{status:ct.DONE}),f(x)},()=>{i(k,{status:ct.FAILED}),p(x)},C=>i(k,{progress:C}),C=>i(k,{storageId:C}));a(k,O)},[e,n,i,a,f,p]);return{uploadOneFile:h,addFromDir:m,handleDroppedItems:y,retryUpload:b,semaphore:u.current}}const KA=hy(my),WA={buttonsStyling:!1,reverseButtons:!0,customClass:{popup:"swal-popup-custom",title:"swal-title-custom",htmlContainer:"swal-html-container-custom",actions:"swal-actions-custom",confirmButton:"btn btn-primary",denyButton:"btn btn-secondary",cancelButton:"btn btn-secondary"}},GA=KA.mixin(WA),qA="_helper_text_kqrvg_26",JA="_file_uploader_drop_zone_kqrvg_31",XA="_is_dragging_kqrvg_38",YA="_drag_drop_msg_kqrvg_43",ZA="_uploading_files_list_kqrvg_50",QA="_uploading_file_kqrvg_50",eM="_info_progress_wrapper_kqrvg_70",tM="_info_kqrvg_70",nM="_upload_progress_kqrvg_90",rM="_failed_message_kqrvg_93",oM="_failed_kqrvg_93",iM="_file_type_different_msg_kqrvg_131",it={helper_text:qA,file_uploader_drop_zone:JA,is_dragging:XA,drag_drop_msg:YA,uploading_files_list:ZA,uploading_file:QA,info_progress_wrapper:eM,info:tM,upload_progress:nM,failed_message:rM,failed:oM,file_type_different_msg:iM};async function sM(t,e){return e.getDatasetUploadLimits(t)}g.createContext({user:null,isLoadingUser:!0,sessionError:null,setUser:()=>{},refetchUserSession:()=>Promise.resolve()});const aM="Bearer token is validated, but there is no linked user account.";class lM{constructor(e){Ut(this,"error");this.error=e}getErrorMessage(){return this.error.message}getReason(){const e=this.error.message.match(/Reason was: (.*)/);return e?e[1]:null}getStatusCode(){const e=this.error.message.match(/\[(\d+)\]/);return e?parseInt(e[1]):null}getReasonWithoutStatusCode(){const e=this.getReason();if(!e)return null;const n=this.getStatusCode();return n===null?e:e.replace(`[${n}]`,"").trim()}isBearerTokenValidatedButNoLinkedUserAccountError(){const e=this.getReasonWithoutStatusCode()??this.getErrorMessage();return this.getStatusCode()===403&&e===aM}}function cM(t,e,n=sM){const[r,o]=g.useState({}),[i,s]=g.useState(!0),[a,l]=g.useState(null),c=g.useCallback(async()=>{if(!e){o({}),s(!1),l(null);return}s(!0),l(null);try{const d=await n(t,e);if(Object.keys(d).length===0){o({});return}o({maxFilesAvailableToUploadFormatted:d.numberOfFilesRemaining!==void 0?d.numberOfFilesRemaining.toLocaleString():void 0,storageQuotaRemainingFormatted:d.storageQuotaRemaining!==void 0?new vi(d.storageQuotaRemaining,Wl.BYTES).toString():void 0})}catch(d){if(o({}),d instanceof De.ReadError){const u=new lM(d),p=u.getReasonWithoutStatusCode()??u.getErrorMessage();l(p)}else l("Something went wrong getting the upload limits. Try again later.")}finally{s(!1)}},[t,e,n]);return g.useEffect(()=>{c()},[c]),{uploadLimit:r,isLoadingUploadLimits:i,errorUploadLimits:a,fetchUploadLimits:c}}const dM=1e3,uM=({fileRepository:t,datasetRepository:e,datasetPersistentId:n,fetchUploadLimits:r})=>{const{fileUploaderState:o,addFile:i,removeFile:s,updateFile:a,addUploadingToCancel:l,removeUploadingToCancel:c,getFileByKey:d}=Io(),{config:{operationType:u,originalFile:p,checksumAlgorithm:f},uploadingToCancelMap:h,isSaving:m}=o,{t:y}=$t("shared"),b=g.useRef(null),x=g.useRef(null),[k,O]=g.useState(!1),{uploadLimit:C}=cM(n,e,r),N=Object.keys(o.files).length,M=Object.values(o.files).filter(B=>B.status!==ct.DONE),S=u===bt.ADD_FILES_TO_DATASET?!0:N===0,R=g.useCallback(async B=>u===bt.REPLACE_FILE&&p.metadata.type.value!==B.type&&!await Q(p.metadata.type.value,B.type)?(b.current&&(b.current.value=""),!1):!0,[u,p]),{uploadOneFile:P,handleDroppedItems:D}=HA({fileRepository:t,datasetPersistentId:n,checksumAlgorithm:f,addFile:i,updateFile:a,getFileByKey:d,addUploadingToCancel:l,removeUploadingToCancel:c,validateBeforeUpload:R,onFileSkipped:(B,H)=>{if(B==="ds_store")lt.info(y("fileUploader.fileUploadSkipped.dsStore"));else if(B==="already_uploaded"){const J=d(Re.getFileKey(H));J&<.info(y("fileUploader.fileUploadSkipped.alreadyUploaded",{fileName:J.fileName}))}}}),L=B=>{const H=Array.from(B.target.files||[]);if(H&&H.length>0)for(const J of H)P(J);b.current&&(b.current.value="")},V=B=>{const H=Array.from(B.target.files||[]);if(H&&H.length>0)for(const J of H)P(J);x.current&&(x.current.value="")},K=B=>{if(B.preventDefault(),B.stopPropagation(),O(!1),m)return;if(u===bt.REPLACE_FILE&&N>0){lt.error(y("fileUploader.replaceFileAlreadyOneFileError"));return}const H=B.dataTransfer.items,J=B.dataTransfer.files;if(H.length>0){if(u===bt.REPLACE_FILE&&H.length>1){lt.error(y("fileUploader.replaceFileMultipleError"));return}D(H,J)}},W=(B,H)=>{const J=h.get(B);J&&(J(),lt.info(`Upload canceled - ${H}`)),c(B),s(B)},Q=async(B,H)=>(await GA.fire({titleText:y("fileUploader.fileTypeDifferentModal.title"),showDenyButton:!0,denyButtonText:y("cancel"),confirmButtonText:y("continue"),html:T.jsxs("div",{className:it.file_type_different_msg,children:[T.jsx(gy,{size:24}),T.jsx("span",{children:y("fileUploader.fileTypeDifferentModal.message",{originalFileType:_n[B]??y("unknown"),replacementFileType:_n[H]??y("unknown")})})]}),allowOutsideClick:!1,allowEscapeKey:!1})).isConfirmed;return T.jsx("div",{children:T.jsx(Qo,{defaultActiveKey:"0",children:T.jsxs(Qo.Item,{eventKey:"0",children:[T.jsx(Qo.Header,{children:y("fileUploader.accordionTitle")}),T.jsxs(Qo.Body,{children:[T.jsxs("p",{className:it.helper_text,children:[y("fileUploader.uploadWidgetHelp",{maxFilesPerUpload:dM.toLocaleString()}),C.maxFilesAvailableToUploadFormatted&&T.jsxs(T.Fragment,{children:[" ",y("fileUploader.uploadWidgetMaxFilesHelp",{maxFilesAvailableToUpload:C.maxFilesAvailableToUploadFormatted})]}),C.storageQuotaRemainingFormatted&&T.jsxs(T.Fragment,{children:[" ",y("fileUploader.uploadWidgetStorageQuotaHelp",{storageQuotaRemaining:C.storageQuotaRemainingFormatted})]})]}),T.jsxs(xr,{children:[T.jsxs(xr.Header,{children:[T.jsxs(se,{onClick:()=>b.current?.click(),disabled:!S||m,size:"sm",children:[T.jsx(Ud,{size:22})," ",u===bt.ADD_FILES_TO_DATASET?y("fileUploader.selectFileMultiple"):y("fileUploader.selectFileSingle")]}),u===bt.ADD_FILES_TO_DATASET&&T.jsxs(se,{onClick:()=>x.current?.click(),disabled:!S||m,size:"sm",className:"ms-2",children:[T.jsx(Ud,{size:22})," ",y("fileUploader.selectFolder")]})]}),T.jsx(xr.Body,{children:T.jsxs("div",{className:Hd(it.file_uploader_drop_zone,{[it.is_dragging]:k}),onDrop:K,onDragOver:B=>{B.preventDefault(),O(!0)},onDragEnter:()=>O(!0),onDragLeave:()=>O(!1),"data-testid":"file-uploader-drop-zone",children:[T.jsx("input",{ref:b,type:"file",onChange:L,multiple:u===bt.ADD_FILES_TO_DATASET,hidden:!0,disabled:!S||m}),T.jsx("input",{ref:x,type:"file",onChange:V,webkitdirectory:"",hidden:!0,disabled:!S||m}),M.length>0?T.jsx("ul",{className:it.uploading_files_list,children:M.map(B=>T.jsxs("li",{className:Hd(it.uploading_file,{[it.failed]:B.status===ct.FAILED}),children:[T.jsxs("div",{className:it.info_progress_wrapper,children:[T.jsxs("p",{className:it.info,children:[T.jsx("span",{children:B.fileDir?`${B.fileDir}/${B.fileName}`:B.fileName}),T.jsx("small",{children:B.fileSizeString})]}),B.status===ct.UPLOADING&&T.jsx("div",{className:it.upload_progress,children:T.jsx($E,{now:B.progress})}),B.status===ct.FAILED&&T.jsx("p",{className:it.failed_message,children:y("fileUploader.uploadFailed")})]}),T.jsx(se,{variant:"secondary",size:"sm",onClick:()=>W(B.key,B.fileName),children:T.jsx(yy,{title:y("fileUploader.cancelUpload")})})]},B.key))}):T.jsx("p",{className:it.drag_drop_msg,children:u===bt.ADD_FILES_TO_DATASET?y("fileUploader.dragDropMultiple"):y("fileUploader.dragDropSingle")})]})})]})]})]})})})},pM=g.memo(uM);function ay({indeterminate:t,...e}){const n=g.useRef(null);return g.useEffect(()=>{typeof t=="boolean"&&n.current&&(n.current.indeterminate=!e.checked&&t)},[n,t,e.checked]),T.jsx("input",{type:"checkbox","aria-label":"Select row",ref:n,...e})}function fM(t,e,n){return t.replace(e,n)}class ly{static toUploadedFileDTO(e,n,r,o,i,s,a,l,c,d){return{fileName:e,description:n,directoryLabel:r,categories:o,restrict:i,storageId:s,checksumValue:a,checksumType:l,mimeType:c===""?"application/octet-stream":c,...d&&{forceReplace:!0}}}}class cy{constructor(e){Ut(this,"error");this.error=e}getErrorMessage(){return this.error.message}getReason(){const e=this.error.message.match(/Reason was: (.*)/);return e?e[1]:null}getStatusCode(){const e=this.error.message.match(/\[(\d+)\]/);return e?parseInt(e[1]):null}getReasonWithoutStatusCode(){const e=this.getReason();if(!e)return null;const n=this.getStatusCode();return n===null?e:e.replace(`[${n}]`,"").trim()}}function hM(t){return"replace"in t&&typeof t.replace=="function"}const mM=t=>{const{setIsSaving:e,setReplaceOperationInfo:n,removeAllFiles:r}=Io(),{t:o}=$t("shared");return{submitReplaceFile:async(s,a)=>{if(!hM(t)){lt.error("File replacement is not supported in standalone mode");return}e(!0);const l=ly.toUploadedFileDTO(a.fileName,a.description,a.fileDir,a.tags,a.restricted,a.storageId,a.checksumValue,a.checksumAlgorithm,a.fileType,!0);try{const c=await fM(t,s,l);r(),n({success:!0,newFileIdentifier:c})}catch(c){if(c instanceof De.WriteError){const d=new cy(c),u=d.getReasonWithoutStatusCode()??d.getErrorMessage();lt.error(u)}else lt.error(o("fileUploader.defaultFileReplaceError"))}finally{e(!1)}}}};function gM(t,e,n){return t.addUploadedFiles(e,n)}const yM=(t,e)=>{const{setIsSaving:n,setAddFilesToDatasetOperationInfo:r,removeAllFiles:o}=Io(),{t:i}=$t("shared");return{submitUploadedFilesToDataset:async a=>{n(!0);const l=a.map(c=>ly.toUploadedFileDTO(c.fileName,c.description,c.fileDir,c.tags,c.restricted,c.storageId,c.checksumValue,c.checksumAlgorithm,c.fileType));try{await gM(t,e,l),o(),r({success:!0})}catch(c){if(c instanceof De.WriteError){const d=new cy(c),u=d.getReasonWithoutStatusCode()??d.getErrorMessage();lt.error(u)}else lt.error(i("fileUploader.defaultAddUploadedFilesToDatasetError"))}finally{n(!1)}}}},vM={"application/pdf":w.DOCUMENT,"image/pdf":w.DOCUMENT,"text/pdf":w.DOCUMENT,"application/x-pdf":w.DOCUMENT,"application/cnt":w.DOCUMENT,"application/msword":w.DOCUMENT,"application/vnd.ms-excel":w.DOCUMENT,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":w.DOCUMENT,"application/vnd.ms-powerpoint":w.DOCUMENT,"application/vnd.openxmlformats-officedocument.presentationml.presentation":w.DOCUMENT,"application/vnd.openxmlformats-officedocument.wordprocessingml.document":w.DOCUMENT,"application/vnd.oasis.opendocument.spreadsheet":w.DOCUMENT,"application/vnd.ms-excel.sheet.macroenabled.12":w.DOCUMENT,"text/plain":w.DOCUMENT,"text/x-log":w.DOCUMENT,"text/html":w.DOCUMENT,"application/x-tex":w.DOCUMENT,"text/x-tex":w.DOCUMENT,"text/markdown":w.DOCUMENT,"text/x-markdown":w.DOCUMENT,"text/x-r-markdown":w.DOCUMENT,"text/x-rst":w.DOCUMENT,"application/rtf":w.DOCUMENT,"text/rtf":w.DOCUMENT,"text/richtext":w.DOCUMENT,"text/turtle":w.DOCUMENT,"application/xml":w.DOCUMENT,"text/xml":w.DOCUMENT,"text/x-c":w.CODE,"text/x-c++src":w.CODE,"text/css":w.CODE,"text/x-objcsrc":w.CODE,"application/java-vm":w.CODE,"text/x-java-source":w.CODE,"text/javascript":w.CODE,"application/javascript":w.CODE,"application/x-javascript":w.CODE,"text/x-perl-script":w.CODE,"text/x-matlab":w.CODE,"text/x-mathematica":w.CODE,"text/php":w.CODE,"text/x-fortran":w.CODE,"text/x-pascal":w.CODE,"text/x-python":w.CODE,"text/x-python-script":w.CODE,"text/x-r-source":w.CODE,"text/x-sh":w.CODE,"application/x-sh":w.CODE,"application/x-shellscript":w.CODE,"application/x-sql":w.CODE,"text/x-sql":w.CODE,"application/x-swc":w.CODE,"application/x-msdownload":w.CODE,"application/x-ipynb+json":w.CODE,"application/x-stata-do":w.CODE,"text/x-stata-syntax":w.CODE,"application/x-stata-syntax":w.CODE,"text/x-spss-syntax":w.CODE,"application/x-spss-syntax":w.CODE,"text/x-sas-syntax":w.CODE,"application/x-sas-syntax":w.CODE,"type/x-r-syntax":w.CODE,"application/postscript":w.CODE,"application/vnd.wolfram.mathematica.package":w.CODE,"application/vnd.wolfram.mathematica":w.CODE,"text/x-workflow-description-language":w.CODE,"text/x-computational-workflow-language":w.CODE,"text/x-nextflow":w.CODE,"text/x-r-notebook":w.CODE,"text/x-ruby-script":w.CODE,"text/x-dagman":w.CODE,"text/x-makefile":w.CODE,"text/x-snakemake":w.CODE,"application/x-docker-file":w.CODE,"application/x-vagrant-file":w.CODE,"text/tab-separated-values":w.TABULAR,"text/tsv":w.TABULAR,"text/comma-separated-values":w.TABULAR,"text/x-comma-separated-values":w.TABULAR,"text/csv":w.TABULAR,"text/x-vcard":w.TABULAR,"text/x-fixed-field":w.TABULAR,"application/x-rlang-transport":w.TABULAR,"application/x-R-2":w.TABULAR,"application/x-stata":w.TABULAR,"application/x-stata-6":w.TABULAR,"application/x-stata-13":w.TABULAR,"application/x-stata-14":w.TABULAR,"application/x-stata-15":w.TABULAR,"application/x-stata-ado":w.TABULAR,"application/x-stata-dta":w.TABULAR,"application/x-stata-smcl":w.TABULAR,"application/x-spss-por":w.TABULAR,"application/x-spss-portable":w.TABULAR,"application/x-spss-sav":w.TABULAR,"application/x-spss-sps":w.TABULAR,"application/x-sas":w.TABULAR,"application/x-sas-transport":w.TABULAR,"application/x-sas-system":w.TABULAR,"application/x-sas-data":w.TABULAR,"application/x-sas-catalog":w.TABULAR,"application/x-sas-log":w.TABULAR,"application/x-sas-output":w.TABULAR,"application/x-r-data":w.TABULAR,"application/softgrid-do":w.TABULAR,"application/x-dvn-csvspss-zip":w.TABULAR,"application/x-dvn-tabddi-zip":w.TABULAR,"application/x-emf":w.TABULAR,"application/x-h5":w.TABULAR,"application/x-hdf":w.TABULAR,"application/x-hdf5":w.TABULAR,"application/geo+json":w.TABULAR,"application/json":w.TABULAR,"application/mathematica":w.TABULAR,"application/matlab-mat":w.TABULAR,"application/x-matlab-data":w.TABULAR,"application/x-matlab-figure":w.TABULAR,"application/x-matlab-workspace":w.TABULAR,"application/x-xfig":w.TABULAR,"application/x-msaccess":w.TABULAR,"application/netcdf":w.TABULAR,"application/x-netcdf":w.TABULAR,"application/vnd.lotus-notes":w.TABULAR,"application/x-nsdstat":w.TABULAR,"application/vnd.flographit":w.TABULAR,"application/vnd.realvnc.bed":w.TABULAR,"application/vnd.ms-pki.stl":w.TABULAR,"application/vnd.isac.fcs":w.TABULAR,"application/java-serialized-object":w.TABULAR,"chemical/x-xyz":w.TABULAR,"image/fits":w.FILE,"application/fits":w.FILE,"application/dbf":w.FILE,"application/dbase":w.FILE,"application/prj":w.FILE,"application/sbn":w.FILE,"application/sbx":w.FILE,"application/shp":w.FILE,"application/shx":w.FILE,"application/x-esri-shape":w.FILE,"application/vnd.google-earth.kml+xml":w.FILE,"application/zipped-shapefile":w.FILE,"application/zip":w.PACKAGE,"application/x-zip-compressed":w.PACKAGE,"application/vnd.antix.game-component":w.PACKAGE,"application/x-bzip":w.PACKAGE,"application/x-bzip2":w.PACKAGE,"application/vnd.google-earth.kmz":w.PACKAGE,"application/gzip":w.PACKAGE,"application/x-gzip":w.PACKAGE,"application/x-gzip-compressed":w.PACKAGE,"application/rar":w.PACKAGE,"application/x-rar":w.PACKAGE,"application/x-rar-compressed":w.PACKAGE,"application/tar":w.PACKAGE,"application/x-tar":w.PACKAGE,"application/x-compressed":w.PACKAGE,"application/x-compressed-tar":w.PACKAGE,"application/x-7z-compressed":w.PACKAGE,"application/x-xz":w.PACKAGE,"application/warc":w.PACKAGE,"application/x-iso9660-image":w.PACKAGE,"application/vnd.eln+zip":w.PACKAGE,"image/gif":w.IMAGE,"image/jpeg":w.IMAGE,"image/jp2":w.IMAGE,"image/x-portable-bitmap":w.IMAGE,"image/x-portable-graymap":w.IMAGE,"image/png":w.IMAGE,"image/x-portable-anymap":w.IMAGE,"image/x-portable-pixmap":w.IMAGE,"application/x-msmetafile":w.IMAGE,"application/dicom":w.IMAGE,"image/dicom-rle":w.IMAGE,"image/nii":w.IMAGE,"image/cmu-raster":w.IMAGE,"image/x-rgb":w.IMAGE,"image/svg+xml":w.IMAGE,"image/tiff":w.IMAGE,"image/bmp":w.IMAGE,"image/x-xbitmap":w.IMAGE,"image/RAW":w.IMAGE,"image/raw":w.IMAGE,"application/x-tgif":w.IMAGE,"image/x-xpixmap":w.IMAGE,"image/x-xwindowdump":w.IMAGE,"application/photoshop":w.IMAGE,"image/vnd.adobe.photoshop":w.IMAGE,"application/x-photoshop":w.IMAGE,"image/webp":w.IMAGE,"audio/x-aiff":w.AUDIO,"audio/mp3":w.AUDIO,"audio/mpeg":w.AUDIO,"audio/mp4":w.AUDIO,"audio/x-m4a":w.AUDIO,"audio/ogg":w.AUDIO,"audio/wav":w.AUDIO,"audio/x-wav":w.AUDIO,"audio/x-wave":w.AUDIO,"video/avi":w.VIDEO,"video/x-msvideo":w.VIDEO,"video/mpeg":w.VIDEO,"video/mp4":w.VIDEO,"video/x-m4v":w.VIDEO,"video/ogg":w.VIDEO,"video/quicktime":w.VIDEO,"video/webm":w.VIDEO,"text/xml-graphml":w.NETWORK,"application/octet-stream":w.FILE,"application/vnd.dataverse.file-package":w.TABULAR,default:w.FILE},bM=({itemIndex:t,defaultValue:e})=>{const{control:n}=Hl(),{t:r}=$t("shared"),o={required:r("fileMetadataForm.fields.fileName.required"),validate:(i,s)=>{const a=s.files[t];return Re.isValidFileName(i)?Re.isUniqueCombinationOfFilepathAndFilename({fileName:i,filePath:a.fileDir,fileKey:a.key,allFiles:s.files})?!0:r("fileMetadataForm.fields.fileName.invalid.duplicateCombination",{fileName:i}):r("fileMetadataForm.fields.fileName.invalid.characters")},maxLength:{value:255,message:r("fileMetadataForm.fields.fileName.invalid.maxLength",{maxLength:255})}};return T.jsxs(oe.Group,{controlId:`files.${t}.fileName`,as:or,children:[T.jsx(oe.Group.Label,{required:!0,column:!0,lg:2,children:r("fileMetadataForm.fields.fileName.label")}),T.jsx(ze,{lg:10,children:T.jsx(Kl,{name:`files.${t}.fileName`,control:n,defaultValue:e,rules:o,render:({field:{onChange:i,ref:s,value:a},fieldState:{invalid:l,error:c}})=>T.jsxs(T.Fragment,{children:[T.jsx(oe.Group.Input,{type:"text",value:a,onChange:i,isInvalid:l,"aria-required":!0,ref:s}),T.jsx(oe.Group.Feedback,{type:"invalid",children:c?.message})]})})})]})},xM=({itemIndex:t,defaultValue:e})=>{const{control:n}=Hl(),{t:r}=$t("shared"),o={validate:(i,s)=>{const a=s.files[t];return Re.isValidFilePath(i)?Re.isUniqueCombinationOfFilepathAndFilename({fileName:a.fileName,filePath:i,fileKey:a.key,allFiles:s.files})?!0:r("fileMetadataForm.fields.filePath.invalid.duplicateCombination",{fileName:i}):r("fileMetadataForm.fields.filePath.invalid.characters")},maxLength:{value:255,message:r("fileMetadataForm.fields.filePath.invalid.maxLength",{maxLength:255})}};return T.jsxs(oe.Group,{controlId:`files.${t}.fileDir`,as:or,children:[T.jsx(oe.Group.Label,{message:r("fileMetadataForm.fields.filePath.description"),column:!0,lg:2,children:r("fileMetadataForm.fields.filePath.label")}),T.jsx(ze,{lg:10,children:T.jsx(Kl,{name:`files.${t}.fileDir`,control:n,rules:o,render:({field:{onChange:i,ref:s,value:a},fieldState:{invalid:l,error:c}})=>T.jsxs(T.Fragment,{children:[T.jsx(oe.Group.Input,{type:"text",defaultValue:e,value:a,onChange:i,isInvalid:l,ref:s}),T.jsx(oe.Group.Feedback,{type:"invalid",children:c?.message})]})})})]})},wM=({itemIndex:t,defaultValue:e})=>{const{control:n}=Hl(),{t:r}=$t("shared"),o={maxLength:{value:255,message:r("fileMetadataForm.fields.description.invalid.maxLength",{maxLength:255})}};return T.jsxs(oe.Group,{controlId:`files.${t}.description`,as:or,children:[T.jsx(oe.Group.Label,{column:!0,lg:2,children:r("fileMetadataForm.fields.description.label")}),T.jsx(ze,{lg:10,children:T.jsx(Kl,{name:`files.${t}.description`,control:n,defaultValue:e,rules:o,render:({field:{onChange:i,ref:s,value:a},fieldState:{invalid:l,error:c}})=>T.jsxs(T.Fragment,{children:[T.jsx(oe.Group.TextArea,{value:a,onChange:i,isInvalid:l,rows:2,ref:s}),T.jsx(oe.Group.Feedback,{type:"invalid",children:c?.message})]})})})]})},EM="_icon_fields_wrapper_rs58e_37",kM="_icon_rs58e_37",OM="_form_fields_rs58e_58",CM="_file_extra_info_rs58e_68",SM="_remove_button_rs58e_80",Jr={icon_fields_wrapper:EM,icon:kM,form_fields:OM,file_extra_info:CM,remove_button:SM},NM=({file:t,isSelected:e,handleSelectFile:n,handleRemoveFile:r,itemIndex:o,isSaving:i})=>{const{t:s}=$t("shared"),a=vM[t.fileType]||w.OTHER;return T.jsxs("tr",{children:[T.jsx("th",{colSpan:1,children:T.jsx(ay,{checked:e,onChange:()=>n(t.key)})}),T.jsx("td",{colSpan:2,children:T.jsxs("div",{className:Jr.icon_fields_wrapper,children:[T.jsx("div",{className:Jr.icon,children:T.jsx(Hc,{name:a})}),T.jsxs("div",{className:Jr.form_fields,children:[T.jsx(bM,{itemIndex:o}),T.jsx(xM,{itemIndex:o}),T.jsx(wM,{itemIndex:o}),T.jsxs("div",{className:Jr.file_extra_info,children:[T.jsx(vy,{}),T.jsx("span",{children:t.fileSizeString}),"-",T.jsx("span",{children:_n[t.fileType]}),"-",T.jsxs("span",{children:[T.jsxs("i",{children:[t.checksumAlgorithm,":"]})," ",t.checksumValue]})]})]}),T.jsx("div",{children:T.jsx(VE,{type:"button",className:Jr.remove_button,onClick:()=>{r(o,t.key)},"aria-label":s("fileUploader.uploadedFilesList.removeFile"),disabled:i})})]})})]})},TM="_table_wrapper_e3j9i_26",AM="_edit_dropdown_e3j9i_78",MM="_edit_dropdown_icon_e3j9i_83",DM="_btns_container_e3j9i_119",Xr={table_wrapper:TM,edit_dropdown:AM,edit_dropdown_icon:MM,btns_container:DM},jM=({fileRepository:t,datasetPersistentId:e,onCancel:n})=>{const{t:r}=$t("shared"),{fileUploaderState:{files:o,isSaving:i,config:{operationType:s,originalFile:a}},uploadedFiles:l,removeFile:c}=Io(),d=g.useMemo(()=>Object.values(o).some(D=>D.status===ct.UPLOADING),[o]),{submitReplaceFile:u}=mM(t),{submitUploadedFilesToDataset:p}=yM(t,e),[f,h]=g.useState([]),m=f.length===l.length,y=f.length>0&&f.length{h(L=>L.includes(D)?L.filter(V=>V!==D):[...L,D])},x=()=>{f.length===l.length?h([]):h(l.map(D=>D.key))},k=by({mode:"onChange"}),{fields:O,remove:C}=xy({control:k.control,name:"files"});tf(()=>{const D=k.getValues("files"),L=l.filter(V=>!D.some(K=>K.key===V.key));k.setValue("files",[...D,...L],{shouldValidate:!0})},[k,l]);const N=D=>{bt.REPLACE_FILE===s&&u(a.id,D.files[0]),bt.ADD_FILES_TO_DATASET===s&&p(D.files)},M=(D,L)=>{C(D),c(L)},S=()=>{const D=O.filter(L=>!f.includes(L.key));k.setValue("files",D),h([]),f.forEach(L=>{c(L)})},R=()=>n(),P=D=>{if(D.key!=="Enter")return;const V=D.target instanceof HTMLButtonElement?D.target.type==="submit":!1,K=D.target instanceof HTMLTextAreaElement;V||K||D.preventDefault()};return T.jsx(wy,{...k,children:T.jsx("form",{onSubmit:k.handleSubmit(N),onKeyDown:P,noValidate:!0,"data-testid":"uploaded-files-list-form",children:T.jsx(ul,{children:T.jsx("div",{className:Xr.table_wrapper,children:T.jsxs(LE,{children:[T.jsx("thead",{children:T.jsxs("tr",{children:[T.jsx("th",{scope:"col",colSpan:1,children:T.jsx("div",{children:T.jsx(ay,{checked:m,indeterminate:y,onChange:x,disabled:i,"aria-label":r(m?"fileUploader.uploadedFilesList.deselectAllFiles":"fileUploader.uploadedFilesList.selectAllFiles")})})}),T.jsx("th",{scope:"col",colSpan:1,children:`${l.length} ${l.length>1?r("fileUploader.uploadedFilesList.uploadedFiles"):r("fileUploader.uploadedFilesList.uploadedFile")}`}),T.jsx("th",{scope:"col",colSpan:1,children:T.jsx("div",{className:Xr.edit_dropdown,children:T.jsx(l1,{id:"edit-selected-files-menu",icon:T.jsx(Ey,{className:Xr.edit_dropdown_icon}),title:"Edit",ariaLabel:r("fileUploader.uploadedFilesList.editSelectedFiles"),variant:"secondary",disabled:f.length===0||i,children:T.jsx(c1,{onClick:S,children:r("fileUploader.uploadedFilesList.removeSelectedFiles")})})})})]})}),T.jsx("tbody",{className:Xr.table_body,children:O.map((D,L)=>T.jsx(NM,{file:D,isSelected:f.includes(D.key),handleSelectFile:b,handleRemoveFile:M,itemIndex:L,isSaving:i},D.id))}),T.jsx("tfoot",{children:T.jsx("tr",{children:T.jsx("td",{colSpan:3,children:T.jsxs("div",{className:Xr.btns_container,children:[T.jsx(se,{type:"button",onClick:R,disabled:i,variant:"secondary",children:r("cancel")}),T.jsx(se,{type:"submit",disabled:i||d,children:T.jsxs(ul,{direction:"horizontal",gap:1,children:[r("saveChanges"),i&&T.jsx(sm,{variant:"light",animation:"border",size:"sm"})]})})]})})})})]})})})})})},tD=({fileRepository:t,datasetRepository:e,datasetPersistentId:n,fetchUploadLimits:r,onCancel:o})=>{const{t:i}=$t("shared"),{fileUploaderState:{replaceOperationInfo:s,addFilesToDatasetOperationInfo:a},uploadedFiles:l}=Io();return tf(()=>{s.success&&s.newFileIdentifier&<.success(i("fileUploader.fileReplacedSuccessfully")),a.success&<.success(i("fileUploader.filesAddedToDatasetSuccessfully"))},[s,a,i]),T.jsxs(ul,{gap:4,children:[T.jsx(pM,{fileRepository:t,datasetRepository:e,datasetPersistentId:n,fetchUploadLimits:r}),l.length>0&&T.jsx(jM,{fileRepository:t,datasetPersistentId:n,onCancel:o})]})};var xt=(t=>(t.ALL="all",t.FOLDERS="folders",t.FILES="files",t))(xt||{}),kr=(t=>(t.NAME_AZ="NameAZ",t.NAME_ZA="NameZA",t))(kr||{}),Ro=(t=>(t.FOLDER="folder",t.FILE="file",t))(Ro||{});const RM=t=>t.type==="folder",IM=t=>t.type==="file";async function nD(t,e){const{datasetPersistentId:n,datasetVersion:r,paths:o,limit:i=500,signal:s}=e,a=[],l=new Set,c=[...o];for(;c.length>0;){if(s?.aborted)throw new Error("Enumeration aborted");const d=c.shift();let u;do{const p=await t.getNode({datasetPersistentId:n,datasetVersion:r,path:d,limit:i,cursor:u});for(const f of p.items)IM(f)?l.has(f.id)||(l.add(f.id),a.push(f)):RM(f)&&c.push(f.path);u=p.nextCursor??void 0}while(u)}return a}class PM{constructor(e=1,n=10,r=0,o="Item"){this.page=e,this.pageSize=n,this.totalItems=r,this.itemName=o}get offset(){return(this.page-1)*this.pageSize}get pageStartItem(){return(this.page-1)*this.pageSize+1}get pageEndItem(){return Math.min(this.pageStartItem+this.pageSize-1,this.totalItems)}withTotal(e){return new this.constructor(this.page,this.pageSize,e)}goToPage(e){return new this.constructor(e,this.pageSize,this.totalItems)}goToPreviousPage(){if(!this.previousPage)throw new Error("No previous page");return this.goToPage(this.previousPage)}goToNextPage(){if(!this.nextPage)throw new Error("No next page");return this.goToPage(this.nextPage)}withPageSize(e){const n=(r,o)=>{const i=Math.ceil(((this.page-1)*r+1)/o);return i>0?i:1};return new this.constructor(n(this.pageSize,e),e,this.totalItems)}get totalPages(){return Math.ceil(this.totalItems/this.pageSize)}get hasPreviousPage(){return this.page>1}get hasNextPage(){return this.page1e3?1e3:Math.floor(t)}function $M(t){if(!t)return 0;if(!t.startsWith(Ul))throw new Error("Invalid cursor");const e=Number.parseInt(t.slice(Ul.length),10);if(!Number.isFinite(e)||e<0)throw new Error("Invalid cursor");return e}function _M(t){return`${Ul}${t}`}function VM(t){return t?t.replace(/\/+/g,"/").replace(/^\/+/,"").replace(/\/+$/,""):""}function UM(t,e,n,r,o){const i=new Map,s=[],a=e===""?"":`${e}/`;for(const c of t){const d=(c.metadata.directory??"").replace(/^\/+|\/+$/g,"");if(e!==""&&d!==e&&!d.startsWith(a))continue;if(d===e){s.push(HM(c,e,o));continue}const p=d.slice(a.length).split("/")[0];if(!p)continue;const f=a+p;let h=i.get(f);if(h||(h={name:p,path:f,fileCount:0,bytes:0,subfolderNames:new Set},i.set(f,h)),h.fileCount+=1,h.bytes+=c.metadata.size?.toBytes()??0,d!==f){const m=d.slice(f.length+1).split("/")[0];m&&h.subfolderNames.add(m)}}const l=Array.from(i.values()).map(c=>({type:Ro.FOLDER,name:c.name,path:c.path,counts:{files:c.fileCount,folders:c.subfolderNames.size,bytes:c.bytes}}));return ef(l,n),ef(s,n),r===xt.FOLDERS?l:r===xt.FILES?s:[...l,...s]}function HM(t,e,n){return{type:Ro.FILE,id:t.id,name:t.name,path:e===""?t.name:`${e}/${t.name}`,size:t.metadata.size.toBytes(),contentType:t.metadata.type.value,access:t.access,checksum:t.metadata.checksum?{type:t.metadata.checksum.algorithm,value:t.metadata.checksum.value}:void 0,downloadUrl:`${n}/${t.id}`}}function ef(t,e){const n=e===kr.NAME_ZA?-1:1;t.sort((r,o)=>n*r.name.localeCompare(o.name,void 0,{sensitivity:"base"}))}class jt{static toFileTreePage(e,n,r){return{path:e.path,items:e.items.map(o=>jt.toFileTreeItem(o)),nextCursor:e.nextCursor,limit:e.limit,order:jt.toFileTreeOrder(e.order,n),include:jt.toFileTreeInclude(e.include,r),approximateCount:e.approximateCount}}static toFileTreeItem(e){if(De.isFileTreeFolderNode(e))return jt.toFileTreeFolder(e);if(De.isFileTreeFileNode(e))return jt.toFileTreeFile(e);throw new Error(`Unknown file tree node type: ${e.type}`)}static toFileTreeFolder(e){return{type:Ro.FOLDER,name:e.name,path:e.path,counts:e.counts}}static toFileTreeFile(e){return{type:Ro.FILE,id:e.id,name:e.name,path:e.path,size:e.size,contentType:e.contentType,access:e.access?{restricted:e.access!=="public",latestVersionRestricted:e.access!=="public",canBeRequested:e.access==="restricted",requested:!1}:void 0,accessStatus:e.access,checksum:e.checksum,downloadUrl:e.downloadUrl}}static toSDKFileTreeOrder(e){if(e!==void 0)return e===kr.NAME_ZA?De.FileTreeOrder.NAME_ZA:De.FileTreeOrder.NAME_AZ}static toSDKFileTreeInclude(e){if(e!==void 0)switch(e){case xt.FOLDERS:return De.FileTreeInclude.FOLDERS;case xt.FILES:return De.FileTreeInclude.FILES;case xt.ALL:default:return De.FileTreeInclude.ALL}}static toFileTreeOrder(e,n){return e===De.FileTreeOrder.NAME_ZA?kr.NAME_ZA:e??n??kr.NAME_AZ}static toFileTreeInclude(e,n){switch(e){case De.FileTreeInclude.FOLDERS:return xt.FOLDERS;case De.FileTreeInclude.FILES:return xt.FILES;case De.FileTreeInclude.ALL:return xt.ALL;default:return n??xt.ALL}}static isEndpointMissing(e){if(e instanceof De.ReadError)return/\[404\]/.test(e.message)?/API endpoint does not exist/i.test(e.message):/\[(405|501)\]/.test(e.message);const n=e?.response?.status;return n===404||n===405||n===501}}class rD{constructor(e){Ut(this,"fallback");Ut(this,"endpointUnavailable",!1);this.fileRepository=e}async getNode(e){if(this.endpointUnavailable&&this.fallback)return this.fallback.getNode(e);try{const n=await De.listDatasetTreeNode.execute({datasetId:e.datasetPersistentId,datasetVersionId:e.datasetVersion.number.toString(),path:e.path,limit:e.limit,cursor:e.cursor,include:jt.toSDKFileTreeInclude(e.include),order:jt.toSDKFileTreeOrder(e.order),includeDeaccessioned:e.includeDeaccessioned,originals:e.originals});return jt.toFileTreePage(n,e.order,e.include)}catch(n){if(this.fileRepository&&jt.isEndpointMissing(n))return this.endpointUnavailable=!0,this.fallback||(this.fallback=new BM(this.fileRepository)),this.fallback.getNode(e);throw n}}}export{eD as D,tD as F,QM as L,bt as O,VA as Q,_A as R,Or as a,ZM as b,JM as c,kr as d,xt as e,RM as f,nD as g,vi as h,IM as i,Wl as j,se as k,rD as l,Io as u}; diff --git a/src/main/webapp/reusable-components/chunks/i18n-CMHgdAUi.js b/src/main/webapp/reusable-components/chunks/i18n-CDa8ZpJw.js similarity index 99% rename from src/main/webapp/reusable-components/chunks/i18n-CMHgdAUi.js rename to src/main/webapp/reusable-components/chunks/i18n-CDa8ZpJw.js index 83073d780dc..f64161c3b93 100644 --- a/src/main/webapp/reusable-components/chunks/i18n-CMHgdAUi.js +++ b/src/main/webapp/reusable-components/chunks/i18n-CDa8ZpJw.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["reusable-components/chunks/vendor-DReq5CoA.js","reusable-components/chunks/react-Dtf48RLW.js"])))=>i.map(i=>d[i]); -import{r as P}from"./react-Dtf48RLW.js";import{i as nt,s as st}from"./vendor-DReq5CoA.js";const y=i=>typeof i=="string",J=()=>{let i,e;const t=new Promise((n,s)=>{i=n,e=s});return t.resolve=i,t.reject=e,t},we=i=>i==null?"":""+i,it=(i,e,t)=>{i.forEach(n=>{e[n]&&(t[n]=e[n])})},rt=/###/g,Le=i=>i&&i.indexOf("###")>-1?i.replace(rt,"."):i,Pe=i=>!i||y(i),W=(i,e,t)=>{const n=y(e)?e.split("."):e;let s=0;for(;s{const{obj:n,k:s}=W(i,e,Object);if(n!==void 0||e.length===1){n[s]=t;return}let r=e[e.length-1],a=e.slice(0,e.length-1),o=W(i,a,Object);for(;o.obj===void 0&&a.length;)r=`${a[a.length-1]}.${r}`,a=a.slice(0,a.length-1),o=W(i,a,Object),o?.obj&&typeof o.obj[`${o.k}.${r}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${r}`]=t},at=(i,e,t,n)=>{const{obj:s,k:r}=W(i,e,Object);s[r]=s[r]||[],s[r].push(t)},se=(i,e)=>{const{obj:t,k:n}=W(i,e);if(t&&Object.prototype.hasOwnProperty.call(t,n))return t[n]},ot=(i,e,t)=>{const n=se(i,t);return n!==void 0?n:se(e,t)},Be=(i,e,t)=>{for(const n in e)n!=="__proto__"&&n!=="constructor"&&(n in i?y(i[n])||i[n]instanceof String||y(e[n])||e[n]instanceof String?t&&(i[n]=e[n]):Be(i[n],e[n],t):i[n]=e[n]);return i},_=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var lt={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const ut=i=>y(i)?i.replace(/[&<>"'\/]/g,e=>lt[e]):i;class ft{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}const ct=[" ",",","?","!",";"],dt=new ft(20),ht=(i,e,t)=>{e=e||"",t=t||"";const n=ct.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(n.length===0)return!0;const s=dt.getRegExp(`(${n.map(a=>a==="?"?"\\?":a).join("|")})`);let r=!s.test(i);if(!r){const a=i.indexOf(t);a>0&&!s.test(i.substring(0,a))&&(r=!0)}return r},ge=(i,e,t=".")=>{if(!i)return;if(i[e])return Object.prototype.hasOwnProperty.call(i,e)?i[e]:void 0;const n=e.split(t);let s=i;for(let r=0;r-1&&li?.replace("_","-"),pt={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,e){console?.[i]?.apply?.(console,e)}};class ie{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||pt,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,s){return s&&!this.debug?null:(y(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new ie(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new ie(this.logger,e)}}var I=new ie;class le{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const s=this.observers[n].get(t)||0;this.observers[n].set(t,s+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([s,r])=>{for(let a=0;a{for(let a=0;a-1&&this.options.ns.splice(t,1)}getResource(e,t,n,s={}){const r=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):y(n)&&r?o.push(...n.split(r)):o.push(n)));const l=se(this.data,o);return!l&&!t&&!n&&e.indexOf(".")>-1&&(e=o[0],t=o[1],n=o.slice(2).join(".")),l||!a||!y(n)?l:ge(this.data?.[e]?.[t],n,r)}addResource(e,t,n,s,r={silent:!1}){const a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(".")>-1&&(o=e.split("."),s=t,t=o[1]),this.addNamespaces(t),Ce(this.data,o,s),r.silent||this.emit("added",e,t,n,s)}addResources(e,t,n,s={silent:!1}){for(const r in n)(y(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});s.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,s,r,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),s=n,n=t,t=o[1]),this.addNamespaces(t);let l=se(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),s?Be(l,n,r):l={...l,...n},Ce(this.data,o,l),a.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(s=>t[s]&&Object.keys(t[s]).length>0)}toJSON(){return this.data}}var qe={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,e,t,n,s){return i.forEach(r=>{e=this.processors[r]?.process(e,t,n,s)??e}),e}};const ze=Symbol("i18next/PATH_KEY");function gt(){const i=[],e=Object.create(null);let t;return e.get=(n,s)=>(t?.revoke?.(),s===ze?i:(i.push(s),t=Proxy.revocable(n,e),t.proxy)),Proxy.revocable(Object.create(null),e).proxy}function re(i,e){const{[ze]:t}=i(gt());return t.join(e?.keySeparator??".")}const $e={},fe=i=>!y(i)&&typeof i!="boolean"&&typeof i!="number";class ae extends le{constructor(e,t={}){super(),it(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=I.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const n={...t};if(e==null)return!1;const s=this.resolve(e,n);if(s?.res===void 0)return!1;const r=fe(s.res);return!(n.returnObjects===!1&&r)}extractFromKey(e,t){let n=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let r=t.ns||this.options.defaultNS||[];const a=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!ht(e,n,s);if(a&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:y(r)?[r]:r};const u=e.split(n);(n!==s||n===s&&this.options.ns.indexOf(u[0])>-1)&&(r=u.shift()),e=u.join(s)}return{key:e,namespaces:y(r)?[r]:r}}translate(e,t,n){let s=typeof t=="object"?{...t}:t;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),e==null)return"";typeof e=="function"&&(e=re(e,{...this.options,...s})),Array.isArray(e)||(e=[String(e)]);const r=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(e[e.length-1],s),u=l[l.length-1];let c=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;c===void 0&&(c=":");const f=s.lng||this.language,h=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()==="cimode")return h?r?{res:`${u}${c}${o}`,usedKey:o,exactUsedKey:o,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:`${u}${c}${o}`:r?{res:o,usedKey:o,exactUsedKey:o,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:o;const p=this.resolve(e,s);let d=p?.res;const v=p?.usedKey||o,b=p?.exactUsedKey||o,O=["[object Number]","[object Function]","[object RegExp]"],w=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,g=!this.i18nFormat||this.i18nFormat.handleAsObject,x=s.count!==void 0&&!y(s.count),L=ae.hasDefaultValue(s),S=x?this.pluralResolver.getSuffix(f,s.count,s):"",m=s.ordinal&&x?this.pluralResolver.getSuffix(f,s.count,{ordinal:!1}):"",k=x&&!s.ordinal&&s.count===0,E=k&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${S}`]||s[`defaultValue${m}`]||s.defaultValue;let C=d;g&&!d&&L&&(C=E);const $=fe(C),V=Object.prototype.toString.apply(C);if(g&&C&&$&&O.indexOf(V)<0&&!(y(w)&&Array.isArray(C))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const R=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,C,{...s,ns:l}):`key '${o} (${this.language})' returned an object instead of string.`;return r?(p.res=R,p.usedParams=this.getUsedParamsDetails(s),p):R}if(a){const R=Array.isArray(C),j=R?[]:{},Z=R?b:v;for(const N in C)if(Object.prototype.hasOwnProperty.call(C,N)){const D=`${Z}${a}${N}`;L&&!d?j[N]=this.translate(D,{...s,defaultValue:fe(E)?E[N]:void 0,joinArrays:!1,ns:l}):j[N]=this.translate(D,{...s,joinArrays:!1,ns:l}),j[N]===D&&(j[N]=C[N])}d=j}}else if(g&&y(w)&&Array.isArray(d))d=d.join(w),d&&(d=this.extendTranslation(d,e,s,n));else{let R=!1,j=!1;!this.isValidLookup(d)&&L&&(R=!0,d=E),this.isValidLookup(d)||(j=!0,d=o);const N=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&j?void 0:d,D=L&&E!==d&&this.options.updateMissing;if(j||R||D){if(this.logger.log(D?"updateKey":"missingKey",f,u,o,D?E:d),a){const F=this.resolve(o,{...s,keySeparator:!1});F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let z=[];const ee=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ee&&ee[0])for(let F=0;F{const Se=L&&X!==d?X:N;this.options.missingKeyHandler?this.options.missingKeyHandler(F,u,K,Se,D,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(F,u,K,Se,D,s),this.emit("missingKey",F,u,K,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?z.forEach(F=>{const K=this.pluralResolver.getSuffixes(F,s);k&&s[`defaultValue${this.options.pluralSeparator}zero`]&&K.indexOf(`${this.options.pluralSeparator}zero`)<0&&K.push(`${this.options.pluralSeparator}zero`),K.forEach(X=>{Oe([F],o+X,s[`defaultValue${X}`]||E)})}):Oe(z,o,E))}d=this.extendTranslation(d,e,s,p,n),j&&d===o&&this.options.appendNamespaceToMissingKey&&(d=`${u}${c}${o}`),(j||R)&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${c}${o}`:o,R?d:void 0,s))}return r?(p.res=d,p.usedParams=this.getUsedParamsDetails(s),p):d}extendTranslation(e,t,n,s,r){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const l=y(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(l){const f=e.match(this.interpolator.nestingRegexp);u=f&&f.length}let c=n.replace&&!y(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),e=this.interpolator.interpolate(e,c,n.lng||this.language||s.usedLng,n),l){const f=e.match(this.interpolator.nestingRegexp),h=f&&f.length;ur?.[0]===f[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${t[0]}`),null):this.translate(...f,t),n)),n.interpolation&&this.interpolator.reset()}const a=n.postProcess||this.options.postProcess,o=y(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=qe.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,s,r,a,o;return y(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(n))return;const u=this.extractFromKey(l,t),c=u.key;s=c;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const h=t.count!==void 0&&!y(t.count),p=h&&!t.ordinal&&t.count===0,d=t.context!==void 0&&(y(t.context)||typeof t.context=="number")&&t.context!=="",v=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);f.forEach(b=>{this.isValidLookup(n)||(o=b,!$e[`${v[0]}-${b}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&($e[`${v[0]}-${b}`]=!0,this.logger.warn(`key "${s}" for languages "${v.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),v.forEach(O=>{if(this.isValidLookup(n))return;a=O;const w=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(w,c,O,b,t);else{let x;h&&(x=this.pluralResolver.getSuffix(O,t.count,t));const L=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(t.ordinal&&x.indexOf(S)===0&&w.push(c+x.replace(S,this.options.pluralSeparator)),w.push(c+x),p&&w.push(c+L)),d){const m=`${c}${this.options.contextSeparator||"_"}${t.context}`;w.push(m),h&&(t.ordinal&&x.indexOf(S)===0&&w.push(m+x.replace(S,this.options.pluralSeparator)),w.push(m+x),p&&w.push(m+L))}}let g;for(;g=w.pop();)this.isValidLookup(n)||(r=g,n=this.getResource(O,b,g,t))}))})}),{res:n,usedKey:s,exactUsedKey:r,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,n,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,s):this.resourceStore.getResource(e,t,n,s)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!y(e.replace);let s=n?e.replace:e;if(n&&typeof e.count<"u"&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!n){s={...s};for(const r of t)delete s[r]}return s}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&e[n]!==void 0)return!0;return!1}}class Ee{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=I.create("languageUtils")}getScriptPartFromCode(e){if(e=Y(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=Y(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(y(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(n=>{if(t)return;const s=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(n=>{if(t)return;const s=this.getScriptPartFromCode(n);if(this.isSupportedCode(s))return t=s;const r=this.getLanguagePartFromCode(n);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(a=>{if(a===r)return a;if(!(a.indexOf("-")<0&&r.indexOf("-")<0)&&(a.indexOf("-")>0&&r.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===r||a.indexOf(r)===0&&r.length>1))return a})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),y(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),s=[],r=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return y(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(e))):y(e)&&r(this.formatLanguageCode(e)),n.forEach(a=>{s.indexOf(a)<0&&r(this.formatLanguageCode(a))}),s}}const Re={zero:0,one:1,two:2,few:3,many:4,other:5},je={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class mt{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=I.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const n=Y(e==="dev"?"en":e),s=t.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:n,type:s});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let a;try{a=new Intl.PluralRules(n,{type:s})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),je;if(!e.match(/-|_/))return je;const l=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(l,t)}return this.pluralRulesCache[r]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(s=>`${t}${s}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?n.resolvedOptions().pluralCategories.sort((s,r)=>Re[s]-Re[r]).map(s=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(e,t,n={}){const s=this.getRule(e,n);return s?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}const Te=(i,e,t,n=".",s=!0)=>{let r=ot(i,e,t);return!r&&s&&y(t)&&(r=ge(i,t,n),r===void 0&&(r=ge(e,t,n))),r},ce=i=>i.replace(/\$/g,"$$$$");class yt{constructor(e={}){this.logger=I.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(t=>t),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:s,prefix:r,prefixEscaped:a,suffix:o,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:f,nestingPrefix:h,nestingPrefixEscaped:p,nestingSuffix:d,nestingSuffixEscaped:v,nestingOptionsSeparator:b,maxReplaces:O,alwaysFormat:w}=e.interpolation;this.escape=t!==void 0?t:ut,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=r?_(r):a||"{{",this.suffix=o?_(o):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=h?_(h):p||_("$t("),this.nestingSuffix=d?_(d):v||_(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=O||1e3,this.alwaysFormat=w!==void 0?w:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,n)=>t?.source===n?(t.lastIndex=0,t):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,s){let r,a,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=p=>{if(p.indexOf(this.formatSeparator)<0){const O=Te(t,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(O,void 0,n,{...s,...t,interpolationkey:p}):O}const d=p.split(this.formatSeparator),v=d.shift().trim(),b=d.join(this.formatSeparator).trim();return this.format(Te(t,l,v,this.options.keySeparator,this.options.ignoreJSONStructure),b,n,{...s,...t,interpolationkey:v})};this.resetRegExp();const c=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>ce(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?ce(this.escape(p)):ce(p)}].forEach(p=>{for(o=0;r=p.regex.exec(e);){const d=r[1].trim();if(a=u(d),a===void 0)if(typeof c=="function"){const b=c(e,r,s);a=y(b)?b:""}else if(s&&Object.prototype.hasOwnProperty.call(s,d))a="";else if(f){a=r[0];continue}else this.logger.warn(`missed to pass in variable ${d} for interpolating ${e}`),a="";else!y(a)&&!this.useRawValueToEscape&&(a=we(a));const v=p.safeValue(a);if(e=e.replace(r[0],v),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=r[0].length):p.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let s,r,a;const o=(l,u)=>{const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const f=l.split(new RegExp(`${c}[ ]*{`));let h=`{${f[1]}`;l=f[0],h=this.interpolate(h,a);const p=h.match(/'/g),d=h.match(/"/g);((p?.length??0)%2===0&&!d||d.length%2!==0)&&(h=h.replace(/'/g,'"'));try{a=JSON.parse(h),u&&(a={...u,...a})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,v),`${l}${c}${h}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;s=this.nestingRegexp.exec(e);){let l=[];a={...n},a=a.replace&&!y(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const u=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(u!==-1&&(l=s[1].slice(u).split(this.formatSeparator).map(c=>c.trim()).filter(Boolean),s[1]=s[1].slice(0,u)),r=t(o.call(this,s[1].trim(),a),a),r&&s[0]===e&&!y(r))return r;y(r)||(r=we(r)),r||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),r=""),l.length&&(r=l.reduce((c,f)=>this.format(c,f,n.lng,{...n,interpolationkey:s[1].trim()}),r.trim())),e=e.replace(s[0],r),this.regexp.lastIndex=0}return e}}const bt=i=>{let e=i.toLowerCase().trim();const t={};if(i.indexOf("(")>-1){const n=i.split("(");e=n[0].toLowerCase().trim();const s=n[1].substring(0,n[1].length-1);e==="currency"&&s.indexOf(":")<0?t.currency||(t.currency=s.trim()):e==="relativetime"&&s.indexOf(":")<0?t.range||(t.range=s.trim()):s.split(";").forEach(a=>{if(a){const[o,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),c=o.trim();t[c]||(t[c]=u),u==="false"&&(t[c]=!1),u==="true"&&(t[c]=!0),isNaN(u)||(t[c]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},ke=i=>{const e={};return(t,n,s)=>{let r=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(r={...r,[s.interpolationkey]:void 0});const a=n+JSON.stringify(r);let o=e[a];return o||(o=i(Y(n),s),e[a]=o),o(t)}},xt=i=>(e,t,n)=>i(Y(t),n)(e);class vt{constructor(e={}){this.logger=I.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const n=t.cacheInBuiltFormats?ke:xt;this.formats={number:n((s,r)=>{const a=new Intl.NumberFormat(s,{...r});return o=>a.format(o)}),currency:n((s,r)=>{const a=new Intl.NumberFormat(s,{...r,style:"currency"});return o=>a.format(o)}),datetime:n((s,r)=>{const a=new Intl.DateTimeFormat(s,{...r});return o=>a.format(o)}),relativetime:n((s,r)=>{const a=new Intl.RelativeTimeFormat(s,{...r});return o=>a.format(o,r.range||"day")}),list:n((s,r)=>{const a=new Intl.ListFormat(s,{...r});return o=>a.format(o)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ke(t)}format(e,t,n,s={}){const r=t.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&r[0].indexOf(")")<0&&r.find(o=>o.indexOf(")")>-1)){const o=r.findIndex(l=>l.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,o)].join(this.formatSeparator)}return r.reduce((o,l)=>{const{formatName:u,formatOptions:c}=bt(l);if(this.formats[u]){let f=o;try{const h=s?.formatParams?.[s.interpolationkey]||{},p=h.locale||h.lng||s.locale||s.lng||n;f=this.formats[u](o,p,{...c,...s,...h})}catch(h){this.logger.warn(h)}return f}else this.logger.warn(`there was no format function for ${u}`);return o},e)}}const Ot=(i,e)=>{i.pending[e]!==void 0&&(delete i.pending[e],i.pendingCount--)};class St extends le{constructor(e,t,n,s={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=s,this.logger=I.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,s.backend,s)}queueLoad(e,t,n,s){const r={},a={},o={},l={};return e.forEach(u=>{let c=!0;t.forEach(f=>{const h=`${u}|${f}`;!n.reload&&this.store.hasResourceBundle(u,f)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?a[h]===void 0&&(a[h]=!0):(this.state[h]=1,c=!1,a[h]===void 0&&(a[h]=!0),r[h]===void 0&&(r[h]=!0),l[f]===void 0&&(l[f]=!0)))}),c||(o[u]=!0)}),(Object.keys(r).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(r),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,t,n){const s=e.split("|"),r=s[0],a=s[1];t&&this.emit("failedLoading",r,a,t),!t&&n&&this.store.addResourceBundle(r,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const o={};this.queue.forEach(l=>{at(l.loaded,[r],a),Ot(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{o[u]||(o[u]={});const c=l.loaded[u];c.length&&c.forEach(f=>{o[u][f]===void 0&&(o[u][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,t,n,s=0,r=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:s,wait:r,callback:a});return}this.readingCalls++;const o=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&c&&s{this.read.call(this,e,t,n,s+1,r*2,a)},r);return}a(u,c)},l=this.backend[n].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(c=>o(null,c)).catch(o):o(null,u)}catch(u){o(u)}return}return l(e,t,o)}prepareLoading(e,t,n={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();y(e)&&(e=this.languageUtils.toResolveHierarchy(e)),y(t)&&(t=[t]);const r=this.queueLoad(e,t,n,s);if(!r.toLoad.length)return r.pending.length||s(),null;r.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=""){const n=e.split("|"),s=n[0],r=n[1];this.read(s,r,"read",void 0,void 0,(a,o)=>{a&&this.logger.warn(`${t}loading namespace ${r} for language ${s} failed`,a),!a&&o&&this.logger.log(`${t}loaded namespace ${r} for language ${s}`,o),this.loaded(e,a,o)})}saveMissing(e,t,n,s,r,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){const l={...a,isUpdate:r},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(e,t,n,s,l):c=u(e,t,n,s),c&&typeof c.then=="function"?c.then(f=>o(null,f)).catch(o):o(null,c)}catch(c){o(c)}else u(e,t,n,s,o,l)}!e||!e[0]||this.store.addResource(e[0],t,n,s)}}}const Fe=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let e={};if(typeof i[1]=="object"&&(e=i[1]),y(i[1])&&(e.defaultValue=i[1]),y(i[2])&&(e.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const t=i[3]||i[2];Object.keys(t).forEach(n=>{e[n]=t[n]})}return e},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Ae=i=>(y(i.ns)&&(i.ns=[i.ns]),y(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),y(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs?.indexOf?.("cimode")<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i),te=()=>{},wt=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(t=>{typeof i[t]=="function"&&(i[t]=i[t].bind(i))})};class Q extends le{constructor(e={},t){if(super(),this.options=Ae(e),this.services={},this.logger=I,this.modules={external:[]},wt(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(y(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const n=Fe();this.options={...n,...this.options,...Ae(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const s=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?I.init(s(this.modules.logger),this.options):I.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=vt;const c=new Ee(this.options);this.store=new Ne(this.options.resources,this.options);const f=this.services;f.logger=I,f.resourceStore=this.store,f.languageUtils=c,f.pluralResolver=new mt(c,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),u&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(f.formatter=s(u),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new yt(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new St(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(p,...d)=>{this.emit(p,...d)}),this.modules.languageDetector&&(f.languageDetector=s(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=s(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new ae(this.services,this.options),this.translator.on("*",(p,...d)=>{this.emit(p,...d)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,t||(t=te),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=(...c)=>this.store[u](...c)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...c)=>(this.store[u](...c),this)});const o=J(),l=()=>{const u=(c,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),o.resolve(f),t(c,f)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),o}loadResources(e,t=te){let n=t;const s=y(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(s?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const r=[],a=o=>{if(!o||o==="cimode")return;this.services.languageUtils.toResolveHierarchy(o).forEach(u=>{u!=="cimode"&&r.indexOf(u)<0&&r.push(u)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload?.forEach?.(o=>a(o)),this.services.backendConnector.load(r,this.options.ns,o=>{!o&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(o)})}else n(null)}reloadResources(e,t,n){const s=J();return typeof e=="function"&&(n=e,e=void 0),typeof t=="function"&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=te),this.services.backendConnector.reload(e,t,r=>{s.resolve(),n(r)}),s}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&qe.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let t=0;t-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const n=J();this.emit("languageChanging",e);const s=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},r=(o,l)=>{l?this.isLanguageChangingTo===e&&(s(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...u)=>this.t(...u)),t&&t(o,(...u)=>this.t(...u))},a=o=>{!e&&!o&&this.services.languageDetector&&(o=[]);const l=y(o)?o:o&&o[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(y(o)?[o]:o);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,c=>{r(c,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n){const s=(r,a,...o)=>{let l;typeof a!="object"?l=this.options.overloadTranslationOptionHandler([r,a].concat(o)):l={...a},l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||n||s.keyPrefix);const u=this.options.keySeparator||".";let c;return l.keyPrefix&&Array.isArray(r)?c=r.map(f=>(typeof f=="function"&&(f=re(f,{...this.options,...a})),`${l.keyPrefix}${u}${f}`)):(typeof r=="function"&&(r=re(r,{...this.options,...a})),c=l.keyPrefix?`${l.keyPrefix}${u}${r}`:r),this.t(c,l)};return y(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=n,s}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const a=(o,l)=>{const u=this.services.backendConnector.state[`${o}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const o=t.precheck(this,a);if(o!==void 0)return o}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!s||a(r,e)))}loadNamespaces(e,t){const n=J();return this.options.ns?(y(e)&&(e=[e]),e.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{n.resolve(),t&&t(s)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=J();y(e)&&(e=[e]);const s=this.options.preload||[],r=e.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return r.length?(this.options.preload=s.concat(r),this.loadResources(a=>{n.resolve(),t&&t(a)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const s=new Intl.Locale(e);if(s&&s.getTextInfo){const r=s.getTextInfo();if(r&&r.direction)return r.direction}}catch{}const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new Ee(Fe());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new Q(e,t)}cloneInstance(e={},t=te){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const s={...this.options,...e,isClone:!0},r=new Q(s);if((e.debug!==void 0||e.prefix!==void 0)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(o=>{r[o]=this[o]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},n){const o=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},l[u]=Object.keys(l[u]).reduce((c,f)=>(c[f]={...l[u][f]},c),l[u]),l),{});r.store=new Ne(o,s),r.services.resourceStore=r.store}return r.translator=new ae(r.services,s),r.translator.on("*",(o,...l)=>{r.emit(o,...l)}),r.init(s,t),r.translator.options=s,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const T=Q.createInstance();T.createInstance=Q.createInstance;T.createInstance;T.dir;T.init;T.loadResources;T.reloadResources;T.use;T.changeLanguage;T.getFixedT;T.t;T.exists;T.setDefaultNamespace;T.hasLoadedNamespace;T.loadNamespaces;T.loadLanguages;const ne=(i,e,t,n)=>{const s=[t,{code:e,...n||{}}];if(i?.services?.logger?.forward)return i.services.logger.forward(s,"warn","react-i18next::",!0);A(s[0])&&(s[0]=`react-i18next:: ${s[0]}`),i?.services?.logger?.warn?i.services.logger.warn(...s):console?.warn&&console.warn(...s)},Ie={},ue=(i,e,t,n)=>{A(t)&&Ie[t]||(A(t)&&(Ie[t]=new Date),ne(i,e,t,n))},Xe=(i,e)=>()=>{if(i.isInitialized)e();else{const t=()=>{setTimeout(()=>{i.off("initialized",t)},0),e()};i.on("initialized",t)}},me=(i,e,t)=>{i.loadNamespaces(e,Xe(i,t))},De=(i,e,t,n)=>{if(A(t)&&(t=[t]),i.options.preload&&i.options.preload.indexOf(e)>-1)return me(i,t,n);t.forEach(s=>{i.options.ns.indexOf(s)<0&&i.options.ns.push(s)}),i.loadLanguages(e,Xe(i,n))},Lt=(i,e,t={})=>!e.languages||!e.languages.length?(ue(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(i,{lng:t.lng,precheck:(n,s)=>{if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!s(n.isLanguageChangingTo,i))return!1}}),A=i=>typeof i=="string",H=i=>typeof i=="object"&&i!==null,Pt=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Ct={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Nt=i=>Ct[i],$t=i=>i.replace(Pt,Nt);let ye={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:$t};const Et=(i={})=>{ye={...ye,...i}},Je=()=>ye;let We;const Rt=i=>{We=i},ve=()=>We,de=(i,e)=>{if(!i)return!1;const t=i.props?.children??i.children;return e?t.length>0:!!t},he=i=>{if(!i)return[];const e=i.props?.children??i.children;return i.props?.i18nIsDynamicList?B(e):e},jt=i=>Array.isArray(i)&&i.every(P.isValidElement),B=i=>Array.isArray(i)?i:[i],Tt=(i,e)=>{const t={...e};return t.props=Object.assign(i.props,e.props),t},Ye=(i,e,t,n)=>{if(!i)return"";let s="";const r=B(i),a=e?.transSupportBasicHtmlNodes?e.transKeepBasicHtmlNodesFor??[]:[];return r.forEach((o,l)=>{if(A(o)){s+=`${o}`;return}if(P.isValidElement(o)){const{props:u,type:c}=o,f=Object.keys(u).length,h=a.indexOf(c)>-1,p=u.children;if(!p&&h&&!f){s+=`<${c}/>`;return}if(!p&&(!h||f)||u.i18nIsDynamicList){s+=`<${l}>`;return}if(h&&f===1&&A(p)){s+=`<${c}>${p}`;return}const d=Ye(p,e,t,n);s+=`<${l}>${d}`;return}if(o===null){ne(t,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:n});return}if(H(o)){const{format:u,...c}=o,f=Object.keys(c);if(f.length===1){const h=u?`${f[0]}, ${u}`:f[0];s+=`{{${h}}}`;return}ne(t,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:n,child:o});return}ne(t,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:n,child:o})}),s},kt=(i,e,t,n,s,r,a)=>{if(t==="")return[];const o=s.transKeepBasicHtmlNodesFor||[],l=t&&new RegExp(o.map(O=>`<${O}`).join("|")).test(t);if(!i&&!e&&!l&&!a)return[t];const u=e??{},c=O=>{B(O).forEach(g=>{A(g)||(de(g)?c(he(g)):H(g)&&!P.isValidElement(g)&&Object.assign(u,g))})};c(i);const f=nt.parse(`<0>${t}`),h={...u,...r},p=(O,w,g)=>{const x=he(O),L=v(x,w.children,g);return jt(x)&&L.length===0||O.props?.i18nIsDynamicList?x:L},d=(O,w,g,x,L)=>{O.dummy?(O.children=w,g.push(P.cloneElement(O,{key:x},L?void 0:w))):g.push(...P.Children.map([O],S=>{const m={...S.props};return delete m.i18nIsDynamicList,P.createElement(S.type,{...m,key:x,ref:S.props.ref??S.ref},L?null:w)}))},v=(O,w,g)=>{const x=B(O);return B(w).reduce((S,m,k)=>{const E=m.children?.[0]?.content&&n.services.interpolator.interpolate(m.children[0].content,h,n.language);if(m.type==="tag"){let C=x[parseInt(m.name,10)];!C&&e&&(C=e[m.name]),g.length===1&&!C&&(C=g[0][m.name]),C||(C={});const $=Object.keys(m.attrs).length!==0?Tt({props:m.attrs},C):C,V=P.isValidElement($),R=V&&de(m,!0)&&!m.voidElement,j=l&&H($)&&$.dummy&&!V,Z=H(e)&&Object.hasOwnProperty.call(e,m.name);if(A($)){const N=n.services.interpolator.interpolate($,h,n.language);S.push(N)}else if(de($)||R){const N=p($,m,g);d($,N,S,k)}else if(j){const N=v(x,m.children,g);d($,N,S,k)}else if(Number.isNaN(parseFloat(m.name)))if(Z){const N=p($,m,g);d($,N,S,k,m.voidElement)}else if(s.transSupportBasicHtmlNodes&&o.indexOf(m.name)>-1)if(m.voidElement)S.push(P.createElement(m.name,{key:`${m.name}-${k}`}));else{const N=v(x,m.children,g);S.push(P.createElement(m.name,{key:`${m.name}-${k}`},N))}else if(m.voidElement)S.push(`<${m.name} />`);else{const N=v(x,m.children,g);S.push(`<${m.name}>${N}`)}else if(H($)&&!V){const N=m.children[0]?E:null;N&&S.push(N)}else d($,E,S,k,m.children.length!==1||!E)}else if(m.type==="text"){const C=s.transWrapTextNodes,$=a?s.unescape(n.services.interpolator.interpolate(m.content,h,n.language)):n.services.interpolator.interpolate(m.content,h,n.language);C?S.push(P.createElement(C,{key:`${m.name}-${k}`},$)):S.push($)}return S},[])},b=v([{dummy:!0,children:i||[]}],f,B(i||[]));return he(b[0])},Qe=(i,e,t)=>{const n=i.key||e,s=P.cloneElement(i,{key:n});if(!s.props||!s.props.children||t.indexOf(`${e}/>`)<0&&t.indexOf(`${e} />`)<0)return s;function r(){return P.createElement(P.Fragment,null,s)}return P.createElement(r,{key:n})},Ft=(i,e)=>i.map((t,n)=>Qe(t,n,e)),At=(i,e)=>{const t={};return Object.keys(i).forEach(n=>{Object.assign(t,{[n]:Qe(i[n],n,e)})}),t},It=(i,e,t,n)=>i?Array.isArray(i)?Ft(i,e):H(i)?At(i,e):(ue(t,"TRANS_INVALID_COMPONENTS",' "components" prop expects an object or array',{i18nKey:n}),null):null,Dt=i=>!H(i)||Array.isArray(i)?!1:Object.keys(i).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function Vt({children:i,count:e,parent:t,i18nKey:n,context:s,tOptions:r={},values:a,defaults:o,components:l,ns:u,i18n:c,t:f,shouldUnescape:h,...p}){const d=c||ve();if(!d)return ue(d,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:n}),i;const v=f||d.t.bind(d)||(j=>j),b={...Je(),...d.options?.react};let O=u||v.ns||d.options?.defaultNS;O=A(O)?[O]:O||["translation"];const w=Ye(i,b,d,n),g=o||r?.defaultValue||w||b.transEmptyNodeValue||(typeof n=="function"?re(n):n),{hashTransKey:x}=b,L=n||(x?x(w||g):w||g);d.options?.interpolation?.defaultVariables&&(a=a&&Object.keys(a).length>0?{...a,...d.options.interpolation.defaultVariables}:{...d.options.interpolation.defaultVariables});const S=a||e!==void 0&&!d.options?.interpolation?.alwaysFormat||!i?r.interpolation:{interpolation:{...r.interpolation,prefix:"#$?",suffix:"?$#"}},m={...r,context:s||r.context,count:e,...a,...S,defaultValue:o||r?.defaultValue,ns:O},k=L?v(L,m):g,E=It(l,k,d,n);let C=E||i,$=null;Dt(E)&&($=E,C=i);const V=kt(C,$,k,d,b,m,h),R=t??b.defaultTransParent;return R?P.createElement(R,p,V):V}const un={type:"3rdParty",init(i){Et(i.options.react),Rt(i)}},Ge=P.createContext();class Ht{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function fn({children:i,count:e,parent:t,i18nKey:n,context:s,tOptions:r={},values:a,defaults:o,components:l,ns:u,i18n:c,t:f,shouldUnescape:h,...p}){const{i18n:d,defaultNS:v}=P.useContext(Ge)||{},b=c||d||ve(),O=f||b?.t.bind(b);return Vt({children:i,count:e,parent:t,i18nKey:n,context:s,tOptions:r,values:a,defaults:o,components:l,ns:u||O?.ns||v||b?.options?.defaultNS,i18n:b,t:f,shouldUnescape:h,...p})}const Mt=(i,e)=>A(e)?e:H(e)&&A(e.defaultValue)?e.defaultValue:Array.isArray(i)?i[i.length-1]:i,Kt={t:Mt,ready:!1},Ut=()=>()=>{},cn=(i,e={})=>{const{i18n:t}=e,{i18n:n,defaultNS:s}=P.useContext(Ge)||{},r=t||n||ve();r&&!r.reportNamespaces&&(r.reportNamespaces=new Ht),r||ue(r,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const a=P.useMemo(()=>({...Je(),...r?.options?.react,...e}),[r,e]),{useSuspense:o,keyPrefix:l}=a,u=P.useMemo(()=>{const g=i||s||r?.options?.defaultNS;return A(g)?[g]:g||["translation"]},[i,s,r]);r?.reportNamespaces?.addUsedNamespaces?.(u);const c=P.useCallback(g=>{if(!r)return Ut;const{bindI18n:x,bindI18nStore:L}=a;return x&&r.on(x,g),L&&r.store.on(L,g),()=>{x&&x.split(" ").forEach(S=>r.off(S,g)),L&&L.split(" ").forEach(S=>r.store.off(S,g))}},[r,a]),f=P.useRef(),h=P.useCallback(()=>{if(!r)return Kt;const g=!!(r.isInitialized||r.initializedStoreOnce)&&u.every(m=>Lt(m,r,a)),x=r.getFixedT(e.lng||r.language,a.nsMode==="fallback"?u:u[0],l),L=f.current;if(L&&L.ready===g&&L.lng===(e.lng||r.language)&&L.keyPrefix===l)return L;const S={t:x,ready:g,lng:e.lng||r.language,keyPrefix:l};return f.current=S,S},[r,u,l,a,e.lng]),[p,d]=P.useState(0),{t:v,ready:b}=st.useSyncExternalStore(c,h,h);P.useEffect(()=>{if(r&&!b&&!o){const g=()=>d(x=>x+1);e.lng?De(r,e.lng,u,g):me(r,u,g)}},[r,e.lng,u,b,o,p]);const O=r||{},w=P.useMemo(()=>{const g=[v,O,b];return g.t=v,g.i18n=O,g.ready=b,g},[v,O,b]);if(r&&o&&!b)throw new Promise(g=>{const x=()=>g();e.lng?De(r,e.lng,u,x):me(r,u,x)});return w};function be(i){"@babel/helpers - typeof";return be=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},be(i)}function Ze(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":be(XMLHttpRequest))==="object"}function _t(i){return!!i&&typeof i.then=="function"}function Bt(i){return _t(i)?i:Promise.resolve(i)}const qt="modulepreload",zt=function(i){return"/"+i},Ve={},Xt=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=a?.nonce||a?.getAttribute("nonce");s=Promise.allSettled(t.map(l=>{if(l=zt(l),l in Ve)return;Ve[l]=!0;const u=l.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${c}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":qt,u||(f.as="script"),f.crossOrigin="",f.href=l,o&&f.setAttribute("nonce",o),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})};function He(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,n)}return t}function Me(i){for(var e=1;eimport("./vendor-DReq5CoA.js").then(i=>i.b),__vite__mapDeps([0,1])).then(function(i){M=i.default}).catch(function(){})}catch{}var xe=function(e,t){if(t&&U(t)==="object"){var n="";for(var s in t)n+="&"+encodeURIComponent(s)+"="+encodeURIComponent(t[s]);if(!n)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+n.slice(1)}return e},Ke=function(e,t,n,s){var r=function(l){if(!l.ok)return n(l.statusText||"Error",{status:l.status});l.text().then(function(u){n(null,{status:l.status,data:u})}).catch(n)};if(s){var a=s(e,t);if(a instanceof Promise){a.then(r).catch(n);return}}typeof fetch=="function"?fetch(e,t).then(r).catch(n):M(e,t).then(r).catch(n)},Ue=!1,Qt=function(e,t,n,s){e.queryStringParams&&(t=xe(t,e.queryStringParams));var r=Me({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(r["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),n&&(r["Content-Type"]="application/json");var a=typeof e.requestOptions=="function"?e.requestOptions(n):e.requestOptions,o=Me({method:n?"POST":"GET",body:n?e.stringify(n):void 0,headers:r},Ue?{}:a),l=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{Ke(t,o,s,l)}catch(u){if(!a||Object.keys(a).length===0||!u.message||u.message.indexOf("not implemented")<0)return s(u);try{Object.keys(a).forEach(function(c){delete o[c]}),Ke(t,o,s,l),Ue=!0}catch(c){s(c)}}},Gt=function(e,t,n,s){n&&U(n)==="object"&&(n=xe("",n).slice(1)),e.queryStringParams&&(t=xe(t,e.queryStringParams));try{var r=G?new G:new oe("MSXML2.XMLHTTP.3.0");r.open(n?"POST":"GET",t,1),e.crossDomain||r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.withCredentials=!!e.withCredentials,n&&r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.overrideMimeType&&r.overrideMimeType("application/json");var a=e.customHeaders;if(a=typeof a=="function"?a():a,a)for(var o in a)r.setRequestHeader(o,a[o]);r.onreadystatechange=function(){r.readyState>3&&s(r.status>=400?r.statusText:null,{status:r.status,data:r.responseText})},r.send(n)}catch(l){console&&console.log(l)}},Zt=function(e,t,n,s){if(typeof n=="function"&&(s=n,n=void 0),s=s||function(){},M&&t.indexOf("file:")!==0)return Qt(e,t,n,s);if(Ze()||typeof ActiveXObject=="function")return Gt(e,t,n,s);s(new Error("No fetch and no xhr implementation found!"))};function q(i){"@babel/helpers - typeof";return q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(i)}function _e(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,n)}return t}function pe(i){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};en(this,i),this.services=e,this.options=t,this.allOptions=n,this.type="backend",this.init(e,t,n)}return nn(i,[{key:"init",value:function(t){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=t,this.options=pe(pe(pe({},rn()),this.options||{}),s),this.allOptions=r,this.services&&this.options.reloadInterval){var a=setInterval(function(){return n.reload()},this.options.reloadInterval);q(a)==="object"&&typeof a.unref=="function"&&a.unref()}}},{key:"readMulti",value:function(t,n,s){this._readAny(t,t,n,n,s)}},{key:"read",value:function(t,n,s){this._readAny([t],t,[n],n,s)}},{key:"_readAny",value:function(t,n,s,r,a){var o=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(t,s)),l=Bt(l),l.then(function(u){if(!u)return a(null,{});var c=o.services.interpolator.interpolate(u,{lng:t.join("+"),ns:s.join("+")});o.loadUrl(c,a,n,r)})}},{key:"loadUrl",value:function(t,n,s,r){var a=this,o=typeof s=="string"?[s]:s,l=typeof r=="string"?[r]:r,u=this.options.parseLoadPayload(o,l);this.options.request(this.options,t,u,function(c,f){if(f&&(f.status>=500&&f.status<600||!f.status))return n("failed loading "+t+"; status code: "+f.status,!0);if(f&&f.status>=400&&f.status<500)return n("failed loading "+t+"; status code: "+f.status,!1);if(!f&&c&&c.message){var h=c.message.toLowerCase(),p=["failed","fetch","network","load"].find(function(b){return h.indexOf(b)>-1});if(p)return n("failed loading "+t+": "+c.message,!0)}if(c)return n(c,!1);var d,v;try{typeof f.data=="string"?d=a.options.parse(f.data,s,r):d=f.data}catch{v="failed parsing "+t+" to json"}if(v)return n(v,!1);n(null,d)})}},{key:"create",value:function(t,n,s,r,a){var o=this;if(this.options.addPath){typeof t=="string"&&(t=[t]);var l=this.options.parsePayload(n,s,r),u=0,c=[],f=[];t.forEach(function(h){var p=o.options.addPath;typeof o.options.addPath=="function"&&(p=o.options.addPath(h,n));var d=o.services.interpolator.interpolate(p,{lng:h,ns:n});o.options.request(o.options,d,l,function(v,b){u+=1,c.push(v),f.push(b),u===t.length&&typeof a=="function"&&a(c,f)})})}}},{key:"reload",value:function(){var t=this,n=this.services,s=n.backendConnector,r=n.languageUtils,a=n.logger,o=s.language;if(!(o&&o.toLowerCase()==="cimode")){var l=[],u=function(f){var h=r.toResolveHierarchy(f);h.forEach(function(p){l.indexOf(p)<0&&l.push(p)})};u(o),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){t.allOptions.ns.forEach(function(f){s.read(c,f,"read",null,null,function(h,p){h&&a.warn("loading namespace ".concat(f," for language ").concat(c," failed"),h),!h&&p&&a.log("loaded namespace ".concat(f," for language ").concat(c),p),s.loaded("".concat(c,"|").concat(f),h,p)})})})}}}])}();an.type="backend";export{an as B,fn as T,un as a,T as i,cn as u}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["reusable-components/chunks/vendor-B5oGEj-7.js","reusable-components/chunks/react-Dtf48RLW.js"])))=>i.map(i=>d[i]); +import{r as P}from"./react-Dtf48RLW.js";import{i as nt,s as st}from"./vendor-B5oGEj-7.js";const y=i=>typeof i=="string",J=()=>{let i,e;const t=new Promise((n,s)=>{i=n,e=s});return t.resolve=i,t.reject=e,t},we=i=>i==null?"":""+i,it=(i,e,t)=>{i.forEach(n=>{e[n]&&(t[n]=e[n])})},rt=/###/g,Le=i=>i&&i.indexOf("###")>-1?i.replace(rt,"."):i,Pe=i=>!i||y(i),W=(i,e,t)=>{const n=y(e)?e.split("."):e;let s=0;for(;s{const{obj:n,k:s}=W(i,e,Object);if(n!==void 0||e.length===1){n[s]=t;return}let r=e[e.length-1],a=e.slice(0,e.length-1),o=W(i,a,Object);for(;o.obj===void 0&&a.length;)r=`${a[a.length-1]}.${r}`,a=a.slice(0,a.length-1),o=W(i,a,Object),o?.obj&&typeof o.obj[`${o.k}.${r}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${r}`]=t},at=(i,e,t,n)=>{const{obj:s,k:r}=W(i,e,Object);s[r]=s[r]||[],s[r].push(t)},se=(i,e)=>{const{obj:t,k:n}=W(i,e);if(t&&Object.prototype.hasOwnProperty.call(t,n))return t[n]},ot=(i,e,t)=>{const n=se(i,t);return n!==void 0?n:se(e,t)},Be=(i,e,t)=>{for(const n in e)n!=="__proto__"&&n!=="constructor"&&(n in i?y(i[n])||i[n]instanceof String||y(e[n])||e[n]instanceof String?t&&(i[n]=e[n]):Be(i[n],e[n],t):i[n]=e[n]);return i},_=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var lt={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const ut=i=>y(i)?i.replace(/[&<>"'\/]/g,e=>lt[e]):i;class ft{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}const ct=[" ",",","?","!",";"],dt=new ft(20),ht=(i,e,t)=>{e=e||"",t=t||"";const n=ct.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(n.length===0)return!0;const s=dt.getRegExp(`(${n.map(a=>a==="?"?"\\?":a).join("|")})`);let r=!s.test(i);if(!r){const a=i.indexOf(t);a>0&&!s.test(i.substring(0,a))&&(r=!0)}return r},ge=(i,e,t=".")=>{if(!i)return;if(i[e])return Object.prototype.hasOwnProperty.call(i,e)?i[e]:void 0;const n=e.split(t);let s=i;for(let r=0;r-1&&li?.replace("_","-"),pt={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,e){console?.[i]?.apply?.(console,e)}};class ie{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||pt,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,s){return s&&!this.debug?null:(y(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new ie(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new ie(this.logger,e)}}var I=new ie;class le{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const s=this.observers[n].get(t)||0;this.observers[n].set(t,s+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([s,r])=>{for(let a=0;a{for(let a=0;a-1&&this.options.ns.splice(t,1)}getResource(e,t,n,s={}){const r=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):y(n)&&r?o.push(...n.split(r)):o.push(n)));const l=se(this.data,o);return!l&&!t&&!n&&e.indexOf(".")>-1&&(e=o[0],t=o[1],n=o.slice(2).join(".")),l||!a||!y(n)?l:ge(this.data?.[e]?.[t],n,r)}addResource(e,t,n,s,r={silent:!1}){const a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(".")>-1&&(o=e.split("."),s=t,t=o[1]),this.addNamespaces(t),Ce(this.data,o,s),r.silent||this.emit("added",e,t,n,s)}addResources(e,t,n,s={silent:!1}){for(const r in n)(y(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});s.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,s,r,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),s=n,n=t,t=o[1]),this.addNamespaces(t);let l=se(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),s?Be(l,n,r):l={...l,...n},Ce(this.data,o,l),a.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(s=>t[s]&&Object.keys(t[s]).length>0)}toJSON(){return this.data}}var qe={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,e,t,n,s){return i.forEach(r=>{e=this.processors[r]?.process(e,t,n,s)??e}),e}};const ze=Symbol("i18next/PATH_KEY");function gt(){const i=[],e=Object.create(null);let t;return e.get=(n,s)=>(t?.revoke?.(),s===ze?i:(i.push(s),t=Proxy.revocable(n,e),t.proxy)),Proxy.revocable(Object.create(null),e).proxy}function re(i,e){const{[ze]:t}=i(gt());return t.join(e?.keySeparator??".")}const $e={},fe=i=>!y(i)&&typeof i!="boolean"&&typeof i!="number";class ae extends le{constructor(e,t={}){super(),it(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=I.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const n={...t};if(e==null)return!1;const s=this.resolve(e,n);if(s?.res===void 0)return!1;const r=fe(s.res);return!(n.returnObjects===!1&&r)}extractFromKey(e,t){let n=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let r=t.ns||this.options.defaultNS||[];const a=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!ht(e,n,s);if(a&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:y(r)?[r]:r};const u=e.split(n);(n!==s||n===s&&this.options.ns.indexOf(u[0])>-1)&&(r=u.shift()),e=u.join(s)}return{key:e,namespaces:y(r)?[r]:r}}translate(e,t,n){let s=typeof t=="object"?{...t}:t;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),e==null)return"";typeof e=="function"&&(e=re(e,{...this.options,...s})),Array.isArray(e)||(e=[String(e)]);const r=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(e[e.length-1],s),u=l[l.length-1];let c=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;c===void 0&&(c=":");const f=s.lng||this.language,h=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()==="cimode")return h?r?{res:`${u}${c}${o}`,usedKey:o,exactUsedKey:o,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:`${u}${c}${o}`:r?{res:o,usedKey:o,exactUsedKey:o,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:o;const p=this.resolve(e,s);let d=p?.res;const v=p?.usedKey||o,b=p?.exactUsedKey||o,O=["[object Number]","[object Function]","[object RegExp]"],w=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,g=!this.i18nFormat||this.i18nFormat.handleAsObject,x=s.count!==void 0&&!y(s.count),L=ae.hasDefaultValue(s),S=x?this.pluralResolver.getSuffix(f,s.count,s):"",m=s.ordinal&&x?this.pluralResolver.getSuffix(f,s.count,{ordinal:!1}):"",k=x&&!s.ordinal&&s.count===0,E=k&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${S}`]||s[`defaultValue${m}`]||s.defaultValue;let C=d;g&&!d&&L&&(C=E);const $=fe(C),V=Object.prototype.toString.apply(C);if(g&&C&&$&&O.indexOf(V)<0&&!(y(w)&&Array.isArray(C))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const R=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,C,{...s,ns:l}):`key '${o} (${this.language})' returned an object instead of string.`;return r?(p.res=R,p.usedParams=this.getUsedParamsDetails(s),p):R}if(a){const R=Array.isArray(C),j=R?[]:{},Z=R?b:v;for(const N in C)if(Object.prototype.hasOwnProperty.call(C,N)){const D=`${Z}${a}${N}`;L&&!d?j[N]=this.translate(D,{...s,defaultValue:fe(E)?E[N]:void 0,joinArrays:!1,ns:l}):j[N]=this.translate(D,{...s,joinArrays:!1,ns:l}),j[N]===D&&(j[N]=C[N])}d=j}}else if(g&&y(w)&&Array.isArray(d))d=d.join(w),d&&(d=this.extendTranslation(d,e,s,n));else{let R=!1,j=!1;!this.isValidLookup(d)&&L&&(R=!0,d=E),this.isValidLookup(d)||(j=!0,d=o);const N=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&j?void 0:d,D=L&&E!==d&&this.options.updateMissing;if(j||R||D){if(this.logger.log(D?"updateKey":"missingKey",f,u,o,D?E:d),a){const F=this.resolve(o,{...s,keySeparator:!1});F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let z=[];const ee=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ee&&ee[0])for(let F=0;F{const Se=L&&X!==d?X:N;this.options.missingKeyHandler?this.options.missingKeyHandler(F,u,K,Se,D,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(F,u,K,Se,D,s),this.emit("missingKey",F,u,K,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?z.forEach(F=>{const K=this.pluralResolver.getSuffixes(F,s);k&&s[`defaultValue${this.options.pluralSeparator}zero`]&&K.indexOf(`${this.options.pluralSeparator}zero`)<0&&K.push(`${this.options.pluralSeparator}zero`),K.forEach(X=>{Oe([F],o+X,s[`defaultValue${X}`]||E)})}):Oe(z,o,E))}d=this.extendTranslation(d,e,s,p,n),j&&d===o&&this.options.appendNamespaceToMissingKey&&(d=`${u}${c}${o}`),(j||R)&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${c}${o}`:o,R?d:void 0,s))}return r?(p.res=d,p.usedParams=this.getUsedParamsDetails(s),p):d}extendTranslation(e,t,n,s,r){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const l=y(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(l){const f=e.match(this.interpolator.nestingRegexp);u=f&&f.length}let c=n.replace&&!y(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),e=this.interpolator.interpolate(e,c,n.lng||this.language||s.usedLng,n),l){const f=e.match(this.interpolator.nestingRegexp),h=f&&f.length;ur?.[0]===f[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${t[0]}`),null):this.translate(...f,t),n)),n.interpolation&&this.interpolator.reset()}const a=n.postProcess||this.options.postProcess,o=y(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=qe.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,s,r,a,o;return y(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(n))return;const u=this.extractFromKey(l,t),c=u.key;s=c;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const h=t.count!==void 0&&!y(t.count),p=h&&!t.ordinal&&t.count===0,d=t.context!==void 0&&(y(t.context)||typeof t.context=="number")&&t.context!=="",v=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);f.forEach(b=>{this.isValidLookup(n)||(o=b,!$e[`${v[0]}-${b}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&($e[`${v[0]}-${b}`]=!0,this.logger.warn(`key "${s}" for languages "${v.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),v.forEach(O=>{if(this.isValidLookup(n))return;a=O;const w=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(w,c,O,b,t);else{let x;h&&(x=this.pluralResolver.getSuffix(O,t.count,t));const L=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(t.ordinal&&x.indexOf(S)===0&&w.push(c+x.replace(S,this.options.pluralSeparator)),w.push(c+x),p&&w.push(c+L)),d){const m=`${c}${this.options.contextSeparator||"_"}${t.context}`;w.push(m),h&&(t.ordinal&&x.indexOf(S)===0&&w.push(m+x.replace(S,this.options.pluralSeparator)),w.push(m+x),p&&w.push(m+L))}}let g;for(;g=w.pop();)this.isValidLookup(n)||(r=g,n=this.getResource(O,b,g,t))}))})}),{res:n,usedKey:s,exactUsedKey:r,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,n,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,s):this.resourceStore.getResource(e,t,n,s)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!y(e.replace);let s=n?e.replace:e;if(n&&typeof e.count<"u"&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!n){s={...s};for(const r of t)delete s[r]}return s}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&e[n]!==void 0)return!0;return!1}}class Ee{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=I.create("languageUtils")}getScriptPartFromCode(e){if(e=Y(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=Y(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(y(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(n=>{if(t)return;const s=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(n=>{if(t)return;const s=this.getScriptPartFromCode(n);if(this.isSupportedCode(s))return t=s;const r=this.getLanguagePartFromCode(n);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(a=>{if(a===r)return a;if(!(a.indexOf("-")<0&&r.indexOf("-")<0)&&(a.indexOf("-")>0&&r.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===r||a.indexOf(r)===0&&r.length>1))return a})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),y(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),s=[],r=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return y(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(e))):y(e)&&r(this.formatLanguageCode(e)),n.forEach(a=>{s.indexOf(a)<0&&r(this.formatLanguageCode(a))}),s}}const Re={zero:0,one:1,two:2,few:3,many:4,other:5},je={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class mt{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=I.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const n=Y(e==="dev"?"en":e),s=t.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:n,type:s});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let a;try{a=new Intl.PluralRules(n,{type:s})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),je;if(!e.match(/-|_/))return je;const l=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(l,t)}return this.pluralRulesCache[r]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(s=>`${t}${s}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?n.resolvedOptions().pluralCategories.sort((s,r)=>Re[s]-Re[r]).map(s=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(e,t,n={}){const s=this.getRule(e,n);return s?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}const Te=(i,e,t,n=".",s=!0)=>{let r=ot(i,e,t);return!r&&s&&y(t)&&(r=ge(i,t,n),r===void 0&&(r=ge(e,t,n))),r},ce=i=>i.replace(/\$/g,"$$$$");class yt{constructor(e={}){this.logger=I.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(t=>t),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:s,prefix:r,prefixEscaped:a,suffix:o,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:f,nestingPrefix:h,nestingPrefixEscaped:p,nestingSuffix:d,nestingSuffixEscaped:v,nestingOptionsSeparator:b,maxReplaces:O,alwaysFormat:w}=e.interpolation;this.escape=t!==void 0?t:ut,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=r?_(r):a||"{{",this.suffix=o?_(o):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=h?_(h):p||_("$t("),this.nestingSuffix=d?_(d):v||_(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=O||1e3,this.alwaysFormat=w!==void 0?w:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,n)=>t?.source===n?(t.lastIndex=0,t):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,s){let r,a,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=p=>{if(p.indexOf(this.formatSeparator)<0){const O=Te(t,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(O,void 0,n,{...s,...t,interpolationkey:p}):O}const d=p.split(this.formatSeparator),v=d.shift().trim(),b=d.join(this.formatSeparator).trim();return this.format(Te(t,l,v,this.options.keySeparator,this.options.ignoreJSONStructure),b,n,{...s,...t,interpolationkey:v})};this.resetRegExp();const c=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>ce(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?ce(this.escape(p)):ce(p)}].forEach(p=>{for(o=0;r=p.regex.exec(e);){const d=r[1].trim();if(a=u(d),a===void 0)if(typeof c=="function"){const b=c(e,r,s);a=y(b)?b:""}else if(s&&Object.prototype.hasOwnProperty.call(s,d))a="";else if(f){a=r[0];continue}else this.logger.warn(`missed to pass in variable ${d} for interpolating ${e}`),a="";else!y(a)&&!this.useRawValueToEscape&&(a=we(a));const v=p.safeValue(a);if(e=e.replace(r[0],v),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=r[0].length):p.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let s,r,a;const o=(l,u)=>{const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const f=l.split(new RegExp(`${c}[ ]*{`));let h=`{${f[1]}`;l=f[0],h=this.interpolate(h,a);const p=h.match(/'/g),d=h.match(/"/g);((p?.length??0)%2===0&&!d||d.length%2!==0)&&(h=h.replace(/'/g,'"'));try{a=JSON.parse(h),u&&(a={...u,...a})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,v),`${l}${c}${h}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;s=this.nestingRegexp.exec(e);){let l=[];a={...n},a=a.replace&&!y(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const u=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(u!==-1&&(l=s[1].slice(u).split(this.formatSeparator).map(c=>c.trim()).filter(Boolean),s[1]=s[1].slice(0,u)),r=t(o.call(this,s[1].trim(),a),a),r&&s[0]===e&&!y(r))return r;y(r)||(r=we(r)),r||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),r=""),l.length&&(r=l.reduce((c,f)=>this.format(c,f,n.lng,{...n,interpolationkey:s[1].trim()}),r.trim())),e=e.replace(s[0],r),this.regexp.lastIndex=0}return e}}const bt=i=>{let e=i.toLowerCase().trim();const t={};if(i.indexOf("(")>-1){const n=i.split("(");e=n[0].toLowerCase().trim();const s=n[1].substring(0,n[1].length-1);e==="currency"&&s.indexOf(":")<0?t.currency||(t.currency=s.trim()):e==="relativetime"&&s.indexOf(":")<0?t.range||(t.range=s.trim()):s.split(";").forEach(a=>{if(a){const[o,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),c=o.trim();t[c]||(t[c]=u),u==="false"&&(t[c]=!1),u==="true"&&(t[c]=!0),isNaN(u)||(t[c]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},ke=i=>{const e={};return(t,n,s)=>{let r=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(r={...r,[s.interpolationkey]:void 0});const a=n+JSON.stringify(r);let o=e[a];return o||(o=i(Y(n),s),e[a]=o),o(t)}},xt=i=>(e,t,n)=>i(Y(t),n)(e);class vt{constructor(e={}){this.logger=I.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const n=t.cacheInBuiltFormats?ke:xt;this.formats={number:n((s,r)=>{const a=new Intl.NumberFormat(s,{...r});return o=>a.format(o)}),currency:n((s,r)=>{const a=new Intl.NumberFormat(s,{...r,style:"currency"});return o=>a.format(o)}),datetime:n((s,r)=>{const a=new Intl.DateTimeFormat(s,{...r});return o=>a.format(o)}),relativetime:n((s,r)=>{const a=new Intl.RelativeTimeFormat(s,{...r});return o=>a.format(o,r.range||"day")}),list:n((s,r)=>{const a=new Intl.ListFormat(s,{...r});return o=>a.format(o)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ke(t)}format(e,t,n,s={}){const r=t.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&r[0].indexOf(")")<0&&r.find(o=>o.indexOf(")")>-1)){const o=r.findIndex(l=>l.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,o)].join(this.formatSeparator)}return r.reduce((o,l)=>{const{formatName:u,formatOptions:c}=bt(l);if(this.formats[u]){let f=o;try{const h=s?.formatParams?.[s.interpolationkey]||{},p=h.locale||h.lng||s.locale||s.lng||n;f=this.formats[u](o,p,{...c,...s,...h})}catch(h){this.logger.warn(h)}return f}else this.logger.warn(`there was no format function for ${u}`);return o},e)}}const Ot=(i,e)=>{i.pending[e]!==void 0&&(delete i.pending[e],i.pendingCount--)};class St extends le{constructor(e,t,n,s={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=s,this.logger=I.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,s.backend,s)}queueLoad(e,t,n,s){const r={},a={},o={},l={};return e.forEach(u=>{let c=!0;t.forEach(f=>{const h=`${u}|${f}`;!n.reload&&this.store.hasResourceBundle(u,f)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?a[h]===void 0&&(a[h]=!0):(this.state[h]=1,c=!1,a[h]===void 0&&(a[h]=!0),r[h]===void 0&&(r[h]=!0),l[f]===void 0&&(l[f]=!0)))}),c||(o[u]=!0)}),(Object.keys(r).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(r),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,t,n){const s=e.split("|"),r=s[0],a=s[1];t&&this.emit("failedLoading",r,a,t),!t&&n&&this.store.addResourceBundle(r,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const o={};this.queue.forEach(l=>{at(l.loaded,[r],a),Ot(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{o[u]||(o[u]={});const c=l.loaded[u];c.length&&c.forEach(f=>{o[u][f]===void 0&&(o[u][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,t,n,s=0,r=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:s,wait:r,callback:a});return}this.readingCalls++;const o=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&c&&s{this.read.call(this,e,t,n,s+1,r*2,a)},r);return}a(u,c)},l=this.backend[n].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(c=>o(null,c)).catch(o):o(null,u)}catch(u){o(u)}return}return l(e,t,o)}prepareLoading(e,t,n={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();y(e)&&(e=this.languageUtils.toResolveHierarchy(e)),y(t)&&(t=[t]);const r=this.queueLoad(e,t,n,s);if(!r.toLoad.length)return r.pending.length||s(),null;r.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=""){const n=e.split("|"),s=n[0],r=n[1];this.read(s,r,"read",void 0,void 0,(a,o)=>{a&&this.logger.warn(`${t}loading namespace ${r} for language ${s} failed`,a),!a&&o&&this.logger.log(`${t}loaded namespace ${r} for language ${s}`,o),this.loaded(e,a,o)})}saveMissing(e,t,n,s,r,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){const l={...a,isUpdate:r},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(e,t,n,s,l):c=u(e,t,n,s),c&&typeof c.then=="function"?c.then(f=>o(null,f)).catch(o):o(null,c)}catch(c){o(c)}else u(e,t,n,s,o,l)}!e||!e[0]||this.store.addResource(e[0],t,n,s)}}}const Fe=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let e={};if(typeof i[1]=="object"&&(e=i[1]),y(i[1])&&(e.defaultValue=i[1]),y(i[2])&&(e.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const t=i[3]||i[2];Object.keys(t).forEach(n=>{e[n]=t[n]})}return e},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Ae=i=>(y(i.ns)&&(i.ns=[i.ns]),y(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),y(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs?.indexOf?.("cimode")<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i),te=()=>{},wt=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(t=>{typeof i[t]=="function"&&(i[t]=i[t].bind(i))})};class Q extends le{constructor(e={},t){if(super(),this.options=Ae(e),this.services={},this.logger=I,this.modules={external:[]},wt(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(y(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const n=Fe();this.options={...n,...this.options,...Ae(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const s=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?I.init(s(this.modules.logger),this.options):I.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=vt;const c=new Ee(this.options);this.store=new Ne(this.options.resources,this.options);const f=this.services;f.logger=I,f.resourceStore=this.store,f.languageUtils=c,f.pluralResolver=new mt(c,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),u&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(f.formatter=s(u),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new yt(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new St(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(p,...d)=>{this.emit(p,...d)}),this.modules.languageDetector&&(f.languageDetector=s(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=s(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new ae(this.services,this.options),this.translator.on("*",(p,...d)=>{this.emit(p,...d)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,t||(t=te),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=(...c)=>this.store[u](...c)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...c)=>(this.store[u](...c),this)});const o=J(),l=()=>{const u=(c,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),o.resolve(f),t(c,f)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),o}loadResources(e,t=te){let n=t;const s=y(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(s?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const r=[],a=o=>{if(!o||o==="cimode")return;this.services.languageUtils.toResolveHierarchy(o).forEach(u=>{u!=="cimode"&&r.indexOf(u)<0&&r.push(u)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload?.forEach?.(o=>a(o)),this.services.backendConnector.load(r,this.options.ns,o=>{!o&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(o)})}else n(null)}reloadResources(e,t,n){const s=J();return typeof e=="function"&&(n=e,e=void 0),typeof t=="function"&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=te),this.services.backendConnector.reload(e,t,r=>{s.resolve(),n(r)}),s}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&qe.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let t=0;t-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const n=J();this.emit("languageChanging",e);const s=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},r=(o,l)=>{l?this.isLanguageChangingTo===e&&(s(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...u)=>this.t(...u)),t&&t(o,(...u)=>this.t(...u))},a=o=>{!e&&!o&&this.services.languageDetector&&(o=[]);const l=y(o)?o:o&&o[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(y(o)?[o]:o);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,c=>{r(c,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n){const s=(r,a,...o)=>{let l;typeof a!="object"?l=this.options.overloadTranslationOptionHandler([r,a].concat(o)):l={...a},l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||n||s.keyPrefix);const u=this.options.keySeparator||".";let c;return l.keyPrefix&&Array.isArray(r)?c=r.map(f=>(typeof f=="function"&&(f=re(f,{...this.options,...a})),`${l.keyPrefix}${u}${f}`)):(typeof r=="function"&&(r=re(r,{...this.options,...a})),c=l.keyPrefix?`${l.keyPrefix}${u}${r}`:r),this.t(c,l)};return y(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=n,s}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const a=(o,l)=>{const u=this.services.backendConnector.state[`${o}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const o=t.precheck(this,a);if(o!==void 0)return o}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!s||a(r,e)))}loadNamespaces(e,t){const n=J();return this.options.ns?(y(e)&&(e=[e]),e.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{n.resolve(),t&&t(s)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=J();y(e)&&(e=[e]);const s=this.options.preload||[],r=e.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return r.length?(this.options.preload=s.concat(r),this.loadResources(a=>{n.resolve(),t&&t(a)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const s=new Intl.Locale(e);if(s&&s.getTextInfo){const r=s.getTextInfo();if(r&&r.direction)return r.direction}}catch{}const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new Ee(Fe());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new Q(e,t)}cloneInstance(e={},t=te){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const s={...this.options,...e,isClone:!0},r=new Q(s);if((e.debug!==void 0||e.prefix!==void 0)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(o=>{r[o]=this[o]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},n){const o=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},l[u]=Object.keys(l[u]).reduce((c,f)=>(c[f]={...l[u][f]},c),l[u]),l),{});r.store=new Ne(o,s),r.services.resourceStore=r.store}return r.translator=new ae(r.services,s),r.translator.on("*",(o,...l)=>{r.emit(o,...l)}),r.init(s,t),r.translator.options=s,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const T=Q.createInstance();T.createInstance=Q.createInstance;T.createInstance;T.dir;T.init;T.loadResources;T.reloadResources;T.use;T.changeLanguage;T.getFixedT;T.t;T.exists;T.setDefaultNamespace;T.hasLoadedNamespace;T.loadNamespaces;T.loadLanguages;const ne=(i,e,t,n)=>{const s=[t,{code:e,...n||{}}];if(i?.services?.logger?.forward)return i.services.logger.forward(s,"warn","react-i18next::",!0);A(s[0])&&(s[0]=`react-i18next:: ${s[0]}`),i?.services?.logger?.warn?i.services.logger.warn(...s):console?.warn&&console.warn(...s)},Ie={},ue=(i,e,t,n)=>{A(t)&&Ie[t]||(A(t)&&(Ie[t]=new Date),ne(i,e,t,n))},Xe=(i,e)=>()=>{if(i.isInitialized)e();else{const t=()=>{setTimeout(()=>{i.off("initialized",t)},0),e()};i.on("initialized",t)}},me=(i,e,t)=>{i.loadNamespaces(e,Xe(i,t))},De=(i,e,t,n)=>{if(A(t)&&(t=[t]),i.options.preload&&i.options.preload.indexOf(e)>-1)return me(i,t,n);t.forEach(s=>{i.options.ns.indexOf(s)<0&&i.options.ns.push(s)}),i.loadLanguages(e,Xe(i,n))},Lt=(i,e,t={})=>!e.languages||!e.languages.length?(ue(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(i,{lng:t.lng,precheck:(n,s)=>{if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!s(n.isLanguageChangingTo,i))return!1}}),A=i=>typeof i=="string",H=i=>typeof i=="object"&&i!==null,Pt=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Ct={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Nt=i=>Ct[i],$t=i=>i.replace(Pt,Nt);let ye={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:$t};const Et=(i={})=>{ye={...ye,...i}},Je=()=>ye;let We;const Rt=i=>{We=i},ve=()=>We,de=(i,e)=>{if(!i)return!1;const t=i.props?.children??i.children;return e?t.length>0:!!t},he=i=>{if(!i)return[];const e=i.props?.children??i.children;return i.props?.i18nIsDynamicList?B(e):e},jt=i=>Array.isArray(i)&&i.every(P.isValidElement),B=i=>Array.isArray(i)?i:[i],Tt=(i,e)=>{const t={...e};return t.props=Object.assign(i.props,e.props),t},Ye=(i,e,t,n)=>{if(!i)return"";let s="";const r=B(i),a=e?.transSupportBasicHtmlNodes?e.transKeepBasicHtmlNodesFor??[]:[];return r.forEach((o,l)=>{if(A(o)){s+=`${o}`;return}if(P.isValidElement(o)){const{props:u,type:c}=o,f=Object.keys(u).length,h=a.indexOf(c)>-1,p=u.children;if(!p&&h&&!f){s+=`<${c}/>`;return}if(!p&&(!h||f)||u.i18nIsDynamicList){s+=`<${l}>`;return}if(h&&f===1&&A(p)){s+=`<${c}>${p}`;return}const d=Ye(p,e,t,n);s+=`<${l}>${d}`;return}if(o===null){ne(t,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:n});return}if(H(o)){const{format:u,...c}=o,f=Object.keys(c);if(f.length===1){const h=u?`${f[0]}, ${u}`:f[0];s+=`{{${h}}}`;return}ne(t,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:n,child:o});return}ne(t,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:n,child:o})}),s},kt=(i,e,t,n,s,r,a)=>{if(t==="")return[];const o=s.transKeepBasicHtmlNodesFor||[],l=t&&new RegExp(o.map(O=>`<${O}`).join("|")).test(t);if(!i&&!e&&!l&&!a)return[t];const u=e??{},c=O=>{B(O).forEach(g=>{A(g)||(de(g)?c(he(g)):H(g)&&!P.isValidElement(g)&&Object.assign(u,g))})};c(i);const f=nt.parse(`<0>${t}`),h={...u,...r},p=(O,w,g)=>{const x=he(O),L=v(x,w.children,g);return jt(x)&&L.length===0||O.props?.i18nIsDynamicList?x:L},d=(O,w,g,x,L)=>{O.dummy?(O.children=w,g.push(P.cloneElement(O,{key:x},L?void 0:w))):g.push(...P.Children.map([O],S=>{const m={...S.props};return delete m.i18nIsDynamicList,P.createElement(S.type,{...m,key:x,ref:S.props.ref??S.ref},L?null:w)}))},v=(O,w,g)=>{const x=B(O);return B(w).reduce((S,m,k)=>{const E=m.children?.[0]?.content&&n.services.interpolator.interpolate(m.children[0].content,h,n.language);if(m.type==="tag"){let C=x[parseInt(m.name,10)];!C&&e&&(C=e[m.name]),g.length===1&&!C&&(C=g[0][m.name]),C||(C={});const $=Object.keys(m.attrs).length!==0?Tt({props:m.attrs},C):C,V=P.isValidElement($),R=V&&de(m,!0)&&!m.voidElement,j=l&&H($)&&$.dummy&&!V,Z=H(e)&&Object.hasOwnProperty.call(e,m.name);if(A($)){const N=n.services.interpolator.interpolate($,h,n.language);S.push(N)}else if(de($)||R){const N=p($,m,g);d($,N,S,k)}else if(j){const N=v(x,m.children,g);d($,N,S,k)}else if(Number.isNaN(parseFloat(m.name)))if(Z){const N=p($,m,g);d($,N,S,k,m.voidElement)}else if(s.transSupportBasicHtmlNodes&&o.indexOf(m.name)>-1)if(m.voidElement)S.push(P.createElement(m.name,{key:`${m.name}-${k}`}));else{const N=v(x,m.children,g);S.push(P.createElement(m.name,{key:`${m.name}-${k}`},N))}else if(m.voidElement)S.push(`<${m.name} />`);else{const N=v(x,m.children,g);S.push(`<${m.name}>${N}`)}else if(H($)&&!V){const N=m.children[0]?E:null;N&&S.push(N)}else d($,E,S,k,m.children.length!==1||!E)}else if(m.type==="text"){const C=s.transWrapTextNodes,$=a?s.unescape(n.services.interpolator.interpolate(m.content,h,n.language)):n.services.interpolator.interpolate(m.content,h,n.language);C?S.push(P.createElement(C,{key:`${m.name}-${k}`},$)):S.push($)}return S},[])},b=v([{dummy:!0,children:i||[]}],f,B(i||[]));return he(b[0])},Qe=(i,e,t)=>{const n=i.key||e,s=P.cloneElement(i,{key:n});if(!s.props||!s.props.children||t.indexOf(`${e}/>`)<0&&t.indexOf(`${e} />`)<0)return s;function r(){return P.createElement(P.Fragment,null,s)}return P.createElement(r,{key:n})},Ft=(i,e)=>i.map((t,n)=>Qe(t,n,e)),At=(i,e)=>{const t={};return Object.keys(i).forEach(n=>{Object.assign(t,{[n]:Qe(i[n],n,e)})}),t},It=(i,e,t,n)=>i?Array.isArray(i)?Ft(i,e):H(i)?At(i,e):(ue(t,"TRANS_INVALID_COMPONENTS",' "components" prop expects an object or array',{i18nKey:n}),null):null,Dt=i=>!H(i)||Array.isArray(i)?!1:Object.keys(i).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function Vt({children:i,count:e,parent:t,i18nKey:n,context:s,tOptions:r={},values:a,defaults:o,components:l,ns:u,i18n:c,t:f,shouldUnescape:h,...p}){const d=c||ve();if(!d)return ue(d,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:n}),i;const v=f||d.t.bind(d)||(j=>j),b={...Je(),...d.options?.react};let O=u||v.ns||d.options?.defaultNS;O=A(O)?[O]:O||["translation"];const w=Ye(i,b,d,n),g=o||r?.defaultValue||w||b.transEmptyNodeValue||(typeof n=="function"?re(n):n),{hashTransKey:x}=b,L=n||(x?x(w||g):w||g);d.options?.interpolation?.defaultVariables&&(a=a&&Object.keys(a).length>0?{...a,...d.options.interpolation.defaultVariables}:{...d.options.interpolation.defaultVariables});const S=a||e!==void 0&&!d.options?.interpolation?.alwaysFormat||!i?r.interpolation:{interpolation:{...r.interpolation,prefix:"#$?",suffix:"?$#"}},m={...r,context:s||r.context,count:e,...a,...S,defaultValue:o||r?.defaultValue,ns:O},k=L?v(L,m):g,E=It(l,k,d,n);let C=E||i,$=null;Dt(E)&&($=E,C=i);const V=kt(C,$,k,d,b,m,h),R=t??b.defaultTransParent;return R?P.createElement(R,p,V):V}const un={type:"3rdParty",init(i){Et(i.options.react),Rt(i)}},Ge=P.createContext();class Ht{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function fn({children:i,count:e,parent:t,i18nKey:n,context:s,tOptions:r={},values:a,defaults:o,components:l,ns:u,i18n:c,t:f,shouldUnescape:h,...p}){const{i18n:d,defaultNS:v}=P.useContext(Ge)||{},b=c||d||ve(),O=f||b?.t.bind(b);return Vt({children:i,count:e,parent:t,i18nKey:n,context:s,tOptions:r,values:a,defaults:o,components:l,ns:u||O?.ns||v||b?.options?.defaultNS,i18n:b,t:f,shouldUnescape:h,...p})}const Mt=(i,e)=>A(e)?e:H(e)&&A(e.defaultValue)?e.defaultValue:Array.isArray(i)?i[i.length-1]:i,Kt={t:Mt,ready:!1},Ut=()=>()=>{},cn=(i,e={})=>{const{i18n:t}=e,{i18n:n,defaultNS:s}=P.useContext(Ge)||{},r=t||n||ve();r&&!r.reportNamespaces&&(r.reportNamespaces=new Ht),r||ue(r,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const a=P.useMemo(()=>({...Je(),...r?.options?.react,...e}),[r,e]),{useSuspense:o,keyPrefix:l}=a,u=P.useMemo(()=>{const g=i||s||r?.options?.defaultNS;return A(g)?[g]:g||["translation"]},[i,s,r]);r?.reportNamespaces?.addUsedNamespaces?.(u);const c=P.useCallback(g=>{if(!r)return Ut;const{bindI18n:x,bindI18nStore:L}=a;return x&&r.on(x,g),L&&r.store.on(L,g),()=>{x&&x.split(" ").forEach(S=>r.off(S,g)),L&&L.split(" ").forEach(S=>r.store.off(S,g))}},[r,a]),f=P.useRef(),h=P.useCallback(()=>{if(!r)return Kt;const g=!!(r.isInitialized||r.initializedStoreOnce)&&u.every(m=>Lt(m,r,a)),x=r.getFixedT(e.lng||r.language,a.nsMode==="fallback"?u:u[0],l),L=f.current;if(L&&L.ready===g&&L.lng===(e.lng||r.language)&&L.keyPrefix===l)return L;const S={t:x,ready:g,lng:e.lng||r.language,keyPrefix:l};return f.current=S,S},[r,u,l,a,e.lng]),[p,d]=P.useState(0),{t:v,ready:b}=st.useSyncExternalStore(c,h,h);P.useEffect(()=>{if(r&&!b&&!o){const g=()=>d(x=>x+1);e.lng?De(r,e.lng,u,g):me(r,u,g)}},[r,e.lng,u,b,o,p]);const O=r||{},w=P.useMemo(()=>{const g=[v,O,b];return g.t=v,g.i18n=O,g.ready=b,g},[v,O,b]);if(r&&o&&!b)throw new Promise(g=>{const x=()=>g();e.lng?De(r,e.lng,u,x):me(r,u,x)});return w};function be(i){"@babel/helpers - typeof";return be=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},be(i)}function Ze(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":be(XMLHttpRequest))==="object"}function _t(i){return!!i&&typeof i.then=="function"}function Bt(i){return _t(i)?i:Promise.resolve(i)}const qt="modulepreload",zt=function(i){return"/"+i},Ve={},Xt=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=a?.nonce||a?.getAttribute("nonce");s=Promise.allSettled(t.map(l=>{if(l=zt(l),l in Ve)return;Ve[l]=!0;const u=l.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${c}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":qt,u||(f.as="script"),f.crossOrigin="",f.href=l,o&&f.setAttribute("nonce",o),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})};function He(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,n)}return t}function Me(i){for(var e=1;eimport("./vendor-B5oGEj-7.js").then(i=>i.b),__vite__mapDeps([0,1])).then(function(i){M=i.default}).catch(function(){})}catch{}var xe=function(e,t){if(t&&U(t)==="object"){var n="";for(var s in t)n+="&"+encodeURIComponent(s)+"="+encodeURIComponent(t[s]);if(!n)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+n.slice(1)}return e},Ke=function(e,t,n,s){var r=function(l){if(!l.ok)return n(l.statusText||"Error",{status:l.status});l.text().then(function(u){n(null,{status:l.status,data:u})}).catch(n)};if(s){var a=s(e,t);if(a instanceof Promise){a.then(r).catch(n);return}}typeof fetch=="function"?fetch(e,t).then(r).catch(n):M(e,t).then(r).catch(n)},Ue=!1,Qt=function(e,t,n,s){e.queryStringParams&&(t=xe(t,e.queryStringParams));var r=Me({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(r["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),n&&(r["Content-Type"]="application/json");var a=typeof e.requestOptions=="function"?e.requestOptions(n):e.requestOptions,o=Me({method:n?"POST":"GET",body:n?e.stringify(n):void 0,headers:r},Ue?{}:a),l=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{Ke(t,o,s,l)}catch(u){if(!a||Object.keys(a).length===0||!u.message||u.message.indexOf("not implemented")<0)return s(u);try{Object.keys(a).forEach(function(c){delete o[c]}),Ke(t,o,s,l),Ue=!0}catch(c){s(c)}}},Gt=function(e,t,n,s){n&&U(n)==="object"&&(n=xe("",n).slice(1)),e.queryStringParams&&(t=xe(t,e.queryStringParams));try{var r=G?new G:new oe("MSXML2.XMLHTTP.3.0");r.open(n?"POST":"GET",t,1),e.crossDomain||r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.withCredentials=!!e.withCredentials,n&&r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.overrideMimeType&&r.overrideMimeType("application/json");var a=e.customHeaders;if(a=typeof a=="function"?a():a,a)for(var o in a)r.setRequestHeader(o,a[o]);r.onreadystatechange=function(){r.readyState>3&&s(r.status>=400?r.statusText:null,{status:r.status,data:r.responseText})},r.send(n)}catch(l){console&&console.log(l)}},Zt=function(e,t,n,s){if(typeof n=="function"&&(s=n,n=void 0),s=s||function(){},M&&t.indexOf("file:")!==0)return Qt(e,t,n,s);if(Ze()||typeof ActiveXObject=="function")return Gt(e,t,n,s);s(new Error("No fetch and no xhr implementation found!"))};function q(i){"@babel/helpers - typeof";return q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(i)}function _e(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,n)}return t}function pe(i){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};en(this,i),this.services=e,this.options=t,this.allOptions=n,this.type="backend",this.init(e,t,n)}return nn(i,[{key:"init",value:function(t){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=t,this.options=pe(pe(pe({},rn()),this.options||{}),s),this.allOptions=r,this.services&&this.options.reloadInterval){var a=setInterval(function(){return n.reload()},this.options.reloadInterval);q(a)==="object"&&typeof a.unref=="function"&&a.unref()}}},{key:"readMulti",value:function(t,n,s){this._readAny(t,t,n,n,s)}},{key:"read",value:function(t,n,s){this._readAny([t],t,[n],n,s)}},{key:"_readAny",value:function(t,n,s,r,a){var o=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(t,s)),l=Bt(l),l.then(function(u){if(!u)return a(null,{});var c=o.services.interpolator.interpolate(u,{lng:t.join("+"),ns:s.join("+")});o.loadUrl(c,a,n,r)})}},{key:"loadUrl",value:function(t,n,s,r){var a=this,o=typeof s=="string"?[s]:s,l=typeof r=="string"?[r]:r,u=this.options.parseLoadPayload(o,l);this.options.request(this.options,t,u,function(c,f){if(f&&(f.status>=500&&f.status<600||!f.status))return n("failed loading "+t+"; status code: "+f.status,!0);if(f&&f.status>=400&&f.status<500)return n("failed loading "+t+"; status code: "+f.status,!1);if(!f&&c&&c.message){var h=c.message.toLowerCase(),p=["failed","fetch","network","load"].find(function(b){return h.indexOf(b)>-1});if(p)return n("failed loading "+t+": "+c.message,!0)}if(c)return n(c,!1);var d,v;try{typeof f.data=="string"?d=a.options.parse(f.data,s,r):d=f.data}catch{v="failed parsing "+t+" to json"}if(v)return n(v,!1);n(null,d)})}},{key:"create",value:function(t,n,s,r,a){var o=this;if(this.options.addPath){typeof t=="string"&&(t=[t]);var l=this.options.parsePayload(n,s,r),u=0,c=[],f=[];t.forEach(function(h){var p=o.options.addPath;typeof o.options.addPath=="function"&&(p=o.options.addPath(h,n));var d=o.services.interpolator.interpolate(p,{lng:h,ns:n});o.options.request(o.options,d,l,function(v,b){u+=1,c.push(v),f.push(b),u===t.length&&typeof a=="function"&&a(c,f)})})}}},{key:"reload",value:function(){var t=this,n=this.services,s=n.backendConnector,r=n.languageUtils,a=n.logger,o=s.language;if(!(o&&o.toLowerCase()==="cimode")){var l=[],u=function(f){var h=r.toResolveHierarchy(f);h.forEach(function(p){l.indexOf(p)<0&&l.push(p)})};u(o),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){t.allOptions.ns.forEach(function(f){s.read(c,f,"read",null,null,function(h,p){h&&a.warn("loading namespace ".concat(f," for language ").concat(c," failed"),h),!h&&p&&a.log("loaded namespace ".concat(f," for language ").concat(c),p),s.loaded("".concat(c,"|").concat(f),h,p)})})})}}}])}();an.type="backend";export{an as B,fn as T,un as a,T as i,cn as u}; diff --git a/src/main/webapp/reusable-components/chunks/shadow-mount-BbV5d7vm.js b/src/main/webapp/reusable-components/chunks/shadow-mount-BbV5d7vm.js deleted file mode 100644 index 14e10400186..00000000000 --- a/src/main/webapp/reusable-components/chunks/shadow-mount-BbV5d7vm.js +++ /dev/null @@ -1 +0,0 @@ -function a({rootElementId:t}){const e=document.getElementById(t);if(!e)throw new Error(`[shadow-mount] No element with id="${t}" found in the host page.`);let o=e.shadowRoot;if(!o)o=e.attachShadow({mode:"open"});else for(;o.firstChild;)o.removeChild(o.firstChild);const s=window.__dvPendingStyles??[];for(const i of s){const n=document.createElement("style");n.textContent=i,o.appendChild(n)}const d=document.createElement("div");return d.className="dv-reusable-root",o.appendChild(d),window.__dvShadowRoot=window.__dvShadowRoot??{},window.__dvShadowRoot[t]=o,{reactRoot:d,shadowRoot:o}}export{a as m}; diff --git a/src/main/webapp/reusable-components/chunks/vendor-B5oGEj-7.js b/src/main/webapp/reusable-components/chunks/vendor-B5oGEj-7.js new file mode 100644 index 00000000000..4dfe55c06ec --- /dev/null +++ b/src/main/webapp/reusable-components/chunks/vendor-B5oGEj-7.js @@ -0,0 +1,186 @@ +import{g as Mo,r as K,R as B,b as Eu,c as h,d as qh}from"./react-Dtf48RLW.js";function zh(e,t){for(var n=0;no[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Hh={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};const Wh=Mo(Hh);var Kh=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function bl(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(Wh[n[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var o=e.indexOf("-->");return{type:"comment",comment:o!==-1?e.slice(4,o):""}}for(var r=new RegExp(Kh),i=null;(i=r.exec(e))!==null;)if(i[0].trim())if(i[1]){var a=i[1].trim(),u=[a,""];a.indexOf("=")>-1&&(u=a.split("=")),t.attrs[u[0]]=u[1],r.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var Yh=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Jh=/^\s*$/,Xh=Object.create(null);function Ru(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(n){var o=[];for(var r in n)o.push(r+'="'+n[r]+'"');return o.length?" "+o.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(Ru,"")+"";case"comment":return e+""}}var hO={parse:function(e,t){t||(t={}),t.components||(t.components=Xh);var n,o=[],r=[],i=-1,a=!1;if(e.indexOf("<")!==0){var u=e.indexOf("<");o.push({type:"text",content:u===-1?e:e.substring(0,u)})}return e.replace(Yh,function(d,c){if(a){if(d!=="")return;a=!1}var s,l=d.charAt(1)!=="/",E=d.startsWith("");return{type:"comment",comment:o!==-1?e.slice(4,o):""}}for(var i=new RegExp(xh),r=null;(r=i.exec(e))!==null;)if(r[0].trim())if(r[1]){var a=r[1].trim(),u=[a,""];a.indexOf("=")>-1&&(u=a.split("=")),t.attrs[u[0]]=u[1],i.lastIndex--}else r[2]&&(t.attrs[r[2]]=r[3].trim().substring(1,r[3].length-1));return t}var Sh=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Ih=/^\s*$/,Mh=Object.create(null);function pu(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(n){var o=[];for(var i in n)o.push(i+'="'+n[i]+'"');return o.length?" "+o.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(pu,"")+"";case"comment":return e+""}}var F2={parse:function(e,t){t||(t={}),t.components||(t.components=Mh);var n,o=[],i=[],r=-1,a=!1;if(e.indexOf("<")!==0){var u=e.indexOf("<");o.push({type:"text",content:u===-1?e:e.substring(0,u)})}return e.replace(Sh,function(d,c){if(a){if(d!=="")return;a=!1}var s,l=d.charAt(1)!=="/",O=d.startsWith("