A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.
JavaScript claude-code-pluginclaude-code-skillscode-appsgithub-copilot-pluginpower-appspower-pagespower-platform
Fix five app-builder bugs that only surfaced on out-of-the-box tables (#356)
Akshay Maloo063dd73bb80d
diff --git a/.github/workflows/model-apps-script-tests.yml b/.github/workflows/model-apps-script-tests.ymlnew file mode 100644index 000000000..69160e313--- /dev/null+++ b/.github/workflows/model-apps-script-tests.yml@@ -0,0 +1,90 @@+# Functional unit tests for the model-apps plugin, across ubuntu × windows × macos+# and Node 20 × 22.+#+# Why a matrix: these scripts shell out to `pac`/`az`, build filesystem paths, and+# parse CLI output, so path-separator and shell differences are a real regression+# class that a single-OS run would miss. Both Node versions are covered because the+# plugin is developed on Node 22 while the repo's other test workflow pins Node 20 —+# a version-only failure should be attributable, not a mystery.+#+# Deliberately mirrors `power-pages-script-tests.yml` rather than extending it: the+# two plugins have independent path filters, so a change to one must not spend CI+# time on the other.+name: model-apps-script-tests++on:+ pull_request:+ branches:+ - main+ paths:+ - "plugins/model-apps/**"+ # The eval harness lives at the repo root but is owned by this plugin, so+ # an eval-only change must still trigger the eval job below.+ - "evals/model-apps/**"+ - ".github/workflows/model-apps-script-tests.yml"++jobs:+ test-model-apps-scripts:+ name: test-model-apps-scripts (${{ matrix.os }}, node ${{ matrix.node }})+ runs-on: ${{ matrix.os }}+ # Defense-in-depth: opt this CI job out of telemetry transmission so a test+ # that forgets to isolate emission can never POST to a real collector. The+ # plugin's committed ikey.json currently ships `disabled: true`, but that is+ # a value that can change; the guard must not depend on it. Suppresses+ # TRANSMISSION only — the local diagnostic mirror is still written, so this+ # cannot change what the tests actually assert.+ env:+ POWER_PLATFORM_SKILLS_TELEMETRY_MODEL_APPS_OPTOUT: "1"+ strategy:+ fail-fast: false+ matrix:+ os:+ - ubuntu-latest+ - windows-latest+ - macos-latest+ node:+ - 20+ - 22+ steps:+ - name: checkout+ uses: actions/checkout@v4++ - name: setup-node+ uses: actions/setup-node@v4+ with:+ node-version: ${{ matrix.node }}++ # run-tests.js is the plugin's own regression gate: it runs every+ # scripts/tests/*.test.js and exits non-zero on any failure. Invoking it+ # (rather than a bare `node --test`) keeps CI and the documented local+ # command identical, so a green PR means the same thing a green local run+ # does. The vendored SDK's own Jest suite is intentionally NOT run here —+ # it needs a Node-20-ABI `canvas` native module and the SDK source tree,+ # neither of which exists in this repo; the real-bundle contract tests in+ # scripts/tests/ cover the shipped bundle instead.+ - name: run-model-apps-script-tests+ shell: bash+ working-directory: plugins/model-apps+ run: node scripts/run-tests.js++ test-model-apps-evals:+ name: test-model-apps-evals+ runs-on: ubuntu-latest+ env:+ POWER_PLATFORM_SKILLS_TELEMETRY_MODEL_APPS_OPTOUT: "1"+ steps:+ - name: checkout+ uses: actions/checkout@v4++ - name: setup-node+ uses: actions/setup-node@v4+ with:+ node-version: 20++ # The eval harness lives at the repo root (evals/model-apps/**) but is+ # owned by this plugin, so it is gated by the same path filter. These are+ # the offline scoring/fixture tests only — the Layer 1/2 runners need a+ # live Dataverse org and are run manually.+ - name: run-model-apps-eval-tests+ shell: bash+ run: node --test evals/model-apps/app-builder/tests/*.test.js evals/model-apps/genpage/tests/*.test.jsdiff --git a/AGENTS.md b/AGENTS.mdindex 2a4280abb..10766edf3 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -41,6 +41,25 @@ claude --plugin-dir /path/to/plugins/<plugin-name>No root-level build, lint, or test commands exist. Build/test tooling lives inside each plugin.+## CI++**Only two workflows run on every PR** — `validate-keyword-case` and `validate-repository-metadata`.+Both are repo-wide and enforce metadata/marketplace rules, not behavior.++**Every test workflow is path-filtered to a single plugin** (`power-pages` → `plugins/power-pages/**`;+`model-apps` → `plugins/model-apps/**` + `evals/model-apps/**`). This is deliberate — a PR should not+spend CI on a plugin it never touched — but it has a corollary: *a green PR does not mean the repo is+green*, only that the paths you touched are.++**A test suite with no workflow silently never runs.** When you add tests to a plugin, add or extend+that plugin's own path-filtered workflow in the same PR; do not widen another plugin's filter to+cover yours.++A plugin that has adopted telemetry must also set its opt-out env var on any job that could execute a+telemetry-emitting hook or script (see `## Shared Telemetry`) — e.g.+`POWER_PLATFORM_SKILLS_TELEMETRY_MODEL_APPS_OPTOUT: "1"`. It suppresses transmission only, so it+cannot change what a test asserts.+## Plugin ConventionsEach plugin follows this structure:diff --git a/plugins/model-apps/.claude-plugin/plugin.json b/plugins/model-apps/.claude-plugin/plugin.jsonindex 6416e66f0..981b2b5f2 100644--- a/plugins/model-apps/.claude-plugin/plugin.json+++ b/plugins/model-apps/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "model-apps",- "version": "2.4.0",+ "version": "2.4.1","description": "Build model-driven Power Apps end to end: /app-builder authors whole apps (tables, relationships, forms, views, charts, security roles, app + sitemap) from a natural-language intent, and /genpage builds generative pages with specialist agents for planning, entity creation, and parallel code generation. Requires PAC CLI >= 2.7.0 and Azure CLI (`az`). See CHANGELOG.md for v1.x -> v2.x migration.","author": {"name": "Microsoft",diff --git a/plugins/model-apps/.plugin/plugin.json b/plugins/model-apps/.plugin/plugin.jsonindex 6416e66f0..981b2b5f2 100644--- a/plugins/model-apps/.plugin/plugin.json+++ b/plugins/model-apps/.plugin/plugin.json@@ -1,6 +1,6 @@{"name": "model-apps",- "version": "2.4.0",+ "version": "2.4.1","description": "Build model-driven Power Apps end to end: /app-builder authors whole apps (tables, relationships, forms, views, charts, security roles, app + sitemap) from a natural-language intent, and /genpage builds generative pages with specialist agents for planning, entity creation, and parallel code generation. Requires PAC CLI >= 2.7.0 and Azure CLI (`az`). See CHANGELOG.md for v1.x -> v2.x migration.","author": {"name": "Microsoft",diff --git a/plugins/model-apps/AGENTS.md b/plugins/model-apps/AGENTS.mdindex 8b67a53a1..754f7b35b 100644--- a/plugins/model-apps/AGENTS.md+++ b/plugins/model-apps/AGENTS.md@@ -55,9 +55,11 @@ tree and teardown order both did before).A second skill (`/app-builder`) builds a whole **model-driven app** (tables, columns,relationships, adaptive forms with sub-grids, views, Choice-column charts, app module +sitemap) from a natural-language intent — distinct from `/genpage`, which builds generative-*pages*. The **entire flow runs in the main conversation loop** (not via a `Task` subagent):-subagents are headless, so `AskUserQuestion` and plan mode can't reach the user from one, and-the whole point is the multi-turn, propose-then-confirm authoring + the live build narration.+*pages*. The **whole flow runs in the main conversation loop, never a `Task` subagent** — subagents+are headless, so `AskUserQuestion` and plan mode cannot reach the user. For the end-to-end flow,+stage→phase mapping and page-identity model, see+[`docs/architecture.md`](docs/architecture.md) → `## /app-builder — build pipeline`; that doc owns+the pipeline and delegates each script's **behavioral spec** to the entries below.- **`references/authoring-flow.md`** — the Phase-1 authoring playbook the skill executes itself:validate prereqs, select the env via PAC (`pac auth list` / `pac org who`), detect existing@@ -66,6 +68,12 @@ the whole point is the multi-turn, propose-then-confirm authoring + the live buipage-intents + sample data, then access), run the `spec-lint.js` guardrail, get plan-mode approval.Writes `app-spec.json` (the machine contract) + `model-app-plan.md` (rendered by`scripts/write-app-spec-doc.js`, never hand-written).+ **Artifact naming:** both skills derive their working directory from a slug off the user's+ request, so they can land on the SAME folder and file names are a namespace. A file written by+ BOTH is unprefixed (`workflow-log.md`); a file owned by ONE is prefixed with it+ (`genpage-plan.md`, `genpage-entity-creation-log.md`, `app-builder-page-plan.md`). A name chosen+ to prevent confusion must not *contain* the name it guards against — see+ `scripts/write-page-plan.js` for why the app-builder page plan is not `genpage-*`.- **`scripts/lib/spec-lint.js`** — pure App Spec guardrail (`lintAppSpec → { ok, errors,warnings }`): errors block the plan gate (e.g. the relationship-name-vs-lookup-namecollision Dataverse rejects), warnings teach.@@ -135,7 +143,20 @@ the whole point is the multi-turn, propose-then-confirm authoring + the live bui**icon** web resource is referenced by the table itself, so Dataverse refuses to delete it until the tableis gone (form JS, referenced by its already-deleted form, is safe either way). Teardown also removes thebuild's **generated default app icon** (`<appUnique>_icon`, created in-solution when the spec sets no- `app.icon`) so it doesn't leak as an orphan. The empty solution container goes last — but a **built-in+ `app.icon`) so it doesn't leak as an orphan. **An app is TWO rows** — an `appmodule` AND a `sitemaps`+ row, with no lookup between them and no server-side cascade; the only link is+ `sitemap.sitemapnameunique === appmodule.uniquename`. Deleting only the appmodule strands the sitemap+ forever and, because `sitemapnameunique` is unique-constrained, permanently **burns that unique name**:+ a later build of an app with the same name fails with *"The name <x> is already in use by an+ existing site map"*, which the maker cannot act on. `deleteAppCascade` therefore resolves the sitemap+ BEFORE deleting the app, deletes both rows in **one atomic OData `$batch`**, and **fails closed** — any+ delete it cannot prove is rejected rather than guessed. This is why+ **`scripts/lib/sdk-http-client.js` must implement `postRaw`**: the SDK will not fall back to two+ sequential deletes, so a transport without it fails every teardown with `APP_DELETE_NOT_ATOMIC` (see+ that file for the wire contract and why a `$batch` is never retried). Pinned by+ `scripts/tests/app-delete-real-bundle.test.js` against the real bundle — every other teardown test+ drives a mock and would stay green through a regression here.+ The empty solution container goes last — but a **built-insystem solution** (`Active`/`Default`/`Basic`) is **skipped** (Dataverse 400s any delete of a restrictedsolution), so a downloaded spec whose real solution could not be recovered (and defaulted to `Default`)still tears down cleanly instead of erroring. Command teardown@@ -159,10 +180,43 @@ the whole point is the multi-turn, propose-then-confirm authoring + the live buino filter isolates author views. Forms/charts/commands need structured reads the SDK doesn't expose.)All four survive on the live app (a rebuild preserves them by discovery), but are absent from thedownloaded spec, so edit them in Maker or a fresh spec.+ **Entities are the sitemap's tables UNIONED with the entities owned by the app's VIEW / CHART /+ FORM components** (`appComponentEntities`) — a maker-built app can include tables reachable only via+ a lookup/sub-grid/related view, with no sitemap entry of their own, and reconstructing from the+ sitemap alone drops them. Note `componenttype eq 1` (Entities) rows are deliberately NOT used:+ LIVE-verified that every one carries the same `objectid` (the `entity` metadata table's own id), so+ it identifies the component *kind*, not which table, and `RetrieveAppComponents` returned 0 rows on+ the same app. **Scope caveat:** `/app-builder` itself never creates a hidden component — a table+ with no sitemap subarea does not become an app component at all (LIVE-verified: declaring `task` in+ `entities[]` without nav left the app's component set unchanged), so for an app-builder-built app+ the sitemap set already IS the complete set. This union therefore only adds tables for apps built+ or edited in the maker. **Closing ADO 6603388 from the BUILD side is blocked by the platform, not+ merely unimplemented:** a table (`entity`) app component cannot be pinned via `AddAppComponents` at+ all — the documented shape returns 204 but records a component pointing at the metadata table+ literally named `entity` (the same finding as the `componenttype eq 1` note above), while+ `metadataid` and a logical-name `entityid` are rejected and a `savedquery` in the SAME request pins+ correctly as a control. Direct create is unsupported too, and `ValidateApp` reports success+ regardless, which is why it went unnoticed. Tracked platform-side as **AB#39140211**. Do NOT claim+ table components are applied. The component read is best-effort: a failure degrades+ to the sitemap-derived set rather than failing the download. Each entity's **`primaryAttribute` comes from+ real Dataverse metadata** (`primaryNameAttribute`) and is **never synthesized**. The old+ `<entity>_name` guess was wrong for most OOB tables (`account` → `name`,+ `contact` → `fullname`) while looking plausible on custom ones, which is why it went unnoticed.+ Because validation *requires* `primaryAttribute`, a table without one cannot simply be emitted: a+ **sitemap** table missing it FAILS the download (actionable — the user asked for that table), while a+ **component-only** table missing it is dropped with a warning (it arrived via a best-effort read and+ was absent from the spec entirely before this change, so aborting over it would regress a previously+ working download with no override flag).The **solution** is recovered as the app's one *real* unmanaged solution — `recoverAppSolution` enumeratesthe app's solution memberships and excludes the built-in `Active`/`Default`/`Basic` system solutions theapp is also a member of (see `scripts/lib/system-solutions.js`), so the downloaded spec can cleanly tear- down its own solution instead of targeting the restricted `Default`. Recovered **tables are flagged+ down its own solution instead of targeting the restricted `Default`. Its **publisher prefix is read from+ that solution's owning publisher** via the SDK's `getSolution` — NOT inferred from the app's uniquename,+ which is silent-wrong whenever the app name doesn't encode the publisher (an app named+ `new_customermanagement` inside publisher `contoso`, an app with no prefix, or a prefix longer than the+ guess assumed all collapsed to a literal `new`). The app-derived value remains the fallback, and+ `prefixResolved` is true for BOTH trusted sources — it gates the icon own-vs-foreign classification, so+ a downgrade there silently stops custom nav icons from round-tripping. Recovered **tables are flagged`existing: true`**, so a teardown of a downloaded spec never deletes a table (+ its data) this buildcannot prove it created — download can't distinguish app-created from merely-referenced tables, so itfails safe (an orphaned table is recoverable; deleted customer data is not).@@ -180,14 +234,49 @@ the whole point is the multi-turn, propose-then-confirm authoring + the live buiview's **column set** (parsed from `layoutxml` — the additive `reconcileView` won't drop a removed speccolumn, so this flags it), plus **relationship** and **command-bar existence** (previously unchecked).Content checks are additive + reader-gated (they only fire when the reader supplies `layoutxml` /- `entityRelationships` / `commandBar`), so existence-only callers are unaffected. This is the F5- "convergence" mitigation: the build is additive (edits to existing artifacts aren't re-applied in- place — teardown + rebuild to converge), and verify makes any resulting divergence **loud**.+ `entityRelationships` / `commandBar`), so existence-only callers are unaffected. It also reconciles+ **AI app features**: for every `ai.appFeatures` entry it proves an APP-SCOPE OVERRIDE ROW exists in+ `appsettings` holding the requested value. Verify previously had no awareness of `spec.ai` at all, so+ a run whose every AI feature was skipped (admin gate off) or silently not persisted still reported a+ clean PASS. The oracle is deliberately the override row and NOT the effective value:+ `RetrieveSetting(name, { appUniqueName })` **falls back to the environment value** when the app has no+ override, so an effective-value compare passes whenever the environment already holds the requested+ value — a false PASS for an app that was never configured, and the same oracle the SDK uses for its+ `applied` bucket. It fails CLOSED when the proof cannot be read, and the check needs BOTH+ `retrieveSetting` and `queryRecords` on the reader (an existence-only reader skips it rather than+ degrading to the unsound compare). Note the per-app settings are DISTINCT from the org readiness gates —+ `nlSearch`'s gate is the boolean `EnableNLGridSearch` but its per-app setting is the numeric+ `NLGridSearchSetting`; conflating them is what let NL grid search report "applied" while writing+ nothing. This is the F5 "convergence" mitigation: the build is additive (edits to existing artifacts+ aren't re-applied in place — teardown + rebuild to converge), and verify makes any resulting+ divergence **loud**.- **`scripts/ai-preflight.js`** — standalone preflight report: prints each AI feature's on/off statusand the exact admin action needed (Power Platform Admin Center → Environments → Settings → Product →Features) for anything off. Never fails. The `ai-features` build phase calls this logic internally anduses `RetrieveSetting`/`SaveSettingValue` (SDK) for app-level feature flags and `AIModelPublish` +- `aiskillconfigs` for per-table row summaries. All AI features are **admin-gated**: the skill preflights+ `aiskillconfigs` for per-table row summaries. Feature values are `true`/`false` (the numeric settings'+ 1/0) or an explicit integer such as `2` ("on for everyone"), bounded to `0..1000000` — the same range+ the SDK enforces, so validation rejects an out-of-range value up front instead of aborting the build+ half-applied. The SDK **proves every write** against the app-scope override row, retrying with backoff+ (an immediate read can still return the environment fallback, which previously produced a false+ `notPersisted` on first apply). `applied` is the ONLY success bucket; a feature otherwise lands in+ `skipped` (org gate off), `notPersisted` (no override observed for the whole retry budget — Dataverse+ can accept an app-scope `SaveSettingValue` with HTTP 204 and store nothing), `unverified` (the write+ was issued but the proof could not be read) or `failed` (the write threw; the rest of the batch still+ reports). The build surfaces **every** non-success bucket as a `⊘` warning plus in the phase detail+ — buckets are read off the result object, so one a future SDK adds is reported verbatim rather than+ silently dropped — and `--verify` fails on any of them. **An app-scope setting WRITE is a no-op until+ the app is published** (live-measured: the write reports `notPersisted` and `appsettings` holds no row+ at all, while publishing and re-issuing the same call applies every feature). This is not read lag, so+ re-*proving* after publish cannot fix it — the build **re-issues** the write after publish for anything+ the first attempt did not apply. Verification proves the override ROW, keyed by `appmoduleid`, so the+ build passes the id it already holds rather than have the SDK resolve it by name (an unpublished+ appmodule is not readable). See the `ai-features` phase in `scripts/lib/sdk-build.js` for the full+ sequence and its bounds.+ The flag set is resolved ONCE by `scripts/lib/ai-app-settings.js` and shared by the build and the+ verifier: a spec with an `ai` block but no `ai.appFeatures` still gets defaults written, so+ reconciling only the DECLARED features left them applied-but-unverified.+ All AI features are **admin-gated**: the skill preflightsand skips/warns; it cannot flip admin or tenant switches. `scripts/lib/ai-candidates.js` selectsgood-candidate tables for auto row-summary mode; `scripts/lib/ai-prompt.js` generates tailored summaryprompts. The `ai` block in the App Spec configures the full set; see@@ -552,6 +641,10 @@ NODE20_BIN=/path/to/node20/bin node scripts/run-tests.js --with-sdk /path/to/pow```- `run-tests.js` runs the full `scripts/tests/*.test.js` suite and prints a combined PASS/FAIL.+ **CI runs this same command** (`.github/workflows/model-apps-script-tests.yml`) on any PR touching+ `plugins/model-apps/**` or `evals/model-apps/**`, across ubuntu × windows × macos and Node 20 × 22.+ Keep `POWER_PLATFORM_SKILLS_TELEMETRY_MODEL_APPS_OPTOUT: "1"` on any new job that could run a+ telemetry-emitting hook or script.- The SDK's Jest suite needs **Node 20** (its `canvas` native module is built for the Node-20 ABI).Set `NODE20_BIN` to a Node-20 bin dir; without it the SDK suite is skipped (plugin suite still runs).- genpage evals: `node --test evals/model-apps/genpage/tests/*.test.js`, plus the Layer 1/2 runnersdiff --git a/plugins/model-apps/CHANGELOG.md b/plugins/model-apps/CHANGELOG.mdindex d8ce6eb2b..7f0c60d25 100644--- a/plugins/model-apps/CHANGELOG.md+++ b/plugins/model-apps/CHANGELOG.md@@ -2,7 +2,57 @@All notable changes to the **model-apps** plugin.-## [Unreleased] — 2.4.0+## [Unreleased] — 2.4.1++Bug fixes for apps built on **out-of-the-box** tables, and the matching `cds-maker-sdk` uptake.+No change to any skill's public surface.++### Fixed+- **AI app features had no effect on a newly built app** — an app-scope setting write is a no-op+ until the app is published, so the build wrote nothing while reporting success. The write is now+ re-issued after publish.+- **`--verify` PASSed when AI features were skipped or never applied** — it now proves an app-scope+ override row in `appsettings`. Reading the setting back is unsound: `RetrieveSetting` falls back+ to the environment value when an app has no override.+- **`ai.appFeatures` could not express non-boolean values** such as `2` ("on for everyone") — a+ value may now be a boolean or an integer `0..1000000`.+- **Download invented primary-name columns** (`account_name`, `contact_name` — neither exists) —+ now read from Dataverse metadata, never synthesized. Because a spec *requires* `primaryAttribute`,+ a table whose metadata does not supply one can no longer be emitted: a table reached from the app's+ **navigation** now **fails** the download naming it (`--allow-lossy-download` drops it instead),+ while a table found only as a hidden component is dropped with a warning.+- **Download replaced the solution's publisher prefix with `new`** — now read from the solution's+ owning publisher.+- **Download dropped tables with no sitemap entry** — the entity set is now the sitemap set unioned+ with tables owned by the app's view/chart/form components.+- **Teardown could permanently burn an app's unique name** — an app is two rows (`appmodule` ++ `sitemaps`) with no server-side cascade, so deleting only the app module stranded the sitemap and+ reserved its name forever. Both rows are now deleted atomically in one OData `$batch`, and any+ delete that cannot be proven refuses rather than guessing.+- **An unreadable app produced a raw SDK throw** instead of the download's documented+ `{ ok: false, error }`.++### Changed+- **Re-vendored `cds-maker-sdk`.** An injected `HttpClient` must now implement `postRaw` (verbatim+ multipart body out, raw response string back) for the atomic `$batch`; without it app deletion+ fails with `APP_DELETE_NOT_ATOMIC`. The plugin's client implements it and does not retry a+ `$batch` — it carries record deletes, and a racing retry wedges the row.++### Tests+- 1266 → 1340 tests; coverage 92.7 → 93.9% line, 82.7 → 83.6% branch.+- **model-apps now runs in CI** (`model-apps-script-tests`, ubuntu × windows × macos, Node 20 × 22,+ plus the offline evals) — previously every test workflow was scoped to `plugins/power-pages/**`,+ so this suite never ran on a PR.+- Real-bundle suites (`ai-app-features-real-bundle`, `app-delete-real-bundle`) drive the shipped+ vendored bundle, including one test that wires the real HTTP transport to it — the SDK's own Jest+ suite cannot run here (Node-20-ABI `canvas`).++### Known limitations+- **Table (`entity`) app components cannot be pinned via `AddAppComponents`** — the documented shape+ returns 204 but records a component pointing at the metadata table named `entity`. Platform defect+ **AB#39140211**; until it is fixed a table with no sitemap entry cannot be added to an app.++## 2.4.0A new **`/app-builder`** skill (Preview) that builds and edits whole model-driven apps,plus local-dev ergonomics, sample coverage, and an automated eval suite. Builds on v2.3;diff --git a/plugins/model-apps/agents/genpage-entity-builder.md b/plugins/model-apps/agents/genpage-entity-builder.mdindex f56fe721a..7e3c721e0 100644--- a/plugins/model-apps/agents/genpage-entity-builder.md+++ b/plugins/model-apps/agents/genpage-entity-builder.md@@ -120,7 +120,7 @@ If `identitiesMatch: false`, log a one-line warning in the transaction log## Step 3 — Open the Transaction Log-Before any writes, create `<working-dir>/entity-creation-log.md` with a header:+Before any writes, create `<working-dir>/genpage-entity-creation-log.md` with a header:```markdown# Entity Creation Log@@ -305,7 +305,7 @@ The script outputs structured JSON:If `ok: false`, the output includes `{ "ok": false, "error": "...", "phase": "..." }`.Surface the error to the user and abort.-Parse the successful result and populate `entity-creation-log.md` with the+Parse the successful result and populate `genpage-entity-creation-log.md` with thefollowing structure:### Created Tables Section@@ -475,7 +475,7 @@ The CLI output includes:}```-Update the `## Commands` section in `entity-creation-log.md` to reflect the+Update the `## Commands` section in `genpage-entity-creation-log.md` to reflect the`--sample-data` flag:```markdown@@ -509,7 +509,7 @@ Entity creation complete.|-------|---------------------|---------|---------------|----------------|| [display] | [actual_name] | [N] | [description] | [N or "skipped"] |-Log: <working-dir>/entity-creation-log.md+Log: <working-dir>/genpage-entity-creation-log.mdReady for RuntimeTypes generation.```diff --git a/plugins/model-apps/references/app-spec-schema.md b/plugins/model-apps/references/app-spec-schema.mdindex 948e4424f..3d904cf4b 100644--- a/plugins/model-apps/references/app-spec-schema.md+++ b/plugins/model-apps/references/app-spec-schema.md@@ -499,11 +499,17 @@ entirely optional; omitting it leaves every AI feature at its platform default.```jsonc"ai": {- // appFeatures: opt specific AI features in or out for this app (all optional booleans).+ // appFeatures: opt specific AI features in or out for this app (all optional).+ // Values are `true`/`false` (the ergonomic spellings of the underlying numeric settings' 1/0) or an+ // explicit integer between 0 and 1000000 for a platform-defined value — notably `2` = "on for+ // everyone". The bound mirrors the SDK's own, so an out-of-range value is rejected here rather+ // than aborting the build half-applied.+ // These write PER-APP settings, which are distinct from the org-level admin gates the build+ // preflights; a feature whose org gate is off is skipped with a warning and never silently applied."appFeatures": {"formFill": true, // Copilot-assisted form fill (data entry)"nlSearch": true, // natural-language grid/view search (data exploration)- "nlChart": true, // natural-language chart / AI data visualization+ "nlChart": 2, // natural-language chart / AI data visualization — on for everyone"m365": false // M365 Copilot integration (opt-in; defaults false)},// summaries: configure the row-summary (Copilot summary card) feature per table.@@ -542,7 +548,8 @@ auto-selects tables that are good row-summary candidates and skips those that ar- State an **explicit output shape**: a short paragraph is the recommended default.**Validation rules** (`validateAppSpec` / `lintAppSpec`):-- `ai.appFeatures` keys must be one of `formFill · nlSearch · nlChart · m365`; values must be booleans (hard error).+- `ai.appFeatures` keys must be one of `formFill · nlSearch · nlChart · m365`; values must be a boolean or an integer between `0` and `1000000` (hard error) — the same range the SDK enforces, so an out-of-range value is rejected here rather than aborting the build half-applied. `true`/`false` mean the underlying numeric setting's `1`/`0`; use an explicit integer (e.g. `2`) for a platform value like "on for everyone".+- Omitting `ai.appFeatures` does **not** mean "no AI features": a spec carrying any `ai` block gets the defaults `formFill · nlSearch · nlChart` on and `m365` off, and `--verify` reconciles that whole resolved set.- `ai.summaries.default` must be `"auto"` or `"off"` (hard error).- `ai.summaries.tables` keys must match a declared entity `schemaName` (case-insensitive, hard error).- `columns[]` entries must be declared column `schemaName` values on that entity (hard error in both validate and lint).diff --git a/plugins/model-apps/scripts/capture-fixture.js b/plugins/model-apps/scripts/capture-fixture.jsindex 9293f4309..d88a97806 100644--- a/plugins/model-apps/scripts/capture-fixture.js+++ b/plugins/model-apps/scripts/capture-fixture.js@@ -4,7 +4,7 @@// Captures a /genpage working directory into an eval fixture folder.//// Copies the agent-produced artifacts (.tsx, RuntimeTypes.ts, workflow-log.md,-// genpage-plan.md, genpage-edit-plan.md, entity-creation-log.md) into+// genpage-plan.md, genpage-edit-plan.md, genpage-entity-creation-log.md) into// evals/model-apps/genpage/fixtures/<eval-id>-<slug>/, skipping local-dev// scaffolding (package.json, genpage.d.ts) and build artifacts (node_modules,// dist, *.log).diff --git a/plugins/model-apps/scripts/download-model-app.js b/plugins/model-apps/scripts/download-model-app.jsindex e351253aa..e8c8fe889 100644--- a/plugins/model-apps/scripts/download-model-app.js+++ b/plugins/model-apps/scripts/download-model-app.js@@ -102,6 +102,84 @@ function collectSitemap(app) {return { entities: [...entities], icons: [...icons], customRefs: [...customRefs] };}+// The entity logical names that are COMPONENTS of the app module, regardless of whether they appear+// in the sitemap. `collectSitemap` can only see tables the maker placed in navigation, but a+// model-driven app routinely includes tables reachable only through a lookup, sub-grid, or related+// view — an app built on account/contact typically also carries task, email, appointment, phonecall,+// systemuser, team and annotation with no sitemap entry of their own. Reconstructing entities from+// the sitemap alone silently dropped those (ADO 6603388), so the download→edit→rebuild round trip+// lost hidden app dependencies.+//+// The entity is derived from the app's VIEW / CHART / FORM components, NOT from its+// `componenttype eq 1` (Entities) rows. That looks like the obvious source but is unusable:+// LIVE-verified that every componenttype-1 row carries the SAME `objectid` — the MetadataId of the+// `entity` metadata table itself — so it identifies the component *kind*, not which table. (On a+// 2-table app both rows read `9d0f025b-…`, which resolves to the logical name `entity`.)+// `RetrieveAppComponents` returned 0 rows on the same app, so it is not an alternative here.+//+// View/chart/form components DO carry usable ids: each `objectid` is a real row id whose record+// names its owning table. An app includes its tables' views and forms, so unioning their owners+// recovers the hidden membership.+// componenttype 26 → savedquery.returnedtypecode+// componenttype 59 → savedqueryvisualization.primaryentitytypecode+// componenttype 60 → systemform.objecttypecode+// See: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/reference/entities/appmodulecomponent+//+// `appId` is the appmoduleid; the parent lookup targets `appmoduleidunique`, so that is resolved+// first. Best-effort by design: any failure returns an empty list so the caller keeps today's+// sitemap-derived behavior rather than losing the download entirely.+const APP_COMPONENT_ENTITY_SOURCES = [+ { componentType: 26, set: 'savedquery', idField: 'savedqueryid', entityField: 'returnedtypecode' },+ { componentType: 59, set: 'savedqueryvisualization', idField: 'savedqueryvisualizationid', entityField: 'primaryentitytypecode' },+ { componentType: 60, set: 'systemform', idField: 'formid', entityField: 'objecttypecode' },+];+// Dataverse honors `$top` as a HARD cap and omits `@odata.nextLink`, so this is the point past which+// components of one type stop being inspected. Generous for a real app (a 70-table app has ~1000+// views), and exceeded only with a warning.+const COMPONENT_PAGE_CAP = 1000;++async function appComponentEntities(sdk, appId) {+ if (!appId) return [];+ try {+ const appRows = await sdk.queryRecords('appmodule', { select: ['appmoduleidunique'], filter: `appmoduleid eq ${appId}`, top: 1 });+ const appUniqueId = appRows && appRows[0] && appRows[0].appmoduleidunique;+ if (!appUniqueId) return [];+ const parent = String(appUniqueId).replace(/[{}]/g, '');+ const found = new Set();+ for (const src of APP_COMPONENT_ENTITY_SOURCES) {+ const rows = await sdk.queryRecords('appmodulecomponent', {+ select: ['objectid', 'componenttype'],+ filter: `_appmoduleidunique_value eq ${parent} and componenttype eq ${src.componentType}`,+ top: COMPONENT_PAGE_CAP,+ });+ // `$top` is a HARD cap in Dataverse (the SDK refuses to combine `top` with `paginate` for+ // exactly this reason: `@odata.nextLink` is omitted, so the tail is lost with no signal). An+ // app with more than this many components of one type would silently lose the remainder —+ // the same silent-drop class as ADO 6603388, just at a higher threshold — so say so rather+ // than quietly returning a partial set.+ if ((rows || []).length >= COMPONENT_PAGE_CAP) {+ process.stderr.write(`WARNING: this app has at least ${COMPONENT_PAGE_CAP} ${src.set} components; only the first ${COMPONENT_PAGE_CAP} were inspected, so a table referenced only beyond that point may be missing from the spec.\n`);+ }+ const ids = [...new Set((rows || []).map((r) => r && r.objectid).filter(Boolean).map((id) => String(id).replace(/[{}]/g, '')))];+ // Chunk the OR-batched id lookups so a many-component app cannot build an over-long URL.+ for (let i = 0; i < ids.length; i += 20) {+ const filter = ids.slice(i, i + 20).map((id) => `${src.idField} eq ${id}`).join(' or ');+ const recs = await sdk.queryRecords(src.set, { select: [src.idField, src.entityField], filter, top: 1000 });+ // A dashboard is a `systemform` row too, and its `objecttypecode` is NOT an entity logical+ // name ('none' / ''). Filtering it here keeps a bogus name out of the metadata fetch loop+ // instead of relying on that fetch 404-ing into a bare catch.+ for (const r of recs || []) {+ const logical = r && r[src.entityField] ? String(r[src.entityField]).toLowerCase() : '';+ if (logical && logical !== 'none') found.add(logical);+ }+ }+ }+ return [...found];+ } catch {+ return []; // best-effort — never break the download over the component read+ }+}+// Read pac's downloaded page tree (<pagesRoot>/<pageId>/{page.tsx,config.json,prompt.txt}) into// pages[] entries with codeFile paths relative to `outDir`.function parseDownloadedPages(pagesRoot, outDir, nameById) {@@ -184,12 +262,27 @@ function missingDownloads(a, b) {// Minimal entity spec (schemaName + primary name column). The build reuses existing tables/columns// idempotently, so column fidelity isn't required to re-apply an edit.+//+// The primary-name attribute MUST come from real Dataverse metadata. It used to fall back to a+// `<first-segment-of-logical>_name` guess, which is wrong for most out-of-the-box tables — `account`+// became `account_name` (really `name`) and `contact` became `contact_name` (really `fullname`). The+// guess was invisible on custom tables (`co_ticket` → `co_name`, which happens to be right), so the+// bug only surfaced on an app built from standard tables (ADO 6603392). The SDK's+// fetchEntityMetadata now $selects and returns PrimaryNameAttribute/SchemaName, so consume those.+//+// `primaryAttribute` is REQUIRED by App Spec validation, so this cannot simply omit it when metadata+// is missing — that would emit a spec the user cannot rebuild from at all. Instead the caller treats a+// missing primary name as a hard download failure, which is actionable at the point it happens rather+// than as a confusing validation error later. Returns `null` for `primaryAttribute` so the caller can+// detect and report it.function entityFromMetadata(meta, logical) {- const primary = (meta && (meta.primaryNameAttribute || meta.primaryNameLogicalName)) || `${logical.split('_')[0]}_name`;+ const primary = meta && (meta.primaryNameAttribute || meta.primaryNameLogicalName);return {schemaName: (meta && (meta.schemaName || meta.logicalName)) || logical,displayName: (meta && meta.displayName) || logical,- primaryAttribute: { schemaName: primary, displayName: 'Name' },+ // Never synthesized: a fabricated attribute name yields a spec that references a column Dataverse+ // does not have, which is exactly the bug this fixes.+ primaryAttribute: primary ? { schemaName: primary, displayName: 'Name' } : null,columns: [],// Flag every recovered table as pre-existing so a teardown of THIS downloaded spec never deletes the// table (+ its data). Download cannot prove which tables the app CREATED vs merely REFERENCED, and@@ -313,10 +406,14 @@ function droppedSubareaCount(app, spec) {// and pick the single unmanaged, non-system solution. Best-effort: returns null (caller keeps its own// default) on no match or any query error — never throws.//-// Returns ONLY the solution `{ uniqueName }` (the teardown container). The publisher PREFIX is-// deliberately NOT recovered here: an app can belong to SEVERAL unmanaged solutions under DIFFERENT-// publishers, so this arbitrary `find()` pick is not an authoritative source for the app's own prefix-// (Sol review). The caller derives the trusted prefix from the app's REAL uniquename instead.+// Returns `{ uniqueName, publisherPrefix? }`. The publisher prefix is read from the recovered+// solution's OWNING PUBLISHER via the SDK's `getSolution`, because it is the only authoritative+// source: the prefix was previously guessed from the app's uniquename, which breaks whenever the app+// name doesn't encode the solution's publisher — an app named `new_customermanagement` inside+// publisher `contoso`, an app with no prefix at all, or a publisher prefix longer than the guess's+// length bound all collapsed to the literal `'new'` (ADO 6603390). `getSolution` is best-effort on top+// of best-effort: if it fails or the publisher defines no prefix, we return the uniqueName alone and+// the caller falls back to the app-derived guess.async function recoverAppSolution(sdk, appId) {try {// objectid == the appmoduleid. `top:500` is a safe over-provision (an app is realistically a@@ -332,7 +429,19 @@ async function recoverAppSolution(sdk, appId) {const sols = await sdk.queryRecords('solution', { select: ['solutionid', 'uniquename', 'ismanaged'], filter, top: 500 });const real = (sols || []).find((s) => s && s.ismanaged === false && !isRestrictedSolution(s.uniquename));if (!real) return null;- return { uniqueName: real.uniquename };+ const out = { uniqueName: real.uniquename };+ // Authoritative publisher prefix for anything authored into THIS solution. Guarded on the method+ // existing so an older vendored bundle (pre-getSolution) degrades to the caller's fallback instead+ // of throwing away the solution we just recovered.+ if (typeof sdk.getSolution === 'function') {+ try {+ const info = await sdk.getSolution(real.uniquename);+ // An empty-string prefix is legitimate for some first-party publishers, but it is not usable as+ // a customization prefix, so treat it as "not recovered" and let the caller fall back.+ if (info && info.publisherPrefix) out.publisherPrefix = String(info.publisherPrefix).toLowerCase();+ } catch { /* best-effort — keep the recovered uniqueName */ }+ }+ return out;} catch {return null; // best-effort — a recovery failure must not break the download}@@ -349,8 +458,23 @@ async function recoverAppSolution(sdk, appId) {// dashboardReconstructionError } or { ok:false, error }.// Logical failures (no sitemap, enumeration down, missing download) return { ok:false } without// throwing. Unexpected I/O errors propagate as thrown exceptions (caught by main().catch).-async function runDownload({ sdk, genpageCli, outDir, appId, appUnique }) {- const app = await sdk.fetchArtifact('app', appId);+async function runDownload({ sdk, genpageCli, outDir, appId, appUnique, allowLossy = false }) {+ // `fetchArtifact('app')` FAILS CLOSED when the app's sitemap cannot be resolved, read, or proven to+ // still belong to this app (SDK code `APP_SITEMAP_UNRESOLVED`) — rather than returning an app whose+ // navigation is untrustworthy. That is a LOGICAL failure of exactly the class this function's+ // contract says it returns rather than throws (the sitemap IS the download's membership oracle), so+ // translate it instead of letting a raw SDK error escape. A newly created app is the common cause:+ // an unpublished appmodule is not readable, so the caller's fix is to publish it and retry.+ let app;+ try {+ app = await sdk.fetchArtifact('app', appId);+ } catch (e) {+ const code = e && e.code;+ if (code === 'APP_SITEMAP_UNRESOLVED' || code === 'APP_UPDATE_NO_ETAG') {+ return { ok: false, error: `cannot read app ${appId}: ${(e && e.message) || code}` };+ }+ throw e;+ }const { entities: entityLogicals, icons, customRefs } = collectSitemap(app);// MEMBERSHIP: the authoritative set of pages owned by this app, from its SITEMAP XML (fail-closed,@@ -461,33 +585,86 @@ async function runDownload({ sdk, genpageCli, outDir, appId, appUnique }) {}}- // Entities (minimal — the build reuses existing tables/columns idempotently, so column fidelity- // isn't required to re-apply an edit).+ // Entities: the sitemap's navigable tables UNIONED with the app's real entity components. The+ // sitemap alone misses tables reachable only via lookup/sub-grid/related view (ADO 6603388); the+ // component read is best-effort, so a failure degrades to exactly today's sitemap-derived set.+ const componentLogicals = await appComponentEntities(sdk, appId);+ const sitemapSet = new Set(entityLogicals);+ const allLogicals = [...new Set([...entityLogicals, ...componentLogicals])];const entities = [];- for (const logical of entityLogicals) {- try { entities.push(entityFromMetadata(await sdk.fetchEntityMetadata(logical), logical)); } catch { /* skip */ }+ const noPrimaryName = []; // sitemap tables — a hard failure (the user asked for these)+ const droppedComponents = []; // component-only tables — dropped with a warning (best-effort input)+ const metadataErrors = new Map(); // logical -> error message (the read itself failed)+ for (const logical of allLogicals) {+ let e;+ // A metadata READ failure is not the same as metadata that reports no primary name, and it must+ // not be swallowed: a 429/503 on a sitemap table used to drop it silently, leaving its subarea+ // behind so validation later complained about a "sitemap subArea references unknown entity" —+ // the confusing downstream error the explicit branch below exists to avoid. Bucket it by origin+ // exactly like the no-primary-name case, so the user is told the table AND the reason.+ try {+ e = entityFromMetadata(await sdk.fetchEntityMetadata(logical), logical);+ } catch (err) {+ metadataErrors.set(logical, (err && err.message) || String(err));+ (sitemapSet.has(logical) ? noPrimaryName : droppedComponents).push(logical);+ continue;+ }+ // `primaryAttribute` is REQUIRED by App Spec validation, so an entity without one cannot be+ // emitted — the spec would fail to validate and the user could not rebuild at all. Guessing the+ // name is what caused ADO 6603392, so the only honest options are fail or drop.+ //+ // Which one depends on WHERE the table came from. A sitemap table is one the user explicitly+ // navigated to: failing loudly names it and is actionable. A component-only table is a hidden+ // dependency this download newly discovered on a best-effort basis — aborting the whole download+ // over one (which previously downloaded fine, because it was never included) would be a+ // regression with no override flag, so drop it and say so. NOTE the SDK returns '' (not+ // undefined) for a missing PrimaryNameAttribute, which `entityFromMetadata` maps to null.+ if (!e.primaryAttribute) {+ (sitemapSet.has(logical) ? noPrimaryName : droppedComponents).push(logical);+ continue;+ }+ entities.push(e);+ }+ const withReason = (list) => list.map((l) => (metadataErrors.has(l) ? `${l} (metadata read failed: ${metadataErrors.get(l)})` : l)).join(', ');+ if (noPrimaryName.length) {+ // Overridable, like the dropped-subarea path: without an escape hatch a download that used to+ // succeed produces nothing at all, which is an availability regression on a READ-ONLY command.+ if (!allowLossy) {+ return { ok: false, error: `could not read the primary-name column for table(s): ${withReason(noPrimaryName)} — refusing to write a spec with a guessed or missing primary attribute (re-run with --allow-lossy-download to drop them instead)` };+ }+ process.stderr.write(`WARNING: ${noPrimaryName.length} sitemap table(s) were DROPPED because their primary-name column could not be read (${withReason(noPrimaryName)}) — --allow-lossy-download was set. Their navigation entries are dropped too; the spec will not rebuild them.\n`);+ for (const l of noPrimaryName) sitemapSet.delete(l);+ }+ if (droppedComponents.length) {+ process.stderr.write(`WARNING: ${droppedComponents.length} app component table(s) were omitted from the spec because Dataverse reported no primary-name column (${withReason(droppedComponents)}) — they are NOT in the app's navigation, and the deployed app still references them; declare them by hand if a rebuild needs them.\n`);}- // App identity + publisher prefix come from the app's REAL, immutable uniquename (`appUnique`, captured- // from Dataverse as `appmodule.uniquename`; guaranteed present here because runDownload bails at the- // sitemap gate above when it is falsy). It IS the app's own publisher prefix and exactly what the build- // (appUniqueName → findArtifact) + teardown must match — NOT the mutable display name (a rename would- // miss the existing app) and NOT an arbitrary unmanaged solution membership (an app can belong to several,- // under different publishers — Sol review). Parsed BEFORE the solution-recovery I/O so a recovery failure- // can't lose it, with a full `<prefix>_<name>` shape check (a bare token is not a valid app uniquename —- // its leading segment must be followed by `_<name>`). This is the ONLY TRUSTED source for the icon- // own-vs-foreign classification; when it can't be parsed, prefixResolved=false makes the classifier- // surface (rather than silently drop) a custom nav icon it can't attribute to this app.+ // App identity comes from the app's REAL, immutable uniquename (`appUnique`, captured from Dataverse as+ // `appmodule.uniquename`; guaranteed present here because runDownload bails at the sitemap gate above).+ // It is exactly what the build (appUniqueName → findArtifact) + teardown must match — NOT the mutable+ // display name (a rename would miss the existing app). Its leading segment is ALSO parsed as a+ // publisher-prefix FALLBACK, with a full `<prefix>_<name>` shape check (a bare token is not a valid app+ // uniquename — its leading segment must be followed by `_<name>`).+ //+ // This app-derived value is only a fallback: the app's name does not reliably encode the publisher of+ // the solution that owns it (ADO 6603390). The authoritative prefix is the recovered solution's owning+ // publisher, read below.const appPrefixMatch = /^([a-z][a-z0-9]{1,7})_.+$/.exec(String(appUnique || '').toLowerCase());- const trustedPrefix = appPrefixMatch ? appPrefixMatch[1] : null;+ const appDerivedPrefix = appPrefixMatch ? appPrefixMatch[1] : null;// Solution container (best-effort): the real unmanaged solution the appmodule belongs to, for a clean- // teardown. Falls back to the restricted 'Default' when recovery finds nothing — that fallback cannot be- // torn down, but teardown skips it safely (see system-solutions.js) rather than erroring. Only its- // uniqueName is used; the publisher prefix is the appUnique-derived `trustedPrefix` above, NOT this- // solution's publisher (which may belong to a different publisher).- const solution = { uniqueName: 'Default', publisherPrefix: trustedPrefix || 'new', prefixResolved: !!trustedPrefix };+ // teardown, plus its owning publisher's customization prefix. Falls back to the restricted 'Default'+ // when recovery finds nothing — that fallback cannot be torn down, but teardown skips it safely (see+ // system-solutions.js) rather than erroring.const recovered = await recoverAppSolution(sdk, appId);++ // Prefix precedence: the SOLUTION's publisher (authoritative) → the app-uniquename guess (fallback).+ // `prefixResolved` means "this prefix is trustworthy", which gates the icon own-vs-foreign+ // classification below; it must be true for BOTH trusted sources, or a genuine own-publisher custom+ // nav icon stops round-tripping. It stays false only for the unverified 'new' default.+ const solutionPrefix = (recovered && recovered.publisherPrefix) || null;+ const trustedPrefix = solutionPrefix || appDerivedPrefix;+ const solution = { uniqueName: 'Default', publisherPrefix: trustedPrefix || 'new', prefixResolved: !!trustedPrefix };if (recovered && recovered.uniqueName) solution.uniqueName = recovered.uniqueName;// Icon web resources — looked up by NAME (the sitemap stores the web-resource name, not its id).@@ -560,7 +737,7 @@ async function main() {const appUnique = appRows && appRows[0] && appRows[0].uniquename;const genpageCli = makeGenpageCli(env);- const result = await runDownload({ sdk, genpageCli, outDir, appId, appUnique });+ const result = await runDownload({ sdk, genpageCli, outDir, appId, appUnique, allowLossy: allowLossyDownload });if (!result.ok) { emitResult(false, result); return; }const { spec, pages, entities, webResources, droppedSubareas, droppedSubareaDetails, dashboardReconstructionError } = result;@@ -591,4 +768,4 @@ if (require.main === module) {main().catch((err) => emitResult(false, err));}-module.exports = { resolveAppId, collectSitemap, parseDownloadedPages, assignPageKeys, missingDownloads, entityFromMetadata, iconWebResources, readDashboards, droppedSubareaCount, recoverAppSolution, runDownload };+module.exports = { resolveAppId, collectSitemap, appComponentEntities, parseDownloadedPages, assignPageKeys, missingDownloads, entityFromMetadata, iconWebResources, readDashboards, droppedSubareaCount, recoverAppSolution, runDownload };diff --git a/plugins/model-apps/scripts/lib/ai-app-settings.js b/plugins/model-apps/scripts/lib/ai-app-settings.jsnew file mode 100644index 000000000..ad3f1503e--- /dev/null+++ b/plugins/model-apps/scripts/lib/ai-app-settings.js@@ -0,0 +1,180 @@+'use strict';+// SINGLE SOURCE OF TRUTH for the per-app AI feature contract.+//+// Before this module the same knowledge lived in four parallel places — the validation allow-list+// (app-spec.js), the setting-name map (verify-spec.js), the build's requested flag set+// (sdk-build.js) and the SDK's own module-private map — and they had already drifted in a way that+// re-opened the bug this area exists to fix: the BUILD writes a default for every feature whenever+// `spec.ai` is present, but verify only reconciled the features a spec DECLARED. A spec carrying+// `ai.summaries` and no `ai.appFeatures` therefore had three features written and ZERO verified,+// so `--verify` reported a clean PASS for features the platform may never have stored — exactly the+// false PASS of ADO 6603383, just narrowed rather than removed.+//+// Everything here is pure except the two `read`-driven proof helpers, which take an injected reader+// so both the build engine and the verifier can share one implementation of the authoritative query.++const { odataLit } = require('./odata.js');++// The PER-APP setting each AI feature writes — mirrors the SDK's `APP_SETTING` map (api/AiApi.ts).+// These are deliberately DISTINCT from the org readiness gates in the SDK's `AI_GATE`: e.g. the+// `nlSearch` org gate is the boolean `EnableNLGridSearch`, but the per-app setting is the numeric+// `NLGridSearchSetting`. Verify must read the PER-APP setting, because that is what the build wrote+// and what is in force for this app. Conflating the two is exactly the bug that made NL grid search+// report "applied" while writing nothing (ADO 6560699 / 6603383).+// Keep in sync with the vendored SDK; `sdk-surface-contract.test.js` guards the method surface and+// `verify-spec.test.js` pins these names.+const AI_APP_SETTING = {+ formFill: 'FormFillBarUXEnabled',+ nlSearch: 'NLGridSearchSetting',+ nlChart: 'NLChartDataVisualizationSetting',+ m365: 'm365copilotmodelappenabled',+};++// Derived, never hand-maintained: the validator's allow-list IS the set of features we can write.+const AI_FEATURE_KEYS = new Set(Object.keys(AI_APP_SETTING));++// Upper bound for a per-app AI feature setting value. MIRRORS `MAX_SETTING_VALUE` in the SDK's+// api/AiApi.ts, which THROWS an InvalidArgumentError outside this range — validating against the+// same bound turns a mid-build abort into an up-front spec error naming the offending field.+const AI_FEATURE_MAX_VALUE = 1000000;++// What the build requests when a spec opts into `ai` without naming a feature. `m365` is off by+// default because it surfaces the app inside M365 Copilot, which is a deliberate choice rather+// than a sensible default.+const DEFAULT_APP_FEATURES = { formFill: true, nlSearch: true, nlChart: true, m365: false };++/**+ * The EXACT flag set the build writes for a spec — and therefore the exact set verify must+ * reconcile. Both callers MUST go through this; that equality is the whole point of the module.+ * Returns null when the spec opts out of `ai` entirely (no features are written, none are checked).+ */+function resolveAiFlags(spec) {+ if (!spec || spec.ai === undefined || spec.ai === null) return null;+ const flags = Object.assign({}, DEFAULT_APP_FEATURES, spec.ai.appFeatures || {});+ // Drop keys the SDK has no setting for: it ignores them, so verifying them would invent a+ // permanent failure for a spec the validator already reports on.+ const out = {};+ for (const [k, v] of Object.entries(flags)) if (AI_FEATURE_KEYS.has(k)) out[k] = v;+ return out;+}++/**+ * Normalize a requested flag to the string the numeric setting stores. `true`/`false` are the+ * ergonomic spellings of `'1'`/`'0'`; any other integer (e.g. 2 = "on for everyone") is used+ * verbatim. Mirrors the SDK's `settingValueOf`, minus its throwing validation — the spec validator+ * has already rejected out-of-range values by the time this runs.+ */+function featureWantValue(requested) {+ return typeof requested === 'boolean' ? (requested ? '1' : '0') : String(requested).trim();+}++/**+ * Compare a stored setting value against a requested one.+ *+ * Deliberately NOT dependent on the setting's `dataType`. A Dataverse Boolean setting (dataType 2)+ * reports `'true'`/`'false'` rather than `'1'`/`'0'`, so the two spellings must be reconciled — but+ * branching on a dataType read makes the comparison depend on a SECOND request that can fail+ * independently, which silently turned a correctly-applied feature into a FAIL when that read+ * errored. Normalizing both sides unconditionally is a no-op for the numeric values these settings+ * actually store (live: the override rows hold '1'/'0'), while still accepting the boolean+ * spelling — so it is strictly safer and has no hidden dependency.+ */+function sameSettingValue(a, b) {+ const onOff = (v) => {+ const s = String(v === undefined || v === null ? '' : v).trim().toLowerCase();+ return s === 'true' ? '1' : s === 'false' ? '0' : s;+ };+ return onOff(a) === onOff(b);+}++/**+ * Resolve the `appmoduleid` for an app's unique name via an injected reader.+ *+ * Deliberately NOT cached beyond one call: an app can be deleted and re-imported under the same+ * unique name with a NEW id, and a stale id would prove an override against the wrong app.+ * Returns `{ appModuleId }` on success or `{ error }` when it could not be resolved — the caller+ * must fail CLOSED on `error` rather than assume absence.+ */+async function resolveAppModuleId(read, appUniqueName) {+ try {+ const rows = await read.queryRecords('appmodule', { select: ['appmoduleid'], filter: `uniquename eq '${odataLit(appUniqueName)}'`, top: 1 });+ const appModuleId = rows && rows[0] && rows[0].appmoduleid;+ if (!appModuleId) return { error: `no app module with unique name '${appUniqueName}' was found` };+ return { appModuleId };+ } catch (e) {+ return { error: `the app module could not be read: ${e && e.message}` };+ }+}++/**+ * Prove whether an APP-SCOPE override row exists for `setting` on this app, and what it holds.+ *+ * This is the ONLY authoritative signal. `RetrieveSetting(name, { appUniqueName })` FALLS BACK to+ * the ENVIRONMENT value when the app has no override, so a matching read-back does NOT prove the+ * app-scope write landed: if the environment already holds the requested value, a write the+ * platform silently ignored reads back as a perfect match. (Live-verified: RetrieveSetting returned+ * the env value while `appsettings` held zero rows for that app+setting.)+ *+ * Returns `{ exists, value }`, or `{ error }` when the proof could not be RUN — the caller must+ * distinguish "verifiably absent" from "could not look" and never report the latter as success.+ */+async function proveAppOverride(read, appModuleId, setting, opts = {}) {+ let defId;+ try {+ const defs = await read.queryRecords('settingdefinition', { select: ['settingdefinitionid'], filter: `uniquename eq '${odataLit(setting)}'`, top: 1 });+ defId = defs && defs[0] && defs[0].settingdefinitionid;+ } catch (e) {+ return { error: `the setting definition could not be read: ${e && e.message}` };+ }+ // A setting the environment has never heard of is NOT the same as an app missing an override:+ // e.g. `m365copilotmodelappenabled` simply does not exist in an org where M365 Copilot was never+ // provisioned, and there is no action a maker could take to satisfy it. Report it as unprovable+ // so the caller can say so precisely instead of alleging a missing override.+ if (!defId) return { error: `no setting definition named '${setting}' exists in this environment`, unsupported: true };+ // Retry ONLY the absent case, and only when the caller asks. An override row can lag briefly+ // behind the write that created it (observed live: the SDK reported a feature not persisted on+ // first apply and clean on a re-run, with the value correct all along), and a verifier that reads+ // once turns that lag into a false FAIL on the build's exit code. A read ERROR is not retried —+ // that is a different condition the caller must surface as "could not look", not "not there yet".+ const attempts = Math.max(1, Math.min(10, opts.attempts || 1));+ const delayMs = Math.max(0, Math.min(5000, opts.delayMs === undefined ? 500 : opts.delayMs));+ let last = { exists: false };+ for (let i = 0; i < attempts; i += 1) {+ if (i > 0 && delayMs) await new Promise((r) => setTimeout(r, delayMs));+ try {+ // `appsetting` rows carry the app and definition as lookups; GUID lookup values are compared+ // UNQUOTED in an OData $filter (…?$filter=_parentappmoduleid_value eq 0000…-0000), matching+ // the SDK's own query for the same proof.+ const rows = await read.queryRecords('appsetting', { select: ['value'], filter: `_parentappmoduleid_value eq ${odataGuid(appModuleId)} and _settingdefinitionid_value eq ${odataGuid(defId)}`, top: 1 });+ if (rows && rows.length) return { exists: true, value: rows[0].value };+ last = { exists: false };+ } catch (e) {+ return { error: `the app-scope override row could not be read: ${e && e.message}` };+ }+ }+ return last;+}++/**+ * Normalize a GUID for use as an UNQUOTED OData lookup comparand. Dataverse returns bare GUIDs, but+ * a caller-supplied id can arrive `{braced}` (the form `normalizeGuid` also accepts); interpolating+ * that raw produces `_x_value eq {0000…}`, a malformed filter that 400s and — because the proof+ * fails closed — reports every feature as unprovable. Stripping braces keeps a legitimate id+ * working; anything else is passed through so a genuinely bad id still fails loudly.+ */+function odataGuid(id) {+ return String(id === undefined || id === null ? '' : id).replace(/[{}]/g, '');+}++module.exports = {+ AI_APP_SETTING,+ AI_FEATURE_KEYS,+ AI_FEATURE_MAX_VALUE,+ DEFAULT_APP_FEATURES,+ resolveAiFlags,+ featureWantValue,+ sameSettingValue,+ resolveAppModuleId,+ proveAppOverride,+ odataGuid,+};diff --git a/plugins/model-apps/scripts/lib/app-spec.js b/plugins/model-apps/scripts/lib/app-spec.jsindex d77b9588a..c194e87a0 100644--- a/plugins/model-apps/scripts/lib/app-spec.js+++ b/plugins/model-apps/scripts/lib/app-spec.js@@ -32,6 +32,7 @@ const FORM_GUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{// PrivilegeScope depth, least->most permissive (user->Basic … organization->Global)// Keep these in lockstep with the SDK; vendor-sdk-smoke asserts the vendored bundle still exposes them.const ACCESS_LEVELS = new Set(['read', 'create', 'write', 'delete', 'append', 'appendTo', 'assign', 'share']);+const { AI_FEATURE_KEYS, AI_FEATURE_MAX_VALUE } = require('./ai-app-settings.js');const PRIVILEGE_SCOPES = new Set(['user', 'businessUnit', 'parentChild', 'organization']);// The exact ownership marker the vendored SDK (cds-maker-sdk SecurityApi) stamps on the `description`@@ -837,7 +838,11 @@ function validateAppSpec(spec, opts = {}) {const targets = ['entity', 'dashboard', 'url', 'page'].filter((k) => sa[k]);if (targets.length === 0) errors.push(`sitemap subArea "${sa.title || ''}" needs an entity, dashboard, url, or page`);else if (targets.length > 1) errors.push(`sitemap subArea "${sa.title || ''}" sets multiple targets (${targets.join(', ')}) — pick one`);- if (sa.entity && !entityNames.has(sa.entity)) errors.push(`sitemap subArea references unknown entity '${sa.entity}'`);+ // Case-insensitive: Dataverse logical names are lower-case while `schemaName` is cased+ // (`Account`), and a sitemap subarea's `entity` comes from the deployed sitemap XML as a+ // LOGICAL name. A downloaded spec therefore legitimately pairs `schemaName: "Account"` with+ // `entity: "account"`. Matches the chart check above, which already uses `entityByLower`.+ if (sa.entity && !entityByLower.has(String(sa.entity).toLowerCase())) errors.push(`sitemap subArea references unknown entity '${sa.entity}'`);if (sa.dashboard && !dashNamesSet.has(sa.dashboard)) errors.push(`sitemap subArea references unknown dashboard '${sa.dashboard}' (declare it in dashboards[])`);if (sa.url && !isSafeHttpUrl(sa.url)) errors.push(`sitemap subArea "${sa.title || ''}" url must be an http(s) URL (got '${sa.url}')`);// schemaVersion 2 references pages by stable KEY; legacy specs still reference by name.@@ -981,14 +986,27 @@ function validateAppSpec(spec, opts = {}) {if (!spec.ai || typeof spec.ai !== 'object' || Array.isArray(spec.ai)) {errors.push('ai must be an object');} else {- const AI_FEATURE_KEYS = new Set(['formFill', 'nlSearch', 'nlChart', 'm365']);+ const AI_FEATURE_KEYS_LIST = [...AI_FEATURE_KEYS].join(', ');if (spec.ai.appFeatures !== undefined) {if (!spec.ai.appFeatures || typeof spec.ai.appFeatures !== 'object' || Array.isArray(spec.ai.appFeatures)) {errors.push('ai.appFeatures must be an object');} else {for (const [k, v] of Object.entries(spec.ai.appFeatures)) {- if (!AI_FEATURE_KEYS.has(k)) errors.push(`ai.appFeatures: unknown key '${k}' (allowed: formFill, nlSearch, nlChart, m365)`);- if (typeof v !== 'boolean') errors.push(`ai.appFeatures.${k}: must be a boolean`);+ if (!AI_FEATURE_KEYS.has(k)) errors.push(`ai.appFeatures: unknown key '${k}' (allowed: ${AI_FEATURE_KEYS_LIST})`);+ // These map to NUMERIC Dataverse app settings, not booleans: `true`/`false` are the+ // ergonomic spellings of 1/0, but the platform also defines other values (notably 2 =+ // "on for everyone"), which a boolean-only contract made inexpressible (ADO 6560699).+ // Accept a boolean or a non-negative integer; reject anything else (a string like '2'+ // would silently bypass the range check downstream).+ //+ // The upper bound MIRRORS the SDK's `MAX_SETTING_VALUE` in api/AiApi.ts. The SDK THROWS+ // an InvalidArgumentError for an out-of-range value, so without this bound a spec would+ // validate cleanly and then abort the build half-applied — validation must reject it up+ // front, where the maker gets a message naming the field. `isSafeInteger` (not+ // `isInteger`) because beyond 2^53 an "integer" double no longer round-trips.+ if (typeof v !== 'boolean' && !(typeof v === 'number' && Number.isSafeInteger(v) && v >= 0 && v <= AI_FEATURE_MAX_VALUE)) {+ errors.push(`ai.appFeatures.${k}: must be a boolean or an integer between 0 and ${AI_FEATURE_MAX_VALUE} (e.g. true, false, or 2 for "on for everyone")`);+ }}}}diff --git a/plugins/model-apps/scripts/lib/sdk-build.js b/plugins/model-apps/scripts/lib/sdk-build.jsindex 4f61eaea1..0a5ad7960 100644--- a/plugins/model-apps/scripts/lib/sdk-build.js+++ b/plugins/model-apps/scripts/lib/sdk-build.js@@ -69,6 +69,7 @@ const { fetchSitemap, fetchAppsForPages } = require('./sitemap-pages.js');// classifies every generative navigateTo pageId at a REAL call site (never a decoy string / comment GUID).const { extractNavTargets, navReferencedKeys, navMalformedRefs, resolvePageRefs, navTargetParity } = require('./pageref-resolver.js');const { selectSummaryTables } = require('./ai-candidates.js');+const { AI_APP_SETTING, resolveAiFlags, featureWantValue, sameSettingValue, resolveAppModuleId, proveAppOverride } = require('./ai-app-settings.js');const { buildPromptSpec } = require('./ai-prompt.js');const { odataLit } = require('./odata.js');@@ -1728,14 +1729,76 @@ async function runSdkBuild(spec, opts = {}) {// 7c. AI features (opt-in via spec.ai). Enable app-level agents (gated on admin settings) +// configure per-table row summaries. All AI writes are best-effort-gated: setAppAiFeatures// skips features whose admin gate is off; it never throws.+ // Features the SDK did not put in `applied`, deferred for a post-publish re-proof (see inside the+ // ai-features phase for why the verdict cannot honestly be decided at write time).+ const pendingAiReconfirm = [];if (has('ai-features') && spec.ai !== undefined && spec.ai !== null) {const solutionUniqueName = spec.solution && spec.solution.uniqueName;const appUnique = appUniqueName(spec);- const flags = Object.assign({ formFill: true, nlSearch: true, nlChart: true, m365: false }, (spec.ai.appFeatures || {}));+ const flags = resolveAiFlags(spec);+ // NOTE: this first write frequently NO-OPS. An app-scope setting write does nothing until the+ // app is published, and this phase runs moments after `app-shell` created it (the `publish`+ // phase is later, and is opt-in). It is still issued here so an ALREADY-published app — the+ // common case on a rebuild/edit — applies immediately and needs no retry. Anything it does not+ // apply is re-issued after publish by the block at the end of this function, which replicates+ // the fetch → publish → write sequence measured to work live.await runner.run('ai-features', 'enable app AI features', async () => {- const r = await provision.setAppAiFeatures(appUnique, flags, { solutionUniqueName });+ // The SDK confirms each app-scope write by polling for its `appsettings` override row, keyed by+ // appmoduleid. That id is normally resolved from the app's unique NAME — but a freshly created+ // appmodule is not readable until it is PUBLISHED (Dataverse omits it from list queries and 404s+ // the by-id retrieve), and this phase runs moments after `app-shell` created it. The by-name+ // lookup is the ONLY piece that fails pre-publish; the `appsettings` proof query itself works+ // fine. Passing the id we already hold skips the lookup entirely and lets the write be proven+ // here, in the same phase that made it.+ //+ // The SDK still re-checks the id against the published app when the app IS readable, so a stale+ // or wrong id is rejected rather than silently used to configure another app.+ //+ // A modest retry budget still helps: on an established app the override row is queryable ~580ms+ // after the write (measured live), so the SDK's 4-attempt/500ms default is tight but the budget+ // is only ever spent when the row is genuinely absent.+ const r = await provision.setAppAiFeatures(appUnique, flags, {+ solutionUniqueName,+ appModuleId: result.created.app || undefined,+ verifyAttempts: 8,+ verifyDelayMs: 1000,+ });result.created.ai.appFeatures = r;- return (r.applied && r.applied.length) ? `applied: ${r.applied.join(', ')}${r.skipped && r.skipped.length ? '; skipped (admin gate off): ' + r.skipped.join(', ') : ''}` : '(none \u2014 admin gate off)';+ // `applied` is the SDK's ONLY success bucket: a feature reaches it only when the APP-SCOPE+ // override row is proven present holding the requested value. Every other bucket is a+ // non-success the build must surface, because reporting them as plain success was the+ // false-PASS half of ADO 6603383 (features were pushed onto `applied` while writing nothing):+ // notPersisted — the write returned 204 but no override was observed for the whole retry+ // budget; Dataverse can accept an app-scope write and store nothing.+ // unverified — the write was issued but the proof could not be READ (no access to+ // appsettings/settingdefinitions/appmodules, or a transport error).+ // failed — the write (or its org-gate read) threw. The SDK keeps going so the rest+ // of the batch still reports, so this arrives as data, never as an exception.+ //+ // RE-CONFIRMATION (safety net): with `appModuleId` supplied above, the SDK can prove the+ // override row here, pre-publish, so the normal path decides the verdict in this phase. The+ // deferral below remains for the residual cases the proof genuinely cannot settle yet — a+ // transient read failure, or a row that has not materialized inside the retry budget. Deciding+ // "NOT PERSISTED" on those would print a scary and WRONG verdict that `--verify` then+ // contradicts in the same run, so the buckets are recorded and re-proved after publish (see+ // `reconfirmAiFeatures` below) against the identical override-row oracle the verifier uses.+ // The re-proof can only ever UPGRADE a feature, never hide a real failure.+ //+ // Derive the non-success buckets from the RESULT, not a fixed list: a bucket added by a future+ // SDK revision is then reported verbatim rather than silently dropped (which is the very bug+ // class this phase exists to remove). `outcomes` is per-feature detail, not a bucket.+ const problemKeys = Object.keys(r || {}).filter((k) => k !== 'applied' && k !== 'skipped' && k !== 'outcomes' && Array.isArray(r[k]) && r[k].length);+ for (const key of problemKeys) {+ for (const feature of r[key]) {+ const outcome = (r.outcomes || []).find((o) => o && o.feature === feature);+ pendingAiReconfirm.push({ feature, bucket: key, reason: outcome && outcome.reason });+ }+ }+ const parts = [];+ if (r.applied && r.applied.length) parts.push(`applied: ${r.applied.join(', ')}`);+ if (r.skipped && r.skipped.length) parts.push(`skipped (admin gate off): ${r.skipped.join(', ')}`);+ if (pendingAiReconfirm.length) parts.push(`retrying after publish: ${pendingAiReconfirm.map((p) => p.feature).join(', ')}`);+ return parts.length ? parts.join('; ') : '(none \u2014 admin gate off)';});const tables = (spec.ai.summaries && spec.ai.summaries.default === 'off') ? [] : selectSummaryTables(spec);for (const logical of tables) {@@ -1813,6 +1876,86 @@ async function runSdkBuild(spec, opts = {}) {});}+ // 8b. AI feature re-issue + re-confirmation. An app-scope setting write is a NO-OP on a freshly+ // created app: measured live on two different apps, the write returned `notPersisted` and a+ // direct `appsettings` query showed no override row at ALL, while fetching + publishing that+ // same app and re-issuing the identical call produced every feature `applied` with real rows+ // holding the requested values. So this pass RE-ISSUES the write (re-proving alone cannot help+ // — there is nothing to find), then falls back to proving the override row for anything the+ // retry still did not claim. It can only ever UPGRADE a feature, never hide a real failure.+ if (pendingAiReconfirm.length) {+ const flags = resolveAiFlags(spec);+ const appUnique = appUniqueName(spec);+ const BUCKET_LABELS = {+ notPersisted: ['NOT PERSISTED', 'Dataverse accepted the write but no app-scope override holding the requested value was observed'],+ unverified: ['UNVERIFIED', 'the write was issued but could not be confirmed \u2014 verify manually before relying on it'],+ failed: ['FAILED', 'the write or its org-gate read threw'],+ };+ // Replicate the sequence proven to work live, in order: fetch the app (so the workspace holds the+ // server's copy), publish it, then write. Each step is best-effort — a failure here must not fail+ // the build, it just leaves the original non-success verdict standing and reported.+ const retryApplied = new Set();+ if (result.created.app) {+ const retryFlags = {};+ for (const p of pendingAiReconfirm) if (flags && Object.prototype.hasOwnProperty.call(flags, p.feature)) retryFlags[p.feature] = flags[p.feature];+ if (Object.keys(retryFlags).length) {+ try {+ await provision.fetchArtifact('app', result.created.app);+ await provision.publishArtifact('app', result.created.app);+ const retry = await provision.setAppAiFeatures(appUnique, retryFlags, {+ solutionUniqueName: spec.solution && spec.solution.uniqueName,+ appModuleId: result.created.app,+ verifyAttempts: 6,+ verifyDelayMs: 1000,+ });+ for (const f of (retry && retry.applied) || []) retryApplied.add(f);+ } catch { /* leave the original verdict standing; it is reported below */ }+ }+ }+ const app = await resolveAppModuleId(provision, appUnique);+ const stillBad = [];+ const reproven = [];+ // Track HOW each feature was recovered so the reported reason is true for that path. Claiming a+ // re-issue applied something the proof merely found is the same "report what you did not verify"+ // failure this whole phase exists to remove.+ const reprovenBy = new Map();+ for (const p of pendingAiReconfirm) {+ if (retryApplied.has(p.feature)) {+ reproven.push(p.feature);+ reprovenBy.set(p.feature, 'applied by the post-publish re-issue (an app-scope write is a no-op before the app is published)');+ continue;+ }+ const setting = AI_APP_SETTING[p.feature];+ let proof = { error: app.error };+ if (!app.error && setting) proof = await proveAppOverride(provision, app.appModuleId, setting);+ if (!proof.error && proof.exists && sameSettingValue(proof.value, featureWantValue(flags && flags[p.feature]))) {+ reproven.push(p.feature);+ reprovenBy.set(p.feature, 'confirmed present after publish by the build\u2019s own override-row proof');+ continue;+ }+ const [label, why] = BUCKET_LABELS[p.bucket] || [String(p.bucket).toUpperCase(), 'reported by the SDK as a non-success outcome'];+ // Prefer the SDK's OWN per-feature reason: it carries the real error text for `failed`, which+ // a canned bucket description throws away.+ stillBad.push({ feature: p.feature, label, why: p.reason || proof.error || why });+ }+ // Reflect the corrected verdict in the machine-readable result too, so a caller reading+ // `created.ai.appFeatures` is not told a feature failed when it demonstrably did not.+ const af = result.created.ai && result.created.ai.appFeatures;+ if (af && reproven.length) {+ af.applied = [...(af.applied || []), ...reproven];+ for (const key of Object.keys(af)) if (Array.isArray(af[key]) && key !== 'applied' && key !== 'skipped') af[key] = af[key].filter((f) => !reproven.includes(f));+ for (const o of af.outcomes || []) if (reproven.includes(o.feature)) { o.status = 'applied'; o.appOverrideExists = true; o.reason = reprovenBy.get(o.feature); }+ }+ // `runner.skip` renders as `⊘ <label>` — the closest thing the narrator has to a warning — and+ // advances the step counter correctly, which a hand-built `runner.emit` did not.+ const byLabel = new Map();+ for (const b of stillBad) {+ if (!byLabel.has(b.label)) byLabel.set(b.label, { names: [], why: b.why });+ byLabel.get(b.label).names.push(b.feature);+ }+ for (const [label, info] of byLabel) runner.skip('ai-features', `${label}: ${info.names.join(', ')} \u2014 ${info.why}`);+ }+return result;}diff --git a/plugins/model-apps/scripts/lib/sdk-http-client.js b/plugins/model-apps/scripts/lib/sdk-http-client.jsindex 9c2d3efd0..1ad103fed 100644--- a/plugins/model-apps/scripts/lib/sdk-http-client.js+++ b/plugins/model-apps/scripts/lib/sdk-http-client.js@@ -15,7 +15,7 @@ const { getAuthToken, makeRequest } = require('./dataverse-auth.js');* Build an HttpClient bound to one Dataverse org.* @param {string} orgUrl - e.g. https://contoso.crm.dynamics.com* @param {object} [deps] - test seam: { getToken(orgUrl)->string|null, request(opts)->Promise }- * @returns {{get,post,patch,delete,put}}+ * @returns {{get,post,patch,delete,put,postRaw}}*/function createAzHttpClient(orgUrl, deps = {}) {const clean = String(orgUrl).replace(/\/+$/, '');@@ -77,7 +77,11 @@ function createAzHttpClient(orgUrl, deps = {}) {}}- async function call(method, url, body, options) {+ /**+ * @param {object} [ctl] - transport controls, independent of the OData semantics:+ * `rawBody` returns the response body as the decoded string it arrived as, skipping parseBody.+ */+ async function call(method, url, body, options, ctl = {}) {assertSameOrigin(url); // never attach the org's bearer token to a foreign originconst hasBody = body !== undefined && body !== null;const bodyStr = hasBody ? (typeof body === 'string' ? body : JSON.stringify(body)) : null;@@ -90,9 +94,15 @@ function createAzHttpClient(orgUrl, deps = {}) {// retry: Dataverse's "More than one concurrent Delete requests detected" guard PERMANENTLY// wedges the record when a retry races the still-in-flight first delete (web-resource deletes// SQL-time-out under load and trip exactly this). One delete keeps the failure re-runnable.+ // - A `$batch` change set is a POST, but it CARRIES record deletes (the SDK deletes an app and+ // its sitemap in one atomic change set), so it inherits the record-delete hazard above. It is+ // also ambiguous on failure: the server may have committed while the response was lost, so a+ // blind re-issue is exactly the racing retry that wedges the row. Issue it once and let the+ // SDK surface the unknown outcome to the caller.const method_ = String(method).toUpperCase();const isMetadataDelete = /\/(EntityDefinitions|RelationshipDefinitions|GlobalOptionSetDefinitions)\b/i.test(url);- const noRetry = method_ === 'DELETE' && !isMetadataDelete;+ const isBatch = method_ === 'POST' && /\/\$batch(\?|$)/i.test(url);+ const noRetry = (method_ === 'DELETE' && !isMetadataDelete) || isBatch;// Retry: refresh the token once on 401 (no backoff); back off on transient 5xx/429.// 6 attempts with capped jittered backoff rides out a per-entity customization lock that@@ -125,7 +135,11 @@ function createAzHttpClient(orgUrl, deps = {}) {await sleep(backoffMs(attempt));continue;}- return { status: res.statusCode, headers: res.headers || {}, body: parseBody(res.body) };+ return {+ status: res.statusCode,+ headers: res.headers || {},+ body: ctl.rawBody ? res.body : parseBody(res.body),+ };}/* istanbul ignore next */throw new Error('Unreachable retry loop');@@ -137,6 +151,16 @@ function createAzHttpClient(orgUrl, deps = {}) {patch: (url, body, options) => call('PATCH', url, body, options),delete: (url, options) => call('DELETE', url, undefined, options),put: (url, body, options) => call('PUT', url, body, options),+ // The SDK's atomic multi-row writes (OData `$batch` change sets) need a transport that does NOT+ // touch the payload in either direction: the request body is a multipart/mixed envelope whose+ // CRLF boundaries are significant, and the response is a multipart envelope the SDK scans for+ // each operation's `HTTP/1.1 <status>` line. JSON-serializing the request or JSON-parsing the+ // response breaks that — the SDK rejects a non-string response body with a ConnectionError.+ // The boundary-bearing Content-Type comes from `options.headers` (call() only defaults a JSON+ // Content-Type when the caller supplied none), so it passes through untouched.+ // Contract: cds-maker-sdk src/types/httpClient.ts (postRaw). Without this method the SDK refuses+ // to delete an app that owns a sitemap (APP_DELETE_NOT_ATOMIC) rather than strand a row.+ postRaw: (url, body, options) => call('POST', url, body, options, { rawBody: true }),};}diff --git a/plugins/model-apps/scripts/lib/verify-spec.js b/plugins/model-apps/scripts/lib/verify-spec.jsindex 0f6a9e767..37d88345e 100644--- a/plugins/model-apps/scripts/lib/verify-spec.js+++ b/plugins/model-apps/scripts/lib/verify-spec.js@@ -6,10 +6,18 @@const { odataLit } = require('./odata.js');const { normalizePageSource, relationshipSchemaName, manyToManySchemaName, SDK_ROLE_MARKER, canonicalPersonaName } = require('./app-spec.js');-const { resolveExistingFormId, resolveRoleBusinessUnit, roleBuClause } = require('./sdk-build.js');+const { resolveExistingFormId, resolveRoleBusinessUnit, roleBuClause, appUniqueName } = require('./sdk-build.js');const { extractNavTargets } = require('./pageref-resolver.js');+const { AI_APP_SETTING, resolveAiFlags, featureWantValue, sameSettingValue, resolveAppModuleId, proveAppOverride } = require('./ai-app-settings.js');-async function verifySpec(spec, read) {+// The PER-APP setting each AI feature writes now lives in ./ai-app-settings.js, together with the+// flag-resolution and override-proof helpers the BUILD uses — see that module for why one source of+// truth matters here. Re-exported below so existing importers of this file keep working.++// `opts.proofAttempts` / `opts.proofDelayMs` tune the app-scope override retry (see the ai-feature+// block below). They exist so tests can drive the absent path without paying real backoff; the+// defaults are what the CLIs use.+async function verifySpec(spec, read, opts = {}) {const checks = [];const add = (kind, name, present, detail) => checks.push({ kind, name, present: !!present, detail: detail || '' });@@ -249,6 +257,74 @@ async function verifySpec(spec, read) {add('role', roleName, row, row ? '' : 'persona security role not found (or its business unit could not be resolved)');}+ // AI app features. The verifier previously had NO awareness of `spec.ai` at all, so a build whose+ // every requested AI feature was skipped (admin gate off) or silently not persisted still reported a+ // clean PASS — a false success signal for automation (ADO 6603383).+ //+ // The oracle is the APP-SCOPE OVERRIDE ROW, not the effective value. `RetrieveSetting(name,+ // { appUniqueName })` FALLS BACK to the environment value when the app has no override, so a+ // matching effective read does NOT prove the build's app-scope write landed: if the environment+ // already holds the requested value, a write the platform silently ignored reads back as a match+ // and verify reports PASS for a feature that was never applied to this app. That is precisely the+ // false-PASS in ADO 6603383, so this proves the override in `appsettings` instead — the same+ // authoritative signal the SDK's own `setAppAiFeatures` uses to decide its `applied` bucket.+ //+ // CRITICAL: the set checked here is `resolveAiFlags(spec)`, the EXACT set the build writes — not+ // `spec.ai.appFeatures`. The build seeds a default for every feature whenever `spec.ai` exists, so+ // reconciling only what a spec DECLARED left a spec with `ai.summaries` and no `ai.appFeatures`+ // with three features written and ZERO verified: a clean PASS for features the platform may never+ // have stored. One resolver, both callers.+ //+ // A feature the org gate SKIPPED therefore fails here, which is intended: the spec asked for it and+ // it is not configured on the app. The effective value is still read, but only as context in the+ // failure message ("in effect as X by environment fallback").+ //+ // Reader-gated like the other content checks: this needs BOTH `retrieveSetting` (context) and+ // `queryRecords` (the proof), so an existence-only reader skips it entirely rather than falling+ // back to the unsound effective-value compare. The shipped CLI reader has both.+ const requestedFeatures = resolveAiFlags(spec);+ if (requestedFeatures && typeof read.retrieveSetting === 'function' && typeof read.queryRecords === 'function') {+ // MUST be the same identity the build wrote under — `appUniqueName(spec)`, which falls back to+ // `<publisherPrefix>_<app.name>` for an authored spec that carries no explicit `app.uniqueName`+ // (neither shipped sample does, and hydrate never emits `ai`, so that is the COMMON case). Reading+ // `spec.app.uniqueName` directly yields undefined there, and the SDK omits the `AppUniqueName` path+ // segment when it is absent — which silently reads the ENVIRONMENT-scoped value instead of the app's.+ const appUnique = appUniqueName(spec);+ // Resolved ONCE for the whole loop (see ai-app-settings.js for why it is never cached longer).+ const app = await resolveAppModuleId(read, appUnique);+ for (const [feature, requested] of Object.entries(requestedFeatures)) {+ const setting = AI_APP_SETTING[feature];+ if (!setting) continue; // unknown key — validation already reports it+ const want = featureWantValue(requested);++ // (1) Authoritative: does an app-scope override row exist, holding `want`?+ // A small retry on the ABSENT case only: an override row can lag briefly behind the write+ // that created it, and a single read turns that lag into a false FAIL on the build's exit+ // code (`--verify` gates it). A read ERROR is not retried — see proveAppOverride.+ const proof = app.error ? { error: app.error } : await proveAppOverride(read, app.appModuleId, setting, { attempts: opts.proofAttempts === undefined ? 3 : opts.proofAttempts, delayMs: opts.proofDelayMs === undefined ? 500 : opts.proofDelayMs });++ // (2) Context only: what is currently in force (may be the ENVIRONMENT fallback). This read is+ // genuinely non-load-bearing — it never participates in the comparison, so a transport+ // failure here can only cost detail in a message, never flip the verdict.+ let effective;+ try {+ const res = await read.retrieveSetting(setting, { appUniqueName: appUnique });+ effective = res && res.value !== undefined && res.value !== null ? String(res.value).trim() : '';+ } catch { /* informational only */ }++ // Fail-closed: when the proof could not be run we could LOOK and looking failed, so we must not+ // claim PASS on the strength of a value that may simply be the environment default.+ const present = !proof.error && proof.exists && sameSettingValue(proof.value, want);+ const inForce = effective === undefined ? '(unreadable)' : effective === '' ? '(unset)' : effective;+ add('ai-feature', feature, present, present ? '' :+ proof.error+ ? `could not prove the app-scope setting '${setting}' was applied: ${proof.error}`+ : !proof.exists+ ? `requested '${want}' but this app has NO app-scope override for '${setting}' (it is in effect as '${inForce}' only by environment fallback, so the app was never configured)`+ : `requested '${want}' but the app-scope override for '${setting}' holds '${proof.value === '' || proof.value === undefined ? '(empty)' : proof.value}'`);+ }+ }+const missing2 = checks.filter((c) => !c.present);// Keep unableToRun absent (undefined) on the normal path so existing callers and tests are unaffected.return { ok: missing2.length === 0 && !unableToRun, checks, missing: missing2, unableToRun: unableToRun || undefined };diff --git a/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.js b/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.jsnew file mode 100644index 000000000..23f3a8bdf--- /dev/null+++ b/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.js@@ -0,0 +1,227 @@+'use strict';+// REAL-BUNDLE contract tests for `setAppAiFeatures` (ADO 6603383 / 6560699).+//+// The plugin's build engine branches on the SHAPE of this result — `applied` is the only success+// bucket, and `notPersisted` / `unverified` / `failed` each have to reach the user. Every other test+// of that branching drives a hand-written mock, so if a re-vendored SDK changed the bucket semantics+// the mocks would stay green while the real bundle behaved differently. That is exactly how the+// original false PASS shipped, so these drive the REAL vendored bundle over a fake httpClient and+// assert the semantics the engine relies on.+//+// The SDK's own Jest suite cannot run here (its `canvas` native module is built for the Node-20 ABI),+// which makes this the only executable check of the shipped bundle's behavior on this path.+const test = require('node:test');+const assert = require('node:assert');+const os = require('node:os');+const path = require('node:path');+const fs = require('node:fs');++const BUNDLE = path.resolve(__dirname, '..', 'vendor', 'cds-maker-sdk.cjs');++const APP = 'co_supportdesk';+const APP_ID = '11111111-1111-1111-1111-111111111111';+// The PER-APP setting for formFill. Note it doubles as its own org gate in the SDK's AI_GATE map,+// which is why the gate is deliberately read at ORG scope (an app-scope 0 must not look like "the+// environment forbids this" and permanently block re-enabling).+const SETTING = 'FormFillBarUXEnabled';+const DEF_ID = '22222222-2222-2222-2222-222222222222';++const tempDirs = [];+test.after(() => { for (const d of tempDirs) fs.rmSync(d, { recursive: true, force: true }); });++/**+ * A real SDK over a fake Dataverse. `opts`:+ * overrideRows - value[] returned by the /appsettings proof query. A FUNCTION is called with the+ * 1-based attempt number so a test can model eventual consistency (empty, then+ * the row appears). An array is returned verbatim every attempt.+ * effective - what RetrieveSetting reports at APP scope (the environment-fallback value).+ * gate - what RetrieveSetting reports at ORG scope (the readiness gate).+ * failProof - throw from the /appsettings query (models missing read access).+ * failWrite - throw from POST /SaveSettingValue.+ */+function freshSdk(opts = {}) {+ const { createMakerSdk } = require(BUNDLE);+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ai-real-'));+ tempDirs.push(dir);+ const calls = [];+ let proofAttempts = 0;+ const httpClient = {+ get: async (url) => {+ calls.push({ method: 'GET', url });+ // /RetrieveSetting(SettingName='X') -> ORG scope (the readiness gate)+ // /RetrieveSetting(SettingName='X',AppUniqueName='Y') -> APP scope (effective, may fall back)+ if (url.includes('/RetrieveSetting(')) {+ const scoped = url.includes('AppUniqueName=');+ const value = scoped ? opts.effective : opts.gate;+ return { status: 200, headers: {}, body: { SettingDetail: { Value: value, DataType: 0 } } };+ }+ if (url.includes('/appmodules')) {+ return { status: 200, headers: {}, body: { value: opts.noApp ? [] : [{ appmoduleid: APP_ID }] } };+ }+ if (url.includes('/settingdefinitions')) {+ return { status: 200, headers: {}, body: { value: [{ settingdefinitionid: DEF_ID }] } };+ }+ if (url.includes('/appsettings')) {+ proofAttempts += 1;+ if (opts.failProof) throw new Error('403 forbidden');+ const rows = typeof opts.overrideRows === 'function' ? opts.overrideRows(proofAttempts) : (opts.overrideRows || []);+ return { status: 200, headers: {}, body: { value: rows } };+ }+ return { status: 200, headers: {}, body: {} };+ },+ post: async (url, body) => {+ calls.push({ method: 'POST', url, body });+ if (url.includes('/SaveSettingValue') && opts.failWrite) throw new Error('boom from SaveSettingValue');+ return { status: 204, headers: {}, body: {} };+ },+ patch: async () => ({ status: 204, headers: {}, body: {} }),+ delete: async () => ({ status: 204, headers: {}, body: {} }),+ put: async () => ({ status: 204, headers: {}, body: {} }),+ };+ const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });+ sdk.initWorkspace();+ return { sdk, calls, proofCount: () => proofAttempts };+}+// `verifyDelayMs: 0` keeps the retry budget instant — the real default backs off up to ~3s.+const FAST = { verifyDelayMs: 0 };++test('REAL BUNDLE: a proven app-scope override row is the only thing that yields `applied`', async () => {+ const { sdk } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });+ const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);+ assert.deepStrictEqual(r.applied, ['formFill']);+ assert.deepStrictEqual([r.notPersisted, r.unverified, r.failed], [[], [], []]);+ assert.strictEqual(r.outcomes[0].appOverrideExists, true);+});++test('REAL BUNDLE: an ENV-fallback match with NO override row is notPersisted, not applied', async () => {+ // The false PASS the plugin's verify oracle also had to fix: RetrieveSetting at app scope returns+ // the ENVIRONMENT value, so the write reads back as requested while `appsettings` holds no row.+ const { sdk } = freshSdk({ gate: '1', effective: '1', overrideRows: [] });+ const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);+ assert.deepStrictEqual(r.applied, [], 'an env-fallback read must never count as applied');+ assert.deepStrictEqual(r.notPersisted, ['formFill']);+ assert.strictEqual(r.outcomes[0].status, 'notPersisted');+});++test('REAL BUNDLE: a write that becomes visible late is retried and reported applied', async () => {+ // Eventual consistency: an immediate read can miss a write that DID land. Reporting that as failed+ // produced a false `notPersisted` on first apply (a re-run then looked clean).+ const { sdk, proofCount } = freshSdk({ gate: '1', effective: '1', overrideRows: (n) => (n >= 3 ? [{ value: '1' }] : []) });+ const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);+ assert.deepStrictEqual(r.applied, ['formFill'], 'the retry budget must absorb read lag');+ assert.strictEqual(proofCount(), 3, 'stops as soon as the override is observed');+});++test('REAL BUNDLE: an unreadable override row is `unverified`, never applied and never notPersisted', async () => {+ const { sdk } = freshSdk({ gate: '1', effective: '1', failProof: true });+ const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);+ assert.deepStrictEqual(r.unverified, ['formFill']);+ assert.deepStrictEqual([r.applied, r.notPersisted], [[], []]);+ assert.strictEqual(r.outcomes[0].appOverrideExists, undefined, 'no stale existence flag when we could not look');+});++test('REAL BUNDLE: a throwing write lands in `failed` and does not abort the batch', async () => {+ const { sdk } = freshSdk({ gate: '1', effective: '1', failWrite: true });+ const r = await sdk.setAppAiFeatures(APP, { formFill: true, nlChart: true }, FAST);+ assert.deepStrictEqual(r.failed.sort(), ['formFill', 'nlChart'], 'every feature still reports');+ assert.deepStrictEqual(r.applied, []);+ assert.match(r.outcomes[0].reason, /boom from SaveSettingValue/);+});++test('REAL BUNDLE: an org gate that is off yields `skipped` and issues no write', async () => {+ const { sdk, calls } = freshSdk({ gate: '0', effective: '0', overrideRows: [] });+ const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);+ assert.deepStrictEqual(r.skipped, ['formFill']);+ assert.strictEqual(calls.filter((c) => c.method === 'POST' && c.url.includes('SaveSettingValue')).length, 0);+});++test('REAL BUNDLE: disabling is never gated — it writes even when the org gate is off', async () => {+ const { sdk, calls } = freshSdk({ gate: '0', effective: '0', overrideRows: [{ value: '0' }] });+ const r = await sdk.setAppAiFeatures(APP, { formFill: false }, FAST);+ assert.deepStrictEqual(r.applied, ['formFill'], 'an explicit disable must always be applied');+ const write = calls.find((c) => c.method === 'POST' && c.url.includes('SaveSettingValue'));+ assert.strictEqual(write.body.Value, '0');+});++test('REAL BUNDLE: an explicit integer value (2 = on for everyone) is written verbatim', async () => {+ // The plugin's spec schema allows this precisely because the SDK does; a boolean-only contract made+ // the platform's documented `2` inexpressible (ADO 6560699).+ const { sdk, calls } = freshSdk({ gate: '1', effective: '2', overrideRows: [{ value: '2' }] });+ const r = await sdk.setAppAiFeatures(APP, { formFill: 2 }, FAST);+ assert.deepStrictEqual(r.applied, ['formFill']);+ assert.strictEqual(calls.find((c) => c.method === 'POST' && c.url.includes('SaveSettingValue')).body.Value, '2');+});++test('REAL BUNDLE: an out-of-range or non-numeric value throws BEFORE any write is issued', async () => {+ // The plugin's validateAppSpec bound mirrors this, so a spec never reaches a half-applied batch.+ for (const bad of [-1, 1.5, 1000001, 'off']) {+ const { sdk, calls } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });+ await assert.rejects(() => sdk.setAppAiFeatures(APP, { formFill: bad }, FAST), /must be a boolean or an integer/, `expected ${bad} to be rejected`);+ assert.strictEqual(calls.filter((c) => c.method === 'POST').length, 0, `no write may be issued for ${bad}`);+ }+});++test('REAL BUNDLE: an empty appUniqueName throws rather than writing at ORGANIZATION scope', async () => {+ // Silently omitting AppUniqueName changes the feature for the WHOLE environment. The plugin always+ // passes appUniqueName(spec), but this is the backstop that makes a regression there loud.+ const { sdk, calls } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });+ await assert.rejects(() => sdk.setAppAiFeatures('', { formFill: true }, FAST), /non-empty appUniqueName/);+ assert.strictEqual(calls.filter((c) => c.method === 'POST').length, 0);+});++test('REAL BUNDLE: the override proof is scoped to THIS app and THIS setting', async () => {+ const { sdk, calls } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });+ await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);+ const proof = calls.find((c) => c.url.includes('/appsettings'));+ assert.ok(proof, 'the override row must actually be queried');+ // GUID lookup values are compared UNQUOTED in an OData $filter.+ assert.ok(proof.url.includes(`_parentappmoduleid_value%20eq%20${APP_ID}`) || proof.url.includes(`_parentappmoduleid_value eq ${APP_ID}`), `app not scoped: ${proof.url}`);+ assert.ok(proof.url.includes(DEF_ID), `setting not scoped: ${proof.url}`);+ // ...and the app id came from THIS app's unique name.+ assert.ok(calls.some((c) => c.url.includes('/appmodules') && c.url.includes(APP)), 'app module resolved by unique name');+});++// --- pre-publish verification via an explicitly supplied appModuleId -------------------------+// A freshly created appmodule is NOT readable until it is PUBLISHED: Dataverse omits it from list+// queries and 404s the by-id retrieve. Because verification proves the app-scope override ROW —+// which is keyed by appmoduleid — the by-NAME lookup is the single piece that fails pre-publish, so+// every feature landed in `unverified` even when the write succeeded. The build hits exactly this:+// its ai-features phase runs moments after app-shell created the app, long before publish.+// `appModuleId` skips that lookup; the `appsettings` proof query itself works fine before publish.++test('REAL BUNDLE: a supplied appModuleId proves the override PRE-PUBLISH (app not yet listable)', async () => {+ // `noApp: true` models the pre-publish reality: the by-name appmodule query returns NO rows.+ // Without appModuleId this is unverifiable; with it, the proof succeeds.+ const { sdk } = freshSdk({ noApp: true, gate: '1', effective: '1', overrideRows: [{ value: '1' }] });+ const r = await sdk.setAppAiFeatures(APP, { formFill: true }, { ...FAST, appModuleId: APP_ID });+ assert.deepStrictEqual(r.applied, ['formFill'], `expected applied, got ${JSON.stringify(r)}`);+ assert.deepStrictEqual([r.notPersisted, r.unverified, r.failed], [[], [], []]);+ assert.strictEqual(r.outcomes[0].appOverrideExists, true);+});++test('REAL BUNDLE: WITHOUT appModuleId the same pre-publish app cannot be proven (regression witness)', async () => {+ // The behaviour the build worked around. Kept so a future SDK change that makes the by-name+ // lookup work pre-publish is noticed here rather than silently making the option pointless.+ const { sdk } = freshSdk({ noApp: true, gate: '1', effective: '1', overrideRows: [{ value: '1' }] });+ const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);+ assert.deepStrictEqual(r.applied, [], `a pre-publish app must not be provable by name: ${JSON.stringify(r)}`);+ assert.ok(+ (r.unverified || []).includes('formFill') || (r.failed || []).includes('formFill'),+ `expected a non-success bucket, got ${JSON.stringify(r)}`+ );+});++test('REAL BUNDLE: a supplied appModuleId that DISAGREES with the published app is rejected, not trusted', async () => {+ // Fail-closed identity check: if the app IS readable by name and resolves to a different id, the+ // caller's id is stale/wrong and writing under it would configure the wrong app.+ const { sdk } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });+ await assert.rejects(+ () => sdk.setAppAiFeatures(APP, { formFill: true }, { ...FAST, appModuleId: '99999999-9999-9999-9999-999999999999' }),+ /INVALID_ARGUMENT|different|mismatch/i+ );+});++test('REAL BUNDLE: a malformed appModuleId is rejected up front', async () => {+ const { sdk } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });+ await assert.rejects(() => sdk.setAppAiFeatures(APP, { formFill: true }, { ...FAST, appModuleId: 'not-a-guid' }));+});diff --git a/plugins/model-apps/scripts/tests/ai-preflight.test.js b/plugins/model-apps/scripts/tests/ai-preflight.test.jsindex 090db945e..d80556dbe 100644--- a/plugins/model-apps/scripts/tests/ai-preflight.test.js+++ b/plugins/model-apps/scripts/tests/ai-preflight.test.js@@ -1,60 +1,184 @@-'use strict';-const { test } = require('node:test');-const assert = require('node:assert');-const { runPreflight } = require('../ai-preflight.js');--test('runPreflight lists features and produces admin actions for disabled ones', () => {- const readiness = {- formFill: { enabled: false, setting: 'FormFillBarUXEnabled', value: '0' },- nlSearch: { enabled: true, setting: 'EnableNLGridSearch', value: 'true' },- nlChart: { enabled: false, setting: 'NLChartVisualizationSetting', value: 'false' },- summaries: { enabled: true, setting: 'EnableFormInsights', value: 'true' },- m365: { enabled: false, setting: 'm365copilotmodelappenabled', value: '0' },- };- const r = runPreflight(readiness);- assert.strictEqual(r.features.length, 5);- assert.ok(r.features.find((f) => f.feature === 'nlSearch').enabled === true);- assert.ok(r.adminActions.length === 3); // formFill, nlChart, m365 disabled- assert.ok(r.adminActions.some((a) => /form.?fill/i.test(a)));-});--test('runPreflight returns no admin actions when all features are enabled', () => {- const readiness = {- formFill: { enabled: true, setting: 'FormFillBarUXEnabled', value: '1' },- nlSearch: { enabled: true, setting: 'EnableNLGridSearch', value: 'true' },- nlChart: { enabled: true, setting: 'NLChartVisualizationSetting', value: 'true' },- summaries: { enabled: true, setting: 'EnableFormInsights', value: 'true' },- m365: { enabled: true, setting: 'm365copilotmodelappenabled', value: '1' },- };- const r = runPreflight(readiness);- assert.strictEqual(r.features.length, 5);- assert.strictEqual(r.adminActions.length, 0);-});--test('runPreflight summaries admin action mentions AI insight cards', () => {- const readiness = {- formFill: { enabled: true, setting: 'FormFillBarUXEnabled', value: '1' },- nlSearch: { enabled: true, setting: 'EnableNLGridSearch', value: 'true' },- nlChart: { enabled: true, setting: 'NLChartVisualizationSetting', value: 'true' },- summaries: { enabled: false, setting: 'EnableFormInsights', value: 'false' },- m365: { enabled: true, setting: 'm365copilotmodelappenabled', value: '1' },- };- const r = runPreflight(readiness);- assert.strictEqual(r.adminActions.length, 1);- assert.ok(/ai insight cards/i.test(r.adminActions[0]), 'summaries action mentions "AI insight cards"');-});--test('runPreflight features include feature name, enabled flag, and setting', () => {- const readiness = {- formFill: { enabled: false, setting: 'FormFillBarUXEnabled', value: '0' },- nlSearch: { enabled: true, setting: 'EnableNLGridSearch', value: 'true' },- nlChart: { enabled: true, setting: 'NLChartVisualizationSetting', value: 'true' },- summaries: { enabled: true, setting: 'EnableFormInsights', value: 'true' },- m365: { enabled: true, setting: 'm365copilotmodelappenabled', value: '1' },- };- const r = runPreflight(readiness);- const ff = r.features.find((f) => f.feature === 'formFill');- assert.ok(ff, 'formFill feature present');- assert.strictEqual(ff.enabled, false);- assert.strictEqual(ff.setting, 'FormFillBarUXEnabled');-});+'use strict';+const { test } = require('node:test');+const assert = require('node:assert');+const fs = require('node:fs');+const path = require('node:path');+const vm = require('node:vm');+const { runPreflight } = require('../ai-preflight.js');++test('runPreflight lists features and produces admin actions for disabled ones', () => {+ const readiness = {+ formFill: { enabled: false, setting: 'FormFillBarUXEnabled', value: '0' },+ nlSearch: { enabled: true, setting: 'EnableNLGridSearch', value: 'true' },+ nlChart: { enabled: false, setting: 'NLChartVisualizationSetting', value: 'false' },+ summaries: { enabled: true, setting: 'EnableFormInsights', value: 'true' },+ m365: { enabled: false, setting: 'm365copilotmodelappenabled', value: '0' },+ };+ const r = runPreflight(readiness);+ assert.strictEqual(r.features.length, 5);+ assert.ok(r.features.find((f) => f.feature === 'nlSearch').enabled === true);+ assert.ok(r.adminActions.length === 3); // formFill, nlChart, m365 disabled+ assert.ok(r.adminActions.some((a) => /form.?fill/i.test(a)));+});++test('runPreflight returns no admin actions when all features are enabled', () => {+ const readiness = {+ formFill: { enabled: true, setting: 'FormFillBarUXEnabled', value: '1' },+ nlSearch: { enabled: true, setting: 'EnableNLGridSearch', value: 'true' },+ nlChart: { enabled: true, setting: 'NLChartVisualizationSetting', value: 'true' },+ summaries: { enabled: true, setting: 'EnableFormInsights', value: 'true' },+ m365: { enabled: true, setting: 'm365copilotmodelappenabled', value: '1' },+ };+ const r = runPreflight(readiness);+ assert.strictEqual(r.features.length, 5);+ assert.strictEqual(r.adminActions.length, 0);+});++test('runPreflight summaries admin action mentions AI insight cards', () => {+ const readiness = {+ formFill: { enabled: true, setting: 'FormFillBarUXEnabled', value: '1' },+ nlSearch: { enabled: true, setting: 'EnableNLGridSearch', value: 'true' },+ nlChart: { enabled: true, setting: 'NLChartVisualizationSetting', value: 'true' },+ summaries: { enabled: false, setting: 'EnableFormInsights', value: 'false' },+ m365: { enabled: true, setting: 'm365copilotmodelappenabled', value: '1' },+ };+ const r = runPreflight(readiness);+ assert.strictEqual(r.adminActions.length, 1);+ assert.ok(/ai insight cards/i.test(r.adminActions[0]), 'summaries action mentions "AI insight cards"');+});++test('runPreflight features include feature name, enabled flag, and setting', () => {+ const readiness = {+ formFill: { enabled: false, setting: 'FormFillBarUXEnabled', value: '0' },+ nlSearch: { enabled: true, setting: 'EnableNLGridSearch', value: 'true' },+ nlChart: { enabled: true, setting: 'NLChartVisualizationSetting', value: 'true' },+ summaries: { enabled: true, setting: 'EnableFormInsights', value: 'true' },+ m365: { enabled: true, setting: 'm365copilotmodelappenabled', value: '1' },+ };+ const r = runPreflight(readiness);+ const ff = r.features.find((f) => f.feature === 'formFill');+ assert.ok(ff, 'formFill feature present');+ assert.strictEqual(ff.enabled, false);+ assert.strictEqual(ff.setting, 'FormFillBarUXEnabled');+});++test('runPreflight ignores feature keys the SDK did not return', () => {+ const r = runPreflight({+ nlSearch: { enabled: false, setting: 'EnableNLGridSearch', value: 'false' },+ });++ assert.deepStrictEqual(r.features, [{ feature: 'nlSearch', enabled: false, setting: 'EnableNLGridSearch' }]);+ assert.strictEqual(r.adminActions.length, 1);+});++function loadPreflightCli({ parseResult, readiness, sdkThrows = null }) {+ const scriptPath = path.join(__dirname, '..', 'ai-preflight.js');+ const source = `${fs.readFileSync(scriptPath, 'utf8')}\nmodule.exports.__mainForTest = main;\n`;+ const events = [];+ const stderr = [];+ const mod = { exports: {} };+ const fakeFs = {+ mkdtempSync: (prefix) => {+ events.push({ type: 'mkdtempSync', prefix });+ return 'D:\\Projects\\power-platform-skills-sdk\\.test-workspace\\ai-preflight';+ },+ rmSync: (dir, opts) => events.push({ type: 'rmSync', dir, opts }),+ };+ const customRequire = (id) => {+ if (id === './lib/dataverse-auth.js') {+ return {+ parseArgs: () => parseResult,+ emitResult: (ok, payload) => events.push({ type: 'emitResult', ok, payload }),+ };+ }+ if (id === './lib/sdk-http-client.js') {+ return { createAzHttpClient: (env) => ({ env }) };+ }+ if (id === 'node:fs') return fakeFs;+ if (id === 'node:os') return { tmpdir: () => 'D:\\Projects\\power-platform-skills-sdk\\.test-workspace' };+ if (id === 'node:path') return path;+ if (id === './vendor/cds-maker-sdk.cjs') {+ return {+ createMakerSdk: (cfg) => {+ events.push({ type: 'createMakerSdk', cfg });+ if (sdkThrows) throw sdkThrows;+ return {+ initWorkspace: () => events.push({ type: 'initWorkspace' }),+ getAiReadiness: async (opts) => {+ events.push({ type: 'getAiReadiness', opts });+ return readiness;+ },+ };+ },+ };+ }+ return require(id);+ };+ customRequire.main = {};+ const sandboxProcess = {+ argv: ['node', scriptPath],+ stderr: { write: (message) => stderr.push(message) },+ exit: (code) => {+ const err = new Error(`process.exit(${code})`);+ err.exitCode = code;+ throw err;+ },+ };+ vm.runInNewContext(source, {+ require: customRequire,+ module: mod,+ exports: mod.exports,+ process: sandboxProcess,+ Buffer,+ }, { filename: scriptPath });+ return { main: mod.exports.__mainForTest, events, stderr };+}++test('ai-preflight CLI rejects a missing --env before creating the throwaway SDK workspace', async () => {+ const harness = loadPreflightCli({ parseResult: { flags: { app: 'contoso_app' } }, readiness: {} });++ await assert.rejects(harness.main(), (err) => err.exitCode === 1);+ assert.match(harness.stderr.join(''), /Usage: node scripts\/ai-preflight\.js/);+ assert.ok(!harness.events.some((e) => e.type === 'mkdtempSync'), 'usage errors stay read-only and create no workspace');+});++test('ai-preflight CLI passes the app scope, prints admin actions, emits the report, and cleans up first', async () => {+ const readiness = {+ formFill: { enabled: false, setting: 'FormFillBarUXEnabled', value: '0' },+ nlSearch: { enabled: true, setting: 'EnableNLGridSearch', value: 'true' },+ m365: { enabled: false, setting: 'm365copilotmodelappenabled', value: '0' },+ };+ const harness = loadPreflightCli({+ parseResult: { flags: { env: 'https://org.example', app: 'new_supportdesk' } },+ readiness,+ });++ await harness.main();+ const stderr = harness.stderr.join('');+ const emitIndex = harness.events.findIndex((e) => e.type === 'emitResult');+ const cleanupIndex = harness.events.findIndex((e) => e.type === 'rmSync');+ const emitted = harness.events[emitIndex];++ assert.ok(harness.events.some((e) => e.type === 'getAiReadiness' && e.opts.appUniqueName === 'new_supportdesk'));+ assert.match(stderr, /AI Feature Readiness/);+ assert.match(stderr, /✗ Form fill \(FormFillBarUXEnabled\)/);+ assert.match(stderr, /Admin actions required:/);+ assert.ok(cleanupIndex > -1 && cleanupIndex < emitIndex, 'emitResult exits, so cleanup must happen first');+ assert.strictEqual(emitted.ok, true);+ assert.strictEqual(emitted.payload.ok, true);+ assert.strictEqual(emitted.payload.adminActions.length, 2);+});++test('ai-preflight CLI reports all-enabled status without admin actions', async () => {+ const readiness = {+ formFill: { enabled: true, setting: 'FormFillBarUXEnabled', value: '1' },+ };+ const harness = loadPreflightCli({+ parseResult: { flags: { env: 'https://org.example' } },+ readiness,+ });++ await harness.main();+ assert.match(harness.stderr.join(''), /All AI features are enabled/);+ assert.ok(harness.events.some((e) => e.type === 'getAiReadiness' && Object.keys(e.opts).length === 0));+});diff --git a/plugins/model-apps/scripts/tests/app-delete-real-bundle.test.js b/plugins/model-apps/scripts/tests/app-delete-real-bundle.test.jsnew file mode 100644index 000000000..2b902e746--- /dev/null+++ b/plugins/model-apps/scripts/tests/app-delete-real-bundle.test.js@@ -0,0 +1,286 @@+'use strict';+// REAL-BUNDLE contract tests for app deletion (teardown's primary destructive step).+//+// An app is TWO rows: an `appmodule` and a `sitemaps` row, with NO lookup between them and no+// server-side cascade — the only link is `sitemap.sitemapnameunique === appmodule.uniquename`.+// Deleting just the appmodule strands the sitemap forever AND, because `sitemapnameunique` is+// unique-constrained, permanently BURNS that unique name: a later build of an app with the same+// name fails with "The name <x> is already in use by an existing site map", which the user cannot+// act on. `teardown-model-app.js` drives this entirely through the vendored SDK's+// `deleteAppCascade`, and every other teardown test uses a hand-written mock — so a re-vendored+// SDK that regressed this would leave those tests green while teardown silently burned names.+//+// The SDK now deletes both rows in ONE atomic OData `$batch` change set, so it requires an+// `HttpClient.postRaw` and refuses (APP_DELETE_NOT_ATOMIC) without one. It also fails closed on+// every read it cannot trust: the app must carry an ETag (so the DELETE can be conditional on the+// row actually inspected) and the sitemap must still carry the app's `sitemapnameunique` (so a+// row re-pointed between read and delete is not destroyed).+const test = require('node:test');+const assert = require('node:assert');+const os = require('node:os');+const path = require('node:path');+const fs = require('node:fs');++const BUNDLE = path.resolve(__dirname, '..', 'vendor', 'cds-maker-sdk.cjs');+const { createAzHttpClient } = require('../lib/sdk-http-client.js');++const APP_ID = '11111111-1111-1111-1111-111111111111';+const APP_UNIQUE_ID = '22222222-2222-2222-2222-222222222222';+const SITEMAP_ID = '33333333-3333-3333-3333-333333333333';+const APP_UNIQUE = 'co_supportdesk';++const tempDirs = [];+test.after(() => { for (const d of tempDirs) fs.rmSync(d, { recursive: true, force: true }); });++/**+ * Build the multipart/mixed response Dataverse returns for a `$batch` change set.+ *+ * Correlation is by `Content-ID`, which Dataverse echoes; the change-set BOUNDARY is not echoed —+ * the server mints its own and announces it in the nested `Content-Type` header — so this mints a+ * fresh one too rather than reusing the request's. `statusFor` lets a test fail one operation.+ *+ * --batchresponse_x+ * Content-Type: multipart/mixed; boundary=changesetresponse_x+ *+ * --changesetresponse_x+ * Content-Type: application/http+ * Content-ID: 1+ *+ * HTTP/1.1 204 No Content+ * ...+ * --changesetresponse_x--+ * --batchresponse_x--+ */+function batchResponseFor(requestBody, statusFor = () => 204) {+ const ids = [...String(requestBody).matchAll(/^Content-ID:\s*(\S+)/gim)].map((m) => m[1]);+ const lines = ['--batchresponse_x', 'Content-Type: multipart/mixed; boundary=changesetresponse_x', ''];+ for (const id of ids) {+ const status = statusFor(id);+ lines.push(+ '--changesetresponse_x',+ 'Content-Type: application/http',+ 'Content-Transfer-Encoding: binary',+ `Content-ID: ${id}`,+ '',+ `HTTP/1.1 ${status} ${status === 204 ? 'No Content' : 'Error'}`,+ ''+ );+ }+ lines.push('--changesetresponse_x--', '--batchresponse_x--', '');+ return lines.join('\r\n');+}++/** The rows a fake Dataverse hands back, shared by the injected-client and real-transport fakes. */+function appRow(opts = {}) {+ const row = { appmoduleid: APP_ID, appmoduleidunique: APP_UNIQUE_ID, uniquename: APP_UNIQUE, name: 'Support Desk' };+ if (!opts.noAppEtag) row['@odata.etag'] = 'W/"1001"';+ return row;+}+function sitemapRow(opts = {}) {+ return {+ '@odata.etag': 'W/"2002"',+ sitemapid: SITEMAP_ID,+ sitemapnameunique: opts.foreignSitemap ? 'co_someotherapp' : APP_UNIQUE,+ sitemapxml: '<SiteMap></SiteMap>',+ };+}++/**+ * A real SDK over a fake Dataverse that models the two-row app. `opts`:+ * appReadStatus - HTTP status for GET /appmodules(<id>) (models a transient read failure)+ * sitemapLookupStatus - HTTP status for the sitemaps lookup+ * noSitemap - the app owns no sitemap row+ * noAppEtag - the app read returns no ETag (delete cannot be made conditional)+ * foreignSitemap - the sitemap no longer carries this app's unique name+ * omitPostRaw - the injected HttpClient does not support atomic $batch+ * batchStatusFor - per-Content-ID status override for the batch response+ * batchBody - replace the batch response body entirely (models an unparseable answer)+ */+function freshSdk(opts = {}) {+ const { createMakerSdk } = require(BUNDLE);+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'appdel-'));+ tempDirs.push(dir);+ const calls = [];+ const httpClient = {+ get: async (url) => {+ calls.push({ method: 'GET', url });+ // Entity-set name resolution: `queryRecords` resolves a LOGICAL name to its entity set via+ // metadata before querying, so this must answer or every cascade lookup fails as an invalid+ // argument. e.g. /EntityDefinitions(LogicalName='appmodulecomponent')?$select=EntitySetName+ const meta = /EntityDefinitions\(LogicalName='([^']+)'\)/.exec(url);+ if (meta) return { status: 200, headers: {}, body: { LogicalName: meta[1], EntitySetName: `${meta[1]}s` } };+ // By-id app retrieve — the source of the `uniquename` the sitemap is linked by, and of the+ // ETag the conditional delete is issued against.+ if (/\/appmodules\([^)]+\)/.test(url)) {+ const status = opts.appReadStatus || 200;+ if (status !== 200) return { status, headers: {}, body: null };+ return { status, headers: {}, body: appRow(opts) };+ }+ // Sitemaps are read UNPUBLISHED (RetrieveUnpublishedMultiple) so a newly authored sitemap is+ // visible before its app is published.+ if (url.includes('/sitemaps')) {+ const status = opts.sitemapLookupStatus || 200;+ if (status !== 200) return { status, headers: {}, body: null };+ return { status, headers: {}, body: { value: opts.noSitemap ? [] : [sitemapRow(opts)] } };+ }+ // Cascade component / generative-page lookups: nothing extra to clean up here.+ return { status: 200, headers: {}, body: { value: [] } };+ },+ post: async (url, body) => { calls.push({ method: 'POST', url, body }); return { status: 204, headers: {}, body: {} }; },+ patch: async () => ({ status: 204, headers: {}, body: {} }),+ delete: async (url) => { calls.push({ method: 'DELETE', url }); return { status: 204, headers: {}, body: {} }; },+ put: async () => ({ status: 204, headers: {}, body: {} }),+ };+ if (!opts.omitPostRaw) {+ httpClient.postRaw = async (url, body) => {+ calls.push({ method: 'POST_RAW', url, body });+ const respBody = opts.batchBody !== undefined ? opts.batchBody : batchResponseFor(body, opts.batchStatusFor);+ return { status: 200, headers: {}, body: respBody };+ };+ }+ const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });+ sdk.initWorkspace();+ return { sdk, calls };+}++const deletes = (calls) => calls.filter((c) => c.method === 'DELETE').map((c) => c.url);+const batches = (calls) => calls.filter((c) => c.method === 'POST_RAW');+/** Every row the delete actually targeted, whether via a $batch change set or a bare DELETE. */+function deletedPaths(calls) {+ const urls = deletes(calls);+ for (const b of batches(calls)) {+ for (const m of String(b.body).matchAll(/^DELETE\s+(\S+)/gim)) urls.push(m[1]);+ }+ return urls;+}++test('REAL BUNDLE: deleting an app also deletes its sitemap row (the unique name is not burned)', async () => {+ const { sdk, calls } = freshSdk();+ const r = await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);+ const urls = deletedPaths(calls);+ assert.ok(urls.some((u) => u.includes(`/appmodules(${APP_ID})`)), `app not deleted: ${JSON.stringify(urls)}`);+ assert.ok(urls.some((u) => u.includes(SITEMAP_ID)), `sitemap not deleted: ${JSON.stringify(urls)}`);+ assert.ok(r.success, `cascade reported failure: ${JSON.stringify(r.failures)}`);+});++test('REAL BUNDLE: both rows are deleted in ONE atomic $batch change set, never as two calls', async () => {+ // The whole point of the atomic path: two sequential DELETEs can strand the sitemap if the+ // process dies (or the second call fails) between them, which burns the unique name forever.+ const { sdk, calls } = freshSdk();+ await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);+ const b = batches(calls);+ assert.strictEqual(b.length, 1, `expected exactly one $batch, got ${b.length}`);+ assert.match(b[0].url, /\/\$batch$/, 'the atomic write must go to the OData $batch endpoint');+ const targets = [...String(b[0].body).matchAll(/^DELETE\s+(\S+)/gim)].map((m) => m[1]);+ assert.strictEqual(targets.length, 2, `both rows must be in the SAME change set: ${JSON.stringify(targets)}`);+ assert.ok(targets.some((u) => u.includes(`/appmodules(${APP_ID})`)));+ assert.ok(targets.some((u) => u.includes(SITEMAP_ID)));+ assert.ok(+ !deletes(calls).some((u) => u.includes('/appmodules(') || u.includes(SITEMAP_ID)),+ 'neither row may ALSO be deleted by a bare, non-atomic DELETE'+ );+});++test('REAL BUNDLE: the sitemap is resolved BEFORE the app delete, never after', async () => {+ // Afterwards the `uniquename` -> sitemap link is unrecoverable, so ordering is the whole+ // guarantee: read first, then destroy.+ const { sdk, calls } = freshSdk();+ await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);+ const sitemapLookup = calls.findIndex((c) => c.method === 'GET' && c.url.includes('/sitemaps'));+ const appDelete = calls.findIndex(+ (c) => (c.method === 'POST_RAW' && /\/appmodules\(/.test(String(c.body))) || (c.method === 'DELETE' && c.url.includes('/appmodules('))+ );+ assert.ok(sitemapLookup > -1, 'the sitemap must be looked up');+ assert.ok(appDelete > -1, 'the app must be deleted');+ assert.ok(sitemapLookup < appDelete, 'the sitemap lookup must precede the app delete');+});++test('REAL BUNDLE: an INCONCLUSIVE sitemap lookup refuses to delete the app (fails CLOSED)', async () => {+ // The dangerous case: the lookup fails transiently. Deleting anyway strands the sitemap and burns+ // the name permanently, so the delete must not run on a guess. Teardown surfaces the rejection.+ for (const opts of [{ appReadStatus: 503 }, { sitemapLookupStatus: 503 }]) {+ const { sdk, calls } = freshSdk(opts);+ await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID), `expected a rejection for ${JSON.stringify(opts)}`);+ assert.ok(+ !deletedPaths(calls).some((u) => u.includes('/appmodules(')),+ `the app must NOT be deleted when the sitemap is unresolved: ${JSON.stringify(opts)}`+ );+ }+});++test("REAL BUNDLE: a sitemap that no longer carries this app's unique name is NOT deleted", async () => {+ // Ownership is name equality only. If the row was re-pointed between the read and the delete it+ // belongs to a different app now, and destroying it would be cross-app data loss.+ const { sdk, calls } = freshSdk({ foreignSitemap: true });+ await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID), /no longer this app|APP_SITEMAP_UNRESOLVED/);+ assert.strictEqual(deletedPaths(calls).length, 0, 'nothing may be deleted when ownership cannot be proven');+});++test('REAL BUNDLE: an app read with no ETag refuses to delete (the DELETE cannot be made conditional)', async () => {+ // Without an If-Match the delete is unconditional, so a row renamed or re-pointed between the+ // read and the delete would be destroyed anyway. Refuse instead.+ const { sdk, calls } = freshSdk({ noAppEtag: true, noSitemap: true });+ await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID), /ETag|APP_SITEMAP_UNRESOLVED/);+ assert.strictEqual(deletedPaths(calls).length, 0, 'nothing may be deleted without a concurrency token');+});++test('REAL BUNDLE: an HttpClient without postRaw REFUSES the delete rather than doing it non-atomically', async () => {+ // This is why lib/sdk-http-client.js must implement postRaw: the SDK does NOT silently degrade+ // to two sequential deletes. A plugin transport missing postRaw breaks teardown outright.+ const { sdk, calls } = freshSdk({ omitPostRaw: true });+ await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID), /APP_DELETE_NOT_ATOMIC|atomic/);+ assert.strictEqual(deletedPaths(calls).length, 0, 'a non-atomic fallback delete must never happen');+});++test('REAL BUNDLE: a failed operation INSIDE the change set is not reported as a successful delete', async () => {+ // The batch envelope can return 200 while an embedded operation failed; reading only the outer+ // status would report a delete that never happened.+ const { sdk } = freshSdk({ batchStatusFor: (id) => (id === '2' ? 400 : 204) });+ await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID));+});++test('REAL BUNDLE: an unparseable batch response is treated as UNKNOWN, not as success', async () => {+ // A 200 with a body that is not a multipart envelope proves nothing about what the server did.+ const { sdk } = freshSdk({ batchBody: 'OK' });+ await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID));+});++test('REAL BUNDLE: an app that owns no sitemap still deletes cleanly', async () => {+ const { sdk, calls } = freshSdk({ noSitemap: true });+ const r = await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);+ assert.ok(deletedPaths(calls).some((u) => u.includes(`/appmodules(${APP_ID})`)), 'the app is still deleted');+ assert.ok(r.success, `cascade reported failure: ${JSON.stringify(r.failures)}`);+ assert.ok(!(r.deleted || []).some((d) => d.type === 'sitemap'), 'no phantom sitemap is reported');+});++// --- the PLUGIN's own transport, end to end -------------------------------------------------+// The tests above inject a hand-written postRaw. This one drives the REAL createAzHttpClient the+// plugin ships, so a transport bug (re-serializing the payload, JSON-parsing the response, or+// dropping the boundary Content-Type) fails HERE instead of live during a teardown.+test('REAL BUNDLE + REAL TRANSPORT: the plugin HttpClient satisfies the SDK atomic-delete contract', async () => {+ const { createMakerSdk } = require(BUNDLE);+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'appdel-'));+ tempDirs.push(dir);+ const wire = [];+ // Speaks HTTP at the wire level: the SDK's URLs in, raw response strings out.+ const request = async ({ url, method, body, headers }) => {+ wire.push({ url, method, body, headers });+ const meta = /EntityDefinitions\(LogicalName='([^']+)'\)/.exec(url);+ if (meta) return { statusCode: 200, headers: {}, body: JSON.stringify({ LogicalName: meta[1], EntitySetName: `${meta[1]}s` }) };+ if (/\/\$batch$/.test(url)) return { statusCode: 200, headers: {}, body: batchResponseFor(body) };+ if (/\/appmodules\([^)]+\)/.test(url)) return { statusCode: 200, headers: {}, body: JSON.stringify(appRow()) };+ if (url.includes('/sitemaps')) return { statusCode: 200, headers: {}, body: JSON.stringify({ value: [sitemapRow()] }) };+ return { statusCode: 200, headers: {}, body: JSON.stringify({ value: [] }) };+ };+ const httpClient = createAzHttpClient('https://example.crm.dynamics.com', { getToken: () => 'TOK', request });+ const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });+ sdk.initWorkspace();++ const r = await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);+ assert.ok(r.success, `cascade reported failure: ${JSON.stringify(r.failures)}`);+ const batch = wire.find((w) => /\/\$batch$/.test(w.url));+ assert.ok(batch, 'the atomic delete must reach the $batch endpoint through the real transport');+ assert.match(batch.headers['Content-Type'], /^multipart\/mixed;\s*boundary=/, 'the boundary Content-Type must survive the transport');+ assert.ok(batch.body.startsWith('--batch_'), 'the multipart payload must be sent verbatim, not JSON-serialized');+ assert.strictEqual([...String(batch.body).matchAll(/^DELETE\s+/gim)].length, 2, 'both rows travel in one change set');+});diff --git a/plugins/model-apps/scripts/tests/app-spec.test.js b/plugins/model-apps/scripts/tests/app-spec.test.jsindex ad620c39a..e940c220b 100644--- a/plugins/model-apps/scripts/tests/app-spec.test.js+++ b/plugins/model-apps/scripts/tests/app-spec.test.js@@ -807,11 +807,35 @@ test('validateAppSpec rejects an unknown ai.appFeatures key', () => {assert.ok(!r.ok && r.errors.some((e) => /unknown key 'copilot'/i.test(e)));});-test('validateAppSpec rejects a non-boolean ai.appFeatures value', () => {+test('validateAppSpec rejects a non-boolean, non-integer ai.appFeatures value', () => {const s = cloneDesk();s.ai = { appFeatures: { nlSearch: 'yes' } };const r = validateAppSpec(s);- assert.ok(!r.ok && r.errors.some((e) => /must be a boolean/i.test(e)));+ assert.ok(!r.ok && r.errors.some((e) => /must be a boolean or an integer between 0 and 1000000/i.test(e)), JSON.stringify(r.errors));+});++test('validateAppSpec ACCEPTS an explicit numeric ai.appFeatures value (2 = on for everyone)', () => {+ // These map to NUMERIC Dataverse app settings. A boolean-only contract made the platform's other+ // documented values inexpressible, so `2` could never be requested at all (ADO 6560699).+ const s = cloneDesk();+ s.ai = { appFeatures: { formFill: 2, nlSearch: true, nlChart: 0, m365: false } };+ const r = validateAppSpec(s);+ assert.ok(r.ok, JSON.stringify(r.errors));+});++test('validateAppSpec rejects a negative, fractional or out-of-range ai.appFeatures value', () => {+ // The upper bound and the unsafe-integer rejection mirror the SDK's `MAX_SETTING_VALUE`: the SDK+ // THROWS for these, so a spec that validated cleanly would abort the build half-applied.+ for (const bad of [-1, 1.5, 1000001, Number.MAX_SAFE_INTEGER + 2, NaN, Infinity]) {+ const s = cloneDesk();+ s.ai = { appFeatures: { formFill: bad } };+ const r = validateAppSpec(s);+ assert.ok(!r.ok && r.errors.some((e) => /ai\.appFeatures\.formFill/.test(e)), `expected ${bad} to be rejected`);+ }+ // ...and the boundary itself is still accepted, so the bound is inclusive like the SDK's.+ const ok = cloneDesk();+ ok.ai = { appFeatures: { formFill: 1000000 } };+ assert.ok(validateAppSpec(ok).ok, 'the maximum value must remain valid');});test('validateAppSpec rejects ai.summaries.default with an invalid value', () => {diff --git a/plugins/model-apps/scripts/tests/dataverse-request.test.js b/plugins/model-apps/scripts/tests/dataverse-request.test.jsnew file mode 100644index 000000000..5074a0719--- /dev/null+++ b/plugins/model-apps/scripts/tests/dataverse-request.test.js@@ -0,0 +1,124 @@+'use strict';+const test = require('node:test');+const assert = require('node:assert/strict');+const fs = require('node:fs');+const os = require('node:os');+const path = require('node:path');+const { spawnSync } = require('node:child_process');++const scriptPath = path.join(__dirname, '..', 'dataverse-request.js');+const authPath = path.join(__dirname, '..', 'lib', 'dataverse-auth.js');+const tempDirs = [];++test.after(() => {+ for (const dir of tempDirs) fs.rmSync(dir, { recursive: true, force: true });+});++function mkdirTemp() {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'dataverse-request-test-'));+ tempDirs.push(dir);+ return dir;+}++function runCli(args, { errorMessage = null } = {}) {+ const code = `+ const Module = require('node:module');+ const scriptPath = ${JSON.stringify(scriptPath)};+ const authPath = ${JSON.stringify(authPath)};+ const realAuth = require(authPath);+ const originalLoad = Module._load;+ Module._load = function(request, parent, isMain) {+ const resolved = Module._resolveFilename(request, parent, isMain);+ if (resolved === authPath) {+ return {+ parseArgs: realAuth.parseArgs,+ readJsonArg: realAuth.readJsonArg,+ dataverseRequest: async (envUrl, method, apiPath, body, opts) => {+ if (${JSON.stringify(errorMessage)} !== null) throw new Error(${JSON.stringify(errorMessage)});+ return { status: 207, data: { envUrl, method, apiPath, body, opts } };+ },+ };+ }+ return originalLoad.apply(this, arguments);+ };+ process.argv = [process.execPath, scriptPath, ...${JSON.stringify(args)}];+ require(scriptPath);+ `;+ return spawnSync(process.execPath, ['-e', code], { encoding: 'utf8' });+}++test('missing required positional arguments exits 1 with usage before any request', () => {+ const res = spawnSync(process.execPath, [scriptPath], { encoding: 'utf8' });++ assert.equal(res.status, 1);+ assert.match(res.stderr, /Usage: node dataverse-request\.js <envUrl> <method> <apiPath>/);+ assert.equal(res.stdout, '');+});++test('successful request uppercases the method, parses JSON body, and forwards headers plus timeout options', () => {+ const res = runCli([+ 'https://org.crm.dynamics.com/',+ 'post',+ 'accounts',+ '--body',+ '{"name":"Contoso"}',+ '--include-headers',+ '--timeout',+ '1234',+ ]);++ assert.equal(res.status, 0, res.stderr);+ // CLI stdout is the machine contract consumed by shell callers:+ // { "status": 207, "data": { "envUrl": "...", "method": "POST", "apiPath": "...", "body": {...}, "opts": {...} } }+ const out = JSON.parse(res.stdout);+ assert.equal(out.status, 207);+ assert.deepEqual(out.data, {+ envUrl: 'https://org.crm.dynamics.com/',+ method: 'POST',+ apiPath: 'accounts',+ body: { name: 'Contoso' },+ opts: { includeHeaders: true, timeout: 1234 },+ });+});++test('body can be read from an @file path and omitted include-headers stays false', () => {+ const dir = mkdirTemp();+ const bodyPath = path.join(dir, 'body.json');+ fs.writeFileSync(bodyPath, JSON.stringify({ subject: 'From file' }), 'utf8');++ const res = runCli(['https://org.crm.dynamics.com', 'PATCH', 'tasks(1)', '--body', '@' + bodyPath]);++ assert.equal(res.status, 0, res.stderr);+ // Same stdout envelope as above; this case proves @file input is parsed before the request call.+ const out = JSON.parse(res.stdout);+ assert.equal(out.data.method, 'PATCH');+ assert.deepEqual(out.data.body, { subject: 'From file' });+ assert.equal(out.data.opts.includeHeaders, false);+ assert.equal(Object.hasOwn(out.data.opts, 'timeout'), false);+});++test('--timeout without a value is rejected before the Dataverse request is invoked', () => {+ const res = runCli(['https://org.crm.dynamics.com', 'GET', 'accounts', '--timeout']);++ assert.equal(res.status, 1);+ assert.match(res.stderr, /--timeout must include a positive millisecond value/);+ assert.equal(res.stdout, '');+});++test('--timeout rejects zero and non-numeric values with the provided raw value', () => {+ const zero = runCli(['https://org.crm.dynamics.com', 'GET', 'accounts', '--timeout', '0']);+ const text = runCli(['https://org.crm.dynamics.com', 'GET', 'accounts', '--timeout', 'soon']);++ assert.equal(zero.status, 1);+ assert.match(zero.stderr, /--timeout must be a positive number \(got "0"\)/);+ assert.equal(text.status, 1);+ assert.match(text.stderr, /--timeout must be a positive number \(got "soon"\)/);+});++test('Dataverse request failures are written to stderr and exit 1', () => {+ const res = runCli(['https://org.crm.dynamics.com', 'GET', 'accounts'], { errorMessage: 'token unavailable' });++ assert.equal(res.status, 1);+ assert.equal(res.stdout, '');+ assert.match(res.stderr, /^token unavailable\r?\n$/);+});diff --git a/plugins/model-apps/scripts/tests/detect-browser.test.js b/plugins/model-apps/scripts/tests/detect-browser.test.jsnew file mode 100644index 000000000..d215e7143--- /dev/null+++ b/plugins/model-apps/scripts/tests/detect-browser.test.js@@ -0,0 +1,128 @@+'use strict';+const test = require('node:test');+const assert = require('node:assert/strict');+const path = require('node:path');+const Module = require('node:module');++const modulePath = path.join(__dirname, '..', 'lib', 'detect-browser.js');++function withDetectedBrowser({ platform, existing = [], which = [], existsThrows = [] }) {+ const originalLoad = Module._load;+ const originalEnv = {+ LOCALAPPDATA: process.env.LOCALAPPDATA,+ PROGRAMFILES: process.env.PROGRAMFILES,+ PROGRAMFILES_X86: process.env['PROGRAMFILES(X86)'],+ };+ const checkedPaths = [];+ const whichCalls = [];+ const existingSet = new Set(existing);+ const whichSet = new Set(which);+ const throwSet = new Set(existsThrows);++ process.env.LOCALAPPDATA = 'C:\\Users\\Maker\\AppData\\Local';+ process.env.PROGRAMFILES = 'C:\\Program Files';+ process.env['PROGRAMFILES(X86)'] = 'C:\\Program Files (x86)';++ try {+ delete require.cache[require.resolve(modulePath)];+ Module._load = function loadWithBrowserStubs(request, parent, isMain) {+ if (request === 'os') return { platform: () => platform };+ if (request === 'fs') {+ return {+ existsSync(filePath) {+ checkedPaths.push(filePath);+ if (throwSet.has(filePath)) throw new Error('filesystem probe failed');+ return existingSet.has(filePath);+ },+ };+ }+ if (request === 'child_process') {+ return {+ execFileSync(command, args, options) {+ whichCalls.push({ command, args, options });+ if (whichSet.has(args[0])) return '';+ throw new Error(`${args[0]} not found`);+ },+ };+ }+ return originalLoad.call(this, request, parent, isMain);+ };++ const { detectBrowser } = require(modulePath);+ return { browser: detectBrowser(), checkedPaths, whichCalls };+ } finally {+ Module._load = originalLoad;+ if (originalEnv.LOCALAPPDATA === undefined) delete process.env.LOCALAPPDATA;+ else process.env.LOCALAPPDATA = originalEnv.LOCALAPPDATA;+ if (originalEnv.PROGRAMFILES === undefined) delete process.env.PROGRAMFILES;+ else process.env.PROGRAMFILES = originalEnv.PROGRAMFILES;+ if (originalEnv.PROGRAMFILES_X86 === undefined) delete process.env['PROGRAMFILES(X86)'];+ else process.env['PROGRAMFILES(X86)'] = originalEnv.PROGRAMFILES_X86;+ delete require.cache[require.resolve(modulePath)];+ }+}++test('Windows prefers preinstalled Edge before Chrome when both browsers exist', () => {+ const edge = 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe';+ const chrome = 'C:\\Users\\Maker\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe';++ const result = withDetectedBrowser({ platform: 'win32', existing: [edge, chrome] });++ assert.equal(result.browser, 'msedge');+ assert.deepEqual(result.checkedPaths, [edge]);+});++test('Windows falls through to Chrome when no Edge install path exists', () => {+ const chrome = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe';++ const result = withDetectedBrowser({ platform: 'win32', existing: [chrome] });++ assert.equal(result.browser, 'chrome');+ assert.ok(result.checkedPaths.includes(chrome));+});++test('filesystem probe failures are treated the same as a missing browser path', () => {+ const edge = 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe';+ const chrome = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe';++ const result = withDetectedBrowser({+ platform: 'win32',+ existing: [chrome],+ existsThrows: [edge],+ });++ assert.equal(result.browser, 'chrome');+});++test('macOS chooses Chrome before Edge to match the app bundle probing order', () => {+ const result = withDetectedBrowser({+ platform: 'darwin',+ existing: ['/Applications/Google Chrome.app', '/Applications/Microsoft Edge.app'],+ });++ assert.equal(result.browser, 'chrome');+ assert.deepEqual(result.checkedPaths, ['/Applications/Google Chrome.app']);+});++test('Linux probes fixed browser command names without invoking a shell', () => {+ const result = withDetectedBrowser({ platform: 'linux', which: ['microsoft-edge'] });++ assert.equal(result.browser, 'msedge');+ assert.deepEqual(result.whichCalls.map((c) => c.args[0]), ['google-chrome', 'google-chrome-stable', 'microsoft-edge']);+ assert.ok(result.whichCalls.every((c) => c.command === 'which'));+ assert.ok(result.whichCalls.every((c) => !Object.hasOwn(c.options, 'shell')));+});++test('Linux falls back to Playwright Chromium after every system browser probe fails', () => {+ const result = withDetectedBrowser({ platform: 'linux' });++ assert.equal(result.browser, 'chromium');+ assert.deepEqual(result.whichCalls.map((c) => c.args[0]), [+ 'google-chrome',+ 'google-chrome-stable',+ 'microsoft-edge',+ 'microsoft-edge-stable',+ 'chromium-browser',+ 'chromium',+ ]);+});diff --git a/plugins/model-apps/scripts/tests/download-model-app.test.js b/plugins/model-apps/scripts/tests/download-model-app.test.jsindex 39d476081..bdd80d581 100644--- a/plugins/model-apps/scripts/tests/download-model-app.test.js+++ b/plugins/model-apps/scripts/tests/download-model-app.test.js@@ -4,7 +4,7 @@ const assert = require('node:assert');const fs = require('node:fs');const os = require('node:os');const path = require('node:path');-const { resolveAppId, collectSitemap, parseDownloadedPages, entityFromMetadata, iconWebResources, droppedSubareaCount } = require('../download-model-app.js');+const { resolveAppId, collectSitemap, parseDownloadedPages, entityFromMetadata, iconWebResources, readDashboards, droppedSubareaCount } = require('../download-model-app.js');test('resolveAppId returns a guid as-is, else resolves by uniquename', async () => {const guid = '11111111-2222-3333-4444-555555555555';@@ -13,6 +13,14 @@ test('resolveAppId returns a guid as-is, else resolves by uniquename', async ()assert.strictEqual(await resolveAppId(sdk, 'new_app'), 'app-1');});+test('resolveAppId escapes apostrophes and returns undefined for a missing app', async () => {+ const calls = [];+ const sdk = { queryRecords: async (logical, opts) => { calls.push({ logical, opts }); return []; } };+ assert.strictEqual(await resolveAppId(sdk, "new_bob's_app"), undefined);+ assert.strictEqual(calls[0].logical, 'appmodule');+ assert.match(calls[0].opts.filter, /uniquename eq 'new_bob''s_app'/);+});+test('collectSitemap gathers distinct entities + icons from the sitemap', () => {const app = { siteMap: { areas: [{ icon: 'a.png', groups: [{ subAreas: [{ type: 'Entity', entity: 'New_Order', icon: 'i.png' },@@ -159,14 +167,90 @@ test('droppedSubareaCount counts subareas the spec could not round-trip (e.g. daassert.strictEqual(droppedSubareaCount(app, same), 0);});+test('readDashboards reconstructs supported tile shapes and skips unreadable dashboards', async () => {+ const DASH = '{AAAAAAAA-0000-4000-8000-000000000001}';+ const SKIP = '{BBBBBBBB-0000-4000-8000-000000000002}';+ const app = { siteMap: { areas: [{ groups: [{ subAreas: [+ { type: 'DashBoard', dashboardId: DASH, title: 'Sitemap title' },+ { type: 'DashBoard', dashboardId: SKIP, title: 'Broken dashboard' },+ ] }] }] } };+ const sdk = {+ fetchArtifact: async (type, id) => {+ if (String(id).toLowerCase() === SKIP.toLowerCase()) throw new Error('dashboard deleted while downloading');+ return {+ components: [+ { type: 'chart', name: 'Revenue', parameters: { TargetEntityType: 'account', ViewId: '{11111111-0000-4000-8000-000000000001}', VisualizationId: '{22222222-0000-4000-8000-000000000002}' } },+ { type: 'list', name: 'Open Accounts', parameters: { TargetEntityType: 'account', ViewId: '{33333333-0000-4000-8000-000000000003}' } },+ { type: 'iframe', name: 'Portal', parameters: { Url: 'https://contoso.example' } },+ { type: 'webresource', name: 'Help', parameters: { WebResourceName: 'new_help.htm' } },+ { type: 'chart', name: 'Incomplete chart', parameters: { TargetEntityType: 'account' } },+ ],+ };+ },+ queryRecords: async () => [{ name: 'Executive Dashboard' }],+ };++ const dashboards = await readDashboards(sdk, app);++ assert.strictEqual(dashboards.length, 1);+ assert.strictEqual(dashboards[0].name, 'Executive Dashboard');+ assert.deepStrictEqual(dashboards[0].tiles, [+ { type: 'chart', name: 'Revenue', entity: 'account', viewId: '11111111-0000-4000-8000-000000000001', visualizationId: '22222222-0000-4000-8000-000000000002' },+ { type: 'list', name: 'Open Accounts', entity: 'account', viewId: '33333333-0000-4000-8000-000000000003' },+ { type: 'iframe', name: 'Portal', url: 'https://contoso.example' },+ { type: 'webresource', name: 'Help', webResource: 'new_help.htm' },+ ]);+});++test('readDashboards keeps the sitemap title when the dashboard name lookup fails', async () => {+ const sdk = {+ fetchArtifact: async () => ({ components: [{ type: 'iframe', name: 'Portal', parameters: { Url: 'https://contoso.example' } }] }),+ queryRecords: async () => { throw new Error('systemform read throttled'); },+ };+ const dashboards = await readDashboards(sdk, {+ siteMap: { areas: [{ groups: [{ subAreas: [{ type: 'DashBoard', dashboardId: 'dash-1', title: 'Operations' }] }] }] },+ });+ assert.strictEqual(dashboards[0].name, 'Operations');+});+// ── Task 11: assignPageKeys + missingDownloads + full round-trip ──────────────-const { assignPageKeys, missingDownloads, runDownload, recoverAppSolution } = require('../download-model-app.js');+const { assignPageKeys, missingDownloads, runDownload, recoverAppSolution, appComponentEntities } = require('../download-model-app.js');const { reconcilePageIds, buildManifest } = require('../lib/page-manifest.js');const { hydrateSpec } = require('../lib/hydrate-spec.js');const { validateAppSpec } = require('../lib/app-spec.js');const { appUniqueName } = require('../lib/sdk-build.js');const { resolvePageRefs, reverseResolveNavIds } = require('../lib/pageref-resolver.js');+test('runDownload translates a fail-closed app read into a graceful error, not a raw SDK throw', async () => {+ // `fetchArtifact('app')` fails closed (`APP_SITEMAP_UNRESOLVED`) rather than hand back an app whose+ // navigation is untrustworthy. The sitemap IS this function's membership oracle, so that is a+ // LOGICAL failure of the class its contract says it RETURNS rather than throws — otherwise the CLI+ // surfaces an opaque SDK error for the very ordinary case of an unpublished app.+ for (const code of ['APP_SITEMAP_UNRESOLVED', 'APP_UPDATE_NO_ETAG']) {+ const err = new Error('app sitemap could not be resolved');+ err.code = code;+ const sdk = { fetchArtifact: async () => { throw err; } };+ const genpageCli = { enumerateEnv: async () => ({ ok: true, pages: [] }), download: async () => true };+ const res = await runDownload({ sdk, genpageCli, outDir: __dirname, appId: 'app-1', appUnique: 'new_app' });+ assert.strictEqual(res.ok, false, `${code} must return ok:false`);+ assert.match(res.error, /cannot read app app-1/, `${code} error names the app`);+ assert.match(res.error, /sitemap could not be resolved/, `${code} keeps the underlying reason`);+ }+});++test('runDownload still propagates a genuinely unexpected error (no blanket swallow)', async () => {+ // Only the two fail-closed read codes are translated. An unexpected I/O error must keep propagating+ // to main().catch, or a real defect would be reported as an ordinary "download failed".+ const err = new Error('EACCES: permission denied');+ err.code = 'EACCES';+ const sdk = { fetchArtifact: async () => { throw err; } };+ const genpageCli = { enumerateEnv: async () => ({ ok: true, pages: [] }), download: async () => true };+ await assert.rejects(+ runDownload({ sdk, genpageCli, outDir: __dirname, appId: 'app-1', appUnique: 'new_app' }),+ (caught) => caught && caught.code === 'EACCES'+ );+});+test('assignPageKeys: reuses the manifest key + v2 semantics for a reconcile-bound page, mints fresh keys otherwise (I3/§7.3)', () => {const GP_O = '13ecbc57-a3a4-4132-b0a2-a6c6b12691e8';const GP_X = '9f2b1a3c-77de-4a10-8b6e-2c4d5e6f7a8b';@@ -362,7 +446,7 @@ test('Task-6: full round-trip via runDownload → hydrateSpec → validateAppSpe// existing app even after a display-name rename) and the publisher prefix is derived FROM it.assert.strictEqual(spec.app.uniqueName, APP_UNIQUE, 'the app real uniquename round-trips into spec.app.uniqueName');assert.strictEqual(spec.solution.uniqueName, 'ContosoSln', 'the real unmanaged solution uniquename is recovered for teardown');- assert.strictEqual(spec.solution.publisherPrefix, 'test', 'the publisher prefix is derived from the app uniquename (test_roundtrip → test), NOT the recovered solution (Sol F2)');+ assert.strictEqual(spec.solution.publisherPrefix, 'test', 'this mock SDK exposes no getSolution, so the prefix falls back to the app uniquename (test_roundtrip → test); when getSolution IS available the solution publisher wins — see the recoverAppSolution tests');assert.strictEqual(appUniqueName(spec), APP_UNIQUE, 'appUniqueName resolves the REAL uniquename (identity lookup finds the existing app, no duplicate) even though the display name is "Test App"');assert.ok(!('prefixResolved' in spec.solution), 'the transient prefixResolved flag is stripped from the persisted spec');} finally {@@ -431,3 +515,185 @@ test('recoverAppSolution never throws — a query error resolves to null (best-econst sdk = { queryRecords: async () => { throw new Error('boom'); } };assert.strictEqual(await recoverAppSolution(sdk, 'app'), null);});++// ── OOB-table round-trip fixes (ADO 6603392 / 6603390 / 6603388) ───────────────────────────────+// All three surfaced on an app built from STANDARD Dataverse tables. Each was masked on custom+// tables, which is why they survived earlier testing.++test('entityFromMetadata uses the REAL primary-name attribute for OOB tables (no <entity>_name guess)', () => {+ // The old fallback produced `account_name` / `contact_name`, neither of which exists. It looked+ // plausible on a custom table (`co_ticket` -> `co_name`), which is exactly why it went unnoticed.+ const account = entityFromMetadata({ logicalName: 'account', schemaName: 'Account', displayName: 'Account', primaryNameAttribute: 'name' }, 'account');+ assert.strictEqual(account.primaryAttribute.schemaName, 'name');+ const contact = entityFromMetadata({ logicalName: 'contact', schemaName: 'Contact', displayName: 'Contact', primaryNameAttribute: 'fullname' }, 'contact');+ assert.strictEqual(contact.primaryAttribute.schemaName, 'fullname');+});++test('entityFromMetadata reports a NULL primaryAttribute rather than synthesizing one', () => {+ // Emitting a fabricated attribute name yields a spec that references a column Dataverse does not+ // have. Omitting the field entirely is no better — `primaryAttribute` is REQUIRED by App Spec+ // validation, so the spec would simply fail to validate later with a confusing error. Signalling+ // null lets runDownload fail the download loudly, naming the table.+ const e = entityFromMetadata({ logicalName: 'account', displayName: 'Account' }, 'account');+ assert.strictEqual(e.primaryAttribute, null, 'must not invent a primary attribute');+ assert.strictEqual(e.existing, true, 'still flagged pre-existing (teardown protection)');+});++test('a downloaded entity WITH real metadata validates as an App Spec entity', () => {+ // Guards the regression the null-signalling above could otherwise introduce: the normal path must+ // still produce a spec that actually validates and can be rebuilt.+ const { validateAppSpec } = require('../lib/app-spec.js');+ const account = entityFromMetadata({ logicalName: 'account', schemaName: 'Account', displayName: 'Account', primaryNameAttribute: 'name' }, 'account');+ const spec = {+ solution: { uniqueName: 'S', publisherPrefix: 'co' },+ app: { name: 'Customer Management', uniqueName: 'contoso_customermanagement' },+ entities: [account],+ views: [], charts: [], forms: [], commands: [], dashboards: [], pages: [],+ webResources: [], appShell: { areas: [] },+ };+ const r = validateAppSpec(spec);+ assert.ok(r.ok, JSON.stringify(r.errors));+});++test('recoverAppSolution recovers the publisher prefix from the SOLUTION, not the app name', async () => {+ const sdk = {+ queryRecords: async (set) => {+ if (set === 'solutioncomponent') return [{ _solutionid_value: 'sol-1' }];+ if (set === 'solution') return [{ solutionid: 'sol-1', uniquename: 'ContosoCustomerManagement', ismanaged: false }];+ return [];+ },+ getSolution: async (uniqueName) => ({ uniqueName, publisherPrefix: 'contoso' }),+ };+ assert.deepStrictEqual(await recoverAppSolution(sdk, 'app-1'), { uniqueName: 'ContosoCustomerManagement', publisherPrefix: 'contoso' });+});++test('recoverAppSolution degrades to uniqueName-only when the prefix cannot be recovered', async () => {+ const base = {+ queryRecords: async (set) => {+ if (set === 'solutioncomponent') return [{ _solutionid_value: 'sol-1' }];+ if (set === 'solution') return [{ solutionid: 'sol-1', uniquename: 'ContosoCustomerManagement', ismanaged: false }];+ return [];+ },+ };+ // (a) an older vendored bundle with no getSolution at all+ assert.deepStrictEqual(await recoverAppSolution(base, 'app-1'), { uniqueName: 'ContosoCustomerManagement' });+ // (b) getSolution throws+ assert.deepStrictEqual(await recoverAppSolution({ ...base, getSolution: async () => { throw new Error('boom'); } }, 'app-1'), { uniqueName: 'ContosoCustomerManagement' });+ // (c) a first-party publisher with no customization prefix -> not usable, so not reported+ assert.deepStrictEqual(await recoverAppSolution({ ...base, getSolution: async () => ({ publisherPrefix: '' }) }, 'app-1'), { uniqueName: 'ContosoCustomerManagement' });+});++// The nine entities from the filed repro: an app on account/contact also carries activity, user and+// note tables that have no sitemap entry of their own. Their membership is recovered from the app's+// VIEW/CHART/FORM components — componenttype 1 (Entities) is unusable because every such row carries+// the same objectid (the `entity` metadata table's own id), LIVE-verified.+const NINE = ['account', 'contact', 'task', 'email', 'appointment', 'phonecall', 'systemuser', 'team', 'annotation'];+const componentSdk = (opts = {}) => {+ const entities = opts.entities || NINE;+ // Give every entity one view, one chart and one form component, with a distinguishable row id.+ const viewId = (n) => `1000${NINE.indexOf(n)}000-0000-4000-8000-000000000001`;+ const chartId = (n) => `2000${NINE.indexOf(n)}000-0000-4000-8000-000000000002`;+ const formId = (n) => `3000${NINE.indexOf(n)}000-0000-4000-8000-000000000003`;+ return {+ queryRecords: async (set, o) => {+ const filter = (o && o.filter) || '';+ if (set === 'appmodule') return [{ appmoduleidunique: 'appuniq-1' }];+ if (set === 'appmodulecomponent') {+ assert.match(filter, /_appmoduleidunique_value eq appuniq-1/);+ if (/componenttype eq 26/.test(filter)) return entities.map((n) => ({ objectid: viewId(n), componenttype: 26 }));+ if (/componenttype eq 59/.test(filter)) return entities.map((n) => ({ objectid: chartId(n), componenttype: 59 }));+ if (/componenttype eq 60/.test(filter)) return entities.map((n) => ({ objectid: formId(n), componenttype: 60 }));+ // componenttype 1 must NOT be consulted — it cannot identify a table.+ assert.fail(`unexpected componenttype filter: ${filter}`);+ }+ // Resolve each component id back to its owning entity via that table's own entity field.+ if (set === 'savedquery') return entities.filter((n) => filter.includes(viewId(n))).map((n) => ({ savedqueryid: viewId(n), returnedtypecode: n }));+ if (set === 'savedqueryvisualization') return entities.filter((n) => filter.includes(chartId(n))).map((n) => ({ savedqueryvisualizationid: chartId(n), primaryentitytypecode: n }));+ if (set === 'systemform') return entities.filter((n) => filter.includes(formId(n))).map((n) => ({ formid: formId(n), objecttypecode: n }));+ return [];+ },+ };+};++test('appComponentEntities recovers ALL app entity components, not just sitemap-visible ones', async () => {+ const got = await appComponentEntities(componentSdk(), 'app-1');+ assert.deepStrictEqual(got.slice().sort(), NINE.slice().sort());+});++test('appComponentEntities is best-effort — every failure path yields [] so download still works', async () => {+ assert.deepStrictEqual(await appComponentEntities(componentSdk(), null), []);+ assert.deepStrictEqual(await appComponentEntities({ queryRecords: async () => { throw new Error('x'); } }, 'app-1'), []);+ // An app whose components resolve to nothing.+ assert.deepStrictEqual(await appComponentEntities(componentSdk({ entities: [] }), 'app-1'), []);+ // An app row without appmoduleidunique (the lookup parent) cannot be queried.+ assert.deepStrictEqual(await appComponentEntities({ queryRecords: async () => [{}] }, 'app-1'), []);+});++test('runDownload: a sitemap table with no primary name HARD-FAILS naming it; a component-only one is dropped', async () => {+ // The riskiest new behaviour (hard-failing a previously-working download) had no executable+ // coverage — the old test only called entityFromMetadata directly, so the branch it named+ // (`sitemapSet.has(logical) ? noPrimaryName : droppedComponents`) would have passed inverted.+ const APP_ID = '5111e0f2-0000-4000-8000-00000000000a';+ const APP_UNIQ_VALUE = '5111e0f2-0000-4000-8000-00000000000b';+ const APP_UNIQUE = 'test_roundtrip';+ const VIEW_ID = '5111e0f2-0000-4000-8000-00000000000c';+ const SM_ID = '5111e0f2-0000-4000-8000-00000000000d';+ const SM_XML = '<SiteMap><Area><Group><SubArea Entity="account" Title="Accounts"/></Group></Area></SiteMap>';+ const out = fs.mkdtempSync(path.join(os.tmpdir(), 'dl-pn-'));+ // `account` is in the sitemap; `annotation` is reachable ONLY as a view component. Neither has a+ // primary name, so they must take different branches.+ const mkSdk = () => ({+ fetchArtifact: async () => ({+ name: 'PN App', description: '',+ siteMap: { areas: [{ title: 'M', groups: [{ title: 'G', subAreas: [{ type: 'Entity', entity: 'account' }] }] }] },+ }),+ queryRecords: async (logical, opts) => {+ const filter = (opts && opts.filter) || '';+ if (logical === 'appmodule') {+ const m = filter.match(/uniquename eq '([^']+)'/);+ if (m) return m[1] === APP_UNIQUE ? [{ appmoduleid: APP_ID, appmoduleidunique: APP_UNIQ_VALUE }] : [];+ return [{ appmoduleid: APP_ID, appmoduleidunique: APP_UNIQ_VALUE, uniquename: APP_UNIQUE }];+ }+ if (logical === 'appmodulecomponent') {+ if (/componenttype eq 26/.test(filter)) return [{ objectid: VIEW_ID, componenttype: 26 }];+ if (/componenttype eq 62/.test(filter)) return [{ objectid: SM_ID, componenttype: 62 }];+ return [{ objectid: SM_ID, componenttype: 62 }];+ }+ if (logical === 'sitemap') return [{ sitemapxml: SM_XML }];+ if (logical === 'savedquery') return [{ savedqueryid: VIEW_ID, returnedtypecode: 'annotation' }];+ if (logical === 'webresource') return [];+ return [];+ },+ // Both report an EMPTY PrimaryNameAttribute (the shape the SDK really returns).+ fetchEntityMetadata: async (logical) => ({ logicalName: logical, schemaName: logical, displayName: logical, primaryNameAttribute: '' }),+ });+ const genpageCli = { enumerateEnv: async () => ({ ok: true, ids: [], pages: [] }), download: async () => true };+ try {+ const failed = await runDownload({ sdk: mkSdk(), genpageCli, outDir: out, appId: APP_ID, appUnique: APP_UNIQUE });+ assert.strictEqual(failed.ok, false, 'a sitemap table with no primary name must abort the download');+ assert.match(failed.error, /account/, 'the failure names the offending sitemap table');+ assert.ok(!/annotation/.test(failed.error), 'a component-only table must NOT be named as a hard failure');+ assert.match(failed.error, /--allow-lossy-download/, 'the hard failure advertises its override');+ // ...and with the override it degrades to a warning instead of producing nothing at all.+ const lossy = await runDownload({ sdk: mkSdk(), genpageCli, outDir: out, appId: APP_ID, appUnique: APP_UNIQUE, allowLossy: true });+ assert.strictEqual(lossy.ok, true, `--allow-lossy-download must let the download complete: ${JSON.stringify(lossy)}`);+ } finally {+ fs.rmSync(out, { recursive: true, force: true });+ }+});++test('a COMPONENT-only table with no primary name is dropped with a warning, not a hard download failure', async () => {+ // appComponentEntities is best-effort by contract, so its output must not be able to abort the whole+ // download. A hidden component table (never in the sitemap, so it did not appear in the spec at all+ // before this change) that Dataverse reports with no PrimaryNameAttribute would otherwise regress a+ // previously-working download — and there is no --allow-lossy override for it.+ const sitemapOnly = new Set(['account']);+ const metaFor = (logical) => (sitemapOnly.has(logical)+ ? { logicalName: logical, schemaName: 'Account', displayName: 'Account', primaryNameAttribute: 'name' }+ // The SDK returns '' (not undefined) when PrimaryNameAttribute is absent.+ : { logicalName: logical, schemaName: logical, displayName: logical, primaryNameAttribute: '' });+ const good = entityFromMetadata(metaFor('account'), 'account');+ const bad = entityFromMetadata(metaFor('annotation'), 'annotation');+ assert.strictEqual(good.primaryAttribute.schemaName, 'name');+ assert.strictEqual(bad.primaryAttribute, null, 'an empty PrimaryNameAttribute must not become a guessed name');+});diff --git a/plugins/model-apps/scripts/tests/form-preview.test.js b/plugins/model-apps/scripts/tests/form-preview.test.jsindex 60d760438..674f4dcd6 100644--- a/plugins/model-apps/scripts/tests/form-preview.test.js+++ b/plugins/model-apps/scripts/tests/form-preview.test.js@@ -47,3 +47,44 @@ test('renderForms renders all forms and honors an entity filter', () => {assert.match(renderForms(s), /Work Order/);assert.strictEqual(renderForms(s, 'new_missing'), "(no forms in spec for 'new_missing')");});++test('renderFormWireframe shows multi-tab forms, truncates wide labels, and falls back to lookup hints', () => {+ const s = {+ solution: { uniqueName: 'X', publisherPrefix: 'new' },+ app: { name: 'X' },+ entities: [{+ schemaName: 'new_case',+ displayName: 'Case',+ primaryAttribute: { schemaName: 'new_name', displayName: 'Case Name' },+ columns: [{+ schemaName: 'new_description',+ displayName: 'Long description 🚀 '.repeat(8),+ type: 'Memo',+ }, {+ schemaName: 'new_notes',+ displayName: 'Notes',+ type: 'Memo',+ }],+ }],+ relationships: [],+ forms: [{+ entity: 'new_case',+ name: 'Case',+ tabs: [+ { label: 'Summary', sections: [{ label: 'Basics', fields: ['new_name'] }] },+ { label: 'Details', sections: [+ { label: 'Narrative', fields: ['new_description', 'new_missinglookupid'] },+ { label: 'Notes', fields: ['new_notes'] },+ ] },+ ],+ }],+ };++ const w = renderFormWireframe(s, s.forms[0]);++ assert.match(w, /Tabs:\s+‹Summary›\s+Details/);+ assert.match(w, /▾ Details/);+ assert.match(w, /…/, 'wide labels are clipped instead of breaking the wireframe border');+ assert.match(w, /\[text area\]/, 'Memo columns keep their multiline widget hint');+ assert.match(w, /new_missinglookupid\s+\[lookup\]/, 'unknown fields are treated as relationship lookups');+});diff --git a/plugins/model-apps/scripts/tests/page-plan.test.js b/plugins/model-apps/scripts/tests/page-plan.test.jsindex 053e67830..bff57ae80 100644--- a/plugins/model-apps/scripts/tests/page-plan.test.js+++ b/plugins/model-apps/scripts/tests/page-plan.test.js@@ -131,10 +131,10 @@ test('the approved design contract reaches the worker', () => {assert.equal(require('../../../../evals/model-apps/genpage/lib/assertions-layer-1.js').validateGenpagePlanSchema(bare).length, 0);});-test('the plan declares Mode so the worker can pick the right identity rule', () => {- assert.match(buildPagePlan(spec(), { workingDir: '/wd' }), /- Mode: app-builder/);-});-+test('the plan declares Mode so the worker can pick the right identity rule', () => {+ assert.match(buildPagePlan(spec(), { workingDir: '/wd' }), /- Mode: app-builder/);+});+test('markdown fence and comment delimiters cannot swallow the rest of the plan', () => {// An unterminated ``` / ~~~ fence or <!-- comment would hide every SECTION AFTER the value,// silently truncating the worker's contract while the document still looks valid.@@ -252,26 +252,63 @@ test('CLI fails with usage when a required flag has no value', () => {assert.equal(res.status, 1);assert.match(res.stderr, /Usage:/);});--test('the projection does NOT default to genpage-plan.md — that filename belongs to /genpage', () => {- // Both skills derive their working directory from a slug off the user's request, so they can land- // on the same folder. `genpage-plan.md` is what standalone /genpage treats as its authoritative- // state, and the two dialects differ (`Mode: app-builder` + stable keys vs. no Mode + filename- // stems), so writing there would let a later /genpage run consume an app-builder plan and emit- // wrong PAGEREF tokens. The worker gets the plan PATH explicitly, so the name is free to differ.- const cli = path.join(__dirname, '..', 'write-page-plan.js');- const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'plan-collision-'));- const specPath = path.join(dir, 'app-spec.json');- fs.writeFileSync(specPath, JSON.stringify(spec()), 'utf8');- const run = () => spawnSync(process.execPath, [cli, '--spec', '@' + specPath, '--working-dir', dir], { encoding: 'utf8' });-- const out = JSON.parse(run().stdout);- assert.equal(path.basename(out.planPath), 'app-builder-page-plan.md');- assert.ok(!fs.existsSync(path.join(dir, 'genpage-plan.md')), 'must not create /genpage state');-- // A pre-existing /genpage plan in the same folder must survive untouched.- const sentinel = '# Genpage Plan\n(authored by genpage-planner)\n';- fs.writeFileSync(path.join(dir, 'genpage-plan.md'), sentinel, 'utf8');- run();- assert.equal(fs.readFileSync(path.join(dir, 'genpage-plan.md'), 'utf8'), sentinel, 'clobbered /genpage state');++test('CLI refuses to write a plan when a referenced sample is absent', (t) => {+ const dir = fs.mkdtempSync(path.join(__dirname, '.tmp-pageplan-'));+ t.after(() => fs.rmSync(dir, { recursive: true, force: true }));+ const specPath = path.join(dir, 'app-spec.json');+ const outPath = path.join(dir, 'app-builder-page-plan.md');+ fs.writeFileSync(specPath, JSON.stringify(spec()), 'utf8');++ const cliPath = path.join(__dirname, '..', 'write-page-plan.js');+ const { main } = require(cliPath);+ const originalArgv = process.argv;+ const originalExit = process.exit;+ const originalStderrWrite = process.stderr.write;+ const originalExistsSync = fs.existsSync;+ let stderr = '';++ try {+ process.argv = [process.execPath, cliPath, '--spec', '@' + specPath, '--working-dir', dir, '--out', outPath];+ process.stderr.write = (chunk) => { stderr += String(chunk); return true; };+ process.exit = (code) => { throw new Error(`process.exit(${code})`); };+ fs.existsSync = (p) => (+ String(p).endsWith(path.join('samples', '9-list-with-caching.tsx'))+ ? false+ : originalExistsSync.call(fs, p)+ );++ assert.throws(() => main(), /process\.exit\(1\)/);+ } finally {+ fs.existsSync = originalExistsSync;+ process.argv = originalArgv;+ process.exit = originalExit;+ process.stderr.write = originalStderrWrite;+ }++ assert.match(stderr, /page plan references sample\(s\) that do not exist/);+ assert.ok(!fs.existsSync(outPath), 'the partial plan is not written after sample validation fails');+});++test('the projection does NOT default to genpage-plan.md — that filename belongs to /genpage', () => {+ // Both skills derive their working directory from a slug off the user's request, so they can land+ // on the same folder. `genpage-plan.md` is what standalone /genpage treats as its authoritative+ // state, and the two dialects differ (`Mode: app-builder` + stable keys vs. no Mode + filename+ // stems), so writing there would let a later /genpage run consume an app-builder plan and emit+ // wrong PAGEREF tokens. The worker gets the plan PATH explicitly, so the name is free to differ.+ const cli = path.join(__dirname, '..', 'write-page-plan.js');+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'plan-collision-'));+ const specPath = path.join(dir, 'app-spec.json');+ fs.writeFileSync(specPath, JSON.stringify(spec()), 'utf8');+ const run = () => spawnSync(process.execPath, [cli, '--spec', '@' + specPath, '--working-dir', dir], { encoding: 'utf8' });++ const out = JSON.parse(run().stdout);+ assert.equal(path.basename(out.planPath), 'app-builder-page-plan.md');+ assert.ok(!fs.existsSync(path.join(dir, 'genpage-plan.md')), 'must not create /genpage state');++ // A pre-existing /genpage plan in the same folder must survive untouched.+ const sentinel = '# Genpage Plan\n(authored by genpage-planner)\n';+ fs.writeFileSync(path.join(dir, 'genpage-plan.md'), sentinel, 'utf8');+ run();+ assert.equal(fs.readFileSync(path.join(dir, 'genpage-plan.md'), 'utf8'), sentinel, 'clobbered /genpage state');});diff --git a/plugins/model-apps/scripts/tests/preview-app.test.js b/plugins/model-apps/scripts/tests/preview-app.test.jsnew file mode 100644index 000000000..940ce312c--- /dev/null+++ b/plugins/model-apps/scripts/tests/preview-app.test.js@@ -0,0 +1,85 @@+'use strict';+const test = require('node:test');+const assert = require('node:assert/strict');+const fs = require('node:fs');+const os = require('node:os');+const path = require('node:path');+const { spawnSync } = require('node:child_process');++const scriptPath = path.join(__dirname, '..', 'preview-app.js');+const tempDirs = [];++test.after(() => {+ for (const dir of tempDirs) fs.rmSync(dir, { recursive: true, force: true });+});++function writeSpec(spec) {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'preview-app-test-'));+ tempDirs.push(dir);+ const specPath = path.join(dir, 'app-spec.json');+ fs.writeFileSync(specPath, JSON.stringify(spec), 'utf8');+ return specPath;+}++function run(args) {+ return spawnSync(process.execPath, [scriptPath, ...args], { encoding: 'utf8' });+}++test('missing spec argument exits 1 with the CLI usage string', () => {+ const res = run([]);++ assert.equal(res.status, 1);+ assert.match(res.stderr, /Usage: node scripts\/preview-app\.js --spec @<app-folder>\/app-spec\.json/);+ assert.equal(res.stdout, '');+});++test('renders a whole-app preview from --spec @file and migrates legacy page references to keys', () => {+ const specPath = writeSpec({+ schemaVersion: 1,+ app: { name: 'Service Console', description: 'Triage customer work' },+ solution: { uniqueName: 'new_service', publisherPrefix: 'new' },+ entities: [+ { schemaName: 'new_ticket', displayName: 'Ticket', primaryAttribute: { schemaName: 'new_name', displayName: 'Name' }, columns: [] },+ ],+ appShell: { areas: [{ label: 'Main', groups: [{ label: 'Work', subAreas: [{ page: 'Overview', title: 'Overview' }] }] }] },+ pages: [+ { name: 'Overview', purpose: 'Queue KPIs', dataSources: ['new_ticket'], codeFile: 'overview.tsx', navigatesTo: [{ targetKey: 'Ticket Detail' }] },+ { name: 'Ticket Detail', purpose: 'One ticket', dataSources: ['new_ticket'], codeFile: 'ticket-detail.tsx' },+ ],+ design: { accentColor: '#0f6cbd', density: 'compact' },+ });++ const res = run(['--spec', '@' + specPath]);++ assert.equal(res.status, 0, res.stderr);+ assert.match(res.stdout, /APP: Service Console/);+ assert.match(res.stdout, /=== Data model ===/);+ assert.match(res.stdout, /page:overview/);+ assert.match(res.stdout, /Overview \[overview\] — implemented \(overview\.tsx\)/);+ assert.match(res.stdout, /→ navigates to ticket-detail/);+ assert.match(res.stdout, /accentColor=#0f6cbd/);+});++test('accepts a positional spec path without @ and renders minimal missing sections', () => {+ const specPath = writeSpec({ app: { name: 'Bare Console' } });++ const res = run([specPath]);++ assert.equal(res.status, 0, res.stderr);+ assert.match(res.stdout, /APP: Bare Console/);+ assert.match(res.stdout, /\(no tables\)/);+ assert.match(res.stdout, /\(no forms\)/);+});++test('malformed JSON exits non-zero before a partial preview is printed', () => {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'preview-app-test-'));+ tempDirs.push(dir);+ const specPath = path.join(dir, 'app-spec.json');+ fs.writeFileSync(specPath, '{"app":', 'utf8');++ const res = run(['--spec', '@' + specPath]);++ assert.notEqual(res.status, 0);+ assert.equal(res.stdout, '');+ assert.match(res.stderr, /SyntaxError/);+});diff --git a/plugins/model-apps/scripts/tests/preview-form.test.js b/plugins/model-apps/scripts/tests/preview-form.test.jsnew file mode 100644index 000000000..6f4c1a23c--- /dev/null+++ b/plugins/model-apps/scripts/tests/preview-form.test.js@@ -0,0 +1,98 @@+'use strict';+const test = require('node:test');+const assert = require('node:assert/strict');+const fs = require('node:fs');+const os = require('node:os');+const path = require('node:path');+const { spawnSync } = require('node:child_process');++const scriptPath = path.join(__dirname, '..', 'preview-form.js');+const tempDirs = [];++test.after(() => {+ for (const dir of tempDirs) fs.rmSync(dir, { recursive: true, force: true });+});++function writeSpec(spec) {+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'preview-form-test-'));+ tempDirs.push(dir);+ const specPath = path.join(dir, 'app-spec.json');+ fs.writeFileSync(specPath, JSON.stringify(spec), 'utf8');+ return specPath;+}++function run(args) {+ return spawnSync(process.execPath, [scriptPath, ...args], { encoding: 'utf8' });+}++function validSpec() {+ return {+ solution: { uniqueName: 'new_service', publisherPrefix: 'new' },+ app: { name: 'Service Console' },+ entities: [+ {+ schemaName: 'new_account',+ displayName: 'Account',+ hasNotes: true,+ primaryAttribute: { schemaName: 'new_name', displayName: 'Name' },+ columns: [+ { schemaName: 'new_status', displayName: 'Status', type: 'Choice', options: ['Active', 'Dormant'] },+ ],+ },+ {+ schemaName: 'new_contact',+ displayName: 'Contact',+ primaryAttribute: { schemaName: 'new_fullname', displayName: 'Full Name' },+ columns: [],+ },+ ],+ forms: [+ { entity: 'new_account', name: 'Account Main', tabs: [{ label: 'Summary', sections: [{ label: 'Details', fields: ['new_name', 'new_status'] }] }] },+ { entity: 'new_contact', name: 'Contact Main', tabs: [{ label: 'Summary', sections: [{ label: 'Details', fields: ['new_fullname'] }] }] },+ ],+ };+}++test('missing spec argument exits 1 with the CLI usage string', () => {+ const res = run([]);++ assert.equal(res.status, 1);+ assert.match(res.stderr, /Usage: node scripts\/preview-form\.js --spec @<app-folder>\/app-spec\.json/);+ assert.equal(res.stdout, '');+});++test('renders the requested entity form only, including field widget hints from the spec', () => {+ const specPath = writeSpec(validSpec());++ const res = run(['--spec', '@' + specPath, '--entity', 'new_account']);++ assert.equal(res.status, 0, res.stderr);+ assert.match(res.stdout, /Account Main/);+ assert.match(res.stdout, /Name \*/);+ assert.match(res.stdout, /Status/);+ assert.match(res.stdout, /▼ select/);+ assert.match(res.stdout, /Notes \/ Timeline/);+ assert.doesNotMatch(res.stdout, /Contact Main/);+});++test('accepts a positional spec path and reports when an entity has no forms', () => {+ const specPath = writeSpec(validSpec());++ const res = run([specPath, '--entity', 'new_missing']);++ assert.equal(res.status, 0, res.stderr);+ assert.match(res.stdout, /\(no forms in spec for 'new_missing'\)/);+});++test('invalid App Spec prints validation errors instead of throwing from the renderer', () => {+ const specPath = writeSpec({ solution: { uniqueName: 'new_bad', publisherPrefix: 'new' }, app: { name: 'Broken' }, forms: [{ entity: 'new_missing' }] });++ const res = run(['--spec', '@' + specPath]);++ assert.equal(res.status, 1);+ assert.equal(res.stdout, '');+ assert.match(res.stderr, /Invalid App Spec:/);+ assert.match(res.stderr, /at least one entity is required/);+ assert.match(res.stderr, /form references unknown entity 'new_missing'/);+ assert.doesNotMatch(res.stderr, /TypeError/);+});diff --git a/plugins/model-apps/scripts/tests/projection.test.js b/plugins/model-apps/scripts/tests/projection.test.jsindex 7fa061a90..1103ca602 100644--- a/plugins/model-apps/scripts/tests/projection.test.js+++ b/plugins/model-apps/scripts/tests/projection.test.js@@ -3,6 +3,7 @@ const { test } = require('node:test');const assert = require('node:assert');const {sha256, formProjection, formProjectionHash, sitemapProjection, sitemapProjectionHash,+ cellProjection, normId,} = require('../lib/projection.js');// Minimal NEW-topology form intent: tabs → columns → sections → rows → cells.@@ -119,3 +120,41 @@ test('#3 sitemap: an out-of-band ADDED dashboard subarea (the drift case) comparconst liveDrifted = sm([{ entity: 'new_a' }, { type: 'Dashboard', dashboardId: 'dash-ops' }]); // Maker added a dashboardassert.notStrictEqual(sitemapProjectionHash(expected), sitemapProjectionHash(liveDrifted), 'drift must be detected');});++test('form projection treats quick-view and timeline controls as controls, not fields', () => {+ const quickView = cellProjection({+ control: {+ classId: '{5c5600e0-1d6e-4205-a272-be80da87fd42}',+ fieldName: 'New_CustomerId',+ label: 'Customer card',+ },+ });+ assert.deepStrictEqual(quickView, {+ control: '5C5600E0-1D6E-4205-A272-BE80DA87FD42',+ field: 'new_customerid',+ label: 'Customer card',+ });++ const timeline = cellProjection({+ control: {+ classId: '{06375649-c143-495e-a496-c962e5b4488e}',+ label: 'Notes',+ },+ });+ assert.deepStrictEqual(timeline, { control: '06375649-C143-495E-A496-C962E5B4488E', label: 'Notes' });+});++test('projections tolerate malformed fetched shapes without fabricating identity', () => {+ assert.strictEqual(normId(null), '');+ assert.deepStrictEqual(formProjection(null), { entity: '', formType: 'Main', tabs: [] });++ // Fetched sitemap fragments can contain placeholders like `{}` or `null` when an adapter could not+ // classify a SubArea; projecting them as `unknown` keeps the verifier deterministic instead of+ // throwing and skipping the rest of the sitemap comparison.+ assert.deepStrictEqual(sitemapProjection({ areas: [{ label: 'A', groups: [{ label: 'G', subAreas: [null, {}] }] }] }), {+ areas: [{ label: 'A', groups: [{ label: 'G', subAreas: [+ { type: 'unknown', ref: '' },+ { type: 'unknown', ref: '' },+ ] }] }],+ });+});diff --git a/plugins/model-apps/scripts/tests/provision-entities.test.js b/plugins/model-apps/scripts/tests/provision-entities.test.jsindex 4ef076f48..e4d44287f 100644--- a/plugins/model-apps/scripts/tests/provision-entities.test.js+++ b/plugins/model-apps/scripts/tests/provision-entities.test.js@@ -15,7 +15,7 @@ function mockDeps() {createTable: async (o) => { calls.push('createTable'); return { logicalName: o.schemaName.toLowerCase(), entitySetName: `${o.schemaName.toLowerCase()}s`, metadataId: `tbl-${o.schemaName}` }; },updateTable: async () => { calls.push('updateTable'); return {}; },createColumn: async (l, o) => { calls.push('createColumn'); return { logicalName: o.schemaName.toLowerCase(), metadataId: `col-${o.schemaName}` }; },- createGlobalOptionSet: async () => ({ metadataId: 'g' }), insertStatusValue: async () => 1, createAlternateKey: async () => ({}),+ createGlobalOptionSet: async () => ({ metadataId: 'g' }), insertStatusValue: async () => 1, createAlternateKey: async () => ({}),createCustomerColumn: async (l, o) => ({ logicalName: o.schemaName.toLowerCase(), metadataId: `col-${o.schemaName}` }),createRecordsBulk: async (e, rows) => rows.map((_, i) => `${e}-${i}`),createRelationship: async (o) => ({ schemaName: o.schemaName, metadataId: `rel-${o.schemaName}` }),@@ -78,3 +78,104 @@ test('no quick-create step is planned/counted without the flag (regression guardconst dry = await provisionEntities(input, { apply: false }, mockDeps());assert.ok(!dry.plan.some((p) => /enable quick create/.test(p)), 'no quick-create step without the opt-in');});++test('dry-run plan includes non-trivial provision steps and skips non-actions', async () => {+ const rich = {+ solution: { uniqueName: 'Default', publisherPrefix: 'cr' },+ globalChoices: [{ name: 'cr_priority', options: ['Low', 'High'] }],+ entities: [+ {+ schemaName: 'cr_parent',+ displayName: 'Parent',+ primaryAttribute: { schemaName: 'cr_name' },+ columns: [+ { schemaName: 'cr_priority', type: 'Choice', globalChoice: 'cr_priority' },+ { schemaName: 'cr_childid', type: 'Lookup' },+ ],+ statusReasons: [{ label: 'Archived', state: 'Inactive' }],+ alternateKeys: [{ schemaName: 'cr_parent_key', columns: ['cr_name'] }],+ },+ { schemaName: 'cr_child', displayName: 'Child', primaryAttribute: { schemaName: 'cr_name' }, columns: [] },+ ],+ relationships: [+ { type: 'OneToMany', schemaName: 'cr_parent_children', referenced: 'cr_parent', referencing: 'cr_child', lookup: { schemaName: 'cr_parentid' } },+ { type: 'ManyToMany', schemaName: 'cr_parent_child_nn', entity1: 'cr_parent', entity2: 'cr_child' },+ ],+ sampleData: { cr_parent: [{ cr_name: 'A' }, { cr_name: 'B' }], cr_child: [] },+ };++ const dry = await provisionEntities(rich, { apply: false, sampleData: true }, mockDeps());++ assert.deepStrictEqual(dry.plan, [+ 'solution Default',+ 'global choice cr_priority',+ 'table cr_parent',+ 'column cr_parent.cr_priority (Choice)',+ 'status reason cr_parent: Archived',+ 'alt key cr_parent.cr_parent_key',+ 'table cr_child',+ 'relationship 1:N cr_parent->cr_child',+ 'relationship N:N cr_parent<->cr_child',+ '2 record(s) -> cr_parent',+ ]);+});++test('apply surfaces fallback metadata for existing columns and relationships', async () => {+ const existingInput = {+ solution: { uniqueName: 'Default', publisherPrefix: 'cr' },+ entities: [+ { schemaName: 'cr_parent', displayName: 'Parent', primaryAttribute: { schemaName: 'cr_name' }, columns: [{ schemaName: 'cr_code', type: 'Text' }] },+ { schemaName: 'cr_child', displayName: 'Child', primaryAttribute: { schemaName: 'cr_name' }, columns: [] },+ ],+ relationships: [+ { type: 'OneToMany', schemaName: 'cr_parent_children', referenced: 'cr_parent', referencing: 'cr_child', lookup: { schemaName: 'cr_parentid' } },+ { type: 'ManyToMany', schemaName: 'cr_parent_child_nn', entity1: 'cr_parent', entity2: 'cr_child' },+ ],+ };+ const d = mockDeps();+ d.provision.findTables = async (schemaName) => [{ logicalName: schemaName.toLowerCase(), entitySetName: `${schemaName.toLowerCase()}s` }];+ d.provision.findColumns = async () => [{ logicalName: 'cr_code' }];+ d.provision.fetchEntityMetadata = async (logical) => ({+ logicalName: logical,+ entitySetName: `${logical}s`,+ relationships: [+ { schemaName: 'cr_parent_children' },+ { schemaName: 'cr_parent_child_nn' },+ ],+ });++ const r = await provisionEntities(existingInput, { apply: true }, { sdk: d.sdk, provision: d.provision });++ assert.deepStrictEqual(r.columns, [{ table: 'cr_parent', schemaName: 'cr_code', logicalName: 'cr_code' }]);+ assert.deepStrictEqual(r.relationships, [+ { kind: '1n', schemaName: 'cr_parent_children' },+ { kind: 'nn', schemaName: 'cr_parent_child_nn' },+ ]);+ assert.ok(!d.calls.includes('createColumn'), 'existing columns are not recreated');+});++test('apply seeds requested sample data and returns created record ids', async () => {+ const seedInput = {+ solution: { uniqueName: 'Default', publisherPrefix: 'cr' },+ entities: [{+ schemaName: 'cr_parent',+ displayName: 'Parent',+ primaryAttribute: { schemaName: 'cr_name' },+ columns: [],+ alternateKeys: [{ schemaName: 'cr_parent_key', columns: ['cr_name'] }],+ }],+ relationships: [],+ sampleData: { cr_parent: [{ cr_name: 'A' }, { cr_name: 'B' }] },+ };+ const d = mockDeps();+ let seedGroup;+ d.sdk.seedRecordGraph = async (groups) => {+ [seedGroup] = groups;+ return { createdIds: { cr_parent: ['id-a', 'id-b'] } };+ };++ const r = await provisionEntities(seedInput, { apply: true, sampleData: true }, { sdk: d.sdk, provision: d.provision });++ assert.strictEqual(seedGroup.matchOn, 'cr_name', 'a single-column alternate key makes sample seeding idempotent');+ assert.deepStrictEqual(r.records, { cr_parent: ['id-a', 'id-b'] });+});diff --git a/plugins/model-apps/scripts/tests/run-tests.test.js b/plugins/model-apps/scripts/tests/run-tests.test.jsindex d79f92c9e..c67f1cef1 100644--- a/plugins/model-apps/scripts/tests/run-tests.test.js+++ b/plugins/model-apps/scripts/tests/run-tests.test.js@@ -47,3 +47,46 @@ test('summarize fails the run when any non-skipped suite failed', () => {assert.strictEqual(exitCode, 1);assert.ok(lines.some((l) => /FAIL\s+plugin node:test/.test(l)));});++// --- CI workflow scoping ---------------------------------------------------------------------+// The plugin's workflow must stay scoped to THIS plugin. A widened path filter would spend CI on+// every unrelated PR, and (worse) make an unrelated plugin's red build look like a model-apps+// failure. This is a text assertion rather than a YAML parse because the repo ships no YAML+// dependency and the properties that matter are all line-level.+const WORKFLOW = path.resolve(__dirname, '..', '..', '..', '..', '.github', 'workflows', 'model-apps-script-tests.yml');++test('the model-apps CI workflow triggers ONLY on model-apps paths', () => {+ const wf = fs.readFileSync(WORKFLOW, 'utf8');+ // The `paths:` block ends at the first non-list line (the blank line before `jobs:`).+ // paths:+ // - "plugins/model-apps/**"+ // # a comment is allowed between entries+ // - "evals/model-apps/**"+ const block = wf.slice(wf.indexOf('paths:'));+ const globs = [];+ for (const line of block.split('\n').slice(1)) {+ const m = /^\s+-\s+"?([^"\s]+)"?\s*$/.exec(line);+ if (m) { globs.push(m[1]); continue; }+ if (/^\s*#/.test(line) || /^\s*$/.test(line)) continue;+ break; // reached `jobs:` or another key+ }+ assert.ok(globs.length > 0, 'the workflow must declare a paths filter, not run on every PR');+ for (const g of globs) {+ assert.ok(+ g.startsWith('plugins/model-apps/') || g.startsWith('evals/model-apps/') || g.endsWith('model-apps-script-tests.yml'),+ `path filter "${g}" is not scoped to model-apps — this workflow must not run for other plugins`+ );+ }+ // And it must not be scoped so tightly that the plugin's own code stops triggering it.+ assert.ok(globs.some((g) => g.startsWith('plugins/model-apps/')), 'the plugin source must trigger the workflow');+});++test('the model-apps CI workflow opts out of telemetry transmission on every job', () => {+ // Repo convention: any job that could execute a telemetry-emitting hook or script must set the+ // plugin's opt-out var, so a test that forgets to isolate emission cannot reach a real collector.+ const wf = fs.readFileSync(WORKFLOW, 'utf8');+ const jobCount = (wf.match(/^ {4}[a-z0-9-]+:\s*$/gim) || []).length;+ const optOuts = (wf.match(/POWER_PLATFORM_SKILLS_TELEMETRY_MODEL_APPS_OPTOUT/g) || []).length;+ assert.ok(jobCount >= 2, `expected at least 2 jobs, found ${jobCount}`);+ assert.strictEqual(optOuts, jobCount, `every job must set the opt-out (${optOuts} set / ${jobCount} jobs)`);+});diff --git a/plugins/model-apps/scripts/tests/sdk-build.test.js b/plugins/model-apps/scripts/tests/sdk-build.test.jsindex ca0e2faca..63cd3c4b3 100644--- a/plugins/model-apps/scripts/tests/sdk-build.test.js+++ b/plugins/model-apps/scripts/tests/sdk-build.test.js@@ -1834,6 +1834,284 @@ test('ai-features phase: spec without spec.ai is a no-op', async () => {assert.strictEqual(find(calls, 'configureRowSummary').length, 0, 'configureRowSummary not called without spec.ai');});+// ── AI app-feature non-success buckets (ADO 6603383) ───────────────────────────────────────────+// `setAppAiFeatures` reports FIVE buckets and `applied` is the ONLY success one. The build must+// surface every non-success bucket: silently dropping one reproduces the false PASS this fix exists+// to remove (a feature the platform never stored being reported as a clean build). `unverified` and+// `failed` were added by a later SDK revision, so this pins that they are surfaced too — not just+// the original `notPersisted`.+const aiProblemSpec = () => makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'off' } } });+const withAiResult = (result) => {+ const { sdk, calls } = mockSdk();+ sdk.setAppAiFeatures = async (appUnique, flags, opts) => { calls.push({ name: 'setAppAiFeatures', args: [appUnique, flags, opts] }); return result; };+ return { sdk, calls };+};++test('ai-features phase: notPersisted / unverified / failed are each surfaced as a warning event', async () => {+ const { sdk } = withAiResult({+ applied: ['nlChart'], skipped: ['m365'],+ notPersisted: ['formFill'], unverified: ['nlSearch'], failed: ['other'],+ outcomes: [],+ });+ const events = [];+ await runSdkBuild(aiProblemSpec(), { sdk, apply: true, phases: ['ai-features'], emit: (e) => events.push(e) });+ const warnings = events.filter((e) => e.phase === 'ai-features' && e.status === 'skip');+ assert.ok(warnings.some((e) => /NOT PERSISTED: formFill/.test(e.label)), 'notPersisted surfaced');+ assert.ok(warnings.some((e) => /UNVERIFIED: nlSearch/.test(e.label)), 'unverified surfaced');+ assert.ok(warnings.some((e) => /FAILED: other/.test(e.label)), 'failed surfaced');+});++test('ai-features phase: an all-applied result emits no warning events', async () => {+ const { sdk } = withAiResult({ applied: ['formFill'], skipped: [], notPersisted: [], unverified: [], failed: [], outcomes: [] });+ const events = [];+ await runSdkBuild(aiProblemSpec(), { sdk, apply: true, phases: ['ai-features'], emit: (e) => events.push(e) });+ assert.strictEqual(events.filter((e) => e.phase === 'ai-features' && e.status === 'skip').length, 0);+});++test('ai-features phase: a result missing the newer buckets does not throw (older SDK shape)', async () => {+ // The vendored bundle and the plugin are versioned together, but a partial result must degrade to+ // "nothing to warn about" rather than crash the whole build on a missing array.+ const { sdk } = withAiResult({ applied: ['formFill'], skipped: [] });+ const events = [];+ await runSdkBuild(aiProblemSpec(), { sdk, apply: true, phases: ['ai-features'], emit: (e) => events.push(e) });+ assert.strictEqual(events.filter((e) => e.phase === 'ai-features' && e.status === 'error').length, 0, 'no error events');+});++test('ai-features phase: passes a raised verify budget so a fresh app module is not falsely reported', async () => {+ // Regression guard for a live false `notPersisted`: this phase runs moments after app-shell CREATED+ // the app module, and the SDK's default budget (4 attempts / 500ms linear ~= 3s) expired before the+ // appsettings override row became queryable -- a build of a brand-new app reported notPersisted for+ // every feature while the rows demonstrably existed seconds later.+ const spec = makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'off' } } });+ const { sdk, calls } = mockSdk();+ await runSdkBuild(spec, { sdk, apply: true, phases: ['ai-features'] });+ const opts = find(calls, 'setAppAiFeatures')[0].args[2];+ assert.ok(opts.verifyAttempts > 4, `expected a raised attempt budget, got ${opts.verifyAttempts}`);+ assert.ok(opts.verifyDelayMs >= 1000, `expected a raised backoff, got ${opts.verifyDelayMs}`);+ // The solution scope must survive alongside the new knobs.+ assert.ok(opts.solutionUniqueName, 'solutionUniqueName still passed');+});++test('ai-features phase: passes the appmoduleid it just created so the write is provable PRE-publish', async () => {+ // A freshly created appmodule is not readable until it is PUBLISHED, so the SDK's by-NAME lookup+ // (the only piece of verification that needs it) fails here and every feature lands `unverified`.+ // The build already holds the id from app-shell, so it must hand it over rather than make the SDK+ // guess. Run BOTH phases so app-shell populates result.created.app first.+ const spec = makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'off' } } });+ const { sdk, calls } = mockSdk();+ const result = await runSdkBuild(spec, { sdk, apply: true, phases: ['app-shell', 'ai-features'] });+ const opts = find(calls, 'setAppAiFeatures')[0].args[2];+ assert.ok(result.created.app, 'app-shell produced an app id');+ assert.strictEqual(opts.appModuleId, result.created.app, 'the created app id must be passed through');+});++test('ai-features phase: omits appModuleId when the app was not created in this run', async () => {+ // A partial run (--from ai-features) has no app id. Passing `null` would be rejected by the SDK's+ // GUID validation and fail the whole phase, so it must be omitted and the SDK left to resolve by+ // name — which works, because an app that predates this run is published and therefore readable.+ const spec = makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'off' } } });+ const { sdk, calls } = mockSdk();+ await runSdkBuild(spec, { sdk, apply: true, phases: ['ai-features'] });+ const opts = find(calls, 'setAppAiFeatures')[0].args[2];+ assert.strictEqual(opts.appModuleId, undefined, 'no app id in this run means the option is absent, not null');+});++test('ai-features phase: the post-publish retry FETCHES and PUBLISHES the app before re-writing', async () => {+ // The exact sequence measured to work live, in order. Publishing without first fetching the app,+ // or writing without publishing, both left the override rows absent — so the ordering is the fix,+ // not an incidental detail.+ const spec = makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'off' } } });+ const { sdk, calls } = mockSdk();+ let call = 0;+ sdk.setAppAiFeatures = async (appUnique, flags, opts) => {+ calls.push({ name: 'setAppAiFeatures', args: [appUnique, flags, opts] });+ call += 1;+ return call === 1+ ? { applied: [], skipped: [], notPersisted: ['formFill'], unverified: [], failed: [], outcomes: [] }+ : { applied: ['formFill'], skipped: [], notPersisted: [], unverified: [], failed: [], outcomes: [] };+ };+ const result = await runSdkBuild(spec, { sdk, apply: true, phases: ['app-shell', 'ai-features'] });+ const idxOf = (pred) => calls.findIndex(pred);+ const firstWrite = idxOf((c) => c.name === 'setAppAiFeatures');+ const fetchIdx = calls.findIndex((c, i) => i > firstWrite && c.name === 'fetchArtifact' && c.args[0] === 'app');+ const pubIdx = calls.findIndex((c, i) => i > firstWrite && c.name === 'publishArtifact' && c.args[0] === 'app');+ const retryIdx = calls.findIndex((c, i) => i > firstWrite && c.name === 'setAppAiFeatures');+ assert.ok(fetchIdx > -1, 'the app is re-fetched before the retry');+ assert.ok(pubIdx > fetchIdx, 'the publish follows the fetch');+ assert.ok(retryIdx > pubIdx, 'the retry write follows the publish');+ assert.strictEqual(calls[pubIdx].args[1], result.created.app, 'the app built in this run is the one published');+});++test('ai-features phase: a failing post-publish retry leaves the original verdict standing', async () => {+ // Best-effort: a throw during the fetch/publish/retry must not fail the build. The original+ // non-success verdict simply stands and is reported.+ const spec = makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'off' } } });+ const { sdk, calls } = mockSdk();+ sdk.setAppAiFeatures = async (appUnique, flags, opts) => {+ calls.push({ name: 'setAppAiFeatures', args: [appUnique, flags, opts] });+ return { applied: [], skipped: [], notPersisted: ['formFill'], unverified: [], failed: [], outcomes: [] };+ };+ sdk.publishArtifact = async (type, id) => { calls.push({ name: 'publishArtifact', args: [type, id] }); throw new Error('publish is throttled'); };+ const events = [];+ const result = await runSdkBuild(spec, { sdk, apply: true, phases: ['app-shell', 'ai-features'], emit: (e) => events.push(e) });+ assert.ok(result.ok, 'the build still completes');+ assert.ok(+ events.some((e) => e.phase === 'ai-features' && e.status === 'skip' && /NOT PERSISTED: formFill/.test(e.label)),+ 'the unapplied feature is still reported'+ );+});++test('ai-features phase: RE-ISSUES the write after publish for anything that did not apply', async () => {+ // LIVE-MEASURED, on two different apps, changing only this variable: a write issued while the app+ // is freshly created returns `notPersisted` and a direct `appsettings` query shows NO override row+ // at all — the write itself is a no-op, not a slow read. Fetching + publishing that same app and+ // re-issuing the IDENTICAL call produced all four `applied` and four real rows. Merely re-PROVING+ // after publish therefore cannot fix it (there is nothing to find); the write must be re-issued.+ const spec = makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'off' } } });+ const { sdk, calls } = mockSdk();+ let call = 0;+ sdk.setAppAiFeatures = async (appUnique, flags, opts) => {+ calls.push({ name: 'setAppAiFeatures', args: [appUnique, flags, opts] });+ // First (pre-publish) write no-ops the way the platform does; the retry after publish lands.+ call += 1;+ return call === 1+ ? { applied: [], skipped: [], notPersisted: ['formFill'], unverified: [], failed: [], outcomes: [{ feature: 'formFill', status: 'notPersisted', reason: 'no override observed' }] }+ : { applied: ['formFill'], skipped: [], notPersisted: [], unverified: [], failed: [], outcomes: [{ feature: 'formFill', status: 'applied', appOverrideExists: true }] };+ };+ const events = [];+ const result = await runSdkBuild(spec, { sdk, apply: true, phases: ['app-shell', 'ai-features'], emit: (e) => events.push(e) });+ const writes = find(calls, 'setAppAiFeatures');+ assert.strictEqual(writes.length, 2, `expected a post-publish retry write, got ${writes.length}`);+ // The retry must be scoped to the features that did NOT apply — re-writing an applied feature is+ // needless churn against a rate-limited settings API.+ assert.deepStrictEqual(Object.keys(writes[1].args[1]), ['formFill'], 'the retry targets only the unapplied features');+ const af = result.created.ai.appFeatures;+ assert.deepStrictEqual(af.applied, ['formFill'], 'the corrected verdict is reflected in the result');+ assert.deepStrictEqual(af.notPersisted, [], 'the stale non-success bucket is cleared');+ assert.strictEqual(events.filter((e) => e.phase === 'ai-features' && e.status === 'skip').length, 0, 'no warning once the retry succeeds');+});++test('ai-features phase: a retry that still fails is reported honestly, not swallowed', async () => {+ const spec = makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'off' } } });+ const { sdk, calls } = mockSdk();+ sdk.setAppAiFeatures = async (appUnique, flags, opts) => {+ calls.push({ name: 'setAppAiFeatures', args: [appUnique, flags, opts] });+ return { applied: [], skipped: [], notPersisted: ['formFill'], unverified: [], failed: [], outcomes: [{ feature: 'formFill', status: 'notPersisted', reason: 'no override observed' }] };+ };+ const events = [];+ await runSdkBuild(spec, { sdk, apply: true, phases: ['app-shell', 'ai-features'], emit: (e) => events.push(e) });+ const warnings = events.filter((e) => e.phase === 'ai-features' && e.status === 'skip');+ assert.ok(warnings.some((e) => /NOT PERSISTED: formFill/.test(e.label)), 'a genuinely failing feature still warns');+});++test('ai-features phase: the recovery reason names the path that actually recovered the feature', async () => {+ // Two recovery paths land in the same bucket: the post-publish RE-ISSUE, and the override-row+ // PROOF. Reporting "applied by the re-issue" for something the proof merely found would be the+ // same report-what-you-did-not-verify failure this phase exists to remove.+ const spec = makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'off' } } });+ const { sdk, calls } = mockSdk();+ // The retry never applies anything, so recovery can only come from the proof path.+ sdk.setAppAiFeatures = async (appUnique, flags, opts) => {+ calls.push({ name: 'setAppAiFeatures', args: [appUnique, flags, opts] });+ return { applied: [], skipped: [], notPersisted: ['formFill'], unverified: [], failed: [], outcomes: [{ feature: 'formFill', status: 'notPersisted' }] };+ };+ // ...but the override row IS present, so the proof recovers it.+ sdk.queryRecords = async (logical) => {+ if (logical === 'appmodule') return [{ appmoduleid: 'app-guid' }];+ if (logical === 'settingdefinition') return [{ settingdefinitionid: 'def-guid' }];+ if (logical === 'appsetting') return [{ value: '1' }];+ return [];+ };+ const result = await runSdkBuild(spec, { sdk, apply: true, phases: ['app-shell', 'ai-features'] });+ const outcome = (result.created.ai.appFeatures.outcomes || []).find((o) => o.feature === 'formFill');+ assert.strictEqual(outcome.status, 'applied');+ assert.match(outcome.reason, /override-row proof/, `the proof path must not claim the re-issue applied it: ${outcome.reason}`);+});++test('ai-features phase: a not-persisted warning carries a real sequential step index, not `total`', async () => {+ // Regression guard for a reviewed defect: this warning was once emitted by hand with+ // `n: runner.total`, so the CLI printed `[total/total]` for it and the progress counter jumped.+ // `runner.skip` shares the same monotonic counter as `runner.run`, which is why the warning must+ // go through it rather than a bespoke emit.+ const spec = makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'off' } } });+ const { sdk, calls } = mockSdk();+ sdk.setAppAiFeatures = async (appUnique, flags, opts) => {+ calls.push({ name: 'setAppAiFeatures', args: [appUnique, flags, opts] });+ return { applied: [], skipped: [], notPersisted: ['formFill'], unverified: [], failed: [], outcomes: [] };+ };+ const events = [];+ await runSdkBuild(spec, { sdk, apply: true, phases: ['app-shell', 'ai-features'], emit: (e) => events.push(e) });+ const warn = events.find((e) => e.phase === 'ai-features' && e.status === 'skip' && /NOT PERSISTED/.test(e.label));+ assert.ok(warn, 'the warning is emitted');+ assert.ok(Number.isInteger(warn.n) && warn.n > 0, `step index must be a real number, got ${warn.n}`);+ // Every terminal event shares one counter, so the warning's index must be strictly greater than+ // the step before it — the exact property a hard-coded `total` destroys.+ const terminal = events.filter((e) => e.status === 'ok' || e.status === 'skip' || e.status === 'error');+ const idx = terminal.indexOf(warn);+ assert.ok(idx > 0, 'the warning is not the first terminal event');+ assert.strictEqual(warn.n, terminal[idx - 1].n + 1, `expected a sequential index, got ${terminal[idx - 1].n} -> ${warn.n}`);+});++test('ai-features phase: a bucket the plugin does not know about is still reported, not dropped', async () => {+ // The buckets are derived from the RESULT, not a fixed list: a non-success bucket added by a+ // future SDK revision must surface verbatim rather than vanish, which is the very bug class this+ // phase exists to remove. (A fixed three-key table silently dropped anything new.)+ const { sdk } = withAiResult({ applied: [], skipped: [], notPersisted: [], unverified: [], failed: [], rejected: ['formFill'], outcomes: [] });+ const events = [];+ await runSdkBuild(aiProblemSpec(), { sdk, apply: true, phases: ['ai-features'], emit: (e) => events.push(e) });+ const warnings = events.filter((e) => e.phase === 'ai-features' && e.status === 'skip');+ assert.ok(warnings.some((e) => /REJECTED: formFill/.test(e.label)), `unknown bucket not surfaced: ${JSON.stringify(warnings.map((w) => w.label))}`);+});++test('ai-features phase: a feature the SDK mis-reports is RE-PROVEN against the override row', async () => {+ // Live-driven: the SDK's build-time proof returns `notPersisted` with appOverrideExists:false for+ // a fresh build while `appsettings` demonstrably holds every requested value (re-running it+ // out-of-band reports all four applied). Printing that as NOT PERSISTED is a false alarm that+ // also contradicts --verify, which proves the same rows and passes. So anything not in `applied`+ // is re-proved here against the identical oracle the verifier uses.+ const { sdk } = withAiResult({ applied: [], skipped: [], notPersisted: ['formFill'], unverified: [], failed: [], outcomes: [{ feature: 'formFill', status: 'notPersisted', reason: 'no override observed' }] });+ sdk.queryRecords = async (set) => {+ if (set === 'appmodule') return [{ appmoduleid: 'APPID' }];+ if (set === 'settingdefinition') return [{ settingdefinitionid: 'DEFID' }];+ if (set === 'appsetting') return [{ value: '1' }]; // the row IS there+ return [];+ };+ const events = [];+ const r = await runSdkBuild(aiProblemSpec(), { sdk, apply: true, phases: ['ai-features'], emit: (e) => events.push(e) });+ assert.strictEqual(events.filter((e) => e.phase === 'ai-features' && e.status === 'skip').length, 0, 'no false NOT PERSISTED warning');+ assert.ok(r.ok, 'build still succeeds');+});++test('ai-features phase: re-proving does NOT mask a feature that genuinely did not persist', async () => {+ // The re-confirmation must only ever UPGRADE a proven feature. When the override row really is+ // absent the warning has to survive, or the fix would reinstate the false PASS.+ const { sdk } = withAiResult({ applied: [], skipped: [], notPersisted: ['formFill'], unverified: [], failed: [], outcomes: [{ feature: 'formFill', status: 'notPersisted', reason: 'no override observed for FormFillBarUXEnabled' }] });+ sdk.queryRecords = async (set) => {+ if (set === 'appmodule') return [{ appmoduleid: 'APPID' }];+ if (set === 'settingdefinition') return [{ settingdefinitionid: 'DEFID' }];+ return []; // no override row+ };+ const events = [];+ await runSdkBuild(aiProblemSpec(), { sdk, apply: true, phases: ['ai-features'], emit: (e) => events.push(e) });+ const warn = events.find((e) => e.phase === 'ai-features' && e.status === 'skip');+ assert.ok(warn, 'a genuinely unpersisted feature must still warn');+ // ...and it must carry the SDK's OWN reason, not a canned bucket description.+ assert.match(warn.label, /no override observed for FormFillBarUXEnabled/);+});++test('ai-features phase: an override holding the WRONG value is not treated as proven', async () => {+ const { sdk } = withAiResult({ applied: [], skipped: [], notPersisted: ['formFill'], unverified: [], failed: [], outcomes: [] });+ sdk.queryRecords = async (set) => {+ if (set === 'appmodule') return [{ appmoduleid: 'APPID' }];+ if (set === 'settingdefinition') return [{ settingdefinitionid: 'DEFID' }];+ if (set === 'appsetting') return [{ value: '0' }]; // requested true -> '1'+ return [];+ };+ const events = [];+ await runSdkBuild(aiProblemSpec(), { sdk, apply: true, phases: ['ai-features'], emit: (e) => events.push(e) });+ assert.ok(events.some((e) => e.phase === 'ai-features' && e.status === 'skip'), 'a wrong-valued override must still warn');+});+test('ai-features planFor: spec.ai adds enable + per-table summary plan entries', () => {const spec = makeSpec({ ai: { appFeatures: { formFill: true }, summaries: { default: 'auto' } } });const items = planFor(spec, { phases: ['ai-features'] });diff --git a/plugins/model-apps/scripts/tests/sdk-http-client.test.js b/plugins/model-apps/scripts/tests/sdk-http-client.test.jsindex 1a4dcf911..e9a371db4 100644--- a/plugins/model-apps/scripts/tests/sdk-http-client.test.js+++ b/plugins/model-apps/scripts/tests/sdk-http-client.test.js@@ -158,3 +158,108 @@ test('rejects a non-https or malformed org URL at construction (fail-closed credassert.throws(() => createAzHttpClient('http://org.crm.dynamics.com', { getToken: () => 'TOK' }), /https/);assert.throws(() => createAzHttpClient('not-a-url', { getToken: () => 'TOK' }), /https/);});++// --- postRaw: the multipart/mixed $batch transport ------------------------------------------+// The SDK makes multi-row writes atomic via an OData `$batch` change set, and it will NOT+// degrade to sequential requests: without postRaw, deleting an app that owns a sitemap fails+// with APP_DELETE_NOT_ATOMIC rather than risk stranding a row between two calls.+// See the HttpClient contract in the SDK: src/types/httpClient.ts.++// A realistic multipart/mixed $batch response. The SDK parses each operation's status line out+// of this string, so the envelope must survive the transport byte-for-byte:+// --batchresponse_<guid>+// Content-Type: multipart/mixed; boundary=changesetresponse_<guid>+//+// --changesetresponse_<guid>+// Content-Type: application/http+// Content-ID: 1+//+// HTTP/1.1 204 No Content+// ...+const BATCH_RESPONSE = [+ '--batchresponse_b1',+ 'Content-Type: multipart/mixed; boundary=changesetresponse_c1',+ '',+ '--changesetresponse_c1',+ 'Content-Type: application/http',+ 'Content-ID: 1',+ '',+ 'HTTP/1.1 204 No Content',+ '',+ '--changesetresponse_c1--',+ '',+ '--batchresponse_b1--',+ '',+].join('\r\n');++test('postRaw sends the body VERBATIM and returns the multipart response as a raw STRING', async () => {+ const { request, calls } = fakeTransport({ statusCode: 200, headers: {}, body: BATCH_RESPONSE });+ const http = createAzHttpClient('https://org.crm.dynamics.com', { getToken: () => 'TOK', request });+ const body = '--batch_a1\r\nContent-Type: application/http\r\n\r\nDELETE /x HTTP/1.1\r\n\r\n--batch_a1--';+ const res = await http.postRaw('https://org.crm.dynamics.com/api/data/v9.2/$batch', body, {+ headers: { 'Content-Type': 'multipart/mixed;boundary=batch_a1' },+ });+ assert.strictEqual(calls[0].method, 'POST');+ assert.strictEqual(calls[0].body, body, 'the multipart payload must not be re-serialized');+ assert.strictEqual(+ calls[0].headers['Content-Type'],+ 'multipart/mixed;boundary=batch_a1',+ "the caller's boundary-bearing Content-Type must win over the JSON default"+ );+ assert.strictEqual(typeof res.body, 'string', 'the SDK reads status lines out of the raw envelope');+ assert.strictEqual(res.body, BATCH_RESPONSE);+ assert.strictEqual(res.status, 200);+});++test('postRaw never JSON-parses a body that happens to be valid JSON', async () => {+ // parseBody() would turn this into an object and the SDK would throw ConnectionError+ // ("body is not a string"). postRaw must bypass parsing unconditionally, not by accident.+ const { request } = fakeTransport({ statusCode: 200, headers: {}, body: '{"not":"multipart"}' });+ const http = createAzHttpClient('https://org', { getToken: () => 'TOK', request });+ const res = await http.postRaw('https://org/api/data/v9.2/$batch', 'x', { headers: { 'Content-Type': 'multipart/mixed;boundary=b' } });+ assert.strictEqual(typeof res.body, 'string');+ assert.strictEqual(res.body, '{"not":"multipart"}');+});++test('postRaw does NOT retry a $batch on a transient status (the change set contains DELETEs)', async () => {+ // Same hazard as a bare record DELETE: Dataverse's "More than one concurrent Delete requests+ // detected" guard permanently wedges a row when a retry races the still-in-flight first delete.+ // A $batch carries DELETEs inside a POST, so the method-based noRetry rule must cover it too.+ const { request, calls } = fakeTransport({ statusCode: 503, headers: {}, body: 'busy' });+ const http = createAzHttpClient('https://org', { getToken: () => 'TOK', request, sleep: async () => {} });+ const res = await http.postRaw('https://org/api/data/v9.2/$batch', 'x', { headers: { 'Content-Type': 'multipart/mixed;boundary=b' } });+ assert.strictEqual(calls.length, 1, 'a $batch is issued exactly once');+ assert.strictEqual(res.status, 503, 'the transient status is surfaced, not retried away');+});++test('postRaw does NOT retry a $batch on a network error either', async () => {+ const { request, calls } = fakeTransport({ error: 'ETIMEDOUT' });+ const http = createAzHttpClient('https://org', { getToken: () => 'TOK', request, sleep: async () => {} });+ await assert.rejects(+ () => http.postRaw('https://org/api/data/v9.2/$batch', 'x', { headers: { 'Content-Type': 'multipart/mixed;boundary=b' } }),+ /Request failed/+ );+ assert.strictEqual(calls.length, 1, 'an ambiguous batch outcome is never re-issued blindly');+});++test('postRaw still refreshes the token once on 401 (rejected before processing, so it is safe)', async () => {+ const { request, calls } = fakeTransport(() =>+ calls.length <= 1 ? { statusCode: 401, headers: {}, body: '' } : { statusCode: 200, headers: {}, body: BATCH_RESPONSE }+ );+ let tokens = 0;+ const http = createAzHttpClient('https://org', { getToken: () => `TOK${++tokens}`, request, sleep: async () => {} });+ const res = await http.postRaw('https://org/api/data/v9.2/$batch', 'x', { headers: { 'Content-Type': 'multipart/mixed;boundary=b' } });+ assert.strictEqual(calls.length, 2);+ assert.strictEqual(calls[1].headers.Authorization, 'Bearer TOK2', 'the retry carries a fresh token');+ assert.strictEqual(res.body, BATCH_RESPONSE);+});++test('postRaw enforces the same-origin credential guard', async () => {+ const { request, calls } = fakeTransport({ statusCode: 200, headers: {}, body: BATCH_RESPONSE });+ const http = createAzHttpClient('https://org.crm.dynamics.com', { getToken: () => 'TOK', request });+ await assert.rejects(+ () => http.postRaw('https://evil.example.com/api/data/v9.2/$batch', 'x', { headers: { 'Content-Type': 'multipart/mixed;boundary=b' } }),+ /different origin/+ );+ assert.strictEqual(calls.length, 0);+});diff --git a/plugins/model-apps/scripts/tests/teardown-model-app.test.js b/plugins/model-apps/scripts/tests/teardown-model-app.test.jsindex c82bfc643..7ae065a9d 100644--- a/plugins/model-apps/scripts/tests/teardown-model-app.test.js+++ b/plugins/model-apps/scripts/tests/teardown-model-app.test.js@@ -1,138 +1,182 @@-'use strict';-// Thin wiring test for teardown-model-app.js: the validation gate, dry-run purity, that apply-// threads through to the teardown engine, and the phase-grouped [n/total] log + summary. The-// engine's per-kind behavior is covered exhaustively in sdk-teardown.test.js.-const { test } = require('node:test');-const assert = require('node:assert');-const path = require('node:path');-const fs = require('node:fs');-const { teardownModelApp, cliEmit } = require(path.join(__dirname, '..', 'teardown-model-app.js'));--const desk = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'samples', 'app-spec.support-desk.json'), 'utf8'));--// An SDK that reports every artifact as present (one id each) so apply performs deletes.-// Stateful for tables so the table delete flow simulates the SDK cosmetic-404 (deleteTable-// throws 404 even on success).-function presentSdk() {- const calls = [];- const deletedTables = new Set();- const deletedRelationships = new Set();- const resolveArtifact = async (kind, identity) => {- calls.push({ method: 'resolveArtifact', kind, identity });- if (kind === 'app') return [{ id: 'id1', name: 'App', appModuleIdUnique: 'unique-id1' }];- if (kind === 'dashboard') return [{ id: 'id2', name: 'Dash' }];- if (kind === 'form') return [{ id: 'id-form', name: 'Form' }];- if (kind === 'chart') return [{ id: 'id-chart', name: 'Chart' }];- if (kind === 'view') return [{ id: 'id-view', name: 'View' }];- if (kind === 'command') return [{ id: identity.entity, entity: identity.entity }];- if (kind === 'webResource') return [{ id: 'id4', name: 'wr' }];- if (kind === 'solution') return [{ id: 'id5', name: 'Sol' }];- return [];- };- const deleteAppCascade = async (appModuleId, appModuleIdUnique) => {- calls.push({ method: 'deleteAppCascade', appModuleId, appModuleIdUnique });- };- const deleteRemoteArtifact = async (type, id) => {- calls.push({ method: 'deleteRemoteArtifact', type, id });- };- const deleteRelationship = async (schemaName) => {- calls.push({ method: 'deleteRelationship', schemaName });- deletedRelationships.add(schemaName);- };- const deleteWebResource = async (id) => {- calls.push({ method: 'deleteWebResource', id });- };- const deleteTable = async (logical) => {- calls.push({ method: 'deleteTable', logical });- deletedTables.add(logical);- // SDK deleteTable throws not-found even on success- const err = new Error('Could not find an entity with specified id');- err.statusCode = 404;- throw err;- };- const deleteSolution = async (id) => {- calls.push({ method: 'deleteSolution', id });- };- // Form resolution now runs through resolveExistingFormId → queryRecords('systemform') (type-scoped),- // replacing the old resolveArtifact('form'). Mirror the old single-form behavior: any form name/id- // lookup resolves to 'id-form'.- const queryRecords = async (entitySet, opts) => {- calls.push({ method: 'queryRecords', entitySet });- const filter = (opts && opts.filter) || '';- if (entitySet === 'systemform') {- if (/formid eq /.test(filter)) return [{ formid: 'id-form', objecttypecode: 'new_x', type: 2, name: 'Form' }];- if (/name eq '/.test(filter)) return [{ formid: 'id-form' }];- }- return [];- };- return { resolveArtifact, queryRecords, deleteAppCascade, deleteRemoteArtifact, deleteRelationship, deleteWebResource, deleteTable, deleteSolution, calls };-}--const logCapture = () => { const logs = []; return { log: (m) => logs.push(m), logs }; };--test('rejects an invalid spec before any teardown', async () => {- const sdk = presentSdk();- const r = await teardownModelApp({ entities: [] }, { apply: true }, { sdk });- assert.strictEqual(r.ok, false);- assert.ok(Array.isArray(r.errors) && r.errors.length);- assert.strictEqual(sdk.calls.length, 0, 'no SDK calls on a bad spec');-});--test('dry-run returns the plan and never touches the SDK', async () => {- const throwing = { queryRecords: () => { throw new Error('dry-run must not call the SDK'); } };- const r = await teardownModelApp(desk, { apply: false }, { sdk: throwing });- assert.strictEqual(r.dryRun, true);- assert.ok(r.plan.some((p) => /app module/.test(p)));- assert.ok(r.plan.some((p) => /^table /.test(p)));- assert.ok(r.plan.some((p) => /^solution /.test(p)));-});--test('apply without --allow-destructive halts before any delete (fail-closed)', async () => {- const sdk = presentSdk();- const cap = logCapture();- const r = await teardownModelApp(desk, { apply: true }, { sdk, log: cap.log });- assert.strictEqual(r.ok, false);- assert.ok(r.errors.some((e) => /allow-destructive/.test(e)));- assert.strictEqual(sdk.calls.length, 0, 'no SDK calls — halted before touching anything');- assert.ok(cap.logs.some((l) => /refusing to delete/.test(l)), 'a clear refusal is printed');-});--test('apply --allow-destructive performs the deletes', async () => {- const sdk = presentSdk();- const r = await teardownModelApp(desk, { apply: true, allowDestructive: true }, { sdk });- assert.strictEqual(r.ok, true);- assert.ok(sdk.calls.some((c) => c.method === 'deleteAppCascade'), 'app deleted');-});--test('apply threads through to the engine (deletes issued) and returns ok', async () => {- const sdk = presentSdk();- const r = await teardownModelApp(desk, { apply: true, allowDestructive: true }, { sdk });- assert.strictEqual(r.ok, true);- assert.ok(sdk.calls.some((c) => c.method === 'deleteAppCascade'), 'app deleted via deleteAppCascade');- assert.ok(sdk.calls.some((c) => c.method === 'deleteTable'));- assert.ok(sdk.calls.some((c) => c.method === 'deleteSolution'));-});--test('apply emits status-marked [n/total] lines under phase headers + a summary', async () => {- const sdk = presentSdk();- const cap = logCapture();- await teardownModelApp(desk, { apply: true, allowDestructive: true }, { sdk, log: cap.log });- const lines = cap.logs.filter((l) => /\[\d+\/\d+\]/.test(l));- assert.ok(lines.length >= 4);- const totals = new Set(lines.map((l) => Number(l.match(/\[\d+\/(\d+)\]/)[1])));- assert.strictEqual(totals.size, 1, 'one consistent total');- assert.ok(cap.logs.some((l) => /▶ /.test(l)), 'phases grouped under ▶ headers');- assert.ok(cap.logs.some((l) => /✓/.test(l)), 'deleted steps marked ✓');- assert.ok(cap.logs.some((l) => /teardown complete — \d+ deleted/.test(l)), 'a closing summary is printed');-});--test('dry-run lists the plan with a ▢ marker and no summary', async () => {- const throwing = { queryRecords: () => { throw new Error('no SDK'); } };- const cap = logCapture();- await teardownModelApp(desk, { apply: false }, { sdk: throwing, log: cap.log });- assert.ok(cap.logs.some((l) => /\[\d+\/\d+\] ▢ /.test(l)), 'plan items use the ▢ marker');- assert.ok(!cap.logs.some((l) => /teardown complete/.test(l)), 'no summary on a dry-run');-});+'use strict';+// Thin wiring test for teardown-model-app.js: the validation gate, dry-run purity, that apply+// threads through to the teardown engine, and the phase-grouped [n/total] log + summary. The+// engine's per-kind behavior is covered exhaustively in sdk-teardown.test.js.+const { test } = require('node:test');+const assert = require('node:assert');+const path = require('node:path');+const fs = require('node:fs');+const vm = require('node:vm');+const { teardownModelApp, cliEmit } = require(path.join(__dirname, '..', 'teardown-model-app.js'));++const desk = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'samples', 'app-spec.support-desk.json'), 'utf8'));++// An SDK that reports every artifact as present (one id each) so apply performs deletes.+// Stateful for tables so the table delete flow simulates the SDK cosmetic-404 (deleteTable+// throws 404 even on success).+function presentSdk() {+ const calls = [];+ const deletedTables = new Set();+ const deletedRelationships = new Set();+ const resolveArtifact = async (kind, identity) => {+ calls.push({ method: 'resolveArtifact', kind, identity });+ if (kind === 'app') return [{ id: 'id1', name: 'App', appModuleIdUnique: 'unique-id1' }];+ if (kind === 'dashboard') return [{ id: 'id2', name: 'Dash' }];+ if (kind === 'form') return [{ id: 'id-form', name: 'Form' }];+ if (kind === 'chart') return [{ id: 'id-chart', name: 'Chart' }];+ if (kind === 'view') return [{ id: 'id-view', name: 'View' }];+ if (kind === 'command') return [{ id: identity.entity, entity: identity.entity }];+ if (kind === 'webResource') return [{ id: 'id4', name: 'wr' }];+ if (kind === 'solution') return [{ id: 'id5', name: 'Sol' }];+ return [];+ };+ const deleteAppCascade = async (appModuleId, appModuleIdUnique) => {+ calls.push({ method: 'deleteAppCascade', appModuleId, appModuleIdUnique });+ };+ const deleteRemoteArtifact = async (type, id) => {+ calls.push({ method: 'deleteRemoteArtifact', type, id });+ };+ const deleteRelationship = async (schemaName) => {+ calls.push({ method: 'deleteRelationship', schemaName });+ deletedRelationships.add(schemaName);+ };+ const deleteWebResource = async (id) => {+ calls.push({ method: 'deleteWebResource', id });+ };+ const deleteTable = async (logical) => {+ calls.push({ method: 'deleteTable', logical });+ deletedTables.add(logical);+ // SDK deleteTable throws not-found even on success+ const err = new Error('Could not find an entity with specified id');+ err.statusCode = 404;+ throw err;+ };+ const deleteSolution = async (id) => {+ calls.push({ method: 'deleteSolution', id });+ };+ // Form resolution now runs through resolveExistingFormId → queryRecords('systemform') (type-scoped),+ // replacing the old resolveArtifact('form'). Mirror the old single-form behavior: any form name/id+ // lookup resolves to 'id-form'.+ const queryRecords = async (entitySet, opts) => {+ calls.push({ method: 'queryRecords', entitySet });+ const filter = (opts && opts.filter) || '';+ if (entitySet === 'systemform') {+ if (/formid eq /.test(filter)) return [{ formid: 'id-form', objecttypecode: 'new_x', type: 2, name: 'Form' }];+ if (/name eq '/.test(filter)) return [{ formid: 'id-form' }];+ }+ return [];+ };+ return { resolveArtifact, queryRecords, deleteAppCascade, deleteRemoteArtifact, deleteRelationship, deleteWebResource, deleteTable, deleteSolution, calls };+}++const logCapture = () => { const logs = []; return { log: (m) => logs.push(m), logs }; };++test('rejects an invalid spec before any teardown', async () => {+ const sdk = presentSdk();+ const r = await teardownModelApp({ entities: [] }, { apply: true }, { sdk });+ assert.strictEqual(r.ok, false);+ assert.ok(Array.isArray(r.errors) && r.errors.length);+ assert.strictEqual(sdk.calls.length, 0, 'no SDK calls on a bad spec');+});++test('dry-run returns the plan and never touches the SDK', async () => {+ const throwing = { queryRecords: () => { throw new Error('dry-run must not call the SDK'); } };+ const r = await teardownModelApp(desk, { apply: false }, { sdk: throwing });+ assert.strictEqual(r.dryRun, true);+ assert.ok(r.plan.some((p) => /app module/.test(p)));+ assert.ok(r.plan.some((p) => /^table /.test(p)));+ assert.ok(r.plan.some((p) => /^solution /.test(p)));+});++test('apply without --allow-destructive halts before any delete (fail-closed)', async () => {+ const sdk = presentSdk();+ const cap = logCapture();+ const r = await teardownModelApp(desk, { apply: true }, { sdk, log: cap.log });+ assert.strictEqual(r.ok, false);+ assert.ok(r.errors.some((e) => /allow-destructive/.test(e)));+ assert.strictEqual(sdk.calls.length, 0, 'no SDK calls — halted before touching anything');+ assert.ok(cap.logs.some((l) => /refusing to delete/.test(l)), 'a clear refusal is printed');+});++test('apply --allow-destructive performs the deletes', async () => {+ const sdk = presentSdk();+ const r = await teardownModelApp(desk, { apply: true, allowDestructive: true }, { sdk });+ assert.strictEqual(r.ok, true);+ assert.ok(sdk.calls.some((c) => c.method === 'deleteAppCascade'), 'app deleted');+});++test('deleteAppCascade rejection is reported as a failed app step and teardown continues', async () => {+ const sdk = presentSdk();+ sdk.deleteAppCascade = async (appModuleId, appModuleIdUnique) => {+ sdk.calls.push({ method: 'deleteAppCascade', appModuleId, appModuleIdUnique });+ throw new Error('delete not confirmed: generative page is shared by another app');+ };+ const cap = logCapture();++ const r = await teardownModelApp(desk, { apply: true, allowDestructive: true }, { sdk, log: cap.log });++ assert.strictEqual(r.ok, false);+ assert.ok(r.errors.some((e) => e.step === 'app module "Support Desk"' && /delete not confirmed/.test(e.message)));+ assert.ok(cap.logs.some((l) => /✗ app module "Support Desk" — delete not confirmed/.test(l)));+ assert.ok(sdk.calls.some((c) => c.method === 'deleteSolution'), 'later steps still run after the app refusal');+ assert.ok(cap.logs.some((l) => /teardown finished with errors/.test(l)), 'the summary stays visibly non-clean');+});++test('deleteAppCascade resolved success:false reports orphaned generative-page children', async () => {+ const sdk = presentSdk();+ sdk.deleteAppCascade = async (appModuleId, appModuleIdUnique) => {+ sdk.calls.push({ method: 'deleteAppCascade', appModuleId, appModuleIdUnique });+ return {+ success: false,+ deleted: [{ type: 'app', id: appModuleId }],+ failures: [+ { operation: 'delete', type: 'genPageFile', id: 'file-1', error: new Error('file remained') },+ { operation: 'delete', type: 'genPage', id: 'page-1', error: new Error('page remained') },+ ],+ };+ };+ const cap = logCapture();++ const r = await teardownModelApp(desk, { apply: true, allowDestructive: true }, { sdk, log: cap.log });+ const message = r.errors.map((e) => e.message).join('\n');++ assert.strictEqual(r.ok, false);+ assert.match(message, /app "App" deleted, but 2 cascade cleanup step\(s\) failed \(orphaned rows remain\)/);+ assert.match(message, /delete genPageFile file-1: file remained/);+ assert.match(message, /delete genPage page-1: page remained/);+ assert.doesNotMatch(message, /sitemap/i, 'the app sitemap is no longer reported as a separate cascade target');+ assert.ok(cap.logs.some((l) => /✗ app module "Support Desk"/.test(l) && /orphaned rows remain/.test(l)));+});++test('apply threads through to the engine (deletes issued) and returns ok', async () => {+ const sdk = presentSdk();+ const r = await teardownModelApp(desk, { apply: true, allowDestructive: true }, { sdk });+ assert.strictEqual(r.ok, true);+ assert.ok(sdk.calls.some((c) => c.method === 'deleteAppCascade'), 'app deleted via deleteAppCascade');+ assert.ok(sdk.calls.some((c) => c.method === 'deleteTable'));+ assert.ok(sdk.calls.some((c) => c.method === 'deleteSolution'));+});++test('apply emits status-marked [n/total] lines under phase headers + a summary', async () => {+ const sdk = presentSdk();+ const cap = logCapture();+ await teardownModelApp(desk, { apply: true, allowDestructive: true }, { sdk, log: cap.log });+ const lines = cap.logs.filter((l) => /\[\d+\/\d+\]/.test(l));+ assert.ok(lines.length >= 4);+ const totals = new Set(lines.map((l) => Number(l.match(/\[\d+\/(\d+)\]/)[1])));+ assert.strictEqual(totals.size, 1, 'one consistent total');+ assert.ok(cap.logs.some((l) => /▶ /.test(l)), 'phases grouped under ▶ headers');+ assert.ok(cap.logs.some((l) => /✓/.test(l)), 'deleted steps marked ✓');+ assert.ok(cap.logs.some((l) => /teardown complete — \d+ deleted/.test(l)), 'a closing summary is printed');+});++test('dry-run lists the plan with a ▢ marker and no summary', async () => {+ const throwing = { queryRecords: () => { throw new Error('no SDK'); } };+ const cap = logCapture();+ await teardownModelApp(desk, { apply: false }, { sdk: throwing, log: cap.log });+ assert.ok(cap.logs.some((l) => /\[\d+\/\d+\] ▢ /.test(l)), 'plan items use the ▢ marker');+ assert.ok(!cap.logs.some((l) => /teardown complete/.test(l)), 'no summary on a dry-run');+});test('cliEmit: an error event with no detail has no dangling separator', () => {const logs = [];@@ -143,7 +187,224 @@ test('cliEmit: an error event with no detail has no dangling separator', () => {const withDetail = logs.find((l) => /thing2/.test(l));assert.ok(!/—\s*$/.test(noDetail) && !noDetail.includes(' — '), `no dangling separator: ${JSON.stringify(noDetail)}`);assert.ok(withDetail.includes(' — boom'), 'detail still rendered with separator');-});+});++function loadTeardownCli({+ parseResult,+ validation = { ok: true },+ runResult = { ok: true, dryRun: false },+ runThrows = null,+ sdkThrows = null,+ workspaceExists = true,+ invokeAsMain = false,+ emitThrows = false,+}) {+ const scriptPath = path.join(__dirname, '..', 'teardown-model-app.js');+ const source = `${fs.readFileSync(scriptPath, 'utf8')}\nmodule.exports.__mainForTest = main;\n`;+ const events = [];+ const stderr = [];+ const mod = { exports: {} };+ const sdkTemp = 'D:\\Projects\\power-platform-skills-sdk\\.test-workspace\\teardown-sdk';+ const fakeFs = {+ mkdtempSync: (prefix) => {+ events.push({ type: 'mkdtempSync', prefix });+ return sdkTemp;+ },+ rmSync: (dir, opts) => events.push({ type: 'rmSync', dir, opts }),+ existsSync: (dir) => {+ events.push({ type: 'existsSync', dir });+ return workspaceExists;+ },+ };+ const customRequire = (id) => {+ if (id === 'node:fs') return fakeFs;+ if (id === 'node:path') return path;+ if (id === 'node:os') return { tmpdir: () => 'D:\\Projects\\power-platform-skills-sdk\\.test-workspace' };+ if (id === './lib/app-spec.js') {+ return {+ validateAppSpec: () => validation,+ migrateAppSpec: (spec) => {+ events.push({ type: 'migrateAppSpec', spec });+ return { ...spec, migrated: true };+ },+ };+ }+ if (id === './lib/sdk-teardown.js') {+ return {+ runTeardown: async (spec, opts, deps) => {+ events.push({ type: 'runTeardown', spec, opts });+ if (runThrows) throw runThrows;+ deps.emit({ phase: 'app', status: runResult.ok ? 'ok' : 'error', label: 'app module "Support Desk"', n: 1, total: 1, detail: runResult.ok ? '' : 'refused' });+ return runResult;+ },+ };+ }+ if (id === './lib/op-diff.js') {+ return { classifyOps: () => ({ hasDestructive: false, destructive: [] }) };+ }+ if (id === './lib/sdk-http-client.js') {+ return { createAzHttpClient: (env) => ({ env }) };+ }+ if (id === './lib/dataverse-auth.js') {+ return {+ parseArgs: () => parseResult,+ readJsonArg: (arg) => {+ events.push({ type: 'readJsonArg', arg });+ return { app: { name: 'Support Desk' }, solution: { publisherPrefix: 'new' } };+ },+ emitResult: (ok, payload) => {+ events.push({ type: 'emitResult', ok, payload });+ if (emitThrows) {+ const err = new Error(`emitResult(${ok})`);+ err.exitCode = ok ? 0 : 1;+ throw err;+ }+ },+ };+ }+ if (id === './lib/apply-snapshot-store.js') {+ return {+ tombstoneSnapshot: (workspaceDir) => { events.push({ type: 'tombstoneSnapshot', workspaceDir }); return { ok: true }; },+ deleteSnapshot: (workspaceDir) => events.push({ type: 'deleteSnapshot', workspaceDir }),+ };+ }+ if (id === './vendor/cds-maker-sdk.cjs') {+ return {+ createMakerSdk: (cfg) => {+ events.push({ type: 'createMakerSdk', cfg });+ if (sdkThrows) throw sdkThrows;+ return {+ initWorkspace: () => events.push({ type: 'initWorkspace' }),+ resolveArtifact: async () => [],+ };+ },+ };+ }+ return require(id);+ };+ customRequire.main = invokeAsMain ? mod : {};+ const sandboxProcess = {+ argv: ['node', scriptPath],+ stderr: { write: (message) => stderr.push(message) },+ exit: (code) => {+ const err = new Error(`process.exit(${code})`);+ err.exitCode = code;+ throw err;+ },+ };+ vm.runInNewContext(source, {+ require: customRequire,+ module: mod,+ exports: mod.exports,+ process: sandboxProcess,+ Buffer,+ setImmediate,+ }, { filename: scriptPath });+ return { main: mod.exports.__mainForTest, events, stderr, sdkTemp, settle: () => new Promise((resolve) => setImmediate(resolve)) };+}++test('teardown CLI rejects usage errors before creating the destructive SDK client', async () => {+ const harness = loadTeardownCli({+ parseResult: { positional: [], flags: { env: 'https://org.example', spec: '@app-spec.json', workspace: true } },+ });++ await assert.rejects(harness.main(), (err) => err.exitCode === 1);+ assert.match(harness.stderr.join(''), /Usage: node scripts\/teardown-model-app\.js/);+ assert.ok(!harness.events.some((e) => e.type === 'createMakerSdk'), 'usage failures do not initialize the SDK');+});++test('teardown CLI applies, clears the local workspace only after a clean run, and cleans the SDK temp dir before emit', async () => {+ const workspaceDir = 'D:\\Projects\\power-platform-skills-sdk\\.test-workspace\\teardown-local';+ const harness = loadTeardownCli({+ parseResult: {+ positional: [],+ flags: {+ env: 'https://org.example',+ spec: '@D:\\Projects\\power-platform-skills-sdk\\plugins\\model-apps\\samples\\app-spec.support-desk.json',+ apply: true,+ 'allow-destructive': true,+ 'clear-workspace': true,+ workspace: workspaceDir,+ },+ },+ });++ await harness.main();+ const emitIndex = harness.events.findIndex((e) => e.type === 'emitResult');+ const sdkCleanupIndex = harness.events.findIndex((e) => e.type === 'rmSync' && e.dir === harness.sdkTemp);+ const workspaceCleanupIndex = harness.events.findIndex((e) => e.type === 'rmSync' && e.dir === workspaceDir);++ assert.ok(harness.events.some((e) => e.type === 'createMakerSdk' && e.cfg.workspacePath === harness.sdkTemp));+ assert.ok(harness.events.some((e) => e.type === 'runTeardown' && e.opts.apply === true));+ assert.ok(harness.events.some((e) => e.type === 'tombstoneSnapshot' && e.workspaceDir === workspaceDir));+ assert.ok(harness.events.some((e) => e.type === 'deleteSnapshot' && e.workspaceDir === workspaceDir));+ assert.ok(workspaceCleanupIndex > -1, '--clear-workspace removes the caller workspace only after clean apply');+ assert.ok(sdkCleanupIndex > -1 && sdkCleanupIndex < emitIndex, 'emitResult exits, so SDK cleanup must happen first');+ assert.match(harness.stderr.join(''), /cleared workspace/);+ assert.strictEqual(harness.events[emitIndex].ok, true);+});++test('teardown CLI dry-runs a positional spec with the default workspace and no destructive cleanup', async () => {+ const specPath = 'D:\\Projects\\power-platform-skills-sdk\\plugins\\model-apps\\samples\\app-spec.support-desk.json';+ const harness = loadTeardownCli({+ parseResult: { positional: [specPath], flags: { env: 'https://org.example' } },+ runResult: { ok: true, dryRun: true, plan: ['app module "Support Desk"'] },+ });++ await harness.main();+ const emitted = harness.events.find((e) => e.type === 'emitResult');++ assert.ok(harness.events.some((e) => e.type === 'runTeardown' && e.opts.apply === false));+ assert.ok(!harness.events.some((e) => e.type === 'tombstoneSnapshot'), 'dry-runs do not touch changed-only snapshots');+ assert.ok(!harness.events.some((e) => e.type === 'existsSync'), 'dry-runs never clear the caller workspace');+ assert.strictEqual(emitted.ok, true);+ assert.strictEqual(emitted.payload.dryRun, true);+});++test('teardown CLI emits an engine failure only after cleaning the SDK temp workspace', async () => {+ const harness = loadTeardownCli({+ parseResult: {+ positional: [],+ flags: {+ env: 'https://org.example',+ spec: '@D:\\Projects\\power-platform-skills-sdk\\plugins\\model-apps\\samples\\app-spec.support-desk.json',+ apply: true,+ 'allow-destructive': true,+ },+ },+ runThrows: new Error('engine failed'),+ emitThrows: true,+ });++ await assert.rejects(harness.main(), (err) => err.exitCode === 1);+ const emitIndex = harness.events.findIndex((e) => e.type === 'emitResult');+ const sdkCleanupIndex = harness.events.findIndex((e) => e.type === 'rmSync' && e.dir === harness.sdkTemp);++ assert.ok(sdkCleanupIndex > -1 && sdkCleanupIndex < emitIndex);+ assert.strictEqual(harness.events[emitIndex].ok, false);+ assert.match(harness.events[emitIndex].payload.message, /engine failed/);+});++test('teardown CLI entrypoint reports SDK startup failures after removing the throwaway workspace', async () => {+ const harness = loadTeardownCli({+ parseResult: {+ positional: [],+ flags: {+ env: 'https://org.example',+ spec: '@D:\\Projects\\power-platform-skills-sdk\\plugins\\model-apps\\samples\\app-spec.support-desk.json',+ },+ },+ sdkThrows: new Error('SDK init failed'),+ invokeAsMain: true,+ });++ await harness.settle();+ const emitted = harness.events.find((e) => e.type === 'emitResult');++ assert.ok(harness.events.some((e) => e.type === 'rmSync' && e.dir === harness.sdkTemp));+ assert.strictEqual(emitted.ok, false);+ assert.match(emitted.payload.message, /SDK init failed/);+});// ---- #changed-only snapshot lifecycle: tombstone-before-delete + delete-after-clean-teardown ----------const os = require('node:os');@@ -191,4 +452,4 @@ test('teardown dry-run does NOT tombstone or delete the snapshot', async () => {const disk = snapStore.readSnapshot(ws);assert.ok(disk && disk.eligible === true, 'a dry-run leaves the eligible snapshot untouched');} finally { fs.rmSync(ws, { recursive: true, force: true }); }-});+});diff --git a/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js b/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.jsindex 84a6243d1..a3312ac51 100644--- a/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js+++ b/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js@@ -280,30 +280,54 @@ test('CONTRACT: free-text sitemap titles/URLs are XML-escaped, not rejected (a sassert.ok(!/<Title[^>]*>[^<]*&(?!amp;|lt;|gt;|quot;|apos;|#)/.test(sitemapXml), 'no raw unescaped ampersand inside a Title');});-test('CONTRACT: vendored deleteAppCascade returns a structured { success, deleted, failures } result surfacing child-cleanup failures (teardown relies on this to report orphaned sitemap/genpage rows)', async () => {- // The app delete succeeds but the cascaded sitemap delete fails (a locked/500 row). The old- // void contract swallowed this; the skill's teardown now reads result.failures to flag the- // orphan, so the bundle MUST keep returning the structured result after a re-vendor.+test('CONTRACT: vendored deleteAppCascade returns a structured { success, deleted, failures } result surfacing child-cleanup failures (teardown relies on this to report orphaned genpage rows)', async () => {+ // The app (and its sitemap) delete atomically, but a cascaded GENERATIVE-PAGE delete fails (a+ // locked/500 row). The old void contract swallowed this; the skill's teardown reads+ // result.failures to flag the orphan, so the bundle MUST keep returning the structured result+ // after a re-vendor.+ //+ // The sitemap is deliberately NOT the failing row here: it is no longer an independently+ // addressable cascade target — it is deleted in the SAME atomic $batch change set as the app, so+ // a sitemap failure rejects the whole call instead of landing in failures[].const APP_ID = '77777777-7777-7777-7777-777777777777';const APP_UNIQUE = '88888888-8888-8888-8888-888888888888';const SITEMAP_ID = '99999999-9999-9999-9999-999999999999';+ const GENPAGE_ID = '55555555-5555-5555-5555-555555555555';const client = {get: async (url) => {if (/EntityDefinitions\(LogicalName=/i.test(url)) {const ln = (url.match(/LogicalName='([^']+)'/) || [])[1] || 'x';return { status: 200, headers: {}, body: { MetadataId: '33333333-3333-3333-3333-333333333333', EntitySetName: `${ln}s`, LogicalName: ln } };}- // appmodulecomponent (type 62) resolves the app's sitemap id...- if (/\/appmodulecomponents\?/.test(url)) return { status: 200, headers: {}, body: { value: [{ objectid: SITEMAP_ID, componenttype: 62 }] } };- // ...and the sitemap row has no GenPageId, so there are no generative pages to cascade.- if (/\/sitemaps\?/.test(url)) return { status: 200, headers: {}, body: { value: [{ sitemapxml: '<SiteMap></SiteMap>' }] } };+ // The app row supplies the uniquename the sitemap is linked by + the ETag the conditional+ // delete is issued against; both are mandatory now (the SDK refuses to guess).+ if (/\/appmodules\([^)]+\)/.test(url)) {+ return { status: 200, headers: {}, body: { '@odata.etag': 'W/"1"', appmoduleid: APP_ID, appmoduleidunique: APP_UNIQUE, uniquename: 'new_cascadeapp', name: 'Cascade App' } };+ }+ // Only a navigational <SubArea GenPageId="…"> counts as a live generative-page reference.+ if (/\/sitemaps/.test(url)) {+ return {+ status: 200,+ headers: {},+ body: { value: [{ '@odata.etag': 'W/"2"', sitemapid: SITEMAP_ID, sitemapnameunique: 'new_cascadeapp', sitemapxml: `<SiteMap><Area><Group><SubArea Id="s1" GenPageId="${GENPAGE_ID}" /></Group></Area></SiteMap>` }] },+ };+ }+ // The generative page owns one file row, which cascades before its parent.+ if (/\/uxagentprojectfiles\?/.test(url)) return { status: 200, headers: {}, body: { value: [{ uxagentprojectfileid: '66666666-6666-6666-6666-666666666666' }] } };return { status: 200, headers: {}, body: { value: [] } };},post: async () => ({ status: 204, headers: {}, body: {} }),+ // The app + sitemap go out as one atomic change set; echo a well-formed multipart response so+ // both operations read as 204 and the cascade proceeds to its generative-page children.+ postRaw: async (_url, body) => {+ const ids = [...String(body).matchAll(/^Content-ID:\s*(\S+)/gim)].map((m) => m[1]);+ const parts = ids.flatMap((id) => ['--csr', 'Content-Type: application/http', `Content-ID: ${id}`, '', 'HTTP/1.1 204 No Content', '']);+ return { status: 200, headers: {}, body: ['--br', 'Content-Type: multipart/mixed; boundary=csr', '', ...parts, '--csr--', '--br--', ''].join('\r\n') };+ },patch: async () => ({ status: 204, headers: {}, body: {} }),delete: async (url) => {- // The DELETE /sitemaps(<id>) child cleanup fails; the DELETE /appmodules(<id>) primary succeeds.- if (/\/sitemaps\(/.test(url)) return { status: 500, headers: {}, body: { error: { message: 'sitemap locked' } } };+ // The DELETE /uxagentprojects(<id>) child cleanup fails; every other delete succeeds.+ if (/\/uxagentprojects\(/.test(url)) return { status: 500, headers: {}, body: { error: { message: 'generative page locked' } } };return { status: 204, headers: {}, body: {} };},put: async () => ({ status: 204, headers: {}, body: {} }),@@ -313,7 +337,7 @@ test('CONTRACT: vendored deleteAppCascade returns a structured { success, deleteassert.ok(result && typeof result === 'object', 'deleteAppCascade returns a structured result (not void)');assert.strictEqual(result.success, false, 'a failed child cleanup makes success=false');assert.ok(Array.isArray(result.deleted) && result.deleted.some((d) => d.type === 'app'), 'the primary app delete is reported in deleted[]');- assert.ok(Array.isArray(result.failures) && result.failures.some((f) => f.type === 'sitemap'), 'the orphaned sitemap cleanup failure is surfaced in failures[]');+ assert.ok(Array.isArray(result.failures) && result.failures.some((f) => f.type === 'genPage'), 'the orphaned generative-page cleanup failure is surfaced in failures[]');});test('CONTRACT: vendored seedRecordGraph returns { createdIds: { <entity>: [ids] } } (the sample-data phase reads createdIds to bind children)', async () => {diff --git a/plugins/model-apps/scripts/tests/verify-model-app.test.js b/plugins/model-apps/scripts/tests/verify-model-app.test.jsindex da319451c..e6dd14743 100644--- a/plugins/model-apps/scripts/tests/verify-model-app.test.js+++ b/plugins/model-apps/scripts/tests/verify-model-app.test.js@@ -1,140 +1,397 @@-'use strict';-const { test } = require('node:test');-const assert = require('node:assert');-const os = require('node:os');-const fs = require('node:fs');-const path = require('node:path');-const { readerFor } = require('../verify-model-app.js');--const GP_OVERVIEW = '13ecbc57-a3a4-4132-b0a2-a6c6b12691e8';-const GP_DETAIL = '5c0a4889-45fd-46ea-91a8-ff876914d644';--// SDK stub that provides enough surface for readerFor (appId resolution, sitemap, webresource).-// `sitemap` when provided causes stubSdk to route appmodulecomponent + sitemap queries appropriately-// so fetchSitemap returns { ok:true, xml, ids }.-function stubSdk({ webresource = [], sitemap = null } = {}) {- return {- queryRecords: async (set) => {- if (set === 'appmodule') return [{ appmoduleid: 'app-uuid-1', appmoduleidunique: 'uid-1' }];- if (set === 'appmodulecomponent') return sitemap ? [{ objectid: 'sm-1', componenttype: 62 }] : [];- if (set === 'sitemap') return sitemap ? [{ sitemapxml: sitemap }] : [];- if (set === 'webresource') return webresource;- return [];- },- findTables: async () => [],- findColumns: async () => [],- };-}--// SDK where appmodule returns empty → fetchSitemap gets { ok:false, reason:'app-not-found' }.-function noAppSdk() {- return { queryRecords: async () => [], findTables: async () => [], findColumns: async () => [] };-}--test('readerFor.existenceIds() calls enumerateEnv(), memoized to one call, throws on failure', async () => {- let calls = 0;- const genpageCli = { enumerateEnv: async () => { calls++; return { ok: true, ids: [GP_OVERVIEW, GP_DETAIL] }; } };- const reader = readerFor(stubSdk(), 'contoso_app', { genpageCli, workspaceDir: os.tmpdir() });-- const ids = await reader.existenceIds();- assert.deepStrictEqual(ids, [GP_OVERVIEW, GP_DETAIL]);- await reader.existenceIds(); // second call — must NOT re-invoke enumerateEnv (memoized)- assert.strictEqual(calls, 1, 'enumerateEnv called exactly once (memoized per verify run)');-- // Failure path: enumerateEnv !ok → existenceIds must throw (fail-closed — unknown env means cannot verify).- const failing = readerFor(stubSdk(), 'contoso_app', {- genpageCli: { enumerateEnv: async () => ({ ok: false, error: 'auth expired' }) },- workspaceDir: os.tmpdir(),- });- await assert.rejects(failing.existenceIds(), /auth expired/i);-});--test('readerFor.sitemapPageIds() returns page ids from fetchSitemap; throws when sitemap unreadable', async () => {- const xml = `<SiteMap><Area><Group><SubArea GenPageId="${GP_OVERVIEW}"/><SubArea GenPageId="${GP_DETAIL}"/></Group></Area></SiteMap>`;- const reader = readerFor(stubSdk({ sitemap: xml }), 'contoso_app', {- genpageCli: { enumerateEnv: async () => ({ ok: true, ids: [] }) },- workspaceDir: os.tmpdir(),- });- const ids = await reader.sitemapPageIds();- assert.ok(ids.includes(GP_OVERVIEW.toLowerCase()), 'GP_OVERVIEW in sitemapPageIds');- assert.ok(ids.includes(GP_DETAIL.toLowerCase()), 'GP_DETAIL in sitemapPageIds');-- // Failure: fetchSitemap returns !ok (app-not-found) → sitemapPageIds must throw (fail-closed).- const failing = readerFor(noAppSdk(), 'contoso_app', {- genpageCli: { enumerateEnv: async () => ({ ok: true, ids: [] }) },- workspaceDir: os.tmpdir(),- });- await assert.rejects(failing.sitemapPageIds(), /could not read the app sitemap/i);-});--test('readerFor.manifest() returns null when webresource absent; parsed manifest when valid; null when corrupt', async () => {- // Absent: no webresource row → manifest() returns null (verifySpec will set unableToRun on a page-bearing spec).- const readAbsent = readerFor(stubSdk(), 'contoso_app', {- genpageCli: { enumerateEnv: async () => ({ ok: true, ids: [] }) },- workspaceDir: os.tmpdir(),- });- assert.strictEqual(await readAbsent.manifest(), null, 'manifest null when webresource absent');-- // Valid: webresource.content = base64 of valid manifest JSON → manifest() returns parsed object.- const manifest = { schemaVersion: 1, pages: [{ key: 'overview', name: 'Overview', pageId: GP_OVERVIEW }] };- const b64 = Buffer.from(JSON.stringify(manifest)).toString('base64');- const readPresent = readerFor(stubSdk({ webresource: [{ content: b64 }] }), 'contoso_app', {- genpageCli: { enumerateEnv: async () => ({ ok: true, ids: [] }) },- workspaceDir: os.tmpdir(),- });- const m = await readPresent.manifest();- assert.ok(m && m.pages[0].pageId === GP_OVERVIEW, 'manifest parsed when webresource is valid');-- // Corrupt: base64 of non-JSON → parseManifestBase64 returns null → manifest() returns null.- const corruptB64 = Buffer.from('this is not valid json!').toString('base64');- const readCorrupt = readerFor(stubSdk({ webresource: [{ content: corruptB64 }] }), 'contoso_app', {- genpageCli: { enumerateEnv: async () => ({ ok: true, ids: [] }) },- workspaceDir: os.tmpdir(),- });- assert.strictEqual(await readCorrupt.manifest(), null, 'manifest null when webresource is corrupt JSON');-});--test('readerFor.pageCode(id) downloads by id (pageIds:[id]), caches per id, throws on download failure', async () => {- const ws = fs.mkdtempSync(path.join(os.tmpdir(), 'vf-'));- let downloads = 0;- const genpageCli = {- enumerateEnv: async () => ({ ok: true, ids: [] }),- // Simulate pac writing <outDir>/<pageId>/page.tsx (the per-id output layout).- download: async ({ outputDir, pageIds }) => {- downloads += 1;- const id = pageIds[0];- fs.mkdirSync(path.join(outputDir, id), { recursive: true });- fs.writeFileSync(path.join(outputDir, id, 'page.tsx'), `// code for ${id}`, 'utf8');- return true;- },- };- const reader = readerFor(stubSdk(), 'contoso_app', { genpageCli, workspaceDir: ws });-- const code = await reader.pageCode(GP_OVERVIEW);- assert.ok(code.includes(GP_OVERVIEW), 'returned the page code for the requested id');-- await reader.pageCode(GP_OVERVIEW); // second call — same id — must NOT re-download- assert.strictEqual(downloads, 1, 'download runs once per id (cached)');-- await reader.pageCode(GP_DETAIL); // different id → exactly one more download (per-id, not all-pages)- assert.strictEqual(downloads, 2, 'each distinct id downloaded separately');-- // Download failure → throws so the build gate gets an error (fail-closed).- const failing = readerFor(stubSdk(), 'contoso_app', {- genpageCli: {- enumerateEnv: async () => ({ ok: true, ids: [] }),- download: async () => { throw new Error('pac download failed'); },- },- workspaceDir: fs.mkdtempSync(path.join(os.tmpdir(), 'vf-')),- });- await assert.rejects(failing.pageCode(GP_OVERVIEW), /pac download failed/i);-});--test('readerFor WITHOUT a genpageCli has no sitemapPageIds/existenceIds/manifest/pageCode — verifySpec fails closed (Imp7/C6)', () => {- const reader = readerFor(stubSdk(), 'contoso_app', {});- // No genpageCli → page-authority methods absent → verifySpec detects reader-incapacity → unableToRun.- assert.strictEqual(typeof reader.sitemapPageIds, 'undefined', 'no sitemapPageIds when no genpageCli');- assert.strictEqual(typeof reader.existenceIds, 'undefined', 'no existenceIds when no genpageCli');- assert.strictEqual(typeof reader.manifest, 'undefined', 'no manifest when no genpageCli');- assert.strictEqual(typeof reader.pageCode, 'undefined', 'no pageCode when no genpageCli');-});+'use strict';+const { test } = require('node:test');+const assert = require('node:assert');+const os = require('node:os');+const fs = require('node:fs');+const path = require('node:path');+const vm = require('node:vm');+const { readerFor, appIdFor } = require('../verify-model-app.js');++const GP_OVERVIEW = '13ecbc57-a3a4-4132-b0a2-a6c6b12691e8';+const GP_DETAIL = '5c0a4889-45fd-46ea-91a8-ff876914d644';++// SDK stub that provides enough surface for readerFor (appId resolution, sitemap, webresource).+// `sitemap` when provided causes stubSdk to route appmodulecomponent + sitemap queries appropriately+// so fetchSitemap returns { ok:true, xml, ids }.+function stubSdk({ webresource = [], sitemap = null } = {}) {+ return {+ queryRecords: async (set) => {+ if (set === 'appmodule') return [{ appmoduleid: 'app-uuid-1', appmoduleidunique: 'uid-1' }];+ if (set === 'appmodulecomponent') return sitemap ? [{ objectid: 'sm-1', componenttype: 62 }] : [];+ if (set === 'sitemap') return sitemap ? [{ sitemapxml: sitemap }] : [];+ if (set === 'webresource') return webresource;+ return [];+ },+ findTables: async () => [],+ findColumns: async () => [],+ };+}++// SDK where appmodule returns empty → fetchSitemap gets { ok:false, reason:'app-not-found' }.+function noAppSdk() {+ return { queryRecords: async () => [], findTables: async () => [], findColumns: async () => [] };+}++test('readerFor.existenceIds() calls enumerateEnv(), memoized to one call, throws on failure', async () => {+ let calls = 0;+ const genpageCli = { enumerateEnv: async () => { calls++; return { ok: true, ids: [GP_OVERVIEW, GP_DETAIL] }; } };+ const reader = readerFor(stubSdk(), 'contoso_app', { genpageCli, workspaceDir: os.tmpdir() });++ const ids = await reader.existenceIds();+ assert.deepStrictEqual(ids, [GP_OVERVIEW, GP_DETAIL]);+ await reader.existenceIds(); // second call — must NOT re-invoke enumerateEnv (memoized)+ assert.strictEqual(calls, 1, 'enumerateEnv called exactly once (memoized per verify run)');++ // Failure path: enumerateEnv !ok → existenceIds must throw (fail-closed — unknown env means cannot verify).+ const failing = readerFor(stubSdk(), 'contoso_app', {+ genpageCli: { enumerateEnv: async () => ({ ok: false, error: 'auth expired' }) },+ workspaceDir: os.tmpdir(),+ });+ await assert.rejects(failing.existenceIds(), /auth expired/i);+});++test('readerFor.sitemapPageIds() returns page ids from fetchSitemap; throws when sitemap unreadable', async () => {+ const xml = `<SiteMap><Area><Group><SubArea GenPageId="${GP_OVERVIEW}"/><SubArea GenPageId="${GP_DETAIL}"/></Group></Area></SiteMap>`;+ const reader = readerFor(stubSdk({ sitemap: xml }), 'contoso_app', {+ genpageCli: { enumerateEnv: async () => ({ ok: true, ids: [] }) },+ workspaceDir: os.tmpdir(),+ });+ const ids = await reader.sitemapPageIds();+ assert.ok(ids.includes(GP_OVERVIEW.toLowerCase()), 'GP_OVERVIEW in sitemapPageIds');+ assert.ok(ids.includes(GP_DETAIL.toLowerCase()), 'GP_DETAIL in sitemapPageIds');++ // Failure: fetchSitemap returns !ok (app-not-found) → sitemapPageIds must throw (fail-closed).+ const failing = readerFor(noAppSdk(), 'contoso_app', {+ genpageCli: { enumerateEnv: async () => ({ ok: true, ids: [] }) },+ workspaceDir: os.tmpdir(),+ });+ await assert.rejects(failing.sitemapPageIds(), /could not read the app sitemap/i);+});++test('readerFor.manifest() returns null when webresource absent; parsed manifest when valid; null when corrupt', async () => {+ // Absent: no webresource row → manifest() returns null (verifySpec will set unableToRun on a page-bearing spec).+ const readAbsent = readerFor(stubSdk(), 'contoso_app', {+ genpageCli: { enumerateEnv: async () => ({ ok: true, ids: [] }) },+ workspaceDir: os.tmpdir(),+ });+ assert.strictEqual(await readAbsent.manifest(), null, 'manifest null when webresource absent');++ // Valid: webresource.content = base64 of valid manifest JSON → manifest() returns parsed object.+ const manifest = { schemaVersion: 1, pages: [{ key: 'overview', name: 'Overview', pageId: GP_OVERVIEW }] };+ const b64 = Buffer.from(JSON.stringify(manifest)).toString('base64');+ const readPresent = readerFor(stubSdk({ webresource: [{ content: b64 }] }), 'contoso_app', {+ genpageCli: { enumerateEnv: async () => ({ ok: true, ids: [] }) },+ workspaceDir: os.tmpdir(),+ });+ const m = await readPresent.manifest();+ assert.ok(m && m.pages[0].pageId === GP_OVERVIEW, 'manifest parsed when webresource is valid');++ // Corrupt: base64 of non-JSON → parseManifestBase64 returns null → manifest() returns null.+ const corruptB64 = Buffer.from('this is not valid json!').toString('base64');+ const readCorrupt = readerFor(stubSdk({ webresource: [{ content: corruptB64 }] }), 'contoso_app', {+ genpageCli: { enumerateEnv: async () => ({ ok: true, ids: [] }) },+ workspaceDir: os.tmpdir(),+ });+ assert.strictEqual(await readCorrupt.manifest(), null, 'manifest null when webresource is corrupt JSON');+});++test('readerFor.pageCode(id) downloads by id (pageIds:[id]), caches per id, throws on download failure', async () => {+ const ws = fs.mkdtempSync(path.join(os.tmpdir(), 'vf-'));+ let downloads = 0;+ const genpageCli = {+ enumerateEnv: async () => ({ ok: true, ids: [] }),+ // Simulate pac writing <outDir>/<pageId>/page.tsx (the per-id output layout).+ download: async ({ outputDir, pageIds }) => {+ downloads += 1;+ const id = pageIds[0];+ fs.mkdirSync(path.join(outputDir, id), { recursive: true });+ fs.writeFileSync(path.join(outputDir, id, 'page.tsx'), `// code for ${id}`, 'utf8');+ return true;+ },+ };+ const reader = readerFor(stubSdk(), 'contoso_app', { genpageCli, workspaceDir: ws });++ const code = await reader.pageCode(GP_OVERVIEW);+ assert.ok(code.includes(GP_OVERVIEW), 'returned the page code for the requested id');++ await reader.pageCode(GP_OVERVIEW); // second call — same id — must NOT re-download+ assert.strictEqual(downloads, 1, 'download runs once per id (cached)');++ await reader.pageCode(GP_DETAIL); // different id → exactly one more download (per-id, not all-pages)+ assert.strictEqual(downloads, 2, 'each distinct id downloaded separately');++ // Download failure → throws so the build gate gets an error (fail-closed).+ const failing = readerFor(stubSdk(), 'contoso_app', {+ genpageCli: {+ enumerateEnv: async () => ({ ok: true, ids: [] }),+ download: async () => { throw new Error('pac download failed'); },+ },+ workspaceDir: fs.mkdtempSync(path.join(os.tmpdir(), 'vf-')),+ });+ await assert.rejects(failing.pageCode(GP_OVERVIEW), /pac download failed/i);+});++test('readerFor WITHOUT a genpageCli has no sitemapPageIds/existenceIds/manifest/pageCode — verifySpec fails closed (Imp7/C6)', () => {+ const reader = readerFor(stubSdk(), 'contoso_app', {});+ // No genpageCli → page-authority methods absent → verifySpec detects reader-incapacity → unableToRun.+ assert.strictEqual(typeof reader.sitemapPageIds, 'undefined', 'no sitemapPageIds when no genpageCli');+ assert.strictEqual(typeof reader.existenceIds, 'undefined', 'no existenceIds when no genpageCli');+ assert.strictEqual(typeof reader.manifest, 'undefined', 'no manifest when no genpageCli');+ assert.strictEqual(typeof reader.pageCode, 'undefined', 'no pageCode when no genpageCli');+});++test('readerFor base readers normalize exact identities for tables, relationships, commands, and settings', async () => {+ const calls = [];+ const sdk = {+ findTables: async (logical) => {+ calls.push({ method: 'findTables', logical });+ return [{ logicalName: 'NEW_ACCOUNT' }, { logicalName: 'new_contact' }];+ },+ findColumns: async (logical) => {+ calls.push({ method: 'findColumns', logical });+ return [{ logicalName: `${logical}_name` }];+ },+ queryRecords: async () => [],+ fetchEntityMetadata: async (logical) => {+ calls.push({ method: 'fetchEntityMetadata', logical });+ return {+ Relationships: [+ { SchemaName: 'new_Parent_Child' },+ { schemaName: 'new_lower' },+ { name: 'new_named' },+ {},+ ],+ };+ },+ resolveArtifact: async (kind, identity) => {+ calls.push({ method: 'resolveArtifact', kind, identity });+ return [{ id: 'cmd-1' }];+ },+ retrieveSetting: async (name, opts) => {+ calls.push({ method: 'retrieveSetting', name, opts });+ return { value: '2' };+ },+ };+ const reader = readerFor(sdk, 'contoso_app', {});++ assert.deepStrictEqual(await reader.findTable('NEW_ACCOUNT'), { logicalName: 'NEW_ACCOUNT' });+ assert.deepStrictEqual(await reader.findColumns('new_account'), [{ logicalName: 'new_account_name' }]);+ assert.deepStrictEqual(await reader.entityRelationships('NEW_CHILD'), ['new_parent_child', 'new_lower', 'new_named']);+ assert.strictEqual(await reader.commandBar('NEW_ACCOUNT'), true);+ assert.deepStrictEqual(await reader.retrieveSetting('NLGridSearchSetting'), { value: '2' });+ assert.ok(calls.some((c) => c.method === 'findTables' && c.logical === 'new_account'));+ assert.ok(calls.some((c) => c.method === 'fetchEntityMetadata' && c.logical === 'new_child'));+ assert.ok(calls.some((c) => c.method === 'resolveArtifact' && c.identity.entity === 'new_account'));+ assert.ok(calls.some((c) => c.method === 'retrieveSetting' && c.opts && Object.keys(c.opts).length === 0));+});++test('appIdFor returns the deployed app id or undefined when the app is already gone', async () => {+ const filters = [];+ const sdk = {+ queryRecords: async (set, opts) => {+ filters.push(opts.filter);+ return /missing/.test(opts.filter) ? [] : [{ appmoduleid: 'app-uuid-1' }];+ },+ };++ assert.strictEqual(await appIdFor(sdk, 'contoso_app'), 'app-uuid-1');+ assert.strictEqual(await appIdFor(sdk, 'missing_app'), undefined);+ assert.ok(filters.every((f) => /uniquename eq '/.test(f)), 'app lookup stays name-scoped');+});++function loadVerifyCli({ parseResult, validateResult = { ok: true }, verifyResult = { ok: true, checks: [], missing: [] }, sdkThrows = null, invokeAsMain = false }) {+ const scriptPath = path.join(__dirname, '..', 'verify-model-app.js');+ const source = `${fs.readFileSync(scriptPath, 'utf8')}\nmodule.exports.__mainForTest = main;\n`;+ const events = [];+ const stderr = [];+ const mod = { exports: {} };+ const fakeFs = {+ mkdirSync: (dir, opts) => events.push({ type: 'mkdirSync', dir, opts }),+ };+ const customRequire = (id) => {+ if (id === 'node:fs') return fakeFs;+ if (id === 'node:path') return path;+ if (id === './lib/dataverse-auth.js') {+ return {+ parseArgs: () => parseResult,+ readJsonArg: (arg) => {+ events.push({ type: 'readJsonArg', arg });+ return { app: { name: 'Support Desk' }, solution: { publisherPrefix: 'new' } };+ },+ emitResult: (ok, payload) => events.push({ type: 'emitResult', ok, payload }),+ };+ }+ if (id === './lib/sdk-http-client.js') {+ return { createAzHttpClient: (env) => ({ env }) };+ }+ if (id === './lib/verify-spec.js') {+ return {+ verifySpec: async (spec, read) => {+ events.push({ type: 'verifySpec', spec, hasReader: typeof read.findTable === 'function' });+ return verifyResult;+ },+ };+ }+ if (id === './lib/sdk-build.js') {+ return { appUniqueName: () => 'new_supportdesk' };+ }+ if (id === './lib/app-spec.js') {+ return {+ validateAppSpec: () => validateResult,+ migrateAppSpec: (spec) => {+ events.push({ type: 'migrateAppSpec', spec });+ return { ...spec, migrated: true };+ },+ };+ }+ if (id === './lib/odata.js') {+ return { odataLit: (value) => String(value).replace(/'/g, "''") };+ }+ if (id === './lib/genpage-cli.js') {+ return { makeGenpageCli: (env) => { events.push({ type: 'makeGenpageCli', env }); return { env }; } };+ }+ if (id === './lib/sitemap-pages.js') {+ return {+ fetchSitemap: async () => ({ ok: true, xml: '<SiteMap />' }),+ sitemapGenPageIds: () => [],+ };+ }+ if (id === './lib/page-manifest.js') {+ return {+ manifestResourceName: (appUnique) => `${appUnique}_pagemanifest`,+ parseManifestBase64: () => null,+ };+ }+ if (id === './vendor/cds-maker-sdk.cjs') {+ return {+ createMakerSdk: (cfg) => {+ events.push({ type: 'createMakerSdk', cfg });+ if (sdkThrows) throw sdkThrows;+ return {+ initWorkspace: () => events.push({ type: 'initWorkspace' }),+ findTables: async () => [],+ findColumns: async () => [],+ queryRecords: async () => [],+ fetchEntityMetadata: async () => ({ Relationships: [] }),+ resolveArtifact: async () => [],+ retrieveSetting: async () => null,+ };+ },+ };+ }+ return require(id);+ };+ customRequire.main = invokeAsMain ? mod : {};+ const sandboxProcess = {+ argv: ['node', scriptPath],+ stderr: { write: (message) => stderr.push(message) },+ exit: (code) => {+ const err = new Error(`process.exit(${code})`);+ err.exitCode = code;+ throw err;+ },+ };+ vm.runInNewContext(source, {+ require: customRequire,+ module: mod,+ exports: mod.exports,+ process: sandboxProcess,+ Buffer,+ setImmediate,+ }, { filename: scriptPath });+ return { main: mod.exports.__mainForTest, events, stderr, settle: () => new Promise((resolve) => setImmediate(resolve)) };+}++test('verify CLI rejects a bare --workspace before provisioning an SDK', async () => {+ const harness = loadVerifyCli({+ parseResult: { positional: [], flags: { env: 'https://org.example', spec: '@app-spec.json', workspace: true } },+ });++ await assert.rejects(harness.main(), (err) => err.exitCode === 1);+ assert.match(harness.stderr.join(''), /Usage: node verify-model-app\.js/);+ assert.ok(!harness.events.some((e) => e.type === 'createMakerSdk'), 'usage errors never initialize the SDK');+});++test('verify CLI emits structured validation failures without touching Dataverse', async () => {+ const harness = loadVerifyCli({+ parseResult: { positional: [], flags: { env: 'https://org.example', spec: '@D:\\Projects\\power-platform-skills-sdk\\plugins\\model-apps\\samples\\bad.json' } },+ validateResult: { ok: false, errors: ['entities must be a non-empty array'] },+ });++ await harness.main();+ const emitted = harness.events.find((e) => e.type === 'emitResult');+ assert.strictEqual(emitted.ok, false);+ assert.deepStrictEqual(emitted.payload.errors, ['entities must be a non-empty array']);+ assert.ok(!harness.events.some((e) => e.type === 'createMakerSdk'), 'invalid specs halt before SDK construction');+});++test('verify CLI prints per-check status and aliases missing checks into emitResult errors', async () => {+ const missing = { kind: 'view', name: 'new_ticket.Open Tickets', present: false };+ const harness = loadVerifyCli({+ parseResult: {+ positional: [],+ flags: {+ env: 'https://org.example',+ spec: '@D:\\Projects\\power-platform-skills-sdk\\plugins\\model-apps\\samples\\app-spec.support-desk.json',+ workspace: 'D:\\Projects\\power-platform-skills-sdk\\.test-workspace\\verify',+ },+ },+ verifyResult: {+ ok: false,+ checks: [{ kind: 'entity', name: 'new_ticket', present: true }, missing],+ missing: [missing],+ },+ });++ await harness.main();+ const stderr = harness.stderr.join('');+ const emitted = harness.events.find((e) => e.type === 'emitResult');++ assert.match(stderr, /✓ entity: new_ticket/);+ assert.match(stderr, /✗ view: new_ticket\.Open Tickets/);+ assert.match(stderr, /✗ verify FAIL — 1 missing \(1\/2 present\)/);+ assert.strictEqual(emitted.ok, false);+ assert.deepStrictEqual(emitted.payload.errors, ['view:new_ticket.Open Tickets']);+ assert.ok(harness.events.some((e) => e.type === 'mkdirSync' && /\\.test-workspace\\verify$/.test(e.dir)));+ assert.ok(harness.events.some((e) => e.type === 'initWorkspace'));+});++test('verify CLI accepts a positional spec, uses the default workspace, and prints PASS', async () => {+ const specPath = 'D:\\Projects\\power-platform-skills-sdk\\plugins\\model-apps\\samples\\app-spec.support-desk.json';+ const harness = loadVerifyCli({+ parseResult: { positional: [specPath], flags: { env: 'https://org.example' } },+ verifyResult: {+ ok: true,+ checks: [{ kind: 'entity', name: 'new_ticket', present: true }],+ missing: [],+ },+ });++ await harness.main();+ const stderr = harness.stderr.join('');+ const emitted = harness.events.find((e) => e.type === 'emitResult');++ assert.match(stderr, /✓ verify PASS \(1\/1 present\)/);+ assert.strictEqual(emitted.ok, true);+ assert.deepStrictEqual(emitted.payload.missing, []);+ assert.ok(harness.events.some((e) => e.type === 'createMakerSdk' && /samples\\.maker-workspace$/.test(e.cfg.workspacePath)));+});++test('verify CLI entrypoint converts SDK startup errors into emitResult failures', async () => {+ const harness = loadVerifyCli({+ parseResult: {+ positional: [],+ flags: {+ env: 'https://org.example',+ spec: '@D:\\Projects\\power-platform-skills-sdk\\plugins\\model-apps\\samples\\app-spec.support-desk.json',+ },+ },+ sdkThrows: new Error('SDK unavailable'),+ invokeAsMain: true,+ });++ await harness.settle();+ const emitted = harness.events.find((e) => e.type === 'emitResult');+ assert.strictEqual(emitted.ok, false);+ assert.match(emitted.payload.message, /SDK unavailable/);+});diff --git a/plugins/model-apps/scripts/tests/verify-spec.test.js b/plugins/model-apps/scripts/tests/verify-spec.test.jsindex cca43be81..0e344b1db 100644--- a/plugins/model-apps/scripts/tests/verify-spec.test.js+++ b/plugins/model-apps/scripts/tests/verify-spec.test.js@@ -521,3 +521,257 @@ test('verifySpec: a missing persona role (or a foreign same-name role) is a loudassert.ok(r.missing.some((m) => m.kind === 'role' && m.name === 'Agent'));});++// ── AI app features (ADO 6603383 / 6560699) ────────────────────────────────────────────────────+// verifySpec had NO awareness of spec.ai, so a build whose every requested AI feature was skipped+// (admin gate off) or silently not persisted still reported a clean PASS.+//+// The oracle is the APP-SCOPE OVERRIDE ROW in `appsettings`, NOT the effective value:+// `RetrieveSetting(name, { appUniqueName })` falls back to the ENVIRONMENT value when the app has no+// override, so an effective-value compare passes whenever the environment happens to already hold the+// requested value — a false PASS for an app that was never configured. This mirrors the oracle the+// SDK's own `setAppAiFeatures` uses to populate its `applied` bucket.++const AI_BASE = {+ solution: { uniqueName: 'S', publisherPrefix: 'co' },+ app: { name: 'A', uniqueName: 'co_a' },+ entities: [], views: [], charts: [], forms: [], appShell: { areas: [] },+};+// `overrides` maps the PER-APP setting name -> the value held by its APP-SCOPE override row (present+// key == a row exists). `effective` maps setting name -> what RetrieveSetting reports for the app,+// which includes environment fallback; it defaults to `overrides` and is context only. Note these are+// the app settings, NOT the org readiness gates: nlSearch's gate is the boolean `EnableNLGridSearch`+// but its per-app setting is the numeric `NLGridSearchSetting` — conflating them is what made NL grid+// search silently no-op.+const aiRead = (overrides, effective, opts = {}) => {+ const eff = effective || overrides;+ return {+ findTable: async () => null,+ findColumns: async () => [],+ sitemapXml: async () => '',+ queryRecords: async (set, o) => {+ const filter = (o && o.filter) || '';+ if (set === 'appmodule') return opts.noApp ? [] : [{ appmoduleid: 'APPID' }];+ if (set === 'settingdefinition') {+ if (opts.noDef) return [];+ const m = /uniquename eq '([^']+)'/.exec(filter);+ return [{ settingdefinitionid: `DEF-${m && m[1]}` }];+ }+ if (set === 'appsetting') {+ if (opts.proofThrows) throw new Error('403 forbidden');+ const m = /_settingdefinitionid_value eq DEF-(.+)$/.exec(filter);+ const name = m && m[1];+ return Object.prototype.hasOwnProperty.call(overrides, name) ? [{ value: overrides[name] }] : [];+ }+ return [];+ },+ retrieveSetting: async (name) => ({ value: eff[name], dataType: opts.dataType }),+ };+};+const ALL_ON = { formFill: true, nlSearch: true, nlChart: true, m365: true };+const ALL_SETTINGS_ON = {+ FormFillBarUXEnabled: '1',+ NLGridSearchSetting: '1',+ NLChartDataVisualizationSetting: '1',+ m365copilotmodelappenabled: '1',+};+// The overrides a DEFAULT build writes: `resolveAiFlags` seeds formFill/nlSearch/nlChart on and+// m365 off for any spec carrying `ai`, and verify reconciles that whole set — so a test focusing on+// ONE feature must still satisfy the other three or it is asserting on unrelated misses.+const DEFAULT_SETTINGS = {+ FormFillBarUXEnabled: '1',+ NLGridSearchSetting: '1',+ NLChartDataVisualizationSetting: '1',+ m365copilotmodelappenabled: '0',+};+const aiMissing = (r, feature) => r.missing.find((m) => m.kind === 'ai-feature' && m.name === feature);+// The override proof retries the ABSENT case with real backoff; these tests drive that path+// constantly, so they opt out of the delay. Retry BEHAVIOUR has its own dedicated test below.+const verifyAi = (spec, read) => verifySpec(spec, read, { proofDelayMs: 0 });++test('verifySpec: requested AI features that are NOT in effect fail verify (no more false PASS)', async () => {+ const r = await verifyAi({ ...AI_BASE, ai: { appFeatures: ALL_ON } }, aiRead({}));+ assert.strictEqual(r.ok, false);+ assert.strictEqual(r.missing.filter((m) => m.kind === 'ai-feature').length, 4);+});++test('verifySpec: AI features in effect verify clean', async () => {+ const r = await verifyAi({ ...AI_BASE, ai: { appFeatures: ALL_ON } }, aiRead(ALL_SETTINGS_ON));+ assert.strictEqual(r.ok, true, JSON.stringify(r.missing));+ assert.strictEqual(r.checks.filter((c) => c.kind === 'ai-feature' && c.present).length, 4);+});++test('verifySpec: an ENV-fallback value that matches the request is NOT a pass (no app override)', async () => {+ // The regression this oracle exists for: RetrieveSetting at app scope returns the ENVIRONMENT value+ // when the app has no override. Every requested feature reads back exactly as requested, yet the app+ // itself was never configured — an effective-value compare reported PASS for a build the SDK itself+ // classified as notPersisted/skipped.+ const r = await verifyAi({ ...AI_BASE, ai: { appFeatures: ALL_ON } }, aiRead({}, ALL_SETTINGS_ON));+ assert.strictEqual(r.ok, false, 'env fallback must not satisfy an app-scope request');+ assert.strictEqual(r.missing.filter((m) => m.kind === 'ai-feature').length, 4);+ assert.match(r.missing.find((m) => m.kind === 'ai-feature').detail, /NO app-scope override/);+ // The effective value is still reported, as context for the maker.+ assert.match(r.missing.find((m) => m.kind === 'ai-feature').detail, /environment fallback/);+});++test('verifySpec: reads the PER-APP setting, not the org readiness gate, for nlSearch', async () => {+ // Only the ORG gate is on; the per-app setting has no override. Verify must NOT pass.+ const r = await verifyAi({ ...AI_BASE, ai: { appFeatures: { nlSearch: true } } }, aiRead({ ...DEFAULT_SETTINGS, NLGridSearchSetting: undefined, EnableNLGridSearch: 'true' }));+ assert.strictEqual(r.ok, false);+ assert.match(aiMissing(r, 'nlSearch').detail, /NLGridSearchSetting/);+});++test('verifySpec: an explicit numeric AI value (2 = on for everyone) is compared verbatim', async () => {+ const want2 = { ...AI_BASE, ai: { appFeatures: { formFill: 2 } } };+ const mismatch = await verifyAi(want2, aiRead({ ...DEFAULT_SETTINGS, FormFillBarUXEnabled: '1' }));+ assert.strictEqual(mismatch.ok, false, 'requested 2 but the override holds 1 must fail');+ assert.match(aiMissing(mismatch, 'formFill').detail, /requested '2'/);+ const match = await verifyAi(want2, aiRead({ ...DEFAULT_SETTINGS, FormFillBarUXEnabled: '2' }));+ assert.strictEqual(match.ok, true, JSON.stringify(match.missing));+});++test('verifySpec: an explicit OFF request is verified against 0, not treated as dont-care', async () => {+ const r = await verifyAi({ ...AI_BASE, ai: { appFeatures: { formFill: false } } }, aiRead({ ...DEFAULT_SETTINGS, FormFillBarUXEnabled: '1' }));+ assert.strictEqual(r.ok, false);+ // An explicit disable is still WRITTEN (disabling is never gated), so the override must hold '0'.+ const ok = await verifyAi({ ...AI_BASE, ai: { appFeatures: { formFill: false } } }, aiRead({ ...DEFAULT_SETTINGS, FormFillBarUXEnabled: '0' }));+ assert.strictEqual(ok.ok, true, JSON.stringify(ok.missing));+});++test('verifySpec: an unreadable override row fails CLOSED (cannot prove => not present)', async () => {+ // We could look and looking failed, so we must not claim PASS on the strength of an effective value+ // that may simply be the environment default — even though it matches the request here.+ const read = aiRead({ FormFillBarUXEnabled: '1' }, { FormFillBarUXEnabled: '1' }, { proofThrows: true });+ const r = await verifyAi({ ...AI_BASE, ai: { appFeatures: { formFill: true } } }, read);+ assert.strictEqual(r.ok, false);+ assert.match(r.missing.find((m) => m.kind === 'ai-feature').detail, /could not prove/);+ assert.match(r.missing.find((m) => m.kind === 'ai-feature').detail, /403 forbidden/);+});++test('verifySpec: an unresolvable app module fails CLOSED rather than proving against the wrong app', async () => {+ const read = aiRead(ALL_SETTINGS_ON, ALL_SETTINGS_ON, { noApp: true });+ const r = await verifyAi({ ...AI_BASE, ai: { appFeatures: { formFill: true } } }, read);+ assert.strictEqual(r.ok, false);+ assert.match(r.missing.find((m) => m.kind === 'ai-feature').detail, /no app module with unique name 'co_a'/);+});++test('verifySpec: a spec with ai but NO appFeatures still verifies every feature the build writes', async () => {+ // DR-P1-SK-001 / DR-P1-AR-001: the build seeds a default for EVERY feature whenever `spec.ai`+ // exists, but verify used to iterate `spec.ai.appFeatures` — so `{ ai: { summaries: {...} } }`+ // had three features written and ZERO verified, and `--verify` reported a clean PASS for features+ // the platform may never have stored. That is ADO 6603383 surviving in the shipped artifact.+ const spec = { ...AI_BASE, ai: { summaries: { default: 'auto' } } };+ const none = await verifyAi(spec, aiRead({}));+ assert.strictEqual(none.checks.filter((c) => c.kind === 'ai-feature').length, 4, 'all four defaults are reconciled');+ assert.strictEqual(none.ok, false, 'unwritten defaults must fail verify');+ // ...and the same spec passes once the defaults really are in place (m365 defaults OFF).+ const ok = await verifyAi(spec, aiRead(DEFAULT_SETTINGS));+ assert.strictEqual(ok.ok, true, JSON.stringify(ok.missing));+});++test('verifySpec: an undeclared feature is still checked when the spec declares only one', async () => {+ // The partial-declaration half of the same hole: `{ appFeatures: { m365: true } }` still causes+ // the build to write formFill/nlSearch/nlChart.+ const spec = { ...AI_BASE, ai: { appFeatures: { m365: true } } };+ const r = await verifyAi(spec, aiRead({ m365copilotmodelappenabled: '1' }));+ assert.strictEqual(r.checks.filter((c) => c.kind === 'ai-feature').length, 4);+ assert.ok(aiMissing(r, 'formFill'), 'the undeclared formFill default is reconciled');+ assert.strictEqual(r.ok, false);+});++test('verifySpec: an override row that appears late is retried, not reported as a false FAIL', async () => {+ // Observed live: an override row can lag briefly behind the write that created it (the SDK+ // reported a feature not persisted on first apply and clean on a re-run, with the value correct+ // all along). Verify gates the build's exit code, so a single read would turn that lag into a+ // false FAIL. Only the ABSENT case is retried — a read ERROR is a different condition.+ let attempts = 0;+ const base = aiRead(DEFAULT_SETTINGS);+ const read = {+ ...base,+ queryRecords: async (set, o) => {+ if (set === 'appsetting') { attempts += 1; if (attempts < 2) return []; }+ return base.queryRecords(set, o);+ },+ };+ const r = await verifyAi({ ...AI_BASE, ai: { appFeatures: { formFill: true } } }, read);+ assert.ok(attempts > 1, 'the absent read must be retried');+ assert.strictEqual(r.ok, true, JSON.stringify(r.missing));+});++test('verifySpec: the AI check is reader-gated and absent-spec-safe (existing callers unaffected)', async () => {+ // No ai block at all -> no ai checks.+ const noAi = await verifyAi(AI_BASE, aiRead(ALL_SETTINGS_ON));+ assert.strictEqual(noAi.checks.filter((c) => c.kind === 'ai-feature').length, 0);+ // ai requested but the reader cannot read settings -> skipped, not a false failure.+ const noSupport = { findTable: async () => null, findColumns: async () => [], queryRecords: async () => [], sitemapXml: async () => '' };+ const r = await verifyAi({ ...AI_BASE, ai: { appFeatures: ALL_ON } }, noSupport);+ assert.strictEqual(r.ok, true, JSON.stringify(r.missing));+ assert.strictEqual(r.checks.filter((c) => c.kind === 'ai-feature').length, 0);+ // ...and equally when it can read settings but cannot run the override PROOF: the check needs both+ // capabilities, and degrading to the unsound effective-value compare is exactly the false PASS.+ const noQuery = { findTable: async () => null, findColumns: async () => [], sitemapXml: async () => '', retrieveSetting: async () => ({ value: '1' }) };+ const r2 = await verifyAi({ ...AI_BASE, ai: { appFeatures: ALL_ON } }, noQuery);+ assert.strictEqual(r2.checks.filter((c) => c.kind === 'ai-feature').length, 0);+});++test('verifySpec: AI settings are read at the APP scope the BUILD wrote under, not the env scope', () => {+ // Regression guard for a false PASS: when a spec carries no explicit app.uniqueName (neither shipped+ // sample does), reading `spec.app.uniqueName` yields undefined, the SDK then omits the AppUniqueName+ // path segment, and RetrieveSetting returns the ENVIRONMENT value. Comparing that against the request+ // can pass while the app itself has the feature off. The identity must be `appUniqueName(spec)`.+ const seen = [];+ const appFilters = [];+ const spec = {+ solution: { uniqueName: 'S', publisherPrefix: 'new' },+ app: { name: 'Project Tracker' }, // <- no uniqueName, like the real samples+ entities: [], views: [], charts: [], forms: [], appShell: { areas: [] },+ ai: { appFeatures: { formFill: true } },+ };+ const base = aiRead(DEFAULT_SETTINGS);+ const read = {+ ...base,+ queryRecords: async (set, o) => {+ if (set === 'appmodule') appFilters.push(o.filter);+ return base.queryRecords(set, o);+ },+ retrieveSetting: async (name, opts) => { seen.push({ name, opts }); return { value: '1' }; },+ };+ return verifyAi(spec, read).then((r) => {+ assert.strictEqual(r.ok, true, JSON.stringify(r.missing));+ // Every feature the BUILD writes is reconciled, not only the one the spec named — the build+ // seeds defaults for all four, so checking fewer would leave the rest silently unverified.+ assert.strictEqual(seen.length, 4);+ for (const s of seen) {+ // Same derivation the build uses for setAppAiFeatures: `<publisherPrefix>_<app.name>` sanitized.+ assert.strictEqual(s.opts.appUniqueName, 'new_projecttracker');+ }+ // ...and the override proof must resolve THE SAME app, or it would prove against another app.+ assert.ok(appFilters.length >= 1);+ for (const f of appFilters) assert.strictEqual(f, "uniquename eq 'new_projecttracker'");+ });+});++test('verifySpec: a Boolean-spelled override value compares as on/off, independent of any dataType read', () => {+ // Dataverse dataType 2 == Boolean, whose value is the string 'true'/'false'. An exact '1' compare+ // would report a genuinely-enabled feature as not-in-effect (a false FAIL on a correct build).+ // The normalization is deliberately UNCONDITIONAL: branching on a `dataType` read made the+ // authoritative comparison depend on a second request that can fail independently, so a transport+ // error on that read silently flipped a correctly-applied feature to FAIL.+ const spec = { ...AI_BASE, ai: { appFeatures: { formFill: true } } };+ return verifyAi(spec, aiRead({ ...DEFAULT_SETTINGS, FormFillBarUXEnabled: 'true' })).then(async (on) => {+ assert.strictEqual(on.ok, true, JSON.stringify(on.missing));+ const off = await verifyAi(spec, aiRead({ ...DEFAULT_SETTINGS, FormFillBarUXEnabled: 'false' }));+ assert.strictEqual(off.ok, false, 'a Boolean-spelled setting reading false must still fail');+ });+});++test('verifySpec: a failing context read cannot flip a proven feature to FAIL', () => {+ // Regression guard: `retrieveSetting` is context only. When the override row proves the feature,+ // a throwing context read must not change the verdict (it previously supplied `dataType`, which+ // silently decided the comparison).+ const spec = { ...AI_BASE, ai: { appFeatures: { formFill: true } } };+ const read = { ...aiRead({ ...DEFAULT_SETTINGS, FormFillBarUXEnabled: 'true' }), retrieveSetting: async () => { throw new Error('429 too many requests'); } };+ return verifyAi(spec, read).then((r) => {+ assert.strictEqual(r.ok, true, JSON.stringify(r.missing));+ });+});diff --git a/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs b/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjsindex 1c15f1d25..0bcb1f313 100644--- a/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs+++ b/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs@@ -25,30 +25,34 @@}globalThis.document=globalThis.document||globalThis.window.document;})();-"use strict";var dD=Object.create;var io=Object.defineProperty;var pD=Object.getOwnPropertyDescriptor;var fD=Object.getOwnPropertyNames;var mD=Object.getPrototypeOf,hD=Object.prototype.hasOwnProperty;var S=(e,t)=>()=>(e&&(t=e(e=0)),t);var f=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xt=(e,t)=>{for(var r in t)io(e,r,{get:t[r],enumerable:!0})},_p=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fD(t))!hD.call(e,i)&&i!==r&&io(e,i,{get:()=>t[i],enumerable:!(n=pD(t,i))||n.enumerable});return e};var ne=(e,t,r)=>(r=e!=null?dD(mD(e)):{},_p(t||!e||!e.__esModule?io(r,"default",{value:e,enumerable:!0}):r,e)),Lt=e=>_p(io({},"__esModule",{value:!0}),e);var _e=f(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.IncompatibleWorkspaceError=Y.PathTraversalError=Y.AmbiguousArtifactError=Y.JsonPointerError=Y.NotImplementedError=Y.WorkspaceNotInitializedError=Y.ConnectionError=Y.VersionConflictError=Y.InvalidArgumentError=Y.ValidationError=Y.PathNotFoundError=Y.ArtifactNotFoundError=Y.SdkError=void 0;var je=class extends Error{constructor(t,r){super(r),this.code=t,Object.setPrototypeOf(this,new.target.prototype),this.name=new.target.name}};Y.SdkError=je;var wl=class extends je{constructor(t,r){super("ARTIFACT_NOT_FOUND",`Artifact ${t}/${r} not found in workspace`),this.type=t,this.id=r}};Y.ArtifactNotFoundError=wl;var Sl=class extends je{constructor(t,r,n){super("PATH_NOT_FOUND",`Path ${n} not found in ${t}/${r}`),this.type=t,this.id=r,this.pointer=n}};Y.PathNotFoundError=Sl;var Dl=class extends je{constructor(t,r,n,i){var a,o,s,l;let u=Array.isArray(n)?n:[{pointer:n,rule:i??"invalid",message:i??"invalid"}];super("VALIDATION_ERROR",`Validation failed for ${t}/${r}:+"use strict";var _D=Object.create;var ao=Object.defineProperty;var PD=Object.getOwnPropertyDescriptor;var OD=Object.getOwnPropertyNames;var FD=Object.getPrototypeOf,TD=Object.prototype.hasOwnProperty;var D=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var m=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Bt=(e,t)=>{for(var r in t)ao(e,r,{get:t[r],enumerable:!0})},Bp=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of OD(t))!TD.call(e,i)&&i!==r&&ao(e,i,{get:()=>t[i],enumerable:!(n=PD(t,i))||n.enumerable});return e};var ne=(e,t,r)=>(r=e!=null?_D(FD(e)):{},Bp(t||!e||!e.__esModule?ao(r,"default",{value:e,enumerable:!0}):r,e)),kt=e=>Bp(ao({},"__esModule",{value:!0}),e);var be=m(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.IncompatibleWorkspaceError=Z.PathTraversalError=Z.AmbiguousArtifactError=Z.JsonPointerError=Z.NotImplementedError=Z.WorkspaceNotInitializedError=Z.ConnectionError=Z.VersionConflictError=Z.InvalidArgumentError=Z.ValidationError=Z.PathNotFoundError=Z.ArtifactNotFoundError=Z.SdkError=void 0;var He=class extends Error{constructor(t,r){super(r),this.code=t,Object.setPrototypeOf(this,new.target.prototype),this.name=new.target.name}};Z.SdkError=He;var _l=class extends He{constructor(t,r){super("ARTIFACT_NOT_FOUND",`Artifact ${t}/${r} not found in workspace`),this.type=t,this.id=r}};Z.ArtifactNotFoundError=_l;var Pl=class extends He{constructor(t,r,n){super("PATH_NOT_FOUND",`Path ${n} not found in ${t}/${r}`),this.type=t,this.id=r,this.pointer=n}};Z.PathNotFoundError=Pl;var Ol=class extends He{constructor(t,r,n,i){var a,o,s,l;let u=Array.isArray(n)?n:[{pointer:n,rule:i??"invalid",message:i??"invalid"}];super("VALIDATION_ERROR",`Validation failed for ${t}/${r}:`+u.map(c=>` \u2022 ${c.pointer}: ${c.message} [${c.rule}]`).join(`-`)),this.type=t,this.id=r,this.issues=u,this.pointer=(o=(a=u[0])===null||a===void 0?void 0:a.pointer)!==null&&o!==void 0?o:"",this.rule=(l=(s=u[0])===null||s===void 0?void 0:s.rule)!==null&&l!==void 0?l:"invalid"}};Y.ValidationError=Dl;var El=class extends je{constructor(t){super("INVALID_ARGUMENT",t)}};Y.InvalidArgumentError=El;var Il=class extends je{constructor(t,r,n,i){super("VERSION_CONFLICT",`Version conflict for ${t}/${r}: local=${n??"(none)"}, server=${i??"(none)"}. Re-fetch and reapply changes.`),this.type=t,this.id=r,this.localEtag=n,this.serverEtag=i}};Y.VersionConflictError=Il;var _l=class extends je{constructor(t,r,n,i){super("CONNECTION_ERROR",r>0?`HTTP ${r} from ${t}: ${n}`:`Transport failure reaching ${t}: ${n}`),this.url=t,this.statusCode=r,this.cause=i}};Y.ConnectionError=_l;var Pl=class extends je{constructor(t){super("WORKSPACE_NOT_INITIALIZED",`Workspace not initialized at ${t}. Call initWorkspace() first.`),this.workspacePath=t}};Y.WorkspaceNotInitializedError=Pl;var Ol=class extends je{constructor(t,r){super("NOT_IMPLEMENTED",`Operation '${t}' is not implemented yet${r?`: ${r}`:""}.`),this.operation=t}};Y.NotImplementedError=Ol;var Fl=class extends je{constructor(t,r){super("INVALID_JSON_POINTER",`Invalid JSON Pointer '${t}': ${r}`),this.pointer=t}};Y.JsonPointerError=Fl;var Rl=class extends je{constructor(t,r,n){super("AMBIGUOUS_ARTIFACT",`Found ${n} ${t} rows matching '${r}'; a name is not a unique key. Resolve by id / alternate key instead of relying on name-based idempotency.`),this.kind=t,this.identity=r,this.matchCount=n}};Y.AmbiguousArtifactError=Rl;var Tl=class extends je{constructor(t,r){super("PATH_TRAVERSAL",`Refusing to resolve a path outside the workspace root: '${t}' is not within '${r}'.`),this.target=t,this.root=r}};Y.PathTraversalError=Tl;var xl=class extends je{constructor(t,r){super("INCOMPATIBLE_WORKSPACE",`Workspace schema version ${t} is newer than this SDK supports (v${r}). Upgrade the SDK, or re-create the workspace with this version.`),this.workspaceVersion=t,this.supportedVersion=r}};Y.IncompatibleWorkspaceError=xl});var so=f(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.JsonPointer=void 0;var ct=_e(),ao=class e{static isReservedToken(t){return e.RESERVED_TOKENS.has(t)}static decodeToken(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}static encodeToken(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}static parse(t){if(t==="")return[];if(t[0]!=="/")throw new ct.JsonPointerError(t,'non-empty pointers must start with "/"');return t.substring(1).split("/").map(r=>{if(/~(?![01])/.test(r))throw new ct.JsonPointerError(t,`invalid '~' escape in token '${r}' (expected ~0 or ~1)`);return e.decodeToken(r)})}static compile(t){return t.length===0?"":"/"+t.map(r=>e.encodeToken(r)).join("/")}static resolve(t,r){let n=e.parse(r),i=t;for(let a of n)if(Array.isArray(i)){let o=e.toArrayIndex(a,i.length);if(o===void 0)return;i=i[o]}else if(i!==null&&typeof i=="object"){let o=i;if(e.isReservedToken(a)||!Object.prototype.hasOwnProperty.call(o,a))return;i=o[a]}else return;return i}static set(t,r,n){let i=e.parse(r);if(i.length===0)throw new ct.JsonPointerError(r,"cannot set the document root");let{parent:a,lastToken:o}=e.resolveParent(t,i,r);if(Array.isArray(a)){let s=e.toArrayIndex(o,a.length);if(s===void 0)throw new ct.JsonPointerError(r,`'${o}' is not a valid array index`);if(s>a.length)throw new ct.JsonPointerError(r,`array index '${o}' is out of range`);a[s]=n}else{if(e.isReservedToken(o))throw new ct.JsonPointerError(r,`refusing to write reserved property '${o}'`);a[o]=n}}static remove(t,r){let n=e.parse(r);if(n.length===0)throw new ct.JsonPointerError(r,"cannot remove the document root");let{parent:i,lastToken:a}=e.resolveParent(t,n,r);if(Array.isArray(i)){let o=e.toArrayIndex(a,i.length);if(o===void 0||o>=i.length)throw new ct.JsonPointerError(r,`array index '${a}' is out of range`);i.splice(o,1)}else{if(e.isReservedToken(a))throw new ct.JsonPointerError(r,`refusing to remove reserved property '${a}'`);delete i[a]}}static add(t,r,n,i){let a=e.parse(r);if(a.length>0&&a[a.length-1]==="-"){let l=e.compile(a.slice(0,-1)),u=e.resolve(t,l);if(!Array.isArray(u))throw new ct.JsonPointerError(r,"add target must be an array");u.push(n);return}let o=e.resolve(t,r);if(!Array.isArray(o))throw new ct.JsonPointerError(r,"add target must be an array");let s=i===void 0?o.length:i;if(s<0||s>o.length)throw new ct.JsonPointerError(r,`insert index ${s} is out of range`);o.splice(s,0,n)}static parent(t){let r=e.parse(t);return r.pop(),e.compile(r)}static lastToken(t){let r=e.parse(t);return r.length===0?"":r[r.length-1]}static append(t,r){return`${t}/${e.encodeToken(String(r))}`}static resolveParent(t,r,n){let i=r[r.length-1],a=e.compile(r.slice(0,-1)),o=e.resolve(t,a);if(o===null||typeof o!="object")throw new ct.JsonPointerError(n,"parent path does not resolve to an object or array");return{parent:o,lastToken:i}}static toArrayIndex(t,r){if(t==="-")return r;if(/^(0|[1-9][0-9]*)$/.test(t))return Number(t)}};oo.JsonPointer=ao;ao.RESERVED_TOKENS=new Set(["__proto__","prototype","constructor"])});var Op=f(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.findElements=void 0;var Pp=so();function gD(e,t){let r=[];return Ll(e,"",t,r),r}lo.findElements=gD;function Ll(e,t,r,n){if(!(e===null||typeof e!="object"))if(r(e,t)&&n.push({pointer:t,value:e}),Array.isArray(e))e.forEach((i,a)=>{Ll(i,Pp.JsonPointer.append(t,a),r,n)});else for(let i of Object.keys(e))Ll(e[i],Pp.JsonPointer.append(t,i),r,n)}});var Tp=f(He=>{"use strict";var vD=He&&He.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),bD=He&&He.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Rp=He&&He.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&vD(t,e,r);return bD(t,e),t};Object.defineProperty(He,"__esModule",{value:!0});He.WorkspaceManager=He.WORKSPACE_SCHEMA_VERSION=void 0;var me=Rp(require("fs")),ve=Rp(require("path")),yn=_e();He.WORKSPACE_SCHEMA_VERSION=1;var uo={form:"forms",view:"views",businessRule:"business-rules",app:"apps",command:"commands",chart:"charts",dashboard:"dashboards"},yD="manifest.json",co=".metadata",Fp="entities",Ul=class{constructor(t,r){this.workspacePath=t,this.instanceUrl=r}getRoot(){return this.workspacePath}getArtifactDir(t){return ve.join(this.workspacePath,uo[t])}getArtifactFilePath(t,r){return this.assertSafeId(r),this.assertWithinRoot(ve.join(this.getArtifactDir(t),`${po(r)}.json`))}getMetaFilePath(t,r){return this.assertSafeId(r),this.assertWithinRoot(ve.join(this.workspacePath,co,uo[t],`${po(r)}.meta.json`))}getEntityMetaFilePath(t){return this.assertSafeId(t),this.assertWithinRoot(ve.join(this.workspacePath,co,Fp,`${t}.json`))}assertSafeId(t){if(typeof t!="string"||t.length===0||/[\u0000-\u001f]/.test(t)||t.includes("/")||t.includes("\\")||t.includes(":")||t==="."||t===".."||t.includes("..")||ve.basename(t)!==t)throw new yn.PathTraversalError(String(t),this.workspacePath)}assertWithinRoot(t){let r=ve.resolve(this.workspacePath),n=ve.resolve(t);if(n!==r&&!n.startsWith(r+ve.sep))throw new yn.PathTraversalError(t,this.workspacePath);let i=me.existsSync(r)?me.realpathSync(r):r,a=n,o=[];for(;!me.existsSync(a);){o.unshift(ve.basename(a));let l=ve.dirname(a);if(l===a)break;a=l}let s=ve.resolve(me.realpathSync(a),...o);if(s!==i&&!s.startsWith(i+ve.sep))throw new yn.PathTraversalError(t,this.workspacePath);return n}get manifestPath(){return ve.join(this.workspacePath,yD)}init(){for(let t of Object.keys(uo))me.mkdirSync(this.getArtifactDir(t),{recursive:!0}),me.mkdirSync(ve.dirname(this.getMetaFilePath(t,"x")),{recursive:!0});if(me.mkdirSync(ve.join(this.workspacePath,co,Fp),{recursive:!0}),!this.exists(this.manifestPath)){let t={instanceUrl:this.instanceUrl,createdAt:new Date().toISOString(),artifacts:[]};this.writeManifest(t)}}isInitialized(){return this.exists(this.manifestPath)}ensureInitialized(){if(!this.isInitialized())throw new yn.WorkspaceNotInitializedError(this.workspacePath)}clean(){for(let r of Object.keys(uo))Ml(this.getArtifactDir(r));Ml(ve.join(this.workspacePath,co));let t=this.getManifest();t.artifacts=[],t.lastSyncAt=void 0,this.init(),this.writeManifest(t)}readArtifact(t,r){return this.ensureInitialized(),this.readJson(this.getArtifactFilePath(t,r))}writeArtifact(t,r,n){this.ensureInitialized(),this.writeJson(this.getArtifactFilePath(t,r),n),this.upsertManifestEntry(t,r,n)}deleteArtifact(t,r){this.ensureInitialized(),this.removeFile(this.getArtifactFilePath(t,r)),this.removeFile(this.getMetaFilePath(t,r));let n=po(r),i=this.getManifest();i.artifacts=i.artifacts.filter(a=>!(a.type===t&&a.id===n)),this.writeManifest(i)}listArtifacts(t,r){return this.ensureInitialized(),this.getManifest().artifacts.filter(n=>!(t&&n.type!==t||r?.entityLogicalName&&n.entityLogicalName!==r.entityLogicalName))}readEntityMetadata(t){return this.ensureInitialized(),this.readJson(this.getEntityMetaFilePath(t))}writeEntityMetadata(t,r){this.ensureInitialized(),this.writeJson(this.getEntityMetaFilePath(t),r)}getManifest(){this.ensureInitialized();let t=this.readJson(this.manifestPath);if(!t)throw new yn.WorkspaceNotInitializedError(this.workspacePath);if(t.schemaVersion!==void 0&&t.schemaVersion>He.WORKSPACE_SCHEMA_VERSION)throw new yn.IncompatibleWorkspaceError(t.schemaVersion,He.WORKSPACE_SCHEMA_VERSION);return t}writeManifest(t){this.writeJson(this.manifestPath,{...t,schemaVersion:He.WORKSPACE_SCHEMA_VERSION})}updateManifest(t){let r=this.getManifest();this.writeManifest({...r,...t})}upsertManifestEntry(t,r,n){let i=this.getManifest(),a=po(r),o=n,s=typeof o.name=="string"?o.name:`${t}:${a}`,l=typeof o.entityLogicalName=="string"?o.entityLogicalName:void 0,u=i.artifacts.find(c=>c.type===t&&c.id===a);u?(u.name=s,u.entityLogicalName=l):i.artifacts.push({type:t,id:a,name:s,entityLogicalName:l,isDirty:!1}),this.writeManifest(i)}readJson(t){return this.exists(t)?JSON.parse(me.readFileSync(t,"utf8")):null}writeJson(t,r){let n=ve.dirname(t);me.mkdirSync(n,{recursive:!0});let i=ve.join(n,`.${ve.basename(t)}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);try{me.writeFileSync(i,`${JSON.stringify(r,null,2)}-`,"utf8"),me.renameSync(i,t)}catch(a){try{me.existsSync(i)&&me.unlinkSync(i)}catch{}throw a}}removeFile(t){this.exists(t)&&me.unlinkSync(t)}exists(t){return me.existsSync(t)}};He.WorkspaceManager=Ul;function po(e){let r=/^\{?([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\}?$/.exec(e);return r?r[1].toLowerCase():e.toLowerCase()}function Ml(e){let t;try{t=me.lstatSync(e)}catch{return}if(t.isSymbolicLink()){try{me.unlinkSync(e)}catch{me.rmdirSync(e)}return}if(!t.isDirectory()){me.unlinkSync(e);return}for(let r of me.readdirSync(e))Ml(ve.join(e,r));me.rmdirSync(e)}});var Bp=f(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.deepEqual=Cn.deepDiff=void 0;var CD=so();function AD(e,t){let r=[];return Lp(e,t,"",r,0),r}Cn.deepDiff=AD;var fo=Symbol("missing"),mo=512;function Lp(e,t,r,n,i){if(e===t)return;if(i>mo)throw new RangeError(`deepDiff exceeded the maximum supported depth of ${mo}`);let a=ho(e),o=ho(t);if(a&&o&&Array.isArray(e)===Array.isArray(t)){let s=ND(e,t);for(let l of s){let u=xp(e,l),c=xp(t,l),p=CD.JsonPointer.append(r,l);u===fo?n.push({pointer:p,type:"added",newValue:c}):c===fo?n.push({pointer:p,type:"removed",oldValue:u}):Lp(u,c,p,n,i+1)}return}Up(e,t)||n.push({pointer:r,type:"modified",oldValue:e,newValue:t})}function ho(e){return e!==null&&typeof e=="object"}function ND(e,t){if(Array.isArray(e)&&Array.isArray(t)){let n=Math.max(e.length,t.length),i=[];for(let a=0;a<n;a++)i.push(String(a));return i}let r=new Set([...Object.keys(e),...Object.keys(t)]);return Array.from(r)}function xp(e,t){if(Array.isArray(e)){let r=Number(t);return r<e.length?e[r]:fo}return t in e?e[t]:fo}function Up(e,t){return Mp(e,t,0)}Cn.deepEqual=Up;function Mp(e,t,r){if(e===t)return!0;if(r>mo)throw new RangeError(`deepEqual exceeded the maximum supported depth of ${mo}`);if(!ho(e)||!ho(t)||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),i=Object.keys(t);return n.length!==i.length?!1:n.every(a=>a in t&&Mp(e[a],t[a],r+1))}});var qp=f(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.VersionManager=void 0;var kp=Bp(),Bl=class{constructor(t){this.workspace=t}storeMeta(t,r,n){this.workspace.writeJson(this.workspace.getMetaFilePath(t,r),n)}getMeta(t,r){return this.workspace.readJson(this.workspace.getMetaFilePath(t,r))}isDirty(t,r){let n=this.workspace.readArtifact(t,r);if(n===null)return!1;let i=this.getMeta(t,r);return i?!(0,kp.deepEqual)(i.snapshot,n):!0}diff(t,r){let n=this.workspace.readArtifact(t,r),i=this.getMeta(t,r),a;return n===null?a=i?[{pointer:"",type:"removed",oldValue:i.snapshot}]:[]:i?a=(0,kp.deepDiff)(i.snapshot,n):a=[{pointer:"",type:"added",newValue:n}],{artifactType:t,artifactId:r,changes:a}}checkConflict(t,r,n){let i=this.getMeta(t,r);return!i||i.etag===null?!1:i.etag!==n}};go.VersionManager=Bl});var Vp=f((kl,$p)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof kl=="object"?$p.exports=t():e.compareVersions=t()})(kl,function(){var e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;function t(a,o){return a.indexOf(o)===-1?a.length:a.indexOf(o)}function r(a){var o=a.replace(/^v/,"").replace(/\+.*$/,""),s=t(o,"-"),l=o.substring(0,s).split(".");return l.push(o.substring(s+1)),l}function n(a){return isNaN(Number(a))?a:Number(a)}function i(a){if(typeof a!="string")throw new TypeError("Invalid argument expected string");if(!e.test(a))throw new Error("Invalid argument not valid semver ('"+a+"' received)")}return function(o,s){[o,s].forEach(i);for(var l=r(o),u=r(s),c=0;c<Math.max(l.length-1,u.length-1);c++){var p=parseInt(l[c]||0,10),m=parseInt(u[c]||0,10);if(p>m)return 1;if(m>p)return-1}var v=l[l.length-1],C=u[u.length-1];if(v&&C){var w=v.split(".").map(n),P=C.split(".").map(n);for(c=0;c<Math.max(w.length,P.length);c++){if(w[c]===void 0||typeof P[c]=="string"&&typeof w[c]=="number")return-1;if(P[c]===void 0||typeof w[c]=="string"&&typeof P[c]=="number"||w[c]>P[c])return 1;if(P[c]>w[c])return-1}}else if(v||C)return v?-1:1;return 0}})});var Hp=f(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.EnvironmentFlowHostingType=pe.EnvironmentDisableReasonCode=pe.EnvironmentMigrationConstants=pe.EnvironmentProvisioningStates=pe.EnvironmentLocations=pe.EnvironmentCreationTypeConstants=pe.EnvironmentType=pe.EnvironmentSkuConstants=pe.environmentPermissions=pe.DatabaseType=void 0;var Gp;(function(e){e.CommonDataService="CommonDataService",e.None="None"})(Gp||(pe.DatabaseType=Gp={}));pe.environmentPermissions={CreatePowerApp:"CreatePowerApp",ReadEnvironment:"ReadEnvironment",GenerateResourceStorage:"GenerateResourceStorage",CreateGateway:"CreateGateway",CreateFlow:"CreateFlow",CreateCustomApi:"CreateCustomApi",AdminReadEnvironment:"AdminReadEnvironment",UpdateEnvironment:"UpdateEnvironment",DeleteEnvironment:"DeleteEnvironment",ExportEnvironmentPackage:"ExportEnvironmentPackage",SetDLPPolicy:"SetDLPPolicy",ListAnyPowerApp:"ListAnyPowerApp",ListAnyFlow:"ListAnyFlow",DeleteAnyPowerApp:"DeleteAnyPowerApp",DeleteAnyFlow:"DeleteAnyFlow",AddEnvironmentRoleAssignment:"AddEnvironmentRoleAssignment",ReadEnvironmentRoleInformation:"ReadEnvironmentRoleInformation",RemoveEnvironmentRoleAssignment:"RemoveEnvironmentRoleAssignment",ModifyDatabaseRoleAssignments:"ModifyDatabaseRoleAssignments",CreateDatabase:"CreateDatabase",ListDatabaseEntities:"ListDatabaseEntities",CreateDatabaseEntities:"CreateDatabaseEntities",UpdateDatabaseEntities:"UpdateDatabaseEntities",DeleteDatabaseEntities:"DeleteDatabaseEntities"};pe.EnvironmentSkuConstants={NotSpecified:"NotSpecified",Standard:"Standard",Premium:"Premium",Developer:"Developer",Basic:"Basic",Production:"Production",Sandbox:"Sandbox",Trial:"Trial",Default:"Default",Teams:"Teams",Platform:"Platform"};var zp;(function(e){e[e.CDS2=0]="CDS2",e[e.CDS1=1]="CDS1",e[e.Empty=2]="Empty"})(zp||(pe.EnvironmentType=zp={}));pe.EnvironmentCreationTypeConstants={NotSpecified:"NotSpecified",Legacy:"Legacy",DefaultTenant:"DefaultTenant",User:"User",CommonDataModelLegacy:"CommonDataModelLegacy"};pe.EnvironmentLocations={global:"global",unitedStates:"unitedstates",southamerica:"southamerica",europe:"europe",canada:"canada",preview:"unitedstatesfirstrelease",asia:"asia",japan:"japan",australia:"australia",india:"india",unitedkingdom:"unitedkingdom",france:"france",germany:"germany",brazil:"brazil",usgov:"usgov",usgovhigh:"usgovhigh",uae:"unitedarabemirates",switzerland:"switzerland",mooncake:"china",korea:"korea",norway:"norway",southafrica:"southafrica",dod:"usdod",singapore:"singapore",sweden:"sweden",italy:"italy",poland:"poland"};pe.EnvironmentProvisioningStates={NotSpecified:"NotSpecified",Succeeded:"Succeeded",Deleting:"Deleting",Deleted:"Deleted",FailedDeleting:"FailedDeleting",LinkedDatabaseProvisioning:"LinkedDatabaseProvisioning",LinkedDatabaseFailedProvisioning:"LinkedDatabaseFailedProvisioning",LinkedDatabaseFailedConfiguring:"LinkedDatabaseFailedConfiguring",LinkedDatabaseUnavailable:"LinkedDatabaseUnavailable",Creating:"Creating"};pe.EnvironmentMigrationConstants={phases:{completed:"Completed"}};var Wp;(function(e){e.NotSpecified="NotSpecified",e.NoValidLicense="NoValidLicense",e.SuspendedLicense="SuspendedLicense",e.TrialExpiration="TrialExpiration",e.UserRequested="UserRequested",e.InstanceStateUpdate="InstanceStateUpdated",e.InactivityThreshold="InactivityThreshold",e.OperationsInitiated="OperationsInitiated",e.EnvironmentLifecycleOperation="EnvironmentLifecycleOperation",e.TenantPolicyEvaluation="TenantPolicyEvaluation"})(Wp||(pe.EnvironmentDisableReasonCode=Wp={}));var jp;(function(e){e.LogicApps="LogicApps",e.SelfHostSingleTenant="SelfHostSingleTenant",e.SelfHostMultiTenant="SelfHostMultiTenant"})(jp||(pe.EnvironmentFlowHostingType=jp={}))});var tf=f(b=>{"use strict";var wD=b&&b.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(b,"__esModule",{value:!0});b.hasCommonDataServiceDatabase=b.getEnvironmentDiscoveryUrl=b.getEnvironmentWebApiUrl=b.getEnvironmentInstanceApiUrl=b.getEnvironmentLanguageCode=b.getEnvironmentUpdateCadence=b.checkVersions=b.isCds2EnvironmentVersionAtLeast=b.getSecurityOrConnectedGroupId=b.hasSecurityGroupId=b.doesCds2VersionSupportApiVersion9_1=b.doesCds2EnvironmentSupportApiVersion9_1=b.cdsVersionSupportingOSColorEdit=b.getEnvironmentDisplayName=b.getEnvironmentName=b.isEnvironmentInFirstReleaseCluster=b.isEnvironmentInPreprodCluster=b.isEnvironmentInTestCluster=b.isLiteEnvironmentUpgrading=b.isEnvironmentExpired=b.isEnvironmentInDeletedState=b.isEnvironmentInCreatingState=b.isDatabaseInProvisioningState=b.canUserCreateDatabase=b.isDisabledEnvironment=b.isDefaultEnvironment=b.isTrialEnvironment=b.isPlatformEnvironment=b.isTeamsEnvironment=b.isSandboxEnvironment=b.isProdEnvironment=b.isDevEnvironment=b.getEnvironmentType=b.getCrmInstanceName=b.getCrmInstanceUrl=b.getCrmAppDesignerUrl=b.getDevResourcesUrl=b.isEnvironmentInSuccessfulState=b.getAllThemesUrl=b.getAllPublishersUrl=b.getAllSolutionsUrl=b.getSecurityRolesUrl=b.getSecurityUsersUrl=b.environmentHasCds2Database=b.DEFAULT_SOLUTION_UNIQUE_NAME=b.DEFAULT_SOLUTION_ID=b.crmBapSolutionId=b.doesUserHavePermission=b.getLinkedEnvironmentMetadata=b.getCrmVersion=void 0;b.doesUserHaveFlowRunOnlyPermission=b.isUserPautoMakerWithoutDataAccess=b.isUserPautoMakerWithDataAccess=b.doesUserHaveCreateFlowPermission=b.equalsIgnoreCase=b.doesUserHaveCreateDatabasePermission=b.doesUserHaveDatabaseTablePermissions=b.isUserMakerWithoutDataAccess=b.isUserMakerWithDataAccess=b.doesUserHaveCreateAppPermission=b.doesUserHaveAdminPermission=void 0;var SD=wD(Vp()),Z=Hp(),Ii=$l();function DD(e){let t=rr(e);return t&&t.version}b.getCrmVersion=DD;function rr(e){return e&&e.properties&&e.properties.linkedEnvironmentMetadata}b.getLinkedEnvironmentMetadata=rr;function tr(e,t){return e?!!e[t]:!1}b.doesUserHavePermission=tr;b.crmBapSolutionId="00000001-0000-0000-0001-00000000009b";b.DEFAULT_SOLUTION_ID="fd140aaf-4df4-11dd-bd17-0019b9312238";b.DEFAULT_SOLUTION_UNIQUE_NAME="Default";function zr(e){return!!rr(e)&&Jp(e)}b.environmentHasCds2Database=zr;function ED(e){if(e&&zr(e)){let t=Sr(e);return(0,Ii.getCrmAdminSecurityRolesUrl)(t)}return""}b.getSecurityUsersUrl=ED;function ID(e){if(e&&zr(e)){let t=Sr(e);return(0,Ii.getCrmAdminSecurityUsersUrl)(t)}return""}b.getSecurityRolesUrl=ID;function _D(e){if(e&&zr(e)){let t=Sr(e);(0,Ii.getCrmAllSolutionsUrl)(t)}return""}b.getAllSolutionsUrl=_D;function PD(e){if(e&&zr(e)){let t=Sr(e);return(0,Ii.getCrmAllPublishersUrl)(t)}return""}b.getAllPublishersUrl=PD;function OD(e){return e&&zr(e)?Sr(e):""}b.getAllThemesUrl=OD;function Jp(e){return!!e&&e.properties&&!!e.properties.provisioningState&&e.properties.provisioningState.toUpperCase()===Z.EnvironmentProvisioningStates.Succeeded.toUpperCase()}b.isEnvironmentInSuccessfulState=Jp;function FD(e){if(e&&zr(e)){let t=Sr(e);return(0,Ii.getCrmDevResourcesUrl)(t)}return""}b.getDevResourcesUrl=FD;function RD(e){return`${e}designer/app/{${b.crmBapSolutionId}}/CreateNewApp}}`}b.getCrmAppDesignerUrl=RD;function Sr(e){let t=rr(e);if(t){let r=t.instanceUrl;return r?r.endsWith("/")?r:r+"/":""}return""}b.getCrmInstanceUrl=Sr;function TD(e){let t=rr(e);return t?t.uniqueName:""}b.getCrmInstanceName=TD;function xD(e){return rr(e)?Z.EnvironmentType.CDS2:e&&e.properties&&e.properties.namespace?Z.EnvironmentType.CDS1:Z.EnvironmentType.Empty}b.getEnvironmentType=xD;function LD(e){return e&&e.properties&&e.properties.environmentSku===Z.EnvironmentSkuConstants.Developer}b.isDevEnvironment=LD;function UD(e){return e&&e.properties&&e.properties.environmentSku===Z.EnvironmentSkuConstants.Production}b.isProdEnvironment=UD;function MD(e){return e&&e.properties&&e.properties.environmentSku===Z.EnvironmentSkuConstants.Sandbox}b.isSandboxEnvironment=MD;function _i(e){return e&&e.properties&&e.properties.environmentSku===Z.EnvironmentSkuConstants.Teams}b.isTeamsEnvironment=_i;function BD(e){return e&&e.properties&&e.properties.environmentSku===Z.EnvironmentSkuConstants.Platform}b.isPlatformEnvironment=BD;var kD=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.environmentSku)===Z.EnvironmentSkuConstants.Trial};b.isTrialEnvironment=kD;function qD(e){return e&&e.properties&&(e.properties.isDefault||e.properties.creationType===Z.EnvironmentCreationTypeConstants.DefaultTenant)}b.isDefaultEnvironment=qD;function $D(e){return e&&e.properties&&!!e.properties.states&&!!e.properties.states.runtime&&e.properties.states.runtime.id==="Disabled"}b.isDisabledEnvironment=$D;function VD(e){return e&&e.properties&&tr(e.properties.permissions,Z.environmentPermissions.CreateDatabase)}b.canUserCreateDatabase=VD;function GD(e){return!!(e&&e.properties&&e.properties.provisioningState&&ef(e.properties.provisioningState,Z.EnvironmentProvisioningStates.LinkedDatabaseProvisioning))}b.isDatabaseInProvisioningState=GD;function zD(e){return!!e&&!!e.properties&&e.properties.provisioningState===Z.EnvironmentProvisioningStates.Creating}b.isEnvironmentInCreatingState=zD;function WD(e){return e&&e.properties&&(e.properties.provisioningState===Z.EnvironmentProvisioningStates.Deleted||e.properties.provisioningState===Z.EnvironmentProvisioningStates.Deleting||e.properties.provisioningState===Z.EnvironmentProvisioningStates.FailedDeleting)}b.isEnvironmentInDeletedState=WD;function jD(e){return!!e&&!!e.properties&&!!e.properties.expirationTime&&Date.parse(e.properties.expirationTime)<Date.now()}b.isEnvironmentExpired=jD;function HD(e){return!!e&&!!e.properties&&!!e.properties.linkedEnvironmentMetadata&&e.properties.linkedEnvironmentMetadata.platformSku==="Lite"&&!!e.properties.states&&!!e.properties.states.management&&e.properties.states.management.id==="Running"&&!!e.properties.ongoingOperation&&!!e.properties.ongoingOperation.type&&e.properties.ongoingOperation.type.id==="Promote"}b.isLiteEnvironmentUpgrading=HD;function JD(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Test"}b.isEnvironmentInTestCluster=JD;function QD(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Preprod"}b.isEnvironmentInPreprodCluster=QD;function XD(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="FirstRelease"}b.isEnvironmentInFirstReleaseCluster=XD;function KD(e){return e&&e.name||""}b.getEnvironmentName=KD;function YD(e){return e&&e.properties&&e.properties.displayName||""}b.getEnvironmentDisplayName=YD;var Qp="9.1.0.8202";b.cdsVersionSupportingOSColorEdit="9.1.0000.20708";function ZD(e){return Yp(e,Qp)}b.doesCds2EnvironmentSupportApiVersion9_1=ZD;function eE(e){return ql(e,Qp)}b.doesCds2VersionSupportApiVersion9_1=eE;function Xp(e){let t=rr(e);if(t)return t.securityGroupId}function Kp(e){return e&&e.properties&&e.properties.connectedGroups}function tE(e,t){let r=Kp(e);return!!r&&!!r.find(n=>n.id===t)||Xp(e)===t}b.hasSecurityGroupId=tE;function rE(e){let t=Kp(e);return t&&t.length>0&&t[0].id?t[0].id:Xp(e)}b.getSecurityOrConnectedGroupId=rE;function Yp(e,t){let r=e.version;return r?ql(r,t):!1}b.isCds2EnvironmentVersionAtLeast=Yp;function ql(e,t){return t?e?(0,SD.default)(e,t)>=0:!1:!0}b.checkVersions=ql;function nE(e){return e&&e.properties&&e.properties.updateCadence&&e.properties.updateCadence.id||"NotSpecified"}b.getEnvironmentUpdateCadence=nE;function iE(e){let t=rr(e);return t?Number(t.baseLanguage):0}b.getEnvironmentLanguageCode=iE;function Zp(e){let t=rr(e);return t?t.instanceApiUrl:void 0}b.getEnvironmentInstanceApiUrl=Zp;function aE(e){let t=Zp(e);return t?t+"/api/data/v9.2":""}b.getEnvironmentWebApiUrl=aE;function oE(e){let t=Sr(e);if(t==="")return"";let r=t.split("/");if(r.length!==4)return"";let n=r[2].split(".");return n[0]="globaldisco",r[2]=n.join("."),r.join("/")+"api/discovery/v2.0/Instances"}b.getEnvironmentDiscoveryUrl=oE;var sE=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.databaseType)===Z.DatabaseType.CommonDataService};b.hasCommonDataServiceDatabase=sE;var lE=e=>{var t;return tr((t=e.properties)===null||t===void 0?void 0:t.permissions,Z.environmentPermissions.AdminReadEnvironment)};b.doesUserHaveAdminPermission=lE;var uE=e=>{var t;return tr((t=e.properties)===null||t===void 0?void 0:t.permissions,Z.environmentPermissions.CreatePowerApp)};b.doesUserHaveCreateAppPermission=uE;var cE=e=>(0,b.doesUserHaveAdminPermission)(e)&&(0,b.hasCommonDataServiceDatabase)(e)?!0:(0,b.doesUserHaveCreateAppPermission)(e)?_i(e)||(0,b.doesUserHaveDatabaseTablePermissions)(e):!1;b.isUserMakerWithDataAccess=cE;var dE=e=>(0,b.doesUserHaveCreateAppPermission)(e)&&!_i(e)&&!(0,b.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,b.doesUserHaveAdminPermission)(e)||!(0,b.hasCommonDataServiceDatabase)(e));b.isUserMakerWithoutDataAccess=dE;var pE=e=>[Z.environmentPermissions.CreateDatabaseEntities,Z.environmentPermissions.ListDatabaseEntities,Z.environmentPermissions.UpdateDatabaseEntities,Z.environmentPermissions.DeleteDatabaseEntities].every(t=>{var r;return tr((r=e.properties)===null||r===void 0?void 0:r.permissions,t)});b.doesUserHaveDatabaseTablePermissions=pE;var fE=e=>{var t;return tr((t=e.properties)===null||t===void 0?void 0:t.permissions,Z.environmentPermissions.CreateDatabase)};b.doesUserHaveCreateDatabasePermission=fE;function ef(e,t){return!e&&!t?!0:!e||!t?!1:e.toUpperCase()===t.toUpperCase()}b.equalsIgnoreCase=ef;var mE=e=>{var t;return tr((t=e.properties)===null||t===void 0?void 0:t.permissions,Z.environmentPermissions.CreateFlow)};b.doesUserHaveCreateFlowPermission=mE;var hE=e=>(0,b.doesUserHaveAdminPermission)(e)&&(0,b.hasCommonDataServiceDatabase)(e)?!0:(0,b.doesUserHaveCreateFlowPermission)(e)?_i(e)||(0,b.doesUserHaveDatabaseTablePermissions)(e):!1;b.isUserPautoMakerWithDataAccess=hE;var gE=e=>(0,b.doesUserHaveCreateFlowPermission)(e)&&!_i(e)&&!(0,b.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,b.doesUserHaveAdminPermission)(e)||!(0,b.hasCommonDataServiceDatabase)(e));b.isUserPautoMakerWithoutDataAccess=gE;var vE=e=>{var t,r;return!tr((t=e.properties)===null||t===void 0?void 0:t.permissions,Z.environmentPermissions.CreateFlow)&&tr((r=e.properties)===null||r===void 0?void 0:r.permissions,Z.environmentPermissions.ReadEnvironment)};b.doesUserHaveFlowRunOnlyPermission=vE});var $l=f(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.getRequiredComponentsQueryUrl=g.solutionComponentCountSummariesQueryUrl=g.solutionComponentSummariesQueryUrl=g.solutionComponentConfigurationsQueryUrl=g.chartsQueryUrl=g.workflowsQueryUrl=g.entityDefinitionsQueryUrl=g.solutionComponentDefinitionsQueryUrl=g.getCreateNewArticleTemplateUrl=g.getCreateNewPublisherUrl=g.getEnableSecurityRolesUrl=g.getArticleTemplateUrl=g.getFieldSecurityProfileDesignerUrl=g.getSecurityRoleDesignerUrl=g.getMailMergeTemplateDesignerUrl=g.getEmailTemplateDesignerUrl=g.getConnectionRoleDesignerUrl=g.getSiteMapDesignerUrl=g.getWebResourceFileUrl=g.getWebResourceDesignerUrl=g.getReportDesignerUrl=g.getBusinessProcessFlowDesignerUrl=g.getProcessShareUrl=g.getProcessDesignerUrl=g.getChartDesignerUrl=g.getOpenModernEntityDashboardUrl=g.getNewModernEntityDashboardUrl=g.getNewModernDashboardUrl=g.getOpenModernDashboardUrl=g.getDashboardDesignerUrl=g.getAppModuleDesignerUrl=g.privilegesQueryUrls=g.xrmApiUrl=g.getPlayAppModuleUrl=g.getCrmAdminSecurityUsersUrl=g.getCrmAdminSecurityRolesUrl=g.getCrmMyAppsUrl=g.getCrmAppDesignerUrl=g.getCrmDevResourcesUrl=g.getCrmAllPublishersUrl=g.getCrmAllSolutionsUrl=g.getSolutionPublisherUrl=g.getExportTranslationFileName=g.getExportSolutionTranslationUrl=g.getImportSolutionTranslationUrl=g.getShowSolutionDependenciesUrl=g.getShowComponentDependenciesUrl=g.cdsServiceUrl=g.ODATA_NEXT_LINK=g.ODATA_MAX_PAGE_SIZE=void 0;g.retrieveOrganizationResources=g.getUCIEntityRecordEditUrl=g.getUCIEntityRecordBaseUrl=g.getBusinessRuleDesignerUri=g.retrieveUnpublishedSuffix=g.getSavePowerSettingUri=g.getPowerSettingUri=g.getPowerSettingsUri=g.RetrievePlatform=g.getAppSettingOverrideUri=g.AppSettingOverrideName=g.getOrgSettingOverrideUri=g.OrgSettingOverrideName=g.getSettingDefinitionsUri=g.retrieveFeatureControlSettingsByNamespaceUrl=g.retrieveDeploymentPipelineConfigAppUrl=g.SPNPrincipalIdUrl=g.retrieveDeploymentEnvironmentInfoUrl=g.devSolutionInfoUrl=g.deployOperationStatusUrl=g.getAIGeneratedDeploymentNotesUrl=g.deploymentStageRunUrl=g.validatePackageAsyncUrl=g.deployPackageAsyncUrl=g.updateDeploymentStageRunUrl=g.createDeploymentStageRunUrl=g.retrieveDeploymentStagesUrl=g.retrievePipelinesUrl=g.retrieveDeploymentPipelineInfoUrl=g.getDeploymentStageRunsUrl=g.appDeploymentUrls=g.getProvisionLanguageUrl=g.getSolutionQueryUrl=g.getSolutionsByUniqueNameQueryUrl=g.solutionsQueryUrl=g.getDependentComponentsWithMetadataQueryUrl=void 0;var rf=tf();g.ODATA_MAX_PAGE_SIZE="odata.maxpagesize";g.ODATA_NEXT_LINK="@odata.nextLink";g.cdsServiceUrl="https://cds-org/";var Oi;(function(e){e.AllSolutions="11",e.AllPublishers="10",e.DevResources="05"})(Oi||(Oi={}));function bE(e,t,r,n){return`${e}tools/dependency/dependencyviewdialog.aspx?appSolutionId=%7b${t}%7d&dType=1&objectid=%7b${r}%7d&objecttype=${n}&operationtype=showdependency`}g.getShowComponentDependenciesUrl=bE;function yE(e,t){let r=`dType=1&isproactivecheck=true&objecttype=7100&operationtype=dependenciesforuninstall&objectid=${t}`;return`${e}tools/dependency/dependencyviewdialog.aspx?${r}`}g.getShowSolutionDependenciesUrl=yE;function CE(e,t){return`${e}tools/muiProvisioning/Dialogs/LangTranslationsImport.aspx?dType=1&appSolutionId=${t}`}g.getImportSolutionTranslationUrl=CE;function AE(e,t){return`${e}_grid/cmds/dlg_exportsolution.aspx?command=exporttranslation&appSolutionId=${t}`}g.getExportSolutionTranslationUrl=AE;function NE(e,t){return e!==void 0&&t!==void 0&&`CrmTranslations_${e}_${t.replace(/[.]/g,"_")}.zip`||""}g.getExportTranslationFileName=NE;function wE(e,t,r){return r?`${e}tools/publisher/edit.aspx?appSolutionId=%7b${r}%7d&id=%7b${t}%7d`:`${e}tools/publisher/edit.aspx?id=%7b${t}%7d`}g.getSolutionPublisherUrl=wE;function Vl(e,t){return`${e}tools/systemcustomization/systemCustomization.aspx?pid=${t}`}function SE(e){return Vl(e,Oi.AllSolutions)}g.getCrmAllSolutionsUrl=SE;function DE(e){return Vl(e,Oi.AllPublishers)}g.getCrmAllPublishersUrl=DE;function EE(e){return Vl(e,Oi.DevResources)}g.getCrmDevResourcesUrl=EE;function IE(e,t=rf.crmBapSolutionId){return`${e}designer/app/${t}#/CreateNewApp`}g.getCrmAppDesignerUrl=IE;function _E(e){return`${e}apps`}g.getCrmMyAppsUrl=_E;function PE(e){return nf(e,"role")+"&forceUCI=0"}g.getCrmAdminSecurityRolesUrl=PE;function OE(e){return`${nf(e,"systemuser")}&forceclassic=1`}g.getCrmAdminSecurityUsersUrl=OE;function nf(e,t){return`${e}main.aspx?pagetype=entitylist&etn=${t}`}function FE(e,t){return`${e}main.aspx?appid=${t}`}g.getPlayAppModuleUrl=FE;g.xrmApiUrl="api/data/v9.0";g.privilegesQueryUrls={systemUserInfo:e=>`${e}${g.xrmApiUrl}/WhoAmI`,userPrivileges:(e,t)=>`${e}${g.xrmApiUrl}/systemusers(${t})/Microsoft.Dynamics.CRM.RetrieveUserPrivileges`,systemPrivileges:e=>`${e}${g.xrmApiUrl}/privileges/Microsoft.Dynamics.CRM.RetrievePrivilegeSet`};function RE(e,t,r=rf.crmBapSolutionId){return`${e}designer/app/${r}/${t}/AppDesignerCanvas/${t}`}g.getAppModuleDesignerUrl=RE;function TE(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${r}%7d&extraqs=%26formId%3d%7b${t}%7d%26dashboardType%3d1030&pagetype=${`${n?"ic":""}dashboardeditor`}`}g.getDashboardDesignerUrl=TE;function xE(e,t,r){return`/e/${e}/s/${t}/dashboard/${r}`}g.getOpenModernDashboardUrl=xE;function LE(e,t,r){let n=r!==void 0?r.toString():void 0;return`/e/${e}/s/${t}/dashboard/new${n?`/${n}`:""}`}g.getNewModernDashboardUrl=LE;function UE(e,t,r,n){let i=n!==void 0?n.toString():void 0;return`/e/${e}/s/${t}/n/${r}/dashboard/new${i?`/${i}`:""}`}g.getNewModernEntityDashboardUrl=UE;function ME(e,t,r,n){return`/e/${e}/s/${t}/n/${r}/dashboard/${n}`}g.getOpenModernEntityDashboardUrl=ME;function BE(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${t}%7d&extraqs=etc=${r||""}`+(n?`%26id=${n}`:"")+"&pagetype=vizdesigner"}g.getChartDesignerUrl=BE;function kE(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}g.getProcessDesignerUrl=kE;function qE(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}g.getProcessShareUrl=qE;function $E(e,t){return`${e}Tools/ProcessControl/UnifiedProcessDesigner.aspx?id=${t}`}g.getBusinessProcessFlowDesignerUrl=$E;function VE(e,t,r){return`${e}CRMReports/reportproperty.aspx?appSolutionId=%7b${r}%7d&disablePersonal=true&id=%7b${t}%7d`}g.getReportDesignerUrl=VE;function GE(e,t,r){return`${e}main.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&etc=9333&id=%7b${t}%7d&pagetype=webresourceedit`}g.getWebResourceDesignerUrl=GE;function zE(e,t){return`${e}WebResources/${t}`}g.getWebResourceFileUrl=zE;function WE(e,t,r){return`${e}designer/sitemap/${r}/${t}/SiteMapHome/${t}`}g.getSiteMapDesignerUrl=WE;function jE(e,t,r){return`${e}connections/connectionroles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}g.getConnectionRoleDesignerUrl=jE;function HE(e,t,r){return`${e}tools/emailtemplateeditor/emailtemplateeditor.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}g.getEmailTemplateDesignerUrl=HE;function JE(e,t,r){return`${e}tools/mailmerge/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}g.getMailMergeTemplateDesignerUrl=JE;function QE(e,t,r){return`${e}biz/roles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}g.getSecurityRoleDesignerUrl=QE;function XE(e,t,r){return`${e}biz/fieldsecurityprofiles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}g.getFieldSecurityProfileDesignerUrl=XE;function KE(e,t,r){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?_CreateFromId=%7b${t}%7d&_CreateFromType=7100&appSolutionId=%7b${t}%7d&id=%7b${r}%7d`}g.getArticleTemplateUrl=KE;function YE(e,t,r,n){return`${e}tools/FormEditor/Dialogs/FormRoleAssignment.aspx?appSolutionId=%7b${t}%7d&dType=1&formId=%7b${r}%7d&objectTypeCode=0&type=${n}`}g.getEnableSecurityRolesUrl=YE;function ZE(e){return`${e}tools/publisher/edit.aspx`}g.getCreateNewPublisherUrl=ZE;function eI(e,t){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?appSolutionId=${t}`}g.getCreateNewArticleTemplateUrl=eI;g.solutionComponentDefinitionsQueryUrl="api/data/v9.0/solutioncomponentdefinitions";g.entityDefinitionsQueryUrl="api/data/v9.0/EntityDefinitions?$select=EntitySetName,DisplayName,LogicalName&$filter=";g.workflowsQueryUrl="api/data/v9.0/workflows";g.chartsQueryUrl="/api/data/v9.0/savedqueryvisualizations";g.solutionComponentConfigurationsQueryUrl="/api/data/v9.1/solutioncomponentconfigurations?$filter=isdisplayable eq true&$select=name";g.solutionComponentSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentsummaries";g.solutionComponentCountSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentcountsummaries";function tI(e,t){return`${g.xrmApiUrl}/RetrieveRequiredComponents(ObjectId=${e},ComponentType=${t})`}g.getRequiredComponentsQueryUrl=tI;function rI(e,t){return`${g.cdsServiceUrl}${g.xrmApiUrl}/RetrieveDependentComponentsWithMetadata(ObjectId=${e},ComponentType=${t})`}g.getDependentComponentsWithMetadataQueryUrl=rI;g.solutionsQueryUrl="/api/data/v9.0/solutions?$expand=publisherid&$filter=(isvisible eq true)";function nI(e){return`/api/data/v9.0/solutions?$expand=publisherid&$filter=(uniquename eq '${e}')`}g.getSolutionsByUniqueNameQueryUrl=nI;function iI(e){return`/api/data/v9.0/solutions(${e})?$expand=publisherid`}g.getSolutionQueryUrl=iI;function aI(e){return`${e}api/data/v9.1/ProvisionLanguageForUser`}g.getProvisionLanguageUrl=aI;g.appDeploymentUrls={associateEnvironmentToPipelineUrl:e=>`/api/data/v9.0/deploymentpipelines(${e})/deploymentpipeline_deploymentenvironment/$ref`,deploymentArtifactsUrl:"/api/data/v9.0/deploymentartifacts",deploymentEnvironmentUrl:"/api/data/v9.0/deploymentenvironments",deploymentPipelinesUrl:"/api/data/v9.0/deploymentpipelines",deploymentStagesUrl:"/api/data/v9.0/deploymentstages",retrieveDeploymentPipelinesUrl:e=>`/api/data/v9.0/RetrieveDeploymentPipelines(SourceEnvironmentId='${e}')`,deletePipelinesUrl:e=>`/api/data/v9.0/deploymentpipelines(${e})`};function oI(e,t,r,n=!1,i=!1,a=!1,o=!1,s=!1,l=!1,u=!1){return`/api/data/v9.1/deploymentstageruns+`)),this.type=t,this.id=r,this.issues=u,this.pointer=(o=(a=u[0])===null||a===void 0?void 0:a.pointer)!==null&&o!==void 0?o:"",this.rule=(l=(s=u[0])===null||s===void 0?void 0:s.rule)!==null&&l!==void 0?l:"invalid"}};Z.ValidationError=Ol;var Fl=class extends He{constructor(t){super("INVALID_ARGUMENT",t)}};Z.InvalidArgumentError=Fl;var Tl=class extends He{constructor(t,r,n,i){super("VERSION_CONFLICT",`Version conflict for ${t}/${r}: local=${n??"(none)"}, server=${i??"(none)"}. Re-fetch and reapply changes.`),this.type=t,this.id=r,this.localEtag=n,this.serverEtag=i}};Z.VersionConflictError=Tl;var Rl=class extends He{constructor(t,r,n,i){super("CONNECTION_ERROR",r>0?`HTTP ${r} from ${t}: ${n}`:`Transport failure reaching ${t}: ${n}`),this.url=t,this.statusCode=r,this.cause=i}};Z.ConnectionError=Rl;var xl=class extends He{constructor(t){super("WORKSPACE_NOT_INITIALIZED",`Workspace not initialized at ${t}. Call initWorkspace() first.`),this.workspacePath=t}};Z.WorkspaceNotInitializedError=xl;var Ll=class extends He{constructor(t,r){super("NOT_IMPLEMENTED",`Operation '${t}' is not implemented yet${r?`: ${r}`:""}.`),this.operation=t}};Z.NotImplementedError=Ll;var Ml=class extends He{constructor(t,r){super("INVALID_JSON_POINTER",`Invalid JSON Pointer '${t}': ${r}`),this.pointer=t}};Z.JsonPointerError=Ml;var Ul=class extends He{constructor(t,r,n){super("AMBIGUOUS_ARTIFACT",`Found ${n} ${t} rows matching '${r}'; a name is not a unique key. Resolve by id / alternate key instead of relying on name-based idempotency.`),this.kind=t,this.identity=r,this.matchCount=n}};Z.AmbiguousArtifactError=Ul;var Bl=class extends He{constructor(t,r){super("PATH_TRAVERSAL",`Refusing to resolve a path outside the workspace root: '${t}' is not within '${r}'.`),this.target=t,this.root=r}};Z.PathTraversalError=Bl;var kl=class extends He{constructor(t,r){super("INCOMPATIBLE_WORKSPACE",`Workspace schema version ${t} is newer than this SDK supports (v${r}). Upgrade the SDK, or re-create the workspace with this version.`),this.workspaceVersion=t,this.supportedVersion=r}};Z.IncompatibleWorkspaceError=kl});var lo=m(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.JsonPointer=void 0;var dt=be(),oo=class e{static isReservedToken(t){return e.RESERVED_TOKENS.has(t)}static decodeToken(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}static encodeToken(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}static parse(t){if(t==="")return[];if(t[0]!=="/")throw new dt.JsonPointerError(t,'non-empty pointers must start with "/"');return t.substring(1).split("/").map(r=>{if(/~(?![01])/.test(r))throw new dt.JsonPointerError(t,`invalid '~' escape in token '${r}' (expected ~0 or ~1)`);return e.decodeToken(r)})}static compile(t){return t.length===0?"":"/"+t.map(r=>e.encodeToken(r)).join("/")}static resolve(t,r){let n=e.parse(r),i=t;for(let a of n)if(Array.isArray(i)){let o=e.toArrayIndex(a,i.length);if(o===void 0)return;i=i[o]}else if(i!==null&&typeof i=="object"){let o=i;if(e.isReservedToken(a)||!Object.prototype.hasOwnProperty.call(o,a))return;i=o[a]}else return;return i}static set(t,r,n){let i=e.parse(r);if(i.length===0)throw new dt.JsonPointerError(r,"cannot set the document root");let{parent:a,lastToken:o}=e.resolveParent(t,i,r);if(Array.isArray(a)){let s=e.toArrayIndex(o,a.length);if(s===void 0)throw new dt.JsonPointerError(r,`'${o}' is not a valid array index`);if(s>a.length)throw new dt.JsonPointerError(r,`array index '${o}' is out of range`);a[s]=n}else{if(e.isReservedToken(o))throw new dt.JsonPointerError(r,`refusing to write reserved property '${o}'`);a[o]=n}}static remove(t,r){let n=e.parse(r);if(n.length===0)throw new dt.JsonPointerError(r,"cannot remove the document root");let{parent:i,lastToken:a}=e.resolveParent(t,n,r);if(Array.isArray(i)){let o=e.toArrayIndex(a,i.length);if(o===void 0||o>=i.length)throw new dt.JsonPointerError(r,`array index '${a}' is out of range`);i.splice(o,1)}else{if(e.isReservedToken(a))throw new dt.JsonPointerError(r,`refusing to remove reserved property '${a}'`);delete i[a]}}static add(t,r,n,i){let a=e.parse(r);if(a.length>0&&a[a.length-1]==="-"){let l=e.compile(a.slice(0,-1)),u=e.resolve(t,l);if(!Array.isArray(u))throw new dt.JsonPointerError(r,"add target must be an array");u.push(n);return}let o=e.resolve(t,r);if(!Array.isArray(o))throw new dt.JsonPointerError(r,"add target must be an array");let s=i===void 0?o.length:i;if(s<0||s>o.length)throw new dt.JsonPointerError(r,`insert index ${s} is out of range`);o.splice(s,0,n)}static parent(t){let r=e.parse(t);return r.pop(),e.compile(r)}static lastToken(t){let r=e.parse(t);return r.length===0?"":r[r.length-1]}static append(t,r){return`${t}/${e.encodeToken(String(r))}`}static resolveParent(t,r,n){let i=r[r.length-1],a=e.compile(r.slice(0,-1)),o=e.resolve(t,a);if(o===null||typeof o!="object")throw new dt.JsonPointerError(n,"parent path does not resolve to an object or array");return{parent:o,lastToken:i}}static toArrayIndex(t,r){if(t==="-")return r;if(/^(0|[1-9][0-9]*)$/.test(t))return Number(t)}};so.JsonPointer=oo;oo.RESERVED_TOKENS=new Set(["__proto__","prototype","constructor"])});var qp=m(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.findElements=void 0;var kp=lo();function RD(e,t){let r=[];return ql(e,"",t,r),r}uo.findElements=RD;function ql(e,t,r,n){if(!(e===null||typeof e!="object"))if(r(e,t)&&n.push({pointer:t,value:e}),Array.isArray(e))e.forEach((i,a)=>{ql(i,kp.JsonPointer.append(t,a),r,n)});else for(let i of Object.keys(e))ql(e[i],kp.JsonPointer.append(t,i),r,n)}});var Gp=m(Je=>{"use strict";var xD=Je&&Je.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),LD=Je&&Je.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Vp=Je&&Je.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&xD(t,e,r);return LD(t,e),t};Object.defineProperty(Je,"__esModule",{value:!0});Je.WorkspaceManager=Je.WORKSPACE_SCHEMA_VERSION=void 0;var he=Vp(require("fs")),ye=Vp(require("path")),wn=be();Je.WORKSPACE_SCHEMA_VERSION=1;var co={form:"forms",view:"views",businessRule:"business-rules",app:"apps",command:"commands",chart:"charts",dashboard:"dashboards"},MD="manifest.json",po=".metadata",$p="entities",$l=class{constructor(t,r){this.workspacePath=t,this.instanceUrl=r}getRoot(){return this.workspacePath}getArtifactDir(t){return ye.join(this.workspacePath,co[t])}getArtifactFilePath(t,r){return this.assertSafeId(r),this.assertWithinRoot(ye.join(this.getArtifactDir(t),`${fo(r)}.json`))}getMetaFilePath(t,r){return this.assertSafeId(r),this.assertWithinRoot(ye.join(this.workspacePath,po,co[t],`${fo(r)}.meta.json`))}getEntityMetaFilePath(t){return this.assertSafeId(t),this.assertWithinRoot(ye.join(this.workspacePath,po,$p,`${t}.json`))}assertSafeId(t){if(typeof t!="string"||t.length===0||/[\u0000-\u001f]/.test(t)||t.includes("/")||t.includes("\\")||t.includes(":")||t==="."||t===".."||t.includes("..")||ye.basename(t)!==t)throw new wn.PathTraversalError(String(t),this.workspacePath)}assertWithinRoot(t){let r=ye.resolve(this.workspacePath),n=ye.resolve(t);if(n!==r&&!n.startsWith(r+ye.sep))throw new wn.PathTraversalError(t,this.workspacePath);let i=he.existsSync(r)?he.realpathSync(r):r,a=n,o=[];for(;!he.existsSync(a);){o.unshift(ye.basename(a));let l=ye.dirname(a);if(l===a)break;a=l}let s=ye.resolve(he.realpathSync(a),...o);if(s!==i&&!s.startsWith(i+ye.sep))throw new wn.PathTraversalError(t,this.workspacePath);return n}get manifestPath(){return ye.join(this.workspacePath,MD)}init(){for(let t of Object.keys(co))he.mkdirSync(this.getArtifactDir(t),{recursive:!0}),he.mkdirSync(ye.dirname(this.getMetaFilePath(t,"x")),{recursive:!0});if(he.mkdirSync(ye.join(this.workspacePath,po,$p),{recursive:!0}),!this.exists(this.manifestPath)){let t={instanceUrl:this.instanceUrl,createdAt:new Date().toISOString(),artifacts:[]};this.writeManifest(t)}}isInitialized(){return this.exists(this.manifestPath)}ensureInitialized(){if(!this.isInitialized())throw new wn.WorkspaceNotInitializedError(this.workspacePath)}clean(){for(let r of Object.keys(co))Vl(this.getArtifactDir(r));Vl(ye.join(this.workspacePath,po));let t=this.getManifest();t.artifacts=[],t.lastSyncAt=void 0,this.init(),this.writeManifest(t)}readArtifact(t,r){return this.ensureInitialized(),this.readJson(this.getArtifactFilePath(t,r))}writeArtifact(t,r,n){this.ensureInitialized(),this.writeJson(this.getArtifactFilePath(t,r),n),this.upsertManifestEntry(t,r,n)}deleteArtifact(t,r){this.ensureInitialized(),this.removeFile(this.getArtifactFilePath(t,r)),this.removeFile(this.getMetaFilePath(t,r));let n=fo(r),i=this.getManifest();i.artifacts=i.artifacts.filter(a=>!(a.type===t&&a.id===n)),this.writeManifest(i)}listArtifacts(t,r){return this.ensureInitialized(),this.getManifest().artifacts.filter(n=>!(t&&n.type!==t||r?.entityLogicalName&&n.entityLogicalName!==r.entityLogicalName))}readEntityMetadata(t){this.ensureInitialized();let r=this.readJson(this.getEntityMetaFilePath(t));return!r||typeof r.schemaName!="string"||typeof r.primaryNameAttribute!="string"||typeof r.primaryIdAttribute!="string"||typeof r.isCustomEntity!="boolean"?null:r}writeEntityMetadata(t,r){this.ensureInitialized(),this.writeJson(this.getEntityMetaFilePath(t),r)}getManifest(){this.ensureInitialized();let t=this.readJson(this.manifestPath);if(!t)throw new wn.WorkspaceNotInitializedError(this.workspacePath);if(t.schemaVersion!==void 0&&t.schemaVersion>Je.WORKSPACE_SCHEMA_VERSION)throw new wn.IncompatibleWorkspaceError(t.schemaVersion,Je.WORKSPACE_SCHEMA_VERSION);return t}writeManifest(t){this.writeJson(this.manifestPath,{...t,schemaVersion:Je.WORKSPACE_SCHEMA_VERSION})}updateManifest(t){let r=this.getManifest();this.writeManifest({...r,...t})}upsertManifestEntry(t,r,n){let i=this.getManifest(),a=fo(r),o=n,s=typeof o.name=="string"?o.name:`${t}:${a}`,l=typeof o.entityLogicalName=="string"?o.entityLogicalName:void 0,u=i.artifacts.find(c=>c.type===t&&c.id===a);u?(u.name=s,u.entityLogicalName=l):i.artifacts.push({type:t,id:a,name:s,entityLogicalName:l,isDirty:!1}),this.writeManifest(i)}readJson(t){return this.exists(t)?JSON.parse(he.readFileSync(t,"utf8")):null}writeJson(t,r){let n=ye.dirname(t);he.mkdirSync(n,{recursive:!0});let i=ye.join(n,`.${ye.basename(t)}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);try{he.writeFileSync(i,`${JSON.stringify(r,null,2)}+`,"utf8"),he.renameSync(i,t)}catch(a){try{he.existsSync(i)&&he.unlinkSync(i)}catch{}throw a}}removeFile(t){this.exists(t)&&he.unlinkSync(t)}exists(t){return he.existsSync(t)}};Je.WorkspaceManager=$l;function fo(e){let r=/^\{?([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\}?$/.exec(e);return r?r[1].toLowerCase():e.toLowerCase()}function Vl(e){let t;try{t=he.lstatSync(e)}catch{return}if(t.isSymbolicLink()){try{he.unlinkSync(e)}catch{he.rmdirSync(e)}return}if(!t.isDirectory()){he.unlinkSync(e);return}for(let r of he.readdirSync(e))Vl(ye.join(e,r));he.rmdirSync(e)}});var Jp=m(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.deepEqual=Nn.deepDiff=void 0;var UD=lo();function BD(e,t){let r=[];return Wp(e,t,"",r,0),r}Nn.deepDiff=BD;var mo=Symbol("missing"),ho=512;function Wp(e,t,r,n,i){if(e===t)return;if(i>ho)throw new RangeError(`deepDiff exceeded the maximum supported depth of ${ho}`);let a=go(e),o=go(t);if(a&&o&&Array.isArray(e)===Array.isArray(t)){let s=kD(e,t);for(let l of s){let u=zp(e,l),c=zp(t,l),d=UD.JsonPointer.append(r,l);u===mo?n.push({pointer:d,type:"added",newValue:c}):c===mo?n.push({pointer:d,type:"removed",oldValue:u}):Wp(u,c,d,n,i+1)}return}jp(e,t)||n.push({pointer:r,type:"modified",oldValue:e,newValue:t})}function go(e){return e!==null&&typeof e=="object"}function kD(e,t){if(Array.isArray(e)&&Array.isArray(t)){let n=Math.max(e.length,t.length),i=[];for(let a=0;a<n;a++)i.push(String(a));return i}let r=new Set([...Object.keys(e),...Object.keys(t)]);return Array.from(r)}function zp(e,t){if(Array.isArray(e)){let r=Number(t);return r<e.length?e[r]:mo}return t in e?e[t]:mo}function jp(e,t){return Hp(e,t,0)}Nn.deepEqual=jp;function Hp(e,t,r){if(e===t)return!0;if(r>ho)throw new RangeError(`deepEqual exceeded the maximum supported depth of ${ho}`);if(!go(e)||!go(t)||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),i=Object.keys(t);return n.length!==i.length?!1:n.every(a=>a in t&&Hp(e[a],t[a],r+1))}});var Xp=m(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.VersionManager=void 0;var Qp=Jp(),Gl=class{constructor(t){this.workspace=t}storeMeta(t,r,n){this.workspace.writeJson(this.workspace.getMetaFilePath(t,r),n)}getMeta(t,r){return this.workspace.readJson(this.workspace.getMetaFilePath(t,r))}isDirty(t,r){let n=this.workspace.readArtifact(t,r);if(n===null)return!1;let i=this.getMeta(t,r);return i?!(0,Qp.deepEqual)(i.snapshot,n):!0}diff(t,r){let n=this.workspace.readArtifact(t,r),i=this.getMeta(t,r),a;return n===null?a=i?[{pointer:"",type:"removed",oldValue:i.snapshot}]:[]:i?a=(0,Qp.deepDiff)(i.snapshot,n):a=[{pointer:"",type:"added",newValue:n}],{artifactType:t,artifactId:r,changes:a}}checkConflict(t,r,n){let i=this.getMeta(t,r);return!i||i.etag===null?!1:i.etag!==n}};vo.VersionManager=Gl});var Yp=m((zl,Kp)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof zl=="object"?Kp.exports=t():e.compareVersions=t()})(zl,function(){var e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;function t(a,o){return a.indexOf(o)===-1?a.length:a.indexOf(o)}function r(a){var o=a.replace(/^v/,"").replace(/\+.*$/,""),s=t(o,"-"),l=o.substring(0,s).split(".");return l.push(o.substring(s+1)),l}function n(a){return isNaN(Number(a))?a:Number(a)}function i(a){if(typeof a!="string")throw new TypeError("Invalid argument expected string");if(!e.test(a))throw new Error("Invalid argument not valid semver ('"+a+"' received)")}return function(o,s){[o,s].forEach(i);for(var l=r(o),u=r(s),c=0;c<Math.max(l.length-1,u.length-1);c++){var d=parseInt(l[c]||0,10),f=parseInt(u[c]||0,10);if(d>f)return 1;if(f>d)return-1}var g=l[l.length-1],b=u[u.length-1];if(g&&b){var w=g.split(".").map(n),N=b.split(".").map(n);for(c=0;c<Math.max(w.length,N.length);c++){if(w[c]===void 0||typeof N[c]=="string"&&typeof w[c]=="number")return-1;if(N[c]===void 0||typeof w[c]=="string"&&typeof N[c]=="number"||w[c]>N[c])return 1;if(N[c]>w[c])return-1}}else if(g||b)return g?-1:1;return 0}})});var nf=m(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.EnvironmentFlowHostingType=fe.EnvironmentDisableReasonCode=fe.EnvironmentMigrationConstants=fe.EnvironmentProvisioningStates=fe.EnvironmentLocations=fe.EnvironmentCreationTypeConstants=fe.EnvironmentType=fe.EnvironmentSkuConstants=fe.environmentPermissions=fe.DatabaseType=void 0;var Zp;(function(e){e.CommonDataService="CommonDataService",e.None="None"})(Zp||(fe.DatabaseType=Zp={}));fe.environmentPermissions={CreatePowerApp:"CreatePowerApp",ReadEnvironment:"ReadEnvironment",GenerateResourceStorage:"GenerateResourceStorage",CreateGateway:"CreateGateway",CreateFlow:"CreateFlow",CreateCustomApi:"CreateCustomApi",AdminReadEnvironment:"AdminReadEnvironment",UpdateEnvironment:"UpdateEnvironment",DeleteEnvironment:"DeleteEnvironment",ExportEnvironmentPackage:"ExportEnvironmentPackage",SetDLPPolicy:"SetDLPPolicy",ListAnyPowerApp:"ListAnyPowerApp",ListAnyFlow:"ListAnyFlow",DeleteAnyPowerApp:"DeleteAnyPowerApp",DeleteAnyFlow:"DeleteAnyFlow",AddEnvironmentRoleAssignment:"AddEnvironmentRoleAssignment",ReadEnvironmentRoleInformation:"ReadEnvironmentRoleInformation",RemoveEnvironmentRoleAssignment:"RemoveEnvironmentRoleAssignment",ModifyDatabaseRoleAssignments:"ModifyDatabaseRoleAssignments",CreateDatabase:"CreateDatabase",ListDatabaseEntities:"ListDatabaseEntities",CreateDatabaseEntities:"CreateDatabaseEntities",UpdateDatabaseEntities:"UpdateDatabaseEntities",DeleteDatabaseEntities:"DeleteDatabaseEntities"};fe.EnvironmentSkuConstants={NotSpecified:"NotSpecified",Standard:"Standard",Premium:"Premium",Developer:"Developer",Basic:"Basic",Production:"Production",Sandbox:"Sandbox",Trial:"Trial",Default:"Default",Teams:"Teams",Platform:"Platform"};var ef;(function(e){e[e.CDS2=0]="CDS2",e[e.CDS1=1]="CDS1",e[e.Empty=2]="Empty"})(ef||(fe.EnvironmentType=ef={}));fe.EnvironmentCreationTypeConstants={NotSpecified:"NotSpecified",Legacy:"Legacy",DefaultTenant:"DefaultTenant",User:"User",CommonDataModelLegacy:"CommonDataModelLegacy"};fe.EnvironmentLocations={global:"global",unitedStates:"unitedstates",southamerica:"southamerica",europe:"europe",canada:"canada",preview:"unitedstatesfirstrelease",asia:"asia",japan:"japan",australia:"australia",india:"india",unitedkingdom:"unitedkingdom",france:"france",germany:"germany",brazil:"brazil",usgov:"usgov",usgovhigh:"usgovhigh",uae:"unitedarabemirates",switzerland:"switzerland",mooncake:"china",korea:"korea",norway:"norway",southafrica:"southafrica",dod:"usdod",singapore:"singapore",sweden:"sweden",italy:"italy",poland:"poland"};fe.EnvironmentProvisioningStates={NotSpecified:"NotSpecified",Succeeded:"Succeeded",Deleting:"Deleting",Deleted:"Deleted",FailedDeleting:"FailedDeleting",LinkedDatabaseProvisioning:"LinkedDatabaseProvisioning",LinkedDatabaseFailedProvisioning:"LinkedDatabaseFailedProvisioning",LinkedDatabaseFailedConfiguring:"LinkedDatabaseFailedConfiguring",LinkedDatabaseUnavailable:"LinkedDatabaseUnavailable",Creating:"Creating"};fe.EnvironmentMigrationConstants={phases:{completed:"Completed"}};var tf;(function(e){e.NotSpecified="NotSpecified",e.NoValidLicense="NoValidLicense",e.SuspendedLicense="SuspendedLicense",e.TrialExpiration="TrialExpiration",e.UserRequested="UserRequested",e.InstanceStateUpdate="InstanceStateUpdated",e.InactivityThreshold="InactivityThreshold",e.OperationsInitiated="OperationsInitiated",e.EnvironmentLifecycleOperation="EnvironmentLifecycleOperation",e.TenantPolicyEvaluation="TenantPolicyEvaluation"})(tf||(fe.EnvironmentDisableReasonCode=tf={}));var rf;(function(e){e.LogicApps="LogicApps",e.SelfHostSingleTenant="SelfHostSingleTenant",e.SelfHostMultiTenant="SelfHostMultiTenant"})(rf||(fe.EnvironmentFlowHostingType=rf={}))});var pf=m(y=>{"use strict";var qD=y&&y.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(y,"__esModule",{value:!0});y.hasCommonDataServiceDatabase=y.getEnvironmentDiscoveryUrl=y.getEnvironmentWebApiUrl=y.getEnvironmentInstanceApiUrl=y.getEnvironmentLanguageCode=y.getEnvironmentUpdateCadence=y.checkVersions=y.isCds2EnvironmentVersionAtLeast=y.getSecurityOrConnectedGroupId=y.hasSecurityGroupId=y.doesCds2VersionSupportApiVersion9_1=y.doesCds2EnvironmentSupportApiVersion9_1=y.cdsVersionSupportingOSColorEdit=y.getEnvironmentDisplayName=y.getEnvironmentName=y.isEnvironmentInFirstReleaseCluster=y.isEnvironmentInPreprodCluster=y.isEnvironmentInTestCluster=y.isLiteEnvironmentUpgrading=y.isEnvironmentExpired=y.isEnvironmentInDeletedState=y.isEnvironmentInCreatingState=y.isDatabaseInProvisioningState=y.canUserCreateDatabase=y.isDisabledEnvironment=y.isDefaultEnvironment=y.isTrialEnvironment=y.isPlatformEnvironment=y.isTeamsEnvironment=y.isSandboxEnvironment=y.isProdEnvironment=y.isDevEnvironment=y.getEnvironmentType=y.getCrmInstanceName=y.getCrmInstanceUrl=y.getCrmAppDesignerUrl=y.getDevResourcesUrl=y.isEnvironmentInSuccessfulState=y.getAllThemesUrl=y.getAllPublishersUrl=y.getAllSolutionsUrl=y.getSecurityRolesUrl=y.getSecurityUsersUrl=y.environmentHasCds2Database=y.DEFAULT_SOLUTION_UNIQUE_NAME=y.DEFAULT_SOLUTION_ID=y.crmBapSolutionId=y.doesUserHavePermission=y.getLinkedEnvironmentMetadata=y.getCrmVersion=void 0;y.doesUserHaveFlowRunOnlyPermission=y.isUserPautoMakerWithoutDataAccess=y.isUserPautoMakerWithDataAccess=y.doesUserHaveCreateFlowPermission=y.equalsIgnoreCase=y.doesUserHaveCreateDatabasePermission=y.doesUserHaveDatabaseTablePermissions=y.isUserMakerWithoutDataAccess=y.isUserMakerWithDataAccess=y.doesUserHaveCreateAppPermission=y.doesUserHaveAdminPermission=void 0;var $D=qD(Yp()),ee=nf(),Fi=jl();function VD(e){let t=ar(e);return t&&t.version}y.getCrmVersion=VD;function ar(e){return e&&e.properties&&e.properties.linkedEnvironmentMetadata}y.getLinkedEnvironmentMetadata=ar;function ir(e,t){return e?!!e[t]:!1}y.doesUserHavePermission=ir;y.crmBapSolutionId="00000001-0000-0000-0001-00000000009b";y.DEFAULT_SOLUTION_ID="fd140aaf-4df4-11dd-bd17-0019b9312238";y.DEFAULT_SOLUTION_UNIQUE_NAME="Default";function jr(e){return!!ar(e)&&af(e)}y.environmentHasCds2Database=jr;function GD(e){if(e&&jr(e)){let t=Ir(e);return(0,Fi.getCrmAdminSecurityRolesUrl)(t)}return""}y.getSecurityUsersUrl=GD;function zD(e){if(e&&jr(e)){let t=Ir(e);return(0,Fi.getCrmAdminSecurityUsersUrl)(t)}return""}y.getSecurityRolesUrl=zD;function WD(e){if(e&&jr(e)){let t=Ir(e);(0,Fi.getCrmAllSolutionsUrl)(t)}return""}y.getAllSolutionsUrl=WD;function jD(e){if(e&&jr(e)){let t=Ir(e);return(0,Fi.getCrmAllPublishersUrl)(t)}return""}y.getAllPublishersUrl=jD;function HD(e){return e&&jr(e)?Ir(e):""}y.getAllThemesUrl=HD;function af(e){return!!e&&e.properties&&!!e.properties.provisioningState&&e.properties.provisioningState.toUpperCase()===ee.EnvironmentProvisioningStates.Succeeded.toUpperCase()}y.isEnvironmentInSuccessfulState=af;function JD(e){if(e&&jr(e)){let t=Ir(e);return(0,Fi.getCrmDevResourcesUrl)(t)}return""}y.getDevResourcesUrl=JD;function QD(e){return`${e}designer/app/{${y.crmBapSolutionId}}/CreateNewApp}}`}y.getCrmAppDesignerUrl=QD;function Ir(e){let t=ar(e);if(t){let r=t.instanceUrl;return r?r.endsWith("/")?r:r+"/":""}return""}y.getCrmInstanceUrl=Ir;function XD(e){let t=ar(e);return t?t.uniqueName:""}y.getCrmInstanceName=XD;function KD(e){return ar(e)?ee.EnvironmentType.CDS2:e&&e.properties&&e.properties.namespace?ee.EnvironmentType.CDS1:ee.EnvironmentType.Empty}y.getEnvironmentType=KD;function YD(e){return e&&e.properties&&e.properties.environmentSku===ee.EnvironmentSkuConstants.Developer}y.isDevEnvironment=YD;function ZD(e){return e&&e.properties&&e.properties.environmentSku===ee.EnvironmentSkuConstants.Production}y.isProdEnvironment=ZD;function eE(e){return e&&e.properties&&e.properties.environmentSku===ee.EnvironmentSkuConstants.Sandbox}y.isSandboxEnvironment=eE;function Ti(e){return e&&e.properties&&e.properties.environmentSku===ee.EnvironmentSkuConstants.Teams}y.isTeamsEnvironment=Ti;function tE(e){return e&&e.properties&&e.properties.environmentSku===ee.EnvironmentSkuConstants.Platform}y.isPlatformEnvironment=tE;var rE=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.environmentSku)===ee.EnvironmentSkuConstants.Trial};y.isTrialEnvironment=rE;function nE(e){return e&&e.properties&&(e.properties.isDefault||e.properties.creationType===ee.EnvironmentCreationTypeConstants.DefaultTenant)}y.isDefaultEnvironment=nE;function iE(e){return e&&e.properties&&!!e.properties.states&&!!e.properties.states.runtime&&e.properties.states.runtime.id==="Disabled"}y.isDisabledEnvironment=iE;function aE(e){return e&&e.properties&&ir(e.properties.permissions,ee.environmentPermissions.CreateDatabase)}y.canUserCreateDatabase=aE;function oE(e){return!!(e&&e.properties&&e.properties.provisioningState&&df(e.properties.provisioningState,ee.EnvironmentProvisioningStates.LinkedDatabaseProvisioning))}y.isDatabaseInProvisioningState=oE;function sE(e){return!!e&&!!e.properties&&e.properties.provisioningState===ee.EnvironmentProvisioningStates.Creating}y.isEnvironmentInCreatingState=sE;function lE(e){return e&&e.properties&&(e.properties.provisioningState===ee.EnvironmentProvisioningStates.Deleted||e.properties.provisioningState===ee.EnvironmentProvisioningStates.Deleting||e.properties.provisioningState===ee.EnvironmentProvisioningStates.FailedDeleting)}y.isEnvironmentInDeletedState=lE;function uE(e){return!!e&&!!e.properties&&!!e.properties.expirationTime&&Date.parse(e.properties.expirationTime)<Date.now()}y.isEnvironmentExpired=uE;function cE(e){return!!e&&!!e.properties&&!!e.properties.linkedEnvironmentMetadata&&e.properties.linkedEnvironmentMetadata.platformSku==="Lite"&&!!e.properties.states&&!!e.properties.states.management&&e.properties.states.management.id==="Running"&&!!e.properties.ongoingOperation&&!!e.properties.ongoingOperation.type&&e.properties.ongoingOperation.type.id==="Promote"}y.isLiteEnvironmentUpgrading=cE;function dE(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Test"}y.isEnvironmentInTestCluster=dE;function pE(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Preprod"}y.isEnvironmentInPreprodCluster=pE;function fE(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="FirstRelease"}y.isEnvironmentInFirstReleaseCluster=fE;function mE(e){return e&&e.name||""}y.getEnvironmentName=mE;function hE(e){return e&&e.properties&&e.properties.displayName||""}y.getEnvironmentDisplayName=hE;var of="9.1.0.8202";y.cdsVersionSupportingOSColorEdit="9.1.0000.20708";function gE(e){return uf(e,of)}y.doesCds2EnvironmentSupportApiVersion9_1=gE;function vE(e){return Wl(e,of)}y.doesCds2VersionSupportApiVersion9_1=vE;function sf(e){let t=ar(e);if(t)return t.securityGroupId}function lf(e){return e&&e.properties&&e.properties.connectedGroups}function bE(e,t){let r=lf(e);return!!r&&!!r.find(n=>n.id===t)||sf(e)===t}y.hasSecurityGroupId=bE;function yE(e){let t=lf(e);return t&&t.length>0&&t[0].id?t[0].id:sf(e)}y.getSecurityOrConnectedGroupId=yE;function uf(e,t){let r=e.version;return r?Wl(r,t):!1}y.isCds2EnvironmentVersionAtLeast=uf;function Wl(e,t){return t?e?(0,$D.default)(e,t)>=0:!1:!0}y.checkVersions=Wl;function CE(e){return e&&e.properties&&e.properties.updateCadence&&e.properties.updateCadence.id||"NotSpecified"}y.getEnvironmentUpdateCadence=CE;function AE(e){let t=ar(e);return t?Number(t.baseLanguage):0}y.getEnvironmentLanguageCode=AE;function cf(e){let t=ar(e);return t?t.instanceApiUrl:void 0}y.getEnvironmentInstanceApiUrl=cf;function wE(e){let t=cf(e);return t?t+"/api/data/v9.2":""}y.getEnvironmentWebApiUrl=wE;function NE(e){let t=Ir(e);if(t==="")return"";let r=t.split("/");if(r.length!==4)return"";let n=r[2].split(".");return n[0]="globaldisco",r[2]=n.join("."),r.join("/")+"api/discovery/v2.0/Instances"}y.getEnvironmentDiscoveryUrl=NE;var SE=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.databaseType)===ee.DatabaseType.CommonDataService};y.hasCommonDataServiceDatabase=SE;var DE=e=>{var t;return ir((t=e.properties)===null||t===void 0?void 0:t.permissions,ee.environmentPermissions.AdminReadEnvironment)};y.doesUserHaveAdminPermission=DE;var EE=e=>{var t;return ir((t=e.properties)===null||t===void 0?void 0:t.permissions,ee.environmentPermissions.CreatePowerApp)};y.doesUserHaveCreateAppPermission=EE;var IE=e=>(0,y.doesUserHaveAdminPermission)(e)&&(0,y.hasCommonDataServiceDatabase)(e)?!0:(0,y.doesUserHaveCreateAppPermission)(e)?Ti(e)||(0,y.doesUserHaveDatabaseTablePermissions)(e):!1;y.isUserMakerWithDataAccess=IE;var _E=e=>(0,y.doesUserHaveCreateAppPermission)(e)&&!Ti(e)&&!(0,y.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,y.doesUserHaveAdminPermission)(e)||!(0,y.hasCommonDataServiceDatabase)(e));y.isUserMakerWithoutDataAccess=_E;var PE=e=>[ee.environmentPermissions.CreateDatabaseEntities,ee.environmentPermissions.ListDatabaseEntities,ee.environmentPermissions.UpdateDatabaseEntities,ee.environmentPermissions.DeleteDatabaseEntities].every(t=>{var r;return ir((r=e.properties)===null||r===void 0?void 0:r.permissions,t)});y.doesUserHaveDatabaseTablePermissions=PE;var OE=e=>{var t;return ir((t=e.properties)===null||t===void 0?void 0:t.permissions,ee.environmentPermissions.CreateDatabase)};y.doesUserHaveCreateDatabasePermission=OE;function df(e,t){return!e&&!t?!0:!e||!t?!1:e.toUpperCase()===t.toUpperCase()}y.equalsIgnoreCase=df;var FE=e=>{var t;return ir((t=e.properties)===null||t===void 0?void 0:t.permissions,ee.environmentPermissions.CreateFlow)};y.doesUserHaveCreateFlowPermission=FE;var TE=e=>(0,y.doesUserHaveAdminPermission)(e)&&(0,y.hasCommonDataServiceDatabase)(e)?!0:(0,y.doesUserHaveCreateFlowPermission)(e)?Ti(e)||(0,y.doesUserHaveDatabaseTablePermissions)(e):!1;y.isUserPautoMakerWithDataAccess=TE;var RE=e=>(0,y.doesUserHaveCreateFlowPermission)(e)&&!Ti(e)&&!(0,y.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,y.doesUserHaveAdminPermission)(e)||!(0,y.hasCommonDataServiceDatabase)(e));y.isUserPautoMakerWithoutDataAccess=RE;var xE=e=>{var t,r;return!ir((t=e.properties)===null||t===void 0?void 0:t.permissions,ee.environmentPermissions.CreateFlow)&&ir((r=e.properties)===null||r===void 0?void 0:r.permissions,ee.environmentPermissions.ReadEnvironment)};y.doesUserHaveFlowRunOnlyPermission=xE});var jl=m(v=>{"use strict";Object.defineProperty(v,"__esModule",{value:!0});v.getRequiredComponentsQueryUrl=v.solutionComponentCountSummariesQueryUrl=v.solutionComponentSummariesQueryUrl=v.solutionComponentConfigurationsQueryUrl=v.chartsQueryUrl=v.workflowsQueryUrl=v.entityDefinitionsQueryUrl=v.solutionComponentDefinitionsQueryUrl=v.getCreateNewArticleTemplateUrl=v.getCreateNewPublisherUrl=v.getEnableSecurityRolesUrl=v.getArticleTemplateUrl=v.getFieldSecurityProfileDesignerUrl=v.getSecurityRoleDesignerUrl=v.getMailMergeTemplateDesignerUrl=v.getEmailTemplateDesignerUrl=v.getConnectionRoleDesignerUrl=v.getSiteMapDesignerUrl=v.getWebResourceFileUrl=v.getWebResourceDesignerUrl=v.getReportDesignerUrl=v.getBusinessProcessFlowDesignerUrl=v.getProcessShareUrl=v.getProcessDesignerUrl=v.getChartDesignerUrl=v.getOpenModernEntityDashboardUrl=v.getNewModernEntityDashboardUrl=v.getNewModernDashboardUrl=v.getOpenModernDashboardUrl=v.getDashboardDesignerUrl=v.getAppModuleDesignerUrl=v.privilegesQueryUrls=v.xrmApiUrl=v.getPlayAppModuleUrl=v.getCrmAdminSecurityUsersUrl=v.getCrmAdminSecurityRolesUrl=v.getCrmMyAppsUrl=v.getCrmAppDesignerUrl=v.getCrmDevResourcesUrl=v.getCrmAllPublishersUrl=v.getCrmAllSolutionsUrl=v.getSolutionPublisherUrl=v.getExportTranslationFileName=v.getExportSolutionTranslationUrl=v.getImportSolutionTranslationUrl=v.getShowSolutionDependenciesUrl=v.getShowComponentDependenciesUrl=v.cdsServiceUrl=v.ODATA_NEXT_LINK=v.ODATA_MAX_PAGE_SIZE=void 0;v.retrieveOrganizationResources=v.getUCIEntityRecordEditUrl=v.getUCIEntityRecordBaseUrl=v.getBusinessRuleDesignerUri=v.retrieveUnpublishedSuffix=v.getSavePowerSettingUri=v.getPowerSettingUri=v.getPowerSettingsUri=v.RetrievePlatform=v.getAppSettingOverrideUri=v.AppSettingOverrideName=v.getOrgSettingOverrideUri=v.OrgSettingOverrideName=v.getSettingDefinitionsUri=v.retrieveFeatureControlSettingsByNamespaceUrl=v.retrieveDeploymentPipelineConfigAppUrl=v.SPNPrincipalIdUrl=v.retrieveDeploymentEnvironmentInfoUrl=v.devSolutionInfoUrl=v.deployOperationStatusUrl=v.getAIGeneratedDeploymentNotesUrl=v.deploymentStageRunUrl=v.validatePackageAsyncUrl=v.deployPackageAsyncUrl=v.updateDeploymentStageRunUrl=v.createDeploymentStageRunUrl=v.retrieveDeploymentStagesUrl=v.retrievePipelinesUrl=v.retrieveDeploymentPipelineInfoUrl=v.getDeploymentStageRunsUrl=v.appDeploymentUrls=v.getProvisionLanguageUrl=v.getSolutionQueryUrl=v.getSolutionsByUniqueNameQueryUrl=v.solutionsQueryUrl=v.getDependentComponentsWithMetadataQueryUrl=void 0;var ff=pf();v.ODATA_MAX_PAGE_SIZE="odata.maxpagesize";v.ODATA_NEXT_LINK="@odata.nextLink";v.cdsServiceUrl="https://cds-org/";var xi;(function(e){e.AllSolutions="11",e.AllPublishers="10",e.DevResources="05"})(xi||(xi={}));function LE(e,t,r,n){return`${e}tools/dependency/dependencyviewdialog.aspx?appSolutionId=%7b${t}%7d&dType=1&objectid=%7b${r}%7d&objecttype=${n}&operationtype=showdependency`}v.getShowComponentDependenciesUrl=LE;function ME(e,t){let r=`dType=1&isproactivecheck=true&objecttype=7100&operationtype=dependenciesforuninstall&objectid=${t}`;return`${e}tools/dependency/dependencyviewdialog.aspx?${r}`}v.getShowSolutionDependenciesUrl=ME;function UE(e,t){return`${e}tools/muiProvisioning/Dialogs/LangTranslationsImport.aspx?dType=1&appSolutionId=${t}`}v.getImportSolutionTranslationUrl=UE;function BE(e,t){return`${e}_grid/cmds/dlg_exportsolution.aspx?command=exporttranslation&appSolutionId=${t}`}v.getExportSolutionTranslationUrl=BE;function kE(e,t){return e!==void 0&&t!==void 0&&`CrmTranslations_${e}_${t.replace(/[.]/g,"_")}.zip`||""}v.getExportTranslationFileName=kE;function qE(e,t,r){return r?`${e}tools/publisher/edit.aspx?appSolutionId=%7b${r}%7d&id=%7b${t}%7d`:`${e}tools/publisher/edit.aspx?id=%7b${t}%7d`}v.getSolutionPublisherUrl=qE;function Hl(e,t){return`${e}tools/systemcustomization/systemCustomization.aspx?pid=${t}`}function $E(e){return Hl(e,xi.AllSolutions)}v.getCrmAllSolutionsUrl=$E;function VE(e){return Hl(e,xi.AllPublishers)}v.getCrmAllPublishersUrl=VE;function GE(e){return Hl(e,xi.DevResources)}v.getCrmDevResourcesUrl=GE;function zE(e,t=ff.crmBapSolutionId){return`${e}designer/app/${t}#/CreateNewApp`}v.getCrmAppDesignerUrl=zE;function WE(e){return`${e}apps`}v.getCrmMyAppsUrl=WE;function jE(e){return mf(e,"role")+"&forceUCI=0"}v.getCrmAdminSecurityRolesUrl=jE;function HE(e){return`${mf(e,"systemuser")}&forceclassic=1`}v.getCrmAdminSecurityUsersUrl=HE;function mf(e,t){return`${e}main.aspx?pagetype=entitylist&etn=${t}`}function JE(e,t){return`${e}main.aspx?appid=${t}`}v.getPlayAppModuleUrl=JE;v.xrmApiUrl="api/data/v9.0";v.privilegesQueryUrls={systemUserInfo:e=>`${e}${v.xrmApiUrl}/WhoAmI`,userPrivileges:(e,t)=>`${e}${v.xrmApiUrl}/systemusers(${t})/Microsoft.Dynamics.CRM.RetrieveUserPrivileges`,systemPrivileges:e=>`${e}${v.xrmApiUrl}/privileges/Microsoft.Dynamics.CRM.RetrievePrivilegeSet`};function QE(e,t,r=ff.crmBapSolutionId){return`${e}designer/app/${r}/${t}/AppDesignerCanvas/${t}`}v.getAppModuleDesignerUrl=QE;function XE(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${r}%7d&extraqs=%26formId%3d%7b${t}%7d%26dashboardType%3d1030&pagetype=${`${n?"ic":""}dashboardeditor`}`}v.getDashboardDesignerUrl=XE;function KE(e,t,r){return`/e/${e}/s/${t}/dashboard/${r}`}v.getOpenModernDashboardUrl=KE;function YE(e,t,r){let n=r!==void 0?r.toString():void 0;return`/e/${e}/s/${t}/dashboard/new${n?`/${n}`:""}`}v.getNewModernDashboardUrl=YE;function ZE(e,t,r,n){let i=n!==void 0?n.toString():void 0;return`/e/${e}/s/${t}/n/${r}/dashboard/new${i?`/${i}`:""}`}v.getNewModernEntityDashboardUrl=ZE;function eI(e,t,r,n){return`/e/${e}/s/${t}/n/${r}/dashboard/${n}`}v.getOpenModernEntityDashboardUrl=eI;function tI(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${t}%7d&extraqs=etc=${r||""}`+(n?`%26id=${n}`:"")+"&pagetype=vizdesigner"}v.getChartDesignerUrl=tI;function rI(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}v.getProcessDesignerUrl=rI;function nI(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}v.getProcessShareUrl=nI;function iI(e,t){return`${e}Tools/ProcessControl/UnifiedProcessDesigner.aspx?id=${t}`}v.getBusinessProcessFlowDesignerUrl=iI;function aI(e,t,r){return`${e}CRMReports/reportproperty.aspx?appSolutionId=%7b${r}%7d&disablePersonal=true&id=%7b${t}%7d`}v.getReportDesignerUrl=aI;function oI(e,t,r){return`${e}main.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&etc=9333&id=%7b${t}%7d&pagetype=webresourceedit`}v.getWebResourceDesignerUrl=oI;function sI(e,t){return`${e}WebResources/${t}`}v.getWebResourceFileUrl=sI;function lI(e,t,r){return`${e}designer/sitemap/${r}/${t}/SiteMapHome/${t}`}v.getSiteMapDesignerUrl=lI;function uI(e,t,r){return`${e}connections/connectionroles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}v.getConnectionRoleDesignerUrl=uI;function cI(e,t,r){return`${e}tools/emailtemplateeditor/emailtemplateeditor.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}v.getEmailTemplateDesignerUrl=cI;function dI(e,t,r){return`${e}tools/mailmerge/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}v.getMailMergeTemplateDesignerUrl=dI;function pI(e,t,r){return`${e}biz/roles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}v.getSecurityRoleDesignerUrl=pI;function fI(e,t,r){return`${e}biz/fieldsecurityprofiles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}v.getFieldSecurityProfileDesignerUrl=fI;function mI(e,t,r){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?_CreateFromId=%7b${t}%7d&_CreateFromType=7100&appSolutionId=%7b${t}%7d&id=%7b${r}%7d`}v.getArticleTemplateUrl=mI;function hI(e,t,r,n){return`${e}tools/FormEditor/Dialogs/FormRoleAssignment.aspx?appSolutionId=%7b${t}%7d&dType=1&formId=%7b${r}%7d&objectTypeCode=0&type=${n}`}v.getEnableSecurityRolesUrl=hI;function gI(e){return`${e}tools/publisher/edit.aspx`}v.getCreateNewPublisherUrl=gI;function vI(e,t){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?appSolutionId=${t}`}v.getCreateNewArticleTemplateUrl=vI;v.solutionComponentDefinitionsQueryUrl="api/data/v9.0/solutioncomponentdefinitions";v.entityDefinitionsQueryUrl="api/data/v9.0/EntityDefinitions?$select=EntitySetName,DisplayName,LogicalName&$filter=";v.workflowsQueryUrl="api/data/v9.0/workflows";v.chartsQueryUrl="/api/data/v9.0/savedqueryvisualizations";v.solutionComponentConfigurationsQueryUrl="/api/data/v9.1/solutioncomponentconfigurations?$filter=isdisplayable eq true&$select=name";v.solutionComponentSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentsummaries";v.solutionComponentCountSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentcountsummaries";function bI(e,t){return`${v.xrmApiUrl}/RetrieveRequiredComponents(ObjectId=${e},ComponentType=${t})`}v.getRequiredComponentsQueryUrl=bI;function yI(e,t){return`${v.cdsServiceUrl}${v.xrmApiUrl}/RetrieveDependentComponentsWithMetadata(ObjectId=${e},ComponentType=${t})`}v.getDependentComponentsWithMetadataQueryUrl=yI;v.solutionsQueryUrl="/api/data/v9.0/solutions?$expand=publisherid&$filter=(isvisible eq true)";function CI(e){return`/api/data/v9.0/solutions?$expand=publisherid&$filter=(uniquename eq '${e}')`}v.getSolutionsByUniqueNameQueryUrl=CI;function AI(e){return`/api/data/v9.0/solutions(${e})?$expand=publisherid`}v.getSolutionQueryUrl=AI;function wI(e){return`${e}api/data/v9.1/ProvisionLanguageForUser`}v.getProvisionLanguageUrl=wI;v.appDeploymentUrls={associateEnvironmentToPipelineUrl:e=>`/api/data/v9.0/deploymentpipelines(${e})/deploymentpipeline_deploymentenvironment/$ref`,deploymentArtifactsUrl:"/api/data/v9.0/deploymentartifacts",deploymentEnvironmentUrl:"/api/data/v9.0/deploymentenvironments",deploymentPipelinesUrl:"/api/data/v9.0/deploymentpipelines",deploymentStagesUrl:"/api/data/v9.0/deploymentstages",retrieveDeploymentPipelinesUrl:e=>`/api/data/v9.0/RetrieveDeploymentPipelines(SourceEnvironmentId='${e}')`,deletePipelinesUrl:e=>`/api/data/v9.0/deploymentpipelines(${e})`};function NI(e,t,r,n=!1,i=!1,a=!1,o=!1,s=!1,l=!1,u=!1){return`/api/data/v9.1/deploymentstageruns?$select=artifactname,artifactversion,deploymentstagerunid,devenvironmentid,endtime,errormessage,${s?"_artifactid_value,isredeployment,":""}${n?"deploymentnotes,":""}operation,operationdetails,operationstatus,${l?"retrycount,":""}${i?"scheduledtime,":""}${u?"solutionid,":""}stagerunstatus,starttime,suboperation,targetenvironmentid,${a?"predeploymentstepnotes,":""}validationresults,${o?"approvalcomments,":""}_devdeploymentenvironment_value,_targetdeploymentenvironment_value&$expand=deploymentstageid($select=deploymentstageid,name,_deploymentpipelineid_value),targetdeploymentenvironment($select=deploymentenvironmentid,environmentid,name),createdby($select=azureactivedirectoryobjectid,fullname,ownerid,systemuserid)${l?",RetryUser($select=azureactivedirectoryobjectid,fullname,ownerid,systemuserid)":""}&$filter=deploymentstageid/_deploymentpipelineid_value eq ${e} and devenvironmentid eq '${t}' and artifactname eq '${r}' and ((operation ne 200000201) or (operation eq 200000201 and operationstatus eq 200000003))- &$orderby=starttime desc`}g.getDeploymentStageRunsUrl=oI;function sI(e,t,r){return`/api/data/v9.1/RetrieveDeploymentPipelineInfo(DeploymentPipelineId=${e},SourceEnvironmentId='${t}',ArtifactName='${r}')`}g.retrieveDeploymentPipelineInfoUrl=sI;function lI(e){return`/api/data/v9.0/deploymentenvironments+ &$orderby=starttime desc`}v.getDeploymentStageRunsUrl=NI;function SI(e,t,r){return`/api/data/v9.1/RetrieveDeploymentPipelineInfo(DeploymentPipelineId=${e},SourceEnvironmentId='${t}',ArtifactName='${r}')`}v.retrieveDeploymentPipelineInfoUrl=SI;function DI(e){return`/api/data/v9.0/deploymentenvironments?$select=deploymentenvironmentid,environmentid,environmenttype,name&$expand=deploymentpipeline_deploymentenvironment($select=name,description,deploymentpipelineid;$orderby=name asc)- &$filter=(environmentid eq '${e}')`}g.retrievePipelinesUrl=lI;function uI(e){return`/api/data/v9.0/deploymentstages+ &$filter=(environmentid eq '${e}')`}v.retrievePipelinesUrl=DI;function EI(e){return`/api/data/v9.0/deploymentstages?$filter=(_deploymentpipelineid_value eq ${e})&$select=name,description,deploymentstageid,_previousdeploymentstageid_value- &$expand=targetdeploymentenvironmentid($select=deploymentenvironmentid,environmentid,name)`}g.retrieveDeploymentStagesUrl=uI;function cI(){return"/api/data/v9.0/deploymentstageruns?$select=deploymentstagerunid"}g.createDeploymentStageRunUrl=cI;function dI(e){return`/api/data/v9.0/deploymentstageruns(${e})`}g.updateDeploymentStageRunUrl=dI;function pI(){return"/api/data/v9.0/DeployPackageAsync"}g.deployPackageAsyncUrl=pI;function fI(){return"/api/data/v9.0/ValidatePackageAsync"}g.validatePackageAsyncUrl=fI;function mI(e,t=!1,r=!1){return`/api/data/v9.0/deploymentstageruns(${e})- ?$select=deploymentstagerunid,stagerunstatus,errormessage,operation,operationdetails,operationstatus,${t?"scheduledtime,":""}targetenvironmentid,validationresults,artifactname,deploymentsettingsjson${r?"&$expand=createdby($select=azureactivedirectoryobjectid,fullname,ownerid,systemuserid)":""}`}g.deploymentStageRunUrl=mI;function hI(e){return`/api/data/v9.0/deploymentstageruns(${e})- ?$select=aigenerateddeploymentnotes,deploymentstagerunid`}g.getAIGeneratedDeploymentNotesUrl=hI;function gI(e){let t="";for(let r=0;r<e.length;r++)r===e.length-1?t=t.concat(`deploymentstagerunid eq ${e[r]}`):t=t.concat(`deploymentstagerunid eq ${e[r]} or `);return`/api/data/v9.0/deploymentstageruns+ &$expand=targetdeploymentenvironmentid($select=deploymentenvironmentid,environmentid,name)`}v.retrieveDeploymentStagesUrl=EI;function II(){return"/api/data/v9.0/deploymentstageruns?$select=deploymentstagerunid"}v.createDeploymentStageRunUrl=II;function _I(e){return`/api/data/v9.0/deploymentstageruns(${e})`}v.updateDeploymentStageRunUrl=_I;function PI(){return"/api/data/v9.0/DeployPackageAsync"}v.deployPackageAsyncUrl=PI;function OI(){return"/api/data/v9.0/ValidatePackageAsync"}v.validatePackageAsyncUrl=OI;function FI(e,t=!1,r=!1){return`/api/data/v9.0/deploymentstageruns(${e})+ ?$select=deploymentstagerunid,stagerunstatus,errormessage,operation,operationdetails,operationstatus,${t?"scheduledtime,":""}targetenvironmentid,validationresults,artifactname,deploymentsettingsjson${r?"&$expand=createdby($select=azureactivedirectoryobjectid,fullname,ownerid,systemuserid)":""}`}v.deploymentStageRunUrl=FI;function TI(e){return`/api/data/v9.0/deploymentstageruns(${e})+ ?$select=aigenerateddeploymentnotes,deploymentstagerunid`}v.getAIGeneratedDeploymentNotesUrl=TI;function RI(e){let t="";for(let r=0;r<e.length;r++)r===e.length-1?t=t.concat(`deploymentstagerunid eq ${e[r]}`):t=t.concat(`deploymentstagerunid eq ${e[r]} or `);return`/api/data/v9.0/deploymentstageruns?$filter=(${t})- &$select=_deploymentstageid_value,deploymentstagerunid,stagerunstatus,operation,operationstatus,suboperation,artifactname`}g.deployOperationStatusUrl=gI;function vI(e){return`/api/data/v9.0/solutions(${e})- ?$select=solutionid,uniquename,version`}g.devSolutionInfoUrl=vI;function bI(e){return`/api/data/v9.0/deploymentenvironments+ &$select=_deploymentstageid_value,deploymentstagerunid,stagerunstatus,operation,operationstatus,suboperation,artifactname`}v.deployOperationStatusUrl=RI;function xI(e){return`/api/data/v9.0/solutions(${e})+ ?$select=solutionid,uniquename,version`}v.devSolutionInfoUrl=xI;function LI(e){return`/api/data/v9.0/deploymentenvironments?$select=deploymentenvironmentid,environmentid,environmenttype,name- &$filter=(environmentid eq '${e}')`}g.retrieveDeploymentEnvironmentInfoUrl=bI;var yI=e=>`/api/data/v9.0/systemusers+ &$filter=(environmentid eq '${e}')`}v.retrieveDeploymentEnvironmentInfoUrl=LI;var MI=e=>`/api/data/v9.0/systemusers?$select=azureactivedirectoryobjectid- &$filter=(applicationid eq '${e}')`;g.SPNPrincipalIdUrl=yI;function CI(){return"/api/data/v9.0/appmodules?$filter=(uniquename eq 'AppDeploymentConfiguration')"}g.retrieveDeploymentPipelineConfigAppUrl=CI;g.retrieveFeatureControlSettingsByNamespaceUrl="/api/data/v9.1/RetrieveFeatureControlSettingsByNamespace";function AI(e){return`/api/data/v9.0/settingdefinitions${e}`}g.getSettingDefinitionsUri=AI;g.OrgSettingOverrideName="organizationsettings";function NI(e,t=!1){let r=`/api/data/v9.0/${g.OrgSettingOverrideName}${e}`;return t?`${g.cdsServiceUrl}${r}`:r}g.getOrgSettingOverrideUri=NI;g.AppSettingOverrideName="appsettings";function wI(e,t=!1){let r=`/api/data/v9.0/${g.AppSettingOverrideName}${e}`;return t?`${g.cdsServiceUrl.replace("/$","")}${r}`:r}g.getAppSettingOverrideUri=wI;var Pi;(function(e){e[e.All=0]="All",e[e.IsPlatformOnly=1]="IsPlatformOnly",e[e.NotPlatformOnly=2]="NotPlatformOnly"})(Pi||(g.RetrievePlatform=Pi={}));function SI(e,t,r,n=Pi.All,i=!1){let a=[];e&&a.push(`AppUniqueName='${e}'`),t!=null&&a.push(`ReleaseLevel=${t}`),r&&a.push(`RetrieveHiddenSettings=${r}`),n!==Pi.All&&a.push(`RetrievePlatformSettings=${n===Pi.IsPlatformOnly?1:0}`);let o="/api/data/v9.0/RetrieveUnpublishedOverridableSettingsInfo";return a.length&&(o=`${o}(${a.join(",")})`),i?`${g.cdsServiceUrl}${o}`:o}g.getPowerSettingsUri=SI;function DI(e,t,r,n=!1){let i=[`SettingName='${e}'`];t!==void 0&&i.push(`SolutionName='${t}'`),r!==void 0&&i.push(`AppUniqueName='${r}'`);let a="/api/data/v9.0/RetrieveUnpublishedSettingInfo";return i.length&&(a=`${a}(${i.join(",")})`),n?`${g.cdsServiceUrl}${a}`:a}g.getPowerSettingUri=DI;function EI(e=!1){let t="/api/data/v9.0/SaveSettingValue()";return e?`${g.cdsServiceUrl}${t}`:t}g.getSavePowerSettingUri=EI;g.retrieveUnpublishedSuffix="Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()";function II(e){return`tools/systemcustomization/businessrules/businessRulesDesigner.aspx?BRlaunchpoint=BRGrid&appSolutionId={${e}}`}g.getBusinessRuleDesignerUri=II;function af({environmentInstanceUrl:e,entityLogicalName:t}){return e&&t?`${e}main.aspx?cmdbar=true&forceUCI=1&navbar=off&newWindow=true&pageType=entityRecord&etn=${t}`:void 0}g.getUCIEntityRecordBaseUrl=af;function _I({baseUrl:e,environmentInstanceUrl:t,entityLogicalName:r,recordId:n}){let i=e||af({environmentInstanceUrl:t,entityLogicalName:r});return i&&n?`${i}&id=${n}`:void 0}g.getUCIEntityRecordEditUrl=_I;g.retrieveOrganizationResources=`${g.cdsServiceUrl}api/data/v9.0/RetrieveOrganizationResources`});var of=f(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.DataverseClient=void 0;var PI=$l(),Fi=_e(),Gl=class{constructor(t,r,n){this.instanceUrl=t,this.httpClient=r,this.solutionUniqueName=n}withSolution(t){return this.solutionUniqueName?{...t,headers:{...t?.headers,"MSCRM.SolutionUniqueName":this.solutionUniqueName}}:t}apiUrl(t){let r=this.instanceUrl.replace(/\/+$/,""),n=t.startsWith("/")?t:`/${t}`;return`${r}/${PI.xrmApiUrl}${n}`}async send(t,r){try{return await r()}catch(n){throw n instanceof Fi.SdkError?n:new Fi.ConnectionError(t,0,n instanceof Error?n.message:String(n),n)}}get(t,r){let n=this.apiUrl(t);return this.send(n,()=>this.httpClient.get(n,r))}getAbsolute(t,r){return this.assertSameOrigin(t),this.send(t,()=>this.httpClient.get(t,r))}assertSameOrigin(t){let r,n;try{r=new URL(t),n=new URL(this.instanceUrl)}catch{throw new Fi.InvalidArgumentError(`Refusing to follow a malformed absolute URL: '${t}'`)}if(r.protocol!==n.protocol||r.host!==n.host)throw new Fi.InvalidArgumentError(`Refusing to follow a cross-origin link ('${r.origin}' is not the configured instance '${n.origin}'); server-driven pagination must stay on-instance.`)}post(t,r,n){let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.post(i,r,this.withSolution(n)))}patch(t,r,n){let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.patch(i,r,this.withSolution(n)))}put(t,r,n){if(!this.httpClient.put)throw new Fi.InvalidArgumentError("The injected HttpClient does not implement put(), required for metadata replace operations (e.g. updateColumn)");let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.put(i,r,this.withSolution(n)))}delete(t,r){let n=this.apiUrl(t);return this.send(n,()=>this.httpClient.delete(n,this.withSolution(r)))}};vo.DataverseClient=Gl});var ue=f(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.odataQuery=Pe.normalizeGuid=Pe.createSafeXmlElement=Pe.assertODataName=Pe.assertXmlName=Pe.xmlText=Pe.odataPathLiteral=Pe.odataLiteral=void 0;var zl=_e();function sf(e){return String(e??"").replace(/'/g,"''")}Pe.odataLiteral=sf;function OI(e){return encodeURIComponent(sf(e))}Pe.odataPathLiteral=OI;function FI(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}Pe.xmlText=FI;function lf(e,t){let r=String(e??""),n=/^[A-Za-z_][0-9A-Za-z_.-]*$/,i=r.split(":");if(!(i.length<=2&&i.every(o=>n.test(o))&&!/^xmlns/i.test(r)))throw new zl.InvalidArgumentError(`${t} must be a valid XML element name (got '${e}')`);return e}Pe.assertXmlName=lf;function RI(e,t){let r=String(e??"");if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r))throw new zl.InvalidArgumentError(`${t} must be a valid OData identifier (letters, digits, underscore): got '${e}'`);return e}Pe.assertODataName=RI;function TI(e,t,r){return e.createElement(lf(t,r))}Pe.createSafeXmlElement=TI;var xI=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function LI(e,t){let r=String(e??""),n=r.length===38&&r.startsWith("{")&&r.endsWith("}")?r.slice(1,-1):r;if(!xI.test(n))throw new zl.InvalidArgumentError(`${t} must be a valid GUID (got '${e}')`);return n.toLowerCase()}Pe.normalizeGuid=LI;function UI(e){let t=[];for(let[r,n]of e)n!=null&&n!==""&&t.push(`${r}=${encodeURIComponent(String(n))}`);return t.length>0?`?${t.join("&")}`:""}Pe.odataQuery=UI});var qe=f(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.nowIso=xe.deleteRecord=xe.ensureSuccess=xe.requireCreatedId=xe.readCreatedId=xe.readEtag=xe.VERSION_CONFLICT_CODE=void 0;var Wl=_e(),jl=ue();xe.VERSION_CONFLICT_CODE="VERSION_CONFLICT";function MI(e){var t;let r=(t=e.headers)!==null&&t!==void 0?t:{};for(let i of Object.keys(r))if(i.toLowerCase()==="etag")return r[i];let n=e.body;return n&&typeof n["@odata.etag"]=="string"?n["@odata.etag"]:null}xe.readEtag=MI;function uf(e,t){var r;let n=e.body;if(n&&typeof n[t]=="string")return(0,jl.normalizeGuid)(n[t],t);let i=(r=e.headers)!==null&&r!==void 0?r:{};for(let a of Object.keys(i))if(a.toLowerCase()==="odata-entityid"){let o=/\(([0-9a-fA-F-]{36})\)/.exec(i[a]);if(o)return(0,jl.normalizeGuid)(o[1],t)}return null}xe.readCreatedId=uf;function BI(e,t,r){let n=uf(e,t);if(!n)throw new Wl.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`);return n}xe.requireCreatedId=BI;function cf(e,t){if(e.status===412)throw new Wl.SdkError(xe.VERSION_CONFLICT_CODE,`Version conflict (412) from ${t}`);if(e.status<200||e.status>=300)throw new Wl.ConnectionError(t,e.status,kI(e.body),e.body);return e}xe.ensureSuccess=cf;function kI(e){if(typeof e=="string"&&e.length>0)return e;if(e!==null&&typeof e=="object"){let t=e;if(t.error&&typeof t.error.message=="string")return t.error.message;if(typeof t.Message=="string")return t.Message;if(typeof t.message=="string")return t.message}return"request failed"}async function qI(e,t,r){let n=(0,jl.normalizeGuid)(r,"id"),i=`/${t}(${n})`;cf(await e.delete(i),e.apiUrl(i))}xe.deleteRecord=qI;function $I(){return new Date().toISOString()}xe.nowIso=$I});var df=f(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.findColumns=Er.findTables=Er.fetchEntityMetadataFromApi=void 0;var Hl=qe(),Ut=ue();function Ri(e){var t,r;return(r=(t=e?.UserLocalizedLabel)===null||t===void 0?void 0:t.Label)!==null&&r!==void 0?r:""}async function An(e,t){var r,n;let i=await e.get(t);return i.status<200||i.status>=300?[]:(n=(r=i.body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]}function Dr(e){return`/EntityDefinitions(LogicalName='${(0,Ut.odataLiteral)(e)}')`}async function VI(e,t,r){let n=await An(e,`${Dr(t)}/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata${(0,Ut.odataQuery)([["$select","LogicalName,MaxLength"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&typeof i.MaxLength=="number"&&(a.maxLength=i.MaxLength)}}async function GI(e,t,r){var n;let i=await An(e,`${Dr(t)}/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata${(0,Ut.odataQuery)([["$select","LogicalName"],["$expand","OptionSet($select=Options)"]])}`);for(let a of i){let o=r.get(a.LogicalName);o&&(!((n=a.OptionSet)===null||n===void 0)&&n.Options)&&(o.options=a.OptionSet.Options.map(s=>{var l;return{value:(l=s.Value)!==null&&l!==void 0?l:0,label:Ri(s.Label)}}))}}async function zI(e,t,r){let n=await An(e,`${Dr(t)}/Attributes/Microsoft.Dynamics.CRM.LookupAttributeMetadata${(0,Ut.odataQuery)([["$select","LogicalName,Targets"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&i.Targets&&(a.targets=i.Targets)}}async function WI(e,t){var r,n,i,a;let o=[],s=await An(e,`${Dr(t)}/OneToManyRelationships${(0,Ut.odataQuery)([["$select","SchemaName,ReferencingEntity,ReferencingAttribute"]])}`);for(let c of s)o.push({schemaName:c.SchemaName,type:"OneToMany",relatedEntity:(r=c.ReferencingEntity)!==null&&r!==void 0?r:"",relatedAttribute:(n=c.ReferencingAttribute)!==null&&n!==void 0?n:""});let l=await An(e,`${Dr(t)}/ManyToOneRelationships${(0,Ut.odataQuery)([["$select","SchemaName,ReferencedEntity,ReferencedAttribute"]])}`);for(let c of l)o.push({schemaName:c.SchemaName,type:"ManyToOne",relatedEntity:(i=c.ReferencedEntity)!==null&&i!==void 0?i:"",relatedAttribute:(a=c.ReferencedAttribute)!==null&&a!==void 0?a:""});let u=await An(e,`${Dr(t)}/ManyToManyRelationships${(0,Ut.odataQuery)([["$select","SchemaName,Entity1LogicalName,Entity2LogicalName"]])}`);for(let c of u){let p=c.Entity1LogicalName===t?c.Entity2LogicalName:c.Entity1LogicalName;o.push({schemaName:c.SchemaName,type:"ManyToMany",relatedEntity:p??"",relatedAttribute:""})}return o}async function jI(e,t){var r,n;let i=`${Dr(t)}`+(0,Ut.odataQuery)([["$select","LogicalName,DisplayName,EntitySetName,IsCustomEntity"],["$expand","Attributes($select=LogicalName,DisplayName,AttributeType,IsCustomAttribute)"]]),o=(0,Hl.ensureSuccess)(await e.get(i),e.apiUrl(i)).body,s=((r=o.Attributes)!==null&&r!==void 0?r:[]).map(c=>{var p;return{logicalName:c.LogicalName,displayName:Ri(c.DisplayName),attributeType:(p=c.AttributeType)!==null&&p!==void 0?p:"Unknown",isCustomAttribute:!!c.IsCustomAttribute}}),l=new Map(s.map(c=>[c.logicalName,c])),[,,,u]=await Promise.all([VI(e,t,l),GI(e,t,l),zI(e,t,l),WI(e,t)]);return{logicalName:o.LogicalName,displayName:Ri(o.DisplayName),entitySetName:(n=o.EntitySetName)!==null&&n!==void 0?n:"",attributes:s,relationships:u}}Er.fetchEntityMetadataFromApi=jI;async function HI(e,t,r){var n,i;let a=`/EntityDefinitions${(0,Ut.odataQuery)([["$select","LogicalName,SchemaName,EntitySetName,DisplayName,IsCustomEntity"]])}`,s=(i=(n=(0,Hl.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[],l=(t??"").toLowerCase(),u=s.filter(c=>!r?.customOnly||c.IsCustomEntity).map(c=>{var p,m;return{logicalName:c.LogicalName,schemaName:(p=c.SchemaName)!==null&&p!==void 0?p:c.LogicalName,displayName:Ri(c.DisplayName),entitySetName:(m=c.EntitySetName)!==null&&m!==void 0?m:"",isCustom:!!c.IsCustomEntity}}).filter(c=>c.logicalName.toLowerCase().includes(l)||c.schemaName.toLowerCase().includes(l)||c.displayName.toLowerCase().includes(l));return typeof r?.top=="number"?u.slice(0,r.top):u}Er.findTables=HI;async function JI(e,t,r,n){var i,a;let o=`${Dr(t)}/Attributes`+(0,Ut.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,AttributeType,IsCustomAttribute"]]),l=(a=(i=(0,Hl.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[],u=(r??"").toLowerCase(),c=l.map(p=>{var m,v;return{logicalName:p.LogicalName,schemaName:(m=p.SchemaName)!==null&&m!==void 0?m:p.LogicalName,displayName:Ri(p.DisplayName),attributeType:(v=p.AttributeType)!==null&&v!==void 0?v:"Unknown",isCustom:!!p.IsCustomAttribute}}).filter(p=>p.logicalName.toLowerCase().includes(u)||p.schemaName.toLowerCase().includes(u)||p.displayName.toLowerCase().includes(u));return typeof n?.top=="number"?c.slice(0,n.top):c}Er.findColumns=JI});var bo=f(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.updateTable=H.deleteAlternateKey=H.createAlternateKey=H.deleteGlobalOptionSet=H.createGlobalOptionSet=H.deleteRelationship=H.deleteColumn=H.updateColumn=H.deleteTable=H.createRelationship=H.insertStatusValue=H.createCustomerColumn=H.createColumn=H.createTable=H.resolveEntitySetName=void 0;var oe=qe(),X=ue(),Et=_e(),QI={String:"Microsoft.Dynamics.CRM.StringAttributeMetadata",Memo:"Microsoft.Dynamics.CRM.MemoAttributeMetadata",Integer:"Microsoft.Dynamics.CRM.IntegerAttributeMetadata",Decimal:"Microsoft.Dynamics.CRM.DecimalAttributeMetadata",Money:"Microsoft.Dynamics.CRM.MoneyAttributeMetadata",Boolean:"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",DateTime:"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",Picklist:"Microsoft.Dynamics.CRM.PicklistAttributeMetadata",Lookup:"Microsoft.Dynamics.CRM.LookupAttributeMetadata"},nr=1033;function he(e,t){return{"@odata.type":"Microsoft.Dynamics.CRM.Label",LocalizedLabels:[{"@odata.type":"Microsoft.Dynamics.CRM.LocalizedLabel",Label:e,LanguageCode:t}]}}function Ti(e){return{Value:e,CanBeChanged:!0,ManagedPropertyLogicalName:"canmodifyrequirementlevelsettings"}}function Ql(e){let t=e.indexOf("_");return t>0?e.slice(0,t):e}function pf(e,t,r){let n=e[t];n&&typeof n=="object"?n.Value=r:e[t]={Value:r}}function xi(e){let t=(0,oe.readCreatedId)(e,"MetadataId");if(!t)throw new Et.InvalidArgumentError("Dataverse did not return a MetadataId for the created metadata component");return t}function XI(e,t,r){var n,i,a,o,s,l,u,c,p,m,v,C,w,P,x,M,T,L,Q,B,W,k;switch(e){case"string":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},MaxLength:(n=t.maxLength)!==null&&n!==void 0?n:100,FormatName:{Value:(i=t.stringFormat)!==null&&i!==void 0?i:"Text"}};case"memo":return{"@odata.type":"Microsoft.Dynamics.CRM.MemoAttributeMetadata",AttributeType:"Memo",AttributeTypeName:{Value:"MemoType"},MaxLength:(a=t.maxLength)!==null&&a!==void 0?a:2e3,Format:"TextArea"};case"integer":return{"@odata.type":"Microsoft.Dynamics.CRM.IntegerAttributeMetadata",AttributeType:"Integer",AttributeTypeName:{Value:"IntegerType"},Format:"None",MinValue:(o=t.minValue)!==null&&o!==void 0?o:-2147483648,MaxValue:(s=t.maxValue)!==null&&s!==void 0?s:2147483647};case"bigint":return{"@odata.type":"Microsoft.Dynamics.CRM.BigIntAttributeMetadata",AttributeType:"BigInt",AttributeTypeName:{Value:"BigIntType"}};case"double":return{"@odata.type":"Microsoft.Dynamics.CRM.DoubleAttributeMetadata",AttributeType:"Double",AttributeTypeName:{Value:"DoubleType"},Precision:(l=t.precision)!==null&&l!==void 0?l:2,MinValue:(u=t.minValue)!==null&&u!==void 0?u:-1e11,MaxValue:(c=t.maxValue)!==null&&c!==void 0?c:1e11};case"decimal":return{"@odata.type":"Microsoft.Dynamics.CRM.DecimalAttributeMetadata",AttributeType:"Decimal",AttributeTypeName:{Value:"DecimalType"},Precision:(p=t.precision)!==null&&p!==void 0?p:2,MinValue:(m=t.minValue)!==null&&m!==void 0?m:-1e11,MaxValue:(v=t.maxValue)!==null&&v!==void 0?v:1e11};case"money":return{"@odata.type":"Microsoft.Dynamics.CRM.MoneyAttributeMetadata",AttributeType:"Money",AttributeTypeName:{Value:"MoneyType"},Precision:(C=t.precision)!==null&&C!==void 0?C:2,PrecisionSource:2,MinValue:(w=t.minValue)!==null&&w!==void 0?w:0,MaxValue:(P=t.maxValue)!==null&&P!==void 0?P:1e9};case"boolean":return{"@odata.type":"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",AttributeType:"Boolean",AttributeTypeName:{Value:"BooleanType"},DefaultValue:!1,OptionSet:{"@odata.type":"Microsoft.Dynamics.CRM.BooleanOptionSetMetadata",TrueOption:{Value:1,Label:he((x=t.trueLabel)!==null&&x!==void 0?x:"Yes",r)},FalseOption:{Value:0,Label:he((M=t.falseLabel)!==null&&M!==void 0?M:"No",r)}}};case"dateTime":return{"@odata.type":"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",AttributeType:"DateTime",AttributeTypeName:{Value:"DateTimeType"},Format:(T=t.dateFormat)!==null&&T!==void 0?T:"DateAndTime"};case"choice":return ff(t,r,!1);case"multiChoice":return ff(t,r,!0);case"file":return{"@odata.type":"Microsoft.Dynamics.CRM.FileAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"FileType"},MaxSizeInKB:(L=t.maxSizeKb)!==null&&L!==void 0?L:10240};case"image":return{"@odata.type":"Microsoft.Dynamics.CRM.ImageAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"ImageType"},IsPrimaryImage:(Q=t.isPrimaryImage)!==null&&Q!==void 0?Q:!1,MaxSizeInKB:(B=t.maxSizeKb)!==null&&B!==void 0?B:10240};case"autonumber":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},FormatName:{Value:"Text"},MaxLength:(W=t.maxLength)!==null&&W!==void 0?W:100,AutoNumberFormat:(k=t.autoNumberFormat)!==null&&k!==void 0?k:""};default:throw new Et.InvalidArgumentError(`unsupported column type '${String(e)}'`)}}function ff(e,t,r){let i={"@odata.type":r?"Microsoft.Dynamics.CRM.MultiSelectPicklistAttributeMetadata":"Microsoft.Dynamics.CRM.PicklistAttributeMetadata",AttributeType:r?"Virtual":"Picklist",AttributeTypeName:{Value:r?"MultiSelectPicklistType":"PicklistType"}};if(e.globalChoiceMetadataId)return i["[email protected]"]=`/GlobalOptionSetDefinitions(${(0,X.normalizeGuid)(e.globalChoiceMetadataId,"globalChoiceMetadataId")})`,i;if(!e.options||e.options.length===0)throw new Et.InvalidArgumentError(`choice column '${e.schemaName}' requires at least one option (or a globalChoiceMetadataId)`);return i.OptionSet={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",IsGlobal:!1,OptionSetType:"Picklist",Options:e.options.map(a=>({Value:a.value,Label:he(a.label,t)}))},i}var Jl=new WeakMap;async function KI(e,t){var r,n;let i=(r=Jl.get(e))===null||r===void 0?void 0:r.get(t);if(i)return i;let a=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')${(0,X.odataQuery)([["$select","EntitySetName"]])}`,s=(n=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.EntitySetName;if(!s)throw new Et.InvalidArgumentError(`could not resolve EntitySetName for '${t}'`);(0,X.assertODataName)(s,`server-derived EntitySetName for '${t}'`);let l=Jl.get(e);return l||(l=new Map,Jl.set(e,l)),l.set(t,s),s}H.resolveEntitySetName=KI;async function YI(e,t){var r,n,i,a,o,s,l,u,c,p,m,v;let C=(r=t.languageCode)!==null&&r!==void 0?r:nr,w=Ql(t.schemaName),P=(n=t.primaryColumnSchemaName)!==null&&n!==void 0?n:`${w}_Name`,x={"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},SchemaName:P,RequiredLevel:Ti("None"),MaxLength:(i=t.primaryColumnMaxLength)!==null&&i!==void 0?i:100,FormatName:{Value:"Text"},DisplayName:he((a=t.primaryColumnDisplayName)!==null&&a!==void 0?a:"Name",C),IsPrimaryName:!0};t.primaryColumnAutoNumberFormat&&(x.AutoNumberFormat=t.primaryColumnAutoNumberFormat);let M={"@odata.type":"Microsoft.Dynamics.CRM.EntityMetadata",SchemaName:t.schemaName,DisplayName:he(t.displayName,C),DisplayCollectionName:he((o=t.pluralName)!==null&&o!==void 0?o:`${t.displayName}s`,C),OwnershipType:(s=t.ownership)!==null&&s!==void 0?s:"UserOwned",IsActivity:!1,HasActivities:(l=t.hasActivities)!==null&&l!==void 0?l:!1,HasNotes:(u=t.hasNotes)!==null&&u!==void 0?u:!1,Attributes:[x]};t.description&&(M.Description=he(t.description,C));let T="/EntityDefinitions",L=(0,oe.ensureSuccess)(await e.post(T,M),e.apiUrl(T)),Q=xi(L),B=`/EntityDefinitions(${Q})`+(0,X.odataQuery)([["$select","LogicalName,EntitySetName,PrimaryIdAttribute,PrimaryNameAttribute"]]),k=(0,oe.ensureSuccess)(await e.get(B),e.apiUrl(B)).body;return{logicalName:(c=k.LogicalName)!==null&&c!==void 0?c:t.schemaName.toLowerCase(),metadataId:Q,entitySetName:(p=k.EntitySetName)!==null&&p!==void 0?p:"",primaryIdAttribute:(m=k.PrimaryIdAttribute)!==null&&m!==void 0?m:`${t.schemaName.toLowerCase()}id`,primaryNameAttribute:(v=k.PrimaryNameAttribute)!==null&&v!==void 0?v:P.toLowerCase()}}H.createTable=YI;async function ZI(e,t,r){var n,i;let a=(n=r.languageCode)!==null&&n!==void 0?n:nr,o={...XI(r.type,r,a),SchemaName:r.schemaName,RequiredLevel:Ti((i=r.required)!==null&&i!==void 0?i:"None"),DisplayName:he(r.displayName,a)};r.description&&(o.Description=he(r.description,a)),r.sourceType&&r.sourceType!=="Simple"&&(o.SourceType=r.sourceType==="Rollup"?2:1,r.formulaDefinition&&(o.FormulaDefinition=r.formulaDefinition));let s=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')/Attributes`,l=(0,oe.ensureSuccess)(await e.post(s,o),e.apiUrl(s));return{logicalName:r.schemaName.toLowerCase(),metadataId:xi(l)}}H.createColumn=ZI;async function e1(e,t,r){var n,i,a,o;let s=(n=r.languageCode)!==null&&n!==void 0?n:nr,l=Ql(r.schemaName),u=(i=r.accountRelationshipName)!==null&&i!==void 0?i:`${l}_${t}_account`,c=(a=r.contactRelationshipName)!==null&&a!==void 0?a:`${l}_${t}_contact`,p={Lookup:{"@odata.type":"Microsoft.Dynamics.CRM.ComplexLookupAttributeMetadata",SchemaName:r.schemaName,DisplayName:he(r.displayName,s),RequiredLevel:Ti((o=r.required)!==null&&o!==void 0?o:"None"),Targets:["account","contact"]},OneToManyRelationships:[{"@odata.type":"Microsoft.Dynamics.CRM.ComplexOneToManyRelationshipMetadata",SchemaName:u,ReferencedEntity:"account",ReferencingEntity:t},{"@odata.type":"Microsoft.Dynamics.CRM.ComplexOneToManyRelationshipMetadata",SchemaName:c,ReferencedEntity:"contact",ReferencingEntity:t}]};return(0,oe.ensureSuccess)(await e.post("/CreateCustomerRelationships",p),e.apiUrl("/CreateCustomerRelationships")),{logicalName:r.schemaName.toLowerCase(),metadataId:""}}H.createCustomerColumn=e1;async function t1(e,t,r){var n,i,a,o,s;let l=(n=r.languageCode)!==null&&n!==void 0?n:nr,u={EntityLogicalName:t,AttributeLogicalName:"statuscode",Label:he(r.label,l),StateCode:(i=r.stateCode)!==null&&i!==void 0?i:0};typeof r.value=="number"&&(u.Value=r.value),r.color&&(u.Color=r.color);let c=(0,oe.ensureSuccess)(await e.post("/InsertStatusValue",u),e.apiUrl("/InsertStatusValue"));return Number((s=(o=(a=c.body)===null||a===void 0?void 0:a.NewOptionValue)!==null&&o!==void 0?o:r.value)!==null&&s!==void 0?s:0)}H.insertStatusValue=t1;async function r1(e,t){var r,n,i,a,o;let s=(r=t.languageCode)!==null&&r!==void 0?r:nr,l,u;if(t.type==="OneToMany"){if(!t.referencedEntity||!t.referencingEntity)throw new Et.InvalidArgumentError("OneToMany relationship requires referencedEntity and referencingEntity");let m=(n=t.lookupSchemaName)!==null&&n!==void 0?n:`${Ql(t.schemaName)}_${t.referencedEntity}Id`;u=m.toLowerCase(),l={"@odata.type":"Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata",SchemaName:t.schemaName,ReferencedEntity:t.referencedEntity,ReferencingEntity:t.referencingEntity,Lookup:{"@odata.type":"Microsoft.Dynamics.CRM.LookupAttributeMetadata",AttributeType:"Lookup",AttributeTypeName:{Value:"LookupType"},SchemaName:m,RequiredLevel:Ti((i=t.lookupRequired)!==null&&i!==void 0?i:"None"),DisplayName:he((a=t.lookupDisplayName)!==null&&a!==void 0?a:t.referencedEntity,s)}}}else{if(!t.entity1||!t.entity2)throw new Et.InvalidArgumentError("ManyToMany relationship requires entity1 and entity2");l={"@odata.type":"Microsoft.Dynamics.CRM.ManyToManyRelationshipMetadata",SchemaName:t.schemaName,IntersectEntityName:(o=t.intersectEntityName)!==null&&o!==void 0?o:t.schemaName.toLowerCase(),Entity1LogicalName:t.entity1,Entity2LogicalName:t.entity2}}let c="/RelationshipDefinitions",p=(0,oe.ensureSuccess)(await e.post(c,l),e.apiUrl(c));return{schemaName:t.schemaName,metadataId:xi(p),lookupLogicalName:u}}H.createRelationship=r1;async function n1(e,t){let r=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')`;(0,oe.ensureSuccess)(await e.delete(r),e.apiUrl(r))}H.deleteTable=n1;async function i1(e,t,r,n){var i,a;let o=(i=n.languageCode)!==null&&i!==void 0?i:nr,s=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')/Attributes`,l=`${s}(LogicalName='${(0,X.odataLiteral)(r)}')${(0,X.odataQuery)([["$select","MetadataId,AttributeType"]])}`,c=(0,oe.ensureSuccess)(await e.get(l),e.apiUrl(l)).body,p=QI[(a=c.AttributeType)!==null&&a!==void 0?a:""];if(!c.MetadataId||!p)throw new Et.InvalidArgumentError(`cannot update column '${r}' on '${t}' (type '${c.AttributeType}' not supported)`);let m=(0,X.normalizeGuid)(c.MetadataId,"MetadataId"),v=`${s}(${m})/${p}`,C=(0,oe.ensureSuccess)(await e.get(v),e.apiUrl(v)).body;for(let P of Object.keys(C))P.startsWith("@odata.")&&delete C[P];C["@odata.type"]=p,n.displayName!==void 0&&(C.DisplayName=he(n.displayName,o)),n.description!==void 0&&(C.Description=he(n.description,o)),n.required!==void 0&&(C.RequiredLevel=Ti(n.required)),n.maxLength!==void 0&&(C.MaxLength=n.maxLength),n.autoNumberFormat!==void 0&&(C.AutoNumberFormat=n.autoNumberFormat);let w=`${s}(${m})`;(0,oe.ensureSuccess)(await e.put(w,C,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(w))}H.updateColumn=i1;async function a1(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')/Attributes`,a=`${i}(LogicalName='${(0,X.odataLiteral)(r)}')${(0,X.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new Et.InvalidArgumentError(`column '${r}' not found on '${t}'`);let l=`${i}(${(0,X.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}H.deleteColumn=a1;async function o1(e,t){var r,n,i;let a=`/RelationshipDefinitions${(0,X.odataQuery)([["$filter",`SchemaName eq '${(0,X.odataLiteral)(t)}'`],["$select","MetadataId"]])}`,s=(i=(n=(r=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.MetadataId;if(!s)throw new Et.InvalidArgumentError(`relationship '${t}' not found`);let l=`/RelationshipDefinitions(${(0,X.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}H.deleteRelationship=o1;async function mf(e,t){var r;let n=`/GlobalOptionSetDefinitions(Name='${(0,X.odataPathLiteral)(t)}')${(0,X.odataQuery)([["$select","MetadataId"]])}`,i=await e.get(n);if(i.status===404)return;let o=(r=(0,oe.ensureSuccess)(i,e.apiUrl(n)).body)===null||r===void 0?void 0:r.MetadataId;return o?(0,X.normalizeGuid)(o,"MetadataId"):void 0}async function s1(e,t){var r;let n=t.name.toLowerCase(),i=await mf(e,n);if(i)return{name:n,metadataId:i};let a=(r=t.languageCode)!==null&&r!==void 0?r:nr,o={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",Name:n,DisplayName:he(t.displayName,a),IsGlobal:!0,OptionSetType:"Picklist",Options:t.options.map(l=>({Value:l.value,Label:he(l.label,a)}))};t.description&&(o.Description=he(t.description,a));let s="/GlobalOptionSetDefinitions";try{let l=(0,oe.ensureSuccess)(await e.post(s,o),e.apiUrl(s));return{name:n,metadataId:xi(l)}}catch(l){let u;try{u=await mf(e,n)}catch{u=void 0}if(u)return{name:n,metadataId:u};throw l}}H.createGlobalOptionSet=s1;async function l1(e,t){let r=`/GlobalOptionSetDefinitions(Name='${(0,X.odataLiteral)(t.toLowerCase())}')`;(0,oe.ensureSuccess)(await e.delete(r),e.apiUrl(r))}H.deleteGlobalOptionSet=l1;async function u1(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:nr,a={"@odata.type":"Microsoft.Dynamics.CRM.EntityKeyMetadata",SchemaName:r.schemaName,DisplayName:he(r.displayName,i),KeyAttributes:r.keyAttributes},o=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')/Keys`,s=(0,oe.ensureSuccess)(await e.post(o,a),e.apiUrl(o));return{logicalName:r.schemaName.toLowerCase(),metadataId:xi(s)}}H.createAlternateKey=u1;async function c1(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')/Keys`,a=`${i}(LogicalName='${(0,X.odataLiteral)(r.toLowerCase())}')${(0,X.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new Et.InvalidArgumentError(`alternate key '${r}' not found on '${t}'`);let l=`${i}(${(0,X.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}H.deleteAlternateKey=c1;async function d1(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:nr,a=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')`,s=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body,l=s.MetadataId;if(!l)throw new Et.InvalidArgumentError(`table '${t}' not found`);let u=(0,X.normalizeGuid)(l,"MetadataId");for(let p of Object.keys(s))p.startsWith("@odata.")&&delete s[p];s["@odata.type"]="Microsoft.Dynamics.CRM.EntityMetadata",r.displayName!==void 0&&(s.DisplayName=he(r.displayName,i)),r.pluralName!==void 0&&(s.DisplayCollectionName=he(r.pluralName,i)),r.description!==void 0&&(s.Description=he(r.description,i)),r.auditEnabled!==void 0&&pf(s,"IsAuditEnabled",r.auditEnabled),r.duplicateDetectionEnabled!==void 0&&pf(s,"IsDuplicateDetectionEnabled",r.duplicateDetectionEnabled),r.changeTrackingEnabled!==void 0&&(s.ChangeTrackingEnabled=r.changeTrackingEnabled),r.quickCreateEnabled!==void 0&&(s.IsQuickCreateEnabled=r.quickCreateEnabled),r.iconVectorName!==void 0&&(s.IconVectorName=r.iconVectorName),r.iconSmallName!==void 0&&(s.IconSmallName=r.iconSmallName),r.iconMediumName!==void 0&&(s.IconMediumName=r.iconMediumName),r.iconLargeName!==void 0&&(s.IconLargeName=r.iconLargeName);let c=`/EntityDefinitions(${u})`;(0,oe.ensureSuccess)(await e.put(c,s,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(c))}H.updateTable=d1});var Li=f(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.disassociateRecords=fe.associateRecords=fe.createRecordsBulk=fe.upsertRecord=fe.queryAllRecords=fe.queryRecords=fe.getRecord=fe.deleteRecord=fe.updateRecord=fe.createRecord=void 0;var ft=qe(),$e=ue(),Wr=_e(),Mt=bo();function yo(e){let t=e,r=!1,n={};for(let i of Object.keys(t)){let a=t[i];Array.isArray(a)&&a.every(o=>typeof o=="number")?(n[i]=a.join(","),r=!0):n[i]=a}return r?n:e}async function p1(e,t,r){let i=`/${await(0,Mt.resolveEntitySetName)(e,t)}`,a=(0,ft.ensureSuccess)(await e.post(i,yo(r)),e.apiUrl(i)),o=(0,ft.readCreatedId)(a,`${t}id`);if(!o)throw new Wr.InvalidArgumentError(`Dataverse did not return an id for the created '${t}' row`);return{id:o,entityType:t}}fe.createRecord=p1;async function f1(e,t,r,n){let i=(0,$e.normalizeGuid)(r,"id"),o=`/${await(0,Mt.resolveEntitySetName)(e,t)}(${i})`;(0,ft.ensureSuccess)(await e.patch(o,yo(n)),e.apiUrl(o))}fe.updateRecord=f1;async function m1(e,t,r){let n=(0,$e.normalizeGuid)(r,"id"),a=`/${await(0,Mt.resolveEntitySetName)(e,t)}(${n})`;(0,ft.ensureSuccess)(await e.delete(a),e.apiUrl(a))}fe.deleteRecord=m1;async function h1(e,t,r,n){var i;let a=(0,$e.normalizeGuid)(r,"id"),o=await(0,Mt.resolveEntitySetName)(e,t),s=(0,$e.odataQuery)([["$select",n&&n.length>0?n.join(","):void 0]]),l=`/${o}(${a})${s}`;return(i=(0,ft.ensureSuccess)(await e.get(l),e.apiUrl(l)).body)!==null&&i!==void 0?i:{}}fe.getRecord=h1;function g1(e){return e?.fetchXml?(0,$e.odataQuery)([["fetchXml",e.fetchXml]]):(0,$e.odataQuery)([["$select",e?.select&&e.select.length>0?e.select.join(","):void 0],["$filter",e?.filter],["$orderby",e?.orderBy],["$expand",e?.expand],["$top",e?.top]])}async function hf(e,t,r){var n,i;if(r?.paginate){if(r.top!==void 0)throw new Wr.InvalidArgumentError("queryRecords: `paginate` cannot be combined with `top` \u2014 Dataverse honors $top as a hard cap and omits @odata.nextLink, so the result would be silently capped at one page.");if(r.fetchXml)throw new Wr.InvalidArgumentError("queryRecords: `paginate` is not supported with `fetchXml` \u2014 FetchXML paging uses a paging cookie (page / fetchxmlpagingcookie), not @odata.nextLink. Page the FetchXML manually, or use an OData query.")}let o=`/${await(0,Mt.resolveEntitySetName)(e,t)}${g1(r)}`,s=(0,ft.ensureSuccess)(await e.get(o),e.apiUrl(o));if(!r?.paginate)return(i=(n=s.body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[];let l=[],u=new Set,c=e.apiUrl(o);for(;;){let p=s.body,m=p?.value;if(!Array.isArray(m))throw new Wr.ConnectionError(c,s.status,`paginated query returned a malformed page \u2014 expected an OData 'value' array but got ${v1(m)}; refusing to return partial results.`);for(let C of m)l.push(C);let v=p?.["@odata.nextLink"];if(!v)break;if(typeof v!="string")throw new Wr.ConnectionError(c,s.status,`paginated query returned a non-string @odata.nextLink (${typeof v}); cannot follow it.`);if(u.has(v))throw new Wr.InvalidArgumentError(`queryRecords: aborting pagination \u2014 the server returned a repeated @odata.nextLink ('${v}'), which would loop indefinitely.`);u.add(v),c=v,s=(0,ft.ensureSuccess)(await e.getAbsolute(v),v)}return l}fe.queryRecords=hf;function v1(e){return e===null?"null":e===void 0?"undefined (missing)":`a ${typeof e}`}async function b1(e,t,r){return hf(e,t,{...r,paginate:!0})}fe.queryAllRecords=b1;function y1(e){if("id"in e)return`(${(0,$e.normalizeGuid)(e.id,"id")})`;let t=typeof e.value=="string"?`'${(0,$e.odataPathLiteral)(e.value)}'`:e.value;return`(${(0,$e.assertODataName)(e.key,"alternate key name")}=${t})`}async function C1(e,t,r,n){let i=y1(r),o=`/${await(0,Mt.resolveEntitySetName)(e,t)}${i}`,s=(0,ft.ensureSuccess)(await e.patch(o,yo(n)),e.apiUrl(o)),l=s.status===201,u=(0,ft.readCreatedId)(s,`${t}id`);return{id:u??("id"in r?(0,$e.normalizeGuid)(r.id,"id"):""),created:l}}fe.upsertRecord=C1;async function A1(e,t,r){var n,i;if(r.length===0)return[];let a=await(0,Mt.resolveEntitySetName)(e,t),o=r.map(c=>({"@odata.type":`Microsoft.Dynamics.CRM.${t}`,...yo(c)})),s=`/${a}/Microsoft.Dynamics.CRM.CreateMultiple`,u=(i=(n=(0,ft.ensureSuccess)(await e.post(s,{Targets:o}),e.apiUrl(s)).body)===null||n===void 0?void 0:n.Ids)!==null&&i!==void 0?i:[];if(u.length!==r.length)throw new Wr.InvalidArgumentError(`CreateMultiple on '${t}' returned ${u.length} id(s) for ${r.length} row(s)`);return u}fe.createRecordsBulk=A1;async function N1(e,t,r,n){let i=(0,$e.normalizeGuid)(r,"id"),a=(0,$e.normalizeGuid)(n.targetId,"targetId"),o=await(0,Mt.resolveEntitySetName)(e,t),s=await(0,Mt.resolveEntitySetName)(e,n.targetEntity),l=(0,$e.assertODataName)(n.relationshipName,"relationshipName"),u=`/${o}(${i})/${l}/$ref`,c={"@odata.id":e.apiUrl(`/${s}(${a})`)};(0,ft.ensureSuccess)(await e.post(u,c),e.apiUrl(u))}fe.associateRecords=N1;async function w1(e,t,r,n,i){let a=(0,$e.normalizeGuid)(r,"id"),o=(0,$e.normalizeGuid)(i,"targetId"),s=await(0,Mt.resolveEntitySetName)(e,t),l=(0,$e.assertODataName)(n,"relationshipName"),u=`/${s}(${a})/${l}(${o})/$ref`;(0,ft.ensureSuccess)(await e.delete(u),e.apiUrl(u))}fe.disassociateRecords=w1});var bf=f(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.deleteWebResource=Bt.getWebResource=Bt.updateWebResource=Bt.createWebResource=void 0;var Nn=qe(),Ui=ue(),Xl=_e(),S1={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12};function D1(e){let t=globalThis;if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");if(t.btoa){let r=globalThis.TextEncoder;if(r){let n=new r().encode(e),i="",a=32768;for(let o=0;o<n.length;o+=a)i+=String.fromCharCode(...n.subarray(o,o+a));return t.btoa(i)}return t.btoa(e)}throw new Xl.InvalidArgumentError("no base64 encoder available; pass contentBase64 instead of content")}function gf(e){if(e.contentBase64!==void 0)return e.contentBase64;if(e.content!==void 0)return D1(e.content)}async function vf(e,t){let r=`<importexportxml><webresources><webresource>${(0,Ui.xmlText)(t)}</webresource></webresources></importexportxml>`;(0,Nn.ensureSuccess)(await e.post("/PublishXml",{ParameterXml:r}),e.apiUrl("/PublishXml"))}async function E1(e,t){var r;let n=gf(t);if(n===void 0)throw new Xl.InvalidArgumentError(`web resource '${t.name}' requires content or contentBase64`);let i={name:t.name,displayname:(r=t.displayName)!==null&&r!==void 0?r:t.name,webresourcetype:S1[t.type],content:n};t.description&&(i.description=t.description);let a=(0,Nn.ensureSuccess)(await e.post("/webresourceset",i),e.apiUrl("/webresourceset")),o=(0,Nn.readCreatedId)(a,"webresourceid");if(!o)throw new Xl.InvalidArgumentError(`Dataverse did not return an id for web resource '${t.name}'`);return t.publish!==!1&&await vf(e,o),{id:o,name:t.name}}Bt.createWebResource=E1;async function I1(e,t,r){let n=(0,Ui.normalizeGuid)(t,"id"),i={},a=gf(r);a!==void 0&&(i.content=a),r.displayName!==void 0&&(i.displayname=r.displayName),r.description!==void 0&&(i.description=r.description);let o=`/webresourceset(${n})`;(0,Nn.ensureSuccess)(await e.patch(o,i),e.apiUrl(o)),r.publish!==!1&&await vf(e,n)}Bt.updateWebResource=I1;async function _1(e,t){var r;let i=`/webresourceset(${(0,Ui.normalizeGuid)(t,"id")})${(0,Ui.odataQuery)([["$select","name,displayname,webresourcetype,content,description"]])}`;return(r=(0,Nn.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)!==null&&r!==void 0?r:{}}Bt.getWebResource=_1;async function P1(e,t){let n=`/webresourceset(${(0,Ui.normalizeGuid)(t,"id")})`;(0,Nn.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Bt.deleteWebResource=P1});var yf=f(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.deleteSolution=te.importSolution=te.exportSolution=te.removeSolutionComponent=te.addSolutionComponent=te.setSolutionVersion=te.createSolution=te.createPublisher=te.fetchSolutionComponents=te.SolutionComponentType=void 0;var mt=qe(),Ir=ue(),Kl=_e();te.SolutionComponentType={SavedQuery:26,Workflow:29,SavedQueryVisualization:59,SystemForm:60,AppModule:80};var O1=[te.SolutionComponentType.SavedQuery,te.SolutionComponentType.Workflow,te.SolutionComponentType.SavedQueryVisualization,te.SolutionComponentType.SystemForm,te.SolutionComponentType.AppModule];async function F1(e,t){var r;let n=(0,Ir.normalizeGuid)(t,"solutionId"),i=O1.map(l=>`msdyn_componenttype eq ${l}`).join(" or "),a=`/msdyn_solutioncomponentsummaries${(0,Ir.odataQuery)([["$select","msdyn_objectid,msdyn_componenttype,msdyn_workflowcategory,msdyn_displayname,msdyn_name"],["$filter",`msdyn_solutionid eq ${n} and (${i})`]])}`,o=[],s=(0,mt.ensureSuccess)(await e.get(a),e.apiUrl(a));for(;;){let l=s.body;for(let c of(r=l?.value)!==null&&r!==void 0?r:[])o.push(c);let u=l?.["@odata.nextLink"];if(!u)break;s=(0,mt.ensureSuccess)(await e.getAbsolute(u),u)}return o.filter(l=>typeof l.msdyn_objectid=="string").map(l=>({objectId:l.msdyn_objectid,componentType:Number(l.msdyn_componenttype),workflowCategory:l.msdyn_workflowcategory==null?void 0:Number(l.msdyn_workflowcategory),displayName:l.msdyn_displayname,name:l.msdyn_name}))}te.fetchSolutionComponents=F1;async function R1(e,t){var r;let n={uniquename:t.uniqueName,friendlyname:t.friendlyName,customizationprefix:t.prefix,customizationoptionvalueprefix:(r=t.optionValuePrefix)!==null&&r!==void 0?r:1e4};t.description&&(n.description=t.description);let i=(0,mt.ensureSuccess)(await e.post("/publishers",n),e.apiUrl("/publishers")),a=(0,mt.readCreatedId)(i,"publisherid");if(!a)throw new Kl.InvalidArgumentError(`Dataverse did not return an id for publisher '${t.uniqueName}'`);return{id:a,uniqueName:t.uniqueName}}te.createPublisher=R1;async function T1(e,t){var r;let n=(0,Ir.normalizeGuid)(t.publisherId,"publisherId"),i={uniquename:t.uniqueName,friendlyname:t.friendlyName,version:(r=t.version)!==null&&r!==void 0?r:"1.0.0.0","[email protected]":`/publishers(${n})`};t.description&&(i.description=t.description);let a=(0,mt.ensureSuccess)(await e.post("/solutions",i),e.apiUrl("/solutions")),o=(0,mt.readCreatedId)(a,"solutionid");if(!o)throw new Kl.InvalidArgumentError(`Dataverse did not return an id for solution '${t.uniqueName}'`);return{id:o,uniqueName:t.uniqueName}}te.createSolution=T1;async function x1(e,t,r){let i=`/solutions(${(0,Ir.normalizeGuid)(t,"solutionId")})`;(0,mt.ensureSuccess)(await e.patch(i,{version:r}),e.apiUrl(i))}te.setSolutionVersion=x1;async function L1(e,t){var r;let i={ComponentId:(0,Ir.normalizeGuid)(t.componentId,"componentId"),ComponentType:t.componentType,SolutionUniqueName:t.solutionUniqueName,AddRequiredComponents:(r=t.addRequiredComponents)!==null&&r!==void 0?r:!1};t.doNotIncludeSubcomponents!==void 0&&(i.DoNotIncludeSubcomponents=t.doNotIncludeSubcomponents),(0,mt.ensureSuccess)(await e.post("/AddSolutionComponent",i),e.apiUrl("/AddSolutionComponent"))}te.addSolutionComponent=L1;async function U1(e,t,r,n){let a={SolutionComponent:{"@odata.type":"Microsoft.Dynamics.CRM.solutioncomponent",solutioncomponentid:(0,Ir.normalizeGuid)(t,"componentId")},ComponentType:r,SolutionUniqueName:n};(0,mt.ensureSuccess)(await e.post("/RemoveSolutionComponent",a),e.apiUrl("/RemoveSolutionComponent"))}te.removeSolutionComponent=U1;async function M1(e,t){var r,n;let i={SolutionName:t.solutionName,Managed:(r=t.managed)!==null&&r!==void 0?r:!1},o=(n=(0,mt.ensureSuccess)(await e.post("/ExportSolution",i),e.apiUrl("/ExportSolution")).body)===null||n===void 0?void 0:n.ExportSolutionFile;if(!o)throw new Kl.InvalidArgumentError(`ExportSolution returned no file for '${t.solutionName}'`);return{base64:o}}te.exportSolution=M1;async function B1(e,t){var r,n;let i={OverwriteUnmanagedCustomizations:(r=t.overwriteUnmanagedCustomizations)!==null&&r!==void 0?r:!0,PublishWorkflows:(n=t.publishWorkflows)!==null&&n!==void 0?n:!0,CustomizationFile:t.base64};t.importJobId&&(i.ImportJobId=(0,Ir.normalizeGuid)(t.importJobId,"importJobId")),(0,mt.ensureSuccess)(await e.post("/ImportSolution",i),e.apiUrl("/ImportSolution"))}te.importSolution=B1;async function k1(e,t){let n=`/solutions(${(0,Ir.normalizeGuid)(t,"solutionId")})`;(0,mt.ensureSuccess)(await e.delete(n),e.apiUrl(n))}te.deleteSolution=k1});var Yl=f(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.appApi=void 0;var Le=qe(),Ce=ue(),q1=_e(),$1=(0,Ce.odataQuery)([["$select","appmoduleid,name,uniquename,description"]]),V1=(0,Ce.odataQuery)([["$select","appmoduleid,name,uniquename,description"]]),G1=(0,Ce.odataQuery)([["$select","sitemapid,sitemapname,sitemapnameunique,sitemapxml"]]);function Mi(e){let t=new Set,r=[];for(let n of e??[])n&&!t.has(n)&&(t.add(n),r.push(n));return r}function z1(e){return`cdsapp_${(e||"").replace(/[^a-zA-Z0-9]/g,"")||"app"}`}async function W1(e,t){var r,n,i;if(!t)return;let a=`/sitemaps${(0,Ce.odataQuery)([["$select","sitemapid"],["$filter",`sitemapnameunique eq '${(0,Ce.odataLiteral)(t)}'`],["$top",1]])}`,o=await e.get(a);if(!(o.status<200||o.status>=300))return(i=(n=(r=o.body)===null||r===void 0?void 0:r.value)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.sitemapid}async function j1(e){let t=s=>{var l,u,c;return(c=(u=(l=s.body)===null||l===void 0?void 0:l.value)===null||u===void 0?void 0:u[0])===null||c===void 0?void 0:c.webresourceid},r=s=>`/webresourceset${(0,Ce.odataQuery)([["$select","webresourceid"],["$top",1],["$filter",s]])}`,n=await e.get(r("webresourcetype eq 5 and ismanaged eq false and contains(name,'icon')")),i=t(n);if(i)return i;let a=await e.get(r("webresourcetype eq 5 and ismanaged eq false")),o=t(a);return o||t(await e.get(r("ismanaged eq false")))}async function H1(e,t){var r,n,i;try{let a=`/roles${(0,Ce.odataQuery)([["$select","roleid"],["$filter","name eq 'System Administrator'"],["$top",1]])}`,s=(i=(n=(r=(await e.get(a)).body)===null||r===void 0?void 0:r.value)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.roleid;if(!s)return;let l=`/appmodules(${t})/appmoduleroles_association/$ref`;await e.post(l,{"@odata.id":e.apiUrl(`/roles(${s})`)})}catch{}}async function J1(e,t){async function r(o,s){var l,u;try{let c=await e.get(o);return c.status<200||c.status>=300?[]:((u=(l=c.body)===null||l===void 0?void 0:l.value)!==null&&u!==void 0?u:[]).map(m=>String(m[s])).filter(m=>m&&m!=="undefined")}catch{return[]}}let[n,i,a]=await Promise.all([r(`/systemforms${(0,Ce.odataQuery)([["$select","formid"],["$filter",`objecttypecode eq '${(0,Ce.odataLiteral)(t)}' and type eq 2 and formactivationstate eq 1`]])}`,"formid"),r(`/savedqueries${(0,Ce.odataQuery)([["$select","savedqueryid"],["$filter",`returnedtypecode eq '${(0,Ce.odataLiteral)(t)}' and querytype eq 0 and statecode eq 0`]])}`,"savedqueryid"),r(`/savedqueryvisualizations${(0,Ce.odataQuery)([["$select","savedqueryvisualizationid"],["$filter",`primaryentitytypecode eq '${(0,Ce.odataLiteral)(t)}'`]])}`,"savedqueryvisualizationid")]);return{forms:n,views:i,charts:a}}var Cf=new WeakMap;async function Q1(e,t){let r=Cf.get(e);r||(r=new Map,Cf.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=await X1(e,t);return i&&r.set(t,i),i}async function Af(e,t,r){let n=new Array(e.length),i=0;async function a(){for(let o=i;o<e.length;o=i)i=o+1,n[o]=await r(e[o])}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>a())),n}async function X1(e,t){var r;let n=`/EntityDefinitions(LogicalName='${(0,Ce.odataLiteral)(t)}')${(0,Ce.odataQuery)([["$select","MetadataId"]])}`,i=await e.get(n);if(i.status>=200&&i.status<300)return(r=i.body)===null||r===void 0?void 0:r.MetadataId}async function Nf(e,t){let r=[],n=Mi(t.entities),i=4,a=await Af(n,i,c=>Q1(e,c));for(let c of a)c&&r.push({"@odata.type":"Microsoft.Dynamics.CRM.entity",entityid:c});for(let c of Mi(t.components.forms))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:c});for(let c of Mi(t.components.views))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:c});for(let c of Mi(t.components.charts))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:c});for(let c of Mi(t.components.dashboards))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:c});let o=new Set(t.components.forms),s=new Set(t.components.views),l=new Set(t.components.charts),u=await Af(n,i,c=>J1(e,c));for(let c of u){for(let p of c.forms)o.has(p)||(o.add(p),r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:p}));for(let p of c.views)s.has(p)||(s.add(p),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:p}));for(let p of c.charts)l.has(p)||(l.add(p),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:p}))}return r}async function wf(e,t,r){if(r.length===0)return;let n="/AddAppComponents";(0,Le.ensureSuccess)(await e.post(n,{AppId:t,Components:r}),e.apiUrl(n))}async function K1(e,t,r){if(r)try{await e.delete(`/sitemaps(${r})`)}catch{}try{await e.delete(`/appmodules(${t})`)}catch{}}Co.appApi={async get(e,t){var r,n;let a=`/appmodules(${(0,Ce.normalizeGuid)(t,"id")})${$1}`,o=(0,Le.ensureSuccess)(await e.get(a),e.apiUrl(a)),s=(r=o.body)!==null&&r!==void 0?r:{},l=await W1(e,s.uniquename),u=l?(0,Ce.normalizeGuid)(l,"sitemapId"):void 0,c=null;if(u){let p=`/sitemaps(${u})${G1}`,m=(0,Le.ensureSuccess)(await e.get(p),e.apiUrl(p));s.$sitemap=(n=m.body)!==null&&n!==void 0?n:{},c=(0,Le.readEtag)(m)}return{raw:s,etag:c??(0,Le.readEtag)(o)}},async list(e,t){var r;let n=`/appmodules${V1}`,a=(0,Le.ensureSuccess)(await e.get(n),e.apiUrl(n)).body;return((r=a?.value)!==null&&r!==void 0?r:[]).map(s=>{var l,u;return{type:"app",id:(l=s.appmoduleid)!==null&&l!==void 0?l:"",name:(u=s.name)!==null&&u!==void 0?u:"",isDirty:!1}})},async create(e,t){let r=t,n=r.iconWebResourceId||await j1(e),i=r.appModuleUniqueName||z1(r.appModuleId),a={name:r.appModuleName,uniquename:i,clienttype:4,formfactor:1,navigationtype:0};r.appModuleDescription&&(a.description=r.appModuleDescription),n&&(a.webresourceid=n);let o="/appmodules",s=(0,Le.ensureSuccess)(await e.post(o,a),e.apiUrl(o)),l=(0,Le.requireCreatedId)(s,"appmoduleid","app module"),u,c=null;try{let p="/sitemaps",m=(0,Le.ensureSuccess)(await e.post(p,{sitemapnameunique:i,sitemapname:r.sitemapname,sitemapxml:r.sitemapxml}),e.apiUrl(p));u=(0,Le.requireCreatedId)(m,"sitemapid","sitemap"),c=(0,Le.readEtag)(m);let v=await Nf(e,r);v.unshift({"@odata.type":"Microsoft.Dynamics.CRM.sitemap",sitemapid:u}),await wf(e,l,v),await H1(e,l);let C="/PublishXml";(0,Le.ensureSuccess)(await e.post(C,{ParameterXml:`<importexportxml><appmodules><appmodule>${l}</appmodule></appmodules></importexportxml>`}),e.apiUrl(C))}catch(p){throw await K1(e,l,u),p}return{id:l,etag:c??(0,Le.readEtag)(s),...u?{serverIdentity:{sitemapId:u}}:{}}},async update(e,t,r,n){let i=r,a=(0,Ce.normalizeGuid)(t,"id");if(!i.sitemapId)throw new q1.ValidationError("app",a,"/sitemapId","missing sitemap identity \u2014 re-fetch the app before pushing edits");let o=(0,Ce.normalizeGuid)(i.sitemapId,"sitemapId"),s=n?{"If-Match":n}:void 0,l=`/sitemaps(${o})`,u=(0,Le.ensureSuccess)(await e.patch(l,{sitemapxml:i.sitemapxml,sitemapname:i.sitemapname},s?{headers:s}:void 0),e.apiUrl(l)),c=`/appmodules(${a})`;(0,Le.ensureSuccess)(await e.patch(c,{name:i.appModuleName,description:i.appModuleDescription}),e.apiUrl(c));let p=[];try{await wf(e,a,await Nf(e,i))}catch(m){p.push(`App '${a}': one or more components were not pinned (${m.message}). Navigation may reference content not included in the app; re-push to retry.`)}return{id:a,etag:(0,Le.readEtag)(u),...p.length>0?{warnings:p}:{}}},delete(e,t){return(0,Le.deleteRecord)(e,"appmodules",t)}}});var Sf=f(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.deleteAppCascade=void 0;var Y1=Yl(),wn=Li(),Bi=ue();function ki(e){return e instanceof Error?e:new Error(String(e))}async function Z1(e,t,r){var n;let i=(0,Bi.normalizeGuid)(t,"appModuleId"),a=(0,Bi.normalizeGuid)(r,"appModuleIdUnique"),o=[],s=[],l=null,u=[];try{let c=await(0,wn.queryRecords)(e,"appmodulecomponent",{select:["objectid","componenttype"],filter:`_appmoduleidunique_value eq ${a} and componenttype eq 62`,top:1}),p=c&&c[0]&&c[0].objectid!=null?String(c[0].objectid):null;if(l=p?(0,Bi.normalizeGuid)(p,"sitemapId"):null,l){let m=await(0,wn.queryRecords)(e,"sitemap",{select:["sitemapxml"],filter:`sitemapid eq ${l}`,top:1}),v=String((n=m&&m[0]&&m[0].sitemapxml)!==null&&n!==void 0?n:""),C=/GenPageId="([0-9a-fA-F-]{36})"/g,w=C.exec(v);for(;w!==null;)u.push((0,Bi.normalizeGuid)(w[1],"GenPageId")),w=C.exec(v)}}catch(c){s.push({operation:"resolve",type:"sitemap",id:a,error:ki(c)})}if(await Y1.appApi.delete(e,i),o.push({type:"app",id:i}),l)try{await(0,wn.deleteRecord)(e,"sitemap",l),o.push({type:"sitemap",id:l})}catch(c){s.push({operation:"delete",type:"sitemap",id:l,error:ki(c)})}for(let c of new Set(u)){let p;try{p=await(0,wn.queryAllRecords)(e,"uxagentprojectfile",{select:["uxagentprojectfileid"],filter:`_uxagentprojectid_value eq ${c}`})}catch(m){s.push({operation:"resolve",type:"genPageFile",id:c,error:ki(m)});continue}for(let m of p??[]){let v=(0,Bi.normalizeGuid)(String(m.uxagentprojectfileid),"uxagentprojectfileid");try{await(0,wn.deleteRecord)(e,"uxagentprojectfile",v),o.push({type:"genPageFile",id:v})}catch(C){s.push({operation:"delete",type:"genPageFile",id:v,error:ki(C)})}}try{await(0,wn.deleteRecord)(e,"uxagentproject",c),o.push({type:"genPage",id:c})}catch(m){s.push({operation:"delete",type:"genPage",id:c,error:ki(m)})}}return{success:s.length===0,deleted:o,failures:s}}Ao.deleteAppCascade=Z1});var Df={};xt(Df,{Guid:()=>E});var E,Ae=S(()=>{"use strict";E=class e{guidString;guid;static get EmptyGuid(){return new e("00000000-0000-0000-0000-000000000000")}static NewGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=Math.random()*16|0,n=t=="x"?r:r&3|8;return n.toString(16)})}constructor(t,r=!1){this.guidString=t;let n=new RegExp("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");(r||n.test(t))&&(this.guid=t)}ToString(){return this.guid}}});var I,Ve=S(()=>{"use strict";be();I=class e{static get EmptyString(){return""}static IsTrue(t){let r=!1;return r=t&&(this.IsStrictTrue(t)||this.IsYes(t)),r}static IsStrictTrue(t){let r=!1;return t&&(r=t.toLowerCase()==="true"),r}static IsYes(t){return t.toLowerCase()==="yes"||t.toLowerCase()==="y"}static get WhiteSpace(){return/ /g}static get EnglishAndNumericCharacters(){return/([a-z0-9A-Z]+)/g}static get ValidIdExpression(){return/([a-z0-9A-Z_]+)/g}static IsNullOrEmpty(t){return t==null||t==null||t==""}static Format(t,r){return e.IsNullOrEmpty(t)?t:t.replace(/\{\{|\}\}|\{(\d+)\}/g,function(n,i){return n=="{{"?"{":n=="}}"?"}":r[i]})}static EndsWithString(t,r){return t.indexOf(r,t.length-r.length)!==-1}static IsBlankString(t){return t.replace(/\s/g,"").length==0}static EscapeXml(t,r){let n=t;return this.IsNullOrEmpty(n)||(n=n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),r&&(n=n.replace(/"/g,""").replace(/'/g,"'"))),n}static EscapeDomId(t){return t.replace(".","\\.")}static ToSnakeCase(t){let r=e.EmptyString;for(let n=0;n<t.length;n++)n!==0&&t[n]==t[n].toUpperCase()&&(r+="-"),r+=t[n].toLowerCase();return r}static GetSnakeCaseMarkup(t,r){let n="<"+this.ToSnakeCase(t);if(!N.IsNullOrUndefined(r))for(let i of r.getKeys())n+=" "+this.ToSnakeCase(i)+'="'+r.getValue(i)+'"';return n+">"}static StripBraces(t){return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?t.substr(1,t.length-2):t}static AddBraces(t){return N.IsNullOrUndefined(t)||t.charAt(0)==="{"||t.charAt(t.length-1)==="}"?t:`{${t}}`}static GuidStringEquals(t,r){return t===r?!0:!t||!r?!1:e.StripBraces(t).toUpperCase()===e.StripBraces(r).toUpperCase()}static AddBracesToArrayValues(t){return t.length>0?t.map(n=>(n.charAt(0)!=="{"&&(n="{"+n),n.charAt(n.length-1)!=="}"&&(n=n+"}"),n)):t}static StripBracesOnArrayValues(t){return t.length>0?t.map(n=>{let i;return n.charAt(0)==="{"&&(i=n.substr(1,n.length-1)),n.charAt(n.length-1)==="}"&&(i=i.substr(0,n.length-2)),i}):t}}});var Ef={};xt(Ef,{ScriptUtilities:()=>N});var N,be=S(()=>{"use strict";Ae();Ve();N=class e{static IsNullOrUndefined(t){return t==null||t===void 0}static IsMacMachine(){return navigator.platform.indexOf("Mac")!==-1}static IsNullOrEmptyGuid(t){return I.IsNullOrEmpty(t.ToString())?!0:E.EmptyGuid.ToString()===t.ToString()}static IsNullOrUndefinedNested(t,r){return r.split(".").every(i=>typeof t!="object"||t==null||!(i in t)||t[i]==null?!1:(t=t[i],!0))}static ParseXml(t){return new DOMParser().parseFromString(t,"text/xml")}static IsWellFormedXml(t){return!e.ParseXml(t).querySelector("parsererror")}static getNamedItemValue(t,r){let n=t.getNamedItem(r);return e.IsNullOrUndefined(n)?null:n.value}static getBooleanValue(t,r){let n=e.getNamedItemValue(t,r);return e.IsNullOrUndefined(n)?null:I.IsTrue(n)}static getNumericValue(t){return e.IsNullOrUndefined(t)?null:parseInt(t)}static getAllUniqueTagNames(t){let r=new Set;return e.getAllUniqueTagNamesHelper(t,r),r}static getAllUniqueTagNamesHelper(t,r){if(t.nodeType===Node.ELEMENT_NODE&&(r.add(t.tagName),t.hasChildNodes()))for(let n=0;n<t.children.length;n++)this.getAllUniqueTagNamesHelper(t.children.item(n),r)}}});var No,wo,jr,So,Zl,Do,eu=S(()=>{"use strict";(function(e){e[e.FormElementNodeChange=0]="FormElementNodeChange",e[e.FormElementAttributeChange=1]="FormElementAttributeChange"})(No||(No={}));wo=class{type;targetNode;constructor(t,r){this.type=t,this.targetNode=r}},jr=class extends wo{key;oldValue;newValue;constructor(t,r,n,i){super(No.FormElementNodeChange,t),this.key=r,this.oldValue=n,this.newValue=i}apply(){this.targetNode.replaceObjectPropertyValue(this.key,this.newValue)}revert(){this.targetNode.replaceObjectPropertyValue(this.key,this.oldValue)}},So=class extends wo{property;oldValue;newValue;constructor(t,r,n,i){super(No.FormElementAttributeChange,t),this.property=r,this.oldValue=n,this.newValue=i}apply(){this.targetNode.replaceAttributeValue(this.property,this.newValue)}revert(){this.targetNode.replaceAttributeValue(this.property,this.oldValue)}},Zl=class{changeSet;reversedChangeSet;constructor(t){this.changeSet=t,this.changeSet&&(this.reversedChangeSet=this.changeSet.slice().reverse())}length(){return this.changeSet?this.changeSet.length:0}apply(){this.changeSet&&this.changeSet.length>0&&this.changeSet.forEach(t=>{t.apply()})}revert(){this.reversedChangeSet&&this.reversedChangeSet.length>0&&this.reversedChangeSet.forEach(t=>{t.revert()})}},Do=class{isTracking;_trackedChanges;_trackedChangeSets;constructor(t=!1){this.isTracking=t,this._trackedChanges=[],this._trackedChangeSets=[]}addChange(t){this.isTracking&&this._trackedChanges.push(t)}collectChanges(){let t=new Zl(this._trackedChanges.slice());return this._trackedChanges=[],t}pushChangeSet(t){this._trackedChangeSets.push(t)}popChangeSet(){if(this._trackedChangeSets?.length>0)return this._trackedChangeSets.pop()}getChangeSets(){return this._trackedChangeSets}}});var If={};xt(If,{ChartGridMode:()=>ht,ColumnLayoutWidths:()=>i_,ComponentCategory:()=>Io,ComponentType:()=>tu,ControlLayoutTypes:()=>lu,DisplayConditionsInfo:()=>r_,ElementNames:()=>h,ElementProperties:()=>d,ElementType:()=>nu,EntityAttributeProperty:()=>iu,EventType:()=>qi,FormActivationState:()=>su,FormCanvasServiceScope:()=>g_,FormDesignerSideBarTab:()=>ru,FormPresentation:()=>au,FormState:()=>Eo,FormType:()=>Ne,HeaderDensityType:()=>_r,LookUpTable:()=>kt,MORE_TAB_PREFIX:()=>o_,NavBarChildElementType:()=>ou,PREVIEW_ID_HEADER_FLYOUT:()=>c_,PREVIEW_ID_HEADER_OVERFLOW_BUTTON:()=>p_,PREVIEW_ID_NAVIGATION_AREA:()=>l_,PREVIEW_ID_QUICKCREATE_ROOT:()=>m_,PREVIEW_ID_TAB:()=>f_,PREVIEW_ID_TAB_LIST:()=>d_,PREVIEW_ID_TAB_PANEL:()=>u_,PropertyModelKeys:()=>du,PropertyModelSectionKeys:()=>a_,RELATED_TAB_ID:()=>pu,RELATED_TAB_PREFIX:()=>s_,SectionDefaultProperties:()=>n_,SectionLayoutTypes:()=>de,TabContentType:()=>uu,TabDefaultProperties:()=>Pr,TabLayoutTypes:()=>ce,TelemetryPropertyNames:()=>h_,UnboundControlPropertyKeys:()=>cu,compositeAddressFields:()=>t_,compositeFieldNames:()=>dt,compositeFields:()=>e_});var Ne,tu,ru,h,d,nu,dt,e_,t_,iu,kt,Eo,_r,au,r_,ou,su,ce,n_,Pr,de,lu,uu,i_,cu,du,a_,qi,ht,pu,o_,s_,l_,u_,c_,d_,p_,f_,m_,h_,Io,g_,G=S(()=>{"use strict";(function(e){e[e.Dashboard=0]="Dashboard",e[e.AppointmentBook=1]="AppointmentBook",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.MobileExpress=5]="MobileExpress",e[e.QuickViewForm=6]="QuickViewForm",e[e.QuickCreate=7]="QuickCreate",e[e.Dialog=8]="Dialog",e[e.TaskFlowForm=9]="TaskFlowForm",e[e.InteractionCentricDashboard=10]="InteractionCentricDashboard",e[e.Card=11]="Card",e[e.MainInteractiveExperience=12]="MainInteractiveExperience",e[e.Other=100]="Other",e[e.MainBackup=101]="MainBackup",e[e.AppointmentBookBackup=102]="AppointmentBookBackup",e[e.PowerBIDashboard=103]="PowerBIDashboard"})(Ne||(Ne={}));(function(e){e[e.Form=0]="Form",e[e.Dialog=1]="Dialog"})(tu||(tu={}));(function(e){e[e.Components=0]="Components",e[e.Properties=1]="Properties",e[e.Relationship=2]="Relationship",e[e.BusinessRules=3]="BusinessRules"})(ru||(ru={}));(function(e){e.form="form",e.formTab="tab",e.formColumn="column",e.formSection="section",e.formRow="row",e.formCell="cell",e.formLabel="label",e.formControl="control",e.formEvent="event",e.dependency="dependency",e.queryStringParameter="querystringparameter",e.controlDescriptions="controlDescriptions",e.controlDescription="controlDescription",e.customControl="customControl",e.dataset="data-set",e.formFooter="footer",e.formHeader="header",e.formNavigation="Navigation",e.formTabs="tabs",e.formColumns="columns",e.formSections="sections",e.formRows="rows",e.formEvents="events",e.quickFormDependencies="externaldependencies",e.controlParameters="parameters",e.formDependencies="dependencies",e.formNavBarAreas="NavBarAreas",e.formNavBarArea="NavBarArea",e.formNavBar="NavBar",e.spacerControl="SpacerControl",e.formField="Field",e.formNavBarByRelationshipItem="NavBarByRelationshipItem",e.formNavBarItem="NavBarItem",e.Title="Title",e.Titles="Titles",e.NavigationLink="Navigation Link",e.Relationship="Relationship",e.NavigationLinkIconClass="mscrm-glyph-NavLinkIcon",e.formDisplayConditions="DisplayConditions",e.formLibraries="formLibraries",e.internalLibraries="internaljscriptfile",e.eventHandlers="Handlers",e.handler="Handler",e.library="Library",e.formRoles="Role",e.formEveryOne="Everyone",e.Handler="Handler",e.EventHandlers="Handlers",e.InternalEventHandlers="InternalHandlers",e.HiddenControl="hiddencontrols",e.EventDependencies="dependencies",e.EventDependency="dependency",e.isvisibleinmocaonly="msinternal.isvisibleinmocaonly"})(h||(h={}));d={ShowImage:"showImage",ShowNavigationbar:"shownavigationbar",MaxWidth:"maxWidth",HeaderDensityType:"headerdensity",OnLoadEvent:"onload",EventActive:"active",EventAttribute:"attribute",Relationship:"relationship",Control:"control",HandlerUniqueId:"handlerUniqueId",functionName:"functionName",libraryNameEventHandler:"libraryName",enabledForField:"enabled",passExecutionContext:"passExecutionContext",parameters:"parameters",eventFunctionName:"eventFunctionName",eventEnabled:"eventEnabled",indicationOfSubgrid:"indicationOfSubgrid",Name:"name",Type:"type",TitleResourceId:"TitleResourceId",Show:"Show",RelationshipName:"RelationshipName",Sequence:"Sequence",Area:"Area",headerPrefix:"header_",application:"application",labelId:"labelid",showbar:"showbar",layout:"layout",classid:"classid",uniqueid:"uniqueid",isUnbound:"isunbound",isRequired:"isrequired",rowspan:"rowspan",rowheight:"rowheight",colspan:"colspan",width:"width",IsUserDefined:"IsUserDefined",expanded:"expanded",related:"related",showlabel:"showlabel",locklevel:"locklevel",datafieldname:"datafieldname",formFactor:"formFactor",static:"static",disabled:"disabled",description:"description",languagecode:"languagecode",LCID:"LCID",groupName:"group",contentType:"contenttype",showCommandBar:"showcommandbar",showBody:"showbody",showTabNavigator:"showtabnavigator",userspacer:"userspacer",columnName:"columns",LabelWidth:"labelwidth",Fieldlabelalignment:"celllabelalignment",Fieldlabelposition:"celllabelposition",availableforphone:"availableforphone",Locked:"bLocked",ReadOnly:"bDisabled",visible:"visible",ForControl:"forControl",text:"Text",url:"Url",passParameters:"PassParameters",autoExpand:"AutoExpand",auto:"auto",Auto:"Auto",Fixed:"Fixed",icon:"Icon",id:"id",Id:"Id",showOnMobileClient:"ShowOnMobileClient",webResourceId:"WebResourceId",viewName:"ViewName",failureTimeField:"FailureTimeField",successCondition:"SuccessConditionName",successConditionValue:"SuccessConditionValue",failureCondition:"FailureConditionName",failureConditionValue:"FailureConditionValue",warningCondition:"WarningConditionName",warningConditionValue:"WarningConditionValue",cancelCondition:"CancelConditionName",cancelConditionValue:"CancelConditionValue",pauseCondition:"PauseConditionName",pauseConditionValue:"PauseConditionValue",filterResults:"FilterResults",autoSuggestionSource:"AutoSuggestionSource",numberOfResults:"NumberOfResults",addressField:"AddressField",displayAsCustomer360Tile:"DisplayAsCustomer360Tile",hideQuickFormBorder:"HideQuickFormBorder",quickForms:"QuickForms",entityName:"EntityName",controlMode:"ControlMode",headerColorCode:"HeaderColorCode",targetEntityType:"TargetEntityType",enableQuickFind:"EnableQuickFind",enableViewPicker:"EnableViewPicker",enableChartPicker:"EnableChartPicker",recordsPerPage:"RecordsPerPage",chartGridMode:"ChartGridMode",referencePanelSubgridIconUrl:"ReferencePanelSubgridIconUrl",referencePanelQuickFormCollectionIconUrl:"ReferencePanelQuickFormCollectionIconUrl",referencePanelSearchWidgetIconUrl:"ReferencePanelSearchWidgetIconUrl",viewId:"ViewId",isUserView:"IsUserView",enableJumpBar:"EnableJumpBar",isUserChart:"IsUserChart",viewIds:"ViewIds",filteredViewIds:"FilteredViewIds",visualizationId:"VisualizationId",teamTemplateId:"TeamTemplateId",selectDefaultLanguage:"SelectDefaultLanguage",allowChangingFiltersOnUI:"AllowChangingFiltersOnUI",enableAutoSuggestions:"EnableAutoSuggestions",enableRating:"EnableRating",searchForAutoSuggestionsUsing:"SearchForAutoSuggestionsUsing",showContextualActions:"ShowContextualActions",showDepartmentFilter:"ShowDepartmentFilter",showLanguageFilter:"ShowLanguageFilter",showRatingUsing:"ShowRatingUsing",actionList:"ActionList",Order:"Order",FallbackForm:"FallbackForm",allowSearchFilter:"allowSearchFilter",socialInstanceParameters:"<Parameters>k__BackingField",signalUrl:"SignalUrl",border:"Border",scrolling:"Scrolling",security:"Security",BingMapsAddress1Composite:"address1_composite",BingMapsAddress2Composite:"address2_composite",UrlHttpsProtocolPrefix:"https://",UrlHttpProtocolPrefix:"http://",showAll:"ShowAll",ShowFilterPane:"UClientShowFilterPane",ExpandFilterPane:"UClientExpandFilterPane",SortOption:"UClientOrderBy",DefaultModuleCreateExperience:"UClientDefaultModuleForCreateExperience",RecordPerPages:"UClientRecordPerPage",moduleList:"UClientModules",showAllModule:"Show All",showSelectedModule:"Show Selected",Ascending:"Ascending",Descending:"Descending",Activities:"Activities",Posts:"Posts",Notes:"Notes",CardForm:"CardForm",SelectActivity:"SelectActivity",DisplayActivity:"UClientDisplayActivityUsing",CreateActivity:"UClientCreateActivityUsing",DisplayActivityHeader:"UClientDisplayActivityHeaderUsing",SortTimeLine:"UClientSortActivitiesByValue",activityList:"UClientActivities",CardActivityMap:"UClientActivityCardMap",DefaultTabId:"DefaultTabId",EmailConversationView:"EmailConversationView",OrderByActivityWall:"OrderByActivityWall",ShowArticleTab:"ShowArticleTab",SortActivityWall:"SortActivityWall",TimelineUniqueName:"UClientUniqueName",SortTimeLineBy:"modifiedon",SelectActivityListDefault:"appointment",SelectCardDefault:"Select Card Form",AscendingValue:"ascending",DescendingValue:"descending",DefaultTabIdValue:"ActivitiesTab",EmailConversationViewDefault:"true",ShowArticleTabDefault:"false",SelectDefaultLanguage:"SelectDefaultLanguage",SelectDefaultLanguageValue:"00000000-0000-0000-0000-000000000000",SortActivityWallDefault:"modifiedon",RecordPerPagesDefault:"10",TimelineNameLabel:"Timeline",showSelectedActions:"Show Selected",defaultFormat:"defaultformat",fieldLabels:"fieldlabels",QuickCreateForm:"quickcreateform",QuickFormNameToIdXMLTempate:"<QuickFormId e,yname={0}>{1}</QuickFormId>",QuickFormIdListXMLTempate:"<QuickFormId,}</QuickFormIds>",AllowFilterOff:"AllowFilterOff",AutoResolve:"AutoResolve",DefaultViewId:"DefaultViewId",DependentAttributeName:"DependentAttributeName",DependentAttributeType:"DependentAttributeType",DisableMru:"DisableMru",UseMFDForCreate:"useMainFormDialogForCreate",UseMFDForEdit:"useMainFormDialogForEdit",DisableQuickFind:"DisableQuickFind",DisableViewPicker:"DisableViewPicker",FilterRelationshipName:"FilterRelationshipName",AvailableViewIds:"AvailableViewIds",MainForm:"mainform",DefaultsFields:"defaultfields",TimeLineCardForm:"cardform",libraryUniqueId:"libraryUniqueId",libraryName:"name",displayName:"displayName",OnChangeEvent:"onchange",ViewIdRAControlDefault:"{92AFD454-0F2E-4397-A1C8-05E37C6AD699}",TargetEntityTypeRAControlDefault:"actioncard",ChartGridModeRAControlDefault:"All",RecordsPerPageRAControlDefault:"4",RAControlDefaultValue:"false",RAcontrolDefaultHeaderColorCode:"#000000",DropdownSelectedDefaultValue:"1",selectPrimaryCustomer:"SelectPrimaryCustomer",bindAttribute:"BindAttribute"};(function(e){e[e.TAB=0]="TAB",e[e.SECTION=1]="SECTION",e[e.BASIC_CONTROL=2]="BASIC_CONTROL",e[e.HEADER=3]="HEADER",e[e.FOOTER=4]="FOOTER",e[e.UB_CONTROL=5]="UB_CONTROL",e[e.RELATIONSHIPITEM=6]="RELATIONSHIPITEM",e[e.RELATIONSHIPGROUP=7]="RELATIONSHIPGROUP",e[e.NAVIGATIONLINK=8]="NAVIGATIONLINK",e[e.FORMMODEL=9]="FORMMODEL",e[e.UNDEFINED=10]="UNDEFINED"})(nu||(nu={}));dt={fullname:"fullname",yomifullname:"yomifullname",address1_composite:"address1_composite",address2_composite:"address2_composite",address3_composite:"address3_composite",billto:"billto_composite",shipto:"shipto_composite"},e_=[dt.fullname,dt.yomifullname,dt.address1_composite,dt.address2_composite,dt.address3_composite,dt.billto,dt.shipto],t_=[dt.address1_composite,dt.address2_composite,dt.address3_composite,dt.billto,dt.shipto];(function(e){e[e.IsValidForForm=0]="IsValidForForm",e[e.IsValidForCreate=1]="IsValidForCreate"})(iu||(iu={}));(function(e){e[e.DependencyFieldTable=0]="DependencyFieldTable",e[e.LockedFieldTable=1]="LockedFieldTable"})(kt||(kt={}));(function(e){e[e.Published=0]="Published",e[e.Draft=1]="Draft",e[e.New=2]="New",e[e.SaveAs=3]="SaveAs"})(Eo||(Eo={}));(function(e){e.Low="Low",e.HighReadOnlyValues="HighReadOnlyValues",e.HighWithControls="HighWithControls"})(_r||(_r={}));(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(au||(au={}));r_={TopOrderFormId:"topOrderFormId",NextDisplayOrder:"nextDisplayOrder"};(function(e){e[e.NavBarRelationShipItem=0]="NavBarRelationShipItem",e[e.NavBarItem=1]="NavBarItem"})(ou||(ou={}));(function(e){e[e.InActive=0]="InActive",e[e.Active=1]="Active"})(su||(su={}));(function(e){e[e.ONE_COLUMN=0]="ONE_COLUMN",e[e.TWO_COLUMN_EQUAL=1]="TWO_COLUMN_EQUAL",e[e.TWO_COLUMN_WIDER_LEFT=2]="TWO_COLUMN_WIDER_LEFT",e[e.TWO_COLUMN_WIDER_RIGHT=3]="TWO_COLUMN_WIDER_RIGHT",e[e.TWO_COLUMN_CUSTOM_LAYOUT=4]="TWO_COLUMN_CUSTOM_LAYOUT",e[e.THREE_COLUMN_EQUAL=5]="THREE_COLUMN_EQUAL",e[e.THREE_COLUMN_WIDER_MID=6]="THREE_COLUMN_WIDER_MID",e[e.THREE_COLUMN_CUSTOM_LAYOUT=7]="THREE_COLUMN_CUSTOM_LAYOUT"})(ce||(ce={}));n_={ShowLabel:"false",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_"},Pr={namePrefix:"tab_",ShowLabel:"true",LockLevel:"0",IsUserDefined:"0"};(function(e){e[e.ONE_COLUMN=0]="ONE_COLUMN",e[e.TWO_COLUMN=1]="TWO_COLUMN",e[e.THREE_COLUMN=2]="THREE_COLUMN",e[e.FOUR_COLUMN=3]="FOUR_COLUMN",e[e.REFERENCE_PANEL=4]="REFERENCE_PANEL"})(de||(de={}));(function(e){e[e.SUBGRID=0]="SUBGRID",e[e.SPACER=1]="SPACER",e[e.QUICK_VIEW=2]="QUICK_VIEW",e[e.WEB_RESOURCE=3]="WEB_RESOURCE",e[e.IFRAME=4]="IFRAME",e[e.BING_MAPS=5]="BING_MAPS",e[e.TIMER=6]="TIMER",e[e.TIMELINE=7]="TIMELINE",e[e.NOTES=8]="NOTES",e[e.SOCIAL_INSIGHTS=9]="SOCIAL_INSIGHTS",e[e.KB_SEARCH=10]="KB_SEARCH",e[e.INTERACTION_WALL=11]="INTERACTION_WALL",e[e.ACI_CONTROL=12]="ACI_CONTROL",e[e.RELATIONSHIP_ASSISTANT=13]="RELATIONSHIP_ASSISTANT",e[e.REFERENCE_PANEL=14]="REFERENCE_PANEL",e[e.REF_PANEL_QUICKVIEW=15]="REF_PANEL_QUICKVIEW",e[e.REF_PANEL_SUBGRID=16]="REF_PANEL_SUBGRID",e[e.REF_PANEL_KBSEARCH=17]="REF_PANEL_KBSEARCH",e[e.WEB_RESOURCE_HTML=18]="WEB_RESOURCE_HTML",e[e.PRED_LEAD_SCORING=19]="PRED_LEAD_SCORING"})(lu||(lu={}));(function(e){e.cardSections="cardSections",e.singleComponent="singleComponent",e.default="default",e.expandAvailableSpace="expandAvailableSpace"})(uu||(uu={}));i_={ONE_COLUMN:"100",TWO_COLUMN:"50",THREE_COLUMN:"33.33",FOUR_COLUMN:"25"};(function(e){e.minValue="MinValue",e.maxValue="MaxValue",e.precision="Precision",e.maxLength="MaxLength",e.entityLogicalName="EntityLogicalName",e.defaultViewId="DefaultViewId",e.optionSetDefaultValue="DefaultValue",e.optionSetId="OptionSetId"})(cu||(cu={}));(function(e){e.entityName="entityName",e.formName="formName",e.formDisplayName="formDisplayName",e.description="description",e.maxWidth="maxWidth",e.showNavigation="showNavigation",e.showImageCheck="showImageCheck",e.downloadFormXml="downloadFormXml",e.downloadRawFormXml="downloadRawFormXml",e.expandTab="expandTab",e.singleComponent="singleComponent",e.label="label",e.name="name",e.hiddenByDefault="hiddenByDefault",e.hideForPhone="hideForPhone",e.tabLayout="tabLayout",e.column1Width="column1Width",e.column2Width="column2Width",e.column3Width="column3Width",e.hideLabel="hideLabel",e.lockElement="lockElement",e.sectionLayout="sectionLayout",e.labelWidth="labelWidth",e.fieldLabelAlignment="fieldLabelAlignment",e.fieldLabelPosition="fieldLabelPosition",e.cellWidth="cellWidth",e.fieldHeight="fieldHeight",e.cellHeight="cellHeight",e.showLine="showLine",e.readonly="readonly",e.required="required",e.maxLength="maxLength",e.isTitle="isTitle",e.minValue="minValue",e.maxValue="maxValue",e.precision="precision",e.autoExpand="autoExpand",e.highDensityEnabled="highDensityEnabled",e.hideExtendedHeader="hideExtendedHeader",e.defaultViewProperty="defaultViewProperty",e.defaultChartProperty="defaultChartProperty",e.teamTemplateProperty="teamTemplateProperty",e.datasourceProperty="datasourceProperty",e.eventType="eventType",e.addEvent="addEvent",e.cellOnChange="cellOnChange",e.cellOnChangeEventDependencies="cellOnChangeEventDependencies",e.cellOnChangeHandlers="cellOnChangeHandlers",e.gridOnChange="gridOnChange",e.gridOnChangeEventDependencies="gridOnChangeEventDependencies",e.gridOnChangeHandlers="gridOnChangeHandlers",e.gridOnChangeTargetField="gridOnChangeTargetField",e.gridOnRecordSelect="gridOnRecordSelect",e.gridOnRecordSelectEventDependencies="gridOnRecordSelectEventDependencies",e.gridOnRecordSelectHandlers="gridOnRecordSelectHandlers",e.cellOnReadyStateEventDependencies="cellOnReadyStateEventDependencies",e.cellOnReadyStateHandlers="cellOnReadyStateEventHandlers",e.tabOnChange="tabOnChange",e.tabOnChangeEventDependencies="tabOnChangeEventDependencies",e.tabOnChangeHandlers="tabOnChangeHandlers",e.formOnLoad="formOnLoad",e.formOnLoadEventDependencies="formOnLoadEventDependencies",e.formOnLoadHandlers="formOnLoadHandlers",e.formOnSave="formOnSave",e.formOnSaveDependencies="formOnSaveDependencies",e.formOnSaveHandlers="formOnSaveHandlers",e.gridOnSave="gridOnSave",e.gridOnSaveDependencies="gridOnSaveDependencies",e.gridOnSaveHandlers="gridOnSaveHandlers",e.formHasNoLibraries="formHasNoLibraries",e.hideHeaderCommandBar="hideHeaderCommandBar",e.hideHeaderBody="hideHeaderBody",e.hideHeaderTabNavigator="hideHeaderTabNavigator",e.hideFooter="hideFooter",e.scrollingDropdown="scrollingDropdown",e.displayBorder="displayBorder",e.crossScripting="crossScripting",e.passParams="passParams",e.webResourceCustomParamData="webResourceCustomParameterData",e.webResourceAltText="webResourceAltText",e.verticalAlignment="verticalAlignment",e.horizontalAlignment="horizontalAlignment",e.specificSize="specificSize",e.urlProperty="urlProperty",e.enableViewPicker="enableViewPicker",e.enableChartPicker="enableChartPicker",e.chartGridMode="chartGridMode",e.relatedRecords="relatedRecords",e.hideSearchBox="hideSearchBox",e.showAllViews="showAllViews",e.availableViewsProperty="availableViewsProperty",e.recordsPerPage="recordsPerPage",e.businessRulePill="business-rule-pill-",e.addBusinessRule="addBusinessRule",e.rowHeight="rowHeight",e.refPanelSectionTabs="refPanelSectionTabs",e.editCanvasAppProperty="editCanvasAppProperty"})(du||(du={}));a_={display:"DisplayOptions",format:"Formatting",control:"Controls",data:"DataOptions",form:"FormProperties",events:"EventProperties",activeBusinessRules:"activeBusinessRules",addBusinessRule:"addBusinessRule",inactiveBusinessRules:"inactiveBusinessRules"};(function(e){e.onChange="onchange",e.onTabStateChange="tabstatechange",e.onLoad="onload",e.onSave="onsave",e.onReadyStateComplete="onreadystatecomplete",e.onRecordSelect="onrecordselect"})(qi||(qi={}));(function(e){e.All="All",e.Chart="Chart",e.Grid="Grid"})(ht||(ht={}));pu="tab_related3b554255-7717-4d17-bb7f-9936fb1e75ca",o_="more_tab_",s_="related_tab_",l_="preview_id_navigation_area",u_="tab-section",c_="headerFieldsFlyout",d_="tablist",p_="header_overflowButton",f_="tab",m_="quickCreateRoot",h_={defaultVisibility:"Default visibility"};(function(e){e.input="input",e.layout="layout",e.grid="grid",e.relatedData="relatedData",e.display="display",e.powerbi="powerbi",e.artificialIntelligence="artificialIntelligence",e.media="media",e.collaboration="collaboration",e.more="more",e.test="test",e.popular="popular"})(Io||(Io={}));g_="CellCanvasServiceScope"});var _f={};xt(_f,{Attribute:()=>_o,FormElementNode:()=>q});var _o,q,Oe=S(()=>{"use strict";be();Ve();eu();G();Ae();_o=class{key;value;constructor(t,r){this.key=t,this.value=r}},q=class e{nodeName;properties;childrenNodes;parentNode;nodeId;isTransient;constructor(t,r){this.nodeName=t,this.properties=[],this.childrenNodes=[],this.parentNode=r,this.isTransient=!1,this.nodeId=`nodeId-${E.NewGuid()}`}getProperty(t){for(let r of this.properties)if(r.key===t)return r.value;return null}getNodeId(){return this.nodeId}getNodeName(){return this.nodeName}setNodeName(t){this.trackObjectPropertyChange("nodeName",t)}get NodeName(){return this.getNodeName()}getAllProperties(){return this.properties}replaceAttributeValue(t,r){this.properties.find(n=>n===t)&&(t.value=r)}replaceObjectPropertyValue(t,r){this[t]=r}getAllChildren(){return this.childrenNodes}getParentNode(){return this.parentNode}visit(t){let r=!1;if(t){r=!!t(this);let n=this.childrenNodes;if(!r&&n)for(let i=0;!r&&i<n.length;i++)r=n[i].visit(t)}return r}findAll(t){let r=[];return t&&this.visit(n=>{t(n)&&r.push(n)}),r}findFirst(t){let r=null;return t&&this.visit(n=>{if(t(n))return r=n,!0}),r}raiseMetadataChange(t){let r=this.getAncestor(h.form);r&&r.raiseMetadataChange(t)}trackPropertyAddition(t,r){this.trackPropertyCollectionChange(()=>{this.properties.push(new _o(t,r))})}trackPropertyDeletion(t){this.trackPropertyCollectionChange(()=>{let r=this.properties.findIndex(n=>n.key===t);r>-1&&this.properties.splice(r,1)})}trackPropertyCollectionChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.properties.slice();t(),r.addChange(new jr(this,"properties",n,this.properties.slice()))}else t()}trackChildrenCollectionChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.childrenNodes.slice();t(),r.addChange(new jr(this,"childrenNodes",n,this.childrenNodes.slice()))}else t()}trackParentNodeChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.parentNode;if(t(),n===this.parentNode)return;r.addChange(new jr(this,"parentNode",n,this.parentNode))}else t()}trackAttributeValueChange(t,r){let n=this.changeTracker();if(n&&n.isTracking){let i=t.value;if(i===r)return;t.value=r,n.addChange(new So(this,t,i,r))}else t.value=r}trackObjectPropertyChange(t,r){let n=this.changeTracker();if(n&&n.isTracking){let i=this[t];if(i===r)return;this[t]=r,n.addChange(new jr(this,t,i,r))}else this[t]=r}setProperty(t,r){if(!t)throw new Error("Invalid property key");let n=this.properties.find(i=>i.key===t);n?this.trackAttributeValueChange(n,r):this.addProperty(t,r)}addProperty(t,r){if(!t)throw new Error("Invalid property key");this.trackPropertyAddition(t,r)}removeProperty(t){this.trackPropertyDeletion(t)}addChild(t){t.trackParentNodeChange(()=>{t.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.push(t)})}insertChildAtIndex(t,r){N.IsNullOrUndefined(t)||(t.trackParentNodeChange(()=>{t.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(r,0,t)}))}moveChild(t,r){let n=this.childrenNodes.indexOf(t);if(n<0)return!1;let i=Math.min(Math.max(0,n+r),this.childrenNodes.length-1);return n!==i&&this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(i,0,this.childrenNodes.splice(n,1)[0])}),!0}getChildren(t){let r=[];for(let n of this.childrenNodes)n.nodeName===t&&r.push(n);return r}getFirstChild(t){for(let r of this.childrenNodes)if(r.nodeName===t)return r;return null}getAllGrandChildren(t){let r=this.getChildren(t),n=null;return r.length===0?new Array:(n=r[0],n.childrenNodes)}deleteChild(t){if(N.IsNullOrUndefined(t))return-1;for(let r=0;r<this.childrenNodes.length;r++)if(this.childrenNodes[r]===t)return this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(r,1)}),r;return-1}deleteAllChildren(){this.trackChildrenCollectionChange(()=>{this.childrenNodes=[]})}getParent(){return this.parentNode}getParentType(){return this.parentNode?this.parentNode.nodeName:I.EmptyString}updateChild(t,r){let n=this.childrenNodes.indexOf(t);return n>-1?(r.trackParentNodeChange(()=>{r.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(n,1,r)}),!0):!1}getAncestor(t){let r=this.getParent(),n=this.getParentType();for(;r;){if(n===t)return r;n=r.getParentType(),r=r.getParent()}return null}deleteFirstGrandChildOfName(t,r){return this.getChildren(t)[0].deleteChild(r)}deleteChildren(t,r){r=N.IsNullOrUndefined(r)?this.childrenNodes.length:r,this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(t,r)})}deleteGrandChildren(t,r,n){this.getChildren(t)[0].deleteChildren(r,n)}addGrandChild(t,r){let n=this.getChildren(t),i=null;n.length===0?(i=new e(t,this),this.addChild(i)):i=n[0],i.addChild(r)}addGrandChildAtIndex(t,r,n){let i=this.getChildren(t),a=null;i.length===0?(a=new e(t,this),this.addChild(a)):a=i[0],a.insertChildAtIndex(r,n)}GetPropertyByParameter(t){return this.getProperty(t)}getSemanticParent(){switch(this.getNodeName()){case h.formCell:let t=this.getAncestor(h.formSection);return t||(t=this.getAncestor(h.formHeader),t)||(t=this.getAncestor(h.formFooter),t)?t:null;case h.formSection:return this.getAncestor(h.formTab);case h.formTab:return this.getAncestor(h.form);default:return null}}isDirty(){return this.visit(t=>t.isInChangeSet())}isInChangeSet(){return this.changeTracker().getChangeSets().some(r=>r.changeSet.some(n=>n.targetNode.getNodeId()===this.getNodeId()))}changeTracker(){let t=this.getAncestor(h.form);return t?t.changeTracker():null}}});var Pf={};xt(Pf,{ControlClassId:()=>A,ControlNamePrefixes:()=>Po,getControlDisplayNames:()=>v_});function v_(e){return{[A.AccessPrivilegeControl]:e("controls.controlNames.accessPrivilege"),[A.AccessTeamTablePickerControl]:e("controls.controlNames.accessTeamTablePicker"),[A.ACIControl]:e("controls.controlNames.aci"),[A.ActivitiesContainerControl]:e("controls.controlNames.activitiesContainer"),[A.ActivitiesWallControl]:e("controls.controlNames.activitiesWall"),[A.AppliedFiltersControl]:e("controls.controlNames.appliedFilters"),[A.ArticleContentControl]:e("controls.controlNames.articleContent"),[A.BooleanControl]:e("controls.controlNames.twoOption"),[A.ButtonControl]:e("controls.controlNames.button"),[A.CheckboxControl]:e("controls.controlNames.checkbox"),[A.CompositionLinkControl]:e("controls.controlNames.compositionLink"),[A.ConnectionControl]:e("controls.controlNames.connection"),[A.ConnectionRoleObjectTypeListControl]:e("controls.controlNames.connectionRoleObjectTypeList"),[A.CoverageChoiceControl]:e("controls.controlNames.coverageChoice"),[A.DashboardControl]:e("controls.controlNames.dashboard"),[A.DynamicPropertyListControl]:e("controls.controlNames.dynamicPropertyList"),[A.EditFilterControl]:e("controls.controlNames.editFilter"),[A.ErrorStatusControl]:e("controls.controlNames.errorStatus"),[A.GlobalFilterControl]:e("controls.controlNames.globalFilter"),[A.HiddenInputControl]:e("controls.controlNames.hiddenInput"),[A.KBViewerControl]:e("controls.controlNames.kbViewer"),[A.LabelControl]:e("controls.controlNames.label"),[A.MailMergeLanguagePickerControl]:e("controls.controlNames.mailMergeLanguagePicker"),[A.MapLinkControl]:e("controls.controlNames.mapLink"),[A.OrgInsightsControl]:e("controls.controlNames.orgInsights"),[A.ChoiceLookupControl]:e("controls.controlNames.choiceLookup"),[A.PowerBIControl]:e("controls.controlNames.powerBI"),[A.ProcessControl]:e("controls.controlNames.process"),[A.RelatedInformationControl]:e("controls.controlNames.relatedInformation"),[A.RelationshipRoleChoiceControl]:e("controls.controlNames.relationshipRoleChoice"),[A.ReportControl]:e("controls.controlNames.report"),[A.StreamsControl]:e("controls.controlNames.streams"),[A.WebResourceSilverlightControl]:e("controls.controlNames.webResourceSilverlight"),[A.CurrencyControl]:e("controls.controlNames.currency"),[A.DateTimeControl]:e("controls.controlNames.dateAndTime"),[A.DecimalControl]:e("controls.controlNames.decimal"),[A.DurationControl]:e("controls.controlNames.duration"),[A.EmailAddressControl]:e("controls.controlNames.email"),[A.FileControl]:e("controls.controlNames.file"),[A.FloatingNumberControl]:e("controls.controlNames.floatingNumber"),[A.IframeControl]:e("controls.controlNames.iframe"),[A.ImageControl]:e("controls.controlNames.image"),[A.LookupControl]:e("controls.controlNames.lookup"),[A.MapsControl]:e("controls.controlNames.maps"),[A.PhoneNumberControl]:e("controls.controlNames.phoneNumber"),[A.ChoiceControl]:e("controls.controlNames.choice"),[A.QuickViewControl]:e("controls.controlNames.quickView"),[A.QuickFormControl]:e("controls.controlNames.quickForm"),[A.CustomControl]:e("controls.controlNames.customControl"),[A.SearchWidgetControl]:e("controls.controlNames.searchWidget"),[A.SocialInsightsControl]:e("controls.controlNames.socialInsights"),[A.SubgridControl]:e("controls.controlNames.subgrid"),[A.TextAreaControl]:e("controls.controlNames.textArea"),[A.TextboxControl]:e("controls.controlNames.textBox"),[A.TickerControl]:e("controls.controlNames.ticker"),[A.UrlControl]:e("controls.controlNames.url"),[A.WebResourceHTMLControl]:e("controls.controlNames.webResourceHTML"),[A.WebResourceImageControl]:e("controls.controlNames.webResourceImage"),[A.IntegerControl]:e("controls.controlNames.integer"),[A.TimerControl]:e("controls.controlNames.timer"),[A.TimelineControl]:e("controls.controlNames.timeline"),[A.EmailBodyControl]:e("controls.controlNames.emailBody"),[A.PartyListControl]:e("controls.controlNames.partyList"),[A.TimezoneControl]:e("controls.controlNames.timezone"),[A.LanguageControl]:e("controls.controlNames.language"),[A.ChoiceStatusControl]:e("controls.controlNames.choiceStatus"),[A.ChoicesControl]:e("controls.controlNames.choices"),[A.RegardingControl]:e("controls.controlNames.regarding"),[A.EmailEngagementActionsControl]:e("controls.controlNames.emailEngagementActions"),[A.EmailRecipientActivityControl]:e("controls.controlNames.emailRecipientActivity"),[A.ReferencePanelSearchWidgetControl]:e("controls.controlNames.referencePanelSearchWidget"),[A.ReferencePanelQuickViewControl]:e("controls.controlNames.referencePanelQuickView"),[A.ReferencePanelSubgridControl]:e("controls.controlNames.referencePanelSubgrid"),[A.KBEditorControl]:e("controls.controlNames.KBEditor"),[A.LinkControl]:e("controls.controlNames.link")}}var A,Po,Hr=S(()=>{"use strict";(function(e){e.AccessPrivilegeControl="F93A31B2-99AC-4084-8EC2-D4027C31369A",e.AccessTeamTablePickerControl="3f4e2a56-f102-4b4d-ab9c-f1574ca5bfda",e.ACIControl="C8BFBBEF-6851-4401-A0CC-7450062FE085",e.ActivitiesContainerControl="C72511AB-84E5-4FB7-A543-25B4FC01E83E",e.ActivitiesWallControl="6636847D-B74D-4994-B55A-A6FAF97ECEA2",e.AppliedFiltersControl="9C310A73-A360-42C5-8943-47A06F1B51EA",e.ArticleContentControl="F02EF977-2564-4B9A-B2F0-DF083D8A019B",e.BooleanControl="67FAC785-CD58-4F9F-ABB3-4B7DDC6ED5ED",e.ButtonControl="00AD73DA-BD4D-49C6-88A8-2F4F4CAD4A20",e.CheckboxControl="B0C6723A-8503-4FD7-BB28-C8A06AC933C2",e.CompositionLinkControl="DB1284EF-9FFC-4E99-B382-0CC082FE2364",e.ConnectionControl="3246F906-1F71-45F7-B11F-D7BE0F9D04C9",e.ConnectionRoleObjectTypeListControl="821ACF1A-7E46-4A0C-965D-FE14A57D78C7",e.CoverageChoiceControl="4168A05C-D857-46AF-8457-5BB47EB04EA1",e.DashboardControl="D2561F53-B292-42D9-B222-478E40FFE29F",e.DynamicPropertyListControl="6896F004-B17A-4202-861E-8B7EA2080E0B",e.EditFilterControl="1479835F-F852-4679-B864-C6892A2844C9",e.ErrorStatusControl="F4C16ECA-CA81-4E39-9448-834B8378721E",e.GlobalFilterControl="FFF0E632-9D7B-4F21-BBC1-05D1567AD144",e.HiddenInputControl="5546E6CD-394C-4BEE-94A8-4425E17EF6C6",e.KBViewerControl="A62B6FA9-169E-406C-B1AA-EAB828CB6026",e.LabelControl="39354E4A-5015-4D74-8031-EA9EB73A1322",e.MailMergeLanguagePickerControl="B634828E-C390-444A-AFE6-E07315D9D970",e.MapLinkControl="91DC0675-C8B9-4421-B1E0-261CEBF02BAC",e.OrgInsightsControl="76b9e25e-695e-4fef-ac69-f05cfa96739c",e.ChoiceLookupControl="2305e33a-bad3-4022-9e15-1856cf218333",e.PowerBIControl="8C54228C-1B25-4909-A12A-F2B968BB0D62",e.ProcessControl="06E9F7AF-1F54-4681-8EEC-1E21A1CEB465",e.RelatedInformationControl="163B90A6-EB64-49D2-9DF8-3C84A4F0A0F8",e.RelationshipRoleChoiceControl="5F986642-5961-4D9F-AB5E-643D71E231E9",e.ReportControl="A28F441B-916C-4865-87FD-0C5D53BD59C9",e.StreamsControl="EE9078C8-6946-4E2C-B8F8-35E65F4BE6A8",e.WebResourceSilverlightControl="080677DB-86EC-4544-AC42-F927E74B491F",e.CurrencyControl="533B9E00-756B-4312-95A0-DC888637AC78",e.CustomControl="F9A8A302-114E-466A-B582-6771B2AE0D92",e.DateTimeControl="5B773807-9FB2-42DB-97C3-7A91EFF8ADFF",e.DecimalControl="C3EFE0C3-0EC6-42BE-8349-CBD9079DFD8E",e.DurationControl="AA987274-CE4E-4271-A803-66164311A958",e.EmailAddressControl="ADA2203E-B4CD-49BE-9DDF-234642B43B52",e.EmailBodyControl="6F3FB987-393B-4D2D-859F-9D0F0349B6AD",e.EmailEngagementActionsControl="F454228D-1D25-4319-E12F-D27968BC0234",e.EmailRecipientActivityControl="26E9760F-7454-40DE-BB07-F6DCCCB82040",e.FileControl="0A7FF475-B016-4687-9CE5-042BFDBD6519",e.FloatingNumberControl="0D2C745A-E5A8-4C8F-BA63-C6D3BB604660",e.IframeControl="FD2A7985-3187-444E-908D-6624B21F69C0",e.ImageControl="7E548B0D-209C-477B-9DCD-F0F44472381D",e.LanguageControl="671A9387-CA5A-4D1E-8AB7-06E39DDCF6B5",e.LookupControl="270BD3DB-D9AF-4782-9025-509E298DEC0A",e.MapsControl="62B0DF79-0464-470F-8AF7-4483CFEA0C7D",e.ChoicesControl="4AA28AB7-9C13-4F57-A73D-AD894D048B5F",e.IntegerControl="C6D124CA-7EDA-4A60-AEA9-7FB8D318B68F",e.PartyListControl="CBFB742C-14E7-4A17-96BB-1A13F7F64AA2",e.PhoneNumberControl="8C10015A-B339-4982-9474-A95FE05631A5",e.ChoiceControl="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE",e.ChoiceStatusControl="5D68B988-0661-4DB2-BC3E-17598AD3BE6C",e.QuickViewControl="5C5600E0-1D6E-4205-A272-BE80DA87FD42",e.QuickFormControl="69AF7DCA-2E3B-4EE7-9201-0DA731DD2413",e.RegardingControl="F3015350-44A2-4AA0-97B5-00166532B5E9",e.SearchWidgetControl="E616A57F-20E0-4534-8662-A101B5DDF4E0",e.SocialInsightsControl="86B9E25E-695E-4FEF-AC69-F05CFA96739C",e.SubgridControl="E7A81278-8635-4D9E-8D4D-59480B391C5B",e.TextAreaControl="E0DECE4B-6FC8-4A8F-A065-082708572369",e.TextboxControl="4273EDBD-AC1D-40D3-9FB2-095C621B552D",e.TickerControl="1E1FC551-F7A8-43AF-AC34-A8DC35C7B6D4",e.TimerControl="9C5CA0A1-AB4D-4781-BE7E-8DFBE867B87E",e.TimelineControl="06375649-C143-495E-A496-C962E5B4488E",e.TimezoneControl="7C624A0B-F59E-493D-9583-638D34759266",e.UrlControl="71716B6C-711E-476C-8AB8-5D11542BFB47",e.WebResourceHTMLControl="9FDF5F91-88B1-47F4-AD53-C11EFC01A01D",e.WebResourceImageControl="587CDF98-C1D5-4BDE-8473-14A0BC7644A7",e.ReferencePanelSearchWidgetControl="7CCD1494-1F7A-4E3A-8BDE-F32069DAEB9F",e.ReferencePanelSubgridControl="02D4264B-47E2-4B4C-AA95-F439F3F4D458",e.ReferencePanelQuickViewControl="B68B05F0-A46D-43F8-843B-917920AF806A",e.KBEditorControl="F94DB24F-263D-44A7-B38E-A35E9854812B",e.LinkControl="DFDF1CDE-837B-4AC9-98CF-AC74361FD89D"})(A||(A={}));Po={[A.WebResourceHTMLControl]:"WebResource",[A.WebResourceImageControl]:"WebResource",[A.IframeControl]:"IFRAME",[A.SearchWidgetControl]:"Search widget",[A.SubgridControl]:"Subgrid",[A.TimelineControl]:"Timeline",[A.QuickViewControl]:"QuickviewControl"}});var Jr=f((V5,Ff)=>{var $i=new Proxy(function(){return $i},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:$i},apply:function(){return $i},construct:function(){return{}}}),Of=function(){return $i};Object.setPrototypeOf(Of,$i);Ff.exports=Of});var Je,ir,Rf,Tf,Sn=S(()=>{"use strict";Je="cds-designer-models",ir="FormCustomControl",Rf="FormCell",Tf="Form"});var Dn,Qe,Vi=S(()=>{"use strict";Dn=class{keys;values;constructor(){this.keys=[],this.values=[]}add(t,r){return this.containsKey(t)?!1:(this.keys.push(t),this.values.push(r),!0)}upsert(t,r){this.update(t,r)||this.add(t,r)}sortedUpsert(t,r){if(!this.update(t,r)){let n=0;for(;n<this.keys.length&&this.keys[n]<t;)n++;this.keys.splice(n,0,t),this.values.splice(n,0,r)}}clear(){this.keys=[],this.values=[]}containsKey(t){return this.keys.indexOf(t)!==-1}containsValue(t){return this.values.indexOf(t)!==-1}count(){return this.keys.length}getValue(t){let r=this.keys.indexOf(t);return r!==-1?this.values[r]:!1}getKeys(){return this.keys.slice()}getValues(){return this.values.slice()}remove(t){let r=this.keys.indexOf(t);return r!==-1?(this.keys.splice(r,1),this.values.splice(r,1),!0):!1}update(t,r){let n=this.keys.indexOf(t);return n!==-1?(this.values[n]=r,!0):!1}},Qe=class{data={};add(t,r){return this.containsKey(t)?!1:(this.data[t]=r,!0)}upsert(t,r){this.data[t]=r}clear(){this.data={}}containsKey(t){return this.data.hasOwnProperty(t)}containsValue(t){for(let r in this.data)if(this.data[r]===t)return!0;return!1}count(){return Object.keys(this.data).length}getValue(t){return this.containsKey(t)?this.data[t]:!1}getKeys(){return Object.keys(this.data)}getValues(){let t=[];for(let r in this.data)t.push(this.data[r]);return t}remove(t){return this.containsKey(t)?delete this.data[t]:!1}update(t,r){return this.containsKey(t)?(this.data[t]=r,!0):!1}getInternalObject(){return this.data}}});var Qr,fu=S(()=>{"use strict";Vi();G();Qr=class e{static lockedFieldCount=new Qe;static dependencyFieldCount=new Qe;static getNecessaryLookUpTable(t){switch(t){case kt.DependencyFieldTable:return e.dependencyFieldCount;case kt.LockedFieldTable:return e.lockedFieldCount}}static initCanvasLockedFieldLookUp(t){switch(t){case kt.DependencyFieldTable:e.dependencyFieldCount=new Qe;case kt.LockedFieldTable:e.lockedFieldCount=new Qe}}}});var Oo,xf=S(()=>{"use strict";Ae();be();G();Oe();Oo=class extends q{constructor(t){super(h.controlDescription,t)}get forControl(){let t=this.getProperty(d.ForControl);return N.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new E(t))}set forControl(t){this.setProperty(d.ForControl,`{${t.ToString()}}`)}get customControls(){return this.getChildren(h.customControl)}set customControls(t){this.deleteAllChildren();for(let r of t)this.addChild(r)}get DefaultControlClassId(){for(let t of this.customControls)if(!N.IsNullOrUndefined(t.id))return t.id;return null}get DefaultCustomControl(){for(let t of this.customControls)if(!N.IsNullOrUndefined(t.id))return t;return null}get DefaultCustomControls(){let t=[];for(let r of this.customControls)N.IsNullOrUndefined(r.id)||t.push(r);return t}async toJSON(t){let r=await this.getCustomControlsJSON(t);return r?{UniqueId:this.forControl.guidString,CustomControls:r,VersionNumber:0,OverallVersionNumber:0}:null}async getCustomControlsJSON(t){if(this.customControls){let r=[];for(let n of this.customControls){let i=await n.toJSON(t);i&&r.push(i)}return r}return null}}});var Uf,Mf,Xe,D,Lf,Or,Xr,En,mu,hu,In=S(()=>{"use strict";Uf={Name:"Name",Value:"Value",Type:"Type",TypeGroup:"TypeGroup",Usage:"Usage",Static:"Static",Primary:"Primary",Columns:"Columns",EnableViewPicker:"EnableViewPicker",EntityName:"EntityName",FilteredViewIds:"FilteredViewIds",ReferencingName:"ReferencingName",RelationshipName:"RelationshipName",RelationshipType:"RelationshipType",TargetEntityType:"TargetEntityType",ViewId:"ViewId",DependentAttributeName:"DependentAttributeName",DependentAttributeType:"DependentAttributeType",DefaultViewId:"DefaultViewId",BindAttribute:"BindAttribute",FilterRelationshipName:"FilterRelationshipName",AvailableViewIds:"AvailableViewIds",QuickForms:"QuickForms",EntityNameKey:"EntityNameKey",CardFormType:"Form.Card",CardFormId:"CardFormId",Hidden:"Hidden",Required:"Required",DefaultValue:"DefaultValue"},Mf={GroupDefinition:"GroupDefinition"},Xe={Control:"control",Resources:"resources",DisplayNameKey:"display-name-key",descriptionKey:"description-key",value:"value",name:"name",defaultKey:"default",groups:"groups",group:"group",property:"property",hidden:"hidden",required:"required",typeGroup:"type-group",type:"type",usage:"usage",ofType:"of-type",ofTypeGroup:"of-type-group",ImageURL:"preview-image",DefaultValue:"default-value",static:"static",dataset:"data-set",propertySet:"property-set",initialDatasetFetch:"initial-data-set-fetch",editable:"editable",cdsDatasetOptions:"cds-data-set-options",allowDefaultSelectedItems:"allow-default-selected-items",resettable:"resettable",isGroup:"isGroup",entityName:"entityname"};(function(e){e.Boolean="Boolean",e.Currency="Currency",e.DateAndTimeDateAndTime="DateAndTime.DateAndTime",e.DateAndTimeDateOnly="DateAndTime.DateOnly",e.Decimal="Decimal",e.Enum="Enum",e.FP="FP",e.File="File",e.Guid="Guid",e.Image="Image",e.LookupCustomer="Lookup.Customer",e.LookupOwner="Lookup.Owner",e.LookupPartyList="Lookup.PartyList",e.LookupRegarding="Lookup.Regarding",e.LookupSimple="Lookup.Simple",e.Multiple="Multiple",e.MultiSelectOptionSet="MultiSelectOptionSet",e.OptionSet="OptionSet",e.SingleLineEmail="SingleLine.Email",e.SingleLinePhone="SingleLine.Phone",e.SingleLineText="SingleLine.Text",e.SingleLineTextArea="SingleLine.TextArea",e.SingleLineTickerSymbol="SingleLine.Ticker",e.SingleLineURL="SingleLine.URL",e.TwoOptions="TwoOptions",e.WholeDuration="Whole.Duration",e.WholeLanguage="Whole.Language",e.WholeNone="Whole.None",e.WholeTimeZone="Whole.TimeZone",e.BusinessProcessFlow="BusinessProcessFlow",e.CardForm="Form.Card",e.Dashboard="Dashboard",e.FormMain="Form.Main",e.Grid="Grid",e.PowerBIReport="PowerBI.Report",e.QuickForm="Form.QuickForm",e.Search="Search",e.SearchWidget="SearchWidget",e.TimelineWall="TimelineWall",e.UnboundCustomControl="Unbound",e.WebResourceHtmlControl="WebResource.HTML"})(D||(D={}));(function(e){e.BooleanType="CC_FlipLabel_Name",e.DateTimeType="CC_TextBox_Name",e.DecimalType="CC_TextBox_Name",e.DoubleType="CC_TextBox_Name",e.IntegerType="CC_TextBox_Name",e.LookupType="CC_TextBox_Name",e.MemoType="CC_TextArea_Name",e.MoneyType="CC_TextBox_Name",e.OptionSetType="CC_OptionSet_Name",e.StringType="CC_TextBox_Name",e.GridType="CC_ReadOnlyGrid_Name",e.UnboundCustomControlType="CC_UnboundCustomControl_Name"})(Lf||(Lf={}));(function(e){e.ArcKnobControl="MscrmControls.Knob.ArcKnobControl",e.CardFeedNameControl="MscrmControls.CardFeedContainer.CardFeedContainer",e.CheckboxControl="MscrmControls.FieldControls.CheckboxControl",e.DateTimeControl="MscrmControls.FieldControls.DateTimeControl",e.DurationControl="MscrmControls.FieldControls.DurationControl",e.EditableGridControl="MscrmControls.Grid.GridControl",e.EmailEngagementActionsControl="MscrmControls.EmailEngagement.EmailEngagementActionsControl",e.FormComponent="MscrmControls.ModelForm.ModelFormControl",e.LanguageCodeControl="MscrmControls.FieldControls.LanguagePickerControl",e.LinearSliderControl="MscrmControls.Slider.LinearSliderControl",e.MultiSelectOptionSetControl="MscrmControls.MultiSelectPicklist.UpdMSPicklistControl",e.OptionSetControl="MscrmControls.OptionSet.OptionSetControl",e.PowerBIPCFControl="MscrmControls.PowerBIPCFControl",e.PredictiveScoringWidget="MscrmControls.Sales.PredictiveScoringWidget.PredictiveScoringWidget",e.ReadonlyGrid="MscrmControls.Grid.ReadOnlyGrid",e.SimilarCasesGrid="MscrmControls.Containers.SimilarCasesGridControl",e.StarRatingControl="MscrmControls.Rating.StarRatingControl",e.TimeZoneControl="MscrmControls.FieldControls.TimeZonePickListControl",e.ModelFormControl="MscrmControls.ModelForm.ModelFormControl",e.AutoCompleteControl="MscrmControls.AutoComplete.AutoCompleteControl",e.CanvasAppControl="MscrmControls.Canvas.CanvasControl",e.PowerAppsOneGrid="Microsoft.PowerApps.PowerAppsOneGrid"})(Or||(Or={}));(function(e){e[e.Read=0]="Read",e[e.Edit=1]="Edit",e[e.Both=2]="Both",e[e.Container=3]="Container",e[e.Unknown=4]="Unknown"})(Xr||(Xr={}));(function(e){e[e.Bound=0]="Bound",e[e.Input=1]="Input",e[e.Output=2]="Output"})(En||(En={}));mu=[D.LookupCustomer,D.LookupOwner,D.LookupPartyList,D.LookupRegarding,D.LookupSimple],hu=[D.WholeNone,D.WholeDuration,D.WholeLanguage,D.WholeTimeZone,D.FP,D.Decimal]});function ar(){return qt||(qt=window._makerConfig,qt&&window?.location?.search?.indexOf("useProductionConfig")>-1&&(qt={...qt,region:"prod",graphQLEndpoint:"https://graph.make.powerapps.com/"}),qt?.region==="prod"&&(qt={endpoints:{eu:{ch:{graphql:"https://graph-make.ch-cm001.gateway.prod.cm.powerapps.com/"},de:{graphql:"https://graph-make.de-cm001.gateway.prod.cm.powerapps.com/"},fr:{graphql:"https://graph-make.fr-cm001.gateway.prod.cm.powerapps.com/"},no:{graphql:"https://graph-make.no-cm001.gateway.prod.cm.powerapps.com/"},default:{graphql:"https://graph-make.eu-cm001.gateway.prod.cm.powerapps.com/"}}},...qt}),qt||{aadClientId:"a8f7a65c-f5ba-4859-b2d6-df772c264e9d",location:"cus",region:"test",publicPath:"/",graphQLEndpoint:"https://graph.make.test.powerapps.com/"})}var qt,Fo=S(()=>{"use strict";});function Bf(e,t,r){if(!e)return Ro.has(e)||(window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoIsEmpty"}),Ro.add("")),!1;if(e){if(e=e.toLowerCase(),Ro.has(e))return!1;if(!(e in t))return window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoNonExistent",eventInfo:{missinggeo:e,parent:r}}),Ro.add(e),!1}return!0}function b_(e){return Bf(e,gu,"Location dictionary")?gu[e.toLowerCase()]:"us"}function y_(){let e=ar().location.toLowerCase();return Bf(e,gu,"Current location dictionary")?e:"us"}var Ro,gu,n9,kf=S(()=>{"use strict";Fo();Ro=new Set,gu={cae:"ae",nae:"ae",eas:"as",seas:"as",eau:"au",seau:"au",sbr:"br",cca:"ca",eca:"ca",nch:"ch",wch:"ch",nde:"de",wcde:"de",neu:"eu",weu:"eu",cfr:"fr",sfr:"fr",cin:"in",sin:"in",ejp:"jp",wjp:"jp",suk:"uk",wuk:"uk",eus:"us",wus:"us",cus:"us",ude:"us",udc:"us",ugtx:"us",ugva:"us",eus2:"us",wus2:"us",nza:"za",wza:"za",cne2:"cn",cnn2:"cn",skr:"kr",ckr:"kr",eno:"no",wno:"no",wrx:"us",erx:"us",wex:"us",eex:"us",unitedstates:"us",europe:"eu",asia:"as",australia:"au",japan:"jp",canada:"ca",india:"in",italy:"it",unitedstatesfirstrelease:"us",unitedkingdom:"uk",southamerica:"br",france:"fr",unitedarabemirates:"ae",germany:"de",sweden:"se",switzerland:"ch",korea:"kr",norway:"no",usgov:"us",usgovhigh:"us",usdod:"us",china:"cn",usnat:"us",ussec:"us",southafrica:"za",singapore:"sg",newzealand:"nz",poland:"pl",qatar:"qa",as:"as",au:"au",ca:"ca",in:"in",jp:"jp",kr:"kr",nz:"nz",ae:"ae",qa:"qa",us:"us",uk:"uk",eu:"eu",de:"de",ch:"ch",no:"no",fr:"fr",se:"se",it:"it",pl:"pl",be:"eu",bel:"eu",gr:"eu",grc:"eu",lt:"eu",ltu:"eu",pt:"eu",prt:"eu",bg:"eu",bgr:"eu",es:"eu",esp:"eu",lu:"eu",lux:"eu",ro:"eu",rou:"eu",cz:"eu",cze:"eu",hu:"eu",hun:"eu",si:"eu",svn:"eu",dk:"eu",dnk:"eu",hr:"eu",hrv:"eu",mt:"eu",mlt:"eu",sk:"eu",svk:"eu",nit:"it",nl:"eu",nld:"eu",fi:"eu",fin:"eu",ee:"eu",est:"eu",cy:"eu",cyp:"eu",at:"eu",aut:"eu",swe:"se",cse:"se",ie:"eu",irl:"eu",lv:"eu",lva:"eu",cpl:"pl",nnz:"nz",cqa:"qa",sg:"sg",br:"br",za:"za",sa:"za"};n9=b_(y_())});var F,a9,qf=S(()=>{"use strict";F={USWest:"westus",USWest2:"westus2",USCentral:"centralus",USEast:"eastus",USEast2:"eastus2",USNorthCentral:"northcentralus",USSouthCentral:"southcentralus",USWestCentral:"westcentralus",CanadaCentral:"canadacentral",CanadaEast:"canadaeast",BrazilSouth:"brazilsouth",EuropeNorth:"northeurope",EuropeWest:"westeurope",UKSouth:"uksouth",UKWest:"ukwest",FranceCentral:"francecentral",FranceSouth:"francesouth",SwitzerlandNorth:"switzerlandnorth",SwitzerlandWest:"switzerlandwest",GermanyNorth:"germanynorth",GermanyWestCentral:"germanywestcentral",NorwayWest:"norwaywest",NorwayEast:"norwayeast",SwedenCentral:"swedencentral",ItalyNorth:"italynorth",PolandCentral:"polandcentral",AsiaEast:"eastasia",AsiaSouthEast:"southeastasia",JapanEast:"japaneast",JapanWest:"japanwest",AustraliaEast:"australiaeast",AustraliaSouthEast:"australiasoutheast",AustraliaCentral:"australiacentral",AustraliaCentral2:"australiacentral2",IndiaCentral:"centralindia",IndiaSouth:"southindia",IndiaWest:"westindia",KoreaSouth:"koreasouth",KoreaCentral:"koreacentral",NewZealandNorth:"newzealandnorth",UAECentral:"uaecentral",UAENorth:"uaenorth",SouthAfricaNorth:"southafricanorth",SouthAfricaWest:"southafricawest",QatarCentral:"qatarcentral",GermanyCentral:"germanycentral",GermanyNorthEast:"germanynortheast",SingaporeSouthEast:"southeastasia",GovernmentUSVirginia:"usgovvirginia",GovernmentUSIowa:"usgoviowa",GovernmentUSArizona:"usgovarizona",GovernmentUSTexas:"usgovtexas",GovernmentUSDodEast:"usdodeast",GovernmentUSDodCentral:"usdodcentral",ChinaNorth:"chinanorth",ChinaNorth2:"chinanorth2",ChinaNorth3:"chinanorth3",ChinaEast:"chinaeast",ChinaEast2:"chinaeast2",ChinaEast3:"chinaeast3",UssecEast:"usseceast",UssecWest:"ussecwest",UsnatEast:"usnateast",UsnatWest:"usnatwest"},a9={[F.USWest]:{geoName:"us",regionShortName:"wus"},[F.USCentral]:{geoName:"us",regionShortName:"cus"},[F.USEast]:{geoName:"us",regionShortName:"eus"},[F.USEast2]:{geoName:"us",regionShortName:"eus2"},[F.USWestCentral]:{geoName:"us",regionShortName:"wcus"},[F.USWest2]:{geoName:"us",regionShortName:"wus2"},[F.USSouthCentral]:{geoName:"br",regionShortName:"scus"},[F.BrazilSouth]:{geoName:"br",regionShortName:"sbr"},[F.UKSouth]:{geoName:"uk",regionShortName:"suk"},[F.UKWest]:{geoName:"uk",regionShortName:"wuk"},[F.JapanEast]:{geoName:"jp",regionShortName:"ejp"},[F.JapanWest]:{geoName:"jp",regionShortName:"wjp"},[F.IndiaCentral]:{geoName:"in",regionShortName:"cin"},[F.IndiaSouth]:{geoName:"in",regionShortName:"sin"},[F.ItalyNorth]:{geoName:"it",regionShortName:"nit"},[F.GermanyWestCentral]:{geoName:"de",regionShortName:"wcde"},[F.GermanyNorth]:{geoName:"de",regionShortName:"nde"},[F.EuropeNorth]:{geoName:"eu",regionShortName:"neu"},[F.EuropeWest]:{geoName:"eu",regionShortName:"weu"},[F.AustraliaEast]:{geoName:"au",regionShortName:"eau"},[F.AustraliaSouthEast]:{geoName:"au",regionShortName:"seau"},[F.AsiaSouthEast]:{geoName:"as",regionShortName:"seas"},[F.AsiaEast]:{geoName:"as",regionShortName:"eas"},[F.CanadaCentral]:{geoName:"ca",regionShortName:"cca"},[F.CanadaEast]:{geoName:"ca",regionShortName:"eca"},[F.SouthAfricaNorth]:{geoName:"za",regionShortName:"nza"},[F.SouthAfricaWest]:{geoName:"za",regionShortName:"wza"},[F.FranceCentral]:{geoName:"fr",regionShortName:"cfr"},[F.FranceSouth]:{geoName:"fr",regionShortName:"sfr"},[F.UAENorth]:{geoName:"ae",regionShortName:"nae"},[F.UAECentral]:{geoName:"ae",regionShortName:"cae"},[F.SwedenCentral]:{geoName:"se",regionShortName:"cse"},[F.SwitzerlandNorth]:{geoName:"ch",regionShortName:"nch"},[F.SwitzerlandWest]:{geoName:"ch",regionShortName:"wch"},[F.NorwayEast]:{geoName:"no",regionShortName:"eno"},[F.NorwayWest]:{geoName:"no",regionShortName:"wno"},[F.KoreaCentral]:{geoName:"kr",regionShortName:"ckr"},[F.KoreaSouth]:{geoName:"kr",regionShortName:"skr"},[F.SingaporeSouthEast]:{geoName:"sg",regionShortName:"seas"},[F.PolandCentral]:{geoName:"pl",regionShortName:"cpl"},[F.QatarCentral]:{geoName:"qa",regionShortName:"cqa"},[F.NewZealandNorth]:{geoName:"nz",regionShortName:"nnz"},[F.GovernmentUSTexas]:{geoName:"us",regionShortName:"ugtx"},[F.GovernmentUSVirginia]:{geoName:"us",regionShortName:"ugva"},[F.GovernmentUSDodCentral]:{regionShortName:"udc"},[F.GovernmentUSDodEast]:{regionShortName:"ude"},[F.ChinaEast]:{regionShortName:"cne"},[F.ChinaEast2]:{regionShortName:"cne2"},[F.ChinaEast3]:{regionShortName:"cne3"},[F.ChinaNorth]:{regionShortName:"cnn"},[F.ChinaNorth2]:{regionShortName:"cnn2"},[F.ChinaNorth3]:{regionShortName:"cnn3"},[F.UssecEast]:{geoName:"us",regionShortName:"erx"},[F.UssecWest]:{geoName:"us",regionShortName:"wrx"},[F.UsnatEast]:{geoName:"us",regionShortName:"eex"},[F.UsnatWest]:{geoName:"us",regionShortName:"wex"}}});var $f=S(()=>{"use strict";Fo();});var Gi=S(()=>{"use strict";Fo();kf();qf();$f();});function zi(e,t){return Vf?Vf.isOverridden(e,t):{overridden:!1}}var Vf,Wi=S(()=>{"use strict";});var vu=S(()=>{"use strict";Gi();Wi();});function C_(e,t){let{region:r}=ar();return()=>{let n=e.settings[t];if(n.allowOverrides){let s=zi(e.packageName,t);if(s.overridden)return typeof s.value=="string"?A_(s.value):s.value}let a=n.values,o=process.env.SETTINGS_FALLBACK_REGION?.[r];return a[r]!==void 0?a[r]:o&&a[o]!==void 0?a[o]:a.default}}function A_(e){return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}function N_(e){let t=e.packageName;if(To.has(t)){let r=`settings has already been created for this package ${t}`;throw console.error(r),new Error(r)}if(Object.keys(e.settings).some(r=>yu(t,r))){let r=`error parsing settings config for package ${t}, a feature gate with the same name exists`;throw console.error(r),new Error(r)}Object.keys(e.settings).forEach(r=>{if(Object.keys(e.settings[r].values).filter(i=>i!=="default").some(i=>!Lo(i))){let i=`error parsing settings config for package ${t}, setting ${r} has invalid region`;throw console.error(i),new Error(i)}})}function ji(e){N_(e);let t={};return Object.keys(e.settings).forEach(r=>{t[r]={enumerable:!0,get:C_(e,r)}}),To.set(e.packageName,e),Object.defineProperties({},t)}function bu(e,t){return To.has(e)?!!To.get(e).settings[t]:!1}var To,xo=S(()=>{"use strict";Gi();Wi();Cu();Hi();To=new Map});function Gf(e,t){let{region:r}=ar();return()=>{let n=zi(e.packageName,t);if(n.overridden)return n.value.toString()==="true";let i=e.features[t].enabledFor,a=process.env.SETTINGS_FALLBACK_REGION?.[r];return i[r]!==void 0?!!i[r]:a&&i[a]!==void 0?!!i[a]:!1}}function w_(e){let t=e.packageName;if(Uo.has(t)){let r="feature gates has already been created for this package";throw console.error(r),new Error(r)}if(Object.keys(e.features).some(r=>bu(t,r))){let r=`error parsing feature gates config for package ${t}, a setting with the same name exists`;throw console.error(r),new Error(r)}Object.keys(e.features).forEach(r=>{if(Object.keys(e.features[r].enabledFor).some(i=>!Lo(i))){let i=`error parsing feature gates config for package ${t}, feature ${r} has invalid region`;throw console.error(i),new Error(i)}})}function Au(e){w_(e);let t={};Object.keys(e.features).forEach(i=>{t[i]={enumerable:!0,configurable:!0,get:Gf(e,i)}});let r={},n=new Set;return t.dangerouslySet={enumerable:!1,value:(i,a)=>{n.add(i),Object.defineProperty(r,i,{enumerable:!0,configurable:!0,value:a})}},t.dangerouslyReset={enumerable:!1,value:()=>{let i={};n.forEach(a=>{i[a.toString()]={enumerable:!0,configurable:!0,get:Gf(e,a.toString())}}),Object.defineProperties(r,i),n.clear()}},Uo.set(e.packageName,e),Object.defineProperties(r,t)}function yu(e,t){return Uo.has(e)?!!Uo.get(e).features[t]:!1}var Uo,Cu=S(()=>{"use strict";Gi();Hi();Wi();xo();Uo=new Map});var Wf=f((O9,zf)=>{"use strict";zf.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return!1;switch(r){case"http":case"ws":return t!==80;case"https":case"wss":return t!==443;case"ftp":return t!==21;case"gopher":return t!==70;case"file":return!1}return t!==0}});var Jf=f(Nu=>{"use strict";var S_=Object.prototype.hasOwnProperty,D_;function jf(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Hf(e){try{return encodeURIComponent(e)}catch{return null}}function E_(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var i=jf(n[1]),a=jf(n[2]);i===null||a===null||i in r||(r[i]=a)}return r}function I_(e,t){t=t||"";var r=[],n,i;typeof t!="string"&&(t="?");for(i in e)if(S_.call(e,i)){if(n=e[i],!n&&(n===null||n===D_||isNaN(n))&&(n=""),i=Hf(i),n=Hf(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""}Nu.stringify=I_;Nu.parse=E_});var Du=f((R9,em)=>{"use strict";var Xf=Wf(),Mo=Jf(),Kf=/[\n\r\t]/g,__=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,P_=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,O_=/^[a-zA-Z]:/,F_=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;function Su(e){return(e||"").toString().replace(F_,"")}var wu=[["#","hash"],["?","query"],function(t,r){return $t(r.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Qf={hash:1,query:1};function Yf(e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={};var r=t.location||{};e=e||r;var n={},i=typeof e,a;if(e.protocol==="blob:")n=new Vt(unescape(e.pathname),{});else if(i==="string"){n=new Vt(e,{});for(a in Qf)delete n[a]}else if(i==="object"){for(a in e)a in Qf||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=__.test(e.href))}return n}function $t(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function Zf(e,t){e=Su(e),e=e.replace(Kf,""),t=t||{};var r=P_.exec(e),n=r[1]?r[1].toLowerCase():"",i=!!r[2],a=!!r[3],o=0,s;return i?a?(s=r[2]+r[3]+r[4],o=r[2].length+r[3].length):(s=r[2]+r[4],o=r[2].length):a?(s=r[3]+r[4],o=r[3].length):s=r[4],n==="file:"?o>=2&&(s=s.slice(2)):$t(n)?s=r[4]:n?i&&(s=s.slice(2)):o>=2&&$t(t.protocol)&&(s=r[4]),{protocol:n,slashes:i||$t(n),slashesCount:o,rest:s}}function R_(e,t){if(e==="")return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,i=r[n-1],a=!1,o=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),o++):o&&(n===0&&(a=!0),r.splice(n,1),o--);return a&&r.unshift(""),(i==="."||i==="..")&&r.push(""),r.join("/")}function Vt(e,t,r){if(e=Su(e),e=e.replace(Kf,""),!(this instanceof Vt))return new Vt(e,t,r);var n,i,a,o,s,l,u=wu.slice(),c=typeof t,p=this,m=0;for(c!=="object"&&c!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=Mo.parse),t=Yf(t),i=Zf(e||"",t),n=!i.protocol&&!i.slashes,p.slashes=i.slashes||n&&t.slashes,p.protocol=i.protocol||t.protocol||"",e=i.rest,(i.protocol==="file:"&&(i.slashesCount!==2||O_.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!$t(p.protocol)))&&(u[3]=[/(.*)/,"pathname"]);m<u.length;m++){if(o=u[m],typeof o=="function"){e=o(e,p);continue}a=o[0],l=o[1],a!==a?p[l]=e:typeof a=="string"?(s=a==="@"?e.lastIndexOf(a):e.indexOf(a),~s&&(typeof o[2]=="number"?(p[l]=e.slice(0,s),e=e.slice(s+o[2])):(p[l]=e.slice(s),e=e.slice(0,s)))):(s=a.exec(e))&&(p[l]=s[1],e=e.slice(0,s.index)),p[l]=p[l]||n&&o[3]&&t[l]||"",o[4]&&(p[l]=p[l].toLowerCase())}r&&(p.query=r(p.query)),n&&t.slashes&&p.pathname.charAt(0)!=="/"&&(p.pathname!==""||t.pathname!=="")&&(p.pathname=R_(p.pathname,t.pathname)),p.pathname.charAt(0)!=="/"&&$t(p.protocol)&&(p.pathname="/"+p.pathname),Xf(p.port,p.protocol)||(p.host=p.hostname,p.port=""),p.username=p.password="",p.auth&&(s=p.auth.indexOf(":"),~s?(p.username=p.auth.slice(0,s),p.username=encodeURIComponent(decodeURIComponent(p.username)),p.password=p.auth.slice(s+1),p.password=encodeURIComponent(decodeURIComponent(p.password))):p.username=encodeURIComponent(decodeURIComponent(p.auth)),p.auth=p.password?p.username+":"+p.password:p.username),p.origin=p.protocol!=="file:"&&$t(p.protocol)&&p.host?p.protocol+"//"+p.host:"null",p.href=p.toString()}function T_(e,t,r){var n=this;switch(e){case"query":typeof t=="string"&&t.length&&(t=(r||Mo.parse)(t)),n[e]=t;break;case"port":n[e]=t,Xf(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,/:\d+$/.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(t){var i=e==="pathname"?"/":"#";n[e]=t.charAt(0)!==i?i+t:t}else n[e]=t;break;case"username":case"password":n[e]=encodeURIComponent(t);break;case"auth":var a=t.indexOf(":");~a?(n.username=t.slice(0,a),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(a+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t))}for(var o=0;o<wu.length;o++){var s=wu[o];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&$t(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function x_(e){(!e||typeof e!="function")&&(e=Mo.stringify);var t,r=this,n=r.host,i=r.protocol;i&&i.charAt(i.length-1)!==":"&&(i+=":");var a=i+(r.protocol&&r.slashes||$t(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&$t(r.protocol)&&!n&&r.pathname!=="/"&&(a+="@"),n[n.length-1]===":"&&(n+=":"),a+=n+r.pathname,t=typeof r.query=="object"?e(r.query):r.query,t&&(a+=t.charAt(0)!=="?"?"?"+t:t),r.hash&&(a+=r.hash),a}Vt.prototype={set:T_,toString:x_};Vt.extractProtocol=Zf;Vt.location=Yf;Vt.trimLeft=Su;Vt.qs=Mo;em.exports=Vt});var L_,tm=S(()=>{"use strict";L_=ne(Du());});function Eu(e,t,r){let n=Object.keys(r).sort();if(n.length===0)throw new Error(`ECS feature has no properties: ${e}.${t}`);let i=`ecs.${e}.${t}`;return n.length===1?`${i}.${n[0]}`:`${i}.{${n.join(";")}}`}var Bo=S(()=>{"use strict";});var Iu,_u,Pu=S(()=>{"use strict";Bo();Iu=class{features=new Map;register(t,r){let n=Eu(r,t.teamName,t.fallback),i={clientName:r,teamName:t.teamName,fullName:n,description:t.description,owners:t.owners,ecsURL:t.ecsURL,createdOn:t.createdOn,fallbackConfig:t.fallback,feature:t,displayTeam:t.displayTeam,tags:t.tags,category:t.category};this.features.set(n,i)}getAll(){return Array.from(this.features.values())}get(t){return this.features.get(t)}has(t){return this.features.has(t)}getByClient(t){return this.getAll().filter(r=>r.clientName===t)}getByTeam(t){return this.getAll().filter(r=>r.teamName===t)}search(t){let r=t.toLowerCase();return this.getAll().filter(n=>n.fullName.toLowerCase().includes(r)||n.description?.toLowerCase().includes(r)||n.teamName.toLowerCase().includes(r)||n.clientName.toLowerCase().includes(r))}getClientNames(){let t=new Set;return this.features.forEach(r=>t.add(r.clientName)),Array.from(t)}getTeamNames(){let t=new Set;return this.features.forEach(r=>t.add(r.teamName)),Array.from(t)}clear(){this.features.clear()}},_u=new Iu});var Ou=S(()=>{"use strict";});function Lo(e){return U_.has(e)}var U_,Hi=S(()=>{"use strict";vu();Cu();xo();Wi();vu();tm();Pu();Bo();Ou();U_=new Set(["tie","test","prod","preview","preprod","gov","high","dod","mooncake","ex","rx"])});var M_,rm=S(()=>{"use strict";Hi();M_=ji({packageName:"cds-designer-models",settings:{testCustomControls:{description:"Test Custom Controls to show up in the component picker.",allowOverrides:!0,values:{default:"",test:"",preprod:"",preview:"",gov:""}}}})});var ko,_,R,Kr,_n,qo,nm,im,Fu,Ji=S(()=>{"use strict";Vi();ko=class{name;constructor(t){this.name=t}toString(){return this.name}getName(){return this.name}getDisplayNameResourceKey(){return Fu.getDisplayNameResourceKey(this.name)}};(function(e){e.BigInt="BigIntType",e.CalendarRulesType="CalendarRulesType",e.Currency="MoneyType",e.Customer="Customer",e.CustomerType="CustomerType",e.DateTime="DateTimeType",e.DecimalNumber="DecimalType",e.EntityNameType="EntityNameType",e.FloatingPointNumber="DoubleType",e.Image="ImageType",e.File="FileType",e.Lookup="Lookup",e.LookupType="LookupType",e.ManagedPropertyType="ManagedPropertyType",e.MultipleLineofText="MemoType",e.MultiSelectOptionSet="MultiSelectPicklistType",e.OptionSet="PicklistType",e.Owner="Owner",e.OwnerType="OwnerType",e.PartyList="PartyList",e.PartyListType="PartyListType",e.PrimaryNameAttributeType="String",e.SingleLineofText="StringType",e.State="StateType",e.Status="StatusType",e.Subject="Subject",e.TimeStamp="TimeStampType",e.TwoOptions="BooleanType",e.UniqueIdentifier="Uniqueidentifier",e.UniqueIdentifierType="UniqueidentifierType",e.VirtualType="VirtualType",e.WholeNumber="IntegerType"})(_||(_={}));(function(e){e.Email="Email",e.Text="Text",e.TextArea="TextArea",e.Url="Url",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.Phone="Phone",e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime",e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean",e.Regarding="Regarding"})(R||(R={}));Kr=class extends ko{constructor(t){super(t)}static get None(){return"None"}static get SystemRequired(){return"SystemRequired"}static get ApplicationRequired(){return"ApplicationRequired"}static get Recommended(){return"Recommended"}},_n=class e extends ko{constructor(t){super(t),t||(this.name=e.None)}static get None(){return"None"}static get Persistent(){return"Persistent"}static get Calculated(){return"Calculated"}static get Rollup(){return"Rollup"}GetValue(){switch(this.name){case e.None:return qo.Persistent;default:return parseInt(qo[this.name])}}};(function(e){e[e.Persistent=0]="Persistent",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup"})(qo||(qo={}));(function(e){e[e.Undefined=0]="Undefined",e[e.Simple=1]="Simple",e[e.Related=2]="Related",e[e.Logical=4]="Logical",e[e.Calculated=8]="Calculated",e[e.Rollup=16]="Rollup",e[e.Invalid=32]="Invalid"})(nm||(nm={}));(function(e){e[e.Attribute=0]="Attribute",e[e.Organization=1]="Organization",e[e.Currency=2]="Currency"})(im||(im={}));Fu=class e{static resourceKeyMap=e.initResourceKeyMap();static initResourceKeyMap(){let t=new Dn;return t.add(_.TwoOptions,"SystemCustomization.type.bit.label"),t.add(_.Customer,"SystemCustomization.type.customer.label"),t.add(_.CustomerType,"SystemCustomization.type.customer.label"),t.add(_.DateTime,"SystemCustomization.type.datetime.label"),t.add(_.DecimalNumber,"SystemCustomization.type.decimal.label"),t.add(_.FloatingPointNumber,"SystemCustomization.type.float.label"),t.add(_.WholeNumber,"SystemCustomization.type.int.label"),t.add(_.LookupType,"SystemCustomization.type.lookup.label"),t.add(_.Lookup,"SystemCustomization.type.lookup.label"),t.add(_.MultipleLineofText,"SystemCustomization.type.ntext.label"),t.add(_.Currency,"SystemCustomization.type.money.label"),t.add(_.Owner,"SystemCustomization.type.owner.label"),t.add(_.OwnerType,"SystemCustomization.type.owner.label"),t.add(_.PartyList,"SystemCustomization.type.partylist.label"),t.add(_.PartyListType,"SystemCustomization.type.partylist.label"),t.add(_.OptionSet,"SystemCustomization.type.picklist.label"),t.add(_.State,"SystemCustomization.type.state.label"),t.add(_.Status,"SystemCustomization.type.status.label"),t.add(_.SingleLineofText,"SystemCustomization.type.nvarchar.label"),t.add(_.UniqueIdentifier,"SystemCustomization.type.uniqueidentifier.label"),t.add(_.UniqueIdentifierType,"SystemCustomization.type.uniqueidentifiertype.label"),t.add(_.CalendarRulesType,"SystemCustomization.type.calendarrules.label"),t.add(_.VirtualType,"SystemCustomization.type.virtual.label"),t.add(_.BigInt,"SystemCustomization.type.bigint.label"),t.add(_.ManagedPropertyType,"SystemCustomization.type.managedproperty.label"),t.add(_.EntityNameType,"SystemCustomization.type.entityname.label"),t.add(_.Image,"SystemCustomization.type.image.label"),t.add(_.MultiSelectOptionSet,"SystemCustomization.type.multiselectpicklist.label"),t.add(_.PrimaryNameAttributeType,"SystemCustomization.type.primaryname.label"),t.add(_.LookupType,"SystemCustomization.type.lookuptype.label"),t.add(_.Subject,"SystemCustomization.type.subject.label"),t.add(R.Email,"SystemCustomization.String.Format.email"),t.add(R.Text,"SystemCustomization.String.Format.text"),t.add(R.TextArea,"SystemCustomization.String.Format.textarea"),t.add(R.Url,"SystemCustomization.String.Format.url"),t.add(R.TickerSymbol,"SystemCustomization.String.Format.tickersymbol"),t.add(R.PhoneticGuide,"SystemCustomization.String.Format.phoneticguide"),t.add(R.VersionNumber,"SystemCustomization.String.Format.versionnumber"),t.add(R.Phone,"SystemCustomization.String.Format.phone"),t.add(R.None,"SystemCustomization.Integer.Format."),t.add(R.Duration,"SystemCustomization.Integer.Format.duration"),t.add(R.TimeZone,"SystemCustomization.Integer.Format.timezone"),t.add(R.Language,"SystemCustomization.Integer.Format.language"),t.add(R.Locale,"SystemCustomization.Integer.Format.language"),t.add(R.DateOnly,"SystemCustomization.DateTime.Format.date"),t.add(R.DateAndTime,"SystemCustomization.DateTime.Format.datetime"),t.add(R.Regarding,"SystemCustomization.Lookup.Format.regarding"),t.add(_n.Persistent,"SystemCustomization.String.Source.persistent"),t.add(_n.Calculated,"SystemCustomization.String.Source.calculated"),t.add(_n.Rollup,"SystemCustomization.String.Source.rollup"),t.add(_n.None,"SystemCustomization.String.Source.none"),t}static getDisplayNameResourceKey(t){return e.resourceKeyMap.getValue(t)}}});var lm,Tu,Pn,Yr,Ru,$o,On,or,se,am,om,sm,It=S(()=>{"use strict";lm={ThreeEqColumn_FirstColumn:34,ThreeEqColumn_SecondColumn:33,ThreeEqColumn_ThirdColumn:33,FiveEqColumn:20},Tu={ONE_COLUMN:"1",TWO_COLUMN:"2",THREE_COLUMN:"3",FOUR_COLUMN:"4"};(function(e){e[e.SUBGRID=0]="SUBGRID",e[e.SPACER=1]="SPACER",e[e.QUICK_VIEW=2]="QUICK_VIEW",e[e.WEB_RESOURCE=3]="WEB_RESOURCE",e[e.IFRAME=4]="IFRAME",e[e.BING_MAPS=5]="BING_MAPS",e[e.TIMER=6]="TIMER",e[e.TIMELINE=7]="TIMELINE",e[e.SOCIAL_INSIGHTS=8]="SOCIAL_INSIGHTS",e[e.KB_SEARCH=9]="KB_SEARCH",e[e.ACI_CONTROL=10]="ACI_CONTROL",e[e.RELATIONSHIP_ASSISTANT=11]="RELATIONSHIP_ASSISTANT",e[e.REFERENCE_PANEL=12]="REFERENCE_PANEL",e[e.REF_PANEL_QUICKVIEW=13]="REF_PANEL_QUICKVIEW",e[e.REF_PANEL_SUBGRID=14]="REF_PANEL_SUBGRID",e[e.REF_PANEL_KBSEARCH=15]="REF_PANEL_KBSEARCH",e[e.WEB_RESOURCE_HTML=16]="WEB_RESOURCE_HTML",e[e.PRED_LEAD_SCORING=17]="PRED_LEAD_SCORING"})(Pn||(Pn={}));(function(e){e.Left="Left",e.Right="Right",e.Center="Center"})(Yr||(Yr={}));(function(e){e[e.Mobile=0]="Mobile",e[e.Tablet=1]="Tablet",e[e.Web=2]="Web"})(Ru||(Ru={}));$o=class{static ONE_COLUMN=1;static TWO_COLUMN=2;static THREE_COLUMN=3;static FIVE_COLUMN=5};(function(e){e.Left="Left",e.Top="Top"})(On||(On={}));or=class{static StartTag="<"},se={ShowLabel:"true",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_",labelAlignment:Yr.Left,labelPosition:On.Left,MarginalControlColumns:"111",referencePanelNamePrefix:"ref_pan_"};(function(e){e.AddFormBodyFieldToReadOnlyHeader="AddFormBodyFieldToReadOnlyHeader",e.AddFieldPaneFieldToReadOnlyHeader="AddFieldPaneFieldToReadOnlyHeader",e.AddFieldExceedsReadOnlyHeaderLimit="AddFieldExceedsReadOnlyHeaderLimit",e.AddCustomComponentToReadOnlyHeader="AddCustomComponentToReadOnlyHeader",e.AddNonDisplayableComponentToReadOnlyHeader="AddNonDisplayableComponentToReadOnlyHeader",e.AddFieldToFlyoutOnly="AddFieldToFlyoutOnly",e.DisplayedFieldToFlyout="DisplayedFieldToFlyout",e.FlyoutFieldToDisplayed="FlyoutFieldToDisplayed",e.AddControlBeforeDefaultLabel="AddControlBeforeDefaultLabel"})(am||(am={}));(function(e){e.TabWithLockedFieldRemoval="TabWithLockedFieldRemoval",e.SectionWithLockedFieldRemoval="SectionWithLockedFieldRemoval",e.LockedSectionRemoval="LockedSectionRemoval",e.LockedFieldRemoval="LockedFieldRemoval",e.RequiredFieldRemoval="RequiredFieldRemoval",e.LastRemainingTab="LastRemainingTab",e.UnknownRemoval="UnknownRemoval"})(om||(om={}));(function(e){e.IsHeader="IsHeader",e.IsFooter="IsFooter",e.ContainedInHeader="ContainedInHeader",e.ContainedInFooter="ContainedInFooter",e.NoElementFound="NoElementFound",e.NoTarget="NoTarget",e.CannotAddControlToHeader="CannotAddControlToHeader",e.CannotAddControlToFooter="CannotAddControlToFooter"})(sm||(sm={}))});var Qi=f(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.DateTimeBehavior=y.PrecisionSource=y.StringFormatName=y.SourceType=y.ImeMode=y.SolutionEntityTypeCodeExtToComponentTypeCode=y.SolutionComponentTypeCodeToEntityTypeCodeExt=y.SolutionComponentVirtualAttributeSubtype=y.EntityTypeCode=y.SolutionComponentTypeCodeExt=y.RootComponentBehavior=y.SolutionComponentTypeCode=y.EntityKeyIndexStatus=y.ViewStateCode=y.ViewStatusCode=y.RelationshipSecurityTypes=y.CascadeType=y.RelationshipTypeExt=y.RelationshipType=y.AppSubType=y.BusinessProcessType=y.WorkflowCategory=y.WorkflowScope=y.WorkflowTypeCode=y.StatusCodeEnabledDisabled=y.StateCodeEnabledDisabled=y.StatusCode=y.StateCode=y.OptionSetType=y.AttributeTypeCodeNum=y.AttributeFormatName=y.AttributeFormatCode=y.AttributeTypeName=y.AttributeTypeCode=y.PluginSourceType=y.AuthType=y.PluginIsolationMode=y.ComponentState=y.ChartType=y.ChartsType=y.ViewType=y.AttributeType=y.ActivationState=y.FormPresentation=y.FormType=y.TableTypeCode=y.TableTypes=y.ActivityTypeMask=y.PrincipalType=y.OwnershipTypes=void 0;y.QueryType=y.KnownCustomSolutionComponentEntitySetName=y.TeamTypeEnum=y.EnvironmentVariableDefinitionTypeEnum=y.ConnectorTypeEnum=y.RoleInheritance=y.DefaultRoleTemplates=y.DeleteDependencyErrorCode=y.ServiceEndpointConnectionMode=y.ServiceEndpointContract=y.ServiceNamespaceFormat=y.ConnectionRoleCategory=y.ReportTypeCode=y.SdkMessageProcessingMode=y.SupportedDeployment=y.SdkMessageProcessingStage=y.WebResourceTypeCode=y.IntegerFormat=y.DateTimeFormat=void 0;var um;(function(e){e.None="None",e.UserOwned="UserOwned",e.TeamOwned="TeamOwned",e.BusinessOwned="BusinessOwned",e.OrganizationOwned="OrganizationOwned",e.BusinessParented="BusinessParented",e.Filtered="Filtered"})(um||(y.OwnershipTypes=um={}));var cm;(function(e){e.User="Microsoft.Dynamics.CRM.systemuser",e.Team="Microsoft.Dynamics.CRM.team"})(cm||(y.PrincipalType=cm={}));var dm;(function(e){e[e.DoNotDisplayInActivityMenus=0]="DoNotDisplayInActivityMenus",e[e.DisplayInActivityMenus=1]="DisplayInActivityMenus"})(dm||(y.ActivityTypeMask=dm={}));var pm;(function(e){e.Activity="Activity",e.Virtual="Virtual",e.Standard="Standard",e.Elastic="Elastic"})(pm||(y.TableTypes=pm={}));var fm;(function(e){e.Standard="Standard",e.Virtual="Virtual",e.Elastic="Elastic"})(fm||(y.TableTypeCode=fm={}));var mm;(function(e){e[e.Dashboard=0]="Dashboard",e[e.AppointmentBook=1]="AppointmentBook",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.MobileExpress=5]="MobileExpress",e[e.QuickViewForm=6]="QuickViewForm",e[e.QuickCreate=7]="QuickCreate",e[e.Dialog=8]="Dialog",e[e.TaskFlowForm=9]="TaskFlowForm",e[e.InteractionCentricDashboard=10]="InteractionCentricDashboard",e[e.Card=11]="Card",e[e.MainInteractiveExperience=12]="MainInteractiveExperience",e[e.Other=100]="Other",e[e.MainBackup=101]="MainBackup",e[e.AppointmentBookBackup=102]="AppointmentBookBackup",e[e.PowerBIDashboard=103]="PowerBIDashboard"})(mm||(y.FormType=mm={}));var hm;(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(hm||(y.FormPresentation=hm={}));var gm;(function(e){e[e.Inactive=0]="Inactive",e[e.Active=1]="Active"})(gm||(y.ActivationState=gm={}));var vm;(function(e){e[e.String=0]="String",e[e.Number=1]="Number",e[e.Picklist=2]="Picklist"})(vm||(y.AttributeType=vm={}));var bm;(function(e){e[e.Public=0]="Public",e[e.AdvancedFind=1]="AdvancedFind",e[e.Associated=2]="Associated",e[e.QuickFind=4]="QuickFind",e[e.Lookup=64]="Lookup"})(bm||(y.ViewType=bm={}));var ym;(function(e){e[e.ASPChart=0]="ASPChart",e[e.PowerBI=1]="PowerBI"})(ym||(y.ChartsType=ym={}));var Cm;(function(e){e[e.DataAndInteractionCentric=0]="DataAndInteractionCentric",e[e.InteractionCentric=1]="InteractionCentric"})(Cm||(y.ChartType=Cm={}));var Am;(function(e){e[e.Published=0]="Published",e[e.Unpublished=1]="Unpublished",e[e.Deleted=2]="Deleted",e[e.DeletedUnpublished=3]="DeletedUnpublished"})(Am||(y.ComponentState=Am={}));var Nm;(function(e){e[e.None=1]="None",e[e.Sandbox=2]="Sandbox",e[e.External=3]="External"})(Nm||(y.PluginIsolationMode=Nm={}));var wm;(function(e){e[e.BasicAuth=0]="BasicAuth"})(wm||(y.AuthType=wm={}));var Sm;(function(e){e[e.Database=0]="Database",e[e.Disk=1]="Disk",e[e.Normal=2]="Normal",e[e.AzureWebApp=3]="AzureWebApp"})(Sm||(y.PluginSourceType=Sm={}));var Dm;(function(e){e.Boolean="Boolean",e.Customer="Customer",e.Date="Date",e.DateTime="DateTime",e.DateTimeNoTimeZone="DateTimeNoTimeZone",e.Decimal="Decimal",e.Double="Double",e.Integer="Integer",e.Lookup="Lookup",e.Memo="Memo",e.Money="Money",e.Owner="Owner",e.PartyList="PartyList",e.Picklist="Picklist",e.State="State",e.Status="Status",e.String="String",e.Uniqueidentifier="Uniqueidentifier",e.CalendarRules="CalendarRules",e.Virtual="Virtual",e.BigInt="BigInt",e.ManagedProperty="ManagedProperty",e.EntityName="EntityName"})(Dm||(y.AttributeTypeCode=Dm={}));var Em;(function(e){e.DateTimeType="DateTimeType",e.ImageType="ImageType",e.IntegerType="IntegerType",e.FileType="FileType",e.BooleanType="BooleanType",e.CustomerType="CustomerType",e.MemoType="MemoType",e.MultiSelectPicklistType="MultiSelectPicklistType",e.MoneyType="MoneyType",e.DecimalType="DecimalType",e.DoubleType="DoubleType",e.LookupType="LookupType",e.BigIntType="BigIntType",e.UniqueidentifierType="UniqueidentifierType",e.StringType="StringType",e.OwnerType="OwnerType",e.PicklistType="PicklistType",e.StateType="StateType",e.StatusType="StatusType",e.EntityNameType="EntityNameType"})(Em||(y.AttributeTypeName=Em={}));var Im;(function(e){e.Email="Email",e.Text="Text",e.TextArea="TextArea",e.Url="Url",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.Phone="Phone",e.Json="Json",e.RichText="RichText",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime",e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(Im||(y.AttributeFormatCode=Im={}));var _m;(function(e){e.Text="Text",e.TextArea="TextArea",e.Email="Email",e.Url="Url",e.Phone="Phone",e.Json="Json",e.RichText="RichText",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(_m||(y.AttributeFormatName=_m={}));var Pm;(function(e){e[e.Boolean=0]="Boolean",e[e.Customer=1]="Customer",e[e.DateTime=2]="DateTime",e[e.Decimal=3]="Decimal",e[e.Double=4]="Double",e[e.Integer=5]="Integer",e[e.Lookup=6]="Lookup",e[e.Memo=7]="Memo",e[e.Money=8]="Money",e[e.Owner=9]="Owner",e[e.PartyList=10]="PartyList",e[e.Picklist=11]="Picklist",e[e.State=12]="State",e[e.Status=13]="Status",e[e.String=14]="String",e[e.Uniqueidentifier=15]="Uniqueidentifier",e[e.CalendarRules=16]="CalendarRules",e[e.Virtual=17]="Virtual",e[e.BigInt=18]="BigInt",e[e.ManagedProperty=19]="ManagedProperty",e[e.EntityName=20]="EntityName"})(Pm||(y.AttributeTypeCodeNum=Pm={}));var Om;(function(e){e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean"})(Om||(y.OptionSetType=Om={}));var Fm;(function(e){e[e.Draft=0]="Draft",e[e.Activated=1]="Activated"})(Fm||(y.StateCode=Fm={}));var Rm;(function(e){e[e.Draft=1]="Draft",e[e.Activated=2]="Activated"})(Rm||(y.StatusCode=Rm={}));var Tm;(function(e){e[e.Enabled=0]="Enabled",e[e.Disabled=1]="Disabled"})(Tm||(y.StateCodeEnabledDisabled=Tm={}));var xm;(function(e){e[e.Enabled=1]="Enabled",e[e.Disabled=2]="Disabled"})(xm||(y.StatusCodeEnabledDisabled=xm={}));var Lm;(function(e){e[e.Definition=1]="Definition",e[e.Activation=2]="Activation",e[e.Template=3]="Template"})(Lm||(y.WorkflowTypeCode=Lm={}));var Um;(function(e){e[e.User=1]="User",e[e.BusinessUnit=2]="BusinessUnit",e[e.ParentChildBusinessUnit=3]="ParentChildBusinessUnit",e[e.Organization=4]="Organization"})(Um||(y.WorkflowScope=Um={}));var Mm;(function(e){e[e.Workflow=0]="Workflow",e[e.Dialog=1]="Dialog",e[e.BusinessRule=2]="BusinessRule",e[e.Action=3]="Action",e[e.BusinessProcessFlow=4]="BusinessProcessFlow",e[e.Flow=5]="Flow",e[e.UIFlow=6]="UIFlow"})(Mm||(y.WorkflowCategory=Mm={}));var Bm;(function(e){e[e.None=-1]="None",e[e.BusinessFlow=0]="BusinessFlow",e[e.TaskFlow=1]="TaskFlow"})(Bm||(y.BusinessProcessType=Bm={}));var km;(function(e){e[e.CanvasApp=0]="CanvasApp",e[e.ComponentLibrary=1]="ComponentLibrary",e[e.CustomCanvasPage=2]="CustomCanvasPage",e[e.UnifiedApp=3]="UnifiedApp",e[e.CodeApp=4]="CodeApp",e[e.MobileApp=5]="MobileApp"})(km||(y.AppSubType=km={}));var qm;(function(e){e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(qm||(y.RelationshipType=qm={}));var $m;(function(e){e.ManyToOneRelationship="ManyToOneRelationship",e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})($m||(y.RelationshipTypeExt=$m={}));var Vm;(function(e){e.NoCascade="NoCascade",e.Cascade="Cascade",e.Active="Active",e.UserOwned="UserOwned",e.RemoveLink="RemoveLink",e.Restrict="Restrict"})(Vm||(y.CascadeType=Vm={}));var Gm;(function(e){e.None="None",e.Append="Append",e.ParentChild="ParentChild",e.Pointer="Pointer",e.Inheritance="Inheritance"})(Gm||(y.RelationshipSecurityTypes=Gm={}));var zm;(function(e){e[e.Active=1]="Active",e[e.Inactive=2]="Inactive"})(zm||(y.ViewStatusCode=zm={}));var Wm;(function(e){e[e.Active=0]="Active",e[e.Inactive=1]="Inactive"})(Wm||(y.ViewStateCode=Wm={}));var jm;(function(e){e.Active="Active",e.Failed="Failed",e.InProgress="InProgress",e.Pending="Pending"})(jm||(y.EntityKeyIndexStatus=jm={}));var Hm;(function(e){e[e.Entity=1]="Entity",e[e.Attribute=2]="Attribute",e[e.OptionSet=9]="OptionSet",e[e.EntityRelationship=10]="EntityRelationship",e[e.EntityKey=14]="EntityKey",e[e.Role=20]="Role",e[e.DisplayString=22]="DisplayString",e[e.SavedQuery=26]="SavedQuery",e[e.Workflow=29]="Workflow",e[e.Report=31]="Report",e[e.Template=36]="Template",e[e.ContractTemplate=37]="ContractTemplate",e[e.KbArticleTemplate=38]="KbArticleTemplate",e[e.MailMergeTemplate=39]="MailMergeTemplate",e[e.RibbonCustomization=50]="RibbonCustomization",e[e.SavedQueryVisualization=59]="SavedQueryVisualization",e[e.SystemForm=60]="SystemForm",e[e.WebResource=61]="WebResource",e[e.SiteMap=62]="SiteMap",e[e.ConnectionRole=63]="ConnectionRole",e[e.HierarchyRule=65]="HierarchyRule",e[e.CustomControl=66]="CustomControl",e[e.FieldSecurityProfile=70]="FieldSecurityProfile",e[e.AppModule=80]="AppModule",e[e.PluginAssembly=91]="PluginAssembly",e[e.SdkMessageProcessingStep=92]="SdkMessageProcessingStep",e[e.ServiceEndpoint=95]="ServiceEndpoint",e[e.RoutingRule=150]="RoutingRule",e[e.SLA=152]="SLA",e[e.ConvertRule=154]="ConvertRule",e[e.MobileOfflineProfile=161]="MobileOfflineProfile",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.EntityDataSource=183]="EntityDataSource",e[e.SdkMessage=201]="SdkMessage",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.Tour=10061]="Tour"})(Hm||(y.SolutionComponentTypeCode=Hm={}));var Jm;(function(e){e[e.IncludeSubcomponents=0]="IncludeSubcomponents",e[e.DoNotIncludeSubcomponents=1]="DoNotIncludeSubcomponents",e[e.IncludeAsShellOnly=2]="IncludeAsShellOnly"})(Jm||(y.RootComponentBehavior=Jm={}));var Vo;(function(e){e[e.Entity=1]="Entity",e[e.Attribute=2]="Attribute",e[e.OptionSet=9]="OptionSet",e[e.EntityRelationship=10]="EntityRelationship",e[e.EntityKey=14]="EntityKey",e[e.Role=20]="Role",e[e.DisplayString=22]="DisplayString",e[e.SavedQuery=26]="SavedQuery",e[e.Workflow=29]="Workflow",e[e.Report=31]="Report",e[e.Template=36]="Template",e[e.ContractTemplate=37]="ContractTemplate",e[e.KbArticleTemplate=38]="KbArticleTemplate",e[e.MailMergeTemplate=39]="MailMergeTemplate",e[e.RibbonCustomization=50]="RibbonCustomization",e[e.SavedQueryVisualization=59]="SavedQueryVisualization",e[e.SystemForm=60]="SystemForm",e[e.WebResource=61]="WebResource",e[e.SiteMap=62]="SiteMap",e[e.ConnectionRole=63]="ConnectionRole",e[e.HierarchyRule=65]="HierarchyRule",e[e.CustomControl=66]="CustomControl",e[e.FieldSecurityProfile=70]="FieldSecurityProfile",e[e.AppModule=80]="AppModule",e[e.PluginAssembly=91]="PluginAssembly",e[e.SdkMessageProcessingStep=92]="SdkMessageProcessingStep",e[e.ServiceEndpoint=95]="ServiceEndpoint",e[e.RoutingRule=150]="RoutingRule",e[e.SLA=152]="SLA",e[e.ConvertRule=154]="ConvertRule",e[e.MobileOfflineProfile=161]="MobileOfflineProfile",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.EntityDataSource=183]="EntityDataSource",e[e.SdkMessage=201]="SdkMessage",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.DataWorkspace=10282]="DataWorkspace",e[e.Dashboard=100001]="Dashboard",e[e.InteractionCentricDashboard=100002]="InteractionCentricDashboard",e[e.Dialog=100003]="Dialog",e[e.PowerBIDashboard=100004]="PowerBIDashboard",e[e.BusinessRule=100021]="BusinessRule",e[e.ProcessFlow=100024]="ProcessFlow",e[e.Flow=100025]="Flow",e[e.UIFlow=100026]="UIFlow",e[e.ProcessNoFlow=100031]="ProcessNoFlow",e[e.AllDashboards=100032]="AllDashboards",e[e.FormsOnly=100033]="FormsOnly",e[e.ComponentLibrary=100034]="ComponentLibrary",e[e.CanvasAppsOnly=100035]="CanvasAppsOnly",e[e.CustomCanvasPage=100038]="CustomCanvasPage",e[e.CodeApp=100039]="CodeApp",e[e.MobileApp=100046]="MobileApp",e[e.ProcessNoFlowNoUIFlowNoBusinessRule=100036]="ProcessNoFlowNoUIFlowNoBusinessRule",e[e.ActionDefinition=100040]="ActionDefinition",e[e.ActionTemplate=100041]="ActionTemplate",e[e.DialogDefinition=100042]="DialogDefinition",e[e.DialogTemplate=100043]="DialogTemplate",e[e.WorkflowDefinition=100044]="WorkflowDefinition",e[e.WorkflowTemplate=100045]="WorkflowTemplate"})(Vo||(y.SolutionComponentTypeCodeExt=Vo={}));var Go;(function(e){e[e.Entity=9801]="Entity",e[e.Attribute=9802]="Attribute",e[e.OptionSet=9804]="OptionSet",e[e.EntityRelationship=9805]="EntityRelationship",e[e.EntityKey=9812]="EntityKey",e[e.Role=1036]="Role",e[e.DisplayString=4102]="DisplayString",e[e.SavedQuery=1039]="SavedQuery",e[e.Workflow=4703]="Workflow",e[e.Report=9100]="Report",e[e.Template=2010]="Template",e[e.ContractTemplate=2011]="ContractTemplate",e[e.KbArticleTemplate=1016]="KbArticleTemplate",e[e.MailMergeTemplate=9106]="MailMergeTemplate",e[e.SavedQueryVisualization=1111]="SavedQueryVisualization",e[e.SystemForm=1030]="SystemForm",e[e.WebResource=9333]="WebResource",e[e.SiteMap=4709]="SiteMap",e[e.ConnectionRole=3231]="ConnectionRole",e[e.HierarchyRule=8840]="HierarchyRule",e[e.CustomControl=9753]="CustomControl",e[e.FieldSecurityProfile=1200]="FieldSecurityProfile",e[e.AppModule=9006]="AppModule",e[e.PluginAssembly=4605]="PluginAssembly",e[e.SdkMessageProcessingStep=4608]="SdkMessageProcessingStep",e[e.ServiceEndpoint=4618]="ServiceEndpoint",e[e.RoutingRule=8181]="RoutingRule",e[e.SLA=9750]="SLA",e[e.ConvertRule=9300]="ConvertRule",e[e.MobileOfflineProfile=9866]="MobileOfflineProfile",e[e.EntityDataSource=85]="EntityDataSource",e[e.SdkMessage=4606]="SdkMessage",e[e.RibbonCustomization=1120]="RibbonCustomization",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.MaskingRule=373]="MaskingRule",e[e.AttributeMaskingRule=374]="AttributeMaskingRule",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Plan=10283]="Plan",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.TeamTemplate=511]="TeamTemplate",e[e.DataWorkspace=10282]="DataWorkspace",e[e.Dashboard=1030]="Dashboard",e[e.InteractionCentricDashboard=1032]="InteractionCentricDashboard",e[e.PowerBIDashboard=1034]="PowerBIDashboard",e[e.Dialog=1030]="Dialog",e[e.WebResourceImage=9333]="WebResourceImage",e[e.WebResourceSilverlight=9333]="WebResourceSilverlight",e[e.WebResourceCode=9333]="WebResourceCode",e[e.WebResourceData=9333]="WebResourceData",e[e.BusinessRule=4703]="BusinessRule",e[e.ActionDefinition=4703]="ActionDefinition",e[e.ActionTemplate=4703]="ActionTemplate",e[e.DialogDefinition=4703]="DialogDefinition",e[e.DialogTemplate=4703]="DialogTemplate",e[e.WorkflowDefinition=4703]="WorkflowDefinition",e[e.WorkflowTemplate=4703]="WorkflowTemplate",e[e.ProcessFlow=4703]="ProcessFlow",e[e.Flow=4703]="Flow",e[e.UIFlow=4703]="UIFlow",e[e.ProcessNoFlow=4703]="ProcessNoFlow",e[e.ProcessNoFlowNoUIFlowNoBusinessRule=4703]="ProcessNoFlowNoUIFlowNoBusinessRule",e[e.AllDashboards=1030]="AllDashboards",e[e.FormsOnly=1030]="FormsOnly",e[e.ComponentLibrary=300]="ComponentLibrary",e[e.CanvasAppsOnly=300]="CanvasAppsOnly",e[e.CustomCanvasPage=300]="CustomCanvasPage",e[e.CodeApp=300]="CodeApp",e[e.MobileApp=300]="MobileApp",e[e.Chatbot=10030]="Chatbot",e[e.Card=10276]="Card"})(Go||(y.EntityTypeCode=Go={}));var Qm;(function(e){e.MultiSelectPicklist="MultiSelectPicklist",e.File="File",e.Image="Image"})(Qm||(y.SolutionComponentVirtualAttributeSubtype=Qm={}));function B_(e){let t=Vo[e];return Go[t]}y.SolutionComponentTypeCodeToEntityTypeCodeExt=B_;function k_(e){let t=Go[e];return Vo[t]}y.SolutionEntityTypeCodeExtToComponentTypeCode=k_;var Xm;(function(e){e.Active="Active",e.Auto="Auto",e.Disabled="Disabled",e.Inactive="Inactive"})(Xm||(y.ImeMode=Xm={}));var Km;(function(e){e[e.Simple=0]="Simple",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup",e[e.Formula=3]="Formula",e[e.Prompt=4]="Prompt"})(Km||(y.SourceType=Km={}));var Ym;(function(e){e.Email="Email",e.Phone="Phone",e.PhoneticGuide="PhoneticGuide",e.Text="Text",e.TextArea="TextArea",e.TickerSymbol="TickerSymbol",e.Url="Url",e.VersionNumber="VersionNumber"})(Ym||(y.StringFormatName=Ym={}));var Zm;(function(e){e[e.PrecisionProperty=0]="PrecisionProperty",e[e.Organization=1]="Organization",e[e.TransactionCurrency=2]="TransactionCurrency"})(Zm||(y.PrecisionSource=Zm={}));var eh;(function(e){e.UserLocal="UserLocal",e.DateOnly="DateOnly",e.TimeZoneIndependent="TimeZoneIndependent"})(eh||(y.DateTimeBehavior=eh={}));var th;(function(e){e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(th||(y.DateTimeFormat=th={}));var rh;(function(e){e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(rh||(y.IntegerFormat=rh={}));var nh;(function(e){e[e.HTML=1]="HTML",e[e.CSS=2]="CSS",e[e.JScript=3]="JScript",e[e.XML=4]="XML",e[e.PNG=5]="PNG",e[e.JPG=6]="JPG",e[e.GIF=7]="GIF",e[e.Silverlight=8]="Silverlight",e[e.XSL=9]="XSL",e[e.ICO=10]="ICO",e[e.SVG=11]="SVG",e[e.RESX=12]="RESX"})(nh||(y.WebResourceTypeCode=nh={}));var ih;(function(e){e[e.Initial=5]="Initial",e[e.PreValidation=10]="PreValidation",e[e.InternalPreOperationBeforeExternal=15]="InternalPreOperationBeforeExternal",e[e.PreOperation=20]="PreOperation",e[e.InternalPreOperationAfterExternal=25]="InternalPreOperationAfterExternal",e[e.MainOperation=30]="MainOperation",e[e.InternalPostOperationBeforeExternal=35]="InternalPostOperationBeforeExternal",e[e.PostOperation=40]="PostOperation",e[e.InternalPostOperationAfterExternal=45]="InternalPostOperationAfterExternal",e[e.PostOperationDeprecated=50]="PostOperationDeprecated",e[e.FinalPostOperation=55]="FinalPostOperation"})(ih||(y.SdkMessageProcessingStage=ih={}));var ah;(function(e){e[e.ServerOnly=0]="ServerOnly",e[e.OutlookClientOnly=1]="OutlookClientOnly",e[e.Both=2]="Both"})(ah||(y.SupportedDeployment=ah={}));var oh;(function(e){e[e.Synchronous=0]="Synchronous",e[e.Asynchronous=1]="Asynchronous"})(oh||(y.SdkMessageProcessingMode=oh={}));var sh;(function(e){e[e.ReportingServicesReport=1]="ReportingServicesReport",e[e.OtherReport=2]="OtherReport",e[e.LinkedReport=3]="LinkedReport"})(sh||(y.ReportTypeCode=sh={}));var lh;(function(e){e[e.Business=1]="Business",e[e.Family=2]="Family",e[e.Social=3]="Social",e[e.Sales=4]="Sales",e[e.Other=5]="Other",e[e.Stakeholder=1e3]="Stakeholder",e[e.SalesTeam=1001]="SalesTeam",e[e.Service=1002]="Service"})(lh||(y.ConnectionRoleCategory=lh={}));var uh;(function(e){e[e.Name=1]="Name",e[e.Address=2]="Address"})(uh||(y.ServiceNamespaceFormat=uh={}));var ch;(function(e){e[e.OneWay=1]="OneWay",e[e.Queue=2]="Queue",e[e.Rest=3]="Rest",e[e.TwoWay=4]="TwoWay",e[e.Topic=5]="Topic",e[e.PersistentQueue=6]="PersistentQueue",e[e.EventHub=7]="EventHub",e[e.WebHook=8]="WebHook"})(ch||(y.ServiceEndpointContract=ch={}));var dh;(function(e){e[e.Normal=1]="Normal",e[e.Federated=2]="Federated"})(dh||(y.ServiceEndpointConnectionMode=dh={}));var ph;(function(e){e.CannotDeleteInUseComponent="0x8004f01f",e.CannotDeleteInUseAttribute="0x80048418",e.CannotDeleteInUseOptionSet="0x80048417",e.CannotDeleteInUseEntity="0x80048420",e.CannotUninstallWithDependencies="0x8004F01D"})(ph||(y.DeleteDependencyErrorCode=ph={}));var fh;(function(e){e.SystemAdministrator="627090FF-40A3-4053-8790-584EDC5BE201",e.SystemCustomizer="119F245C-3CC8-4B62-B31C-D1A046CED15D"})(fh||(y.DefaultRoleTemplates=fh={}));var mh;(function(e){e[e.DefaultTeamPrivilege=0]="DefaultTeamPrivilege",e[e.DirectUserAndTeamPrivilege=1]="DirectUserAndTeamPrivilege"})(mh||(y.RoleInheritance=mh={}));var hh;(function(e){e[e.NotSpecified=0]="NotSpecified",e[e.CustomConnector=1]="CustomConnector"})(hh||(y.ConnectorTypeEnum=hh={}));var gh;(function(e){e[e.String=1e8]="String",e[e.Number=100000001]="Number",e[e.Boolean=100000002]="Boolean",e[e.JSON=100000003]="JSON",e[e.ConnectionReference=100000004]="ConnectionReference",e[e.Secret=100000005]="Secret"})(gh||(y.EnvironmentVariableDefinitionTypeEnum=gh={}));var vh;(function(e){e[e.Owner=0]="Owner",e[e.Access=1]="Access",e[e.AADSecurityGroup=2]="AADSecurityGroup",e[e.AADOfficeGroup=3]="AADOfficeGroup"})(vh||(y.TeamTypeEnum=vh={}));var bh;(function(e){e.Bots="bots"})(bh||(y.KnownCustomSolutionComponentEntitySetName=bh={}));var yh;(function(e){e[e.MainApplicationView=0]="MainApplicationView",e[e.AdvancedSearch=1]="AdvancedSearch",e[e.SubGrid=2]="SubGrid",e[e.QuickFindSearch=4]="QuickFindSearch",e[e.Reporting=8]="Reporting",e[e.OfflineFilters=16]="OfflineFilters",e[e.MASearch=32]="MASearch",e[e.LookupView=64]="LookupView",e[e.SMAppointmentBookView=128]="SMAppointmentBookView",e[e.OutlookFilters=256]="OutlookFilters",e[e.AddressBookFilters=512]="AddressBookFilters",e[e.SavedQueryTypeOther=2048]="SavedQueryTypeOther",e[e.InteractiveWorkflowView=4096]="InteractiveWorkflowView",e[e.OfflineTemplate=8192]="OfflineTemplate",e[e.OutlookTemplate=131072]="OutlookTemplate",e[e.CustomDefinedView=16384]="CustomDefinedView"})(yh||(y.QueryType=yh={}))});var xu,Ch=S(()=>{"use strict";(function(e){e.DefaultValue="defaultValue",e.Loaded="loaded"})(xu||(xu={}))});var wh,q_,Ah,F8,R8,Xi,Nh,T8,x8,Sh=S(()=>{"use strict";wh=ne(Jr());be();Sn();rm();Ji();It();In();G();q_=ne(Qi());Ch();(function(e){e.Model="Model",e.Canvas="Canvas",e.CustomPages="CustomPages"})(Ah||(Ah={}));F8={Read:Xr.Read,Edit:Xr.Edit,Both:Xr.Both,Container:Xr.Container},R8={input:En.Input,bound:En.Bound,output:En.Output};(function(e){e[e.dataset=0]="dataset",e[e.property=1]="property",e[e.groups=2]="groups",e[e.group=3]="group"})(Xi||(Xi={}));(function(e){e[e.None=0]="None",e[e.HiddenControl=1]="HiddenControl",e[e.CompatibleDataTypesIsMissing=2]="CompatibleDataTypesIsMissing",e[e.TagNameIsUnsupported=3]="TagNameIsUnsupported",e[e.PropertyTypeIsUnsupported=4]="PropertyTypeIsUnsupported",e[e.PropertyTypeGroupIsUnsupported=5]="PropertyTypeGroupIsUnsupported"})(Nh||(Nh={}));T8=new Set([D.Currency,D.Decimal,D.FP,D.Multiple,D.SingleLineEmail,D.SingleLinePhone,D.SingleLineText,D.SingleLineTextArea,D.SingleLineURL,D.SingleLineTickerSymbol,D.WholeNone,D.WholeDuration,D.WholeLanguage,D.WholeTimeZone,D.Enum,D.LookupSimple,D.LookupCustomer,D.LookupOwner,D.LookupPartyList,D.LookupRegarding,D.TwoOptions,D.Boolean,D.PowerBIReport,D.DateAndTimeDateAndTime,D.DateAndTimeDateOnly,D.OptionSet,D.MultiSelectOptionSet,D.CardForm]),x8={numbers:[D.WholeNone,D.FP,D.Decimal,D.Currency],text:[D.SingleLineText,D.SingleLineTextArea,D.Multiple],lookup:[D.LookupSimple,D.LookupCustomer,D.LookupOwner,D.LookupPartyList,D.LookupRegarding],dates:[D.DateAndTimeDateOnly,D.DateAndTimeDateAndTime],allFields:[D.TwoOptions,D.DateAndTimeDateOnly,D.DateAndTimeDateAndTime,D.FP,D.Decimal,D.WholeNone,D.WholeDuration,D.WholeTimeZone,D.WholeLanguage,D.LookupSimple,D.LookupCustomer,D.LookupOwner,D.LookupPartyList,D.LookupRegarding,D.Multiple,D.OptionSet,D.SingleLineText,D.SingleLineTextArea,D.SingleLineEmail,D.SingleLineURL,D.SingleLineTickerSymbol,D.SingleLinePhone]}});var _t,zo,Dh=S(()=>{"use strict";_t=ne(Jr());Ae();be();Ve();Sn();In();Sh();Ji();G();Oe();It();zo=class extends q{constructor(t){super(h.customControl,t)}customControlId;get id(){let t=this.getProperty(d.id);return N.IsNullOrUndefined(t)?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new E(t.substr(1,t.length-2)):new E(t)}getParameters(){let t=new Map,r=this.getAllChildren();if(r&&r.length!==0&&r[0]){let n=r[0].getAllChildren();if(n!=null){for(let i of n)if(i&&i.getAllChildren().length>0){let a=i.getNodeName();t.get(a)?t.get(a).push(i):t.set(a,[i])}}}return t}getFormComponentValueByParameterName(t){let r=this.getParameters()?.get(Xe.value);if(r?.length>0){let n=r[0],i=n?.getAllChildren()?.length>0?n.getAllChildren().find(o=>o.getNodeName()===t):null,a=i?.getAllChildren()?.length>0?i.getAllChildren()[0].getNodeName():"";return this.normalizePropertyValue(a)}}getParameterValue(t){let r=this.getParameterNodeChild(t);return r&&this.normalizePropertyValue(r.getNodeName())}getParameterNodeChild(t){let r=this.getParameters().get(t);return r?.length>0&&r[0].getAllChildren()?.length>0?r[0].getAllChildren()[0]:null}getDatasetName(t){return t.getAllProperties().find(r=>r.key===Xe.name)?.value}getParameterChildrenValues(t,r,n){if(this.isDataSet(t)){let i=r.find(u=>u.key===Xe.name)?.value,a={Name:i,Type:D.Grid,Columns:[]},l=this.getParameters().get(Xe.dataset).find(u=>this.getDatasetName(u)===i).getAllChildren();for(let u of l){let c=u.getNodeName();if(u&&u.getAllChildren().length>0){let p=this.normalizePropertyValue(u.getAllChildren()[0].getNodeName());a[c]=p}}return a}}getParameterIsStatic(t){let r=!1,n=this.getParameters().get(t)[0],i=n&&n.getAllProperties();if(i){for(let a of i)if(a.key===d.static&&a.value==="true"){r=!0;break}}return r}get name(){return this.getProperty(d.Name)}get formFactor(){return this.getProperty(d.formFactor)}set formFactor(t){this.setProperty(d.formFactor,t)}async toJSON(t){if(this.id)return null;let r=await this.parametersToJSON(t),n=parseInt(this.formFactor,10);return{CustomControlId:this.customControlId,FormFactor:isNaN(n)?-1:n,Name:this.name,Version:null,Parameters:r,ShouldOverrideControlVisible:!1}}normalizePropertyValue(t){return t.startsWith(or.StartTag)&&(t=t.substring(1)),t}async parametersToJSON(t){let r=[];if(!this.name)return r;try{let n=await t.formModelService.customControlDiscoveryService.getCustomControlMetadata(this.name);if(n)if(n.configurations){let i=n.configurations,a=this.getParameters();for(let[o,s]of a)if(this.isDataSet(o))for(let l of a.get(o)){let u=l.getAllProperties(),c=this.getDatasetName(l),p=i.get(c),m=await this.parameterJSON(o,u,p,t);r.push({Name:c,Value:m})}else if(this.isGroups(s))r.push({Name:o,Value:{Type:Mf.GroupDefinition,Value:this.normalizePropertyValue(this.getParameterNodeChild(s[0].NodeName).NodeName)}}),i.get(o).groupSet?.forEach(u=>{u.groupConfigurableProperties.forEach(async c=>{let p=c.name;c.propertyType===Xi.dataset?a.get(Xe.dataset)?.some(v=>this.getDatasetName(v)===p)||r.push({Name:p,Value:{Name:p,Columns:[],Type:D.Grid}}):c.propertyType===Xi.property&&(a.has(p)||r.push({Name:p,Value:{Usage:c.usage}}))})});else{let l=s[0].getAllProperties(),u=i.get(o),c=await this.parameterJSON(o,l,u,t);if(c)r.push({Name:o,Value:c});else{(0,_t.trackInfoTrace)(Je,{eventName:`${ir}/parametersToJSON`,eventData:{message:`Configuration metadata for custom control parameter ${o} is not available for custom control : ${this.name}.`}}),r=[];break}}}else(0,_t.trackErrorTrace)(Je,{eventName:`${ir}/parametersToJSON`,eventData:{message:"Custom Control Manifest Property Info not available"}},new Error(`Custom Control Manifest Property Info not available for custom control : ${this.name}.`));else(0,_t.trackErrorTrace)(Je,{eventName:`${ir}/parametersToJSON`,eventData:{message:"Custom Control Manifest not found"}},new Error(`No custom control manifest found for ${this.name}`))}catch(n){(0,_t.trackErrorTrace)(Je,{eventName:`${ir}/parametersToJSON`,eventData:{message:"parameters to json failed"}},n)}return r}async parameterJSON(t,r,n,i){if(this.isDataSet(t)){let a=n,o=r.find(s=>s.key===Xe.name)?.value;if(a)return this.getParameterChildrenValues(t,r);{let s=new Error(`No dataset manifest info for ${o}`);(0,_t.trackErrorTrace)(Je,{eventName:`${ir}/parameterJSON`,eventData:{message:"Missing custom control manifest dataset info"}},s)}}else{let a=n,o=r&&r.find(l=>l.key===d.Type),s=a&&!a.ofTypeGroup.every(l=>!mu.includes(l));if(this.isLookupType(o?.value)||this.isLookupType(a?.ofType)||s)if(a){let l=a.usage,u=this.getParameterIsStatic(t),c=a.isPrimary;if(this.name===Or.FormComponent){let p=this.getFormComponentValueByParameterName(d.bindAttribute),m=await i.formModelService.loadLookupModel(p),v=m.lookupColumn,C=this.getLookupDataTypeFromAttributeMetadata(v);return{Name:t,Type:C,Usage:l,Static:u,Primary:c,EntityName:m.primaryTableName,Value:p,ViewId:this.getFormComponentValueByParameterName(Uf.DefaultViewId),TargetEntityType:v.targets[0],FilterRelationshipName:this.getFormComponentValueByParameterName(d.FilterRelationshipName),AvailableViewIds:this.getFormComponentValueByParameterName(d.AvailableViewIds),DependentAttributeName:this.getFormComponentValueByParameterName(d.DependentAttributeName),DependentAttributeType:this.getFormComponentValueByParameterName(d.DependentAttributeType),AllowFilterOff:I.IsStrictTrue(this.getFormComponentValueByParameterName(d.AllowFilterOff)),DisableQuickFind:I.IsStrictTrue(this.getFormComponentValueByParameterName(d.DisableQuickFind)),EnableViewPicker:!I.IsStrictTrue(this.getFormComponentValueByParameterName(d.DisableViewPicker))}}return{Name:t,Usage:l,Static:u,Primary:c,Value:this.getParameterValue(t)}}else{let l=new Error(`No lookup manifest info for ${t}`);(0,_t.trackErrorTrace)(Je,{eventName:`${ir}/parameterJSON`,eventData:{message:"Missing custom control manifest lookup property info"}},l)}if(a){let l=a.usage,u=this.getParameterIsStatic(t),c=this.getParameterValue(t),p=a.isPrimary;if(o){let v=o.value;return{Type:v,Static:u,Usage:l,Value:this.isNumberTypeProperty(a,v)&&Number(c)?Number(c):c,Primary:p}}if(a.ofType)return{Type:a.ofType,Static:u,Usage:l,Value:c,Primary:!0};if(a.ofTypeGroup)return{Static:u,Usage:l,Value:c,Primary:!0};let m=new Error(`No property type info for ${t}`);(0,_t.trackErrorTrace)(Je,{eventName:`${ir}/parameterJSON`,eventData:{message:"Missing property type info"}},m)}else{let l=new Error(`No property manifest info for ${t}`);(0,_t.trackWarningTrace)(Je,{eventName:`${ir}/parameterJSON`,eventData:{message:"Missing custom control manifest property info"}},l)}}return null}getLookupDataTypeFromAttributeMetadata(t){let{attributeType:r,format:n}=t;switch(r){case _.Customer:return D.LookupCustomer;case _.Owner:return D.LookupOwner;case _.PartyList:return D.LookupPartyList;default:return n===R.Regarding?D.LookupRegarding:D.LookupSimple}}isLookupType(t){return mu.includes(t)}isNumberTypeProperty(t,r){return hu.includes(r)||t.ofTypeGroup.some(n=>hu.includes(n))}isDataSet(t){return Xe.dataset===t}isGroups(t){return!!t[0].getAllProperties().find(n=>n.key==="isGroup"&&n.value==="true")}}});var U,Lu=S(()=>{"use strict";U=class{static get CustomControl(){return"CustomControl"}static get ACIControl(){return"ACIControl"}static get ReferencePanelSearchWidget(){return"ReferencePanelSearchWidget"}static get SearchWidgetControl(){return"SearchWidgetControl"}static get SocialInsightControl(){return"SocialInsightControl"}static get NotesControl(){return"notescontrol"}static get TimerControl(){return"TimerControl"}static get MapsControl(){return"MapsControl"}static get IframeControl(){return"IframeControl"}static get WebResourceHtmlControl(){return"WebResourceHtmlControl"}static get QuickFormCollectionControl(){return"QuickFormCollectionControl"}static get QuickFormControl(){return"QuickFormControl"}static get GridControl(){return"GridControl"}static get SubGridControl(){return"SubGridControl"}static get WebResourceImageControl(){return"WebResourceImageControl"}static get TimeLineControl(){return"TimeLineControl"}static get LeadScoringControl(){return"LeadScoringControl"}}});var O,Fn,we,Wo=S(()=>{"use strict";Ae();Vi();be();Ve();Ji();Hr();Lu();It();O=class{static get TextBoxControl(){return"4273EDBD-AC1D-40d3-9FB2-095C621B552D"}static get TickerControl(){return"1E1FC551-F7A8-43af-AC34-A8DC35C7B6D4"}static get UrlControl(){return"71716B6C-711E-476c-8AB8-5D11542BFB47"}static get PhoneNumberControl(){return"8C10015A-B339-4982-9474-A95FE05631A5"}static get EmailAddressControl(){return"ADA2203E-B4CD-49be-9DDF-234642B43B52"}static get RadioControl(){return"67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED"}static get LookupControl(){return"270BD3DB-D9AF-4782-9025-509E298DEC0A"}static get DateTimeControl(){return"5B773807-9FB2-42db-97C3-7A91EFF8ADFF"}static get IntegerControl(){return"C6D124CA-7EDA-4a60-AEA9-7FB8D318B68F"}static get MoneyControl(){return"533B9E00-756B-4312-95A0-DC888637AC78"}static get FloatControl(){return"0D2C745A-E5A8-4c8f-BA63-C6D3BB604660"}static get DecimalControl(){return"C3EFE0C3-0EC6-42be-8349-CBD9079DFD8E"}static get TextAreaControl(){return"E0DECE4B-6FC8-4a8f-A065-082708572369"}static get PicklistControl(){return"3EF39988-22BB-4f0b-BBBE-64B5A3748AEE"}static get HiddenInputControl(){return"5546E6CD-394C-4BEE-94A8-4425E17EF6C6"}static get GridControl(){return"E7A81278-8635-4D9E-8D4D-59480B391C5B"}static get CheckBoxControl(){return"B0C6723A-8503-4fd7-BB28-C8A06AC933C2"}static get IframeControl(){return"FD2A7985-3187-444e-908D-6624B21F69C0"}static get SocialInsightControl(){return"86B9E25E-695E-4FEF-AC69-F05CFA96739C"}static get OrgInsightsControl(){return"76B9E25E-695E-4FEF-AC69-F05CFA96739C"}static get DurationControl(){return"AA987274-CE4E-4271-A803-66164311A958"}static get RegardingControl(){return"F3015350-44A2-4aa0-97B5-00166532B5E9"}static get PartyListControl(){return"CBFB742C-14E7-4a17-96BB-1A13F7F64AA2"}static get TimeLineControl(){return"06375649-c143-495e-a496-c962e5b4488e"}static get TimeLineControlUC(){return"06375649-C143-495E-A496-C962E5B4488E"}static get TimeZonePicklistControl(){return"7C624A0B-F59E-493d-9583-638D34759266"}static get LanguagePickerControl(){return"671A9387-CA5A-4d1e-8AB7-06E39DDCF6B5"}static get AccessTeamTablePickerControl(){return"3F4E2A56-F102-4B4D-AB9C-F1574CA5BFDA"}static get KBViewerControl(){return"A62B6FA9-169E-406C-B1AA-EAB828CB6026"}static get PicklistStatusControl(){return"5D68B988-0661-4db2-BC3E-17598AD3BE6C"}static get EmailBodyControl(){return"6F3FB987-393B-4d2d-859F-9D0F0349B6AD"}static get PicklistLookupControl(){return"2305E33A-BAD3-4022-9E15-1856CF218333"}static get RelationshipRolePicklistControl(){return"5F986642-5961-4D9F-AB5E-643D71E231E9"}static get RelatedInformationControl(){return"163B90A6-EB64-49D2-9DF8-3C84A4F0A0F8"}static get CoverPagePicklistControl(){return"4168A05C-D857-46AF-8457-5BB47EB04EA1"}static get MailMergeLanguagePickerControl(){return"B634828E-C390-444A-AFE6-E07315D9D970"}static get ConnectionControl(){return"3246F906-1F71-45F7-B11F-D7BE0F9D04C9"}static get ConnectionRoleObjectTypeListControl(){return"821ACF1A-7E46-4A0C-965D-FE14A57D78C7"}static get MapsControl(){return"62B0DF79-0464-470F-8AF7-4483CFEA0C7D"}static get MapLinkControl(){return"91DC0675-C8B9-4421-B1E0-261CEBF02BAC"}static get WebResourceHtmlControl(){return"9FDF5F91-88B1-47F4-AD53-C11EFC01A01D"}static get WebResourceImageControl(){return"587CDF98-C1D5-4BDE-8473-14A0BC7644A7"}static get WebResourceSilverlightControl(){return"080677DB-86EC-4544-AC42-F927E74B491F"}static get ReportControl(){return"A28F441B-916C-4865-87FD-0C5D53BD59C9"}static get ArticleContentControl(){return"F02EF977-2564-4B9A-B2F0-DF083D8A019B"}static get ProcessControl(){return"06E9F7AF-1F54-4681-8EEC-1E21A1CEB465"}static get ActivitiesWallControl(){return"6636847D-B74D-4994-B55A-A6FAF97ECEA2"}static get QuickFormControl(){return"69AF7DCA-2E3B-4EE7-9201-0DA731DD2413"}static get QuickFormCollectionControl(){return"5C5600E0-1D6E-4205-A272-BE80DA87FD42"}static get LinkControl(){return"DFDF1CDE-837B-4AC9-98CF-AC74361FD89D"}static get CompositionLinkControl(){return"DB1284EF-9FFC-4E99-B382-0CC082FE2364"}static get ErrorStatusControl(){return"F4C16ECA-CA81-4E39-9448-834B8378721E"}static get ActivitiesContainerControl(){return"C72511AB-84E5-4FB7-A543-25B4FC01E83E"}static get AccessPrivilegeControl(){return"F93A31B2-99AC-4084-8EC2-D4027C31369A"}static get TimerControl(){return"9C5CA0A1-AB4D-4781-BE7E-8DFBE867B87E"}static get DynamicPropertyListControl(){return"6896F004-B17A-4202-861E-8B7EA2080E0B"}static get ButtonControl(){return"00AD73DA-BD4D-49C6-88A8-2F4F4CAD4A20"}static get SearchWidgetControl(){return"E616A57F-20E0-4534-8662-A101B5DDF4E0"}static get EmailRecipientActivityControl(){return"26E9760F-7454-40DE-BB07-F6DCCCB82040"}static get LabelControl(){return"39354E4A-5015-4D74-8031-EA9EB73A1322"}static get CustomControl(){return"F9A8A302-114E-466A-B582-6771B2AE0D92"}static get EditFilterControl(){return"1479835F-F852-4679-B864-C6892A2844C9"}static get RichEditorControl(){return"F94DB24F-263D-44A7-B38E-A35E9854812B"}static get PowerBIControl(){return"8C54228C-1B25-4909-A12A-F2B968BB0D62"}static get EmailEngagementActionsControl(){return"F454228D-1D25-4319-E12F-D27968BC0234"}static get ACIControl(){return"C8BFBBEF-6851-4401-A0CC-7450062FE085"}static get ChoicesControl(){return"4AA28AB7-9C13-4F57-A73D-AD894D048B5F"}static get ReferencePanelSubgridControl(){return"02D4264B-47E2-4B4C-AA95-F439F3F4D458"}static get ReferencePanelSearchWidget(){return"7CCD1494-1F7A-4E3A-8BDE-F32069DAEB9F"}static get ReferencePanelQuickFormCollectionControl(){return"B68B05F0-A46D-43F8-843B-917920AF806A"}static get SpacerControl(){return"E4BAB03A-A9A5-4C23-CC3B-54AA680150E2"}},Fn=class{static get RelationshipAssistant(){return"3ff9a528-dd50-4aca-8f10-2e5ed73513ad"}static get PredictiveLeadScoring(){return"6f503f2a-d033-4106-b62c-f8f2e5f01a57"}},we=class e{static FieldControlIds=e.initializeFieldControls();static UnboundControlIds=e.initializeUnboundControls();static ControlsAllowedForReferencePanel=e.initializeReferencePanelControls();static ControlsAllowedForFooter=e.initializeFooterControls();static CustomControlIdMap=new Qe;static initializeFieldControls(){let t=new Qe,r=e.getControlName(_.SingleLineofText,R.Phone);t.add(r,new E(O.PhoneNumberControl));let n=e.getControlName(_.SingleLineofText,R.TextArea);t.add(n,new E(O.TextAreaControl));let i=e.getControlName(_.SingleLineofText,R.Text);t.add(i,new E(O.TextBoxControl));let a=e.getControlName(_.SingleLineofText,R.Email);t.add(a,new E(O.EmailAddressControl));let o=e.getControlName(_.SingleLineofText,R.Url);t.add(o,new E(O.UrlControl));let s=e.getControlName(_.SingleLineofText,R.TickerSymbol);t.add(s,new E(O.TickerControl));let l=e.getControlName(_.SingleLineofText,R.PhoneticGuide);t.add(l,new E(O.TextBoxControl));let u=e.getControlName(_.WholeNumber,R.Duration);t.add(u,new E(O.DurationControl));let c=e.getControlName(_.WholeNumber,R.Language);t.add(c,new E(O.LanguagePickerControl));let p=e.getControlName(_.WholeNumber,R.TimeZone);t.add(p,new E(O.TimeZonePicklistControl));let m=e.getControlName(_.WholeNumber,R.None);t.add(m,new E(O.IntegerControl));let v=e.getControlName(_.DateTime,R.DateOnly);t.add(v,new E(O.DateTimeControl));let C=e.getControlName(_.DateTime,R.DateAndTime);t.add(C,new E(O.DateTimeControl));let w=e.getControlName(_.LookupType,R.None);t.add(w,new E(O.LookupControl));let P=e.getControlName(_.CustomerType,R.None);t.add(P,new E(O.LookupControl));let x=e.getControlName(_.FloatingPointNumber,R.None);t.add(x,new E(O.FloatControl));let M=e.getControlName(_.DecimalNumber,R.None);t.add(M,new E(O.DecimalControl));let T=e.getControlName(_.Currency,R.None);t.add(T,new E(O.MoneyControl));let L=e.getControlName(_.MultipleLineofText,R.None);t.add(L,new E(O.TextAreaControl));let Q=e.getControlName(_.MultipleLineofText,R.Text);t.add(Q,new E(O.TextAreaControl));let B=e.getControlName(_.MultipleLineofText,R.TextArea);t.add(B,new E(O.TextAreaControl));let W=e.getControlName(_.MultipleLineofText,R.Email);t.add(W,new E(O.EmailBodyControl));let k=e.getControlName(_.OptionSet,R.None);t.add(k,new E(O.PicklistControl));let $=e.getControlName(_.TwoOptions,R.None);t.add($,new E(O.RadioControl));let re=e.getControlName(_.Image,R.None);t.add(re,new E(O.WebResourceImageControl));let j=e.getControlName(_.Image,R.None);t.add(j,new E(O.WebResourceHtmlControl));let er=e.getControlName(_.TwoOptions,"Radio");t.add(er,new E(O.RadioControl));let Al=e.getControlName(_.TwoOptions,"CheckBox");t.add(Al,new E(O.CheckBoxControl));let Ei=e.getControlName(_.TwoOptions,"List");t.add(Ei,new E(O.PicklistControl));let no=e.getControlName(_.State,R.None);t.add(no,new E(O.PicklistControl));let le=e.getControlName(_.Status,R.None);t.add(le,new E(O.PicklistStatusControl));let Ze=e.getControlName(_.OwnerType,R.None);t.add(Ze,new E(O.LookupControl));let Nl=e.getControlName(_.PartyListType,R.None);t.add(Nl,new E(O.PartyListControl));let uD=e.getControlName(_.LookupType,R.Regarding);t.add(uD,new E(O.RegardingControl));let cD=e.getControlName(_.MultiSelectOptionSet,R.None);return t.add(cD,new E(O.ChoicesControl)),t}static getControlName(t,r){return t+"_"+r}static getControlIdByTypeAndFormat(t,r){let n=e.getControlName(t.toString(),r.toString());return e.FieldControlIds.containsKey(n)?e.FieldControlIds.getValue(n):null}static getTypeAndFormatByControlOrUniqueId(t){for(let r in e.FieldControlIds.getKeys())if(e.FieldControlIds.getValue(e.FieldControlIds.getKeys()[r]).guidString.toLowerCase()===t)return e.FieldControlIds.getKeys()[r]}static getControlDataTypeByControlOrUniqueId(t){if(!N.IsNullOrEmptyGuid(t)){let r=e.getTypeAndFormatByControlOrUniqueId(t.guidString.toLowerCase());return r=N.IsNullOrUndefined(r)?e.getUnboundControlNameFromIdentifier(t):r.substring(0,r.indexOf("_")),r}return null}static isCustomControl(t){return N.IsNullOrUndefined(t.control)||N.IsNullOrUndefined(t.control.ClassId)||t.control.ClassId.guidString===O.CustomControl}static initializeUnboundControls(){let t=new Qe;return t.add(O.ACIControl,U.ACIControl),t.add(O.IframeControl,U.IframeControl),t.add(O.SearchWidgetControl,U.SearchWidgetControl),t.add(O.MapsControl,U.MapsControl),t.add(O.QuickFormCollectionControl,U.QuickFormCollectionControl),t.add(O.GridControl,U.SubGridControl),t.add(O.WebResourceImageControl,U.WebResourceImageControl),t.add(O.WebResourceHtmlControl,U.WebResourceHtmlControl),t.add(O.ReferencePanelSearchWidget,U.SearchWidgetControl),t.add(O.ReferencePanelQuickFormCollectionControl,U.QuickFormCollectionControl),t.add(O.ReferencePanelSubgridControl,U.SubGridControl),t.add(O.TimerControl,U.TimerControl),t.add(O.TimeLineControl,U.NotesControl),t.add(O.TimeLineControlUC,U.NotesControl),t.add(O.SocialInsightControl,U.SocialInsightControl),t.add(Fn.RelationshipAssistant,U.CustomControl),t}static initializeReferencePanelControls(){let t=new Qe;return t.add(O.IframeControl,U.IframeControl),t.add(O.ReferencePanelSearchWidget,U.SearchWidgetControl),t.add(O.ReferencePanelQuickFormCollectionControl,U.QuickFormCollectionControl),t.add(O.ReferencePanelSubgridControl,U.SubGridControl),t.add(O.WebResourceHtmlControl,U.WebResourceHtmlControl),t.add(O.WebResourceImageControl,U.WebResourceHtmlControl),t}static initializeFooterControls(){let t=new Dn;return t.add(Pn.IFRAME,!0),t.add(Pn.SPACER,!0),t.add(Pn.WEB_RESOURCE_HTML,!0),t}static isUnboundFormControl(t){if(N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.control)||N.IsNullOrUndefined(t.control.ClassId))return!1;let r=e.getUniqueIdentifierForControl(t.control);return e.UnboundControlIds.containsKey(r.guidString)}static isReferencePanelSection(t){return!N.IsNullOrUndefined(t)&&!N.IsNullOrUndefined(t.Name)&&t.Name.indexOf(se.referencePanelNamePrefix)===0}static isUnboundFormControlByIdentifier(t){return N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.guidString)?!1:e.UnboundControlIds.containsKey(t.guidString)}static getUnboundFormControlName(t){let r=I.EmptyString;if(N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.control)||N.IsNullOrUndefined(t.control.ClassId))return r;let n=e.getUniqueIdentifierForControl(t.control);return e.UnboundControlIds.getValue(n.guidString).toString()}static getUnboundControlNameFromIdentifier(t){return N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.guidString)?I.EmptyString:e.UnboundControlIds.getValue(t.guidString).toString()}static isSpacerControl(t){return t===O.SpacerControl}static GetRowSpan(t){let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===O.CustomControl&&!N.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}switch(e.UnboundControlIds.getValue(r.guidString)){case U.IframeControl:case U.ACIControl:case U.SocialInsightControl:return 6;case U.SubGridControl:case U.CustomControl:return 4;case U.WebResourceImageControl:return 15;case U.WebResourceHtmlControl:return 15;case U.MapsControl:return 8;case U.SearchWidgetControl:return 10;case U.NotesControl:case U.TimeLineControl:return 15;case U.TimerControl:return 2;default:}}static isLookUpControl(t){return!N.IsNullOrUndefined(t)&&t.ClassId.guidString===O.LookupControl}static isRelationshipAssistantOrLeadScoringControl(t){return!N.IsNullOrUndefined(t)&&e.isRelationshipAssistantOrLeadScoring(t.UniqueId)}static isRelationshipAssistantOrLeadScoring(t){return!N.IsNullOrUndefined(t)&&(t.guidString===Fn.RelationshipAssistant||t.guidString===Fn.PredictiveLeadScoring)}static isRelationshipAssistantControl(t){return!N.IsNullOrUndefined(t)&&e.isRelationshipAssistant(t.UniqueId)}static isRelationshipAssistant(t){return!N.IsNullOrUndefined(t)&&t.guidString===Fn.RelationshipAssistant}static getUniqueIdentifierForControl(t){if(N.IsNullOrUndefined(t))return null;let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===O.CustomControl&&!N.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}return r}}});var jo,Eh=S(()=>{"use strict";jo=class{listeners=[];listenersOncer=[];on(t){return this.listeners.push(t),{dispose:()=>this.off(t)}}once(t){this.listenersOncer.push(t)}off(t){let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1)}emit(t){this.listeners.forEach(r=>r(t)),this.listenersOncer.forEach(r=>r(t)),this.listenersOncer=[]}pipe(t){return this.on(r=>t.emit(r))}}});var Zr,Rn,Ih,_h,Fr,Ph,Oh,Uu=S(()=>{"use strict";(function(e){e[e.Center=0]="Center",e[e.Left=1]="Left",e[e.Right=2]="Right"})(Zr||(Zr={}));(function(e){e[e.Left=0]="Left",e[e.Top=1]="Top"})(Rn||(Rn={}));(function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle"})(Ih||(Ih={}));(function(e){e[e.None=0]="None",e[e.Create=1]="Create",e[e.Existing=2]="Existing",e[e.ReadOnly=3]="ReadOnly",e[e.Disabled=4]="Disabled",e[e.BulkEdit=6]="BulkEdit",e[e.Merge=7]="Merge",e[e.Print=8]="Print",e[e.FollowUp=9]="FollowUp"})(_h||(_h={}));(function(e){e[e.None=-1]="None",e[e.AppointmentBook=0]="AppointmentBook",e[e.Hardcoded=1]="Hardcoded",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.Dashboard=5]="Dashboard",e[e.Quick=6]="Quick",e[e.Mobile=7]="Mobile",e[e.Read=8]="Read",e[e.QuickCreate=9]="QuickCreate",e[e.Dialog=10]="Dialog",e[e.Card=11]="Card",e[e.TaskBasedForm=12]="TaskBasedForm",e[e.InteractionCentricDashboard=13]="InteractionCentricDashboard"})(Fr||(Fr={}));(function(e){e[e.None=0]="None",e[e.SystemRequired=1]="SystemRequired",e[e.ApplicationRequired=2]="ApplicationRequired",e[e.Recommended=3]="Recommended"})(Ph||(Ph={}));(function(e){e[e.Boolean=0]="Boolean",e[e.Customer=1]="Customer",e[e.DateTime=2]="DateTime",e[e.Decimal=3]="Decimal",e[e.Double=4]="Double",e[e.Integer=5]="Integer",e[e.Lookup=6]="Lookup",e[e.Memo=7]="Memo",e[e.Money=8]="Money",e[e.Owner=9]="Owner",e[e.PartyList=10]="PartyList",e[e.Picklist=11]="Picklist",e[e.State=12]="State",e[e.Status=13]="Status",e[e.String=14]="String",e[e.Uniqueidentifier=15]="Uniqueidentifier",e[e.CalendarRules=16]="CalendarRules",e[e.Virtual=17]="Virtual",e[e.BigInt=18]="BigInt",e[e.ManagedProperty=19]="ManagedProperty",e[e.EntityName=20]="EntityName"})(Oh||(Oh={}))});var Tn,Fh=S(()=>{"use strict";Hi();Tn=Au({packageName:"cds-designer-models",features:{showAllPCFControls:{owner:"anchoudh",description:"Do not only show the controls that exist on the whitelist",enabledFor:{test:!1,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1}},showTestControls:{owner:"lucorre",description:"Show advanced custom controls for testing (designated in Authoring Manifest with isTestOnly=true)",enabledFor:{test:!0,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1}},enablePrefetchGetMoreComponentsLocalization:{owner:"vajagarl",description:"Enables prefetching the localization files for controls displayed in custom control picker",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0}},showMapControl:{owner:"vayilavarapu",createdDate:"07/19/2022",description:"Show map control",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},enableFallbackFormTemplate:{owner:"vajagarl",createdDate:"01/03/2023",description:"Enable default form template as fallback if unable to retrieve a form template from Dataverse",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},enableAutoInsertionOfCellInRow:{owner:"debeshd",createdDate:"09/01/2023",description:"Enable the auto insertion of cell in a row when a section is initialized",enabledFor:{test:!1,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableOneGridEvents:{owner:"aansu",createdDate:"08/21/2024",description:"Enable OneGrid events in form designer",enabledFor:{test:!0,preprod:!0,prod:!0,preview:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},disablePBIComponents:{owner:"adekulkarni",createdDate:"02/13/2025",description:"Disables PBI components and cleans them up from the form",enabledFor:{test:!0,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableAgentResponse:{owner:"jennietu",createdDate:"04/24/2025",description:"Enables agent response in form designer",enabledFor:{test:!0,preprod:!0,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableDelayedLocalizationForCustomControls:{owner:"aansu",createdDate:"06/08/2025",description:"Enables delayed localization of custom control",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}}}})});function Rh(e){return{...e,extractConfig:t=>$_(t,Object.keys(e.fallback))}}function $_(e,t){let r={};for(let n of t)typeof e[n]<"u"&&(r[n]=e[n]);return r}var Mu=S(()=>{"use strict";});var Bu=f((l6,xh)=>{var Ki=new Proxy(function(){return Ki},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Ki},apply:function(){return Ki},construct:function(){return{}}}),Th=function(){return Ki};Object.setPrototypeOf(Th,Ki);xh.exports=Th});var Mh=f((u6,Uh)=>{var Yi=new Proxy(function(){return Yi},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Yi},apply:function(){return Yi},construct:function(){return{}}}),Lh=function(){return Yi};Object.setPrototypeOf(Lh,Yi);Uh.exports=Lh});var ku=f((c6,kh)=>{var Zi=new Proxy(function(){return Zi},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Zi},apply:function(){return Zi},construct:function(){return{}}}),Bh=function(){return Zi};Object.setPrototypeOf(Bh,Zi);kh.exports=Bh});var $h=f((d6,qh)=>{function V_(){this.__data__=[],this.size=0}qh.exports=V_});var xn=f((p6,Vh)=>{function G_(e,t){return e===t||e!==e&&t!==t}Vh.exports=G_});var ea=f((f6,Gh)=>{var z_=xn();function W_(e,t){for(var r=e.length;r--;)if(z_(e[r][0],t))return r;return-1}Gh.exports=W_});var Wh=f((m6,zh)=>{var j_=ea(),H_=Array.prototype,J_=H_.splice;function Q_(e){var t=this.__data__,r=j_(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():J_.call(t,r,1),--this.size,!0}zh.exports=Q_});var Hh=f((h6,jh)=>{var X_=ea();function K_(e){var t=this.__data__,r=X_(t,e);return r<0?void 0:t[r][1]}jh.exports=K_});var Qh=f((g6,Jh)=>{var Y_=ea();function Z_(e){return Y_(this.__data__,e)>-1}Jh.exports=Z_});var Kh=f((v6,Xh)=>{var eP=ea();function tP(e,t){var r=this.__data__,n=eP(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}Xh.exports=tP});var ta=f((b6,Yh)=>{var rP=$h(),nP=Wh(),iP=Hh(),aP=Qh(),oP=Kh();function Ln(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ln.prototype.clear=rP;Ln.prototype.delete=nP;Ln.prototype.get=iP;Ln.prototype.has=aP;Ln.prototype.set=oP;Yh.exports=Ln});var eg=f((y6,Zh)=>{var sP=ta();function lP(){this.__data__=new sP,this.size=0}Zh.exports=lP});var rg=f((C6,tg)=>{function uP(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}tg.exports=uP});var ig=f((A6,ng)=>{function cP(e){return this.__data__.get(e)}ng.exports=cP});var og=f((N6,ag)=>{function dP(e){return this.__data__.has(e)}ag.exports=dP});var qu=f((w6,sg)=>{var pP=typeof global=="object"&&global&&global.Object===Object&&global;sg.exports=pP});var Pt=f((S6,lg)=>{var fP=qu(),mP=typeof self=="object"&&self&&self.Object===Object&&self,hP=fP||mP||Function("return this")();lg.exports=hP});var ra=f((D6,ug)=>{var gP=Pt(),vP=gP.Symbol;ug.exports=vP});var fg=f((E6,pg)=>{var cg=ra(),dg=Object.prototype,bP=dg.hasOwnProperty,yP=dg.toString,na=cg?cg.toStringTag:void 0;function CP(e){var t=bP.call(e,na),r=e[na];try{e[na]=void 0;var n=!0}catch{}var i=yP.call(e);return n&&(t?e[na]=r:delete e[na]),i}pg.exports=CP});var hg=f((I6,mg)=>{var AP=Object.prototype,NP=AP.toString;function wP(e){return NP.call(e)}mg.exports=wP});var en=f((_6,bg)=>{var gg=ra(),SP=fg(),DP=hg(),EP="[object Null]",IP="[object Undefined]",vg=gg?gg.toStringTag:void 0;function _P(e){return e==null?e===void 0?IP:EP:vg&&vg in Object(e)?SP(e):DP(e)}bg.exports=_P});var sr=f((P6,yg)=>{function PP(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}yg.exports=PP});var Ho=f((O6,Cg)=>{var OP=en(),FP=sr(),RP="[object AsyncFunction]",TP="[object Function]",xP="[object GeneratorFunction]",LP="[object Proxy]";function UP(e){if(!FP(e))return!1;var t=OP(e);return t==TP||t==xP||t==RP||t==LP}Cg.exports=UP});var Ng=f((F6,Ag)=>{var MP=Pt(),BP=MP["__core-js_shared__"];Ag.exports=BP});var Dg=f((R6,Sg)=>{var $u=Ng(),wg=function(){var e=/[^.]+$/.exec($u&&$u.keys&&$u.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function kP(e){return!!wg&&wg in e}Sg.exports=kP});var Vu=f((T6,Eg)=>{var qP=Function.prototype,$P=qP.toString;function VP(e){if(e!=null){try{return $P.call(e)}catch{}try{return e+""}catch{}}return""}Eg.exports=VP});var _g=f((x6,Ig)=>{var GP=Ho(),zP=Dg(),WP=sr(),jP=Vu(),HP=/[\\^$.*+?()[\]{}|]/g,JP=/^\[object .+?Constructor\]$/,QP=Function.prototype,XP=Object.prototype,KP=QP.toString,YP=XP.hasOwnProperty,ZP=RegExp("^"+KP.call(YP).replace(HP,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function eO(e){if(!WP(e)||zP(e))return!1;var t=GP(e)?ZP:JP;return t.test(jP(e))}Ig.exports=eO});var Og=f((L6,Pg)=>{function tO(e,t){return e?.[t]}Pg.exports=tO});var Rr=f((U6,Fg)=>{var rO=_g(),nO=Og();function iO(e,t){var r=nO(e,t);return rO(r)?r:void 0}Fg.exports=iO});var Jo=f((M6,Rg)=>{var aO=Rr(),oO=Pt(),sO=aO(oO,"Map");Rg.exports=sO});var ia=f((B6,Tg)=>{var lO=Rr(),uO=lO(Object,"create");Tg.exports=uO});var Ug=f((k6,Lg)=>{var xg=ia();function cO(){this.__data__=xg?xg(null):{},this.size=0}Lg.exports=cO});var Bg=f((q6,Mg)=>{function dO(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}Mg.exports=dO});var qg=f(($6,kg)=>{var pO=ia(),fO="__lodash_hash_undefined__",mO=Object.prototype,hO=mO.hasOwnProperty;function gO(e){var t=this.__data__;if(pO){var r=t[e];return r===fO?void 0:r}return hO.call(t,e)?t[e]:void 0}kg.exports=gO});var Vg=f((V6,$g)=>{var vO=ia(),bO=Object.prototype,yO=bO.hasOwnProperty;function CO(e){var t=this.__data__;return vO?t[e]!==void 0:yO.call(t,e)}$g.exports=CO});var zg=f((G6,Gg)=>{var AO=ia(),NO="__lodash_hash_undefined__";function wO(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=AO&&t===void 0?NO:t,this}Gg.exports=wO});var jg=f((z6,Wg)=>{var SO=Ug(),DO=Bg(),EO=qg(),IO=Vg(),_O=zg();function Un(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Un.prototype.clear=SO;Un.prototype.delete=DO;Un.prototype.get=EO;Un.prototype.has=IO;Un.prototype.set=_O;Wg.exports=Un});var Qg=f((W6,Jg)=>{var Hg=jg(),PO=ta(),OO=Jo();function FO(){this.size=0,this.__data__={hash:new Hg,map:new(OO||PO),string:new Hg}}Jg.exports=FO});var Kg=f((j6,Xg)=>{function RO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}Xg.exports=RO});var aa=f((H6,Yg)=>{var TO=Kg();function xO(e,t){var r=e.__data__;return TO(t)?r[typeof t=="string"?"string":"hash"]:r.map}Yg.exports=xO});var e0=f((J6,Zg)=>{var LO=aa();function UO(e){var t=LO(this,e).delete(e);return this.size-=t?1:0,t}Zg.exports=UO});var r0=f((Q6,t0)=>{var MO=aa();function BO(e){return MO(this,e).get(e)}t0.exports=BO});var i0=f((X6,n0)=>{var kO=aa();function qO(e){return kO(this,e).has(e)}n0.exports=qO});var o0=f((K6,a0)=>{var $O=aa();function VO(e,t){var r=$O(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}a0.exports=VO});var Qo=f((Y6,s0)=>{var GO=Qg(),zO=e0(),WO=r0(),jO=i0(),HO=o0();function Mn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Mn.prototype.clear=GO;Mn.prototype.delete=zO;Mn.prototype.get=WO;Mn.prototype.has=jO;Mn.prototype.set=HO;s0.exports=Mn});var u0=f((Z6,l0)=>{var JO=ta(),QO=Jo(),XO=Qo(),KO=200;function YO(e,t){var r=this.__data__;if(r instanceof JO){var n=r.__data__;if(!QO||n.length<KO-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new XO(n)}return r.set(e,t),this.size=r.size,this}l0.exports=YO});var Gu=f((e7,c0)=>{var ZO=ta(),eF=eg(),tF=rg(),rF=ig(),nF=og(),iF=u0();function Bn(e){var t=this.__data__=new ZO(e);this.size=t.size}Bn.prototype.clear=eF;Bn.prototype.delete=tF;Bn.prototype.get=rF;Bn.prototype.has=nF;Bn.prototype.set=iF;c0.exports=Bn});var p0=f((t7,d0)=>{var aF="__lodash_hash_undefined__";function oF(e){return this.__data__.set(e,aF),this}d0.exports=oF});var m0=f((r7,f0)=>{function sF(e){return this.__data__.has(e)}f0.exports=sF});var g0=f((n7,h0)=>{var lF=Qo(),uF=p0(),cF=m0();function Xo(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new lF;++t<r;)this.add(e[t])}Xo.prototype.add=Xo.prototype.push=uF;Xo.prototype.has=cF;h0.exports=Xo});var b0=f((i7,v0)=>{function dF(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}v0.exports=dF});var C0=f((a7,y0)=>{function pF(e,t){return e.has(t)}y0.exports=pF});var zu=f((o7,A0)=>{var fF=g0(),mF=b0(),hF=C0(),gF=1,vF=2;function bF(e,t,r,n,i,a){var o=r&gF,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var u=a.get(e),c=a.get(t);if(u&&c)return u==t&&c==e;var p=-1,m=!0,v=r&vF?new fF:void 0;for(a.set(e,t),a.set(t,e);++p<s;){var C=e[p],w=t[p];if(n)var P=o?n(w,C,p,t,e,a):n(C,w,p,e,t,a);if(P!==void 0){if(P)continue;m=!1;break}if(v){if(!mF(t,function(x,M){if(!hF(v,M)&&(C===x||i(C,x,r,n,a)))return v.push(M)})){m=!1;break}}else if(!(C===w||i(C,w,r,n,a))){m=!1;break}}return a.delete(e),a.delete(t),m}A0.exports=bF});var Wu=f((s7,N0)=>{var yF=Pt(),CF=yF.Uint8Array;N0.exports=CF});var S0=f((l7,w0)=>{function AF(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}w0.exports=AF});var E0=f((u7,D0)=>{function NF(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}D0.exports=NF});var F0=f((c7,O0)=>{var I0=ra(),_0=Wu(),wF=xn(),SF=zu(),DF=S0(),EF=E0(),IF=1,_F=2,PF="[object Boolean]",OF="[object Date]",FF="[object Error]",RF="[object Map]",TF="[object Number]",xF="[object RegExp]",LF="[object Set]",UF="[object String]",MF="[object Symbol]",BF="[object ArrayBuffer]",kF="[object DataView]",P0=I0?I0.prototype:void 0,ju=P0?P0.valueOf:void 0;function qF(e,t,r,n,i,a,o){switch(r){case kF:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case BF:return!(e.byteLength!=t.byteLength||!a(new _0(e),new _0(t)));case PF:case OF:case TF:return wF(+e,+t);case FF:return e.name==t.name&&e.message==t.message;case xF:case UF:return e==t+"";case RF:var s=DF;case LF:var l=n&IF;if(s||(s=EF),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;n|=_F,o.set(e,t);var c=SF(s(e),s(t),n,i,a,o);return o.delete(e),c;case MF:if(ju)return ju.call(e)==ju.call(t)}return!1}O0.exports=qF});var T0=f((d7,R0)=>{function $F(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}R0.exports=$F});var Tr=f((p7,x0)=>{var VF=Array.isArray;x0.exports=VF});var U0=f((f7,L0)=>{var GF=T0(),zF=Tr();function WF(e,t,r){var n=t(e);return zF(e)?n:GF(n,r(e))}L0.exports=WF});var B0=f((m7,M0)=>{function jF(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}M0.exports=jF});var q0=f((h7,k0)=>{function HF(){return[]}k0.exports=HF});var G0=f((g7,V0)=>{var JF=B0(),QF=q0(),XF=Object.prototype,KF=XF.propertyIsEnumerable,$0=Object.getOwnPropertySymbols,YF=$0?function(e){return e==null?[]:(e=Object(e),JF($0(e),function(t){return KF.call(e,t)}))}:QF;V0.exports=YF});var W0=f((v7,z0)=>{function ZF(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}z0.exports=ZF});var xr=f((b7,j0)=>{function eR(e){return e!=null&&typeof e=="object"}j0.exports=eR});var J0=f((y7,H0)=>{var tR=en(),rR=xr(),nR="[object Arguments]";function iR(e){return rR(e)&&tR(e)==nR}H0.exports=iR});var Hu=f((C7,K0)=>{var Q0=J0(),aR=xr(),X0=Object.prototype,oR=X0.hasOwnProperty,sR=X0.propertyIsEnumerable,lR=Q0(function(){return arguments}())?Q0:function(e){return aR(e)&&oR.call(e,"callee")&&!sR.call(e,"callee")};K0.exports=lR});var Z0=f((A7,Y0)=>{function uR(){return!1}Y0.exports=uR});var Ko=f((oa,kn)=>{var cR=Pt(),dR=Z0(),rv=typeof oa=="object"&&oa&&!oa.nodeType&&oa,ev=rv&&typeof kn=="object"&&kn&&!kn.nodeType&&kn,pR=ev&&ev.exports===rv,tv=pR?cR.Buffer:void 0,fR=tv?tv.isBuffer:void 0,mR=fR||dR;kn.exports=mR});var Yo=f((N7,nv)=>{var hR=9007199254740991,gR=/^(?:0|[1-9]\d*)$/;function vR(e,t){var r=typeof e;return t=t??hR,!!t&&(r=="number"||r!="symbol"&&gR.test(e))&&e>-1&&e%1==0&&e<t}nv.exports=vR});var Ju=f((w7,iv)=>{var bR=9007199254740991;function yR(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=bR}iv.exports=yR});var ov=f((S7,av)=>{var CR=en(),AR=Ju(),NR=xr(),wR="[object Arguments]",SR="[object Array]",DR="[object Boolean]",ER="[object Date]",IR="[object Error]",_R="[object Function]",PR="[object Map]",OR="[object Number]",FR="[object Object]",RR="[object RegExp]",TR="[object Set]",xR="[object String]",LR="[object WeakMap]",UR="[object ArrayBuffer]",MR="[object DataView]",BR="[object Float32Array]",kR="[object Float64Array]",qR="[object Int8Array]",$R="[object Int16Array]",VR="[object Int32Array]",GR="[object Uint8Array]",zR="[object Uint8ClampedArray]",WR="[object Uint16Array]",jR="[object Uint32Array]",ie={};ie[BR]=ie[kR]=ie[qR]=ie[$R]=ie[VR]=ie[GR]=ie[zR]=ie[WR]=ie[jR]=!0;ie[wR]=ie[SR]=ie[UR]=ie[DR]=ie[MR]=ie[ER]=ie[IR]=ie[_R]=ie[PR]=ie[OR]=ie[FR]=ie[RR]=ie[TR]=ie[xR]=ie[LR]=!1;function HR(e){return NR(e)&&AR(e.length)&&!!ie[CR(e)]}av.exports=HR});var lv=f((D7,sv)=>{function JR(e){return function(t){return e(t)}}sv.exports=JR});var cv=f((sa,qn)=>{var QR=qu(),uv=typeof sa=="object"&&sa&&!sa.nodeType&&sa,la=uv&&typeof qn=="object"&&qn&&!qn.nodeType&&qn,XR=la&&la.exports===uv,Qu=XR&&QR.process,KR=function(){try{var e=la&&la.require&&la.require("util").types;return e||Qu&&Qu.binding&&Qu.binding("util")}catch{}}();qn.exports=KR});var Zo=f((E7,fv)=>{var YR=ov(),ZR=lv(),dv=cv(),pv=dv&&dv.isTypedArray,eT=pv?ZR(pv):YR;fv.exports=eT});var Xu=f((I7,mv)=>{var tT=W0(),rT=Hu(),nT=Tr(),iT=Ko(),aT=Yo(),oT=Zo(),sT=Object.prototype,lT=sT.hasOwnProperty;function uT(e,t){var r=nT(e),n=!r&&rT(e),i=!r&&!n&&iT(e),a=!r&&!n&&!i&&oT(e),o=r||n||i||a,s=o?tT(e.length,String):[],l=s.length;for(var u in e)(t||lT.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||aT(u,l)))&&s.push(u);return s}mv.exports=uT});var es=f((_7,hv)=>{var cT=Object.prototype;function dT(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||cT;return e===r}hv.exports=dT});var Ku=f((P7,gv)=>{function pT(e,t){return function(r){return e(t(r))}}gv.exports=pT});var bv=f((O7,vv)=>{var fT=Ku(),mT=fT(Object.keys,Object);vv.exports=mT});var Cv=f((F7,yv)=>{var hT=es(),gT=bv(),vT=Object.prototype,bT=vT.hasOwnProperty;function yT(e){if(!hT(e))return gT(e);var t=[];for(var r in Object(e))bT.call(e,r)&&r!="constructor"&&t.push(r);return t}yv.exports=yT});var ua=f((R7,Av)=>{var CT=Ho(),AT=Ju();function NT(e){return e!=null&&AT(e.length)&&!CT(e)}Av.exports=NT});var wv=f((T7,Nv)=>{var wT=Xu(),ST=Cv(),DT=ua();function ET(e){return DT(e)?wT(e):ST(e)}Nv.exports=ET});var Dv=f((x7,Sv)=>{var IT=U0(),_T=G0(),PT=wv();function OT(e){return IT(e,PT,_T)}Sv.exports=OT});var _v=f((L7,Iv)=>{var Ev=Dv(),FT=1,RT=Object.prototype,TT=RT.hasOwnProperty;function xT(e,t,r,n,i,a){var o=r&FT,s=Ev(e),l=s.length,u=Ev(t),c=u.length;if(l!=c&&!o)return!1;for(var p=l;p--;){var m=s[p];if(!(o?m in t:TT.call(t,m)))return!1}var v=a.get(e),C=a.get(t);if(v&&C)return v==t&&C==e;var w=!0;a.set(e,t),a.set(t,e);for(var P=o;++p<l;){m=s[p];var x=e[m],M=t[m];if(n)var T=o?n(M,x,m,t,e,a):n(x,M,m,e,t,a);if(!(T===void 0?x===M||i(x,M,r,n,a):T)){w=!1;break}P||(P=m=="constructor")}if(w&&!P){var L=e.constructor,Q=t.constructor;L!=Q&&"constructor"in e&&"constructor"in t&&!(typeof L=="function"&&L instanceof L&&typeof Q=="function"&&Q instanceof Q)&&(w=!1)}return a.delete(e),a.delete(t),w}Iv.exports=xT});var Ov=f((U7,Pv)=>{var LT=Rr(),UT=Pt(),MT=LT(UT,"DataView");Pv.exports=MT});var Rv=f((M7,Fv)=>{var BT=Rr(),kT=Pt(),qT=BT(kT,"Promise");Fv.exports=qT});var xv=f((B7,Tv)=>{var $T=Rr(),VT=Pt(),GT=$T(VT,"Set");Tv.exports=GT});var Uv=f((k7,Lv)=>{var zT=Rr(),WT=Pt(),jT=zT(WT,"WeakMap");Lv.exports=jT});var zv=f((q7,Gv)=>{var Yu=Ov(),Zu=Jo(),ec=Rv(),tc=xv(),rc=Uv(),Vv=en(),$n=Vu(),Mv="[object Map]",HT="[object Object]",Bv="[object Promise]",kv="[object Set]",qv="[object WeakMap]",$v="[object DataView]",JT=$n(Yu),QT=$n(Zu),XT=$n(ec),KT=$n(tc),YT=$n(rc),tn=Vv;(Yu&&tn(new Yu(new ArrayBuffer(1)))!=$v||Zu&&tn(new Zu)!=Mv||ec&&tn(ec.resolve())!=Bv||tc&&tn(new tc)!=kv||rc&&tn(new rc)!=qv)&&(tn=function(e){var t=Vv(e),r=t==HT?e.constructor:void 0,n=r?$n(r):"";if(n)switch(n){case JT:return $v;case QT:return Mv;case XT:return Bv;case KT:return kv;case YT:return qv}return t});Gv.exports=tn});var Yv=f(($7,Kv)=>{var nc=Gu(),ZT=zu(),ex=F0(),tx=_v(),Wv=zv(),jv=Tr(),Hv=Ko(),rx=Zo(),nx=1,Jv="[object Arguments]",Qv="[object Array]",ts="[object Object]",ix=Object.prototype,Xv=ix.hasOwnProperty;function ax(e,t,r,n,i,a){var o=jv(e),s=jv(t),l=o?Qv:Wv(e),u=s?Qv:Wv(t);l=l==Jv?ts:l,u=u==Jv?ts:u;var c=l==ts,p=u==ts,m=l==u;if(m&&Hv(e)){if(!Hv(t))return!1;o=!0,c=!1}if(m&&!c)return a||(a=new nc),o||rx(e)?ZT(e,t,r,n,i,a):ex(e,t,l,r,n,i,a);if(!(r&nx)){var v=c&&Xv.call(e,"__wrapped__"),C=p&&Xv.call(t,"__wrapped__");if(v||C){var w=v?e.value():e,P=C?t.value():t;return a||(a=new nc),i(w,P,r,n,a)}}return m?(a||(a=new nc),tx(e,t,r,n,i,a)):!1}Kv.exports=ax});var rb=f((V7,tb)=>{var ox=Yv(),Zv=xr();function eb(e,t,r,n,i){return e===t?!0:e==null||t==null||!Zv(e)&&!Zv(t)?e!==e&&t!==t:ox(e,t,r,n,eb,i)}tb.exports=eb});var ib=f((G7,nb)=>{var sx=rb();function lx(e,t){return sx(e,t)}nb.exports=lx});var ic=f((z7,ab)=>{var ux=Rr(),cx=function(){try{var e=ux(Object,"defineProperty");return e({},"",{}),e}catch{}}();ab.exports=cx});var rs=f((W7,sb)=>{var ob=ic();function dx(e,t,r){t=="__proto__"&&ob?ob(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}sb.exports=dx});var ac=f((j7,lb)=>{var px=rs(),fx=xn();function mx(e,t,r){(r!==void 0&&!fx(e[t],r)||r===void 0&&!(t in e))&&px(e,t,r)}lb.exports=mx});var cb=f((H7,ub)=>{function hx(e){return function(t,r,n){for(var i=-1,a=Object(t),o=n(t),s=o.length;s--;){var l=o[e?s:++i];if(r(a[l],l,a)===!1)break}return t}}ub.exports=hx});var pb=f((J7,db)=>{var gx=cb(),vx=gx();db.exports=vx});var vb=f((ca,Vn)=>{var bx=Pt(),gb=typeof ca=="object"&&ca&&!ca.nodeType&&ca,fb=gb&&typeof Vn=="object"&&Vn&&!Vn.nodeType&&Vn,yx=fb&&fb.exports===gb,mb=yx?bx.Buffer:void 0,hb=mb?mb.allocUnsafe:void 0;function Cx(e,t){if(t)return e.slice();var r=e.length,n=hb?hb(r):new e.constructor(r);return e.copy(n),n}Vn.exports=Cx});var Cb=f((Q7,yb)=>{var bb=Wu();function Ax(e){var t=new e.constructor(e.byteLength);return new bb(t).set(new bb(e)),t}yb.exports=Ax});var Nb=f((X7,Ab)=>{var Nx=Cb();function wx(e,t){var r=t?Nx(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}Ab.exports=wx});var Sb=f((K7,wb)=>{function Sx(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}wb.exports=Sx});var Ib=f((Y7,Eb)=>{var Dx=sr(),Db=Object.create,Ex=function(){function e(){}return function(t){if(!Dx(t))return{};if(Db)return Db(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();Eb.exports=Ex});var oc=f((Z7,_b)=>{var Ix=Ku(),_x=Ix(Object.getPrototypeOf,Object);_b.exports=_x});var Ob=f((eV,Pb)=>{var Px=Ib(),Ox=oc(),Fx=es();function Rx(e){return typeof e.constructor=="function"&&!Fx(e)?Px(Ox(e)):{}}Pb.exports=Rx});var Rb=f((tV,Fb)=>{var Tx=ua(),xx=xr();function Lx(e){return xx(e)&&Tx(e)}Fb.exports=Lx});var Lb=f((rV,xb)=>{var Ux=en(),Mx=oc(),Bx=xr(),kx="[object Object]",qx=Function.prototype,$x=Object.prototype,Tb=qx.toString,Vx=$x.hasOwnProperty,Gx=Tb.call(Object);function zx(e){if(!Bx(e)||Ux(e)!=kx)return!1;var t=Mx(e);if(t===null)return!0;var r=Vx.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Tb.call(r)==Gx}xb.exports=zx});var sc=f((nV,Ub)=>{function Wx(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}Ub.exports=Wx});var lc=f((iV,Mb)=>{var jx=rs(),Hx=xn(),Jx=Object.prototype,Qx=Jx.hasOwnProperty;function Xx(e,t,r){var n=e[t];(!(Qx.call(e,t)&&Hx(n,r))||r===void 0&&!(t in e))&&jx(e,t,r)}Mb.exports=Xx});var kb=f((aV,Bb)=>{var Kx=lc(),Yx=rs();function Zx(e,t,r,n){var i=!r;r||(r={});for(var a=-1,o=t.length;++a<o;){var s=t[a],l=n?n(r[s],e[s],s,r,e):void 0;l===void 0&&(l=e[s]),i?Yx(r,s,l):Kx(r,s,l)}return r}Bb.exports=Zx});var $b=f((oV,qb)=>{function eL(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}qb.exports=eL});var Gb=f((sV,Vb)=>{var tL=sr(),rL=es(),nL=$b(),iL=Object.prototype,aL=iL.hasOwnProperty;function oL(e){if(!tL(e))return nL(e);var t=rL(e),r=[];for(var n in e)n=="constructor"&&(t||!aL.call(e,n))||r.push(n);return r}Vb.exports=oL});var uc=f((lV,zb)=>{var sL=Xu(),lL=Gb(),uL=ua();function cL(e){return uL(e)?sL(e,!0):lL(e)}zb.exports=cL});var jb=f((uV,Wb)=>{var dL=kb(),pL=uc();function fL(e){return dL(e,pL(e))}Wb.exports=fL});var Yb=f((cV,Kb)=>{var Hb=ac(),mL=vb(),hL=Nb(),gL=Sb(),vL=Ob(),Jb=Hu(),Qb=Tr(),bL=Rb(),yL=Ko(),CL=Ho(),AL=sr(),NL=Lb(),wL=Zo(),Xb=sc(),SL=jb();function DL(e,t,r,n,i,a,o){var s=Xb(e,r),l=Xb(t,r),u=o.get(l);if(u){Hb(e,r,u);return}var c=a?a(s,l,r+"",e,t,o):void 0,p=c===void 0;if(p){var m=Qb(l),v=!m&&yL(l),C=!m&&!v&&wL(l);c=l,m||v||C?Qb(s)?c=s:bL(s)?c=gL(s):v?(p=!1,c=mL(l,!0)):C?(p=!1,c=hL(l,!0)):c=[]:NL(l)||Jb(l)?(c=s,Jb(s)?c=SL(s):(!AL(s)||CL(s))&&(c=vL(l))):p=!1}p&&(o.set(l,c),i(c,l,n,a,o),o.delete(l)),Hb(e,r,c)}Kb.exports=DL});var cc=f((dV,ey)=>{var EL=Gu(),IL=ac(),_L=pb(),PL=Yb(),OL=sr(),FL=uc(),RL=sc();function Zb(e,t,r,n,i){e!==t&&_L(t,function(a,o){if(i||(i=new EL),OL(a))PL(e,t,o,r,Zb,n,i);else{var s=n?n(RL(e,o),a,o+"",e,t,i):void 0;s===void 0&&(s=a),IL(e,o,s)}},FL)}ey.exports=Zb});var dc=f((pV,ty)=>{function TL(e){return e}ty.exports=TL});var ny=f((fV,ry)=>{function xL(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}ry.exports=xL});var oy=f((mV,ay)=>{var LL=ny(),iy=Math.max;function UL(e,t,r){return t=iy(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=iy(n.length-t,0),o=Array(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(o),LL(e,this,s)}}ay.exports=UL});var ly=f((hV,sy)=>{function ML(e){return function(){return e}}sy.exports=ML});var dy=f((gV,cy)=>{var BL=ly(),uy=ic(),kL=dc(),qL=uy?function(e,t){return uy(e,"toString",{configurable:!0,enumerable:!1,value:BL(t),writable:!0})}:kL;cy.exports=qL});var fy=f((vV,py)=>{var $L=800,VL=16,GL=Date.now;function zL(e){var t=0,r=0;return function(){var n=GL(),i=VL-(n-r);if(r=n,i>0){if(++t>=$L)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}py.exports=zL});var hy=f((bV,my)=>{var WL=dy(),jL=fy(),HL=jL(WL);my.exports=HL});var vy=f((yV,gy)=>{var JL=dc(),QL=oy(),XL=hy();function KL(e,t){return XL(QL(e,t,JL),e+"")}gy.exports=KL});var yy=f((CV,by)=>{var YL=xn(),ZL=ua(),eU=Yo(),tU=sr();function rU(e,t,r){if(!tU(r))return!1;var n=typeof t;return(n=="number"?ZL(r)&&eU(t,r.length):n=="string"&&t in r)?YL(r[t],e):!1}by.exports=rU});var pc=f((AV,Cy)=>{var nU=vy(),iU=yy();function aU(e){return nU(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,o&&iU(r[0],r[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,a)}return t})}Cy.exports=aU});var Ny=f((NV,Ay)=>{var oU=cc(),sU=pc(),lU=sU(function(e,t,r,n){oU(e,t,r,n)});Ay.exports=lU});var gt,da=S(()=>{"use strict";(function(e){e[e.NotLoaded=0]="NotLoaded",e[e.Initialized=1]="Initialized",e[e.ConfigsLoaded=2]="ConfigsLoaded",e[e.Error=3]="Error"})(gt||(gt={}))});function Sy(e,t,r="PROD"){let n=i=>`ShellSettings_ECS_ClientCache_${e}_${wy.EcsConfigType[i]}_${r}`;return{getData:i=>{let a=t.getItem(n(i));return Promise.resolve(a?JSON.parse(a):void 0)},putData:(i,a)=>(t.setItem(n(i),JSON.stringify(a)),Promise.resolve())}}var wy,uU,Dy=S(()=>{"use strict";wy=ne(ku()),uU=ne(Bu());});var fc,Ey=S(()=>{"use strict";xo();fc=ji({packageName:"shell-settings",settings:{prodEcsEndpoint:{description:"The url for the PROD ECS endpoint",values:{default:"https://ecs.office.com",dod:"https://config.ecs.dod.teams.microsoft.us",high:"https://config.ecs.gov.teams.microsoft.us",ex:"https://config.ecs.teams.eaglex.ic.gov",rx:"https://config.ecs.teams.microsoft.scloud"}},integrationEcsEndpoint:{description:"The url for the INT ECS endpoint",values:{default:"https://config.edge.skype.net"}}}})});var _y,Py,Oy,Fy,mc,cU,ns,Iy,hc=S(()=>{"use strict";_y=ne(Bu()),Py=ne(Mh()),Oy=ne(ku()),Fy=ne(ib()),mc=ne(Ny());da();Dy();Ey();cU=60*1e3,ns=class{clientName;logger;ecsEndpoint;resolveLoadingPromise;loadingPromise=new Promise(t=>this.resolveLoadingPromise=t);_status=gt.NotLoaded;endpointType;clientConfigOverride;get status(){return this._status}constructor(t,r,n="PROD"){this.clientName=t,this.logger=r,this.endpointType=n,this.ecsEndpoint=n==="PROD"?fc.prodEcsEndpoint:fc.integrationEcsEndpoint}client=new Py.default;init=async({clientVersion:t,getFilters:r,cacheStorage:n=_y.StorageHelper.transientWithGlobalFallback,updateIntervalInMinutes:i,overrideEcsInitParams:a})=>{this.client.telemetryEventAdded.subscribe(this.logger.logEvent),this.client.configUpdated.subscribe(this.handleConfigUpdated);let o=async()=>{let s=await r();return this.logEvent("FeaturesClient/configRequested",{ecsClientName:this.clientName,filters:s}),s};try{await this.client.initialize({clientName:this.clientName,clientVersion:t??"1.0.0.0",configsToFetch:[Oy.EcsConfigType.Default],hosts:[this.ecsEndpoint],initialAppActiveState:!0,getEcsParameters:o,databaseInterface:Sy(this.clientName,n,this.endpointType),...a}),this.client.requestUpdate(),this._status===gt.NotLoaded&&(this._status=gt.Initialized)}catch(s){this._status=gt.Error,this.resolveLoadingPromise(),this.logEvent("FeaturesClient/initializationFailed",{ecsClientName:this.clientName,error:s},"Error")}i&&window.setInterval(()=>this.client.requestUpdate(),i*cU)};getConfig=t=>{let r=this.getMergedClientConfigByTeamName(t.teamName),n=r?t.extractConfig(r):{};return(0,mc.default)({},t.fallback,n,t.override,Iy)};getAllConfigs=()=>this.getMergedClientConfig();getAllConfigsByTeamName=t=>this.getMergedClientConfigByTeamName(t);requestConfigUpdate=()=>{this.client.requestUpdate()};subscribe=(t,r)=>{let n=this.getConfig(t),i=this.client.configUpdated.subscribe(()=>{let a=this.getConfig(t);(0,Fy.default)(a,n)||(n={...a},r(a))});return{unsubscribe:()=>i.unsubscribe()}};waitUntilLoaded=async t=>{if(t!==void 0){let r,n=new Promise((i,a)=>{r=window.setTimeout(()=>{a(new Error("Timed out waiting for configuration to load"))},t)});await Promise.race([this.loadingPromise,n]),clearTimeout(r)}else await this.loadingPromise};overrideClientConfig(t){this.logger.logEvent("FeaturesClient/overrideClientConfig",{clientConfigOverride:t}),this.clientConfigOverride=t}undoClientConfigOverride(){this.clientConfigOverride=void 0,this.logger.logEvent("FeaturesClient/undoClientConfigOverride")}getMergedClientConfig=()=>(0,mc.default)({},this.client.getConfig()?.config,this.clientConfigOverride,Iy);getMergedClientConfigByTeamName=t=>this.getMergedClientConfig()?.[t];handleConfigUpdated=()=>{let t=this.client.getConfig();if(t===void 0)return;this.resolveLoadingPromise(),this._status=gt.ConfigsLoaded;let{ConfigIDs:r,Headers:n}=t.config;this.logEvent("FeaturesClient/configUpdated",{ecsClientName:this.clientName,configIDs:r,ETag:n?.ETag})};logEvent=(t,r)=>{this.logger.logEvent(t,{ecsClientName:this.clientName,ecsEndpointType:this.endpointType,...r})}},Iy=(e,t)=>{if(Array.isArray(t))return t}});var Ty=f((FV,Ry)=>{"use strict";var dU=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};Ry.exports=dU});var gc=f((RV,Ly)=>{var pa=new Proxy(function(){return pa},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:pa},apply:function(){return pa},construct:function(){return{}}}),xy=function(){return pa};Object.setPrototypeOf(xy,pa);Ly.exports=xy});var By=f((TV,My)=>{var fa=new Proxy(function(){return fa},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:fa},apply:function(){return fa},construct:function(){return{}}}),Uy=function(){return fa};Object.setPrototypeOf(Uy,fa);My.exports=Uy});var Wy=f((xV,zy)=>{"use strict";var vc=By(),pU={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},fU={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},mU={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Vy={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},bc={};bc[vc.ForwardRef]=mU;bc[vc.Memo]=Vy;function ky(e){return vc.isMemo(e)?Vy:bc[e.$$typeof]||pU}var hU=Object.defineProperty,gU=Object.getOwnPropertyNames,qy=Object.getOwnPropertySymbols,vU=Object.getOwnPropertyDescriptor,bU=Object.getPrototypeOf,$y=Object.prototype;function Gy(e,t,r){if(typeof t!="string"){if($y){var n=bU(t);n&&n!==$y&&Gy(e,n,r)}var i=gU(t);qy&&(i=i.concat(qy(t)));for(var a=ky(e),o=ky(t),s=0;s<i.length;++s){var l=i[s];if(!fU[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var u=vU(t,l);try{hU(e,l,u)}catch{}}}}return e}zy.exports=Gy});function Hy(e,t,r){let[n,i]=(0,Gn.useState)(e.getConfig(t));return(0,Gn.useEffect)(()=>{if(!r?.subscribe&&e.status===gt.ConfigsLoaded)return;let a=e.subscribe(t,o=>{i(o),r?.subscribe||a.unsubscribe()});return a?.unsubscribe},[]),n}function Jy(e){return function(t,r){return Hy(e,t,r)}}function Qy(e,t,r,n){let i=a=>{let o=Hy(e,t,n),s={...a,...o};return Gn.default.createElement(r,{...s})};return(0,jy.default)(i,r),i.displayName=`WithFeature(${r.name})`,i}function Xy(e,t,r,n){return t.reduce((i,a)=>Qy(e,a,i,n),r)}function Ky(e){return function(t,r,n){return Qy(e,t,r,n)}}var jy,Gn,yc=S(()=>{"use strict";jy=ne(Wy()),Gn=ne(gc());da();});var Zy=f((MV,Yy)=>{var yU=cc(),CU=pc(),AU=CU(function(e,t,r){yU(e,t,r)});Yy.exports=AU});var is=f((BV,eC)=>{var NU=en(),wU=xr(),SU="[object Symbol]";function DU(e){return typeof e=="symbol"||wU(e)&&NU(e)==SU}eC.exports=DU});var rC=f((kV,tC)=>{var EU=Tr(),IU=is(),_U=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,PU=/^\w*$/;function OU(e,t){if(EU(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||IU(e)?!0:PU.test(e)||!_U.test(e)||t!=null&&e in Object(t)}tC.exports=OU});var aC=f((qV,iC)=>{var nC=Qo(),FU="Expected a function";function Cc(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(FU);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Cc.Cache||nC),r}Cc.Cache=nC;iC.exports=Cc});var sC=f(($V,oC)=>{var RU=aC(),TU=500;function xU(e){var t=RU(e,function(n){return r.size===TU&&r.clear(),n}),r=t.cache;return t}oC.exports=xU});var uC=f((VV,lC)=>{var LU=sC(),UU=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,MU=/\\(\\)?/g,BU=LU(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(UU,function(r,n,i,a){t.push(i?a.replace(MU,"$1"):n||r)}),t});lC.exports=BU});var dC=f((GV,cC)=>{function kU(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}cC.exports=kU});var vC=f((zV,gC)=>{var pC=ra(),qU=dC(),$U=Tr(),VU=is(),GU=1/0,fC=pC?pC.prototype:void 0,mC=fC?fC.toString:void 0;function hC(e){if(typeof e=="string")return e;if($U(e))return qU(e,hC)+"";if(VU(e))return mC?mC.call(e):"";var t=e+"";return t=="0"&&1/e==-GU?"-0":t}gC.exports=hC});var yC=f((WV,bC)=>{var zU=vC();function WU(e){return e==null?"":zU(e)}bC.exports=WU});var AC=f((jV,CC)=>{var jU=Tr(),HU=rC(),JU=uC(),QU=yC();function XU(e,t){return jU(e)?e:HU(e,t)?[e]:JU(QU(e))}CC.exports=XU});var wC=f((HV,NC)=>{var KU=is(),YU=1/0;function ZU(e){if(typeof e=="string"||KU(e))return e;var t=e+"";return t=="0"&&1/e==-YU?"-0":t}NC.exports=ZU});var EC=f((JV,DC)=>{var eM=lc(),tM=AC(),rM=Yo(),SC=sr(),nM=wC();function iM(e,t,r,n){if(!SC(e))return e;t=tM(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=nM(t[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=o){var c=s[l];u=n?n(c,l,s):void 0,u===void 0&&(u=SC(c)?c:rM(t[i+1])?[]:{})}eM(s,l,u),s=s[l]}return e}DC.exports=iM});var _C=f((QV,IC)=>{var aM=EC();function oM(e,t,r){return e==null?e:aM(e,t,r)}IC.exports=oM});function RC(e){let{query:t}=(0,FC.default)(window.location.href,!0);return lM(e,t),e}function lM(e,t){let r=sM+e.clientName,n=Object.keys(t).filter(a=>a.startsWith(r));if(!n)return;let i={};n.forEach(a=>{let o=t[a];if(o)try{let s=JSON.parse(o),l=r+TC,u={};if(a===r)u=s;else if(a.startsWith(l)){let c=a.substring(l.length);(0,OC.default)(u,c,s)}(0,PC.default)(i,u)}catch{}}),Object.keys(i).length>0&&e.overrideClientConfig(i)}var PC,OC,FC,TC,sM,xC=S(()=>{"use strict";PC=ne(Zy()),OC=ne(_C()),FC=ne(Du());TC=".",sM="ecs"+TC});function os(e,t,r){let n=RC(new ns(e,t,r));function i(a){(0,as.useEffect)(()=>{n.init(a)},[])}return{featuresClient:n,createFeature:cM(n),useFeaturesClientInitParams:i,withFeatures:(a,o,s)=>Xy(n,a,o,s)}}function cM(e){let t=Jy(e),r=Ky(e);return function(i){let a=Rh(i);return a.getConfig=()=>e.getConfig(a),a.isLoaded=()=>e.status===gt.ConfigsLoaded,_u.register(a,e.clientName),{useFeature:o=>t(a,o),withFeature:(o,s)=>r(a,o,s),feature:a}}}var uM,as,Ac=S(()=>{"use strict";uM=ne(Ty()),as=ne(gc());Mu();hc();da();yc();xC();Pu();});var LC=S(()=>{"use strict";Mu();hc();Ac();da();yc();Bo();Ou();});function ss(e){return{logEvent:(t,r,n)=>{switch(n){case"Error":(0,zn.trackErrorTrace)(e,{eventName:t,eventData:r});break;case"Warning":(0,zn.trackWarningTrace)(e,{eventName:t,eventData:r});break;default:(0,zn.trackInfoTrace)(e,{eventName:t,eventData:r});break}}}}var zn,Nc=S(()=>{"use strict";zn=ne(Jr());});var hG,gG,vG,UC=S(()=>{"use strict";LC();Nc();({featuresClient:hG,createFeature:gG,useFeaturesClientInitParams:vG}=os("PowerApps-Shell-Test",ss("shell-features")))});var kC=f((yG,BC)=>{var ma=new Proxy(function(){return ma},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:ma},apply:function(){return ma},construct:function(){return{}}}),MC=function(){return ma};Object.setPrototypeOf(MC,ma);BC.exports=MC});var dM,pM,qC=S(()=>{"use strict";Gi();dM=ne(kC()),pM=ne(Jr());});var $C=S(()=>{"use strict";UC();Nc();qC();});var _G,Wn,PG,VC=S(()=>{"use strict";$C();Ac();({featuresClient:_G,createFeature:Wn,useFeaturesClientInitParams:PG}=os("PowerApps-MakerPortal",ss("powerapps-features")))});var GC,zC,TG,xG,LG,UG,wc=S(()=>{"use strict";Fh();VC();({feature:GC}=Wn({teamName:"MakerPortal",owners:["debeshd"],description:"Enable the auto insertion of cell in a row when a section is initialized",createdOn:"09/01/2023",fallback:{enableAutoInsertionOfCellInRow:Tn.enableAutoInsertionOfCellInRow}})),{feature:zC}=Wn({teamName:"MakerPortal",owners:["aansu"],description:"Enable the one grid events for form designer",createdOn:"08/21/2024",fallback:{enableOneGridEventsForFormDesigner:Tn.enableOneGridEvents}}),{feature:TG}=Wn({teamName:"MakerPortal",owners:["adekulkarni"],description:"Disables PBI components and cleans them up from the form",createdOn:"01/03/2023",fallback:{enableFallbackFormTemplate:Tn.disablePBIComponents}}),{feature:xG}=Wn({teamName:"MakerPortal",owners:["jennietu"],description:"Enables agent response in form designer. This feature is used to enable the agent response in form designer",createdOn:"04/24/2025",fallback:{enableAgentResponse:Tn.enableAgentResponse}}),{feature:LG,useFeature:UG}=Wn({teamName:"MakerPortal",owners:["aansu"],description:"Enables delayed localization of custom control",createdOn:"06/08/2025",fallback:{enableDelayedLocalizationForCustomControls:Tn.enableDelayedLocalizationForCustomControls}})});var HC=f((BG,jC)=>{var ha=new Proxy(function(){return ha},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:ha},apply:function(){return ha},construct:function(){return{}}}),WC=function(){return ha};Object.setPrototypeOf(WC,ha);jC.exports=WC});var Ge,Lr=S(()=>{"use strict";Ae();be();Ve();Wo();G();Oe();Ge=class extends q{static HighestUsedIndexByClass=new Map;get colspan(){let t=this.getProperty(d.colspan);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set colspan(t){N.IsNullOrUndefined(t)||this.setProperty(d.colspan,String(t))}constructor(t,r){super(t,r)}get id(){let t=this.getProperty(d.id);return t==null?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new E(t.substr(1,t.length-2)):new E(t)}set id(t){this.setProperty(d.id,`{${t.ToString()}}`)}set labelId(t){this.setProperty(d.labelId,`{${t.ToString()}}`)}get labelId(){let t=this.getProperty(d.labelId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new E(t.substr(1,t.length-2)):new E(t)}get Name(){return this.getProperty(d.Name)}set Name(t){this.setProperty(d.Name,t)}setDisplayName(t,r){for(let i of this.getAllLabels())if(+i.getProperty(d.languagecode)===r){i.setProperty(d.description,t);return}let n=new q(h.formLabel,null);n.setProperty(d.description,t),n.setProperty(d.languagecode,String(r)),this.addGrandChild("labels",n)}getDisplayName(t){for(let r of this.getAllLabels())if(+r.getProperty(d.languagecode)===t)return r.getProperty(d.description)}getAllLabels(){let t=this.getChildren("labels");return t.length!==1?[]:t[0].getChildren("label")}get isLocked(){return+this.getProperty(d.locklevel)==1}set isLocked(t){!this.IsUnboundControl&&this.setProperty(d.locklevel,t?"1":"0")}get availableforphone(){return this.getProcessedValue(d.availableforphone)}set availableforphone(t){N.IsNullOrUndefined(t)||!this.IsAllowedUBCForAvailableOnPhone()||this.setProperty(d.availableforphone,String(t))}get visible(){return this.getProcessedValue(d.visible)}set visible(t){N.IsNullOrUndefined(t)||!this.IsAllowedUBCForVisibleByDefault()||this.setProperty(d.visible,String(t))}isLockLevelSettable(){return!this.IsUnboundControl}get showlabel(){return this.getProcessedValue(d.showlabel)}set showlabel(t){N.IsNullOrUndefined(t)||this.setProperty(d.showlabel,String(t))}isAvailableForPhoneSettable(){return this.IsAllowedUBCForAvailableOnPhone()}isVisibleSettable(){return this.IsAllowedUBCForVisibleByDefault()}getProcessedValue(t){let r=this.getProperty(t);return N.IsNullOrUndefined(r)||this.getProperty(t)==="true"}get readonly(){let t=this.getFirstChild(h.formControl);return t?t.disabled:!1}set readonly(t){let r=this.getFirstChild(h.formControl);r&&(r.disabled=t)}get allowfilteroff(){let t=this.getFirstChild(h.formControl);if(t)return t.getParam(d.AllowFilterOff)==="true"}set allowfilteroff(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(d.AllowFilterOff,t)}get autoresolve(){let t=this.getFirstChild(h.formControl);if(t)return t.getParam(d.AutoResolve)==="true"}set autoresolve(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(d.AutoResolve,t)}get defaultviewid(){let t=this.getFirstChild(h.formControl);return t?t.getParam(d.DefaultViewId):I.EmptyString}set defaultviewid(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(d.DefaultViewId,t)}get dependentattributename(){let t=this.getFirstChild(h.formControl);return t?t.getParam(d.DependentAttributeName):I.EmptyString}set dependentattributename(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(d.DependentAttributeName,t)}get dependentattributetype(){let t=this.getFirstChild(h.formControl);return t?t.getParam(d.DependentAttributeType):I.EmptyString}set dependentattributetype(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(d.DependentAttributeType,t)}get disablequickfind(){let t=this.getFirstChild(h.formControl);if(t)return t.getParam(d.DisableQuickFind)==="true"}set disablequickfind(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(d.DisableQuickFind,t)}get disableviewpicker(){let t=this.getFirstChild(h.formControl);if(t)return t.getParam(d.DisableViewPicker)==="true"}set disableviewpicker(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(d.DisableViewPicker,t)}get filterrelationshipname(){let t=this.getFirstChild(h.formControl);return t?t.getParam(d.FilterRelationshipName):I.EmptyString}set filterrelationshipname(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(d.FilterRelationshipName,t)}get availableviewids(){let t=this.getFirstChild(h.formControl);return t?t.getParam(d.AvailableViewIds):I.EmptyString}set availableviewids(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(d.AvailableViewIds,t)}get IsUnboundControl(){let t=this.getFirstChild(h.formControl);if(t&&t.ClassId){let r=we.getUniqueIdentifierForControl(t);return!N.IsNullOrUndefined(r)&&we.isUnboundFormControlByIdentifier(r)}else return!1}IsAllowedUBCForAvailableOnPhone(){let t=this.getFirstChild(h.formControl);if(t){let n=we.getUniqueIdentifierForControl(t).guidString,i=n===O.GridControl||n===O.TimeLineControl||n===O.TimeLineControlUC;return this.IsUnboundControl?i:!0}return this.NodeName===h.formSection||this.NodeName===h.formTab}IsAllowedUBCForVisibleByDefault(){let t=this.getFirstChild(h.formControl);if(t){let n=we.getUniqueIdentifierForControl(t).guidString,i=n===O.MapsControl||n===O.WebResourceHtmlControl||n===O.WebResourceImageControl||n===O.IframeControl||n===O.SocialInsightControl;return this.IsUnboundControl?i:!0}else return!0}get events(){let t=this.getChildren(h.formEvents);return t.length===1?t[0].getAllChildren():[]}addEvent(t){this.addGrandChild(h.formEvents,t)}getUsedNodeNameSet(t){return null}getHighestIndexById(t,r){return null}}});var jn,Sc=S(()=>{"use strict";Ve();G();Oe();jn=class extends q{constructor(t,r){super(h.dependency,t),I.IsNullOrEmpty(r)||this.setDefaultProperties(r)}set id(t){this.setProperty(d.id,t)}get id(){return this.getProperty(d.id)}setDefaultProperties(t){this.id=t}}});var JC,Hn,Dc=S(()=>{"use strict";be();Sc();G();Oe();Lr();(function(e){e[e.Form=0]="Form",e[e.Cell=1]="Cell",e[e.Tab=2]="Tab",e[e.Control=3]="Control"})(JC||(JC={}));Hn=class extends Ge{constructor(t,r){super(h.formEvent,t),r&&(this.eventName=r,this.application="false",this.active="false")}set eventName(t){this.setProperty(d.Name,t)}get eventName(){return this.getProperty(d.Name)}set application(t){this.setProperty(d.application,t)}get application(){return this.getProperty(d.application)}set attribute(t){this.setProperty(d.EventAttribute,t)}get attribute(){return this.getProperty(d.EventAttribute)}set relationship(t){this.setProperty(d.Relationship,t)}get relationship(){return this.getProperty(d.Relationship)}set control(t){this.setProperty(d.Control,t)}get control(){return this.getProperty(d.Control)}set active(t){this.setProperty(d.EventActive,t)}get active(){return this.getProperty(d.EventActive)}getAllHandlers(){let t=this.getChildren(h.EventHandlers);return t&&t.length?t[0].getChildren(h.handler):[]}getAllDependencies(){let t=this.getChildren(h.formDependencies);return t.length===0?[]:t[0].getAllChildren()}setDependencies(t){let r=this.getFirstChild(h.formDependencies);if(N.IsNullOrUndefined(r)){if(t.length===0)return;this.addChild(new q(h.formDependencies,this)),r=this.getFirstChild(h.formDependencies)}if(t.length===0)r.getParentNode().deleteChild(r);else{r.deleteAllChildren();for(let n of t)r.addChild(new jn(r,n.toString()))}}}});var Ot,ga=S(()=>{"use strict";Ae();Vi();be();Hr();G();Oe();It();Ot=class extends q{previewVersion;constructor(t){super(h.formControl,t)}updatePreview(){this.previewVersion=Date.now()}get ClassId(){let t=this.getProperty(d.classid);return t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new E(t)}set ClassId(t){this.setProperty(d.classid,`{${t.ToString()}}`)}get dataFieldName(){return this.getProperty(d.datafieldname)}set dataFieldName(t){this.setProperty(d.datafieldname,t)}set id(t){this.setProperty(d.id,t)}get id(){return this.getProperty(d.id)}get UniqueId(){let t=this.getProperty(d.uniqueid);return N.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new E(t))}set UniqueId(t){this.setProperty(d.uniqueid,`{${t.ToString()}}`)}get isRequired(){return this.getProperty(d.isRequired)==="true"}set isRequired(t){N.IsNullOrUndefined(t)||this.setProperty(d.isRequired,String(t))}get disableMru(){return this.getParam(d.DisableMru)==="true"}set disableMru(t){N.IsNullOrUndefined(t)||this.setParameter(d.DisableMru,t)}get useMFDForCreate(){return this.getParam(d.UseMFDForCreate)==="true"}set useMFDForCreate(t){N.IsNullOrUndefined(t)||this.setParameter(d.UseMFDForCreate,t)}get useMFDForEdit(){return this.getParam(d.UseMFDForEdit)==="true"}set useMFDForEdit(t){N.IsNullOrUndefined(t)||this.setParameter(d.UseMFDForEdit,t)}get disabled(){return this.getProperty(d.disabled)==="true"}set disabled(t){N.IsNullOrUndefined(t)||this.setProperty(d.disabled,String(t))}get indicationOfSubgrid(){return this.getProperty(d.indicationOfSubgrid)==="true"}set indicationOfSubgrid(t){this.setProperty(d.indicationOfSubgrid,String(t))}getAllParameters(){let t=new Qe,r=this.getFirstChild(d.parameters);return r&&r.getAllChildren().forEach(n=>{if(n){let i=n.getAllChildren(),a=i&&i.length>0&&i[0];a&&t.add(n.getNodeName(),a.getNodeName())}}),t}setParameter(t,r){let n=!1;r===null&&(n=!0);let i=(or.StartTag+r).toString(),a=this.parametersNode;if(a){let o=a.findFirst(s=>s&&s.getNodeName()===t);if(o)if(n){this.deleteFirstGrandChildOfName(h.controlParameters,o);return}else{let s=o.getAllChildren();s&&s.length>0&&s[0]?s[0].setNodeName(i):o.addChild(new q(i,o))}else n||(o=new q(t,a),o.addChild(new q(i,o)),a.addChild(o))}else if(!n){a=new q("parameters",this);let o=new q(t,a);o.addChild(new q(i,o)),a.addChild(o),this.addChild(a)}}getParam(t){if(this.parametersNode){let r=this.parametersNode.findFirst(n=>n&&n.getNodeName()===t);if(r){let n=r.getAllChildren(),i=n&&n.length>0&&n[0];if(i){let a=i.getNodeName();return a.charAt(0)===or.StartTag?a.substring(1):a}}}return null}get parametersNode(){let t=this.getChildren(d.parameters);return t.length===0?null:t[0]}async serializeParameters(t,r){let n=new Qe;switch(this.ClassId.guidString.toUpperCase()){case A.LookupControl:if(t&&t.getKeys())if(t.getKeys().forEach(o=>{n.add(o,this.getParam(o))}),t&&t.containsKey("DefaultViewId")){let o=this.getParam("DefaultViewId").replace("{","").replace("}","");n.upsert("DefaultViewId",o)}else{let o=this.getParent(),s=await r.formModelService.lookupControlService.populateDefaultView(this,o.getParentForm().entityName);s&&s.id&&n.upsert("DefaultViewId",s.id.replace("{","").replace("}",""))}break;default:t&&t.getKeys()&&t.getKeys().forEach(o=>{n.add(o,this.getParam(o))});break}let i=n.getInternalObject(),a=[];for(let o in i)i.hasOwnProperty(o)&&a.push({Name:o,Value:i[o]});return a}getIsUnbound(){return this.getProperty(d.isUnbound)==="true"}getAttributeTypeFromClassId(t){if(t)switch(t.toUpperCase()){case A.BooleanControl:case A.CheckboxControl:return 0;case A.DateTimeControl:return 2;case A.DecimalControl:return 3;case A.FloatingNumberControl:return 4;case A.IntegerControl:case A.DurationControl:case A.LanguageControl:case A.TimezoneControl:return 5;case A.LookupControl:return 6;case A.CurrencyControl:return 8;case A.PartyListControl:return 10;case A.ChoiceControl:case A.RelationshipRoleChoiceControl:return 11;case A.ChoiceStatusControl:return 13;case A.TextAreaControl:case A.TextboxControl:case A.LabelControl:case A.EmailAddressControl:case A.UrlControl:case A.TickerControl:case A.ButtonControl:case A.PhoneNumberControl:return 14;case A.ChoicesControl:return 24;default:return}return 14}async toJSON(t){let r=this.getParent(),n=t&&t.formModelService&&t.formModelService.getFormType()===Ne.QuickViewForm?!0:this.disabled,i=await this.serializeParameters(this.getAllParameters(),t);return{ClassId:this.ClassId&&this.ClassId.guidString,Parameters:i,Disabled:n,ControlLayout:0,RequiredLevel:0,Type:this.getAttributeTypeFromClassId(this.ClassId.guidString),IsUnbound:this.getIsUnbound(),IsRequired:this.isRequired,DataFieldName:this.dataFieldName,UniqueId:this.UniqueId&&this.UniqueId.guidString,Id:this.previewVersion?this.id+this.previewVersion:this.id,Label:r.getDisplayName(t.langCode),LabelId:r.labelId&&r.labelId.guidString,Name:null,ShowLabel:r.showlabel,PreviewId:r&&r.id.guidString,Visible:r.visible||t.formModelService.showHiddenElements}}}});var Jn,Ec=S(()=>{"use strict";Ve();In();ga();G();Oe();Jn=class extends Ot{constructor(t){super(t)}get targetEntityType(){return this.getParam(d.targetEntityType)||I.EmptyString}set targetEntityType(t){this.setParameter(d.targetEntityType,t)}get viewId(){return I.StripBraces(this.getParam(d.viewId))||I.EmptyString}set viewId(t){this.setParameter(d.viewId,I.AddBraces(t))}get viewIds(){return this.getParam(d.viewIds)||I.EmptyString}set viewIds(t){this.setParameter(d.viewIds,t)}get relationshipName(){return this.getParam(d.RelationshipName)||I.EmptyString}set relationshipName(t){this.setParameter(d.RelationshipName,t)}get isUserView(){return I.IsStrictTrue(this.getParam(d.isUserView))}set isUserView(t){this.setParameter(d.isUserView,t.toString())}get enableViewPicker(){return I.IsStrictTrue(this.getParam(d.enableViewPicker))}set enableViewPicker(t){this.setParameter(d.enableViewPicker,t)}get autoExpand(){return this.getParent().autoexpand&&this.getParam(d.autoExpand)===d.Auto}set autoExpand(t){let r=this.getParent();this.setParameter(d.autoExpand,t?d.Auto:d.Fixed),r.autoexpand=t}get recordsPerPage(){return this.getParam(d.recordsPerPage)?Number(this.getParam(d.recordsPerPage)):Number(d.RecordsPerPageRAControlDefault)}set recordsPerPage(t){this.setParameter(d.recordsPerPage,String(t))}get enableQuickFind(){return I.IsStrictTrue(this.getParam(d.enableQuickFind))}set enableQuickFind(t){this.setParameter(d.enableQuickFind,t)}get teamTemplateId(){return I.StripBraces(this.getParam(d.teamTemplateId))||I.EmptyString}set teamTemplateId(t){this.setParameter(d.teamTemplateId,I.AddBraces(t))}get chartId(){return this.getParam(d.visualizationId)||I.EmptyString}set chartId(t){this.setParameter(d.visualizationId,t)}get enableChartPicker(){return I.IsStrictTrue(this.getParam(d.enableChartPicker))}set enableChartPicker(t){this.setParameter(d.enableChartPicker,t)}get chartGridMode(){switch(this.getParam(d.chartGridMode)){case ht.Chart:return ht.Chart;case ht.Grid:return ht.Grid;default:return ht.All}}set chartGridMode(t){this.setParameter(d.chartGridMode,t)}updateChartGridMode(t){t?this.chartGridMode=ht.Chart:this.chartGridMode=this.enableChartPicker?ht.All:ht.Grid}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case d.targetEntityType:n.getAllChildren()[0].setNodeName("<"+r.targetEntityType);break;case d.viewId:n.getAllChildren()[0].setNodeName("<"+I.AddBraces(r.viewId));break;case d.isUserView:n.getAllChildren()[0].setNodeName("<"+r.isUserView);break;case d.enableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.enableViewPicker);break;case d.RelationshipName:let i=n.getAllChildren(),a="<"+r.relationshipName;i.length?n.getAllChildren()[0].setNodeName(a):n.addChild(new q(a,n));break;default:break}}updateControlDescription(t){let r=t.getControlDescriptionByForControl(this.UniqueId);if(r){let n=r.customControls;for(let i=0;i<n.length;i++){let a=n[i].getParameters().get(Xe.dataset)?n[i].getParameters().get(Xe.dataset)[0]:null;if(a){let o=a.getAllChildren();this.updateDefaultProperties(o,this)}else{let o=n[i].getAllChildren()[0].getAllChildren();this.updateDefaultProperties(o,this)}}}}}});var Qn,Ic=S(()=>{"use strict";Ve();In();ga();G();Qn=class extends Ot{constructor(t){super(t)}get defaultViewId(){return I.StripBraces(this.getParam(d.DefaultViewId))||I.EmptyString}set defaultViewId(t){this.setParameter(d.DefaultViewId,I.AddBraces(t))}get autoResolve(){return I.IsStrictTrue(this.getParam(d.AutoResolve))}set autoResolve(t){this.setParameter(d.AutoResolve,t)}get disableQuickFind(){return I.IsStrictTrue(this.getParam(d.DisableQuickFind))}set disableQuickFind(t){this.setParameter(d.DisableQuickFind,t)}get disableViewPicker(){return I.IsStrictTrue(this.getParam(d.DisableViewPicker))}set disableViewPicker(t){this.setParameter(d.DisableViewPicker,t)}get allowFilterOff(){return I.IsStrictTrue(this.getParam(d.AllowFilterOff))}set allowFilterOff(t){this.setParameter(d.AllowFilterOff,t)}get disableMru(){return I.IsStrictTrue(this.getParam(d.DisableMru))}set disableMru(t){this.setParameter(d.DisableMru,t)}get dependentAttributeName(){return this.getParam(d.DependentAttributeName)||I.EmptyString}set dependentAttributeName(t){this.setParameter(d.DependentAttributeName,t)}get dependentAttributeType(){return this.getParam(d.DependentAttributeType)||I.EmptyString}set dependentAttributeType(t){this.setParameter(d.DependentAttributeType,t)}get filterRelationshipName(){return this.getParam(d.FilterRelationshipName)||I.EmptyString}set filterRelationshipName(t){this.setParameter(d.FilterRelationshipName,t)}get availableViewIds(){return this.getParam(d.AvailableViewIds)||I.EmptyString}set availableViewIds(t){this.setParameter(d.AvailableViewIds,t)}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case d.datafieldname:case d.bindAttribute:n.getAllChildren()[0].setNodeName("<"+r.dataFieldName);break;case d.DefaultViewId:n.getAllChildren()[0].setNodeName("<"+I.AddBraces(r.defaultViewId));break;case d.AllowFilterOff:n.getAllChildren()[0].setNodeName("<"+r.allowFilterOff);break;case d.DisableQuickFind:n.getAllChildren()[0].setNodeName("<"+r.disableQuickFind);break;case d.DisableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.disableViewPicker);break;case d.FilterRelationshipName:n.getAllChildren()[0].setNodeName("<"+r.filterRelationshipName);break;case d.DependentAttributeName:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeName);break;case d.DependentAttributeType:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeType);break;case d.AvailableViewIds:n.getAllChildren()[0].setNodeName("<"+r.availableViewIds);break;case d.DisableMru:n.getAllChildren()[0].setNodeName("<"+r.disableMru);break;case d.AutoResolve:n.getAllChildren()[0].setNodeName("<"+r.autoResolve);break;default:break}}updateControlDescription(t){let r=t.getControlDescriptionByForControl(this.UniqueId);if(r){let n=r.customControls;for(let i=0;i<n.length;i++){let a=n[i].getParameters().get(Xe.value)?n[i].getParameters().get(Xe.value)[0]:null;if(a){let o=a.getAllChildren();this.updateDefaultProperties(o,this)}else{let o=n[i].getAllChildren()[0].getAllChildren();this.updateDefaultProperties(o,this)}}}}}});var QC,_c,et,va=S(()=>{"use strict";QC=ne(HC());Lr();G();be();Ae();Dc();ga();Wo();Lu();fu();It();Hr();Sn();Ec();Ic();Pc();Ji();_c="_",et=class e extends Ge{fieldPlaceholder;fieldRequiredLevel;isNewField;cellColType;dependentFields=[];constructor(t){super(h.formCell,t),this.isNewField=!1}get cellType(){return this.cellColType}set cellType(t){this.cellColType=t}setDefaultProperties(t){this.showlabel=t,this.isLocked=!1,N.IsNullOrUndefined(this.getProperty(d.id))&&(this.id=new E(E.NewGuid()))}addControl(t,r,n,i,a,o,s){n instanceof Ot?this.addChild(n):n instanceof E&&this.addChild(this.getControlWithControlSpecificProperties(t,r,n,i,a,o,s))}removeControl(){return this.deleteChild(this.control)>=0}get isIndependent(){if(!N.IsNullOrUndefined(this.control))return N.IsNullOrUndefined(this.control.dataFieldName)?N.IsNullOrUndefined(this.control.id)?!0:!Qr.dependencyFieldCount.containsKey(this.control.id):!Qr.dependencyFieldCount.containsKey(this.control.dataFieldName)}createOnLoadEvent(){this.addEvent(new Hn(this,qi.onLoad))}get dependencies(){let t=this.getChildren(h.formEvents);for(let r of t){let n=r.getChildren(h.formEvent);for(let i of n)this.buildDependencyList(i,this.dependentFields)}return this.dependentFields}getNextAvailableControlName(t,r,n,i){let a;if(i&&Po[i])a=Po[i].replace(/ /g,_c)+_c;else{a="Control_";let u=new Error("Control class id does not exist or is undefined");(0,QC.trackErrorTrace)(Je,{eventName:`${Rf}/getNextAvailableControlName`},u)}let o="new_",s=this.getHighestIndexById(t,i)+1,l=`${a}${o}${s}`;for(;n.has(l);)s++,l=`${a}${o}${s}`;return l}getUnboundControlProperties(t){e.prototype.setProperty.call(t,d.isUnbound,"true"),e.prototype.setProperty.call(t,d.isRequired,"false")}getControlWithControlSpecificProperties(t,r,n,i,a,o,s){let l;a===vt.Grid?(l=new Jn(this),l.indicationOfSubgrid=!0):a===vt.Lookup?l=new Qn(this):l=new Ot(this);let u=n.guidString,c=o||this.getNextAvailableControlName(t,i,this.getUsedNodeNameSet(t),u);if(e.prototype.setProperty.call(l,d.id,c),l.ClassId=n,!N.IsNullOrUndefined(s)&&(l.UniqueId=s),!o&&r)this.getUnboundControlProperties(l);else{let p=we.getUniqueIdentifierForControl(l);N.IsNullOrUndefined(p)||(we.getControlDataTypeByControlOrUniqueId(p)===U.QuickFormCollectionControl||!we.isUnboundFormControlByIdentifier(p)?a!==vt.Grid&&o&&u!==A.IframeControl&&u!==A.SubgridControl&&u!==A.ReferencePanelSubgridControl&&(l.dataFieldName=o,e.prototype.setProperty.call(l,d.disabled,"false")):(this.rowspan=we.GetRowSpan(l),(we.getControlDataTypeByControlOrUniqueId(p)===U.NotesControl||we.getControlDataTypeByControlOrUniqueId(p)===U.TimeLineControl)&&(e.prototype.setProperty.call(l,d.disabled,"false"),l.id=U.NotesControl)),(we.getUnboundControlNameFromIdentifier(n)===U.SubGridControl||we.getUnboundControlNameFromIdentifier(n)===U.NotesControl||we.getUnboundControlNameFromIdentifier(n)===U.TimeLineControl)&&(this.availableforphone=!0))}return l}buildDependencyList(t,r){if(N.IsNullOrUndefined(t))return;let n=t.getAllChildren();for(let i of n){let a=i.getAllChildren();for(let o of a){let s=o.GetPropertyByParameter(d.id);o.getNodeName()===h.dependency&&s?r.push(s):this.buildDependencyList(o,r)}}}get control(){return this.getFirstChild(h.formControl)}set rowspan(t){this.setProperty(d.rowspan,String(t))}get rowspan(){let t=this.getProperty(d.rowspan);return N.IsNullOrUndefined(t)?1:parseInt(t,10)}set autoexpand(t){this.setProperty(d.auto,String(t))}get autoexpand(){return this.getProperty(d.auto)==="true"}set colspan(t){let r=Number(Tu.ONE_COLUMN),n=Number(Tu.FOUR_COLUMN);N.IsNullOrUndefined(t)||t>n||t<r||this.setProperty(d.colspan,String(t))}get colspan(){let t=this.getProperty(d.colspan);return N.IsNullOrUndefined(t)?1:parseInt(t,10)}getParentRow(){return this.getAncestor(h.formRow)}getParentSection(){return this.getAncestor(h.formSection)}getParentTab(){return this.getAncestor(h.formTab)}getParentForm(){return this.getAncestor(h.form)}isInHeader(){let t=this.getAncestor(h.formHeader);return!N.IsNullOrUndefined(t)}isInFooter(){let t=this.getAncestor(h.formFooter);return!N.IsNullOrUndefined(t)}isEmpty(){return N.IsNullOrUndefined(this.control)&&!this.IsUserSpacer}getHeaderFooter(){return this.isInHeader()?this.getAncestor(h.formHeader):this.isInFooter()?this.getAncestor(h.formFooter):null}get FieldRequiredLevel(){return this.fieldRequiredLevel}set FieldRequiredLevel(t){this.fieldRequiredLevel=t}get FieldPlaceholder(){return this.fieldPlaceholder}set FieldPlaceholder(t){this.fieldPlaceholder=t}get IsNewField(){return this.isNewField}set IsNewField(t){this.isNewField=t}get IsUserSpacer(){let t=this.getProperty(d.userspacer);return N.IsNullOrUndefined(t)?!1:t==="true"}SetUserSpacer(){this.setProperty(d.userspacer,"true")}ClearUserSpacer(){this.setProperty(d.userspacer,"false")}get columns(){let t=this.getProperty(d.columnName);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}getColumnLayoutValue(t){let r;switch(t){case de.TWO_COLUMN:r="11";break;case de.THREE_COLUMN:r="111";break;case de.FOUR_COLUMN:r="1111";break;default:r="1"}return r}findRowIndexByCellId(t){let r=this.getParentRow().cells.indexOf(this);for(let n=0;n<t.rows.length;n++)if(!N.IsNullOrUndefined(t.rows[n].cells[r])&&this.id.ToString()===t.rows[n].cells[r].id.ToString())return n;return-1}setAutoExpandDetailsForTab(){let t=this.getParentTab();N.IsNullOrUndefined(t)||(t.autoExpandCell=this,t.tabContainsAutoExpandControl=!0)}isCellRequiredOrLocked(t,r,n){let i=this.getParentForm();if(this?.control){if(this.IsUserSpacer)return!1;{if(this.isLocked||r().has(this.control.dataFieldName))return!0;let a=i.isDuplicateCell(this,n),o=this.getRequiredLevel(t);if((o===Kr.ApplicationRequired||o===Kr.SystemRequired)&&!a||this.isCellLockedByExternal(t)&&!a)return!0}}return!1}getRequiredLevel(t){return!this.control?.dataFieldName||!this.control?.id||this.IsNewField||!this.control?.ClassId?Kr.None:t.getEntityAttributeByName(this.control.dataFieldName)?.requiredLevel?.toString()??Kr.None}isCellLockedByExternal(t){return this.control||this.IsUnboundControl?!1:t.getEntityAttributeByName(this.control.dataFieldName).isRequiredForForm||!this.isIndependent}async toJSON(t){return{Id:this.id&&this.id.guidString,Name:this.Name,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId.guidString,PreviewId:this.id&&this.id.guidString,ColSpan:this.colspan,RowSpan:this.rowspan,AutoExpand:this.autoexpand,IsInFirstColumnOfSection:!1,IsInLastColumnOfSection:!1,AvailableForPhone:this.availableforphone,UserSpacer:this.IsUserSpacer,IsPreviewCell:!1,IsStreamCell:!1,IsChartCell:!1,IsTileCell:!1,Control:this.control&&await this.control.toJSON(t)}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===h.formCell){let i=n;i.control&&i!==this&&r.add(n.control.id)}return!1}),r}getHighestIndexById(t,r){let n=t.findAll(a=>a.getNodeName()===h.formCell&&a.control&&a.control.ClassId.guidString===r),i=0;return n.forEach(a=>{i=Math.max(this.parseControlNameIndex(a.control.id),i)}),i}parseControlNameIndex(t){let r=t.length-1,n=0;for(;r>0&&parseInt(t.charAt(r),10);)r--;return r>0&&r!==t.length-1&&t.charAt(r)===_c&&(r++,n=parseInt(t.substr(r,t.length-r),10)),n}}});var Xn,Oc=S(()=>{"use strict";Ve();G();Oe();Xn=class extends q{isInternal;constructor(t,r,n,i){super(h.library,t),this.isInternal=!!i,I.IsNullOrEmpty(n)||(this.name=r,this.libraryUniqueId=n)}get libraryUniqueId(){let t=this.getProperty(d.libraryUniqueId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),t?.toUpperCase()}set libraryUniqueId(t){this.setProperty(d.libraryUniqueId,t)}get name(){return this.getProperty(d.libraryName)}set name(t){this.setProperty(d.libraryName,t)}get displayName(){return this.getProperty(d.displayName)}set displayName(t){this.setProperty(d.displayName,t)}get description(){return this.getProperty(d.description)}set description(t){this.setProperty(d.description,t)}}});var rn,Fc=S(()=>{"use strict";be();va();G();Oe();rn=class extends q{isRowAddedOnDragOver;constructor(t){super(h.formRow,t)}addCell(t){this.addChild(t)}appendCells(t){for(let r of t)this.addChild(r)}updateCell(t,r){return this.updateChild(t,r)}removeCell(t){return N.IsNullOrUndefined(t)?!1:this.deleteChild(t)>=0}insertCellAtIndex(t,r){return N.IsNullOrUndefined(t)?!1:(this.insertChildAtIndex(t,r),!0)}isEmpty(){return!this.cells||this.cells.every(t=>t.isEmpty())}getParentSection(){return this.getAncestor(h.formSection)}insertPaddingCellAtIndex(t){let r=new et(this);r.setDefaultProperties(),this.insertCellAtIndex(r,t)}get firstCell(){let t=this.cells;return t.length>0?t[0]:null}get cells(){return this.getChildren(h.formCell)}get rowColspan(){return this.cells.reduce((t,r)=>t+r.colspan,0)}set IsRowAddedOnDragOver(t){this.isRowAddedOnDragOver=t}get IsRowAddedOnDragOver(){return this.isRowAddedOnDragOver}async getCellsJSON(t){let r=[],n=[];if(this.cells){for(let i of this.cells)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Cells:await this.getCellsJSON(t),Visible:!0,Height:"0"}}}});function fM(e){switch(e){case Yr.Left:return Zr.Left;case Yr.Right:return Zr.Right;case Yr.Center:return Zr.Center;default:return Zr.Left}}function mM(e){switch(e){case On.Left:return Rn.Left;case On.Top:return Rn.Top;default:return Rn.Left}}function XC(e){switch(e){case 1:return 1;case 2:return 11;case 3:return 111;case 4:return 1111;default:return 1}}var hM,Gt,ba=S(()=>{"use strict";Uu();Ae();be();Ve();wc();va();G();It();Lr();Fc();hM=115,Gt=class e extends Ge{colSpan=1;constructor(t,r){super(t,r)}getSectionType(){let t;switch(this.columns){case 1:t=de.ONE_COLUMN;break;case 11:t=de.TWO_COLUMN;break;case 111:t=de.THREE_COLUMN;break;case 1111:t=de.FOUR_COLUMN;break;default:t=this.colSpan-1}return t}setUniqueName(){let t=this.getParentTab(),r=se.namePrefix;if(t){let n=t.Name,i=t.TotalSectionsCount+1;r=n+se.namePrefix+i.toString()}else r+=Math.floor(Math.random()*1e3);this.setProperty(d.Name,r)}initializeDefaultProperties(t,r,n){if(n===de.REFERENCE_PANEL){this.addProperty(d.rowheight,"25");let i=`${se.referencePanelNamePrefix}${E.NewGuid()}${se.namePrefix}`;this.addProperty(d.Name,i)}else this.setUniqueName();if(this.addProperty(d.id,new E(E.NewGuid()).guidString),this.addProperty(d.IsUserDefined,se.IsUserDefined),this.addProperty(d.locklevel,se.LockLevel),this.addProperty(d.showlabel,se.ShowLabel),this.addProperty(d.showbar,se.ShowBar),this.addProperty(d.layout,se.Layout),this.addProperty(d.Fieldlabelalignment,se.labelAlignment),this.addProperty(d.Fieldlabelposition,se.labelPosition),N.IsNullOrUndefined(n))this.addProperty(d.columnName,se.columns);else{let i=this.getColumnLayoutValue(n);this.addProperty(d.columnName,i)}this.addProperty(d.LabelWidth,se.LabelWidth),this.setDisplayName(r,t)}getColumnLayoutValue(t){let r;switch(t){case de.TWO_COLUMN:r="11";break;case de.THREE_COLUMN:r="111";break;case de.FOUR_COLUMN:r="1111";break;default:r="1"}return r}getNumberOfColumns(){return e.getNumericColumnLayoutValue(this.columns)}static getNumericColumnLayoutValue(t){switch(t){case 1:return 1;case 11:return 2;case 111:return 3;case 1111:return 4;default:throw new Error("Unexpected Section Layout Value.")}}getColumnCountValue(){let t=0;return N.IsNullOrUndefined(this.columns)?t=this.ColSpan:this.columns.toString().split(I.EmptyString).forEach(r=>{t+=parseInt(r,10)}),t}get ColSpan(){return this.colSpan}initializeRow(t){if(t>0&&t<5){let r=new rn(null);if(this.addGrandChild(h.formRows,r),GC.getConfig().enableAutoInsertionOfCellInRow)for(let n=0;n<t;n++){let i=new et(r);i.setDefaultProperties(!1),r.addCell(i)}}}initialize(t,r,n){this.initializeDefaultProperties(t,r,n),n===de.REFERENCE_PANEL&&(n=de.ONE_COLUMN),this.initializeRow(n+1)}setColSpan(t){this.colSpan=t}appendRow(t){this.addGrandChild(h.formRows,t)}insertRowAtIndex(t,r){this.addGrandChildAtIndex(h.formRows,t,r)}insertRowsAtIndex(t,r){if(t&&t.length>0)for(let n=0;n<t.length;n++)this.addGrandChildAtIndex(h.formRows,t[n],r+n)}indexOfRow(t){return this.rows.indexOf(t)}deleteRow(t){return this.deleteFirstGrandChildOfName(h.formRows,t)}deleteRows(t,r){this.deleteGrandChildren(h.formRows,t,r)}get rows(){return this.getRows()}getRows(){let t=this.getChildren(h.formRows);return t.length===0?[]:t[0].getChildren(h.formRow)}get columns(){let t=this.getProperty(d.columnName),r=N.IsNullOrUndefined(t)?NaN:parseInt(t,10);if(isNaN(r)){let n=1;for(let i of this.rows)n=Math.max(n,i.cells.length);return XC(n)}return r}set columns(t){N.IsNullOrUndefined(t)||this.setProperty(d.columnName,String(t))}get rowHeight(){let t=this.getProperty(d.rowheight);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set rowHeight(t){this.setProperty(d.rowheight,String(t))}set autoexpand(t){this.setProperty(d.autoExpand.toLowerCase(),String(t))}get autoexpand(){return this.getProperty(d.autoExpand.toLowerCase())==="true"}get isUserDefined(){return+this.getProperty(d.IsUserDefined)!=0}set isUserDefined(t){t?this.setProperty(d.IsUserDefined,"1"):this.setProperty(d.IsUserDefined,"0")}getParentColumn(){return this.getAncestor(h.formColumn)}getParentTab(){return this.getAncestor(h.formTab)}get hasMultiColumnRow(){return this.getColumnCountValue()>1}get showlabel(){return this.getProperty(d.showlabel)==="true"}set showlabel(t){N.IsNullOrUndefined(t)||this.setProperty(d.showlabel,String(t))}get fieldLabelAlignment(){let t=se.labelAlignment,r=this.getProperty(d.Fieldlabelalignment);return N.IsNullOrUndefined(r)?t:r}set fieldLabelAlignment(t){N.IsNullOrUndefined(t)||this.setProperty(d.Fieldlabelalignment,t)}get fieldLabelPosition(){let t=this.getProperty(d.Fieldlabelposition);return N.IsNullOrUndefined(t)?se.labelPosition:t}set fieldLabelPosition(t){N.IsNullOrUndefined(t)||this.setProperty(d.Fieldlabelposition,String(t))}get showbar(){return this.getProperty(d.showbar)==="true"}set showbar(t){N.IsNullOrUndefined(t)||this.setProperty(d.showbar,String(t))}get labelwidth(){let t=+this.getProperty(d.LabelWidth);return t===0?hM:t}set labelwidth(t){N.IsNullOrUndefined(t)||t>283&&t<57||this.setProperty(d.LabelWidth,t.toString())}async getRowsJSON(t){let r=[],n=[];if(this.rows){for(let i of this.rows)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Name:this.Name,Id:this.id&&this.id.guidString,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId&&this.labelId.guidString,PreviewId:this.id&&this.id.guidString,Rows:await this.getRowsJSON(t),CellLabel:{Width:this.labelwidth,Alignment:fM(this.fieldLabelAlignment),Position:mM(this.fieldLabelPosition)},Columns:XC(this.getColumnCountValue()),AvailableForPhone:this.availableforphone,Height:this.rowHeight&&this.rowHeight.toString()}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===h.formSection){let i=n;i.Name&&!I.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}isReferencePanelSection(){return!N.IsNullOrUndefined(this)&&!N.IsNullOrUndefined(this.Name)&&this.Name.indexOf(se.referencePanelNamePrefix)===0}getAllMultiRowCells(){return this.findAll(t=>{if(t.getNodeName()===h.formCell){let r=t;return!r.isEmpty()&&r.rowspan>1}return!1})}isHeaderOrFooterSection(){return this.NodeName===h.formFooter||this.NodeName===h.formHeader}}});var Ur,ls=S(()=>{"use strict";G();Oe();ba();Ur=class e extends q{constructor(t){super(h.formColumn,t)}initializeDefaultProperties(t){this.addProperty(d.width,t.toString()+"%")}insertSectionAtIndex(t,r){this.addGrandChildAtIndex(h.formSections,t,r)}static createAndInitNewSection(t,r,n){let i=new Gt(h.formSection,null);return i.initialize(t,r,n),i}addSectionAtIndex(t,r){this.addGrandChildAtIndex(h.formSections,t,r)}initialize(t,r,n,i=de.ONE_COLUMN){this.initializeDefaultProperties(t);let a=e.createAndInitNewSection(r,n,i);this.addSectionAtIndex(a,this.sections.length),a.setUniqueName()}get parentTab(){return this.getAncestor(h.formTab)}get sections(){let t=this.getChildren("sections");return t.length!==1?[]:t[0].getChildren(h.formSection)}get width(){return this.getProperty(d.width)}set width(t){this.setProperty(d.width,t)}deleteSection(t){return this.deleteFirstGrandChildOfName(h.formSections,t)}async getSectionsJSON(t){let r=[];if(this.sections)for(let n of this.sections)r.push(await n.toJSON(t));return r}async toJSON(t){return{Name:this.getProperty(d.Name),Id:this.getProperty(d.id),Label:null,ShowLabel:!1,Visible:!0,LabelId:null,PreviewId:this.getProperty(d.id),Sections:await this.getSectionsJSON(t),Width:this.width}}}});var us,KC=S(()=>{"use strict";Ae();G();It();ba();us=class extends Gt{initializeNavArea(t,r,n){this.initializeNavAreaProps(t,r,n)}get AreaName(){return this.Name}initializeNavAreaProps(t,r,n){this.addProperty(d.Name,n),this.addProperty(d.id,new E(E.NewGuid()).guidString),this.addProperty(d.columnName,se.columns),this.setDisplayName(r,t)}}});var cs,YC=S(()=>{"use strict";ls();G();KC();cs=class extends Ur{addAndIntializeNavBarSection(t,r,n,i){let a=new us(h.formSection,null);return a.initializeNavArea(t,r,i),this.addGrandChildAtIndex(h.formSections,a,n),a}}});var lr,ds=S(()=>{"use strict";Ae();be();Ve();ls();G();Oe();Lr();lr=class extends Ge{tabContainsAutoExpandControl;autoExpandCell;constructor(t,r){super(h.formTab,t),this.tabContainsAutoExpandControl=!1}getParentForm(){return this.getAncestor(h.form)}getTabLayoutType(){let t;switch(this.columns.length){case 1:t=ce.ONE_COLUMN;break;case 2:if(parseInt(this.columns[0].width,10)===50&&parseInt(this.columns[1].width,10)===50){t=ce.TWO_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===67&&parseInt(this.columns[1].width,10)===33){t=ce.TWO_COLUMN_WIDER_LEFT;break}if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===66){t=ce.TWO_COLUMN_WIDER_RIGHT;break}t=ce.TWO_COLUMN_CUSTOM_LAYOUT;break;case 3:if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===33&&parseInt(this.columns[2].width,10)===33){t=ce.THREE_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===28&&parseInt(this.columns[1].width,10)===44&&parseInt(this.columns[2].width,10)===28){t=ce.THREE_COLUMN_WIDER_MID;break}t=ce.THREE_COLUMN_CUSTOM_LAYOUT;break;default:}return t}initializeProperties(t,r,n){this.addProperty(d.Name,Pr.namePrefix+t.toString()),this.addProperty(d.id,new E(E.NewGuid()).guidString),this.addProperty(d.IsUserDefined,Pr.IsUserDefined),this.addProperty(d.locklevel,Pr.LockLevel),this.addProperty(d.showlabel,Pr.ShowLabel),this.setDisplayName(n,r)}get TotalSectionsCount(){let t=0;for(let r of this.columns)t+=r.sections.length;return t}initializeColumns(t,r,n,i=de.ONE_COLUMN,a=!0,o){let s=this.getChildren(h.formColumns)[0],l=[];switch(t){case ce.ONE_COLUMN:l.push(100);break;case ce.TWO_COLUMN_EQUAL:l.push(50),l.push(50);break;case ce.TWO_COLUMN_WIDER_LEFT:l.push(67),l.push(33);break;case ce.TWO_COLUMN_WIDER_RIGHT:l.push(34),l.push(66);break;case ce.THREE_COLUMN_EQUAL:l.push(34),l.push(33),l.push(33);break;case ce.THREE_COLUMN_WIDER_MID:l.push(28),l.push(44),l.push(28);break;default:}for(let u of l){let c=new Ur(s);c.initialize(u,r,n,i),this.addGrandChild(h.formColumns,c)}}initialize(t,r,n,i,a,o=de.ONE_COLUMN,s=!0,l){this.addChild(new q(h.formColumns,this)),this.initializeProperties(r,n,i),this.initializeColumns(t,n,a,o,s,l)}get columns(){let t=this.getChildren(h.formColumns);return t.length!==1?[]:t[0].getChildren(h.formColumn)}get expanded(){return this.getProcessedValue(d.expanded)}set expanded(t){N.IsNullOrUndefined(t)||this.setProperty(d.expanded,String(t))}get groupName(){return this.getProperty(d.groupName)}get contentType(){return this.getProperty(d.contentType)}set contentType(t){this.setProperty(d.contentType,t)}insertNewColumnAtIndex(t,r,n,i,a){t.initialize(n,i,a),this.addGrandChildAtIndex(h.formColumns,t,r)}insertColumnAtIndex(t,r){this.addGrandChildAtIndex(h.formColumns,t,r)}deleteColumn(t){return this.deleteFirstGrandChildOfName(h.formColumns,t)}async getColumnsJSON(t){let r=[],n=[];if(this.columns){for(let i of this.columns)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Name:this.Name,Id:this.id&&this.id.guidString,Label:this.getDisplayName(t.langCode)+(!this.visible&&t.formModelService.showHiddenElements?"\u3000\u3000":""),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId&&this.labelId.guidString,UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString,Columns:await this.getColumnsJSON(t),EventHandlers:[],Expanded:this.expanded,ContentType:this.contentType,AvailableForPhone:this.availableforphone,Header:void 0,Footer:void 0}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===h.formTab){let i=n;i.Name&&!I.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}}});var nn,Rc=S(()=>{"use strict";Ae();G();Oe();It();YC();ds();nn=class extends lr{constructor(t,r,n){super(t,ce.THREE_COLUMN_EQUAL),this.setDisplayName(r,n),this.id=new E(E.NewGuid())}initializeDefaultProps(){this.addChild(new q(h.formColumns,this)),this.initializeFiveColumns()}get columns(){let t=this.getChildren("columns");return t.length!==1?[]:t[0].getChildren(h.formColumn)}getNavSectionForArea(t){for(let r of this.columns)for(let n of r.sections)if(n.AreaName===t)return n;return null}getNavCellFromNavId(t){for(let r of this.columns)for(let n of r.sections)for(let i of n.rows)for(let a of i.cells)if(a.NavId===t)return a;return null}initializeFiveColumns(){for(let t=0;t<$o.FIVE_COLUMN;t++){let r=new cs(this.getChildren(h.formColumns)[0]);r.initializeDefaultProperties(lm.FiveEqColumn),this.addGrandChild(h.formColumns,r)}}}});function vM(e){switch(e){case Ne.Main:return Fr.Main;case Ne.QuickCreate:return Fr.QuickCreate;case Ne.QuickViewForm:return Fr.Quick;case Ne.Dialog:return Fr.Dialog;default:return Fr.None}}function bM(e,t){if(t===Ne.Main){if(e)switch(e.toLowerCase()){case"low":return _r.Low;case"highreadonlyvalues":return _r.HighReadOnlyValues;default:return _r.HighWithControls}return _r.Low}}var fs,gM,ps,ZC=S(()=>{"use strict";Eh();fs=ne(Jr());Uu();be();Ve();Sn();wc();G();In();eu();Hr();va();G();Lr();Oc();Rc();ds();gM="1920";ps=class e extends Ge{_formUniqueName;isHeaderDefaulted;consistencyStrong=!1;_formId;_rawFormXml;_entityName;_entityDisplayName;_status;_formName;_langCode;_description;_formType;_formPresentation;parameters=[];_formactivationstate;_changeTracker;_metadataChangeEvent;_etag;constructor(t,r,n,i,a,o,s,l,u){super(h.form,null),this._formUniqueName=a,this._formId=t,this._entityName=r,this._status=n,this._formName=i,this._description=l,this._formType=o,this._formPresentation=s,this._formactivationstate=u,this._changeTracker=new Do,this._metadataChangeEvent=new jo}get FormLibraries(){let t=this.getFirstChild(h.formLibraries),r=t?t.getAllChildren():[],n=this._getInternalLibraries();return r.concat(n)}getAllEvents(){let t=[],r=this.events;r&&(t=t.concat(r));for(let n of this.tabs){let i=n.events;i&&(t=t.concat(i)),n.findAll(a=>a instanceof et).forEach(a=>{let o=a.events;o&&(t=t.concat(o))})}return t}getEventsForNode(t){if(t instanceof e){let r=t.events;return r?r.filter(n=>!n.control&&!n.attribute):null}else if(t instanceof et){if(t.control?.dataFieldName){let r=this.events;return r?r.filter(n=>n.attribute&&t.control.dataFieldName===n.attribute):null}else if(this.isCellEditableGridControl(t)){let r=this.events;return r?r.filter(n=>n.control&&t.control.id===n.control):null}}return t?.events}_getInternalLibraries(){let t=this.findAll(i=>i.getNodeName()===h.internalLibraries),r=[],n="src";return t.length>0&&(r=t.map(i=>{let a=i.GetPropertyByParameter(n).replace("$webresource:",""),o=new Xn(void 0,void 0,"",!0);return o.name=a,o.displayName=a,o})),r}getDependentFields(){let t=this.getAllEvents(),r=new Set;return t.forEach(n=>{try{n.getAllDependencies().forEach(a=>{r.add(a.id)})}catch(i){throw(0,fs.trackErrorTrace)(Tf,{eventName:"GetDependentFields_MissingDependencies",eventData:{Message:`Failed get dependencies for form event in form ${this.formId.guidString}.`,Attribute:n.attribute,EventName:n.eventName}}),i}}),r}get Parameters(){return this.parameters}set Parameters(t){this.parameters=t}get ShowImagecheck(){return I.IsNullOrEmpty(this.getProperty(d.ShowImage))?!0:this.getProperty(d.ShowImage)!=="false"}set ShowImagecheck(t){t?this.setProperty(d.ShowImage,String(t)):this.setProperty(d.ShowImage,"false")}get ShowNavigation(){return I.IsNullOrEmpty(this.getProperty(d.ShowNavigationbar))?!0:this.getProperty(d.ShowNavigationbar)!=="false"}set ShowNavigation(t){t?this.setProperty(d.ShowNavigationbar,String(t)):this.setProperty(d.ShowNavigationbar,"false")}get MaxWidth(){return I.IsNullOrEmpty(this.getProperty(d.MaxWidth))?gM:this.getProperty(d.MaxWidth)}set MaxWidth(t){this.setProperty(d.MaxWidth,t)}get headerDensityType(){return this.getProperty(d.HeaderDensityType)}set headerDensityType(t){t&&this.formType===Ne.Main?this.setProperty(d.HeaderDensityType,t):this.formType!==Ne.Main&&this.headerDensityType&&this.removeProperty(d.HeaderDensityType)}IsMainOrQuickCreateForm(){return this.formType===Ne.Main||this.formType===Ne.QuickCreate}get FormPresentation(){return this._formPresentation}get LanguageCode(){return this._langCode}set LanguageCode(t){this._langCode=t}get header(){let t=this.getChildren(h.formHeader);return t.length!==1?null:t[0]}set header(t){N.IsNullOrUndefined(t)||(this.deleteChild(this.header),this.addChild(t))}getAllDependencies(){return this.getChildren(h.quickFormDependencies).length===0?[]:this.ConvertModelToArray(this.getChildren(h.quickFormDependencies)[0].getAllChildren())}ConvertModelToArray(t){let r=[];return N.IsNullOrUndefined(t)||t.forEach(n=>{r.push(n.id)}),r}get footer(){let t=this.getChildren(h.formFooter);return t.length!==1?null:t[0]}set footer(t){N.IsNullOrUndefined(t)||(this.deleteChild(this.footer),this.addChild(t))}createAndInitNewTab(t,r,n){let i=new lr(null,t),a=this.getNextTabCounter(this.tabs.length+1);return i.initialize(t,a,this.LanguageCode,r,n),i}addTabAtIndex(t,r){this.addGrandChildAtIndex(h.formTabs,t,r)}createAndInitNewTabWithMarginalControl(t,r,n,i,a){let o=new lr(null,ce.ONE_COLUMN),s=this.getNextTabCounter(this.tabs.length+1);o.initialize(ce.ONE_COLUMN,s,this.LanguageCode,r,n,a,!1),this.addGrandChildAtIndex(h.formTabs,o,i);let l=o.columns[0].sections[0];for(let u=0;u<t.rows.length;u++)l.appendRow(t.rows[u])}getNextTabCounter(t){for(let r=0;r<this.tabs.length;r++)if(this.tabs[r].Name===Pr.namePrefix+t.toString())return this.getNextTabCounter(t+1);return t}get allTabs(){let t=this.getChildren(h.formTabs);return t.length!==1?[]:t[0].getChildren(h.formTab)}get CanvasNavigationTab(){if(this.tabs.length>0){let t=this.tabs[this.tabs.length-1];if(t instanceof nn)return t}return null}get NavigationNode(){let t=this.getChildren(h.formNavigation);return t.length!==1?null:t[0]}set NavigationNode(t){let n=this.getAllChildren().indexOf(this.NavigationNode);n>=0&&(this.deleteChild(this.NavigationNode),this.insertChildAtIndex(t,n))}addNavigatioNode(t){this.addChild(t)}get tabs(){return this.allTabs}deleteTab(t){return this.deleteFirstGrandChildOfName(h.formTabs,t)}insertTabAtIndex(t,r){this.addGrandChildAtIndex(h.formTabs,t,r)}insertRelatedTab(t){let r=this.getAllGrandChildren(h.formTabs);if(!N.IsNullOrUndefined(r)){let n=r.length;this.insertTabAtIndex(t,n)}}get isfooterPresent(){return this.getChildren(h.formFooter).length>0}get displayCondition(){let t=this.getChildren(h.formDisplayConditions);return t.length>0?t[0]:null}set displayCondition(t){this.deleteChild(this.displayCondition),this.addChild(t)}get entityName(){return this._entityName}get formId(){return this._formId}set formId(t){this._formId=t}get rawFormXml(){return this._rawFormXml}set rawFormXml(t){this._rawFormXml=t}get status(){return this._status}set status(t){this._status=t}get formName(){return this._formName}set formName(t){this.trackObjectPropertyChange("_formName",t)}get formUniqueName(){return this._formUniqueName}set formUniqueName(t){this.trackObjectPropertyChange("_formUniqueName",t)}get formType(){return this._formType}get tabCount(){return this.allTabs.length}get description(){return this._description}set description(t){this.trackObjectPropertyChange("_description",t)}get formactivationstate(){return this._formactivationstate}set formactivationstate(t){this.trackObjectPropertyChange("_formactivationstate",t)}get entityDisplayName(){return this._entityDisplayName}set entityDisplayName(t){this._entityDisplayName=t}get etag(){return this._etag}set etag(t){this._etag=t}indexOfTab(t){return this.getAllGrandChildren(h.formTabs).indexOf(t)}get ControlDescriptions(){return this.getAllGrandChildren(h.controlDescriptions)}addControlDescriptionNode(t){this.addGrandChild(h.controlDescriptions,t)}deleteControlDescByForControlId(t){let r=this.getControlDescriptionByForControl(t);N.IsNullOrUndefined(r)||this.deleteFirstGrandChildOfName(h.controlDescriptions,r)}getControlDescriptionByForControl(t){if(!t)return null;for(let r of this.ControlDescriptions)if(r.forControl.guidString===t.guidString)return r;return null}cellHasCustomControlWithName(t,r){if(!t?.control||!r)return!1;let n=this.getControlDescriptionByForControl(t.control.UniqueId);return n?!!n.customControls.find(i=>i.name===r):!1}isDuplicateCell(t,r){return!!this.findFirst(i=>{if(!(i instanceof et))return!1;let a=!0;return r==="Tab"?a=i.getParentTab()!==t.getParentTab():r==="Section"?a=i.getParentSection()!==t.getParentSection():a=i!==t,i instanceof et&&i.control&&t.control&&a&&i.control.dataFieldName===t.control.dataFieldName})}isCellEditableGridControl(t){return!t?.control?.indicationOfSubgrid||t.control.ClassId.guidString.toUpperCase()!==A.CustomControl?!1:this.cellHasCustomControlWithName(t,Or.EditableGridControl)||zC.getConfig()?.enableOneGridEventsForFormDesigner&&this.cellHasCustomControlWithName(t,Or.PowerAppsOneGrid)}isCellCanvasAppControl(t){return t?.control?.ClassId.guidString.toUpperCase()===A.CustomControl&&this.cellHasCustomControlWithName(t,Or.CanvasAppControl)}findFormNodeById(t,r=this){return r===null?null:r.findFirst(n=>{if(n===this&&t===this.formId.ToString()||n.id?.ToString?.()===t)return!0})}findFormCellByClassId(t,r=this){return r?r.findFirst(n=>{if(n.getNodeName()===h.formCell){let i=n;return i&&i.control&&i.control.ClassId.guidString===t}return!1}):null}async getTabsJSON(t){let r=this.tabs,n=[],i=[];if(r){for(let a of r)if(!(a instanceof nn)){let o=a.toJSON(t);n.push(o)}for(let a of n)i.push(await a)}return i}async getControlDescriptionsToJSON(t){let r=[];for(let n of this.ControlDescriptions){let i=await n.toJSON(t);i&&r.push(i)}return r}async toJSON(t){let r=[];r=await this.getControlDescriptionsToJSON(t);let n=this.NavigationNode&&await this.NavigationNode.toJSON(t);return{Id:this._formId.guidString,Name:this.formName,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible,LabelId:this.labelId&&this.labelId.guidString,PreviewId:this._formId.guidString,PreviewSessionId:(0,fs.getSessionId)(),EntityLogicalName:this._entityName,FormId:this._formId.guidString,TabAttributes:{},Tabs:await this.getTabsJSON(t),HiddenFields:[],Header:this.header&&await this.header.toJSON(t),Footer:this.footer&&await this.footer.toJSON(t),...this.formType===Ne.Main?{HeaderDensity:bM(this.headerDensityType,this.formType)}:{},InlineEditGridRow:[],InlineQuickForms:[],QuickFormEntities:[],EventHandlers:[],LinkControlSections:[],FormType:vM(this.formType),SubGrids:[],Views:void 0,Charts:void 0,CustomControlConfigurations:r,BusinessLogic:void 0,FormLibraries:[],Navigation:n,ShowNavigationBar:this.ShowNavigation||t.formModelService.showHiddenElements,ClientResources:[]}}changeTracker(){return this._changeTracker}onMetadataChange=t=>this._metadataChangeEvent.on(t);raiseMetadataChange(t){this._metadataChangeEvent.emit(t)}}});var ms,Tc,eA=S(()=>{"use strict";Ae();be();G();Oe();Lr();ms=class extends Ge{constructor(t){super(h.formDisplayConditions,t)}get Order(){let t=this.getProperty(d.Order);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set Order(t){this.setProperty(d.Order,t.toString())}get FallbackForm(){return this.getProperty(d.FallbackForm)==="true"}set FallbackForm(t){this.setProperty(d.FallbackForm,t.toString())}addRoles(t){this.deleteAllChildren();for(let r=0;r<t.length;r++)this.addChild(t[r])}isRoleEveryone(){return!!(this.getChildren(h.formEveryOne)&&this.getChildren(h.formEveryOne)[0])}setRoleEveryone(){this.deleteAllChildren(),this.addChild(new Tc(this))}},Tc=class extends q{constructor(t){super(h.formEveryOne,t)}}});var hs,tA=S(()=>{"use strict";G();Oe();hs=class extends q{constructor(t,r){super(h.Handler,r),t.length>0&&this.setDefaultProperties(t)}setDefaultProperties(t){this.FunctionName=t[0],this.LibraryName=t[1],this.HandlerUniqueID=t[2],this.Enabled=t[3],this.Parameters=t[4],this.PassExecutionContext=t[5]}get HandlerUniqueID(){return this.getProperty(d.HandlerUniqueId)}set HandlerUniqueID(t){this.setProperty(d.HandlerUniqueId,t)}get FunctionName(){return this.getProperty(d.functionName)}set FunctionName(t){this.setProperty(d.functionName,t)}get LibraryName(){return this.getProperty(d.libraryNameEventHandler)}set LibraryName(t){this.setProperty(d.libraryNameEventHandler,t)}get Enabled(){return this.getProperty(d.enabledForField)}set Enabled(t){this.setProperty(d.enabledForField,t)}get PassExecutionContext(){return this.getProperty(d.passExecutionContext)}set PassExecutionContext(t){this.setProperty(d.passExecutionContext,t)}get Parameters(){return this.getProperty(d.parameters)}set Parameters(t){this.setProperty(d.parameters,t)}}});var Kn,xc=S(()=>{"use strict";G();ba();Kn=class extends Gt{constructor(t,r){super(t,r)}get cells(){let t=this.getRows(),r=[];if(this.rows&&t.length){for(let n of this.rows)if(n.cells){let i=n.getChildren(h.formCell);for(let a of i)r.push(a)}}return r}get occupiedCells(){return this.cells.filter(t=>!t.isEmpty())}get maxColumns(){return super.getColumnCountValue()}}});var ya,rA=S(()=>{"use strict";G();xc();ya=class extends Kn{_customFooter;constructor(t,r){super(h.formFooter,t),this._customFooter=r}get customFooter(){return this._customFooter}set customFooter(t){this._customFooter=t}async getControls(t){let r=[];if(this.rows){for(let n of this.rows)if(n.cells)for(let i of n.cells)i.control&&r.push(await i.control.toJSON(t))}return r}async toJSON(t){return{AvailableForPhone:this.availableforphone,Controls:await this.getControls(t),UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString}}isEmpty(){return!this.cells.find(t=>!!t.control)}}});var Ca,nA=S(()=>{"use strict";G();xc();Ca=class extends Kn{_customHeader;constructor(t,r){super(h.formHeader,t),this._customHeader=r}get customHeader(){return this._customHeader}set customHeader(t){this._customHeader=t}get showCommandBar(){return this.getProcessedValue(d.showCommandBar)}set showCommandBar(t){t!=null&&this.setProperty(d.showCommandBar,String(t))}get showBody(){return this.getProcessedValue(d.showBody)}set showBody(t){t!=null&&this.setProperty(d.showBody,String(t))}get showTabNavigator(){return this.getProcessedValue(d.showTabNavigator)}set showTabNavigator(t){t!=null&&this.setProperty(d.showTabNavigator,String(t))}async getControls(t){let r=[];if(this.rows){for(let n of this.rows)if(n.cells)for(let i of n.cells)i.control&&r.push(await i.control.toJSON(t))}return r}async toJSON(t){return{AvailableForPhone:this.availableforphone,Controls:await this.getControls(t),UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString}}}});var tt,an=S(()=>{"use strict";Ae();Ve();G();Lr();tt=class e extends Ge{constructor(t,r){super(t,r)}getTitle(t){for(let r of this.getAllTitles())if(+r.getProperty(d.LCID)===t)return r.getProperty(d.text);return null}getAllTitles(){let t=this.getChildren(h.Titles);return t.length===0?[]:t[0].getChildren(h.Title)}setTitle(t,r){for(let i of this.getAllTitles())if(+i.getProperty(d.LCID)===r){i.setProperty(d.text,t);return}let n=new e(h.Title,null);n.setProperty(d.text,t),n.setProperty(d.LCID,String(r)),this.addGrandChild(h.Titles,n)}get Sequence(){return+this.getProperty(d.Sequence)}set Sequence(t){this.setProperty(d.Sequence,t.toString())}get Area(){return this.getProperty(d.Area)}set Area(t){this.setProperty(d.Area,t)}set Id(t){this.setProperty(d.Id,t)}get Id(){return this.getProperty(d.Id)}get id(){return new E(this.Id??"",!0)}set id(t){this.Id=t.guidString}get Show(){return!0}get Icon(){return this.getProperty(d.icon)}set Icon(t){t=t||I.EmptyString,this.setProperty(d.icon,t)}updateCommonProperties(t,r){this.Area=t.Area,this.Sequence=t.Sequence,this.setTitle(t.getDisplayName(r),r)}}});var Aa,iA=S(()=>{"use strict";(function(e){e[e.NavLinkNotAvailable=-1]="NavLinkNotAvailable",e[e.NavLinkIdConflict=-2]="NavLinkIdConflict",e[e.NavBarNotAvailable=-3]="NavBarNotAvailable"})(Aa||(Aa={}))});var gs,aA=S(()=>{"use strict";be();G();an();iA();gs=class extends tt{constructor(t){super(h.formNavBar,t)}addChildElement(t){this.addChild(t)}getAllActiveNavBarChildren(){return this.getAllChildren().filter(n=>n.Show)}getAllInActiveActiveNavBarChildren(){return this.getAllChildren().filter(n=>!n.Show)}get AllRelationShipItems(){return this.getChildren("NavBarByRelationshipItem")}get AllNavLinkItems(){return this.getChildren("NavBarItem")}removeNavLink(t){let r=this.getNavBarLinkItemById(t);return N.IsNullOrUndefined(r)?Aa.NavLinkNotAvailable:r.length===1?this.deleteChild(r[0]):Aa.NavLinkIdConflict}getRelationShipItemsByArea(t){let r=this.AllRelationShipItems,n=[];for(let i of r)i.Area===t&&i.Show===!0&&n.push(i);return n}getNavBarRelationShipItemsByNavId(t){return this.AllRelationShipItems.filter(n=>n.Id===t)}getNavBarLinkItemById(t){let r=this.AllNavLinkItems.filter(n=>n.Id===t);return r.length>0?r:null}getAllActiveChildrenForGivenArea(t){let r=this.getAllChildren(),n=[];for(let i of r)i.Area===t&&i.Show&&n.push(i);return n}}});var ae,yM,oA,Ij,Yn,Lc=S(()=>{"use strict";Ae();G();an();(function(e){e.Info="_NA_Info",e.Sales="_NA_SFA",e.Service="_NA_CS",e.Marketing="_NA_MA",e.InternetMarketing="_NA_IMA",e.ProcessCenter="_NA_PROC",e.Async="_NA_AO"})(ae||(ae={}));yM=new Map([[ae.Info,"Info"],[ae.Sales,"Sales"],[ae.Service,"Service"],[ae.Marketing,"Marketing"],[ae.ProcessCenter,"ProcessCenter"]]),oA=new Map([["Info",ae.Info],["Sales",ae.Sales],["Service",ae.Service],["Marketing",ae.Marketing],["ProcessCenter",ae.ProcessCenter]]),Ij=new Map([[ae.Info,9e3],[ae.Sales,9200],[ae.Service,9400],[ae.Marketing,9600],[ae.ProcessCenter,9800],[ae.InternetMarketing,1e4],[ae.Async,10200]]),Yn=class extends tt{constructor(t,r){super(h.formNavBarArea,r)}setDefaultPropertiesByType(t,r,n){this.AreaId=yM.get(t);let i=n?.(`navBarArea.title.${this.AreaId}`)??this.AreaId;this.setTitle(i,r)}get ParentNavigation(){return this.getAncestor(h.formNavigation)}get AreaId(){return this.getProperty(d.Id)}set AreaId(t){this.setProperty(d.Id,t)}get id(){return new E(this.AreaId??"",!0)}set id(t){this.AreaId=t.guidString}async toJSON(t){return{Id:this.AreaId,Titles:[{LCID:t.langCode,Text:this.getTitle(t.langCode)}],PreviewId:this.AreaId}}}});var Zn,Uc=S(()=>{"use strict";G();an();Zn=class extends tt{constructor(t,r){super(h.formNavBarAreas,r)}get AllNavBarAreaItems(){return this.getChildren(h.formNavBarArea)}get ParentNavigation(){return this.getAncestor(h.formNavigation)}addNavBarArea(t){this.addChild(t)}}});var vs,sA=S(()=>{"use strict";be();G();an();vs=class extends tt{RelationshipNameUCIRuntime;constructor(t){super(h.formNavBarByRelationshipItem,t)}get RelationshipName(){return this.getProperty(d.RelationshipName)}set RelationshipName(t){this.setProperty(d.RelationshipName,t)}set Show(t){this.setProperty(d.Show,String(t))}get Show(){let t=this.getProperty(d.Show);return N.IsNullOrUndefined(t)||t==="true"}get TitleResourceId(){return this.getProperty(d.TitleResourceId)}async toJSON(t){return{Area:this.Area,Show:this.Show||t.formModelService.showHiddenElements,Id:this.Id,Titles:[{Name:t.langCode.toString(),Value:this.getTitle(t.langCode)}],Sequence:this.Sequence.toString(),Privileges:[],TooltipTitles:[],AvailableOffline:!0,PreviewId:this.Id,RelationshipName:this.RelationshipNameUCIRuntime??this.RelationshipName,Icon:null,ViewId:null,Client:null,TitleResourceId:null}}}});var bs,lA=S(()=>{"use strict";G();an();bs=class extends tt{constructor(t){super(h.formNavBarItem,t)}get Url(){return this.getProperty(d.url)}set Url(t){this.setProperty(d.url,t)}}});var ys,uA=S(()=>{"use strict";Ae();G();Lc();Uc();an();ys=class extends tt{constructor(t,r){super(t,r)}getNavBarAreaByAreaName(t){let r=this.navBarAreas.AllNavBarAreaItems.filter(n=>n.AreaId===t);return r.length===0?null:r[0]}get navBarAreas(){return this.getFirstChild(h.formNavBarAreas)}setDefaultNavBarAreas(t,r){let n=[ae.Info,ae.Sales,ae.Service,ae.Marketing,ae.ProcessCenter];if(this.navBarAreas){let i=this.navBarAreas?.AllNavBarAreaItems;if(i&&i.length>0){let a=new Set(i.map(o=>oA.get(o.AreaId)));n=n.filter(o=>!a.has(o))}}else{let i=new Zn(h.formNavBarAreas,this);i.isTransient=!0,this.addChild(i)}return n.length>0?(n.forEach(i=>{let a=new Yn(h.formNavBarArea,this.navBarAreas);a.setDefaultPropertiesByType(i,t,r),this.navBarAreas.addNavBarArea(a)}),!0):!1}get navBar(){return this.getFirstChild(h.formNavBar)}get id(){return new E(pu,!0)}replaceNavAreaToGivenIndex(t,r){this.navBarAreas?.AllNavBarAreaItems.indexOf(r)!==-1&&(this.deleteFirstGrandChildOfName(h.formNavBarAreas,r),this.addGrandChildAtIndex(h.formNavBarAreas,r,t))}async getNavBarAreasJSON(t){let r=[],n=[];if(this.navBarAreas?.AllNavBarAreaItems){for(let a of this.navBarAreas.AllNavBarAreaItems)n.push(a.toJSON(t));r=await Promise.all(n)}return r}async getNavBarRelationshipItemsJSON(t){let r=[],n=[];if(this.navBar?.AllRelationShipItems){for(let i of this.navBar.AllRelationShipItems)n.push(i.toJSON(t));r=await Promise.all(n)}return r}async toJSON(t){let r=await this.getNavBarAreasJSON(t),n=await this.getNavBarRelationshipItemsJSON(t);return{NavBarAreas:{NavBarAreas:r},NavBarByRelationshipItems:n,NavBarItems:[],NavPaneIsvItems:{NavBarIsvItems:[]},ShowEmptyNavBarAreas:t.formModelService.showHiddenElements}}}});var cA={};xt(cA,{ControlType:()=>vt,DeserializationService:()=>kc,DeserializationServiceScope:()=>Bc,DeserializedFormElementNode:()=>rt});var Mc,rt,Bc,vt,kc,Pc=S(()=>{"use strict";Mc=ne(Jr());Ae();be();Ve();Sn();fu();Hr();xf();Dh();Wo();ZC();va();ls();ga();Sc();G();G();eA();Oe();It();Dc();tA();rA();Ec();Ic();nA();Oc();Fc();ba();ds();aA();Lc();Uc();sA();lA();uA();rt=class extends q{constructor(t,r){super(t,r)}insertProperty(t,r){this.addProperty(t,r)}insertChild(t){this.addChild(t)}},Bc="DeserializationService";(function(e){e.Grid="Grid",e.Lookup="Lookup",e.Base="Base"})(vt||(vt={}));kc=class{lcid;constructor(t){this.lcid=t}deSerializeFormXml(t,r,n,i,a,o,s,l,u,c){if(!t)throw new Error("Formxml could not be parsed.");let p=t.getElementsByTagName("form");if(p.length!==1){let v="";throw p.length===0?v="FormXml has no form node.":v="FormXml has multiple form nodes.",(0,Mc.trackErrorTrace)(Je,{eventName:Bc,eventData:{error:v}}),new Error(v)}let m=this.createFormModel(p.item(0),r,n,i,a,o,s,l,u,c);return N.IsNullOrUndefined(m.displayCondition)&&s!==Ne.Dialog&&this.appendDefaultDisplayCondition(m),m}upsertFieldCount(t,r){let n=Qr.getNecessaryLookUpTable(r),i=1;n.containsKey(t)&&(i+=n.getValue(t)),n.upsert(t,i)}appendDefaultDisplayCondition(t){let r='<DisplayConditions Order="0" FallbackForm="true"><Everyone/></DisplayConditions>';if(!N.IsNullOrUndefined(t)){let n=N.ParseXml(r);n!==null&&this.populateElementChildren(t,n.childNodes)}}createFormModel(t,r,n,i,a,o,s,l,u,c){let p=new ps(r,n,i,a,o,s,l,u,c);return this.populateElementProperties(p,t.attributes),this.populateElementChildren(p,t.childNodes),s===Ne.Main&&(this.insertHeaderFooterElementProperties(h.formHeader,p,p.header),this.insertHeaderFooterElementProperties(h.formFooter,p,p.footer)),p}insertHeaderFooterElementProperties(t,r,n){if(N.IsNullOrUndefined(n)){let i=t===h.formHeader?new Ca(r,!0):new ya(r,!0);rt.prototype.insertProperty.call(i,d.id,"{"+E.NewGuid()+"}"),rt.prototype.insertProperty.call(i,d.Fieldlabelposition,"Top"),rt.prototype.insertProperty.call(i,d.columnName,se.MarginalControlColumns),rt.prototype.insertProperty.call(i,d.LabelWidth,se.LabelWidth),rt.prototype.insertProperty.call(i,d.Fieldlabelalignment,"Left");let a=null,o=new rn(a);for(let s=0;s<i.maxColumns;s++){let l=new et(o);rt.prototype.insertProperty.call(l,d.id,"{"+E.NewGuid()+"}"),l.setDisplayName(I.EmptyString,this.lcid),rt.prototype.insertProperty.call(l,d.showlabel,"false"),o.addCell(l)}i.appendRow(o),t===h.formHeader?r.header=i:r.footer=i}}deSerializeFormXmlNode(t,r){if(t&&t.nodeValue&&(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.CDATA_SECTION_NODE))return new rt(`<${t.nodeValue}`,r);if(t.nodeType===Node.COMMENT_NODE)return;let n=this.createModelNode(t,r);return this.populateElementProperties(n,t.attributes),this.populateElementChildren(n,t.childNodes),n}populateElementProperties(t,r){if(!r){let n="attributes is undefined for element: "+t.getNodeName();throw(0,Mc.trackErrorTrace)(Je,{eventName:Bc,eventData:{error:n}}),new Error(n)}for(let n=0;n<r.length;n++){let i=r.item(n);i&&(rt.prototype.insertProperty.call(t,i.name,i.value),t.getNodeName()===h.formCell&&i.name===d.auto&&i.value==="true"&&t.setAutoExpandDetailsForTab())}}populateElementChildren(t,r){for(let n=0;n<r.length;n++){let i=r.item(n),a=this.deSerializeFormXmlNode(i,t);a&&rt.prototype.insertChild.call(t,a)}}createModelNode(t,r){switch(t.nodeName){case h.form:throw new Error("Form node shouldn't be created using this method");case h.formTab:return new lr(r);case h.formColumn:return new Ur(r);case h.formHeader:return new Ca(r,!1);case h.formFooter:return new ya(r,!1);case h.formSection:return new Gt(h.formSection,r);case h.formRow:return new rn(r);case h.formCell:return new et(r);case h.formControl:let n=t.attributes,i=t.childNodes.length>0?t.childNodes[0].childNodes:null,a;for(let s=0;s<n.length;s++){let l=n.item(s);if(l.name===d.indicationOfSubgrid&&l.value==="true"||l.name===d.classid&&(l.value?.toLocaleUpperCase()===`{${A.SubgridControl}}`||l.value?.toLocaleUpperCase()===`{${A.ReferencePanelSubgridControl}}`))a=vt.Grid;else if(l.name===d.classid&&l.value?.toLocaleUpperCase()===`{${A.LookupControl}}`)a=vt.Lookup;else if(l.name===d.classid&&l.value?.toLocaleUpperCase()===`{${A.CustomControl}}`)for(let u=0;u<i?.length;u++)i[u].nodeName===d.DefaultViewId&&(a=vt.Lookup)}return a===vt.Grid?new Jn(r):a===vt.Lookup?new Qn(r):new Ot(r);case h.formEvent:return new Hn(r,I.EmptyString);case h.dependency:return this.populateDependencyTable(t),new jn(r,I.EmptyString);case h.Handler:let o=[];return new hs(o,r);case h.formNavigation:return new ys(t.nodeName,r);case h.formNavBarArea:return new Yn(t.nodeName,r);case h.formNavBarAreas:return new Zn(t.nodeName,r);case h.formNavBar:return new gs(r);case h.formNavBarByRelationshipItem:return new vs(r);case h.formNavBarItem:return new bs(r);case h.formDisplayConditions:return new ms(r);case h.library:return new Xn(r,I.EmptyString,I.EmptyString);case h.controlDescription:return new Oo(r);case h.customControl:return this.populateCustomControlConfigurationId(t),new zo(r);default:return new rt(t.nodeName,r)}}populateDependencyTable(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);i.name===d.id&&this.upsertFieldCount(i.value,kt.DependencyFieldTable)}}populateCustomControlConfigurationId(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);if(i.name===d.id){let a=new E(i.value.substr(1,i.value.length-2));for(let o=0;o<t.parentNode.attributes.length;o++){let s=t.parentNode.attributes.item(o);if(s.name===d.ForControl){let l=s.value.substr(1,i.value.length-2);we.CustomControlIdMap.upsert(l,a);break}}break}}}}});var dA={};xt(dA,{SerializationService:()=>qc,SerializationServiceScope:()=>CM,SerializedFormElementNode:()=>ei});var CM,ei,qc,pA=S(()=>{"use strict";Ve();Oe();It();Rc();CM="SerializationService",ei=class extends q{fetchNodeName(){return this.getNodeName()}enumerateProperties(){return this.getAllProperties()}enumerateChildren(){return this.getAllChildren()}},qc=class{langCode;constructor(t){this.langCode=t}serializeFormXmlNode(t){let r=ei.prototype.fetchNodeName.call(t);if(r.charAt(0)===or.StartTag)return I.EscapeXml(r.substr(1),!1);if(t.isTransient&&!t.isDirty())return I.EmptyString;let n=ei.prototype.enumerateProperties.call(t),i=ei.prototype.enumerateChildren.call(t);if(!(t instanceof nn)){let a=`<${r}`;if(n.length!==0&&(a+=` ${this.getPropertiesString(n)}`),i.length===0)a+=" />";else{let o=I.EmptyString;for(let s of i)o+=this.serializeFormXmlNode(s);a+=`>${o}</${r}>`}return a}return I.EmptyString}getPropertiesString(t){let r=I.EmptyString;return t.forEach((n,i)=>{i!==0&&(r+=" "),r+=`${n.key}="${I.EscapeXml(n.value,!0)}"`}),r}}});var on=f(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.rebuildRaw=nt.assembleChildren=nt.spliceChildren=nt.mergeAttrs=nt.rawFromNode=nt.emptyBag=void 0;var Mr=_e(),fA=1e6,As=512;function AM(){return{a:[],c:[]}}nt.emptyBag=AM;function mA(e,t=0){if(t>As)throw new Mr.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${As}`);return{n:e.getNodeName(),a:e.getAllProperties().map(r=>[r.key,r.value]),c:e.getAllChildren().map(r=>mA(r,t+1))}}nt.rawFromNode=mA;function NM(e,t){let r=new Map;for(let[a,o]of t)r.set(a,o);let n=new Set,i=[];for(let[a,o]of e)r.has(a)?i.push([a,r.get(a)]):i.push([a,o]),n.add(a);for(let[a,o]of t)n.has(a)||(i.push([a,o]),n.add(a));return i}nt.mergeAttrs=NM;function Cs(e,t){let r=new Set;for(let s of e){let l=s.i;if(!Number.isInteger(l)||l<0||l>fA)throw new Mr.InvalidArgumentError(`Bag child index must be an integer in [0, ${fA}] (got ${String(l)})`);if(r.has(l))throw new Mr.InvalidArgumentError(`Duplicate bag child index ${l}`);r.add(l)}let n=[...e].sort((s,l)=>s.i-l.i),i=[],a=0,o=0;for(let s of n){for(;o<s.i&&a<t.length;)i.push(t[a]),a+=1,o+=1;o<s.i&&(o=s.i),i.push(s.node),o+=1}for(;a<t.length;)i.push(t[a]),a+=1;return i}nt.spliceChildren=Cs;function wM(e,t){if(e.w){let r={n:e.w.n,a:e.w.a.map(n=>[n[0],n[1]]),c:Cs(e.w.c,t)};return Cs(e.c,[r])}return Cs(e.c,t)}nt.assembleChildren=wM;function hA(e,t,r,n=0){if(n>As)throw new Mr.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${As}`);SM(e,n);let i=t.make(e.n,r);for(let[a,o]of e.a)t.setProp(i,a,o);for(let a of e.c)t.addChild(i,hA(a,t,i,n+1));return i}nt.rebuildRaw=hA;function SM(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new Mr.InvalidArgumentError(`Malformed hybrid node at depth ${t}: expected a JSON object`);let r=e;if(typeof r.n!="string")throw new Mr.InvalidArgumentError(`Malformed hybrid node at depth ${t}: 'n' (tag name) must be a string`);if(!Array.isArray(r.a)||!Array.isArray(r.c))throw new Mr.InvalidArgumentError(`Malformed hybrid node '${r.n}': 'a' and 'c' must be arrays`);for(let n of r.a)if(!Array.isArray(n)||n.length!==2||typeof n[0]!="string"||typeof n[1]!="string")throw new Mr.InvalidArgumentError(`Malformed hybrid node '${r.n}': each attribute must be a [string, string] pair`)}});var Br=f(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.childObjects=it.optionalGuidId=it.optionalEnum=it.eachObject=it.issue=it.isJsonObject=void 0;function gA(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}it.isJsonObject=gA;function Na(e,t,r,n){return n?{pointer:e,rule:t,message:r,fatal:n}:{pointer:e,rule:t,message:r}}it.issue=Na;function vA(e,t,r,n){if(!Array.isArray(e))return[];let i=[];return e.forEach((a,o)=>{gA(a)?i.push({node:a,index:o}):n.push(Na(`${t}/${o}`,`${r}-must-be-object`,`a ${r} must be a JSON object, got ${a===null?"null":typeof a}`))}),i}it.eachObject=vA;function DM(e,t,r,n,i,a){let o=e[t];o!==void 0&&(typeof o!="string"||!r.includes(o))&&a.push(Na(`${n}/${t}`,i,`${t} must be one of ${r.map(s=>`'${s}'`).join(", ")}, got ${JSON.stringify(o)}`))}it.optionalEnum=DM;var EM=/^(?:\{[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}\}|[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12})$/;function IM(e,t,r,n,i){let a=e[t];typeof a=="string"&&a!==""&&!EM.test(a)&&i.push(Na(`${r}/${t}`,n,`${t} must be a GUID or empty, got '${a}'`))}it.optionalGuidId=IM;function _M(e,t,r,n,i){let a=e[t],o=`${r}/${t}`;return a===void 0?[]:Array.isArray(a)?vA(a,o,n,i):(i.push(Na(o,`${n}-list-must-be-array`,`${t} must be an array when present, got ${typeof a}`)),[])}it.childObjects=_M});var bA=f(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.formApi=void 0;var ur=qe(),wa=ue(),PM="formid,formxml,name,type,objecttypecode,formpresentation,formactivationstate,uniquename,description,versionnumber",OM="formid,name,type,objecttypecode",FM=2;Ns.formApi={async get(e,t){let n=`/systemforms(${(0,wa.normalizeGuid)(t,"id")})${(0,wa.odataQuery)([["$select",PM]])}`,i=(0,ur.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,ur.readEtag)(i)}},async list(e,t){var r;let n=[`type eq ${FM}`];t?.entityLogicalName&&n.push(`objecttypecode eq '${(0,wa.odataLiteral)(t.entityLogicalName)}'`);let i=`/systemforms${(0,wa.odataQuery)([["$select",OM],["$filter",n.join(" and ")]])}`,o=(0,ur.ensureSuccess)(await e.get(i),e.apiUrl(i)).body;return((r=o?.value)!==null&&r!==void 0?r:[]).map(l=>{var u,c;return{type:"form",id:(u=l.formid)!==null&&u!==void 0?u:"",name:(c=l.name)!==null&&c!==void 0?c:"",entityLogicalName:l.objecttypecode,isDirty:!1}})},async create(e,t){let r="/systemforms",n=(0,ur.ensureSuccess)(await e.post(r,t),e.apiUrl(r));return{id:(0,ur.requireCreatedId)(n,"formid","form"),etag:(0,ur.readEtag)(n)}},async update(e,t,r,n){let i=(0,wa.normalizeGuid)(t,"id"),a=`/systemforms(${i})`,o=n?{"If-Match":n}:void 0,s=(0,ur.ensureSuccess)(await e.patch(a,r,o?{headers:o}:void 0),e.apiUrl(a));return{id:i,etag:(0,ur.readEtag)(s)}},delete(e,t){return(0,ur.deleteRecord)(e,"systemforms",t)}}});var yA=f($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var CA=f(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.default="00000000-0000-0000-0000-000000000000"});var AA=f(Gc=>{"use strict";Object.defineProperty(Gc,"__esModule",{value:!0});Gc.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var Sa=f(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});var RM=AA();function TM(e){return typeof e=="string"&&RM.default.test(e)}zc.default=TM});var Da=f(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});var xM=Sa();function LM(e){if(!(0,xM.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}Wc.default=LM});var cr=f(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.unsafeStringify=void 0;var UM=Sa(),Ue=[];for(let e=0;e<256;++e)Ue.push((e+256).toString(16).slice(1));function NA(e,t=0){return(Ue[e[t+0]]+Ue[e[t+1]]+Ue[e[t+2]]+Ue[e[t+3]]+"-"+Ue[e[t+4]]+Ue[e[t+5]]+"-"+Ue[e[t+6]]+Ue[e[t+7]]+"-"+Ue[e[t+8]]+Ue[e[t+9]]+"-"+Ue[e[t+10]]+Ue[e[t+11]]+Ue[e[t+12]]+Ue[e[t+13]]+Ue[e[t+14]]+Ue[e[t+15]]).toLowerCase()}Ea.unsafeStringify=NA;function MM(e,t=0){let r=NA(e,t);if(!(0,UM.default)(r))throw TypeError("Stringified UUID is invalid");return r}Ea.default=MM});var Ds=f(jc=>{"use strict";Object.defineProperty(jc,"__esModule",{value:!0});var BM=require("crypto"),Ss=new Uint8Array(256),ws=Ss.length;function kM(){return ws>Ss.length-16&&((0,BM.randomFillSync)(Ss),ws=0),Ss.slice(ws,ws+=16)}jc.default=kM});var Hc=f(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.updateV1State=void 0;var wA=Ds(),qM=cr(),Ia={};function $M(e,t,r){let n,i=e?._v6??!1;if(e){let a=Object.keys(e);a.length===1&&a[0]==="_v6"&&(e=void 0)}if(e)n=SA(e.random??e.rng?.()??(0,wA.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{let a=Date.now(),o=(0,wA.default)();DA(Ia,a,o),n=SA(o,Ia.msecs,Ia.nsecs,i?void 0:Ia.clockseq,i?void 0:Ia.node,t,r)}return t??(0,qM.unsafeStringify)(n)}function DA(e,t,r){return e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=(r[8]<<8|r[9])&16383),e.msecs=t,e}_a.updateV1State=DA;function SA(e,t,r,n,i,a,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!a)a=new Uint8Array(16),o=0;else if(o<0||o+16>a.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);t??=Date.now(),r??=0,n??=(e[8]<<8|e[9])&16383,i??=e.slice(10,16),t+=122192928e5;let s=((t&268435455)*1e4+r)%4294967296;a[o++]=s>>>24&255,a[o++]=s>>>16&255,a[o++]=s>>>8&255,a[o++]=s&255;let l=t/4294967296*1e4&268435455;a[o++]=l>>>8&255,a[o++]=l&255,a[o++]=l>>>24&15|16,a[o++]=l>>>16&255,a[o++]=n>>>8|128,a[o++]=n&255;for(let u=0;u<6;++u)a[o++]=i[u];return a}_a.default=$M});var Qc=f(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});var VM=Da(),GM=cr();function zM(e){let t=typeof e=="string"?(0,VM.default)(e):e,r=WM(t);return typeof e=="string"?(0,GM.unsafeStringify)(r):r}Jc.default=zM;function WM(e){return Uint8Array.of((e[6]&15)<<4|e[7]>>4&15,(e[7]&15)<<4|(e[4]&240)>>4,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,(e[1]&15)<<4|(e[2]&240)>>4,96|e[2]&15,e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var EA=f(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});var jM=require("crypto");function HM(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),(0,jM.createHash)("md5").update(e).digest()}Xc.default=HM});var Pa=f(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.URL=dr.DNS=dr.stringToBytes=void 0;var IA=Da(),JM=cr();function _A(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}dr.stringToBytes=_A;dr.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";dr.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function QM(e,t,r,n,i,a){let o=typeof r=="string"?_A(r):r,s=typeof n=="string"?(0,IA.default)(n):n;if(typeof n=="string"&&(n=(0,IA.default)(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(s),l.set(o,s.length),l=t(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,i){if(a=a||0,a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let u=0;u<16;++u)i[a+u]=l[u];return i}return(0,JM.unsafeStringify)(l)}dr.default=QM});var OA=f(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.URL=sn.DNS=void 0;var XM=EA(),Kc=Pa(),PA=Pa();Object.defineProperty(sn,"DNS",{enumerable:!0,get:function(){return PA.DNS}});Object.defineProperty(sn,"URL",{enumerable:!0,get:function(){return PA.URL}});function Yc(e,t,r,n){return(0,Kc.default)(48,XM.default,e,t,r,n)}Yc.DNS=Kc.DNS;Yc.URL=Kc.URL;sn.default=Yc});var FA=f(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});var KM=require("crypto");Zc.default={randomUUID:KM.randomUUID}});var TA=f(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});var RA=FA(),YM=Ds(),ZM=cr();function eB(e,t,r){if(RA.default.randomUUID&&!t&&!e)return RA.default.randomUUID();e=e||{};let n=e.random??e.rng?.()??(0,YM.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return(0,ZM.unsafeStringify)(n)}ed.default=eB});var xA=f(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});var tB=require("crypto");function rB(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),(0,tB.createHash)("sha1").update(e).digest()}td.default=rB});var UA=f(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.URL=ln.DNS=void 0;var nB=xA(),rd=Pa(),LA=Pa();Object.defineProperty(ln,"DNS",{enumerable:!0,get:function(){return LA.DNS}});Object.defineProperty(ln,"URL",{enumerable:!0,get:function(){return LA.URL}});function nd(e,t,r,n){return(0,rd.default)(80,nB.default,e,t,r,n)}nd.DNS=rd.DNS;nd.URL=rd.URL;ln.default=nd});var MA=f(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});var iB=cr(),aB=Hc(),oB=Qc();function sB(e,t,r){e??={},r??=0;let n=(0,aB.default)({...e,_v6:!0},new Uint8Array(16));if(n=(0,oB.default)(n),t){if(r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;i++)t[r+i]=n[i];return t}return(0,iB.unsafeStringify)(n)}id.default=sB});var BA=f(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});var lB=Da(),uB=cr();function cB(e){let t=typeof e=="string"?(0,lB.default)(e):e,r=dB(t);return typeof e=="string"?(0,uB.unsafeStringify)(r):r}ad.default=cB;function dB(e){return Uint8Array.of((e[3]&15)<<4|e[4]>>4&15,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|e[6]&15,e[7],(e[1]&15)<<4|(e[2]&240)>>4,(e[2]&15)<<4|(e[3]&240)>>4,16|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var VA=f(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.updateV7State=void 0;var kA=Ds(),pB=cr(),od={};function fB(e,t,r){let n;if(e)n=qA(e.random??e.rng?.()??(0,kA.default)(),e.msecs,e.seq,t,r);else{let i=Date.now(),a=(0,kA.default)();$A(od,i,a),n=qA(a,od.msecs,od.seq,t,r)}return t??(0,pB.unsafeStringify)(n)}function $A(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}Oa.updateV7State=$A;function qA(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}Oa.default=fB});var GA=f(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});var mB=Sa();function hB(e){if(!(0,mB.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}sd.default=hB});var ld=f(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.version=J.validate=J.v7=J.v6ToV1=J.v6=J.v5=J.v4=J.v3=J.v1ToV6=J.v1=J.stringify=J.parse=J.NIL=J.MAX=void 0;var gB=yA();Object.defineProperty(J,"MAX",{enumerable:!0,get:function(){return gB.default}});var vB=CA();Object.defineProperty(J,"NIL",{enumerable:!0,get:function(){return vB.default}});var bB=Da();Object.defineProperty(J,"parse",{enumerable:!0,get:function(){return bB.default}});var yB=cr();Object.defineProperty(J,"stringify",{enumerable:!0,get:function(){return yB.default}});var CB=Hc();Object.defineProperty(J,"v1",{enumerable:!0,get:function(){return CB.default}});var AB=Qc();Object.defineProperty(J,"v1ToV6",{enumerable:!0,get:function(){return AB.default}});var NB=OA();Object.defineProperty(J,"v3",{enumerable:!0,get:function(){return NB.default}});var wB=TA();Object.defineProperty(J,"v4",{enumerable:!0,get:function(){return wB.default}});var SB=UA();Object.defineProperty(J,"v5",{enumerable:!0,get:function(){return SB.default}});var DB=MA();Object.defineProperty(J,"v6",{enumerable:!0,get:function(){return DB.default}});var EB=BA();Object.defineProperty(J,"v6ToV1",{enumerable:!0,get:function(){return EB.default}});var IB=VA();Object.defineProperty(J,"v7",{enumerable:!0,get:function(){return IB.default}});var _B=Sa();Object.defineProperty(J,"validate",{enumerable:!0,get:function(){return _B.default}});var PB=GA();Object.defineProperty(J,"version",{enumerable:!0,get:function(){return PB.default}})});var zt=f(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.assignMissingIds=ti.newId=void 0;var OB=ld();function zA(){return(0,OB.v4)()}ti.newId=zA;function FB(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var RB=new Set(["parameters","bag"]);function TB(e){return ud(e),e}ti.assignMissingIds=TB;function ud(e){if(Array.isArray(e)){e.forEach(t=>ud(t));return}if(FB(e)){(typeof e.id!="string"||e.id.length===0)&&(e.id=zA());for(let t of Object.keys(e))t==="id"||RB.has(t)||ud(e[t])}}});var Fa=f(ri=>{"use strict";function xB(e,t,r){if(r===void 0&&(r=Array.prototype),e&&typeof r.find=="function")return r.find.call(e,t);for(var n=0;n<e.length;n++)if(Object.prototype.hasOwnProperty.call(e,n)){var i=e[n];if(t.call(void 0,i,n,e))return i}}function cd(e,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(e):e}function LB(e,t){if(e===null||typeof e!="object")throw new TypeError("target is not an object");for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}var WA=cd({HTML:"text/html",isHTML:function(e){return e===WA.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),jA=cd({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===jA.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});ri.assign=LB;ri.find=xB;ri.freeze=cd;ri.MIME_TYPE=WA;ri.NAMESPACE=jA});var Nd=f(hr=>{var e2=Fa(),Wt=e2.find,Ra=e2.NAMESPACE;function UB(e){return e!==""}function MB(e){return e?e.split(/[\t\n\f\r ]+/).filter(UB):[]}function BB(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function HA(e){if(!e)return[];var t=MB(e);return Object.keys(t.reduce(BB,{}))}function kB(e){return function(t){return e&&e.indexOf(t)!==-1}}function xa(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function ot(e,t){var r=e.prototype;if(!(r instanceof t)){let i=function(){};var n=i;i.prototype=t.prototype,i=new i,xa(r,i),e.prototype=r=i}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var st={},bt=st.ELEMENT_NODE=1,ii=st.ATTRIBUTE_NODE=2,Is=st.TEXT_NODE=3,t2=st.CDATA_SECTION_NODE=4,r2=st.ENTITY_REFERENCE_NODE=5,qB=st.ENTITY_NODE=6,dd=st.PROCESSING_INSTRUCTION_NODE=7,pd=st.COMMENT_NODE=8,n2=st.DOCUMENT_NODE=9,i2=st.DOCUMENT_TYPE_NODE=10,pr=st.DOCUMENT_FRAGMENT_NODE=11,$B=st.NOTATION_NODE=12,ze={},Re={},rJ=ze.INDEX_SIZE_ERR=(Re[1]="Index size error",1),nJ=ze.DOMSTRING_SIZE_ERR=(Re[2]="DOMString size error",2),at=ze.HIERARCHY_REQUEST_ERR=(Re[3]="Hierarchy request error",3),iJ=ze.WRONG_DOCUMENT_ERR=(Re[4]="Wrong document",4),VB=ze.INVALID_CHARACTER_ERR=(Re[5]="Invalid character",5),aJ=ze.NO_DATA_ALLOWED_ERR=(Re[6]="No data allowed",6),oJ=ze.NO_MODIFICATION_ALLOWED_ERR=(Re[7]="No modification allowed",7),a2=ze.NOT_FOUND_ERR=(Re[8]="Not found",8),sJ=ze.NOT_SUPPORTED_ERR=(Re[9]="Not supported",9),JA=ze.INUSE_ATTRIBUTE_ERR=(Re[10]="Attribute in use",10),ni=ze.INVALID_STATE_ERR=(Re[11]="Invalid state",11),lJ=ze.SYNTAX_ERR=(Re[12]="Syntax error",12),uJ=ze.INVALID_MODIFICATION_ERR=(Re[13]="Invalid modification",13),cJ=ze.NAMESPACE_ERR=(Re[14]="Invalid namespace",14),dJ=ze.INVALID_ACCESS_ERR=(Re[15]="Invalid access",15);function ee(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,Re[e]),this.message=Re[e],Error.captureStackTrace&&Error.captureStackTrace(this,ee);return r.code=e,t&&(this.message=this.message+": "+t),r}ee.prototype=Error.prototype;xa(ze,ee);function fr(){}fr.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t,r){for(var n=!!r&&!!r.requireWellFormed,i=[],a=0;a<this.length;a++)Ad(this[a],i,e,t,null,n);return i.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}};function ai(e,t){this._node=e,this._refresh=t,fd(this)}function fd(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(v2(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)Object.prototype.hasOwnProperty.call(e,n)&&delete e[n];xa(r,e),e._inc=t}}ai.prototype.item=function(e){return fd(this),this[e]||null};ot(ai,fr);function _s(){}function o2(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function QA(e,t,r,n){if(n?t[o2(t,n)]=r:t[t.length++]=r,e){r.ownerElement=e;var i=e.ownerDocument;i&&(n&&u2(i,e,n),GB(i,e,r))}}function XA(e,t,r){var n=o2(t,r);if(n>=0){for(var i=t.length-1;n<i;)t[n]=t[++n];if(t.length=i,e){var a=e.ownerDocument;a&&(u2(a,e,r),r.ownerElement=null)}}else throw new ee(a2,new Error(e.tagName+"@"+r))}_s.prototype={length:0,item:fr.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new ee(JA);var r=this.getNamedItem(e.nodeName);return QA(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t=e.ownerElement,r;if(t&&t!=this._ownerElement)throw new ee(JA);return r=this.getNamedItemNS(e.namespaceURI,e.localName),QA(this._ownerElement,this,e,r),r},removeNamedItem:function(e){var t=this.getNamedItem(e);return XA(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return XA(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var n=this[r];if(n.localName==t&&n.namespaceURI==e)return n}return null}};function s2(){}s2.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new La;if(n.implementation=this,n.childNodes=new fr,n.doctype=r||null,r&&n.appendChild(r),t){var i=n.createElementNS(e,t);n.appendChild(i)}return n},createDocumentType:function(e,t,r){var n=new Rs;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n}};function K(){}K.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return Os(this,e,t)},replaceChild:function(e,t){Os(this,e,t,d2),t&&this.removeChild(t)},removeChild:function(e){return c2(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return g2(this.ownerDocument||this,this,e)},normalize:function(){Fe(this,null,{enter:function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;r!==null&&r.nodeType===Is&&t.nodeType===Is?(e.removeChild(r),t.appendData(r.data)):t=r}return!0}})},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&r[n]===e)return n}t=t.nodeType==ii?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==ii?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return t==null}};function l2(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}xa(st,K);xa(st,K.prototype);function Ps(e,t){return Fe(e,null,{enter:function(r){return t(r)?Fe.STOP:!0}})===Fe.STOP}function Fe(e,t,r){for(var n=[{node:e,context:t,phase:Fe.ENTER}];n.length>0;){var i=n.pop();if(i.phase===Fe.ENTER){var a=r.enter(i.node,i.context);if(a===Fe.STOP)return Fe.STOP;if(n.push({node:i.node,context:a,phase:Fe.EXIT}),a==null)continue;for(var o=i.node.lastChild;o;)n.push({node:o,context:a,phase:Fe.ENTER}),o=o.previousSibling}else r.exit&&r.exit(i.node,i.context)}}Fe.STOP=Symbol("walkDOM.STOP");Fe.ENTER=0;Fe.EXIT=1;function La(){this.ownerDocument=this}function GB(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===Ra.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function u2(e,t,r,n){e&&e._inc++;var i=r.namespaceURI;i===Ra.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function md(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r)n[n.length++]=r;else{for(var i=t.firstChild,a=0;i;)n[a++]=i,i=i.nextSibling;n.length=a,delete n[n.length]}}}function c2(e,t){var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,md(e.ownerDocument,e),t}function zB(e){return e&&(e.nodeType===K.DOCUMENT_NODE||e.nodeType===K.DOCUMENT_FRAGMENT_NODE||e.nodeType===K.ELEMENT_NODE)}function WB(e){return e&&(jt(e)||hd(e)||mr(e)||e.nodeType===K.DOCUMENT_FRAGMENT_NODE||e.nodeType===K.COMMENT_NODE||e.nodeType===K.PROCESSING_INSTRUCTION_NODE)}function mr(e){return e&&e.nodeType===K.DOCUMENT_TYPE_NODE}function jt(e){return e&&e.nodeType===K.ELEMENT_NODE}function hd(e){return e&&e.nodeType===K.TEXT_NODE}function KA(e,t){var r=e.childNodes||[];if(Wt(r,jt)||mr(t))return!1;var n=Wt(r,mr);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function YA(e,t){var r=e.childNodes||[];function n(a){return jt(a)&&a!==t}if(Wt(r,n))return!1;var i=Wt(r,mr);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function jB(e,t,r){if(!zB(e))throw new ee(at,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new ee(a2,"child not in parent");if(!WB(t)||mr(t)&&e.nodeType!==K.DOCUMENT_NODE)throw new ee(at,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function HB(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===K.DOCUMENT_FRAGMENT_NODE){var a=i.filter(jt);if(a.length>1||Wt(i,hd))throw new ee(at,"More than one element or text in fragment");if(a.length===1&&!KA(e,r))throw new ee(at,"Element in fragment can not be inserted before doctype")}if(jt(t)&&!KA(e,r))throw new ee(at,"Only one element can be added and only after doctype");if(mr(t)){if(Wt(n,mr))throw new ee(at,"Only one doctype is allowed");var o=Wt(n,jt);if(r&&n.indexOf(o)<n.indexOf(r))throw new ee(at,"Doctype can only be inserted before an element");if(!r&&o)throw new ee(at,"Doctype can not be appended since element is present")}}function d2(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===K.DOCUMENT_FRAGMENT_NODE){var a=i.filter(jt);if(a.length>1||Wt(i,hd))throw new ee(at,"More than one element or text in fragment");if(a.length===1&&!YA(e,r))throw new ee(at,"Element in fragment can not be inserted before doctype")}if(jt(t)&&!YA(e,r))throw new ee(at,"Only one element can be added and only after doctype");if(mr(t)){let l=function(u){return mr(u)&&u!==r};var s=l;if(Wt(n,l))throw new ee(at,"Only one doctype is allowed");var o=Wt(n,jt);if(r&&n.indexOf(o)<n.indexOf(r))throw new ee(at,"Doctype can only be inserted before an element")}}function Os(e,t,r,n){jB(e,t,r),e.nodeType===K.DOCUMENT_NODE&&(n||HB)(e,t,r);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===pr){var a=t.firstChild;if(a==null)return t;var o=t.lastChild}else a=o=t;var s=r?r.previousSibling:e.lastChild;a.previousSibling=s,o.nextSibling=r,s?s.nextSibling=a:e.firstChild=a,r==null?e.lastChild=o:r.previousSibling=o;do{a.parentNode=e;var l=e.ownerDocument||e;Ta(a,l)}while(a!==o&&(a=a.nextSibling));return md(e.ownerDocument||e,e),t.nodeType==pr&&(t.firstChild=t.lastChild=null),t}function Ta(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===bt&&e.attributes)for(var r=0;r<e.attributes.length;r++){var n=e.attributes.item(r);n&&(n.ownerDocument=t)}for(var i=e.firstChild;i;)Ta(i,t),i=i.nextSibling}}function JB(e,t){t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,md(e.ownerDocument,e,t);var r=e.ownerDocument||e;return Ta(t,r),t}La.prototype={nodeName:"#document",nodeType:n2,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==pr){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return Os(this,e,t),Ta(e,this),this.documentElement===null&&e.nodeType===bt&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),c2(this,e)},replaceChild:function(e,t){Os(this,e,t,d2),Ta(e,this),t&&this.removeChild(t),jt(e)&&(this.documentElement=e)},importNode:function(e,t){return QB(this,e,t)},getElementById:function(e){var t=null;return Ps(this.documentElement,function(r){if(r.nodeType==bt&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=HA(e);return new ai(this,function(r){var n=[];return t.length>0&&Ps(r.documentElement,function(i){if(i!==r&&i.nodeType===bt){var a=i.getAttribute("class");if(a){var o=e===a;if(!o){var s=HA(a);o=t.every(kB(s))}o&&n.push(i)}}}),n})},createElement:function(e){var t=new un;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new fr;var r=t.attributes=new _s;return r._ownerElement=t,t},createDocumentFragment:function(){var e=new Ts;return e.ownerDocument=this,e.childNodes=new fr,e},createTextNode:function(e){var t=new gd;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new vd;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new ee(VB,'data contains "]]>"');var t=new bd;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new Cd;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new Fs;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new yd;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new un,n=t.split(":"),i=r.attributes=new _s;return r.childNodes=new fr,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,i._ownerElement=r,r},createAttributeNS:function(e,t){var r=new Fs,n=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,r}};ot(La,K);function un(){this._nsMap={}}un.prototype={nodeType:bt,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===pr?this.insertBefore(e,null):JB(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return this.getAttributeNodeNS(e,t)!=null},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+r,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new ai(this,function(t){var r=[];return Ps(t,function(n){n!==t&&n.nodeType==bt&&(e==="*"||n.tagName==e)&&r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new ai(this,function(r){var n=[];return Ps(r,function(i){i!==r&&i.nodeType===bt&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};La.prototype.getElementsByTagName=un.prototype.getElementsByTagName;La.prototype.getElementsByTagNameNS=un.prototype.getElementsByTagNameNS;ot(un,K);function Fs(){}Fs.prototype.nodeType=ii;ot(Fs,K);function Ua(){}Ua.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(Re[at])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){var n=this.data.substring(0,e),i=this.data.substring(e+t);r=n+r+i,this.nodeValue=this.data=r,this.length=r.length}};ot(Ua,K);function gd(){}gd.prototype={nodeName:"#text",nodeType:Is,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};ot(gd,Ua);function vd(){}vd.prototype={nodeName:"#comment",nodeType:pd};ot(vd,Ua);function bd(){}bd.prototype={nodeName:"#cdata-section",nodeType:t2};ot(bd,Ua);function Rs(){}Rs.prototype.nodeType=i2;ot(Rs,K);function p2(){}p2.prototype.nodeType=$B;ot(p2,K);function f2(){}f2.prototype.nodeType=qB;ot(f2,K);function yd(){}yd.prototype.nodeType=r2;ot(yd,K);function Ts(){}Ts.prototype.nodeName="#document-fragment";Ts.prototype.nodeType=pr;ot(Ts,K);function Cd(){}Cd.prototype.nodeType=dd;ot(Cd,K);function m2(){}m2.prototype.serializeToString=function(e,t,r,n){return h2.call(e,t,r,n)};K.prototype.toString=h2;function h2(e,t,r){var n=!!r&&!!r.requireWellFormed,i=[],a=this.nodeType==9&&this.documentElement||this,o=a.prefix,s=a.namespaceURI;if(s&&o==null){var o=a.lookupPrefix(s);if(o==null)var l=[{namespace:s,prefix:null}]}return Ad(this,i,e,t,l,n),i.join("")}function ZA(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!i||n==="xml"&&i===Ra.XML||i===Ra.XMLNS)return!1;for(var a=r.length;a--;){var o=r[a];if(o.prefix===n)return o.namespace!==i}return!0}function Es(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,l2),'"')}function Ad(e,t,r,n,i,a){i||(i=[]),Fe(e,{ns:i,isHTML:r},{enter:function(o,s){var l=s.ns,u=s.isHTML;if(n)if(o=n(o),o){if(typeof o=="string")return t.push(o),null}else return null;switch(o.nodeType){case bt:var c=o.attributes,p=c.length,m=o.tagName;u=Ra.isHTML(o.namespaceURI)||u;var v=m;if(!u&&!o.prefix&&o.namespaceURI){for(var C,w=0;w<c.length;w++)if(c.item(w).name==="xmlns"){C=c.item(w).value;break}if(!C)for(var P=l.length-1;P>=0;P--){var x=l[P];if(x.prefix===""&&x.namespace===o.namespaceURI){C=x.namespace;break}}if(C!==o.namespaceURI)for(var P=l.length-1;P>=0;P--){var x=l[P];if(x.namespace===o.namespaceURI){x.prefix&&(v=x.prefix+":"+m);break}}}t.push("<",v);for(var M=l.slice(),T=0;T<p;T++){var L=c.item(T);L.prefix=="xmlns"?M.push({prefix:L.localName,namespace:L.value}):L.nodeName=="xmlns"&&M.push({prefix:"",namespace:L.value})}for(var T=0;T<p;T++){var L=c.item(T);if(ZA(L,u,M)){var Q=L.prefix||"",B=L.namespaceURI;Es(t,Q?"xmlns:"+Q:"xmlns",B),M.push({prefix:Q,namespace:B})}var W=n?n(L):L;W&&(typeof W=="string"?t.push(W):Es(t,W.name,W.value))}if(m===v&&ZA(o,u,M)){var k=o.prefix||"",B=o.namespaceURI;Es(t,k?"xmlns:"+k:"xmlns",B),M.push({prefix:k,namespace:B})}var $=o.firstChild;if($||u&&!/^(?:meta|link|img|br|hr|input)$/i.test(m)){if(t.push(">"),u&&/^script$/i.test(m)){for(;$;)$.data?t.push($.data):Ad($,t,u,n,M.slice(),a),$=$.nextSibling;return t.push("</",m,">"),null}return{ns:M,isHTML:u,tag:v}}else return t.push("/>"),null;case n2:case pr:return{ns:l.slice(),isHTML:u,tag:null};case ii:return Es(t,o.name,o.value),null;case Is:return t.push(o.data.replace(/[<&>]/g,l2)),null;case t2:if(a&&o.data.indexOf("]]>")!==-1)throw new ee(ni,'The CDATASection data contains "]]>"');return t.push("<![CDATA[",o.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case pd:if(a&&o.data.indexOf("-->")!==-1)throw new ee(ni,'The comment node data contains "-->"');return t.push("<!--",o.data,"-->"),null;case i2:if(a){if(o.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(o.publicId))throw new ee(ni,"DocumentType publicId is not a valid PubidLiteral");if(o.systemId&&!/^("[^"]*"|'[^']*')$/.test(o.systemId))throw new ee(ni,"DocumentType systemId is not a valid SystemLiteral");if(o.internalSubset&&o.internalSubset.indexOf("]>")!==-1)throw new ee(ni,'DocumentType internalSubset contains "]>"')}var re=o.publicId,j=o.systemId;if(t.push("<!DOCTYPE ",o.name),re)t.push(" PUBLIC ",re),j&&j!="."&&t.push(" ",j),t.push(">");else if(j&&j!=".")t.push(" SYSTEM ",j,">");else{var er=o.internalSubset;er&&t.push(" [",er,"]"),t.push(">")}return null;case dd:if(a&&o.data.indexOf("?>")!==-1)throw new ee(ni,'The ProcessingInstruction data contains "?>"');return t.push("<?",o.target," ",o.data,"?>"),null;case r2:return t.push("&",o.nodeName,";"),null;default:return t.push("??",o.nodeName),null}},exit:function(o,s){s&&s.tag&&t.push("</",s.tag,">")}})}function QB(e,t,r){var n;return Fe(t,null,{enter:function(i,a){var o=i.cloneNode(!1);o.ownerDocument=e,o.parentNode=null,a===null?n=o:a.appendChild(o);var s=i.nodeType===ii||r;return s?o:null}}),n}function g2(e,t,r){var n;return Fe(t,null,{enter:function(i,a){var o=new i.constructor;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){var l=i[s];typeof l!="object"&&l!=o[s]&&(o[s]=l)}i.childNodes&&(o.childNodes=new fr),o.ownerDocument=e;var u=r;switch(o.nodeType){case bt:var c=i.attributes,p=o.attributes=new _s,m=c.length;p._ownerElement=o;for(var v=0;v<m;v++)o.setAttributeNode(g2(e,c.item(v),!0));break;case ii:u=!0}return a!==null?a.appendChild(o):n=o,u?o:null}}),n}function v2(e,t,r){e[t]=r}try{Object.defineProperty&&(Object.defineProperty(ai.prototype,"length",{get:function(){return fd(this),this.$$length}}),Object.defineProperty(K.prototype,"textContent",{get:function(){if(this.nodeType===bt||this.nodeType===pr){var e=[];return Fe(this,null,{enter:function(t){if(t.nodeType===bt||t.nodeType===pr)return!0;if(t.nodeType===dd||t.nodeType===pd)return null;e.push(t.nodeValue)}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case bt:case pr:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),v2=function(e,t,r){e["$$"+t]=r})}catch{}hr.DocumentType=Rs;hr.DOMException=ee;hr.DOMImplementation=s2;hr.Element=un;hr.Node=K;hr.NodeList=fr;hr.walkDOM=Fe;hr.XMLSerializer=m2});var y2=f(Ma=>{"use strict";var b2=Fa().freeze;Ma.XML_ENTITIES=b2({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});Ma.HTML_ENTITIES=b2({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`-`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});Ma.entityMap=Ma.HTML_ENTITIES});var I2=f(Sd=>{var $a=Fa().NAMESPACE,wd=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,C2=new RegExp("[\\-\\.0-9"+wd.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),A2=new RegExp("^"+wd.source+C2.source+"*(?::"+wd.source+C2.source+"*)?$"),Ba=0,kr=1,oi=2,ka=3,si=4,li=5,qa=6,xs=7;function ui(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,ui)}ui.prototype=new Error;ui.prototype.name=ui.name;function S2(){}S2.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),D2(t,t={}),XB(e,t,r,n,this.errorHandler),n.endDocument()}};function XB(e,t,r,n,i){function a(le){if(le>65535){le-=65536;var Ze=55296+(le>>10),Nl=56320+(le&1023);return String.fromCharCode(Ze,Nl)}else return String.fromCharCode(le)}function o(le){var Ze=le.slice(1,-1);return Object.hasOwnProperty.call(r,Ze)?r[Ze]:Ze.charAt(0)==="#"?a(parseInt(Ze.substr(1).replace("x","0x"))):(i.error("entity not found:"+le),le)}function s(le){if(le>w){var Ze=e.substring(w,le).replace(/&#?\w+;/g,o);m&&l(w),n.characters(Ze,0,le-w),w=le}}function l(le,Ze){for(;le>=c&&(Ze=p.exec(e));)u=Ze.index,c=u+Ze[0].length,m.lineNumber++;m.columnNumber=le-u+1}for(var u=0,c=0,p=/.*(?:\r\n?|\n)|.*$/g,m=n.locator,v=[{currentNSMap:t}],C={},w=0;;){try{var P=e.indexOf("<",w);if(P<0){if(!e.substr(w).match(/^\s*$/)){var x=n.doc,M=x.createTextNode(e.substr(w));x.appendChild(M),n.currentElement=M}return}switch(P>w&&s(P),e.charAt(P+1)){case"/":var j=e.indexOf(">",P+3),T=e.substring(P+2,j).replace(/[ \t\n\r]+$/g,""),L=v.pop();j<0?(T=e.substring(P+2).replace(/[\s<].*/,""),i.error("end tag name: "+T+" is not complete:"+L.tagName),j=P+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),i.error("end tag name: "+T+" maybe not complete"),j=P+1+T.length);var Q=L.localNSMap,B=L.tagName==T,W=B||L.tagName&&L.tagName.toLowerCase()==T.toLowerCase();if(W){if(n.endElement(L.uri,L.localName,T),Q)for(var k in Q)Object.prototype.hasOwnProperty.call(Q,k)&&n.endPrefixMapping(k);B||i.fatalError("end tag name: "+T+" is not match the current start tagName:"+L.tagName)}else v.push(L);j++;break;case"?":m&&l(P),j=tk(e,P,n);break;case"!":m&&l(P),j=ek(e,P,n,i);break;default:m&&l(P);var $=new E2,re=v[v.length-1].currentNSMap,j=KB(e,P,$,re,o,i),er=$.length;if(!$.closed&&ZB(e,j,$.tagName,C)&&($.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),m&&er){for(var Al=N2(m,{}),Ei=0;Ei<er;Ei++){var no=$[Ei];l(no.offset),no.locator=N2(m,{})}n.locator=Al,w2($,n,re)&&v.push($),n.locator=m}else w2($,n,re)&&v.push($);$a.isHTML($.uri)&&!$.closed?j=YB(e,j,$.tagName,o,n):j++}}catch(le){if(le instanceof ui)throw le;i.error("element parse error: "+le),j=-1}j>w?w=j:s(Math.max(P,w)+1)}}function N2(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function KB(e,t,r,n,i,a){function o(v,C,w){r.attributeNames.hasOwnProperty(v)&&a.fatalError("Attribute "+v+" redefined"),r.addValue(v,C.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),w)}for(var s,l,u=++t,c=Ba;;){var p=e.charAt(u);switch(p){case"=":if(c===kr)s=e.slice(t,u),c=ka;else if(c===oi)c=ka;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===ka||c===kr)if(c===kr&&(a.warning('attribute value must after "="'),s=e.slice(t,u)),t=u+1,u=e.indexOf(p,t),u>0)l=e.slice(t,u),o(s,l,t-1),c=li;else throw new Error("attribute value no end '"+p+"' match");else if(c==si)l=e.slice(t,u),o(s,l,t),a.warning('attribute "'+s+'" missed start quot('+p+")!!"),t=u+1,c=li;else throw new Error('attribute value must after "="');break;case"/":switch(c){case Ba:r.setTagName(e.slice(t,u));case li:case qa:case xs:c=xs,r.closed=!0;case si:case kr:break;case oi:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),c==Ba&&r.setTagName(e.slice(t,u)),u;case">":switch(c){case Ba:r.setTagName(e.slice(t,u));case li:case qa:case xs:break;case si:case kr:l=e.slice(t,u),l.slice(-1)==="/"&&(r.closed=!0,l=l.slice(0,-1));case oi:c===oi&&(l=s),c==si?(a.warning('attribute "'+l+'" missed quot(")!'),o(s,l,t)):((!$a.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),o(l,l,t));break;case ka:throw new Error("attribute value missed!!")}return u;case"\x80":p=" ";default:if(p<=" ")switch(c){case Ba:r.setTagName(e.slice(t,u)),c=qa;break;case kr:s=e.slice(t,u),c=oi;break;case si:var l=e.slice(t,u);a.warning('attribute "'+l+'" missed quot(")!!'),o(s,l,t);case li:c=qa;break}else switch(c){case oi:var m=r.tagName;(!$a.isHTML(n[""])||!s.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=u,c=kr;break;case li:a.warning('attribute space is required"'+s+'"!!');case qa:c=kr,t=u;break;case ka:c=si,t=u;break;case xs:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function w2(e,t,r){for(var n=e.tagName,i=null,p=e.length;p--;){var a=e[p],o=a.qName,s=a.value,m=o.indexOf(":");if(m>0)var l=a.prefix=o.slice(0,m),u=o.slice(m+1),c=l==="xmlns"&&u;else u=o,l=null,c=o==="xmlns"&&"";a.localName=u,c!==!1&&(i==null&&(i={},D2(r,r={})),r[c]=i[c]=s,a.uri=$a.XMLNS,t.startPrefixMapping(c,s))}for(var p=e.length;p--;){a=e[p];var l=a.prefix;l&&(l==="xml"&&(a.uri=$a.XML),l!=="xmlns"&&(a.uri=r[l||""]))}var m=n.indexOf(":");m>0?(l=e.prefix=n.slice(0,m),u=e.localName=n.slice(m+1)):(l=null,u=e.localName=n);var v=e.uri=r[l||""];if(t.startElement(v,u,n,e),e.closed){if(t.endElement(v,u,n),i)for(l in i)Object.prototype.hasOwnProperty.call(i,l)&&t.endPrefixMapping(l)}else return e.currentNSMap=r,e.localNSMap=i,!0}function YB(e,t,r,n,i){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",t),o=e.substring(t+1,a);if(/[&<]/.test(o))return/^script$/i.test(r)?(i.characters(o,0,o.length),a):(o=o.replace(/&#?\w+;/g,n),i.characters(o,0,o.length),a)}return t+1}function ZB(e,t,r,n){var i=n[r];return i==null&&(i=e.lastIndexOf("</"+r+">"),i<t&&(i=e.lastIndexOf("</"+r)),n[r]=i),i<t}function D2(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function ek(e,t,r,n){var i=e.charAt(t+2);switch(i){case"-":if(e.charAt(t+3)==="-"){var a=e.indexOf("-->",t+4);return a>t?(r.comment(e,t+4,a-t-4),a+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(e.substr(t+3,6)=="CDATA["){var a=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,a-t-9),r.endCDATA(),a+3}var o=rk(e,t),s=o.length;if(s>1&&/!doctype/i.test(o[0][0])){var l=o[1][0],u=!1,c=!1;s>3&&(/^public$/i.test(o[2][0])?(u=o[3][0],c=s>4&&o[4][0]):/^system$/i.test(o[2][0])&&(c=o[3][0]));var p=o[s-1];return r.startDTD(l,u,c),r.endDTD(),p.index+p[0].length}}return-1}function tk(e,t,r){var n=e.indexOf("?>",t);if(n){var i=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(i){var a=i[0].length;return r.processingInstruction(i[1],i[2]),n+2}else return-1}return-1}function E2(){this.attributeNames={}}E2.prototype={setTagName:function(e){if(!A2.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!A2.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function rk(e,t){var r,n=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=t,i.exec(e);r=i.exec(e);)if(n.push(r),r[1])return n}Sd.XMLReader=S2;Sd.ParseError=ui});var x2=f(Us=>{var nk=Fa(),ik=Nd(),_2=y2(),F2=I2(),ak=ik.DOMImplementation,P2=nk.NAMESPACE,ok=F2.ParseError,sk=F2.XMLReader;function R2(e){return e.replace(/\r[\n\u0085]/g,`+ &$filter=(applicationid eq '${e}')`;v.SPNPrincipalIdUrl=MI;function UI(){return"/api/data/v9.0/appmodules?$filter=(uniquename eq 'AppDeploymentConfiguration')"}v.retrieveDeploymentPipelineConfigAppUrl=UI;v.retrieveFeatureControlSettingsByNamespaceUrl="/api/data/v9.1/RetrieveFeatureControlSettingsByNamespace";function BI(e){return`/api/data/v9.0/settingdefinitions${e}`}v.getSettingDefinitionsUri=BI;v.OrgSettingOverrideName="organizationsettings";function kI(e,t=!1){let r=`/api/data/v9.0/${v.OrgSettingOverrideName}${e}`;return t?`${v.cdsServiceUrl}${r}`:r}v.getOrgSettingOverrideUri=kI;v.AppSettingOverrideName="appsettings";function qI(e,t=!1){let r=`/api/data/v9.0/${v.AppSettingOverrideName}${e}`;return t?`${v.cdsServiceUrl.replace("/$","")}${r}`:r}v.getAppSettingOverrideUri=qI;var Ri;(function(e){e[e.All=0]="All",e[e.IsPlatformOnly=1]="IsPlatformOnly",e[e.NotPlatformOnly=2]="NotPlatformOnly"})(Ri||(v.RetrievePlatform=Ri={}));function $I(e,t,r,n=Ri.All,i=!1){let a=[];e&&a.push(`AppUniqueName='${e}'`),t!=null&&a.push(`ReleaseLevel=${t}`),r&&a.push(`RetrieveHiddenSettings=${r}`),n!==Ri.All&&a.push(`RetrievePlatformSettings=${n===Ri.IsPlatformOnly?1:0}`);let o="/api/data/v9.0/RetrieveUnpublishedOverridableSettingsInfo";return a.length&&(o=`${o}(${a.join(",")})`),i?`${v.cdsServiceUrl}${o}`:o}v.getPowerSettingsUri=$I;function VI(e,t,r,n=!1){let i=[`SettingName='${e}'`];t!==void 0&&i.push(`SolutionName='${t}'`),r!==void 0&&i.push(`AppUniqueName='${r}'`);let a="/api/data/v9.0/RetrieveUnpublishedSettingInfo";return i.length&&(a=`${a}(${i.join(",")})`),n?`${v.cdsServiceUrl}${a}`:a}v.getPowerSettingUri=VI;function GI(e=!1){let t="/api/data/v9.0/SaveSettingValue()";return e?`${v.cdsServiceUrl}${t}`:t}v.getSavePowerSettingUri=GI;v.retrieveUnpublishedSuffix="Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()";function zI(e){return`tools/systemcustomization/businessrules/businessRulesDesigner.aspx?BRlaunchpoint=BRGrid&appSolutionId={${e}}`}v.getBusinessRuleDesignerUri=zI;function hf({environmentInstanceUrl:e,entityLogicalName:t}){return e&&t?`${e}main.aspx?cmdbar=true&forceUCI=1&navbar=off&newWindow=true&pageType=entityRecord&etn=${t}`:void 0}v.getUCIEntityRecordBaseUrl=hf;function WI({baseUrl:e,environmentInstanceUrl:t,entityLogicalName:r,recordId:n}){let i=e||hf({environmentInstanceUrl:t,entityLogicalName:r});return i&&n?`${i}&id=${n}`:void 0}v.getUCIEntityRecordEditUrl=WI;v.retrieveOrganizationResources=`${v.cdsServiceUrl}api/data/v9.0/RetrieveOrganizationResources`});var gf=m(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.DataverseClient=void 0;var jI=jl(),Sn=be(),Jl=class{constructor(t,r,n){this.instanceUrl=t,this.httpClient=r,this.solutionUniqueName=n}withSolution(t){return this.solutionUniqueName?{...t,headers:{...t?.headers,"MSCRM.SolutionUniqueName":this.solutionUniqueName}}:t}apiUrl(t){let r=this.instanceUrl.replace(/\/+$/,""),n=t.startsWith("/")?t:`/${t}`;return`${r}/${jI.xrmApiUrl}${n}`}async send(t,r){try{return await r()}catch(n){throw n instanceof Sn.SdkError?n:new Sn.ConnectionError(t,0,n instanceof Error?n.message:String(n),n)}}get(t,r){let n=this.apiUrl(t);return this.send(n,()=>this.httpClient.get(n,r))}getAbsolute(t,r){return this.assertSameOrigin(t),this.send(t,()=>this.httpClient.get(t,r))}assertSameOrigin(t){let r,n;try{r=new URL(t),n=new URL(this.instanceUrl)}catch{throw new Sn.InvalidArgumentError(`Refusing to follow a malformed absolute URL: '${t}'`)}if(r.protocol!==n.protocol||r.host!==n.host)throw new Sn.InvalidArgumentError(`Refusing to follow a cross-origin link ('${r.origin}' is not the configured instance '${n.origin}'); server-driven pagination must stay on-instance.`)}post(t,r,n){let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.post(i,r,this.withSolution(n)))}get supportsAtomicBatch(){return typeof this.httpClient.postRaw=="function"}postBatch(t,r,n){if(!this.httpClient.postRaw)throw new Sn.InvalidArgumentError("The injected HttpClient does not implement postRaw(), required for atomic $batch change sets");let i=this.apiUrl("/$batch"),a={...n,headers:{...n?.headers,"Content-Type":`multipart/mixed;boundary=${r}`}};return this.send(i,()=>this.httpClient.postRaw(i,t,a))}patch(t,r,n){let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.patch(i,r,this.withSolution(n)))}put(t,r,n){if(!this.httpClient.put)throw new Sn.InvalidArgumentError("The injected HttpClient does not implement put(), required for metadata replace operations (e.g. updateColumn)");let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.put(i,r,this.withSolution(n)))}delete(t,r){let n=this.apiUrl(t);return this.send(n,()=>this.httpClient.delete(n,this.withSolution(r)))}};bo.DataverseClient=Jl});var ue=m(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.odataQuery=Oe.normalizeGuid=Oe.createSafeXmlElement=Oe.assertODataName=Oe.assertXmlName=Oe.xmlText=Oe.odataPathLiteral=Oe.odataLiteral=void 0;var Ql=be();function vf(e){return String(e??"").replace(/'/g,"''")}Oe.odataLiteral=vf;function HI(e){return encodeURIComponent(vf(e))}Oe.odataPathLiteral=HI;function JI(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}Oe.xmlText=JI;function bf(e,t){let r=String(e??""),n=/^[A-Za-z_][0-9A-Za-z_.-]*$/,i=r.split(":");if(!(i.length<=2&&i.every(o=>n.test(o))&&!/^xmlns/i.test(r)))throw new Ql.InvalidArgumentError(`${t} must be a valid XML element name (got '${e}')`);return e}Oe.assertXmlName=bf;function QI(e,t){let r=String(e??"");if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r))throw new Ql.InvalidArgumentError(`${t} must be a valid OData identifier (letters, digits, underscore): got '${e}'`);return e}Oe.assertODataName=QI;function XI(e,t,r){return e.createElement(bf(t,r))}Oe.createSafeXmlElement=XI;var KI=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function YI(e,t){let r=String(e??""),n=r.length===38&&r.startsWith("{")&&r.endsWith("}")?r.slice(1,-1):r;if(!KI.test(n))throw new Ql.InvalidArgumentError(`${t} must be a valid GUID (got '${e}')`);return n.toLowerCase()}Oe.normalizeGuid=YI;function ZI(e){let t=[];for(let[r,n]of e)n!=null&&n!==""&&t.push(`${r}=${encodeURIComponent(String(n))}`);return t.length>0?`?${t.join("&")}`:""}Oe.odataQuery=ZI});var $e=m(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.nowIso=Ne.isAlreadyDeleted=Ne.deleteRecord=Ne.ensureSuccess=Ne.requireCreatedId=Ne.readCreatedId=Ne.readEtag=Ne.VERSION_CONFLICT_CODE=void 0;var yo=be(),Xl=ue();Ne.VERSION_CONFLICT_CODE="VERSION_CONFLICT";function e1(e){var t;let r=(t=e.headers)!==null&&t!==void 0?t:{};for(let i of Object.keys(r))if(i.toLowerCase()==="etag")return r[i];let n=e.body;return n&&typeof n["@odata.etag"]=="string"?n["@odata.etag"]:null}Ne.readEtag=e1;function yf(e,t){var r;let n=e.body;if(n&&typeof n[t]=="string")return(0,Xl.normalizeGuid)(n[t],t);let i=(r=e.headers)!==null&&r!==void 0?r:{};for(let a of Object.keys(i))if(a.toLowerCase()==="odata-entityid"){let o=/\(([0-9a-fA-F-]{36})\)/.exec(i[a]);if(o)return(0,Xl.normalizeGuid)(o[1],t)}return null}Ne.readCreatedId=yf;function t1(e,t,r){let n=yf(e,t);if(!n)throw new yo.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`);return n}Ne.requireCreatedId=t1;function Cf(e,t){if(e.status===412)throw new yo.SdkError(Ne.VERSION_CONFLICT_CODE,`Version conflict (412) from ${t}`);if(e.status<200||e.status>=300)throw new yo.ConnectionError(t,e.status,r1(e.body),e.body);return e}Ne.ensureSuccess=Cf;function r1(e){if(typeof e=="string"&&e.length>0)return e;if(e!==null&&typeof e=="object"){let t=e;if(t.error&&typeof t.error.message=="string")return t.error.message;if(typeof t.Message=="string")return t.Message;if(typeof t.message=="string")return t.message}return"request failed"}async function n1(e,t,r){let n=(0,Xl.normalizeGuid)(r,"id"),i=`/${t}(${n})`;Cf(await e.delete(i),e.apiUrl(i))}Ne.deleteRecord=n1;function i1(e){return e instanceof yo.ConnectionError&&e.statusCode===404}Ne.isAlreadyDeleted=i1;function a1(){return new Date().toISOString()}Ne.nowIso=a1});var Af=m(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.findColumns=Pr.findTables=Pr.fetchEntityMetadataFromApi=void 0;var Kl=$e(),qt=ue();function Li(e){var t,r;return(r=(t=e?.UserLocalizedLabel)===null||t===void 0?void 0:t.Label)!==null&&r!==void 0?r:""}async function Dn(e,t){var r,n;let i=await e.get(t);return i.status<200||i.status>=300?[]:(n=(r=i.body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]}function _r(e){return`/EntityDefinitions(LogicalName='${(0,qt.odataLiteral)(e)}')`}async function o1(e,t,r){let n=await Dn(e,`${_r(t)}/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata${(0,qt.odataQuery)([["$select","LogicalName,MaxLength"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&typeof i.MaxLength=="number"&&(a.maxLength=i.MaxLength)}}async function s1(e,t,r){var n;let i=await Dn(e,`${_r(t)}/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata${(0,qt.odataQuery)([["$select","LogicalName"],["$expand","OptionSet($select=Options)"]])}`);for(let a of i){let o=r.get(a.LogicalName);o&&(!((n=a.OptionSet)===null||n===void 0)&&n.Options)&&(o.options=a.OptionSet.Options.map(s=>{var l;return{value:(l=s.Value)!==null&&l!==void 0?l:0,label:Li(s.Label)}}))}}async function l1(e,t,r){let n=await Dn(e,`${_r(t)}/Attributes/Microsoft.Dynamics.CRM.LookupAttributeMetadata${(0,qt.odataQuery)([["$select","LogicalName,Targets"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&i.Targets&&(a.targets=i.Targets)}}async function u1(e,t){var r,n,i,a;let o=[],s=await Dn(e,`${_r(t)}/OneToManyRelationships${(0,qt.odataQuery)([["$select","SchemaName,ReferencingEntity,ReferencingAttribute"]])}`);for(let c of s)o.push({schemaName:c.SchemaName,type:"OneToMany",relatedEntity:(r=c.ReferencingEntity)!==null&&r!==void 0?r:"",relatedAttribute:(n=c.ReferencingAttribute)!==null&&n!==void 0?n:""});let l=await Dn(e,`${_r(t)}/ManyToOneRelationships${(0,qt.odataQuery)([["$select","SchemaName,ReferencedEntity,ReferencedAttribute"]])}`);for(let c of l)o.push({schemaName:c.SchemaName,type:"ManyToOne",relatedEntity:(i=c.ReferencedEntity)!==null&&i!==void 0?i:"",relatedAttribute:(a=c.ReferencedAttribute)!==null&&a!==void 0?a:""});let u=await Dn(e,`${_r(t)}/ManyToManyRelationships${(0,qt.odataQuery)([["$select","SchemaName,Entity1LogicalName,Entity2LogicalName"]])}`);for(let c of u){let d=c.Entity1LogicalName===t?c.Entity2LogicalName:c.Entity1LogicalName;o.push({schemaName:c.SchemaName,type:"ManyToMany",relatedEntity:d??"",relatedAttribute:""})}return o}async function c1(e,t){var r,n,i,a,o;let s=`${_r(t)}`+(0,qt.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,EntitySetName,IsCustomEntity,PrimaryNameAttribute,PrimaryIdAttribute"],["$expand","Attributes($select=LogicalName,DisplayName,AttributeType,IsCustomAttribute)"]]),u=(0,Kl.ensureSuccess)(await e.get(s),e.apiUrl(s)).body,c=((r=u.Attributes)!==null&&r!==void 0?r:[]).map(g=>{var b;return{logicalName:g.LogicalName,displayName:Li(g.DisplayName),attributeType:(b=g.AttributeType)!==null&&b!==void 0?b:"Unknown",isCustomAttribute:!!g.IsCustomAttribute}}),d=new Map(c.map(g=>[g.logicalName,g])),[,,,f]=await Promise.all([o1(e,t,d),s1(e,t,d),l1(e,t,d),u1(e,t)]);return{logicalName:u.LogicalName,schemaName:(n=u.SchemaName)!==null&&n!==void 0?n:u.LogicalName,displayName:Li(u.DisplayName),entitySetName:(i=u.EntitySetName)!==null&&i!==void 0?i:"",primaryNameAttribute:(a=u.PrimaryNameAttribute)!==null&&a!==void 0?a:"",primaryIdAttribute:(o=u.PrimaryIdAttribute)!==null&&o!==void 0?o:"",isCustomEntity:!!u.IsCustomEntity,attributes:c,relationships:f}}Pr.fetchEntityMetadataFromApi=c1;async function d1(e,t,r){var n,i;let a=`/EntityDefinitions${(0,qt.odataQuery)([["$select","LogicalName,SchemaName,EntitySetName,DisplayName,IsCustomEntity"]])}`,s=(i=(n=(0,Kl.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[],l=(t??"").toLowerCase(),u=s.filter(c=>!r?.customOnly||c.IsCustomEntity).map(c=>{var d,f;return{logicalName:c.LogicalName,schemaName:(d=c.SchemaName)!==null&&d!==void 0?d:c.LogicalName,displayName:Li(c.DisplayName),entitySetName:(f=c.EntitySetName)!==null&&f!==void 0?f:"",isCustom:!!c.IsCustomEntity}}).filter(c=>c.logicalName.toLowerCase().includes(l)||c.schemaName.toLowerCase().includes(l)||c.displayName.toLowerCase().includes(l));return typeof r?.top=="number"?u.slice(0,r.top):u}Pr.findTables=d1;async function p1(e,t,r,n){var i,a;let o=`${_r(t)}/Attributes`+(0,qt.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,AttributeType,IsCustomAttribute"]]),l=(a=(i=(0,Kl.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[],u=(r??"").toLowerCase(),c=l.map(d=>{var f,g;return{logicalName:d.LogicalName,schemaName:(f=d.SchemaName)!==null&&f!==void 0?f:d.LogicalName,displayName:Li(d.DisplayName),attributeType:(g=d.AttributeType)!==null&&g!==void 0?g:"Unknown",isCustom:!!d.IsCustomAttribute}}).filter(d=>d.logicalName.toLowerCase().includes(u)||d.schemaName.toLowerCase().includes(u)||d.displayName.toLowerCase().includes(u));return typeof n?.top=="number"?c.slice(0,n.top):c}Pr.findColumns=p1});var Co=m(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.updateTable=J.deleteAlternateKey=J.createAlternateKey=J.deleteGlobalOptionSet=J.createGlobalOptionSet=J.deleteRelationship=J.deleteColumn=J.updateColumn=J.deleteTable=J.createRelationship=J.insertStatusValue=J.createCustomerColumn=J.createColumn=J.createTable=J.resolveEntitySetName=void 0;var oe=$e(),X=ue(),Ot=be(),f1={String:"Microsoft.Dynamics.CRM.StringAttributeMetadata",Memo:"Microsoft.Dynamics.CRM.MemoAttributeMetadata",Integer:"Microsoft.Dynamics.CRM.IntegerAttributeMetadata",Decimal:"Microsoft.Dynamics.CRM.DecimalAttributeMetadata",Money:"Microsoft.Dynamics.CRM.MoneyAttributeMetadata",Boolean:"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",DateTime:"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",Picklist:"Microsoft.Dynamics.CRM.PicklistAttributeMetadata",Lookup:"Microsoft.Dynamics.CRM.LookupAttributeMetadata"},or=1033;function ge(e,t){return{"@odata.type":"Microsoft.Dynamics.CRM.Label",LocalizedLabels:[{"@odata.type":"Microsoft.Dynamics.CRM.LocalizedLabel",Label:e,LanguageCode:t}]}}function Mi(e){return{Value:e,CanBeChanged:!0,ManagedPropertyLogicalName:"canmodifyrequirementlevelsettings"}}function Zl(e){let t=e.indexOf("_");return t>0?e.slice(0,t):e}function wf(e,t,r){let n=e[t];n&&typeof n=="object"?n.Value=r:e[t]={Value:r}}function Ui(e){let t=(0,oe.readCreatedId)(e,"MetadataId");if(!t)throw new Ot.InvalidArgumentError("Dataverse did not return a MetadataId for the created metadata component");return t}function m1(e,t,r){var n,i,a,o,s,l,u,c,d,f,g,b,w,N,_,T,R,M,W,B,j,k;switch(e){case"string":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},MaxLength:(n=t.maxLength)!==null&&n!==void 0?n:100,FormatName:{Value:(i=t.stringFormat)!==null&&i!==void 0?i:"Text"}};case"memo":return{"@odata.type":"Microsoft.Dynamics.CRM.MemoAttributeMetadata",AttributeType:"Memo",AttributeTypeName:{Value:"MemoType"},MaxLength:(a=t.maxLength)!==null&&a!==void 0?a:2e3,Format:"TextArea"};case"integer":return{"@odata.type":"Microsoft.Dynamics.CRM.IntegerAttributeMetadata",AttributeType:"Integer",AttributeTypeName:{Value:"IntegerType"},Format:"None",MinValue:(o=t.minValue)!==null&&o!==void 0?o:-2147483648,MaxValue:(s=t.maxValue)!==null&&s!==void 0?s:2147483647};case"bigint":return{"@odata.type":"Microsoft.Dynamics.CRM.BigIntAttributeMetadata",AttributeType:"BigInt",AttributeTypeName:{Value:"BigIntType"}};case"double":return{"@odata.type":"Microsoft.Dynamics.CRM.DoubleAttributeMetadata",AttributeType:"Double",AttributeTypeName:{Value:"DoubleType"},Precision:(l=t.precision)!==null&&l!==void 0?l:2,MinValue:(u=t.minValue)!==null&&u!==void 0?u:-1e11,MaxValue:(c=t.maxValue)!==null&&c!==void 0?c:1e11};case"decimal":return{"@odata.type":"Microsoft.Dynamics.CRM.DecimalAttributeMetadata",AttributeType:"Decimal",AttributeTypeName:{Value:"DecimalType"},Precision:(d=t.precision)!==null&&d!==void 0?d:2,MinValue:(f=t.minValue)!==null&&f!==void 0?f:-1e11,MaxValue:(g=t.maxValue)!==null&&g!==void 0?g:1e11};case"money":return{"@odata.type":"Microsoft.Dynamics.CRM.MoneyAttributeMetadata",AttributeType:"Money",AttributeTypeName:{Value:"MoneyType"},Precision:(b=t.precision)!==null&&b!==void 0?b:2,PrecisionSource:2,MinValue:(w=t.minValue)!==null&&w!==void 0?w:0,MaxValue:(N=t.maxValue)!==null&&N!==void 0?N:1e9};case"boolean":return{"@odata.type":"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",AttributeType:"Boolean",AttributeTypeName:{Value:"BooleanType"},DefaultValue:!1,OptionSet:{"@odata.type":"Microsoft.Dynamics.CRM.BooleanOptionSetMetadata",TrueOption:{Value:1,Label:ge((_=t.trueLabel)!==null&&_!==void 0?_:"Yes",r)},FalseOption:{Value:0,Label:ge((T=t.falseLabel)!==null&&T!==void 0?T:"No",r)}}};case"dateTime":return{"@odata.type":"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",AttributeType:"DateTime",AttributeTypeName:{Value:"DateTimeType"},Format:(R=t.dateFormat)!==null&&R!==void 0?R:"DateAndTime"};case"choice":return Nf(t,r,!1);case"multiChoice":return Nf(t,r,!0);case"file":return{"@odata.type":"Microsoft.Dynamics.CRM.FileAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"FileType"},MaxSizeInKB:(M=t.maxSizeKb)!==null&&M!==void 0?M:10240};case"image":return{"@odata.type":"Microsoft.Dynamics.CRM.ImageAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"ImageType"},IsPrimaryImage:(W=t.isPrimaryImage)!==null&&W!==void 0?W:!1,MaxSizeInKB:(B=t.maxSizeKb)!==null&&B!==void 0?B:10240};case"autonumber":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},FormatName:{Value:"Text"},MaxLength:(j=t.maxLength)!==null&&j!==void 0?j:100,AutoNumberFormat:(k=t.autoNumberFormat)!==null&&k!==void 0?k:""};default:throw new Ot.InvalidArgumentError(`unsupported column type '${String(e)}'`)}}function Nf(e,t,r){let i={"@odata.type":r?"Microsoft.Dynamics.CRM.MultiSelectPicklistAttributeMetadata":"Microsoft.Dynamics.CRM.PicklistAttributeMetadata",AttributeType:r?"Virtual":"Picklist",AttributeTypeName:{Value:r?"MultiSelectPicklistType":"PicklistType"}};if(e.globalChoiceMetadataId)return i["[email protected]"]=`/GlobalOptionSetDefinitions(${(0,X.normalizeGuid)(e.globalChoiceMetadataId,"globalChoiceMetadataId")})`,i;if(!e.options||e.options.length===0)throw new Ot.InvalidArgumentError(`choice column '${e.schemaName}' requires at least one option (or a globalChoiceMetadataId)`);return i.OptionSet={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",IsGlobal:!1,OptionSetType:"Picklist",Options:e.options.map(a=>({Value:a.value,Label:ge(a.label,t)}))},i}var Yl=new WeakMap;async function h1(e,t){var r,n;let i=(r=Yl.get(e))===null||r===void 0?void 0:r.get(t);if(i)return i;let a=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')${(0,X.odataQuery)([["$select","EntitySetName"]])}`,s=(n=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.EntitySetName;if(!s)throw new Ot.InvalidArgumentError(`could not resolve EntitySetName for '${t}'`);(0,X.assertODataName)(s,`server-derived EntitySetName for '${t}'`);let l=Yl.get(e);return l||(l=new Map,Yl.set(e,l)),l.set(t,s),s}J.resolveEntitySetName=h1;async function g1(e,t){var r,n,i,a,o,s,l,u,c,d,f,g;let b=(r=t.languageCode)!==null&&r!==void 0?r:or,w=Zl(t.schemaName),N=(n=t.primaryColumnSchemaName)!==null&&n!==void 0?n:`${w}_Name`,_={"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},SchemaName:N,RequiredLevel:Mi("None"),MaxLength:(i=t.primaryColumnMaxLength)!==null&&i!==void 0?i:100,FormatName:{Value:"Text"},DisplayName:ge((a=t.primaryColumnDisplayName)!==null&&a!==void 0?a:"Name",b),IsPrimaryName:!0};t.primaryColumnAutoNumberFormat&&(_.AutoNumberFormat=t.primaryColumnAutoNumberFormat);let T={"@odata.type":"Microsoft.Dynamics.CRM.EntityMetadata",SchemaName:t.schemaName,DisplayName:ge(t.displayName,b),DisplayCollectionName:ge((o=t.pluralName)!==null&&o!==void 0?o:`${t.displayName}s`,b),OwnershipType:(s=t.ownership)!==null&&s!==void 0?s:"UserOwned",IsActivity:!1,HasActivities:(l=t.hasActivities)!==null&&l!==void 0?l:!1,HasNotes:(u=t.hasNotes)!==null&&u!==void 0?u:!1,Attributes:[_]};t.description&&(T.Description=ge(t.description,b));let R="/EntityDefinitions",M=(0,oe.ensureSuccess)(await e.post(R,T),e.apiUrl(R)),W=Ui(M),B=`/EntityDefinitions(${W})`+(0,X.odataQuery)([["$select","LogicalName,EntitySetName,PrimaryIdAttribute,PrimaryNameAttribute"]]),k=(0,oe.ensureSuccess)(await e.get(B),e.apiUrl(B)).body;return{logicalName:(c=k.LogicalName)!==null&&c!==void 0?c:t.schemaName.toLowerCase(),metadataId:W,entitySetName:(d=k.EntitySetName)!==null&&d!==void 0?d:"",primaryIdAttribute:(f=k.PrimaryIdAttribute)!==null&&f!==void 0?f:`${t.schemaName.toLowerCase()}id`,primaryNameAttribute:(g=k.PrimaryNameAttribute)!==null&&g!==void 0?g:N.toLowerCase()}}J.createTable=g1;async function v1(e,t,r){var n,i;let a=(n=r.languageCode)!==null&&n!==void 0?n:or,o={...m1(r.type,r,a),SchemaName:r.schemaName,RequiredLevel:Mi((i=r.required)!==null&&i!==void 0?i:"None"),DisplayName:ge(r.displayName,a)};r.description&&(o.Description=ge(r.description,a)),r.sourceType&&r.sourceType!=="Simple"&&(o.SourceType=r.sourceType==="Rollup"?2:1,r.formulaDefinition&&(o.FormulaDefinition=r.formulaDefinition));let s=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')/Attributes`,l=(0,oe.ensureSuccess)(await e.post(s,o),e.apiUrl(s));return{logicalName:r.schemaName.toLowerCase(),metadataId:Ui(l)}}J.createColumn=v1;async function b1(e,t,r){var n,i,a,o;let s=(n=r.languageCode)!==null&&n!==void 0?n:or,l=Zl(r.schemaName),u=(i=r.accountRelationshipName)!==null&&i!==void 0?i:`${l}_${t}_account`,c=(a=r.contactRelationshipName)!==null&&a!==void 0?a:`${l}_${t}_contact`,d={Lookup:{"@odata.type":"Microsoft.Dynamics.CRM.ComplexLookupAttributeMetadata",SchemaName:r.schemaName,DisplayName:ge(r.displayName,s),RequiredLevel:Mi((o=r.required)!==null&&o!==void 0?o:"None"),Targets:["account","contact"]},OneToManyRelationships:[{"@odata.type":"Microsoft.Dynamics.CRM.ComplexOneToManyRelationshipMetadata",SchemaName:u,ReferencedEntity:"account",ReferencingEntity:t},{"@odata.type":"Microsoft.Dynamics.CRM.ComplexOneToManyRelationshipMetadata",SchemaName:c,ReferencedEntity:"contact",ReferencingEntity:t}]};return(0,oe.ensureSuccess)(await e.post("/CreateCustomerRelationships",d),e.apiUrl("/CreateCustomerRelationships")),{logicalName:r.schemaName.toLowerCase(),metadataId:""}}J.createCustomerColumn=b1;async function y1(e,t,r){var n,i,a,o,s;let l=(n=r.languageCode)!==null&&n!==void 0?n:or,u={EntityLogicalName:t,AttributeLogicalName:"statuscode",Label:ge(r.label,l),StateCode:(i=r.stateCode)!==null&&i!==void 0?i:0};typeof r.value=="number"&&(u.Value=r.value),r.color&&(u.Color=r.color);let c=(0,oe.ensureSuccess)(await e.post("/InsertStatusValue",u),e.apiUrl("/InsertStatusValue"));return Number((s=(o=(a=c.body)===null||a===void 0?void 0:a.NewOptionValue)!==null&&o!==void 0?o:r.value)!==null&&s!==void 0?s:0)}J.insertStatusValue=y1;async function C1(e,t){var r,n,i,a,o;let s=(r=t.languageCode)!==null&&r!==void 0?r:or,l,u;if(t.type==="OneToMany"){if(!t.referencedEntity||!t.referencingEntity)throw new Ot.InvalidArgumentError("OneToMany relationship requires referencedEntity and referencingEntity");let f=(n=t.lookupSchemaName)!==null&&n!==void 0?n:`${Zl(t.schemaName)}_${t.referencedEntity}Id`;u=f.toLowerCase(),l={"@odata.type":"Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata",SchemaName:t.schemaName,ReferencedEntity:t.referencedEntity,ReferencingEntity:t.referencingEntity,Lookup:{"@odata.type":"Microsoft.Dynamics.CRM.LookupAttributeMetadata",AttributeType:"Lookup",AttributeTypeName:{Value:"LookupType"},SchemaName:f,RequiredLevel:Mi((i=t.lookupRequired)!==null&&i!==void 0?i:"None"),DisplayName:ge((a=t.lookupDisplayName)!==null&&a!==void 0?a:t.referencedEntity,s)}}}else{if(!t.entity1||!t.entity2)throw new Ot.InvalidArgumentError("ManyToMany relationship requires entity1 and entity2");l={"@odata.type":"Microsoft.Dynamics.CRM.ManyToManyRelationshipMetadata",SchemaName:t.schemaName,IntersectEntityName:(o=t.intersectEntityName)!==null&&o!==void 0?o:t.schemaName.toLowerCase(),Entity1LogicalName:t.entity1,Entity2LogicalName:t.entity2}}let c="/RelationshipDefinitions",d=(0,oe.ensureSuccess)(await e.post(c,l),e.apiUrl(c));return{schemaName:t.schemaName,metadataId:Ui(d),lookupLogicalName:u}}J.createRelationship=C1;async function A1(e,t){let r=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')`;(0,oe.ensureSuccess)(await e.delete(r),e.apiUrl(r))}J.deleteTable=A1;async function w1(e,t,r,n){var i,a;let o=(i=n.languageCode)!==null&&i!==void 0?i:or,s=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')/Attributes`,l=`${s}(LogicalName='${(0,X.odataLiteral)(r)}')${(0,X.odataQuery)([["$select","MetadataId,AttributeType"]])}`,c=(0,oe.ensureSuccess)(await e.get(l),e.apiUrl(l)).body,d=f1[(a=c.AttributeType)!==null&&a!==void 0?a:""];if(!c.MetadataId||!d)throw new Ot.InvalidArgumentError(`cannot update column '${r}' on '${t}' (type '${c.AttributeType}' not supported)`);let f=(0,X.normalizeGuid)(c.MetadataId,"MetadataId"),g=`${s}(${f})/${d}`,b=(0,oe.ensureSuccess)(await e.get(g),e.apiUrl(g)).body;for(let N of Object.keys(b))N.startsWith("@odata.")&&delete b[N];b["@odata.type"]=d,n.displayName!==void 0&&(b.DisplayName=ge(n.displayName,o)),n.description!==void 0&&(b.Description=ge(n.description,o)),n.required!==void 0&&(b.RequiredLevel=Mi(n.required)),n.maxLength!==void 0&&(b.MaxLength=n.maxLength),n.autoNumberFormat!==void 0&&(b.AutoNumberFormat=n.autoNumberFormat);let w=`${s}(${f})`;(0,oe.ensureSuccess)(await e.put(w,b,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(w))}J.updateColumn=w1;async function N1(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')/Attributes`,a=`${i}(LogicalName='${(0,X.odataLiteral)(r)}')${(0,X.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new Ot.InvalidArgumentError(`column '${r}' not found on '${t}'`);let l=`${i}(${(0,X.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}J.deleteColumn=N1;async function S1(e,t){var r,n,i;let a=`/RelationshipDefinitions${(0,X.odataQuery)([["$filter",`SchemaName eq '${(0,X.odataLiteral)(t)}'`],["$select","MetadataId"]])}`,s=(i=(n=(r=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.MetadataId;if(!s)throw new Ot.InvalidArgumentError(`relationship '${t}' not found`);let l=`/RelationshipDefinitions(${(0,X.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}J.deleteRelationship=S1;async function Sf(e,t){var r;let n=`/GlobalOptionSetDefinitions(Name='${(0,X.odataPathLiteral)(t)}')${(0,X.odataQuery)([["$select","MetadataId"]])}`,i=await e.get(n);if(i.status===404)return;let o=(r=(0,oe.ensureSuccess)(i,e.apiUrl(n)).body)===null||r===void 0?void 0:r.MetadataId;return o?(0,X.normalizeGuid)(o,"MetadataId"):void 0}async function D1(e,t){var r;let n=t.name.toLowerCase(),i=await Sf(e,n);if(i)return{name:n,metadataId:i};let a=(r=t.languageCode)!==null&&r!==void 0?r:or,o={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",Name:n,DisplayName:ge(t.displayName,a),IsGlobal:!0,OptionSetType:"Picklist",Options:t.options.map(l=>({Value:l.value,Label:ge(l.label,a)}))};t.description&&(o.Description=ge(t.description,a));let s="/GlobalOptionSetDefinitions";try{let l=(0,oe.ensureSuccess)(await e.post(s,o),e.apiUrl(s));return{name:n,metadataId:Ui(l)}}catch(l){let u;try{u=await Sf(e,n)}catch{u=void 0}if(u)return{name:n,metadataId:u};throw l}}J.createGlobalOptionSet=D1;async function E1(e,t){let r=`/GlobalOptionSetDefinitions(Name='${(0,X.odataLiteral)(t.toLowerCase())}')`;(0,oe.ensureSuccess)(await e.delete(r),e.apiUrl(r))}J.deleteGlobalOptionSet=E1;async function I1(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:or,a={"@odata.type":"Microsoft.Dynamics.CRM.EntityKeyMetadata",SchemaName:r.schemaName,DisplayName:ge(r.displayName,i),KeyAttributes:r.keyAttributes},o=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')/Keys`,s=(0,oe.ensureSuccess)(await e.post(o,a),e.apiUrl(o));return{logicalName:r.schemaName.toLowerCase(),metadataId:Ui(s)}}J.createAlternateKey=I1;async function _1(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')/Keys`,a=`${i}(LogicalName='${(0,X.odataLiteral)(r.toLowerCase())}')${(0,X.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new Ot.InvalidArgumentError(`alternate key '${r}' not found on '${t}'`);let l=`${i}(${(0,X.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}J.deleteAlternateKey=_1;async function P1(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:or,a=`/EntityDefinitions(LogicalName='${(0,X.odataLiteral)(t)}')`,s=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body,l=s.MetadataId;if(!l)throw new Ot.InvalidArgumentError(`table '${t}' not found`);let u=(0,X.normalizeGuid)(l,"MetadataId");for(let d of Object.keys(s))d.startsWith("@odata.")&&delete s[d];s["@odata.type"]="Microsoft.Dynamics.CRM.EntityMetadata",r.displayName!==void 0&&(s.DisplayName=ge(r.displayName,i)),r.pluralName!==void 0&&(s.DisplayCollectionName=ge(r.pluralName,i)),r.description!==void 0&&(s.Description=ge(r.description,i)),r.auditEnabled!==void 0&&wf(s,"IsAuditEnabled",r.auditEnabled),r.duplicateDetectionEnabled!==void 0&&wf(s,"IsDuplicateDetectionEnabled",r.duplicateDetectionEnabled),r.changeTrackingEnabled!==void 0&&(s.ChangeTrackingEnabled=r.changeTrackingEnabled),r.quickCreateEnabled!==void 0&&(s.IsQuickCreateEnabled=r.quickCreateEnabled),r.iconVectorName!==void 0&&(s.IconVectorName=r.iconVectorName),r.iconSmallName!==void 0&&(s.IconSmallName=r.iconSmallName),r.iconMediumName!==void 0&&(s.IconMediumName=r.iconMediumName),r.iconLargeName!==void 0&&(s.IconLargeName=r.iconLargeName);let c=`/EntityDefinitions(${u})`;(0,oe.ensureSuccess)(await e.put(c,s,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(c))}J.updateTable=P1});var Bi=m(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.disassociateRecords=me.associateRecords=me.createRecordsBulk=me.upsertRecord=me.queryAllRecords=me.queryRecords=me.getRecord=me.deleteRecord=me.updateRecord=me.createRecord=void 0;var vt=$e(),Ve=ue(),Hr=be(),$t=Co();function Ao(e){let t=e,r=!1,n={};for(let i of Object.keys(t)){let a=t[i];Array.isArray(a)&&a.every(o=>typeof o=="number")?(n[i]=a.join(","),r=!0):n[i]=a}return r?n:e}async function O1(e,t,r){let i=`/${await(0,$t.resolveEntitySetName)(e,t)}`,a=(0,vt.ensureSuccess)(await e.post(i,Ao(r)),e.apiUrl(i)),o=(0,vt.readCreatedId)(a,`${t}id`);if(!o)throw new Hr.InvalidArgumentError(`Dataverse did not return an id for the created '${t}' row`);return{id:o,entityType:t}}me.createRecord=O1;async function F1(e,t,r,n){let i=(0,Ve.normalizeGuid)(r,"id"),o=`/${await(0,$t.resolveEntitySetName)(e,t)}(${i})`;(0,vt.ensureSuccess)(await e.patch(o,Ao(n)),e.apiUrl(o))}me.updateRecord=F1;async function T1(e,t,r){let n=(0,Ve.normalizeGuid)(r,"id"),a=`/${await(0,$t.resolveEntitySetName)(e,t)}(${n})`;(0,vt.ensureSuccess)(await e.delete(a),e.apiUrl(a))}me.deleteRecord=T1;async function R1(e,t,r,n){var i;let a=(0,Ve.normalizeGuid)(r,"id"),o=await(0,$t.resolveEntitySetName)(e,t),s=(0,Ve.odataQuery)([["$select",n&&n.length>0?n.join(","):void 0]]),l=`/${o}(${a})${s}`;return(i=(0,vt.ensureSuccess)(await e.get(l),e.apiUrl(l)).body)!==null&&i!==void 0?i:{}}me.getRecord=R1;function x1(e){return e?.fetchXml?(0,Ve.odataQuery)([["fetchXml",e.fetchXml]]):(0,Ve.odataQuery)([["$select",e?.select&&e.select.length>0?e.select.join(","):void 0],["$filter",e?.filter],["$orderby",e?.orderBy],["$expand",e?.expand],["$top",e?.top]])}async function Df(e,t,r){var n,i;if(r?.paginate){if(r.top!==void 0)throw new Hr.InvalidArgumentError("queryRecords: `paginate` cannot be combined with `top` \u2014 Dataverse honors $top as a hard cap and omits @odata.nextLink, so the result would be silently capped at one page.");if(r.fetchXml)throw new Hr.InvalidArgumentError("queryRecords: `paginate` is not supported with `fetchXml` \u2014 FetchXML paging uses a paging cookie (page / fetchxmlpagingcookie), not @odata.nextLink. Page the FetchXML manually, or use an OData query.")}let o=`/${await(0,$t.resolveEntitySetName)(e,t)}${x1(r)}`,s=(0,vt.ensureSuccess)(await e.get(o),e.apiUrl(o));if(!r?.paginate)return(i=(n=s.body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[];let l=[],u=new Set,c=e.apiUrl(o);for(;;){let d=s.body,f=d?.value;if(!Array.isArray(f))throw new Hr.ConnectionError(c,s.status,`paginated query returned a malformed page \u2014 expected an OData 'value' array but got ${L1(f)}; refusing to return partial results.`);for(let b of f)l.push(b);let g=d?.["@odata.nextLink"];if(!g)break;if(typeof g!="string")throw new Hr.ConnectionError(c,s.status,`paginated query returned a non-string @odata.nextLink (${typeof g}); cannot follow it.`);if(u.has(g))throw new Hr.InvalidArgumentError(`queryRecords: aborting pagination \u2014 the server returned a repeated @odata.nextLink ('${g}'), which would loop indefinitely.`);u.add(g),c=g,s=(0,vt.ensureSuccess)(await e.getAbsolute(g),g)}return l}me.queryRecords=Df;function L1(e){return e===null?"null":e===void 0?"undefined (missing)":`a ${typeof e}`}async function M1(e,t,r){return Df(e,t,{...r,paginate:!0})}me.queryAllRecords=M1;function U1(e){if("id"in e)return`(${(0,Ve.normalizeGuid)(e.id,"id")})`;let t=typeof e.value=="string"?`'${(0,Ve.odataPathLiteral)(e.value)}'`:e.value;return`(${(0,Ve.assertODataName)(e.key,"alternate key name")}=${t})`}async function B1(e,t,r,n){let i=U1(r),o=`/${await(0,$t.resolveEntitySetName)(e,t)}${i}`,s=(0,vt.ensureSuccess)(await e.patch(o,Ao(n)),e.apiUrl(o)),l=s.status===201,u=(0,vt.readCreatedId)(s,`${t}id`);return{id:u??("id"in r?(0,Ve.normalizeGuid)(r.id,"id"):""),created:l}}me.upsertRecord=B1;async function k1(e,t,r){var n,i;if(r.length===0)return[];let a=await(0,$t.resolveEntitySetName)(e,t),o=r.map(c=>({"@odata.type":`Microsoft.Dynamics.CRM.${t}`,...Ao(c)})),s=`/${a}/Microsoft.Dynamics.CRM.CreateMultiple`,u=(i=(n=(0,vt.ensureSuccess)(await e.post(s,{Targets:o}),e.apiUrl(s)).body)===null||n===void 0?void 0:n.Ids)!==null&&i!==void 0?i:[];if(u.length!==r.length)throw new Hr.InvalidArgumentError(`CreateMultiple on '${t}' returned ${u.length} id(s) for ${r.length} row(s)`);return u}me.createRecordsBulk=k1;async function q1(e,t,r,n){let i=(0,Ve.normalizeGuid)(r,"id"),a=(0,Ve.normalizeGuid)(n.targetId,"targetId"),o=await(0,$t.resolveEntitySetName)(e,t),s=await(0,$t.resolveEntitySetName)(e,n.targetEntity),l=(0,Ve.assertODataName)(n.relationshipName,"relationshipName"),u=`/${o}(${i})/${l}/$ref`,c={"@odata.id":e.apiUrl(`/${s}(${a})`)};(0,vt.ensureSuccess)(await e.post(u,c),e.apiUrl(u))}me.associateRecords=q1;async function $1(e,t,r,n,i){let a=(0,Ve.normalizeGuid)(r,"id"),o=(0,Ve.normalizeGuid)(i,"targetId"),s=await(0,$t.resolveEntitySetName)(e,t),l=(0,Ve.assertODataName)(n,"relationshipName"),u=`/${s}(${a})/${l}(${o})/$ref`;(0,vt.ensureSuccess)(await e.delete(u),e.apiUrl(u))}me.disassociateRecords=$1});var _f=m(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.deleteWebResource=Vt.getWebResource=Vt.updateWebResource=Vt.createWebResource=void 0;var En=$e(),ki=ue(),eu=be(),V1={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12};function G1(e){let t=globalThis;if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");if(t.btoa){let r=globalThis.TextEncoder;if(r){let n=new r().encode(e),i="",a=32768;for(let o=0;o<n.length;o+=a)i+=String.fromCharCode(...n.subarray(o,o+a));return t.btoa(i)}return t.btoa(e)}throw new eu.InvalidArgumentError("no base64 encoder available; pass contentBase64 instead of content")}function Ef(e){if(e.contentBase64!==void 0)return e.contentBase64;if(e.content!==void 0)return G1(e.content)}async function If(e,t){let r=`<importexportxml><webresources><webresource>${(0,ki.xmlText)(t)}</webresource></webresources></importexportxml>`;(0,En.ensureSuccess)(await e.post("/PublishXml",{ParameterXml:r}),e.apiUrl("/PublishXml"))}async function z1(e,t){var r;let n=Ef(t);if(n===void 0)throw new eu.InvalidArgumentError(`web resource '${t.name}' requires content or contentBase64`);let i={name:t.name,displayname:(r=t.displayName)!==null&&r!==void 0?r:t.name,webresourcetype:V1[t.type],content:n};t.description&&(i.description=t.description);let a=(0,En.ensureSuccess)(await e.post("/webresourceset",i),e.apiUrl("/webresourceset")),o=(0,En.readCreatedId)(a,"webresourceid");if(!o)throw new eu.InvalidArgumentError(`Dataverse did not return an id for web resource '${t.name}'`);return t.publish!==!1&&await If(e,o),{id:o,name:t.name}}Vt.createWebResource=z1;async function W1(e,t,r){let n=(0,ki.normalizeGuid)(t,"id"),i={},a=Ef(r);a!==void 0&&(i.content=a),r.displayName!==void 0&&(i.displayname=r.displayName),r.description!==void 0&&(i.description=r.description);let o=`/webresourceset(${n})`;(0,En.ensureSuccess)(await e.patch(o,i),e.apiUrl(o)),r.publish!==!1&&await If(e,n)}Vt.updateWebResource=W1;async function j1(e,t){var r;let i=`/webresourceset(${(0,ki.normalizeGuid)(t,"id")})${(0,ki.odataQuery)([["$select","name,displayname,webresourcetype,content,description"]])}`;return(r=(0,En.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)!==null&&r!==void 0?r:{}}Vt.getWebResource=j1;async function H1(e,t){let n=`/webresourceset(${(0,ki.normalizeGuid)(t,"id")})`;(0,En.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Vt.deleteWebResource=H1});var Pf=m(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.deleteSolution=K.importSolution=K.exportSolution=K.removeSolutionComponent=K.addSolutionComponent=K.setSolutionVersion=K.createSolution=K.createPublisher=K.getSolution=K.fetchSolutionComponents=K.SolutionComponentType=void 0;var ft=$e(),pt=ue(),Jr=be();K.SolutionComponentType={SavedQuery:26,Workflow:29,SavedQueryVisualization:59,SystemForm:60,AppModule:80};var J1=[K.SolutionComponentType.SavedQuery,K.SolutionComponentType.Workflow,K.SolutionComponentType.SavedQueryVisualization,K.SolutionComponentType.SystemForm,K.SolutionComponentType.AppModule];async function Q1(e,t){var r;let n=(0,pt.normalizeGuid)(t,"solutionId"),i=J1.map(l=>`msdyn_componenttype eq ${l}`).join(" or "),a=`/msdyn_solutioncomponentsummaries${(0,pt.odataQuery)([["$select","msdyn_objectid,msdyn_componenttype,msdyn_workflowcategory,msdyn_displayname,msdyn_name"],["$filter",`msdyn_solutionid eq ${n} and (${i})`]])}`,o=[],s=(0,ft.ensureSuccess)(await e.get(a),e.apiUrl(a));for(;;){let l=s.body;for(let c of(r=l?.value)!==null&&r!==void 0?r:[])o.push(c);let u=l?.["@odata.nextLink"];if(!u)break;s=(0,ft.ensureSuccess)(await e.getAbsolute(u),u)}return o.filter(l=>typeof l.msdyn_objectid=="string").map(l=>({objectId:l.msdyn_objectid,componentType:Number(l.msdyn_componenttype),workflowCategory:l.msdyn_workflowcategory==null?void 0:Number(l.msdyn_workflowcategory),displayName:l.msdyn_displayname,name:l.msdyn_name}))}K.fetchSolutionComponents=Q1;function X1(e){let t=e.length===38&&e.startsWith("{")&&e.endsWith("}")?e.slice(1,-1):e;return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(t)}async function K1(e,t){var r,n,i,a,o,s,l,u,c,d;let f=String(t??"").trim();if(!f)throw new Jr.InvalidArgumentError("getSolution: a solution unique name or id is required.");let g=X1(f)?`solutionid eq ${(0,pt.normalizeGuid)(f,"solutionId")}`:`uniquename eq '${(0,pt.odataLiteral)(f)}'`,b=`/solutions${(0,pt.odataQuery)([["$select","solutionid,uniquename,friendlyname,version,ismanaged"],["$expand","publisherid($select=publisherid,uniquename,customizationprefix,customizationoptionvalueprefix)"],["$filter",g]])}`,_=((n=(r=(0,ft.ensureSuccess)(await e.get(b),e.apiUrl(b)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!_?.solutionid)throw new Jr.InvalidArgumentError(`No solution found for '${t}'.`);let T=_.publisherid;if(!T?.publisherid)throw new Jr.InvalidArgumentError(`Solution '${(i=_.uniquename)!==null&&i!==void 0?i:t}' returned no owning publisher, so its customization prefix cannot be determined; refusing to report an empty prefix that could be mistaken for "no prefix".`);if(!("customizationprefix"in T))throw new Jr.InvalidArgumentError(`Solution '${(a=_.uniquename)!==null&&a!==void 0?a:t}' returned a publisher without a customizationprefix property (partial expansion), so its prefix cannot be determined.`);return{solutionId:(0,pt.normalizeGuid)(_.solutionid,"solutionId"),uniqueName:(o=_.uniquename)!==null&&o!==void 0?o:"",friendlyName:(s=_.friendlyname)!==null&&s!==void 0?s:"",version:(l=_.version)!==null&&l!==void 0?l:"",isManaged:!!_.ismanaged,publisherId:(0,pt.normalizeGuid)(T.publisherid,"publisherId"),publisherUniqueName:(u=T.uniquename)!==null&&u!==void 0?u:"",publisherPrefix:(c=T.customizationprefix)!==null&&c!==void 0?c:"",publisherOptionValuePrefix:(d=T.customizationoptionvalueprefix)!==null&&d!==void 0?d:0}}K.getSolution=K1;async function Y1(e,t){var r;let n={uniquename:t.uniqueName,friendlyname:t.friendlyName,customizationprefix:t.prefix,customizationoptionvalueprefix:(r=t.optionValuePrefix)!==null&&r!==void 0?r:1e4};t.description&&(n.description=t.description);let i=(0,ft.ensureSuccess)(await e.post("/publishers",n),e.apiUrl("/publishers")),a=(0,ft.readCreatedId)(i,"publisherid");if(!a)throw new Jr.InvalidArgumentError(`Dataverse did not return an id for publisher '${t.uniqueName}'`);return{id:a,uniqueName:t.uniqueName}}K.createPublisher=Y1;async function Z1(e,t){var r;let n=(0,pt.normalizeGuid)(t.publisherId,"publisherId"),i={uniquename:t.uniqueName,friendlyname:t.friendlyName,version:(r=t.version)!==null&&r!==void 0?r:"1.0.0.0","[email protected]":`/publishers(${n})`};t.description&&(i.description=t.description);let a=(0,ft.ensureSuccess)(await e.post("/solutions",i),e.apiUrl("/solutions")),o=(0,ft.readCreatedId)(a,"solutionid");if(!o)throw new Jr.InvalidArgumentError(`Dataverse did not return an id for solution '${t.uniqueName}'`);return{id:o,uniqueName:t.uniqueName}}K.createSolution=Z1;async function e_(e,t,r){let i=`/solutions(${(0,pt.normalizeGuid)(t,"solutionId")})`;(0,ft.ensureSuccess)(await e.patch(i,{version:r}),e.apiUrl(i))}K.setSolutionVersion=e_;async function t_(e,t){var r;let i={ComponentId:(0,pt.normalizeGuid)(t.componentId,"componentId"),ComponentType:t.componentType,SolutionUniqueName:t.solutionUniqueName,AddRequiredComponents:(r=t.addRequiredComponents)!==null&&r!==void 0?r:!1};t.doNotIncludeSubcomponents!==void 0&&(i.DoNotIncludeSubcomponents=t.doNotIncludeSubcomponents),(0,ft.ensureSuccess)(await e.post("/AddSolutionComponent",i),e.apiUrl("/AddSolutionComponent"))}K.addSolutionComponent=t_;async function r_(e,t,r,n){let a={SolutionComponent:{"@odata.type":"Microsoft.Dynamics.CRM.solutioncomponent",solutioncomponentid:(0,pt.normalizeGuid)(t,"componentId")},ComponentType:r,SolutionUniqueName:n};(0,ft.ensureSuccess)(await e.post("/RemoveSolutionComponent",a),e.apiUrl("/RemoveSolutionComponent"))}K.removeSolutionComponent=r_;async function n_(e,t){var r,n;let i={SolutionName:t.solutionName,Managed:(r=t.managed)!==null&&r!==void 0?r:!1},o=(n=(0,ft.ensureSuccess)(await e.post("/ExportSolution",i),e.apiUrl("/ExportSolution")).body)===null||n===void 0?void 0:n.ExportSolutionFile;if(!o)throw new Jr.InvalidArgumentError(`ExportSolution returned no file for '${t.solutionName}'`);return{base64:o}}K.exportSolution=n_;async function i_(e,t){var r,n;let i={OverwriteUnmanagedCustomizations:(r=t.overwriteUnmanagedCustomizations)!==null&&r!==void 0?r:!0,PublishWorkflows:(n=t.publishWorkflows)!==null&&n!==void 0?n:!0,CustomizationFile:t.base64};t.importJobId&&(i.ImportJobId=(0,pt.normalizeGuid)(t.importJobId,"importJobId")),(0,ft.ensureSuccess)(await e.post("/ImportSolution",i),e.apiUrl("/ImportSolution"))}K.importSolution=i_;async function a_(e,t){let n=`/solutions(${(0,pt.normalizeGuid)(t,"solutionId")})`;(0,ft.ensureSuccess)(await e.delete(n),e.apiUrl(n))}K.deleteSolution=a_});var Of=m(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var Ff=m(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.default="00000000-0000-0000-0000-000000000000"});var Tf=m(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var qi=m(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});var o_=Tf();function s_(e){return typeof e=="string"&&o_.default.test(e)}iu.default=s_});var $i=m(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});var l_=qi();function u_(e){if(!(0,l_.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}au.default=u_});var sr=m(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.unsafeStringify=void 0;var c_=qi(),Ue=[];for(let e=0;e<256;++e)Ue.push((e+256).toString(16).slice(1));function Rf(e,t=0){return(Ue[e[t+0]]+Ue[e[t+1]]+Ue[e[t+2]]+Ue[e[t+3]]+"-"+Ue[e[t+4]]+Ue[e[t+5]]+"-"+Ue[e[t+6]]+Ue[e[t+7]]+"-"+Ue[e[t+8]]+Ue[e[t+9]]+"-"+Ue[e[t+10]]+Ue[e[t+11]]+Ue[e[t+12]]+Ue[e[t+13]]+Ue[e[t+14]]+Ue[e[t+15]]).toLowerCase()}Vi.unsafeStringify=Rf;function d_(e,t=0){let r=Rf(e,t);if(!(0,c_.default)(r))throw TypeError("Stringified UUID is invalid");return r}Vi.default=d_});var So=m(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});var p_=require("crypto"),No=new Uint8Array(256),wo=No.length;function f_(){return wo>No.length-16&&((0,p_.randomFillSync)(No),wo=0),No.slice(wo,wo+=16)}ou.default=f_});var su=m(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.updateV1State=void 0;var xf=So(),m_=sr(),Gi={};function h_(e,t,r){let n,i=e?._v6??!1;if(e){let a=Object.keys(e);a.length===1&&a[0]==="_v6"&&(e=void 0)}if(e)n=Lf(e.random??e.rng?.()??(0,xf.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{let a=Date.now(),o=(0,xf.default)();Mf(Gi,a,o),n=Lf(o,Gi.msecs,Gi.nsecs,i?void 0:Gi.clockseq,i?void 0:Gi.node,t,r)}return t??(0,m_.unsafeStringify)(n)}function Mf(e,t,r){return e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=(r[8]<<8|r[9])&16383),e.msecs=t,e}zi.updateV1State=Mf;function Lf(e,t,r,n,i,a,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!a)a=new Uint8Array(16),o=0;else if(o<0||o+16>a.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);t??=Date.now(),r??=0,n??=(e[8]<<8|e[9])&16383,i??=e.slice(10,16),t+=122192928e5;let s=((t&268435455)*1e4+r)%4294967296;a[o++]=s>>>24&255,a[o++]=s>>>16&255,a[o++]=s>>>8&255,a[o++]=s&255;let l=t/4294967296*1e4&268435455;a[o++]=l>>>8&255,a[o++]=l&255,a[o++]=l>>>24&15|16,a[o++]=l>>>16&255,a[o++]=n>>>8|128,a[o++]=n&255;for(let u=0;u<6;++u)a[o++]=i[u];return a}zi.default=h_});var uu=m(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});var g_=$i(),v_=sr();function b_(e){let t=typeof e=="string"?(0,g_.default)(e):e,r=y_(t);return typeof e=="string"?(0,v_.unsafeStringify)(r):r}lu.default=b_;function y_(e){return Uint8Array.of((e[6]&15)<<4|e[7]>>4&15,(e[7]&15)<<4|(e[4]&240)>>4,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,(e[1]&15)<<4|(e[2]&240)>>4,96|e[2]&15,e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var Uf=m(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});var C_=require("crypto");function A_(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),(0,C_.createHash)("md5").update(e).digest()}cu.default=A_});var Wi=m(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.URL=lr.DNS=lr.stringToBytes=void 0;var Bf=$i(),w_=sr();function kf(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}lr.stringToBytes=kf;lr.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";lr.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function N_(e,t,r,n,i,a){let o=typeof r=="string"?kf(r):r,s=typeof n=="string"?(0,Bf.default)(n):n;if(typeof n=="string"&&(n=(0,Bf.default)(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(s),l.set(o,s.length),l=t(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,i){if(a=a||0,a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let u=0;u<16;++u)i[a+u]=l[u];return i}return(0,w_.unsafeStringify)(l)}lr.default=N_});var $f=m(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.URL=Qr.DNS=void 0;var S_=Uf(),du=Wi(),qf=Wi();Object.defineProperty(Qr,"DNS",{enumerable:!0,get:function(){return qf.DNS}});Object.defineProperty(Qr,"URL",{enumerable:!0,get:function(){return qf.URL}});function pu(e,t,r,n){return(0,du.default)(48,S_.default,e,t,r,n)}pu.DNS=du.DNS;pu.URL=du.URL;Qr.default=pu});var Vf=m(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});var D_=require("crypto");fu.default={randomUUID:D_.randomUUID}});var zf=m(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});var Gf=Vf(),E_=So(),I_=sr();function __(e,t,r){if(Gf.default.randomUUID&&!t&&!e)return Gf.default.randomUUID();e=e||{};let n=e.random??e.rng?.()??(0,E_.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return(0,I_.unsafeStringify)(n)}mu.default=__});var Wf=m(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});var P_=require("crypto");function O_(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),(0,P_.createHash)("sha1").update(e).digest()}hu.default=O_});var Hf=m(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.URL=Xr.DNS=void 0;var F_=Wf(),gu=Wi(),jf=Wi();Object.defineProperty(Xr,"DNS",{enumerable:!0,get:function(){return jf.DNS}});Object.defineProperty(Xr,"URL",{enumerable:!0,get:function(){return jf.URL}});function vu(e,t,r,n){return(0,gu.default)(80,F_.default,e,t,r,n)}vu.DNS=gu.DNS;vu.URL=gu.URL;Xr.default=vu});var Jf=m(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});var T_=sr(),R_=su(),x_=uu();function L_(e,t,r){e??={},r??=0;let n=(0,R_.default)({...e,_v6:!0},new Uint8Array(16));if(n=(0,x_.default)(n),t){if(r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;i++)t[r+i]=n[i];return t}return(0,T_.unsafeStringify)(n)}bu.default=L_});var Qf=m(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});var M_=$i(),U_=sr();function B_(e){let t=typeof e=="string"?(0,M_.default)(e):e,r=k_(t);return typeof e=="string"?(0,U_.unsafeStringify)(r):r}yu.default=B_;function k_(e){return Uint8Array.of((e[3]&15)<<4|e[4]>>4&15,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|e[6]&15,e[7],(e[1]&15)<<4|(e[2]&240)>>4,(e[2]&15)<<4|(e[3]&240)>>4,16|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var Zf=m(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.updateV7State=void 0;var Xf=So(),q_=sr(),Cu={};function $_(e,t,r){let n;if(e)n=Kf(e.random??e.rng?.()??(0,Xf.default)(),e.msecs,e.seq,t,r);else{let i=Date.now(),a=(0,Xf.default)();Yf(Cu,i,a),n=Kf(a,Cu.msecs,Cu.seq,t,r)}return t??(0,q_.unsafeStringify)(n)}function Yf(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}ji.updateV7State=Yf;function Kf(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}ji.default=$_});var em=m(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});var V_=qi();function G_(e){if(!(0,V_.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}Au.default=G_});var wu=m(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.version=Q.validate=Q.v7=Q.v6ToV1=Q.v6=Q.v5=Q.v4=Q.v3=Q.v1ToV6=Q.v1=Q.stringify=Q.parse=Q.NIL=Q.MAX=void 0;var z_=Of();Object.defineProperty(Q,"MAX",{enumerable:!0,get:function(){return z_.default}});var W_=Ff();Object.defineProperty(Q,"NIL",{enumerable:!0,get:function(){return W_.default}});var j_=$i();Object.defineProperty(Q,"parse",{enumerable:!0,get:function(){return j_.default}});var H_=sr();Object.defineProperty(Q,"stringify",{enumerable:!0,get:function(){return H_.default}});var J_=su();Object.defineProperty(Q,"v1",{enumerable:!0,get:function(){return J_.default}});var Q_=uu();Object.defineProperty(Q,"v1ToV6",{enumerable:!0,get:function(){return Q_.default}});var X_=$f();Object.defineProperty(Q,"v3",{enumerable:!0,get:function(){return X_.default}});var K_=zf();Object.defineProperty(Q,"v4",{enumerable:!0,get:function(){return K_.default}});var Y_=Hf();Object.defineProperty(Q,"v5",{enumerable:!0,get:function(){return Y_.default}});var Z_=Jf();Object.defineProperty(Q,"v6",{enumerable:!0,get:function(){return Z_.default}});var eP=Qf();Object.defineProperty(Q,"v6ToV1",{enumerable:!0,get:function(){return eP.default}});var tP=Zf();Object.defineProperty(Q,"v7",{enumerable:!0,get:function(){return tP.default}});var rP=qi();Object.defineProperty(Q,"validate",{enumerable:!0,get:function(){return rP.default}});var nP=em();Object.defineProperty(Q,"version",{enumerable:!0,get:function(){return nP.default}})});var Ft=m(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.assignMissingIds=In.newId=void 0;var iP=wu();function tm(){return(0,iP.v4)()}In.newId=tm;function aP(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var oP=new Set(["parameters","bag"]);function sP(e){return Nu(e),e}In.assignMissingIds=sP;function Nu(e){if(Array.isArray(e)){e.forEach(t=>Nu(t));return}if(aP(e)){(typeof e.id!="string"||e.id.length===0)&&(e.id=tm());for(let t of Object.keys(e))t==="id"||oP.has(t)||Nu(e[t])}}});var _u=m(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.appApi=_n.deleteAppResolvingOnce=void 0;var Fe=$e(),ce=ue(),Du=Ft(),mt=be(),sm=(0,ce.odataQuery)([["$select","appmoduleid,name,uniquename,description"]]),lP=(0,ce.odataQuery)([["$select","appmoduleid,name,uniquename,description"]]);function Do(e,t){return"/sitemaps/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ce.odataQuery)([["$select",t],["$filter",`sitemapid eq ${e}`],["$top",1]])}function Eu(e){var t;let r=(t=e.body)===null||t===void 0?void 0:t.value;if(Array.isArray(r))return r[0]}function Iu(e){let t=e?.["@odata.etag"];return typeof t=="string"?t:null}function Hi(e){let t=new Set,r=[];for(let n of e??[])n&&!t.has(n)&&(t.add(n),r.push(n));return r}function uP(e){return`cdsapp_${(e||"").replace(/[^a-zA-Z0-9]/g,"")||"app"}`}async function lm(e,t){var r,n;let i=u=>{throw new mt.SdkError("APP_SITEMAP_UNRESOLVED",`The sitemap lookup for app uniquename '${t??""}' ${u}, so it cannot be determined whether this app has a sitemap. Retry; if the app is newly created, publish it first (an unpublished app is not readable).`)};if(!t)return i("cannot run because the app record carried no uniquename");let a=`/sitemaps${(0,ce.odataQuery)([["$select","sitemapid"],["$filter",`sitemapnameunique eq '${(0,ce.odataLiteral)(t)}'`],["$top",1]])}`,o;try{o=await e.get(a)}catch(u){return i(`failed (${u.message})`)}if(o.status<200||o.status>=300)return i(`returned HTTP ${o.status}`);let s=(r=o.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(s))return i("returned a malformed body");let l=(n=s[0])===null||n===void 0?void 0:n.sitemapid;return s.length>0&&!l?i("returned a row with no sitemapid"):l}async function cP(e){let t=s=>{var l,u,c;return(c=(u=(l=s.body)===null||l===void 0?void 0:l.value)===null||u===void 0?void 0:u[0])===null||c===void 0?void 0:c.webresourceid},r=s=>`/webresourceset${(0,ce.odataQuery)([["$select","webresourceid"],["$top",1],["$filter",s]])}`,n=await e.get(r("webresourcetype eq 5 and ismanaged eq false and contains(name,'icon')")),i=t(n);if(i)return i;let a=await e.get(r("webresourcetype eq 5 and ismanaged eq false")),o=t(a);return o||t(await e.get(r("ismanaged eq false")))}async function dP(e,t){var r,n,i;try{let a=`/roles${(0,ce.odataQuery)([["$select","roleid"],["$filter","name eq 'System Administrator'"],["$top",1]])}`,s=(i=(n=(r=(await e.get(a)).body)===null||r===void 0?void 0:r.value)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.roleid;if(!s)return;let l=`/appmodules(${t})/appmoduleroles_association/$ref`;await e.post(l,{"@odata.id":e.apiUrl(`/roles(${s})`)})}catch{}}async function pP(e,t){async function r(o,s){var l,u;try{let c=await e.get(o);return c.status<200||c.status>=300?[]:((u=(l=c.body)===null||l===void 0?void 0:l.value)!==null&&u!==void 0?u:[]).map(f=>String(f[s])).filter(f=>f&&f!=="undefined")}catch{return[]}}let[n,i,a]=await Promise.all([r(`/systemforms${(0,ce.odataQuery)([["$select","formid"],["$filter",`objecttypecode eq '${(0,ce.odataLiteral)(t)}' and type eq 2 and formactivationstate eq 1`]])}`,"formid"),r(`/savedqueries${(0,ce.odataQuery)([["$select","savedqueryid"],["$filter",`returnedtypecode eq '${(0,ce.odataLiteral)(t)}' and querytype eq 0 and statecode eq 0`]])}`,"savedqueryid"),r(`/savedqueryvisualizations${(0,ce.odataQuery)([["$select","savedqueryvisualizationid"],["$filter",`primaryentitytypecode eq '${(0,ce.odataLiteral)(t)}'`]])}`,"savedqueryvisualizationid")]);return{forms:n,views:i,charts:a}}var rm=new WeakMap;async function fP(e,t){let r=rm.get(e);r||(r=new Map,rm.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=await mP(e,t);return i&&r.set(t,i),i}async function nm(e,t,r){let n=new Array(e.length),i=0;async function a(){for(let o=i;o<e.length;o=i)i=o+1,n[o]=await r(e[o])}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>a())),n}async function mP(e,t){var r;let n=`/EntityDefinitions(LogicalName='${(0,ce.odataLiteral)(t)}')${(0,ce.odataQuery)([["$select","MetadataId"]])}`,i=await e.get(n);if(i.status>=200&&i.status<300)return(r=i.body)===null||r===void 0?void 0:r.MetadataId}async function im(e,t){let r=[],n=Hi(t.entities),i=4,a=await nm(n,i,c=>fP(e,c));for(let c of a)c&&r.push({"@odata.type":"Microsoft.Dynamics.CRM.entity",entityid:c});for(let c of Hi(t.components.forms))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:c});for(let c of Hi(t.components.views))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:c});for(let c of Hi(t.components.charts))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:c});for(let c of Hi(t.components.dashboards))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:c});let o=new Set(t.components.forms),s=new Set(t.components.views),l=new Set(t.components.charts),u=await nm(n,i,c=>pP(e,c));for(let c of u){for(let d of c.forms)o.has(d)||(o.add(d),r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:d}));for(let d of c.views)s.has(d)||(s.add(d),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:d}));for(let d of c.charts)l.has(d)||(l.add(d),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:d}))}return r}async function am(e,t,r){if(r.length===0)return;let n="/AddAppComponents";(0,Fe.ensureSuccess)(await e.post(n,{AppId:t,Components:r}),e.apiUrl(n))}async function hP(e,t,r){let n=`/appmodules(${t})`,i=`/sitemaps(${r.sitemapId})`;try{if(!await gP(e,r.sitemapId)){r.serverRefusedSitemap&&(0,Fe.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}e.supportsAtomicBatch&&await cm(e,[{path:n,etag:r.appEtag},{path:i,etag:r.sitemapEtag}])}catch{}}async function gP(e,t){var r;let n=Do(t,"sitemapid"),i=await e.get(n);if(i.status<200||i.status>=300)throw new mt.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned HTTP ${i.status}, so it cannot be determined whether the row exists.`);let a=(r=i.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(a))throw new mt.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned no readable result set, so it cannot be determined whether the row exists.`);return a.length>0}async function um(e,t){var r;let n=(0,ce.normalizeGuid)(t,"id"),i=b=>{throw new mt.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to delete app '${n}': ${b} Deleting the app would destroy the only pointer to its sitemap, stranding that row and reserving its unique name forever. Retry; if the app is newly created, publish it first (an unpublished app is not readable).`)},a=`/appmodules(${n})${sm}`,o;try{o=await e.get(a)}catch(b){return i(`reading the app failed (${b.message}).`)}if(o.status<200||o.status>=300)return i(o.status===404?"reading the app returned HTTP 404, which does NOT prove it is absent \u2014 Dataverse also reports an unpublished app that way, and such an app still owns a sitemap.":`reading the app returned HTTP ${o.status}.`);let s=(r=o.body)===null||r===void 0?void 0:r.uniquename;if(!s)return i("the app record carried no uniquename, so its sitemap cannot be located.");let l=await lm(e,s);if(!l)return{uniquename:s,appEtag:(0,Fe.readEtag)(o)};let u=(0,ce.normalizeGuid)(l,"sitemapId"),c=Do(u,"sitemapid,sitemapnameunique,sitemapxml"),d;try{d=await e.get(c)}catch(b){return i(`reading sitemap '${u}' failed (${b.message}).`)}if(d.status<200||d.status>=300)return i(`reading sitemap '${u}' returned HTTP ${d.status}.`);let f=Eu(d);if(!f)return i(`sitemap '${u}' was not returned by the unpublished-aware read.`);if(f.sitemapnameunique!==s)return i(`sitemap '${u}' now carries sitemapnameunique '${String(f.sitemapnameunique)}', not '${s}', so it is no longer this app's sitemap.`);let g=f.sitemapxml;return typeof g!="string"?i(`sitemap '${u}' returned no sitemapxml.`):{sitemapId:u,uniquename:s,sitemapXml:g,appEtag:(0,Fe.readEtag)(o),sitemapEtag:Iu(f)}}async function vP(e,t,r){let n=(0,ce.normalizeGuid)(t,"id"),i=await um(e,n);await r?.(i.sitemapXml),await dm(e,n,i)}_n.deleteAppResolvingOnce=vP;async function cm(e,t){let r=`batch_${(0,Du.newId)()}`,n=`changeset_${(0,Du.newId)()}`,i=t.map((d,f)=>[`--${n}`,"Content-Type: application/http","Content-Transfer-Encoding: binary",`Content-ID: ${f+1}`,"",`DELETE ${e.apiUrl(d.path)} HTTP/1.1`,...d.etag?[`If-Match: ${d.etag}`]:[],""].join(`\r+`)),a=[`--${r}`,`Content-Type: multipart/mixed;boundary=${n}`,"",...i,`--${n}--`,`--${r}--`,""].join(`\r+`),o=await e.postBatch(a,r),s=e.apiUrl("/$batch");(0,Fe.ensureSuccess)(o,s);let l=`app '${t[0].path}'`;if(typeof o.body!="string"||o.body.length===0)throw new mt.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response had no readable body, so the change set's outcome is unknown`);let u=bP(o.body,i.map((d,f)=>String(f+1)));if(u===void 0)throw new mt.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response could not be parsed as a change set, so the outcome is unknown`);let c=u.find(d=>d<200||d>=300);if(c!==void 0)throw new mt.ConnectionError(s,c,`atomic delete of ${l} was rolled back: the change set reported HTTP ${c}`);if(u.length!==i.length)throw new mt.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response reported ${u.length} operation result(s), expected exactly ${i.length}`)}function bP(e,t){var r,n,i,a;if(typeof e!="string"||e.length===0)return;let o=(r=/^--(\S+)\r?\n/.exec(e))===null||r===void 0?void 0:r[1];if(o===void 0||!e.trimEnd().endsWith(`--${o}--`))return;let s=(n=/Content-Type:\s*multipart\/mixed;\s*boundary=(\S+)/i.exec(e))===null||n===void 0?void 0:n[1];if(s===void 0||s===o)return;let l=e.split(`--${s}`);if(l.length<2||!/^--(\r?\n|$)/.test(l[l.length-1]))return;let u=new Set(t),c=[],d=new Set;for(let f of l.slice(1)){if(f.startsWith("--"))break;let g=f.indexOf(`\r+\r+`);if(g===-1)return;let b=f.slice(0,g),w=f.slice(g+4);if(!/^Content-Type:\s*application\/http\b/im.test(b))return;let N=/^HTTP\/1\.[01] (\d{3})\b/.exec(w);if(!N||((i=w.match(/^HTTP\/1\.[01] \d{3}\b/gm))!==null&&i!==void 0?i:[]).length!==1)return;let _=(a=/^Content-ID:\s*(\S+)/im.exec(b))===null||a===void 0?void 0:a[1];if(_===void 0||d.has(_)||!u.has(_))return;d.add(_),c.push(Number(N[1]))}return c.length===0?void 0:c}async function om(e,t){try{let r=Do(t,"sitemapid"),n=await e.get(r);return n.status<200||n.status>=300?null:Iu(Eu(n))}catch{return null}}function yP(e){return e>=400&&e<500&&e!==408&&e!==429}function Su(e,t,r){if(!e)throw new mt.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to delete app '${t}': the ${r} read returned no ETag, so the delete cannot be made conditional on the row that was actually inspected. Without that condition a row renamed or re-pointed between the read and the delete would be destroyed. Retry.`);return e}async function dm(e,t,r){let n=`/appmodules(${t})`;if(!r.sitemapId){await CP(e,n,Su(r.appEtag,t,"app"));return}if(!e.supportsAtomicBatch)throw new mt.SdkError("APP_DELETE_NOT_ATOMIC",`Refusing to delete app '${t}': it owns a sitemap, and the injected HttpClient cannot send a raw body, so the two rows would have to be deleted as separate requests. A failure between them strands the sitemap and permanently reserves the app's unique name. Implement HttpClient.postRaw so the SDK can delete them atomically.`);await cm(e,[{path:n,etag:Su(r.appEtag,t,"app")},{path:`/sitemaps(${r.sitemapId})`,etag:Su(r.sitemapEtag,t,"sitemap")}])}async function CP(e,t,r){(0,Fe.ensureSuccess)(await e.delete(t,{headers:{"If-Match":r}}),e.apiUrl(t))}_n.appApi={async get(e,t){var r;let n=(0,ce.normalizeGuid)(t,"id"),i=`/appmodules(${n})${sm}`,o=(r=(0,Fe.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)!==null&&r!==void 0?r:{},s=await lm(e,o.uniquename),l=s?(0,ce.normalizeGuid)(s,"sitemapId"):void 0,u=null;if(l){let c=Do(l,"sitemapid,sitemapname,sitemapnameunique,sitemapxml"),d=(0,Fe.ensureSuccess)(await e.get(c),e.apiUrl(c)),f=Eu(d);if(f&&f.sitemapnameunique!==o.uniquename)throw new mt.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to fetch app '${n}': sitemap '${l}' now carries sitemapnameunique '${String(f.sitemapnameunique)}', not '${String(o.uniquename)}', so it is no longer this app's sitemap. Retry.`);o.$sitemap=f??{},u=Iu(f)}return{raw:o,etag:u}},async list(e,t){var r;let n=`/appmodules${lP}`,a=(0,Fe.ensureSuccess)(await e.get(n),e.apiUrl(n)).body;return((r=a?.value)!==null&&r!==void 0?r:[]).map(s=>{var l,u;return{type:"app",id:(l=s.appmoduleid)!==null&&l!==void 0?l:"",name:(u=s.name)!==null&&u!==void 0?u:"",isDirty:!1}})},async create(e,t){let r=t,n=r.iconWebResourceId||await cP(e),i=r.appModuleUniqueName||uP(r.appModuleId),a={name:r.appModuleName,uniquename:i,clienttype:4,formfactor:1,navigationtype:0};r.appModuleDescription&&(a.description=r.appModuleDescription),n&&(a.webresourceid=n);let o="/appmodules",s=(0,Fe.ensureSuccess)(await e.post(o,a),e.apiUrl(o)),l=(0,Fe.requireCreatedId)(s,"appmoduleid","app module"),u=null,c=(0,Du.newId)(),d=!1;try{let f="/sitemaps",g=await e.post(f,{sitemapid:c,sitemapnameunique:i,sitemapname:r.sitemapname,sitemapxml:r.sitemapxml});d=yP(g.status);let b=(0,Fe.ensureSuccess)(g,e.apiUrl(f));u=(0,Fe.readEtag)(b),u||(u=await om(e,c));let w=await im(e,r);w.unshift({"@odata.type":"Microsoft.Dynamics.CRM.sitemap",sitemapid:c}),await am(e,l,w),await dP(e,l);let N="/PublishXml";(0,Fe.ensureSuccess)(await e.post(N,{ParameterXml:`<importexportxml><appmodules><appmodule>${l}</appmodule></appmodules></importexportxml>`}),e.apiUrl(N))}catch(f){throw await hP(e,l,{sitemapId:c,serverRefusedSitemap:d,appEtag:(0,Fe.readEtag)(s),sitemapEtag:u}),f}return{id:l,etag:u,serverIdentity:{sitemapId:c}}},async update(e,t,r,n){var i;let a=r,o=(0,ce.normalizeGuid)(t,"id");if(!a.sitemapId)throw new mt.ValidationError("app",o,"/sitemapId","missing sitemap identity \u2014 re-fetch the app before pushing edits");let s=(0,ce.normalizeGuid)(a.sitemapId,"sitemapId");if(!n)throw new mt.SdkError("APP_UPDATE_NO_ETAG",`Refusing to push app '${o}': no concurrency token is held for its sitemap row, so the write could not be made conditional and would silently overwrite a concurrent edit. Re-fetch the app and re-apply the change.`);let l={"If-Match":n},u=`/sitemaps(${s})`,c=(0,Fe.ensureSuccess)(await e.patch(u,{sitemapxml:a.sitemapxml,sitemapname:a.sitemapname},l?{headers:l}:void 0),e.apiUrl(u)),d=`/appmodules(${o})`;(0,Fe.ensureSuccess)(await e.patch(d,{name:a.appModuleName,description:a.appModuleDescription}),e.apiUrl(d));let f=[];try{await am(e,o,await im(e,a))}catch(g){f.push(`App '${o}': one or more components were not pinned (${g.message}). Navigation may reference content not included in the app; re-push to retry.`)}return{id:o,etag:(i=(0,Fe.readEtag)(c))!==null&&i!==void 0?i:await om(e,s),...f.length>0?{warnings:f}:{}}},async delete(e,t){let r=(0,ce.normalizeGuid)(t,"id");await dm(e,r,await um(e,r))}}});var Ji=m(Pn=>{"use strict";function AP(e,t,r){if(r===void 0&&(r=Array.prototype),e&&typeof r.find=="function")return r.find.call(e,t);for(var n=0;n<e.length;n++)if(Object.prototype.hasOwnProperty.call(e,n)){var i=e[n];if(t.call(void 0,i,n,e))return i}}function Pu(e,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(e):e}function wP(e,t){if(e===null||typeof e!="object")throw new TypeError("target is not an object");for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}var pm=Pu({HTML:"text/html",isHTML:function(e){return e===pm.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),fm=Pu({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===fm.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Pn.assign=wP;Pn.find=AP;Pn.freeze=Pu;Pn.MIME_TYPE=pm;Pn.NAMESPACE=fm});var $u=m(pr=>{var Am=Ji(),Gt=Am.find,Qi=Am.NAMESPACE;function NP(e){return e!==""}function SP(e){return e?e.split(/[\t\n\f\r ]+/).filter(NP):[]}function DP(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function mm(e){if(!e)return[];var t=SP(e);return Object.keys(t.reduce(DP,{}))}function EP(e){return function(t){return e&&e.indexOf(t)!==-1}}function Ki(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function nt(e,t){var r=e.prototype;if(!(r instanceof t)){let i=function(){};var n=i;i.prototype=t.prototype,i=new i,Ki(r,i),e.prototype=r=i}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var it={},bt=it.ELEMENT_NODE=1,Fn=it.ATTRIBUTE_NODE=2,Io=it.TEXT_NODE=3,wm=it.CDATA_SECTION_NODE=4,Nm=it.ENTITY_REFERENCE_NODE=5,IP=it.ENTITY_NODE=6,Ou=it.PROCESSING_INSTRUCTION_NODE=7,Fu=it.COMMENT_NODE=8,Sm=it.DOCUMENT_NODE=9,Dm=it.DOCUMENT_TYPE_NODE=10,ur=it.DOCUMENT_FRAGMENT_NODE=11,_P=it.NOTATION_NODE=12,Ge={},Re={},L9=Ge.INDEX_SIZE_ERR=(Re[1]="Index size error",1),M9=Ge.DOMSTRING_SIZE_ERR=(Re[2]="DOMString size error",2),rt=Ge.HIERARCHY_REQUEST_ERR=(Re[3]="Hierarchy request error",3),U9=Ge.WRONG_DOCUMENT_ERR=(Re[4]="Wrong document",4),PP=Ge.INVALID_CHARACTER_ERR=(Re[5]="Invalid character",5),B9=Ge.NO_DATA_ALLOWED_ERR=(Re[6]="No data allowed",6),k9=Ge.NO_MODIFICATION_ALLOWED_ERR=(Re[7]="No modification allowed",7),Em=Ge.NOT_FOUND_ERR=(Re[8]="Not found",8),q9=Ge.NOT_SUPPORTED_ERR=(Re[9]="Not supported",9),hm=Ge.INUSE_ATTRIBUTE_ERR=(Re[10]="Attribute in use",10),On=Ge.INVALID_STATE_ERR=(Re[11]="Invalid state",11),$9=Ge.SYNTAX_ERR=(Re[12]="Syntax error",12),V9=Ge.INVALID_MODIFICATION_ERR=(Re[13]="Invalid modification",13),G9=Ge.NAMESPACE_ERR=(Re[14]="Invalid namespace",14),z9=Ge.INVALID_ACCESS_ERR=(Re[15]="Invalid access",15);function te(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,Re[e]),this.message=Re[e],Error.captureStackTrace&&Error.captureStackTrace(this,te);return r.code=e,t&&(this.message=this.message+": "+t),r}te.prototype=Error.prototype;Ki(Ge,te);function cr(){}cr.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t,r){for(var n=!!r&&!!r.requireWellFormed,i=[],a=0;a<this.length;a++)qu(this[a],i,e,t,null,n);return i.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}};function Tn(e,t){this._node=e,this._refresh=t,Tu(this)}function Tu(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(Bm(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)Object.prototype.hasOwnProperty.call(e,n)&&delete e[n];Ki(r,e),e._inc=t}}Tn.prototype.item=function(e){return Tu(this),this[e]||null};nt(Tn,cr);function _o(){}function Im(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function gm(e,t,r,n){if(n?t[Im(t,n)]=r:t[t.length++]=r,e){r.ownerElement=e;var i=e.ownerDocument;i&&(n&&Om(i,e,n),OP(i,e,r))}}function vm(e,t,r){var n=Im(t,r);if(n>=0){for(var i=t.length-1;n<i;)t[n]=t[++n];if(t.length=i,e){var a=e.ownerDocument;a&&(Om(a,e,r),r.ownerElement=null)}}else throw new te(Em,new Error(e.tagName+"@"+r))}_o.prototype={length:0,item:cr.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new te(hm);var r=this.getNamedItem(e.nodeName);return gm(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t=e.ownerElement,r;if(t&&t!=this._ownerElement)throw new te(hm);return r=this.getNamedItemNS(e.namespaceURI,e.localName),gm(this._ownerElement,this,e,r),r},removeNamedItem:function(e){var t=this.getNamedItem(e);return vm(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return vm(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var n=this[r];if(n.localName==t&&n.namespaceURI==e)return n}return null}};function _m(){}_m.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new Yi;if(n.implementation=this,n.childNodes=new cr,n.doctype=r||null,r&&n.appendChild(r),t){var i=n.createElementNS(e,t);n.appendChild(i)}return n},createDocumentType:function(e,t,r){var n=new To;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n}};function Y(){}Y.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return Oo(this,e,t)},replaceChild:function(e,t){Oo(this,e,t,Tm),t&&this.removeChild(t)},removeChild:function(e){return Fm(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return Um(this.ownerDocument||this,this,e)},normalize:function(){Te(this,null,{enter:function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;r!==null&&r.nodeType===Io&&t.nodeType===Io?(e.removeChild(r),t.appendData(r.data)):t=r}return!0}})},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&r[n]===e)return n}t=t.nodeType==Fn?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==Fn?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return t==null}};function Pm(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}Ki(it,Y);Ki(it,Y.prototype);function Po(e,t){return Te(e,null,{enter:function(r){return t(r)?Te.STOP:!0}})===Te.STOP}function Te(e,t,r){for(var n=[{node:e,context:t,phase:Te.ENTER}];n.length>0;){var i=n.pop();if(i.phase===Te.ENTER){var a=r.enter(i.node,i.context);if(a===Te.STOP)return Te.STOP;if(n.push({node:i.node,context:a,phase:Te.EXIT}),a==null)continue;for(var o=i.node.lastChild;o;)n.push({node:o,context:a,phase:Te.ENTER}),o=o.previousSibling}else r.exit&&r.exit(i.node,i.context)}}Te.STOP=Symbol("walkDOM.STOP");Te.ENTER=0;Te.EXIT=1;function Yi(){this.ownerDocument=this}function OP(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===Qi.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function Om(e,t,r,n){e&&e._inc++;var i=r.namespaceURI;i===Qi.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function Ru(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r)n[n.length++]=r;else{for(var i=t.firstChild,a=0;i;)n[a++]=i,i=i.nextSibling;n.length=a,delete n[n.length]}}}function Fm(e,t){var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,Ru(e.ownerDocument,e),t}function FP(e){return e&&(e.nodeType===Y.DOCUMENT_NODE||e.nodeType===Y.DOCUMENT_FRAGMENT_NODE||e.nodeType===Y.ELEMENT_NODE)}function TP(e){return e&&(zt(e)||xu(e)||dr(e)||e.nodeType===Y.DOCUMENT_FRAGMENT_NODE||e.nodeType===Y.COMMENT_NODE||e.nodeType===Y.PROCESSING_INSTRUCTION_NODE)}function dr(e){return e&&e.nodeType===Y.DOCUMENT_TYPE_NODE}function zt(e){return e&&e.nodeType===Y.ELEMENT_NODE}function xu(e){return e&&e.nodeType===Y.TEXT_NODE}function bm(e,t){var r=e.childNodes||[];if(Gt(r,zt)||dr(t))return!1;var n=Gt(r,dr);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function ym(e,t){var r=e.childNodes||[];function n(a){return zt(a)&&a!==t}if(Gt(r,n))return!1;var i=Gt(r,dr);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function RP(e,t,r){if(!FP(e))throw new te(rt,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new te(Em,"child not in parent");if(!TP(t)||dr(t)&&e.nodeType!==Y.DOCUMENT_NODE)throw new te(rt,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function xP(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===Y.DOCUMENT_FRAGMENT_NODE){var a=i.filter(zt);if(a.length>1||Gt(i,xu))throw new te(rt,"More than one element or text in fragment");if(a.length===1&&!bm(e,r))throw new te(rt,"Element in fragment can not be inserted before doctype")}if(zt(t)&&!bm(e,r))throw new te(rt,"Only one element can be added and only after doctype");if(dr(t)){if(Gt(n,dr))throw new te(rt,"Only one doctype is allowed");var o=Gt(n,zt);if(r&&n.indexOf(o)<n.indexOf(r))throw new te(rt,"Doctype can only be inserted before an element");if(!r&&o)throw new te(rt,"Doctype can not be appended since element is present")}}function Tm(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===Y.DOCUMENT_FRAGMENT_NODE){var a=i.filter(zt);if(a.length>1||Gt(i,xu))throw new te(rt,"More than one element or text in fragment");if(a.length===1&&!ym(e,r))throw new te(rt,"Element in fragment can not be inserted before doctype")}if(zt(t)&&!ym(e,r))throw new te(rt,"Only one element can be added and only after doctype");if(dr(t)){let l=function(u){return dr(u)&&u!==r};var s=l;if(Gt(n,l))throw new te(rt,"Only one doctype is allowed");var o=Gt(n,zt);if(r&&n.indexOf(o)<n.indexOf(r))throw new te(rt,"Doctype can only be inserted before an element")}}function Oo(e,t,r,n){RP(e,t,r),e.nodeType===Y.DOCUMENT_NODE&&(n||xP)(e,t,r);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===ur){var a=t.firstChild;if(a==null)return t;var o=t.lastChild}else a=o=t;var s=r?r.previousSibling:e.lastChild;a.previousSibling=s,o.nextSibling=r,s?s.nextSibling=a:e.firstChild=a,r==null?e.lastChild=o:r.previousSibling=o;do{a.parentNode=e;var l=e.ownerDocument||e;Xi(a,l)}while(a!==o&&(a=a.nextSibling));return Ru(e.ownerDocument||e,e),t.nodeType==ur&&(t.firstChild=t.lastChild=null),t}function Xi(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===bt&&e.attributes)for(var r=0;r<e.attributes.length;r++){var n=e.attributes.item(r);n&&(n.ownerDocument=t)}for(var i=e.firstChild;i;)Xi(i,t),i=i.nextSibling}}function LP(e,t){t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,Ru(e.ownerDocument,e,t);var r=e.ownerDocument||e;return Xi(t,r),t}Yi.prototype={nodeName:"#document",nodeType:Sm,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==ur){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return Oo(this,e,t),Xi(e,this),this.documentElement===null&&e.nodeType===bt&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),Fm(this,e)},replaceChild:function(e,t){Oo(this,e,t,Tm),Xi(e,this),t&&this.removeChild(t),zt(e)&&(this.documentElement=e)},importNode:function(e,t){return MP(this,e,t)},getElementById:function(e){var t=null;return Po(this.documentElement,function(r){if(r.nodeType==bt&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=mm(e);return new Tn(this,function(r){var n=[];return t.length>0&&Po(r.documentElement,function(i){if(i!==r&&i.nodeType===bt){var a=i.getAttribute("class");if(a){var o=e===a;if(!o){var s=mm(a);o=t.every(EP(s))}o&&n.push(i)}}}),n})},createElement:function(e){var t=new Kr;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new cr;var r=t.attributes=new _o;return r._ownerElement=t,t},createDocumentFragment:function(){var e=new Ro;return e.ownerDocument=this,e.childNodes=new cr,e},createTextNode:function(e){var t=new Lu;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Mu;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new te(PP,'data contains "]]>"');var t=new Uu;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new ku;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new Fo;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Bu;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Kr,n=t.split(":"),i=r.attributes=new _o;return r.childNodes=new cr,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,i._ownerElement=r,r},createAttributeNS:function(e,t){var r=new Fo,n=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,r}};nt(Yi,Y);function Kr(){this._nsMap={}}Kr.prototype={nodeType:bt,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===ur?this.insertBefore(e,null):LP(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return this.getAttributeNodeNS(e,t)!=null},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+r,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new Tn(this,function(t){var r=[];return Po(t,function(n){n!==t&&n.nodeType==bt&&(e==="*"||n.tagName==e)&&r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new Tn(this,function(r){var n=[];return Po(r,function(i){i!==r&&i.nodeType===bt&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};Yi.prototype.getElementsByTagName=Kr.prototype.getElementsByTagName;Yi.prototype.getElementsByTagNameNS=Kr.prototype.getElementsByTagNameNS;nt(Kr,Y);function Fo(){}Fo.prototype.nodeType=Fn;nt(Fo,Y);function Zi(){}Zi.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(Re[rt])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){var n=this.data.substring(0,e),i=this.data.substring(e+t);r=n+r+i,this.nodeValue=this.data=r,this.length=r.length}};nt(Zi,Y);function Lu(){}Lu.prototype={nodeName:"#text",nodeType:Io,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};nt(Lu,Zi);function Mu(){}Mu.prototype={nodeName:"#comment",nodeType:Fu};nt(Mu,Zi);function Uu(){}Uu.prototype={nodeName:"#cdata-section",nodeType:wm};nt(Uu,Zi);function To(){}To.prototype.nodeType=Dm;nt(To,Y);function Rm(){}Rm.prototype.nodeType=_P;nt(Rm,Y);function xm(){}xm.prototype.nodeType=IP;nt(xm,Y);function Bu(){}Bu.prototype.nodeType=Nm;nt(Bu,Y);function Ro(){}Ro.prototype.nodeName="#document-fragment";Ro.prototype.nodeType=ur;nt(Ro,Y);function ku(){}ku.prototype.nodeType=Ou;nt(ku,Y);function Lm(){}Lm.prototype.serializeToString=function(e,t,r,n){return Mm.call(e,t,r,n)};Y.prototype.toString=Mm;function Mm(e,t,r){var n=!!r&&!!r.requireWellFormed,i=[],a=this.nodeType==9&&this.documentElement||this,o=a.prefix,s=a.namespaceURI;if(s&&o==null){var o=a.lookupPrefix(s);if(o==null)var l=[{namespace:s,prefix:null}]}return qu(this,i,e,t,l,n),i.join("")}function Cm(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!i||n==="xml"&&i===Qi.XML||i===Qi.XMLNS)return!1;for(var a=r.length;a--;){var o=r[a];if(o.prefix===n)return o.namespace!==i}return!0}function Eo(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,Pm),'"')}function qu(e,t,r,n,i,a){i||(i=[]),Te(e,{ns:i,isHTML:r},{enter:function(o,s){var l=s.ns,u=s.isHTML;if(n)if(o=n(o),o){if(typeof o=="string")return t.push(o),null}else return null;switch(o.nodeType){case bt:var c=o.attributes,d=c.length,f=o.tagName;u=Qi.isHTML(o.namespaceURI)||u;var g=f;if(!u&&!o.prefix&&o.namespaceURI){for(var b,w=0;w<c.length;w++)if(c.item(w).name==="xmlns"){b=c.item(w).value;break}if(!b)for(var N=l.length-1;N>=0;N--){var _=l[N];if(_.prefix===""&&_.namespace===o.namespaceURI){b=_.namespace;break}}if(b!==o.namespaceURI)for(var N=l.length-1;N>=0;N--){var _=l[N];if(_.namespace===o.namespaceURI){_.prefix&&(g=_.prefix+":"+f);break}}}t.push("<",g);for(var T=l.slice(),R=0;R<d;R++){var M=c.item(R);M.prefix=="xmlns"?T.push({prefix:M.localName,namespace:M.value}):M.nodeName=="xmlns"&&T.push({prefix:"",namespace:M.value})}for(var R=0;R<d;R++){var M=c.item(R);if(Cm(M,u,T)){var W=M.prefix||"",B=M.namespaceURI;Eo(t,W?"xmlns:"+W:"xmlns",B),T.push({prefix:W,namespace:B})}var j=n?n(M):M;j&&(typeof j=="string"?t.push(j):Eo(t,j.name,j.value))}if(f===g&&Cm(o,u,T)){var k=o.prefix||"",B=o.namespaceURI;Eo(t,k?"xmlns:"+k:"xmlns",B),T.push({prefix:k,namespace:B})}var $=o.firstChild;if($||u&&!/^(?:meta|link|img|br|hr|input)$/i.test(f)){if(t.push(">"),u&&/^script$/i.test(f)){for(;$;)$.data?t.push($.data):qu($,t,u,n,T.slice(),a),$=$.nextSibling;return t.push("</",f,">"),null}return{ns:T,isHTML:u,tag:g}}else return t.push("/>"),null;case Sm:case ur:return{ns:l.slice(),isHTML:u,tag:null};case Fn:return Eo(t,o.name,o.value),null;case Io:return t.push(o.data.replace(/[<&>]/g,Pm)),null;case wm:if(a&&o.data.indexOf("]]>")!==-1)throw new te(On,'The CDATASection data contains "]]>"');return t.push("<![CDATA[",o.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case Fu:if(a&&o.data.indexOf("-->")!==-1)throw new te(On,'The comment node data contains "-->"');return t.push("<!--",o.data,"-->"),null;case Dm:if(a){if(o.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(o.publicId))throw new te(On,"DocumentType publicId is not a valid PubidLiteral");if(o.systemId&&!/^("[^"]*"|'[^']*')$/.test(o.systemId))throw new te(On,"DocumentType systemId is not a valid SystemLiteral");if(o.internalSubset&&o.internalSubset.indexOf("]>")!==-1)throw new te(On,'DocumentType internalSubset contains "]>"')}var re=o.publicId,H=o.systemId;if(t.push("<!DOCTYPE ",o.name),re)t.push(" PUBLIC ",re),H&&H!="."&&t.push(" ",H),t.push(">");else if(H&&H!=".")t.push(" SYSTEM ",H,">");else{var nr=o.internalSubset;nr&&t.push(" [",nr,"]"),t.push(">")}return null;case Ou:if(a&&o.data.indexOf("?>")!==-1)throw new te(On,'The ProcessingInstruction data contains "?>"');return t.push("<?",o.target," ",o.data,"?>"),null;case Nm:return t.push("&",o.nodeName,";"),null;default:return t.push("??",o.nodeName),null}},exit:function(o,s){s&&s.tag&&t.push("</",s.tag,">")}})}function MP(e,t,r){var n;return Te(t,null,{enter:function(i,a){var o=i.cloneNode(!1);o.ownerDocument=e,o.parentNode=null,a===null?n=o:a.appendChild(o);var s=i.nodeType===Fn||r;return s?o:null}}),n}function Um(e,t,r){var n;return Te(t,null,{enter:function(i,a){var o=new i.constructor;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){var l=i[s];typeof l!="object"&&l!=o[s]&&(o[s]=l)}i.childNodes&&(o.childNodes=new cr),o.ownerDocument=e;var u=r;switch(o.nodeType){case bt:var c=i.attributes,d=o.attributes=new _o,f=c.length;d._ownerElement=o;for(var g=0;g<f;g++)o.setAttributeNode(Um(e,c.item(g),!0));break;case Fn:u=!0}return a!==null?a.appendChild(o):n=o,u?o:null}}),n}function Bm(e,t,r){e[t]=r}try{Object.defineProperty&&(Object.defineProperty(Tn.prototype,"length",{get:function(){return Tu(this),this.$$length}}),Object.defineProperty(Y.prototype,"textContent",{get:function(){if(this.nodeType===bt||this.nodeType===ur){var e=[];return Te(this,null,{enter:function(t){if(t.nodeType===bt||t.nodeType===ur)return!0;if(t.nodeType===Ou||t.nodeType===Fu)return null;e.push(t.nodeValue)}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case bt:case ur:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),Bm=function(e,t,r){e["$$"+t]=r})}catch{}pr.DocumentType=To;pr.DOMException=te;pr.DOMImplementation=_m;pr.Element=Kr;pr.Node=Y;pr.NodeList=cr;pr.walkDOM=Te;pr.XMLSerializer=Lm});var qm=m(ea=>{"use strict";var km=Ji().freeze;ea.XML_ENTITIES=km({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});ea.HTML_ENTITIES=km({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`+`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});ea.entityMap=ea.HTML_ENTITIES});var Jm=m(Gu=>{var ia=Ji().NAMESPACE,Vu=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,$m=new RegExp("[\\-\\.0-9"+Vu.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Vm=new RegExp("^"+Vu.source+$m.source+"*(?::"+Vu.source+$m.source+"*)?$"),ta=0,Or=1,Rn=2,ra=3,xn=4,Ln=5,na=6,xo=7;function Mn(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Mn)}Mn.prototype=new Error;Mn.prototype.name=Mn.name;function Wm(){}Wm.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),jm(t,t={}),UP(e,t,r,n,this.errorHandler),n.endDocument()}};function UP(e,t,r,n,i){function a(le){if(le>65535){le-=65536;var tt=55296+(le>>10),Il=56320+(le&1023);return String.fromCharCode(tt,Il)}else return String.fromCharCode(le)}function o(le){var tt=le.slice(1,-1);return Object.hasOwnProperty.call(r,tt)?r[tt]:tt.charAt(0)==="#"?a(parseInt(tt.substr(1).replace("x","0x"))):(i.error("entity not found:"+le),le)}function s(le){if(le>w){var tt=e.substring(w,le).replace(/&#?\w+;/g,o);f&&l(w),n.characters(tt,0,le-w),w=le}}function l(le,tt){for(;le>=c&&(tt=d.exec(e));)u=tt.index,c=u+tt[0].length,f.lineNumber++;f.columnNumber=le-u+1}for(var u=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,f=n.locator,g=[{currentNSMap:t}],b={},w=0;;){try{var N=e.indexOf("<",w);if(N<0){if(!e.substr(w).match(/^\s*$/)){var _=n.doc,T=_.createTextNode(e.substr(w));_.appendChild(T),n.currentElement=T}return}switch(N>w&&s(N),e.charAt(N+1)){case"/":var H=e.indexOf(">",N+3),R=e.substring(N+2,H).replace(/[ \t\n\r]+$/g,""),M=g.pop();H<0?(R=e.substring(N+2).replace(/[\s<].*/,""),i.error("end tag name: "+R+" is not complete:"+M.tagName),H=N+1+R.length):R.match(/\s</)&&(R=R.replace(/[\s<].*/,""),i.error("end tag name: "+R+" maybe not complete"),H=N+1+R.length);var W=M.localNSMap,B=M.tagName==R,j=B||M.tagName&&M.tagName.toLowerCase()==R.toLowerCase();if(j){if(n.endElement(M.uri,M.localName,R),W)for(var k in W)Object.prototype.hasOwnProperty.call(W,k)&&n.endPrefixMapping(k);B||i.fatalError("end tag name: "+R+" is not match the current start tagName:"+M.tagName)}else g.push(M);H++;break;case"?":f&&l(N),H=VP(e,N,n);break;case"!":f&&l(N),H=$P(e,N,n,i);break;default:f&&l(N);var $=new Hm,re=g[g.length-1].currentNSMap,H=BP(e,N,$,re,o,i),nr=$.length;if(!$.closed&&qP(e,H,$.tagName,b)&&($.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),f&&nr){for(var El=Gm(f,{}),Oi=0;Oi<nr;Oi++){var io=$[Oi];l(io.offset),io.locator=Gm(f,{})}n.locator=El,zm($,n,re)&&g.push($),n.locator=f}else zm($,n,re)&&g.push($);ia.isHTML($.uri)&&!$.closed?H=kP(e,H,$.tagName,o,n):H++}}catch(le){if(le instanceof Mn)throw le;i.error("element parse error: "+le),H=-1}H>w?w=H:s(Math.max(N,w)+1)}}function Gm(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function BP(e,t,r,n,i,a){function o(g,b,w){r.attributeNames.hasOwnProperty(g)&&a.fatalError("Attribute "+g+" redefined"),r.addValue(g,b.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),w)}for(var s,l,u=++t,c=ta;;){var d=e.charAt(u);switch(d){case"=":if(c===Or)s=e.slice(t,u),c=ra;else if(c===Rn)c=ra;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===ra||c===Or)if(c===Or&&(a.warning('attribute value must after "="'),s=e.slice(t,u)),t=u+1,u=e.indexOf(d,t),u>0)l=e.slice(t,u),o(s,l,t-1),c=Ln;else throw new Error("attribute value no end '"+d+"' match");else if(c==xn)l=e.slice(t,u),o(s,l,t),a.warning('attribute "'+s+'" missed start quot('+d+")!!"),t=u+1,c=Ln;else throw new Error('attribute value must after "="');break;case"/":switch(c){case ta:r.setTagName(e.slice(t,u));case Ln:case na:case xo:c=xo,r.closed=!0;case xn:case Or:break;case Rn:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),c==ta&&r.setTagName(e.slice(t,u)),u;case">":switch(c){case ta:r.setTagName(e.slice(t,u));case Ln:case na:case xo:break;case xn:case Or:l=e.slice(t,u),l.slice(-1)==="/"&&(r.closed=!0,l=l.slice(0,-1));case Rn:c===Rn&&(l=s),c==xn?(a.warning('attribute "'+l+'" missed quot(")!'),o(s,l,t)):((!ia.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),o(l,l,t));break;case ra:throw new Error("attribute value missed!!")}return u;case"\x80":d=" ";default:if(d<=" ")switch(c){case ta:r.setTagName(e.slice(t,u)),c=na;break;case Or:s=e.slice(t,u),c=Rn;break;case xn:var l=e.slice(t,u);a.warning('attribute "'+l+'" missed quot(")!!'),o(s,l,t);case Ln:c=na;break}else switch(c){case Rn:var f=r.tagName;(!ia.isHTML(n[""])||!s.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=u,c=Or;break;case Ln:a.warning('attribute space is required"'+s+'"!!');case na:c=Or,t=u;break;case ra:c=xn,t=u;break;case xo:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function zm(e,t,r){for(var n=e.tagName,i=null,d=e.length;d--;){var a=e[d],o=a.qName,s=a.value,f=o.indexOf(":");if(f>0)var l=a.prefix=o.slice(0,f),u=o.slice(f+1),c=l==="xmlns"&&u;else u=o,l=null,c=o==="xmlns"&&"";a.localName=u,c!==!1&&(i==null&&(i={},jm(r,r={})),r[c]=i[c]=s,a.uri=ia.XMLNS,t.startPrefixMapping(c,s))}for(var d=e.length;d--;){a=e[d];var l=a.prefix;l&&(l==="xml"&&(a.uri=ia.XML),l!=="xmlns"&&(a.uri=r[l||""]))}var f=n.indexOf(":");f>0?(l=e.prefix=n.slice(0,f),u=e.localName=n.slice(f+1)):(l=null,u=e.localName=n);var g=e.uri=r[l||""];if(t.startElement(g,u,n,e),e.closed){if(t.endElement(g,u,n),i)for(l in i)Object.prototype.hasOwnProperty.call(i,l)&&t.endPrefixMapping(l)}else return e.currentNSMap=r,e.localNSMap=i,!0}function kP(e,t,r,n,i){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",t),o=e.substring(t+1,a);if(/[&<]/.test(o))return/^script$/i.test(r)?(i.characters(o,0,o.length),a):(o=o.replace(/&#?\w+;/g,n),i.characters(o,0,o.length),a)}return t+1}function qP(e,t,r,n){var i=n[r];return i==null&&(i=e.lastIndexOf("</"+r+">"),i<t&&(i=e.lastIndexOf("</"+r)),n[r]=i),i<t}function jm(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function $P(e,t,r,n){var i=e.charAt(t+2);switch(i){case"-":if(e.charAt(t+3)==="-"){var a=e.indexOf("-->",t+4);return a>t?(r.comment(e,t+4,a-t-4),a+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(e.substr(t+3,6)=="CDATA["){var a=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,a-t-9),r.endCDATA(),a+3}var o=GP(e,t),s=o.length;if(s>1&&/!doctype/i.test(o[0][0])){var l=o[1][0],u=!1,c=!1;s>3&&(/^public$/i.test(o[2][0])?(u=o[3][0],c=s>4&&o[4][0]):/^system$/i.test(o[2][0])&&(c=o[3][0]));var d=o[s-1];return r.startDTD(l,u,c),r.endDTD(),d.index+d[0].length}}return-1}function VP(e,t,r){var n=e.indexOf("?>",t);if(n){var i=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(i){var a=i[0].length;return r.processingInstruction(i[1],i[2]),n+2}else return-1}return-1}function Hm(){this.attributeNames={}}Hm.prototype={setTagName:function(e){if(!Vm.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!Vm.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function GP(e,t){var r,n=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=t,i.exec(e);r=i.exec(e);)if(n.push(r),r[1])return n}Gu.XMLReader=Wm;Gu.ParseError=Mn});var th=m(Mo=>{var zP=Ji(),WP=$u(),Qm=qm(),Ym=Jm(),jP=WP.DOMImplementation,Xm=zP.NAMESPACE,HP=Ym.ParseError,JP=Ym.XMLReader;function Zm(e){return e.replace(/\r[\n\u0085]/g,``).replace(/[\r\u0085\u2028]/g,`-`)}function T2(e){this.options=e||{locator:{}}}T2.prototype.parseFromString=function(e,t){var r=this.options,n=new sk,i=r.domBuilder||new Va,a=r.errorHandler,o=r.locator,s=r.xmlns||{},l=/\/x?html?$/.test(t),u=l?_2.HTML_ENTITIES:_2.XML_ENTITIES;o&&i.setDocumentLocator(o),n.errorHandler=lk(a,i,o),n.domBuilder=r.domBuilder||i,l&&(s[""]=P2.HTML),s.xml=s.xml||P2.XML;var c=r.normalizeLineEndings||R2;return e&&typeof e=="string"?n.parse(c(e),s,u):n.errorHandler.error("invalid doc source"),i.doc};function lk(e,t,r){if(!e){if(t instanceof Va)return t;e=t}var n={},i=e instanceof Function;r=r||{};function a(o){var s=e[o];!s&&i&&(s=e.length==2?function(l){e(o,l)}:e),n[o]=s&&function(l){s("[xmldom "+o+"] "+l+Dd(r))}||function(){}}return a("warning"),a("error"),a("fatalError"),n}function Va(){this.cdata=!1}function ci(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}Va.prototype={startDocument:function(){this.doc=new ak().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,n){var i=this.doc,a=i.createElementNS(e,r||t),o=n.length;Ls(this,a),this.currentElement=a,this.locator&&ci(this.locator,a);for(var s=0;s<o;s++){var e=n.getURI(s),l=n.getValue(s),r=n.getQName(s),u=i.createAttributeNS(e,r);this.locator&&ci(n.getLocator(s),u),u.value=u.nodeValue=l,a.setAttributeNode(u)}},endElement:function(e,t,r){var n=this.currentElement,i=n.tagName;this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&ci(this.locator,r),Ls(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=O2.apply(this,arguments),e){if(this.cdata)var n=this.doc.createCDATASection(e);else var n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&ci(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=O2.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&ci(this.locator,n),Ls(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var i=n.createDocumentType(e,t,r);this.locator&&ci(this.locator,i),Ls(this,i),this.doc.doctype=i}},warning:function(e){console.warn("[xmldom warning] "+e,Dd(this.locator))},error:function(e){console.error("[xmldom error] "+e,Dd(this.locator))},fatalError:function(e){throw new ok(e,this.locator)}};function Dd(e){if(e)return`-@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function O2(e,t,r){return typeof e=="string"?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){Va.prototype[e]=function(){return null}});function Ls(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Us.__DOMHandler=Va;Us.normalizeLineEndings=R2;Us.DOMParser=T2});var U2=f(Ms=>{var L2=Nd();Ms.DOMImplementation=L2.DOMImplementation;Ms.XMLSerializer=L2.XMLSerializer;Ms.DOMParser=x2().DOMParser});var cn=f(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.installDomShim=void 0;var M2=U2(),B2=!1,uk={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};function ck(){if(B2)return;let e=globalThis;typeof e.DOMParser>"u"&&(e.DOMParser=M2.DOMParser),typeof e.XMLSerializer>"u"&&(e.XMLSerializer=M2.XMLSerializer),typeof e.Node>"u"&&(e.Node=uk),B2=!0}Bs.installDomShim=ck});var Y2=f(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.classIdForAttributeType=lt.QUICK_VIEW_CLASS_ID=lt.NOTES_CLASS_ID=lt.SUBGRID_CLASS_ID=lt.formRegistration=lt.FormAdapter=void 0;var yt=(Ae(),Lt(Df)),dk=(be(),Lt(Ef)),pk=(Oe(),Lt(_f)),We=(G(),Lt(If)),Se=(Hr(),Lt(Pf)),fk=(Pc(),Lt(cA)),mk=(pA(),Lt(dA)),De=on(),dn=Br(),hk=bA(),gk=zt(),Pd=ue(),G2=cn(),Ht=1033,vk={[We.FormType.Main]:"Main",[We.FormType.QuickCreate]:"QuickCreate",[We.FormType.QuickViewForm]:"QuickView",[We.FormType.Card]:"Card"},Ed={Main:We.FormType.Main,QuickCreate:We.FormType.QuickCreate,QuickView:We.FormType.QuickViewForm,Card:We.FormType.Card},bk=new Map(Object.entries(Se.ControlClassId).map(([e,t])=>[String(t).toUpperCase(),e]));function z2(e){var t;return e&&(t=bk.get(e.toUpperCase()))!==null&&t!==void 0?t:"Unknown"}function Ga(e){return e.getAllProperties().map(t=>[t.key,t.value])}function pn(e){let t=new Map;for(let r of e.getAllProperties())t.has(r.key)||t.set(r.key,r.value);return t}function W2(e,t){return e.getAllChildren().find(r=>r.getNodeName()===t)}function Od(e){var t,r;let n=W2(e,"labels");if(!n)return"";let i=n.getAllChildren().filter(o=>o.getNodeName()==="label"),a=(t=i.find(o=>pn(o).get("languagecode")===String(Ht)))!==null&&t!==void 0?t:i[0];return a&&(r=pn(a).get("description"))!==null&&r!==void 0?r:""}function yk(e){let t=W2(e,"parameters"),r={};if(!t)return r;for(let n of t.getAllChildren()){let i=n.getNodeName();if(i.charAt(0)==="<"||i.charAt(0)==="#")continue;let a=n.getAllChildren()[0],o=a?a.getNodeName():"";o.charAt(0)==="<"&&(o=o.substring(1)),r[i]=o}return r}function j2(e){return/^1+$/.test(e)&&e.length>=1&&e.length<=4?e.length:1}function Id(e){let t=Math.min(Math.max(Math.trunc(e),1),4);return"1".repeat(t)}function fn(e){return e.replace(/[{}]/g,"")}function _d(e){return`{${fn(e)}}`}function k2(e,t){if(e===void 0||e==="")return t;let r=Number(e);return Number.isNaN(r)?t:r}function qs(e,t,r){let n=e.getAllChildren(),i=n.findIndex(u=>u.getNodeName()===t),a=[];if(n.forEach((u,c)=>{c!==i&&a.push({i:c,node:(0,De.rawFromNode)(u)})}),i<0)return{modeled:[],bag:{a:Ga(e),c:a}};let o=n[i],s=[],l=[];return o.getAllChildren().forEach((u,c)=>{u.getNodeName()===r?s.push(u):l.push({i:c,node:(0,De.rawFromNode)(u)})}),{modeled:s,bag:{a:Ga(e),c:a,w:{n:o.getNodeName(),a:Ga(o),c:l}}}}function H2(e,t,r){let n=[],i=[];return e.getAllChildren().forEach((a,o)=>{a.getNodeName()===t&&(!r||n.length===0)?n.push(a):i.push({i:o,node:(0,De.rawFromNode)(a)})}),{modeled:n,bag:{a:Ga(e),c:i}}}function Ck(e){let{modeled:t,bag:r}=qs(e,"tabs","tab");return{tabs:t.map(Ak),bag:r}}function Ak(e){var t,r;let n=pn(e),{modeled:i,bag:a}=qs(e,"columns","column");return{id:(t=n.get("id"))!==null&&t!==void 0?t:"",name:(r=n.get("name"))!==null&&r!==void 0?r:"",label:Od(e),expanded:n.get("expanded")==="true",visible:n.has("visible")?n.get("visible")==="true":!0,columns:i.map(Nk),bag:a}}function Nk(e){let t=pn(e),{modeled:r,bag:n}=qs(e,"sections","section");return{width:t.get("width"),sections:r.map(wk),bag:n}}function wk(e){var t,r,n;let i=pn(e),{modeled:a,bag:o}=qs(e,"rows","row");return{id:(t=i.get("id"))!==null&&t!==void 0?t:"",name:(r=i.get("name"))!==null&&r!==void 0?r:"",label:Od(e),visible:i.has("visible")?i.get("visible")==="true":!0,showLabel:i.get("showlabel")==="true",columns:j2((n=i.get("columns"))!==null&&n!==void 0?n:"1"),rows:a.map(Sk),bag:o}}function Sk(e){let{modeled:t,bag:r}=H2(e,"cell",!1);return{cells:t.map(Dk),bag:r}}function Dk(e){var t;let r=pn(e),{modeled:n,bag:i}=H2(e,"control",!0),a=Od(e),o=r.get("showlabel")==="true",s=n[0]?Ek(n[0],a,o):null;return{id:(t=r.get("id"))!==null&&t!==void 0?t:"",visible:r.has("visible")?r.get("visible")==="true":!0,colspan:k2(r.get("colspan"),1),rowspan:k2(r.get("rowspan"),1),control:s,bag:i}}function Ek(e,t,r){var n,i;let a=pn(e),o=fn((n=a.get("classid"))!==null&&n!==void 0?n:""),s=a.get("datafieldname");return{id:(i=a.get("id"))!==null&&i!==void 0?i:"",classId:o,fieldName:s||null,type:z2(o),isRequired:a.get("isrequired")==="true",isReadOnly:a.get("disabled")==="true",label:t,showLabel:r,parameters:yk(e),bag:{a:Ga(e),c:e.getAllChildren().map((l,u)=>({i:u,node:(0,De.rawFromNode)(l)}))}}}function di(e){return e.a.length===0&&e.c.length===0&&!e.w}function J2(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function mn(e,t){var r;let n=new Set(e.a.map(o=>o[0])),i=di(e),a=[];for(let o of t)if(n.has(o.key)){let s=(r=J2(e,o.key))!==null&&r!==void 0?r:"";o.matches(s)||a.push([o.key,o.render()])}else i?a.push([o.key,o.render()]):o.matches(o.absentDefault)||a.push([o.key,o.render()]);return(0,De.mergeAttrs)(e.a,a)}var qr=(e,t)=>({key:e,matches:r=>r===t,render:()=>t,absentDefault:""}),$r=(e,t,r=!1)=>({key:e,matches:n=>n==="true"===t,render:()=>String(t),absentDefault:String(r)}),q2=(e,t,r=1)=>({key:e,matches:n=>Number(n)===t,render:()=>String(t),absentDefault:String(r)});function Fd(e){return{n:"labels",a:[],c:[{n:"label",a:[["description",e],["languagecode",String(Ht)]],c:[]}]}}function Q2(e){return{n:"parameters",a:[],c:Object.keys(e).map(t=>({n:(0,Pd.assertXmlName)(t,"Form control parameter name"),a:[],c:[{n:`<${e[t]}`,a:[],c:[]}]}))}}function Ik(e){var t,r;let n=e.c.find(a=>a.n==="label"&&a.a.some(o=>o[0]==="languagecode"&&o[1]===String(Ht))),i=n??e.c.find(a=>a.n==="label");return(r=(t=i?.a.find(a=>a[0]==="description"))===null||t===void 0?void 0:t[1])!==null&&r!==void 0?r:""}function _k(e,t){let r=!1,n=e.c.map(i=>i.n!=="label"||!i.a.some(o=>o[0]==="languagecode"&&o[1]===String(Ht))?i:(r=!0,{...i,a:i.a.map(o=>o[0]==="description"?["description",t]:o)}));return r||n.push({n:"label",a:[["description",t],["languagecode",String(Ht)]],c:[]}),{...e,c:n}}function Rd(e,t){let r=e.c.findIndex(i=>i.node.n==="labels");if(r<0||Ik(e.c[r].node)===t)return e;let n=_k(e.c[r].node,t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function Pk(e){let t={};for(let r of e.c){let n=r.n;if(n.charAt(0)==="<"||n.charAt(0)==="#")continue;let i=r.c[0],a=i?i.n:"";a.charAt(0)==="<"&&(a=a.substring(1)),t[n]=a}return t}function Ok(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(i=>e[i]===t[i])}function Fk(e,t){return e.a.some(r=>r[0]===t)?{...e,a:e.a.filter(r=>r[0]!==t)}:e}function Rk(e,t){let r=e.c.findIndex(i=>i.node.n==="parameters");if(r<0||Ok(Pk(e.c[r].node),t))return e;let n=Q2(t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function $s(e,t,r,n){if(e.w){let o={n:e.w.n,a:e.w.a.map(s=>[s[0],s[1]]),c:(0,De.spliceChildren)(e.w.c,r)};return(0,De.spliceChildren)(e.c,[o])}let i=n(),a={n:t,a:[],c:r};return e.c.length===0?[...i,a]:(0,De.spliceChildren)(e.c,[...i,a])}function Tk(e){let t=e.tabs.map(xk);return{n:"form",a:mn(e.bag,[]),c:e.tabs.length===0&&di(e.bag)?[]:$s(e.bag,"tabs",t,()=>[])}}function xk(e){let t=[qr("id",e.id),qr("name",e.name),$r("expanded",e.expanded),$r("visible",e.visible,!0)],r=e.columns.map(Lk),n=Rd(e.bag,e.label);return{n:"tab",a:mn(n,t),c:$s(n,"columns",r,()=>e.label?[Fd(e.label)]:[])}}function Lk(e){let t=e.width!==void 0?[qr("width",e.width)]:[],r=e.sections.map(Uk);return{n:"column",a:mn(e.bag,t),c:$s(e.bag,"sections",r,()=>[])}}function Uk(e){let t=[qr("id",e.id),qr("name",e.name),$r("showlabel",e.showLabel),$r("visible",e.visible,!0),{key:"columns",matches:i=>j2(i)===e.columns,render:()=>Id(e.columns),absentDefault:Id(1)}],r=e.rows.map(Mk),n=Rd(e.bag,e.label);return{n:"section",a:mn(n,t),c:$s(n,"rows",r,()=>e.label?[Fd(e.label)]:[])}}function Mk(e){let t=e.cells.map(Bk);return{n:"row",a:mn(e.bag,[]),c:di(e.bag)?t:(0,De.assembleChildren)(e.bag,t)}}function Bk(e){let t=e.control?e.control.showLabel:J2(e.bag,"showlabel")==="true",r=[qr("id",e.id),$r("showlabel",t),$r("visible",e.visible,!0),q2("colspan",e.colspan),q2("rowspan",e.rowspan)],n=e.control?[kk(e.control)]:[],i;if(di(e.bag))i=[...e.control&&e.control.label?[Fd(e.control.label)]:[],...n];else{let a=e.control?Rd(e.bag,e.control.label):e.bag;i=(0,De.assembleChildren)(a,n)}return{n:"cell",a:mn(e.bag,r),c:i}}function kk(e){let t=[qr("id",e.id),{key:"classid",matches:i=>fn(i)===e.classId,render:()=>_d(e.classId),absentDefault:""}];e.fieldName!==null&&t.push(qr("datafieldname",e.fieldName)),t.push($r("disabled",e.isReadOnly)),t.push($r("isrequired",e.isRequired));let r=e.fieldName===null?Fk(e.bag,"datafieldname"):e.bag,n;return di(r)?n=Object.keys(e.parameters).length>0?[Q2(e.parameters)]:[]:n=(0,De.assembleChildren)(Rk(r,e.parameters),[]),{n:"control",a:mn(r,t),c:n}}var qk={make:(e,t)=>new pk.FormElementNode(e,t),setProp:(e,t,r)=>e.setProperty(t,r),addChild:(e,t)=>e.addChild(t)};function $2(e,t){(0,G2.installDomShim)();let r=Vk(e,t),n=(0,De.rebuildRaw)(Tk(r),qk,null);return new mk.SerializationService(Ht).serializeFormXmlNode(n)}function $k(e){return JSON.parse(JSON.stringify(e))}function Vk(e,t){var r;let n=$k(e);n.bag||(n.bag=(0,De.emptyBag)()),Xk(n.bag),t&&Gk(n,t);for(let i of(r=n.tabs)!==null&&r!==void 0?r:[])zk(i);return n}function Gk(e,t){var r;let n=(r=e.entityLogicalName)!==null&&r!==void 0?r:"";X2(e,i=>{let a=i.fieldName,o=i;if(!a||o.label!==void 0&&o.classId!==void 0)return;let s=t.resolveField(n,a);s&&(o.label===void 0&&s.displayName&&(o.label=s.displayName),o.classId===void 0&&s.attributeType&&(o.classId=K2(s.attributeType)))})}function X2(e,t){var r,n,i,a,o;for(let s of(r=e.tabs)!==null&&r!==void 0?r:[])for(let l of(n=s.columns)!==null&&n!==void 0?n:[])for(let u of(i=l.sections)!==null&&i!==void 0?i:[])for(let c of(a=u.rows)!==null&&a!==void 0?a:[])for(let p of(o=c.cells)!==null&&o!==void 0?o:[])p.control&&t(p.control)}function zk(e){e.id||(e.id=yt.Guid.NewGuid()),e.name===void 0&&(e.name=""),e.label===void 0&&(e.label=""),e.expanded===void 0&&(e.expanded=!0),e.visible===void 0&&(e.visible=!0),e.columns||(e.columns=[]);for(let t of e.columns)Wk(t);e.bag||(e.bag=(0,De.emptyBag)())}function Wk(e){e.sections||(e.sections=[]);for(let t of e.sections)jk(t);e.bag||(e.bag=(0,De.emptyBag)()),e.width===void 0&&di(e.bag)&&(e.width="100%")}function jk(e){e.id||(e.id=yt.Guid.NewGuid()),e.name===void 0&&(e.name=""),e.label===void 0&&(e.label=""),e.showLabel===void 0&&(e.showLabel=!1),e.visible===void 0&&(e.visible=!0),e.columns===void 0&&(e.columns=1),e.rows||(e.rows=[]);for(let t of e.rows)Hk(t);e.bag||(e.bag=(0,De.emptyBag)())}function Hk(e){e.cells||(e.cells=[]);for(let t of e.cells)Jk(t);e.bag||(e.bag=(0,De.emptyBag)())}function Jk(e){e.id||(e.id=yt.Guid.NewGuid()),e.visible===void 0&&(e.visible=!0),e.colspan===void 0&&(e.colspan=1),e.rowspan===void 0&&(e.rowspan=1),e.control===void 0&&(e.control=null),e.control&&Qk(e.control),e.bag||(e.bag=(0,De.emptyBag)())}function Qk(e){var t;e.id||(e.id=yt.Guid.NewGuid()),e.classId===void 0&&(e.classId=String(Se.ControlClassId.TextboxControl)),e.fieldName===void 0&&(e.fieldName=null),e.type===void 0&&(e.type=e.fieldName?"Field":z2(String(e.classId))),e.isRequired===void 0&&(e.isRequired=!1),e.isReadOnly===void 0&&(e.isReadOnly=!1),e.label===void 0&&(e.label=(t=e.fieldName)!==null&&t!==void 0?t:""),e.showLabel===void 0&&(e.showLabel=!0),(e.parameters===void 0||e.parameters===null)&&(e.parameters={});for(let r of Object.keys(e.parameters))(0,Pd.assertXmlName)(r,"Form control parameter name");e.bag||(e.bag=(0,De.emptyBag)())}function Xk(e){for(let t of e.c){let r=t.node;if(r.n==="events"){for(let n of r.c)if(n.n==="event"){for(let i of n.c)if(i.n==="Handlers")for(let a of i.c)a.n==="Handler"&&!V2(a,"handlerUniqueId")&&a.a.push(["handlerUniqueId",_d(yt.Guid.NewGuid())])}}else if(r.n==="formLibraries")for(let n of r.c)n.n==="Library"&&!V2(n,"libraryUniqueId")&&n.a.push(["libraryUniqueId",_d(yt.Guid.NewGuid())])}}var ks=class{toArtifact(t){var r,n,i;let{tabs:a,bag:o}=Ck(t);return{id:t.formId?t.formId.guidString:"",name:(r=t.formName)!==null&&r!==void 0?r:"",entityLogicalName:(n=t.entityName)!==null&&n!==void 0?n:"",formType:(i=vk[t.formType])!==null&&i!==void 0?i:"Main",status:this.readActivationStatus(t),tabs:a,bag:o}}fromArtifact(t){return this.deserialize({formxml:$2(t),formid:t.id||yt.Guid.NewGuid(),objecttypecode:t.entityLogicalName,type:Ed[t.formType],name:t.name,uniquename:t.name,description:"",formpresentation:We.FormPresentation.AirForm,formactivationstate:t.status==="Active"?We.FormActivationState.Active:We.FormActivationState.InActive})}fromApiResponse(t){var r,n,i,a,o,s;let l=t,u=this.deserialize({formxml:(r=l.formxml)!==null&&r!==void 0?r:"",formid:(n=l.formid)!==null&&n!==void 0?n:yt.Guid.NewGuid(),objecttypecode:(i=l.objecttypecode)!==null&&i!==void 0?i:"",type:l.type,name:(a=l.name)!==null&&a!==void 0?a:"",uniquename:(o=l.uniquename)!==null&&o!==void 0?o:"",description:(s=l.description)!==null&&s!==void 0?s:"",formpresentation:l.formpresentation,formactivationstate:l.formactivationstate});return this.toArtifact(u)}toApiPayload(t,r,n){return{formxml:$2(t,n),name:t.name,type:Ed[t.formType],objecttypecode:t.entityLogicalName}}metadataNeeds(t){let r=t.entityLogicalName;if(!r)return[];let n=new Set,i=[];return X2(t,a=>{let o=a.fieldName,s=a;!o||s.label!==void 0&&s.classId!==void 0||n.has(o)||(n.add(o),i.push({entityLogicalName:r,fieldName:o}))}),i}createDefault(t){var r,n,i,a,o,s,l,u,c,p;let m=t.tabs&&t.tabs.length>0?void 0:a3,v=m!==void 0?m:t.tabs.map(P=>Kk(P)).join(""),C=this.deserialize({formxml:`<form><tabs>${v}</tabs></form>`,formid:t.id||yt.Guid.NewGuid(),objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",type:Ed[(n=t.formType)!==null&&n!==void 0?n:"Main"],name:(i=t.name)!==null&&i!==void 0?i:"New Form",uniquename:(a=t.name)!==null&&a!==void 0?a:"New Form",description:"",formpresentation:We.FormPresentation.AirForm,formactivationstate:((o=t.status)!==null&&o!==void 0?o:"Active")==="Active"?We.FormActivationState.Active:We.FormActivationState.InActive}),w=this.toArtifact(C);return{id:(s=t.id)!==null&&s!==void 0?s:w.id,name:(l=t.name)!==null&&l!==void 0?l:"New Form",entityLogicalName:(u=t.entityLogicalName)!==null&&u!==void 0?u:"",formType:(c=t.formType)!==null&&c!==void 0?c:"Main",status:(p=t.status)!==null&&p!==void 0?p:"Active",tabs:w.tabs,bag:w.bag}}assignMissingIds(t){return(0,gk.assignMissingIds)(t)}validate(t){return s3(t)}deserialize(t){(0,G2.installDomShim)();let r=dk.ScriptUtilities.ParseXml(t.formxml),n=new fk.DeserializationService(Ht).deSerializeFormXml(r,new yt.Guid(t.formid),t.objecttypecode,We.FormState.Draft,t.name,t.uniquename,t.type,t.formpresentation,t.description,t.formactivationstate);if(!n)throw new Error("FormXml could not be deserialized into a Form model.");return n}readActivationStatus(t){return t.formactivationstate===We.FormActivationState.InActive?"Inactive":"Active"}};lt.FormAdapter=ks;function Ft(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Td(e){return e?`<labels><label description="${Ft(e)}" languagecode="${Ht}" /></labels>`:""}function Kk(e){let t=(e.columns.length>0?e.columns:[i3()]).map(r=>Yk(r)).join("");return`<tab id="{${Ft(fn(e.id))}}" name="${Ft(e.name)}" expanded="${e.expanded}" visible="${e.visible}">${Td(e.label)}<columns>${t}</columns></tab>`}function Yk(e){var t;let r=e.sections.map(n=>Zk(n)).join("");return`<column width="${Ft((t=e.width)!==null&&t!==void 0?t:"100%")}"><sections>${r}</sections></column>`}function Zk(e){let t=e.rows.map(r=>e3(r)).join("");return`<section id="{${Ft(fn(e.id))}}" name="${Ft(e.name)}" showlabel="${e.showLabel}" visible="${e.visible}" columns="${Id(e.columns)}">${Td(e.label)}<rows>${t}</rows></section>`}function e3(e){return`<row>${e.cells.map(t=>t3(t)).join("")}</row>`}function t3(e){let t=e.control,r=t?Td(t.label):"",n=t?r3(t):"";return`<cell id="{${Ft(fn(e.id))}}" showlabel="${t?t.showLabel:!1}" visible="${e.visible}" colspan="${e.colspan}" rowspan="${e.rowspan}">${r}${n}</cell>`}function r3(e){let t=e.fieldName?` datafieldname="${Ft(e.fieldName)}"`:"",r=n3(e.parameters);return`<control id="${Ft(e.id)}" classid="{${Ft(fn(e.classId))}}"${t} disabled="${e.isReadOnly}" isrequired="${e.isRequired}">${r}</control>`}function n3(e){let t=Object.keys(e);return t.length===0?"":(t.forEach(n=>(0,Pd.assertXmlName)(n,"Form control parameter name")),`<parameters>${t.map(n=>`<${n}>${Ft(e[n])}</${n}>`).join("")}</parameters>`)}function i3(){return{width:"100%",sections:[],bag:{a:[],c:[]}}}var a3=`<tab id="{${yt.Guid.NewGuid()}}" name="tab_general" expanded="true" visible="true"><labels><label description="General" languagecode="${Ht}" /></labels><columns><column width="100%"><sections><section id="{${yt.Guid.NewGuid()}}" name="section_general" showlabel="false" visible="true" columns="1"><labels><label description="General" languagecode="${Ht}" /></labels><rows></rows></section></sections></column></columns></tab>`;function o3(){return{adapter:new ks,api:hk.formApi}}lt.formRegistration=o3;function s3(e){let t=[];return(0,dn.childObjects)(e,"tabs","","tab",t).forEach(({node:n,index:i})=>{(0,dn.childObjects)(n,"columns",`/tabs/${i}`,"column",t).forEach(({node:o,index:s})=>{let l=`/tabs/${i}/columns/${s}`;(0,dn.childObjects)(o,"sections",l,"section",t).forEach(({node:c,index:p})=>{let m=`${l}/sections/${p}`;(0,dn.childObjects)(c,"rows",m,"row",t).forEach(({node:C,index:w})=>{let P=`${m}/rows/${w}`;(0,dn.childObjects)(C,"cells",P,"cell",t).forEach(({node:M,index:T})=>{let L=M.control;L!=null&&!(0,dn.isJsonObject)(L)&&t.push((0,dn.issue)(`${P}/cells/${T}/control`,"control-must-be-object-or-null",`a cell control must be a JSON object or null, got ${typeof L}`))})})})})}),t}lt.SUBGRID_CLASS_ID=Se.ControlClassId.SubgridControl;lt.NOTES_CLASS_ID=Se.ControlClassId.TimelineControl;lt.QUICK_VIEW_CLASS_ID=Se.ControlClassId.QuickViewControl;var l3={Lookup:String(Se.ControlClassId.LookupControl),Customer:String(Se.ControlClassId.LookupControl),Owner:String(Se.ControlClassId.LookupControl),PartyList:String(Se.ControlClassId.PartyListControl),Boolean:String(Se.ControlClassId.BooleanControl),DateTime:String(Se.ControlClassId.DateTimeControl),Decimal:String(Se.ControlClassId.DecimalControl),Double:String(Se.ControlClassId.FloatingNumberControl),Money:String(Se.ControlClassId.CurrencyControl),Integer:String(Se.ControlClassId.IntegerControl),BigInt:String(Se.ControlClassId.IntegerControl),Memo:String(Se.ControlClassId.TextAreaControl),String:String(Se.ControlClassId.TextboxControl)},u3="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE";function K2(e){return e==="Picklist"||e==="State"||e==="Status"?u3:e&&l3[e]||String(Se.ControlClassId.TextboxControl)}lt.classIdForAttributeType=K2;function V2(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}});var Wa=f(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.projectElementBag=ge.serializeNode=ge.domEngine=ge.nodeLikeFromDom=ge.parseXmlRoot=ge.EMPTY_FORM_SENTINEL=ge.TEXT_SENTINEL=void 0;var c3=on(),za=_e();ge.TEXT_SENTINEL="#text";ge.EMPTY_FORM_SENTINEL="#empty";var Gs=new WeakSet;function d3(e,t){let r=e&&e.trim()!==""?e:t,i=new DOMParser().parseFromString(r,"text/xml").documentElement;if(!i)throw new za.InvalidArgumentError("XML source has no root element (empty or malformed input)");return f3(i),m3(i),v3(i,r),i}ge.parseXmlRoot=d3;var p3=new Set([1,3]);function f3(e){let t=[e];for(;t.length>0;){let n=t.pop().childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];if(!p3.has(a.nodeType))throw new za.InvalidArgumentError(`Unsupported XML node type ${a.nodeType} (CDATA / comment / processing-instruction) is outside the hybrid projection's lossless grammar and cannot be round-tripped`);t.push(a)}}}function m3(e){var t,r;let n=(t=e.ownerDocument)!==null&&t!==void 0?t:e.parentNode;if(!n)return;let i=n.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];if(o!==e&&!(o.nodeType===3&&((r=o.nodeValue)!==null&&r!==void 0?r:"").trim()===""))throw new za.InvalidArgumentError(`Unsupported document-level XML node (type ${o.nodeType}: declaration / comment / processing-instruction outside the root element) cannot be round-tripped`)}}function h3(e){let t=[],r=/<([^>]*)>/g;for(let n=r.exec(e);n!==null;n=r.exec(e)){let i=n[1];i.startsWith("/")||i.startsWith("?")||i.startsWith("!")||t.push(i.endsWith("/"))}return t}function g3(e){let t=[],r=[e];for(;r.length>0;){let n=r.pop();t.push(n);let i=n.childNodes;for(let a=i.length-1;a>=0;a-=1){let o=i[a];o.nodeType===1&&r.push(o)}}return t}function eN(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r].nodeType;if(n===1||n===3)return!0}return!1}function v3(e,t){let r=h3(t),n=g3(e),i=Math.min(r.length,n.length);for(let a=0;a<i;a+=1){if(r[a])continue;let o=n[a];eN(o)||Gs.add(o)}}function xd(e){let t=e.nodeType===3;return{getNodeName:()=>t?ge.TEXT_SENTINEL:e.tagName,getAllProperties:()=>{var r;if(t)return[{key:ge.TEXT_SENTINEL,value:(r=e.nodeValue)!==null&&r!==void 0?r:""}];let n=e.attributes,i=[];for(let a=0;a<n.length;a+=1)i.push({key:n[a].name,value:n[a].value});return Gs.has(e)&&!eN(e)&&i.push({key:ge.EMPTY_FORM_SENTINEL,value:"1"}),i},getAllChildren:()=>{if(t)return[];let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];(a.nodeType===1||a.nodeType===3)&&r.push(xd(a))}return r}}}ge.nodeLikeFromDom=xd;function b3(e){return{make:t=>t===ge.TEXT_SENTINEL?e.createTextNode(""):e.createElement(t),setProp:(t,r,n)=>{t.nodeType===3?t.nodeValue=n:r===ge.EMPTY_FORM_SENTINEL?Gs.add(t):t.setAttribute(r,n)},addChild:(t,r)=>{t.appendChild(r)}}}ge.domEngine=b3;function tN(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r<=31&&r!==9&&r!==10&&r!==13||r===65534||r===65535)throw Vs(r);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))throw Vs(r);t+=1;continue}if(r>=56320&&r<=57343)throw Vs(r)}}function Vs(e){let t=e.toString(16).toUpperCase().padStart(4,"0");return new za.InvalidArgumentError(`Value contains U+${t}, a character not permitted in XML 1.0 (control char / lone surrogate / non-character); it cannot be serialized losslessly`)}function y3(e){return tN(e),String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/\r/g,"
").replace(/\n/g,"
").replace(/\t/g,"	")}function C3(e){return tN(e),String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function A3(e){return rN(e,0)}ge.serializeNode=A3;var Z2=512;function rN(e,t){var r;if(t>Z2)throw new za.InvalidArgumentError(`XML nesting exceeds the maximum supported depth of ${Z2}`);if(e.nodeType===3)return C3((r=e.nodeValue)!==null&&r!==void 0?r:"");let n=e,i="<"+n.tagName,a=n.attributes;for(let l=0;l<a.length;l+=1)i+=" "+a[l].name+'="'+y3(a[l].value)+'"';let o=[],s=n.childNodes;for(let l=0;l<s.length;l+=1){let u=s[l];(u.nodeType===1||u.nodeType===3)&&o.push(u)}if(o.length===0)return Gs.has(n)?i+"></"+n.tagName+">":i+" />";i+=">";for(let l of o)i+=rN(l,t+1);return i+"</"+n.tagName+">"}function N3(e){let t=xd(e);return{a:t.getAllProperties().map(r=>[r.key,r.value]),c:t.getAllChildren().map((r,n)=>({i:n,node:(0,c3.rawFromNode)(r)}))}}ge.projectElementBag=N3});var Ld=f(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.viewApi=pi.findDefaultViews=void 0;var Jt=qe(),gr=ue(),w3="savedqueryid,name,description,fetchxml,layoutxml,querytype,returnedtypecode,isdefault",S3="savedqueryid,name,returnedtypecode,querytype,isdefault";async function D3(e,t,r={}){var n,i,a;let o=new Set(((n=r.excludeViewIds)!==null&&n!==void 0?n:[]).filter(Boolean)),s=`returnedtypecode eq '${(0,gr.odataLiteral)(t)}' and querytype eq 0`,l=`/savedqueries${(0,gr.odataQuery)([["$select","savedqueryid,name,isdefault"],["$filter",s],["$top",50]])}`;return((a=(i=(0,Jt.ensureSuccess)(await e.get(l),e.apiUrl(l)).body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[]).filter(p=>{var m;return p.savedqueryid&&!o.has(p.savedqueryid)&&(p.isdefault||/^(Active|Inactive)\b/i.test((m=p.name)!==null&&m!==void 0?m:""))}).map(p=>{var m;return{id:String(p.savedqueryid),name:String((m=p.name)!==null&&m!==void 0?m:"")}})}pi.findDefaultViews=D3;async function E3(e,t){var r;let n=`/EntityDefinitions(LogicalName='${(0,gr.odataLiteral)(t)}')${(0,gr.odataQuery)([["$select","ObjectTypeCode"]])}`,i=await e.get(n);if(i.status>=200&&i.status<300){let a=(r=i.body)===null||r===void 0?void 0:r.ObjectTypeCode;return typeof a=="number"?a:void 0}}async function nN(e,t,r){if(!r||!/<grid\b/.test(t)||/<grid[^>]*\bobject=/.test(t))return t;let n=await E3(e,r);return n===void 0?t:t.replace(/<grid\b/,`<grid object="${n}"`)}pi.viewApi={async get(e,t){let n=`/savedqueries(${(0,gr.normalizeGuid)(t,"id")})${(0,gr.odataQuery)([["$select",w3]])}`,i=(0,Jt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Jt.readEtag)(i)}},async list(e,t){var r;let n=`/savedqueries${(0,gr.odataQuery)([["$select",S3],["$filter",t?.entityLogicalName?`returnedtypecode eq '${(0,gr.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`,a=(0,Jt.ensureSuccess)(await e.get(n),e.apiUrl(n)).body;return((r=a?.value)!==null&&r!==void 0?r:[]).map(s=>{var l,u;return{type:"view",id:(l=s.savedqueryid)!==null&&l!==void 0?l:"",name:(u=s.name)!==null&&u!==void 0?u:"",entityLogicalName:s.returnedtypecode,isDirty:!1}})},async create(e,t){let r=t,n="/savedqueries",i=await nN(e,r.layoutxml,r.returnedtypecode),a=(0,Jt.ensureSuccess)(await e.post(n,{name:r.name,description:r.description,fetchxml:r.fetchxml,layoutxml:i,returnedtypecode:r.returnedtypecode,querytype:r.querytype,isdefault:r.isdefault}),e.apiUrl(n));return{id:(0,Jt.requireCreatedId)(a,"savedqueryid","view"),etag:(0,Jt.readEtag)(a)}},async update(e,t,r,n){let i=r,a=(0,gr.normalizeGuid)(t,"id"),o=`/savedqueries(${a})`,s=n?{"If-Match":n}:void 0,l=await nN(e,i.layoutxml,i.returnedtypecode),u=(0,Jt.ensureSuccess)(await e.patch(o,{name:i.name,description:i.description,fetchxml:i.fetchxml,layoutxml:l},s?{headers:s}:void 0),e.apiUrl(o));return{id:a,etag:(0,Jt.readEtag)(u)}},delete(e,t){return(0,Jt.deleteRecord)(e,"savedqueries",t)}}});var hN=f(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.viewRegistration=mi.ViewAdapter=void 0;var fi=Br(),Ud=on(),hn=Wa(),I3=Ld(),Md=cn(),_3=zt(),sN=100,zs=class{toArtifact(t){var r,n,i,a,o,s,l,u;(0,Md.installDomShim)();let c=(r=t.fetchxml)!==null&&r!==void 0?r:"",p=(n=t.layoutxml)!==null&&n!==void 0?n:"",m=(0,hn.parseXmlRoot)(c,"<fetch/>"),v=(0,hn.parseXmlRoot)(p,"<grid/>");return{id:(i=t.savedqueryid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.returnedtypecode)!==null&&s!==void 0?s:P3(m),queryType:(l=t.querytype)!==null&&l!==void 0?l:0,isDefault:(u=t.isdefault)!==null&&u!==void 0?u:!1,columns:uN(v,m),filters:pN(m),sort:dN(m),fetchBag:c?(0,hn.projectElementBag)(m):void 0,layoutBag:p?(0,hn.projectElementBag)(v):void 0}}fromArtifact(t){(0,Md.installDomShim)();let{fetchxml:r,layoutxml:n}=iN(t);return{savedqueryid:t.id,name:t.name,description:t.description,returnedtypecode:t.entityLogicalName,querytype:t.queryType,isdefault:t.isDefault,fetchxml:r,layoutxml:n}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){var r,n,i,a,o;(0,Md.installDomShim)();let{fetchxml:s,layoutxml:l}=iN(t);return{name:(r=t.name)!==null&&r!==void 0?r:"",description:(n=t.description)!==null&&n!==void 0?n:"",fetchxml:s,layoutxml:l,returnedtypecode:(i=t.entityLogicalName)!==null&&i!==void 0?i:"",querytype:(a=t.queryType)!==null&&a!==void 0?a:0,isdefault:(o=t.isDefault)!==null&&o!==void 0?o:!1}}createDefault(t){var r,n,i,a,o,s,l,u;let c=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,_3.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New View",description:(a=t.description)!==null&&a!==void 0?a:"",entityLogicalName:c,queryType:(o=t.queryType)!==null&&o!==void 0?o:0,isDefault:(s=t.isDefault)!==null&&s!==void 0?s:!1,columns:t.columns&&t.columns.length>0?t.columns:[{name:`${c}id`,width:300,order:0}],filters:(l=t.filters)!==null&&l!==void 0?l:{type:"and",conditions:[],groups:[]},sort:(u=t.sort)!==null&&u!==void 0?u:[]}}assignMissingIds(t){return t}validate(t){let r=[],n=t;(0,fi.childObjects)(n,"columns","","column",r),(0,fi.childObjects)(n,"sort","","sort",r);let i=n.filters;return i!=null&&((0,fi.isJsonObject)(i)?lN(i,"/filters",r):r.push((0,fi.issue)("/filters","filters-must-be-object",`filters must be a JSON object, got ${typeof i}`))),r}};mi.ViewAdapter=zs;function lN(e,t,r){(0,fi.childObjects)(e,"conditions",t,"condition",r),(0,fi.childObjects)(e,"groups",t,"filterGroup",r).forEach(({node:i,index:a})=>lN(i,`${t}/groups/${a}`,r))}function P3(e){var t;let r=e.getElementsByTagName("entity")[0];return(t=r?.getAttribute("name"))!==null&&t!==void 0?t:""}function uN(e,t){var r;let n=cN(t),i=e.getElementsByTagName("cell"),a=[],o=0;for(let s=0;s<i.length;s+=1){let l=i[s];if(l.getAttribute("ishidden")==="1")continue;let u=l.getAttribute("name");if(!u)continue;let c=parseInt((r=l.getAttribute("width"))!==null&&r!==void 0?r:"",10),p={name:u,width:Number.isNaN(c)?sN:c,order:o},m=n.get(u);m&&(p.relatedEntity=m),o+=1,a.push(p)}return a}function cN(e){var t;let r=new Map,n=e.getElementsByTagName("link-entity");for(let i=0;i<n.length;i+=1){let a=n[i],o=a.getAttribute("name");if(!o)continue;let s=a.getElementsByTagName("attribute");for(let l=0;l<s.length;l+=1){let u=s[l],c=(t=u.getAttribute("alias"))!==null&&t!==void 0?t:u.getAttribute("name");c&&r.set(c,o)}}return r}function dN(e){var t;let r=e.getElementsByTagName("entity")[0];if(!r)return[];let n=[],i=r.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];if(o.nodeType===1&&o.tagName==="order"){let s=o.getAttribute("attribute");s&&n.push({attribute:s,descending:((t=o.getAttribute("descending"))!==null&&t!==void 0?t:"").toLowerCase()==="true"})}}return n}function pN(e){let t=e.getElementsByTagName("entity")[0],r={type:"and",conditions:[],groups:[]};if(!t)return r;let n=Ct(t,"filter").filter(i=>!fN(i)).map(mN);return n.length===0?r:n.length===1?n[0]:{type:"and",conditions:[],groups:n}}function fN(e){if(Ct(e,"filter").length>0)return!1;let t=Ct(e,"condition");return t.length===0?!1:t.some(r=>r.getAttribute("isquickfindfields")==="1"||Ct(r,"value").length>0)}function mN(e){var t,r;let n=((t=e.getAttribute("type"))!==null&&t!==void 0?t:"and").toLowerCase()==="or"?"or":"and",i=[],a=[],o=e.childNodes;for(let s=0;s<o.length;s+=1){let l=o[s];if(l.nodeType===1)if(l.tagName==="condition"){if(l.getAttribute("isquickfindfields")==="1")continue;let u=l.getAttribute("attribute");if(!u)continue;let c={attribute:u,operator:(r=l.getAttribute("operator"))!==null&&r!==void 0?r:""},p=l.getAttribute("value");p!==null&&(c.value=p),i.push(c)}else l.tagName==="filter"&&a.push(mN(l))}return{type:n,conditions:i,groups:a}}function Ct(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName===t&&r.push(a)}return r}function iN(e){let t=O3(e.columns);if(!aN(e.fetchBag)||!aN(e.layoutBag))return{fetchxml:q3({...e,columns:t}),layoutxml:$3({...e,columns:t},`${e.entityLogicalName}id`)};let r=new DOMParser().parseFromString("<root/>","text/xml"),n=oN(e.fetchBag,"fetch",r),i=oN(e.layoutBag,"grid",r),a=uN(i,n),o=!Bd(t,a),s=!Bd(e.sort,dN(n)),l=!Bd(e.filters,pN(n));return o&&(F3(r,n,t,a),L3(r,i,t)),s&&B3(r,n,e.sort),l&&k3(r,n,e.filters),{fetchxml:(0,hn.serializeNode)(n),layoutxml:(0,hn.serializeNode)(i)}}function O3(e){return(e??[]).map((t,r)=>{var n,i;return{name:String(t.name).toLowerCase(),width:(n=t.width)!==null&&n!==void 0?n:sN,order:(i=t.order)!==null&&i!==void 0?i:r,...t.relatedEntity?{relatedEntity:t.relatedEntity}:{}}})}function aN(e){return!!e&&(e.c.length>0||e.a.length>0)}function oN(e,t,r){let n={n:t,a:(0,Ud.mergeAttrs)(e.a,[]),c:(0,Ud.spliceChildren)(e.c,[])};return(0,Ud.rebuildRaw)(n,(0,hn.domEngine)(r),null)}function F3(e,t,r,n){var i;let a=t.getElementsByTagName("entity")[0];if(!a)return;let o=new Set(r.map(u=>{var c;return`${(c=u.relatedEntity)!==null&&c!==void 0?c:""}:${u.name}`}));for(let u of n)o.has(`${(i=u.relatedEntity)!==null&&i!==void 0?i:""}:${u.name}`)||R3(a,u);let s=cN(t),l=new Set(Ct(a,"attribute").map(u=>u.getAttribute("name")).filter(u=>!!u));for(let u of[...r].sort((c,p)=>c.order-p.order))if(u.relatedEntity){if(s.get(u.name)===u.relatedEntity)continue;let c=T3(e,a,u.relatedEntity),p=e.createElement("attribute");p.setAttribute("name",u.name),c.appendChild(p),s.set(u.name,u.relatedEntity)}else{if(l.has(u.name))continue;let c=e.createElement("attribute");c.setAttribute("name",u.name),x3(a,c),l.add(u.name)}}function R3(e,t){var r;if(t.relatedEntity){for(let n of Ct(e,"link-entity"))if(n.getAttribute("name")===t.relatedEntity){for(let i of Ct(n,"attribute"))if(((r=i.getAttribute("alias"))!==null&&r!==void 0?r:i.getAttribute("name"))===t.name){n.removeChild(i);return}}return}for(let n of Ct(e,"attribute"))if(n.getAttribute("name")===t.name){e.removeChild(n);return}}function T3(e,t,r){for(let i of Ct(t,"link-entity"))if(i.getAttribute("name")===r)return i;let n=e.createElement("link-entity");return n.setAttribute("name",r),t.appendChild(n),n}function x3(e,t){let r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];if(i.nodeType===1&&i.tagName!=="attribute"){e.insertBefore(t,i);return}}e.appendChild(t)}function L3(e,t,r){let n=t.getElementsByTagName("row")[0];if(!n)return;let i=[...r].sort((s,l)=>s.order-l.order),a=U3(n);if(M3(a,i)){for(let s=0;s<i.length;s+=1){let l=String(i[s].width);a[s].getAttribute("width")!==l&&a[s].setAttribute("width",l)}return}let o=new Map;for(let s of a){let l=s.getAttribute("name");l&&o.set(l,s),n.removeChild(s)}for(let s of i){let l=o.get(s.name);l||(l=e.createElement("cell"),l.setAttribute("name",s.name)),l.setAttribute("width",String(s.width)),n.appendChild(l)}}function U3(e){return Ct(e,"cell").filter(t=>!!t.getAttribute("name")&&t.getAttribute("ishidden")!=="1")}function M3(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r].getAttribute("name")!==t[r].name)return!1;return!0}function B3(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of Ct(n,"order"))n.removeChild(i);for(let i of r){let a=e.createElement("order");a.setAttribute("attribute",i.attribute),a.setAttribute("descending",String(i.descending)),n.appendChild(a)}}}function k3(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of Ct(n,"filter"))fN(i)||n.removeChild(i);(r.conditions.length>0||r.groups.length>0)&&n.appendChild(kd(e,r))}}function Bd(e,t){return JSON.stringify(e)===JSON.stringify(t)}function q3(e){let t=new DOMParser().parseFromString("<fetch/>","text/xml"),r=t.documentElement;r.setAttribute("version","1.0"),r.setAttribute("mapping","logical");let n=t.createElement("entity");n.setAttribute("name",e.entityLogicalName),r.appendChild(n);let i=new Map;for(let a of[...e.columns].sort((o,s)=>o.order-s.order)){let o=t.createElement("attribute");if(o.setAttribute("name",a.name),a.relatedEntity){let s=i.get(a.relatedEntity);s||(s=t.createElement("link-entity"),s.setAttribute("name",a.relatedEntity),n.appendChild(s),i.set(a.relatedEntity,s)),s.appendChild(o)}else n.appendChild(o)}for(let a of e.sort){let o=t.createElement("order");o.setAttribute("attribute",a.attribute),o.setAttribute("descending",String(a.descending)),n.appendChild(o)}return(e.filters.conditions.length>0||e.filters.groups.length>0)&&n.appendChild(kd(t,e.filters)),new XMLSerializer().serializeToString(t)}function kd(e,t){let r=e.createElement("filter");r.setAttribute("type",t.type);for(let n of t.conditions){let i=e.createElement("condition");i.setAttribute("attribute",n.attribute),i.setAttribute("operator",n.operator),n.value!==void 0&&i.setAttribute("value",n.value),r.appendChild(i)}for(let n of t.groups)r.appendChild(kd(e,n));return r}function $3(e,t){var r;let n=new DOMParser().parseFromString("<grid/>","text/xml"),i=n.documentElement,a=[...e.columns].sort((s,l)=>s.order-l.order);i.setAttribute("name","resultset"),i.setAttribute("jump",((r=a[0])===null||r===void 0?void 0:r.name)||t||`${e.entityLogicalName}id`),i.setAttribute("select","1"),i.setAttribute("icon","1"),i.setAttribute("preview","1");let o=n.createElement("row");o.setAttribute("name","result"),o.setAttribute("id",t||`${e.entityLogicalName}id`),i.appendChild(o);for(let s of a){let l=n.createElement("cell");l.setAttribute("name",s.name),l.setAttribute("width",String(s.width)),o.appendChild(l)}return new XMLSerializer().serializeToString(n)}function V3(){return{adapter:new zs,api:I3.viewApi}}mi.viewRegistration=V3});function gN(e,t=0){return(Me[e[t+0]]+Me[e[t+1]]+Me[e[t+2]]+Me[e[t+3]]+"-"+Me[e[t+4]]+Me[e[t+5]]+"-"+Me[e[t+6]]+Me[e[t+7]]+"-"+Me[e[t+8]]+Me[e[t+9]]+"-"+Me[e[t+10]]+Me[e[t+11]]+Me[e[t+12]]+Me[e[t+13]]+Me[e[t+14]]+Me[e[t+15]]).toLowerCase()}var Me,vN=S(()=>{Me=[];for(let e=0;e<256;++e)Me.push((e+256).toString(16).slice(1))});function qd(){return Ws>js.length-16&&((0,bN.randomFillSync)(js),Ws=0),js.slice(Ws,Ws+=16)}var bN,js,Ws,yN=S(()=>{bN=require("crypto"),js=new Uint8Array(256),Ws=js.length});var CN,$d,AN=S(()=>{CN=require("crypto"),$d={randomUUID:CN.randomUUID}});function G3(e,t,r){if($d.randomUUID&&!t&&!e)return $d.randomUUID();e=e||{};let n=e.random??e.rng?.()??qd();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return gN(n)}var pt,NN=S(()=>{AN();yN();vN();pt=G3});var Vd=S(()=>{NN()});var wN=f(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.WorkflowConditionOperator=At.WorkflowAttributeType=At.SystemStep=At.FieldRequiredLevelTypes=At.AttributeDateTimeBehavior=void 0;At.AttributeDateTimeBehavior={None:0,Dynamic:1,DateOnly:2,StaticTimeZoneInvariant:3,UserLocal:4};At.FieldRequiredLevelTypes={None:"0",Required:"1",Recommended:"2"};At.SystemStep={IdentifyContact:"IdentifyContact",IdentifyAccount:"IdentifyAccount",IdentifyCustomer:"IdentifyCustomer",IdentifyCase:"IdentifyCase",Solution:"Solution",Resolve:"Resolve"};At.WorkflowAttributeType={Boolean:"0",Customer:"1",DateTime:"2",Decimal:"3",Float:"4",Integer:"5",Lookup:"6",Money:"7",Owner:"8",PartyList:"9",Picklist:"10",Key:"11",State:"12",Status:"13",String:"14",UniqueIdentifier:"15",EntityNameReference:"16",Entity:"17",EntityCollection:"18",BpfProcess:"19",BpfStageCategory:"20",BpfStage:"21",EntityReferenceCollection:"22",MultiSelectPicklist:"23",BigType:"24"};At.WorkflowConditionOperator={IsNull:"0",NotNull:"1",LogicalAnd:"2",LogicalOr:"3",IN:"4",NotIn:"5",NotInNull:"51",Equal:"6",NotEqual:"7",Contains:"8",DoesNotContain:"9",BeginsWith:"10",DoesNotBeginWith:"11",EndsWith:"12",DoesNotEndWith:"13",GreaterThan:"14",GreaterThanOrEqual:"15",LessThan:"16",LessThanOrEqual:"17",EqualUserId:"18",NotEqualUserId:"19",On:"20",NotOn:"21",OnOrAfter:"22",OnOrBefore:"23",Yesterday:"24",Today:"25",Tomorrow:"26",NextSevenDays:"27",LastSevenDays:"28",NextWeek:"29",LastWeek:"30",ThisWeek:"31",NextMonth:"32",LastMonth:"33",ThisMonth:"34",NextYear:"35",LastYear:"36",ThisYear:"37",Anytime:"38",LastXHours:"39",NextXHours:"40",LastXDays:"41",NextXDays:"42",LastXWeeks:"43",NextXWeeks:"44",LastXMonths:"45",NextXMonths:"46",LastXYears:"47",NextXYears:"48",Under:"49",NotUnder:"50"}});var MN={};xt(MN,{deserializeWorkflowJson:()=>tq,serializeToWorkflowJson:()=>rq});function SN(e){return e.__class==="BinaryExpression:#Microsoft.Crm.Workflow.Expressions"}function z3(e){return e.__class==="ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel"}function ja(){return{list:[]}}function ON(e){return{__class:"PrimaryEntity:#Microsoft.Crm.Workflow.Expressions",parameterName:"primaryEntity",entityName:e}}function Wd(e,t,r){return{__class:"EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,entity:ON(t),attributeName:e}}function Hd(e,t){return{__class:"PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",type:t,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function W3(){return Hd("true",z.WorkflowAttributeType.Boolean)}function DN(e,t){let r=z.WorkflowAttributeType.String,n=zd[e.operator]??z.WorkflowConditionOperator.Equal,i=Wd(e.field,t,r),a;return e.operator==="ContainsData"||e.operator==="DoesNotContainData"?a=[]:e.valueType==="Field"&&e.valueField?a=[Wd(e.valueField,t,r)]:a=[Hd(e.value??"",r)],{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function j3(e,t,r){if(e.length===0)return null;if(e.length===1)return DN(e[0],r);let n=t==="AND"?z.WorkflowConditionOperator.LogicalAnd:z.WorkflowConditionOperator.LogicalOr,[i,...a]=e.map(o=>DN(o,r));return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:z.WorkflowAttributeType.String,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function jd(e){return e?e.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions"?{valueType:"Field",valueField:e.attributeName}:e.__class==="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions"?{valueType:"Value",value:e.primitiveValue!=null?String(e.primitiveValue):""}:{valueType:"Value",value:""}:{valueType:"Value",value:""}}function Gd(e){let t=PN[e.conditionOperatoroperator]??"Equals",r=e.left.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions"?e.left.attributeName:"",i=t==="ContainsData"||t==="DoesNotContainData"?{valueType:"Value"}:jd(e.right[0]);return{id:pt(),field:r,fieldDisplayName:r,operator:t,...i}}function FN(e){if(!e||e.__class!=="BinaryExpression:#Microsoft.Crm.Workflow.Expressions")return{clauses:[],logic:"AND"};let t=e.conditionOperatoroperator;if(t===z.WorkflowConditionOperator.LogicalAnd||t===z.WorkflowConditionOperator.LogicalOr){let r=t===z.WorkflowConditionOperator.LogicalAnd?"AND":"OR";return{clauses:[...SN(e.left)?[Gd(e.left)]:[],...e.right.filter(SN).map(Gd)],logic:r}}return{clauses:[Gd(e)],logic:"AND"}}function EN(e,t,r,n){return e==="Field"&&r?Wd(r,n,z.WorkflowAttributeType.String):Hd(t??"",z.WorkflowAttributeType.String)}function IN(e,t){return{propertyName:e,propertyValueExpr:t}}function hi(e){return`Step_${e.value++}`}function Nt(e,t){let r=(t.counts[e]??0)+1,n=`${e}${r}`;for(;t.used.has(n);)r+=1,n=`${e}${r}`;return t.counts[e]=r,t.used.add(n),n}function H3(e,t,r){return e&&!r.used.has(e)?(r.used.add(e),e):Nt(t,r)}function J3(e,t,r){return{__class:"ActionStep:#Microsoft.Crm.Workflow.ObjectModel",id:Nt("ActionStep",r),name:hi(t),description:"Action step",stepLabels:{list:[{labelId:pt(),languageCode:1033,description:e}]},steps:{list:[]},actionId:null,actionType:"4",processId:pt(),uniqueName:`id_${pt().replace(/-/g,"")}ActionStep`}}function Q3(e,t,r,n){let i=ON(t),a=e.stepName??hi(r),o=e.stepLabels??ja(),s={name:a,stepLabels:o,description:e.displayName},l=e.type;switch(l){case"SetFieldValue":return{...s,id:Nt("SetAttributeValueStep",n),__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:i,specification:IN(e.field,EN(e.valueType,e.value,e.valueField,t))};case"SetDefaultValue":return{...s,id:Nt("SetDefaultValueStep",n),__class:"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:i,specification:IN(e.field,EN(e.valueType,e.value,e.valueField,t))};case"LockUnlock":return{...s,id:Nt("SetDisplayModeStep",n),__class:"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:e.field,controlType:"attribute",isReadOnly:e.lock,entity:i};case"SetBusinessRequired":return{...s,id:Nt("SetFieldRequiredLevelStep",n),__class:"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:e.field,controlType:"attribute",requiredLevel:e.required?z.FieldRequiredLevelTypes.Required:z.FieldRequiredLevelTypes.None,entity:i};case"SetVisibility":return{...s,id:Nt("SetVisibilityStep",n),__class:"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:e.field,controlType:"attribute",isVisible:e.visible,entity:i};case"ShowErrorMessage":return{...s,id:Nt("SetMessageStep",n),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",name:e.errorMessage||e.displayName,controlId:e.field,entity:i,level:e.messageLevel??"error",actionSteps:e.messageActionSteps??{list:[]}};case"Recommendation":{let u=e.messageText||e.recommendationTitle||e.displayName,c=e.stepLabels&&e.stepLabels.list.length>0?e.stepLabels:{list:[{labelId:pt(),languageCode:1033,description:u}]},p=e.recommendationActionSteps,m=p&&p.list.length>0?p:{list:[J3(u,r,n)]};return{...s,id:Nt("SetMessageStep",n),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:c,description:e.recommendationTitle||e.displayName,controlId:e.field,entity:i,level:"RECOMMENDATION",actionSteps:m}}default:throw new Error(`Unsupported action type: ${l}`)}}function X3(e){switch(e.__class){case"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let t=jd(e.specification.propertyValueExpr);return{kind:"action",id:e.id,type:"SetFieldValue",displayName:e.description||e.name||"Set Field Value",stepName:e.name,stepLabels:e.stepLabels,field:e.specification.propertyName,...t}}case"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let t=jd(e.specification.propertyValueExpr);return{kind:"action",id:e.id,type:"SetDefaultValue",displayName:e.description||e.name||"Set Default Value",stepName:e.name,stepLabels:e.stepLabels,field:e.specification.propertyName,...t}}case"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:e.id,type:"LockUnlock",displayName:e.description||e.name||"Lock/Unlock",stepName:e.name,stepLabels:e.stepLabels,field:e.controlId,lock:e.isReadOnly};case"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:e.id,type:"SetBusinessRequired",displayName:e.description||e.name||"Set Business Required",stepName:e.name,stepLabels:e.stepLabels,field:e.controlId,required:e.requiredLevel!==z.FieldRequiredLevelTypes.None};case"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:e.id,type:"SetVisibility",displayName:e.description||e.name||"Set Visibility",stepName:e.name,stepLabels:e.stepLabels,field:e.controlId,visible:e.isVisible};case"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel":{let t=e.stepLabels?.list,r=t&&t.length>0?t[0].description??"":"";return(e.level??"").toUpperCase()==="RECOMMENDATION"?{kind:"action",id:e.id,type:"Recommendation",displayName:e.description||"Recommendation",stepName:e.name,stepLabels:e.stepLabels,field:e.controlId,recommendationTitle:e.description||"",messageText:r,recommendationActionSteps:e.actionSteps}:{kind:"action",id:e.id,type:"ShowErrorMessage",displayName:e.description||"Show Error Message",stepName:e.name,stepLabels:e.stepLabels,field:e.controlId,errorMessage:r||e.name||"",messageLevel:e.level??void 0,messageActionSteps:e.actionSteps}}case"ActionStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:e.id,type:"Recommendation",displayName:e.name||"Recommendation",stepName:e.name,stepLabels:e.stepLabels,field:e.actionControl?.controlId??"",recommendationTitle:e.name||"",messageText:e.description||""};default:return null}}function RN(e,t,r,n){let i=e.stepName??hi(r),a=Nt("ConditionStep",n),o=[],s=e,l=!0;for(;s;){let u=j3(s.clauses,s.logic,t),c=l?s.branchName??hi(r):hi(r),m={__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:l?H3(s.branchId,"ConditionBranchStep",n):Nt("ConditionBranchStep",n),name:c,description:s.displayName,stepLabels:ja(),conditionExpression:u??void 0,steps:{list:s.trueBranch.map(C=>TN(C,t,r,n))}};o.push(m);let v=s.falseBranch;if(v.length===1&&v[0].kind==="condition"){s=v[0],l=!1;continue}v.length>0&&o.push(K3(v,t,r,n)),s=void 0}return{__class:"ConditionStep:#Microsoft.Crm.Workflow.ObjectModel",id:a,name:i,description:"",stepLabels:ja(),containsElsebranch:o.length>1,steps:{list:o}}}function K3(e,t,r,n){return{__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:Nt("ConditionBranchStep",n),name:hi(r),description:null,stepLabels:ja(),conditionExpression:W3(),steps:{list:e.map(i=>TN(i,t,r,n))}}}function TN(e,t,r,n){return e.kind==="condition"?RN(e,t,r,n):Q3(e,t,r,n)}function xN(e){let t=(e.steps?.list??[]).filter(z3);return LN(t,e,!0)}function LN(e,t,r){let[n,...i]=e,{clauses:a,logic:o}=FN(n?.conditionExpression),s=UN(n?.steps?.list??[]),l=Y3(i,t),u=n?.description||n?.name||t.description||t.name||"Condition";return{kind:"condition",id:(r?t.id:n?.id)??pt(),displayName:u,clauses:a,logic:o,trueBranch:s,falseBranch:l,isCollapsed:!1,stepName:r?t.name:void 0,branchId:r?n?.id:void 0,branchName:r?n?.name:void 0}}function Y3(e,t){if(e.length===0)return[];let[r]=e,{clauses:n}=FN(r.conditionExpression);return n.length===0?UN(r.steps?.list??[]):[LN(e,t,!1)]}function UN(e){return e.map(t=>t.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel"?xN(t):X3(t)).filter(t=>t!==null)}function Z3(e){return e===_N.StateCode.Activated?"Active":"Draft"}function eq(e,t){let r=e.processtriggerscope,n=e.processtriggerformid;return r===1&&n?n:r===2?"Entity":t??"Entity"}function tq(e){let t=e,r=null,n;if(e.wfomJson)try{let i=JSON.parse(e.wfomJson);n={id:i.id==="WorkflowStep0"||!i.id?e.workflowid??pt():i.id,name:i.name,description:i.description,nextStepIndex:i.nextStepIndex,category:i.category==="0"||i.category===0?"2":i.category,businessProcessType:i.businessProcessType,mode:i.mode,title:i.title||e.name||"",primaryEntityName:i.primaryEntityName==="1"||!i.primaryEntityName?e.primaryentity??"":i.primaryEntityName,workflowEntityId:i.workflowEntityId==="00000000-0000-0000-0000-000000000000"||!i.workflowEntityId?e.workflowid??"":i.workflowEntityId,formId:i.formId,variables:i.variables,inputs:i.inputs};let o=(i.steps?.list??[]).find(s=>s.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel");o&&(r=xN(o))}catch{}return{ruleId:e.workflowid??null,name:e.name??"",description:e.description??"",entityLogicalName:e.primaryentity??"",scope:eq(t,n?.formId),status:Z3(e.statecode),rootCondition:r,wfomRoot:n}}function rq(e){let t=e.entityLogicalName,r=e.wfomRoot,n={value:r?Number(r.nextStepIndex):1},i={counts:{},used:new Set},a=e.scope!=="Entity"&&e.scope!=="AllForms"?e.scope:null,o=e.rootCondition?[RN(e.rootCondition,t,n,i)]:[],s={__class:"WorkflowStep:#Microsoft.Crm.Workflow.ObjectModel",id:r?.id??e.ruleId??pt(),name:r?.name??"Step_0",description:r!==void 0?r.description:e.description||null,stepLabels:ja(),argumentsArray:[],primaryEntityName:r?.primaryEntityName??t,nextStepIndex:String(n.value),isCrmUIWorkflow:!0,category:r?.category??"2",businessProcessType:r?.businessProcessType??"0",mode:r?.mode??"0",title:r?.title??e.name,formId:a,workflowEntityId:r?.workflowEntityId??e.ruleId??"",variables:r?.variables??[],inputs:r?.inputs??[],steps:{list:o}};return JSON.stringify(s)}var _N,z,zd,PN,BN=S(()=>{"use strict";Vd();_N=ne(Qi()),z=ne(wN());zd={Equals:z.WorkflowConditionOperator.Equal,DoesNotEqual:z.WorkflowConditionOperator.NotEqual,IsGreaterThan:z.WorkflowConditionOperator.GreaterThan,IsLessThan:z.WorkflowConditionOperator.LessThan,IsGreaterThanEqualTo:z.WorkflowConditionOperator.GreaterThanOrEqual,IsLessThanEqualTo:z.WorkflowConditionOperator.LessThanOrEqual,Contains:z.WorkflowConditionOperator.Contains,DoesNotContain:z.WorkflowConditionOperator.DoesNotContain,BeginsWith:z.WorkflowConditionOperator.BeginsWith,DoesNotBeginWith:z.WorkflowConditionOperator.DoesNotBeginWith,EndsWith:z.WorkflowConditionOperator.EndsWith,DoesNotEndWith:z.WorkflowConditionOperator.DoesNotEndWith,On:z.WorkflowConditionOperator.On,NotOn:z.WorkflowConditionOperator.NotOn,ContainsData:z.WorkflowConditionOperator.NotNull,DoesNotContainData:z.WorkflowConditionOperator.IsNull},PN={};for(let e of Object.keys(zd))PN[zd[e]]=e});function Jd(e){return!nq.has(e)}function kN(e){return iq.has(e)?"string":e==="Money"?"money":e==="Integer"||e==="BigInt"?"integer":e==="Decimal"||e==="Double"?"decimal":aq.has(e)?"date":oq.has(e)?"boolean":"other"}function qN(e,t){let r=kN(e),n=kN(t);return r==="other"||n==="other"?e===t:r===n}var nq,iq,aq,oq,$N=S(()=>{"use strict";nq=new Set(["ContainsData","DoesNotContainData"]);iq=new Set(["String","Memo","EntityName"]),aq=new Set(["DateTime"]),oq=new Set(["Boolean"])});var XN={};xt(XN,{addElseIfInTree:()=>cq,appendToBranch:()=>lq,buildBreadcrumb:()=>vq,collectUsedFields:()=>hq,createEmptyAction:()=>mq,createEmptyCondition:()=>HN,findNode:()=>zN,findParent:()=>gi,getBranchPosition:()=>fq,hasAnyTriggerGeneratingAction:()=>Kd,isTriggerGeneratingAction:()=>GN,moveBranchItemInTree:()=>pq,removeElseIfInTree:()=>dq,removeNodeFromTree:()=>WN,updateActionInTree:()=>Qd,updateConditionInTree:()=>gn,validateTree:()=>gq});function GN(e){return sq.has(e.type)}function Kd(e){if(!e)return!1;for(let t of[...e.trueBranch,...e.falseBranch])if(t.kind==="action"){if(GN(t))return!0}else if(Kd(t))return!0;return!1}function zN(e,t){if(e.id===t)return e;for(let r of[...e.trueBranch,...e.falseBranch]){if(r.id===t)return r;if(r.kind==="condition"){let n=zN(r,t);if(n)return n}}return null}function gi(e,t){for(let r=0;r<e.trueBranch.length;r++){let n=e.trueBranch[r];if(n.id===t)return{node:e,branch:"true",index:r};if(n.kind==="condition"){let i=gi(n,t);if(i)return i}}for(let r=0;r<e.falseBranch.length;r++){let n=e.falseBranch[r];if(n.id===t)return{node:e,branch:"false",index:r};if(n.kind==="condition"){let i=gi(n,t);if(i)return i}}return null}function WN(e,t){return{...e,trueBranch:VN(e.trueBranch,t),falseBranch:VN(e.falseBranch,t)}}function VN(e,t){return e.filter(r=>r.id!==t).map(r=>r.kind==="condition"?WN(r,t):r)}function gn(e,t,r){return e.id===t?r(e):{...e,trueBranch:e.trueBranch.map(n=>n.kind==="condition"?gn(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="condition"?gn(n,t,r):n)}}function Qd(e,t,r){return{...e,trueBranch:e.trueBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?Qd(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?Qd(n,t,r):n)}}function lq(e,t,r,n){return gn(e,t,i=>({...i,trueBranch:r==="true"?[...i.trueBranch,n]:i.trueBranch,falseBranch:r==="false"?[...i.falseBranch,n]:i.falseBranch}))}function uq(e){return e.length===1&&e[0].kind==="condition"}function cq(e,t){return gn(e,t,r=>jN(r))}function jN(e){if(uq(e.falseBranch))return{...e,falseBranch:[jN(e.falseBranch[0])]};let t=HN();return t.falseBranch=e.falseBranch,{...e,falseBranch:[t]}}function dq(e,t){let r=gi(e,t);if(!r||r.branch!=="false")return e;let n=r.node.falseBranch[r.index];if(!n||n.kind!=="condition")return e;let i=n.falseBranch;return gn(e,r.node.id,a=>({...a,falseBranch:i}))}function pq(e,t,r){let n=gi(e,t);if(!n)return e;let i=a=>{let o=[...a],s=o[n.index+r];return s?(o[n.index+r]=o[n.index],o[n.index]=s,o):a};return gn(e,n.node.id,a=>({...a,trueBranch:n.branch==="true"?i(a.trueBranch):a.trueBranch,falseBranch:n.branch==="false"?i(a.falseBranch):a.falseBranch}))}function fq(e,t){let r=gi(e,t);if(!r)return null;let n=r.branch==="true"?r.node.trueBranch:r.node.falseBranch;return{isFirst:r.index===0,isLast:r.index===n.length-1}}function HN(){return{kind:"condition",id:pt(),displayName:"New Condition",clauses:[],logic:"AND",trueBranch:[],falseBranch:[],isCollapsed:!1}}function mq(e){let t={kind:"action",id:pt(),type:e,displayName:`New ${e}`};switch(e){case"Recommendation":return{...t,type:"Recommendation",field:"",recommendationTitle:"",messageText:""};case"LockUnlock":return{...t,type:"LockUnlock",field:"",lock:!0};case"ShowErrorMessage":return{...t,type:"ShowErrorMessage",field:"",errorMessage:""};case"SetFieldValue":return{...t,type:"SetFieldValue",field:"",valueType:"Value",value:""};case"SetDefaultValue":return{...t,type:"SetDefaultValue",field:"",valueType:"Value",value:""};case"SetBusinessRequired":return{...t,type:"SetBusinessRequired",field:"",required:!0};case"SetVisibility":return{...t,type:"SetVisibility",field:"",visible:!0};default:return{...t,type:"SetFieldValue",field:"",valueType:"Value",value:""}}}function hq(e){if(!e)return[];let t=[];return JN(e,t),[...new Set(t)]}function JN(e,t){e.clauses.forEach(r=>{r.field&&t.push(r.field)}),[...e.trueBranch,...e.falseBranch].forEach(r=>{r.kind==="condition"?JN(r,t):"field"in r&&r.field&&t.push(r.field)})}function gq(e,t=[]){if(!e)return[{nodeId:"root",kind:"NO_CONDITION",message:"A business rule must include at least one condition."}];let r=[],n=new Map(t.map(i=>[i.logicalName,i]));return QN(e,r,n),Kd(e)||r.push({nodeId:"root",kind:"NO_ACTION",message:"A business rule must include at least one action step."}),r}function QN(e,t,r){e.clauses.length===0&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Add at least one clause to this condition."}),e.clauses.forEach(n=>{if(!n.field)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Please select a field for this clause."});else if(Jd(n.operator)&&n.valueType==="Value"&&!n.value)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please enter a value for this clause."});else if(Jd(n.operator)&&n.valueType==="Value"&&n.value){let i=r.get(n.field);i?.maxLength&&n.value.length>i.maxLength&&t.push({nodeId:e.id,kind:"CLAUSE_VALUE_TOO_LONG",message:`Value exceeds the field's maximum length of ${i.maxLength} characters.`})}}),[...e.trueBranch,...e.falseBranch].forEach(n=>{if(n.kind==="condition")QN(n,t,r);else if(!("field"in n)||!n.field)t.push({nodeId:n.id,kind:"EMPTY_ACTION_FIELD",message:`${n.type}: a target field is required.`});else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Value"&&n.value){let i=r.get(n.field);i?.maxLength&&n.value.length>i.maxLength&&t.push({nodeId:n.id,kind:"ACTION_VALUE_TOO_LONG",message:`${n.type}: value exceeds the field's maximum length of ${i.maxLength} characters.`})}else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Field"){if(!n.valueField)t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please select a field to copy from.`});else if(r.size>0){let i=r.get(n.field),a=r.get(n.valueField);i&&a&&!qN(i.attributeType,a.attributeType)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: the source field's type is not compatible with the target field.`})}}})}function vq(e,t){let r=[];return Xd(e,t,r),r}function Xd(e,t,r){if(e.id===t)return r.push({conditionId:e.id,label:e.displayName}),!0;for(let n of e.trueBranch)if(n.kind==="condition"){if(r.push({conditionId:e.id,label:e.displayName}),Xd(n,t,r))return!0;r.pop()}for(let n of e.falseBranch)if(n.kind==="condition"){if(r.push({conditionId:e.id,label:e.displayName}),Xd(n,t,r))return!0;r.pop()}return!1}var sq,KN=S(()=>{"use strict";Vd();$N();sq=new Set(["LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"])});var ew=f(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.businessRuleApi=void 0;var Hs=Qi(),Qt=qe(),vi=ue(),YN="00000000-0000-0000-0000-000000000000",Js={"Content-Type":"application/json",Accept:"application/json"},bq="workflowid,name,description,primaryentity,statecode,category,type",yq="category eq 2 and type eq 1";async function ZN(e,t,r){if(r==="Draft")return;let n=(0,vi.normalizeGuid)(t,"workflowid"),i=r==="Active",a={statecode:i?Hs.StateCode.Activated:Hs.StateCode.Draft,statuscode:i?Hs.StatusCode.Activated:Hs.StatusCode.Draft},o=`/workflows(${n})`;(0,Qt.ensureSuccess)(await e.patch(o,a,{headers:Js}),e.apiUrl(o))}Qs.businessRuleApi={async get(e,t){let n=`/workflows(${(0,vi.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveProcessWithWfomJson`,i=(0,Qt.ensureSuccess)(await e.post(n,{},{headers:Js}),e.apiUrl(n));return{raw:i.body,etag:(0,Qt.readEtag)(i)}},async list(e,t){var r;let n=[yq];t?.entityLogicalName&&n.push(`primaryentity eq '${(0,vi.odataLiteral)(t.entityLogicalName)}'`);let i=`/workflows${(0,vi.odataQuery)([["$select",bq],["$filter",n.join(" and ")]])}`,o=(0,Qt.ensureSuccess)(await e.get(i),e.apiUrl(i)).body;return((r=o?.value)!==null&&r!==void 0?r:[]).map(l=>{var u,c;return{type:"businessRule",id:(u=l.workflowid)!==null&&u!==void 0?u:"",name:(c=l.name)!==null&&c!==void 0?c:"",entityLogicalName:l.primaryentity,isDirty:!1}})},async create(e,t){let r=t,n=`/workflows(${YN})/Microsoft.Dynamics.CRM.CreateProcessWithWfomJson`,i=(0,Qt.ensureSuccess)(await e.post(n,r,{headers:Js}),e.apiUrl(n)),a=(0,vi.normalizeGuid)(r.Entity.workflowid,"workflowid");try{await ZN(e,a,r.status)}catch(o){try{await(0,Qt.deleteRecord)(e,"workflows",a)}catch{}throw o}return{id:a,etag:(0,Qt.readEtag)(i)}},async update(e,t,r,n){let i=r,a=(0,vi.normalizeGuid)(t,"id"),o=`/workflows(${YN})/Microsoft.Dynamics.CRM.UpdateProcessWithWfomJson`,s={...Js};n&&(s["If-Match"]=n);let l=(0,Qt.ensureSuccess)(await e.post(o,i,{headers:s}),e.apiUrl(o));return await ZN(e,a,i.status),{id:a,etag:(0,Qt.readEtag)(l)}},delete(e,t){return(0,Qt.deleteRecord)(e,"workflows",t)}}});var iw=f(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.BUSINESS_RULE_NULL_GUID=Vr.businessRuleRegistration=Vr.BusinessRuleAdapter=void 0;var tw=ld(),Yd=Qi(),rw=(BN(),Lt(MN)),Cq=(KN(),Lt(XN)),Ha=Br(),Aq=ew(),Nq=zt(),wq="00000000-0000-0000-0000-000000000000";Vr.BUSINESS_RULE_NULL_GUID=wq;var Sq=new Set(["Recommendation","LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]),Dq=["ruleId","name","description","entityLogicalName","scope","status","rootCondition"],Eq=["kind","id","displayName","logic","clauses","trueBranch","falseBranch"],Xs=class{toArtifact(t){let r=this.residualBag(t,Dq),n={id:t.ruleId,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:t.rootCondition?this.conditionToJson(t.rootCondition):null};return r&&(n.bag=r),n}fromArtifact(t){var r;let n=t.rootCondition?this.conditionFromJson(t.rootCondition):null;return{...(r=t.bag)!==null&&r!==void 0?r:{},ruleId:t.id,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:n}}fromApiResponse(t){var r;let n=t??{},i={...(r=n.Entity)!==null&&r!==void 0?r:{},wfomJson:n.WfomJson},a=(0,rw.deserializeWorkflowJson)(i);return this.toArtifact(a)}toApiPayload(t){var r;let n=this.fromArtifact(t);n.wfomRoot&&(n.wfomRoot={...n.wfomRoot,name:t.name,title:t.name,primaryEntityName:t.entityLogicalName||n.wfomRoot.primaryEntityName});let i=(0,rw.serializeToWorkflowJson)(n),a=(r=n.ruleId)!==null&&r!==void 0?r:(0,tw.v4)();return{Entity:this.buildWorkflowEntity(n,a),WfomJson:i,status:t.status}}createDefault(t){var r,n,i,a,o,s;let l={ruleId:(r=t.id)!==null&&r!==void 0?r:null,name:(n=t.name)!==null&&n!==void 0?n:"New business rule",description:(i=t.description)!==null&&i!==void 0?i:"",entityLogicalName:(a=t.entityLogicalName)!==null&&a!==void 0?a:"",scope:(o=t.scope)!==null&&o!==void 0?o:"Entity",status:(s=t.status)!==null&&s!==void 0?s:"Draft",rootCondition:(0,Cq.createEmptyCondition)()},u=this.toArtifact(l);return u.id||(u.id=(0,tw.v4)()),u}assignMissingIds(t){return(0,Nq.assignMissingIds)(t)}validate(t){let r=[],n=t.rootCondition;return n==null?r:(0,Ha.isJsonObject)(n)?(nw(n,"/rootCondition",r),r):(r.push((0,Ha.issue)("/rootCondition","condition-must-be-object",`rootCondition must be a JSON object or null, got ${typeof n}`)),r)}residualBag(t,r){let n=new Set(r),i={};for(let a of Object.keys(t)){if(n.has(a))continue;let o=t[a];o!==void 0&&(i[a]=o)}return Object.keys(i).length>0?i:void 0}buildWorkflowEntity(t,r){let n=t.scope!=="Entity"&&t.scope!=="AllForms";return{"@odata.type":"#Microsoft.Dynamics.CRM.workflow",name:t.name,description:t.description,workflowid:r,ondemand:!1,subprocess:!1,triggeroncreate:!1,triggerondelete:!1,category:Yd.WorkflowCategory.BusinessRule,type:Yd.WorkflowTypeCode.Definition,mode:1,scope:Yd.WorkflowScope.Organization,primaryentity:t.entityLogicalName,iscrmuiworkflow:!0,processtriggerscope:n?1:2,...n?{processtriggerformid:t.scope}:{}}}conditionToJson(t){let r=this.residualBag(t,Eq),n={id:t.id,displayName:t.displayName,logic:t.logic,clauses:t.clauses.map(i=>this.clauseToJson(i)),trueBranch:t.trueBranch.map(i=>this.branchItemToJson(i)),falseBranch:t.falseBranch.map(i=>this.branchItemToJson(i))};return r&&(n.bag=r),n}clauseToJson(t){return{id:t.id,field:t.field,fieldDisplayName:t.fieldDisplayName,operator:t.operator,valueType:t.valueType,...t.value!==void 0?{value:t.value}:{},...t.valueField!==void 0?{valueField:t.valueField}:{}}}branchItemToJson(t){return t.kind==="condition"?this.conditionToJson(t):this.actionToJson(t)}actionToJson(t){return{...t}}conditionFromJson(t){var r;return{kind:"condition",isCollapsed:!1,...(r=t.bag)!==null&&r!==void 0?r:{},id:t.id,displayName:t.displayName,logic:t.logic,clauses:t.clauses.map(i=>this.clauseFromJson(i)),trueBranch:t.trueBranch.map(i=>this.branchItemFromJson(i)),falseBranch:t.falseBranch.map(i=>this.branchItemFromJson(i))}}clauseFromJson(t){var r;return{id:t.id,field:t.field,fieldDisplayName:(r=t.fieldDisplayName)!==null&&r!==void 0?r:t.field,operator:t.operator,valueType:t.valueType,...t.value!==void 0?{value:t.value}:{},...t.valueField!==void 0?{valueField:t.valueField}:{}}}branchItemFromJson(t){return this.isConditionJson(t)?this.conditionFromJson(t):this.actionFromJson(t)}actionFromJson(t){if(!Sq.has(t.type))throw new Error(`Unsupported business-rule action type: ${t.type}`);return{...t,kind:"action",type:t.type}}isConditionJson(t){return Object.prototype.hasOwnProperty.call(t,"clauses")&&Object.prototype.hasOwnProperty.call(t,"logic")&&!Object.prototype.hasOwnProperty.call(t,"type")}};Vr.BusinessRuleAdapter=Xs;function nw(e,t,r){(0,Ha.optionalEnum)(e,"logic",["AND","OR"],t,"condition-logic-invalid",r),(0,Ha.childObjects)(e,"clauses",t,"clause",r);for(let n of["trueBranch","falseBranch"])(0,Ha.childObjects)(e,n,t,"branchItem",r).forEach(({node:a,index:o})=>{("clauses"in a||"trueBranch"in a||"falseBranch"in a)&&nw(a,`${t}/${n}/${o}`,r)})}function Iq(){return{adapter:new Xs,api:Aq.businessRuleApi}}Vr.businessRuleRegistration=Iq});var dw=f(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.appRegistration=yi.AppAdapter=void 0;var bi=Br(),Te=on(),Qa=Wa(),_q=Yl(),Zd=cn(),Pq=zt(),np="1033",Zs="7.0.0.0",aw=`<SiteMap IntroducedVersion="${Zs}"></SiteMap>`,Oq="/_imgs/imagestrips/transparent_spacer.gif",Fq="/_imgs/TableIconsFluentV9/document_one_page_sparkle.svg",Rq=["Entity","Url","DefaultDashboard","Page","GenPageId"],Ja="sitemapId",ow="sitemapName",Tq="sitemapNameUnique",el=class{toArtifact(t){let{bag:r,modeledEls:n}=Ks(t,"Area");return{id:"",name:"",uniqueName:"",description:"",siteMap:{areas:n.map(i=>this.areaToJson(i)),bag:r},bag:(0,Te.emptyBag)()}}fromArtifact(t){(0,Zd.installDomShim)();let r=this.assignMissingIds(JSON.parse(JSON.stringify(t))),n=new DOMParser().parseFromString("<root/>","text/xml"),i=this.rootToRaw(r);return(0,Te.rebuildRaw)(i,(0,Qa.domEngine)(n),null)}fromApiResponse(t){var r,n,i,a,o,s,l,u,c,p;(0,Zd.installDomShim)();let m=t??{},v=(r=m.$sitemap)!==null&&r!==void 0?r:m,C=(0,Qa.parseXmlRoot)((n=v.sitemapxml)!==null&&n!==void 0?n:aw,aw),w=this.toArtifact(C);return w.id=(i=m.appmoduleid)!==null&&i!==void 0?i:"",w.name=(a=m.name)!==null&&a!==void 0?a:"",w.uniqueName=(o=m.uniquename)!==null&&o!==void 0?o:"",w.description=(s=m.description)!==null&&s!==void 0?s:"",w.bag={a:[[Ja,(u=(l=v.sitemapid)!==null&&l!==void 0?l:m._sitemapid_value)!==null&&u!==void 0?u:""],[ow,(c=v.sitemapname)!==null&&c!==void 0?c:""],[Tq,(p=v.sitemapnameunique)!==null&&p!==void 0?p:""]],c:[]},w}toApiPayload(t){var r,n,i,a,o,s,l,u,c,p,m,v,C,w;(0,Zd.installDomShim)();let P=(0,Qa.serializeNode)(this.fromArtifact(t)),x=[],M=[];for(let L of(n=(r=t.siteMap)===null||r===void 0?void 0:r.areas)!==null&&n!==void 0?n:[])for(let Q of(i=L.groups)!==null&&i!==void 0?i:[])for(let B of(a=Q.subAreas)!==null&&a!==void 0?a:[])B.type==="Entity"&&B.entity?x.push(B.entity):B.type==="DashBoard"&&B.dashboardId&&M.push(B.dashboardId);let T=(o=t.bag)!==null&&o!==void 0?o:(0,Te.emptyBag)();return{sitemapId:(s=lw(T,Ja))!==null&&s!==void 0?s:"",sitemapxml:P,sitemapname:lw(T,ow)||t.name,appModuleId:t.id,appModuleName:t.name,appModuleDescription:t.description,appModuleUniqueName:t.uniqueName,...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},entities:x,components:{forms:(u=(l=t.components)===null||l===void 0?void 0:l.forms)!==null&&u!==void 0?u:[],views:(p=(c=t.components)===null||c===void 0?void 0:c.views)!==null&&p!==void 0?p:[],charts:(v=(m=t.components)===null||m===void 0?void 0:m.charts)!==null&&v!==void 0?v:[],dashboards:[...(w=(C=t.components)===null||C===void 0?void 0:C.dashboards)!==null&&w!==void 0?w:[],...M]}}}createDefault(t){var r,n,i,a;let o=t.siteMap&&t.siteMap.areas.length>0?t.siteMap.areas:[{id:"",title:"Area",groups:[{id:"",title:"Group",subAreas:[]}]}];return{id:(r=t.id)!==null&&r!==void 0?r:(0,Pq.newId)(),name:(n=t.name)!==null&&n!==void 0?n:"New App",uniqueName:(i=t.uniqueName)!==null&&i!==void 0?i:"",description:(a=t.description)!==null&&a!==void 0?a:"",siteMap:{areas:o},...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},...t.components?{components:t.components}:{}}}assignMissingIds(t){let r=t;if(!r||typeof r!="object")return t;let n=r.siteMap;return n&&Array.isArray(n.areas)?n.areas.forEach(rp):Array.isArray(r.areas)?r.areas.forEach(rp):Array.isArray(r.groups)?rp(r):Array.isArray(r.subAreas)?cw(r):"type"in r&&tl(r,"subarea"),t}validate(t){let r=[],n=t.siteMap;return n==null?r:(0,bi.isJsonObject)(n)?((0,bi.childObjects)(n,"areas","/siteMap","area",r).forEach(({node:a,index:o})=>{let s=`/siteMap/areas/${o}`;(0,bi.childObjects)(a,"groups",s,"group",r).forEach(({node:u,index:c})=>{let p=`${s}/groups/${c}`;(0,bi.childObjects)(u,"subAreas",p,"subArea",r).forEach(({node:v,index:C})=>{(0,bi.optionalEnum)(v,"type",["Entity","URL","DashBoard","CustomPage","GenPage"],`${p}/subAreas/${C}`,"subarea-type-invalid",r)})})}),r):(r.push((0,bi.issue)("/siteMap","sitemap-must-be-object",`siteMap must be a JSON object, got ${typeof n}`)),r)}applyServerIdentity(t,r){let n=r[Ja];if(!n)return;t.bag||(t.bag=(0,Te.emptyBag)());let i=t.bag.a.find(a=>a[0]===Ja);i?i[1]=n:t.bag.a.push([Ja,n])}areaToJson(t){var r;let{bag:n,modeledEls:i}=Ks(t,"Group"),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:ep(t),groups:i.map(l=>this.groupToJson(l)),bag:n},o=t.getAttribute("Icon");o&&(a.icon=o);let s=t.getAttribute("VectorIcon");return s&&(a.vectorIcon=s),a}groupToJson(t){var r;let{bag:n,modeledEls:i}=Ks(t,"SubArea");return{id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:ep(t),subAreas:i.map(a=>this.subAreaToJson(a)),bag:n}}subAreaToJson(t){var r;let{bag:n}=Ks(t,null),i=xq(t),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",type:i,title:ep(t),bag:n};if(i==="Entity"){let l=t.getAttribute("Entity");l&&(a.entity=l)}else if(i==="DashBoard"){let l=t.getAttribute("DefaultDashboard");l&&(a.dashboardId=l);let u=t.getAttribute("Url");u&&(a.dashboardUrl=u)}else if(i==="CustomPage"){let l=t.getAttribute("Page");l&&(a.page=l)}else if(i==="GenPage"){let l=t.getAttribute("GenPageId");l&&(a.genPageId=l)}else{let l=t.getAttribute("Url");l&&(a.url=l)}let o=t.getAttribute("Icon");o&&o!==Oq&&(a.icon=o);let s=t.getAttribute("VectorIcon");return s&&(a.vectorIcon=s),a}rootToRaw(t){var r,n,i,a;let o=(n=(r=t.siteMap)===null||r===void 0?void 0:r.bag)!==null&&n!==void 0?n:(0,Te.emptyBag)(),l=Ys(o)?[["IntroducedVersion",Zs]]:[],u=((a=(i=t.siteMap)===null||i===void 0?void 0:i.areas)!==null&&a!==void 0?a:[]).map(c=>this.areaToRaw(c));return{n:"SiteMap",a:(0,Te.mergeAttrs)(o.a,l),c:(0,Te.spliceChildren)(o.c,u)}}areaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Te.emptyBag)(),i=Ys(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ShowGroups","true"],["ResourceId","SitemapDesigner.NewTitle"],["DescriptionResourceId","SitemapDesigner.NewTitle"],["IntroducedVersion",Zs]),t.icon!==void 0&&a.push(["Icon",t.icon]),t.vectorIcon!==void 0&&a.push(["VectorIcon",t.vectorIcon]);let o=t.groups.map(l=>this.groupToRaw(l)),s=tp((0,Te.spliceChildren)(n.c,o),t.title,i);return{n:"Area",a:(0,Te.mergeAttrs)(n.a,a),c:s}}groupToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Te.emptyBag)(),i=Ys(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ResourceId","SitemapDesigner.NewGroup"],["DescriptionResourceId","SitemapDesigner.NewGroup"],["ToolTipResourseId","SitemapDesigner.Unknown"],["IntroducedVersion",Zs],["IsProfile","false"]);let o=t.subAreas.map(l=>this.subAreaToRaw(l)),s=tp((0,Te.spliceChildren)(n.c,o),t.title,i);return{n:"Group",a:(0,Te.mergeAttrs)(n.a,a),c:s}}subAreaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Te.emptyBag)(),i=Ys(n),a=Uq(n.a,t.type),o=[];t.id&&o.push(["Id",t.id]),Bq(o,t),i?(o.push(["ResourceId","SitemapDesigner.NewSubArea"],["Client","All,Outlook,OutlookLaptopClient,OutlookWorkstationClient,Web"],["Sku","All,OnPremise,Live,SPLA"],["AvailableOffline","true"],["PassParams","false"]),t.icon&&o.push(["Icon",t.icon])):t.icon!==void 0&&o.push(["Icon",t.icon]),t.vectorIcon!==void 0?o.push(["VectorIcon",t.vectorIcon]):t.type==="GenPage"&&!Lq(a,"VectorIcon")&&o.push(["VectorIcon",Fq]);let s=tp((0,Te.spliceChildren)(n.c,[]),t.title,i);return{n:"SubArea",a:(0,Te.mergeAttrs)(a,o),c:s}}};yi.AppAdapter=el;function Ks(e,t){let r=(0,Qa.nodeLikeFromDom)(e).getAllProperties().map(s=>[s.key,s.value]),n=[],i=[],a=e.childNodes,o=0;for(let s=0;s<a.length;s+=1){let l=a[s];l.nodeType!==1&&l.nodeType!==3||(l.nodeType===1&&t!==null&&l.tagName===t?i.push(l):n.push({i:o,node:(0,Te.rawFromNode)((0,Qa.nodeLikeFromDom)(l))}),o+=1)}return{bag:{a:r,c:n},modeledEls:i}}function sw(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName===t&&r.push(a)}return r}function ep(e){var t;let r=sw(e,"Titles")[0];if(!r)return"";let i=sw(r,"Title").find(a=>a.getAttribute("LCID")===np);return i&&(t=i.getAttribute("Title"))!==null&&t!==void 0?t:""}function xq(e){return e.getAttribute("GenPageId")?"GenPage":e.getAttribute("Entity")?"Entity":e.getAttribute("Page")?"CustomPage":e.getAttribute("DefaultDashboard")?"DashBoard":"URL"}function Ys(e){return e.a.length===0&&e.c.length===0}function Lq(e,t){return e.some(([r])=>r===t)}function lw(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function Uq(e,t){let r=Mq(t);return e.filter(([n])=>!Rq.includes(n)||r.has(n)).map(n=>[n[0],n[1]])}function Mq(e){switch(e){case"Entity":return new Set(["Entity"]);case"URL":return new Set(["Url"]);case"DashBoard":return new Set(["DefaultDashboard","Url"]);case"CustomPage":return new Set(["Page"]);case"GenPage":return new Set(["GenPageId"]);default:return new Set}}function Bq(e,t){var r,n,i,a,o;switch(t.type){case"Entity":e.push(["Entity",(r=t.entity)!==null&&r!==void 0?r:""]);break;case"URL":e.push(["Url",(n=t.url)!==null&&n!==void 0?n:""]);break;case"DashBoard":e.push(["DefaultDashboard",(i=t.dashboardId)!==null&&i!==void 0?i:""]),t.dashboardUrl!==void 0&&e.push(["Url",t.dashboardUrl]);break;case"CustomPage":e.push(["Page",(a=t.page)!==null&&a!==void 0?a:""]);break;case"GenPage":e.push(["GenPageId",(o=t.genPageId)!==null&&o!==void 0?o:""]);break;default:break}}function tp(e,t,r){if(!t)return e;let n=e.findIndex(i=>i.n==="Titles");if(n>=0){let i=e.slice();return i[n]=kq(e[n],t),i}return r?[qq(t),...e]:e}function kq(e,t){let r=!1,n=e.c.map(i=>!r&&i.n==="Title"&&$q(i,"LCID")===np?(r=!0,{n:i.n,a:(0,Te.mergeAttrs)(i.a,[["Title",t]]),c:i.c}):i);return r||n.unshift(uw(t)),{n:e.n,a:e.a.map(i=>[i[0],i[1]]),c:n}}function qq(e){return{n:"Titles",a:[],c:[uw(e)]}}function uw(e){return{n:"Title",a:[["LCID",np],["Title",e]],c:[]}}function $q(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function Vq(e){let t="0123456789abcdef",r="";for(let n=0;n<e;n+=1)r+=t[Math.floor(Math.random()*t.length)];return r}function tl(e,t){e&&(typeof e.id!="string"||e.id.length===0)&&(e.id=`${t}_${Vq(8)}`)}function rp(e){var t;tl(e,"area");for(let r of(t=e.groups)!==null&&t!==void 0?t:[])cw(r)}function cw(e){var t;tl(e,"group");for(let r of(t=e.subAreas)!==null&&t!==void 0?t:[])tl(r,"subarea")}function Gq(){return{adapter:new el,api:_q.appApi}}yi.appRegistration=Gq});var pw={};xt(pw,{ActionType:()=>ap,AppActionOrigin:()=>fp,AppActionVisibilityType:()=>pp,ButtonType:()=>sp,CannotUpdateAppActionColumns:()=>zq,Context:()=>up,IconType:()=>op,Location:()=>lp,OnClickEventType:()=>dp,Scope:()=>cp,VisibilityType:()=>ip});var ip,ap,op,sp,lp,up,cp,dp,pp,fp,zq,fw=S(()=>{"use strict";(function(e){e[e.NotSupported=0]="NotSupported",e[e.Show=1]="Show",e[e.ClassicRules=2]="ClassicRules",e[e.Expression=3]="Expression"})(ip||(ip={}));(function(e){e[e.NotSupported=0]="NotSupported",e[e.None=1]="None",e[e.JavaScript=2]="JavaScript",e[e.Expression=3]="Expression"})(ap||(ap={}));(function(e){e[e.NoIcon=0]="NoIcon",e[e.UseIcon=1]="UseIcon",e[e.UseWebResource=2]="UseWebResource"})(op||(op={}));(function(e){e[e.Standard=0]="Standard",e[e.Dropdown=1]="Dropdown",e[e.Split=2]="Split",e[e.Group=3]="Group"})(sp||(sp={}));(function(e){e[e.Form=0]="Form",e[e.HomePageGrid=1]="HomePageGrid",e[e.SubGridStandard=2]="SubGridStandard",e[e.SubGridAssociated=3]="SubGridAssociated",e[e.QuickForm=4]="QuickForm",e[e.Global=5]="Global",e[e.Dashboard=6]="Dashboard"})(lp||(lp={}));(function(e){e[e.All=0]="All",e[e.Entity=1]="Entity"})(up||(up={}));(function(e){e[e.App=0]="App",e[e.Entity=1]="Entity",e[e.Global=2]="Global"})(cp||(cp={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.JavaScript=2]="JavaScript"})(dp||(dp={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.ClassicRules=2]="ClassicRules"})(pp||(pp={}));(function(e){e[e.Default=0]="Default",e[e.Migrated=1]="Migrated",e[e.MigratedClone=2]="MigratedClone"})(fp||(fp={}));zq=["appactionid","appmoduleid","context","contextvalue","location","name","type","uniquename","isdisabled","origin"]});var hw=f(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.commandApi=void 0;var vr=qe(),Xt=ue(),Wq="OnClickEventJavaScriptWebResourceId($select=name,webresourceid),IconWebResourceId($select=name,webresourceid)";async function mp(e,t){let r=`/EntityDefinitions(LogicalName='${(0,Xt.odataLiteral)(t)}')${(0,Xt.odataQuery)([["$select","MetadataId"]])}`,i=(0,vr.ensureSuccess)(await e.get(r),e.apiUrl(r)).body,a=i?.MetadataId;return a?(0,Xt.normalizeGuid)(a,"entityMetadataId"):""}rl.commandApi={async get(e,t){var r;let n=t,i=await mp(e,n),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,Xt.odataLiteral)(n)}'`,o=`/appactions${(0,Xt.odataQuery)([["$expand",Wq],["$filter",a]])}`,s=(0,vr.ensureSuccess)(await e.get(o),e.apiUrl(o)),l=s.body;return{raw:{entityLogicalName:n,entityMetadataId:i,appActions:(r=l?.value)!==null&&r!==void 0?r:[]},etag:(0,vr.readEtag)(s)}},async list(e,t){let r=t?.entityLogicalName;return r?[{type:"command",id:r,name:`${r} commands`,entityLogicalName:r,isDirty:!1}]:[]},async create(e,t){let r=t,n=r.entityMetadataId||await mp(e,r.entityLogicalName);return mw(e,{...r,entityMetadataId:n},!1)},async update(e,t,r,n){return mw(e,r,!0)},async delete(e,t){var r,n;let i=await mp(e,t),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,Xt.odataLiteral)(t)}'`,o=`/appactions${(0,Xt.odataQuery)([["$select","appactionid"],["$filter",a]])}`,l=(n=(r=(0,vr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[];for(let u of l)u.appactionid&&await(0,vr.deleteRecord)(e,"appactions",u.appactionid)}};async function mw(e,t,r){var n;let i=t.entityMetadataId?(0,Xt.normalizeGuid)(t.entityMetadataId,"entityMetadataId"):"",a=jq(t.rows);for(let o of a)if(r&&o.exists){let l=`/appactions(${(0,Xt.normalizeGuid)(o.appactionid,"id")})`,u=o.etag?{"If-Match":o.etag}:void 0;(0,vr.ensureSuccess)(await e.patch(l,o.body,u?{headers:u}:void 0),e.apiUrl(l))}else{let s="/appactions",l={...o.body};i&&l["[email protected]"]===void 0&&(l["[email protected]"]=`/entities(${i})`);let u=(0,vr.ensureSuccess)(await e.post(s,l),e.apiUrl(s));(0,vr.readCreatedId)(u,"appactionid")}for(let o of[...(n=t.deletedRowIds)!==null&&n!==void 0?n:[]].reverse())await(0,vr.deleteRecord)(e,"appactions",(0,Xt.normalizeGuid)(o,"id"));return{id:t.entityLogicalName,etag:null}}function jq(e){let t=new Map(e.map(a=>[a.appactionid,a])),r=new Set,n=[],i=a=>{if(r.has(a.appactionid))return;let o=a.body["[email protected]"];if(typeof o=="string"){let s=/\(([^)]+)\)/.exec(o),l=s?t.get(s[1]):void 0;l&&i(l)}r.add(a.appactionid),n.push(a)};return e.forEach(i),n}});var _w=f(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.commandRegistration=Ci.CommandAdapter=void 0;var Ee=(fw(),Lt(pw)),wt=Br(),Hq=hw(),vw=zt(),Xa=ue(),gp="$ClientSvg:",vp=".svg",Jq=2,bw="entityMetadataId",Qq=new Set(["@odata.etag","IconWebResourceId","OnClickEventJavaScriptWebResourceId","VisibilityFormulaComponentLibraryId","OnClickEventFormulaComponentLibraryId","ContextEntity","_appmoduleid_value","_contextentity_value","_createdby_value","_createdonbehalfby_value","_iconwebresourceid_value","_modifiedby_value","_modifiedonbehalfby_value","_onclickeventformulacomponentlibraryid_value","_onclickeventjavascriptwebresourceid_value","_organizationid_value","_parentappactionid_value","_visibilityformulacomponentlibraryid_value","createdon","modifiedon","overriddencreatedon","overwritetime","componentstate","componentidunique","solutionid","ismanaged","iscustomizable","versionnumber","importsequencenumber","timezoneruleversionnumber","utcconversiontimezonecode","statecode","statuscode","scope"]),nl=class{toArtifact(t){var r,n,i,a,o,s;let l=(r=t.appActions)!==null&&r!==void 0?r:[],u=(n=t.entityLogicalName)!==null&&n!==void 0?n:"",c=new Map;for(let v of l){let C=typeof v._parentappactionid_value=="string"&&v._parentappactionid_value?v._parentappactionid_value:"",w=(i=c.get(C))!==null&&i!==void 0?i:[];w.push(v),c.set(C,w)}let p=new Map;for(let v of(a=c.get(""))!==null&&a!==void 0?a:[]){let C=e4(v.location),w=(o=p.get(C))!==null&&o!==void 0?o:[];w.push(v),p.set(C,w)}let m=[];for(let[v,C]of p)m.push({location:v,groups:Kq(C,c,ww(v),u)});return{id:u,entityLogicalName:u,commandBars:Zq(m),bag:{a:[[bw,(s=t.entityMetadataId)!==null&&s!==void 0?s:""]]}}}fromArtifact(t){return{entityLogicalName:t.entityLogicalName,entityMetadataId:yp(t),appActions:hp(t).map(r=>r.row)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t,r){let n=new Set(r?hp(r).map(l=>l.appactionid):[]),i=hp(t),a=new Set(i.map(l=>l.appactionid)),o=i.map(l=>{let u=l.exists||n.has(l.appactionid);return{appactionid:l.appactionid,exists:u,etag:l.etag,body:u?d4(l.row):Iw(l.row)}}),s=[...n].filter(l=>!a.has(l));return{entityLogicalName:t.entityLogicalName,entityMetadataId:yp(t),rows:o,...s.length>0?{deletedRowIds:s}:{}}}createDefault(t){var r,n,i,a;let o=(n=(r=t.entityLogicalName)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"";return{id:(i=t.id)!==null&&i!==void 0?i:o,entityLogicalName:o,commandBars:(a=t.commandBars)!==null&&a!==void 0?a:[]}}assignMissingIds(t){return(0,vw.assignMissingIds)(t)}validate(t){let r=[];return(0,wt.childObjects)(t,"commandBars","","commandBar",r).forEach(({node:i,index:a})=>{let o=`/commandBars/${a}`;(0,wt.optionalEnum)(i,"location",["MainTab","ContextualTab","HomeTab"],o,"bar-location-invalid",r),(0,wt.childObjects)(i,"groups",o,"group",r).forEach(({node:l,index:u})=>{let c=`${o}/groups/${u}`;(0,wt.optionalGuidId)(l,"id",c,"group-id-invalid",r),yw((0,wt.childObjects)(l,"controls",c,"control",r),`${c}/controls`,r)})}),r}};Ci.CommandAdapter=nl;function yw(e,t,r){e.forEach(({node:n,index:i})=>{let a=`${t}/${i}`;(0,wt.optionalGuidId)(n,"id",a,"control-id-invalid",r),(0,wt.optionalEnum)(n,"type",["Button","FlyoutAnchor","SplitButton"],a,"control-type-invalid",r);let o=n.location;o!==void 0&&(typeof o!="number"||!Number.isInteger(o)||o<0||o>6)&&r.push((0,wt.issue)(`${a}/location`,"control-location-invalid",`location must be an integer 0-6 when present, got ${JSON.stringify(o)}`)),n.action!==void 0&&n.action!==null&&((0,wt.isJsonObject)(n.action)?(0,wt.optionalEnum)(n.action,"type",["javascript"],`${a}/action`,"action-type-invalid",r):r.push((0,wt.issue)(`${a}/action`,"control-action-must-be-object",`a control action must be a JSON object when present, got ${typeof n.action}`)));let s=(0,wt.childObjects)(n,"children",a,"control",r);s.length>0&&yw(s,`${a}/children`,r)})}function Cw(e){return{a:Object.entries(e)}}function Xq(e){return Object.fromEntries(e.a)}function bp(e,t){if(e){for(let[r,n]of e.a)if(r===t)return n}}function yp(e){let t=bp(e.bag,bw);return typeof t=="string"?t:""}function Kq(e,t,r,n){var i,a;let o=[],s=[];for(let l of al(e))l.type===Ee.ButtonType.Group?o.push({id:Nw(l.name,n),title:typeof l.grouptitle=="string"?l.grouptitle:"",controls:al((a=t.get((i=l.appactionid)!==null&&i!==void 0?i:""))!==null&&a!==void 0?a:[]).map(u=>il(u,t,r,n)),bag:Cw(l)}):s.push(il(l,t,r,n));return s.length>0&&o.unshift({id:(0,vw.newId)(),title:"",controls:s}),o}function il(e,t,r,n){var i,a,o,s;let l=Nw(e.name,n),u={id:l,type:t4(e.type),label:typeof e.buttonlabeltext=="string"?e.buttonlabeltext:"",command:typeof e.appactionid=="string"?e.appactionid:l,bag:Cw(e)},c=Aw(e);c&&(u.icon=c);let p=Yq(e);p&&(u.action=p),typeof e.hidden=="boolean"&&(u.hidden=e.hidden),typeof e.isdisabled=="boolean"&&(u.disabled=e.isdisabled),typeof e.location=="number"&&e.location!==r&&(u.location=e.location);let m=t.get((i=e.appactionid)!==null&&i!==void 0?i:"");if(m&&m.length>0){let v=[];for(let C of al(m))if(C.type===Ee.ButtonType.Group){u.flyoutGroupId=(a=C.appactionid)!==null&&a!==void 0?a:void 0;for(let w of al((s=t.get((o=C.appactionid)!==null&&o!==void 0?o:""))!==null&&s!==void 0?s:[]))v.push(il(w,t,r,n))}else v.push(il(C,t,r,n));u.children=v}return u}function Aw(e){var t;if(!((t=e.IconWebResourceId)===null||t===void 0)&&t.name)return e.IconWebResourceId.name;if(e.fonticon)return e.fonticon.startsWith(gp)?e.fonticon.slice(gp.length)+vp:e.fonticon}function Yq(e){var t;let r=e.onclickeventjavascriptfunctionname;if(typeof r!="string"||!r)return;let n=e.OnClickEventJavaScriptWebResourceId,i=e._onclickeventjavascriptwebresourceid_value,a={type:"javascript",webResourceId:(t=typeof i=="string"?i:n?.webresourceid)!==null&&t!==void 0?t:"",functionName:r};n?.name&&(a.libraryName=n.name);let o=e.onclickeventjavascriptparameters;return typeof o=="string"&&o&&(a.parameters=o),a}function gw(e){return typeof e.sequence=="number"?e.sequence:typeof e.buttonsequencepriority=="number"?e.buttonsequencepriority:0}function al(e){return[...e].sort((t,r)=>gw(t)-gw(r))}function Zq(e){let t={MainTab:0,ContextualTab:1,HomeTab:2};return[...e].sort((r,n)=>{var i,a;return((i=t[r.location])!==null&&i!==void 0?i:9)-((a=t[n.location])!==null&&a!==void 0?a:9)})}function Nw(e,t){if(!e)return"";if(e.indexOf("{!EntityLogicalName}")>=0)return e.replace("{!EntityLogicalName}",t);let r=e.split("!");return r.length===2?r[1]:e}function e4(e){switch(e){case Ee.Location.Form:case Ee.Location.QuickForm:return"MainTab";case Ee.Location.HomePageGrid:case Ee.Location.Dashboard:return"HomeTab";default:return"ContextualTab"}}function ww(e){switch(e){case"MainTab":return Ee.Location.Form;case"HomeTab":return Ee.Location.HomePageGrid;default:return Ee.Location.SubGridStandard}}function t4(e){switch(e){case Ee.ButtonType.Dropdown:return"FlyoutAnchor";case Ee.ButtonType.Split:return"SplitButton";default:return"Button"}}function r4(e){switch(e){case"FlyoutAnchor":return Ee.ButtonType.Dropdown;case"SplitButton":return Ee.ButtonType.Split;default:return Ee.ButtonType.Standard}}function n4(e){var t;return e.bag&&e.bag.a.length>0?!0:((t=e.title)!==null&&t!==void 0?t:"").length>0}function hp(e){var t,r,n;let i=[],a=yp(e);for(let o of(t=e.commandBars)!==null&&t!==void 0?t:[]){let s=ww(o.location);for(let l of(r=o.groups)!==null&&r!==void 0?r:[]){let u;if(n4(l)){let c=a4(l,s,void 0,e,a);i.push(c),u=c.appactionid}for(let c of(n=l.controls)!==null&&n!==void 0?n:[])Sw(c,s,u,e,a,i)}}return i}function Sw(e,t,r,n,i,a){var o;let s=i4(e,t,r,n,i);a.push(s);let l=(o=e.children)!==null&&o!==void 0?o:[];if(l.length===0)return;let u=e.flyoutGroupId||c4(s.appactionid);a.push(o4(u,t,s.appactionid,n,i));for(let c of l)Sw(c,t,u,n,i,a)}function i4(e,t,r,n,i){let a=Dw(e,t,r,n,i),o=a.row,s=Aw(o);return e.location!==void 0&&(o.location=e.location),o.type=r4(e.type),o.buttonlabeltext=e.label,s4(o,e.icon,s),l4(o,e.action),e.hidden!==void 0&&(o.hidden=e.hidden),e.disabled!==void 0&&(o.isdisabled=e.disabled),{...a,row:o}}function a4(e,t,r,n,i){let a=Dw(e,t,r,n,i);return a.row.type=Ee.ButtonType.Group,a.row.grouptitle=e.title,a}function o4(e,t,r,n,i){let a=Ew(e,t,n,i);return a["[email protected]"]=`/appactions(${(0,Xa.normalizeGuid)(r,"Command flyout group id")})`,a.type=Ee.ButtonType.Group,a.grouptitle===void 0&&(a.grouptitle=""),a.isgrouptitlehidden=!0,{appactionid:e,exists:!1,etag:null,row:a}}function Dw(e,t,r,n,i){let a,o,s,l;if(e.bag&&e.bag.a.length>0){a=Xq(e.bag),o=!0;let u=bp(e.bag,"@odata.etag");s=typeof u=="string"?u:null;let c=bp(e.bag,"appactionid");l=typeof c=="string"&&c?c:e.id}else l=e.id,a=Ew(l,t,n,i),o=!1,s=null;return r&&(a["[email protected]"]=`/appactions(${(0,Xa.normalizeGuid)(r,"Command parent appaction id")})`),{appactionid:l,exists:o,etag:s,row:a}}function Ew(e,t,r,n){let i={appactionid:e,name:`${e}!${e.replace(/-/g,"").slice(0,32)}`,uniquename:"",location:t,context:Ee.Context.Entity,contextvalue:r.entityLogicalName,scope:Ee.Scope.Entity};return n&&(i["[email protected]"]=`/entities(${(0,Xa.normalizeGuid)(n,"Command context entity metadata id")})`),i}function s4(e,t,r){if(t===r){let n=e._iconwebresourceid_value;typeof n=="string"&&n&&!e.fonticon&&(e["[email protected]"]=`/webresourceset(${(0,Xa.normalizeGuid)(n,"Command icon web resource id")})`);return}if(t===void 0){e.fonticon="",e.IconWebResourceId=null;return}e.fonticon=t.toLowerCase().endsWith(vp)?gp+t.slice(0,t.length-vp.length):t,e.IconWebResourceId=null}function l4(e,t){if(!(!t||t.type!=="javascript")){if(e.onclickeventtype=Jq,t.webResourceId){let r=(0,Xa.normalizeGuid)(t.webResourceId,"Command action web resource id");e["[email protected]"]=`/webresourceset(${r})`}e.onclickeventjavascriptfunctionname=t.functionName,t.parameters!==void 0&&(e.onclickeventjavascriptparameters=t.parameters)}}function u4(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}function c4(e){let t="";for(let r=0;r<4;r+=1)t+=u4(`${r}:flyout-group:${e}`).toString(16).padStart(8,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function Iw(e){let t={...e};for(let r of Qq)delete t[r];return t}function d4(e){let t=Iw(e);for(let r of Ee.CannotUpdateAppActionColumns)delete t[r];return t}function p4(){return{adapter:new nl,api:Hq.commandApi}}Ci.commandRegistration=p4});var Pw=f(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.chartApi=void 0;var br=qe(),Ka=ue(),f4="savedqueryvisualizationid,name,description,primaryentitytypecode,datadescription,presentationdescription,charttype,type,isdefault",m4="savedqueryvisualizationid,name,primaryentitytypecode,charttype,isdefault";ol.chartApi={async get(e,t){let n=`/savedqueryvisualizations(${(0,Ka.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Ka.odataQuery)([["$select",f4]]),i=(0,br.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,br.readEtag)(i)}},async list(e,t){var r;let n=`/savedqueryvisualizations${(0,Ka.odataQuery)([["$select",m4],["$filter",t?.entityLogicalName?`primaryentitytypecode eq '${(0,Ka.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`,a=(0,br.ensureSuccess)(await e.get(n),e.apiUrl(n)).body;return((r=a?.value)!==null&&r!==void 0?r:[]).map(s=>{var l,u;return{type:"chart",id:(l=s.savedqueryvisualizationid)!==null&&l!==void 0?l:"",name:(u=s.name)!==null&&u!==void 0?u:"",entityLogicalName:s.primaryentitytypecode,isDirty:!1}})},async create(e,t){let r=t,n="/savedqueryvisualizations",i=(0,br.ensureSuccess)(await e.post(n,{name:r.name,description:r.description,datadescription:r.datadescription,presentationdescription:r.presentationdescription,primaryentitytypecode:r.primaryentitytypecode,charttype:r.charttype,isdefault:r.isdefault}),e.apiUrl(n));return{id:(0,br.requireCreatedId)(i,"savedqueryvisualizationid","chart"),etag:(0,br.readEtag)(i)}},async update(e,t,r,n){let i=r,a=(0,Ka.normalizeGuid)(t,"id"),o=`/savedqueryvisualizations(${a})`,s=n?{"If-Match":n}:void 0,l=(0,br.ensureSuccess)(await e.patch(o,{name:i.name,description:i.description,datadescription:i.datadescription,presentationdescription:i.presentationdescription},s?{headers:s}:void 0),e.apiUrl(o));return{id:a,etag:(0,br.readEtag)(l)}},delete(e,t){return(0,br.deleteRecord)(e,"savedqueryvisualizations",t)}}});var zw=f(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.chartRegistration=Ai.ChartAdapter=void 0;var Cp=on(),Ow=Br(),yr=Wa(),h4=Pw(),Ap=cn(),g4=zt(),v4=["Column","StackedColumn","StackedColumn100","Bar","StackedBar","StackedBar100","Area","StackedArea","StackedArea100","Line","Pie","Doughnut","Funnel","Tag"],b4=new Map(v4.map(e=>[e.toLowerCase(),e]));function xw(e){var t;return e&&(t=b4.get(e.toLowerCase()))!==null&&t!==void 0?t:"Column"}function y4(){return'<Chart Palette="BrightPastel"><Series><Series ChartType="Column" ChartArea="Default" /></Series><ChartAreas><ChartArea Name="Default" /></ChartAreas><Legends><Legend Name="Default" /></Legends></Chart>'}function C4(e){var t,r;let n=e.entityLogicalName,i=e.series.map((u,c)=>({alias:`agg_${c}`,series:u})),a=e.categories.map((u,c)=>({alias:`grp_${c}`,category:u})),o=i.map(u=>`<attribute alias="${u.alias}" name="${Ya(u.series.attribute)}" aggregate="${Ya(u.series.aggregate)}" />`).join("")+a.map(u=>`<attribute alias="${u.alias}" name="${Ya(u.category.attribute)}" groupby="true"${u.category.dateGrouping?` dategrouping="${Ya(u.category.dateGrouping)}"`:""} />`).join(""),s=i.map(u=>`<measure alias="${u.alias}" />`).join(""),l=(r=(t=a[0])===null||t===void 0?void 0:t.alias)!==null&&r!==void 0?r:"";return`<datadefinition><fetchcollection><fetch mapping="logical" aggregate="true"><entity name="${Ya(n)}">${o}</entity></fetch></fetchcollection><categorycollection><category alias="${l}"><measurecollection>${s}</measurecollection></category></categorycollection></datadefinition>`}var sl=class{toArtifact(t){var r,n,i,a,o,s,l;(0,Ap.installDomShim)();let u=(r=t.datadescription)!==null&&r!==void 0?r:"",c=(n=t.presentationdescription)!==null&&n!==void 0?n:"",p=(0,yr.parseXmlRoot)(u,"<datadefinition/>"),m=(0,yr.parseXmlRoot)(c,"<Chart/>");return{id:(i=t.savedqueryvisualizationid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.primaryentitytypecode)!==null&&s!==void 0?s:"",chartType:Lw(m),isDefault:(l=t.isdefault)!==null&&l!==void 0?l:!1,series:Bw(p),categories:kw(p),presentation:Uw(m),dataBag:u?(0,yr.projectElementBag)(p):void 0,presentationBag:c?(0,yr.projectElementBag)(m):void 0,rowBag:A4(t.charttype,t.type)}}fromArtifact(t){(0,Ap.installDomShim)();let{datadescription:r,presentationdescription:n}=N4(t);return{savedqueryvisualizationid:t.id,name:t.name,description:t.description,primaryentitytypecode:t.entityLogicalName,datadescription:r,presentationdescription:n,charttype:Fw(t.rowBag,"charttype"),type:Fw(t.rowBag,"type"),isdefault:t.isDefault}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){var r,n,i,a,o,s,l;let u=this.fromArtifact(t);return{name:(r=u.name)!==null&&r!==void 0?r:"",description:(n=u.description)!==null&&n!==void 0?n:"",datadescription:(i=u.datadescription)!==null&&i!==void 0?i:"",presentationdescription:(a=u.presentationdescription)!==null&&a!==void 0?a:"",primaryentitytypecode:(o=u.primaryentitytypecode)!==null&&o!==void 0?o:"",charttype:(s=u.charttype)!==null&&s!==void 0?s:0,isdefault:(l=u.isdefault)!==null&&l!==void 0?l:!1}}createDefault(t){var r,n,i,a,o,s,l;(0,Ap.installDomShim)();let u=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,g4.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New Chart",description:(a=t.description)!==null&&a!==void 0?a:"",entityLogicalName:u,chartType:(o=t.chartType)!==null&&o!==void 0?o:"Column",isDefault:(s=t.isDefault)!==null&&s!==void 0?s:!1,series:t.series&&t.series.length>0?t.series:[{attribute:"createdon",aggregate:"count"}],categories:t.categories&&t.categories.length>0?t.categories:[{attribute:"createdon",dateGrouping:"month"}],presentation:(l=t.presentation)!==null&&l!==void 0?l:{palette:"BrightPastel",showLegend:!0}}}assignMissingIds(t){return t}validate(t){let r=[],n=t;return(0,Ow.childObjects)(n,"series","","series",r),(0,Ow.childObjects)(n,"categories","","category",r),r}};Ai.ChartAdapter=sl;function A4(e,t){let r=[];return e!==void 0&&r.push(["charttype",String(e)]),t!==void 0&&r.push(["type",String(t)]),r.length>0?{a:r,c:[]}:void 0}function Fw(e,t){if(!e)return;let r=e.a.find(([i])=>i===t);if(!r)return;let n=parseInt(r[1],10);return Number.isNaN(n)?void 0:n}function Lw(e){let t=e.getElementsByTagName("Series");for(let r=0;r<t.length;r+=1)if(t[r].getAttribute("ChartType"))return xw(t[r].getAttribute("ChartType"));return"Column"}function Uw(e){var t;let r={showLegend:e.getElementsByTagName("Legend").length>0},n=e.getAttribute("Palette");n&&(r.palette=n);let i=e.getElementsByTagName("Title")[0],a=((t=i?.textContent)!==null&&t!==void 0?t:"").trim();return a&&(r.title=a),r}function ll(e){return e.getElementsByTagName("fetch")[0]}function Mw(e){var t;let r=new Map;if(!e)return r;let n=e.getElementsByTagName("link-entity");for(let i=0;i<n.length;i+=1){let a=n[i],o=a.getAttribute("name");if(!o)continue;let s=a.getElementsByTagName("attribute");for(let l=0;l<s.length;l+=1){let u=s[l],c=(t=u.getAttribute("alias"))!==null&&t!==void 0?t:u.getAttribute("name");c&&r.set(c,o)}}return r}function Bw(e){let t=ll(e);if(!t)return[];let r=Mw(t),n=t.getElementsByTagName("attribute"),i=[];for(let a=0;a<n.length;a+=1){let o=n[a],s=o.getAttribute("aggregate");if(!s)continue;let l=o.getAttribute("name");if(!l)continue;let u={attribute:l,aggregate:s},c=o.getAttribute("charttype");c&&(u.seriesType=xw(c));let p=o.getAttribute("alias");p&&(u.alias=p);let m=p??l,v=r.get(m);v&&(u.relatedEntity=v),i.push(u)}return i}function kw(e){var t;let r=ll(e);if(!r)return[];let n=Mw(r),i=r.getElementsByTagName("attribute"),a=[];for(let o=0;o<i.length;o+=1){let s=i[o];if(((t=s.getAttribute("groupby"))!==null&&t!==void 0?t:"").toLowerCase()!=="true")continue;let l=s.getAttribute("name");if(!l)continue;let u={attribute:l},c=s.getAttribute("dategrouping");c&&(u.dateGrouping=c);let p=s.getAttribute("alias");p&&(u.alias=p);let m=p??l,v=n.get(m);v&&(u.relatedEntity=v),a.push(u)}return a}function N4(e){if(!Rw(e.dataBag)||!Rw(e.presentationBag))return{datadescription:C4(e),presentationdescription:V4(e)};let t=new DOMParser().parseFromString("<root/>","text/xml"),r=Tw(e.dataBag,"datadefinition",t),n=Tw(e.presentationBag,"Chart",t);return Np(e.series,Bw(r))||(S4(t,r,e.series),w4(t,n,e.series.length,e.chartType)),Np(e.categories,kw(r))||D4(t,r,e.categories),e.chartType!==Lw(n)&&Vw(n,e.chartType),Np(e.presentation,Uw(n))||Gw(n,e.presentation),{datadescription:(0,yr.serializeNode)(r),presentationdescription:(0,yr.serializeNode)(n)}}function Rw(e){return!!e&&(e.c.length>0||e.a.length>0)}function w4(e,t,r,n){let i,a=t.childNodes;for(let l=0;l<a.length;l+=1)if(a[l].nodeType===1&&a[l].tagName==="Series"){i=a[l];break}i||(i=e.createElement("Series"),t.insertBefore(i,t.firstChild));let o=[],s=i.childNodes;for(let l=0;l<s.length;l+=1)s[l].nodeType===1&&s[l].tagName==="Series"&&o.push(s[l]);for(let l=o.length;l<r;l+=1){let u=e.createElement("Series");u.setAttribute("ChartType",n),i.appendChild(u)}for(let l=r;l<o.length;l+=1)i.removeChild(o[l])}function Tw(e,t,r){let n={n:t,a:(0,Cp.mergeAttrs)(e.a,[]),c:(0,Cp.spliceChildren)(e.c,[])};return(0,Cp.rebuildRaw)(n,(0,yr.domEngine)(r),null)}function S4(e,t,r){let n=ll(t),i=n?.getElementsByTagName("entity")[0];!n||!i||qw(e,t,i,R4(n),r,x4,{aliasPrefix:"aggregate_column",addRef:_4,removeRef:F4})}function D4(e,t,r){let n=ll(t),i=n?.getElementsByTagName("entity")[0];!n||!i||qw(e,t,i,T4(n),r,L4,{aliasPrefix:"groupby_column",addRef:P4,removeRef:O4})}function qw(e,t,r,n,i,a,o){let s=new Map;for(let m of n){let v=m.getAttribute("alias");v&&s.set(v,m)}let l=new Set,u=[];for(let m of i){let v=m.alias?s.get(m.alias):void 0;v&&!l.has(v)?(a(v,m),l.add(v)):u.push(m)}let c=n.filter(m=>!l.has(m)),p=0;for(let m of u)if(p<c.length){let v=c[p];a(v,m),l.add(v),p+=1}else{let v=e.createElement("attribute"),C=m.alias||I4(t,o.aliasPrefix);v.setAttribute("alias",C),a(v,m),U4(e,r,v,m.relatedEntity),o.addRef(e,t,C)}for(let m of n)if(!l.has(m)){let v=m.getAttribute("alias");v&&o.removeRef(t,v),B4(m)}}function E4(e){let t=new Set;for(let r of["attribute","measure","category"]){let n=e.getElementsByTagName(r);for(let i=0;i<n.length;i+=1){let a=n[i].getAttribute("alias");a&&t.add(a)}}return t}function I4(e,t){let r=E4(e);if(!r.has(t))return t;for(let n=2;;n+=1){let i=`${t}_${n}`;if(!r.has(i))return i}}function $w(e,t){let r=t.getElementsByTagName("categorycollection")[0];if(r)return r;let n=e.createElement("categorycollection");return t.appendChild(n),n}function _4(e,t,r){let n=$w(e,t),i=n.getElementsByTagName("category")[0];i||(i=e.createElement("category"),n.appendChild(i));let a=e.createElement("measurecollection"),o=e.createElement("measure");o.setAttribute("alias",r),a.appendChild(o),i.appendChild(a)}function P4(e,t,r){let n=$w(e,t),i=e.createElement("category");i.setAttribute("alias",r),n.appendChild(i)}function O4(e,t){let r=e.getElementsByTagName("category");for(let n=0;n<r.length;n+=1)r[n].getAttribute("alias")===t&&r[n].removeAttribute("alias")}function F4(e,t){var r;let n=e.getElementsByTagName("measure"),i=[];for(let a=0;a<n.length;a+=1)n[a].getAttribute("alias")===t&&i.push(n[a]);for(let a of i){let o=a.parentNode;o?.removeChild(a),o&&o.tagName==="measurecollection"&&!q4(o)&&((r=o.parentNode)===null||r===void 0||r.removeChild(o))}}function R4(e){let t=[],r=e.getElementsByTagName("attribute");for(let n=0;n<r.length;n+=1)r[n].getAttribute("aggregate")&&t.push(r[n]);return t}function T4(e){var t;let r=[],n=e.getElementsByTagName("attribute");for(let i=0;i<n.length;i+=1)((t=n[i].getAttribute("groupby"))!==null&&t!==void 0?t:"").toLowerCase()==="true"&&r.push(n[i]);return r}function x4(e,t){e.setAttribute("name",t.attribute),e.setAttribute("aggregate",t.aggregate),t.seriesType&&e.setAttribute("charttype",t.seriesType)}function L4(e,t){e.setAttribute("name",t.attribute),e.setAttribute("groupby","true"),t.dateGrouping?e.setAttribute("dategrouping",t.dateGrouping):e.getAttribute("dategrouping")!==null&&e.removeAttribute("dategrouping")}function U4(e,t,r,n){n?M4(e,t,n).appendChild(r):t.appendChild(r)}function M4(e,t,r){let n=t.getElementsByTagName("link-entity");for(let a=0;a<n.length;a+=1)if(n[a].getAttribute("name")===r)return n[a];let i=e.createElement("link-entity");return i.setAttribute("name",r),t.appendChild(i),i}function B4(e){let t=e.parentNode;if(t&&(t.removeChild(e),t.tagName==="link-entity"&&!k4(t))){let r=t.parentNode;r&&r.removeChild(t)}}function k4(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1){let i=n.tagName;if(i==="attribute"||i==="link-entity")return!0}}return!1}function q4(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1)if(t[r].nodeType===1)return!0;return!1}function Vw(e,t){let r=e.getElementsByTagName("Series"),n=!1;for(let i=0;i<r.length;i+=1)r[i].getAttribute("ChartType")&&(r[i].setAttribute("ChartType",t),n=!0);if(!n){for(let i=0;i<r.length;i+=1)if(!$4(r[i])){r[i].setAttribute("ChartType",t);return}}}function $4(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1&&n.tagName==="Series")return!0}return!1}function Gw(e,t){var r;let n=e.ownerDocument;if(t.palette!==void 0&&e.setAttribute("Palette",t.palette),t.showLegend!==void 0){let i=[],a=e.getElementsByTagName("Legends");for(let o=0;o<a.length;o+=1)i.push(a[o]);if(t.showLegend&&i.length===0){let o=n.createElement("Legends"),s=n.createElement("Legend");s.setAttribute("Name","Default"),o.appendChild(s),e.appendChild(o)}else if(!t.showLegend)for(let o of i)(r=o.parentNode)===null||r===void 0||r.removeChild(o)}if(t.title!==void 0){let i=e.getElementsByTagName("Title")[0];i&&(i.textContent=t.title)}}function V4(e){let t=(0,yr.parseXmlRoot)(y4(),"<Chart/>");return Vw(t,e.chartType),Gw(t,e.presentation),(0,yr.serializeNode)(t)}function Np(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Ya(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function G4(){return{adapter:new sl,api:h4.chartApi}}Ai.chartRegistration=G4});var Ww=f(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.dashboardApi=void 0;var Cr=qe(),Za=ue(),z4="formid,name,description,formxml,type,objecttypecode,istabletenabled,iscustomizable,componentstate,versionnumber",W4="formid,name,type,objecttypecode",j4=0,H4=10;ul.dashboardApi={async get(e,t){let n=`/systemforms(${(0,Za.normalizeGuid)(t,"id")})${(0,Za.odataQuery)([["$select",z4]])}`,i=(0,Cr.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Cr.readEtag)(i)}},async list(e,t){var r;let n=[`(type eq ${j4} or type eq ${H4})`];t?.entityLogicalName&&n.push(`objecttypecode eq '${(0,Za.odataLiteral)(t.entityLogicalName)}'`);let i=`/systemforms${(0,Za.odataQuery)([["$select",W4],["$filter",n.join(" and ")]])}`,o=(0,Cr.ensureSuccess)(await e.get(i),e.apiUrl(i)).body;return((r=o?.value)!==null&&r!==void 0?r:[]).map(l=>{var u,c;return{type:"dashboard",id:(u=l.formid)!==null&&u!==void 0?u:"",name:(c=l.name)!==null&&c!==void 0?c:"",entityLogicalName:l.objecttypecode,isDirty:!1}})},async create(e,t){let r=t,n="/systemforms",i={name:r.name,description:r.description,formxml:r.formxml,istabletenabled:r.istabletenabled,type:r.type};r.objecttypecode&&(i.objecttypecode=r.objecttypecode);let a=(0,Cr.ensureSuccess)(await e.post(n,i),e.apiUrl(n));return{id:(0,Cr.requireCreatedId)(a,"formid","dashboard"),etag:(0,Cr.readEtag)(a)}},async update(e,t,r,n){let i=r,a=(0,Za.normalizeGuid)(t,"id"),o=`/systemforms(${a})`,s=n?{"If-Match":n}:void 0,l=(0,Cr.ensureSuccess)(await e.patch(o,{name:i.name,description:i.description,formxml:i.formxml,istabletenabled:i.istabletenabled},s?{headers:s}:void 0),e.apiUrl(o));return{id:a,etag:(0,Cr.readEtag)(l)}},delete(e,t){return(0,Cr.deleteRecord)(e,"systemforms",t)}}});var rS=f(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.dashboardRegistration=Kt.TILE_CLASS_ID=Kt.DashboardAdapter=void 0;var to=on(),St=Wa(),eo=Br(),J4=Ww(),wp=cn(),vn=zt(),Kw=ue(),dl=1033,jw="0",Sp="10",Q4=new Map([["{E7A81278-8635-4D9E-8D4D-59480B391C5B}","chart"],["{FD2A7985-3187-444E-908D-6624B21F69C0}","iframe"],["{9FDF5F91-88B1-47F4-AD53-C11EFC01A01D}","webresource"],["{EE9078C8-6946-4E2C-B8F8-35E65F4BE6A8}","stream"],["{06375649-C143-495E-A496-C962E5B4488E}","timeline"],["{8C54228C-1B25-4909-A12A-F2B968BB0D62}","powerbi"],["{F9A8A302-114E-466A-B582-6771B2AE0D92}","assistant"]]),X4="{3FF9A528-DD50-4ACA-8F10-2E5ED73513AD}",pl=class{toArtifact(t){var r,n,i,a;(0,wp.installDomShim)();let o=(r=t.formxml)!==null&&r!==void 0?r:"",s=(0,St.parseXmlRoot)(o,"<form/>");return{id:(n=t.formid)!==null&&n!==void 0?n:"",name:(i=t.name)!==null&&i!==void 0?i:"",description:(a=t.description)!==null&&a!==void 0?a:"",dashboardType:K4(t.type),entityLogicalName:t.objecttypecode?t.objecttypecode:null,enabledForMobile:!!t.istabletenabled,layoutType:Y4(s),components:Hw(s),bag:(0,St.projectElementBag)(s)}}fromArtifact(t){var r;return(0,wp.installDomShim)(),{formid:t.id,name:t.name,description:t.description,type:t.dashboardType==="Interactive"?Sp:jw,objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",istabletenabled:t.enabledForMobile,formxml:Jw(t)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){return{name:t.name,description:t.description,formxml:Jw(t),istabletenabled:t.enabledForMobile,type:t.dashboardType==="Interactive"?Sp:jw,objecttypecode:t.entityLogicalName}}createDefault(t){var r,n,i,a,o,s,l,u;(0,wp.installDomShim)();let c=(0,St.parseXmlRoot)(d$(),"<form/>");return{id:(r=t.id)!==null&&r!==void 0?r:(0,vn.newId)(),name:(n=t.name)!==null&&n!==void 0?n:"New Dashboard",description:(i=t.description)!==null&&i!==void 0?i:"",dashboardType:(a=t.dashboardType)!==null&&a!==void 0?a:"Standard",entityLogicalName:(o=t.entityLogicalName)!==null&&o!==void 0?o:null,enabledForMobile:(s=t.enabledForMobile)!==null&&s!==void 0?s:!1,layoutType:(l=t.layoutType)!==null&&l!==void 0?l:0,components:(u=t.components)!==null&&u!==void 0?u:Hw(c),bag:(0,St.projectElementBag)(c)}}assignMissingIds(t){if(t&&typeof t=="object"&&!Array.isArray(t)&&"position"in t&&!("components"in t)){let r=t;(typeof r.id!="string"||r.id.length===0)&&(r.id=(0,vn.newId)())}return t}validate(t){let r=[],n=(0,eo.childObjects)(t,"components","","component",r),i=new Set;return n.forEach(({node:a,index:o})=>{let s=`/components/${o}`;for(let l of["position","parameters"]){let u=a[l];u!==void 0&&!(0,eo.isJsonObject)(u)&&r.push((0,eo.issue)(`${s}/${l}`,`component-${l}-must-be-object`,`a component ${l} must be a JSON object when present, got ${u===null?"null":typeof u}`))}if((0,eo.isJsonObject)(a.position)){let l=ro(a.position);i.has(l)?r.push((0,eo.issue)(`${s}/position`,"component-position-collision",`two components occupy the same dashboard position (${l}); move one to a free cell`)):i.add(l)}}),r}};Kt.DashboardAdapter=pl;function K4(e){return String(e??"")===Sp?"Interactive":"Standard"}function Y4(e){var t;let r=(t=e?.getAttribute("formLayout"))!==null&&t!==void 0?t:e?.getAttribute("layoutType"),n=parseInt(r??"",10);return Number.isNaN(n)?0:n}function V(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName.toLowerCase()===t&&r.push(a)}return r}function Hw(e){let t=[];return V(e,"tabs").flatMap(n=>V(n,"tab")).forEach((n,i)=>{V(n,"columns").flatMap(o=>V(o,"column")).forEach((o,s)=>{V(o,"sections").flatMap(u=>V(u,"section")).forEach((u,c)=>{Z4(u,{tabIndex:i,columnIndex:s,sectionIndex:c},t)})})}),t}function Z4(e,t,r){V(e,"rows").flatMap(i=>V(i,"row")).forEach((i,a)=>{V(i,"cell").forEach((o,s)=>{let l=e$(o,{...t,rowIndex:a,cellIndex:s});l&&r.push(l)})})}function e$(e,t){var r,n,i;let a=eS((r=e.getAttribute("id"))!==null&&r!==void 0?r:"");if(a.toLowerCase().startsWith("spacer"))return null;let o=V(e,"control")[0];if(!o)return null;let s=(n=o.getAttribute("classid"))!==null&&n!==void 0?n:"",l=n$(o),u=i$(s,l,o),c=t$(o);return{id:(i=o.getAttribute("id"))!==null&&i!==void 0?i:a,type:u,name:Zw(e),classId:s,position:t,colspan:Dp(e,"colspan",1),rowspan:Dp(e,"rowspan",1),parameters:l,bag:(0,St.projectElementBag)(e),...c?{icProperties:c}:{}}}function Yw(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1&&n.tagName.toLowerCase()==="icproperties")return n}}function t$(e){let t=Yw(e);return t?(0,St.serializeNode)(t):void 0}function r$(e,t,r){let n=Yw(t);if(!r){n&&t.removeChild(n);return}let i=new DOMParser().parseFromString(r,"text/xml").documentElement,a=(0,to.rebuildRaw)((0,to.rawFromNode)((0,St.nodeLikeFromDom)(i)),(0,St.domEngine)(e),null);n&&(0,St.serializeNode)(n)===(0,St.serializeNode)(a)||(n?t.replaceChild(a,n):t.appendChild(a))}function Zw(e){var t,r;let n=V(e,"labels")[0];if(!n)return"";let i=V(n,"label"),a=(t=i.find(o=>o.getAttribute("languagecode")===String(dl)))!==null&&t!==void 0?t:i[0];return(r=a?.getAttribute("description"))!==null&&r!==void 0?r:""}function n$(e){var t;let r={},n=V(e,"parameters")[0];if(!n)return r;let i=n.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];o.nodeType===1&&(r[o.tagName]=((t=o.textContent)!==null&&t!==void 0?t:"").trim())}return r}function i$(e,t,r){var n;let i=Q4.get(e.toUpperCase());return i?i==="chart"?t.ChartGridMode==="Chart"?"chart":"list":i==="assistant"&&((n=r.getAttribute("uniqueid"))!==null&&n!==void 0?n:"").toUpperCase()===X4?"assistant":i:"unknown"}function Dp(e,t,r){var n;let i=parseInt((n=e.getAttribute(t))!==null&&n!==void 0?n:"",10);return Number.isNaN(i)?r:i}function eS(e){return e.replace(/^\{/,"").replace(/\}$/,"")}function a$(e,t){let r={n:"form",a:(0,to.mergeAttrs)(e.bag.a,[]),c:(0,to.spliceChildren)(e.bag.c,[])};return(0,to.rebuildRaw)(r,(0,St.domEngine)(t),null)}function Jw(e){let t=new DOMParser().parseFromString("<root/>","text/xml"),r=a$(e,t);return l$(t,r,e.components),o$(t,r,e.components),(0,St.serializeNode)(r)}function o$(e,t,r){let n=tS(t);for(let i of r)n.has(ro(i.position))||s$(e,t,i)}function s$(e,t,r){var n,i,a,o;let s=(i=(n=r.position)===null||n===void 0?void 0:n.sectionIndex)!==null&&i!==void 0?i:0,l=p$(t,e,s);for(let $ of V(l,"row"))V($,"cell").some(re=>V(re,"control").length>0)||l.removeChild($);let u=r.classId||Kt.TILE_CLASS_ID[r.type]||Kt.TILE_CLASS_ID.iframe,c=r.rowspan&&r.rowspan>0?r.rowspan:4,p=r.bag&&Qw(r.bag,"id")?String(Qw(r.bag,"id")):cl((0,vn.newId)()),m=r.id?cl(r.id):cl((0,vn.newId)()),v=l.parentNode,C=Math.max(1,parseInt(v&&v.getAttribute&&v.getAttribute("columns")||"1",10)||1),w=Math.min(Math.max(1,r.colspan&&r.colspan>0?r.colspan:1),C),P=V(l,"row"),x=P[P.length-1],M=x?V(x,"cell").reduce(($,re)=>$+Dp(re,"colspan",1),0):0;(!x||M+w>C)&&(x=e.createElement("row"),l.appendChild(x));let T=e.createElement("cell");T.setAttribute("id",p),T.setAttribute("colspan",String(w)),T.setAttribute("rowspan",String(c)),T.setAttribute("showlabel","true");let L=e.createElement("labels"),Q=e.createElement("label");Q.setAttribute("description",(a=r.name)!==null&&a!==void 0?a:""),Q.setAttribute("languagecode",String(dl)),L.appendChild(Q),T.appendChild(L);let B=e.createElement("control");B.setAttribute("id",m),B.setAttribute("classid",cl(u));let W=e.createElement("parameters"),k=(o=r.parameters)!==null&&o!==void 0?o:{};for(let $ of Object.keys(k)){let re=(0,Kw.createSafeXmlElement)(e,$,"dashboard tile parameter");re.textContent=k[$],W.appendChild(re)}B.appendChild(W),T.appendChild(B),x.appendChild(T)}function Qw(e,t){if(!e)return;let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function l$(e,t,r){var n;let i=tS(t),a=new Set(r.map(o=>ro(o.position)));for(let o of r){let s=i.get(ro(o.position));if(!s)continue;let l=V(s,"control")[0];l&&(u$(e,s,o.name),c$(e,l,o.parameters),Xw(s,"colspan",o.colspan),Xw(s,"rowspan",o.rowspan),o.icProperties!==void 0&&r$(e,l,o.icProperties))}for(let[o,s]of i)a.has(o)||(n=s.parentNode)===null||n===void 0||n.removeChild(s)}function tS(e){let t=new Map;return V(e,"tabs").flatMap(n=>V(n,"tab")).forEach((n,i)=>{V(n,"columns").flatMap(o=>V(o,"column")).forEach((o,s)=>{V(o,"sections").flatMap(u=>V(u,"section")).forEach((u,c)=>{V(u,"rows").flatMap(m=>V(m,"row")).forEach((m,v)=>{V(m,"cell").forEach((C,w)=>{var P;eS((P=C.getAttribute("id"))!==null&&P!==void 0?P:"").toLowerCase().startsWith("spacer")||V(C,"control")[0]&&t.set(ro({tabIndex:i,columnIndex:s,sectionIndex:c,rowIndex:v,cellIndex:w}),C)})})})})}),t}function ro(e){let t=e??{};return`${t.tabIndex}.${t.columnIndex}.${t.sectionIndex}.${t.rowIndex}.${t.cellIndex}`}function u$(e,t,r){if(r===Zw(t))return;let n=V(t,"labels")[0];n||(n=e.createElement("labels"),t.appendChild(n));let i=V(n,"label").find(a=>a.getAttribute("languagecode")===String(dl));i||(i=V(n,"label")[0]),i||(i=e.createElement("label"),i.setAttribute("languagecode",String(dl)),n.appendChild(i)),i.setAttribute("description",r)}function c$(e,t,r){var n;if(!r)return;let i=Object.keys(r);if(i.length===0)return;let a=V(t,"parameters")[0];a||(a=e.createElement("parameters"),t.appendChild(a));let o=new Map,s=a.childNodes;for(let l=0;l<s.length;l+=1){let u=s[l];u.nodeType===1&&o.set(u.tagName,u)}for(let l of i){let u=r[l],c=o.get(l);if(c)((n=c.textContent)!==null&&n!==void 0?n:"")!==u&&(c.textContent=u);else{let p=(0,Kw.createSafeXmlElement)(e,l,"dashboard component parameter");p.textContent=u,a.appendChild(p)}}}function Xw(e,t,r){var n;((n=e.getAttribute(t))!==null&&n!==void 0?n:"")!==String(r)&&e.setAttribute(t,String(r))}function d$(e=2){let t=`{${(0,vn.newId)()}}`,r=`{${(0,vn.newId)()}}`,n=`{${(0,vn.newId)()}}`,i=Math.max(1,Math.floor(e));return`<form><tabs><tab id="${t}" name="General" showlabel="true" expanded="true" verticallayout="true"><columns><column width="100%"><sections><section id="${r}" name="Section 1" showlabel="false" columns="${i}"><rows><row><cell id="${n}" rowspan="12" colspan="${i}" showlabel="true" /></row></rows></section></sections></column></columns></tab></tabs></form>`}Kt.TILE_CLASS_ID={chart:"E7A81278-8635-4D9E-8D4D-59480B391C5B",list:"E7A81278-8635-4D9E-8D4D-59480B391C5B",iframe:"FD2A7985-3187-444E-908D-6624B21F69C0",webresource:"9FDF5F91-88B1-47F4-AD53-C11EFC01A01D"};function cl(e){return`{${e.replace(/[{}]/g,"")}}`}function p$(e,t,r){var n;let i=V(e,"tabs").flatMap(u=>V(u,"tab"))[0];if(!i)throw new Error("addDashboardTile: dashboard formxml has no <tab>");let a=V(i,"columns").flatMap(u=>V(u,"column"))[0];if(!a)throw new Error("addDashboardTile: dashboard formxml has no <column>");let o=V(a,"sections").flatMap(u=>V(u,"section")),s=(n=o[r])!==null&&n!==void 0?n:o[0];if(!s)throw new Error("addDashboardTile: dashboard formxml has no <section>");let l=V(s,"rows")[0];return l||(l=t.createElement("rows"),s.appendChild(l)),l}function f$(){return{adapter:new pl,api:J4.dashboardApi}}Kt.dashboardRegistration=f$});var nS=f(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.buildRegistrations=void 0;var m$=Y2(),h$=hN(),g$=iw(),v$=dw(),b$=_w(),y$=zw(),C$=rS();function A$(){let e=new Map;return e.set("form",(0,m$.formRegistration)()),e.set("view",(0,h$.viewRegistration)()),e.set("businessRule",(0,g$.businessRuleRegistration)()),e.set("app",(0,v$.appRegistration)()),e.set("command",(0,b$.commandRegistration)()),e.set("chart",(0,y$.chartRegistration)()),e.set("dashboard",(0,C$.dashboardRegistration)()),e}fl.buildRegistrations=A$});var iS=f(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});ml.cloneJson=void 0;function N$(e){return JSON.parse(JSON.stringify(e))}ml.cloneJson=N$});var cS=f(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.removeRowSummary=Ie.configureRowSummary=Ie.buildGptDynamicPrompt=Ie.setAppAiFeatures=Ie.getAiReadiness=Ie.saveSettingValue=Ie.retrieveSetting=Ie.AI_GATE=void 0;var Rt=qe(),Ar=ue(),aS=zt();Ie.AI_GATE={formFill:"FormFillBarUXEnabled",nlSearch:"EnableNLGridSearch",nlChart:"NLChartVisualizationSetting",summaries:"EnableFormInsights",m365:"m365copilotmodelappenabled"};var w$={formFill:"FormFillBarUXEnabled",nlSearch:null,nlChart:"NLChartDataVisualizationSetting",m365:"m365copilotmodelappenabled"},S$="1";function D$(e,t){return t===2?String(e).toLowerCase()==="true":e!=null&&e!=="0"&&e!==""}async function oS(e,t,r={}){var n,i;let a=[`SettingName='${(0,Ar.odataPathLiteral)(t)}'`];r.appUniqueName&&a.push(`AppUniqueName='${(0,Ar.odataPathLiteral)(r.appUniqueName)}'`);let o=`/RetrieveSetting(${a.join(",")})`,l=(i=(n=(0,Rt.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.SettingDetail)!==null&&i!==void 0?i:{};return{value:l.Value,dataType:l.DataType}}Ie.retrieveSetting=oS;async function sS(e,t,r,n={}){let i={SettingName:t,Value:r};n.appUniqueName&&(i.AppUniqueName=n.appUniqueName),n.solutionUniqueName&&(i.SolutionUniqueName=n.solutionUniqueName),(0,Rt.ensureSuccess)(await e.post("/SaveSettingValue",i),e.apiUrl("/SaveSettingValue"))}Ie.saveSettingValue=sS;async function lS(e,t={}){let r={};for(let[n,i]of Object.entries(Ie.AI_GATE)){let{value:a,dataType:o}=await oS(e,i,t);r[n]={enabled:D$(a,o),setting:i,value:a}}return r}Ie.getAiReadiness=lS;async function E$(e,t,r,n={}){var i;let a=await lS(e,{appUniqueName:t}),o=[],s=[];for(let[l,u]of Object.entries(r)){if(!u)continue;if(!(!((i=a[l])===null||i===void 0)&&i.enabled)){s.push(l);continue}let c=w$[l];c&&await sS(e,c,S$,{appUniqueName:t,solutionUniqueName:n.solutionUniqueName}),o.push(l)}return{applied:o,skipped:s}}Ie.setAppAiFeatures=E$;var I$="GptPowerPrompt",_$='{ "consumptionSource": "Api", "partnerSource": "AIBuilder", "consumptionSourceVersion": "GptApiClient"}';function uS(e){var t,r,n,i;let a=e.entityLogicalName,o=[{type:"literal",text:e.instruction.replace(/\s*$/,"")+" "}];return e.columns.forEach((s,l)=>{o.push({type:"data",id:`${a}.${s.logical}`,text:s.display}),l<e.columns.length-1&&o.push({type:"literal",text:", "})}),{version:"GptDynamicPrompt-2",prompt:o,definitions:{inputs:[{id:"RecordId",text:"RecordId",type:"text"},{id:"LanguageCode",text:"LanguageCode",type:"text"}],formulas:[],data:[{id:a,displayName:a,type:"dataverseTable",filters:[{filterType:"equal",attribute:e.primaryKey,valueType:"inputVariable",value:"RecordId"}]}],output:{formats:[(t=e.outputFormat)!==null&&t!==void 0?t:"text"]}},modelParameters:{modelType:"default",gptParameters:{temperature:(r=e.temperature)!==null&&r!==void 0?r:0}},settings:{recordRetrievalLimit:(n=e.recordRetrievalLimit)!==null&&n!==void 0?n:30,shouldPreserveRecordLinks:null,runtime:null,enableReasoning:(i=e.enableReasoning)!==null&&i!==void 0?i:!0},code:"",signature:""}}Ie.buildGptDynamicPrompt=uS;async function P$(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,Ar.odataPathLiteral)(t)}')${(0,Ar.odataQuery)([["$select","MetadataId"]])}`;return(n=(r=(0,Rt.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.MetadataId)!==null&&n!==void 0?n:""}async function O$(e,t,r={}){var n,i,a,o,s;let l=`ais_RowSummary_${t.entityLogicalName}`,u=`/aiskillconfigs${(0,Ar.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,Ar.odataLiteral)(l)}'`],["$top",1]])}`,c=((i=(n=(0,Rt.ensureSuccess)(await e.get(u),e.apiUrl(u)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[])[0];if(c)return{modelId:c._aimodel_value,aiSkillConfigId:c.aiskillconfigid};let p=`/msdyn_aitemplates${(0,Ar.odataQuery)([["$select","msdyn_aitemplateid"],["$filter",`msdyn_uniquename eq '${I$}'`],["$top",1]])}`,m=((s=(o=(a=(0,Rt.ensureSuccess)(await e.get(p),e.apiUrl(p)).body)===null||a===void 0?void 0:a.value)===null||o===void 0?void 0:o[0])!==null&&s!==void 0?s:{}).msdyn_aitemplateid,v=(0,aS.newId)(),C=(0,aS.newId)(),w=JSON.stringify(uS(t)),P={ModelId:v,RunConfigurationId:C,ModelName:`${t.entityLogicalName} row summary`,TemplateId:m,CustomConfiguration:w,Source:_$,RunConfiguration:""};(0,Rt.ensureSuccess)(await e.post("/AIModelPublish",P),e.apiUrl("/AIModelPublish"));try{let x=await P$(e,t.entityLogicalName),M={uniquename:l,description:`${t.entityLogicalName} row summary`,"[email protected]":`/entities(${x})`,"[email protected]":`/msdyn_aimodels(${v})`,aiskill:"RowSummary"},T=(0,Rt.ensureSuccess)(await e.post("/aiskillconfigs",M),e.apiUrl("/aiskillconfigs")),L=(0,Rt.requireCreatedId)(T,"aiskillconfigid","row-summary skill");return{modelId:v,aiSkillConfigId:L}}catch(x){try{await e.delete(`/msdyn_aimodels(${v})`)}catch{}throw x}}Ie.configureRowSummary=O$;async function F$(e,t){var r,n;let i=`ais_RowSummary_${t.entityLogicalName}`,a=`/aiskillconfigs${(0,Ar.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,Ar.odataLiteral)(i)}'`],["$top",1]])}`,o=((n=(r=(0,Rt.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!o)return;let s=`/aiskillconfigs(${o.aiskillconfigid})`;if((0,Rt.ensureSuccess)(await e.delete(s),e.apiUrl(s)),o._aimodel_value){let l=`/msdyn_aimodels(${o._aimodel_value})`;(0,Rt.ensureSuccess)(await e.delete(l),e.apiUrl(l))}}Ie.removeRowSummary=F$});var dS=f(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.findArtifact=Ni.resolveArtifact=void 0;var Ke=ue(),Yt=Li(),R$=_e();async function T$(e,t,r){var n,i,a,o,s,l,u,c,p,m,v;switch(t){case"app":{let C=await(0,Yt.queryRecords)(e,"appmodule",{select:["appmoduleid","name","appmoduleidunique"],filter:`uniquename eq '${(0,Ke.odataLiteral)((n=r.uniqueName)!==null&&n!==void 0?n:"")}'`,top:1}),w=C&&C[0];return w?[{id:String(w.appmoduleid),name:String(w.name),appModuleIdUnique:String(w.appmoduleidunique)}]:[]}case"dashboard":return(await(0,Yt.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,Ke.odataLiteral)((i=r.name)!==null&&i!==void 0?i:"")}' and type eq 0`,top:10})||[]).map(w=>({id:String(w.formid),name:String(w.name)}));case"command":{let C=await(0,Yt.queryRecords)(e,"appaction",{select:["appactionid","buttonlabeltext"],filter:`contextvalue eq '${(0,Ke.odataLiteral)((a=r.entity)!==null&&a!==void 0?a:"")}'`,top:1});return C&&C.length?[{id:String(r.entity),entity:String(r.entity)}]:[]}case"form":return(await(0,Yt.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,Ke.odataLiteral)((o=r.name)!==null&&o!==void 0?o:"")}' and objecttypecode eq '${(0,Ke.odataLiteral)((s=r.entity)!==null&&s!==void 0?s:"")}'`,top:10})||[]).map(w=>({id:String(w.formid),name:String(w.name)}));case"chart":return(await(0,Yt.queryRecords)(e,"savedqueryvisualization",{select:["savedqueryvisualizationid","name"],filter:`name eq '${(0,Ke.odataLiteral)((l=r.name)!==null&&l!==void 0?l:"")}' and primaryentitytypecode eq '${(0,Ke.odataLiteral)((u=r.entity)!==null&&u!==void 0?u:"")}'`,top:10})||[]).map(w=>({id:String(w.savedqueryvisualizationid),name:String(w.name)}));case"view":return(await(0,Yt.queryRecords)(e,"savedquery",{select:["savedqueryid","name"],filter:`name eq '${(0,Ke.odataLiteral)((c=r.name)!==null&&c!==void 0?c:"")}' and returnedtypecode eq '${(0,Ke.odataLiteral)((p=r.entity)!==null&&p!==void 0?p:"")}'`,top:10})||[]).map(w=>({id:String(w.savedqueryid),name:String(w.name)}));case"webResource":return(await(0,Yt.queryRecords)(e,"webresource",{select:["webresourceid","name"],filter:`name eq '${(0,Ke.odataLiteral)((m=r.name)!==null&&m!==void 0?m:"")}'`,top:1})||[]).map(w=>({id:String(w.webresourceid),name:String(w.name)}));case"solution":return(await(0,Yt.queryRecords)(e,"solution",{select:["solutionid","uniquename"],filter:`uniquename eq '${(0,Ke.odataLiteral)((v=r.uniqueName)!==null&&v!==void 0?v:"")}'`,top:1})||[]).map(w=>({id:String(w.solutionid),name:String(w.uniquename)}));default:return[]}}Ni.resolveArtifact=T$;async function x$(e,t,r){var n,i,a,o,s;let l=(0,Ke.odataLiteral)((n=r.name)!==null&&n!==void 0?n:""),u=(0,Ke.odataLiteral)((i=r.entity)!==null&&i!==void 0?i:"");if(t==="command"){let C=await(0,Yt.queryRecords)(e,"appaction",{select:["appactionid"],filter:`contextvalue eq '${(0,Ke.odataLiteral)((a=r.entity)!==null&&a!==void 0?a:"")}'`,top:1});return C&&C.length?String(r.entity):null}let c=L$(t,l,u,r),p=t!=="app",m=await(0,Yt.queryRecords)(e,c.set,{select:[c.idField],filter:c.filter,top:p?2:1});if(p&&m&&m.length>1)throw new R$.AmbiguousArtifactError(t,(s=(o=r.name)!==null&&o!==void 0?o:r.uniqueName)!==null&&s!==void 0?s:"",m.length);let v=m&&m[0]&&m[0][c.idField];return v!=null?String(v):null}Ni.findArtifact=x$;function L$(e,t,r,n){var i;switch(e){case"view":return{set:"savedquery",idField:"savedqueryid",filter:`returnedtypecode eq '${r}' and name eq '${t}'`};case"chart":return{set:"savedqueryvisualization",idField:"savedqueryvisualizationid",filter:`primaryentitytypecode eq '${r}' and name eq '${t}'`};case"form":return{set:"systemform",idField:"formid",filter:`objecttypecode eq '${r}' and name eq '${t}'`};case"app":return{set:"appmodule",idField:"appmoduleid",filter:`uniquename eq '${(0,Ke.odataLiteral)((i=n.uniqueName)!==null&&i!==void 0?i:"")}'`};case"dashboard":return{set:"systemform",idField:"formid",filter:`name eq '${t}' and type eq 0`};default:throw new Error(`Unsupported findable kind: ${e}`)}}});var fS=f(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.seedRecordGraph=void 0;var pS=Li(),U$=bo(),hl=ue(),M$=_e();async function B$(e,t,r={}){var n,i,a,o,s;let l=(n=r.createdIds)!==null&&n!==void 0?n:{},u=(i=r.entitySetFor)!==null&&i!==void 0?i:m=>(0,U$.resolveEntitySetName)(e,m),c={},p=m=>{var v;return(v=c[m])!==null&&v!==void 0?v:l[m]};for(let m of t){let v=m.entityLogical.toLowerCase(),C=(a=m.matchOn)===null||a===void 0?void 0:a.toLowerCase(),w=[];for(let B of m.records){let W={...B.body};for(let k of(o=B.binds)!==null&&o!==void 0?o:[]){let $=k.parentEntity.toLowerCase(),re=(s=p($))===null||s===void 0?void 0:s[k.parentIndex];if(!re)throw new M$.InvalidArgumentError(`Cannot resolve bind '${k.navProperty}' on a '${v}' record: parent '${k.parentEntity}'[${k.parentIndex}] has no created id. Seed the parent group before the child, or supply it via options.createdIds.`);let j=(0,hl.assertODataName)(await u($),`entity set for parent '${k.parentEntity}'`),er=(0,hl.normalizeGuid)(re,`parent id for bind '${k.navProperty}'`);W[`${k.navProperty}@odata.bind`]=`/${j}(${er})`}w.push(W)}let P=C?w.map(B=>{let W=B[C];return W!=null&&W!==""?String(W):null}):w.map(()=>null),x=new Map;if(C){let B=(0,hl.assertODataName)(C,"RecordGraph matchOn key"),W=[...new Set(P.filter(k=>k!==null))];if(W.length){let k=W.map(re=>`${B} eq '${(0,hl.odataLiteral)(re)}'`).join(" or "),$=await(0,pS.queryRecords)(e,v,{select:[B,`${v}id`],filter:k,top:5e3});for(let re of $??[]){let j=re[B];j!=null&&x.set(String(j).toLowerCase(),String(re[`${v}id`]))}}}let M=[],T=new Map,L=w.map((B,W)=>{let k=P[W];if(k&&x.has(k.toLowerCase()))return null;if(k){let $=k.toLowerCase(),re=T.get($);if(re!==void 0)return re;let j=M.push(B)-1;return T.set($,j),j}return M.push(B)-1}),Q=M.length?await(0,pS.createRecordsBulk)(e,v,M):[];c[v]=w.map((B,W)=>{let k=P[W];return k&&x.has(k.toLowerCase())?x.get(k.toLowerCase()):Q[L[W]]})}return{createdIds:c}}gl.seedRecordGraph=B$});var NS=f(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.deleteSecurityRole=Dt.createPersonaRole=Dt.createSecurityRole=Dt.SDK_ROLE_MARKER=void 0;var Zt=qe(),Be=ue(),Tt=_e(),mS={read:"Read",create:"Create",write:"Write",delete:"Delete",append:"Append",appendTo:"AppendTo",assign:"Assign",share:"Share"},CS={user:"Basic",businessUnit:"Local",parentChild:"Deep",organization:"Global"},hS={user:1,businessUnit:2,parentChild:3,organization:4},k$={user:"CanBeBasic",businessUnit:"CanBeLocal",parentChild:"CanBeDeep",organization:"CanBeGlobal"};Dt.SDK_ROLE_MARKER="Authored by @maker-studio/cds-maker-sdk (persona/security role).";function q$(e){return Object.prototype.hasOwnProperty.call(mS,e)?mS[e]:void 0}function $$(e){return Object.prototype.hasOwnProperty.call(CS,e)}var gS=new WeakMap,vS=new WeakMap;async function V$(e,t){var r,n;(0,Be.assertODataName)(t,"entity logical name");let i=gS.get(e);i||(i=new Map,gS.set(e,i));let a=i.get(t);if(a)return a;let o=`/EntityDefinitions(LogicalName='${(0,Be.odataPathLiteral)(t)}')${(0,Be.odataQuery)([["$select","LogicalName,Privileges"]])}`,l=(n=(r=(0,Zt.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||r===void 0?void 0:r.Privileges)!==null&&n!==void 0?n:[];if(l.length===0)throw new Tt.InvalidArgumentError(`Entity '${t}' exposes no privileges (unknown or non-securable entity).`);return i.set(t,l),l}async function G$(e){var t,r,n;let i=vS.get(e);if(i)return i;let a=`/businessunits${(0,Be.odataQuery)([["$select","businessunitid"],["$filter","_parentbusinessunitid_value eq null"],["$top",1]])}`,l=(n=((r=(t=(0,Zt.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||t===void 0?void 0:t.value)!==null&&r!==void 0?r:[])[0])===null||n===void 0?void 0:n.businessunitid;if(!l)throw new Tt.InvalidArgumentError("Could not resolve the root business unit.");let u=(0,Be.normalizeGuid)(l,"businessUnitId");return vS.set(e,u),u}async function z$(e,t){var r;let n=new Map;for(let i of t){if(!i.access||i.access.length===0)throw new Tt.InvalidArgumentError(`Entity '${i.entity}' privilege request has no access levels.`);let a=(r=i.scope)!==null&&r!==void 0?r:"user";if(!$$(a))throw new Tt.InvalidArgumentError(`Unknown privilege scope '${a}' for entity '${i.entity}'.`);let o=await V$(e,i.entity);for(let s of i.access){let l=q$(s);if(!l)throw new Tt.InvalidArgumentError(`Unknown access level '${s}' for entity '${i.entity}'.`);let u=o.find(C=>C.PrivilegeType===l);if(!u)throw new Tt.InvalidArgumentError(`Entity '${i.entity}' does not support '${s}' access.`);let c=k$[a];if(u[c]===!1)throw new Tt.InvalidArgumentError(`Privilege '${u.Name}' on '${i.entity}' does not support the '${a}' scope.`);let p=(0,Be.normalizeGuid)(u.PrivilegeId,"PrivilegeId"),m=n.get(p);if(!m){n.set(p,{privilegeName:u.Name,privilegeType:l,scope:a,entities:new Set([i.entity])});continue}if(m.scope===a){m.entities.add(i.entity);continue}if(!(m.entities.size===1&&m.entities.has(i.entity))){let C=[...m.entities].sort().join(", ");throw new Tt.InvalidArgumentError(`Entities '${C}' and '${i.entity}' share the Dataverse privilege '${u.Name}' but request different scopes; a role holds one depth per privilege. Use the same scope for all entities that share this privilege, or split them.`)}m.scope=hS[a]>hS[m.scope]?a:m.scope}}return[...n.entries()].map(([i,a])=>({entity:[...a.entities].sort().join(", "),privilegeId:i,privilegeName:a.privilegeName,privilegeType:a.privilegeType,scope:a.scope}))}async function W$(e,t,r){if(r.length===0)return;let n={Privileges:r.map(a=>({Depth:CS[a.scope],PrivilegeId:a.privilegeId}))},i=`/roles(${t})/Microsoft.Dynamics.CRM.ReplacePrivilegesRole`;(0,Zt.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function bS(e,t,r,n,i){var a,o;let s=`/${t}(${r})/${n}${(0,Be.odataQuery)([["$select","roleid"],["$filter",`roleid eq ${i}`]])}`;return((o=(a=(0,Zt.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||a===void 0?void 0:a.value)!==null&&o!==void 0?o:[]).length>0}async function j$(e,t,r){var n,i;let a=[],o=[],s={"@odata.id":e.apiUrl(`/roles(${t})`)};for(let l of(n=r?.teams)!==null&&n!==void 0?n:[]){let u=(0,Be.normalizeGuid)(l,"teamId");if(!await bS(e,"teams",u,"teamroles_association",t)){let c=`/teams(${u})/teamroles_association/$ref`;(0,Zt.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}a.push(u)}for(let l of(i=r?.users)!==null&&i!==void 0?i:[]){let u=(0,Be.normalizeGuid)(l,"userId");if(!await bS(e,"systemusers",u,"systemuserroles_association",t)){let c=`/systemusers(${u})/systemuserroles_association/$ref`;(0,Zt.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}o.push(u)}return{teams:a,users:o}}async function yS(e,t,r){var n,i,a;let o=`/roles${(0,Be.odataQuery)([["$select","roleid,description,ismanaged"],["$filter",`name eq '${(0,Be.odataLiteral)(t)}' and _businessunitid_value eq ${r}`],["$top",1]])}`,u=((i=(n=(0,Zt.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[])[0];if(u?.roleid){if(u.ismanaged===!0||((a=u.description)!==null&&a!==void 0?a:"")!==Dt.SDK_ROLE_MARKER)throw new Tt.InvalidArgumentError(`A role named '${t}' already exists in this business unit and was not created by the SDK; refusing to modify or assign it. Choose a different persona/role name.`);return(0,Be.normalizeGuid)(u.roleid,"roleId")}}function H$(e){var t,r;return{teams:((t=e?.teams)!==null&&t!==void 0?t:[]).map(n=>(0,Be.normalizeGuid)(n,"teamId")),users:((r=e?.users)!==null&&r!==void 0?r:[]).map(n=>(0,Be.normalizeGuid)(n,"userId"))}}function J$(e){return e.map(t=>({entity:t.entity,privilegeName:t.privilegeName,privilegeType:t.privilegeType,scope:t.scope}))}async function AS(e,t){var r,n;let i=(r=t.name)===null||r===void 0?void 0:r.trim();if(!i)throw new Tt.InvalidArgumentError("createSecurityRole: a non-empty role name is required.");let a=t.businessUnitId?(0,Be.normalizeGuid)(t.businessUnitId,"businessUnitId"):await G$(e),o=await z$(e,(n=t.privileges)!==null&&n!==void 0?n:[]),s=H$(t.assignTo),l=await yS(e,i,a),u=l!==void 0;if(!l){let p="/roles",m={name:i,description:Dt.SDK_ROLE_MARKER,"[email protected]":`/businessunits(${a})`};try{let v=(0,Zt.ensureSuccess)(await e.post(p,m),e.apiUrl(p));l=(0,Be.normalizeGuid)((0,Zt.requireCreatedId)(v,"roleid","role"),"roleId")}catch(v){let C;try{C=await yS(e,i,a)}catch{C=void 0}if(!C)throw v;l=C}}await W$(e,l,o);let c=await j$(e,l,s);return{roleId:l,name:i,reused:u,appliedPrivileges:J$(o),assignedTeams:c.teams,assignedUsers:c.users}}Dt.createSecurityRole=AS;async function Q$(e,t){var r,n;let i=(r=t.persona)===null||r===void 0?void 0:r.trim();if(!i)throw new Tt.InvalidArgumentError("createPersonaRole: a non-empty persona name is required.");let a=[...t.jobs.flatMap(o=>{var s;return(s=o.privileges)!==null&&s!==void 0?s:[]}),...(n=t.additionalPrivileges)!==null&&n!==void 0?n:[]];return AS(e,{name:i,businessUnitId:t.businessUnitId,privileges:a,assignTo:t.assignTo})}Dt.createPersonaRole=Q$;async function X$(e,t){let n=`/roles(${(0,Be.normalizeGuid)(t,"roleId")})`;(0,Zt.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Dt.deleteSecurityRole=X$});var DS=f(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.createMakerSdk=Di.MakerSdk=void 0;var ke=_e(),Nr=so(),K$=Op(),Y$=Tp(),Z$=qp(),e5=of(),Ep=df(),Ye=bo(),wr=Li(),vl=bf(),ut=yf(),t5=Sf(),r5=nS(),n5=cn(),i5=zt(),bn=iS(),Gr=qe(),wi=ue(),Si=cS(),wS=dS(),a5=fS(),o5=Ld(),Ip=NS(),bl=class{constructor(t){(0,n5.installDomShim)(),this.workspace=new Y$.WorkspaceManager(t.workspacePath,t.instanceUrl),this.versions=new Z$.VersionManager(this.workspace),this.dataverse=new e5.DataverseClient(t.instanceUrl,t.httpClient,t.solutionUniqueName),this.registrations=(0,r5.buildRegistrations)()}initWorkspace(){this.workspace.init()}getManifest(){return this.workspace.getManifest()}cleanWorkspace(){this.workspace.clean()}async fetchArtifact(t,r){let n=this.requireRegistration(t,"fetchArtifact"),{raw:i,etag:a}=await n.api.get(this.dataverse,r),o=n.adapter.fromApiResponse(i);return this.workspace.writeArtifact(t,r,o),this.versions.storeMeta(t,r,{etag:a,fetchedAt:(0,Gr.nowIso)(),snapshot:(0,bn.cloneJson)(o)}),(0,bn.cloneJson)(o)}async fetchArtifactList(t,r){return this.requireRegistration(t,"fetchArtifactList").api.list(this.dataverse,r)}async fetchSolution(t){var r;let n=await(0,ut.fetchSolutionComponents)(this.dataverse,t),i=[],a=[];for(let o of n)try{let s=await this.resolveComponentType(o);if(!s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"unsupported"});continue}let l=await this.fetchArtifact(s,o.objectId);i.push({type:s,id:o.objectId,name:typeof l.name=="string"?l.name:(r=o.displayName)!==null&&r!==void 0?r:o.objectId,entityLogicalName:typeof l.entityLogicalName=="string"?l.entityLogicalName:void 0,lastFetched:(0,Gr.nowIso)(),isDirty:!1})}catch(s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"failed",error:SS(s)})}return this.workspace.updateManifest({lastSyncAt:(0,Gr.nowIso)()}),{summaries:i,skipped:a}}async fetchEntityMetadata(t){let r=await(0,Ep.fetchEntityMetadataFromApi)(this.dataverse,t);return this.workspace.writeEntityMetadata(t,r),r}findTables(t,r){return(0,Ep.findTables)(this.dataverse,t,r)}findColumns(t,r,n){return(0,Ep.findColumns)(this.dataverse,t,r,n)}createTable(t){return(0,Ye.createTable)(this.dataverse,t)}createColumn(t,r){return(0,Ye.createColumn)(this.dataverse,t,r)}updateColumn(t,r,n){return(0,Ye.updateColumn)(this.dataverse,t,r,n)}deleteColumn(t,r){return(0,Ye.deleteColumn)(this.dataverse,t,r)}createCustomerColumn(t,r){return(0,Ye.createCustomerColumn)(this.dataverse,t,r)}insertStatusValue(t,r){return(0,Ye.insertStatusValue)(this.dataverse,t,r)}updateTable(t,r){return(0,Ye.updateTable)(this.dataverse,t,r)}async setEntityIcon(t,r){if(await(0,Ye.updateTable)(this.dataverse,t,{iconVectorName:r.vector,iconSmallName:r.small,iconMediumName:r.medium,iconLargeName:r.large}),r.publish!==!1){let n=`<importexportxml><entities><entity>${(0,wi.xmlText)(t)}</entity></entities></importexportxml>`;(0,Gr.ensureSuccess)(await this.dataverse.post("/PublishXml",{ParameterXml:n}),this.dataverse.apiUrl("/PublishXml"))}}createAlternateKey(t,r){return(0,Ye.createAlternateKey)(this.dataverse,t,r)}deleteAlternateKey(t,r){return(0,Ye.deleteAlternateKey)(this.dataverse,t,r)}createRelationship(t){return(0,Ye.createRelationship)(this.dataverse,t)}deleteRelationship(t){return(0,Ye.deleteRelationship)(this.dataverse,t)}createGlobalOptionSet(t){return(0,Ye.createGlobalOptionSet)(this.dataverse,t)}deleteGlobalOptionSet(t){return(0,Ye.deleteGlobalOptionSet)(this.dataverse,t)}deleteTable(t){return(0,Ye.deleteTable)(this.dataverse,t)}createSecurityRole(t){return(0,Ip.createSecurityRole)(this.dataverse,t)}createPersonaRole(t){return(0,Ip.createPersonaRole)(this.dataverse,t)}deleteSecurityRole(t){return(0,Ip.deleteSecurityRole)(this.dataverse,t)}createRecord(t,r){return(0,wr.createRecord)(this.dataverse,t,r)}createRecordsBulk(t,r){return(0,wr.createRecordsBulk)(this.dataverse,t,r)}updateRecord(t,r,n){return(0,wr.updateRecord)(this.dataverse,t,r,n)}upsertRecord(t,r,n){return(0,wr.upsertRecord)(this.dataverse,t,r,n)}deleteRecord(t,r){return(0,wr.deleteRecord)(this.dataverse,t,r)}getRecord(t,r,n){return(0,wr.getRecord)(this.dataverse,t,r,n)}queryRecords(t,r){return(0,wr.queryRecords)(this.dataverse,t,r)}seedRecordGraph(t,r){return(0,a5.seedRecordGraph)(this.dataverse,t,r)}resolveArtifact(t,r){return(0,wS.resolveArtifact)(this.dataverse,t,r)}findArtifact(t,r){return(0,wS.findArtifact)(this.dataverse,t,r)}async deleteAppCascade(t,r){let n=await(0,t5.deleteAppCascade)(this.dataverse,t,r),i=(0,wi.normalizeGuid)(t,"appModuleId");return this.workspace.readArtifact("app",i)&&this.workspace.deleteArtifact("app",i),n}associateRecords(t,r,n){return(0,wr.associateRecords)(this.dataverse,t,r,n)}disassociateRecords(t,r,n,i){return(0,wr.disassociateRecords)(this.dataverse,t,r,n,i)}createWebResource(t){return(0,vl.createWebResource)(this.dataverse,t)}updateWebResource(t,r){return(0,vl.updateWebResource)(this.dataverse,t,r)}getWebResource(t){return(0,vl.getWebResource)(this.dataverse,t)}deleteWebResource(t){return(0,vl.deleteWebResource)(this.dataverse,t)}createPublisher(t){return(0,ut.createPublisher)(this.dataverse,t)}createSolution(t){return(0,ut.createSolution)(this.dataverse,t)}setSolutionVersion(t,r){return(0,ut.setSolutionVersion)(this.dataverse,t,r)}addSolutionComponent(t){return(0,ut.addSolutionComponent)(this.dataverse,t)}removeSolutionComponent(t,r,n){return(0,ut.removeSolutionComponent)(this.dataverse,t,r,n)}exportSolution(t){return(0,ut.exportSolution)(this.dataverse,t)}importSolution(t){return(0,ut.importSolution)(this.dataverse,t)}deleteSolution(t){return(0,ut.deleteSolution)(this.dataverse,t)}getArtifact(t,r){return(0,bn.cloneJson)(this.readRaw(t,r))}readRaw(t,r){let n=this.workspace.readArtifact(t,r);if(!n)throw new ke.ArtifactNotFoundError(t,r);return n}queryTree(t,r,n){let i=this.getArtifact(t,r),a=Nr.JsonPointer.resolve(i,n);if(a===void 0)throw new ke.PathNotFoundError(t,r,n);return a}findElements(t,r,n){let i=this.getArtifact(t,r);return(0,K$.findElements)(i,n)}listArtifacts(t,r){return this.workspace.listArtifacts(t,r).map(n=>({...n,isDirty:this.versions.isDirty(n.type,n.id)}))}getEntityMetadata(t){let r=this.workspace.readEntityMetadata(t);if(!r)throw new ke.ArtifactNotFoundError("entityMetadata",t);return r}getFieldMetadata(t,r){let i=this.getEntityMetadata(t).attributes.find(a=>a.logicalName===r);if(!i)throw new ke.PathNotFoundError("entityMetadata",t,r);return i}updateElement(t,r,n,i){let a=this.readRaw(t,r),o=Nr.JsonPointer.resolve(a,n);if(o===void 0)throw new ke.PathNotFoundError(t,r,n);let s=yl(o)&&yl(i)?{...o,...i}:i;return Nr.JsonPointer.set(a,n,(0,bn.cloneJson)(s)),this.assertStructurallyValid(t,r,a,n),this.workspace.writeArtifact(t,r,a),this.getArtifact(t,r)}addElement(t,r,n,i,a){let o=this.readRaw(t,r),s=Nr.JsonPointer.resolve(o,n);if(s===void 0)throw new ke.PathNotFoundError(t,r,n);if(!Array.isArray(s))throw new ke.ValidationError(t,r,n,"parent must be an array");let l=this.assignMissingIds(t,(0,bn.cloneJson)(i)),u=u5(s,a?.position);return s.splice(u,0,l),this.assertStructurallyValid(t,r,o,n),this.workspace.writeArtifact(t,r,o),this.getArtifact(t,r)}moveElement(t,r,n,i,a){var o;let s=this.readRaw(t,r),l=Nr.JsonPointer.resolve(s,n);if(l===void 0)throw new ke.PathNotFoundError(t,r,n);let u=Nr.JsonPointer.resolve(s,i);if(u===void 0)throw new ke.PathNotFoundError(t,r,i);if(!Array.isArray(u))throw new ke.ValidationError(t,r,i,"move target must be an array");if(i===n||i.startsWith(`${n}/`))throw new ke.ValidationError(t,r,i,"cannot move an element into its own subtree");Nr.JsonPointer.remove(s,n);let c=(o=a?.index)!==null&&o!==void 0?o:u.length;return u.splice(Math.max(0,Math.min(c,u.length)),0,l),this.assertStructurallyValid(t,r,s,i),this.workspace.writeArtifact(t,r,s),this.getArtifact(t,r)}removeElement(t,r,n){let i=this.readRaw(t,r);if(Nr.JsonPointer.resolve(i,n)===void 0)throw new ke.PathNotFoundError(t,r,n);return Nr.JsonPointer.remove(i,n),this.assertStructurallyValid(t,r,i,l5(n)),this.workspace.writeArtifact(t,r,i),this.getArtifact(t,r)}assertStructurallyValid(t,r,n,i){var a,o,s;let l=this.registrations.get(t),u=(s=(o=l==null?void 0:(a=l.adapter).validate)===null||o===void 0?void 0:o.call(a,n,i))!==null&&s!==void 0?s:[];if(u.length>0)throw new ke.ValidationError(t,r,u)}retrieveSetting(t,r){return(0,Si.retrieveSetting)(this.dataverse,t,r)}saveSettingValue(t,r,n){return(0,Si.saveSettingValue)(this.dataverse,t,r,n)}getAiReadiness(t){return(0,Si.getAiReadiness)(this.dataverse,t)}setAppAiFeatures(t,r,n){return(0,Si.setAppAiFeatures)(this.dataverse,t,r,n)}configureRowSummary(t,r){return(0,Si.configureRowSummary)(this.dataverse,t,r)}removeRowSummary(t){return(0,Si.removeRowSummary)(this.dataverse,t)}async enrichDefaultViews(t,r,n={}){let i=await(0,o5.findDefaultViews)(this.dataverse,t,n);for(let a of i)await this.fetchArtifact("view",a.id),this.updateElement("view",a.id,"/columns",r),await this.pushArtifact("view",a.id);return i.length&&await this.publishArtifact("view",i[0].id),{updated:i.map(a=>a.id)}}createArtifact(t,r){let n=this.requireRegistration(t,"createArtifact"),i=n.adapter.assignMissingIds(n.adapter.createDefault(r)),a=i.id;if(!a)throw new ke.ValidationError(t,"(new)","/id","created artifact must have an id");return this.workspace.writeArtifact(t,a,i),(0,bn.cloneJson)(i)}deleteArtifact(t,r){this.workspace.deleteArtifact(t,r)}async deleteRemoteArtifact(t,r){await this.requireRegistration(t,"deleteRemoteArtifact").api.delete(this.dataverse,r),this.workspace.readArtifact(t,r)&&this.workspace.deleteArtifact(t,r)}async publishArtifact(t,r){let n=this.readRaw(t,r),i;if(t==="app")i=`<importexportxml><appmodules><appmodule>${(0,wi.xmlText)(r)}</appmodule></appmodules></importexportxml>`;else{let a=n.entityLogicalName;a&&(i=`<importexportxml><entities><entity>${(0,wi.xmlText)(a)}</entity></entities></importexportxml>`)}i&&(0,Gr.ensureSuccess)(await this.dataverse.post("/PublishXml",{ParameterXml:i}),this.dataverse.apiUrl("/PublishXml"))}async pushArtifact(t,r){var n;let i=this.requireRegistration(t,"pushArtifact"),a=this.readRaw(t,r),o=this.versions.getMeta(t,r),s=await this.buildMetadataContext(i.adapter,a),l=i.adapter.toApiPayload(a,o?.snapshot,s);try{let u=o?await i.api.update(this.dataverse,r,l,o.etag):await i.api.create(this.dataverse,l),c=r;return o||(u.serverIdentity&&i.adapter.applyServerIdentity&&i.adapter.applyServerIdentity(a,u.serverIdentity),u.id&&u.id!==r&&(a.id=u.id,this.workspace.deleteArtifact(t,r),c=u.id),this.workspace.writeArtifact(t,c,a)),this.versions.storeMeta(t,c,{etag:u.etag,fetchedAt:(0,Gr.nowIso)(),snapshot:(0,bn.cloneJson)(a)}),{type:t,id:c,success:!0,...u.warnings&&u.warnings.length>0?{warnings:u.warnings}:{}}}catch(u){if(u instanceof ke.SdkError&&u.code===Gr.VERSION_CONFLICT_CODE)return{type:t,id:r,success:!1,error:new ke.VersionConflictError(t,r,(n=o?.etag)!==null&&n!==void 0?n:null,null)};throw u}}async buildMetadataContext(t,r){var n,i;let a=(i=(n=t.metadataNeeds)===null||n===void 0?void 0:n.call(t,r))!==null&&i!==void 0?i:[];if(a.length===0)return;let o=new Set(a.map(s=>s.entityLogicalName).filter(s=>!!s));for(let s of o)if(!this.workspace.readEntityMetadata(s))try{await this.fetchEntityMetadata(s)}catch{}return{resolveField:(s,l)=>{let u=this.workspace.readEntityMetadata(s),c=u?.attributes.find(p=>p.logicalName===l);return c?{displayName:c.displayName,attributeType:c.attributeType}:void 0}}}async pushAll(){let t=this.getDirtyArtifacts(),r=[];for(let n of t)try{r.push(await this.pushArtifact(n.type,n.id))}catch(i){r.push({type:n.type,id:n.id,success:!1,error:SS(i)})}return r}getDirtyArtifacts(){return this.workspace.listArtifacts().filter(t=>this.versions.isDirty(t.type,t.id)).map(t=>({...t,isDirty:!0}))}diffArtifact(t,r){return this.versions.diff(t,r)}assignMissingIds(t,r){let n=this.registrations.get(t);return n?n.adapter.assignMissingIds(r):(0,i5.assignMissingIds)(r)}async resolveComponentType(t){switch(t.componentType){case ut.SolutionComponentType.SavedQuery:return"view";case ut.SolutionComponentType.SavedQueryVisualization:return"chart";case ut.SolutionComponentType.AppModule:return"app";case ut.SolutionComponentType.Workflow:return t.workflowCategory===2?"businessRule":void 0;case ut.SolutionComponentType.SystemForm:return await this.isDashboardForm(t.objectId)?"dashboard":"form";default:return}}async isDashboardForm(t){let n=`/systemforms(${(0,wi.normalizeGuid)(t,"formId")})${(0,wi.odataQuery)([["$select","type"]])}`,i=(0,Gr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n)),a=Number(i.body.type);return a===0||a===10}requireRegistration(t,r){let n=this.registrations.get(t);if(!n)throw new ke.NotImplementedError(r,`no adapter registered for artifact type '${t}'`);return n}};Di.MakerSdk=bl;function s5(e){return new bl(e)}Di.createMakerSdk=s5;function SS(e){return e instanceof Error?e:new Error(String(e))}function yl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function l5(e){let t=e.lastIndexOf("/");return t<=0?"":e.slice(0,t)}function u5(e,t){if(t===void 0||t==="end")return e.length;if(t==="start")return 0;if("index"in t)return Math.max(0,Math.min(t.index,e.length));if("before"in t){let n=e.findIndex(i=>yl(i)&&i.id===t.before);return n<0?e.length:n}let r=e.findIndex(n=>yl(n)&&n.id===t.after);return r<0?e.length:r+1}});var ES=f(Cl=>{"use strict";Object.defineProperty(Cl,"__esModule",{value:!0});Cl.ARTIFACT_TYPES=void 0;Cl.ARTIFACT_TYPES=["form","view","businessRule","app","command","chart","dashboard"]});var _S=f(IS=>{"use strict";Object.defineProperty(IS,"__esModule",{value:!0})});var OS=f(PS=>{"use strict";Object.defineProperty(PS,"__esModule",{value:!0})});var RS=f(FS=>{"use strict";Object.defineProperty(FS,"__esModule",{value:!0})});var xS=f(TS=>{"use strict";Object.defineProperty(TS,"__esModule",{value:!0})});var US=f(LS=>{"use strict";Object.defineProperty(LS,"__esModule",{value:!0})});var BS=f(MS=>{"use strict";Object.defineProperty(MS,"__esModule",{value:!0})});var qS=f(kS=>{"use strict";Object.defineProperty(kS,"__esModule",{value:!0})});var VS=f($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0})});var zS=f(GS=>{"use strict";Object.defineProperty(GS,"__esModule",{value:!0})});var jS=f(WS=>{"use strict";Object.defineProperty(WS,"__esModule",{value:!0})});var JS=f(HS=>{"use strict";Object.defineProperty(HS,"__esModule",{value:!0})});var XS=f(QS=>{"use strict";Object.defineProperty(QS,"__esModule",{value:!0})});var YS=f(KS=>{"use strict";Object.defineProperty(KS,"__esModule",{value:!0})});var eD=f(ZS=>{"use strict";Object.defineProperty(ZS,"__esModule",{value:!0})});var rD=f(tD=>{"use strict";Object.defineProperty(tD,"__esModule",{value:!0})});var iD=f(nD=>{"use strict";Object.defineProperty(nD,"__esModule",{value:!0})});var oD=f(aD=>{"use strict";Object.defineProperty(aD,"__esModule",{value:!0})});var lD=f(sD=>{"use strict";Object.defineProperty(sD,"__esModule",{value:!0})});var c5=exports&&exports.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ye=exports&&exports.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&c5(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0});exports.createMakerSdk=void 0;var d5=DS();Object.defineProperty(exports,"createMakerSdk",{enumerable:!0,get:function(){return d5.createMakerSdk}});ye(ES(),exports);ye(_S(),exports);ye(OS(),exports);ye(RS(),exports);ye(xS(),exports);ye(US(),exports);ye(BS(),exports);ye(qS(),exports);ye(VS(),exports);ye(zS(),exports);ye(jS(),exports);ye(JS(),exports);ye(XS(),exports);ye(YS(),exports);ye(eD(),exports);ye(rD(),exports);ye(iD(),exports);ye(oD(),exports);ye(lD(),exports);ye(_e(),exports);+`)}function eh(e){this.options=e||{locator:{}}}eh.prototype.parseFromString=function(e,t){var r=this.options,n=new JP,i=r.domBuilder||new aa,a=r.errorHandler,o=r.locator,s=r.xmlns||{},l=/\/x?html?$/.test(t),u=l?Qm.HTML_ENTITIES:Qm.XML_ENTITIES;o&&i.setDocumentLocator(o),n.errorHandler=QP(a,i,o),n.domBuilder=r.domBuilder||i,l&&(s[""]=Xm.HTML),s.xml=s.xml||Xm.XML;var c=r.normalizeLineEndings||Zm;return e&&typeof e=="string"?n.parse(c(e),s,u):n.errorHandler.error("invalid doc source"),i.doc};function QP(e,t,r){if(!e){if(t instanceof aa)return t;e=t}var n={},i=e instanceof Function;r=r||{};function a(o){var s=e[o];!s&&i&&(s=e.length==2?function(l){e(o,l)}:e),n[o]=s&&function(l){s("[xmldom "+o+"] "+l+zu(r))}||function(){}}return a("warning"),a("error"),a("fatalError"),n}function aa(){this.cdata=!1}function Un(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}aa.prototype={startDocument:function(){this.doc=new jP().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,n){var i=this.doc,a=i.createElementNS(e,r||t),o=n.length;Lo(this,a),this.currentElement=a,this.locator&&Un(this.locator,a);for(var s=0;s<o;s++){var e=n.getURI(s),l=n.getValue(s),r=n.getQName(s),u=i.createAttributeNS(e,r);this.locator&&Un(n.getLocator(s),u),u.value=u.nodeValue=l,a.setAttributeNode(u)}},endElement:function(e,t,r){var n=this.currentElement,i=n.tagName;this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&Un(this.locator,r),Lo(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=Km.apply(this,arguments),e){if(this.cdata)var n=this.doc.createCDATASection(e);else var n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&Un(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=Km.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&Un(this.locator,n),Lo(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var i=n.createDocumentType(e,t,r);this.locator&&Un(this.locator,i),Lo(this,i),this.doc.doctype=i}},warning:function(e){console.warn("[xmldom warning] "+e,zu(this.locator))},error:function(e){console.error("[xmldom error] "+e,zu(this.locator))},fatalError:function(e){throw new HP(e,this.locator)}};function zu(e){if(e)return`+@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function Km(e,t,r){return typeof e=="string"?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){aa.prototype[e]=function(){return null}});function Lo(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Mo.__DOMHandler=aa;Mo.normalizeLineEndings=Zm;Mo.DOMParser=eh});var Wu=m(Uo=>{var rh=$u();Uo.DOMImplementation=rh.DOMImplementation;Uo.XMLSerializer=rh.XMLSerializer;Uo.DOMParser=th().DOMParser});var nh=m(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.deleteAppCascade=void 0;var XP=_u(),ju=Bi(),KP=be(),Bo=ue(),YP=Wu();function Hu(e){return e instanceof Error?e:new Error(String(e))}function ZP(e){let t=[],r=s=>l=>t.push(`${s}: ${l}`),i=new YP.DOMParser({errorHandler:{warning:r("warning"),error:r("error"),fatalError:r("fatalError")}}).parseFromString(e,"text/xml").documentElement;if(!i||t.length>0)throw new KP.InvalidArgumentError(`The app sitemap xml could not be parsed cleanly, so its generative-page children cannot be determined${t.length>0?` (${t[0]})`:""}`);let a=[],o=s=>{if(s.nodeName==="SubArea"){let u=s.getAttribute("GenPageId");u&&a.push((0,Bo.normalizeGuid)(u,"GenPageId"))}let l=s.childNodes;for(let u=0;u<l.length;u+=1){let c=l[u];c.nodeType===1&&o(c)}};return o(i),a}async function eO(e,t,r){let n=(0,Bo.normalizeGuid)(t,"appModuleId");(0,Bo.normalizeGuid)(r,"appModuleIdUnique");let i=[],a=[],o=[];await(0,XP.deleteAppResolvingOnce)(e,n,s=>{s!==void 0&&o.push(...ZP(s))}),i.push({type:"app",id:n});for(let s of new Set(o)){let l;try{l=await(0,ju.queryAllRecords)(e,"uxagentprojectfile",{select:["uxagentprojectfileid"],filter:`_uxagentprojectid_value eq ${s}`})}catch(u){a.push({operation:"resolve",type:"genPageFile",id:s,error:Hu(u)});continue}for(let u of l??[]){let c="";try{c=(0,Bo.normalizeGuid)(String(u.uxagentprojectfileid),"uxagentprojectfileid"),await(0,ju.deleteRecord)(e,"uxagentprojectfile",c),i.push({type:"genPageFile",id:c})}catch(d){a.push({operation:"delete",type:"genPageFile",id:c,error:Hu(d)})}}try{await(0,ju.deleteRecord)(e,"uxagentproject",s),i.push({type:"genPage",id:s})}catch(u){a.push({operation:"delete",type:"genPage",id:s,error:Hu(u)})}}return{success:a.length===0,deleted:i,failures:a}}ko.deleteAppCascade=eO});var ih={};Bt(ih,{Guid:()=>I});var I,Se=D(()=>{"use strict";I=class e{guidString;guid;static get EmptyGuid(){return new e("00000000-0000-0000-0000-000000000000")}static NewGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=Math.random()*16|0,n=t=="x"?r:r&3|8;return n.toString(16)})}constructor(t,r=!1){this.guidString=t;let n=new RegExp("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");(r||n.test(t))&&(this.guid=t)}ToString(){return this.guid}}});var P,ze=D(()=>{"use strict";Ce();P=class e{static get EmptyString(){return""}static IsTrue(t){let r=!1;return r=t&&(this.IsStrictTrue(t)||this.IsYes(t)),r}static IsStrictTrue(t){let r=!1;return t&&(r=t.toLowerCase()==="true"),r}static IsYes(t){return t.toLowerCase()==="yes"||t.toLowerCase()==="y"}static get WhiteSpace(){return/ /g}static get EnglishAndNumericCharacters(){return/([a-z0-9A-Z]+)/g}static get ValidIdExpression(){return/([a-z0-9A-Z_]+)/g}static IsNullOrEmpty(t){return t==null||t==null||t==""}static Format(t,r){return e.IsNullOrEmpty(t)?t:t.replace(/\{\{|\}\}|\{(\d+)\}/g,function(n,i){return n=="{{"?"{":n=="}}"?"}":r[i]})}static EndsWithString(t,r){return t.indexOf(r,t.length-r.length)!==-1}static IsBlankString(t){return t.replace(/\s/g,"").length==0}static EscapeXml(t,r){let n=t;return this.IsNullOrEmpty(n)||(n=n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),r&&(n=n.replace(/"/g,""").replace(/'/g,"'"))),n}static EscapeDomId(t){return t.replace(".","\\.")}static ToSnakeCase(t){let r=e.EmptyString;for(let n=0;n<t.length;n++)n!==0&&t[n]==t[n].toUpperCase()&&(r+="-"),r+=t[n].toLowerCase();return r}static GetSnakeCaseMarkup(t,r){let n="<"+this.ToSnakeCase(t);if(!S.IsNullOrUndefined(r))for(let i of r.getKeys())n+=" "+this.ToSnakeCase(i)+'="'+r.getValue(i)+'"';return n+">"}static StripBraces(t){return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?t.substr(1,t.length-2):t}static AddBraces(t){return S.IsNullOrUndefined(t)||t.charAt(0)==="{"||t.charAt(t.length-1)==="}"?t:`{${t}}`}static GuidStringEquals(t,r){return t===r?!0:!t||!r?!1:e.StripBraces(t).toUpperCase()===e.StripBraces(r).toUpperCase()}static AddBracesToArrayValues(t){return t.length>0?t.map(n=>(n.charAt(0)!=="{"&&(n="{"+n),n.charAt(n.length-1)!=="}"&&(n=n+"}"),n)):t}static StripBracesOnArrayValues(t){return t.length>0?t.map(n=>{let i;return n.charAt(0)==="{"&&(i=n.substr(1,n.length-1)),n.charAt(n.length-1)==="}"&&(i=i.substr(0,n.length-2)),i}):t}}});var ah={};Bt(ah,{ScriptUtilities:()=>S});var S,Ce=D(()=>{"use strict";Se();ze();S=class e{static IsNullOrUndefined(t){return t==null||t===void 0}static IsMacMachine(){return navigator.platform.indexOf("Mac")!==-1}static IsNullOrEmptyGuid(t){return P.IsNullOrEmpty(t.ToString())?!0:I.EmptyGuid.ToString()===t.ToString()}static IsNullOrUndefinedNested(t,r){return r.split(".").every(i=>typeof t!="object"||t==null||!(i in t)||t[i]==null?!1:(t=t[i],!0))}static ParseXml(t){return new DOMParser().parseFromString(t,"text/xml")}static IsWellFormedXml(t){return!e.ParseXml(t).querySelector("parsererror")}static getNamedItemValue(t,r){let n=t.getNamedItem(r);return e.IsNullOrUndefined(n)?null:n.value}static getBooleanValue(t,r){let n=e.getNamedItemValue(t,r);return e.IsNullOrUndefined(n)?null:P.IsTrue(n)}static getNumericValue(t){return e.IsNullOrUndefined(t)?null:parseInt(t)}static getAllUniqueTagNames(t){let r=new Set;return e.getAllUniqueTagNamesHelper(t,r),r}static getAllUniqueTagNamesHelper(t,r){if(t.nodeType===Node.ELEMENT_NODE&&(r.add(t.tagName),t.hasChildNodes()))for(let n=0;n<t.children.length;n++)this.getAllUniqueTagNamesHelper(t.children.item(n),r)}}});var qo,$o,Yr,Vo,Ju,Go,Qu=D(()=>{"use strict";(function(e){e[e.FormElementNodeChange=0]="FormElementNodeChange",e[e.FormElementAttributeChange=1]="FormElementAttributeChange"})(qo||(qo={}));$o=class{type;targetNode;constructor(t,r){this.type=t,this.targetNode=r}},Yr=class extends $o{key;oldValue;newValue;constructor(t,r,n,i){super(qo.FormElementNodeChange,t),this.key=r,this.oldValue=n,this.newValue=i}apply(){this.targetNode.replaceObjectPropertyValue(this.key,this.newValue)}revert(){this.targetNode.replaceObjectPropertyValue(this.key,this.oldValue)}},Vo=class extends $o{property;oldValue;newValue;constructor(t,r,n,i){super(qo.FormElementAttributeChange,t),this.property=r,this.oldValue=n,this.newValue=i}apply(){this.targetNode.replaceAttributeValue(this.property,this.newValue)}revert(){this.targetNode.replaceAttributeValue(this.property,this.oldValue)}},Ju=class{changeSet;reversedChangeSet;constructor(t){this.changeSet=t,this.changeSet&&(this.reversedChangeSet=this.changeSet.slice().reverse())}length(){return this.changeSet?this.changeSet.length:0}apply(){this.changeSet&&this.changeSet.length>0&&this.changeSet.forEach(t=>{t.apply()})}revert(){this.reversedChangeSet&&this.reversedChangeSet.length>0&&this.reversedChangeSet.forEach(t=>{t.revert()})}},Go=class{isTracking;_trackedChanges;_trackedChangeSets;constructor(t=!1){this.isTracking=t,this._trackedChanges=[],this._trackedChangeSets=[]}addChange(t){this.isTracking&&this._trackedChanges.push(t)}collectChanges(){let t=new Ju(this._trackedChanges.slice());return this._trackedChanges=[],t}pushChangeSet(t){this._trackedChangeSets.push(t)}popChangeSet(){if(this._trackedChangeSets?.length>0)return this._trackedChangeSets.pop()}getChangeSets(){return this._trackedChangeSets}}});var oh={};Bt(oh,{ChartGridMode:()=>yt,ColumnLayoutWidths:()=>aO,ComponentCategory:()=>Wo,ComponentType:()=>Xu,ControlLayoutTypes:()=>nc,DisplayConditionsInfo:()=>nO,ElementNames:()=>h,ElementProperties:()=>p,ElementType:()=>Yu,EntityAttributeProperty:()=>Zu,EventType:()=>oa,FormActivationState:()=>rc,FormCanvasServiceScope:()=>vO,FormDesignerSideBarTab:()=>Ku,FormPresentation:()=>ec,FormState:()=>zo,FormType:()=>De,HeaderDensityType:()=>Fr,LookUpTable:()=>Wt,MORE_TAB_PREFIX:()=>sO,NavBarChildElementType:()=>tc,PREVIEW_ID_HEADER_FLYOUT:()=>dO,PREVIEW_ID_HEADER_OVERFLOW_BUTTON:()=>fO,PREVIEW_ID_NAVIGATION_AREA:()=>uO,PREVIEW_ID_QUICKCREATE_ROOT:()=>hO,PREVIEW_ID_TAB:()=>mO,PREVIEW_ID_TAB_LIST:()=>pO,PREVIEW_ID_TAB_PANEL:()=>cO,PropertyModelKeys:()=>oc,PropertyModelSectionKeys:()=>oO,RELATED_TAB_ID:()=>sc,RELATED_TAB_PREFIX:()=>lO,SectionDefaultProperties:()=>iO,SectionLayoutTypes:()=>pe,TabContentType:()=>ic,TabDefaultProperties:()=>Tr,TabLayoutTypes:()=>de,TelemetryPropertyNames:()=>gO,UnboundControlPropertyKeys:()=>ac,compositeAddressFields:()=>rO,compositeFieldNames:()=>ht,compositeFields:()=>tO});var De,Xu,Ku,h,p,Yu,ht,tO,rO,Zu,Wt,zo,Fr,ec,nO,tc,rc,de,iO,Tr,pe,nc,ic,aO,ac,oc,oO,oa,yt,sc,sO,lO,uO,cO,dO,pO,fO,mO,hO,gO,Wo,vO,G=D(()=>{"use strict";(function(e){e[e.Dashboard=0]="Dashboard",e[e.AppointmentBook=1]="AppointmentBook",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.MobileExpress=5]="MobileExpress",e[e.QuickViewForm=6]="QuickViewForm",e[e.QuickCreate=7]="QuickCreate",e[e.Dialog=8]="Dialog",e[e.TaskFlowForm=9]="TaskFlowForm",e[e.InteractionCentricDashboard=10]="InteractionCentricDashboard",e[e.Card=11]="Card",e[e.MainInteractiveExperience=12]="MainInteractiveExperience",e[e.Other=100]="Other",e[e.MainBackup=101]="MainBackup",e[e.AppointmentBookBackup=102]="AppointmentBookBackup",e[e.PowerBIDashboard=103]="PowerBIDashboard"})(De||(De={}));(function(e){e[e.Form=0]="Form",e[e.Dialog=1]="Dialog"})(Xu||(Xu={}));(function(e){e[e.Components=0]="Components",e[e.Properties=1]="Properties",e[e.Relationship=2]="Relationship",e[e.BusinessRules=3]="BusinessRules"})(Ku||(Ku={}));(function(e){e.form="form",e.formTab="tab",e.formColumn="column",e.formSection="section",e.formRow="row",e.formCell="cell",e.formLabel="label",e.formControl="control",e.formEvent="event",e.dependency="dependency",e.queryStringParameter="querystringparameter",e.controlDescriptions="controlDescriptions",e.controlDescription="controlDescription",e.customControl="customControl",e.dataset="data-set",e.formFooter="footer",e.formHeader="header",e.formNavigation="Navigation",e.formTabs="tabs",e.formColumns="columns",e.formSections="sections",e.formRows="rows",e.formEvents="events",e.quickFormDependencies="externaldependencies",e.controlParameters="parameters",e.formDependencies="dependencies",e.formNavBarAreas="NavBarAreas",e.formNavBarArea="NavBarArea",e.formNavBar="NavBar",e.spacerControl="SpacerControl",e.formField="Field",e.formNavBarByRelationshipItem="NavBarByRelationshipItem",e.formNavBarItem="NavBarItem",e.Title="Title",e.Titles="Titles",e.NavigationLink="Navigation Link",e.Relationship="Relationship",e.NavigationLinkIconClass="mscrm-glyph-NavLinkIcon",e.formDisplayConditions="DisplayConditions",e.formLibraries="formLibraries",e.internalLibraries="internaljscriptfile",e.eventHandlers="Handlers",e.handler="Handler",e.library="Library",e.formRoles="Role",e.formEveryOne="Everyone",e.Handler="Handler",e.EventHandlers="Handlers",e.InternalEventHandlers="InternalHandlers",e.HiddenControl="hiddencontrols",e.EventDependencies="dependencies",e.EventDependency="dependency",e.isvisibleinmocaonly="msinternal.isvisibleinmocaonly"})(h||(h={}));p={ShowImage:"showImage",ShowNavigationbar:"shownavigationbar",MaxWidth:"maxWidth",HeaderDensityType:"headerdensity",OnLoadEvent:"onload",EventActive:"active",EventAttribute:"attribute",Relationship:"relationship",Control:"control",HandlerUniqueId:"handlerUniqueId",functionName:"functionName",libraryNameEventHandler:"libraryName",enabledForField:"enabled",passExecutionContext:"passExecutionContext",parameters:"parameters",eventFunctionName:"eventFunctionName",eventEnabled:"eventEnabled",indicationOfSubgrid:"indicationOfSubgrid",Name:"name",Type:"type",TitleResourceId:"TitleResourceId",Show:"Show",RelationshipName:"RelationshipName",Sequence:"Sequence",Area:"Area",headerPrefix:"header_",application:"application",labelId:"labelid",showbar:"showbar",layout:"layout",classid:"classid",uniqueid:"uniqueid",isUnbound:"isunbound",isRequired:"isrequired",rowspan:"rowspan",rowheight:"rowheight",colspan:"colspan",width:"width",IsUserDefined:"IsUserDefined",expanded:"expanded",related:"related",showlabel:"showlabel",locklevel:"locklevel",datafieldname:"datafieldname",formFactor:"formFactor",static:"static",disabled:"disabled",description:"description",languagecode:"languagecode",LCID:"LCID",groupName:"group",contentType:"contenttype",showCommandBar:"showcommandbar",showBody:"showbody",showTabNavigator:"showtabnavigator",userspacer:"userspacer",columnName:"columns",LabelWidth:"labelwidth",Fieldlabelalignment:"celllabelalignment",Fieldlabelposition:"celllabelposition",availableforphone:"availableforphone",Locked:"bLocked",ReadOnly:"bDisabled",visible:"visible",ForControl:"forControl",text:"Text",url:"Url",passParameters:"PassParameters",autoExpand:"AutoExpand",auto:"auto",Auto:"Auto",Fixed:"Fixed",icon:"Icon",id:"id",Id:"Id",showOnMobileClient:"ShowOnMobileClient",webResourceId:"WebResourceId",viewName:"ViewName",failureTimeField:"FailureTimeField",successCondition:"SuccessConditionName",successConditionValue:"SuccessConditionValue",failureCondition:"FailureConditionName",failureConditionValue:"FailureConditionValue",warningCondition:"WarningConditionName",warningConditionValue:"WarningConditionValue",cancelCondition:"CancelConditionName",cancelConditionValue:"CancelConditionValue",pauseCondition:"PauseConditionName",pauseConditionValue:"PauseConditionValue",filterResults:"FilterResults",autoSuggestionSource:"AutoSuggestionSource",numberOfResults:"NumberOfResults",addressField:"AddressField",displayAsCustomer360Tile:"DisplayAsCustomer360Tile",hideQuickFormBorder:"HideQuickFormBorder",quickForms:"QuickForms",entityName:"EntityName",controlMode:"ControlMode",headerColorCode:"HeaderColorCode",targetEntityType:"TargetEntityType",enableQuickFind:"EnableQuickFind",enableViewPicker:"EnableViewPicker",enableChartPicker:"EnableChartPicker",recordsPerPage:"RecordsPerPage",chartGridMode:"ChartGridMode",referencePanelSubgridIconUrl:"ReferencePanelSubgridIconUrl",referencePanelQuickFormCollectionIconUrl:"ReferencePanelQuickFormCollectionIconUrl",referencePanelSearchWidgetIconUrl:"ReferencePanelSearchWidgetIconUrl",viewId:"ViewId",isUserView:"IsUserView",enableJumpBar:"EnableJumpBar",isUserChart:"IsUserChart",viewIds:"ViewIds",filteredViewIds:"FilteredViewIds",visualizationId:"VisualizationId",teamTemplateId:"TeamTemplateId",selectDefaultLanguage:"SelectDefaultLanguage",allowChangingFiltersOnUI:"AllowChangingFiltersOnUI",enableAutoSuggestions:"EnableAutoSuggestions",enableRating:"EnableRating",searchForAutoSuggestionsUsing:"SearchForAutoSuggestionsUsing",showContextualActions:"ShowContextualActions",showDepartmentFilter:"ShowDepartmentFilter",showLanguageFilter:"ShowLanguageFilter",showRatingUsing:"ShowRatingUsing",actionList:"ActionList",Order:"Order",FallbackForm:"FallbackForm",allowSearchFilter:"allowSearchFilter",socialInstanceParameters:"<Parameters>k__BackingField",signalUrl:"SignalUrl",border:"Border",scrolling:"Scrolling",security:"Security",BingMapsAddress1Composite:"address1_composite",BingMapsAddress2Composite:"address2_composite",UrlHttpsProtocolPrefix:"https://",UrlHttpProtocolPrefix:"http://",showAll:"ShowAll",ShowFilterPane:"UClientShowFilterPane",ExpandFilterPane:"UClientExpandFilterPane",SortOption:"UClientOrderBy",DefaultModuleCreateExperience:"UClientDefaultModuleForCreateExperience",RecordPerPages:"UClientRecordPerPage",moduleList:"UClientModules",showAllModule:"Show All",showSelectedModule:"Show Selected",Ascending:"Ascending",Descending:"Descending",Activities:"Activities",Posts:"Posts",Notes:"Notes",CardForm:"CardForm",SelectActivity:"SelectActivity",DisplayActivity:"UClientDisplayActivityUsing",CreateActivity:"UClientCreateActivityUsing",DisplayActivityHeader:"UClientDisplayActivityHeaderUsing",SortTimeLine:"UClientSortActivitiesByValue",activityList:"UClientActivities",CardActivityMap:"UClientActivityCardMap",DefaultTabId:"DefaultTabId",EmailConversationView:"EmailConversationView",OrderByActivityWall:"OrderByActivityWall",ShowArticleTab:"ShowArticleTab",SortActivityWall:"SortActivityWall",TimelineUniqueName:"UClientUniqueName",SortTimeLineBy:"modifiedon",SelectActivityListDefault:"appointment",SelectCardDefault:"Select Card Form",AscendingValue:"ascending",DescendingValue:"descending",DefaultTabIdValue:"ActivitiesTab",EmailConversationViewDefault:"true",ShowArticleTabDefault:"false",SelectDefaultLanguage:"SelectDefaultLanguage",SelectDefaultLanguageValue:"00000000-0000-0000-0000-000000000000",SortActivityWallDefault:"modifiedon",RecordPerPagesDefault:"10",TimelineNameLabel:"Timeline",showSelectedActions:"Show Selected",defaultFormat:"defaultformat",fieldLabels:"fieldlabels",QuickCreateForm:"quickcreateform",QuickFormNameToIdXMLTempate:"<QuickFormId e,yname={0}>{1}</QuickFormId>",QuickFormIdListXMLTempate:"<QuickFormId,}</QuickFormIds>",AllowFilterOff:"AllowFilterOff",AutoResolve:"AutoResolve",DefaultViewId:"DefaultViewId",DependentAttributeName:"DependentAttributeName",DependentAttributeType:"DependentAttributeType",DisableMru:"DisableMru",UseMFDForCreate:"useMainFormDialogForCreate",UseMFDForEdit:"useMainFormDialogForEdit",DisableQuickFind:"DisableQuickFind",DisableViewPicker:"DisableViewPicker",FilterRelationshipName:"FilterRelationshipName",AvailableViewIds:"AvailableViewIds",MainForm:"mainform",DefaultsFields:"defaultfields",TimeLineCardForm:"cardform",libraryUniqueId:"libraryUniqueId",libraryName:"name",displayName:"displayName",OnChangeEvent:"onchange",ViewIdRAControlDefault:"{92AFD454-0F2E-4397-A1C8-05E37C6AD699}",TargetEntityTypeRAControlDefault:"actioncard",ChartGridModeRAControlDefault:"All",RecordsPerPageRAControlDefault:"4",RAControlDefaultValue:"false",RAcontrolDefaultHeaderColorCode:"#000000",DropdownSelectedDefaultValue:"1",selectPrimaryCustomer:"SelectPrimaryCustomer",bindAttribute:"BindAttribute"};(function(e){e[e.TAB=0]="TAB",e[e.SECTION=1]="SECTION",e[e.BASIC_CONTROL=2]="BASIC_CONTROL",e[e.HEADER=3]="HEADER",e[e.FOOTER=4]="FOOTER",e[e.UB_CONTROL=5]="UB_CONTROL",e[e.RELATIONSHIPITEM=6]="RELATIONSHIPITEM",e[e.RELATIONSHIPGROUP=7]="RELATIONSHIPGROUP",e[e.NAVIGATIONLINK=8]="NAVIGATIONLINK",e[e.FORMMODEL=9]="FORMMODEL",e[e.UNDEFINED=10]="UNDEFINED"})(Yu||(Yu={}));ht={fullname:"fullname",yomifullname:"yomifullname",address1_composite:"address1_composite",address2_composite:"address2_composite",address3_composite:"address3_composite",billto:"billto_composite",shipto:"shipto_composite"},tO=[ht.fullname,ht.yomifullname,ht.address1_composite,ht.address2_composite,ht.address3_composite,ht.billto,ht.shipto],rO=[ht.address1_composite,ht.address2_composite,ht.address3_composite,ht.billto,ht.shipto];(function(e){e[e.IsValidForForm=0]="IsValidForForm",e[e.IsValidForCreate=1]="IsValidForCreate"})(Zu||(Zu={}));(function(e){e[e.DependencyFieldTable=0]="DependencyFieldTable",e[e.LockedFieldTable=1]="LockedFieldTable"})(Wt||(Wt={}));(function(e){e[e.Published=0]="Published",e[e.Draft=1]="Draft",e[e.New=2]="New",e[e.SaveAs=3]="SaveAs"})(zo||(zo={}));(function(e){e.Low="Low",e.HighReadOnlyValues="HighReadOnlyValues",e.HighWithControls="HighWithControls"})(Fr||(Fr={}));(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(ec||(ec={}));nO={TopOrderFormId:"topOrderFormId",NextDisplayOrder:"nextDisplayOrder"};(function(e){e[e.NavBarRelationShipItem=0]="NavBarRelationShipItem",e[e.NavBarItem=1]="NavBarItem"})(tc||(tc={}));(function(e){e[e.InActive=0]="InActive",e[e.Active=1]="Active"})(rc||(rc={}));(function(e){e[e.ONE_COLUMN=0]="ONE_COLUMN",e[e.TWO_COLUMN_EQUAL=1]="TWO_COLUMN_EQUAL",e[e.TWO_COLUMN_WIDER_LEFT=2]="TWO_COLUMN_WIDER_LEFT",e[e.TWO_COLUMN_WIDER_RIGHT=3]="TWO_COLUMN_WIDER_RIGHT",e[e.TWO_COLUMN_CUSTOM_LAYOUT=4]="TWO_COLUMN_CUSTOM_LAYOUT",e[e.THREE_COLUMN_EQUAL=5]="THREE_COLUMN_EQUAL",e[e.THREE_COLUMN_WIDER_MID=6]="THREE_COLUMN_WIDER_MID",e[e.THREE_COLUMN_CUSTOM_LAYOUT=7]="THREE_COLUMN_CUSTOM_LAYOUT"})(de||(de={}));iO={ShowLabel:"false",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_"},Tr={namePrefix:"tab_",ShowLabel:"true",LockLevel:"0",IsUserDefined:"0"};(function(e){e[e.ONE_COLUMN=0]="ONE_COLUMN",e[e.TWO_COLUMN=1]="TWO_COLUMN",e[e.THREE_COLUMN=2]="THREE_COLUMN",e[e.FOUR_COLUMN=3]="FOUR_COLUMN",e[e.REFERENCE_PANEL=4]="REFERENCE_PANEL"})(pe||(pe={}));(function(e){e[e.SUBGRID=0]="SUBGRID",e[e.SPACER=1]="SPACER",e[e.QUICK_VIEW=2]="QUICK_VIEW",e[e.WEB_RESOURCE=3]="WEB_RESOURCE",e[e.IFRAME=4]="IFRAME",e[e.BING_MAPS=5]="BING_MAPS",e[e.TIMER=6]="TIMER",e[e.TIMELINE=7]="TIMELINE",e[e.NOTES=8]="NOTES",e[e.SOCIAL_INSIGHTS=9]="SOCIAL_INSIGHTS",e[e.KB_SEARCH=10]="KB_SEARCH",e[e.INTERACTION_WALL=11]="INTERACTION_WALL",e[e.ACI_CONTROL=12]="ACI_CONTROL",e[e.RELATIONSHIP_ASSISTANT=13]="RELATIONSHIP_ASSISTANT",e[e.REFERENCE_PANEL=14]="REFERENCE_PANEL",e[e.REF_PANEL_QUICKVIEW=15]="REF_PANEL_QUICKVIEW",e[e.REF_PANEL_SUBGRID=16]="REF_PANEL_SUBGRID",e[e.REF_PANEL_KBSEARCH=17]="REF_PANEL_KBSEARCH",e[e.WEB_RESOURCE_HTML=18]="WEB_RESOURCE_HTML",e[e.PRED_LEAD_SCORING=19]="PRED_LEAD_SCORING"})(nc||(nc={}));(function(e){e.cardSections="cardSections",e.singleComponent="singleComponent",e.default="default",e.expandAvailableSpace="expandAvailableSpace"})(ic||(ic={}));aO={ONE_COLUMN:"100",TWO_COLUMN:"50",THREE_COLUMN:"33.33",FOUR_COLUMN:"25"};(function(e){e.minValue="MinValue",e.maxValue="MaxValue",e.precision="Precision",e.maxLength="MaxLength",e.entityLogicalName="EntityLogicalName",e.defaultViewId="DefaultViewId",e.optionSetDefaultValue="DefaultValue",e.optionSetId="OptionSetId"})(ac||(ac={}));(function(e){e.entityName="entityName",e.formName="formName",e.formDisplayName="formDisplayName",e.description="description",e.maxWidth="maxWidth",e.showNavigation="showNavigation",e.showImageCheck="showImageCheck",e.downloadFormXml="downloadFormXml",e.downloadRawFormXml="downloadRawFormXml",e.expandTab="expandTab",e.singleComponent="singleComponent",e.label="label",e.name="name",e.hiddenByDefault="hiddenByDefault",e.hideForPhone="hideForPhone",e.tabLayout="tabLayout",e.column1Width="column1Width",e.column2Width="column2Width",e.column3Width="column3Width",e.hideLabel="hideLabel",e.lockElement="lockElement",e.sectionLayout="sectionLayout",e.labelWidth="labelWidth",e.fieldLabelAlignment="fieldLabelAlignment",e.fieldLabelPosition="fieldLabelPosition",e.cellWidth="cellWidth",e.fieldHeight="fieldHeight",e.cellHeight="cellHeight",e.showLine="showLine",e.readonly="readonly",e.required="required",e.maxLength="maxLength",e.isTitle="isTitle",e.minValue="minValue",e.maxValue="maxValue",e.precision="precision",e.autoExpand="autoExpand",e.highDensityEnabled="highDensityEnabled",e.hideExtendedHeader="hideExtendedHeader",e.defaultViewProperty="defaultViewProperty",e.defaultChartProperty="defaultChartProperty",e.teamTemplateProperty="teamTemplateProperty",e.datasourceProperty="datasourceProperty",e.eventType="eventType",e.addEvent="addEvent",e.cellOnChange="cellOnChange",e.cellOnChangeEventDependencies="cellOnChangeEventDependencies",e.cellOnChangeHandlers="cellOnChangeHandlers",e.gridOnChange="gridOnChange",e.gridOnChangeEventDependencies="gridOnChangeEventDependencies",e.gridOnChangeHandlers="gridOnChangeHandlers",e.gridOnChangeTargetField="gridOnChangeTargetField",e.gridOnRecordSelect="gridOnRecordSelect",e.gridOnRecordSelectEventDependencies="gridOnRecordSelectEventDependencies",e.gridOnRecordSelectHandlers="gridOnRecordSelectHandlers",e.cellOnReadyStateEventDependencies="cellOnReadyStateEventDependencies",e.cellOnReadyStateHandlers="cellOnReadyStateEventHandlers",e.tabOnChange="tabOnChange",e.tabOnChangeEventDependencies="tabOnChangeEventDependencies",e.tabOnChangeHandlers="tabOnChangeHandlers",e.formOnLoad="formOnLoad",e.formOnLoadEventDependencies="formOnLoadEventDependencies",e.formOnLoadHandlers="formOnLoadHandlers",e.formOnSave="formOnSave",e.formOnSaveDependencies="formOnSaveDependencies",e.formOnSaveHandlers="formOnSaveHandlers",e.gridOnSave="gridOnSave",e.gridOnSaveDependencies="gridOnSaveDependencies",e.gridOnSaveHandlers="gridOnSaveHandlers",e.formHasNoLibraries="formHasNoLibraries",e.hideHeaderCommandBar="hideHeaderCommandBar",e.hideHeaderBody="hideHeaderBody",e.hideHeaderTabNavigator="hideHeaderTabNavigator",e.hideFooter="hideFooter",e.scrollingDropdown="scrollingDropdown",e.displayBorder="displayBorder",e.crossScripting="crossScripting",e.passParams="passParams",e.webResourceCustomParamData="webResourceCustomParameterData",e.webResourceAltText="webResourceAltText",e.verticalAlignment="verticalAlignment",e.horizontalAlignment="horizontalAlignment",e.specificSize="specificSize",e.urlProperty="urlProperty",e.enableViewPicker="enableViewPicker",e.enableChartPicker="enableChartPicker",e.chartGridMode="chartGridMode",e.relatedRecords="relatedRecords",e.hideSearchBox="hideSearchBox",e.showAllViews="showAllViews",e.availableViewsProperty="availableViewsProperty",e.recordsPerPage="recordsPerPage",e.businessRulePill="business-rule-pill-",e.addBusinessRule="addBusinessRule",e.rowHeight="rowHeight",e.refPanelSectionTabs="refPanelSectionTabs",e.editCanvasAppProperty="editCanvasAppProperty"})(oc||(oc={}));oO={display:"DisplayOptions",format:"Formatting",control:"Controls",data:"DataOptions",form:"FormProperties",events:"EventProperties",activeBusinessRules:"activeBusinessRules",addBusinessRule:"addBusinessRule",inactiveBusinessRules:"inactiveBusinessRules"};(function(e){e.onChange="onchange",e.onTabStateChange="tabstatechange",e.onLoad="onload",e.onSave="onsave",e.onReadyStateComplete="onreadystatecomplete",e.onRecordSelect="onrecordselect"})(oa||(oa={}));(function(e){e.All="All",e.Chart="Chart",e.Grid="Grid"})(yt||(yt={}));sc="tab_related3b554255-7717-4d17-bb7f-9936fb1e75ca",sO="more_tab_",lO="related_tab_",uO="preview_id_navigation_area",cO="tab-section",dO="headerFieldsFlyout",pO="tablist",fO="header_overflowButton",mO="tab",hO="quickCreateRoot",gO={defaultVisibility:"Default visibility"};(function(e){e.input="input",e.layout="layout",e.grid="grid",e.relatedData="relatedData",e.display="display",e.powerbi="powerbi",e.artificialIntelligence="artificialIntelligence",e.media="media",e.collaboration="collaboration",e.more="more",e.test="test",e.popular="popular"})(Wo||(Wo={}));vO="CellCanvasServiceScope"});var sh={};Bt(sh,{Attribute:()=>jo,FormElementNode:()=>q});var jo,q,xe=D(()=>{"use strict";Ce();ze();Qu();G();Se();jo=class{key;value;constructor(t,r){this.key=t,this.value=r}},q=class e{nodeName;properties;childrenNodes;parentNode;nodeId;isTransient;constructor(t,r){this.nodeName=t,this.properties=[],this.childrenNodes=[],this.parentNode=r,this.isTransient=!1,this.nodeId=`nodeId-${I.NewGuid()}`}getProperty(t){for(let r of this.properties)if(r.key===t)return r.value;return null}getNodeId(){return this.nodeId}getNodeName(){return this.nodeName}setNodeName(t){this.trackObjectPropertyChange("nodeName",t)}get NodeName(){return this.getNodeName()}getAllProperties(){return this.properties}replaceAttributeValue(t,r){this.properties.find(n=>n===t)&&(t.value=r)}replaceObjectPropertyValue(t,r){this[t]=r}getAllChildren(){return this.childrenNodes}getParentNode(){return this.parentNode}visit(t){let r=!1;if(t){r=!!t(this);let n=this.childrenNodes;if(!r&&n)for(let i=0;!r&&i<n.length;i++)r=n[i].visit(t)}return r}findAll(t){let r=[];return t&&this.visit(n=>{t(n)&&r.push(n)}),r}findFirst(t){let r=null;return t&&this.visit(n=>{if(t(n))return r=n,!0}),r}raiseMetadataChange(t){let r=this.getAncestor(h.form);r&&r.raiseMetadataChange(t)}trackPropertyAddition(t,r){this.trackPropertyCollectionChange(()=>{this.properties.push(new jo(t,r))})}trackPropertyDeletion(t){this.trackPropertyCollectionChange(()=>{let r=this.properties.findIndex(n=>n.key===t);r>-1&&this.properties.splice(r,1)})}trackPropertyCollectionChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.properties.slice();t(),r.addChange(new Yr(this,"properties",n,this.properties.slice()))}else t()}trackChildrenCollectionChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.childrenNodes.slice();t(),r.addChange(new Yr(this,"childrenNodes",n,this.childrenNodes.slice()))}else t()}trackParentNodeChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.parentNode;if(t(),n===this.parentNode)return;r.addChange(new Yr(this,"parentNode",n,this.parentNode))}else t()}trackAttributeValueChange(t,r){let n=this.changeTracker();if(n&&n.isTracking){let i=t.value;if(i===r)return;t.value=r,n.addChange(new Vo(this,t,i,r))}else t.value=r}trackObjectPropertyChange(t,r){let n=this.changeTracker();if(n&&n.isTracking){let i=this[t];if(i===r)return;this[t]=r,n.addChange(new Yr(this,t,i,r))}else this[t]=r}setProperty(t,r){if(!t)throw new Error("Invalid property key");let n=this.properties.find(i=>i.key===t);n?this.trackAttributeValueChange(n,r):this.addProperty(t,r)}addProperty(t,r){if(!t)throw new Error("Invalid property key");this.trackPropertyAddition(t,r)}removeProperty(t){this.trackPropertyDeletion(t)}addChild(t){t.trackParentNodeChange(()=>{t.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.push(t)})}insertChildAtIndex(t,r){S.IsNullOrUndefined(t)||(t.trackParentNodeChange(()=>{t.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(r,0,t)}))}moveChild(t,r){let n=this.childrenNodes.indexOf(t);if(n<0)return!1;let i=Math.min(Math.max(0,n+r),this.childrenNodes.length-1);return n!==i&&this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(i,0,this.childrenNodes.splice(n,1)[0])}),!0}getChildren(t){let r=[];for(let n of this.childrenNodes)n.nodeName===t&&r.push(n);return r}getFirstChild(t){for(let r of this.childrenNodes)if(r.nodeName===t)return r;return null}getAllGrandChildren(t){let r=this.getChildren(t),n=null;return r.length===0?new Array:(n=r[0],n.childrenNodes)}deleteChild(t){if(S.IsNullOrUndefined(t))return-1;for(let r=0;r<this.childrenNodes.length;r++)if(this.childrenNodes[r]===t)return this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(r,1)}),r;return-1}deleteAllChildren(){this.trackChildrenCollectionChange(()=>{this.childrenNodes=[]})}getParent(){return this.parentNode}getParentType(){return this.parentNode?this.parentNode.nodeName:P.EmptyString}updateChild(t,r){let n=this.childrenNodes.indexOf(t);return n>-1?(r.trackParentNodeChange(()=>{r.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(n,1,r)}),!0):!1}getAncestor(t){let r=this.getParent(),n=this.getParentType();for(;r;){if(n===t)return r;n=r.getParentType(),r=r.getParent()}return null}deleteFirstGrandChildOfName(t,r){return this.getChildren(t)[0].deleteChild(r)}deleteChildren(t,r){r=S.IsNullOrUndefined(r)?this.childrenNodes.length:r,this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(t,r)})}deleteGrandChildren(t,r,n){this.getChildren(t)[0].deleteChildren(r,n)}addGrandChild(t,r){let n=this.getChildren(t),i=null;n.length===0?(i=new e(t,this),this.addChild(i)):i=n[0],i.addChild(r)}addGrandChildAtIndex(t,r,n){let i=this.getChildren(t),a=null;i.length===0?(a=new e(t,this),this.addChild(a)):a=i[0],a.insertChildAtIndex(r,n)}GetPropertyByParameter(t){return this.getProperty(t)}getSemanticParent(){switch(this.getNodeName()){case h.formCell:let t=this.getAncestor(h.formSection);return t||(t=this.getAncestor(h.formHeader),t)||(t=this.getAncestor(h.formFooter),t)?t:null;case h.formSection:return this.getAncestor(h.formTab);case h.formTab:return this.getAncestor(h.form);default:return null}}isDirty(){return this.visit(t=>t.isInChangeSet())}isInChangeSet(){return this.changeTracker().getChangeSets().some(r=>r.changeSet.some(n=>n.targetNode.getNodeId()===this.getNodeId()))}changeTracker(){let t=this.getAncestor(h.form);return t?t.changeTracker():null}}});var lh={};Bt(lh,{ControlClassId:()=>A,ControlNamePrefixes:()=>Ho,getControlDisplayNames:()=>bO});function bO(e){return{[A.AccessPrivilegeControl]:e("controls.controlNames.accessPrivilege"),[A.AccessTeamTablePickerControl]:e("controls.controlNames.accessTeamTablePicker"),[A.ACIControl]:e("controls.controlNames.aci"),[A.ActivitiesContainerControl]:e("controls.controlNames.activitiesContainer"),[A.ActivitiesWallControl]:e("controls.controlNames.activitiesWall"),[A.AppliedFiltersControl]:e("controls.controlNames.appliedFilters"),[A.ArticleContentControl]:e("controls.controlNames.articleContent"),[A.BooleanControl]:e("controls.controlNames.twoOption"),[A.ButtonControl]:e("controls.controlNames.button"),[A.CheckboxControl]:e("controls.controlNames.checkbox"),[A.CompositionLinkControl]:e("controls.controlNames.compositionLink"),[A.ConnectionControl]:e("controls.controlNames.connection"),[A.ConnectionRoleObjectTypeListControl]:e("controls.controlNames.connectionRoleObjectTypeList"),[A.CoverageChoiceControl]:e("controls.controlNames.coverageChoice"),[A.DashboardControl]:e("controls.controlNames.dashboard"),[A.DynamicPropertyListControl]:e("controls.controlNames.dynamicPropertyList"),[A.EditFilterControl]:e("controls.controlNames.editFilter"),[A.ErrorStatusControl]:e("controls.controlNames.errorStatus"),[A.GlobalFilterControl]:e("controls.controlNames.globalFilter"),[A.HiddenInputControl]:e("controls.controlNames.hiddenInput"),[A.KBViewerControl]:e("controls.controlNames.kbViewer"),[A.LabelControl]:e("controls.controlNames.label"),[A.MailMergeLanguagePickerControl]:e("controls.controlNames.mailMergeLanguagePicker"),[A.MapLinkControl]:e("controls.controlNames.mapLink"),[A.OrgInsightsControl]:e("controls.controlNames.orgInsights"),[A.ChoiceLookupControl]:e("controls.controlNames.choiceLookup"),[A.PowerBIControl]:e("controls.controlNames.powerBI"),[A.ProcessControl]:e("controls.controlNames.process"),[A.RelatedInformationControl]:e("controls.controlNames.relatedInformation"),[A.RelationshipRoleChoiceControl]:e("controls.controlNames.relationshipRoleChoice"),[A.ReportControl]:e("controls.controlNames.report"),[A.StreamsControl]:e("controls.controlNames.streams"),[A.WebResourceSilverlightControl]:e("controls.controlNames.webResourceSilverlight"),[A.CurrencyControl]:e("controls.controlNames.currency"),[A.DateTimeControl]:e("controls.controlNames.dateAndTime"),[A.DecimalControl]:e("controls.controlNames.decimal"),[A.DurationControl]:e("controls.controlNames.duration"),[A.EmailAddressControl]:e("controls.controlNames.email"),[A.FileControl]:e("controls.controlNames.file"),[A.FloatingNumberControl]:e("controls.controlNames.floatingNumber"),[A.IframeControl]:e("controls.controlNames.iframe"),[A.ImageControl]:e("controls.controlNames.image"),[A.LookupControl]:e("controls.controlNames.lookup"),[A.MapsControl]:e("controls.controlNames.maps"),[A.PhoneNumberControl]:e("controls.controlNames.phoneNumber"),[A.ChoiceControl]:e("controls.controlNames.choice"),[A.QuickViewControl]:e("controls.controlNames.quickView"),[A.QuickFormControl]:e("controls.controlNames.quickForm"),[A.CustomControl]:e("controls.controlNames.customControl"),[A.SearchWidgetControl]:e("controls.controlNames.searchWidget"),[A.SocialInsightsControl]:e("controls.controlNames.socialInsights"),[A.SubgridControl]:e("controls.controlNames.subgrid"),[A.TextAreaControl]:e("controls.controlNames.textArea"),[A.TextboxControl]:e("controls.controlNames.textBox"),[A.TickerControl]:e("controls.controlNames.ticker"),[A.UrlControl]:e("controls.controlNames.url"),[A.WebResourceHTMLControl]:e("controls.controlNames.webResourceHTML"),[A.WebResourceImageControl]:e("controls.controlNames.webResourceImage"),[A.IntegerControl]:e("controls.controlNames.integer"),[A.TimerControl]:e("controls.controlNames.timer"),[A.TimelineControl]:e("controls.controlNames.timeline"),[A.EmailBodyControl]:e("controls.controlNames.emailBody"),[A.PartyListControl]:e("controls.controlNames.partyList"),[A.TimezoneControl]:e("controls.controlNames.timezone"),[A.LanguageControl]:e("controls.controlNames.language"),[A.ChoiceStatusControl]:e("controls.controlNames.choiceStatus"),[A.ChoicesControl]:e("controls.controlNames.choices"),[A.RegardingControl]:e("controls.controlNames.regarding"),[A.EmailEngagementActionsControl]:e("controls.controlNames.emailEngagementActions"),[A.EmailRecipientActivityControl]:e("controls.controlNames.emailRecipientActivity"),[A.ReferencePanelSearchWidgetControl]:e("controls.controlNames.referencePanelSearchWidget"),[A.ReferencePanelQuickViewControl]:e("controls.controlNames.referencePanelQuickView"),[A.ReferencePanelSubgridControl]:e("controls.controlNames.referencePanelSubgrid"),[A.KBEditorControl]:e("controls.controlNames.KBEditor"),[A.LinkControl]:e("controls.controlNames.link")}}var A,Ho,Zr=D(()=>{"use strict";(function(e){e.AccessPrivilegeControl="F93A31B2-99AC-4084-8EC2-D4027C31369A",e.AccessTeamTablePickerControl="3f4e2a56-f102-4b4d-ab9c-f1574ca5bfda",e.ACIControl="C8BFBBEF-6851-4401-A0CC-7450062FE085",e.ActivitiesContainerControl="C72511AB-84E5-4FB7-A543-25B4FC01E83E",e.ActivitiesWallControl="6636847D-B74D-4994-B55A-A6FAF97ECEA2",e.AppliedFiltersControl="9C310A73-A360-42C5-8943-47A06F1B51EA",e.ArticleContentControl="F02EF977-2564-4B9A-B2F0-DF083D8A019B",e.BooleanControl="67FAC785-CD58-4F9F-ABB3-4B7DDC6ED5ED",e.ButtonControl="00AD73DA-BD4D-49C6-88A8-2F4F4CAD4A20",e.CheckboxControl="B0C6723A-8503-4FD7-BB28-C8A06AC933C2",e.CompositionLinkControl="DB1284EF-9FFC-4E99-B382-0CC082FE2364",e.ConnectionControl="3246F906-1F71-45F7-B11F-D7BE0F9D04C9",e.ConnectionRoleObjectTypeListControl="821ACF1A-7E46-4A0C-965D-FE14A57D78C7",e.CoverageChoiceControl="4168A05C-D857-46AF-8457-5BB47EB04EA1",e.DashboardControl="D2561F53-B292-42D9-B222-478E40FFE29F",e.DynamicPropertyListControl="6896F004-B17A-4202-861E-8B7EA2080E0B",e.EditFilterControl="1479835F-F852-4679-B864-C6892A2844C9",e.ErrorStatusControl="F4C16ECA-CA81-4E39-9448-834B8378721E",e.GlobalFilterControl="FFF0E632-9D7B-4F21-BBC1-05D1567AD144",e.HiddenInputControl="5546E6CD-394C-4BEE-94A8-4425E17EF6C6",e.KBViewerControl="A62B6FA9-169E-406C-B1AA-EAB828CB6026",e.LabelControl="39354E4A-5015-4D74-8031-EA9EB73A1322",e.MailMergeLanguagePickerControl="B634828E-C390-444A-AFE6-E07315D9D970",e.MapLinkControl="91DC0675-C8B9-4421-B1E0-261CEBF02BAC",e.OrgInsightsControl="76b9e25e-695e-4fef-ac69-f05cfa96739c",e.ChoiceLookupControl="2305e33a-bad3-4022-9e15-1856cf218333",e.PowerBIControl="8C54228C-1B25-4909-A12A-F2B968BB0D62",e.ProcessControl="06E9F7AF-1F54-4681-8EEC-1E21A1CEB465",e.RelatedInformationControl="163B90A6-EB64-49D2-9DF8-3C84A4F0A0F8",e.RelationshipRoleChoiceControl="5F986642-5961-4D9F-AB5E-643D71E231E9",e.ReportControl="A28F441B-916C-4865-87FD-0C5D53BD59C9",e.StreamsControl="EE9078C8-6946-4E2C-B8F8-35E65F4BE6A8",e.WebResourceSilverlightControl="080677DB-86EC-4544-AC42-F927E74B491F",e.CurrencyControl="533B9E00-756B-4312-95A0-DC888637AC78",e.CustomControl="F9A8A302-114E-466A-B582-6771B2AE0D92",e.DateTimeControl="5B773807-9FB2-42DB-97C3-7A91EFF8ADFF",e.DecimalControl="C3EFE0C3-0EC6-42BE-8349-CBD9079DFD8E",e.DurationControl="AA987274-CE4E-4271-A803-66164311A958",e.EmailAddressControl="ADA2203E-B4CD-49BE-9DDF-234642B43B52",e.EmailBodyControl="6F3FB987-393B-4D2D-859F-9D0F0349B6AD",e.EmailEngagementActionsControl="F454228D-1D25-4319-E12F-D27968BC0234",e.EmailRecipientActivityControl="26E9760F-7454-40DE-BB07-F6DCCCB82040",e.FileControl="0A7FF475-B016-4687-9CE5-042BFDBD6519",e.FloatingNumberControl="0D2C745A-E5A8-4C8F-BA63-C6D3BB604660",e.IframeControl="FD2A7985-3187-444E-908D-6624B21F69C0",e.ImageControl="7E548B0D-209C-477B-9DCD-F0F44472381D",e.LanguageControl="671A9387-CA5A-4D1E-8AB7-06E39DDCF6B5",e.LookupControl="270BD3DB-D9AF-4782-9025-509E298DEC0A",e.MapsControl="62B0DF79-0464-470F-8AF7-4483CFEA0C7D",e.ChoicesControl="4AA28AB7-9C13-4F57-A73D-AD894D048B5F",e.IntegerControl="C6D124CA-7EDA-4A60-AEA9-7FB8D318B68F",e.PartyListControl="CBFB742C-14E7-4A17-96BB-1A13F7F64AA2",e.PhoneNumberControl="8C10015A-B339-4982-9474-A95FE05631A5",e.ChoiceControl="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE",e.ChoiceStatusControl="5D68B988-0661-4DB2-BC3E-17598AD3BE6C",e.QuickViewControl="5C5600E0-1D6E-4205-A272-BE80DA87FD42",e.QuickFormControl="69AF7DCA-2E3B-4EE7-9201-0DA731DD2413",e.RegardingControl="F3015350-44A2-4AA0-97B5-00166532B5E9",e.SearchWidgetControl="E616A57F-20E0-4534-8662-A101B5DDF4E0",e.SocialInsightsControl="86B9E25E-695E-4FEF-AC69-F05CFA96739C",e.SubgridControl="E7A81278-8635-4D9E-8D4D-59480B391C5B",e.TextAreaControl="E0DECE4B-6FC8-4A8F-A065-082708572369",e.TextboxControl="4273EDBD-AC1D-40D3-9FB2-095C621B552D",e.TickerControl="1E1FC551-F7A8-43AF-AC34-A8DC35C7B6D4",e.TimerControl="9C5CA0A1-AB4D-4781-BE7E-8DFBE867B87E",e.TimelineControl="06375649-C143-495E-A496-C962E5B4488E",e.TimezoneControl="7C624A0B-F59E-493D-9583-638D34759266",e.UrlControl="71716B6C-711E-476C-8AB8-5D11542BFB47",e.WebResourceHTMLControl="9FDF5F91-88B1-47F4-AD53-C11EFC01A01D",e.WebResourceImageControl="587CDF98-C1D5-4BDE-8473-14A0BC7644A7",e.ReferencePanelSearchWidgetControl="7CCD1494-1F7A-4E3A-8BDE-F32069DAEB9F",e.ReferencePanelSubgridControl="02D4264B-47E2-4B4C-AA95-F439F3F4D458",e.ReferencePanelQuickViewControl="B68B05F0-A46D-43F8-843B-917920AF806A",e.KBEditorControl="F94DB24F-263D-44A7-B38E-A35E9854812B",e.LinkControl="DFDF1CDE-837B-4AC9-98CF-AC74361FD89D"})(A||(A={}));Ho={[A.WebResourceHTMLControl]:"WebResource",[A.WebResourceImageControl]:"WebResource",[A.IframeControl]:"IFRAME",[A.SearchWidgetControl]:"Search widget",[A.SubgridControl]:"Subgrid",[A.TimelineControl]:"Timeline",[A.QuickViewControl]:"QuickviewControl"}});var en=m((s8,ch)=>{var sa=new Proxy(function(){return sa},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:sa},apply:function(){return sa},construct:function(){return{}}}),uh=function(){return sa};Object.setPrototypeOf(uh,sa);ch.exports=uh});var Qe,fr,dh,ph,Bn=D(()=>{"use strict";Qe="cds-designer-models",fr="FormCustomControl",dh="FormCell",ph="Form"});var kn,Xe,la=D(()=>{"use strict";kn=class{keys;values;constructor(){this.keys=[],this.values=[]}add(t,r){return this.containsKey(t)?!1:(this.keys.push(t),this.values.push(r),!0)}upsert(t,r){this.update(t,r)||this.add(t,r)}sortedUpsert(t,r){if(!this.update(t,r)){let n=0;for(;n<this.keys.length&&this.keys[n]<t;)n++;this.keys.splice(n,0,t),this.values.splice(n,0,r)}}clear(){this.keys=[],this.values=[]}containsKey(t){return this.keys.indexOf(t)!==-1}containsValue(t){return this.values.indexOf(t)!==-1}count(){return this.keys.length}getValue(t){let r=this.keys.indexOf(t);return r!==-1?this.values[r]:!1}getKeys(){return this.keys.slice()}getValues(){return this.values.slice()}remove(t){let r=this.keys.indexOf(t);return r!==-1?(this.keys.splice(r,1),this.values.splice(r,1),!0):!1}update(t,r){let n=this.keys.indexOf(t);return n!==-1?(this.values[n]=r,!0):!1}},Xe=class{data={};add(t,r){return this.containsKey(t)?!1:(this.data[t]=r,!0)}upsert(t,r){this.data[t]=r}clear(){this.data={}}containsKey(t){return this.data.hasOwnProperty(t)}containsValue(t){for(let r in this.data)if(this.data[r]===t)return!0;return!1}count(){return Object.keys(this.data).length}getValue(t){return this.containsKey(t)?this.data[t]:!1}getKeys(){return Object.keys(this.data)}getValues(){let t=[];for(let r in this.data)t.push(this.data[r]);return t}remove(t){return this.containsKey(t)?delete this.data[t]:!1}update(t,r){return this.containsKey(t)?(this.data[t]=r,!0):!1}getInternalObject(){return this.data}}});var tn,lc=D(()=>{"use strict";la();G();tn=class e{static lockedFieldCount=new Xe;static dependencyFieldCount=new Xe;static getNecessaryLookUpTable(t){switch(t){case Wt.DependencyFieldTable:return e.dependencyFieldCount;case Wt.LockedFieldTable:return e.lockedFieldCount}}static initCanvasLockedFieldLookUp(t){switch(t){case Wt.DependencyFieldTable:e.dependencyFieldCount=new Xe;case Wt.LockedFieldTable:e.lockedFieldCount=new Xe}}}});var Jo,fh=D(()=>{"use strict";Se();Ce();G();xe();Jo=class extends q{constructor(t){super(h.controlDescription,t)}get forControl(){let t=this.getProperty(p.ForControl);return S.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new I(t))}set forControl(t){this.setProperty(p.ForControl,`{${t.ToString()}}`)}get customControls(){return this.getChildren(h.customControl)}set customControls(t){this.deleteAllChildren();for(let r of t)this.addChild(r)}get DefaultControlClassId(){for(let t of this.customControls)if(!S.IsNullOrUndefined(t.id))return t.id;return null}get DefaultCustomControl(){for(let t of this.customControls)if(!S.IsNullOrUndefined(t.id))return t;return null}get DefaultCustomControls(){let t=[];for(let r of this.customControls)S.IsNullOrUndefined(r.id)||t.push(r);return t}async toJSON(t){let r=await this.getCustomControlsJSON(t);return r?{UniqueId:this.forControl.guidString,CustomControls:r,VersionNumber:0,OverallVersionNumber:0}:null}async getCustomControlsJSON(t){if(this.customControls){let r=[];for(let n of this.customControls){let i=await n.toJSON(t);i&&r.push(i)}return r}return null}}});var hh,gh,Ke,E,mh,Rr,rn,qn,uc,cc,$n=D(()=>{"use strict";hh={Name:"Name",Value:"Value",Type:"Type",TypeGroup:"TypeGroup",Usage:"Usage",Static:"Static",Primary:"Primary",Columns:"Columns",EnableViewPicker:"EnableViewPicker",EntityName:"EntityName",FilteredViewIds:"FilteredViewIds",ReferencingName:"ReferencingName",RelationshipName:"RelationshipName",RelationshipType:"RelationshipType",TargetEntityType:"TargetEntityType",ViewId:"ViewId",DependentAttributeName:"DependentAttributeName",DependentAttributeType:"DependentAttributeType",DefaultViewId:"DefaultViewId",BindAttribute:"BindAttribute",FilterRelationshipName:"FilterRelationshipName",AvailableViewIds:"AvailableViewIds",QuickForms:"QuickForms",EntityNameKey:"EntityNameKey",CardFormType:"Form.Card",CardFormId:"CardFormId",Hidden:"Hidden",Required:"Required",DefaultValue:"DefaultValue"},gh={GroupDefinition:"GroupDefinition"},Ke={Control:"control",Resources:"resources",DisplayNameKey:"display-name-key",descriptionKey:"description-key",value:"value",name:"name",defaultKey:"default",groups:"groups",group:"group",property:"property",hidden:"hidden",required:"required",typeGroup:"type-group",type:"type",usage:"usage",ofType:"of-type",ofTypeGroup:"of-type-group",ImageURL:"preview-image",DefaultValue:"default-value",static:"static",dataset:"data-set",propertySet:"property-set",initialDatasetFetch:"initial-data-set-fetch",editable:"editable",cdsDatasetOptions:"cds-data-set-options",allowDefaultSelectedItems:"allow-default-selected-items",resettable:"resettable",isGroup:"isGroup",entityName:"entityname"};(function(e){e.Boolean="Boolean",e.Currency="Currency",e.DateAndTimeDateAndTime="DateAndTime.DateAndTime",e.DateAndTimeDateOnly="DateAndTime.DateOnly",e.Decimal="Decimal",e.Enum="Enum",e.FP="FP",e.File="File",e.Guid="Guid",e.Image="Image",e.LookupCustomer="Lookup.Customer",e.LookupOwner="Lookup.Owner",e.LookupPartyList="Lookup.PartyList",e.LookupRegarding="Lookup.Regarding",e.LookupSimple="Lookup.Simple",e.Multiple="Multiple",e.MultiSelectOptionSet="MultiSelectOptionSet",e.OptionSet="OptionSet",e.SingleLineEmail="SingleLine.Email",e.SingleLinePhone="SingleLine.Phone",e.SingleLineText="SingleLine.Text",e.SingleLineTextArea="SingleLine.TextArea",e.SingleLineTickerSymbol="SingleLine.Ticker",e.SingleLineURL="SingleLine.URL",e.TwoOptions="TwoOptions",e.WholeDuration="Whole.Duration",e.WholeLanguage="Whole.Language",e.WholeNone="Whole.None",e.WholeTimeZone="Whole.TimeZone",e.BusinessProcessFlow="BusinessProcessFlow",e.CardForm="Form.Card",e.Dashboard="Dashboard",e.FormMain="Form.Main",e.Grid="Grid",e.PowerBIReport="PowerBI.Report",e.QuickForm="Form.QuickForm",e.Search="Search",e.SearchWidget="SearchWidget",e.TimelineWall="TimelineWall",e.UnboundCustomControl="Unbound",e.WebResourceHtmlControl="WebResource.HTML"})(E||(E={}));(function(e){e.BooleanType="CC_FlipLabel_Name",e.DateTimeType="CC_TextBox_Name",e.DecimalType="CC_TextBox_Name",e.DoubleType="CC_TextBox_Name",e.IntegerType="CC_TextBox_Name",e.LookupType="CC_TextBox_Name",e.MemoType="CC_TextArea_Name",e.MoneyType="CC_TextBox_Name",e.OptionSetType="CC_OptionSet_Name",e.StringType="CC_TextBox_Name",e.GridType="CC_ReadOnlyGrid_Name",e.UnboundCustomControlType="CC_UnboundCustomControl_Name"})(mh||(mh={}));(function(e){e.ArcKnobControl="MscrmControls.Knob.ArcKnobControl",e.CardFeedNameControl="MscrmControls.CardFeedContainer.CardFeedContainer",e.CheckboxControl="MscrmControls.FieldControls.CheckboxControl",e.DateTimeControl="MscrmControls.FieldControls.DateTimeControl",e.DurationControl="MscrmControls.FieldControls.DurationControl",e.EditableGridControl="MscrmControls.Grid.GridControl",e.EmailEngagementActionsControl="MscrmControls.EmailEngagement.EmailEngagementActionsControl",e.FormComponent="MscrmControls.ModelForm.ModelFormControl",e.LanguageCodeControl="MscrmControls.FieldControls.LanguagePickerControl",e.LinearSliderControl="MscrmControls.Slider.LinearSliderControl",e.MultiSelectOptionSetControl="MscrmControls.MultiSelectPicklist.UpdMSPicklistControl",e.OptionSetControl="MscrmControls.OptionSet.OptionSetControl",e.PowerBIPCFControl="MscrmControls.PowerBIPCFControl",e.PredictiveScoringWidget="MscrmControls.Sales.PredictiveScoringWidget.PredictiveScoringWidget",e.ReadonlyGrid="MscrmControls.Grid.ReadOnlyGrid",e.SimilarCasesGrid="MscrmControls.Containers.SimilarCasesGridControl",e.StarRatingControl="MscrmControls.Rating.StarRatingControl",e.TimeZoneControl="MscrmControls.FieldControls.TimeZonePickListControl",e.ModelFormControl="MscrmControls.ModelForm.ModelFormControl",e.AutoCompleteControl="MscrmControls.AutoComplete.AutoCompleteControl",e.CanvasAppControl="MscrmControls.Canvas.CanvasControl",e.PowerAppsOneGrid="Microsoft.PowerApps.PowerAppsOneGrid"})(Rr||(Rr={}));(function(e){e[e.Read=0]="Read",e[e.Edit=1]="Edit",e[e.Both=2]="Both",e[e.Container=3]="Container",e[e.Unknown=4]="Unknown"})(rn||(rn={}));(function(e){e[e.Bound=0]="Bound",e[e.Input=1]="Input",e[e.Output=2]="Output"})(qn||(qn={}));uc=[E.LookupCustomer,E.LookupOwner,E.LookupPartyList,E.LookupRegarding,E.LookupSimple],cc=[E.WholeNone,E.WholeDuration,E.WholeLanguage,E.WholeTimeZone,E.FP,E.Decimal]});function mr(){return jt||(jt=window._makerConfig,jt&&window?.location?.search?.indexOf("useProductionConfig")>-1&&(jt={...jt,region:"prod",graphQLEndpoint:"https://graph.make.powerapps.com/"}),jt?.region==="prod"&&(jt={endpoints:{eu:{ch:{graphql:"https://graph-make.ch-cm001.gateway.prod.cm.powerapps.com/"},de:{graphql:"https://graph-make.de-cm001.gateway.prod.cm.powerapps.com/"},fr:{graphql:"https://graph-make.fr-cm001.gateway.prod.cm.powerapps.com/"},no:{graphql:"https://graph-make.no-cm001.gateway.prod.cm.powerapps.com/"},default:{graphql:"https://graph-make.eu-cm001.gateway.prod.cm.powerapps.com/"}}},...jt}),jt||{aadClientId:"a8f7a65c-f5ba-4859-b2d6-df772c264e9d",location:"cus",region:"test",publicPath:"/",graphQLEndpoint:"https://graph.make.test.powerapps.com/"})}var jt,Qo=D(()=>{"use strict";});function vh(e,t,r){if(!e)return Xo.has(e)||(window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoIsEmpty"}),Xo.add("")),!1;if(e){if(e=e.toLowerCase(),Xo.has(e))return!1;if(!(e in t))return window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoNonExistent",eventInfo:{missinggeo:e,parent:r}}),Xo.add(e),!1}return!0}function yO(e){return vh(e,dc,"Location dictionary")?dc[e.toLowerCase()]:"us"}function CO(){let e=mr().location.toLowerCase();return vh(e,dc,"Current location dictionary")?e:"us"}var Xo,dc,w8,bh=D(()=>{"use strict";Qo();Xo=new Set,dc={cae:"ae",nae:"ae",eas:"as",seas:"as",eau:"au",seau:"au",sbr:"br",cca:"ca",eca:"ca",nch:"ch",wch:"ch",nde:"de",wcde:"de",neu:"eu",weu:"eu",cfr:"fr",sfr:"fr",cin:"in",sin:"in",ejp:"jp",wjp:"jp",suk:"uk",wuk:"uk",eus:"us",wus:"us",cus:"us",ude:"us",udc:"us",ugtx:"us",ugva:"us",eus2:"us",wus2:"us",nza:"za",wza:"za",cne2:"cn",cnn2:"cn",skr:"kr",ckr:"kr",eno:"no",wno:"no",wrx:"us",erx:"us",wex:"us",eex:"us",unitedstates:"us",europe:"eu",asia:"as",australia:"au",japan:"jp",canada:"ca",india:"in",italy:"it",unitedstatesfirstrelease:"us",unitedkingdom:"uk",southamerica:"br",france:"fr",unitedarabemirates:"ae",germany:"de",sweden:"se",switzerland:"ch",korea:"kr",norway:"no",usgov:"us",usgovhigh:"us",usdod:"us",china:"cn",usnat:"us",ussec:"us",southafrica:"za",singapore:"sg",newzealand:"nz",poland:"pl",qatar:"qa",as:"as",au:"au",ca:"ca",in:"in",jp:"jp",kr:"kr",nz:"nz",ae:"ae",qa:"qa",us:"us",uk:"uk",eu:"eu",de:"de",ch:"ch",no:"no",fr:"fr",se:"se",it:"it",pl:"pl",be:"eu",bel:"eu",gr:"eu",grc:"eu",lt:"eu",ltu:"eu",pt:"eu",prt:"eu",bg:"eu",bgr:"eu",es:"eu",esp:"eu",lu:"eu",lux:"eu",ro:"eu",rou:"eu",cz:"eu",cze:"eu",hu:"eu",hun:"eu",si:"eu",svn:"eu",dk:"eu",dnk:"eu",hr:"eu",hrv:"eu",mt:"eu",mlt:"eu",sk:"eu",svk:"eu",nit:"it",nl:"eu",nld:"eu",fi:"eu",fin:"eu",ee:"eu",est:"eu",cy:"eu",cyp:"eu",at:"eu",aut:"eu",swe:"se",cse:"se",ie:"eu",irl:"eu",lv:"eu",lva:"eu",cpl:"pl",nnz:"nz",cqa:"qa",sg:"sg",br:"br",za:"za",sa:"za"};w8=yO(CO())});var x,S8,yh=D(()=>{"use strict";x={USWest:"westus",USWest2:"westus2",USCentral:"centralus",USEast:"eastus",USEast2:"eastus2",USNorthCentral:"northcentralus",USSouthCentral:"southcentralus",USWestCentral:"westcentralus",CanadaCentral:"canadacentral",CanadaEast:"canadaeast",BrazilSouth:"brazilsouth",EuropeNorth:"northeurope",EuropeWest:"westeurope",UKSouth:"uksouth",UKWest:"ukwest",FranceCentral:"francecentral",FranceSouth:"francesouth",SwitzerlandNorth:"switzerlandnorth",SwitzerlandWest:"switzerlandwest",GermanyNorth:"germanynorth",GermanyWestCentral:"germanywestcentral",NorwayWest:"norwaywest",NorwayEast:"norwayeast",SwedenCentral:"swedencentral",ItalyNorth:"italynorth",PolandCentral:"polandcentral",AsiaEast:"eastasia",AsiaSouthEast:"southeastasia",JapanEast:"japaneast",JapanWest:"japanwest",AustraliaEast:"australiaeast",AustraliaSouthEast:"australiasoutheast",AustraliaCentral:"australiacentral",AustraliaCentral2:"australiacentral2",IndiaCentral:"centralindia",IndiaSouth:"southindia",IndiaWest:"westindia",KoreaSouth:"koreasouth",KoreaCentral:"koreacentral",NewZealandNorth:"newzealandnorth",UAECentral:"uaecentral",UAENorth:"uaenorth",SouthAfricaNorth:"southafricanorth",SouthAfricaWest:"southafricawest",QatarCentral:"qatarcentral",GermanyCentral:"germanycentral",GermanyNorthEast:"germanynortheast",SingaporeSouthEast:"southeastasia",GovernmentUSVirginia:"usgovvirginia",GovernmentUSIowa:"usgoviowa",GovernmentUSArizona:"usgovarizona",GovernmentUSTexas:"usgovtexas",GovernmentUSDodEast:"usdodeast",GovernmentUSDodCentral:"usdodcentral",ChinaNorth:"chinanorth",ChinaNorth2:"chinanorth2",ChinaNorth3:"chinanorth3",ChinaEast:"chinaeast",ChinaEast2:"chinaeast2",ChinaEast3:"chinaeast3",UssecEast:"usseceast",UssecWest:"ussecwest",UsnatEast:"usnateast",UsnatWest:"usnatwest"},S8={[x.USWest]:{geoName:"us",regionShortName:"wus"},[x.USCentral]:{geoName:"us",regionShortName:"cus"},[x.USEast]:{geoName:"us",regionShortName:"eus"},[x.USEast2]:{geoName:"us",regionShortName:"eus2"},[x.USWestCentral]:{geoName:"us",regionShortName:"wcus"},[x.USWest2]:{geoName:"us",regionShortName:"wus2"},[x.USSouthCentral]:{geoName:"br",regionShortName:"scus"},[x.BrazilSouth]:{geoName:"br",regionShortName:"sbr"},[x.UKSouth]:{geoName:"uk",regionShortName:"suk"},[x.UKWest]:{geoName:"uk",regionShortName:"wuk"},[x.JapanEast]:{geoName:"jp",regionShortName:"ejp"},[x.JapanWest]:{geoName:"jp",regionShortName:"wjp"},[x.IndiaCentral]:{geoName:"in",regionShortName:"cin"},[x.IndiaSouth]:{geoName:"in",regionShortName:"sin"},[x.ItalyNorth]:{geoName:"it",regionShortName:"nit"},[x.GermanyWestCentral]:{geoName:"de",regionShortName:"wcde"},[x.GermanyNorth]:{geoName:"de",regionShortName:"nde"},[x.EuropeNorth]:{geoName:"eu",regionShortName:"neu"},[x.EuropeWest]:{geoName:"eu",regionShortName:"weu"},[x.AustraliaEast]:{geoName:"au",regionShortName:"eau"},[x.AustraliaSouthEast]:{geoName:"au",regionShortName:"seau"},[x.AsiaSouthEast]:{geoName:"as",regionShortName:"seas"},[x.AsiaEast]:{geoName:"as",regionShortName:"eas"},[x.CanadaCentral]:{geoName:"ca",regionShortName:"cca"},[x.CanadaEast]:{geoName:"ca",regionShortName:"eca"},[x.SouthAfricaNorth]:{geoName:"za",regionShortName:"nza"},[x.SouthAfricaWest]:{geoName:"za",regionShortName:"wza"},[x.FranceCentral]:{geoName:"fr",regionShortName:"cfr"},[x.FranceSouth]:{geoName:"fr",regionShortName:"sfr"},[x.UAENorth]:{geoName:"ae",regionShortName:"nae"},[x.UAECentral]:{geoName:"ae",regionShortName:"cae"},[x.SwedenCentral]:{geoName:"se",regionShortName:"cse"},[x.SwitzerlandNorth]:{geoName:"ch",regionShortName:"nch"},[x.SwitzerlandWest]:{geoName:"ch",regionShortName:"wch"},[x.NorwayEast]:{geoName:"no",regionShortName:"eno"},[x.NorwayWest]:{geoName:"no",regionShortName:"wno"},[x.KoreaCentral]:{geoName:"kr",regionShortName:"ckr"},[x.KoreaSouth]:{geoName:"kr",regionShortName:"skr"},[x.SingaporeSouthEast]:{geoName:"sg",regionShortName:"seas"},[x.PolandCentral]:{geoName:"pl",regionShortName:"cpl"},[x.QatarCentral]:{geoName:"qa",regionShortName:"cqa"},[x.NewZealandNorth]:{geoName:"nz",regionShortName:"nnz"},[x.GovernmentUSTexas]:{geoName:"us",regionShortName:"ugtx"},[x.GovernmentUSVirginia]:{geoName:"us",regionShortName:"ugva"},[x.GovernmentUSDodCentral]:{regionShortName:"udc"},[x.GovernmentUSDodEast]:{regionShortName:"ude"},[x.ChinaEast]:{regionShortName:"cne"},[x.ChinaEast2]:{regionShortName:"cne2"},[x.ChinaEast3]:{regionShortName:"cne3"},[x.ChinaNorth]:{regionShortName:"cnn"},[x.ChinaNorth2]:{regionShortName:"cnn2"},[x.ChinaNorth3]:{regionShortName:"cnn3"},[x.UssecEast]:{geoName:"us",regionShortName:"erx"},[x.UssecWest]:{geoName:"us",regionShortName:"wrx"},[x.UsnatEast]:{geoName:"us",regionShortName:"eex"},[x.UsnatWest]:{geoName:"us",regionShortName:"wex"}}});var Ch=D(()=>{"use strict";Qo();});var ua=D(()=>{"use strict";Qo();bh();yh();Ch();});function ca(e,t){return Ah?Ah.isOverridden(e,t):{overridden:!1}}var Ah,da=D(()=>{"use strict";});var pc=D(()=>{"use strict";ua();da();});function AO(e,t){let{region:r}=mr();return()=>{let n=e.settings[t];if(n.allowOverrides){let s=ca(e.packageName,t);if(s.overridden)return typeof s.value=="string"?wO(s.value):s.value}let a=n.values,o=process.env.SETTINGS_FALLBACK_REGION?.[r];return a[r]!==void 0?a[r]:o&&a[o]!==void 0?a[o]:a.default}}function wO(e){return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}function NO(e){let t=e.packageName;if(Ko.has(t)){let r=`settings has already been created for this package ${t}`;throw console.error(r),new Error(r)}if(Object.keys(e.settings).some(r=>mc(t,r))){let r=`error parsing settings config for package ${t}, a feature gate with the same name exists`;throw console.error(r),new Error(r)}Object.keys(e.settings).forEach(r=>{if(Object.keys(e.settings[r].values).filter(i=>i!=="default").some(i=>!Zo(i))){let i=`error parsing settings config for package ${t}, setting ${r} has invalid region`;throw console.error(i),new Error(i)}})}function pa(e){NO(e);let t={};return Object.keys(e.settings).forEach(r=>{t[r]={enumerable:!0,get:AO(e,r)}}),Ko.set(e.packageName,e),Object.defineProperties({},t)}function fc(e,t){return Ko.has(e)?!!Ko.get(e).settings[t]:!1}var Ko,Yo=D(()=>{"use strict";ua();da();hc();fa();Ko=new Map});function wh(e,t){let{region:r}=mr();return()=>{let n=ca(e.packageName,t);if(n.overridden)return n.value.toString()==="true";let i=e.features[t].enabledFor,a=process.env.SETTINGS_FALLBACK_REGION?.[r];return i[r]!==void 0?!!i[r]:a&&i[a]!==void 0?!!i[a]:!1}}function SO(e){let t=e.packageName;if(es.has(t)){let r="feature gates has already been created for this package";throw console.error(r),new Error(r)}if(Object.keys(e.features).some(r=>fc(t,r))){let r=`error parsing feature gates config for package ${t}, a setting with the same name exists`;throw console.error(r),new Error(r)}Object.keys(e.features).forEach(r=>{if(Object.keys(e.features[r].enabledFor).some(i=>!Zo(i))){let i=`error parsing feature gates config for package ${t}, feature ${r} has invalid region`;throw console.error(i),new Error(i)}})}function gc(e){SO(e);let t={};Object.keys(e.features).forEach(i=>{t[i]={enumerable:!0,configurable:!0,get:wh(e,i)}});let r={},n=new Set;return t.dangerouslySet={enumerable:!1,value:(i,a)=>{n.add(i),Object.defineProperty(r,i,{enumerable:!0,configurable:!0,value:a})}},t.dangerouslyReset={enumerable:!1,value:()=>{let i={};n.forEach(a=>{i[a.toString()]={enumerable:!0,configurable:!0,get:wh(e,a.toString())}}),Object.defineProperties(r,i),n.clear()}},es.set(e.packageName,e),Object.defineProperties(r,t)}function mc(e,t){return es.has(e)?!!es.get(e).features[t]:!1}var es,hc=D(()=>{"use strict";ua();fa();da();Yo();es=new Map});var Sh=m((Q8,Nh)=>{"use strict";Nh.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return!1;switch(r){case"http":case"ws":return t!==80;case"https":case"wss":return t!==443;case"ftp":return t!==21;case"gopher":return t!==70;case"file":return!1}return t!==0}});var Ih=m(vc=>{"use strict";var DO=Object.prototype.hasOwnProperty,EO;function Dh(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Eh(e){try{return encodeURIComponent(e)}catch{return null}}function IO(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var i=Dh(n[1]),a=Dh(n[2]);i===null||a===null||i in r||(r[i]=a)}return r}function _O(e,t){t=t||"";var r=[],n,i;typeof t!="string"&&(t="?");for(i in e)if(DO.call(e,i)){if(n=e[i],!n&&(n===null||n===EO||isNaN(n))&&(n=""),i=Eh(i),n=Eh(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""}vc.stringify=_O;vc.parse=IO});var Cc=m((K8,Rh)=>{"use strict";var Ph=Sh(),ts=Ih(),Oh=/[\n\r\t]/g,PO=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,OO=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,FO=/^[a-zA-Z]:/,TO=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;function yc(e){return(e||"").toString().replace(TO,"")}var bc=[["#","hash"],["?","query"],function(t,r){return Ht(r.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],_h={hash:1,query:1};function Fh(e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={};var r=t.location||{};e=e||r;var n={},i=typeof e,a;if(e.protocol==="blob:")n=new Jt(unescape(e.pathname),{});else if(i==="string"){n=new Jt(e,{});for(a in _h)delete n[a]}else if(i==="object"){for(a in e)a in _h||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=PO.test(e.href))}return n}function Ht(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function Th(e,t){e=yc(e),e=e.replace(Oh,""),t=t||{};var r=OO.exec(e),n=r[1]?r[1].toLowerCase():"",i=!!r[2],a=!!r[3],o=0,s;return i?a?(s=r[2]+r[3]+r[4],o=r[2].length+r[3].length):(s=r[2]+r[4],o=r[2].length):a?(s=r[3]+r[4],o=r[3].length):s=r[4],n==="file:"?o>=2&&(s=s.slice(2)):Ht(n)?s=r[4]:n?i&&(s=s.slice(2)):o>=2&&Ht(t.protocol)&&(s=r[4]),{protocol:n,slashes:i||Ht(n),slashesCount:o,rest:s}}function RO(e,t){if(e==="")return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,i=r[n-1],a=!1,o=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),o++):o&&(n===0&&(a=!0),r.splice(n,1),o--);return a&&r.unshift(""),(i==="."||i==="..")&&r.push(""),r.join("/")}function Jt(e,t,r){if(e=yc(e),e=e.replace(Oh,""),!(this instanceof Jt))return new Jt(e,t,r);var n,i,a,o,s,l,u=bc.slice(),c=typeof t,d=this,f=0;for(c!=="object"&&c!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=ts.parse),t=Fh(t),i=Th(e||"",t),n=!i.protocol&&!i.slashes,d.slashes=i.slashes||n&&t.slashes,d.protocol=i.protocol||t.protocol||"",e=i.rest,(i.protocol==="file:"&&(i.slashesCount!==2||FO.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!Ht(d.protocol)))&&(u[3]=[/(.*)/,"pathname"]);f<u.length;f++){if(o=u[f],typeof o=="function"){e=o(e,d);continue}a=o[0],l=o[1],a!==a?d[l]=e:typeof a=="string"?(s=a==="@"?e.lastIndexOf(a):e.indexOf(a),~s&&(typeof o[2]=="number"?(d[l]=e.slice(0,s),e=e.slice(s+o[2])):(d[l]=e.slice(s),e=e.slice(0,s)))):(s=a.exec(e))&&(d[l]=s[1],e=e.slice(0,s.index)),d[l]=d[l]||n&&o[3]&&t[l]||"",o[4]&&(d[l]=d[l].toLowerCase())}r&&(d.query=r(d.query)),n&&t.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||t.pathname!=="")&&(d.pathname=RO(d.pathname,t.pathname)),d.pathname.charAt(0)!=="/"&&Ht(d.protocol)&&(d.pathname="/"+d.pathname),Ph(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(s=d.auth.indexOf(":"),~s?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&Ht(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function xO(e,t,r){var n=this;switch(e){case"query":typeof t=="string"&&t.length&&(t=(r||ts.parse)(t)),n[e]=t;break;case"port":n[e]=t,Ph(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,/:\d+$/.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(t){var i=e==="pathname"?"/":"#";n[e]=t.charAt(0)!==i?i+t:t}else n[e]=t;break;case"username":case"password":n[e]=encodeURIComponent(t);break;case"auth":var a=t.indexOf(":");~a?(n.username=t.slice(0,a),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(a+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t))}for(var o=0;o<bc.length;o++){var s=bc[o];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Ht(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function LO(e){(!e||typeof e!="function")&&(e=ts.stringify);var t,r=this,n=r.host,i=r.protocol;i&&i.charAt(i.length-1)!==":"&&(i+=":");var a=i+(r.protocol&&r.slashes||Ht(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&Ht(r.protocol)&&!n&&r.pathname!=="/"&&(a+="@"),n[n.length-1]===":"&&(n+=":"),a+=n+r.pathname,t=typeof r.query=="object"?e(r.query):r.query,t&&(a+=t.charAt(0)!=="?"?"?"+t:t),r.hash&&(a+=r.hash),a}Jt.prototype={set:xO,toString:LO};Jt.extractProtocol=Th;Jt.location=Fh;Jt.trimLeft=yc;Jt.qs=ts;Rh.exports=Jt});var MO,xh=D(()=>{"use strict";MO=ne(Cc());});function Ac(e,t,r){let n=Object.keys(r).sort();if(n.length===0)throw new Error(`ECS feature has no properties: ${e}.${t}`);let i=`ecs.${e}.${t}`;return n.length===1?`${i}.${n[0]}`:`${i}.{${n.join(";")}}`}var rs=D(()=>{"use strict";});var wc,Nc,Sc=D(()=>{"use strict";rs();wc=class{features=new Map;register(t,r){let n=Ac(r,t.teamName,t.fallback),i={clientName:r,teamName:t.teamName,fullName:n,description:t.description,owners:t.owners,ecsURL:t.ecsURL,createdOn:t.createdOn,fallbackConfig:t.fallback,feature:t,displayTeam:t.displayTeam,tags:t.tags,category:t.category};this.features.set(n,i)}getAll(){return Array.from(this.features.values())}get(t){return this.features.get(t)}has(t){return this.features.has(t)}getByClient(t){return this.getAll().filter(r=>r.clientName===t)}getByTeam(t){return this.getAll().filter(r=>r.teamName===t)}search(t){let r=t.toLowerCase();return this.getAll().filter(n=>n.fullName.toLowerCase().includes(r)||n.description?.toLowerCase().includes(r)||n.teamName.toLowerCase().includes(r)||n.clientName.toLowerCase().includes(r))}getClientNames(){let t=new Set;return this.features.forEach(r=>t.add(r.clientName)),Array.from(t)}getTeamNames(){let t=new Set;return this.features.forEach(r=>t.add(r.teamName)),Array.from(t)}clear(){this.features.clear()}},Nc=new wc});var Dc=D(()=>{"use strict";});function Zo(e){return UO.has(e)}var UO,fa=D(()=>{"use strict";pc();hc();Yo();da();pc();xh();Sc();rs();Dc();UO=new Set(["tie","test","prod","preview","preprod","gov","high","dod","mooncake","ex","rx"])});var BO,Lh=D(()=>{"use strict";fa();BO=pa({packageName:"cds-designer-models",settings:{testCustomControls:{description:"Test Custom Controls to show up in the component picker.",allowOverrides:!0,values:{default:"",test:"",preprod:"",preview:"",gov:""}}}})});var ns,O,L,nn,Vn,is,Mh,Uh,Ec,ma=D(()=>{"use strict";la();ns=class{name;constructor(t){this.name=t}toString(){return this.name}getName(){return this.name}getDisplayNameResourceKey(){return Ec.getDisplayNameResourceKey(this.name)}};(function(e){e.BigInt="BigIntType",e.CalendarRulesType="CalendarRulesType",e.Currency="MoneyType",e.Customer="Customer",e.CustomerType="CustomerType",e.DateTime="DateTimeType",e.DecimalNumber="DecimalType",e.EntityNameType="EntityNameType",e.FloatingPointNumber="DoubleType",e.Image="ImageType",e.File="FileType",e.Lookup="Lookup",e.LookupType="LookupType",e.ManagedPropertyType="ManagedPropertyType",e.MultipleLineofText="MemoType",e.MultiSelectOptionSet="MultiSelectPicklistType",e.OptionSet="PicklistType",e.Owner="Owner",e.OwnerType="OwnerType",e.PartyList="PartyList",e.PartyListType="PartyListType",e.PrimaryNameAttributeType="String",e.SingleLineofText="StringType",e.State="StateType",e.Status="StatusType",e.Subject="Subject",e.TimeStamp="TimeStampType",e.TwoOptions="BooleanType",e.UniqueIdentifier="Uniqueidentifier",e.UniqueIdentifierType="UniqueidentifierType",e.VirtualType="VirtualType",e.WholeNumber="IntegerType"})(O||(O={}));(function(e){e.Email="Email",e.Text="Text",e.TextArea="TextArea",e.Url="Url",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.Phone="Phone",e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime",e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean",e.Regarding="Regarding"})(L||(L={}));nn=class extends ns{constructor(t){super(t)}static get None(){return"None"}static get SystemRequired(){return"SystemRequired"}static get ApplicationRequired(){return"ApplicationRequired"}static get Recommended(){return"Recommended"}},Vn=class e extends ns{constructor(t){super(t),t||(this.name=e.None)}static get None(){return"None"}static get Persistent(){return"Persistent"}static get Calculated(){return"Calculated"}static get Rollup(){return"Rollup"}GetValue(){return this.name===e.None?is.Persistent:parseInt(is[this.name])}};(function(e){e[e.Persistent=0]="Persistent",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup"})(is||(is={}));(function(e){e[e.Undefined=0]="Undefined",e[e.Simple=1]="Simple",e[e.Related=2]="Related",e[e.Logical=4]="Logical",e[e.Calculated=8]="Calculated",e[e.Rollup=16]="Rollup",e[e.Invalid=32]="Invalid"})(Mh||(Mh={}));(function(e){e[e.Attribute=0]="Attribute",e[e.Organization=1]="Organization",e[e.Currency=2]="Currency"})(Uh||(Uh={}));Ec=class e{static resourceKeyMap=e.initResourceKeyMap();static initResourceKeyMap(){let t=new kn;return t.add(O.TwoOptions,"SystemCustomization.type.bit.label"),t.add(O.Customer,"SystemCustomization.type.customer.label"),t.add(O.CustomerType,"SystemCustomization.type.customer.label"),t.add(O.DateTime,"SystemCustomization.type.datetime.label"),t.add(O.DecimalNumber,"SystemCustomization.type.decimal.label"),t.add(O.FloatingPointNumber,"SystemCustomization.type.float.label"),t.add(O.WholeNumber,"SystemCustomization.type.int.label"),t.add(O.LookupType,"SystemCustomization.type.lookup.label"),t.add(O.Lookup,"SystemCustomization.type.lookup.label"),t.add(O.MultipleLineofText,"SystemCustomization.type.ntext.label"),t.add(O.Currency,"SystemCustomization.type.money.label"),t.add(O.Owner,"SystemCustomization.type.owner.label"),t.add(O.OwnerType,"SystemCustomization.type.owner.label"),t.add(O.PartyList,"SystemCustomization.type.partylist.label"),t.add(O.PartyListType,"SystemCustomization.type.partylist.label"),t.add(O.OptionSet,"SystemCustomization.type.picklist.label"),t.add(O.State,"SystemCustomization.type.state.label"),t.add(O.Status,"SystemCustomization.type.status.label"),t.add(O.SingleLineofText,"SystemCustomization.type.nvarchar.label"),t.add(O.UniqueIdentifier,"SystemCustomization.type.uniqueidentifier.label"),t.add(O.UniqueIdentifierType,"SystemCustomization.type.uniqueidentifiertype.label"),t.add(O.CalendarRulesType,"SystemCustomization.type.calendarrules.label"),t.add(O.VirtualType,"SystemCustomization.type.virtual.label"),t.add(O.BigInt,"SystemCustomization.type.bigint.label"),t.add(O.ManagedPropertyType,"SystemCustomization.type.managedproperty.label"),t.add(O.EntityNameType,"SystemCustomization.type.entityname.label"),t.add(O.Image,"SystemCustomization.type.image.label"),t.add(O.MultiSelectOptionSet,"SystemCustomization.type.multiselectpicklist.label"),t.add(O.PrimaryNameAttributeType,"SystemCustomization.type.primaryname.label"),t.add(O.LookupType,"SystemCustomization.type.lookuptype.label"),t.add(O.Subject,"SystemCustomization.type.subject.label"),t.add(L.Email,"SystemCustomization.String.Format.email"),t.add(L.Text,"SystemCustomization.String.Format.text"),t.add(L.TextArea,"SystemCustomization.String.Format.textarea"),t.add(L.Url,"SystemCustomization.String.Format.url"),t.add(L.TickerSymbol,"SystemCustomization.String.Format.tickersymbol"),t.add(L.PhoneticGuide,"SystemCustomization.String.Format.phoneticguide"),t.add(L.VersionNumber,"SystemCustomization.String.Format.versionnumber"),t.add(L.Phone,"SystemCustomization.String.Format.phone"),t.add(L.None,"SystemCustomization.Integer.Format."),t.add(L.Duration,"SystemCustomization.Integer.Format.duration"),t.add(L.TimeZone,"SystemCustomization.Integer.Format.timezone"),t.add(L.Language,"SystemCustomization.Integer.Format.language"),t.add(L.Locale,"SystemCustomization.Integer.Format.language"),t.add(L.DateOnly,"SystemCustomization.DateTime.Format.date"),t.add(L.DateAndTime,"SystemCustomization.DateTime.Format.datetime"),t.add(L.Regarding,"SystemCustomization.Lookup.Format.regarding"),t.add(Vn.Persistent,"SystemCustomization.String.Source.persistent"),t.add(Vn.Calculated,"SystemCustomization.String.Source.calculated"),t.add(Vn.Rollup,"SystemCustomization.String.Source.rollup"),t.add(Vn.None,"SystemCustomization.String.Source.none"),t}static getDisplayNameResourceKey(t){return e.resourceKeyMap.getValue(t)}}});var $h,_c,Gn,an,Ic,as,zn,hr,se,Bh,kh,qh,Tt=D(()=>{"use strict";$h={ThreeEqColumn_FirstColumn:34,ThreeEqColumn_SecondColumn:33,ThreeEqColumn_ThirdColumn:33,FiveEqColumn:20},_c={ONE_COLUMN:"1",TWO_COLUMN:"2",THREE_COLUMN:"3",FOUR_COLUMN:"4"};(function(e){e[e.SUBGRID=0]="SUBGRID",e[e.SPACER=1]="SPACER",e[e.QUICK_VIEW=2]="QUICK_VIEW",e[e.WEB_RESOURCE=3]="WEB_RESOURCE",e[e.IFRAME=4]="IFRAME",e[e.BING_MAPS=5]="BING_MAPS",e[e.TIMER=6]="TIMER",e[e.TIMELINE=7]="TIMELINE",e[e.SOCIAL_INSIGHTS=8]="SOCIAL_INSIGHTS",e[e.KB_SEARCH=9]="KB_SEARCH",e[e.ACI_CONTROL=10]="ACI_CONTROL",e[e.RELATIONSHIP_ASSISTANT=11]="RELATIONSHIP_ASSISTANT",e[e.REFERENCE_PANEL=12]="REFERENCE_PANEL",e[e.REF_PANEL_QUICKVIEW=13]="REF_PANEL_QUICKVIEW",e[e.REF_PANEL_SUBGRID=14]="REF_PANEL_SUBGRID",e[e.REF_PANEL_KBSEARCH=15]="REF_PANEL_KBSEARCH",e[e.WEB_RESOURCE_HTML=16]="WEB_RESOURCE_HTML",e[e.PRED_LEAD_SCORING=17]="PRED_LEAD_SCORING"})(Gn||(Gn={}));(function(e){e.Left="Left",e.Right="Right",e.Center="Center"})(an||(an={}));(function(e){e[e.Mobile=0]="Mobile",e[e.Tablet=1]="Tablet",e[e.Web=2]="Web"})(Ic||(Ic={}));as=class{static ONE_COLUMN=1;static TWO_COLUMN=2;static THREE_COLUMN=3;static FIVE_COLUMN=5};(function(e){e.Left="Left",e.Top="Top"})(zn||(zn={}));hr=class{static StartTag="<"},se={ShowLabel:"true",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_",labelAlignment:an.Left,labelPosition:zn.Left,MarginalControlColumns:"111",referencePanelNamePrefix:"ref_pan_"};(function(e){e.AddFormBodyFieldToReadOnlyHeader="AddFormBodyFieldToReadOnlyHeader",e.AddFieldPaneFieldToReadOnlyHeader="AddFieldPaneFieldToReadOnlyHeader",e.AddFieldExceedsReadOnlyHeaderLimit="AddFieldExceedsReadOnlyHeaderLimit",e.AddCustomComponentToReadOnlyHeader="AddCustomComponentToReadOnlyHeader",e.AddNonDisplayableComponentToReadOnlyHeader="AddNonDisplayableComponentToReadOnlyHeader",e.AddFieldToFlyoutOnly="AddFieldToFlyoutOnly",e.DisplayedFieldToFlyout="DisplayedFieldToFlyout",e.FlyoutFieldToDisplayed="FlyoutFieldToDisplayed",e.AddControlBeforeDefaultLabel="AddControlBeforeDefaultLabel"})(Bh||(Bh={}));(function(e){e.TabWithLockedFieldRemoval="TabWithLockedFieldRemoval",e.SectionWithLockedFieldRemoval="SectionWithLockedFieldRemoval",e.LockedSectionRemoval="LockedSectionRemoval",e.LockedFieldRemoval="LockedFieldRemoval",e.RequiredFieldRemoval="RequiredFieldRemoval",e.LastRemainingTab="LastRemainingTab",e.UnknownRemoval="UnknownRemoval"})(kh||(kh={}));(function(e){e.IsHeader="IsHeader",e.IsFooter="IsFooter",e.ContainedInHeader="ContainedInHeader",e.ContainedInFooter="ContainedInFooter",e.NoElementFound="NoElementFound",e.NoTarget="NoTarget",e.CannotAddControlToHeader="CannotAddControlToHeader",e.CannotAddControlToFooter="CannotAddControlToFooter"})(qh||(qh={}))});var ha=m(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.DateTimeBehavior=C.PrecisionSource=C.StringFormatName=C.SourceType=C.ImeMode=C.SolutionEntityTypeCodeExtToComponentTypeCode=C.SolutionComponentTypeCodeToEntityTypeCodeExt=C.SolutionComponentVirtualAttributeSubtype=C.EntityTypeCode=C.SolutionComponentTypeCodeExt=C.RootComponentBehavior=C.SolutionComponentTypeCode=C.EntityKeyIndexStatus=C.ViewStateCode=C.ViewStatusCode=C.RelationshipSecurityTypes=C.CascadeType=C.RelationshipTypeExt=C.RelationshipType=C.AppSubType=C.BusinessProcessType=C.WorkflowCategory=C.WorkflowScope=C.WorkflowTypeCode=C.StatusCodeEnabledDisabled=C.StateCodeEnabledDisabled=C.StatusCode=C.StateCode=C.OptionSetType=C.AttributeTypeCodeNum=C.AttributeFormatName=C.AttributeFormatCode=C.AttributeTypeName=C.AttributeTypeCode=C.PluginSourceType=C.AuthType=C.PluginIsolationMode=C.ComponentState=C.ChartType=C.ChartsType=C.ViewType=C.AttributeType=C.ActivationState=C.FormPresentation=C.FormType=C.TableTypeCode=C.TableTypes=C.ActivityTypeMask=C.PrincipalType=C.OwnershipTypes=void 0;C.QueryType=C.KnownCustomSolutionComponentEntitySetName=C.TeamTypeEnum=C.EnvironmentVariableDefinitionTypeEnum=C.ConnectorTypeEnum=C.RoleInheritance=C.DefaultRoleTemplates=C.DeleteDependencyErrorCode=C.ServiceEndpointConnectionMode=C.ServiceEndpointContract=C.ServiceNamespaceFormat=C.ConnectionRoleCategory=C.ReportTypeCode=C.SdkMessageProcessingMode=C.SupportedDeployment=C.SdkMessageProcessingStage=C.WebResourceTypeCode=C.IntegerFormat=C.DateTimeFormat=void 0;var Vh;(function(e){e.None="None",e.UserOwned="UserOwned",e.TeamOwned="TeamOwned",e.BusinessOwned="BusinessOwned",e.OrganizationOwned="OrganizationOwned",e.BusinessParented="BusinessParented",e.Filtered="Filtered"})(Vh||(C.OwnershipTypes=Vh={}));var Gh;(function(e){e.User="Microsoft.Dynamics.CRM.systemuser",e.Team="Microsoft.Dynamics.CRM.team"})(Gh||(C.PrincipalType=Gh={}));var zh;(function(e){e[e.DoNotDisplayInActivityMenus=0]="DoNotDisplayInActivityMenus",e[e.DisplayInActivityMenus=1]="DisplayInActivityMenus"})(zh||(C.ActivityTypeMask=zh={}));var Wh;(function(e){e.Activity="Activity",e.Virtual="Virtual",e.Standard="Standard",e.Elastic="Elastic"})(Wh||(C.TableTypes=Wh={}));var jh;(function(e){e.Standard="Standard",e.Virtual="Virtual",e.Elastic="Elastic"})(jh||(C.TableTypeCode=jh={}));var Hh;(function(e){e[e.Dashboard=0]="Dashboard",e[e.AppointmentBook=1]="AppointmentBook",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.MobileExpress=5]="MobileExpress",e[e.QuickViewForm=6]="QuickViewForm",e[e.QuickCreate=7]="QuickCreate",e[e.Dialog=8]="Dialog",e[e.TaskFlowForm=9]="TaskFlowForm",e[e.InteractionCentricDashboard=10]="InteractionCentricDashboard",e[e.Card=11]="Card",e[e.MainInteractiveExperience=12]="MainInteractiveExperience",e[e.Other=100]="Other",e[e.MainBackup=101]="MainBackup",e[e.AppointmentBookBackup=102]="AppointmentBookBackup",e[e.PowerBIDashboard=103]="PowerBIDashboard"})(Hh||(C.FormType=Hh={}));var Jh;(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(Jh||(C.FormPresentation=Jh={}));var Qh;(function(e){e[e.Inactive=0]="Inactive",e[e.Active=1]="Active"})(Qh||(C.ActivationState=Qh={}));var Xh;(function(e){e[e.String=0]="String",e[e.Number=1]="Number",e[e.Picklist=2]="Picklist"})(Xh||(C.AttributeType=Xh={}));var Kh;(function(e){e[e.Public=0]="Public",e[e.AdvancedFind=1]="AdvancedFind",e[e.Associated=2]="Associated",e[e.QuickFind=4]="QuickFind",e[e.Lookup=64]="Lookup"})(Kh||(C.ViewType=Kh={}));var Yh;(function(e){e[e.ASPChart=0]="ASPChart",e[e.PowerBI=1]="PowerBI"})(Yh||(C.ChartsType=Yh={}));var Zh;(function(e){e[e.DataAndInteractionCentric=0]="DataAndInteractionCentric",e[e.InteractionCentric=1]="InteractionCentric"})(Zh||(C.ChartType=Zh={}));var eg;(function(e){e[e.Published=0]="Published",e[e.Unpublished=1]="Unpublished",e[e.Deleted=2]="Deleted",e[e.DeletedUnpublished=3]="DeletedUnpublished"})(eg||(C.ComponentState=eg={}));var tg;(function(e){e[e.None=1]="None",e[e.Sandbox=2]="Sandbox",e[e.External=3]="External"})(tg||(C.PluginIsolationMode=tg={}));var rg;(function(e){e[e.BasicAuth=0]="BasicAuth"})(rg||(C.AuthType=rg={}));var ng;(function(e){e[e.Database=0]="Database",e[e.Disk=1]="Disk",e[e.Normal=2]="Normal",e[e.AzureWebApp=3]="AzureWebApp"})(ng||(C.PluginSourceType=ng={}));var ig;(function(e){e.Boolean="Boolean",e.Customer="Customer",e.Date="Date",e.DateTime="DateTime",e.DateTimeNoTimeZone="DateTimeNoTimeZone",e.Decimal="Decimal",e.Double="Double",e.Integer="Integer",e.Lookup="Lookup",e.Memo="Memo",e.Money="Money",e.Owner="Owner",e.PartyList="PartyList",e.Picklist="Picklist",e.State="State",e.Status="Status",e.String="String",e.Uniqueidentifier="Uniqueidentifier",e.CalendarRules="CalendarRules",e.Virtual="Virtual",e.BigInt="BigInt",e.ManagedProperty="ManagedProperty",e.EntityName="EntityName"})(ig||(C.AttributeTypeCode=ig={}));var ag;(function(e){e.DateTimeType="DateTimeType",e.ImageType="ImageType",e.IntegerType="IntegerType",e.FileType="FileType",e.BooleanType="BooleanType",e.CustomerType="CustomerType",e.MemoType="MemoType",e.MultiSelectPicklistType="MultiSelectPicklistType",e.MoneyType="MoneyType",e.DecimalType="DecimalType",e.DoubleType="DoubleType",e.LookupType="LookupType",e.BigIntType="BigIntType",e.UniqueidentifierType="UniqueidentifierType",e.StringType="StringType",e.OwnerType="OwnerType",e.PicklistType="PicklistType",e.StateType="StateType",e.StatusType="StatusType",e.EntityNameType="EntityNameType"})(ag||(C.AttributeTypeName=ag={}));var og;(function(e){e.Email="Email",e.Text="Text",e.TextArea="TextArea",e.Url="Url",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.Phone="Phone",e.Json="Json",e.RichText="RichText",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime",e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(og||(C.AttributeFormatCode=og={}));var sg;(function(e){e.Text="Text",e.TextArea="TextArea",e.Email="Email",e.Url="Url",e.Phone="Phone",e.Json="Json",e.RichText="RichText",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(sg||(C.AttributeFormatName=sg={}));var lg;(function(e){e[e.Boolean=0]="Boolean",e[e.Customer=1]="Customer",e[e.DateTime=2]="DateTime",e[e.Decimal=3]="Decimal",e[e.Double=4]="Double",e[e.Integer=5]="Integer",e[e.Lookup=6]="Lookup",e[e.Memo=7]="Memo",e[e.Money=8]="Money",e[e.Owner=9]="Owner",e[e.PartyList=10]="PartyList",e[e.Picklist=11]="Picklist",e[e.State=12]="State",e[e.Status=13]="Status",e[e.String=14]="String",e[e.Uniqueidentifier=15]="Uniqueidentifier",e[e.CalendarRules=16]="CalendarRules",e[e.Virtual=17]="Virtual",e[e.BigInt=18]="BigInt",e[e.ManagedProperty=19]="ManagedProperty",e[e.EntityName=20]="EntityName"})(lg||(C.AttributeTypeCodeNum=lg={}));var ug;(function(e){e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean"})(ug||(C.OptionSetType=ug={}));var cg;(function(e){e[e.Draft=0]="Draft",e[e.Activated=1]="Activated"})(cg||(C.StateCode=cg={}));var dg;(function(e){e[e.Draft=1]="Draft",e[e.Activated=2]="Activated"})(dg||(C.StatusCode=dg={}));var pg;(function(e){e[e.Enabled=0]="Enabled",e[e.Disabled=1]="Disabled"})(pg||(C.StateCodeEnabledDisabled=pg={}));var fg;(function(e){e[e.Enabled=1]="Enabled",e[e.Disabled=2]="Disabled"})(fg||(C.StatusCodeEnabledDisabled=fg={}));var mg;(function(e){e[e.Definition=1]="Definition",e[e.Activation=2]="Activation",e[e.Template=3]="Template"})(mg||(C.WorkflowTypeCode=mg={}));var hg;(function(e){e[e.User=1]="User",e[e.BusinessUnit=2]="BusinessUnit",e[e.ParentChildBusinessUnit=3]="ParentChildBusinessUnit",e[e.Organization=4]="Organization"})(hg||(C.WorkflowScope=hg={}));var gg;(function(e){e[e.Workflow=0]="Workflow",e[e.Dialog=1]="Dialog",e[e.BusinessRule=2]="BusinessRule",e[e.Action=3]="Action",e[e.BusinessProcessFlow=4]="BusinessProcessFlow",e[e.Flow=5]="Flow",e[e.UIFlow=6]="UIFlow"})(gg||(C.WorkflowCategory=gg={}));var vg;(function(e){e[e.None=-1]="None",e[e.BusinessFlow=0]="BusinessFlow",e[e.TaskFlow=1]="TaskFlow"})(vg||(C.BusinessProcessType=vg={}));var bg;(function(e){e[e.CanvasApp=0]="CanvasApp",e[e.ComponentLibrary=1]="ComponentLibrary",e[e.CustomCanvasPage=2]="CustomCanvasPage",e[e.UnifiedApp=3]="UnifiedApp",e[e.CodeApp=4]="CodeApp",e[e.MobileApp=5]="MobileApp"})(bg||(C.AppSubType=bg={}));var yg;(function(e){e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(yg||(C.RelationshipType=yg={}));var Cg;(function(e){e.ManyToOneRelationship="ManyToOneRelationship",e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Cg||(C.RelationshipTypeExt=Cg={}));var Ag;(function(e){e.NoCascade="NoCascade",e.Cascade="Cascade",e.Active="Active",e.UserOwned="UserOwned",e.RemoveLink="RemoveLink",e.Restrict="Restrict"})(Ag||(C.CascadeType=Ag={}));var wg;(function(e){e.None="None",e.Append="Append",e.ParentChild="ParentChild",e.Pointer="Pointer",e.Inheritance="Inheritance"})(wg||(C.RelationshipSecurityTypes=wg={}));var Ng;(function(e){e[e.Active=1]="Active",e[e.Inactive=2]="Inactive"})(Ng||(C.ViewStatusCode=Ng={}));var Sg;(function(e){e[e.Active=0]="Active",e[e.Inactive=1]="Inactive"})(Sg||(C.ViewStateCode=Sg={}));var Dg;(function(e){e.Active="Active",e.Failed="Failed",e.InProgress="InProgress",e.Pending="Pending"})(Dg||(C.EntityKeyIndexStatus=Dg={}));var Eg;(function(e){e[e.Entity=1]="Entity",e[e.Attribute=2]="Attribute",e[e.OptionSet=9]="OptionSet",e[e.EntityRelationship=10]="EntityRelationship",e[e.EntityKey=14]="EntityKey",e[e.Role=20]="Role",e[e.DisplayString=22]="DisplayString",e[e.SavedQuery=26]="SavedQuery",e[e.Workflow=29]="Workflow",e[e.Report=31]="Report",e[e.Template=36]="Template",e[e.ContractTemplate=37]="ContractTemplate",e[e.KbArticleTemplate=38]="KbArticleTemplate",e[e.MailMergeTemplate=39]="MailMergeTemplate",e[e.RibbonCustomization=50]="RibbonCustomization",e[e.SavedQueryVisualization=59]="SavedQueryVisualization",e[e.SystemForm=60]="SystemForm",e[e.WebResource=61]="WebResource",e[e.SiteMap=62]="SiteMap",e[e.ConnectionRole=63]="ConnectionRole",e[e.HierarchyRule=65]="HierarchyRule",e[e.CustomControl=66]="CustomControl",e[e.FieldSecurityProfile=70]="FieldSecurityProfile",e[e.AppModule=80]="AppModule",e[e.PluginAssembly=91]="PluginAssembly",e[e.SdkMessageProcessingStep=92]="SdkMessageProcessingStep",e[e.ServiceEndpoint=95]="ServiceEndpoint",e[e.RoutingRule=150]="RoutingRule",e[e.SLA=152]="SLA",e[e.ConvertRule=154]="ConvertRule",e[e.MobileOfflineProfile=161]="MobileOfflineProfile",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.EntityDataSource=183]="EntityDataSource",e[e.SdkMessage=201]="SdkMessage",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.Tour=10061]="Tour"})(Eg||(C.SolutionComponentTypeCode=Eg={}));var Ig;(function(e){e[e.IncludeSubcomponents=0]="IncludeSubcomponents",e[e.DoNotIncludeSubcomponents=1]="DoNotIncludeSubcomponents",e[e.IncludeAsShellOnly=2]="IncludeAsShellOnly"})(Ig||(C.RootComponentBehavior=Ig={}));var os;(function(e){e[e.Entity=1]="Entity",e[e.Attribute=2]="Attribute",e[e.OptionSet=9]="OptionSet",e[e.EntityRelationship=10]="EntityRelationship",e[e.EntityKey=14]="EntityKey",e[e.Role=20]="Role",e[e.DisplayString=22]="DisplayString",e[e.SavedQuery=26]="SavedQuery",e[e.Workflow=29]="Workflow",e[e.Report=31]="Report",e[e.Template=36]="Template",e[e.ContractTemplate=37]="ContractTemplate",e[e.KbArticleTemplate=38]="KbArticleTemplate",e[e.MailMergeTemplate=39]="MailMergeTemplate",e[e.RibbonCustomization=50]="RibbonCustomization",e[e.SavedQueryVisualization=59]="SavedQueryVisualization",e[e.SystemForm=60]="SystemForm",e[e.WebResource=61]="WebResource",e[e.SiteMap=62]="SiteMap",e[e.ConnectionRole=63]="ConnectionRole",e[e.HierarchyRule=65]="HierarchyRule",e[e.CustomControl=66]="CustomControl",e[e.FieldSecurityProfile=70]="FieldSecurityProfile",e[e.AppModule=80]="AppModule",e[e.PluginAssembly=91]="PluginAssembly",e[e.SdkMessageProcessingStep=92]="SdkMessageProcessingStep",e[e.ServiceEndpoint=95]="ServiceEndpoint",e[e.RoutingRule=150]="RoutingRule",e[e.SLA=152]="SLA",e[e.ConvertRule=154]="ConvertRule",e[e.MobileOfflineProfile=161]="MobileOfflineProfile",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.EntityDataSource=183]="EntityDataSource",e[e.SdkMessage=201]="SdkMessage",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.DataWorkspace=10282]="DataWorkspace",e[e.Dashboard=100001]="Dashboard",e[e.InteractionCentricDashboard=100002]="InteractionCentricDashboard",e[e.Dialog=100003]="Dialog",e[e.PowerBIDashboard=100004]="PowerBIDashboard",e[e.BusinessRule=100021]="BusinessRule",e[e.ProcessFlow=100024]="ProcessFlow",e[e.Flow=100025]="Flow",e[e.UIFlow=100026]="UIFlow",e[e.ProcessNoFlow=100031]="ProcessNoFlow",e[e.AllDashboards=100032]="AllDashboards",e[e.FormsOnly=100033]="FormsOnly",e[e.ComponentLibrary=100034]="ComponentLibrary",e[e.CanvasAppsOnly=100035]="CanvasAppsOnly",e[e.CustomCanvasPage=100038]="CustomCanvasPage",e[e.CodeApp=100039]="CodeApp",e[e.MobileApp=100046]="MobileApp",e[e.ProcessNoFlowNoUIFlowNoBusinessRule=100036]="ProcessNoFlowNoUIFlowNoBusinessRule",e[e.ActionDefinition=100040]="ActionDefinition",e[e.ActionTemplate=100041]="ActionTemplate",e[e.DialogDefinition=100042]="DialogDefinition",e[e.DialogTemplate=100043]="DialogTemplate",e[e.WorkflowDefinition=100044]="WorkflowDefinition",e[e.WorkflowTemplate=100045]="WorkflowTemplate"})(os||(C.SolutionComponentTypeCodeExt=os={}));var ss;(function(e){e[e.Entity=9801]="Entity",e[e.Attribute=9802]="Attribute",e[e.OptionSet=9804]="OptionSet",e[e.EntityRelationship=9805]="EntityRelationship",e[e.EntityKey=9812]="EntityKey",e[e.Role=1036]="Role",e[e.DisplayString=4102]="DisplayString",e[e.SavedQuery=1039]="SavedQuery",e[e.Workflow=4703]="Workflow",e[e.Report=9100]="Report",e[e.Template=2010]="Template",e[e.ContractTemplate=2011]="ContractTemplate",e[e.KbArticleTemplate=1016]="KbArticleTemplate",e[e.MailMergeTemplate=9106]="MailMergeTemplate",e[e.SavedQueryVisualization=1111]="SavedQueryVisualization",e[e.SystemForm=1030]="SystemForm",e[e.WebResource=9333]="WebResource",e[e.SiteMap=4709]="SiteMap",e[e.ConnectionRole=3231]="ConnectionRole",e[e.HierarchyRule=8840]="HierarchyRule",e[e.CustomControl=9753]="CustomControl",e[e.FieldSecurityProfile=1200]="FieldSecurityProfile",e[e.AppModule=9006]="AppModule",e[e.PluginAssembly=4605]="PluginAssembly",e[e.SdkMessageProcessingStep=4608]="SdkMessageProcessingStep",e[e.ServiceEndpoint=4618]="ServiceEndpoint",e[e.RoutingRule=8181]="RoutingRule",e[e.SLA=9750]="SLA",e[e.ConvertRule=9300]="ConvertRule",e[e.MobileOfflineProfile=9866]="MobileOfflineProfile",e[e.EntityDataSource=85]="EntityDataSource",e[e.SdkMessage=4606]="SdkMessage",e[e.RibbonCustomization=1120]="RibbonCustomization",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.MaskingRule=373]="MaskingRule",e[e.AttributeMaskingRule=374]="AttributeMaskingRule",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Plan=10283]="Plan",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.TeamTemplate=511]="TeamTemplate",e[e.DataWorkspace=10282]="DataWorkspace",e[e.Dashboard=1030]="Dashboard",e[e.InteractionCentricDashboard=1032]="InteractionCentricDashboard",e[e.PowerBIDashboard=1034]="PowerBIDashboard",e[e.Dialog=1030]="Dialog",e[e.WebResourceImage=9333]="WebResourceImage",e[e.WebResourceSilverlight=9333]="WebResourceSilverlight",e[e.WebResourceCode=9333]="WebResourceCode",e[e.WebResourceData=9333]="WebResourceData",e[e.BusinessRule=4703]="BusinessRule",e[e.ActionDefinition=4703]="ActionDefinition",e[e.ActionTemplate=4703]="ActionTemplate",e[e.DialogDefinition=4703]="DialogDefinition",e[e.DialogTemplate=4703]="DialogTemplate",e[e.WorkflowDefinition=4703]="WorkflowDefinition",e[e.WorkflowTemplate=4703]="WorkflowTemplate",e[e.ProcessFlow=4703]="ProcessFlow",e[e.Flow=4703]="Flow",e[e.UIFlow=4703]="UIFlow",e[e.ProcessNoFlow=4703]="ProcessNoFlow",e[e.ProcessNoFlowNoUIFlowNoBusinessRule=4703]="ProcessNoFlowNoUIFlowNoBusinessRule",e[e.AllDashboards=1030]="AllDashboards",e[e.FormsOnly=1030]="FormsOnly",e[e.ComponentLibrary=300]="ComponentLibrary",e[e.CanvasAppsOnly=300]="CanvasAppsOnly",e[e.CustomCanvasPage=300]="CustomCanvasPage",e[e.CodeApp=300]="CodeApp",e[e.MobileApp=300]="MobileApp",e[e.Chatbot=10030]="Chatbot",e[e.Card=10276]="Card"})(ss||(C.EntityTypeCode=ss={}));var _g;(function(e){e.MultiSelectPicklist="MultiSelectPicklist",e.File="File",e.Image="Image"})(_g||(C.SolutionComponentVirtualAttributeSubtype=_g={}));function kO(e){let t=os[e];return ss[t]}C.SolutionComponentTypeCodeToEntityTypeCodeExt=kO;function qO(e){let t=ss[e];return os[t]}C.SolutionEntityTypeCodeExtToComponentTypeCode=qO;var Pg;(function(e){e.Active="Active",e.Auto="Auto",e.Disabled="Disabled",e.Inactive="Inactive"})(Pg||(C.ImeMode=Pg={}));var Og;(function(e){e[e.Simple=0]="Simple",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup",e[e.Formula=3]="Formula",e[e.Prompt=4]="Prompt"})(Og||(C.SourceType=Og={}));var Fg;(function(e){e.Email="Email",e.Phone="Phone",e.PhoneticGuide="PhoneticGuide",e.Text="Text",e.TextArea="TextArea",e.TickerSymbol="TickerSymbol",e.Url="Url",e.VersionNumber="VersionNumber"})(Fg||(C.StringFormatName=Fg={}));var Tg;(function(e){e[e.PrecisionProperty=0]="PrecisionProperty",e[e.Organization=1]="Organization",e[e.TransactionCurrency=2]="TransactionCurrency"})(Tg||(C.PrecisionSource=Tg={}));var Rg;(function(e){e.UserLocal="UserLocal",e.DateOnly="DateOnly",e.TimeZoneIndependent="TimeZoneIndependent"})(Rg||(C.DateTimeBehavior=Rg={}));var xg;(function(e){e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(xg||(C.DateTimeFormat=xg={}));var Lg;(function(e){e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(Lg||(C.IntegerFormat=Lg={}));var Mg;(function(e){e[e.HTML=1]="HTML",e[e.CSS=2]="CSS",e[e.JScript=3]="JScript",e[e.XML=4]="XML",e[e.PNG=5]="PNG",e[e.JPG=6]="JPG",e[e.GIF=7]="GIF",e[e.Silverlight=8]="Silverlight",e[e.XSL=9]="XSL",e[e.ICO=10]="ICO",e[e.SVG=11]="SVG",e[e.RESX=12]="RESX"})(Mg||(C.WebResourceTypeCode=Mg={}));var Ug;(function(e){e[e.Initial=5]="Initial",e[e.PreValidation=10]="PreValidation",e[e.InternalPreOperationBeforeExternal=15]="InternalPreOperationBeforeExternal",e[e.PreOperation=20]="PreOperation",e[e.InternalPreOperationAfterExternal=25]="InternalPreOperationAfterExternal",e[e.MainOperation=30]="MainOperation",e[e.InternalPostOperationBeforeExternal=35]="InternalPostOperationBeforeExternal",e[e.PostOperation=40]="PostOperation",e[e.InternalPostOperationAfterExternal=45]="InternalPostOperationAfterExternal",e[e.PostOperationDeprecated=50]="PostOperationDeprecated",e[e.FinalPostOperation=55]="FinalPostOperation"})(Ug||(C.SdkMessageProcessingStage=Ug={}));var Bg;(function(e){e[e.ServerOnly=0]="ServerOnly",e[e.OutlookClientOnly=1]="OutlookClientOnly",e[e.Both=2]="Both"})(Bg||(C.SupportedDeployment=Bg={}));var kg;(function(e){e[e.Synchronous=0]="Synchronous",e[e.Asynchronous=1]="Asynchronous"})(kg||(C.SdkMessageProcessingMode=kg={}));var qg;(function(e){e[e.ReportingServicesReport=1]="ReportingServicesReport",e[e.OtherReport=2]="OtherReport",e[e.LinkedReport=3]="LinkedReport"})(qg||(C.ReportTypeCode=qg={}));var $g;(function(e){e[e.Business=1]="Business",e[e.Family=2]="Family",e[e.Social=3]="Social",e[e.Sales=4]="Sales",e[e.Other=5]="Other",e[e.Stakeholder=1e3]="Stakeholder",e[e.SalesTeam=1001]="SalesTeam",e[e.Service=1002]="Service"})($g||(C.ConnectionRoleCategory=$g={}));var Vg;(function(e){e[e.Name=1]="Name",e[e.Address=2]="Address"})(Vg||(C.ServiceNamespaceFormat=Vg={}));var Gg;(function(e){e[e.OneWay=1]="OneWay",e[e.Queue=2]="Queue",e[e.Rest=3]="Rest",e[e.TwoWay=4]="TwoWay",e[e.Topic=5]="Topic",e[e.PersistentQueue=6]="PersistentQueue",e[e.EventHub=7]="EventHub",e[e.WebHook=8]="WebHook"})(Gg||(C.ServiceEndpointContract=Gg={}));var zg;(function(e){e[e.Normal=1]="Normal",e[e.Federated=2]="Federated"})(zg||(C.ServiceEndpointConnectionMode=zg={}));var Wg;(function(e){e.CannotDeleteInUseComponent="0x8004f01f",e.CannotDeleteInUseAttribute="0x80048418",e.CannotDeleteInUseOptionSet="0x80048417",e.CannotDeleteInUseEntity="0x80048420",e.CannotUninstallWithDependencies="0x8004F01D"})(Wg||(C.DeleteDependencyErrorCode=Wg={}));var jg;(function(e){e.SystemAdministrator="627090FF-40A3-4053-8790-584EDC5BE201",e.SystemCustomizer="119F245C-3CC8-4B62-B31C-D1A046CED15D"})(jg||(C.DefaultRoleTemplates=jg={}));var Hg;(function(e){e[e.DefaultTeamPrivilege=0]="DefaultTeamPrivilege",e[e.DirectUserAndTeamPrivilege=1]="DirectUserAndTeamPrivilege"})(Hg||(C.RoleInheritance=Hg={}));var Jg;(function(e){e[e.NotSpecified=0]="NotSpecified",e[e.CustomConnector=1]="CustomConnector"})(Jg||(C.ConnectorTypeEnum=Jg={}));var Qg;(function(e){e[e.String=1e8]="String",e[e.Number=100000001]="Number",e[e.Boolean=100000002]="Boolean",e[e.JSON=100000003]="JSON",e[e.ConnectionReference=100000004]="ConnectionReference",e[e.Secret=100000005]="Secret"})(Qg||(C.EnvironmentVariableDefinitionTypeEnum=Qg={}));var Xg;(function(e){e[e.Owner=0]="Owner",e[e.Access=1]="Access",e[e.AADSecurityGroup=2]="AADSecurityGroup",e[e.AADOfficeGroup=3]="AADOfficeGroup"})(Xg||(C.TeamTypeEnum=Xg={}));var Kg;(function(e){e.Bots="bots"})(Kg||(C.KnownCustomSolutionComponentEntitySetName=Kg={}));var Yg;(function(e){e[e.MainApplicationView=0]="MainApplicationView",e[e.AdvancedSearch=1]="AdvancedSearch",e[e.SubGrid=2]="SubGrid",e[e.QuickFindSearch=4]="QuickFindSearch",e[e.Reporting=8]="Reporting",e[e.OfflineFilters=16]="OfflineFilters",e[e.MASearch=32]="MASearch",e[e.LookupView=64]="LookupView",e[e.SMAppointmentBookView=128]="SMAppointmentBookView",e[e.OutlookFilters=256]="OutlookFilters",e[e.AddressBookFilters=512]="AddressBookFilters",e[e.SavedQueryTypeOther=2048]="SavedQueryTypeOther",e[e.InteractiveWorkflowView=4096]="InteractiveWorkflowView",e[e.OfflineTemplate=8192]="OfflineTemplate",e[e.OutlookTemplate=131072]="OutlookTemplate",e[e.CustomDefinedView=16384]="CustomDefinedView"})(Yg||(C.QueryType=Yg={}))});var Pc,Zg=D(()=>{"use strict";(function(e){e.DefaultValue="defaultValue",e.Loaded="loaded"})(Pc||(Pc={}))});var r0,$O,e0,X6,K6,ga,t0,Y6,Z6,n0=D(()=>{"use strict";r0=ne(en());Ce();Bn();Lh();ma();Tt();$n();G();$O=ne(ha());Zg();(function(e){e.Model="Model",e.Canvas="Canvas",e.CustomPages="CustomPages"})(e0||(e0={}));X6={Read:rn.Read,Edit:rn.Edit,Both:rn.Both,Container:rn.Container},K6={input:qn.Input,bound:qn.Bound,output:qn.Output};(function(e){e[e.dataset=0]="dataset",e[e.property=1]="property",e[e.groups=2]="groups",e[e.group=3]="group"})(ga||(ga={}));(function(e){e[e.None=0]="None",e[e.HiddenControl=1]="HiddenControl",e[e.CompatibleDataTypesIsMissing=2]="CompatibleDataTypesIsMissing",e[e.TagNameIsUnsupported=3]="TagNameIsUnsupported",e[e.PropertyTypeIsUnsupported=4]="PropertyTypeIsUnsupported",e[e.PropertyTypeGroupIsUnsupported=5]="PropertyTypeGroupIsUnsupported"})(t0||(t0={}));Y6=new Set([E.Currency,E.Decimal,E.FP,E.Multiple,E.SingleLineEmail,E.SingleLinePhone,E.SingleLineText,E.SingleLineTextArea,E.SingleLineURL,E.SingleLineTickerSymbol,E.WholeNone,E.WholeDuration,E.WholeLanguage,E.WholeTimeZone,E.Enum,E.LookupSimple,E.LookupCustomer,E.LookupOwner,E.LookupPartyList,E.LookupRegarding,E.TwoOptions,E.Boolean,E.PowerBIReport,E.DateAndTimeDateAndTime,E.DateAndTimeDateOnly,E.OptionSet,E.MultiSelectOptionSet,E.CardForm]),Z6={numbers:[E.WholeNone,E.FP,E.Decimal,E.Currency],text:[E.SingleLineText,E.SingleLineTextArea,E.Multiple],lookup:[E.LookupSimple,E.LookupCustomer,E.LookupOwner,E.LookupPartyList,E.LookupRegarding],dates:[E.DateAndTimeDateOnly,E.DateAndTimeDateAndTime],allFields:[E.TwoOptions,E.DateAndTimeDateOnly,E.DateAndTimeDateAndTime,E.FP,E.Decimal,E.WholeNone,E.WholeDuration,E.WholeTimeZone,E.WholeLanguage,E.LookupSimple,E.LookupCustomer,E.LookupOwner,E.LookupPartyList,E.LookupRegarding,E.Multiple,E.OptionSet,E.SingleLineText,E.SingleLineTextArea,E.SingleLineEmail,E.SingleLineURL,E.SingleLineTickerSymbol,E.SingleLinePhone]}});var Rt,ls,i0=D(()=>{"use strict";Rt=ne(en());Se();Ce();ze();Bn();$n();n0();ma();G();xe();Tt();ls=class extends q{constructor(t){super(h.customControl,t)}customControlId;get id(){let t=this.getProperty(p.id);return S.IsNullOrUndefined(t)?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new I(t.substr(1,t.length-2)):new I(t)}getParameters(){let t=new Map,r=this.getAllChildren();if(r&&r.length!==0&&r[0]){let n=r[0].getAllChildren();if(n!=null){for(let i of n)if(i&&i.getAllChildren().length>0){let a=i.getNodeName();t.get(a)?t.get(a).push(i):t.set(a,[i])}}}return t}getFormComponentValueByParameterName(t){let r=this.getParameters()?.get(Ke.value);if(r?.length>0){let n=r[0],i=n?.getAllChildren()?.length>0?n.getAllChildren().find(o=>o.getNodeName()===t):null,a=i?.getAllChildren()?.length>0?i.getAllChildren()[0].getNodeName():"";return this.normalizePropertyValue(a)}}getParameterValue(t){let r=this.getParameterNodeChild(t);return r&&this.normalizePropertyValue(r.getNodeName())}getParameterNodeChild(t){let r=this.getParameters().get(t);return r?.length>0&&r[0].getAllChildren()?.length>0?r[0].getAllChildren()[0]:null}getDatasetName(t){return t.getAllProperties().find(r=>r.key===Ke.name)?.value}getParameterChildrenValues(t,r,n){if(this.isDataSet(t)){let i=r.find(u=>u.key===Ke.name)?.value,a={Name:i,Type:E.Grid,Columns:[]},l=this.getParameters().get(Ke.dataset).find(u=>this.getDatasetName(u)===i).getAllChildren();for(let u of l){let c=u.getNodeName();if(u&&u.getAllChildren().length>0){let d=this.normalizePropertyValue(u.getAllChildren()[0].getNodeName());a[c]=d}}return a}}getParameterIsStatic(t){let r=!1,n=this.getParameters().get(t)[0],i=n&&n.getAllProperties();if(i){for(let a of i)if(a.key===p.static&&a.value==="true"){r=!0;break}}return r}get name(){return this.getProperty(p.Name)}get formFactor(){return this.getProperty(p.formFactor)}set formFactor(t){this.setProperty(p.formFactor,t)}async toJSON(t){if(this.id)return null;let r=await this.parametersToJSON(t),n=parseInt(this.formFactor,10);return{CustomControlId:this.customControlId,FormFactor:isNaN(n)?-1:n,Name:this.name,Version:null,Parameters:r,ShouldOverrideControlVisible:!1}}normalizePropertyValue(t){return t.startsWith(hr.StartTag)&&(t=t.substring(1)),t}async parametersToJSON(t){let r=[];if(!this.name)return r;try{let n=await t.formModelService.customControlDiscoveryService.getCustomControlMetadata(this.name);if(n)if(n.configurations){let i=n.configurations,a=this.getParameters();for(let[o,s]of a)if(this.isDataSet(o))for(let l of a.get(o)){let u=l.getAllProperties(),c=this.getDatasetName(l),d=i.get(c),f=await this.parameterJSON(o,u,d,t);r.push({Name:c,Value:f})}else if(this.isGroups(s))r.push({Name:o,Value:{Type:gh.GroupDefinition,Value:this.normalizePropertyValue(this.getParameterNodeChild(s[0].NodeName).NodeName)}}),i.get(o).groupSet?.forEach(u=>{u.groupConfigurableProperties.forEach(async c=>{let d=c.name;c.propertyType===ga.dataset?a.get(Ke.dataset)?.some(g=>this.getDatasetName(g)===d)||r.push({Name:d,Value:{Name:d,Columns:[],Type:E.Grid}}):c.propertyType===ga.property&&(a.has(d)||r.push({Name:d,Value:{Usage:c.usage}}))})});else{let l=s[0].getAllProperties(),u=i.get(o),c=await this.parameterJSON(o,l,u,t);if(c)r.push({Name:o,Value:c});else{(0,Rt.trackInfoTrace)(Qe,{eventName:`${fr}/parametersToJSON`,eventData:{message:`Configuration metadata for custom control parameter ${o} is not available for custom control : ${this.name}.`}}),r=[];break}}}else(0,Rt.trackErrorTrace)(Qe,{eventName:`${fr}/parametersToJSON`,eventData:{message:"Custom Control Manifest Property Info not available"}},new Error(`Custom Control Manifest Property Info not available for custom control : ${this.name}.`));else(0,Rt.trackErrorTrace)(Qe,{eventName:`${fr}/parametersToJSON`,eventData:{message:"Custom Control Manifest not found"}},new Error(`No custom control manifest found for ${this.name}`))}catch(n){(0,Rt.trackErrorTrace)(Qe,{eventName:`${fr}/parametersToJSON`,eventData:{message:"parameters to json failed"}},n)}return r}async parameterJSON(t,r,n,i){if(this.isDataSet(t)){let a=n,o=r.find(s=>s.key===Ke.name)?.value;if(a)return this.getParameterChildrenValues(t,r);{let s=new Error(`No dataset manifest info for ${o}`);(0,Rt.trackErrorTrace)(Qe,{eventName:`${fr}/parameterJSON`,eventData:{message:"Missing custom control manifest dataset info"}},s)}}else{let a=n,o=r&&r.find(l=>l.key===p.Type),s=a&&!a.ofTypeGroup.every(l=>!uc.includes(l));if(this.isLookupType(o?.value)||this.isLookupType(a?.ofType)||s)if(a){let l=a.usage,u=this.getParameterIsStatic(t),c=a.isPrimary;if(this.name===Rr.FormComponent){let d=this.getFormComponentValueByParameterName(p.bindAttribute),f=await i.formModelService.loadLookupModel(d),g=f.lookupColumn,b=this.getLookupDataTypeFromAttributeMetadata(g);return{Name:t,Type:b,Usage:l,Static:u,Primary:c,EntityName:f.primaryTableName,Value:d,ViewId:this.getFormComponentValueByParameterName(hh.DefaultViewId),TargetEntityType:g.targets[0],FilterRelationshipName:this.getFormComponentValueByParameterName(p.FilterRelationshipName),AvailableViewIds:this.getFormComponentValueByParameterName(p.AvailableViewIds),DependentAttributeName:this.getFormComponentValueByParameterName(p.DependentAttributeName),DependentAttributeType:this.getFormComponentValueByParameterName(p.DependentAttributeType),AllowFilterOff:P.IsStrictTrue(this.getFormComponentValueByParameterName(p.AllowFilterOff)),DisableQuickFind:P.IsStrictTrue(this.getFormComponentValueByParameterName(p.DisableQuickFind)),EnableViewPicker:!P.IsStrictTrue(this.getFormComponentValueByParameterName(p.DisableViewPicker))}}return{Name:t,Usage:l,Static:u,Primary:c,Value:this.getParameterValue(t)}}else{let l=new Error(`No lookup manifest info for ${t}`);(0,Rt.trackErrorTrace)(Qe,{eventName:`${fr}/parameterJSON`,eventData:{message:"Missing custom control manifest lookup property info"}},l)}if(a){let l=a.usage,u=this.getParameterIsStatic(t),c=this.getParameterValue(t),d=a.isPrimary;if(o){let g=o.value;return{Type:g,Static:u,Usage:l,Value:this.isNumberTypeProperty(a,g)&&Number(c)?Number(c):c,Primary:d}}if(a.ofType)return{Type:a.ofType,Static:u,Usage:l,Value:c,Primary:!0};if(a.ofTypeGroup)return{Static:u,Usage:l,Value:c,Primary:!0};let f=new Error(`No property type info for ${t}`);(0,Rt.trackErrorTrace)(Qe,{eventName:`${fr}/parameterJSON`,eventData:{message:"Missing property type info"}},f)}else{let l=new Error(`No property manifest info for ${t}`);(0,Rt.trackWarningTrace)(Qe,{eventName:`${fr}/parameterJSON`,eventData:{message:"Missing custom control manifest property info"}},l)}}return null}getLookupDataTypeFromAttributeMetadata(t){let{attributeType:r,format:n}=t;switch(r){case O.Customer:return E.LookupCustomer;case O.Owner:return E.LookupOwner;case O.PartyList:return E.LookupPartyList;default:return n===L.Regarding?E.LookupRegarding:E.LookupSimple}}isLookupType(t){return uc.includes(t)}isNumberTypeProperty(t,r){return cc.includes(r)||t.ofTypeGroup.some(n=>cc.includes(n))}isDataSet(t){return Ke.dataset===t}isGroups(t){return!!t[0].getAllProperties().find(n=>n.key==="isGroup"&&n.value==="true")}}});var U,Oc=D(()=>{"use strict";U=class{static get CustomControl(){return"CustomControl"}static get ACIControl(){return"ACIControl"}static get ReferencePanelSearchWidget(){return"ReferencePanelSearchWidget"}static get SearchWidgetControl(){return"SearchWidgetControl"}static get SocialInsightControl(){return"SocialInsightControl"}static get NotesControl(){return"notescontrol"}static get TimerControl(){return"TimerControl"}static get MapsControl(){return"MapsControl"}static get IframeControl(){return"IframeControl"}static get WebResourceHtmlControl(){return"WebResourceHtmlControl"}static get QuickFormCollectionControl(){return"QuickFormCollectionControl"}static get QuickFormControl(){return"QuickFormControl"}static get GridControl(){return"GridControl"}static get SubGridControl(){return"SubGridControl"}static get WebResourceImageControl(){return"WebResourceImageControl"}static get TimeLineControl(){return"TimeLineControl"}static get LeadScoringControl(){return"LeadScoringControl"}}});var F,Wn,Ee,us=D(()=>{"use strict";Se();la();Ce();ze();ma();Zr();Oc();Tt();F=class{static get TextBoxControl(){return"4273EDBD-AC1D-40d3-9FB2-095C621B552D"}static get TickerControl(){return"1E1FC551-F7A8-43af-AC34-A8DC35C7B6D4"}static get UrlControl(){return"71716B6C-711E-476c-8AB8-5D11542BFB47"}static get PhoneNumberControl(){return"8C10015A-B339-4982-9474-A95FE05631A5"}static get EmailAddressControl(){return"ADA2203E-B4CD-49be-9DDF-234642B43B52"}static get RadioControl(){return"67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED"}static get LookupControl(){return"270BD3DB-D9AF-4782-9025-509E298DEC0A"}static get DateTimeControl(){return"5B773807-9FB2-42db-97C3-7A91EFF8ADFF"}static get IntegerControl(){return"C6D124CA-7EDA-4a60-AEA9-7FB8D318B68F"}static get MoneyControl(){return"533B9E00-756B-4312-95A0-DC888637AC78"}static get FloatControl(){return"0D2C745A-E5A8-4c8f-BA63-C6D3BB604660"}static get DecimalControl(){return"C3EFE0C3-0EC6-42be-8349-CBD9079DFD8E"}static get TextAreaControl(){return"E0DECE4B-6FC8-4a8f-A065-082708572369"}static get PicklistControl(){return"3EF39988-22BB-4f0b-BBBE-64B5A3748AEE"}static get HiddenInputControl(){return"5546E6CD-394C-4BEE-94A8-4425E17EF6C6"}static get GridControl(){return"E7A81278-8635-4D9E-8D4D-59480B391C5B"}static get CheckBoxControl(){return"B0C6723A-8503-4fd7-BB28-C8A06AC933C2"}static get IframeControl(){return"FD2A7985-3187-444e-908D-6624B21F69C0"}static get SocialInsightControl(){return"86B9E25E-695E-4FEF-AC69-F05CFA96739C"}static get OrgInsightsControl(){return"76B9E25E-695E-4FEF-AC69-F05CFA96739C"}static get DurationControl(){return"AA987274-CE4E-4271-A803-66164311A958"}static get RegardingControl(){return"F3015350-44A2-4aa0-97B5-00166532B5E9"}static get PartyListControl(){return"CBFB742C-14E7-4a17-96BB-1A13F7F64AA2"}static get TimeLineControl(){return"06375649-c143-495e-a496-c962e5b4488e"}static get TimeLineControlUC(){return"06375649-C143-495E-A496-C962E5B4488E"}static get TimeZonePicklistControl(){return"7C624A0B-F59E-493d-9583-638D34759266"}static get LanguagePickerControl(){return"671A9387-CA5A-4d1e-8AB7-06E39DDCF6B5"}static get AccessTeamTablePickerControl(){return"3F4E2A56-F102-4B4D-AB9C-F1574CA5BFDA"}static get KBViewerControl(){return"A62B6FA9-169E-406C-B1AA-EAB828CB6026"}static get PicklistStatusControl(){return"5D68B988-0661-4db2-BC3E-17598AD3BE6C"}static get EmailBodyControl(){return"6F3FB987-393B-4d2d-859F-9D0F0349B6AD"}static get PicklistLookupControl(){return"2305E33A-BAD3-4022-9E15-1856CF218333"}static get RelationshipRolePicklistControl(){return"5F986642-5961-4D9F-AB5E-643D71E231E9"}static get RelatedInformationControl(){return"163B90A6-EB64-49D2-9DF8-3C84A4F0A0F8"}static get CoverPagePicklistControl(){return"4168A05C-D857-46AF-8457-5BB47EB04EA1"}static get MailMergeLanguagePickerControl(){return"B634828E-C390-444A-AFE6-E07315D9D970"}static get ConnectionControl(){return"3246F906-1F71-45F7-B11F-D7BE0F9D04C9"}static get ConnectionRoleObjectTypeListControl(){return"821ACF1A-7E46-4A0C-965D-FE14A57D78C7"}static get MapsControl(){return"62B0DF79-0464-470F-8AF7-4483CFEA0C7D"}static get MapLinkControl(){return"91DC0675-C8B9-4421-B1E0-261CEBF02BAC"}static get WebResourceHtmlControl(){return"9FDF5F91-88B1-47F4-AD53-C11EFC01A01D"}static get WebResourceImageControl(){return"587CDF98-C1D5-4BDE-8473-14A0BC7644A7"}static get WebResourceSilverlightControl(){return"080677DB-86EC-4544-AC42-F927E74B491F"}static get ReportControl(){return"A28F441B-916C-4865-87FD-0C5D53BD59C9"}static get ArticleContentControl(){return"F02EF977-2564-4B9A-B2F0-DF083D8A019B"}static get ProcessControl(){return"06E9F7AF-1F54-4681-8EEC-1E21A1CEB465"}static get ActivitiesWallControl(){return"6636847D-B74D-4994-B55A-A6FAF97ECEA2"}static get QuickFormControl(){return"69AF7DCA-2E3B-4EE7-9201-0DA731DD2413"}static get QuickFormCollectionControl(){return"5C5600E0-1D6E-4205-A272-BE80DA87FD42"}static get LinkControl(){return"DFDF1CDE-837B-4AC9-98CF-AC74361FD89D"}static get CompositionLinkControl(){return"DB1284EF-9FFC-4E99-B382-0CC082FE2364"}static get ErrorStatusControl(){return"F4C16ECA-CA81-4E39-9448-834B8378721E"}static get ActivitiesContainerControl(){return"C72511AB-84E5-4FB7-A543-25B4FC01E83E"}static get AccessPrivilegeControl(){return"F93A31B2-99AC-4084-8EC2-D4027C31369A"}static get TimerControl(){return"9C5CA0A1-AB4D-4781-BE7E-8DFBE867B87E"}static get DynamicPropertyListControl(){return"6896F004-B17A-4202-861E-8B7EA2080E0B"}static get ButtonControl(){return"00AD73DA-BD4D-49C6-88A8-2F4F4CAD4A20"}static get SearchWidgetControl(){return"E616A57F-20E0-4534-8662-A101B5DDF4E0"}static get EmailRecipientActivityControl(){return"26E9760F-7454-40DE-BB07-F6DCCCB82040"}static get LabelControl(){return"39354E4A-5015-4D74-8031-EA9EB73A1322"}static get CustomControl(){return"F9A8A302-114E-466A-B582-6771B2AE0D92"}static get EditFilterControl(){return"1479835F-F852-4679-B864-C6892A2844C9"}static get RichEditorControl(){return"F94DB24F-263D-44A7-B38E-A35E9854812B"}static get PowerBIControl(){return"8C54228C-1B25-4909-A12A-F2B968BB0D62"}static get EmailEngagementActionsControl(){return"F454228D-1D25-4319-E12F-D27968BC0234"}static get ACIControl(){return"C8BFBBEF-6851-4401-A0CC-7450062FE085"}static get ChoicesControl(){return"4AA28AB7-9C13-4F57-A73D-AD894D048B5F"}static get ReferencePanelSubgridControl(){return"02D4264B-47E2-4B4C-AA95-F439F3F4D458"}static get ReferencePanelSearchWidget(){return"7CCD1494-1F7A-4E3A-8BDE-F32069DAEB9F"}static get ReferencePanelQuickFormCollectionControl(){return"B68B05F0-A46D-43F8-843B-917920AF806A"}static get SpacerControl(){return"E4BAB03A-A9A5-4C23-CC3B-54AA680150E2"}},Wn=class{static get RelationshipAssistant(){return"3ff9a528-dd50-4aca-8f10-2e5ed73513ad"}static get PredictiveLeadScoring(){return"6f503f2a-d033-4106-b62c-f8f2e5f01a57"}},Ee=class e{static FieldControlIds=e.initializeFieldControls();static UnboundControlIds=e.initializeUnboundControls();static ControlsAllowedForReferencePanel=e.initializeReferencePanelControls();static ControlsAllowedForFooter=e.initializeFooterControls();static CustomControlIdMap=new Xe;static initializeFieldControls(){let t=new Xe,r=e.getControlName(O.SingleLineofText,L.Phone);t.add(r,new I(F.PhoneNumberControl));let n=e.getControlName(O.SingleLineofText,L.TextArea);t.add(n,new I(F.TextAreaControl));let i=e.getControlName(O.SingleLineofText,L.Text);t.add(i,new I(F.TextBoxControl));let a=e.getControlName(O.SingleLineofText,L.Email);t.add(a,new I(F.EmailAddressControl));let o=e.getControlName(O.SingleLineofText,L.Url);t.add(o,new I(F.UrlControl));let s=e.getControlName(O.SingleLineofText,L.TickerSymbol);t.add(s,new I(F.TickerControl));let l=e.getControlName(O.SingleLineofText,L.PhoneticGuide);t.add(l,new I(F.TextBoxControl));let u=e.getControlName(O.WholeNumber,L.Duration);t.add(u,new I(F.DurationControl));let c=e.getControlName(O.WholeNumber,L.Language);t.add(c,new I(F.LanguagePickerControl));let d=e.getControlName(O.WholeNumber,L.TimeZone);t.add(d,new I(F.TimeZonePicklistControl));let f=e.getControlName(O.WholeNumber,L.None);t.add(f,new I(F.IntegerControl));let g=e.getControlName(O.DateTime,L.DateOnly);t.add(g,new I(F.DateTimeControl));let b=e.getControlName(O.DateTime,L.DateAndTime);t.add(b,new I(F.DateTimeControl));let w=e.getControlName(O.LookupType,L.None);t.add(w,new I(F.LookupControl));let N=e.getControlName(O.CustomerType,L.None);t.add(N,new I(F.LookupControl));let _=e.getControlName(O.FloatingPointNumber,L.None);t.add(_,new I(F.FloatControl));let T=e.getControlName(O.DecimalNumber,L.None);t.add(T,new I(F.DecimalControl));let R=e.getControlName(O.Currency,L.None);t.add(R,new I(F.MoneyControl));let M=e.getControlName(O.MultipleLineofText,L.None);t.add(M,new I(F.TextAreaControl));let W=e.getControlName(O.MultipleLineofText,L.Text);t.add(W,new I(F.TextAreaControl));let B=e.getControlName(O.MultipleLineofText,L.TextArea);t.add(B,new I(F.TextAreaControl));let j=e.getControlName(O.MultipleLineofText,L.Email);t.add(j,new I(F.EmailBodyControl));let k=e.getControlName(O.OptionSet,L.None);t.add(k,new I(F.PicklistControl));let $=e.getControlName(O.TwoOptions,L.None);t.add($,new I(F.RadioControl));let re=e.getControlName(O.Image,L.None);t.add(re,new I(F.WebResourceImageControl));let H=e.getControlName(O.Image,L.None);t.add(H,new I(F.WebResourceHtmlControl));let nr=e.getControlName(O.TwoOptions,"Radio");t.add(nr,new I(F.RadioControl));let El=e.getControlName(O.TwoOptions,"CheckBox");t.add(El,new I(F.CheckBoxControl));let Oi=e.getControlName(O.TwoOptions,"List");t.add(Oi,new I(F.PicklistControl));let io=e.getControlName(O.State,L.None);t.add(io,new I(F.PicklistControl));let le=e.getControlName(O.Status,L.None);t.add(le,new I(F.PicklistStatusControl));let tt=e.getControlName(O.OwnerType,L.None);t.add(tt,new I(F.LookupControl));let Il=e.getControlName(O.PartyListType,L.None);t.add(Il,new I(F.PartyListControl));let ED=e.getControlName(O.LookupType,L.Regarding);t.add(ED,new I(F.RegardingControl));let ID=e.getControlName(O.MultiSelectOptionSet,L.None);return t.add(ID,new I(F.ChoicesControl)),t}static getControlName(t,r){return t+"_"+r}static getControlIdByTypeAndFormat(t,r){let n=e.getControlName(t.toString(),r.toString());return e.FieldControlIds.containsKey(n)?e.FieldControlIds.getValue(n):null}static getTypeAndFormatByControlOrUniqueId(t){for(let r in e.FieldControlIds.getKeys())if(e.FieldControlIds.getValue(e.FieldControlIds.getKeys()[r]).guidString.toLowerCase()===t)return e.FieldControlIds.getKeys()[r]}static getControlDataTypeByControlOrUniqueId(t){if(!S.IsNullOrEmptyGuid(t)){let r=e.getTypeAndFormatByControlOrUniqueId(t.guidString.toLowerCase());return r=S.IsNullOrUndefined(r)?e.getUnboundControlNameFromIdentifier(t):r.substring(0,r.indexOf("_")),r}return null}static isCustomControl(t){return S.IsNullOrUndefined(t.control)||S.IsNullOrUndefined(t.control.ClassId)||t.control.ClassId.guidString===F.CustomControl}static initializeUnboundControls(){let t=new Xe;return t.add(F.ACIControl,U.ACIControl),t.add(F.IframeControl,U.IframeControl),t.add(F.SearchWidgetControl,U.SearchWidgetControl),t.add(F.MapsControl,U.MapsControl),t.add(F.QuickFormCollectionControl,U.QuickFormCollectionControl),t.add(F.GridControl,U.SubGridControl),t.add(F.WebResourceImageControl,U.WebResourceImageControl),t.add(F.WebResourceHtmlControl,U.WebResourceHtmlControl),t.add(F.ReferencePanelSearchWidget,U.SearchWidgetControl),t.add(F.ReferencePanelQuickFormCollectionControl,U.QuickFormCollectionControl),t.add(F.ReferencePanelSubgridControl,U.SubGridControl),t.add(F.TimerControl,U.TimerControl),t.add(F.TimeLineControl,U.NotesControl),t.add(F.TimeLineControlUC,U.NotesControl),t.add(F.SocialInsightControl,U.SocialInsightControl),t.add(Wn.RelationshipAssistant,U.CustomControl),t}static initializeReferencePanelControls(){let t=new Xe;return t.add(F.IframeControl,U.IframeControl),t.add(F.ReferencePanelSearchWidget,U.SearchWidgetControl),t.add(F.ReferencePanelQuickFormCollectionControl,U.QuickFormCollectionControl),t.add(F.ReferencePanelSubgridControl,U.SubGridControl),t.add(F.WebResourceHtmlControl,U.WebResourceHtmlControl),t.add(F.WebResourceImageControl,U.WebResourceHtmlControl),t}static initializeFooterControls(){let t=new kn;return t.add(Gn.IFRAME,!0),t.add(Gn.SPACER,!0),t.add(Gn.WEB_RESOURCE_HTML,!0),t}static isUnboundFormControl(t){if(S.IsNullOrUndefined(t)||S.IsNullOrUndefined(t.control)||S.IsNullOrUndefined(t.control.ClassId))return!1;let r=e.getUniqueIdentifierForControl(t.control);return e.UnboundControlIds.containsKey(r.guidString)}static isReferencePanelSection(t){return!S.IsNullOrUndefined(t)&&!S.IsNullOrUndefined(t.Name)&&t.Name.indexOf(se.referencePanelNamePrefix)===0}static isUnboundFormControlByIdentifier(t){return S.IsNullOrUndefined(t)||S.IsNullOrUndefined(t.guidString)?!1:e.UnboundControlIds.containsKey(t.guidString)}static getUnboundFormControlName(t){let r=P.EmptyString;if(S.IsNullOrUndefined(t)||S.IsNullOrUndefined(t.control)||S.IsNullOrUndefined(t.control.ClassId))return r;let n=e.getUniqueIdentifierForControl(t.control);return e.UnboundControlIds.getValue(n.guidString).toString()}static getUnboundControlNameFromIdentifier(t){return S.IsNullOrUndefined(t)||S.IsNullOrUndefined(t.guidString)?P.EmptyString:e.UnboundControlIds.getValue(t.guidString).toString()}static isSpacerControl(t){return t===F.SpacerControl}static GetRowSpan(t){let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===F.CustomControl&&!S.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}switch(e.UnboundControlIds.getValue(r.guidString)){case U.IframeControl:case U.ACIControl:case U.SocialInsightControl:return 6;case U.SubGridControl:case U.CustomControl:return 4;case U.WebResourceImageControl:return 15;case U.WebResourceHtmlControl:return 15;case U.MapsControl:return 8;case U.SearchWidgetControl:return 10;case U.NotesControl:case U.TimeLineControl:return 15;case U.TimerControl:return 2;default:}}static isLookUpControl(t){return!S.IsNullOrUndefined(t)&&t.ClassId.guidString===F.LookupControl}static isRelationshipAssistantOrLeadScoringControl(t){return!S.IsNullOrUndefined(t)&&e.isRelationshipAssistantOrLeadScoring(t.UniqueId)}static isRelationshipAssistantOrLeadScoring(t){return!S.IsNullOrUndefined(t)&&(t.guidString===Wn.RelationshipAssistant||t.guidString===Wn.PredictiveLeadScoring)}static isRelationshipAssistantControl(t){return!S.IsNullOrUndefined(t)&&e.isRelationshipAssistant(t.UniqueId)}static isRelationshipAssistant(t){return!S.IsNullOrUndefined(t)&&t.guidString===Wn.RelationshipAssistant}static getUniqueIdentifierForControl(t){if(S.IsNullOrUndefined(t))return null;let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===F.CustomControl&&!S.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}return r}}});var cs,a0=D(()=>{"use strict";cs=class{listeners=[];listenersOncer=[];on(t){return this.listeners.push(t),{dispose:()=>this.off(t)}}once(t){this.listenersOncer.push(t)}off(t){let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1)}emit(t){this.listeners.forEach(r=>r(t)),this.listenersOncer.forEach(r=>r(t)),this.listenersOncer=[]}pipe(t){return this.on(r=>t.emit(r))}}});var on,jn,o0,s0,xr,l0,u0,Fc=D(()=>{"use strict";(function(e){e[e.Center=0]="Center",e[e.Left=1]="Left",e[e.Right=2]="Right"})(on||(on={}));(function(e){e[e.Left=0]="Left",e[e.Top=1]="Top"})(jn||(jn={}));(function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle"})(o0||(o0={}));(function(e){e[e.None=0]="None",e[e.Create=1]="Create",e[e.Existing=2]="Existing",e[e.ReadOnly=3]="ReadOnly",e[e.Disabled=4]="Disabled",e[e.BulkEdit=6]="BulkEdit",e[e.Merge=7]="Merge",e[e.Print=8]="Print",e[e.FollowUp=9]="FollowUp"})(s0||(s0={}));(function(e){e[e.None=-1]="None",e[e.AppointmentBook=0]="AppointmentBook",e[e.Hardcoded=1]="Hardcoded",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.Dashboard=5]="Dashboard",e[e.Quick=6]="Quick",e[e.Mobile=7]="Mobile",e[e.Read=8]="Read",e[e.QuickCreate=9]="QuickCreate",e[e.Dialog=10]="Dialog",e[e.Card=11]="Card",e[e.TaskBasedForm=12]="TaskBasedForm",e[e.InteractionCentricDashboard=13]="InteractionCentricDashboard"})(xr||(xr={}));(function(e){e[e.None=0]="None",e[e.SystemRequired=1]="SystemRequired",e[e.ApplicationRequired=2]="ApplicationRequired",e[e.Recommended=3]="Recommended"})(l0||(l0={}));(function(e){e[e.Boolean=0]="Boolean",e[e.Customer=1]="Customer",e[e.DateTime=2]="DateTime",e[e.Decimal=3]="Decimal",e[e.Double=4]="Double",e[e.Integer=5]="Integer",e[e.Lookup=6]="Lookup",e[e.Memo=7]="Memo",e[e.Money=8]="Money",e[e.Owner=9]="Owner",e[e.PartyList=10]="PartyList",e[e.Picklist=11]="Picklist",e[e.State=12]="State",e[e.Status=13]="Status",e[e.String=14]="String",e[e.Uniqueidentifier=15]="Uniqueidentifier",e[e.CalendarRules=16]="CalendarRules",e[e.Virtual=17]="Virtual",e[e.BigInt=18]="BigInt",e[e.ManagedProperty=19]="ManagedProperty",e[e.EntityName=20]="EntityName"})(u0||(u0={}))});var Hn,c0=D(()=>{"use strict";fa();Hn=gc({packageName:"cds-designer-models",features:{showAllPCFControls:{owner:"anchoudh",description:"Do not only show the controls that exist on the whitelist",enabledFor:{test:!1,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1}},showTestControls:{owner:"lucorre",description:"Show advanced custom controls for testing (designated in Authoring Manifest with isTestOnly=true)",enabledFor:{test:!0,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1}},enablePrefetchGetMoreComponentsLocalization:{owner:"vajagarl",description:"Enables prefetching the localization files for controls displayed in custom control picker",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0}},showMapControl:{owner:"vayilavarapu",createdDate:"07/19/2022",description:"Show map control",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},enableFallbackFormTemplate:{owner:"vajagarl",createdDate:"01/03/2023",description:"Enable default form template as fallback if unable to retrieve a form template from Dataverse",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},enableAutoInsertionOfCellInRow:{owner:"debeshd",createdDate:"09/01/2023",description:"Enable the auto insertion of cell in a row when a section is initialized",enabledFor:{test:!1,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableOneGridEvents:{owner:"aansu",createdDate:"08/21/2024",description:"Enable OneGrid events in form designer",enabledFor:{test:!0,preprod:!0,prod:!0,preview:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},disablePBIComponents:{owner:"adekulkarni",createdDate:"02/13/2025",description:"Disables PBI components and cleans them up from the form",enabledFor:{test:!0,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableAgentResponse:{owner:"jennietu",createdDate:"04/24/2025",description:"Enables agent response in form designer",enabledFor:{test:!0,preprod:!0,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableDelayedLocalizationForCustomControls:{owner:"aansu",createdDate:"06/08/2025",description:"Enables delayed localization of custom control",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}}}})});function d0(e){return{...e,extractConfig:t=>VO(t,Object.keys(e.fallback))}}function VO(e,t){let r={};for(let n of t)typeof e[n]<"u"&&(r[n]=e[n]);return r}var Tc=D(()=>{"use strict";});var Rc=m((I7,f0)=>{var va=new Proxy(function(){return va},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:va},apply:function(){return va},construct:function(){return{}}}),p0=function(){return va};Object.setPrototypeOf(p0,va);f0.exports=p0});var g0=m((_7,h0)=>{var ba=new Proxy(function(){return ba},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:ba},apply:function(){return ba},construct:function(){return{}}}),m0=function(){return ba};Object.setPrototypeOf(m0,ba);h0.exports=m0});var xc=m((P7,b0)=>{var ya=new Proxy(function(){return ya},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:ya},apply:function(){return ya},construct:function(){return{}}}),v0=function(){return ya};Object.setPrototypeOf(v0,ya);b0.exports=v0});var C0=m((O7,y0)=>{function GO(){this.__data__=[],this.size=0}y0.exports=GO});var Jn=m((F7,A0)=>{function zO(e,t){return e===t||e!==e&&t!==t}A0.exports=zO});var Ca=m((T7,w0)=>{var WO=Jn();function jO(e,t){for(var r=e.length;r--;)if(WO(e[r][0],t))return r;return-1}w0.exports=jO});var S0=m((R7,N0)=>{var HO=Ca(),JO=Array.prototype,QO=JO.splice;function XO(e){var t=this.__data__,r=HO(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():QO.call(t,r,1),--this.size,!0}N0.exports=XO});var E0=m((x7,D0)=>{var KO=Ca();function YO(e){var t=this.__data__,r=KO(t,e);return r<0?void 0:t[r][1]}D0.exports=YO});var _0=m((L7,I0)=>{var ZO=Ca();function eF(e){return ZO(this.__data__,e)>-1}I0.exports=eF});var O0=m((M7,P0)=>{var tF=Ca();function rF(e,t){var r=this.__data__,n=tF(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}P0.exports=rF});var Aa=m((U7,F0)=>{var nF=C0(),iF=S0(),aF=E0(),oF=_0(),sF=O0();function Qn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Qn.prototype.clear=nF;Qn.prototype.delete=iF;Qn.prototype.get=aF;Qn.prototype.has=oF;Qn.prototype.set=sF;F0.exports=Qn});var R0=m((B7,T0)=>{var lF=Aa();function uF(){this.__data__=new lF,this.size=0}T0.exports=uF});var L0=m((k7,x0)=>{function cF(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}x0.exports=cF});var U0=m((q7,M0)=>{function dF(e){return this.__data__.get(e)}M0.exports=dF});var k0=m(($7,B0)=>{function pF(e){return this.__data__.has(e)}B0.exports=pF});var Lc=m((V7,q0)=>{var fF=typeof global=="object"&&global&&global.Object===Object&&global;q0.exports=fF});var xt=m((G7,$0)=>{var mF=Lc(),hF=typeof self=="object"&&self&&self.Object===Object&&self,gF=mF||hF||Function("return this")();$0.exports=gF});var wa=m((z7,V0)=>{var vF=xt(),bF=vF.Symbol;V0.exports=bF});var j0=m((W7,W0)=>{var G0=wa(),z0=Object.prototype,yF=z0.hasOwnProperty,CF=z0.toString,Na=G0?G0.toStringTag:void 0;function AF(e){var t=yF.call(e,Na),r=e[Na];try{e[Na]=void 0;var n=!0}catch{}var i=CF.call(e);return n&&(t?e[Na]=r:delete e[Na]),i}W0.exports=AF});var J0=m((j7,H0)=>{var wF=Object.prototype,NF=wF.toString;function SF(e){return NF.call(e)}H0.exports=SF});var sn=m((H7,K0)=>{var Q0=wa(),DF=j0(),EF=J0(),IF="[object Null]",_F="[object Undefined]",X0=Q0?Q0.toStringTag:void 0;function PF(e){return e==null?e===void 0?_F:IF:X0&&X0 in Object(e)?DF(e):EF(e)}K0.exports=PF});var gr=m((J7,Y0)=>{function OF(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}Y0.exports=OF});var ds=m((Q7,Z0)=>{var FF=sn(),TF=gr(),RF="[object AsyncFunction]",xF="[object Function]",LF="[object GeneratorFunction]",MF="[object Proxy]";function UF(e){if(!TF(e))return!1;var t=FF(e);return t==xF||t==LF||t==RF||t==MF}Z0.exports=UF});var tv=m((X7,ev)=>{var BF=xt(),kF=BF["__core-js_shared__"];ev.exports=kF});var iv=m((K7,nv)=>{var Mc=tv(),rv=(function(){var e=/[^.]+$/.exec(Mc&&Mc.keys&&Mc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function qF(e){return!!rv&&rv in e}nv.exports=qF});var Uc=m((Y7,av)=>{var $F=Function.prototype,VF=$F.toString;function GF(e){if(e!=null){try{return VF.call(e)}catch{}try{return e+""}catch{}}return""}av.exports=GF});var sv=m((Z7,ov)=>{var zF=ds(),WF=iv(),jF=gr(),HF=Uc(),JF=/[\\^$.*+?()[\]{}|]/g,QF=/^\[object .+?Constructor\]$/,XF=Function.prototype,KF=Object.prototype,YF=XF.toString,ZF=KF.hasOwnProperty,eT=RegExp("^"+YF.call(ZF).replace(JF,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function tT(e){if(!jF(e)||WF(e))return!1;var t=zF(e)?eT:QF;return t.test(HF(e))}ov.exports=tT});var uv=m((eV,lv)=>{function rT(e,t){return e?.[t]}lv.exports=rT});var Lr=m((tV,cv)=>{var nT=sv(),iT=uv();function aT(e,t){var r=iT(e,t);return nT(r)?r:void 0}cv.exports=aT});var ps=m((rV,dv)=>{var oT=Lr(),sT=xt(),lT=oT(sT,"Map");dv.exports=lT});var Sa=m((nV,pv)=>{var uT=Lr(),cT=uT(Object,"create");pv.exports=cT});var hv=m((iV,mv)=>{var fv=Sa();function dT(){this.__data__=fv?fv(null):{},this.size=0}mv.exports=dT});var vv=m((aV,gv)=>{function pT(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}gv.exports=pT});var yv=m((oV,bv)=>{var fT=Sa(),mT="__lodash_hash_undefined__",hT=Object.prototype,gT=hT.hasOwnProperty;function vT(e){var t=this.__data__;if(fT){var r=t[e];return r===mT?void 0:r}return gT.call(t,e)?t[e]:void 0}bv.exports=vT});var Av=m((sV,Cv)=>{var bT=Sa(),yT=Object.prototype,CT=yT.hasOwnProperty;function AT(e){var t=this.__data__;return bT?t[e]!==void 0:CT.call(t,e)}Cv.exports=AT});var Nv=m((lV,wv)=>{var wT=Sa(),NT="__lodash_hash_undefined__";function ST(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=wT&&t===void 0?NT:t,this}wv.exports=ST});var Dv=m((uV,Sv)=>{var DT=hv(),ET=vv(),IT=yv(),_T=Av(),PT=Nv();function Xn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Xn.prototype.clear=DT;Xn.prototype.delete=ET;Xn.prototype.get=IT;Xn.prototype.has=_T;Xn.prototype.set=PT;Sv.exports=Xn});var _v=m((cV,Iv)=>{var Ev=Dv(),OT=Aa(),FT=ps();function TT(){this.size=0,this.__data__={hash:new Ev,map:new(FT||OT),string:new Ev}}Iv.exports=TT});var Ov=m((dV,Pv)=>{function RT(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}Pv.exports=RT});var Da=m((pV,Fv)=>{var xT=Ov();function LT(e,t){var r=e.__data__;return xT(t)?r[typeof t=="string"?"string":"hash"]:r.map}Fv.exports=LT});var Rv=m((fV,Tv)=>{var MT=Da();function UT(e){var t=MT(this,e).delete(e);return this.size-=t?1:0,t}Tv.exports=UT});var Lv=m((mV,xv)=>{var BT=Da();function kT(e){return BT(this,e).get(e)}xv.exports=kT});var Uv=m((hV,Mv)=>{var qT=Da();function $T(e){return qT(this,e).has(e)}Mv.exports=$T});var kv=m((gV,Bv)=>{var VT=Da();function GT(e,t){var r=VT(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}Bv.exports=GT});var fs=m((vV,qv)=>{var zT=_v(),WT=Rv(),jT=Lv(),HT=Uv(),JT=kv();function Kn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Kn.prototype.clear=zT;Kn.prototype.delete=WT;Kn.prototype.get=jT;Kn.prototype.has=HT;Kn.prototype.set=JT;qv.exports=Kn});var Vv=m((bV,$v)=>{var QT=Aa(),XT=ps(),KT=fs(),YT=200;function ZT(e,t){var r=this.__data__;if(r instanceof QT){var n=r.__data__;if(!XT||n.length<YT-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new KT(n)}return r.set(e,t),this.size=r.size,this}$v.exports=ZT});var Bc=m((yV,Gv)=>{var eR=Aa(),tR=R0(),rR=L0(),nR=U0(),iR=k0(),aR=Vv();function Yn(e){var t=this.__data__=new eR(e);this.size=t.size}Yn.prototype.clear=tR;Yn.prototype.delete=rR;Yn.prototype.get=nR;Yn.prototype.has=iR;Yn.prototype.set=aR;Gv.exports=Yn});var Wv=m((CV,zv)=>{var oR="__lodash_hash_undefined__";function sR(e){return this.__data__.set(e,oR),this}zv.exports=sR});var Hv=m((AV,jv)=>{function lR(e){return this.__data__.has(e)}jv.exports=lR});var Qv=m((wV,Jv)=>{var uR=fs(),cR=Wv(),dR=Hv();function ms(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new uR;++t<r;)this.add(e[t])}ms.prototype.add=ms.prototype.push=cR;ms.prototype.has=dR;Jv.exports=ms});var Kv=m((NV,Xv)=>{function pR(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}Xv.exports=pR});var Zv=m((SV,Yv)=>{function fR(e,t){return e.has(t)}Yv.exports=fR});var kc=m((DV,eb)=>{var mR=Qv(),hR=Kv(),gR=Zv(),vR=1,bR=2;function yR(e,t,r,n,i,a){var o=r&vR,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var u=a.get(e),c=a.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,g=r&bR?new mR:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var b=e[d],w=t[d];if(n)var N=o?n(w,b,d,t,e,a):n(b,w,d,e,t,a);if(N!==void 0){if(N)continue;f=!1;break}if(g){if(!hR(t,function(_,T){if(!gR(g,T)&&(b===_||i(b,_,r,n,a)))return g.push(T)})){f=!1;break}}else if(!(b===w||i(b,w,r,n,a))){f=!1;break}}return a.delete(e),a.delete(t),f}eb.exports=yR});var qc=m((EV,tb)=>{var CR=xt(),AR=CR.Uint8Array;tb.exports=AR});var nb=m((IV,rb)=>{function wR(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}rb.exports=wR});var ab=m((_V,ib)=>{function NR(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}ib.exports=NR});var cb=m((PV,ub)=>{var ob=wa(),sb=qc(),SR=Jn(),DR=kc(),ER=nb(),IR=ab(),_R=1,PR=2,OR="[object Boolean]",FR="[object Date]",TR="[object Error]",RR="[object Map]",xR="[object Number]",LR="[object RegExp]",MR="[object Set]",UR="[object String]",BR="[object Symbol]",kR="[object ArrayBuffer]",qR="[object DataView]",lb=ob?ob.prototype:void 0,$c=lb?lb.valueOf:void 0;function $R(e,t,r,n,i,a,o){switch(r){case qR:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case kR:return!(e.byteLength!=t.byteLength||!a(new sb(e),new sb(t)));case OR:case FR:case xR:return SR(+e,+t);case TR:return e.name==t.name&&e.message==t.message;case LR:case UR:return e==t+"";case RR:var s=ER;case MR:var l=n&_R;if(s||(s=IR),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;n|=PR,o.set(e,t);var c=DR(s(e),s(t),n,i,a,o);return o.delete(e),c;case BR:if($c)return $c.call(e)==$c.call(t)}return!1}ub.exports=$R});var pb=m((OV,db)=>{function VR(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}db.exports=VR});var Mr=m((FV,fb)=>{var GR=Array.isArray;fb.exports=GR});var hb=m((TV,mb)=>{var zR=pb(),WR=Mr();function jR(e,t,r){var n=t(e);return WR(e)?n:zR(n,r(e))}mb.exports=jR});var vb=m((RV,gb)=>{function HR(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}gb.exports=HR});var yb=m((xV,bb)=>{function JR(){return[]}bb.exports=JR});var wb=m((LV,Ab)=>{var QR=vb(),XR=yb(),KR=Object.prototype,YR=KR.propertyIsEnumerable,Cb=Object.getOwnPropertySymbols,ZR=Cb?function(e){return e==null?[]:(e=Object(e),QR(Cb(e),function(t){return YR.call(e,t)}))}:XR;Ab.exports=ZR});var Sb=m((MV,Nb)=>{function ex(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}Nb.exports=ex});var Ur=m((UV,Db)=>{function tx(e){return e!=null&&typeof e=="object"}Db.exports=tx});var Ib=m((BV,Eb)=>{var rx=sn(),nx=Ur(),ix="[object Arguments]";function ax(e){return nx(e)&&rx(e)==ix}Eb.exports=ax});var Vc=m((kV,Ob)=>{var _b=Ib(),ox=Ur(),Pb=Object.prototype,sx=Pb.hasOwnProperty,lx=Pb.propertyIsEnumerable,ux=_b((function(){return arguments})())?_b:function(e){return ox(e)&&sx.call(e,"callee")&&!lx.call(e,"callee")};Ob.exports=ux});var Tb=m((qV,Fb)=>{function cx(){return!1}Fb.exports=cx});var hs=m((Ea,Zn)=>{var dx=xt(),px=Tb(),Lb=typeof Ea=="object"&&Ea&&!Ea.nodeType&&Ea,Rb=Lb&&typeof Zn=="object"&&Zn&&!Zn.nodeType&&Zn,fx=Rb&&Rb.exports===Lb,xb=fx?dx.Buffer:void 0,mx=xb?xb.isBuffer:void 0,hx=mx||px;Zn.exports=hx});var gs=m(($V,Mb)=>{var gx=9007199254740991,vx=/^(?:0|[1-9]\d*)$/;function bx(e,t){var r=typeof e;return t=t??gx,!!t&&(r=="number"||r!="symbol"&&vx.test(e))&&e>-1&&e%1==0&&e<t}Mb.exports=bx});var Gc=m((VV,Ub)=>{var yx=9007199254740991;function Cx(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=yx}Ub.exports=Cx});var kb=m((GV,Bb)=>{var Ax=sn(),wx=Gc(),Nx=Ur(),Sx="[object Arguments]",Dx="[object Array]",Ex="[object Boolean]",Ix="[object Date]",_x="[object Error]",Px="[object Function]",Ox="[object Map]",Fx="[object Number]",Tx="[object Object]",Rx="[object RegExp]",xx="[object Set]",Lx="[object String]",Mx="[object WeakMap]",Ux="[object ArrayBuffer]",Bx="[object DataView]",kx="[object Float32Array]",qx="[object Float64Array]",$x="[object Int8Array]",Vx="[object Int16Array]",Gx="[object Int32Array]",zx="[object Uint8Array]",Wx="[object Uint8ClampedArray]",jx="[object Uint16Array]",Hx="[object Uint32Array]",ie={};ie[kx]=ie[qx]=ie[$x]=ie[Vx]=ie[Gx]=ie[zx]=ie[Wx]=ie[jx]=ie[Hx]=!0;ie[Sx]=ie[Dx]=ie[Ux]=ie[Ex]=ie[Bx]=ie[Ix]=ie[_x]=ie[Px]=ie[Ox]=ie[Fx]=ie[Tx]=ie[Rx]=ie[xx]=ie[Lx]=ie[Mx]=!1;function Jx(e){return Nx(e)&&wx(e.length)&&!!ie[Ax(e)]}Bb.exports=Jx});var $b=m((zV,qb)=>{function Qx(e){return function(t){return e(t)}}qb.exports=Qx});var Gb=m((Ia,ei)=>{var Xx=Lc(),Vb=typeof Ia=="object"&&Ia&&!Ia.nodeType&&Ia,_a=Vb&&typeof ei=="object"&&ei&&!ei.nodeType&&ei,Kx=_a&&_a.exports===Vb,zc=Kx&&Xx.process,Yx=(function(){try{var e=_a&&_a.require&&_a.require("util").types;return e||zc&&zc.binding&&zc.binding("util")}catch{}})();ei.exports=Yx});var vs=m((WV,jb)=>{var Zx=kb(),eL=$b(),zb=Gb(),Wb=zb&&zb.isTypedArray,tL=Wb?eL(Wb):Zx;jb.exports=tL});var Wc=m((jV,Hb)=>{var rL=Sb(),nL=Vc(),iL=Mr(),aL=hs(),oL=gs(),sL=vs(),lL=Object.prototype,uL=lL.hasOwnProperty;function cL(e,t){var r=iL(e),n=!r&&nL(e),i=!r&&!n&&aL(e),a=!r&&!n&&!i&&sL(e),o=r||n||i||a,s=o?rL(e.length,String):[],l=s.length;for(var u in e)(t||uL.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||oL(u,l)))&&s.push(u);return s}Hb.exports=cL});var bs=m((HV,Jb)=>{var dL=Object.prototype;function pL(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||dL;return e===r}Jb.exports=pL});var jc=m((JV,Qb)=>{function fL(e,t){return function(r){return e(t(r))}}Qb.exports=fL});var Kb=m((QV,Xb)=>{var mL=jc(),hL=mL(Object.keys,Object);Xb.exports=hL});var Zb=m((XV,Yb)=>{var gL=bs(),vL=Kb(),bL=Object.prototype,yL=bL.hasOwnProperty;function CL(e){if(!gL(e))return vL(e);var t=[];for(var r in Object(e))yL.call(e,r)&&r!="constructor"&&t.push(r);return t}Yb.exports=CL});var Pa=m((KV,ey)=>{var AL=ds(),wL=Gc();function NL(e){return e!=null&&wL(e.length)&&!AL(e)}ey.exports=NL});var ry=m((YV,ty)=>{var SL=Wc(),DL=Zb(),EL=Pa();function IL(e){return EL(e)?SL(e):DL(e)}ty.exports=IL});var iy=m((ZV,ny)=>{var _L=hb(),PL=wb(),OL=ry();function FL(e){return _L(e,OL,PL)}ny.exports=FL});var sy=m((eG,oy)=>{var ay=iy(),TL=1,RL=Object.prototype,xL=RL.hasOwnProperty;function LL(e,t,r,n,i,a){var o=r&TL,s=ay(e),l=s.length,u=ay(t),c=u.length;if(l!=c&&!o)return!1;for(var d=l;d--;){var f=s[d];if(!(o?f in t:xL.call(t,f)))return!1}var g=a.get(e),b=a.get(t);if(g&&b)return g==t&&b==e;var w=!0;a.set(e,t),a.set(t,e);for(var N=o;++d<l;){f=s[d];var _=e[f],T=t[f];if(n)var R=o?n(T,_,f,t,e,a):n(_,T,f,e,t,a);if(!(R===void 0?_===T||i(_,T,r,n,a):R)){w=!1;break}N||(N=f=="constructor")}if(w&&!N){var M=e.constructor,W=t.constructor;M!=W&&"constructor"in e&&"constructor"in t&&!(typeof M=="function"&&M instanceof M&&typeof W=="function"&&W instanceof W)&&(w=!1)}return a.delete(e),a.delete(t),w}oy.exports=LL});var uy=m((tG,ly)=>{var ML=Lr(),UL=xt(),BL=ML(UL,"DataView");ly.exports=BL});var dy=m((rG,cy)=>{var kL=Lr(),qL=xt(),$L=kL(qL,"Promise");cy.exports=$L});var fy=m((nG,py)=>{var VL=Lr(),GL=xt(),zL=VL(GL,"Set");py.exports=zL});var hy=m((iG,my)=>{var WL=Lr(),jL=xt(),HL=WL(jL,"WeakMap");my.exports=HL});var Ny=m((aG,wy)=>{var Hc=uy(),Jc=ps(),Qc=dy(),Xc=fy(),Kc=hy(),Ay=sn(),ti=Uc(),gy="[object Map]",JL="[object Object]",vy="[object Promise]",by="[object Set]",yy="[object WeakMap]",Cy="[object DataView]",QL=ti(Hc),XL=ti(Jc),KL=ti(Qc),YL=ti(Xc),ZL=ti(Kc),ln=Ay;(Hc&&ln(new Hc(new ArrayBuffer(1)))!=Cy||Jc&&ln(new Jc)!=gy||Qc&&ln(Qc.resolve())!=vy||Xc&&ln(new Xc)!=by||Kc&&ln(new Kc)!=yy)&&(ln=function(e){var t=Ay(e),r=t==JL?e.constructor:void 0,n=r?ti(r):"";if(n)switch(n){case QL:return Cy;case XL:return gy;case KL:return vy;case YL:return by;case ZL:return yy}return t});wy.exports=ln});var Fy=m((oG,Oy)=>{var Yc=Bc(),eM=kc(),tM=cb(),rM=sy(),Sy=Ny(),Dy=Mr(),Ey=hs(),nM=vs(),iM=1,Iy="[object Arguments]",_y="[object Array]",ys="[object Object]",aM=Object.prototype,Py=aM.hasOwnProperty;function oM(e,t,r,n,i,a){var o=Dy(e),s=Dy(t),l=o?_y:Sy(e),u=s?_y:Sy(t);l=l==Iy?ys:l,u=u==Iy?ys:u;var c=l==ys,d=u==ys,f=l==u;if(f&&Ey(e)){if(!Ey(t))return!1;o=!0,c=!1}if(f&&!c)return a||(a=new Yc),o||nM(e)?eM(e,t,r,n,i,a):tM(e,t,l,r,n,i,a);if(!(r&iM)){var g=c&&Py.call(e,"__wrapped__"),b=d&&Py.call(t,"__wrapped__");if(g||b){var w=g?e.value():e,N=b?t.value():t;return a||(a=new Yc),i(w,N,r,n,a)}}return f?(a||(a=new Yc),rM(e,t,r,n,i,a)):!1}Oy.exports=oM});var Ly=m((sG,xy)=>{var sM=Fy(),Ty=Ur();function Ry(e,t,r,n,i){return e===t?!0:e==null||t==null||!Ty(e)&&!Ty(t)?e!==e&&t!==t:sM(e,t,r,n,Ry,i)}xy.exports=Ry});var Uy=m((lG,My)=>{var lM=Ly();function uM(e,t){return lM(e,t)}My.exports=uM});var Zc=m((uG,By)=>{var cM=Lr(),dM=(function(){try{var e=cM(Object,"defineProperty");return e({},"",{}),e}catch{}})();By.exports=dM});var Cs=m((cG,qy)=>{var ky=Zc();function pM(e,t,r){t=="__proto__"&&ky?ky(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}qy.exports=pM});var ed=m((dG,$y)=>{var fM=Cs(),mM=Jn();function hM(e,t,r){(r!==void 0&&!mM(e[t],r)||r===void 0&&!(t in e))&&fM(e,t,r)}$y.exports=hM});var Gy=m((pG,Vy)=>{function gM(e){return function(t,r,n){for(var i=-1,a=Object(t),o=n(t),s=o.length;s--;){var l=o[e?s:++i];if(r(a[l],l,a)===!1)break}return t}}Vy.exports=gM});var Wy=m((fG,zy)=>{var vM=Gy(),bM=vM();zy.exports=bM});var Xy=m((Oa,ri)=>{var yM=xt(),Qy=typeof Oa=="object"&&Oa&&!Oa.nodeType&&Oa,jy=Qy&&typeof ri=="object"&&ri&&!ri.nodeType&&ri,CM=jy&&jy.exports===Qy,Hy=CM?yM.Buffer:void 0,Jy=Hy?Hy.allocUnsafe:void 0;function AM(e,t){if(t)return e.slice();var r=e.length,n=Jy?Jy(r):new e.constructor(r);return e.copy(n),n}ri.exports=AM});var Zy=m((mG,Yy)=>{var Ky=qc();function wM(e){var t=new e.constructor(e.byteLength);return new Ky(t).set(new Ky(e)),t}Yy.exports=wM});var tC=m((hG,eC)=>{var NM=Zy();function SM(e,t){var r=t?NM(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}eC.exports=SM});var nC=m((gG,rC)=>{function DM(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}rC.exports=DM});var oC=m((vG,aC)=>{var EM=gr(),iC=Object.create,IM=(function(){function e(){}return function(t){if(!EM(t))return{};if(iC)return iC(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();aC.exports=IM});var td=m((bG,sC)=>{var _M=jc(),PM=_M(Object.getPrototypeOf,Object);sC.exports=PM});var uC=m((yG,lC)=>{var OM=oC(),FM=td(),TM=bs();function RM(e){return typeof e.constructor=="function"&&!TM(e)?OM(FM(e)):{}}lC.exports=RM});var dC=m((CG,cC)=>{var xM=Pa(),LM=Ur();function MM(e){return LM(e)&&xM(e)}cC.exports=MM});var mC=m((AG,fC)=>{var UM=sn(),BM=td(),kM=Ur(),qM="[object Object]",$M=Function.prototype,VM=Object.prototype,pC=$M.toString,GM=VM.hasOwnProperty,zM=pC.call(Object);function WM(e){if(!kM(e)||UM(e)!=qM)return!1;var t=BM(e);if(t===null)return!0;var r=GM.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&pC.call(r)==zM}fC.exports=WM});var rd=m((wG,hC)=>{function jM(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}hC.exports=jM});var nd=m((NG,gC)=>{var HM=Cs(),JM=Jn(),QM=Object.prototype,XM=QM.hasOwnProperty;function KM(e,t,r){var n=e[t];(!(XM.call(e,t)&&JM(n,r))||r===void 0&&!(t in e))&&HM(e,t,r)}gC.exports=KM});var bC=m((SG,vC)=>{var YM=nd(),ZM=Cs();function eU(e,t,r,n){var i=!r;r||(r={});for(var a=-1,o=t.length;++a<o;){var s=t[a],l=n?n(r[s],e[s],s,r,e):void 0;l===void 0&&(l=e[s]),i?ZM(r,s,l):YM(r,s,l)}return r}vC.exports=eU});var CC=m((DG,yC)=>{function tU(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}yC.exports=tU});var wC=m((EG,AC)=>{var rU=gr(),nU=bs(),iU=CC(),aU=Object.prototype,oU=aU.hasOwnProperty;function sU(e){if(!rU(e))return iU(e);var t=nU(e),r=[];for(var n in e)n=="constructor"&&(t||!oU.call(e,n))||r.push(n);return r}AC.exports=sU});var id=m((IG,NC)=>{var lU=Wc(),uU=wC(),cU=Pa();function dU(e){return cU(e)?lU(e,!0):uU(e)}NC.exports=dU});var DC=m((_G,SC)=>{var pU=bC(),fU=id();function mU(e){return pU(e,fU(e))}SC.exports=mU});var FC=m((PG,OC)=>{var EC=ed(),hU=Xy(),gU=tC(),vU=nC(),bU=uC(),IC=Vc(),_C=Mr(),yU=dC(),CU=hs(),AU=ds(),wU=gr(),NU=mC(),SU=vs(),PC=rd(),DU=DC();function EU(e,t,r,n,i,a,o){var s=PC(e,r),l=PC(t,r),u=o.get(l);if(u){EC(e,r,u);return}var c=a?a(s,l,r+"",e,t,o):void 0,d=c===void 0;if(d){var f=_C(l),g=!f&&CU(l),b=!f&&!g&&SU(l);c=l,f||g||b?_C(s)?c=s:yU(s)?c=vU(s):g?(d=!1,c=hU(l,!0)):b?(d=!1,c=gU(l,!0)):c=[]:NU(l)||IC(l)?(c=s,IC(s)?c=DU(s):(!wU(s)||AU(s))&&(c=bU(l))):d=!1}d&&(o.set(l,c),i(c,l,n,a,o),o.delete(l)),EC(e,r,c)}OC.exports=EU});var ad=m((OG,RC)=>{var IU=Bc(),_U=ed(),PU=Wy(),OU=FC(),FU=gr(),TU=id(),RU=rd();function TC(e,t,r,n,i){e!==t&&PU(t,function(a,o){if(i||(i=new IU),FU(a))OU(e,t,o,r,TC,n,i);else{var s=n?n(RU(e,o),a,o+"",e,t,i):void 0;s===void 0&&(s=a),_U(e,o,s)}},TU)}RC.exports=TC});var od=m((FG,xC)=>{function xU(e){return e}xC.exports=xU});var MC=m((TG,LC)=>{function LU(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}LC.exports=LU});var kC=m((RG,BC)=>{var MU=MC(),UC=Math.max;function UU(e,t,r){return t=UC(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=UC(n.length-t,0),o=Array(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(o),MU(e,this,s)}}BC.exports=UU});var $C=m((xG,qC)=>{function BU(e){return function(){return e}}qC.exports=BU});var zC=m((LG,GC)=>{var kU=$C(),VC=Zc(),qU=od(),$U=VC?function(e,t){return VC(e,"toString",{configurable:!0,enumerable:!1,value:kU(t),writable:!0})}:qU;GC.exports=$U});var jC=m((MG,WC)=>{var VU=800,GU=16,zU=Date.now;function WU(e){var t=0,r=0;return function(){var n=zU(),i=GU-(n-r);if(r=n,i>0){if(++t>=VU)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}WC.exports=WU});var JC=m((UG,HC)=>{var jU=zC(),HU=jC(),JU=HU(jU);HC.exports=JU});var XC=m((BG,QC)=>{var QU=od(),XU=kC(),KU=JC();function YU(e,t){return KU(XU(e,t,QU),e+"")}QC.exports=YU});var YC=m((kG,KC)=>{var ZU=Jn(),eB=Pa(),tB=gs(),rB=gr();function nB(e,t,r){if(!rB(r))return!1;var n=typeof t;return(n=="number"?eB(r)&&tB(t,r.length):n=="string"&&t in r)?ZU(r[t],e):!1}KC.exports=nB});var sd=m((qG,ZC)=>{var iB=XC(),aB=YC();function oB(e){return iB(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,o&&aB(r[0],r[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,a)}return t})}ZC.exports=oB});var tA=m(($G,eA)=>{var sB=ad(),lB=sd(),uB=lB(function(e,t,r,n){sB(e,t,r,n)});eA.exports=uB});var Ct,Fa=D(()=>{"use strict";(function(e){e[e.NotLoaded=0]="NotLoaded",e[e.Initialized=1]="Initialized",e[e.ConfigsLoaded=2]="ConfigsLoaded",e[e.Error=3]="Error"})(Ct||(Ct={}))});function nA(e,t,r="PROD"){let n=i=>`ShellSettings_ECS_ClientCache_${e}_${rA.EcsConfigType[i]}_${r}`;return{getData:i=>{let a=t.getItem(n(i));return Promise.resolve(a?JSON.parse(a):void 0)},putData:(i,a)=>(t.setItem(n(i),JSON.stringify(a)),Promise.resolve())}}var rA,cB,iA=D(()=>{"use strict";rA=ne(xc()),cB=ne(Rc());});var ld,aA=D(()=>{"use strict";Yo();ld=pa({packageName:"shell-settings",settings:{prodEcsEndpoint:{description:"The url for the PROD ECS endpoint",values:{default:"https://ecs.office.com",dod:"https://config.ecs.dod.teams.microsoft.us",high:"https://config.ecs.gov.teams.microsoft.us",ex:"https://config.ecs.teams.eaglex.ic.gov",rx:"https://config.ecs.teams.microsoft.scloud"}},integrationEcsEndpoint:{description:"The url for the INT ECS endpoint",values:{default:"https://config.edge.skype.net"}}}})});var sA,lA,uA,cA,ud,dB,As,oA,cd=D(()=>{"use strict";sA=ne(Rc()),lA=ne(g0()),uA=ne(xc()),cA=ne(Uy()),ud=ne(tA());Fa();iA();aA();dB=60*1e3,As=class{clientName;logger;ecsEndpoint;resolveLoadingPromise;loadingPromise=new Promise(t=>this.resolveLoadingPromise=t);_status=Ct.NotLoaded;endpointType;clientConfigOverride;get status(){return this._status}constructor(t,r,n="PROD"){this.clientName=t,this.logger=r,this.endpointType=n,this.ecsEndpoint=n==="PROD"?ld.prodEcsEndpoint:ld.integrationEcsEndpoint}client=new lA.default;init=async({clientVersion:t,getFilters:r,cacheStorage:n=sA.StorageHelper.transientWithGlobalFallback,updateIntervalInMinutes:i,overrideEcsInitParams:a})=>{this.client.telemetryEventAdded.subscribe(this.logger.logEvent),this.client.configUpdated.subscribe(this.handleConfigUpdated);let o=(async()=>{let s=await r();return this.logEvent("FeaturesClient/configRequested",{ecsClientName:this.clientName,filters:s}),s});try{await this.client.initialize({clientName:this.clientName,clientVersion:t??"1.0.0.0",configsToFetch:[uA.EcsConfigType.Default],hosts:[this.ecsEndpoint],initialAppActiveState:!0,getEcsParameters:o,databaseInterface:nA(this.clientName,n,this.endpointType),...a}),this.client.requestUpdate(),this._status===Ct.NotLoaded&&(this._status=Ct.Initialized)}catch(s){this._status=Ct.Error,this.resolveLoadingPromise(),this.logEvent("FeaturesClient/initializationFailed",{ecsClientName:this.clientName,error:s},"Error")}i&&window.setInterval(()=>this.client.requestUpdate(),i*dB)};getConfig=t=>{let r=this.getMergedClientConfigByTeamName(t.teamName),n=r?t.extractConfig(r):{};return(0,ud.default)({},t.fallback,n,t.override,oA)};getAllConfigs=()=>this.getMergedClientConfig();getAllConfigsByTeamName=t=>this.getMergedClientConfigByTeamName(t);requestConfigUpdate=()=>{this.client.requestUpdate()};subscribe=(t,r)=>{let n=this.getConfig(t),i=this.client.configUpdated.subscribe(()=>{let a=this.getConfig(t);(0,cA.default)(a,n)||(n={...a},r(a))});return{unsubscribe:()=>i.unsubscribe()}};waitUntilLoaded=async t=>{if(t!==void 0){let r,n=new Promise((i,a)=>{r=window.setTimeout(()=>{a(new Error("Timed out waiting for configuration to load"))},t)});await Promise.race([this.loadingPromise,n]),clearTimeout(r)}else await this.loadingPromise};overrideClientConfig(t){this.logger.logEvent("FeaturesClient/overrideClientConfig",{clientConfigOverride:t}),this.clientConfigOverride=t}undoClientConfigOverride(){this.clientConfigOverride=void 0,this.logger.logEvent("FeaturesClient/undoClientConfigOverride")}getMergedClientConfig=()=>(0,ud.default)({},this.client.getConfig()?.config,this.clientConfigOverride,oA);getMergedClientConfigByTeamName=t=>this.getMergedClientConfig()?.[t];handleConfigUpdated=()=>{let t=this.client.getConfig();if(t===void 0)return;this.resolveLoadingPromise(),this._status=Ct.ConfigsLoaded;let{ConfigIDs:r,Headers:n}=t.config;this.logEvent("FeaturesClient/configUpdated",{ecsClientName:this.clientName,configIDs:r,ETag:n?.ETag})};logEvent=(t,r)=>{this.logger.logEvent(t,{ecsClientName:this.clientName,ecsEndpointType:this.endpointType,...r})}},oA=(e,t)=>{if(Array.isArray(t))return t}});var pA=m((XG,dA)=>{"use strict";var pB=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};dA.exports=pB});var dd=m((KG,mA)=>{var Ta=new Proxy(function(){return Ta},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Ta},apply:function(){return Ta},construct:function(){return{}}}),fA=function(){return Ta};Object.setPrototypeOf(fA,Ta);mA.exports=fA});var vA=m((YG,gA)=>{var Ra=new Proxy(function(){return Ra},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Ra},apply:function(){return Ra},construct:function(){return{}}}),hA=function(){return Ra};Object.setPrototypeOf(hA,Ra);gA.exports=hA});var SA=m((ZG,NA)=>{"use strict";var pd=vA(),fB={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},mB={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},hB={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},AA={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},fd={};fd[pd.ForwardRef]=hB;fd[pd.Memo]=AA;function bA(e){return pd.isMemo(e)?AA:fd[e.$$typeof]||fB}var gB=Object.defineProperty,vB=Object.getOwnPropertyNames,yA=Object.getOwnPropertySymbols,bB=Object.getOwnPropertyDescriptor,yB=Object.getPrototypeOf,CA=Object.prototype;function wA(e,t,r){if(typeof t!="string"){if(CA){var n=yB(t);n&&n!==CA&&wA(e,n,r)}var i=vB(t);yA&&(i=i.concat(yA(t)));for(var a=bA(e),o=bA(t),s=0;s<i.length;++s){var l=i[s];if(!mB[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var u=bB(t,l);try{gB(e,l,u)}catch{}}}}return e}NA.exports=wA});function EA(e,t,r){let[n,i]=(0,ni.useState)(e.getConfig(t));return(0,ni.useEffect)(()=>{if(!r?.subscribe&&e.status===Ct.ConfigsLoaded)return;let a=e.subscribe(t,o=>{i(o),r?.subscribe||a.unsubscribe()});return a?.unsubscribe},[]),n}function IA(e){return function(t,r){return EA(e,t,r)}}function _A(e,t,r,n){let i=a=>{let o=EA(e,t,n),s={...a,...o};return ni.default.createElement(r,{...s})};return(0,DA.default)(i,r),i.displayName=`WithFeature(${r.name})`,i}function PA(e,t,r,n){return t.reduce((i,a)=>_A(e,a,i,n),r)}function OA(e){return function(t,r,n){return _A(e,t,r,n)}}var DA,ni,md=D(()=>{"use strict";DA=ne(SA()),ni=ne(dd());Fa();});var TA=m((rz,FA)=>{var CB=ad(),AB=sd(),wB=AB(function(e,t,r){CB(e,t,r)});FA.exports=wB});var ws=m((nz,RA)=>{var NB=sn(),SB=Ur(),DB="[object Symbol]";function EB(e){return typeof e=="symbol"||SB(e)&&NB(e)==DB}RA.exports=EB});var LA=m((iz,xA)=>{var IB=Mr(),_B=ws(),PB=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,OB=/^\w*$/;function FB(e,t){if(IB(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||_B(e)?!0:OB.test(e)||!PB.test(e)||t!=null&&e in Object(t)}xA.exports=FB});var BA=m((az,UA)=>{var MA=fs(),TB="Expected a function";function hd(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(TB);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(hd.Cache||MA),r}hd.Cache=MA;UA.exports=hd});var qA=m((oz,kA)=>{var RB=BA(),xB=500;function LB(e){var t=RB(e,function(n){return r.size===xB&&r.clear(),n}),r=t.cache;return t}kA.exports=LB});var VA=m((sz,$A)=>{var MB=qA(),UB=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,BB=/\\(\\)?/g,kB=MB(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(UB,function(r,n,i,a){t.push(i?a.replace(BB,"$1"):n||r)}),t});$A.exports=kB});var zA=m((lz,GA)=>{function qB(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}GA.exports=qB});var XA=m((uz,QA)=>{var WA=wa(),$B=zA(),VB=Mr(),GB=ws(),zB=1/0,jA=WA?WA.prototype:void 0,HA=jA?jA.toString:void 0;function JA(e){if(typeof e=="string")return e;if(VB(e))return $B(e,JA)+"";if(GB(e))return HA?HA.call(e):"";var t=e+"";return t=="0"&&1/e==-zB?"-0":t}QA.exports=JA});var YA=m((cz,KA)=>{var WB=XA();function jB(e){return e==null?"":WB(e)}KA.exports=jB});var ew=m((dz,ZA)=>{var HB=Mr(),JB=LA(),QB=VA(),XB=YA();function KB(e,t){return HB(e)?e:JB(e,t)?[e]:QB(XB(e))}ZA.exports=KB});var rw=m((pz,tw)=>{var YB=ws(),ZB=1/0;function ek(e){if(typeof e=="string"||YB(e))return e;var t=e+"";return t=="0"&&1/e==-ZB?"-0":t}tw.exports=ek});var aw=m((fz,iw)=>{var tk=nd(),rk=ew(),nk=gs(),nw=gr(),ik=rw();function ak(e,t,r,n){if(!nw(e))return e;t=rk(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=ik(t[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=o){var c=s[l];u=n?n(c,l,s):void 0,u===void 0&&(u=nw(c)?c:nk(t[i+1])?[]:{})}tk(s,l,u),s=s[l]}return e}iw.exports=ak});var sw=m((mz,ow)=>{var ok=aw();function sk(e,t,r){return e==null?e:ok(e,t,r)}ow.exports=sk});function dw(e){let{query:t}=(0,cw.default)(window.location.href,!0);return uk(e,t),e}function uk(e,t){let r=lk+e.clientName,n=Object.keys(t).filter(a=>a.startsWith(r));if(!n)return;let i={};n.forEach(a=>{let o=t[a];if(o)try{let s=JSON.parse(o),l=r+pw,u={};if(a===r)u=s;else if(a.startsWith(l)){let c=a.substring(l.length);(0,uw.default)(u,c,s)}(0,lw.default)(i,u)}catch{}}),Object.keys(i).length>0&&e.overrideClientConfig(i)}var lw,uw,cw,pw,lk,fw=D(()=>{"use strict";lw=ne(TA()),uw=ne(sw()),cw=ne(Cc());pw=".",lk="ecs"+pw});function Ss(e,t,r){let n=dw(new As(e,t,r));function i(a){(0,Ns.useEffect)(()=>{n.init(a)},[])}return{featuresClient:n,createFeature:dk(n),useFeaturesClientInitParams:i,withFeatures:(a,o,s)=>PA(n,a,o,s)}}function dk(e){let t=IA(e),r=OA(e);return function(i){let a=d0(i);return a.getConfig=()=>e.getConfig(a),a.isLoaded=()=>e.status===Ct.ConfigsLoaded,Nc.register(a,e.clientName),{useFeature:o=>t(a,o),withFeature:(o,s)=>r(a,o,s),feature:a}}}var ck,Ns,gd=D(()=>{"use strict";ck=ne(pA()),Ns=ne(dd());Tc();cd();Fa();md();fw();Sc();});var mw=D(()=>{"use strict";Tc();cd();gd();Fa();md();rs();Dc();});function Ds(e){return{logEvent:(t,r,n)=>{switch(n){case"Error":(0,ii.trackErrorTrace)(e,{eventName:t,eventData:r});break;case"Warning":(0,ii.trackWarningTrace)(e,{eventName:t,eventData:r});break;default:(0,ii.trackInfoTrace)(e,{eventName:t,eventData:r});break}}}}var ii,vd=D(()=>{"use strict";ii=ne(en());});var xz,Lz,Mz,hw=D(()=>{"use strict";mw();vd();({featuresClient:xz,createFeature:Lz,useFeaturesClientInitParams:Mz}=Ss("PowerApps-Shell-Test",Ds("shell-features")))});var bw=m((Bz,vw)=>{var xa=new Proxy(function(){return xa},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:xa},apply:function(){return xa},construct:function(){return{}}}),gw=function(){return xa};Object.setPrototypeOf(gw,xa);vw.exports=gw});var pk,fk,yw=D(()=>{"use strict";ua();pk=ne(bw()),fk=ne(en());});var Cw=D(()=>{"use strict";hw();vd();yw();});var Hz,ai,Jz,Aw=D(()=>{"use strict";Cw();gd();({featuresClient:Hz,createFeature:ai,useFeaturesClientInitParams:Jz}=Ss("PowerApps-MakerPortal",Ds("powerapps-features")))});var ww,Nw,Yz,Zz,eW,tW,bd=D(()=>{"use strict";c0();Aw();({feature:ww}=ai({teamName:"MakerPortal",owners:["debeshd"],description:"Enable the auto insertion of cell in a row when a section is initialized",createdOn:"09/01/2023",fallback:{enableAutoInsertionOfCellInRow:Hn.enableAutoInsertionOfCellInRow}})),{feature:Nw}=ai({teamName:"MakerPortal",owners:["aansu"],description:"Enable the one grid events for form designer",createdOn:"08/21/2024",fallback:{enableOneGridEventsForFormDesigner:Hn.enableOneGridEvents}}),{feature:Yz}=ai({teamName:"MakerPortal",owners:["adekulkarni"],description:"Disables PBI components and cleans them up from the form",createdOn:"01/03/2023",fallback:{enableFallbackFormTemplate:Hn.disablePBIComponents}}),{feature:Zz}=ai({teamName:"MakerPortal",owners:["jennietu"],description:"Enables agent response in form designer. This feature is used to enable the agent response in form designer",createdOn:"04/24/2025",fallback:{enableAgentResponse:Hn.enableAgentResponse}}),{feature:eW,useFeature:tW}=ai({teamName:"MakerPortal",owners:["aansu"],description:"Enables delayed localization of custom control",createdOn:"06/08/2025",fallback:{enableDelayedLocalizationForCustomControls:Hn.enableDelayedLocalizationForCustomControls}})});var Ew=m((nW,Dw)=>{var La=new Proxy(function(){return La},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:La},apply:function(){return La},construct:function(){return{}}}),Sw=function(){return La};Object.setPrototypeOf(Sw,La);Dw.exports=Sw});var We,Br=D(()=>{"use strict";Se();Ce();ze();us();G();xe();We=class extends q{static HighestUsedIndexByClass=new Map;get colspan(){let t=this.getProperty(p.colspan);return S.IsNullOrUndefined(t)?null:parseInt(t,10)}set colspan(t){S.IsNullOrUndefined(t)||this.setProperty(p.colspan,String(t))}constructor(t,r){super(t,r)}get id(){let t=this.getProperty(p.id);return t==null?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new I(t.substr(1,t.length-2)):new I(t)}set id(t){this.setProperty(p.id,`{${t.ToString()}}`)}set labelId(t){this.setProperty(p.labelId,`{${t.ToString()}}`)}get labelId(){let t=this.getProperty(p.labelId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new I(t.substr(1,t.length-2)):new I(t)}get Name(){return this.getProperty(p.Name)}set Name(t){this.setProperty(p.Name,t)}setDisplayName(t,r){for(let i of this.getAllLabels())if(+i.getProperty(p.languagecode)===r){i.setProperty(p.description,t);return}let n=new q(h.formLabel,null);n.setProperty(p.description,t),n.setProperty(p.languagecode,String(r)),this.addGrandChild("labels",n)}getDisplayName(t){for(let r of this.getAllLabels())if(+r.getProperty(p.languagecode)===t)return r.getProperty(p.description)}getAllLabels(){let t=this.getChildren("labels");return t.length!==1?[]:t[0].getChildren("label")}get isLocked(){return+this.getProperty(p.locklevel)==1}set isLocked(t){!this.IsUnboundControl&&this.setProperty(p.locklevel,t?"1":"0")}get availableforphone(){return this.getProcessedValue(p.availableforphone)}set availableforphone(t){S.IsNullOrUndefined(t)||!this.IsAllowedUBCForAvailableOnPhone()||this.setProperty(p.availableforphone,String(t))}get visible(){return this.getProcessedValue(p.visible)}set visible(t){S.IsNullOrUndefined(t)||!this.IsAllowedUBCForVisibleByDefault()||this.setProperty(p.visible,String(t))}isLockLevelSettable(){return!this.IsUnboundControl}get showlabel(){return this.getProcessedValue(p.showlabel)}set showlabel(t){S.IsNullOrUndefined(t)||this.setProperty(p.showlabel,String(t))}isAvailableForPhoneSettable(){return this.IsAllowedUBCForAvailableOnPhone()}isVisibleSettable(){return this.IsAllowedUBCForVisibleByDefault()}getProcessedValue(t){let r=this.getProperty(t);return S.IsNullOrUndefined(r)||this.getProperty(t)==="true"}get readonly(){let t=this.getFirstChild(h.formControl);return t?t.disabled:!1}set readonly(t){let r=this.getFirstChild(h.formControl);r&&(r.disabled=t)}get allowfilteroff(){let t=this.getFirstChild(h.formControl);if(t)return t.getParam(p.AllowFilterOff)==="true"}set allowfilteroff(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(p.AllowFilterOff,t)}get autoresolve(){let t=this.getFirstChild(h.formControl);if(t)return t.getParam(p.AutoResolve)==="true"}set autoresolve(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(p.AutoResolve,t)}get defaultviewid(){let t=this.getFirstChild(h.formControl);return t?t.getParam(p.DefaultViewId):P.EmptyString}set defaultviewid(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(p.DefaultViewId,t)}get dependentattributename(){let t=this.getFirstChild(h.formControl);return t?t.getParam(p.DependentAttributeName):P.EmptyString}set dependentattributename(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(p.DependentAttributeName,t)}get dependentattributetype(){let t=this.getFirstChild(h.formControl);return t?t.getParam(p.DependentAttributeType):P.EmptyString}set dependentattributetype(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(p.DependentAttributeType,t)}get disablequickfind(){let t=this.getFirstChild(h.formControl);if(t)return t.getParam(p.DisableQuickFind)==="true"}set disablequickfind(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(p.DisableQuickFind,t)}get disableviewpicker(){let t=this.getFirstChild(h.formControl);if(t)return t.getParam(p.DisableViewPicker)==="true"}set disableviewpicker(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(p.DisableViewPicker,t)}get filterrelationshipname(){let t=this.getFirstChild(h.formControl);return t?t.getParam(p.FilterRelationshipName):P.EmptyString}set filterrelationshipname(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(p.FilterRelationshipName,t)}get availableviewids(){let t=this.getFirstChild(h.formControl);return t?t.getParam(p.AvailableViewIds):P.EmptyString}set availableviewids(t){let r=this.getFirstChild(h.formControl);r&&!this.IsUnboundControl&&r.setParameter(p.AvailableViewIds,t)}get IsUnboundControl(){let t=this.getFirstChild(h.formControl);if(t&&t.ClassId){let r=Ee.getUniqueIdentifierForControl(t);return!S.IsNullOrUndefined(r)&&Ee.isUnboundFormControlByIdentifier(r)}else return!1}IsAllowedUBCForAvailableOnPhone(){let t=this.getFirstChild(h.formControl);if(t){let n=Ee.getUniqueIdentifierForControl(t).guidString,i=n===F.GridControl||n===F.TimeLineControl||n===F.TimeLineControlUC;return this.IsUnboundControl?i:!0}return this.NodeName===h.formSection||this.NodeName===h.formTab}IsAllowedUBCForVisibleByDefault(){let t=this.getFirstChild(h.formControl);if(t){let n=Ee.getUniqueIdentifierForControl(t).guidString,i=n===F.MapsControl||n===F.WebResourceHtmlControl||n===F.WebResourceImageControl||n===F.IframeControl||n===F.SocialInsightControl;return this.IsUnboundControl?i:!0}else return!0}get events(){let t=this.getChildren(h.formEvents);return t.length===1?t[0].getAllChildren():[]}addEvent(t){this.addGrandChild(h.formEvents,t)}getUsedNodeNameSet(t){return null}getHighestIndexById(t,r){return null}}});var oi,yd=D(()=>{"use strict";ze();G();xe();oi=class extends q{constructor(t,r){super(h.dependency,t),P.IsNullOrEmpty(r)||this.setDefaultProperties(r)}set id(t){this.setProperty(p.id,t)}get id(){return this.getProperty(p.id)}setDefaultProperties(t){this.id=t}}});var Iw,si,Cd=D(()=>{"use strict";Ce();yd();G();xe();Br();(function(e){e[e.Form=0]="Form",e[e.Cell=1]="Cell",e[e.Tab=2]="Tab",e[e.Control=3]="Control"})(Iw||(Iw={}));si=class extends We{constructor(t,r){super(h.formEvent,t),r&&(this.eventName=r,this.application="false",this.active="false")}set eventName(t){this.setProperty(p.Name,t)}get eventName(){return this.getProperty(p.Name)}set application(t){this.setProperty(p.application,t)}get application(){return this.getProperty(p.application)}set attribute(t){this.setProperty(p.EventAttribute,t)}get attribute(){return this.getProperty(p.EventAttribute)}set relationship(t){this.setProperty(p.Relationship,t)}get relationship(){return this.getProperty(p.Relationship)}set control(t){this.setProperty(p.Control,t)}get control(){return this.getProperty(p.Control)}set active(t){this.setProperty(p.EventActive,t)}get active(){return this.getProperty(p.EventActive)}getAllHandlers(){let t=this.getChildren(h.EventHandlers);return t&&t.length?t[0].getChildren(h.handler):[]}getAllDependencies(){let t=this.getChildren(h.formDependencies);return t.length===0?[]:t[0].getAllChildren()}setDependencies(t){let r=this.getFirstChild(h.formDependencies);if(S.IsNullOrUndefined(r)){if(t.length===0)return;this.addChild(new q(h.formDependencies,this)),r=this.getFirstChild(h.formDependencies)}if(t.length===0)r.getParentNode().deleteChild(r);else{r.deleteAllChildren();for(let n of t)r.addChild(new oi(r,n.toString()))}}}});var Lt,Ma=D(()=>{"use strict";Se();la();Ce();Zr();G();xe();Tt();Lt=class extends q{previewVersion;constructor(t){super(h.formControl,t)}updatePreview(){this.previewVersion=Date.now()}get ClassId(){let t=this.getProperty(p.classid);return t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new I(t)}set ClassId(t){this.setProperty(p.classid,`{${t.ToString()}}`)}get dataFieldName(){return this.getProperty(p.datafieldname)}set dataFieldName(t){this.setProperty(p.datafieldname,t)}set id(t){this.setProperty(p.id,t)}get id(){return this.getProperty(p.id)}get UniqueId(){let t=this.getProperty(p.uniqueid);return S.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new I(t))}set UniqueId(t){this.setProperty(p.uniqueid,`{${t.ToString()}}`)}get isRequired(){return this.getProperty(p.isRequired)==="true"}set isRequired(t){S.IsNullOrUndefined(t)||this.setProperty(p.isRequired,String(t))}get disableMru(){return this.getParam(p.DisableMru)==="true"}set disableMru(t){S.IsNullOrUndefined(t)||this.setParameter(p.DisableMru,t)}get useMFDForCreate(){return this.getParam(p.UseMFDForCreate)==="true"}set useMFDForCreate(t){S.IsNullOrUndefined(t)||this.setParameter(p.UseMFDForCreate,t)}get useMFDForEdit(){return this.getParam(p.UseMFDForEdit)==="true"}set useMFDForEdit(t){S.IsNullOrUndefined(t)||this.setParameter(p.UseMFDForEdit,t)}get disabled(){return this.getProperty(p.disabled)==="true"}set disabled(t){S.IsNullOrUndefined(t)||this.setProperty(p.disabled,String(t))}get indicationOfSubgrid(){return this.getProperty(p.indicationOfSubgrid)==="true"}set indicationOfSubgrid(t){this.setProperty(p.indicationOfSubgrid,String(t))}getAllParameters(){let t=new Xe,r=this.getFirstChild(p.parameters);return r&&r.getAllChildren().forEach(n=>{if(n){let i=n.getAllChildren(),a=i&&i.length>0&&i[0];a&&t.add(n.getNodeName(),a.getNodeName())}}),t}setParameter(t,r){let n=!1;r===null&&(n=!0);let i=(hr.StartTag+r).toString(),a=this.parametersNode;if(a){let o=a.findFirst(s=>s&&s.getNodeName()===t);if(o)if(n){this.deleteFirstGrandChildOfName(h.controlParameters,o);return}else{let s=o.getAllChildren();s&&s.length>0&&s[0]?s[0].setNodeName(i):o.addChild(new q(i,o))}else n||(o=new q(t,a),o.addChild(new q(i,o)),a.addChild(o))}else if(!n){a=new q("parameters",this);let o=new q(t,a);o.addChild(new q(i,o)),a.addChild(o),this.addChild(a)}}getParam(t){if(this.parametersNode){let r=this.parametersNode.findFirst(n=>n&&n.getNodeName()===t);if(r){let n=r.getAllChildren(),i=n&&n.length>0&&n[0];if(i){let a=i.getNodeName();return a.charAt(0)===hr.StartTag?a.substring(1):a}}}return null}get parametersNode(){let t=this.getChildren(p.parameters);return t.length===0?null:t[0]}async serializeParameters(t,r){let n=new Xe;switch(this.ClassId.guidString.toUpperCase()){case A.LookupControl:if(t&&t.getKeys())if(t.getKeys().forEach(o=>{n.add(o,this.getParam(o))}),t&&t.containsKey("DefaultViewId")){let o=this.getParam("DefaultViewId").replace("{","").replace("}","");n.upsert("DefaultViewId",o)}else{let o=this.getParent(),s=await r.formModelService.lookupControlService.populateDefaultView(this,o.getParentForm().entityName);s&&s.id&&n.upsert("DefaultViewId",s.id.replace("{","").replace("}",""))}break;default:t&&t.getKeys()&&t.getKeys().forEach(o=>{n.add(o,this.getParam(o))});break}let i=n.getInternalObject(),a=[];for(let o in i)i.hasOwnProperty(o)&&a.push({Name:o,Value:i[o]});return a}getIsUnbound(){return this.getProperty(p.isUnbound)==="true"}getAttributeTypeFromClassId(t){if(t)switch(t.toUpperCase()){case A.BooleanControl:case A.CheckboxControl:return 0;case A.DateTimeControl:return 2;case A.DecimalControl:return 3;case A.FloatingNumberControl:return 4;case A.IntegerControl:case A.DurationControl:case A.LanguageControl:case A.TimezoneControl:return 5;case A.LookupControl:return 6;case A.CurrencyControl:return 8;case A.PartyListControl:return 10;case A.ChoiceControl:case A.RelationshipRoleChoiceControl:return 11;case A.ChoiceStatusControl:return 13;case A.TextAreaControl:case A.TextboxControl:case A.LabelControl:case A.EmailAddressControl:case A.UrlControl:case A.TickerControl:case A.ButtonControl:case A.PhoneNumberControl:return 14;case A.ChoicesControl:return 24;default:return}return 14}async toJSON(t){let r=this.getParent(),n=t&&t.formModelService&&t.formModelService.getFormType()===De.QuickViewForm?!0:this.disabled,i=await this.serializeParameters(this.getAllParameters(),t);return{ClassId:this.ClassId&&this.ClassId.guidString,Parameters:i,Disabled:n,ControlLayout:0,RequiredLevel:0,Type:this.getAttributeTypeFromClassId(this.ClassId.guidString),IsUnbound:this.getIsUnbound(),IsRequired:this.isRequired,DataFieldName:this.dataFieldName,UniqueId:this.UniqueId&&this.UniqueId.guidString,Id:this.previewVersion?this.id+this.previewVersion:this.id,Label:r.getDisplayName(t.langCode),LabelId:r.labelId&&r.labelId.guidString,Name:null,ShowLabel:r.showlabel,PreviewId:r&&r.id.guidString,Visible:r.visible||t.formModelService.showHiddenElements}}}});var li,Ad=D(()=>{"use strict";ze();$n();Ma();G();xe();li=class extends Lt{constructor(t){super(t)}get targetEntityType(){return this.getParam(p.targetEntityType)||P.EmptyString}set targetEntityType(t){this.setParameter(p.targetEntityType,t)}get viewId(){return P.StripBraces(this.getParam(p.viewId))||P.EmptyString}set viewId(t){this.setParameter(p.viewId,P.AddBraces(t))}get viewIds(){return this.getParam(p.viewIds)||P.EmptyString}set viewIds(t){this.setParameter(p.viewIds,t)}get relationshipName(){return this.getParam(p.RelationshipName)||P.EmptyString}set relationshipName(t){this.setParameter(p.RelationshipName,t)}get isUserView(){return P.IsStrictTrue(this.getParam(p.isUserView))}set isUserView(t){this.setParameter(p.isUserView,t.toString())}get enableViewPicker(){return P.IsStrictTrue(this.getParam(p.enableViewPicker))}set enableViewPicker(t){this.setParameter(p.enableViewPicker,t)}get autoExpand(){return this.getParent().autoexpand&&this.getParam(p.autoExpand)===p.Auto}set autoExpand(t){let r=this.getParent();this.setParameter(p.autoExpand,t?p.Auto:p.Fixed),r.autoexpand=t}get recordsPerPage(){return this.getParam(p.recordsPerPage)?Number(this.getParam(p.recordsPerPage)):Number(p.RecordsPerPageRAControlDefault)}set recordsPerPage(t){this.setParameter(p.recordsPerPage,String(t))}get enableQuickFind(){return P.IsStrictTrue(this.getParam(p.enableQuickFind))}set enableQuickFind(t){this.setParameter(p.enableQuickFind,t)}get teamTemplateId(){return P.StripBraces(this.getParam(p.teamTemplateId))||P.EmptyString}set teamTemplateId(t){this.setParameter(p.teamTemplateId,P.AddBraces(t))}get chartId(){return this.getParam(p.visualizationId)||P.EmptyString}set chartId(t){this.setParameter(p.visualizationId,t)}get enableChartPicker(){return P.IsStrictTrue(this.getParam(p.enableChartPicker))}set enableChartPicker(t){this.setParameter(p.enableChartPicker,t)}get chartGridMode(){switch(this.getParam(p.chartGridMode)){case yt.Chart:return yt.Chart;case yt.Grid:return yt.Grid;default:return yt.All}}set chartGridMode(t){this.setParameter(p.chartGridMode,t)}updateChartGridMode(t){t?this.chartGridMode=yt.Chart:this.chartGridMode=this.enableChartPicker?yt.All:yt.Grid}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case p.targetEntityType:n.getAllChildren()[0].setNodeName("<"+r.targetEntityType);break;case p.viewId:n.getAllChildren()[0].setNodeName("<"+P.AddBraces(r.viewId));break;case p.isUserView:n.getAllChildren()[0].setNodeName("<"+r.isUserView);break;case p.enableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.enableViewPicker);break;case p.RelationshipName:let i=n.getAllChildren(),a="<"+r.relationshipName;i.length?n.getAllChildren()[0].setNodeName(a):n.addChild(new q(a,n));break;default:break}}updateControlDescription(t){let r=t.getControlDescriptionByForControl(this.UniqueId);if(r){let n=r.customControls;for(let i=0;i<n.length;i++){let a=n[i].getParameters().get(Ke.dataset)?n[i].getParameters().get(Ke.dataset)[0]:null;if(a){let o=a.getAllChildren();this.updateDefaultProperties(o,this)}else{let o=n[i].getAllChildren()[0].getAllChildren();this.updateDefaultProperties(o,this)}}}}}});var ui,wd=D(()=>{"use strict";ze();$n();Ma();G();ui=class extends Lt{constructor(t){super(t)}get defaultViewId(){return P.StripBraces(this.getParam(p.DefaultViewId))||P.EmptyString}set defaultViewId(t){this.setParameter(p.DefaultViewId,P.AddBraces(t))}get autoResolve(){return P.IsStrictTrue(this.getParam(p.AutoResolve))}set autoResolve(t){this.setParameter(p.AutoResolve,t)}get disableQuickFind(){return P.IsStrictTrue(this.getParam(p.DisableQuickFind))}set disableQuickFind(t){this.setParameter(p.DisableQuickFind,t)}get disableViewPicker(){return P.IsStrictTrue(this.getParam(p.DisableViewPicker))}set disableViewPicker(t){this.setParameter(p.DisableViewPicker,t)}get allowFilterOff(){return P.IsStrictTrue(this.getParam(p.AllowFilterOff))}set allowFilterOff(t){this.setParameter(p.AllowFilterOff,t)}get disableMru(){return P.IsStrictTrue(this.getParam(p.DisableMru))}set disableMru(t){this.setParameter(p.DisableMru,t)}get dependentAttributeName(){return this.getParam(p.DependentAttributeName)||P.EmptyString}set dependentAttributeName(t){this.setParameter(p.DependentAttributeName,t)}get dependentAttributeType(){return this.getParam(p.DependentAttributeType)||P.EmptyString}set dependentAttributeType(t){this.setParameter(p.DependentAttributeType,t)}get filterRelationshipName(){return this.getParam(p.FilterRelationshipName)||P.EmptyString}set filterRelationshipName(t){this.setParameter(p.FilterRelationshipName,t)}get availableViewIds(){return this.getParam(p.AvailableViewIds)||P.EmptyString}set availableViewIds(t){this.setParameter(p.AvailableViewIds,t)}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case p.datafieldname:case p.bindAttribute:n.getAllChildren()[0].setNodeName("<"+r.dataFieldName);break;case p.DefaultViewId:n.getAllChildren()[0].setNodeName("<"+P.AddBraces(r.defaultViewId));break;case p.AllowFilterOff:n.getAllChildren()[0].setNodeName("<"+r.allowFilterOff);break;case p.DisableQuickFind:n.getAllChildren()[0].setNodeName("<"+r.disableQuickFind);break;case p.DisableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.disableViewPicker);break;case p.FilterRelationshipName:n.getAllChildren()[0].setNodeName("<"+r.filterRelationshipName);break;case p.DependentAttributeName:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeName);break;case p.DependentAttributeType:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeType);break;case p.AvailableViewIds:n.getAllChildren()[0].setNodeName("<"+r.availableViewIds);break;case p.DisableMru:n.getAllChildren()[0].setNodeName("<"+r.disableMru);break;case p.AutoResolve:n.getAllChildren()[0].setNodeName("<"+r.autoResolve);break;default:break}}updateControlDescription(t){let r=t.getControlDescriptionByForControl(this.UniqueId);if(r){let n=r.customControls;for(let i=0;i<n.length;i++){let a=n[i].getParameters().get(Ke.value)?n[i].getParameters().get(Ke.value)[0]:null;if(a){let o=a.getAllChildren();this.updateDefaultProperties(o,this)}else{let o=n[i].getAllChildren()[0].getAllChildren();this.updateDefaultProperties(o,this)}}}}}});var _w,Nd,at,Ua=D(()=>{"use strict";_w=ne(Ew());Br();G();Ce();Se();Cd();Ma();us();Oc();lc();Tt();Zr();Bn();Ad();wd();Sd();ma();Nd="_",at=class e extends We{fieldPlaceholder;fieldRequiredLevel;isNewField;cellColType;dependentFields=[];constructor(t){super(h.formCell,t),this.isNewField=!1}get cellType(){return this.cellColType}set cellType(t){this.cellColType=t}setDefaultProperties(t){this.showlabel=t,this.isLocked=!1,S.IsNullOrUndefined(this.getProperty(p.id))&&(this.id=new I(I.NewGuid()))}addControl(t,r,n,i,a,o,s){n instanceof Lt?this.addChild(n):n instanceof I&&this.addChild(this.getControlWithControlSpecificProperties(t,r,n,i,a,o,s))}removeControl(){return this.deleteChild(this.control)>=0}get isIndependent(){if(!S.IsNullOrUndefined(this.control))return S.IsNullOrUndefined(this.control.dataFieldName)?S.IsNullOrUndefined(this.control.id)?!0:!tn.dependencyFieldCount.containsKey(this.control.id):!tn.dependencyFieldCount.containsKey(this.control.dataFieldName)}createOnLoadEvent(){this.addEvent(new si(this,oa.onLoad))}get dependencies(){let t=this.getChildren(h.formEvents);for(let r of t){let n=r.getChildren(h.formEvent);for(let i of n)this.buildDependencyList(i,this.dependentFields)}return this.dependentFields}getNextAvailableControlName(t,r,n,i){let a;if(i&&Ho[i])a=Ho[i].replace(/ /g,Nd)+Nd;else{a="Control_";let u=new Error("Control class id does not exist or is undefined");(0,_w.trackErrorTrace)(Qe,{eventName:`${dh}/getNextAvailableControlName`},u)}let o="new_",s=this.getHighestIndexById(t,i)+1,l=`${a}${o}${s}`;for(;n.has(l);)s++,l=`${a}${o}${s}`;return l}getUnboundControlProperties(t){e.prototype.setProperty.call(t,p.isUnbound,"true"),e.prototype.setProperty.call(t,p.isRequired,"false")}getControlWithControlSpecificProperties(t,r,n,i,a,o,s){let l;a===At.Grid?(l=new li(this),l.indicationOfSubgrid=!0):a===At.Lookup?l=new ui(this):l=new Lt(this);let u=n.guidString,c=o||this.getNextAvailableControlName(t,i,this.getUsedNodeNameSet(t),u);if(e.prototype.setProperty.call(l,p.id,c),l.ClassId=n,!S.IsNullOrUndefined(s)&&(l.UniqueId=s),!o&&r)this.getUnboundControlProperties(l);else{let d=Ee.getUniqueIdentifierForControl(l);S.IsNullOrUndefined(d)||(Ee.getControlDataTypeByControlOrUniqueId(d)===U.QuickFormCollectionControl||!Ee.isUnboundFormControlByIdentifier(d)?a!==At.Grid&&o&&u!==A.IframeControl&&u!==A.SubgridControl&&u!==A.ReferencePanelSubgridControl&&(l.dataFieldName=o,e.prototype.setProperty.call(l,p.disabled,"false")):(this.rowspan=Ee.GetRowSpan(l),(Ee.getControlDataTypeByControlOrUniqueId(d)===U.NotesControl||Ee.getControlDataTypeByControlOrUniqueId(d)===U.TimeLineControl)&&(e.prototype.setProperty.call(l,p.disabled,"false"),l.id=U.NotesControl)),(Ee.getUnboundControlNameFromIdentifier(n)===U.SubGridControl||Ee.getUnboundControlNameFromIdentifier(n)===U.NotesControl||Ee.getUnboundControlNameFromIdentifier(n)===U.TimeLineControl)&&(this.availableforphone=!0))}return l}buildDependencyList(t,r){if(S.IsNullOrUndefined(t))return;let n=t.getAllChildren();for(let i of n){let a=i.getAllChildren();for(let o of a){let s=o.GetPropertyByParameter(p.id);o.getNodeName()===h.dependency&&s?r.push(s):this.buildDependencyList(o,r)}}}get control(){return this.getFirstChild(h.formControl)}set rowspan(t){this.setProperty(p.rowspan,String(t))}get rowspan(){let t=this.getProperty(p.rowspan);return S.IsNullOrUndefined(t)?1:parseInt(t,10)}set autoexpand(t){this.setProperty(p.auto,String(t))}get autoexpand(){return this.getProperty(p.auto)==="true"}set colspan(t){let r=Number(_c.ONE_COLUMN),n=Number(_c.FOUR_COLUMN);S.IsNullOrUndefined(t)||t>n||t<r||this.setProperty(p.colspan,String(t))}get colspan(){let t=this.getProperty(p.colspan);return S.IsNullOrUndefined(t)?1:parseInt(t,10)}getParentRow(){return this.getAncestor(h.formRow)}getParentSection(){return this.getAncestor(h.formSection)}getParentTab(){return this.getAncestor(h.formTab)}getParentForm(){return this.getAncestor(h.form)}isInHeader(){let t=this.getAncestor(h.formHeader);return!S.IsNullOrUndefined(t)}isInFooter(){let t=this.getAncestor(h.formFooter);return!S.IsNullOrUndefined(t)}isEmpty(){return S.IsNullOrUndefined(this.control)&&!this.IsUserSpacer}getHeaderFooter(){return this.isInHeader()?this.getAncestor(h.formHeader):this.isInFooter()?this.getAncestor(h.formFooter):null}get FieldRequiredLevel(){return this.fieldRequiredLevel}set FieldRequiredLevel(t){this.fieldRequiredLevel=t}get FieldPlaceholder(){return this.fieldPlaceholder}set FieldPlaceholder(t){this.fieldPlaceholder=t}get IsNewField(){return this.isNewField}set IsNewField(t){this.isNewField=t}get IsUserSpacer(){let t=this.getProperty(p.userspacer);return S.IsNullOrUndefined(t)?!1:t==="true"}SetUserSpacer(){this.setProperty(p.userspacer,"true")}ClearUserSpacer(){this.setProperty(p.userspacer,"false")}get columns(){let t=this.getProperty(p.columnName);return S.IsNullOrUndefined(t)?null:parseInt(t,10)}getColumnLayoutValue(t){let r;switch(t){case pe.TWO_COLUMN:r="11";break;case pe.THREE_COLUMN:r="111";break;case pe.FOUR_COLUMN:r="1111";break;default:r="1"}return r}findRowIndexByCellId(t){let r=this.getParentRow().cells.indexOf(this);for(let n=0;n<t.rows.length;n++)if(!S.IsNullOrUndefined(t.rows[n].cells[r])&&this.id.ToString()===t.rows[n].cells[r].id.ToString())return n;return-1}setAutoExpandDetailsForTab(){let t=this.getParentTab();S.IsNullOrUndefined(t)||(t.autoExpandCell=this,t.tabContainsAutoExpandControl=!0)}isCellRequiredOrLocked(t,r,n){let i=this.getParentForm();if(this?.control){if(this.IsUserSpacer)return!1;{if(this.isLocked||r().has(this.control.dataFieldName))return!0;let a=i.isDuplicateCell(this,n),o=this.getRequiredLevel(t);if((o===nn.ApplicationRequired||o===nn.SystemRequired)&&!a||this.isCellLockedByExternal(t)&&!a)return!0}}return!1}getRequiredLevel(t){return!this.control?.dataFieldName||!this.control?.id||this.IsNewField||!this.control?.ClassId?nn.None:t.getEntityAttributeByName(this.control.dataFieldName)?.requiredLevel?.toString()??nn.None}isCellLockedByExternal(t){return this.control||this.IsUnboundControl?!1:t.getEntityAttributeByName(this.control.dataFieldName).isRequiredForForm||!this.isIndependent}async toJSON(t){return{Id:this.id&&this.id.guidString,Name:this.Name,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId.guidString,PreviewId:this.id&&this.id.guidString,ColSpan:this.colspan,RowSpan:this.rowspan,AutoExpand:this.autoexpand,IsInFirstColumnOfSection:!1,IsInLastColumnOfSection:!1,AvailableForPhone:this.availableforphone,UserSpacer:this.IsUserSpacer,IsPreviewCell:!1,IsStreamCell:!1,IsChartCell:!1,IsTileCell:!1,Control:this.control&&await this.control.toJSON(t)}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===h.formCell){let i=n;i.control&&i!==this&&r.add(n.control.id)}return!1}),r}getHighestIndexById(t,r){let n=t.findAll(a=>a.getNodeName()===h.formCell&&a.control&&a.control.ClassId.guidString===r),i=0;return n.forEach(a=>{i=Math.max(this.parseControlNameIndex(a.control.id),i)}),i}parseControlNameIndex(t){let r=t.length-1,n=0;for(;r>0&&parseInt(t.charAt(r),10);)r--;return r>0&&r!==t.length-1&&t.charAt(r)===Nd&&(r++,n=parseInt(t.substr(r,t.length-r),10)),n}}});var ci,Dd=D(()=>{"use strict";ze();G();xe();ci=class extends q{isInternal;constructor(t,r,n,i){super(h.library,t),this.isInternal=!!i,P.IsNullOrEmpty(n)||(this.name=r,this.libraryUniqueId=n)}get libraryUniqueId(){let t=this.getProperty(p.libraryUniqueId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),t?.toUpperCase()}set libraryUniqueId(t){this.setProperty(p.libraryUniqueId,t)}get name(){return this.getProperty(p.libraryName)}set name(t){this.setProperty(p.libraryName,t)}get displayName(){return this.getProperty(p.displayName)}set displayName(t){this.setProperty(p.displayName,t)}get description(){return this.getProperty(p.description)}set description(t){this.setProperty(p.description,t)}}});var un,Ed=D(()=>{"use strict";Ce();Ua();G();xe();un=class extends q{isRowAddedOnDragOver;constructor(t){super(h.formRow,t)}addCell(t){this.addChild(t)}appendCells(t){for(let r of t)this.addChild(r)}updateCell(t,r){return this.updateChild(t,r)}removeCell(t){return S.IsNullOrUndefined(t)?!1:this.deleteChild(t)>=0}insertCellAtIndex(t,r){return S.IsNullOrUndefined(t)?!1:(this.insertChildAtIndex(t,r),!0)}isEmpty(){return!this.cells||this.cells.every(t=>t.isEmpty())}getParentSection(){return this.getAncestor(h.formSection)}insertPaddingCellAtIndex(t){let r=new at(this);r.setDefaultProperties(),this.insertCellAtIndex(r,t)}get firstCell(){let t=this.cells;return t.length>0?t[0]:null}get cells(){return this.getChildren(h.formCell)}get rowColspan(){return this.cells.reduce((t,r)=>t+r.colspan,0)}set IsRowAddedOnDragOver(t){this.isRowAddedOnDragOver=t}get IsRowAddedOnDragOver(){return this.isRowAddedOnDragOver}async getCellsJSON(t){let r=[],n=[];if(this.cells){for(let i of this.cells)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Cells:await this.getCellsJSON(t),Visible:!0,Height:"0"}}}});function mk(e){switch(e){case an.Left:return on.Left;case an.Right:return on.Right;case an.Center:return on.Center;default:return on.Left}}function hk(e){switch(e){case zn.Left:return jn.Left;case zn.Top:return jn.Top;default:return jn.Left}}function Pw(e){switch(e){case 1:return 1;case 2:return 11;case 3:return 111;case 4:return 1111;default:return 1}}var gk,Qt,Ba=D(()=>{"use strict";Fc();Se();Ce();ze();bd();Ua();G();Tt();Br();Ed();gk=115,Qt=class e extends We{colSpan=1;constructor(t,r){super(t,r)}getSectionType(){let t;switch(this.columns){case 1:t=pe.ONE_COLUMN;break;case 11:t=pe.TWO_COLUMN;break;case 111:t=pe.THREE_COLUMN;break;case 1111:t=pe.FOUR_COLUMN;break;default:t=this.colSpan-1}return t}setUniqueName(){let t=this.getParentTab(),r=se.namePrefix;if(t){let n=t.Name,i=t.TotalSectionsCount+1;r=n+se.namePrefix+i.toString()}else r+=Math.floor(Math.random()*1e3);this.setProperty(p.Name,r)}initializeDefaultProperties(t,r,n){if(n===pe.REFERENCE_PANEL){this.addProperty(p.rowheight,"25");let i=`${se.referencePanelNamePrefix}${I.NewGuid()}${se.namePrefix}`;this.addProperty(p.Name,i)}else this.setUniqueName();if(this.addProperty(p.id,new I(I.NewGuid()).guidString),this.addProperty(p.IsUserDefined,se.IsUserDefined),this.addProperty(p.locklevel,se.LockLevel),this.addProperty(p.showlabel,se.ShowLabel),this.addProperty(p.showbar,se.ShowBar),this.addProperty(p.layout,se.Layout),this.addProperty(p.Fieldlabelalignment,se.labelAlignment),this.addProperty(p.Fieldlabelposition,se.labelPosition),S.IsNullOrUndefined(n))this.addProperty(p.columnName,se.columns);else{let i=this.getColumnLayoutValue(n);this.addProperty(p.columnName,i)}this.addProperty(p.LabelWidth,se.LabelWidth),this.setDisplayName(r,t)}getColumnLayoutValue(t){let r;switch(t){case pe.TWO_COLUMN:r="11";break;case pe.THREE_COLUMN:r="111";break;case pe.FOUR_COLUMN:r="1111";break;default:r="1"}return r}getNumberOfColumns(){return e.getNumericColumnLayoutValue(this.columns)}static getNumericColumnLayoutValue(t){switch(t){case 1:return 1;case 11:return 2;case 111:return 3;case 1111:return 4;default:throw new Error("Unexpected Section Layout Value.")}}getColumnCountValue(){let t=0;return S.IsNullOrUndefined(this.columns)?t=this.ColSpan:this.columns.toString().split(P.EmptyString).forEach(r=>{t+=parseInt(r,10)}),t}get ColSpan(){return this.colSpan}initializeRow(t){if(t>0&&t<5){let r=new un(null);if(this.addGrandChild(h.formRows,r),ww.getConfig().enableAutoInsertionOfCellInRow)for(let n=0;n<t;n++){let i=new at(r);i.setDefaultProperties(!1),r.addCell(i)}}}initialize(t,r,n){this.initializeDefaultProperties(t,r,n),n===pe.REFERENCE_PANEL&&(n=pe.ONE_COLUMN),this.initializeRow(n+1)}setColSpan(t){this.colSpan=t}appendRow(t){this.addGrandChild(h.formRows,t)}insertRowAtIndex(t,r){this.addGrandChildAtIndex(h.formRows,t,r)}insertRowsAtIndex(t,r){if(t&&t.length>0)for(let n=0;n<t.length;n++)this.addGrandChildAtIndex(h.formRows,t[n],r+n)}indexOfRow(t){return this.rows.indexOf(t)}deleteRow(t){return this.deleteFirstGrandChildOfName(h.formRows,t)}deleteRows(t,r){this.deleteGrandChildren(h.formRows,t,r)}get rows(){return this.getRows()}getRows(){let t=this.getChildren(h.formRows);return t.length===0?[]:t[0].getChildren(h.formRow)}get columns(){let t=this.getProperty(p.columnName),r=S.IsNullOrUndefined(t)?NaN:parseInt(t,10);if(isNaN(r)){let n=1;for(let i of this.rows)n=Math.max(n,i.cells.length);return Pw(n)}return r}set columns(t){S.IsNullOrUndefined(t)||this.setProperty(p.columnName,String(t))}get rowHeight(){let t=this.getProperty(p.rowheight);return S.IsNullOrUndefined(t)?null:parseInt(t,10)}set rowHeight(t){this.setProperty(p.rowheight,String(t))}set autoexpand(t){this.setProperty(p.autoExpand.toLowerCase(),String(t))}get autoexpand(){return this.getProperty(p.autoExpand.toLowerCase())==="true"}get isUserDefined(){return+this.getProperty(p.IsUserDefined)!=0}set isUserDefined(t){t?this.setProperty(p.IsUserDefined,"1"):this.setProperty(p.IsUserDefined,"0")}getParentColumn(){return this.getAncestor(h.formColumn)}getParentTab(){return this.getAncestor(h.formTab)}get hasMultiColumnRow(){return this.getColumnCountValue()>1}get showlabel(){return this.getProperty(p.showlabel)==="true"}set showlabel(t){S.IsNullOrUndefined(t)||this.setProperty(p.showlabel,String(t))}get fieldLabelAlignment(){let t=se.labelAlignment,r=this.getProperty(p.Fieldlabelalignment);return S.IsNullOrUndefined(r)?t:r}set fieldLabelAlignment(t){S.IsNullOrUndefined(t)||this.setProperty(p.Fieldlabelalignment,t)}get fieldLabelPosition(){let t=this.getProperty(p.Fieldlabelposition);return S.IsNullOrUndefined(t)?se.labelPosition:t}set fieldLabelPosition(t){S.IsNullOrUndefined(t)||this.setProperty(p.Fieldlabelposition,String(t))}get showbar(){return this.getProperty(p.showbar)==="true"}set showbar(t){S.IsNullOrUndefined(t)||this.setProperty(p.showbar,String(t))}get labelwidth(){let t=+this.getProperty(p.LabelWidth);return t===0?gk:t}set labelwidth(t){S.IsNullOrUndefined(t)||t>283&&t<57||this.setProperty(p.LabelWidth,t.toString())}async getRowsJSON(t){let r=[],n=[];if(this.rows){for(let i of this.rows)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Name:this.Name,Id:this.id&&this.id.guidString,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId&&this.labelId.guidString,PreviewId:this.id&&this.id.guidString,Rows:await this.getRowsJSON(t),CellLabel:{Width:this.labelwidth,Alignment:mk(this.fieldLabelAlignment),Position:hk(this.fieldLabelPosition)},Columns:Pw(this.getColumnCountValue()),AvailableForPhone:this.availableforphone,Height:this.rowHeight&&this.rowHeight.toString()}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===h.formSection){let i=n;i.Name&&!P.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}isReferencePanelSection(){return!S.IsNullOrUndefined(this)&&!S.IsNullOrUndefined(this.Name)&&this.Name.indexOf(se.referencePanelNamePrefix)===0}getAllMultiRowCells(){return this.findAll(t=>{if(t.getNodeName()===h.formCell){let r=t;return!r.isEmpty()&&r.rowspan>1}return!1})}isHeaderOrFooterSection(){return this.NodeName===h.formFooter||this.NodeName===h.formHeader}}});var kr,Es=D(()=>{"use strict";G();xe();Ba();kr=class e extends q{constructor(t){super(h.formColumn,t)}initializeDefaultProperties(t){this.addProperty(p.width,t.toString()+"%")}insertSectionAtIndex(t,r){this.addGrandChildAtIndex(h.formSections,t,r)}static createAndInitNewSection(t,r,n){let i=new Qt(h.formSection,null);return i.initialize(t,r,n),i}addSectionAtIndex(t,r){this.addGrandChildAtIndex(h.formSections,t,r)}initialize(t,r,n,i=pe.ONE_COLUMN){this.initializeDefaultProperties(t);let a=e.createAndInitNewSection(r,n,i);this.addSectionAtIndex(a,this.sections.length),a.setUniqueName()}get parentTab(){return this.getAncestor(h.formTab)}get sections(){let t=this.getChildren("sections");return t.length!==1?[]:t[0].getChildren(h.formSection)}get width(){return this.getProperty(p.width)}set width(t){this.setProperty(p.width,t)}deleteSection(t){return this.deleteFirstGrandChildOfName(h.formSections,t)}async getSectionsJSON(t){let r=[];if(this.sections)for(let n of this.sections)r.push(await n.toJSON(t));return r}async toJSON(t){return{Name:this.getProperty(p.Name),Id:this.getProperty(p.id),Label:null,ShowLabel:!1,Visible:!0,LabelId:null,PreviewId:this.getProperty(p.id),Sections:await this.getSectionsJSON(t),Width:this.width}}}});var Is,Ow=D(()=>{"use strict";Se();G();Tt();Ba();Is=class extends Qt{initializeNavArea(t,r,n){this.initializeNavAreaProps(t,r,n)}get AreaName(){return this.Name}initializeNavAreaProps(t,r,n){this.addProperty(p.Name,n),this.addProperty(p.id,new I(I.NewGuid()).guidString),this.addProperty(p.columnName,se.columns),this.setDisplayName(r,t)}}});var _s,Fw=D(()=>{"use strict";Es();G();Ow();_s=class extends kr{addAndIntializeNavBarSection(t,r,n,i){let a=new Is(h.formSection,null);return a.initializeNavArea(t,r,i),this.addGrandChildAtIndex(h.formSections,a,n),a}}});var vr,Ps=D(()=>{"use strict";Se();Ce();ze();Es();G();xe();Br();vr=class extends We{tabContainsAutoExpandControl;autoExpandCell;constructor(t,r){super(h.formTab,t),this.tabContainsAutoExpandControl=!1}getParentForm(){return this.getAncestor(h.form)}getTabLayoutType(){let t;switch(this.columns.length){case 1:t=de.ONE_COLUMN;break;case 2:if(parseInt(this.columns[0].width,10)===50&&parseInt(this.columns[1].width,10)===50){t=de.TWO_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===67&&parseInt(this.columns[1].width,10)===33){t=de.TWO_COLUMN_WIDER_LEFT;break}if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===66){t=de.TWO_COLUMN_WIDER_RIGHT;break}t=de.TWO_COLUMN_CUSTOM_LAYOUT;break;case 3:if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===33&&parseInt(this.columns[2].width,10)===33){t=de.THREE_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===28&&parseInt(this.columns[1].width,10)===44&&parseInt(this.columns[2].width,10)===28){t=de.THREE_COLUMN_WIDER_MID;break}t=de.THREE_COLUMN_CUSTOM_LAYOUT;break;default:}return t}initializeProperties(t,r,n){this.addProperty(p.Name,Tr.namePrefix+t.toString()),this.addProperty(p.id,new I(I.NewGuid()).guidString),this.addProperty(p.IsUserDefined,Tr.IsUserDefined),this.addProperty(p.locklevel,Tr.LockLevel),this.addProperty(p.showlabel,Tr.ShowLabel),this.setDisplayName(n,r)}get TotalSectionsCount(){let t=0;for(let r of this.columns)t+=r.sections.length;return t}initializeColumns(t,r,n,i=pe.ONE_COLUMN,a=!0,o){let s=this.getChildren(h.formColumns)[0],l=[];switch(t){case de.ONE_COLUMN:l.push(100);break;case de.TWO_COLUMN_EQUAL:l.push(50),l.push(50);break;case de.TWO_COLUMN_WIDER_LEFT:l.push(67),l.push(33);break;case de.TWO_COLUMN_WIDER_RIGHT:l.push(34),l.push(66);break;case de.THREE_COLUMN_EQUAL:l.push(34),l.push(33),l.push(33);break;case de.THREE_COLUMN_WIDER_MID:l.push(28),l.push(44),l.push(28);break;default:}for(let u of l){let c=new kr(s);c.initialize(u,r,n,i),this.addGrandChild(h.formColumns,c)}}initialize(t,r,n,i,a,o=pe.ONE_COLUMN,s=!0,l){this.addChild(new q(h.formColumns,this)),this.initializeProperties(r,n,i),this.initializeColumns(t,n,a,o,s,l)}get columns(){let t=this.getChildren(h.formColumns);return t.length!==1?[]:t[0].getChildren(h.formColumn)}get expanded(){return this.getProcessedValue(p.expanded)}set expanded(t){S.IsNullOrUndefined(t)||this.setProperty(p.expanded,String(t))}get groupName(){return this.getProperty(p.groupName)}get contentType(){return this.getProperty(p.contentType)}set contentType(t){this.setProperty(p.contentType,t)}insertNewColumnAtIndex(t,r,n,i,a){t.initialize(n,i,a),this.addGrandChildAtIndex(h.formColumns,t,r)}insertColumnAtIndex(t,r){this.addGrandChildAtIndex(h.formColumns,t,r)}deleteColumn(t){return this.deleteFirstGrandChildOfName(h.formColumns,t)}async getColumnsJSON(t){let r=[],n=[];if(this.columns){for(let i of this.columns)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Name:this.Name,Id:this.id&&this.id.guidString,Label:this.getDisplayName(t.langCode)+(!this.visible&&t.formModelService.showHiddenElements?"\u3000\u3000":""),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId&&this.labelId.guidString,UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString,Columns:await this.getColumnsJSON(t),EventHandlers:[],Expanded:this.expanded,ContentType:this.contentType,AvailableForPhone:this.availableforphone,Header:void 0,Footer:void 0}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===h.formTab){let i=n;i.Name&&!P.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}}});var cn,Id=D(()=>{"use strict";Se();G();xe();Tt();Fw();Ps();cn=class extends vr{constructor(t,r,n){super(t,de.THREE_COLUMN_EQUAL),this.setDisplayName(r,n),this.id=new I(I.NewGuid())}initializeDefaultProps(){this.addChild(new q(h.formColumns,this)),this.initializeFiveColumns()}get columns(){let t=this.getChildren("columns");return t.length!==1?[]:t[0].getChildren(h.formColumn)}getNavSectionForArea(t){for(let r of this.columns)for(let n of r.sections)if(n.AreaName===t)return n;return null}getNavCellFromNavId(t){for(let r of this.columns)for(let n of r.sections)for(let i of n.rows)for(let a of i.cells)if(a.NavId===t)return a;return null}initializeFiveColumns(){for(let t=0;t<as.FIVE_COLUMN;t++){let r=new _s(this.getChildren(h.formColumns)[0]);r.initializeDefaultProperties($h.FiveEqColumn),this.addGrandChild(h.formColumns,r)}}}});function bk(e){switch(e){case De.Main:return xr.Main;case De.QuickCreate:return xr.QuickCreate;case De.QuickViewForm:return xr.Quick;case De.Dialog:return xr.Dialog;default:return xr.None}}function yk(e,t){if(t===De.Main){if(e)switch(e.toLowerCase()){case"low":return Fr.Low;case"highreadonlyvalues":return Fr.HighReadOnlyValues;default:return Fr.HighWithControls}return Fr.Low}}var Fs,vk,Os,Tw=D(()=>{"use strict";a0();Fs=ne(en());Fc();Ce();ze();Bn();bd();G();$n();Qu();Zr();Ua();G();Br();Dd();Id();Ps();vk="1920";Os=class e extends We{_formUniqueName;isHeaderDefaulted;consistencyStrong=!1;_formId;_rawFormXml;_entityName;_entityDisplayName;_status;_formName;_langCode;_description;_formType;_formPresentation;parameters=[];_formactivationstate;_changeTracker;_metadataChangeEvent;_etag;constructor(t,r,n,i,a,o,s,l,u){super(h.form,null),this._formUniqueName=a,this._formId=t,this._entityName=r,this._status=n,this._formName=i,this._description=l,this._formType=o,this._formPresentation=s,this._formactivationstate=u,this._changeTracker=new Go,this._metadataChangeEvent=new cs}get FormLibraries(){let t=this.getFirstChild(h.formLibraries),r=t?t.getAllChildren():[],n=this._getInternalLibraries();return r.concat(n)}getAllEvents(){let t=[],r=this.events;r&&(t=t.concat(r));for(let n of this.tabs){let i=n.events;i&&(t=t.concat(i)),n.findAll(a=>a instanceof at).forEach(a=>{let o=a.events;o&&(t=t.concat(o))})}return t}getEventsForNode(t){if(t instanceof e){let r=t.events;return r?r.filter(n=>!n.control&&!n.attribute):null}else if(t instanceof at){if(t.control?.dataFieldName){let r=this.events;return r?r.filter(n=>n.attribute&&t.control.dataFieldName===n.attribute):null}else if(this.isCellEditableGridControl(t)){let r=this.events;return r?r.filter(n=>n.control&&t.control.id===n.control):null}}return t?.events}_getInternalLibraries(){let t=this.findAll(i=>i.getNodeName()===h.internalLibraries),r=[],n="src";return t.length>0&&(r=t.map(i=>{let a=i.GetPropertyByParameter(n).replace("$webresource:",""),o=new ci(void 0,void 0,"",!0);return o.name=a,o.displayName=a,o})),r}getDependentFields(){let t=this.getAllEvents(),r=new Set;return t.forEach(n=>{try{n.getAllDependencies().forEach(a=>{r.add(a.id)})}catch(i){throw(0,Fs.trackErrorTrace)(ph,{eventName:"GetDependentFields_MissingDependencies",eventData:{Message:`Failed get dependencies for form event in form ${this.formId.guidString}.`,Attribute:n.attribute,EventName:n.eventName}}),i}}),r}get Parameters(){return this.parameters}set Parameters(t){this.parameters=t}get ShowImagecheck(){return P.IsNullOrEmpty(this.getProperty(p.ShowImage))?!0:this.getProperty(p.ShowImage)!=="false"}set ShowImagecheck(t){t?this.setProperty(p.ShowImage,String(t)):this.setProperty(p.ShowImage,"false")}get ShowNavigation(){return P.IsNullOrEmpty(this.getProperty(p.ShowNavigationbar))?!0:this.getProperty(p.ShowNavigationbar)!=="false"}set ShowNavigation(t){t?this.setProperty(p.ShowNavigationbar,String(t)):this.setProperty(p.ShowNavigationbar,"false")}get MaxWidth(){return P.IsNullOrEmpty(this.getProperty(p.MaxWidth))?vk:this.getProperty(p.MaxWidth)}set MaxWidth(t){this.setProperty(p.MaxWidth,t)}get headerDensityType(){return this.getProperty(p.HeaderDensityType)}set headerDensityType(t){t&&this.formType===De.Main?this.setProperty(p.HeaderDensityType,t):this.formType!==De.Main&&this.headerDensityType&&this.removeProperty(p.HeaderDensityType)}IsMainOrQuickCreateForm(){return this.formType===De.Main||this.formType===De.QuickCreate}get FormPresentation(){return this._formPresentation}get LanguageCode(){return this._langCode}set LanguageCode(t){this._langCode=t}get header(){let t=this.getChildren(h.formHeader);return t.length!==1?null:t[0]}set header(t){S.IsNullOrUndefined(t)||(this.deleteChild(this.header),this.addChild(t))}getAllDependencies(){return this.getChildren(h.quickFormDependencies).length===0?[]:this.ConvertModelToArray(this.getChildren(h.quickFormDependencies)[0].getAllChildren())}ConvertModelToArray(t){let r=[];return S.IsNullOrUndefined(t)||t.forEach(n=>{r.push(n.id)}),r}get footer(){let t=this.getChildren(h.formFooter);return t.length!==1?null:t[0]}set footer(t){S.IsNullOrUndefined(t)||(this.deleteChild(this.footer),this.addChild(t))}createAndInitNewTab(t,r,n){let i=new vr(null,t),a=this.getNextTabCounter(this.tabs.length+1);return i.initialize(t,a,this.LanguageCode,r,n),i}addTabAtIndex(t,r){this.addGrandChildAtIndex(h.formTabs,t,r)}createAndInitNewTabWithMarginalControl(t,r,n,i,a){let o=new vr(null,de.ONE_COLUMN),s=this.getNextTabCounter(this.tabs.length+1);o.initialize(de.ONE_COLUMN,s,this.LanguageCode,r,n,a,!1),this.addGrandChildAtIndex(h.formTabs,o,i);let l=o.columns[0].sections[0];for(let u=0;u<t.rows.length;u++)l.appendRow(t.rows[u])}getNextTabCounter(t){for(let r=0;r<this.tabs.length;r++)if(this.tabs[r].Name===Tr.namePrefix+t.toString())return this.getNextTabCounter(t+1);return t}get allTabs(){let t=this.getChildren(h.formTabs);return t.length!==1?[]:t[0].getChildren(h.formTab)}get CanvasNavigationTab(){if(this.tabs.length>0){let t=this.tabs[this.tabs.length-1];if(t instanceof cn)return t}return null}get NavigationNode(){let t=this.getChildren(h.formNavigation);return t.length!==1?null:t[0]}set NavigationNode(t){let n=this.getAllChildren().indexOf(this.NavigationNode);n>=0&&(this.deleteChild(this.NavigationNode),this.insertChildAtIndex(t,n))}addNavigatioNode(t){this.addChild(t)}get tabs(){return this.allTabs}deleteTab(t){return this.deleteFirstGrandChildOfName(h.formTabs,t)}insertTabAtIndex(t,r){this.addGrandChildAtIndex(h.formTabs,t,r)}insertRelatedTab(t){let r=this.getAllGrandChildren(h.formTabs);if(!S.IsNullOrUndefined(r)){let n=r.length;this.insertTabAtIndex(t,n)}}get isfooterPresent(){return this.getChildren(h.formFooter).length>0}get displayCondition(){let t=this.getChildren(h.formDisplayConditions);return t.length>0?t[0]:null}set displayCondition(t){this.deleteChild(this.displayCondition),this.addChild(t)}get entityName(){return this._entityName}get formId(){return this._formId}set formId(t){this._formId=t}get rawFormXml(){return this._rawFormXml}set rawFormXml(t){this._rawFormXml=t}get status(){return this._status}set status(t){this._status=t}get formName(){return this._formName}set formName(t){this.trackObjectPropertyChange("_formName",t)}get formUniqueName(){return this._formUniqueName}set formUniqueName(t){this.trackObjectPropertyChange("_formUniqueName",t)}get formType(){return this._formType}get tabCount(){return this.allTabs.length}get description(){return this._description}set description(t){this.trackObjectPropertyChange("_description",t)}get formactivationstate(){return this._formactivationstate}set formactivationstate(t){this.trackObjectPropertyChange("_formactivationstate",t)}get entityDisplayName(){return this._entityDisplayName}set entityDisplayName(t){this._entityDisplayName=t}get etag(){return this._etag}set etag(t){this._etag=t}indexOfTab(t){return this.getAllGrandChildren(h.formTabs).indexOf(t)}get ControlDescriptions(){return this.getAllGrandChildren(h.controlDescriptions)}addControlDescriptionNode(t){this.addGrandChild(h.controlDescriptions,t)}deleteControlDescByForControlId(t){let r=this.getControlDescriptionByForControl(t);S.IsNullOrUndefined(r)||this.deleteFirstGrandChildOfName(h.controlDescriptions,r)}getControlDescriptionByForControl(t){if(!t)return null;for(let r of this.ControlDescriptions)if(r.forControl.guidString===t.guidString)return r;return null}cellHasCustomControlWithName(t,r){if(!t?.control||!r)return!1;let n=this.getControlDescriptionByForControl(t.control.UniqueId);return n?!!n.customControls.find(i=>i.name===r):!1}isDuplicateCell(t,r){return!!this.findFirst(i=>{if(!(i instanceof at))return!1;let a=!0;return r==="Tab"?a=i.getParentTab()!==t.getParentTab():r==="Section"?a=i.getParentSection()!==t.getParentSection():a=i!==t,i instanceof at&&i.control&&t.control&&a&&i.control.dataFieldName===t.control.dataFieldName})}isCellEditableGridControl(t){return!t?.control?.indicationOfSubgrid||t.control.ClassId.guidString.toUpperCase()!==A.CustomControl?!1:this.cellHasCustomControlWithName(t,Rr.EditableGridControl)||Nw.getConfig()?.enableOneGridEventsForFormDesigner&&this.cellHasCustomControlWithName(t,Rr.PowerAppsOneGrid)}isCellCanvasAppControl(t){return t?.control?.ClassId.guidString.toUpperCase()===A.CustomControl&&this.cellHasCustomControlWithName(t,Rr.CanvasAppControl)}findFormNodeById(t,r=this){return r===null?null:r.findFirst(n=>{if(n===this&&t===this.formId.ToString()||n.id?.ToString?.()===t)return!0})}findFormCellByClassId(t,r=this){return r?r.findFirst(n=>{if(n.getNodeName()===h.formCell){let i=n;return i&&i.control&&i.control.ClassId.guidString===t}return!1}):null}async getTabsJSON(t){let r=this.tabs,n=[],i=[];if(r){for(let a of r)if(!(a instanceof cn)){let o=a.toJSON(t);n.push(o)}for(let a of n)i.push(await a)}return i}async getControlDescriptionsToJSON(t){let r=[];for(let n of this.ControlDescriptions){let i=await n.toJSON(t);i&&r.push(i)}return r}async toJSON(t){let r=[];r=await this.getControlDescriptionsToJSON(t);let n=this.NavigationNode&&await this.NavigationNode.toJSON(t);return{Id:this._formId.guidString,Name:this.formName,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible,LabelId:this.labelId&&this.labelId.guidString,PreviewId:this._formId.guidString,PreviewSessionId:(0,Fs.getSessionId)(),EntityLogicalName:this._entityName,FormId:this._formId.guidString,TabAttributes:{},Tabs:await this.getTabsJSON(t),HiddenFields:[],Header:this.header&&await this.header.toJSON(t),Footer:this.footer&&await this.footer.toJSON(t),...this.formType===De.Main?{HeaderDensity:yk(this.headerDensityType,this.formType)}:{},InlineEditGridRow:[],InlineQuickForms:[],QuickFormEntities:[],EventHandlers:[],LinkControlSections:[],FormType:bk(this.formType),SubGrids:[],Views:void 0,Charts:void 0,CustomControlConfigurations:r,BusinessLogic:void 0,FormLibraries:[],Navigation:n,ShowNavigationBar:this.ShowNavigation||t.formModelService.showHiddenElements,ClientResources:[]}}changeTracker(){return this._changeTracker}onMetadataChange=t=>this._metadataChangeEvent.on(t);raiseMetadataChange(t){this._metadataChangeEvent.emit(t)}}});var Ts,_d,Rw=D(()=>{"use strict";Se();Ce();G();xe();Br();Ts=class extends We{constructor(t){super(h.formDisplayConditions,t)}get Order(){let t=this.getProperty(p.Order);return S.IsNullOrUndefined(t)?null:parseInt(t,10)}set Order(t){this.setProperty(p.Order,t.toString())}get FallbackForm(){return this.getProperty(p.FallbackForm)==="true"}set FallbackForm(t){this.setProperty(p.FallbackForm,t.toString())}addRoles(t){this.deleteAllChildren();for(let r=0;r<t.length;r++)this.addChild(t[r])}isRoleEveryone(){return!!(this.getChildren(h.formEveryOne)&&this.getChildren(h.formEveryOne)[0])}setRoleEveryone(){this.deleteAllChildren(),this.addChild(new _d(this))}},_d=class extends q{constructor(t){super(h.formEveryOne,t)}}});var Rs,xw=D(()=>{"use strict";G();xe();Rs=class extends q{constructor(t,r){super(h.Handler,r),t.length>0&&this.setDefaultProperties(t)}setDefaultProperties(t){this.FunctionName=t[0],this.LibraryName=t[1],this.HandlerUniqueID=t[2],this.Enabled=t[3],this.Parameters=t[4],this.PassExecutionContext=t[5]}get HandlerUniqueID(){return this.getProperty(p.HandlerUniqueId)}set HandlerUniqueID(t){this.setProperty(p.HandlerUniqueId,t)}get FunctionName(){return this.getProperty(p.functionName)}set FunctionName(t){this.setProperty(p.functionName,t)}get LibraryName(){return this.getProperty(p.libraryNameEventHandler)}set LibraryName(t){this.setProperty(p.libraryNameEventHandler,t)}get Enabled(){return this.getProperty(p.enabledForField)}set Enabled(t){this.setProperty(p.enabledForField,t)}get PassExecutionContext(){return this.getProperty(p.passExecutionContext)}set PassExecutionContext(t){this.setProperty(p.passExecutionContext,t)}get Parameters(){return this.getProperty(p.parameters)}set Parameters(t){this.setProperty(p.parameters,t)}}});var di,Pd=D(()=>{"use strict";G();Ba();di=class extends Qt{constructor(t,r){super(t,r)}get cells(){let t=this.getRows(),r=[];if(this.rows&&t.length){for(let n of this.rows)if(n.cells){let i=n.getChildren(h.formCell);for(let a of i)r.push(a)}}return r}get occupiedCells(){return this.cells.filter(t=>!t.isEmpty())}get maxColumns(){return super.getColumnCountValue()}}});var ka,Lw=D(()=>{"use strict";G();Pd();ka=class extends di{_customFooter;constructor(t,r){super(h.formFooter,t),this._customFooter=r}get customFooter(){return this._customFooter}set customFooter(t){this._customFooter=t}async getControls(t){let r=[];if(this.rows){for(let n of this.rows)if(n.cells)for(let i of n.cells)i.control&&r.push(await i.control.toJSON(t))}return r}async toJSON(t){return{AvailableForPhone:this.availableforphone,Controls:await this.getControls(t),UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString}}isEmpty(){return!this.cells.find(t=>!!t.control)}}});var qa,Mw=D(()=>{"use strict";G();Pd();qa=class extends di{_customHeader;constructor(t,r){super(h.formHeader,t),this._customHeader=r}get customHeader(){return this._customHeader}set customHeader(t){this._customHeader=t}get showCommandBar(){return this.getProcessedValue(p.showCommandBar)}set showCommandBar(t){t!=null&&this.setProperty(p.showCommandBar,String(t))}get showBody(){return this.getProcessedValue(p.showBody)}set showBody(t){t!=null&&this.setProperty(p.showBody,String(t))}get showTabNavigator(){return this.getProcessedValue(p.showTabNavigator)}set showTabNavigator(t){t!=null&&this.setProperty(p.showTabNavigator,String(t))}async getControls(t){let r=[];if(this.rows){for(let n of this.rows)if(n.cells)for(let i of n.cells)i.control&&r.push(await i.control.toJSON(t))}return r}async toJSON(t){return{AvailableForPhone:this.availableforphone,Controls:await this.getControls(t),UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString}}}});var ot,dn=D(()=>{"use strict";Se();ze();G();Br();ot=class e extends We{constructor(t,r){super(t,r)}getTitle(t){for(let r of this.getAllTitles())if(+r.getProperty(p.LCID)===t)return r.getProperty(p.text);return null}getAllTitles(){let t=this.getChildren(h.Titles);return t.length===0?[]:t[0].getChildren(h.Title)}setTitle(t,r){for(let i of this.getAllTitles())if(+i.getProperty(p.LCID)===r){i.setProperty(p.text,t);return}let n=new e(h.Title,null);n.setProperty(p.text,t),n.setProperty(p.LCID,String(r)),this.addGrandChild(h.Titles,n)}get Sequence(){return+this.getProperty(p.Sequence)}set Sequence(t){this.setProperty(p.Sequence,t.toString())}get Area(){return this.getProperty(p.Area)}set Area(t){this.setProperty(p.Area,t)}set Id(t){this.setProperty(p.Id,t)}get Id(){return this.getProperty(p.Id)}get id(){return new I(this.Id??"",!0)}set id(t){this.Id=t.guidString}get Show(){return!0}get Icon(){return this.getProperty(p.icon)}set Icon(t){t=t||P.EmptyString,this.setProperty(p.icon,t)}updateCommonProperties(t,r){this.Area=t.Area,this.Sequence=t.Sequence,this.setTitle(t.getDisplayName(r),r)}}});var $a,Uw=D(()=>{"use strict";(function(e){e[e.NavLinkNotAvailable=-1]="NavLinkNotAvailable",e[e.NavLinkIdConflict=-2]="NavLinkIdConflict",e[e.NavBarNotAvailable=-3]="NavBarNotAvailable"})($a||($a={}))});var xs,Bw=D(()=>{"use strict";Ce();G();dn();Uw();xs=class extends ot{constructor(t){super(h.formNavBar,t)}addChildElement(t){this.addChild(t)}getAllActiveNavBarChildren(){return this.getAllChildren().filter(n=>n.Show)}getAllInActiveActiveNavBarChildren(){return this.getAllChildren().filter(n=>!n.Show)}get AllRelationShipItems(){return this.getChildren("NavBarByRelationshipItem")}get AllNavLinkItems(){return this.getChildren("NavBarItem")}removeNavLink(t){let r=this.getNavBarLinkItemById(t);return S.IsNullOrUndefined(r)?$a.NavLinkNotAvailable:r.length===1?this.deleteChild(r[0]):$a.NavLinkIdConflict}getRelationShipItemsByArea(t){let r=this.AllRelationShipItems,n=[];for(let i of r)i.Area===t&&i.Show===!0&&n.push(i);return n}getNavBarRelationShipItemsByNavId(t){return this.AllRelationShipItems.filter(n=>n.Id===t)}getNavBarLinkItemById(t){let r=this.AllNavLinkItems.filter(n=>n.Id===t);return r.length>0?r:null}getAllActiveChildrenForGivenArea(t){let r=this.getAllChildren(),n=[];for(let i of r)i.Area===t&&i.Show&&n.push(i);return n}}});var ae,Ck,kw,jH,pi,Od=D(()=>{"use strict";Se();G();dn();(function(e){e.Info="_NA_Info",e.Sales="_NA_SFA",e.Service="_NA_CS",e.Marketing="_NA_MA",e.InternetMarketing="_NA_IMA",e.ProcessCenter="_NA_PROC",e.Async="_NA_AO"})(ae||(ae={}));Ck=new Map([[ae.Info,"Info"],[ae.Sales,"Sales"],[ae.Service,"Service"],[ae.Marketing,"Marketing"],[ae.ProcessCenter,"ProcessCenter"]]),kw=new Map([["Info",ae.Info],["Sales",ae.Sales],["Service",ae.Service],["Marketing",ae.Marketing],["ProcessCenter",ae.ProcessCenter]]),jH=new Map([[ae.Info,9e3],[ae.Sales,9200],[ae.Service,9400],[ae.Marketing,9600],[ae.ProcessCenter,9800],[ae.InternetMarketing,1e4],[ae.Async,10200]]),pi=class extends ot{constructor(t,r){super(h.formNavBarArea,r)}setDefaultPropertiesByType(t,r,n){this.AreaId=Ck.get(t);let i=n?.(`navBarArea.title.${this.AreaId}`)??this.AreaId;this.setTitle(i,r)}get ParentNavigation(){return this.getAncestor(h.formNavigation)}get AreaId(){return this.getProperty(p.Id)}set AreaId(t){this.setProperty(p.Id,t)}get id(){return new I(this.AreaId??"",!0)}set id(t){this.AreaId=t.guidString}async toJSON(t){return{Id:this.AreaId,Titles:[{LCID:t.langCode,Text:this.getTitle(t.langCode)}],PreviewId:this.AreaId}}}});var fi,Fd=D(()=>{"use strict";G();dn();fi=class extends ot{constructor(t,r){super(h.formNavBarAreas,r)}get AllNavBarAreaItems(){return this.getChildren(h.formNavBarArea)}get ParentNavigation(){return this.getAncestor(h.formNavigation)}addNavBarArea(t){this.addChild(t)}}});var Ls,qw=D(()=>{"use strict";Ce();G();dn();Ls=class extends ot{RelationshipNameUCIRuntime;constructor(t){super(h.formNavBarByRelationshipItem,t)}get RelationshipName(){return this.getProperty(p.RelationshipName)}set RelationshipName(t){this.setProperty(p.RelationshipName,t)}set Show(t){this.setProperty(p.Show,String(t))}get Show(){let t=this.getProperty(p.Show);return S.IsNullOrUndefined(t)||t==="true"}get TitleResourceId(){return this.getProperty(p.TitleResourceId)}async toJSON(t){return{Area:this.Area,Show:this.Show||t.formModelService.showHiddenElements,Id:this.Id,Titles:[{Name:t.langCode.toString(),Value:this.getTitle(t.langCode)}],Sequence:this.Sequence.toString(),Privileges:[],TooltipTitles:[],AvailableOffline:!0,PreviewId:this.Id,RelationshipName:this.RelationshipNameUCIRuntime??this.RelationshipName,Icon:null,ViewId:null,Client:null,TitleResourceId:null}}}});var Ms,$w=D(()=>{"use strict";G();dn();Ms=class extends ot{constructor(t){super(h.formNavBarItem,t)}get Url(){return this.getProperty(p.url)}set Url(t){this.setProperty(p.url,t)}}});var Us,Vw=D(()=>{"use strict";Se();G();Od();Fd();dn();Us=class extends ot{constructor(t,r){super(t,r)}getNavBarAreaByAreaName(t){let r=this.navBarAreas.AllNavBarAreaItems.filter(n=>n.AreaId===t);return r.length===0?null:r[0]}get navBarAreas(){return this.getFirstChild(h.formNavBarAreas)}setDefaultNavBarAreas(t,r){let n=[ae.Info,ae.Sales,ae.Service,ae.Marketing,ae.ProcessCenter];if(this.navBarAreas){let i=this.navBarAreas?.AllNavBarAreaItems;if(i&&i.length>0){let a=new Set(i.map(o=>kw.get(o.AreaId)));n=n.filter(o=>!a.has(o))}}else{let i=new fi(h.formNavBarAreas,this);i.isTransient=!0,this.addChild(i)}return n.length>0?(n.forEach(i=>{let a=new pi(h.formNavBarArea,this.navBarAreas);a.setDefaultPropertiesByType(i,t,r),this.navBarAreas.addNavBarArea(a)}),!0):!1}get navBar(){return this.getFirstChild(h.formNavBar)}get id(){return new I(sc,!0)}replaceNavAreaToGivenIndex(t,r){this.navBarAreas?.AllNavBarAreaItems.indexOf(r)!==-1&&(this.deleteFirstGrandChildOfName(h.formNavBarAreas,r),this.addGrandChildAtIndex(h.formNavBarAreas,r,t))}async getNavBarAreasJSON(t){let r=[],n=[];if(this.navBarAreas?.AllNavBarAreaItems){for(let a of this.navBarAreas.AllNavBarAreaItems)n.push(a.toJSON(t));r=await Promise.all(n)}return r}async getNavBarRelationshipItemsJSON(t){let r=[],n=[];if(this.navBar?.AllRelationShipItems){for(let i of this.navBar.AllRelationShipItems)n.push(i.toJSON(t));r=await Promise.all(n)}return r}async toJSON(t){let r=await this.getNavBarAreasJSON(t),n=await this.getNavBarRelationshipItemsJSON(t);return{NavBarAreas:{NavBarAreas:r},NavBarByRelationshipItems:n,NavBarItems:[],NavPaneIsvItems:{NavBarIsvItems:[]},ShowEmptyNavBarAreas:t.formModelService.showHiddenElements}}}});var Gw={};Bt(Gw,{ControlType:()=>At,DeserializationService:()=>xd,DeserializationServiceScope:()=>Rd,DeserializedFormElementNode:()=>st});var Td,st,Rd,At,xd,Sd=D(()=>{"use strict";Td=ne(en());Se();Ce();ze();Bn();lc();Zr();fh();i0();us();Tw();Ua();Es();Ma();yd();G();G();Rw();xe();Tt();Cd();xw();Lw();Ad();wd();Mw();Dd();Ed();Ba();Ps();Bw();Od();Fd();qw();$w();Vw();st=class extends q{constructor(t,r){super(t,r)}insertProperty(t,r){this.addProperty(t,r)}insertChild(t){this.addChild(t)}},Rd="DeserializationService";(function(e){e.Grid="Grid",e.Lookup="Lookup",e.Base="Base"})(At||(At={}));xd=class{lcid;constructor(t){this.lcid=t}deSerializeFormXml(t,r,n,i,a,o,s,l,u,c){if(!t)throw new Error("Formxml could not be parsed.");let d=t.getElementsByTagName("form");if(d.length!==1){let g="";throw d.length===0?g="FormXml has no form node.":g="FormXml has multiple form nodes.",(0,Td.trackErrorTrace)(Qe,{eventName:Rd,eventData:{error:g}}),new Error(g)}let f=this.createFormModel(d.item(0),r,n,i,a,o,s,l,u,c);return S.IsNullOrUndefined(f.displayCondition)&&s!==De.Dialog&&this.appendDefaultDisplayCondition(f),f}upsertFieldCount(t,r){let n=tn.getNecessaryLookUpTable(r),i=1;n.containsKey(t)&&(i+=n.getValue(t)),n.upsert(t,i)}appendDefaultDisplayCondition(t){let r='<DisplayConditions Order="0" FallbackForm="true"><Everyone/></DisplayConditions>';if(!S.IsNullOrUndefined(t)){let n=S.ParseXml(r);n!==null&&this.populateElementChildren(t,n.childNodes)}}createFormModel(t,r,n,i,a,o,s,l,u,c){let d=new Os(r,n,i,a,o,s,l,u,c);return this.populateElementProperties(d,t.attributes),this.populateElementChildren(d,t.childNodes),s===De.Main&&(this.insertHeaderFooterElementProperties(h.formHeader,d,d.header),this.insertHeaderFooterElementProperties(h.formFooter,d,d.footer)),d}insertHeaderFooterElementProperties(t,r,n){if(S.IsNullOrUndefined(n)){let i=t===h.formHeader?new qa(r,!0):new ka(r,!0);st.prototype.insertProperty.call(i,p.id,"{"+I.NewGuid()+"}"),st.prototype.insertProperty.call(i,p.Fieldlabelposition,"Top"),st.prototype.insertProperty.call(i,p.columnName,se.MarginalControlColumns),st.prototype.insertProperty.call(i,p.LabelWidth,se.LabelWidth),st.prototype.insertProperty.call(i,p.Fieldlabelalignment,"Left");let a=null,o=new un(a);for(let s=0;s<i.maxColumns;s++){let l=new at(o);st.prototype.insertProperty.call(l,p.id,"{"+I.NewGuid()+"}"),l.setDisplayName(P.EmptyString,this.lcid),st.prototype.insertProperty.call(l,p.showlabel,"false"),o.addCell(l)}i.appendRow(o),t===h.formHeader?r.header=i:r.footer=i}}deSerializeFormXmlNode(t,r){if(t&&t.nodeValue&&(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.CDATA_SECTION_NODE))return new st(`<${t.nodeValue}`,r);if(t.nodeType===Node.COMMENT_NODE)return;let n=this.createModelNode(t,r);return this.populateElementProperties(n,t.attributes),this.populateElementChildren(n,t.childNodes),n}populateElementProperties(t,r){if(!r){let n="attributes is undefined for element: "+t.getNodeName();throw(0,Td.trackErrorTrace)(Qe,{eventName:Rd,eventData:{error:n}}),new Error(n)}for(let n=0;n<r.length;n++){let i=r.item(n);i&&(st.prototype.insertProperty.call(t,i.name,i.value),t.getNodeName()===h.formCell&&i.name===p.auto&&i.value==="true"&&t.setAutoExpandDetailsForTab())}}populateElementChildren(t,r){for(let n=0;n<r.length;n++){let i=r.item(n),a=this.deSerializeFormXmlNode(i,t);a&&st.prototype.insertChild.call(t,a)}}createModelNode(t,r){switch(t.nodeName){case h.form:throw new Error("Form node shouldn't be created using this method");case h.formTab:return new vr(r);case h.formColumn:return new kr(r);case h.formHeader:return new qa(r,!1);case h.formFooter:return new ka(r,!1);case h.formSection:return new Qt(h.formSection,r);case h.formRow:return new un(r);case h.formCell:return new at(r);case h.formControl:let n=t.attributes,i=t.childNodes.length>0?t.childNodes[0].childNodes:null,a;for(let s=0;s<n.length;s++){let l=n.item(s);if(l.name===p.indicationOfSubgrid&&l.value==="true"||l.name===p.classid&&(l.value?.toLocaleUpperCase()===`{${A.SubgridControl}}`||l.value?.toLocaleUpperCase()===`{${A.ReferencePanelSubgridControl}}`))a=At.Grid;else if(l.name===p.classid&&l.value?.toLocaleUpperCase()===`{${A.LookupControl}}`)a=At.Lookup;else if(l.name===p.classid&&l.value?.toLocaleUpperCase()===`{${A.CustomControl}}`)for(let u=0;u<i?.length;u++)i[u].nodeName===p.DefaultViewId&&(a=At.Lookup)}return a===At.Grid?new li(r):a===At.Lookup?new ui(r):new Lt(r);case h.formEvent:return new si(r,P.EmptyString);case h.dependency:return this.populateDependencyTable(t),new oi(r,P.EmptyString);case h.Handler:let o=[];return new Rs(o,r);case h.formNavigation:return new Us(t.nodeName,r);case h.formNavBarArea:return new pi(t.nodeName,r);case h.formNavBarAreas:return new fi(t.nodeName,r);case h.formNavBar:return new xs(r);case h.formNavBarByRelationshipItem:return new Ls(r);case h.formNavBarItem:return new Ms(r);case h.formDisplayConditions:return new Ts(r);case h.library:return new ci(r,P.EmptyString,P.EmptyString);case h.controlDescription:return new Jo(r);case h.customControl:return this.populateCustomControlConfigurationId(t),new ls(r);default:return new st(t.nodeName,r)}}populateDependencyTable(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);i.name===p.id&&this.upsertFieldCount(i.value,Wt.DependencyFieldTable)}}populateCustomControlConfigurationId(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);if(i.name===p.id){let a=new I(i.value.substr(1,i.value.length-2));for(let o=0;o<t.parentNode.attributes.length;o++){let s=t.parentNode.attributes.item(o);if(s.name===p.ForControl){let l=s.value.substr(1,i.value.length-2);Ee.CustomControlIdMap.upsert(l,a);break}}break}}}}});var zw={};Bt(zw,{SerializationService:()=>Ld,SerializationServiceScope:()=>Ak,SerializedFormElementNode:()=>mi});var Ak,mi,Ld,Ww=D(()=>{"use strict";ze();xe();Tt();Id();Ak="SerializationService",mi=class extends q{fetchNodeName(){return this.getNodeName()}enumerateProperties(){return this.getAllProperties()}enumerateChildren(){return this.getAllChildren()}},Ld=class{langCode;constructor(t){this.langCode=t}serializeFormXmlNode(t){let r=mi.prototype.fetchNodeName.call(t);if(r.charAt(0)===hr.StartTag)return P.EscapeXml(r.substr(1),!1);if(t.isTransient&&!t.isDirty())return P.EmptyString;let n=mi.prototype.enumerateProperties.call(t),i=mi.prototype.enumerateChildren.call(t);if(!(t instanceof cn)){let a=`<${r}`;if(n.length!==0&&(a+=` ${this.getPropertiesString(n)}`),i.length===0)a+=" />";else{let o=P.EmptyString;for(let s of i)o+=this.serializeFormXmlNode(s);a+=`>${o}</${r}>`}return a}return P.EmptyString}getPropertiesString(t){let r=P.EmptyString;return t.forEach((n,i)=>{i!==0&&(r+=" "),r+=`${n.key}="${P.EscapeXml(n.value,!0)}"`}),r}}});var pn=m(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.rebuildRaw=lt.assembleChildren=lt.spliceChildren=lt.mergeAttrs=lt.rawFromNode=lt.emptyBag=void 0;var qr=be(),jw=1e6,ks=512;function wk(){return{a:[],c:[]}}lt.emptyBag=wk;function Hw(e,t=0){if(t>ks)throw new qr.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${ks}`);return{n:e.getNodeName(),a:e.getAllProperties().map(r=>[r.key,r.value]),c:e.getAllChildren().map(r=>Hw(r,t+1))}}lt.rawFromNode=Hw;function Nk(e,t){let r=new Map;for(let[a,o]of t)r.set(a,o);let n=new Set,i=[];for(let[a,o]of e)r.has(a)?i.push([a,r.get(a)]):i.push([a,o]),n.add(a);for(let[a,o]of t)n.has(a)||(i.push([a,o]),n.add(a));return i}lt.mergeAttrs=Nk;function Bs(e,t){let r=new Set;for(let s of e){let l=s.i;if(!Number.isInteger(l)||l<0||l>jw)throw new qr.InvalidArgumentError(`Bag child index must be an integer in [0, ${jw}] (got ${String(l)})`);if(r.has(l))throw new qr.InvalidArgumentError(`Duplicate bag child index ${l}`);r.add(l)}let n=[...e].sort((s,l)=>s.i-l.i),i=[],a=0,o=0;for(let s of n){for(;o<s.i&&a<t.length;)i.push(t[a]),a+=1,o+=1;o<s.i&&(o=s.i),i.push(s.node),o+=1}for(;a<t.length;)i.push(t[a]),a+=1;return i}lt.spliceChildren=Bs;function Sk(e,t){if(e.w){let r={n:e.w.n,a:e.w.a.map(n=>[n[0],n[1]]),c:Bs(e.w.c,t)};return Bs(e.c,[r])}return Bs(e.c,t)}lt.assembleChildren=Sk;function Jw(e,t,r,n=0){if(n>ks)throw new qr.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${ks}`);Dk(e,n);let i=t.make(e.n,r);for(let[a,o]of e.a)t.setProp(i,a,o);for(let a of e.c)t.addChild(i,Jw(a,t,i,n+1));return i}lt.rebuildRaw=Jw;function Dk(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new qr.InvalidArgumentError(`Malformed hybrid node at depth ${t}: expected a JSON object`);let r=e;if(typeof r.n!="string")throw new qr.InvalidArgumentError(`Malformed hybrid node at depth ${t}: 'n' (tag name) must be a string`);if(!Array.isArray(r.a)||!Array.isArray(r.c))throw new qr.InvalidArgumentError(`Malformed hybrid node '${r.n}': 'a' and 'c' must be arrays`);for(let n of r.a)if(!Array.isArray(n)||n.length!==2||typeof n[0]!="string"||typeof n[1]!="string")throw new qr.InvalidArgumentError(`Malformed hybrid node '${r.n}': each attribute must be a [string, string] pair`)}});var $r=m(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.childObjects=ut.optionalGuidId=ut.optionalEnum=ut.eachObject=ut.issue=ut.isJsonObject=void 0;function Qw(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}ut.isJsonObject=Qw;function Va(e,t,r,n){return n?{pointer:e,rule:t,message:r,fatal:n}:{pointer:e,rule:t,message:r}}ut.issue=Va;function Xw(e,t,r,n){if(!Array.isArray(e))return[];let i=[];return e.forEach((a,o)=>{Qw(a)?i.push({node:a,index:o}):n.push(Va(`${t}/${o}`,`${r}-must-be-object`,`a ${r} must be a JSON object, got ${a===null?"null":typeof a}`))}),i}ut.eachObject=Xw;function Ek(e,t,r,n,i,a){let o=e[t];o!==void 0&&(typeof o!="string"||!r.includes(o))&&a.push(Va(`${n}/${t}`,i,`${t} must be one of ${r.map(s=>`'${s}'`).join(", ")}, got ${JSON.stringify(o)}`))}ut.optionalEnum=Ek;var Ik=/^(?:\{[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}\}|[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12})$/;function _k(e,t,r,n,i){let a=e[t];typeof a=="string"&&a!==""&&!Ik.test(a)&&i.push(Va(`${r}/${t}`,n,`${t} must be a GUID or empty, got '${a}'`))}ut.optionalGuidId=_k;function Pk(e,t,r,n,i){let a=e[t],o=`${r}/${t}`;return a===void 0?[]:Array.isArray(a)?Xw(a,o,n,i):(i.push(Va(o,`${n}-list-must-be-array`,`${t} must be an array when present, got ${typeof a}`)),[])}ut.childObjects=Pk});var Kw=m(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.formApi=void 0;var br=$e(),Ga=ue(),Ok="formid,formxml,name,type,objecttypecode,formpresentation,formactivationstate,uniquename,description,versionnumber",Fk="formid,name,type,objecttypecode",Tk=2;qs.formApi={async get(e,t){let n=`/systemforms(${(0,Ga.normalizeGuid)(t,"id")})${(0,Ga.odataQuery)([["$select",Ok]])}`,i=(0,br.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,br.readEtag)(i)}},async list(e,t){var r;let n=[`type eq ${Tk}`];t?.entityLogicalName&&n.push(`objecttypecode eq '${(0,Ga.odataLiteral)(t.entityLogicalName)}'`);let i=`/systemforms${(0,Ga.odataQuery)([["$select",Fk],["$filter",n.join(" and ")]])}`,o=(0,br.ensureSuccess)(await e.get(i),e.apiUrl(i)).body;return((r=o?.value)!==null&&r!==void 0?r:[]).map(l=>{var u,c;return{type:"form",id:(u=l.formid)!==null&&u!==void 0?u:"",name:(c=l.name)!==null&&c!==void 0?c:"",entityLogicalName:l.objecttypecode,isDirty:!1}})},async create(e,t){let r="/systemforms",n=(0,br.ensureSuccess)(await e.post(r,t),e.apiUrl(r));return{id:(0,br.requireCreatedId)(n,"formid","form"),etag:(0,br.readEtag)(n)}},async update(e,t,r,n){let i=(0,Ga.normalizeGuid)(t,"id"),a=`/systemforms(${i})`,o=n?{"If-Match":n}:void 0,s=(0,br.ensureSuccess)(await e.patch(a,r,o?{headers:o}:void 0),e.apiUrl(a));return{id:i,etag:(0,br.readEtag)(s)}},delete(e,t){return(0,br.deleteRecord)(e,"systemforms",t)}}});var fn=m($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.installDomShim=void 0;var Yw=Wu(),Zw=!1,Rk={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};function xk(){if(Zw)return;let e=globalThis;typeof e.DOMParser>"u"&&(e.DOMParser=Yw.DOMParser),typeof e.XMLSerializer>"u"&&(e.XMLSerializer=Yw.XMLSerializer),typeof e.Node>"u"&&(e.Node=Rk),Zw=!0}$s.installDomShim=xk});var f2=m(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.classIdForAttributeType=ct.QUICK_VIEW_CLASS_ID=ct.NOTES_CLASS_ID=ct.SUBGRID_CLASS_ID=ct.formRegistration=ct.FormAdapter=void 0;var wt=(Se(),kt(ih)),Lk=(Ce(),kt(ah)),Mk=(xe(),kt(sh)),je=(G(),kt(oh)),Ie=(Zr(),kt(lh)),Uk=(Sd(),kt(Gw)),Bk=(Ww(),kt(zw)),_e=pn(),mn=$r(),kk=Kw(),qk=Ft(),kd=ue(),i2=fn(),Xt=1033,$k={[je.FormType.Main]:"Main",[je.FormType.QuickCreate]:"QuickCreate",[je.FormType.QuickViewForm]:"QuickView",[je.FormType.Card]:"Card"},Md={Main:je.FormType.Main,QuickCreate:je.FormType.QuickCreate,QuickView:je.FormType.QuickViewForm,Card:je.FormType.Card},Vk=new Map(Object.entries(Ie.ControlClassId).map(([e,t])=>[String(t).toUpperCase(),e]));function a2(e){var t;return e&&(t=Vk.get(e.toUpperCase()))!==null&&t!==void 0?t:"Unknown"}function za(e){return e.getAllProperties().map(t=>[t.key,t.value])}function hn(e){let t=new Map;for(let r of e.getAllProperties())t.has(r.key)||t.set(r.key,r.value);return t}function o2(e,t){return e.getAllChildren().find(r=>r.getNodeName()===t)}function qd(e){var t,r;let n=o2(e,"labels");if(!n)return"";let i=n.getAllChildren().filter(o=>o.getNodeName()==="label"),a=(t=i.find(o=>hn(o).get("languagecode")===String(Xt)))!==null&&t!==void 0?t:i[0];return a&&(r=hn(a).get("description"))!==null&&r!==void 0?r:""}function Gk(e){let t=o2(e,"parameters"),r={};if(!t)return r;for(let n of t.getAllChildren()){let i=n.getNodeName();if(i.charAt(0)==="<"||i.charAt(0)==="#")continue;let a=n.getAllChildren()[0],o=a?a.getNodeName():"";o.charAt(0)==="<"&&(o=o.substring(1)),r[i]=o}return r}function s2(e){return/^1+$/.test(e)&&e.length>=1&&e.length<=4?e.length:1}function Ud(e){let t=Math.min(Math.max(Math.trunc(e),1),4);return"1".repeat(t)}function gn(e){return e.replace(/[{}]/g,"")}function Bd(e){return`{${gn(e)}}`}function e2(e,t){if(e===void 0||e==="")return t;let r=Number(e);return Number.isNaN(r)?t:r}function Gs(e,t,r){let n=e.getAllChildren(),i=n.findIndex(u=>u.getNodeName()===t),a=[];if(n.forEach((u,c)=>{c!==i&&a.push({i:c,node:(0,_e.rawFromNode)(u)})}),i<0)return{modeled:[],bag:{a:za(e),c:a}};let o=n[i],s=[],l=[];return o.getAllChildren().forEach((u,c)=>{u.getNodeName()===r?s.push(u):l.push({i:c,node:(0,_e.rawFromNode)(u)})}),{modeled:s,bag:{a:za(e),c:a,w:{n:o.getNodeName(),a:za(o),c:l}}}}function l2(e,t,r){let n=[],i=[];return e.getAllChildren().forEach((a,o)=>{a.getNodeName()===t&&(!r||n.length===0)?n.push(a):i.push({i:o,node:(0,_e.rawFromNode)(a)})}),{modeled:n,bag:{a:za(e),c:i}}}function zk(e){let{modeled:t,bag:r}=Gs(e,"tabs","tab");return{tabs:t.map(Wk),bag:r}}function Wk(e){var t,r;let n=hn(e),{modeled:i,bag:a}=Gs(e,"columns","column");return{id:(t=n.get("id"))!==null&&t!==void 0?t:"",name:(r=n.get("name"))!==null&&r!==void 0?r:"",label:qd(e),expanded:n.get("expanded")==="true",visible:n.has("visible")?n.get("visible")==="true":!0,columns:i.map(jk),bag:a}}function jk(e){let t=hn(e),{modeled:r,bag:n}=Gs(e,"sections","section");return{width:t.get("width"),sections:r.map(Hk),bag:n}}function Hk(e){var t,r,n;let i=hn(e),{modeled:a,bag:o}=Gs(e,"rows","row");return{id:(t=i.get("id"))!==null&&t!==void 0?t:"",name:(r=i.get("name"))!==null&&r!==void 0?r:"",label:qd(e),visible:i.has("visible")?i.get("visible")==="true":!0,showLabel:i.get("showlabel")==="true",columns:s2((n=i.get("columns"))!==null&&n!==void 0?n:"1"),rows:a.map(Jk),bag:o}}function Jk(e){let{modeled:t,bag:r}=l2(e,"cell",!1);return{cells:t.map(Qk),bag:r}}function Qk(e){var t;let r=hn(e),{modeled:n,bag:i}=l2(e,"control",!0),a=qd(e),o=r.get("showlabel")==="true",s=n[0]?Xk(n[0],a,o):null;return{id:(t=r.get("id"))!==null&&t!==void 0?t:"",visible:r.has("visible")?r.get("visible")==="true":!0,colspan:e2(r.get("colspan"),1),rowspan:e2(r.get("rowspan"),1),control:s,bag:i}}function Xk(e,t,r){var n,i;let a=hn(e),o=gn((n=a.get("classid"))!==null&&n!==void 0?n:""),s=a.get("datafieldname");return{id:(i=a.get("id"))!==null&&i!==void 0?i:"",classId:o,fieldName:s||null,type:a2(o),isRequired:a.get("isrequired")==="true",isReadOnly:a.get("disabled")==="true",label:t,showLabel:r,parameters:Gk(e),bag:{a:za(e),c:e.getAllChildren().map((l,u)=>({i:u,node:(0,_e.rawFromNode)(l)}))}}}function hi(e){return e.a.length===0&&e.c.length===0&&!e.w}function u2(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function vn(e,t){var r;let n=new Set(e.a.map(o=>o[0])),i=hi(e),a=[];for(let o of t)if(n.has(o.key)){let s=(r=u2(e,o.key))!==null&&r!==void 0?r:"";o.matches(s)||a.push([o.key,o.render()])}else i?a.push([o.key,o.render()]):o.matches(o.absentDefault)||a.push([o.key,o.render()]);return(0,_e.mergeAttrs)(e.a,a)}var Vr=(e,t)=>({key:e,matches:r=>r===t,render:()=>t,absentDefault:""}),Gr=(e,t,r=!1)=>({key:e,matches:n=>n==="true"===t,render:()=>String(t),absentDefault:String(r)}),t2=(e,t,r=1)=>({key:e,matches:n=>Number(n)===t,render:()=>String(t),absentDefault:String(r)});function $d(e){return{n:"labels",a:[],c:[{n:"label",a:[["description",e],["languagecode",String(Xt)]],c:[]}]}}function c2(e){return{n:"parameters",a:[],c:Object.keys(e).map(t=>({n:(0,kd.assertXmlName)(t,"Form control parameter name"),a:[],c:[{n:`<${e[t]}`,a:[],c:[]}]}))}}function Kk(e){var t,r;let n=e.c.find(a=>a.n==="label"&&a.a.some(o=>o[0]==="languagecode"&&o[1]===String(Xt))),i=n??e.c.find(a=>a.n==="label");return(r=(t=i?.a.find(a=>a[0]==="description"))===null||t===void 0?void 0:t[1])!==null&&r!==void 0?r:""}function Yk(e,t){let r=!1,n=e.c.map(i=>i.n!=="label"||!i.a.some(o=>o[0]==="languagecode"&&o[1]===String(Xt))?i:(r=!0,{...i,a:i.a.map(o=>o[0]==="description"?["description",t]:o)}));return r||n.push({n:"label",a:[["description",t],["languagecode",String(Xt)]],c:[]}),{...e,c:n}}function Vd(e,t){let r=e.c.findIndex(i=>i.node.n==="labels");if(r<0||Kk(e.c[r].node)===t)return e;let n=Yk(e.c[r].node,t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function Zk(e){let t={};for(let r of e.c){let n=r.n;if(n.charAt(0)==="<"||n.charAt(0)==="#")continue;let i=r.c[0],a=i?i.n:"";a.charAt(0)==="<"&&(a=a.substring(1)),t[n]=a}return t}function e3(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(i=>e[i]===t[i])}function t3(e,t){return e.a.some(r=>r[0]===t)?{...e,a:e.a.filter(r=>r[0]!==t)}:e}function r3(e,t){let r=e.c.findIndex(i=>i.node.n==="parameters");if(r<0||e3(Zk(e.c[r].node),t))return e;let n=c2(t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function zs(e,t,r,n){if(e.w){let o={n:e.w.n,a:e.w.a.map(s=>[s[0],s[1]]),c:(0,_e.spliceChildren)(e.w.c,r)};return(0,_e.spliceChildren)(e.c,[o])}let i=n(),a={n:t,a:[],c:r};return e.c.length===0?[...i,a]:(0,_e.spliceChildren)(e.c,[...i,a])}function n3(e){let t=e.tabs.map(i3);return{n:"form",a:vn(e.bag,[]),c:e.tabs.length===0&&hi(e.bag)?[]:zs(e.bag,"tabs",t,()=>[])}}function i3(e){let t=[Vr("id",e.id),Vr("name",e.name),Gr("expanded",e.expanded),Gr("visible",e.visible,!0)],r=e.columns.map(a3),n=Vd(e.bag,e.label);return{n:"tab",a:vn(n,t),c:zs(n,"columns",r,()=>e.label?[$d(e.label)]:[])}}function a3(e){let t=e.width!==void 0?[Vr("width",e.width)]:[],r=e.sections.map(o3);return{n:"column",a:vn(e.bag,t),c:zs(e.bag,"sections",r,()=>[])}}function o3(e){let t=[Vr("id",e.id),Vr("name",e.name),Gr("showlabel",e.showLabel),Gr("visible",e.visible,!0),{key:"columns",matches:i=>s2(i)===e.columns,render:()=>Ud(e.columns),absentDefault:Ud(1)}],r=e.rows.map(s3),n=Vd(e.bag,e.label);return{n:"section",a:vn(n,t),c:zs(n,"rows",r,()=>e.label?[$d(e.label)]:[])}}function s3(e){let t=e.cells.map(l3);return{n:"row",a:vn(e.bag,[]),c:hi(e.bag)?t:(0,_e.assembleChildren)(e.bag,t)}}function l3(e){let t=e.control?e.control.showLabel:u2(e.bag,"showlabel")==="true",r=[Vr("id",e.id),Gr("showlabel",t),Gr("visible",e.visible,!0),t2("colspan",e.colspan),t2("rowspan",e.rowspan)],n=e.control?[u3(e.control)]:[],i;if(hi(e.bag))i=[...e.control&&e.control.label?[$d(e.control.label)]:[],...n];else{let a=e.control?Vd(e.bag,e.control.label):e.bag;i=(0,_e.assembleChildren)(a,n)}return{n:"cell",a:vn(e.bag,r),c:i}}function u3(e){let t=[Vr("id",e.id),{key:"classid",matches:i=>gn(i)===e.classId,render:()=>Bd(e.classId),absentDefault:""}];e.fieldName!==null&&t.push(Vr("datafieldname",e.fieldName)),t.push(Gr("disabled",e.isReadOnly)),t.push(Gr("isrequired",e.isRequired));let r=e.fieldName===null?t3(e.bag,"datafieldname"):e.bag,n;return hi(r)?n=Object.keys(e.parameters).length>0?[c2(e.parameters)]:[]:n=(0,_e.assembleChildren)(r3(r,e.parameters),[]),{n:"control",a:vn(r,t),c:n}}var c3={make:(e,t)=>new Mk.FormElementNode(e,t),setProp:(e,t,r)=>e.setProperty(t,r),addChild:(e,t)=>e.addChild(t)};function r2(e,t){(0,i2.installDomShim)();let r=p3(e,t),n=(0,_e.rebuildRaw)(n3(r),c3,null);return new Bk.SerializationService(Xt).serializeFormXmlNode(n)}function d3(e){return JSON.parse(JSON.stringify(e))}function p3(e,t){var r;let n=d3(e);n.bag||(n.bag=(0,_e.emptyBag)()),C3(n.bag),t&&f3(n,t);for(let i of(r=n.tabs)!==null&&r!==void 0?r:[])m3(i);return n}function f3(e,t){var r;let n=(r=e.entityLogicalName)!==null&&r!==void 0?r:"";d2(e,i=>{let a=i.fieldName,o=i;if(!a||o.label!==void 0&&o.classId!==void 0)return;let s=t.resolveField(n,a);s&&(o.label===void 0&&s.displayName&&(o.label=s.displayName),o.classId===void 0&&s.attributeType&&(o.classId=p2(s.attributeType)))})}function d2(e,t){var r,n,i,a,o;for(let s of(r=e.tabs)!==null&&r!==void 0?r:[])for(let l of(n=s.columns)!==null&&n!==void 0?n:[])for(let u of(i=l.sections)!==null&&i!==void 0?i:[])for(let c of(a=u.rows)!==null&&a!==void 0?a:[])for(let d of(o=c.cells)!==null&&o!==void 0?o:[])d.control&&t(d.control)}function m3(e){e.id||(e.id=wt.Guid.NewGuid()),e.name===void 0&&(e.name=""),e.label===void 0&&(e.label=""),e.expanded===void 0&&(e.expanded=!0),e.visible===void 0&&(e.visible=!0),e.columns||(e.columns=[]);for(let t of e.columns)h3(t);e.bag||(e.bag=(0,_e.emptyBag)())}function h3(e){e.sections||(e.sections=[]);for(let t of e.sections)g3(t);e.bag||(e.bag=(0,_e.emptyBag)()),e.width===void 0&&hi(e.bag)&&(e.width="100%")}function g3(e){e.id||(e.id=wt.Guid.NewGuid()),e.name===void 0&&(e.name=""),e.label===void 0&&(e.label=""),e.showLabel===void 0&&(e.showLabel=!1),e.visible===void 0&&(e.visible=!0),e.columns===void 0&&(e.columns=1),e.rows||(e.rows=[]);for(let t of e.rows)v3(t);e.bag||(e.bag=(0,_e.emptyBag)())}function v3(e){e.cells||(e.cells=[]);for(let t of e.cells)b3(t);e.bag||(e.bag=(0,_e.emptyBag)())}function b3(e){e.id||(e.id=wt.Guid.NewGuid()),e.visible===void 0&&(e.visible=!0),e.colspan===void 0&&(e.colspan=1),e.rowspan===void 0&&(e.rowspan=1),e.control===void 0&&(e.control=null),e.control&&y3(e.control),e.bag||(e.bag=(0,_e.emptyBag)())}function y3(e){var t;e.id||(e.id=wt.Guid.NewGuid()),e.classId===void 0&&(e.classId=String(Ie.ControlClassId.TextboxControl)),e.fieldName===void 0&&(e.fieldName=null),e.type===void 0&&(e.type=e.fieldName?"Field":a2(String(e.classId))),e.isRequired===void 0&&(e.isRequired=!1),e.isReadOnly===void 0&&(e.isReadOnly=!1),e.label===void 0&&(e.label=(t=e.fieldName)!==null&&t!==void 0?t:""),e.showLabel===void 0&&(e.showLabel=!0),(e.parameters===void 0||e.parameters===null)&&(e.parameters={});for(let r of Object.keys(e.parameters))(0,kd.assertXmlName)(r,"Form control parameter name");e.bag||(e.bag=(0,_e.emptyBag)())}function C3(e){for(let t of e.c){let r=t.node;if(r.n==="events"){for(let n of r.c)if(n.n==="event"){for(let i of n.c)if(i.n==="Handlers")for(let a of i.c)a.n==="Handler"&&!n2(a,"handlerUniqueId")&&a.a.push(["handlerUniqueId",Bd(wt.Guid.NewGuid())])}}else if(r.n==="formLibraries")for(let n of r.c)n.n==="Library"&&!n2(n,"libraryUniqueId")&&n.a.push(["libraryUniqueId",Bd(wt.Guid.NewGuid())])}}var Vs=class{toArtifact(t){var r,n,i;let{tabs:a,bag:o}=zk(t);return{id:t.formId?t.formId.guidString:"",name:(r=t.formName)!==null&&r!==void 0?r:"",entityLogicalName:(n=t.entityName)!==null&&n!==void 0?n:"",formType:(i=$k[t.formType])!==null&&i!==void 0?i:"Main",status:this.readActivationStatus(t),tabs:a,bag:o}}fromArtifact(t){return this.deserialize({formxml:r2(t),formid:t.id||wt.Guid.NewGuid(),objecttypecode:t.entityLogicalName,type:Md[t.formType],name:t.name,uniquename:t.name,description:"",formpresentation:je.FormPresentation.AirForm,formactivationstate:t.status==="Active"?je.FormActivationState.Active:je.FormActivationState.InActive})}fromApiResponse(t){var r,n,i,a,o,s;let l=t,u=this.deserialize({formxml:(r=l.formxml)!==null&&r!==void 0?r:"",formid:(n=l.formid)!==null&&n!==void 0?n:wt.Guid.NewGuid(),objecttypecode:(i=l.objecttypecode)!==null&&i!==void 0?i:"",type:l.type,name:(a=l.name)!==null&&a!==void 0?a:"",uniquename:(o=l.uniquename)!==null&&o!==void 0?o:"",description:(s=l.description)!==null&&s!==void 0?s:"",formpresentation:l.formpresentation,formactivationstate:l.formactivationstate});return this.toArtifact(u)}toApiPayload(t,r,n){return{formxml:r2(t,n),name:t.name,type:Md[t.formType],objecttypecode:t.entityLogicalName}}metadataNeeds(t){let r=t.entityLogicalName;if(!r)return[];let n=new Set,i=[];return d2(t,a=>{let o=a.fieldName,s=a;!o||s.label!==void 0&&s.classId!==void 0||n.has(o)||(n.add(o),i.push({entityLogicalName:r,fieldName:o}))}),i}createDefault(t){var r,n,i,a,o,s,l,u,c,d;let f=t.tabs&&t.tabs.length>0?void 0:P3,g=f!==void 0?f:t.tabs.map(N=>A3(N)).join(""),b=this.deserialize({formxml:`<form><tabs>${g}</tabs></form>`,formid:t.id||wt.Guid.NewGuid(),objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",type:Md[(n=t.formType)!==null&&n!==void 0?n:"Main"],name:(i=t.name)!==null&&i!==void 0?i:"New Form",uniquename:(a=t.name)!==null&&a!==void 0?a:"New Form",description:"",formpresentation:je.FormPresentation.AirForm,formactivationstate:((o=t.status)!==null&&o!==void 0?o:"Active")==="Active"?je.FormActivationState.Active:je.FormActivationState.InActive}),w=this.toArtifact(b);return{id:(s=t.id)!==null&&s!==void 0?s:w.id,name:(l=t.name)!==null&&l!==void 0?l:"New Form",entityLogicalName:(u=t.entityLogicalName)!==null&&u!==void 0?u:"",formType:(c=t.formType)!==null&&c!==void 0?c:"Main",status:(d=t.status)!==null&&d!==void 0?d:"Active",tabs:w.tabs,bag:w.bag}}assignMissingIds(t){return(0,qk.assignMissingIds)(t)}validate(t){return F3(t)}deserialize(t){(0,i2.installDomShim)();let r=Lk.ScriptUtilities.ParseXml(t.formxml),n=new Uk.DeserializationService(Xt).deSerializeFormXml(r,new wt.Guid(t.formid),t.objecttypecode,je.FormState.Draft,t.name,t.uniquename,t.type,t.formpresentation,t.description,t.formactivationstate);if(!n)throw new Error("FormXml could not be deserialized into a Form model.");return n}readActivationStatus(t){return t.formactivationstate===je.FormActivationState.InActive?"Inactive":"Active"}};ct.FormAdapter=Vs;function Mt(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Gd(e){return e?`<labels><label description="${Mt(e)}" languagecode="${Xt}" /></labels>`:""}function A3(e){let t=(e.columns.length>0?e.columns:[_3()]).map(r=>w3(r)).join("");return`<tab id="{${Mt(gn(e.id))}}" name="${Mt(e.name)}" expanded="${e.expanded}" visible="${e.visible}">${Gd(e.label)}<columns>${t}</columns></tab>`}function w3(e){var t;let r=e.sections.map(n=>N3(n)).join("");return`<column width="${Mt((t=e.width)!==null&&t!==void 0?t:"100%")}"><sections>${r}</sections></column>`}function N3(e){let t=e.rows.map(r=>S3(r)).join("");return`<section id="{${Mt(gn(e.id))}}" name="${Mt(e.name)}" showlabel="${e.showLabel}" visible="${e.visible}" columns="${Ud(e.columns)}">${Gd(e.label)}<rows>${t}</rows></section>`}function S3(e){return`<row>${e.cells.map(t=>D3(t)).join("")}</row>`}function D3(e){let t=e.control,r=t?Gd(t.label):"",n=t?E3(t):"";return`<cell id="{${Mt(gn(e.id))}}" showlabel="${t?t.showLabel:!1}" visible="${e.visible}" colspan="${e.colspan}" rowspan="${e.rowspan}">${r}${n}</cell>`}function E3(e){let t=e.fieldName?` datafieldname="${Mt(e.fieldName)}"`:"",r=I3(e.parameters);return`<control id="${Mt(e.id)}" classid="{${Mt(gn(e.classId))}}"${t} disabled="${e.isReadOnly}" isrequired="${e.isRequired}">${r}</control>`}function I3(e){let t=Object.keys(e);return t.length===0?"":(t.forEach(n=>(0,kd.assertXmlName)(n,"Form control parameter name")),`<parameters>${t.map(n=>`<${n}>${Mt(e[n])}</${n}>`).join("")}</parameters>`)}function _3(){return{width:"100%",sections:[],bag:{a:[],c:[]}}}var P3=`<tab id="{${wt.Guid.NewGuid()}}" name="tab_general" expanded="true" visible="true"><labels><label description="General" languagecode="${Xt}" /></labels><columns><column width="100%"><sections><section id="{${wt.Guid.NewGuid()}}" name="section_general" showlabel="false" visible="true" columns="1"><labels><label description="General" languagecode="${Xt}" /></labels><rows></rows></section></sections></column></columns></tab>`;function O3(){return{adapter:new Vs,api:kk.formApi}}ct.formRegistration=O3;function F3(e){let t=[];return(0,mn.childObjects)(e,"tabs","","tab",t).forEach(({node:n,index:i})=>{(0,mn.childObjects)(n,"columns",`/tabs/${i}`,"column",t).forEach(({node:o,index:s})=>{let l=`/tabs/${i}/columns/${s}`;(0,mn.childObjects)(o,"sections",l,"section",t).forEach(({node:c,index:d})=>{let f=`${l}/sections/${d}`;(0,mn.childObjects)(c,"rows",f,"row",t).forEach(({node:b,index:w})=>{let N=`${f}/rows/${w}`;(0,mn.childObjects)(b,"cells",N,"cell",t).forEach(({node:T,index:R})=>{let M=T.control;M!=null&&!(0,mn.isJsonObject)(M)&&t.push((0,mn.issue)(`${N}/cells/${R}/control`,"control-must-be-object-or-null",`a cell control must be a JSON object or null, got ${typeof M}`))})})})})}),t}ct.SUBGRID_CLASS_ID=Ie.ControlClassId.SubgridControl;ct.NOTES_CLASS_ID=Ie.ControlClassId.TimelineControl;ct.QUICK_VIEW_CLASS_ID=Ie.ControlClassId.QuickViewControl;var T3={Lookup:String(Ie.ControlClassId.LookupControl),Customer:String(Ie.ControlClassId.LookupControl),Owner:String(Ie.ControlClassId.LookupControl),PartyList:String(Ie.ControlClassId.PartyListControl),Boolean:String(Ie.ControlClassId.BooleanControl),DateTime:String(Ie.ControlClassId.DateTimeControl),Decimal:String(Ie.ControlClassId.DecimalControl),Double:String(Ie.ControlClassId.FloatingNumberControl),Money:String(Ie.ControlClassId.CurrencyControl),Integer:String(Ie.ControlClassId.IntegerControl),BigInt:String(Ie.ControlClassId.IntegerControl),Memo:String(Ie.ControlClassId.TextAreaControl),String:String(Ie.ControlClassId.TextboxControl)},R3="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE";function p2(e){return e==="Picklist"||e==="State"||e==="Status"?R3:e&&T3[e]||String(Ie.ControlClassId.TextboxControl)}ct.classIdForAttributeType=p2;function n2(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}});var ja=m(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.projectElementBag=ve.serializeNode=ve.domEngine=ve.nodeLikeFromDom=ve.parseXmlRoot=ve.EMPTY_FORM_SENTINEL=ve.TEXT_SENTINEL=void 0;var x3=pn(),Wa=be();ve.TEXT_SENTINEL="#text";ve.EMPTY_FORM_SENTINEL="#empty";var js=new WeakSet;function L3(e,t){let r=e&&e.trim()!==""?e:t,i=new DOMParser().parseFromString(r,"text/xml").documentElement;if(!i)throw new Wa.InvalidArgumentError("XML source has no root element (empty or malformed input)");return U3(i),B3(i),$3(i,r),i}ve.parseXmlRoot=L3;var M3=new Set([1,3]);function U3(e){let t=[e];for(;t.length>0;){let n=t.pop().childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];if(!M3.has(a.nodeType))throw new Wa.InvalidArgumentError(`Unsupported XML node type ${a.nodeType} (CDATA / comment / processing-instruction) is outside the hybrid projection's lossless grammar and cannot be round-tripped`);t.push(a)}}}function B3(e){var t,r;let n=(t=e.ownerDocument)!==null&&t!==void 0?t:e.parentNode;if(!n)return;let i=n.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];if(o!==e&&!(o.nodeType===3&&((r=o.nodeValue)!==null&&r!==void 0?r:"").trim()===""))throw new Wa.InvalidArgumentError(`Unsupported document-level XML node (type ${o.nodeType}: declaration / comment / processing-instruction outside the root element) cannot be round-tripped`)}}function k3(e){let t=[],r=/<([^>]*)>/g;for(let n=r.exec(e);n!==null;n=r.exec(e)){let i=n[1];i.startsWith("/")||i.startsWith("?")||i.startsWith("!")||t.push(i.endsWith("/"))}return t}function q3(e){let t=[],r=[e];for(;r.length>0;){let n=r.pop();t.push(n);let i=n.childNodes;for(let a=i.length-1;a>=0;a-=1){let o=i[a];o.nodeType===1&&r.push(o)}}return t}function h2(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r].nodeType;if(n===1||n===3)return!0}return!1}function $3(e,t){let r=k3(t),n=q3(e),i=Math.min(r.length,n.length);for(let a=0;a<i;a+=1){if(r[a])continue;let o=n[a];h2(o)||js.add(o)}}function zd(e){let t=e.nodeType===3;return{getNodeName:()=>t?ve.TEXT_SENTINEL:e.tagName,getAllProperties:()=>{var r;if(t)return[{key:ve.TEXT_SENTINEL,value:(r=e.nodeValue)!==null&&r!==void 0?r:""}];let n=e.attributes,i=[];for(let a=0;a<n.length;a+=1)i.push({key:n[a].name,value:n[a].value});return js.has(e)&&!h2(e)&&i.push({key:ve.EMPTY_FORM_SENTINEL,value:"1"}),i},getAllChildren:()=>{if(t)return[];let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];(a.nodeType===1||a.nodeType===3)&&r.push(zd(a))}return r}}}ve.nodeLikeFromDom=zd;function V3(e){return{make:t=>t===ve.TEXT_SENTINEL?e.createTextNode(""):e.createElement(t),setProp:(t,r,n)=>{t.nodeType===3?t.nodeValue=n:r===ve.EMPTY_FORM_SENTINEL?js.add(t):t.setAttribute(r,n)},addChild:(t,r)=>{t.appendChild(r)}}}ve.domEngine=V3;function g2(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r<=31&&r!==9&&r!==10&&r!==13||r===65534||r===65535)throw Ws(r);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))throw Ws(r);t+=1;continue}if(r>=56320&&r<=57343)throw Ws(r)}}function Ws(e){let t=e.toString(16).toUpperCase().padStart(4,"0");return new Wa.InvalidArgumentError(`Value contains U+${t}, a character not permitted in XML 1.0 (control char / lone surrogate / non-character); it cannot be serialized losslessly`)}function G3(e){return g2(e),String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/\r/g,"
").replace(/\n/g,"
").replace(/\t/g,"	")}function z3(e){return g2(e),String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function W3(e){return v2(e,0)}ve.serializeNode=W3;var m2=512;function v2(e,t){var r;if(t>m2)throw new Wa.InvalidArgumentError(`XML nesting exceeds the maximum supported depth of ${m2}`);if(e.nodeType===3)return z3((r=e.nodeValue)!==null&&r!==void 0?r:"");let n=e,i="<"+n.tagName,a=n.attributes;for(let l=0;l<a.length;l+=1)i+=" "+a[l].name+'="'+G3(a[l].value)+'"';let o=[],s=n.childNodes;for(let l=0;l<s.length;l+=1){let u=s[l];(u.nodeType===1||u.nodeType===3)&&o.push(u)}if(o.length===0)return js.has(n)?i+"></"+n.tagName+">":i+" />";i+=">";for(let l of o)i+=v2(l,t+1);return i+"</"+n.tagName+">"}function j3(e){let t=zd(e);return{a:t.getAllProperties().map(r=>[r.key,r.value]),c:t.getAllChildren().map((r,n)=>({i:n,node:(0,x3.rawFromNode)(r)}))}}ve.projectElementBag=j3});var Wd=m(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.viewApi=gi.findDefaultViews=void 0;var Kt=$e(),yr=ue(),H3="savedqueryid,name,description,fetchxml,layoutxml,querytype,returnedtypecode,isdefault",J3="savedqueryid,name,returnedtypecode,querytype,isdefault";async function Q3(e,t,r={}){var n,i,a;let o=new Set(((n=r.excludeViewIds)!==null&&n!==void 0?n:[]).filter(Boolean)),s=`returnedtypecode eq '${(0,yr.odataLiteral)(t)}' and querytype eq 0`,l=`/savedqueries${(0,yr.odataQuery)([["$select","savedqueryid,name,isdefault"],["$filter",s],["$top",50]])}`;return((a=(i=(0,Kt.ensureSuccess)(await e.get(l),e.apiUrl(l)).body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[]).filter(d=>{var f;return d.savedqueryid&&!o.has(d.savedqueryid)&&(d.isdefault||/^(Active|Inactive)\b/i.test((f=d.name)!==null&&f!==void 0?f:""))}).map(d=>{var f;return{id:String(d.savedqueryid),name:String((f=d.name)!==null&&f!==void 0?f:"")}})}gi.findDefaultViews=Q3;async function X3(e,t){var r;let n=`/EntityDefinitions(LogicalName='${(0,yr.odataLiteral)(t)}')${(0,yr.odataQuery)([["$select","ObjectTypeCode"]])}`,i=await e.get(n);if(i.status>=200&&i.status<300){let a=(r=i.body)===null||r===void 0?void 0:r.ObjectTypeCode;return typeof a=="number"?a:void 0}}async function b2(e,t,r){if(!r||!/<grid\b/.test(t)||/<grid[^>]*\bobject=/.test(t))return t;let n=await X3(e,r);return n===void 0?t:t.replace(/<grid\b/,`<grid object="${n}"`)}gi.viewApi={async get(e,t){let n=`/savedqueries(${(0,yr.normalizeGuid)(t,"id")})${(0,yr.odataQuery)([["$select",H3]])}`,i=(0,Kt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Kt.readEtag)(i)}},async list(e,t){var r;let n=`/savedqueries${(0,yr.odataQuery)([["$select",J3],["$filter",t?.entityLogicalName?`returnedtypecode eq '${(0,yr.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`,a=(0,Kt.ensureSuccess)(await e.get(n),e.apiUrl(n)).body;return((r=a?.value)!==null&&r!==void 0?r:[]).map(s=>{var l,u;return{type:"view",id:(l=s.savedqueryid)!==null&&l!==void 0?l:"",name:(u=s.name)!==null&&u!==void 0?u:"",entityLogicalName:s.returnedtypecode,isDirty:!1}})},async create(e,t){let r=t,n="/savedqueries",i=await b2(e,r.layoutxml,r.returnedtypecode),a=(0,Kt.ensureSuccess)(await e.post(n,{name:r.name,description:r.description,fetchxml:r.fetchxml,layoutxml:i,returnedtypecode:r.returnedtypecode,querytype:r.querytype,isdefault:r.isdefault}),e.apiUrl(n));return{id:(0,Kt.requireCreatedId)(a,"savedqueryid","view"),etag:(0,Kt.readEtag)(a)}},async update(e,t,r,n){let i=r,a=(0,yr.normalizeGuid)(t,"id"),o=`/savedqueries(${a})`,s=n?{"If-Match":n}:void 0,l=await b2(e,i.layoutxml,i.returnedtypecode),u=(0,Kt.ensureSuccess)(await e.patch(o,{name:i.name,description:i.description,fetchxml:i.fetchxml,layoutxml:l},s?{headers:s}:void 0),e.apiUrl(o));return{id:a,etag:(0,Kt.readEtag)(u)}},delete(e,t){return(0,Kt.deleteRecord)(e,"savedqueries",t)}}});var O2=m(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.viewRegistration=bi.ViewAdapter=void 0;var vi=$r(),jd=pn(),bn=ja(),K3=Wd(),Hd=fn(),Y3=Ft(),w2=100,Hs=class{toArtifact(t){var r,n,i,a,o,s,l,u;(0,Hd.installDomShim)();let c=(r=t.fetchxml)!==null&&r!==void 0?r:"",d=(n=t.layoutxml)!==null&&n!==void 0?n:"",f=(0,bn.parseXmlRoot)(c,"<fetch/>"),g=(0,bn.parseXmlRoot)(d,"<grid/>");return{id:(i=t.savedqueryid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.returnedtypecode)!==null&&s!==void 0?s:Z3(f),queryType:(l=t.querytype)!==null&&l!==void 0?l:0,isDefault:(u=t.isdefault)!==null&&u!==void 0?u:!1,columns:S2(g,f),filters:I2(f),sort:E2(f),fetchBag:c?(0,bn.projectElementBag)(f):void 0,layoutBag:d?(0,bn.projectElementBag)(g):void 0}}fromArtifact(t){(0,Hd.installDomShim)();let{fetchxml:r,layoutxml:n}=y2(t);return{savedqueryid:t.id,name:t.name,description:t.description,returnedtypecode:t.entityLogicalName,querytype:t.queryType,isdefault:t.isDefault,fetchxml:r,layoutxml:n}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){var r,n,i,a,o;(0,Hd.installDomShim)();let{fetchxml:s,layoutxml:l}=y2(t);return{name:(r=t.name)!==null&&r!==void 0?r:"",description:(n=t.description)!==null&&n!==void 0?n:"",fetchxml:s,layoutxml:l,returnedtypecode:(i=t.entityLogicalName)!==null&&i!==void 0?i:"",querytype:(a=t.queryType)!==null&&a!==void 0?a:0,isdefault:(o=t.isDefault)!==null&&o!==void 0?o:!1}}createDefault(t){var r,n,i,a,o,s,l,u;let c=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,Y3.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New View",description:(a=t.description)!==null&&a!==void 0?a:"",entityLogicalName:c,queryType:(o=t.queryType)!==null&&o!==void 0?o:0,isDefault:(s=t.isDefault)!==null&&s!==void 0?s:!1,columns:t.columns&&t.columns.length>0?t.columns:[{name:`${c}id`,width:300,order:0}],filters:(l=t.filters)!==null&&l!==void 0?l:{type:"and",conditions:[],groups:[]},sort:(u=t.sort)!==null&&u!==void 0?u:[]}}assignMissingIds(t){return t}validate(t){let r=[],n=t;(0,vi.childObjects)(n,"columns","","column",r),(0,vi.childObjects)(n,"sort","","sort",r);let i=n.filters;return i!=null&&((0,vi.isJsonObject)(i)?N2(i,"/filters",r):r.push((0,vi.issue)("/filters","filters-must-be-object",`filters must be a JSON object, got ${typeof i}`))),r}};bi.ViewAdapter=Hs;function N2(e,t,r){(0,vi.childObjects)(e,"conditions",t,"condition",r),(0,vi.childObjects)(e,"groups",t,"filterGroup",r).forEach(({node:i,index:a})=>N2(i,`${t}/groups/${a}`,r))}function Z3(e){var t;let r=e.getElementsByTagName("entity")[0];return(t=r?.getAttribute("name"))!==null&&t!==void 0?t:""}function S2(e,t){var r;let n=D2(t),i=e.getElementsByTagName("cell"),a=[],o=0;for(let s=0;s<i.length;s+=1){let l=i[s];if(l.getAttribute("ishidden")==="1")continue;let u=l.getAttribute("name");if(!u)continue;let c=parseInt((r=l.getAttribute("width"))!==null&&r!==void 0?r:"",10),d={name:u,width:Number.isNaN(c)?w2:c,order:o},f=n.get(u);f&&(d.relatedEntity=f),o+=1,a.push(d)}return a}function D2(e){var t;let r=new Map,n=e.getElementsByTagName("link-entity");for(let i=0;i<n.length;i+=1){let a=n[i],o=a.getAttribute("name");if(!o)continue;let s=a.getElementsByTagName("attribute");for(let l=0;l<s.length;l+=1){let u=s[l],c=(t=u.getAttribute("alias"))!==null&&t!==void 0?t:u.getAttribute("name");c&&r.set(c,o)}}return r}function E2(e){var t;let r=e.getElementsByTagName("entity")[0];if(!r)return[];let n=[],i=r.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];if(o.nodeType===1&&o.tagName==="order"){let s=o.getAttribute("attribute");s&&n.push({attribute:s,descending:((t=o.getAttribute("descending"))!==null&&t!==void 0?t:"").toLowerCase()==="true"})}}return n}function I2(e){let t=e.getElementsByTagName("entity")[0],r={type:"and",conditions:[],groups:[]};if(!t)return r;let n=Nt(t,"filter").filter(i=>!_2(i)).map(P2);return n.length===0?r:n.length===1?n[0]:{type:"and",conditions:[],groups:n}}function _2(e){if(Nt(e,"filter").length>0)return!1;let t=Nt(e,"condition");return t.length===0?!1:t.some(r=>r.getAttribute("isquickfindfields")==="1"||Nt(r,"value").length>0)}function P2(e){var t,r;let n=((t=e.getAttribute("type"))!==null&&t!==void 0?t:"and").toLowerCase()==="or"?"or":"and",i=[],a=[],o=e.childNodes;for(let s=0;s<o.length;s+=1){let l=o[s];if(l.nodeType===1)if(l.tagName==="condition"){if(l.getAttribute("isquickfindfields")==="1")continue;let u=l.getAttribute("attribute");if(!u)continue;let c={attribute:u,operator:(r=l.getAttribute("operator"))!==null&&r!==void 0?r:""},d=l.getAttribute("value");d!==null&&(c.value=d),i.push(c)}else l.tagName==="filter"&&a.push(P2(l))}return{type:n,conditions:i,groups:a}}function Nt(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName===t&&r.push(a)}return r}function y2(e){let t=eq(e.columns);if(!C2(e.fetchBag)||!C2(e.layoutBag))return{fetchxml:cq({...e,columns:t}),layoutxml:dq({...e,columns:t},`${e.entityLogicalName}id`)};let r=new DOMParser().parseFromString("<root/>","text/xml"),n=A2(e.fetchBag,"fetch",r),i=A2(e.layoutBag,"grid",r),a=S2(i,n),o=!Jd(t,a),s=!Jd(e.sort,E2(n)),l=!Jd(e.filters,I2(n));return o&&(tq(r,n,t,a),aq(r,i,t)),s&&lq(r,n,e.sort),l&&uq(r,n,e.filters),{fetchxml:(0,bn.serializeNode)(n),layoutxml:(0,bn.serializeNode)(i)}}function eq(e){return(e??[]).map((t,r)=>{var n,i;return{name:String(t.name).toLowerCase(),width:(n=t.width)!==null&&n!==void 0?n:w2,order:(i=t.order)!==null&&i!==void 0?i:r,...t.relatedEntity?{relatedEntity:t.relatedEntity}:{}}})}function C2(e){return!!e&&(e.c.length>0||e.a.length>0)}function A2(e,t,r){let n={n:t,a:(0,jd.mergeAttrs)(e.a,[]),c:(0,jd.spliceChildren)(e.c,[])};return(0,jd.rebuildRaw)(n,(0,bn.domEngine)(r),null)}function tq(e,t,r,n){var i;let a=t.getElementsByTagName("entity")[0];if(!a)return;let o=new Set(r.map(u=>{var c;return`${(c=u.relatedEntity)!==null&&c!==void 0?c:""}:${u.name}`}));for(let u of n)o.has(`${(i=u.relatedEntity)!==null&&i!==void 0?i:""}:${u.name}`)||rq(a,u);let s=D2(t),l=new Set(Nt(a,"attribute").map(u=>u.getAttribute("name")).filter(u=>!!u));for(let u of[...r].sort((c,d)=>c.order-d.order))if(u.relatedEntity){if(s.get(u.name)===u.relatedEntity)continue;let c=nq(e,a,u.relatedEntity),d=e.createElement("attribute");d.setAttribute("name",u.name),c.appendChild(d),s.set(u.name,u.relatedEntity)}else{if(l.has(u.name))continue;let c=e.createElement("attribute");c.setAttribute("name",u.name),iq(a,c),l.add(u.name)}}function rq(e,t){var r;if(t.relatedEntity){for(let n of Nt(e,"link-entity"))if(n.getAttribute("name")===t.relatedEntity){for(let i of Nt(n,"attribute"))if(((r=i.getAttribute("alias"))!==null&&r!==void 0?r:i.getAttribute("name"))===t.name){n.removeChild(i);return}}return}for(let n of Nt(e,"attribute"))if(n.getAttribute("name")===t.name){e.removeChild(n);return}}function nq(e,t,r){for(let i of Nt(t,"link-entity"))if(i.getAttribute("name")===r)return i;let n=e.createElement("link-entity");return n.setAttribute("name",r),t.appendChild(n),n}function iq(e,t){let r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];if(i.nodeType===1&&i.tagName!=="attribute"){e.insertBefore(t,i);return}}e.appendChild(t)}function aq(e,t,r){let n=t.getElementsByTagName("row")[0];if(!n)return;let i=[...r].sort((s,l)=>s.order-l.order),a=oq(n);if(sq(a,i)){for(let s=0;s<i.length;s+=1){let l=String(i[s].width);a[s].getAttribute("width")!==l&&a[s].setAttribute("width",l)}return}let o=new Map;for(let s of a){let l=s.getAttribute("name");l&&o.set(l,s),n.removeChild(s)}for(let s of i){let l=o.get(s.name);l||(l=e.createElement("cell"),l.setAttribute("name",s.name)),l.setAttribute("width",String(s.width)),n.appendChild(l)}}function oq(e){return Nt(e,"cell").filter(t=>!!t.getAttribute("name")&&t.getAttribute("ishidden")!=="1")}function sq(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r].getAttribute("name")!==t[r].name)return!1;return!0}function lq(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of Nt(n,"order"))n.removeChild(i);for(let i of r){let a=e.createElement("order");a.setAttribute("attribute",i.attribute),a.setAttribute("descending",String(i.descending)),n.appendChild(a)}}}function uq(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of Nt(n,"filter"))_2(i)||n.removeChild(i);(r.conditions.length>0||r.groups.length>0)&&n.appendChild(Qd(e,r))}}function Jd(e,t){return JSON.stringify(e)===JSON.stringify(t)}function cq(e){let t=new DOMParser().parseFromString("<fetch/>","text/xml"),r=t.documentElement;r.setAttribute("version","1.0"),r.setAttribute("mapping","logical");let n=t.createElement("entity");n.setAttribute("name",e.entityLogicalName),r.appendChild(n);let i=new Map;for(let a of[...e.columns].sort((o,s)=>o.order-s.order)){let o=t.createElement("attribute");if(o.setAttribute("name",a.name),a.relatedEntity){let s=i.get(a.relatedEntity);s||(s=t.createElement("link-entity"),s.setAttribute("name",a.relatedEntity),n.appendChild(s),i.set(a.relatedEntity,s)),s.appendChild(o)}else n.appendChild(o)}for(let a of e.sort){let o=t.createElement("order");o.setAttribute("attribute",a.attribute),o.setAttribute("descending",String(a.descending)),n.appendChild(o)}return(e.filters.conditions.length>0||e.filters.groups.length>0)&&n.appendChild(Qd(t,e.filters)),new XMLSerializer().serializeToString(t)}function Qd(e,t){let r=e.createElement("filter");r.setAttribute("type",t.type);for(let n of t.conditions){let i=e.createElement("condition");i.setAttribute("attribute",n.attribute),i.setAttribute("operator",n.operator),n.value!==void 0&&i.setAttribute("value",n.value),r.appendChild(i)}for(let n of t.groups)r.appendChild(Qd(e,n));return r}function dq(e,t){var r;let n=new DOMParser().parseFromString("<grid/>","text/xml"),i=n.documentElement,a=[...e.columns].sort((s,l)=>s.order-l.order);i.setAttribute("name","resultset"),i.setAttribute("jump",((r=a[0])===null||r===void 0?void 0:r.name)||t||`${e.entityLogicalName}id`),i.setAttribute("select","1"),i.setAttribute("icon","1"),i.setAttribute("preview","1");let o=n.createElement("row");o.setAttribute("name","result"),o.setAttribute("id",t||`${e.entityLogicalName}id`),i.appendChild(o);for(let s of a){let l=n.createElement("cell");l.setAttribute("name",s.name),l.setAttribute("width",String(s.width)),o.appendChild(l)}return new XMLSerializer().serializeToString(n)}function pq(){return{adapter:new Hs,api:K3.viewApi}}bi.viewRegistration=pq});function F2(e,t=0){return(Be[e[t+0]]+Be[e[t+1]]+Be[e[t+2]]+Be[e[t+3]]+"-"+Be[e[t+4]]+Be[e[t+5]]+"-"+Be[e[t+6]]+Be[e[t+7]]+"-"+Be[e[t+8]]+Be[e[t+9]]+"-"+Be[e[t+10]]+Be[e[t+11]]+Be[e[t+12]]+Be[e[t+13]]+Be[e[t+14]]+Be[e[t+15]]).toLowerCase()}var Be,T2=D(()=>{Be=[];for(let e=0;e<256;++e)Be.push((e+256).toString(16).slice(1))});function Xd(){return Js>Qs.length-16&&((0,R2.randomFillSync)(Qs),Js=0),Qs.slice(Js,Js+=16)}var R2,Qs,Js,x2=D(()=>{R2=require("crypto"),Qs=new Uint8Array(256),Js=Qs.length});var L2,Kd,M2=D(()=>{L2=require("crypto"),Kd={randomUUID:L2.randomUUID}});function fq(e,t,r){if(Kd.randomUUID&&!t&&!e)return Kd.randomUUID();e=e||{};let n=e.random??e.rng?.()??Xd();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return F2(n)}var gt,U2=D(()=>{M2();x2();T2();gt=fq});var Yd=D(()=>{U2()});var B2=m(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.WorkflowConditionOperator=St.WorkflowAttributeType=St.SystemStep=St.FieldRequiredLevelTypes=St.AttributeDateTimeBehavior=void 0;St.AttributeDateTimeBehavior={None:0,Dynamic:1,DateOnly:2,StaticTimeZoneInvariant:3,UserLocal:4};St.FieldRequiredLevelTypes={None:"0",Required:"1",Recommended:"2"};St.SystemStep={IdentifyContact:"IdentifyContact",IdentifyAccount:"IdentifyAccount",IdentifyCustomer:"IdentifyCustomer",IdentifyCase:"IdentifyCase",Solution:"Solution",Resolve:"Resolve"};St.WorkflowAttributeType={Boolean:"0",Customer:"1",DateTime:"2",Decimal:"3",Float:"4",Integer:"5",Lookup:"6",Money:"7",Owner:"8",PartyList:"9",Picklist:"10",Key:"11",State:"12",Status:"13",String:"14",UniqueIdentifier:"15",EntityNameReference:"16",Entity:"17",EntityCollection:"18",BpfProcess:"19",BpfStageCategory:"20",BpfStage:"21",EntityReferenceCollection:"22",MultiSelectPicklist:"23",BigType:"24"};St.WorkflowConditionOperator={IsNull:"0",NotNull:"1",LogicalAnd:"2",LogicalOr:"3",IN:"4",NotIn:"5",NotInNull:"51",Equal:"6",NotEqual:"7",Contains:"8",DoesNotContain:"9",BeginsWith:"10",DoesNotBeginWith:"11",EndsWith:"12",DoesNotEndWith:"13",GreaterThan:"14",GreaterThanOrEqual:"15",LessThan:"16",LessThanOrEqual:"17",EqualUserId:"18",NotEqualUserId:"19",On:"20",NotOn:"21",OnOrAfter:"22",OnOrBefore:"23",Yesterday:"24",Today:"25",Tomorrow:"26",NextSevenDays:"27",LastSevenDays:"28",NextWeek:"29",LastWeek:"30",ThisWeek:"31",NextMonth:"32",LastMonth:"33",ThisMonth:"34",NextYear:"35",LastYear:"36",ThisYear:"37",Anytime:"38",LastXHours:"39",NextXHours:"40",LastXDays:"41",NextXDays:"42",LastXWeeks:"43",NextXWeeks:"44",LastXMonths:"45",NextXMonths:"46",LastXYears:"47",NextXYears:"48",Under:"49",NotUnder:"50"}});var Y2={};Bt(Y2,{deserializeWorkflowJson:()=>Dq,serializeToWorkflowJson:()=>Eq});function k2(e){return e.__class==="BinaryExpression:#Microsoft.Crm.Workflow.Expressions"}function mq(e){return e.__class==="ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel"}function Ha(){return{list:[]}}function W2(e){return{__class:"PrimaryEntity:#Microsoft.Crm.Workflow.Expressions",parameterName:"primaryEntity",entityName:e}}function tp(e,t,r){return{__class:"EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,entity:W2(t),attributeName:e}}function np(e,t){return{__class:"PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",type:t,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function hq(){return np("true",z.WorkflowAttributeType.Boolean)}function q2(e,t){let r=z.WorkflowAttributeType.String,n=ep[e.operator]??z.WorkflowConditionOperator.Equal,i=tp(e.field,t,r),a;return e.operator==="ContainsData"||e.operator==="DoesNotContainData"?a=[]:e.valueType==="Field"&&e.valueField?a=[tp(e.valueField,t,r)]:a=[np(e.value??"",r)],{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function gq(e,t,r){if(e.length===0)return null;if(e.length===1)return q2(e[0],r);let n=t==="AND"?z.WorkflowConditionOperator.LogicalAnd:z.WorkflowConditionOperator.LogicalOr,[i,...a]=e.map(o=>q2(o,r));return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:z.WorkflowAttributeType.String,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function rp(e){return e?e.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions"?{valueType:"Field",valueField:e.attributeName}:e.__class==="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions"?{valueType:"Value",value:e.primitiveValue!=null?String(e.primitiveValue):""}:{valueType:"Value",value:""}:{valueType:"Value",value:""}}function Zd(e){let t=z2[e.conditionOperatoroperator]??"Equals",r=e.left.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions"?e.left.attributeName:"",i=t==="ContainsData"||t==="DoesNotContainData"?{valueType:"Value"}:rp(e.right[0]);return{id:gt(),field:r,fieldDisplayName:r,operator:t,...i}}function j2(e){if(!e||e.__class!=="BinaryExpression:#Microsoft.Crm.Workflow.Expressions")return{clauses:[],logic:"AND"};let t=e.conditionOperatoroperator;if(t===z.WorkflowConditionOperator.LogicalAnd||t===z.WorkflowConditionOperator.LogicalOr){let r=t===z.WorkflowConditionOperator.LogicalAnd?"AND":"OR";return{clauses:[...k2(e.left)?[Zd(e.left)]:[],...e.right.filter(k2).map(Zd)],logic:r}}return{clauses:[Zd(e)],logic:"AND"}}function $2(e,t,r,n){return e==="Field"&&r?tp(r,n,z.WorkflowAttributeType.String):np(t??"",z.WorkflowAttributeType.String)}function V2(e,t){return{propertyName:e,propertyValueExpr:t}}function yi(e){return`Step_${e.value++}`}function Dt(e,t){let r=(t.counts[e]??0)+1,n=`${e}${r}`;for(;t.used.has(n);)r+=1,n=`${e}${r}`;return t.counts[e]=r,t.used.add(n),n}function vq(e,t,r){return e&&!r.used.has(e)?(r.used.add(e),e):Dt(t,r)}function bq(e,t,r){return{__class:"ActionStep:#Microsoft.Crm.Workflow.ObjectModel",id:Dt("ActionStep",r),name:yi(t),description:"Action step",stepLabels:{list:[{labelId:gt(),languageCode:1033,description:e}]},steps:{list:[]},actionId:null,actionType:"4",processId:gt(),uniqueName:`id_${gt().replace(/-/g,"")}ActionStep`}}function yq(e,t,r,n){let i=W2(t),a=e.stepName??yi(r),o=e.stepLabels??Ha(),s={name:a,stepLabels:o,description:e.displayName},l=e.type;switch(l){case"SetFieldValue":return{...s,id:Dt("SetAttributeValueStep",n),__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:i,specification:V2(e.field,$2(e.valueType,e.value,e.valueField,t))};case"SetDefaultValue":return{...s,id:Dt("SetDefaultValueStep",n),__class:"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:i,specification:V2(e.field,$2(e.valueType,e.value,e.valueField,t))};case"LockUnlock":return{...s,id:Dt("SetDisplayModeStep",n),__class:"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:e.field,controlType:"attribute",isReadOnly:e.lock,entity:i};case"SetBusinessRequired":return{...s,id:Dt("SetFieldRequiredLevelStep",n),__class:"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:e.field,controlType:"attribute",requiredLevel:e.required?z.FieldRequiredLevelTypes.Required:z.FieldRequiredLevelTypes.None,entity:i};case"SetVisibility":return{...s,id:Dt("SetVisibilityStep",n),__class:"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:e.field,controlType:"attribute",isVisible:e.visible,entity:i};case"ShowErrorMessage":return{...s,id:Dt("SetMessageStep",n),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",name:e.errorMessage||e.displayName,controlId:e.field,entity:i,level:e.messageLevel??"error",actionSteps:e.messageActionSteps??{list:[]}};case"Recommendation":{let u=e.messageText||e.recommendationTitle||e.displayName,c=e.stepLabels&&e.stepLabels.list.length>0?e.stepLabels:{list:[{labelId:gt(),languageCode:1033,description:u}]},d=e.recommendationActionSteps,f=d&&d.list.length>0?d:{list:[bq(u,r,n)]};return{...s,id:Dt("SetMessageStep",n),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:c,description:e.recommendationTitle||e.displayName,controlId:e.field,entity:i,level:"RECOMMENDATION",actionSteps:f}}default:throw new Error(`Unsupported action type: ${l}`)}}function Cq(e){switch(e.__class){case"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let t=rp(e.specification.propertyValueExpr);return{kind:"action",id:e.id,type:"SetFieldValue",displayName:e.description||e.name||"Set Field Value",stepName:e.name,stepLabels:e.stepLabels,field:e.specification.propertyName,...t}}case"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let t=rp(e.specification.propertyValueExpr);return{kind:"action",id:e.id,type:"SetDefaultValue",displayName:e.description||e.name||"Set Default Value",stepName:e.name,stepLabels:e.stepLabels,field:e.specification.propertyName,...t}}case"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:e.id,type:"LockUnlock",displayName:e.description||e.name||"Lock/Unlock",stepName:e.name,stepLabels:e.stepLabels,field:e.controlId,lock:e.isReadOnly};case"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:e.id,type:"SetBusinessRequired",displayName:e.description||e.name||"Set Business Required",stepName:e.name,stepLabels:e.stepLabels,field:e.controlId,required:e.requiredLevel!==z.FieldRequiredLevelTypes.None};case"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:e.id,type:"SetVisibility",displayName:e.description||e.name||"Set Visibility",stepName:e.name,stepLabels:e.stepLabels,field:e.controlId,visible:e.isVisible};case"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel":{let t=e.stepLabels?.list,r=t&&t.length>0?t[0].description??"":"";return(e.level??"").toUpperCase()==="RECOMMENDATION"?{kind:"action",id:e.id,type:"Recommendation",displayName:e.description||"Recommendation",stepName:e.name,stepLabels:e.stepLabels,field:e.controlId,recommendationTitle:e.description||"",messageText:r,recommendationActionSteps:e.actionSteps}:{kind:"action",id:e.id,type:"ShowErrorMessage",displayName:e.description||"Show Error Message",stepName:e.name,stepLabels:e.stepLabels,field:e.controlId,errorMessage:r||e.name||"",messageLevel:e.level??void 0,messageActionSteps:e.actionSteps}}case"ActionStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:e.id,type:"Recommendation",displayName:e.name||"Recommendation",stepName:e.name,stepLabels:e.stepLabels,field:e.actionControl?.controlId??"",recommendationTitle:e.name||"",messageText:e.description||""};default:return null}}function H2(e,t,r,n){let i=e.stepName??yi(r),a=Dt("ConditionStep",n),o=[],s=e,l=!0;for(;s;){let u=gq(s.clauses,s.logic,t),c=l?s.branchName??yi(r):yi(r),f={__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:l?vq(s.branchId,"ConditionBranchStep",n):Dt("ConditionBranchStep",n),name:c,description:s.displayName,stepLabels:Ha(),conditionExpression:u??void 0,steps:{list:s.trueBranch.map(b=>J2(b,t,r,n))}};o.push(f);let g=s.falseBranch;if(g.length===1&&g[0].kind==="condition"){s=g[0],l=!1;continue}g.length>0&&o.push(Aq(g,t,r,n)),s=void 0}return{__class:"ConditionStep:#Microsoft.Crm.Workflow.ObjectModel",id:a,name:i,description:"",stepLabels:Ha(),containsElsebranch:o.length>1,steps:{list:o}}}function Aq(e,t,r,n){return{__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:Dt("ConditionBranchStep",n),name:yi(r),description:null,stepLabels:Ha(),conditionExpression:hq(),steps:{list:e.map(i=>J2(i,t,r,n))}}}function J2(e,t,r,n){return e.kind==="condition"?H2(e,t,r,n):yq(e,t,r,n)}function Q2(e){let t=(e.steps?.list??[]).filter(mq);return X2(t,e,!0)}function X2(e,t,r){let[n,...i]=e,{clauses:a,logic:o}=j2(n?.conditionExpression),s=K2(n?.steps?.list??[]),l=wq(i,t),u=n?.description||n?.name||t.description||t.name||"Condition";return{kind:"condition",id:(r?t.id:n?.id)??gt(),displayName:u,clauses:a,logic:o,trueBranch:s,falseBranch:l,isCollapsed:!1,stepName:r?t.name:void 0,branchId:r?n?.id:void 0,branchName:r?n?.name:void 0}}function wq(e,t){if(e.length===0)return[];let[r]=e,{clauses:n}=j2(r.conditionExpression);return n.length===0?K2(r.steps?.list??[]):[X2(e,t,!1)]}function K2(e){return e.map(t=>t.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel"?Q2(t):Cq(t)).filter(t=>t!==null)}function Nq(e){return e===G2.StateCode.Activated?"Active":"Draft"}function Sq(e,t){let r=e.processtriggerscope,n=e.processtriggerformid;return r===1&&n?n:r===2?"Entity":t??"Entity"}function Dq(e){let t=e,r=null,n;if(e.wfomJson)try{let i=JSON.parse(e.wfomJson);n={id:i.id==="WorkflowStep0"||!i.id?e.workflowid??gt():i.id,name:i.name,description:i.description,nextStepIndex:i.nextStepIndex,category:i.category==="0"||i.category===0?"2":i.category,businessProcessType:i.businessProcessType,mode:i.mode,title:i.title||e.name||"",primaryEntityName:i.primaryEntityName==="1"||!i.primaryEntityName?e.primaryentity??"":i.primaryEntityName,workflowEntityId:i.workflowEntityId==="00000000-0000-0000-0000-000000000000"||!i.workflowEntityId?e.workflowid??"":i.workflowEntityId,formId:i.formId,variables:i.variables,inputs:i.inputs};let o=(i.steps?.list??[]).find(s=>s.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel");o&&(r=Q2(o))}catch{}return{ruleId:e.workflowid??null,name:e.name??"",description:e.description??"",entityLogicalName:e.primaryentity??"",scope:Sq(t,n?.formId),status:Nq(e.statecode),rootCondition:r,wfomRoot:n}}function Eq(e){let t=e.entityLogicalName,r=e.wfomRoot,n={value:r?Number(r.nextStepIndex):1},i={counts:{},used:new Set},a=e.scope!=="Entity"&&e.scope!=="AllForms"?e.scope:null,o=e.rootCondition?[H2(e.rootCondition,t,n,i)]:[],s={__class:"WorkflowStep:#Microsoft.Crm.Workflow.ObjectModel",id:r?.id??e.ruleId??gt(),name:r?.name??"Step_0",description:r!==void 0?r.description:e.description||null,stepLabels:Ha(),argumentsArray:[],primaryEntityName:r?.primaryEntityName??t,nextStepIndex:String(n.value),isCrmUIWorkflow:!0,category:r?.category??"2",businessProcessType:r?.businessProcessType??"0",mode:r?.mode??"0",title:r?.title??e.name,formId:a,workflowEntityId:r?.workflowEntityId??e.ruleId??"",variables:r?.variables??[],inputs:r?.inputs??[],steps:{list:o}};return JSON.stringify(s)}var G2,z,ep,z2,Z2=D(()=>{"use strict";Yd();G2=ne(ha()),z=ne(B2());ep={Equals:z.WorkflowConditionOperator.Equal,DoesNotEqual:z.WorkflowConditionOperator.NotEqual,IsGreaterThan:z.WorkflowConditionOperator.GreaterThan,IsLessThan:z.WorkflowConditionOperator.LessThan,IsGreaterThanEqualTo:z.WorkflowConditionOperator.GreaterThanOrEqual,IsLessThanEqualTo:z.WorkflowConditionOperator.LessThanOrEqual,Contains:z.WorkflowConditionOperator.Contains,DoesNotContain:z.WorkflowConditionOperator.DoesNotContain,BeginsWith:z.WorkflowConditionOperator.BeginsWith,DoesNotBeginWith:z.WorkflowConditionOperator.DoesNotBeginWith,EndsWith:z.WorkflowConditionOperator.EndsWith,DoesNotEndWith:z.WorkflowConditionOperator.DoesNotEndWith,On:z.WorkflowConditionOperator.On,NotOn:z.WorkflowConditionOperator.NotOn,ContainsData:z.WorkflowConditionOperator.NotNull,DoesNotContainData:z.WorkflowConditionOperator.IsNull},z2={};for(let e of Object.keys(ep))z2[ep[e]]=e});function ip(e){return!Iq.has(e)}function eN(e){return _q.has(e)?"string":e==="Money"?"money":e==="Integer"||e==="BigInt"?"integer":e==="Decimal"||e==="Double"?"decimal":Pq.has(e)?"date":Oq.has(e)?"boolean":"other"}function tN(e,t){let r=eN(e),n=eN(t);return r==="other"||n==="other"?e===t:r===n}var Iq,_q,Pq,Oq,rN=D(()=>{"use strict";Iq=new Set(["ContainsData","DoesNotContainData"]);_q=new Set(["String","Memo","EntityName"]),Pq=new Set(["DateTime"]),Oq=new Set(["Boolean"])});var dN={};Bt(dN,{addElseIfInTree:()=>xq,appendToBranch:()=>Tq,buildBreadcrumb:()=>$q,collectUsedFields:()=>kq,createEmptyAction:()=>Bq,createEmptyCondition:()=>lN,findNode:()=>aN,findParent:()=>Ci,getBranchPosition:()=>Uq,hasAnyTriggerGeneratingAction:()=>sp,isTriggerGeneratingAction:()=>iN,moveBranchItemInTree:()=>Mq,removeElseIfInTree:()=>Lq,removeNodeFromTree:()=>oN,updateActionInTree:()=>ap,updateConditionInTree:()=>yn,validateTree:()=>qq});function iN(e){return Fq.has(e.type)}function sp(e){if(!e)return!1;for(let t of[...e.trueBranch,...e.falseBranch])if(t.kind==="action"){if(iN(t))return!0}else if(sp(t))return!0;return!1}function aN(e,t){if(e.id===t)return e;for(let r of[...e.trueBranch,...e.falseBranch]){if(r.id===t)return r;if(r.kind==="condition"){let n=aN(r,t);if(n)return n}}return null}function Ci(e,t){for(let r=0;r<e.trueBranch.length;r++){let n=e.trueBranch[r];if(n.id===t)return{node:e,branch:"true",index:r};if(n.kind==="condition"){let i=Ci(n,t);if(i)return i}}for(let r=0;r<e.falseBranch.length;r++){let n=e.falseBranch[r];if(n.id===t)return{node:e,branch:"false",index:r};if(n.kind==="condition"){let i=Ci(n,t);if(i)return i}}return null}function oN(e,t){return{...e,trueBranch:nN(e.trueBranch,t),falseBranch:nN(e.falseBranch,t)}}function nN(e,t){return e.filter(r=>r.id!==t).map(r=>r.kind==="condition"?oN(r,t):r)}function yn(e,t,r){return e.id===t?r(e):{...e,trueBranch:e.trueBranch.map(n=>n.kind==="condition"?yn(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="condition"?yn(n,t,r):n)}}function ap(e,t,r){return{...e,trueBranch:e.trueBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?ap(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?ap(n,t,r):n)}}function Tq(e,t,r,n){return yn(e,t,i=>({...i,trueBranch:r==="true"?[...i.trueBranch,n]:i.trueBranch,falseBranch:r==="false"?[...i.falseBranch,n]:i.falseBranch}))}function Rq(e){return e.length===1&&e[0].kind==="condition"}function xq(e,t){return yn(e,t,r=>sN(r))}function sN(e){if(Rq(e.falseBranch))return{...e,falseBranch:[sN(e.falseBranch[0])]};let t=lN();return t.falseBranch=e.falseBranch,{...e,falseBranch:[t]}}function Lq(e,t){let r=Ci(e,t);if(!r||r.branch!=="false")return e;let n=r.node.falseBranch[r.index];if(!n||n.kind!=="condition")return e;let i=n.falseBranch;return yn(e,r.node.id,a=>({...a,falseBranch:i}))}function Mq(e,t,r){let n=Ci(e,t);if(!n)return e;let i=a=>{let o=[...a],s=o[n.index+r];return s?(o[n.index+r]=o[n.index],o[n.index]=s,o):a};return yn(e,n.node.id,a=>({...a,trueBranch:n.branch==="true"?i(a.trueBranch):a.trueBranch,falseBranch:n.branch==="false"?i(a.falseBranch):a.falseBranch}))}function Uq(e,t){let r=Ci(e,t);if(!r)return null;let n=r.branch==="true"?r.node.trueBranch:r.node.falseBranch;return{isFirst:r.index===0,isLast:r.index===n.length-1}}function lN(){return{kind:"condition",id:gt(),displayName:"New Condition",clauses:[],logic:"AND",trueBranch:[],falseBranch:[],isCollapsed:!1}}function Bq(e){let t={kind:"action",id:gt(),type:e,displayName:`New ${e}`};switch(e){case"Recommendation":return{...t,type:"Recommendation",field:"",recommendationTitle:"",messageText:""};case"LockUnlock":return{...t,type:"LockUnlock",field:"",lock:!0};case"ShowErrorMessage":return{...t,type:"ShowErrorMessage",field:"",errorMessage:""};case"SetFieldValue":return{...t,type:"SetFieldValue",field:"",valueType:"Value",value:""};case"SetDefaultValue":return{...t,type:"SetDefaultValue",field:"",valueType:"Value",value:""};case"SetBusinessRequired":return{...t,type:"SetBusinessRequired",field:"",required:!0};case"SetVisibility":return{...t,type:"SetVisibility",field:"",visible:!0};default:return{...t,type:"SetFieldValue",field:"",valueType:"Value",value:""}}}function kq(e){if(!e)return[];let t=[];return uN(e,t),[...new Set(t)]}function uN(e,t){e.clauses.forEach(r=>{r.field&&t.push(r.field)}),[...e.trueBranch,...e.falseBranch].forEach(r=>{r.kind==="condition"?uN(r,t):"field"in r&&r.field&&t.push(r.field)})}function qq(e,t=[]){if(!e)return[{nodeId:"root",kind:"NO_CONDITION",message:"A business rule must include at least one condition."}];let r=[],n=new Map(t.map(i=>[i.logicalName,i]));return cN(e,r,n),sp(e)||r.push({nodeId:"root",kind:"NO_ACTION",message:"A business rule must include at least one action step."}),r}function cN(e,t,r){e.clauses.length===0&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Add at least one clause to this condition."}),e.clauses.forEach(n=>{if(!n.field)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Please select a field for this clause."});else if(ip(n.operator)&&n.valueType==="Value"&&!n.value)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please enter a value for this clause."});else if(ip(n.operator)&&n.valueType==="Value"&&n.value){let i=r.get(n.field);i?.maxLength&&n.value.length>i.maxLength&&t.push({nodeId:e.id,kind:"CLAUSE_VALUE_TOO_LONG",message:`Value exceeds the field's maximum length of ${i.maxLength} characters.`})}}),[...e.trueBranch,...e.falseBranch].forEach(n=>{if(n.kind==="condition")cN(n,t,r);else if(!("field"in n)||!n.field)t.push({nodeId:n.id,kind:"EMPTY_ACTION_FIELD",message:`${n.type}: a target field is required.`});else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Value"&&n.value){let i=r.get(n.field);i?.maxLength&&n.value.length>i.maxLength&&t.push({nodeId:n.id,kind:"ACTION_VALUE_TOO_LONG",message:`${n.type}: value exceeds the field's maximum length of ${i.maxLength} characters.`})}else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Field"){if(!n.valueField)t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please select a field to copy from.`});else if(r.size>0){let i=r.get(n.field),a=r.get(n.valueField);i&&a&&!tN(i.attributeType,a.attributeType)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: the source field's type is not compatible with the target field.`})}}})}function $q(e,t){let r=[];return op(e,t,r),r}function op(e,t,r){if(e.id===t)return r.push({conditionId:e.id,label:e.displayName}),!0;for(let n of e.trueBranch)if(n.kind==="condition"){if(r.push({conditionId:e.id,label:e.displayName}),op(n,t,r))return!0;r.pop()}for(let n of e.falseBranch)if(n.kind==="condition"){if(r.push({conditionId:e.id,label:e.displayName}),op(n,t,r))return!0;r.pop()}return!1}var Fq,pN=D(()=>{"use strict";Yd();rN();Fq=new Set(["LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"])});var hN=m(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.businessRuleApi=void 0;var Xs=ha(),Yt=$e(),Ai=ue(),fN="00000000-0000-0000-0000-000000000000",Ks={"Content-Type":"application/json",Accept:"application/json"},Vq="workflowid,name,description,primaryentity,statecode,category,type",Gq="category eq 2 and type eq 1";async function mN(e,t,r){if(r==="Draft")return;let n=(0,Ai.normalizeGuid)(t,"workflowid"),i=r==="Active",a={statecode:i?Xs.StateCode.Activated:Xs.StateCode.Draft,statuscode:i?Xs.StatusCode.Activated:Xs.StatusCode.Draft},o=`/workflows(${n})`;(0,Yt.ensureSuccess)(await e.patch(o,a,{headers:Ks}),e.apiUrl(o))}Ys.businessRuleApi={async get(e,t){let n=`/workflows(${(0,Ai.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveProcessWithWfomJson`,i=(0,Yt.ensureSuccess)(await e.post(n,{},{headers:Ks}),e.apiUrl(n));return{raw:i.body,etag:(0,Yt.readEtag)(i)}},async list(e,t){var r;let n=[Gq];t?.entityLogicalName&&n.push(`primaryentity eq '${(0,Ai.odataLiteral)(t.entityLogicalName)}'`);let i=`/workflows${(0,Ai.odataQuery)([["$select",Vq],["$filter",n.join(" and ")]])}`,o=(0,Yt.ensureSuccess)(await e.get(i),e.apiUrl(i)).body;return((r=o?.value)!==null&&r!==void 0?r:[]).map(l=>{var u,c;return{type:"businessRule",id:(u=l.workflowid)!==null&&u!==void 0?u:"",name:(c=l.name)!==null&&c!==void 0?c:"",entityLogicalName:l.primaryentity,isDirty:!1}})},async create(e,t){let r=t,n=`/workflows(${fN})/Microsoft.Dynamics.CRM.CreateProcessWithWfomJson`,i=(0,Yt.ensureSuccess)(await e.post(n,r,{headers:Ks}),e.apiUrl(n)),a=(0,Ai.normalizeGuid)(r.Entity.workflowid,"workflowid");try{await mN(e,a,r.status)}catch(o){try{await(0,Yt.deleteRecord)(e,"workflows",a)}catch{}throw o}return{id:a,etag:(0,Yt.readEtag)(i)}},async update(e,t,r,n){let i=r,a=(0,Ai.normalizeGuid)(t,"id"),o=`/workflows(${fN})/Microsoft.Dynamics.CRM.UpdateProcessWithWfomJson`,s={...Ks};n&&(s["If-Match"]=n);let l=(0,Yt.ensureSuccess)(await e.post(o,i,{headers:s}),e.apiUrl(o));return await mN(e,a,i.status),{id:a,etag:(0,Yt.readEtag)(l)}},delete(e,t){return(0,Yt.deleteRecord)(e,"workflows",t)}}});var yN=m(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.BUSINESS_RULE_NULL_GUID=zr.businessRuleRegistration=zr.BusinessRuleAdapter=void 0;var gN=wu(),lp=ha(),vN=(Z2(),kt(Y2)),zq=(pN(),kt(dN)),Ja=$r(),Wq=hN(),jq=Ft(),Hq="00000000-0000-0000-0000-000000000000";zr.BUSINESS_RULE_NULL_GUID=Hq;var Jq=new Set(["Recommendation","LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]),Qq=["ruleId","name","description","entityLogicalName","scope","status","rootCondition"],Xq=["kind","id","displayName","logic","clauses","trueBranch","falseBranch"],Zs=class{toArtifact(t){let r=this.residualBag(t,Qq),n={id:t.ruleId,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:t.rootCondition?this.conditionToJson(t.rootCondition):null};return r&&(n.bag=r),n}fromArtifact(t){var r;let n=t.rootCondition?this.conditionFromJson(t.rootCondition):null;return{...(r=t.bag)!==null&&r!==void 0?r:{},ruleId:t.id,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:n}}fromApiResponse(t){var r;let n=t??{},i={...(r=n.Entity)!==null&&r!==void 0?r:{},wfomJson:n.WfomJson},a=(0,vN.deserializeWorkflowJson)(i);return this.toArtifact(a)}toApiPayload(t){var r;let n=this.fromArtifact(t);n.wfomRoot&&(n.wfomRoot={...n.wfomRoot,name:t.name,title:t.name,primaryEntityName:t.entityLogicalName||n.wfomRoot.primaryEntityName});let i=(0,vN.serializeToWorkflowJson)(n),a=(r=n.ruleId)!==null&&r!==void 0?r:(0,gN.v4)();return{Entity:this.buildWorkflowEntity(n,a),WfomJson:i,status:t.status}}createDefault(t){var r,n,i,a,o,s;let l={ruleId:(r=t.id)!==null&&r!==void 0?r:null,name:(n=t.name)!==null&&n!==void 0?n:"New business rule",description:(i=t.description)!==null&&i!==void 0?i:"",entityLogicalName:(a=t.entityLogicalName)!==null&&a!==void 0?a:"",scope:(o=t.scope)!==null&&o!==void 0?o:"Entity",status:(s=t.status)!==null&&s!==void 0?s:"Draft",rootCondition:(0,zq.createEmptyCondition)()},u=this.toArtifact(l);return u.id||(u.id=(0,gN.v4)()),u}assignMissingIds(t){return(0,jq.assignMissingIds)(t)}validate(t){let r=[],n=t.rootCondition;return n==null?r:(0,Ja.isJsonObject)(n)?(bN(n,"/rootCondition",r),r):(r.push((0,Ja.issue)("/rootCondition","condition-must-be-object",`rootCondition must be a JSON object or null, got ${typeof n}`)),r)}residualBag(t,r){let n=new Set(r),i={};for(let a of Object.keys(t)){if(n.has(a))continue;let o=t[a];o!==void 0&&(i[a]=o)}return Object.keys(i).length>0?i:void 0}buildWorkflowEntity(t,r){let n=t.scope!=="Entity"&&t.scope!=="AllForms";return{"@odata.type":"#Microsoft.Dynamics.CRM.workflow",name:t.name,description:t.description,workflowid:r,ondemand:!1,subprocess:!1,triggeroncreate:!1,triggerondelete:!1,category:lp.WorkflowCategory.BusinessRule,type:lp.WorkflowTypeCode.Definition,mode:1,scope:lp.WorkflowScope.Organization,primaryentity:t.entityLogicalName,iscrmuiworkflow:!0,processtriggerscope:n?1:2,...n?{processtriggerformid:t.scope}:{}}}conditionToJson(t){let r=this.residualBag(t,Xq),n={id:t.id,displayName:t.displayName,logic:t.logic,clauses:t.clauses.map(i=>this.clauseToJson(i)),trueBranch:t.trueBranch.map(i=>this.branchItemToJson(i)),falseBranch:t.falseBranch.map(i=>this.branchItemToJson(i))};return r&&(n.bag=r),n}clauseToJson(t){return{id:t.id,field:t.field,fieldDisplayName:t.fieldDisplayName,operator:t.operator,valueType:t.valueType,...t.value!==void 0?{value:t.value}:{},...t.valueField!==void 0?{valueField:t.valueField}:{}}}branchItemToJson(t){return t.kind==="condition"?this.conditionToJson(t):this.actionToJson(t)}actionToJson(t){return{...t}}conditionFromJson(t){var r;return{kind:"condition",isCollapsed:!1,...(r=t.bag)!==null&&r!==void 0?r:{},id:t.id,displayName:t.displayName,logic:t.logic,clauses:t.clauses.map(i=>this.clauseFromJson(i)),trueBranch:t.trueBranch.map(i=>this.branchItemFromJson(i)),falseBranch:t.falseBranch.map(i=>this.branchItemFromJson(i))}}clauseFromJson(t){var r;return{id:t.id,field:t.field,fieldDisplayName:(r=t.fieldDisplayName)!==null&&r!==void 0?r:t.field,operator:t.operator,valueType:t.valueType,...t.value!==void 0?{value:t.value}:{},...t.valueField!==void 0?{valueField:t.valueField}:{}}}branchItemFromJson(t){return this.isConditionJson(t)?this.conditionFromJson(t):this.actionFromJson(t)}actionFromJson(t){if(!Jq.has(t.type))throw new Error(`Unsupported business-rule action type: ${t.type}`);return{...t,kind:"action",type:t.type}}isConditionJson(t){return Object.prototype.hasOwnProperty.call(t,"clauses")&&Object.prototype.hasOwnProperty.call(t,"logic")&&!Object.prototype.hasOwnProperty.call(t,"type")}};zr.BusinessRuleAdapter=Zs;function bN(e,t,r){(0,Ja.optionalEnum)(e,"logic",["AND","OR"],t,"condition-logic-invalid",r),(0,Ja.childObjects)(e,"clauses",t,"clause",r);for(let n of["trueBranch","falseBranch"])(0,Ja.childObjects)(e,n,t,"branchItem",r).forEach(({node:a,index:o})=>{("clauses"in a||"trueBranch"in a||"falseBranch"in a)&&bN(a,`${t}/${n}/${o}`,r)})}function Kq(){return{adapter:new Zs,api:Wq.businessRuleApi}}zr.businessRuleRegistration=Kq});var EN=m(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.appRegistration=Ni.AppAdapter=void 0;var wi=$r(),Le=pn(),Xa=ja(),Yq=_u(),up=fn(),Zq=Ft(),fp="1033",rl="7.0.0.0",CN=`<SiteMap IntroducedVersion="${rl}"></SiteMap>`,e$="/_imgs/imagestrips/transparent_spacer.gif",t$="/_imgs/TableIconsFluentV9/document_one_page_sparkle.svg",r$=["Entity","Url","DefaultDashboard","Page","GenPageId"],Qa="sitemapId",AN="sitemapName",n$="sitemapNameUnique",nl=class{toArtifact(t){let{bag:r,modeledEls:n}=el(t,"Area");return{id:"",name:"",uniqueName:"",description:"",siteMap:{areas:n.map(i=>this.areaToJson(i)),bag:r},bag:(0,Le.emptyBag)()}}fromArtifact(t){(0,up.installDomShim)();let r=this.assignMissingIds(JSON.parse(JSON.stringify(t))),n=new DOMParser().parseFromString("<root/>","text/xml"),i=this.rootToRaw(r);return(0,Le.rebuildRaw)(i,(0,Xa.domEngine)(n),null)}fromApiResponse(t){var r,n,i,a,o,s,l,u,c,d;(0,up.installDomShim)();let f=t??{},g=(r=f.$sitemap)!==null&&r!==void 0?r:f,b=(0,Xa.parseXmlRoot)((n=g.sitemapxml)!==null&&n!==void 0?n:CN,CN),w=this.toArtifact(b);return w.id=(i=f.appmoduleid)!==null&&i!==void 0?i:"",w.name=(a=f.name)!==null&&a!==void 0?a:"",w.uniqueName=(o=f.uniquename)!==null&&o!==void 0?o:"",w.description=(s=f.description)!==null&&s!==void 0?s:"",w.bag={a:[[Qa,(u=(l=g.sitemapid)!==null&&l!==void 0?l:f._sitemapid_value)!==null&&u!==void 0?u:""],[AN,(c=g.sitemapname)!==null&&c!==void 0?c:""],[n$,(d=g.sitemapnameunique)!==null&&d!==void 0?d:""]],c:[]},w}toApiPayload(t){var r,n,i,a,o,s,l,u,c,d,f,g,b,w;(0,up.installDomShim)();let N=(0,Xa.serializeNode)(this.fromArtifact(t)),_=[],T=[];for(let M of(n=(r=t.siteMap)===null||r===void 0?void 0:r.areas)!==null&&n!==void 0?n:[])for(let W of(i=M.groups)!==null&&i!==void 0?i:[])for(let B of(a=W.subAreas)!==null&&a!==void 0?a:[])B.type==="Entity"&&B.entity?_.push(B.entity):B.type==="DashBoard"&&B.dashboardId&&T.push(B.dashboardId);let R=(o=t.bag)!==null&&o!==void 0?o:(0,Le.emptyBag)();return{sitemapId:(s=NN(R,Qa))!==null&&s!==void 0?s:"",sitemapxml:N,sitemapname:NN(R,AN)||t.name,appModuleId:t.id,appModuleName:t.name,appModuleDescription:t.description,appModuleUniqueName:t.uniqueName,...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},entities:_,components:{forms:(u=(l=t.components)===null||l===void 0?void 0:l.forms)!==null&&u!==void 0?u:[],views:(d=(c=t.components)===null||c===void 0?void 0:c.views)!==null&&d!==void 0?d:[],charts:(g=(f=t.components)===null||f===void 0?void 0:f.charts)!==null&&g!==void 0?g:[],dashboards:[...(w=(b=t.components)===null||b===void 0?void 0:b.dashboards)!==null&&w!==void 0?w:[],...T]}}}createDefault(t){var r,n,i,a;let o=t.siteMap&&t.siteMap.areas.length>0?t.siteMap.areas:[{id:"",title:"Area",groups:[{id:"",title:"Group",subAreas:[]}]}];return{id:(r=t.id)!==null&&r!==void 0?r:(0,Zq.newId)(),name:(n=t.name)!==null&&n!==void 0?n:"New App",uniqueName:(i=t.uniqueName)!==null&&i!==void 0?i:"",description:(a=t.description)!==null&&a!==void 0?a:"",siteMap:{areas:o},...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},...t.components?{components:t.components}:{}}}assignMissingIds(t){let r=t;if(!r||typeof r!="object")return t;let n=r.siteMap;return n&&Array.isArray(n.areas)?n.areas.forEach(pp):Array.isArray(r.areas)?r.areas.forEach(pp):Array.isArray(r.groups)?pp(r):Array.isArray(r.subAreas)?DN(r):"type"in r&&il(r,"subarea"),t}validate(t){let r=[],n=t.siteMap;return n==null?r:(0,wi.isJsonObject)(n)?((0,wi.childObjects)(n,"areas","/siteMap","area",r).forEach(({node:a,index:o})=>{let s=`/siteMap/areas/${o}`;(0,wi.childObjects)(a,"groups",s,"group",r).forEach(({node:u,index:c})=>{let d=`${s}/groups/${c}`;(0,wi.childObjects)(u,"subAreas",d,"subArea",r).forEach(({node:g,index:b})=>{(0,wi.optionalEnum)(g,"type",["Entity","URL","DashBoard","CustomPage","GenPage"],`${d}/subAreas/${b}`,"subarea-type-invalid",r)})})}),r):(r.push((0,wi.issue)("/siteMap","sitemap-must-be-object",`siteMap must be a JSON object, got ${typeof n}`)),r)}applyServerIdentity(t,r){let n=r[Qa];if(!n)return;t.bag||(t.bag=(0,Le.emptyBag)());let i=t.bag.a.find(a=>a[0]===Qa);i?i[1]=n:t.bag.a.push([Qa,n])}areaToJson(t){var r;let{bag:n,modeledEls:i}=el(t,"Group"),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:cp(t),groups:i.map(l=>this.groupToJson(l)),bag:n},o=t.getAttribute("Icon");o&&(a.icon=o);let s=t.getAttribute("VectorIcon");return s&&(a.vectorIcon=s),a}groupToJson(t){var r;let{bag:n,modeledEls:i}=el(t,"SubArea");return{id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:cp(t),subAreas:i.map(a=>this.subAreaToJson(a)),bag:n}}subAreaToJson(t){var r;let{bag:n}=el(t,null),i=i$(t),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",type:i,title:cp(t),bag:n};if(i==="Entity"){let l=t.getAttribute("Entity");l&&(a.entity=l)}else if(i==="DashBoard"){let l=t.getAttribute("DefaultDashboard");l&&(a.dashboardId=l);let u=t.getAttribute("Url");u&&(a.dashboardUrl=u)}else if(i==="CustomPage"){let l=t.getAttribute("Page");l&&(a.page=l)}else if(i==="GenPage"){let l=t.getAttribute("GenPageId");l&&(a.genPageId=l)}else{let l=t.getAttribute("Url");l&&(a.url=l)}let o=t.getAttribute("Icon");o&&o!==e$&&(a.icon=o);let s=t.getAttribute("VectorIcon");return s&&(a.vectorIcon=s),a}rootToRaw(t){var r,n,i,a;let o=(n=(r=t.siteMap)===null||r===void 0?void 0:r.bag)!==null&&n!==void 0?n:(0,Le.emptyBag)(),l=tl(o)?[["IntroducedVersion",rl]]:[],u=((a=(i=t.siteMap)===null||i===void 0?void 0:i.areas)!==null&&a!==void 0?a:[]).map(c=>this.areaToRaw(c));return{n:"SiteMap",a:(0,Le.mergeAttrs)(o.a,l),c:(0,Le.spliceChildren)(o.c,u)}}areaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Le.emptyBag)(),i=tl(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ShowGroups","true"],["ResourceId","SitemapDesigner.NewTitle"],["DescriptionResourceId","SitemapDesigner.NewTitle"],["IntroducedVersion",rl]),t.icon!==void 0&&a.push(["Icon",t.icon]),t.vectorIcon!==void 0&&a.push(["VectorIcon",t.vectorIcon]);let o=t.groups.map(l=>this.groupToRaw(l)),s=dp((0,Le.spliceChildren)(n.c,o),t.title,i);return{n:"Area",a:(0,Le.mergeAttrs)(n.a,a),c:s}}groupToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Le.emptyBag)(),i=tl(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ResourceId","SitemapDesigner.NewGroup"],["DescriptionResourceId","SitemapDesigner.NewGroup"],["ToolTipResourseId","SitemapDesigner.Unknown"],["IntroducedVersion",rl],["IsProfile","false"]);let o=t.subAreas.map(l=>this.subAreaToRaw(l)),s=dp((0,Le.spliceChildren)(n.c,o),t.title,i);return{n:"Group",a:(0,Le.mergeAttrs)(n.a,a),c:s}}subAreaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Le.emptyBag)(),i=tl(n),a=o$(n.a,t.type),o=[];t.id&&o.push(["Id",t.id]),l$(o,t),i?(o.push(["ResourceId","SitemapDesigner.NewSubArea"],["Client","All,Outlook,OutlookLaptopClient,OutlookWorkstationClient,Web"],["Sku","All,OnPremise,Live,SPLA"],["AvailableOffline","true"],["PassParams","false"]),t.icon&&o.push(["Icon",t.icon])):t.icon!==void 0&&o.push(["Icon",t.icon]),t.vectorIcon!==void 0?o.push(["VectorIcon",t.vectorIcon]):t.type==="GenPage"&&!a$(a,"VectorIcon")&&o.push(["VectorIcon",t$]);let s=dp((0,Le.spliceChildren)(n.c,[]),t.title,i);return{n:"SubArea",a:(0,Le.mergeAttrs)(a,o),c:s}}};Ni.AppAdapter=nl;function el(e,t){let r=(0,Xa.nodeLikeFromDom)(e).getAllProperties().map(s=>[s.key,s.value]),n=[],i=[],a=e.childNodes,o=0;for(let s=0;s<a.length;s+=1){let l=a[s];l.nodeType!==1&&l.nodeType!==3||(l.nodeType===1&&t!==null&&l.tagName===t?i.push(l):n.push({i:o,node:(0,Le.rawFromNode)((0,Xa.nodeLikeFromDom)(l))}),o+=1)}return{bag:{a:r,c:n},modeledEls:i}}function wN(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName===t&&r.push(a)}return r}function cp(e){var t;let r=wN(e,"Titles")[0];if(!r)return"";let i=wN(r,"Title").find(a=>a.getAttribute("LCID")===fp);return i&&(t=i.getAttribute("Title"))!==null&&t!==void 0?t:""}function i$(e){return e.getAttribute("GenPageId")?"GenPage":e.getAttribute("Entity")?"Entity":e.getAttribute("Page")?"CustomPage":e.getAttribute("DefaultDashboard")?"DashBoard":"URL"}function tl(e){return e.a.length===0&&e.c.length===0}function a$(e,t){return e.some(([r])=>r===t)}function NN(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function o$(e,t){let r=s$(t);return e.filter(([n])=>!r$.includes(n)||r.has(n)).map(n=>[n[0],n[1]])}function s$(e){switch(e){case"Entity":return new Set(["Entity"]);case"URL":return new Set(["Url"]);case"DashBoard":return new Set(["DefaultDashboard","Url"]);case"CustomPage":return new Set(["Page"]);case"GenPage":return new Set(["GenPageId"]);default:return new Set}}function l$(e,t){var r,n,i,a,o;switch(t.type){case"Entity":e.push(["Entity",(r=t.entity)!==null&&r!==void 0?r:""]);break;case"URL":e.push(["Url",(n=t.url)!==null&&n!==void 0?n:""]);break;case"DashBoard":e.push(["DefaultDashboard",(i=t.dashboardId)!==null&&i!==void 0?i:""]),t.dashboardUrl!==void 0&&e.push(["Url",t.dashboardUrl]);break;case"CustomPage":e.push(["Page",(a=t.page)!==null&&a!==void 0?a:""]);break;case"GenPage":e.push(["GenPageId",(o=t.genPageId)!==null&&o!==void 0?o:""]);break;default:break}}function dp(e,t,r){if(!t)return e;let n=e.findIndex(i=>i.n==="Titles");if(n>=0){let i=e.slice();return i[n]=u$(e[n],t),i}return r?[c$(t),...e]:e}function u$(e,t){let r=!1,n=e.c.map(i=>!r&&i.n==="Title"&&d$(i,"LCID")===fp?(r=!0,{n:i.n,a:(0,Le.mergeAttrs)(i.a,[["Title",t]]),c:i.c}):i);return r||n.unshift(SN(t)),{n:e.n,a:e.a.map(i=>[i[0],i[1]]),c:n}}function c$(e){return{n:"Titles",a:[],c:[SN(e)]}}function SN(e){return{n:"Title",a:[["LCID",fp],["Title",e]],c:[]}}function d$(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function p$(e){let t="0123456789abcdef",r="";for(let n=0;n<e;n+=1)r+=t[Math.floor(Math.random()*t.length)];return r}function il(e,t){e&&(typeof e.id!="string"||e.id.length===0)&&(e.id=`${t}_${p$(8)}`)}function pp(e){var t;il(e,"area");for(let r of(t=e.groups)!==null&&t!==void 0?t:[])DN(r)}function DN(e){var t;il(e,"group");for(let r of(t=e.subAreas)!==null&&t!==void 0?t:[])il(r,"subarea")}function f$(){return{adapter:new nl,api:Yq.appApi}}Ni.appRegistration=f$});var IN={};Bt(IN,{ActionType:()=>hp,AppActionOrigin:()=>Np,AppActionVisibilityType:()=>wp,ButtonType:()=>vp,CannotUpdateAppActionColumns:()=>m$,Context:()=>yp,IconType:()=>gp,Location:()=>bp,OnClickEventType:()=>Ap,Scope:()=>Cp,VisibilityType:()=>mp});var mp,hp,gp,vp,bp,yp,Cp,Ap,wp,Np,m$,_N=D(()=>{"use strict";(function(e){e[e.NotSupported=0]="NotSupported",e[e.Show=1]="Show",e[e.ClassicRules=2]="ClassicRules",e[e.Expression=3]="Expression"})(mp||(mp={}));(function(e){e[e.NotSupported=0]="NotSupported",e[e.None=1]="None",e[e.JavaScript=2]="JavaScript",e[e.Expression=3]="Expression"})(hp||(hp={}));(function(e){e[e.NoIcon=0]="NoIcon",e[e.UseIcon=1]="UseIcon",e[e.UseWebResource=2]="UseWebResource"})(gp||(gp={}));(function(e){e[e.Standard=0]="Standard",e[e.Dropdown=1]="Dropdown",e[e.Split=2]="Split",e[e.Group=3]="Group"})(vp||(vp={}));(function(e){e[e.Form=0]="Form",e[e.HomePageGrid=1]="HomePageGrid",e[e.SubGridStandard=2]="SubGridStandard",e[e.SubGridAssociated=3]="SubGridAssociated",e[e.QuickForm=4]="QuickForm",e[e.Global=5]="Global",e[e.Dashboard=6]="Dashboard"})(bp||(bp={}));(function(e){e[e.All=0]="All",e[e.Entity=1]="Entity"})(yp||(yp={}));(function(e){e[e.App=0]="App",e[e.Entity=1]="Entity",e[e.Global=2]="Global"})(Cp||(Cp={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.JavaScript=2]="JavaScript"})(Ap||(Ap={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.ClassicRules=2]="ClassicRules"})(wp||(wp={}));(function(e){e[e.Default=0]="Default",e[e.Migrated=1]="Migrated",e[e.MigratedClone=2]="MigratedClone"})(Np||(Np={}));m$=["appactionid","appmoduleid","context","contextvalue","location","name","type","uniquename","isdisabled","origin"]});var ON=m(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.commandApi=void 0;var Cr=$e(),Zt=ue(),h$="OnClickEventJavaScriptWebResourceId($select=name,webresourceid),IconWebResourceId($select=name,webresourceid)";async function Sp(e,t){let r=`/EntityDefinitions(LogicalName='${(0,Zt.odataLiteral)(t)}')${(0,Zt.odataQuery)([["$select","MetadataId"]])}`,i=(0,Cr.ensureSuccess)(await e.get(r),e.apiUrl(r)).body,a=i?.MetadataId;return a?(0,Zt.normalizeGuid)(a,"entityMetadataId"):""}al.commandApi={async get(e,t){var r;let n=t,i=await Sp(e,n),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,Zt.odataLiteral)(n)}'`,o=`/appactions${(0,Zt.odataQuery)([["$expand",h$],["$filter",a]])}`,s=(0,Cr.ensureSuccess)(await e.get(o),e.apiUrl(o)),l=s.body;return{raw:{entityLogicalName:n,entityMetadataId:i,appActions:(r=l?.value)!==null&&r!==void 0?r:[]},etag:(0,Cr.readEtag)(s)}},async list(e,t){let r=t?.entityLogicalName;return r?[{type:"command",id:r,name:`${r} commands`,entityLogicalName:r,isDirty:!1}]:[]},async create(e,t){let r=t,n=r.entityMetadataId||await Sp(e,r.entityLogicalName);return PN(e,{...r,entityMetadataId:n},!1)},async update(e,t,r,n){return PN(e,r,!0)},async delete(e,t){var r,n;let i=await Sp(e,t),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,Zt.odataLiteral)(t)}'`,o=`/appactions${(0,Zt.odataQuery)([["$select","appactionid"],["$filter",a]])}`,l=(n=(r=(0,Cr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[];for(let u of l)u.appactionid&&await(0,Cr.deleteRecord)(e,"appactions",u.appactionid)}};async function PN(e,t,r){var n;let i=t.entityMetadataId?(0,Zt.normalizeGuid)(t.entityMetadataId,"entityMetadataId"):"",a=g$(t.rows);for(let o of a)if(r&&o.exists){let l=`/appactions(${(0,Zt.normalizeGuid)(o.appactionid,"id")})`,u=o.etag?{"If-Match":o.etag}:void 0;(0,Cr.ensureSuccess)(await e.patch(l,o.body,u?{headers:u}:void 0),e.apiUrl(l))}else{let s="/appactions",l={...o.body};i&&l["[email protected]"]===void 0&&(l["[email protected]"]=`/entities(${i})`);let u=(0,Cr.ensureSuccess)(await e.post(s,l),e.apiUrl(s));(0,Cr.readCreatedId)(u,"appactionid")}for(let o of[...(n=t.deletedRowIds)!==null&&n!==void 0?n:[]].reverse())await(0,Cr.deleteRecord)(e,"appactions",(0,Zt.normalizeGuid)(o,"id"));return{id:t.entityLogicalName,etag:null}}function g$(e){let t=new Map(e.map(a=>[a.appactionid,a])),r=new Set,n=[],i=a=>{if(r.has(a.appactionid))return;let o=a.body["[email protected]"];if(typeof o=="string"){let s=/\(([^)]+)\)/.exec(o),l=s?t.get(s[1]):void 0;l&&i(l)}r.add(a.appactionid),n.push(a)};return e.forEach(i),n}});var GN=m(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.commandRegistration=Si.CommandAdapter=void 0;var Pe=(_N(),kt(IN)),Et=$r(),v$=ON(),TN=Ft(),Ka=ue(),Ep="$ClientSvg:",Ip=".svg",b$=2,RN="entityMetadataId",y$=new Set(["@odata.etag","IconWebResourceId","OnClickEventJavaScriptWebResourceId","VisibilityFormulaComponentLibraryId","OnClickEventFormulaComponentLibraryId","ContextEntity","_appmoduleid_value","_contextentity_value","_createdby_value","_createdonbehalfby_value","_iconwebresourceid_value","_modifiedby_value","_modifiedonbehalfby_value","_onclickeventformulacomponentlibraryid_value","_onclickeventjavascriptwebresourceid_value","_organizationid_value","_parentappactionid_value","_visibilityformulacomponentlibraryid_value","createdon","modifiedon","overriddencreatedon","overwritetime","componentstate","componentidunique","solutionid","ismanaged","iscustomizable","versionnumber","importsequencenumber","timezoneruleversionnumber","utcconversiontimezonecode","statecode","statuscode","scope"]),ol=class{toArtifact(t){var r,n,i,a,o,s;let l=(r=t.appActions)!==null&&r!==void 0?r:[],u=(n=t.entityLogicalName)!==null&&n!==void 0?n:"",c=new Map;for(let g of l){let b=typeof g._parentappactionid_value=="string"&&g._parentappactionid_value?g._parentappactionid_value:"",w=(i=c.get(b))!==null&&i!==void 0?i:[];w.push(g),c.set(b,w)}let d=new Map;for(let g of(a=c.get(""))!==null&&a!==void 0?a:[]){let b=S$(g.location),w=(o=d.get(b))!==null&&o!==void 0?o:[];w.push(g),d.set(b,w)}let f=[];for(let[g,b]of d)f.push({location:g,groups:A$(b,c,BN(g),u)});return{id:u,entityLogicalName:u,commandBars:N$(f),bag:{a:[[RN,(s=t.entityMetadataId)!==null&&s!==void 0?s:""]]}}}fromArtifact(t){return{entityLogicalName:t.entityLogicalName,entityMetadataId:Pp(t),appActions:Dp(t).map(r=>r.row)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t,r){let n=new Set(r?Dp(r).map(l=>l.appactionid):[]),i=Dp(t),a=new Set(i.map(l=>l.appactionid)),o=i.map(l=>{let u=l.exists||n.has(l.appactionid);return{appactionid:l.appactionid,exists:u,etag:l.etag,body:u?L$(l.row):VN(l.row)}}),s=[...n].filter(l=>!a.has(l));return{entityLogicalName:t.entityLogicalName,entityMetadataId:Pp(t),rows:o,...s.length>0?{deletedRowIds:s}:{}}}createDefault(t){var r,n,i,a;let o=(n=(r=t.entityLogicalName)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"";return{id:(i=t.id)!==null&&i!==void 0?i:o,entityLogicalName:o,commandBars:(a=t.commandBars)!==null&&a!==void 0?a:[]}}assignMissingIds(t){return(0,TN.assignMissingIds)(t)}validate(t){let r=[];return(0,Et.childObjects)(t,"commandBars","","commandBar",r).forEach(({node:i,index:a})=>{let o=`/commandBars/${a}`;(0,Et.optionalEnum)(i,"location",["MainTab","ContextualTab","HomeTab"],o,"bar-location-invalid",r),(0,Et.childObjects)(i,"groups",o,"group",r).forEach(({node:l,index:u})=>{let c=`${o}/groups/${u}`;(0,Et.optionalGuidId)(l,"id",c,"group-id-invalid",r),xN((0,Et.childObjects)(l,"controls",c,"control",r),`${c}/controls`,r)})}),r}};Si.CommandAdapter=ol;function xN(e,t,r){e.forEach(({node:n,index:i})=>{let a=`${t}/${i}`;(0,Et.optionalGuidId)(n,"id",a,"control-id-invalid",r),(0,Et.optionalEnum)(n,"type",["Button","FlyoutAnchor","SplitButton"],a,"control-type-invalid",r);let o=n.location;o!==void 0&&(typeof o!="number"||!Number.isInteger(o)||o<0||o>6)&&r.push((0,Et.issue)(`${a}/location`,"control-location-invalid",`location must be an integer 0-6 when present, got ${JSON.stringify(o)}`)),n.action!==void 0&&n.action!==null&&((0,Et.isJsonObject)(n.action)?(0,Et.optionalEnum)(n.action,"type",["javascript"],`${a}/action`,"action-type-invalid",r):r.push((0,Et.issue)(`${a}/action`,"control-action-must-be-object",`a control action must be a JSON object when present, got ${typeof n.action}`)));let s=(0,Et.childObjects)(n,"children",a,"control",r);s.length>0&&xN(s,`${a}/children`,r)})}function LN(e){return{a:Object.entries(e)}}function C$(e){return Object.fromEntries(e.a)}function _p(e,t){if(e){for(let[r,n]of e.a)if(r===t)return n}}function Pp(e){let t=_p(e.bag,RN);return typeof t=="string"?t:""}function A$(e,t,r,n){var i,a;let o=[],s=[];for(let l of ll(e))l.type===Pe.ButtonType.Group?o.push({id:UN(l.name,n),title:typeof l.grouptitle=="string"?l.grouptitle:"",controls:ll((a=t.get((i=l.appactionid)!==null&&i!==void 0?i:""))!==null&&a!==void 0?a:[]).map(u=>sl(u,t,r,n)),bag:LN(l)}):s.push(sl(l,t,r,n));return s.length>0&&o.unshift({id:(0,TN.newId)(),title:"",controls:s}),o}function sl(e,t,r,n){var i,a,o,s;let l=UN(e.name,n),u={id:l,type:D$(e.type),label:typeof e.buttonlabeltext=="string"?e.buttonlabeltext:"",command:typeof e.appactionid=="string"?e.appactionid:l,bag:LN(e)},c=MN(e);c&&(u.icon=c);let d=w$(e);d&&(u.action=d),typeof e.hidden=="boolean"&&(u.hidden=e.hidden),typeof e.isdisabled=="boolean"&&(u.disabled=e.isdisabled),typeof e.location=="number"&&e.location!==r&&(u.location=e.location);let f=t.get((i=e.appactionid)!==null&&i!==void 0?i:"");if(f&&f.length>0){let g=[];for(let b of ll(f))if(b.type===Pe.ButtonType.Group){u.flyoutGroupId=(a=b.appactionid)!==null&&a!==void 0?a:void 0;for(let w of ll((s=t.get((o=b.appactionid)!==null&&o!==void 0?o:""))!==null&&s!==void 0?s:[]))g.push(sl(w,t,r,n))}else g.push(sl(b,t,r,n));u.children=g}return u}function MN(e){var t;if(!((t=e.IconWebResourceId)===null||t===void 0)&&t.name)return e.IconWebResourceId.name;if(e.fonticon)return e.fonticon.startsWith(Ep)?e.fonticon.slice(Ep.length)+Ip:e.fonticon}function w$(e){var t;let r=e.onclickeventjavascriptfunctionname;if(typeof r!="string"||!r)return;let n=e.OnClickEventJavaScriptWebResourceId,i=e._onclickeventjavascriptwebresourceid_value,a={type:"javascript",webResourceId:(t=typeof i=="string"?i:n?.webresourceid)!==null&&t!==void 0?t:"",functionName:r};n?.name&&(a.libraryName=n.name);let o=e.onclickeventjavascriptparameters;return typeof o=="string"&&o&&(a.parameters=o),a}function FN(e){return typeof e.sequence=="number"?e.sequence:typeof e.buttonsequencepriority=="number"?e.buttonsequencepriority:0}function ll(e){return[...e].sort((t,r)=>FN(t)-FN(r))}function N$(e){let t={MainTab:0,ContextualTab:1,HomeTab:2};return[...e].sort((r,n)=>{var i,a;return((i=t[r.location])!==null&&i!==void 0?i:9)-((a=t[n.location])!==null&&a!==void 0?a:9)})}function UN(e,t){if(!e)return"";if(e.indexOf("{!EntityLogicalName}")>=0)return e.replace("{!EntityLogicalName}",t);let r=e.split("!");return r.length===2?r[1]:e}function S$(e){switch(e){case Pe.Location.Form:case Pe.Location.QuickForm:return"MainTab";case Pe.Location.HomePageGrid:case Pe.Location.Dashboard:return"HomeTab";default:return"ContextualTab"}}function BN(e){switch(e){case"MainTab":return Pe.Location.Form;case"HomeTab":return Pe.Location.HomePageGrid;default:return Pe.Location.SubGridStandard}}function D$(e){switch(e){case Pe.ButtonType.Dropdown:return"FlyoutAnchor";case Pe.ButtonType.Split:return"SplitButton";default:return"Button"}}function E$(e){switch(e){case"FlyoutAnchor":return Pe.ButtonType.Dropdown;case"SplitButton":return Pe.ButtonType.Split;default:return Pe.ButtonType.Standard}}function I$(e){var t;return e.bag&&e.bag.a.length>0?!0:((t=e.title)!==null&&t!==void 0?t:"").length>0}function Dp(e){var t,r,n;let i=[],a=Pp(e);for(let o of(t=e.commandBars)!==null&&t!==void 0?t:[]){let s=BN(o.location);for(let l of(r=o.groups)!==null&&r!==void 0?r:[]){let u;if(I$(l)){let c=P$(l,s,void 0,e,a);i.push(c),u=c.appactionid}for(let c of(n=l.controls)!==null&&n!==void 0?n:[])kN(c,s,u,e,a,i)}}return i}function kN(e,t,r,n,i,a){var o;let s=_$(e,t,r,n,i);a.push(s);let l=(o=e.children)!==null&&o!==void 0?o:[];if(l.length===0)return;let u=e.flyoutGroupId||x$(s.appactionid);a.push(O$(u,t,s.appactionid,n,i));for(let c of l)kN(c,t,u,n,i,a)}function _$(e,t,r,n,i){let a=qN(e,t,r,n,i),o=a.row,s=MN(o);return e.location!==void 0&&(o.location=e.location),o.type=E$(e.type),o.buttonlabeltext=e.label,F$(o,e.icon,s),T$(o,e.action),e.hidden!==void 0&&(o.hidden=e.hidden),e.disabled!==void 0&&(o.isdisabled=e.disabled),{...a,row:o}}function P$(e,t,r,n,i){let a=qN(e,t,r,n,i);return a.row.type=Pe.ButtonType.Group,a.row.grouptitle=e.title,a}function O$(e,t,r,n,i){let a=$N(e,t,n,i);return a["[email protected]"]=`/appactions(${(0,Ka.normalizeGuid)(r,"Command flyout group id")})`,a.type=Pe.ButtonType.Group,a.grouptitle===void 0&&(a.grouptitle=""),a.isgrouptitlehidden=!0,{appactionid:e,exists:!1,etag:null,row:a}}function qN(e,t,r,n,i){let a,o,s,l;if(e.bag&&e.bag.a.length>0){a=C$(e.bag),o=!0;let u=_p(e.bag,"@odata.etag");s=typeof u=="string"?u:null;let c=_p(e.bag,"appactionid");l=typeof c=="string"&&c?c:e.id}else l=e.id,a=$N(l,t,n,i),o=!1,s=null;return r&&(a["[email protected]"]=`/appactions(${(0,Ka.normalizeGuid)(r,"Command parent appaction id")})`),{appactionid:l,exists:o,etag:s,row:a}}function $N(e,t,r,n){let i={appactionid:e,name:`${e}!${e.replace(/-/g,"").slice(0,32)}`,uniquename:"",location:t,context:Pe.Context.Entity,contextvalue:r.entityLogicalName,scope:Pe.Scope.Entity};return n&&(i["[email protected]"]=`/entities(${(0,Ka.normalizeGuid)(n,"Command context entity metadata id")})`),i}function F$(e,t,r){if(t===r){let n=e._iconwebresourceid_value;typeof n=="string"&&n&&!e.fonticon&&(e["[email protected]"]=`/webresourceset(${(0,Ka.normalizeGuid)(n,"Command icon web resource id")})`);return}if(t===void 0){e.fonticon="",e.IconWebResourceId=null;return}e.fonticon=t.toLowerCase().endsWith(Ip)?Ep+t.slice(0,t.length-Ip.length):t,e.IconWebResourceId=null}function T$(e,t){if(!(!t||t.type!=="javascript")){if(e.onclickeventtype=b$,t.webResourceId){let r=(0,Ka.normalizeGuid)(t.webResourceId,"Command action web resource id");e["[email protected]"]=`/webresourceset(${r})`}e.onclickeventjavascriptfunctionname=t.functionName,t.parameters!==void 0&&(e.onclickeventjavascriptparameters=t.parameters)}}function R$(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}function x$(e){let t="";for(let r=0;r<4;r+=1)t+=R$(`${r}:flyout-group:${e}`).toString(16).padStart(8,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function VN(e){let t={...e};for(let r of y$)delete t[r];return t}function L$(e){let t=VN(e);for(let r of Pe.CannotUpdateAppActionColumns)delete t[r];return t}function M$(){return{adapter:new ol,api:v$.commandApi}}Si.commandRegistration=M$});var zN=m(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.chartApi=void 0;var Ar=$e(),Ya=ue(),U$="savedqueryvisualizationid,name,description,primaryentitytypecode,datadescription,presentationdescription,charttype,type,isdefault",B$="savedqueryvisualizationid,name,primaryentitytypecode,charttype,isdefault";ul.chartApi={async get(e,t){let n=`/savedqueryvisualizations(${(0,Ya.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Ya.odataQuery)([["$select",U$]]),i=(0,Ar.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Ar.readEtag)(i)}},async list(e,t){var r;let n=`/savedqueryvisualizations${(0,Ya.odataQuery)([["$select",B$],["$filter",t?.entityLogicalName?`primaryentitytypecode eq '${(0,Ya.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`,a=(0,Ar.ensureSuccess)(await e.get(n),e.apiUrl(n)).body;return((r=a?.value)!==null&&r!==void 0?r:[]).map(s=>{var l,u;return{type:"chart",id:(l=s.savedqueryvisualizationid)!==null&&l!==void 0?l:"",name:(u=s.name)!==null&&u!==void 0?u:"",entityLogicalName:s.primaryentitytypecode,isDirty:!1}})},async create(e,t){let r=t,n="/savedqueryvisualizations",i=(0,Ar.ensureSuccess)(await e.post(n,{name:r.name,description:r.description,datadescription:r.datadescription,presentationdescription:r.presentationdescription,primaryentitytypecode:r.primaryentitytypecode,charttype:r.charttype,isdefault:r.isdefault}),e.apiUrl(n));return{id:(0,Ar.requireCreatedId)(i,"savedqueryvisualizationid","chart"),etag:(0,Ar.readEtag)(i)}},async update(e,t,r,n){let i=r,a=(0,Ya.normalizeGuid)(t,"id"),o=`/savedqueryvisualizations(${a})`,s=n?{"If-Match":n}:void 0,l=(0,Ar.ensureSuccess)(await e.patch(o,{name:i.name,description:i.description,datadescription:i.datadescription,presentationdescription:i.presentationdescription},s?{headers:s}:void 0),e.apiUrl(o));return{id:a,etag:(0,Ar.readEtag)(l)}},delete(e,t){return(0,Ar.deleteRecord)(e,"savedqueryvisualizations",t)}}});var aS=m(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.chartRegistration=Di.ChartAdapter=void 0;var Op=pn(),WN=$r(),wr=ja(),k$=zN(),Fp=fn(),q$=Ft(),$$=["Column","StackedColumn","StackedColumn100","Bar","StackedBar","StackedBar100","Area","StackedArea","StackedArea100","Line","Pie","Doughnut","Funnel","Tag"],V$=new Map($$.map(e=>[e.toLowerCase(),e]));function QN(e){var t;return e&&(t=V$.get(e.toLowerCase()))!==null&&t!==void 0?t:"Column"}function G$(){return'<Chart Palette="BrightPastel"><Series><Series ChartType="Column" ChartArea="Default" /></Series><ChartAreas><ChartArea Name="Default" /></ChartAreas><Legends><Legend Name="Default" /></Legends></Chart>'}function z$(e){var t,r;let n=e.entityLogicalName,i=e.series.map((u,c)=>({alias:`agg_${c}`,series:u})),a=e.categories.map((u,c)=>({alias:`grp_${c}`,category:u})),o=i.map(u=>`<attribute alias="${u.alias}" name="${Za(u.series.attribute)}" aggregate="${Za(u.series.aggregate)}" />`).join("")+a.map(u=>`<attribute alias="${u.alias}" name="${Za(u.category.attribute)}" groupby="true"${u.category.dateGrouping?` dategrouping="${Za(u.category.dateGrouping)}"`:""} />`).join(""),s=i.map(u=>`<measure alias="${u.alias}" />`).join(""),l=(r=(t=a[0])===null||t===void 0?void 0:t.alias)!==null&&r!==void 0?r:"";return`<datadefinition><fetchcollection><fetch mapping="logical" aggregate="true"><entity name="${Za(n)}">${o}</entity></fetch></fetchcollection><categorycollection><category alias="${l}"><measurecollection>${s}</measurecollection></category></categorycollection></datadefinition>`}var cl=class{toArtifact(t){var r,n,i,a,o,s,l;(0,Fp.installDomShim)();let u=(r=t.datadescription)!==null&&r!==void 0?r:"",c=(n=t.presentationdescription)!==null&&n!==void 0?n:"",d=(0,wr.parseXmlRoot)(u,"<datadefinition/>"),f=(0,wr.parseXmlRoot)(c,"<Chart/>");return{id:(i=t.savedqueryvisualizationid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.primaryentitytypecode)!==null&&s!==void 0?s:"",chartType:XN(f),isDefault:(l=t.isdefault)!==null&&l!==void 0?l:!1,series:ZN(d),categories:eS(d),presentation:KN(f),dataBag:u?(0,wr.projectElementBag)(d):void 0,presentationBag:c?(0,wr.projectElementBag)(f):void 0,rowBag:W$(t.charttype,t.type)}}fromArtifact(t){(0,Fp.installDomShim)();let{datadescription:r,presentationdescription:n}=j$(t);return{savedqueryvisualizationid:t.id,name:t.name,description:t.description,primaryentitytypecode:t.entityLogicalName,datadescription:r,presentationdescription:n,charttype:jN(t.rowBag,"charttype"),type:jN(t.rowBag,"type"),isdefault:t.isDefault}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){var r,n,i,a,o,s,l;let u=this.fromArtifact(t);return{name:(r=u.name)!==null&&r!==void 0?r:"",description:(n=u.description)!==null&&n!==void 0?n:"",datadescription:(i=u.datadescription)!==null&&i!==void 0?i:"",presentationdescription:(a=u.presentationdescription)!==null&&a!==void 0?a:"",primaryentitytypecode:(o=u.primaryentitytypecode)!==null&&o!==void 0?o:"",charttype:(s=u.charttype)!==null&&s!==void 0?s:0,isdefault:(l=u.isdefault)!==null&&l!==void 0?l:!1}}createDefault(t){var r,n,i,a,o,s,l;(0,Fp.installDomShim)();let u=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,q$.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New Chart",description:(a=t.description)!==null&&a!==void 0?a:"",entityLogicalName:u,chartType:(o=t.chartType)!==null&&o!==void 0?o:"Column",isDefault:(s=t.isDefault)!==null&&s!==void 0?s:!1,series:t.series&&t.series.length>0?t.series:[{attribute:"createdon",aggregate:"count"}],categories:t.categories&&t.categories.length>0?t.categories:[{attribute:"createdon",dateGrouping:"month"}],presentation:(l=t.presentation)!==null&&l!==void 0?l:{palette:"BrightPastel",showLegend:!0}}}assignMissingIds(t){return t}validate(t){let r=[],n=t;return(0,WN.childObjects)(n,"series","","series",r),(0,WN.childObjects)(n,"categories","","category",r),r}};Di.ChartAdapter=cl;function W$(e,t){let r=[];return e!==void 0&&r.push(["charttype",String(e)]),t!==void 0&&r.push(["type",String(t)]),r.length>0?{a:r,c:[]}:void 0}function jN(e,t){if(!e)return;let r=e.a.find(([i])=>i===t);if(!r)return;let n=parseInt(r[1],10);return Number.isNaN(n)?void 0:n}function XN(e){let t=e.getElementsByTagName("Series");for(let r=0;r<t.length;r+=1)if(t[r].getAttribute("ChartType"))return QN(t[r].getAttribute("ChartType"));return"Column"}function KN(e){var t;let r={showLegend:e.getElementsByTagName("Legend").length>0},n=e.getAttribute("Palette");n&&(r.palette=n);let i=e.getElementsByTagName("Title")[0],a=((t=i?.textContent)!==null&&t!==void 0?t:"").trim();return a&&(r.title=a),r}function dl(e){return e.getElementsByTagName("fetch")[0]}function YN(e){var t;let r=new Map;if(!e)return r;let n=e.getElementsByTagName("link-entity");for(let i=0;i<n.length;i+=1){let a=n[i],o=a.getAttribute("name");if(!o)continue;let s=a.getElementsByTagName("attribute");for(let l=0;l<s.length;l+=1){let u=s[l],c=(t=u.getAttribute("alias"))!==null&&t!==void 0?t:u.getAttribute("name");c&&r.set(c,o)}}return r}function ZN(e){let t=dl(e);if(!t)return[];let r=YN(t),n=t.getElementsByTagName("attribute"),i=[];for(let a=0;a<n.length;a+=1){let o=n[a],s=o.getAttribute("aggregate");if(!s)continue;let l=o.getAttribute("name");if(!l)continue;let u={attribute:l,aggregate:s},c=o.getAttribute("charttype");c&&(u.seriesType=QN(c));let d=o.getAttribute("alias");d&&(u.alias=d);let f=d??l,g=r.get(f);g&&(u.relatedEntity=g),i.push(u)}return i}function eS(e){var t;let r=dl(e);if(!r)return[];let n=YN(r),i=r.getElementsByTagName("attribute"),a=[];for(let o=0;o<i.length;o+=1){let s=i[o];if(((t=s.getAttribute("groupby"))!==null&&t!==void 0?t:"").toLowerCase()!=="true")continue;let l=s.getAttribute("name");if(!l)continue;let u={attribute:l},c=s.getAttribute("dategrouping");c&&(u.dateGrouping=c);let d=s.getAttribute("alias");d&&(u.alias=d);let f=d??l,g=n.get(f);g&&(u.relatedEntity=g),a.push(u)}return a}function j$(e){if(!HN(e.dataBag)||!HN(e.presentationBag))return{datadescription:z$(e),presentationdescription:p4(e)};let t=new DOMParser().parseFromString("<root/>","text/xml"),r=JN(e.dataBag,"datadefinition",t),n=JN(e.presentationBag,"Chart",t);return Tp(e.series,ZN(r))||(J$(t,r,e.series),H$(t,n,e.series.length,e.chartType)),Tp(e.categories,eS(r))||Q$(t,r,e.categories),e.chartType!==XN(n)&&nS(n,e.chartType),Tp(e.presentation,KN(n))||iS(n,e.presentation),{datadescription:(0,wr.serializeNode)(r),presentationdescription:(0,wr.serializeNode)(n)}}function HN(e){return!!e&&(e.c.length>0||e.a.length>0)}function H$(e,t,r,n){let i,a=t.childNodes;for(let l=0;l<a.length;l+=1)if(a[l].nodeType===1&&a[l].tagName==="Series"){i=a[l];break}i||(i=e.createElement("Series"),t.insertBefore(i,t.firstChild));let o=[],s=i.childNodes;for(let l=0;l<s.length;l+=1)s[l].nodeType===1&&s[l].tagName==="Series"&&o.push(s[l]);for(let l=o.length;l<r;l+=1){let u=e.createElement("Series");u.setAttribute("ChartType",n),i.appendChild(u)}for(let l=r;l<o.length;l+=1)i.removeChild(o[l])}function JN(e,t,r){let n={n:t,a:(0,Op.mergeAttrs)(e.a,[]),c:(0,Op.spliceChildren)(e.c,[])};return(0,Op.rebuildRaw)(n,(0,wr.domEngine)(r),null)}function J$(e,t,r){let n=dl(t),i=n?.getElementsByTagName("entity")[0];!n||!i||tS(e,t,i,r4(n),r,i4,{aliasPrefix:"aggregate_column",addRef:Y$,removeRef:t4})}function Q$(e,t,r){let n=dl(t),i=n?.getElementsByTagName("entity")[0];!n||!i||tS(e,t,i,n4(n),r,a4,{aliasPrefix:"groupby_column",addRef:Z$,removeRef:e4})}function tS(e,t,r,n,i,a,o){let s=new Map;for(let f of n){let g=f.getAttribute("alias");g&&s.set(g,f)}let l=new Set,u=[];for(let f of i){let g=f.alias?s.get(f.alias):void 0;g&&!l.has(g)?(a(g,f),l.add(g)):u.push(f)}let c=n.filter(f=>!l.has(f)),d=0;for(let f of u)if(d<c.length){let g=c[d];a(g,f),l.add(g),d+=1}else{let g=e.createElement("attribute"),b=f.alias||K$(t,o.aliasPrefix);g.setAttribute("alias",b),a(g,f),o4(e,r,g,f.relatedEntity),o.addRef(e,t,b)}for(let f of n)if(!l.has(f)){let g=f.getAttribute("alias");g&&o.removeRef(t,g),l4(f)}}function X$(e){let t=new Set;for(let r of["attribute","measure","category"]){let n=e.getElementsByTagName(r);for(let i=0;i<n.length;i+=1){let a=n[i].getAttribute("alias");a&&t.add(a)}}return t}function K$(e,t){let r=X$(e);if(!r.has(t))return t;for(let n=2;;n+=1){let i=`${t}_${n}`;if(!r.has(i))return i}}function rS(e,t){let r=t.getElementsByTagName("categorycollection")[0];if(r)return r;let n=e.createElement("categorycollection");return t.appendChild(n),n}function Y$(e,t,r){let n=rS(e,t),i=n.getElementsByTagName("category")[0];i||(i=e.createElement("category"),n.appendChild(i));let a=e.createElement("measurecollection"),o=e.createElement("measure");o.setAttribute("alias",r),a.appendChild(o),i.appendChild(a)}function Z$(e,t,r){let n=rS(e,t),i=e.createElement("category");i.setAttribute("alias",r),n.appendChild(i)}function e4(e,t){let r=e.getElementsByTagName("category");for(let n=0;n<r.length;n+=1)r[n].getAttribute("alias")===t&&r[n].removeAttribute("alias")}function t4(e,t){var r;let n=e.getElementsByTagName("measure"),i=[];for(let a=0;a<n.length;a+=1)n[a].getAttribute("alias")===t&&i.push(n[a]);for(let a of i){let o=a.parentNode;o?.removeChild(a),o&&o.tagName==="measurecollection"&&!c4(o)&&((r=o.parentNode)===null||r===void 0||r.removeChild(o))}}function r4(e){let t=[],r=e.getElementsByTagName("attribute");for(let n=0;n<r.length;n+=1)r[n].getAttribute("aggregate")&&t.push(r[n]);return t}function n4(e){var t;let r=[],n=e.getElementsByTagName("attribute");for(let i=0;i<n.length;i+=1)((t=n[i].getAttribute("groupby"))!==null&&t!==void 0?t:"").toLowerCase()==="true"&&r.push(n[i]);return r}function i4(e,t){e.setAttribute("name",t.attribute),e.setAttribute("aggregate",t.aggregate),t.seriesType&&e.setAttribute("charttype",t.seriesType)}function a4(e,t){e.setAttribute("name",t.attribute),e.setAttribute("groupby","true"),t.dateGrouping?e.setAttribute("dategrouping",t.dateGrouping):e.getAttribute("dategrouping")!==null&&e.removeAttribute("dategrouping")}function o4(e,t,r,n){n?s4(e,t,n).appendChild(r):t.appendChild(r)}function s4(e,t,r){let n=t.getElementsByTagName("link-entity");for(let a=0;a<n.length;a+=1)if(n[a].getAttribute("name")===r)return n[a];let i=e.createElement("link-entity");return i.setAttribute("name",r),t.appendChild(i),i}function l4(e){let t=e.parentNode;if(t&&(t.removeChild(e),t.tagName==="link-entity"&&!u4(t))){let r=t.parentNode;r&&r.removeChild(t)}}function u4(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1){let i=n.tagName;if(i==="attribute"||i==="link-entity")return!0}}return!1}function c4(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1)if(t[r].nodeType===1)return!0;return!1}function nS(e,t){let r=e.getElementsByTagName("Series"),n=!1;for(let i=0;i<r.length;i+=1)r[i].getAttribute("ChartType")&&(r[i].setAttribute("ChartType",t),n=!0);if(!n){for(let i=0;i<r.length;i+=1)if(!d4(r[i])){r[i].setAttribute("ChartType",t);return}}}function d4(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1&&n.tagName==="Series")return!0}return!1}function iS(e,t){var r;let n=e.ownerDocument;if(t.palette!==void 0&&e.setAttribute("Palette",t.palette),t.showLegend!==void 0){let i=[],a=e.getElementsByTagName("Legends");for(let o=0;o<a.length;o+=1)i.push(a[o]);if(t.showLegend&&i.length===0){let o=n.createElement("Legends"),s=n.createElement("Legend");s.setAttribute("Name","Default"),o.appendChild(s),e.appendChild(o)}else if(!t.showLegend)for(let o of i)(r=o.parentNode)===null||r===void 0||r.removeChild(o)}if(t.title!==void 0){let i=e.getElementsByTagName("Title")[0];i&&(i.textContent=t.title)}}function p4(e){let t=(0,wr.parseXmlRoot)(G$(),"<Chart/>");return nS(t,e.chartType),iS(t,e.presentation),(0,wr.serializeNode)(t)}function Tp(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Za(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function f4(){return{adapter:new cl,api:k$.chartApi}}Di.chartRegistration=f4});var oS=m(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.dashboardApi=void 0;var Nr=$e(),eo=ue(),m4="formid,name,description,formxml,type,objecttypecode,istabletenabled,iscustomizable,componentstate,versionnumber",h4="formid,name,type,objecttypecode",g4=0,v4=10;pl.dashboardApi={async get(e,t){let n=`/systemforms(${(0,eo.normalizeGuid)(t,"id")})${(0,eo.odataQuery)([["$select",m4]])}`,i=(0,Nr.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Nr.readEtag)(i)}},async list(e,t){var r;let n=[`(type eq ${g4} or type eq ${v4})`];t?.entityLogicalName&&n.push(`objecttypecode eq '${(0,eo.odataLiteral)(t.entityLogicalName)}'`);let i=`/systemforms${(0,eo.odataQuery)([["$select",h4],["$filter",n.join(" and ")]])}`,o=(0,Nr.ensureSuccess)(await e.get(i),e.apiUrl(i)).body;return((r=o?.value)!==null&&r!==void 0?r:[]).map(l=>{var u,c;return{type:"dashboard",id:(u=l.formid)!==null&&u!==void 0?u:"",name:(c=l.name)!==null&&c!==void 0?c:"",entityLogicalName:l.objecttypecode,isDirty:!1}})},async create(e,t){let r=t,n="/systemforms",i={name:r.name,description:r.description,formxml:r.formxml,istabletenabled:r.istabletenabled,type:r.type};r.objecttypecode&&(i.objecttypecode=r.objecttypecode);let a=(0,Nr.ensureSuccess)(await e.post(n,i),e.apiUrl(n));return{id:(0,Nr.requireCreatedId)(a,"formid","dashboard"),etag:(0,Nr.readEtag)(a)}},async update(e,t,r,n){let i=r,a=(0,eo.normalizeGuid)(t,"id"),o=`/systemforms(${a})`,s=n?{"If-Match":n}:void 0,l=(0,Nr.ensureSuccess)(await e.patch(o,{name:i.name,description:i.description,formxml:i.formxml,istabletenabled:i.istabletenabled},s?{headers:s}:void 0),e.apiUrl(o));return{id:a,etag:(0,Nr.readEtag)(l)}},delete(e,t){return(0,Nr.deleteRecord)(e,"systemforms",t)}}});var vS=m(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.dashboardRegistration=er.TILE_CLASS_ID=er.DashboardAdapter=void 0;var ro=pn(),It=ja(),to=$r(),b4=oS(),Rp=fn(),Cn=Ft(),pS=ue(),ml=1033,sS="0",xp="10",y4=new Map([["{E7A81278-8635-4D9E-8D4D-59480B391C5B}","chart"],["{FD2A7985-3187-444E-908D-6624B21F69C0}","iframe"],["{9FDF5F91-88B1-47F4-AD53-C11EFC01A01D}","webresource"],["{EE9078C8-6946-4E2C-B8F8-35E65F4BE6A8}","stream"],["{06375649-C143-495E-A496-C962E5B4488E}","timeline"],["{8C54228C-1B25-4909-A12A-F2B968BB0D62}","powerbi"],["{F9A8A302-114E-466A-B582-6771B2AE0D92}","assistant"]]),C4="{3FF9A528-DD50-4ACA-8F10-2E5ED73513AD}",hl=class{toArtifact(t){var r,n,i,a;(0,Rp.installDomShim)();let o=(r=t.formxml)!==null&&r!==void 0?r:"",s=(0,It.parseXmlRoot)(o,"<form/>");return{id:(n=t.formid)!==null&&n!==void 0?n:"",name:(i=t.name)!==null&&i!==void 0?i:"",description:(a=t.description)!==null&&a!==void 0?a:"",dashboardType:A4(t.type),entityLogicalName:t.objecttypecode?t.objecttypecode:null,enabledForMobile:!!t.istabletenabled,layoutType:w4(s),components:lS(s),bag:(0,It.projectElementBag)(s)}}fromArtifact(t){var r;return(0,Rp.installDomShim)(),{formid:t.id,name:t.name,description:t.description,type:t.dashboardType==="Interactive"?xp:sS,objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",istabletenabled:t.enabledForMobile,formxml:uS(t)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){return{name:t.name,description:t.description,formxml:uS(t),istabletenabled:t.enabledForMobile,type:t.dashboardType==="Interactive"?xp:sS,objecttypecode:t.entityLogicalName}}createDefault(t){var r,n,i,a,o,s,l,u;(0,Rp.installDomShim)();let c=(0,It.parseXmlRoot)(L4(),"<form/>");return{id:(r=t.id)!==null&&r!==void 0?r:(0,Cn.newId)(),name:(n=t.name)!==null&&n!==void 0?n:"New Dashboard",description:(i=t.description)!==null&&i!==void 0?i:"",dashboardType:(a=t.dashboardType)!==null&&a!==void 0?a:"Standard",entityLogicalName:(o=t.entityLogicalName)!==null&&o!==void 0?o:null,enabledForMobile:(s=t.enabledForMobile)!==null&&s!==void 0?s:!1,layoutType:(l=t.layoutType)!==null&&l!==void 0?l:0,components:(u=t.components)!==null&&u!==void 0?u:lS(c),bag:(0,It.projectElementBag)(c)}}assignMissingIds(t){if(t&&typeof t=="object"&&!Array.isArray(t)&&"position"in t&&!("components"in t)){let r=t;(typeof r.id!="string"||r.id.length===0)&&(r.id=(0,Cn.newId)())}return t}validate(t){let r=[],n=(0,to.childObjects)(t,"components","","component",r),i=new Set;return n.forEach(({node:a,index:o})=>{let s=`/components/${o}`;for(let l of["position","parameters"]){let u=a[l];u!==void 0&&!(0,to.isJsonObject)(u)&&r.push((0,to.issue)(`${s}/${l}`,`component-${l}-must-be-object`,`a component ${l} must be a JSON object when present, got ${u===null?"null":typeof u}`))}if((0,to.isJsonObject)(a.position)){let l=no(a.position);i.has(l)?r.push((0,to.issue)(`${s}/position`,"component-position-collision",`two components occupy the same dashboard position (${l}); move one to a free cell`)):i.add(l)}}),r}};er.DashboardAdapter=hl;function A4(e){return String(e??"")===xp?"Interactive":"Standard"}function w4(e){var t;let r=(t=e?.getAttribute("formLayout"))!==null&&t!==void 0?t:e?.getAttribute("layoutType"),n=parseInt(r??"",10);return Number.isNaN(n)?0:n}function V(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName.toLowerCase()===t&&r.push(a)}return r}function lS(e){let t=[];return V(e,"tabs").flatMap(n=>V(n,"tab")).forEach((n,i)=>{V(n,"columns").flatMap(o=>V(o,"column")).forEach((o,s)=>{V(o,"sections").flatMap(u=>V(u,"section")).forEach((u,c)=>{N4(u,{tabIndex:i,columnIndex:s,sectionIndex:c},t)})})}),t}function N4(e,t,r){V(e,"rows").flatMap(i=>V(i,"row")).forEach((i,a)=>{V(i,"cell").forEach((o,s)=>{let l=S4(o,{...t,rowIndex:a,cellIndex:s});l&&r.push(l)})})}function S4(e,t){var r,n,i;let a=hS((r=e.getAttribute("id"))!==null&&r!==void 0?r:"");if(a.toLowerCase().startsWith("spacer"))return null;let o=V(e,"control")[0];if(!o)return null;let s=(n=o.getAttribute("classid"))!==null&&n!==void 0?n:"",l=I4(o),u=_4(s,l,o),c=D4(o);return{id:(i=o.getAttribute("id"))!==null&&i!==void 0?i:a,type:u,name:mS(e),classId:s,position:t,colspan:Lp(e,"colspan",1),rowspan:Lp(e,"rowspan",1),parameters:l,bag:(0,It.projectElementBag)(e),...c?{icProperties:c}:{}}}function fS(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1&&n.tagName.toLowerCase()==="icproperties")return n}}function D4(e){let t=fS(e);return t?(0,It.serializeNode)(t):void 0}function E4(e,t,r){let n=fS(t);if(!r){n&&t.removeChild(n);return}let i=new DOMParser().parseFromString(r,"text/xml").documentElement,a=(0,ro.rebuildRaw)((0,ro.rawFromNode)((0,It.nodeLikeFromDom)(i)),(0,It.domEngine)(e),null);n&&(0,It.serializeNode)(n)===(0,It.serializeNode)(a)||(n?t.replaceChild(a,n):t.appendChild(a))}function mS(e){var t,r;let n=V(e,"labels")[0];if(!n)return"";let i=V(n,"label"),a=(t=i.find(o=>o.getAttribute("languagecode")===String(ml)))!==null&&t!==void 0?t:i[0];return(r=a?.getAttribute("description"))!==null&&r!==void 0?r:""}function I4(e){var t;let r={},n=V(e,"parameters")[0];if(!n)return r;let i=n.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];o.nodeType===1&&(r[o.tagName]=((t=o.textContent)!==null&&t!==void 0?t:"").trim())}return r}function _4(e,t,r){var n;let i=y4.get(e.toUpperCase());return i?i==="chart"?t.ChartGridMode==="Chart"?"chart":"list":i==="assistant"&&((n=r.getAttribute("uniqueid"))!==null&&n!==void 0?n:"").toUpperCase()===C4?"assistant":i:"unknown"}function Lp(e,t,r){var n;let i=parseInt((n=e.getAttribute(t))!==null&&n!==void 0?n:"",10);return Number.isNaN(i)?r:i}function hS(e){return e.replace(/^\{/,"").replace(/\}$/,"")}function P4(e,t){let r={n:"form",a:(0,ro.mergeAttrs)(e.bag.a,[]),c:(0,ro.spliceChildren)(e.bag.c,[])};return(0,ro.rebuildRaw)(r,(0,It.domEngine)(t),null)}function uS(e){let t=new DOMParser().parseFromString("<root/>","text/xml"),r=P4(e,t);return T4(t,r,e.components),O4(t,r,e.components),(0,It.serializeNode)(r)}function O4(e,t,r){let n=gS(t);for(let i of r)n.has(no(i.position))||F4(e,t,i)}function F4(e,t,r){var n,i,a,o;let s=(i=(n=r.position)===null||n===void 0?void 0:n.sectionIndex)!==null&&i!==void 0?i:0,l=M4(t,e,s);for(let $ of V(l,"row"))V($,"cell").some(re=>V(re,"control").length>0)||l.removeChild($);let u=r.classId||er.TILE_CLASS_ID[r.type]||er.TILE_CLASS_ID.iframe,c=r.rowspan&&r.rowspan>0?r.rowspan:4,d=r.bag&&cS(r.bag,"id")?String(cS(r.bag,"id")):fl((0,Cn.newId)()),f=r.id?fl(r.id):fl((0,Cn.newId)()),g=l.parentNode,b=Math.max(1,parseInt(g&&g.getAttribute&&g.getAttribute("columns")||"1",10)||1),w=Math.min(Math.max(1,r.colspan&&r.colspan>0?r.colspan:1),b),N=V(l,"row"),_=N[N.length-1],T=_?V(_,"cell").reduce(($,re)=>$+Lp(re,"colspan",1),0):0;(!_||T+w>b)&&(_=e.createElement("row"),l.appendChild(_));let R=e.createElement("cell");R.setAttribute("id",d),R.setAttribute("colspan",String(w)),R.setAttribute("rowspan",String(c)),R.setAttribute("showlabel","true");let M=e.createElement("labels"),W=e.createElement("label");W.setAttribute("description",(a=r.name)!==null&&a!==void 0?a:""),W.setAttribute("languagecode",String(ml)),M.appendChild(W),R.appendChild(M);let B=e.createElement("control");B.setAttribute("id",f),B.setAttribute("classid",fl(u));let j=e.createElement("parameters"),k=(o=r.parameters)!==null&&o!==void 0?o:{};for(let $ of Object.keys(k)){let re=(0,pS.createSafeXmlElement)(e,$,"dashboard tile parameter");re.textContent=k[$],j.appendChild(re)}B.appendChild(j),R.appendChild(B),_.appendChild(R)}function cS(e,t){if(!e)return;let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function T4(e,t,r){var n;let i=gS(t),a=new Set(r.map(o=>no(o.position)));for(let o of r){let s=i.get(no(o.position));if(!s)continue;let l=V(s,"control")[0];l&&(R4(e,s,o.name),x4(e,l,o.parameters),dS(s,"colspan",o.colspan),dS(s,"rowspan",o.rowspan),o.icProperties!==void 0&&E4(e,l,o.icProperties))}for(let[o,s]of i)a.has(o)||(n=s.parentNode)===null||n===void 0||n.removeChild(s)}function gS(e){let t=new Map;return V(e,"tabs").flatMap(n=>V(n,"tab")).forEach((n,i)=>{V(n,"columns").flatMap(o=>V(o,"column")).forEach((o,s)=>{V(o,"sections").flatMap(u=>V(u,"section")).forEach((u,c)=>{V(u,"rows").flatMap(f=>V(f,"row")).forEach((f,g)=>{V(f,"cell").forEach((b,w)=>{var N;hS((N=b.getAttribute("id"))!==null&&N!==void 0?N:"").toLowerCase().startsWith("spacer")||V(b,"control")[0]&&t.set(no({tabIndex:i,columnIndex:s,sectionIndex:c,rowIndex:g,cellIndex:w}),b)})})})})}),t}function no(e){let t=e??{};return`${t.tabIndex}.${t.columnIndex}.${t.sectionIndex}.${t.rowIndex}.${t.cellIndex}`}function R4(e,t,r){if(r===mS(t))return;let n=V(t,"labels")[0];n||(n=e.createElement("labels"),t.appendChild(n));let i=V(n,"label").find(a=>a.getAttribute("languagecode")===String(ml));i||(i=V(n,"label")[0]),i||(i=e.createElement("label"),i.setAttribute("languagecode",String(ml)),n.appendChild(i)),i.setAttribute("description",r)}function x4(e,t,r){var n;if(!r)return;let i=Object.keys(r);if(i.length===0)return;let a=V(t,"parameters")[0];a||(a=e.createElement("parameters"),t.appendChild(a));let o=new Map,s=a.childNodes;for(let l=0;l<s.length;l+=1){let u=s[l];u.nodeType===1&&o.set(u.tagName,u)}for(let l of i){let u=r[l],c=o.get(l);if(c)((n=c.textContent)!==null&&n!==void 0?n:"")!==u&&(c.textContent=u);else{let d=(0,pS.createSafeXmlElement)(e,l,"dashboard component parameter");d.textContent=u,a.appendChild(d)}}}function dS(e,t,r){var n;((n=e.getAttribute(t))!==null&&n!==void 0?n:"")!==String(r)&&e.setAttribute(t,String(r))}function L4(e=2){let t=`{${(0,Cn.newId)()}}`,r=`{${(0,Cn.newId)()}}`,n=`{${(0,Cn.newId)()}}`,i=Math.max(1,Math.floor(e));return`<form><tabs><tab id="${t}" name="General" showlabel="true" expanded="true" verticallayout="true"><columns><column width="100%"><sections><section id="${r}" name="Section 1" showlabel="false" columns="${i}"><rows><row><cell id="${n}" rowspan="12" colspan="${i}" showlabel="true" /></row></rows></section></sections></column></columns></tab></tabs></form>`}er.TILE_CLASS_ID={chart:"E7A81278-8635-4D9E-8D4D-59480B391C5B",list:"E7A81278-8635-4D9E-8D4D-59480B391C5B",iframe:"FD2A7985-3187-444E-908D-6624B21F69C0",webresource:"9FDF5F91-88B1-47F4-AD53-C11EFC01A01D"};function fl(e){return`{${e.replace(/[{}]/g,"")}}`}function M4(e,t,r){var n;let i=V(e,"tabs").flatMap(u=>V(u,"tab"))[0];if(!i)throw new Error("addDashboardTile: dashboard formxml has no <tab>");let a=V(i,"columns").flatMap(u=>V(u,"column"))[0];if(!a)throw new Error("addDashboardTile: dashboard formxml has no <column>");let o=V(a,"sections").flatMap(u=>V(u,"section")),s=(n=o[r])!==null&&n!==void 0?n:o[0];if(!s)throw new Error("addDashboardTile: dashboard formxml has no <section>");let l=V(s,"rows")[0];return l||(l=t.createElement("rows"),s.appendChild(l)),l}function U4(){return{adapter:new hl,api:b4.dashboardApi}}er.dashboardRegistration=U4});var bS=m(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.buildRegistrations=void 0;var B4=f2(),k4=O2(),q4=yN(),$4=EN(),V4=GN(),G4=aS(),z4=vS();function W4(){let e=new Map;return e.set("form",(0,B4.formRegistration)()),e.set("view",(0,k4.viewRegistration)()),e.set("businessRule",(0,q4.businessRuleRegistration)()),e.set("app",(0,$4.appRegistration)()),e.set("command",(0,V4.commandRegistration)()),e.set("chart",(0,G4.chartRegistration)()),e.set("dashboard",(0,z4.dashboardRegistration)()),e}gl.buildRegistrations=W4});var yS=m(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.cloneJson=void 0;function j4(e){return JSON.parse(JSON.stringify(e))}vl.cloneJson=j4});var IS=m(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.removeRowSummary=Ae.configureRowSummary=Ae.buildGptDynamicPrompt=Ae.setAppAiFeatures=Ae.getAiReadiness=Ae.saveSettingValue=Ae.retrieveSetting=Ae.AI_GATE=void 0;var Ut=$e(),Me=ue(),CS=Ft(),Sr=be();Ae.AI_GATE={formFill:"FormFillBarUXEnabled",nlSearch:"EnableNLGridSearch",nlChart:"NLChartVisualizationSetting",summaries:"EnableFormInsights",m365:"m365copilotmodelappenabled"};var H4={formFill:"FormFillBarUXEnabled",nlSearch:"NLGridSearchSetting",nlChart:"NLChartDataVisualizationSetting",m365:"m365copilotmodelappenabled"},bl=1e6;function J4(e,t){let r=()=>{throw new Sr.InvalidArgumentError(`setAppAiFeatures: '${t}' must be a boolean or an integer between 0 and ${bl} (e.g. 0, 1, 2); got '${String(e)}'.`)};if(typeof e=="boolean")return e?"1":"0";if(typeof e=="number")return!Number.isSafeInteger(e)||e<0||e>bl?r():String(e);if(typeof e=="string"){let n=e.trim(),i=n.toLowerCase();if(i==="true")return"1";if(i==="false")return"0";if(/^[0-9]+$/.test(n)){let a=n.replace(/^0+(?=[0-9])/,"");return a.length>String(bl).length||Number(a)>bl?r():a}}return r()}function Q4(e){return e!=="0"}async function X4(e,t){var r,n,i;let a=`/appmodules${(0,Me.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,Me.odataLiteral)(t)}'`]])}`,o=await e.get(a);return o.status>=200&&o.status<300?(i=((n=(r=o.body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0])===null||i===void 0?void 0:i.appmoduleid:void 0}async function K4(e,t){var r,n;let i=`/appmodules${(0,Me.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,Me.odataLiteral)(t)}'`]])}`,a;try{a=await e.get(i)}catch(l){throw new Sr.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup failed (${l.message}). Retry, or omit appModuleId to verify by name.`)}if(a.status<200||a.status>=300)throw new Sr.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned HTTP ${a.status}. Retry, or omit appModuleId to verify by name.`);let o=(r=a.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(o))throw new Sr.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a malformed body.`);if(o.length===0)return;let s=(n=o[0])===null||n===void 0?void 0:n.appmoduleid;if(!s)throw new Sr.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a row with no appmoduleid.`);return s}var AS=new WeakMap;async function Y4(e,t){var r,n,i;let a=AS.get(e);if(a||(a=new Map,AS.set(e,a)),a.has(t))return a.get(t);let o=`/settingdefinitions${(0,Me.odataQuery)([["$select","settingdefinitionid"],["$filter",`uniquename eq '${(0,Me.odataLiteral)(t)}'`]])}`,s=await e.get(o),l=s.status>=200&&s.status<300?(i=((n=(r=s.body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0])===null||i===void 0?void 0:i.settingdefinitionid:void 0;return l&&a.set(t,l),l}async function Z4(e,t,r){var n,i;let a=await Y4(e,r);if(!t||!a)return;let o=`/appsettings${(0,Me.odataQuery)([["$select","value"],["$filter",`_parentappmoduleid_value eq ${t} and _settingdefinitionid_value eq ${a}`]])}`,s=await e.get(o);if(s.status<200||s.status>=300)return;let l=(i=(n=s.body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[];return l.length>0?{exists:!0,value:l[0].value}:{exists:!1}}var e5=4,t5=500,wS=20,NS=3e4;function r5(e){if(e===void 0)return e5;if(!Number.isFinite(e))throw new Sr.InvalidArgumentError(`setAppAiFeatures: verifyAttempts must be a finite integer between 1 and ${wS}; got ${e}.`);return Math.min(wS,Math.max(1,Math.floor(e)))}function n5(e){if(e===void 0)return t5;if(!Number.isFinite(e))throw new Sr.InvalidArgumentError(`setAppAiFeatures: verifyDelayMs must be a finite number between 0 and ${NS}; got ${e}.`);return Math.min(NS,Math.max(0,Math.floor(e)))}function i5(e){return e>0?new Promise(t=>setTimeout(t,e)):Promise.resolve()}async function a5(e,t,r,n,i,a,o){let s,l,u,c=!1;for(let d=0;d<a;d+=1){d>0&&await i5(o*d);let f;try{let g=await t();g?(f=await Z4(e,g,n),f===void 0&&(u="the app-scope override row could not be read (insufficient access or unresolvable ids)")):u=`the app '${r}' could not be resolved to an appmoduleid \u2014 a newly created app is not readable until it is published, so either publish it first or pass \`appModuleId\` in the options to verify without the lookup`}catch(g){f=void 0,u=g.message}c=f!==void 0,l=f?.exists;try{s=(await yl(e,n,{appUniqueName:r})).value}catch{}if(f?.exists&&f.value===i)return{result:"proven",effectiveValue:f.value,appOverrideExists:!0}}return c?{result:"absent",effectiveValue:s,appOverrideExists:l}:{result:"unverifiable",effectiveValue:s,appOverrideExists:void 0,reason:u}}function SS(e,t){return t===2?String(e).toLowerCase()==="true":e!=null&&e!=="0"&&e!==""}async function yl(e,t,r={}){var n,i;let a=[`SettingName='${(0,Me.odataPathLiteral)(t)}'`];r.appUniqueName&&a.push(`AppUniqueName='${(0,Me.odataPathLiteral)(r.appUniqueName)}'`);let o=`/RetrieveSetting(${a.join(",")})`,l=(i=(n=(0,Ut.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.SettingDetail)!==null&&i!==void 0?i:{};return{value:l.Value,dataType:l.DataType}}Ae.retrieveSetting=yl;async function DS(e,t,r,n={}){let i={SettingName:t,Value:r};n.appUniqueName&&(i.AppUniqueName=n.appUniqueName),n.solutionUniqueName&&(i.SolutionUniqueName=n.solutionUniqueName),(0,Ut.ensureSuccess)(await e.post("/SaveSettingValue",i),e.apiUrl("/SaveSettingValue"))}Ae.saveSettingValue=DS;async function o5(e,t={}){let r={};for(let[n,i]of Object.entries(Ae.AI_GATE)){let{value:a,dataType:o}=await yl(e,i,t);r[n]={enabled:SS(a,o),setting:i,value:a}}return r}Ae.getAiReadiness=o5;async function s5(e,t,r,n={}){var i,a,o;if(!t||!t.trim())throw new Sr.InvalidArgumentError("setAppAiFeatures: a non-empty appUniqueName is required (an empty value would write the setting at organization scope, affecting every app).");let s=r5(n.verifyAttempts),l=n5(n.verifyDelayMs),u=[];for(let[N,_]of Object.entries(r)){if(_===void 0)continue;let T=H4[N];T&&u.push({feature:N,setting:T,requestedValue:J4(_,N)})}let c=[],d=n.appModuleId?(0,Me.normalizeGuid)(n.appModuleId,"appModuleId"):void 0;if(d){let N=await K4(e,t);if(N&&(0,Me.normalizeGuid)(N,"appModuleId")!==d)throw new Sr.InvalidArgumentError(`setAppAiFeatures: appModuleId '${d}' does not belong to app '${t}' (which resolves to '${N}'). Settings are written by unique name, so verifying against a different app would report success for a write that never landed.`)}let f,g=async()=>d||(f||(f=await X4(e,t)),f),b=new Map,w=async N=>{let _=Ae.AI_GATE[N];if(_){if(!b.has(_)){let{value:T,dataType:R}=await yl(e,_);b.set(_,{enabled:SS(T,R),setting:_,value:T})}return b.get(_)}};for(let{feature:N,setting:_,requestedValue:T}of u)try{if(Q4(T)){let W=await w(N);if(!W?.enabled){c.push({feature:N,setting:_,requestedValue:T,status:"skipped",reason:`the org readiness gate '${(i=W?.setting)!==null&&i!==void 0?i:N}' is off, so the feature cannot be enabled for this app`});continue}}await DS(e,_,T,{appUniqueName:t,solutionUniqueName:n.solutionUniqueName});let R=await a5(e,g,t,_,T,s,l),M={feature:N,setting:_,requestedValue:T,effectiveValue:R.effectiveValue,appOverrideExists:R.appOverrideExists};R.result==="proven"?c.push({...M,status:"applied"}):R.result==="absent"?c.push({...M,status:"notPersisted",reason:`the write reported success but no app-scope override holding '${T}' was observed for '${_}' after ${s} attempt(s) \u2014 it reads '${(a=R.effectiveValue)!==null&&a!==void 0?a:""}' for this app (Dataverse can accept an app-scope write without storing it)`}):c.push({...M,status:"unverified",reason:`the write was issued but could not be confirmed: ${(o=R.reason)!==null&&o!==void 0?o:"the app-scope override row could not be read"}. The value may or may not be in force \u2014 verify manually before relying on it.`})}catch(R){c.push({feature:N,setting:_,requestedValue:T,status:"failed",reason:R.message})}return{applied:c.filter(N=>N.status==="applied").map(N=>N.feature),skipped:c.filter(N=>N.status==="skipped").map(N=>N.feature),notPersisted:c.filter(N=>N.status==="notPersisted").map(N=>N.feature),unverified:c.filter(N=>N.status==="unverified").map(N=>N.feature),failed:c.filter(N=>N.status==="failed").map(N=>N.feature),outcomes:c}}Ae.setAppAiFeatures=s5;var l5="GptPowerPrompt",u5='{ "consumptionSource": "Api", "partnerSource": "AIBuilder", "consumptionSourceVersion": "GptApiClient"}';function ES(e){var t,r,n,i;let a=e.entityLogicalName,o=[{type:"literal",text:e.instruction.replace(/\s*$/,"")+" "}];return e.columns.forEach((s,l)=>{o.push({type:"data",id:`${a}.${s.logical}`,text:s.display}),l<e.columns.length-1&&o.push({type:"literal",text:", "})}),{version:"GptDynamicPrompt-2",prompt:o,definitions:{inputs:[{id:"RecordId",text:"RecordId",type:"text"},{id:"LanguageCode",text:"LanguageCode",type:"text"}],formulas:[],data:[{id:a,displayName:a,type:"dataverseTable",filters:[{filterType:"equal",attribute:e.primaryKey,valueType:"inputVariable",value:"RecordId"}]}],output:{formats:[(t=e.outputFormat)!==null&&t!==void 0?t:"text"]}},modelParameters:{modelType:"default",gptParameters:{temperature:(r=e.temperature)!==null&&r!==void 0?r:0}},settings:{recordRetrievalLimit:(n=e.recordRetrievalLimit)!==null&&n!==void 0?n:30,shouldPreserveRecordLinks:null,runtime:null,enableReasoning:(i=e.enableReasoning)!==null&&i!==void 0?i:!0},code:"",signature:""}}Ae.buildGptDynamicPrompt=ES;async function c5(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,Me.odataPathLiteral)(t)}')${(0,Me.odataQuery)([["$select","MetadataId"]])}`;return(n=(r=(0,Ut.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.MetadataId)!==null&&n!==void 0?n:""}async function d5(e,t,r={}){var n,i,a,o,s;let l=`ais_RowSummary_${t.entityLogicalName}`,u=`/aiskillconfigs${(0,Me.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,Me.odataLiteral)(l)}'`],["$top",1]])}`,c=((i=(n=(0,Ut.ensureSuccess)(await e.get(u),e.apiUrl(u)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[])[0];if(c)return{modelId:c._aimodel_value,aiSkillConfigId:c.aiskillconfigid};let d=`/msdyn_aitemplates${(0,Me.odataQuery)([["$select","msdyn_aitemplateid"],["$filter",`msdyn_uniquename eq '${l5}'`],["$top",1]])}`,f=((s=(o=(a=(0,Ut.ensureSuccess)(await e.get(d),e.apiUrl(d)).body)===null||a===void 0?void 0:a.value)===null||o===void 0?void 0:o[0])!==null&&s!==void 0?s:{}).msdyn_aitemplateid,g=(0,CS.newId)(),b=(0,CS.newId)(),w=JSON.stringify(ES(t)),N={ModelId:g,RunConfigurationId:b,ModelName:`${t.entityLogicalName} row summary`,TemplateId:f,CustomConfiguration:w,Source:u5,RunConfiguration:""};(0,Ut.ensureSuccess)(await e.post("/AIModelPublish",N),e.apiUrl("/AIModelPublish"));try{let _=await c5(e,t.entityLogicalName),T={uniquename:l,description:`${t.entityLogicalName} row summary`,"[email protected]":`/entities(${_})`,"[email protected]":`/msdyn_aimodels(${g})`,aiskill:"RowSummary"},R=(0,Ut.ensureSuccess)(await e.post("/aiskillconfigs",T),e.apiUrl("/aiskillconfigs")),M=(0,Ut.requireCreatedId)(R,"aiskillconfigid","row-summary skill");return{modelId:g,aiSkillConfigId:M}}catch(_){try{await e.delete(`/msdyn_aimodels(${g})`)}catch{}throw _}}Ae.configureRowSummary=d5;async function p5(e,t){var r,n;let i=`ais_RowSummary_${t.entityLogicalName}`,a=`/aiskillconfigs${(0,Me.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,Me.odataLiteral)(i)}'`],["$top",1]])}`,o=((n=(r=(0,Ut.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!o)return;let s=`/aiskillconfigs(${o.aiskillconfigid})`;if((0,Ut.ensureSuccess)(await e.delete(s),e.apiUrl(s)),o._aimodel_value){let l=`/msdyn_aimodels(${o._aimodel_value})`;(0,Ut.ensureSuccess)(await e.delete(l),e.apiUrl(l))}}Ae.removeRowSummary=p5});var _S=m(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.findArtifact=Ei.resolveArtifact=void 0;var Ye=ue(),tr=Bi(),f5=be();async function m5(e,t,r){var n,i,a,o,s,l,u,c,d,f,g;switch(t){case"app":{let b=await(0,tr.queryRecords)(e,"appmodule",{select:["appmoduleid","name","appmoduleidunique"],filter:`uniquename eq '${(0,Ye.odataLiteral)((n=r.uniqueName)!==null&&n!==void 0?n:"")}'`,top:1}),w=b&&b[0];return w?[{id:String(w.appmoduleid),name:String(w.name),appModuleIdUnique:String(w.appmoduleidunique)}]:[]}case"dashboard":return(await(0,tr.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,Ye.odataLiteral)((i=r.name)!==null&&i!==void 0?i:"")}' and type eq 0`,top:10})||[]).map(w=>({id:String(w.formid),name:String(w.name)}));case"command":{let b=await(0,tr.queryRecords)(e,"appaction",{select:["appactionid","buttonlabeltext"],filter:`contextvalue eq '${(0,Ye.odataLiteral)((a=r.entity)!==null&&a!==void 0?a:"")}'`,top:1});return b&&b.length?[{id:String(r.entity),entity:String(r.entity)}]:[]}case"form":return(await(0,tr.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,Ye.odataLiteral)((o=r.name)!==null&&o!==void 0?o:"")}' and objecttypecode eq '${(0,Ye.odataLiteral)((s=r.entity)!==null&&s!==void 0?s:"")}'`,top:10})||[]).map(w=>({id:String(w.formid),name:String(w.name)}));case"chart":return(await(0,tr.queryRecords)(e,"savedqueryvisualization",{select:["savedqueryvisualizationid","name"],filter:`name eq '${(0,Ye.odataLiteral)((l=r.name)!==null&&l!==void 0?l:"")}' and primaryentitytypecode eq '${(0,Ye.odataLiteral)((u=r.entity)!==null&&u!==void 0?u:"")}'`,top:10})||[]).map(w=>({id:String(w.savedqueryvisualizationid),name:String(w.name)}));case"view":return(await(0,tr.queryRecords)(e,"savedquery",{select:["savedqueryid","name"],filter:`name eq '${(0,Ye.odataLiteral)((c=r.name)!==null&&c!==void 0?c:"")}' and returnedtypecode eq '${(0,Ye.odataLiteral)((d=r.entity)!==null&&d!==void 0?d:"")}'`,top:10})||[]).map(w=>({id:String(w.savedqueryid),name:String(w.name)}));case"webResource":return(await(0,tr.queryRecords)(e,"webresource",{select:["webresourceid","name"],filter:`name eq '${(0,Ye.odataLiteral)((f=r.name)!==null&&f!==void 0?f:"")}'`,top:1})||[]).map(w=>({id:String(w.webresourceid),name:String(w.name)}));case"solution":return(await(0,tr.queryRecords)(e,"solution",{select:["solutionid","uniquename"],filter:`uniquename eq '${(0,Ye.odataLiteral)((g=r.uniqueName)!==null&&g!==void 0?g:"")}'`,top:1})||[]).map(w=>({id:String(w.solutionid),name:String(w.uniquename)}));default:return[]}}Ei.resolveArtifact=m5;async function h5(e,t,r){var n,i,a,o,s;let l=(0,Ye.odataLiteral)((n=r.name)!==null&&n!==void 0?n:""),u=(0,Ye.odataLiteral)((i=r.entity)!==null&&i!==void 0?i:"");if(t==="command"){let b=await(0,tr.queryRecords)(e,"appaction",{select:["appactionid"],filter:`contextvalue eq '${(0,Ye.odataLiteral)((a=r.entity)!==null&&a!==void 0?a:"")}'`,top:1});return b&&b.length?String(r.entity):null}let c=g5(t,l,u,r),d=t!=="app",f=await(0,tr.queryRecords)(e,c.set,{select:[c.idField],filter:c.filter,top:d?2:1});if(d&&f&&f.length>1)throw new f5.AmbiguousArtifactError(t,(s=(o=r.name)!==null&&o!==void 0?o:r.uniqueName)!==null&&s!==void 0?s:"",f.length);let g=f&&f[0]&&f[0][c.idField];return g!=null?String(g):null}Ei.findArtifact=h5;function g5(e,t,r,n){var i;switch(e){case"view":return{set:"savedquery",idField:"savedqueryid",filter:`returnedtypecode eq '${r}' and name eq '${t}'`};case"chart":return{set:"savedqueryvisualization",idField:"savedqueryvisualizationid",filter:`primaryentitytypecode eq '${r}' and name eq '${t}'`};case"form":return{set:"systemform",idField:"formid",filter:`objecttypecode eq '${r}' and name eq '${t}'`};case"app":return{set:"appmodule",idField:"appmoduleid",filter:`uniquename eq '${(0,Ye.odataLiteral)((i=n.uniqueName)!==null&&i!==void 0?i:"")}'`};case"dashboard":return{set:"systemform",idField:"formid",filter:`name eq '${t}' and type eq 0`};default:throw new Error(`Unsupported findable kind: ${e}`)}}});var OS=m(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.seedRecordGraph=void 0;var PS=Bi(),v5=Co(),Cl=ue(),b5=be();async function y5(e,t,r={}){var n,i,a,o,s;let l=(n=r.createdIds)!==null&&n!==void 0?n:{},u=(i=r.entitySetFor)!==null&&i!==void 0?i:(f=>(0,v5.resolveEntitySetName)(e,f)),c={},d=f=>{var g;return(g=c[f])!==null&&g!==void 0?g:l[f]};for(let f of t){let g=f.entityLogical.toLowerCase(),b=(a=f.matchOn)===null||a===void 0?void 0:a.toLowerCase(),w=[];for(let B of f.records){let j={...B.body};for(let k of(o=B.binds)!==null&&o!==void 0?o:[]){let $=k.parentEntity.toLowerCase(),re=(s=d($))===null||s===void 0?void 0:s[k.parentIndex];if(!re)throw new b5.InvalidArgumentError(`Cannot resolve bind '${k.navProperty}' on a '${g}' record: parent '${k.parentEntity}'[${k.parentIndex}] has no created id. Seed the parent group before the child, or supply it via options.createdIds.`);let H=(0,Cl.assertODataName)(await u($),`entity set for parent '${k.parentEntity}'`),nr=(0,Cl.normalizeGuid)(re,`parent id for bind '${k.navProperty}'`);j[`${k.navProperty}@odata.bind`]=`/${H}(${nr})`}w.push(j)}let N=b?w.map(B=>{let j=B[b];return j!=null&&j!==""?String(j):null}):w.map(()=>null),_=new Map;if(b){let B=(0,Cl.assertODataName)(b,"RecordGraph matchOn key"),j=[...new Set(N.filter(k=>k!==null))];if(j.length){let k=j.map(re=>`${B} eq '${(0,Cl.odataLiteral)(re)}'`).join(" or "),$=await(0,PS.queryRecords)(e,g,{select:[B,`${g}id`],filter:k,top:5e3});for(let re of $??[]){let H=re[B];H!=null&&_.set(String(H).toLowerCase(),String(re[`${g}id`]))}}}let T=[],R=new Map,M=w.map((B,j)=>{let k=N[j];if(k&&_.has(k.toLowerCase()))return null;if(k){let $=k.toLowerCase(),re=R.get($);if(re!==void 0)return re;let H=T.push(B)-1;return R.set($,H),H}return T.push(B)-1}),W=T.length?await(0,PS.createRecordsBulk)(e,g,T):[];c[g]=w.map((B,j)=>{let k=N[j];return k&&_.has(k.toLowerCase())?_.get(k.toLowerCase()):W[M[j]]})}return{createdIds:c}}Al.seedRecordGraph=y5});var kS=m(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.deleteSecurityRole=Pt.createPersonaRole=Pt.createSecurityRole=Pt.SDK_ROLE_MARKER=void 0;var rr=$e(),ke=ue(),_t=be(),FS={read:"Read",create:"Create",write:"Write",delete:"Delete",append:"Append",appendTo:"AppendTo",assign:"Assign",share:"Share"},US={user:"Basic",businessUnit:"Local",parentChild:"Deep",organization:"Global"},TS={user:1,businessUnit:2,parentChild:3,organization:4},C5={user:"CanBeBasic",businessUnit:"CanBeLocal",parentChild:"CanBeDeep",organization:"CanBeGlobal"};Pt.SDK_ROLE_MARKER="Authored by @maker-studio/cds-maker-sdk (persona/security role).";function A5(e){return Object.prototype.hasOwnProperty.call(FS,e)?FS[e]:void 0}function w5(e){return Object.prototype.hasOwnProperty.call(US,e)}var RS=new WeakMap,xS=new WeakMap;async function N5(e,t){var r,n;(0,ke.assertODataName)(t,"entity logical name");let i=RS.get(e);i||(i=new Map,RS.set(e,i));let a=i.get(t);if(a)return a;let o=`/EntityDefinitions(LogicalName='${(0,ke.odataPathLiteral)(t)}')${(0,ke.odataQuery)([["$select","LogicalName,Privileges"]])}`,l=(n=(r=(0,rr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||r===void 0?void 0:r.Privileges)!==null&&n!==void 0?n:[];if(l.length===0)throw new _t.InvalidArgumentError(`Entity '${t}' exposes no privileges (unknown or non-securable entity).`);return i.set(t,l),l}async function S5(e){var t,r,n;let i=xS.get(e);if(i)return i;let a=`/businessunits${(0,ke.odataQuery)([["$select","businessunitid"],["$filter","_parentbusinessunitid_value eq null"],["$top",1]])}`,l=(n=((r=(t=(0,rr.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||t===void 0?void 0:t.value)!==null&&r!==void 0?r:[])[0])===null||n===void 0?void 0:n.businessunitid;if(!l)throw new _t.InvalidArgumentError("Could not resolve the root business unit.");let u=(0,ke.normalizeGuid)(l,"businessUnitId");return xS.set(e,u),u}async function D5(e,t){var r;let n=new Map;for(let i of t){if(!i.access||i.access.length===0)throw new _t.InvalidArgumentError(`Entity '${i.entity}' privilege request has no access levels.`);let a=(r=i.scope)!==null&&r!==void 0?r:"user";if(!w5(a))throw new _t.InvalidArgumentError(`Unknown privilege scope '${a}' for entity '${i.entity}'.`);let o=await N5(e,i.entity);for(let s of i.access){let l=A5(s);if(!l)throw new _t.InvalidArgumentError(`Unknown access level '${s}' for entity '${i.entity}'.`);let u=o.find(b=>b.PrivilegeType===l);if(!u)throw new _t.InvalidArgumentError(`Entity '${i.entity}' does not support '${s}' access.`);let c=C5[a];if(u[c]===!1)throw new _t.InvalidArgumentError(`Privilege '${u.Name}' on '${i.entity}' does not support the '${a}' scope.`);let d=(0,ke.normalizeGuid)(u.PrivilegeId,"PrivilegeId"),f=n.get(d);if(!f){n.set(d,{privilegeName:u.Name,privilegeType:l,scope:a,entities:new Set([i.entity])});continue}if(f.scope===a){f.entities.add(i.entity);continue}if(!(f.entities.size===1&&f.entities.has(i.entity))){let b=[...f.entities].sort().join(", ");throw new _t.InvalidArgumentError(`Entities '${b}' and '${i.entity}' share the Dataverse privilege '${u.Name}' but request different scopes; a role holds one depth per privilege. Use the same scope for all entities that share this privilege, or split them.`)}f.scope=TS[a]>TS[f.scope]?a:f.scope}}return[...n.entries()].map(([i,a])=>({entity:[...a.entities].sort().join(", "),privilegeId:i,privilegeName:a.privilegeName,privilegeType:a.privilegeType,scope:a.scope}))}async function E5(e,t,r,n){if(r.length===0&&!n)return;let i={Privileges:r.map(o=>({Depth:US[o.scope],PrivilegeId:o.privilegeId}))},a=`/roles(${t})/Microsoft.Dynamics.CRM.ReplacePrivilegesRole`;(0,rr.ensureSuccess)(await e.post(a,i),e.apiUrl(a))}async function LS(e,t,r,n,i){var a,o;let s=`/${t}(${r})/${n}${(0,ke.odataQuery)([["$select","roleid"],["$filter",`roleid eq ${i}`]])}`;return((o=(a=(0,rr.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||a===void 0?void 0:a.value)!==null&&o!==void 0?o:[]).length>0}async function I5(e,t,r){var n,i;let a=[],o=[],s={"@odata.id":e.apiUrl(`/roles(${t})`)};for(let l of(n=r?.teams)!==null&&n!==void 0?n:[]){let u=(0,ke.normalizeGuid)(l,"teamId");if(!await LS(e,"teams",u,"teamroles_association",t)){let c=`/teams(${u})/teamroles_association/$ref`;(0,rr.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}a.push(u)}for(let l of(i=r?.users)!==null&&i!==void 0?i:[]){let u=(0,ke.normalizeGuid)(l,"userId");if(!await LS(e,"systemusers",u,"systemuserroles_association",t)){let c=`/systemusers(${u})/systemuserroles_association/$ref`;(0,rr.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}o.push(u)}return{teams:a,users:o}}async function MS(e,t,r){var n,i;let a=`/roles${(0,ke.odataQuery)([["$select","roleid,description,ismanaged"],["$filter",`name eq '${(0,ke.odataLiteral)(t)}' and _businessunitid_value eq ${r}`]])}`,l=((i=(n=(0,rr.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]).filter(d=>!!d.roleid);if(l.length===0)return;let u=d=>{var f;return d.ismanaged!==!0&&((f=d.description)!==null&&f!==void 0?f:"")===Pt.SDK_ROLE_MARKER};if(l.some(d=>!u(d)))throw new _t.InvalidArgumentError(`A role named '${t}' already exists in this business unit and was not created by the SDK; refusing to modify or assign it. Choose a different persona/role name.`);if(l.length>1)throw new _t.InvalidArgumentError(`Multiple (${l.length}) SDK-owned roles named '${t}' exist in this business unit; refusing to reuse one arbitrarily. Remove the duplicate role(s) and retry.`);let c=l[0].roleid;return c?(0,ke.normalizeGuid)(c,"roleId"):void 0}function _5(e){var t,r;return{teams:((t=e?.teams)!==null&&t!==void 0?t:[]).map(n=>(0,ke.normalizeGuid)(n,"teamId")),users:((r=e?.users)!==null&&r!==void 0?r:[]).map(n=>(0,ke.normalizeGuid)(n,"userId"))}}function P5(e){return e.map(t=>({entity:t.entity,privilegeName:t.privilegeName,privilegeType:t.privilegeType,scope:t.scope}))}async function BS(e,t){var r,n;let i=(r=t.name)===null||r===void 0?void 0:r.trim();if(!i)throw new _t.InvalidArgumentError("createSecurityRole: a non-empty role name is required.");let a=t.businessUnitId?(0,ke.normalizeGuid)(t.businessUnitId,"businessUnitId"):await S5(e),o=await D5(e,(n=t.privileges)!==null&&n!==void 0?n:[]),s=_5(t.assignTo),l=await MS(e,i,a),u=l!==void 0;if(!l){let d="/roles",f={name:i,description:Pt.SDK_ROLE_MARKER,"[email protected]":`/businessunits(${a})`};try{let g=(0,rr.ensureSuccess)(await e.post(d,f),e.apiUrl(d));l=(0,ke.normalizeGuid)((0,rr.requireCreatedId)(g,"roleid","role"),"roleId")}catch(g){let b;try{b=await MS(e,i,a)}catch{b=void 0}if(!b)throw g;l=b}}await E5(e,l,o,u);let c=await I5(e,l,s);return{roleId:l,name:i,reused:u,appliedPrivileges:P5(o),assignedTeams:c.teams,assignedUsers:c.users}}Pt.createSecurityRole=BS;async function O5(e,t){var r,n;let i=(r=t.persona)===null||r===void 0?void 0:r.trim();if(!i)throw new _t.InvalidArgumentError("createPersonaRole: a non-empty persona name is required.");let a=[...t.jobs.flatMap(o=>{var s;return(s=o.privileges)!==null&&s!==void 0?s:[]}),...(n=t.additionalPrivileges)!==null&&n!==void 0?n:[]];return BS(e,{name:i,businessUnitId:t.businessUnitId,privileges:a,assignTo:t.assignTo})}Pt.createPersonaRole=O5;async function F5(e,t){let n=`/roles(${(0,ke.normalizeGuid)(t,"roleId")})`;(0,rr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Pt.deleteSecurityRole=F5});var VS=m(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.createMakerSdk=Pi.MakerSdk=void 0;var qe=be(),Dr=lo(),T5=qp(),R5=Gp(),x5=Xp(),L5=gf(),Mp=Af(),Ze=Co(),Er=Bi(),wl=_f(),et=Pf(),M5=nh(),U5=bS(),B5=fn(),k5=Ft(),An=yS(),Wr=$e(),Ii=ue(),_i=IS(),qS=_S(),q5=OS(),$5=Wd(),Up=kS(),Nl=class{constructor(t){(0,B5.installDomShim)(),this.workspace=new R5.WorkspaceManager(t.workspacePath,t.instanceUrl),this.versions=new x5.VersionManager(this.workspace),this.dataverse=new L5.DataverseClient(t.instanceUrl,t.httpClient,t.solutionUniqueName),this.registrations=(0,U5.buildRegistrations)()}initWorkspace(){this.workspace.init()}getManifest(){return this.workspace.getManifest()}cleanWorkspace(){this.workspace.clean()}async fetchArtifact(t,r){let n=this.requireRegistration(t,"fetchArtifact"),{raw:i,etag:a}=await n.api.get(this.dataverse,r),o=n.adapter.fromApiResponse(i);return this.workspace.writeArtifact(t,r,o),this.versions.storeMeta(t,r,{etag:a,fetchedAt:(0,Wr.nowIso)(),snapshot:(0,An.cloneJson)(o)}),(0,An.cloneJson)(o)}async fetchArtifactList(t,r){return this.requireRegistration(t,"fetchArtifactList").api.list(this.dataverse,r)}async fetchSolution(t){var r;let n=await(0,et.fetchSolutionComponents)(this.dataverse,t),i=[],a=[];for(let o of n)try{let s=await this.resolveComponentType(o);if(!s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"unsupported"});continue}let l=await this.fetchArtifact(s,o.objectId);i.push({type:s,id:o.objectId,name:typeof l.name=="string"?l.name:(r=o.displayName)!==null&&r!==void 0?r:o.objectId,entityLogicalName:typeof l.entityLogicalName=="string"?l.entityLogicalName:void 0,lastFetched:(0,Wr.nowIso)(),isDirty:!1})}catch(s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"failed",error:$S(s)})}return this.workspace.updateManifest({lastSyncAt:(0,Wr.nowIso)()}),{summaries:i,skipped:a}}async fetchEntityMetadata(t){let r=await(0,Mp.fetchEntityMetadataFromApi)(this.dataverse,t);return this.workspace.writeEntityMetadata(t,r),r}findTables(t,r){return(0,Mp.findTables)(this.dataverse,t,r)}findColumns(t,r,n){return(0,Mp.findColumns)(this.dataverse,t,r,n)}createTable(t){return(0,Ze.createTable)(this.dataverse,t)}createColumn(t,r){return(0,Ze.createColumn)(this.dataverse,t,r)}updateColumn(t,r,n){return(0,Ze.updateColumn)(this.dataverse,t,r,n)}deleteColumn(t,r){return(0,Ze.deleteColumn)(this.dataverse,t,r)}createCustomerColumn(t,r){return(0,Ze.createCustomerColumn)(this.dataverse,t,r)}insertStatusValue(t,r){return(0,Ze.insertStatusValue)(this.dataverse,t,r)}updateTable(t,r){return(0,Ze.updateTable)(this.dataverse,t,r)}async setEntityIcon(t,r){if(await(0,Ze.updateTable)(this.dataverse,t,{iconVectorName:r.vector,iconSmallName:r.small,iconMediumName:r.medium,iconLargeName:r.large}),r.publish!==!1){let n=`<importexportxml><entities><entity>${(0,Ii.xmlText)(t)}</entity></entities></importexportxml>`;(0,Wr.ensureSuccess)(await this.dataverse.post("/PublishXml",{ParameterXml:n}),this.dataverse.apiUrl("/PublishXml"))}}createAlternateKey(t,r){return(0,Ze.createAlternateKey)(this.dataverse,t,r)}deleteAlternateKey(t,r){return(0,Ze.deleteAlternateKey)(this.dataverse,t,r)}createRelationship(t){return(0,Ze.createRelationship)(this.dataverse,t)}deleteRelationship(t){return(0,Ze.deleteRelationship)(this.dataverse,t)}createGlobalOptionSet(t){return(0,Ze.createGlobalOptionSet)(this.dataverse,t)}deleteGlobalOptionSet(t){return(0,Ze.deleteGlobalOptionSet)(this.dataverse,t)}deleteTable(t){return(0,Ze.deleteTable)(this.dataverse,t)}createSecurityRole(t){return(0,Up.createSecurityRole)(this.dataverse,t)}createPersonaRole(t){return(0,Up.createPersonaRole)(this.dataverse,t)}deleteSecurityRole(t){return(0,Up.deleteSecurityRole)(this.dataverse,t)}createRecord(t,r){return(0,Er.createRecord)(this.dataverse,t,r)}createRecordsBulk(t,r){return(0,Er.createRecordsBulk)(this.dataverse,t,r)}updateRecord(t,r,n){return(0,Er.updateRecord)(this.dataverse,t,r,n)}upsertRecord(t,r,n){return(0,Er.upsertRecord)(this.dataverse,t,r,n)}deleteRecord(t,r){return(0,Er.deleteRecord)(this.dataverse,t,r)}getRecord(t,r,n){return(0,Er.getRecord)(this.dataverse,t,r,n)}queryRecords(t,r){return(0,Er.queryRecords)(this.dataverse,t,r)}seedRecordGraph(t,r){return(0,q5.seedRecordGraph)(this.dataverse,t,r)}resolveArtifact(t,r){return(0,qS.resolveArtifact)(this.dataverse,t,r)}findArtifact(t,r){return(0,qS.findArtifact)(this.dataverse,t,r)}async deleteAppCascade(t,r){let n=await(0,M5.deleteAppCascade)(this.dataverse,t,r),i=(0,Ii.normalizeGuid)(t,"appModuleId");return this.workspace.readArtifact("app",i)&&this.workspace.deleteArtifact("app",i),n}associateRecords(t,r,n){return(0,Er.associateRecords)(this.dataverse,t,r,n)}disassociateRecords(t,r,n,i){return(0,Er.disassociateRecords)(this.dataverse,t,r,n,i)}createWebResource(t){return(0,wl.createWebResource)(this.dataverse,t)}updateWebResource(t,r){return(0,wl.updateWebResource)(this.dataverse,t,r)}getWebResource(t){return(0,wl.getWebResource)(this.dataverse,t)}deleteWebResource(t){return(0,wl.deleteWebResource)(this.dataverse,t)}getSolution(t){return(0,et.getSolution)(this.dataverse,t)}createPublisher(t){return(0,et.createPublisher)(this.dataverse,t)}createSolution(t){return(0,et.createSolution)(this.dataverse,t)}setSolutionVersion(t,r){return(0,et.setSolutionVersion)(this.dataverse,t,r)}addSolutionComponent(t){return(0,et.addSolutionComponent)(this.dataverse,t)}removeSolutionComponent(t,r,n){return(0,et.removeSolutionComponent)(this.dataverse,t,r,n)}exportSolution(t){return(0,et.exportSolution)(this.dataverse,t)}importSolution(t){return(0,et.importSolution)(this.dataverse,t)}deleteSolution(t){return(0,et.deleteSolution)(this.dataverse,t)}getArtifact(t,r){return(0,An.cloneJson)(this.readRaw(t,r))}readRaw(t,r){let n=this.workspace.readArtifact(t,r);if(!n)throw new qe.ArtifactNotFoundError(t,r);return n}queryTree(t,r,n){let i=this.getArtifact(t,r),a=Dr.JsonPointer.resolve(i,n);if(a===void 0)throw new qe.PathNotFoundError(t,r,n);return a}findElements(t,r,n){let i=this.getArtifact(t,r);return(0,T5.findElements)(i,n)}listArtifacts(t,r){return this.workspace.listArtifacts(t,r).map(n=>({...n,isDirty:this.versions.isDirty(n.type,n.id)}))}getEntityMetadata(t){let r=this.workspace.readEntityMetadata(t);if(!r)throw new qe.ArtifactNotFoundError("entityMetadata",t);return r}getFieldMetadata(t,r){let i=this.getEntityMetadata(t).attributes.find(a=>a.logicalName===r);if(!i)throw new qe.PathNotFoundError("entityMetadata",t,r);return i}updateElement(t,r,n,i){let a=this.readRaw(t,r),o=Dr.JsonPointer.resolve(a,n);if(o===void 0)throw new qe.PathNotFoundError(t,r,n);let s=Sl(o)&&Sl(i)?{...o,...i}:i;return Dr.JsonPointer.set(a,n,(0,An.cloneJson)(s)),this.assertStructurallyValid(t,r,a,n),this.workspace.writeArtifact(t,r,a),this.getArtifact(t,r)}addElement(t,r,n,i,a){let o=this.readRaw(t,r),s=Dr.JsonPointer.resolve(o,n);if(s===void 0)throw new qe.PathNotFoundError(t,r,n);if(!Array.isArray(s))throw new qe.ValidationError(t,r,n,"parent must be an array");let l=this.assignMissingIds(t,(0,An.cloneJson)(i)),u=z5(s,a?.position);return s.splice(u,0,l),this.assertStructurallyValid(t,r,o,n),this.workspace.writeArtifact(t,r,o),this.getArtifact(t,r)}moveElement(t,r,n,i,a){var o;let s=this.readRaw(t,r),l=Dr.JsonPointer.resolve(s,n);if(l===void 0)throw new qe.PathNotFoundError(t,r,n);let u=Dr.JsonPointer.resolve(s,i);if(u===void 0)throw new qe.PathNotFoundError(t,r,i);if(!Array.isArray(u))throw new qe.ValidationError(t,r,i,"move target must be an array");if(i===n||i.startsWith(`${n}/`))throw new qe.ValidationError(t,r,i,"cannot move an element into its own subtree");Dr.JsonPointer.remove(s,n);let c=(o=a?.index)!==null&&o!==void 0?o:u.length;return u.splice(Math.max(0,Math.min(c,u.length)),0,l),this.assertStructurallyValid(t,r,s,i),this.workspace.writeArtifact(t,r,s),this.getArtifact(t,r)}removeElement(t,r,n){let i=this.readRaw(t,r);if(Dr.JsonPointer.resolve(i,n)===void 0)throw new qe.PathNotFoundError(t,r,n);return Dr.JsonPointer.remove(i,n),this.assertStructurallyValid(t,r,i,G5(n)),this.workspace.writeArtifact(t,r,i),this.getArtifact(t,r)}assertStructurallyValid(t,r,n,i){var a,o,s;let l=this.registrations.get(t),u=(s=(o=l==null?void 0:(a=l.adapter).validate)===null||o===void 0?void 0:o.call(a,n,i))!==null&&s!==void 0?s:[];if(u.length>0)throw new qe.ValidationError(t,r,u)}retrieveSetting(t,r){return(0,_i.retrieveSetting)(this.dataverse,t,r)}saveSettingValue(t,r,n){return(0,_i.saveSettingValue)(this.dataverse,t,r,n)}getAiReadiness(t){return(0,_i.getAiReadiness)(this.dataverse,t)}setAppAiFeatures(t,r,n){return(0,_i.setAppAiFeatures)(this.dataverse,t,r,n)}configureRowSummary(t,r){return(0,_i.configureRowSummary)(this.dataverse,t,r)}removeRowSummary(t){return(0,_i.removeRowSummary)(this.dataverse,t)}async enrichDefaultViews(t,r,n={}){let i=await(0,$5.findDefaultViews)(this.dataverse,t,n);for(let a of i)await this.fetchArtifact("view",a.id),this.updateElement("view",a.id,"/columns",r),await this.pushArtifact("view",a.id);return i.length&&await this.publishArtifact("view",i[0].id),{updated:i.map(a=>a.id)}}createArtifact(t,r){let n=this.requireRegistration(t,"createArtifact"),i=n.adapter.assignMissingIds(n.adapter.createDefault(r)),a=i.id;if(!a)throw new qe.ValidationError(t,"(new)","/id","created artifact must have an id");return this.workspace.writeArtifact(t,a,i),(0,An.cloneJson)(i)}deleteArtifact(t,r){this.workspace.deleteArtifact(t,r)}async deleteRemoteArtifact(t,r){await this.requireRegistration(t,"deleteRemoteArtifact").api.delete(this.dataverse,r),this.workspace.readArtifact(t,r)&&this.workspace.deleteArtifact(t,r)}async publishArtifact(t,r){let n=this.readRaw(t,r),i;if(t==="app")i=`<importexportxml><appmodules><appmodule>${(0,Ii.xmlText)(r)}</appmodule></appmodules></importexportxml>`;else{let a=n.entityLogicalName;a&&(i=`<importexportxml><entities><entity>${(0,Ii.xmlText)(a)}</entity></entities></importexportxml>`)}i&&(0,Wr.ensureSuccess)(await this.dataverse.post("/PublishXml",{ParameterXml:i}),this.dataverse.apiUrl("/PublishXml"))}async pushArtifact(t,r){var n;let i=this.requireRegistration(t,"pushArtifact"),a=this.readRaw(t,r),o=this.versions.getMeta(t,r),s=await this.buildMetadataContext(i.adapter,a),l=i.adapter.toApiPayload(a,o?.snapshot,s);try{let u=o?await i.api.update(this.dataverse,r,l,o.etag):await i.api.create(this.dataverse,l),c=r;return o||(u.serverIdentity&&i.adapter.applyServerIdentity&&i.adapter.applyServerIdentity(a,u.serverIdentity),u.id&&u.id!==r&&(a.id=u.id,this.workspace.deleteArtifact(t,r),c=u.id),this.workspace.writeArtifact(t,c,a)),this.versions.storeMeta(t,c,{etag:u.etag,fetchedAt:(0,Wr.nowIso)(),snapshot:(0,An.cloneJson)(a)}),{type:t,id:c,success:!0,...u.warnings&&u.warnings.length>0?{warnings:u.warnings}:{}}}catch(u){if(u instanceof qe.SdkError&&u.code===Wr.VERSION_CONFLICT_CODE)return{type:t,id:r,success:!1,error:new qe.VersionConflictError(t,r,(n=o?.etag)!==null&&n!==void 0?n:null,null)};throw u}}async buildMetadataContext(t,r){var n,i;let a=(i=(n=t.metadataNeeds)===null||n===void 0?void 0:n.call(t,r))!==null&&i!==void 0?i:[];if(a.length===0)return;let o=new Set(a.map(s=>s.entityLogicalName).filter(s=>!!s));for(let s of o)if(!this.workspace.readEntityMetadata(s))try{await this.fetchEntityMetadata(s)}catch{}return{resolveField:(s,l)=>{let u=this.workspace.readEntityMetadata(s),c=u?.attributes.find(d=>d.logicalName===l);return c?{displayName:c.displayName,attributeType:c.attributeType}:void 0}}}async pushAll(){let t=this.getDirtyArtifacts(),r=[];for(let n of t)try{r.push(await this.pushArtifact(n.type,n.id))}catch(i){r.push({type:n.type,id:n.id,success:!1,error:$S(i)})}return r}getDirtyArtifacts(){return this.workspace.listArtifacts().filter(t=>this.versions.isDirty(t.type,t.id)).map(t=>({...t,isDirty:!0}))}diffArtifact(t,r){return this.versions.diff(t,r)}assignMissingIds(t,r){let n=this.registrations.get(t);return n?n.adapter.assignMissingIds(r):(0,k5.assignMissingIds)(r)}async resolveComponentType(t){switch(t.componentType){case et.SolutionComponentType.SavedQuery:return"view";case et.SolutionComponentType.SavedQueryVisualization:return"chart";case et.SolutionComponentType.AppModule:return"app";case et.SolutionComponentType.Workflow:return t.workflowCategory===2?"businessRule":void 0;case et.SolutionComponentType.SystemForm:return await this.isDashboardForm(t.objectId)?"dashboard":"form";default:return}}async isDashboardForm(t){let n=`/systemforms(${(0,Ii.normalizeGuid)(t,"formId")})${(0,Ii.odataQuery)([["$select","type"]])}`,i=(0,Wr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n)),a=Number(i.body.type);return a===0||a===10}requireRegistration(t,r){let n=this.registrations.get(t);if(!n)throw new qe.NotImplementedError(r,`no adapter registered for artifact type '${t}'`);return n}};Pi.MakerSdk=Nl;function V5(e){return new Nl(e)}Pi.createMakerSdk=V5;function $S(e){return e instanceof Error?e:new Error(String(e))}function Sl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function G5(e){let t=e.lastIndexOf("/");return t<=0?"":e.slice(0,t)}function z5(e,t){if(t===void 0||t==="end")return e.length;if(t==="start")return 0;if("index"in t)return Math.max(0,Math.min(t.index,e.length));if("before"in t){let n=e.findIndex(i=>Sl(i)&&i.id===t.before);return n<0?e.length:n}let r=e.findIndex(n=>Sl(n)&&n.id===t.after);return r<0?e.length:r+1}});var GS=m(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.ARTIFACT_TYPES=void 0;Dl.ARTIFACT_TYPES=["form","view","businessRule","app","command","chart","dashboard"]});var WS=m(zS=>{"use strict";Object.defineProperty(zS,"__esModule",{value:!0})});var HS=m(jS=>{"use strict";Object.defineProperty(jS,"__esModule",{value:!0})});var QS=m(JS=>{"use strict";Object.defineProperty(JS,"__esModule",{value:!0})});var KS=m(XS=>{"use strict";Object.defineProperty(XS,"__esModule",{value:!0})});var ZS=m(YS=>{"use strict";Object.defineProperty(YS,"__esModule",{value:!0})});var tD=m(eD=>{"use strict";Object.defineProperty(eD,"__esModule",{value:!0})});var nD=m(rD=>{"use strict";Object.defineProperty(rD,"__esModule",{value:!0})});var aD=m(iD=>{"use strict";Object.defineProperty(iD,"__esModule",{value:!0})});var sD=m(oD=>{"use strict";Object.defineProperty(oD,"__esModule",{value:!0})});var uD=m(lD=>{"use strict";Object.defineProperty(lD,"__esModule",{value:!0})});var dD=m(cD=>{"use strict";Object.defineProperty(cD,"__esModule",{value:!0})});var fD=m(pD=>{"use strict";Object.defineProperty(pD,"__esModule",{value:!0})});var hD=m(mD=>{"use strict";Object.defineProperty(mD,"__esModule",{value:!0})});var vD=m(gD=>{"use strict";Object.defineProperty(gD,"__esModule",{value:!0})});var yD=m(bD=>{"use strict";Object.defineProperty(bD,"__esModule",{value:!0})});var AD=m(CD=>{"use strict";Object.defineProperty(CD,"__esModule",{value:!0})});var ND=m(wD=>{"use strict";Object.defineProperty(wD,"__esModule",{value:!0})});var DD=m(SD=>{"use strict";Object.defineProperty(SD,"__esModule",{value:!0})});var W5=exports&&exports.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),we=exports&&exports.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&W5(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0});exports.createMakerSdk=void 0;var j5=VS();Object.defineProperty(exports,"createMakerSdk",{enumerable:!0,get:function(){return j5.createMakerSdk}});we(GS(),exports);we(WS(),exports);we(HS(),exports);we(QS(),exports);we(KS(),exports);we(ZS(),exports);we(tD(),exports);we(nD(),exports);we(aD(),exports);we(sD(),exports);we(uD(),exports);we(dD(),exports);we(fD(),exports);we(hD(),exports);we(vD(),exports);we(yD(),exports);we(AD(),exports);we(ND(),exports);we(DD(),exports);we(be(),exports);diff --git a/plugins/model-apps/scripts/verify-model-app.js b/plugins/model-apps/scripts/verify-model-app.jsindex 2c9e616f9..9feaa6865 100644--- a/plugins/model-apps/scripts/verify-model-app.js+++ b/plugins/model-apps/scripts/verify-model-app.js@@ -89,6 +89,12 @@ function readerFor(sdk, appUnique, opts) {const items = await sdk.resolveArtifact('command', { entity: String(entity).toLowerCase() });return !!(items && items[0] && items[0].id);},+ // retrieveSetting(name, { appUniqueName }): the EFFECTIVE app-scoped value of a Dataverse setting,+ // for the AI app-feature reconcile. Wired here (not in the pure core) so the reader stays injectable+ // and existence-only callers skip the check entirely. Errors PROPAGATE: verifySpec catches them per+ // feature and reports the read failure as a not-present check, which is the fail-closed direction —+ // a verify that cannot prove a feature is in effect must not claim it is.+ retrieveSetting: async (name, opts) => sdk.retrieveSetting(name, opts || {}),// sitemapXml (string, fail-closed '') for entity/icon hasElement checks — from the discriminated sitemap// read. Returning '' on failure suppresses entity/icon checks without aborting the whole verify.sitemapXml: async () => { const r = await memoSitemap(); return r.ok ? r.xml : ''; },diff --git a/plugins/model-apps/skills/genpage/SKILL.md b/plugins/model-apps/skills/genpage/SKILL.mdindex b586182a3..5b3b66439 100644--- a/plugins/model-apps/skills/genpage/SKILL.md+++ b/plugins/model-apps/skills/genpage/SKILL.md@@ -272,7 +272,7 @@ The entity-builder reads `Solution` and `Publisher Prefix` directly from theplan's `## Environment` — no need to re-thread them here.Wait for completion. The builder writes a transactional log at-`<working-dir>/entity-creation-log.md` for recovery on failure.+`<working-dir>/genpage-entity-creation-log.md` for recovery on failure.### Phase 3: App Creation/Selection