Skip to content

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.

model-apps 2.9.0: lifecycle safety, form-layout and verify correctness, SDK uptake (#608)

Akshay Maloo63a812ac2517
diff --git a/plugins/model-apps/.claude-plugin/plugin.json b/plugins/model-apps/.claude-plugin/plugin.json
index d277ee2aa..8c24c0350 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.8.0",
+ "version": "2.9.0",
"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.10.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.json
index d277ee2aa..8c24c0350 100644
--- a/plugins/model-apps/.plugin/plugin.json
+++ b/plugins/model-apps/.plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "model-apps",
- "version": "2.8.0",
+ "version": "2.9.0",
"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.10.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.md
index 26cae262d..a9fed88e4 100644
--- a/plugins/model-apps/AGENTS.md
+++ b/plugins/model-apps/AGENTS.md
@@ -334,10 +334,14 @@ the pipeline and delegates each script's **behavioral spec** to the entries belo
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
+ delete it cannot prove is rejected rather than guessed. Each row's delete is conditioned on its
+ **row** token from a by-id read, not the unpublished-aware read's content token, which runs ahead
+ of the row while a sitemap edit is unpublished (that made such an app impossible to tear down —
+ 412 every time). 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
+ that file for the wire contract, why a `$batch` is never retried, and why a conditional write that
+ gets no answer is never re-sent). 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-in
@@ -893,13 +897,12 @@ repo-root `shared/telemetry/`; `scripts/lib/telemetry/lib` is a **physical copy*
(CI-enforced: `node scripts/validate-telemetry-ikeys.js`).
- **Emission:** `hooks/run-skill-pretool-telemetry.js` (PreToolUse Skill) and
`hooks/run-user-prompt-telemetry.js` (UserPromptSubmit `/model-apps:<skill>`).
-- **Privacy:** default-on usage telemetry. Events include Dataverse organization
- and Entra tenant GUIDs when PAC is signed in, but Model Apps excludes the
- signed-in user's Entra object ID. The local diagnostic mirror retains the same
- event fields. Users opt out of transmission via
- `/model-apps:telemetry off`; the local diagnostic mirror
- (`~/.power-platform-skills/telemetry/model-apps/sessions/<id>/events.jsonl`) is
- still written. CI/automation opt out via
+- **Privacy:** while `disabled: true` nothing is built, sent or mirrored (see Posture). Once
+ enabled, telemetry is default-on: events can include Dataverse organization and Entra tenant GUIDs
+ when PAC is signed in, never the signed-in user's Entra object ID, and the local diagnostic mirror
+ (`~/.power-platform-skills/telemetry/model-apps/sessions/<id>/events.jsonl`) retains the same
+ fields — it is still written after a user opts out of transmission via
+ `/model-apps:telemetry off`. CI/automation opt out via
`POWER_PLATFORM_SKILLS_TELEMETRY_MODEL_APPS_OPTOUT=1` (highest precedence).
- **Fail closed:** telemetry never changes a script's exit code; emission is
fire-and-forget via a detached dispatcher child. See `shared/telemetry/README.md`.
@@ -1051,7 +1054,8 @@ node plugins/model-apps/scripts/_vendor-build/build.js --sdk /path/to/power-plat
Only the SDK `src/` is committed in the SDK repo (`lib/` is gitignored). A type-only/whitespace SDK
edit produces a byte-identical `lib/*.js`, so the bundle only needs rebuilding when SDK **runtime**
-changes.
+changes. **Never patch the bundle** to work around an SDK defect: the next re-vendor silently
+reverts it and the hash in `PROVENANCE.json` stops matching. Fix it upstream and re-vendor.
**Vendored-SDK contract invariants (regression net).** When you bump the SDK and re-vendor, the
skill relies on behaviors that must survive. Four test files lock them — run all against every
@@ -1146,6 +1150,13 @@ that keeps an `external` web resource. Expect a clean environment afterwards *ex
`<prefix>publisher`; if a probe must restore the environment exactly, remove that row yourself after
confirming it owns no other solution.
+**`appmodulecomponent` rows also survive an app delete, and teardown deliberately leaves them** — this
+has been re-reported as a teardown bug and re-measured. The platform exposes no way to remove them:
+the table registers only `Retrieve`/`RetrieveMultiple` (a direct `DELETE` 400s), and
+`RemoveAppComponents` returns `204` while removing nothing as long as the app exists, then `404`s once
+it is gone. Calling it would report a cleanup that never happened. The rows are unreachable metadata
+that a rebuild neither adopts nor trips over; revisit only if the platform adds a delete or a cascade.
+
**After modifying the plugin also:** run `claude --debug` to confirm the plugin loads, exercise the
skill (`/genpage` or `/app-builder`), and for genpage verify Playwright browser checks
(navigate/snapshot/click/screenshot).
diff --git a/plugins/model-apps/CHANGELOG.md b/plugins/model-apps/CHANGELOG.md
index be89aa539..fce029b81 100644
--- a/plugins/model-apps/CHANGELOG.md
+++ b/plugins/model-apps/CHANGELOG.md
@@ -5,7 +5,7 @@ All notable changes to the **model-apps** plugin.
Entries are deliberately short: what changed and why it matters to you. The reasoning,
evidence and trade-offs behind a change live in its PR, in `docs/`, or in the linked issue.
-## [Unreleased] — 2.8.0
+## [Unreleased] — 2.9.0
A dry run that says what an apply would really do, sample data that can express a hierarchy, and
downloads that round-trip Choice columns.
@@ -29,6 +29,35 @@ downloads that round-trip Choice columns.
### Fixed
+- **A page NAME can no longer forge the page listing.** The "Found N pages" summary was matched
+ anywhere in pac's output, so a page called `Found 1 generated page` made a listing with no real
+ summary read as authoritative — and a truncated-but-authoritative listing is what drives a
+ duplicate page create. The whole line must be the summary, so a name that merely *starts* with it
+ is rejected too.
+- **A malformed page id is refused instead of stored.** The old pattern accepted 36 characters from
+ an alphabet containing `-`, so a row of dashes passed and an over-long id was silently *truncated*
+ into a plausible one. Any identifier character following the id now disqualifies it, not just a
+ hex digit. An unparsable id goes through the existing uncertain-create recovery.
+- **A sample-data row that is not an object is rejected up front.** `null` crashed, a string became
+ `{"0":"a","1":"b"}` and a number became `{}` — all after tables, forms and views had deployed.
+ Both provisioning entry points share one gate; `provision-entities` previously checked only that
+ the value was an array.
+- **A failed PAC command reports what PAC actually said.** The real error was replaced by the last
+ line of the help dump that follows it, and a deterministic failure (a bad argument, a missing file)
+ was retried three times before reporting anything — on an ordinary page update it still was, since
+ the stop condition only covered creates.
+- **A path ending in `\` no longer swallows the flags after it** on Windows, where a trailing
+ backslash escaped its own closing quote.
+- **A crashed browser-automation server reports failure**, instead of exiting 0 because the process
+ was killed by a signal rather than by its own choice.
+- **`generate-page-manifest --force` never writes outside the working directory or through a link.**
+ A `package.json` that is a symlink (even a dangling one) or a hard link is refused, and so is a
+ working directory that is itself a link or junction; a linked ancestor is still followed. A file is
+ replaced atomically and keeps its file mode, and a read-only one is refused rather than replaced.
+- **`--clear-workspace` refuses a UNC/network path**, which could otherwise block on an unreachable
+ share with no way to interrupt it. A mapped drive is unaffected.
+- **A transient discovery failure no longer certifies a `--changed-only` baseline as fresh**, which
+ could let a later page edit skip a full build it actually needed.
- **An explicit form layout reshapes a form instead of flattening it** ([#575]). Every field was
appended to the first section, containers were never created or resized, and declaring `tabs`
silently switched pruning on. Containers now match by `name`, then `label`, then position, and a
@@ -36,14 +65,29 @@ downloads that round-trip Choice columns.
- **A section emptied by a layout move is reclaimed** instead of surviving as a blank twin.
- **A field added or moved on an existing form packs to the section's grid**, so the same spec no
longer produces a different form depending on whether the form already existed.
-- **Cell spans converge on an existing form, and are clamped where they are written.** A declared
- span reaches the deployed cell; an undeclared one is still never sent, so a cell widened by hand
- survives. `rowspan` is rejected unless it is the last field in its section ([#581]).
+- **Cell spans converge on an existing form, and are clamped against the grid that is really
+ deployed.** A declared span reaches the deployed cell; an undeclared one is still never sent, so a
+ cell widened by hand survives. Clamping used the grid the spec compiled to rather than the live
+ one, so an auto layout could narrow a maker's four-column cell to one; and narrowing a section
+ left an over-wide cell behind, unchanged on the next apply too. `rowspan` is rejected unless it is
+ inline on the last field in its section ([#581]), and a form-level `fieldOptions` span is now
+ validated too instead of a bad value being dropped.
+- **Re-flowing a section no longer breaks a maker's row-spanning layout.** Once a field follows a
+ `rowspan`, re-flowing by reading order moved it into the reserved slot. Such a section now keeps
+ its grid when the rows cannot follow a narrowing, a span change that would overflow its row is
+ skipped, and a `rowspan` is never raised on a deployed cell that other cells follow. Trailing spans
+ (the stock-form shape) re-flow normally. Every refusal is reported and recorded in the build
+ result's `skipped.layout`.
- **A form field can be narrowed again.** An explicit `colspan`/`rowspan` of `1` was
indistinguishable from omitting it, so changing `2` back to `1` never reached the form.
- **Widening a field on a deployed form re-packs its row.** The span was patched in place but the
row was not re-packed, leaving three columns of content in a two-column section. Displaced fields
move down rather than to the bottom of the section; a span that still fits writes nothing.
+- **`--verify` judges widths and spans by the build's own rule.** It used to derive them separately:
+ a too-narrow section could excuse its own span (`columns: 4, colspan: 4` arriving as 1 and 1
+ verified PASS), while a section that omits `columns`, a QuickCreate section, or a span set through
+ `fieldOptions` was misjudged. Verify now uses the compiler's width and field-option rules, and it
+ counts the slot a row-spanning cell reserves beneath it, so a full row under a `rowspan` fails.
- **`--verify` no longer fails a reshape the build performed correctly.** The build reuses deployed
containers and deliberately does not rename them (form scripts and business rules reference
section names), but verify looked them up by the authored name — so a section it had just reused
@@ -124,8 +168,19 @@ downloads that round-trip Choice columns.
reapplied, and that is now said out loud.
- **A test file in a `scripts/tests/` subdirectory is no longer silently skipped.**
- **The vendored SDK is refreshed** for upstream wire-correctness fixes (view joins, `addElement`
- re-keying, dashboard parsing, duplicate sort attributes, BPF `If-Match`). Measured against the
- previous bundle, none of it changes this plugin's output today — it removes latent hazards.
+ re-keying, dashboard parsing, duplicate sort attributes, a flow left disabled when an edit fails)
+ and a patched `@xmldom/xmldom` (0.8.15, parser denial-of-service fixes). Two change what you see:
+ **an app whose sitemap has an unpublished edit can now be torn down** — the delete carried a token
+ the platform refuses while an edit is pending, so it failed with 412 every time — and **each write
+ in a business process flow's create is conditioned on the token the previous write returned**, so
+ a concurrent edit is refused rather than activated or overwritten.
+- **A slow write is waited for, not abandoned and re-sent.** Writes now get up to 5 minutes (reads
+ keep 60 s), and a conditional write that gets no answer is reported rather than re-sent: it may
+ still commit, and a re-send could only be refused as a false version conflict. Activating a
+ business process flow on a newly created table can take longer than the old 60 s.
+- **An `already-exists` halt names the step that clears it.** A plain re-run keeps the workspace copy
+ that was never recorded as pushed and halts again; the message now says to delete `.maker-workspace`
+ first.
### Changed
diff --git a/plugins/model-apps/README.md b/plugins/model-apps/README.md
index 7e34f8311..65ccfea81 100644
--- a/plugins/model-apps/README.md
+++ b/plugins/model-apps/README.md
@@ -202,10 +202,10 @@ export MODEL_APPS_DISABLE_HOOKS=1
## Telemetry
model-apps ships opt-out usage telemetry (1DS). The committed config ships
-**disabled** (`disabled: true`) — it emits nothing until go-live, even though it now
+**disabled** (`disabled: true`) — until go-live it builds, sends and mirrors nothing, even though it now
carries the provisioned model-apps key + stream (staged, not yet enabled). `disabled:
true` is the active guard; the placeholder-key check is only a secondary guard for
-un-provisioned copies. Once enabled it is **on by default** (you opt out).
+un-provisioned copies. Once enabled it is **on by default** (you opt out), and then:
- **What's collected:** skill name, plugin/PAC/agent versions, OS/Node versions,
session/correlation IDs, and Dataverse organization and Entra tenant GUIDs when
diff --git a/plugins/model-apps/docs/app-builder-capabilities.md b/plugins/model-apps/docs/app-builder-capabilities.md
index f32883813..0af4a2ea2 100644
--- a/plugins/model-apps/docs/app-builder-capabilities.md
+++ b/plugins/model-apps/docs/app-builder-capabilities.md
@@ -192,9 +192,18 @@ apart deliberately.
- Additive on rebuild (matched by `entity` + `name`, reused if present, Active/Draft state converged
in both directions, and re-added to the solution on every run so a failed component add is repaired
rather than inherited); torn down with the app, deactivate-then-delete, before its table. Deleting
- an activated flow cascades a **backing-table** drop and regularly runs past the client's 60s HTTP
- timeout, so teardown polls the row rather than reporting a failure for work the server completed.
+ an activated flow cascades a **backing-table** drop that used to run past the client's 60 s HTTP
+ timeout; writes now wait up to 5 minutes, and teardown still polls the row rather than reporting a
+ failure for work the server completed if even that is exceeded.
A new `business-process-flows` build phase sits next to `business-rules` (16 now).
+- **Each write in a flow's create is conditioned on the token the previous write returned** (vendored
+ SDK): the create echoes its token, the activation is sent only on it, and a rollback deletes only on
+ a token the create produced — so a concurrent edit is refused, never activated or deleted. This
+ exposed a transport hazard, found live: activating a flow on a table created seconds earlier ran
+ past the old 60 s wait, the activation committed anyway, and the transport's re-send was refused as
+ a version conflict, failing the build. Writes now wait up to 5 minutes and a conditional write that
+ gets no answer is never re-sent (`scripts/lib/sdk-http-client.js`); a fresh build of that app then
+ passed live.
- **The derived unique name is a TABLE name, and it is guarded on both sides.** Dataverse stores the
flow as `new_<name lower-cased, non-alphanumerics stripped>` — the derivation ignores the table
*and* the solution's publisher prefix — and activation creates an org-owned backing table with that
@@ -235,7 +244,8 @@ apart deliberately.
### Teardown — ✅ verified live
- `teardown-model-app.js` deletes exactly what an App Spec declares, in dependency-safe order (app → dashboards → commands → business rules → business process flows → forms → **security roles** → charts → views → relationships → AI row summaries → tables [children-first] → web-resources → global choices → solution). Forms/charts/views/relationships are removed **before** tables (a table delete doesn't reliably cascade cross-references); **web resources are removed AFTER tables** (a table's icon web resource is referenced by the table). A business rule / business process flow is deactivated before it is deleted, because Dataverse refuses to delete an activated process.
-- **Classifier-safe** (every id resolved from a spec-declared name via an exact-match, entity-scoped filter), dry-run by default, best-effort continue, not-found aware, undeletable (system/managed) artifacts recorded as `skipped`. A **restricted system solution** (`Active`/`Default`/`Basic`) is skipped rather than attempted (Dataverse 400s any delete of one), so a downloaded spec that defaulted its solution to `Default` tears down cleanly. An already-gone relationship (Dataverse 400 *"…but 0 were found"*) is tolerated as deleted, like the table not-found case.
+- **Classifier-safe** (every id resolved from a spec-declared name via an exact-match, entity-scoped filter), dry-run by default, best-effort continue, not-found aware, undeletable (system/managed) artifacts recorded as `skipped`. A **restricted system solution** (`Active`/`Default`/`Basic`) is skipped rather than attempted (Dataverse 400s any delete of one), so a downloaded spec that defaulted its solution to `Default` tears down cleanly. An already-gone relationship (Dataverse 400 *"…but 0 were found"*) is tolerated as deleted, like the table not-found case.
+- **An app whose sitemap carries an unpublished edit tears down cleanly.** A sitemap has two tokens: the unpublished-aware read returns a *content* token that runs ahead of the row while an edit is pending, and Dataverse validates `If-Match` against the *row*. The vendored SDK now conditions each delete on the row token from a by-id read. Live-verified on the same pending-edit app: the previous bundle's teardown failed with 412 on the delete `$batch`; this one deleted everything, and an independent query confirmed every row gone.
### Tooling & internals — ✅ verified live
- ASCII **form wireframe** preview (`preview-form.js`); phase-grouped build log with per-step status glyphs (`✓`/`⊘`/`✗`) + a closing summary.
diff --git a/plugins/model-apps/references/app-spec-schema.md b/plugins/model-apps/references/app-spec-schema.md
index b1ebb4ee5..694a5f91a 100644
--- a/plugins/model-apps/references/app-spec-schema.md
+++ b/plugins/model-apps/references/app-spec-schema.md
@@ -715,6 +715,20 @@ requires emitting an empty *spacer* cell to occupy the reserved slot, which the
correctly; the compiler does not emit one yet. The restriction can be lifted once it does — tracked
in [#581](https://github.com/microsoft/power-platform-skills/issues/581).
+A **deployed** `rowspan` — one a maker added by hand, which the authored restriction above cannot
+prevent — can make the rows of a section positionally meaningful in the same way: once any cell
+**follows** a row-spanning cell, re-flowing the section by reading order could move that cell into
+the reserved slot. In such a section the build therefore never re-flows. Narrowing its grid is
+applied only when every row already fits the new width; otherwise the section **keeps its current
+grid** and the refusal is reported. A span change that would overflow a row there is skipped (and
+reported), rather than applied without the re-flow. Likewise a `rowspan` is never **raised** on a
+deployed cell that other cells follow, even when its row still fits: the build keeps a field where
+the form already has it, so the field you list last is not necessarily last on the form. A section
+whose row spans are all **trailing** — stock Main forms put `rowspan` on the last cell — re-flows
+normally, because nothing comes after the span to land in its reservation. Every refusal is also
+recorded in the build result (`skipped.layout`), and `--verify` reports the divergence for an
+explicit layout.
+
**Editing an existing form.** An explicit layout is converged onto the deployed form rather than
flattened into its first section: missing tabs, form-columns and sections are **created**, a
section's `columns`/`label`/`showLabel`/`visible` are **updated in place**, and a field sitting in
@@ -742,7 +756,7 @@ reorder a subset without re-declaring every other field.
### Per-field control options — `readOnly`, `hidden`, `after`
-A form field can carry three per-control options. Declare them **form-level** in `fieldOptions`
+A form field can carry these per-control options. Declare them **form-level** in `fieldOptions`
(keyed by column logical name) — the only route under an `auto` layout, which has no field list —
or **inline** on an explicit layout's `fields[]` entry as `{ "name": …, "readOnly": …, "hidden": … }`.
Where both apply to one field the inline entry wins; a plain string entry keeps working unchanged.
@@ -760,6 +774,12 @@ Where both apply to one field the inline entry wins; a plain string entry keeps
Two anchor shapes are **rejected**, because neither has a satisfiable answer: only **one** field may
sit immediately after a given anchor (to place several in sequence, *chain* them — anchor the second
after the first), and anchors may not form a **cycle**.
+- **`colspan: <n>`** widens the control to `n` of its section's columns (a whole number ≥ 1, clamped
+ to the section's width) — the same key an inline entry takes. An `auto` layout generates a
+ one-column section (two columns once it holds more than six fields), so there a wider span only
+ takes effect up to that width — or on a deployed form whose section is wider (a stock Main form
+ the build reconciles). **`rowspan`** above 1 is accepted **inline only**, on the last field of a
+ section: a form-level option cannot see where its field lands, so it is rejected there.
**Only the enabled state is ever written.** The build emits `readOnly`/`hidden` when you ask for
them and writes *nothing* when you do not, so a rebuild never clears a lock or a hide someone applied
diff --git a/plugins/model-apps/scripts/generate-page-manifest.js b/plugins/model-apps/scripts/generate-page-manifest.js
index d5077c4be..630be131f 100644
--- a/plugins/model-apps/scripts/generate-page-manifest.js
+++ b/plugins/model-apps/scripts/generate-page-manifest.js
@@ -35,6 +35,7 @@
const fs = require('node:fs');
const path = require('node:path');
+const crypto = require('node:crypto');
const {
RUNTIME_DEPENDENCIES,
DEV_DEPENDENCIES,
@@ -194,14 +195,165 @@ declare global {
`;
}
-function writeIfAllowed(filePath, content, force) {
- if (fs.existsSync(filePath) && !force) {
+// Windows can refuse a rename while another process briefly holds the destination — Defender, the
+// search indexer and OneDrive all open a just-written file — and reports it as EPERM/EACCES/EBUSY.
+// MEASURED: with `package.json` open in another program without delete-sharing, the rename failed
+// with EPERM where an in-place write would have succeeded. A SHORT bounded retry absorbs the
+// transient scanner case (graceful-fs retries renames on win32 for the same reason); a lock that
+// outlasts it is reported as what it almost certainly is, so the user knows what to do.
+const RENAME_RETRY_MS = [25, 50, 100, 200, 400];
+const RENAME_LOCK_CODES = new Set(['EPERM', 'EACCES', 'EBUSY']);
+function sleepSync(ms) {
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
+}
+function renameWithRetry(from, to) {
+ for (let i = 0; ; i += 1) {
+ try {
+ fs.renameSync(from, to);
+ return;
+ } catch (err) {
+ if (process.platform !== 'win32' || !RENAME_LOCK_CODES.has(err.code) || i >= RENAME_RETRY_MS.length) throw err;
+ sleepSync(RENAME_RETRY_MS[i]);
+ }
+ }
+}
+
+function writeIfAllowed(filePath, content, force, approvedRoot) {
+ if (typeof approvedRoot !== 'string' || !approvedRoot) {
+ // Fail CLOSED, with the same code as every other refusal: without a root there is nothing to
+ // confine the write to, so it must not happen.
+ const e = new Error(`refusing to write ${filePath}: no approved root was given to confine it to`);
+ e.code = 'UNSAFE_OUTPUT';
+ throw e;
+ }
+ // Output confinement. Each part closes a hole a previous shape left open; a partial version of
+ // this check is worse than none, because it reads as a guarantee it does not give.
+ //
+ // WHAT IS GUARANTEED: the file is written at the location the working directory resolves to, and
+ // never through a link or into a file this tool does not own. `approvedRoot` is the realpath of
+ // the working directory taken at startup; `main` refuses a working directory that is ITSELF a link
+ // (a pre-planted link at the path a caller creates would redirect the whole run), while a linked
+ // ANCESTOR is followed by design — macOS temp directories live under a symlinked `/var`, and a
+ // junctioned project root is a normal setup.
+ //
+ // 1. RESOLVE WHERE THE WRITE WILL LAND. `realpath` the parent (the file itself may not exist yet)
+ // and require it to still be the approved root: this is what catches the working directory
+ // being swapped for a link AFTER startup. Every later operation uses this `resolved` path, never
+ // the lexical one, so the location that was checked is the location that is written.
+ const dir = path.dirname(filePath);
+ let realDir;
+ try {
+ realDir = fs.realpathSync(dir);
+ } catch (err) {
+ const e = new Error(`refusing to write ${filePath}: its directory could not be resolved (${err.code || err.message})`);
+ e.code = 'UNSAFE_OUTPUT';
+ throw e;
+ }
+ // `realpath` succeeds on a REGULAR FILE — it only resolves links, it does not assert a kind. So a
+ // parent that is a file (or a link to one) passes resolution and the escape is caught only by the
+ // write failing, which is an I/O error rather than a safety refusal. MEASURED on Windows, where
+ // `lstat` of a child under a file reports ENOENT rather than ENOTDIR, so the fail-closed probe
+ // below never sees it either. Prove the parent is a directory here instead.
+ let dirSt;
+ try {
+ dirSt = fs.statSync(realDir);
+ } catch (err) {
+ const e = new Error(`refusing to write ${filePath}: its directory could not be inspected (${err.code || err.message})`);
+ e.code = 'UNSAFE_OUTPUT';
+ throw e;
+ }
+ if (!dirSt.isDirectory()) {
+ const e = new Error(`refusing to write ${filePath}: ${realDir} is not a directory`);
+ e.code = 'UNSAFE_OUTPUT';
+ throw e;
+ }
+ const resolved = path.join(realDir, path.basename(filePath));
+ const rel = path.relative(approvedRoot, resolved);
+ if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) {
+ const e = new Error(`refusing to write ${filePath}: it resolves to ${resolved}, outside the working directory ${approvedRoot}`);
+ e.code = 'UNSAFE_OUTPUT';
+ throw e;
+ }
+
+ // 2. PROBE THE LINK, NOT THE TARGET, AND FAIL CLOSED. `existsSync` FOLLOWS symlinks, so a DANGLING
+ // link — one whose target does not exist yet — reported "nothing here", skipped every check and
+ // `writeFileSync` then CREATED the file at the outside target. MEASURED: a `package.json`
+ // symlinked to a non-existent path outside the working directory was created there, which is
+ // worse than the overwrite this guard was first written for.
+ // Only ENOENT means "genuinely nothing there". Swallowing every error made EACCES/ENOTDIR — a
+ // probe that could not determine safety — indistinguishable from a clear slot, so the write
+ // proceeded on exactly the inputs least understood.
+ let st = null;
+ try {
+ st = fs.lstatSync(resolved);
+ } catch (err) {
+ if (err.code !== 'ENOENT') {
+ const e = new Error(`refusing to write ${filePath}: it could not be inspected (${err.code || err.message})`);
+ e.code = 'UNSAFE_OUTPUT';
+ throw e;
+ }
+ }
+
+ // Without --force nothing that exists is written, whatever it is — so it is simply skipped. The
+ // refusals below apply only to a write that would really happen; checking them first made a
+ // hard-linked `package.json` abort a plain run, which then never wrote `genpage.d.ts` either.
+ if (st && !force) {
return { wrote: false, reason: 'exists (use --force to overwrite)' };
}
+
+ if (st && !st.isFile()) {
+ // `--force` may overwrite the file this tool OWNS, never whatever that name points at. A symlink,
+ // directory or special file is not ours, whether its target exists or not.
+ const kind = st.isSymbolicLink() ? 'symlink' : st.isDirectory() ? 'directory' : 'special file';
+ const e = new Error(`refusing to overwrite ${filePath}: it is not a regular file (${kind})`);
+ e.code = 'UNSAFE_OUTPUT';
+ throw e;
+ }
+
+ // 3. HARD LINKS. A hard link is a regular file and passes `isFile()`, but the inode is shared, so
+ // writing through it edits the outside file just as surely as a symlink would. A file this tool
+ // owns has exactly one name.
+ if (st && st.nlink > 1) {
+ const e = new Error(`refusing to overwrite ${filePath}: it is a hard link (${st.nlink} names share this file)`);
+ e.code = 'UNSAFE_OUTPUT';
+ throw e;
+ }
+
+ // A read-only file is a deliberate "do not modify". The in-place write this replaced refused it
+ // (EACCES); a rename would silently replace it, because replacing a directory entry needs write
+ // access to the DIRECTORY, not the file. Keep the old answer.
+ if (st && !(st.mode & 0o200)) {
+ const e = new Error(`refusing to overwrite ${filePath}: it is read-only`);
+ e.code = 'IO_ERROR';
+ throw e;
+ }
+
+ // 4. ATOMIC REPLACE. The checks above describe the past: anything that can write this directory can
+ // swap a symlink in between `lstat` and the write, and `writeFileSync` would follow it. Writing
+ // a fresh temp file and RENAMING over the target replaces the directory ENTRY, so a link
+ // installed after the checks is discarded rather than followed.
+ // The temp name is unique per call, and `wx` fails rather than reuse a name someone else
+ // created — in which case that file is NOT ours to delete. A replaced file keeps its permission
+ // bits (a rename would otherwise hand it the temp file's); a new one gets the process default.
+ const tmp = path.join(realDir, `.${path.basename(filePath)}.${process.pid}.${crypto.randomBytes(4).toString('hex')}.tmp`);
+ let createdTmp = false;
try {
- fs.writeFileSync(filePath, content);
+ // Owned from the moment the exclusive open succeeds, not when the write returns: a write that
+ // fails after the open (ENOSPC, EDQUOT, EIO) leaves the file behind, and fs.writeFileSync closes
+ // it without removing it — so waiting for the write stranded a temp file on every failed run.
+ const fd = fs.openSync(tmp, 'wx');
+ createdTmp = true;
+ try { fs.writeFileSync(fd, content); } finally { fs.closeSync(fd); }
+ if (st) fs.chmodSync(tmp, st.mode & 0o777);
+ renameWithRetry(tmp, resolved);
} catch (err) {
- const e = new Error(`failed to write ${filePath}: ${err.message}`);
+ if (createdTmp) {
+ try { fs.unlinkSync(tmp); } catch { /* already renamed, or removed by someone else */ }
+ }
+ const locked = process.platform === 'win32' && RENAME_LOCK_CODES.has(err.code);
+ const e = new Error(locked
+ ? `failed to write ${filePath}: it could not be replaced (${err.code}) — another program may have it open. Close it and retry.`
+ : `failed to write ${filePath}: ${err.message}`);
e.code = 'IO_ERROR';
throw e;
}
@@ -220,15 +372,28 @@ function main() {
const workingDir = path.resolve(args.positional[0]);
const slug = args.positional[1];
+ // The root every output is confined to: the working directory's realpath, taken ONCE here and
+ // re-checked at write time (see writeIfAllowed). The working directory ITSELF must not be a link.
+ // Callers create this directory (`mkdir -p <folder>`), and `mkdir -p` succeeds silently on a
+ // symlink or junction that is already there — so a link pre-planted at that path would redirect
+ // every write the run makes, with `--force` overwriting whatever it points at. A linked ANCESTOR
+ // is still followed: that is a normal setup (macOS temp dirs sit under a symlinked `/var`), not a
+ // redirect of the directory the caller named.
+ let approvedRoot;
try {
if (!fs.existsSync(workingDir)) {
console.error(`error: working directory does not exist: ${workingDir}`);
process.exit(2);
}
+ if (fs.lstatSync(workingDir).isSymbolicLink()) {
+ console.error(`error: refusing to use ${workingDir} as the working directory: it is a symbolic link or junction. Pass the directory it points to if that is intended.`);
+ process.exit(2);
+ }
if (!fs.statSync(workingDir).isDirectory()) {
console.error(`error: not a directory: ${workingDir}`);
process.exit(2);
}
+ approvedRoot = fs.realpathSync(workingDir);
} catch (err) {
console.error(`error: failed to stat working directory: ${err.message}`);
process.exit(2);
@@ -244,10 +409,10 @@ function main() {
try {
const pkg = buildPackageJson(slug, args.features);
const pkgPath = path.join(workingDir, 'package.json');
- pkgResult = writeIfAllowed(pkgPath, JSON.stringify(pkg, null, 2) + '\n', args.force);
+ pkgResult = writeIfAllowed(pkgPath, JSON.stringify(pkg, null, 2) + '\n', args.force, approvedRoot);
const dtsPath = path.join(workingDir, 'genpage.d.ts');
- dtsResult = writeIfAllowed(dtsPath, buildAmbientDeclarations(), args.force);
+ dtsResult = writeIfAllowed(dtsPath, buildAmbientDeclarations(), args.force, approvedRoot);
} catch (err) {
console.error(`error: ${err.message}`);
process.exit(2);
@@ -271,6 +436,9 @@ module.exports = {
parseArgs,
buildPackageJson,
buildAmbientDeclarations,
+ // Exported for the output-confinement tests: `--force` must overwrite the file this tool owns,
+ // never whatever a symlink at that name points at.
+ writeIfAllowed,
RUNTIME_DEPENDENCIES,
DEV_DEPENDENCIES,
};
diff --git a/plugins/model-apps/scripts/launch-playwright-mcp.js b/plugins/model-apps/scripts/launch-playwright-mcp.js
index 3582ddb4a..0af8c1f30 100644
--- a/plugins/model-apps/scripts/launch-playwright-mcp.js
+++ b/plugins/model-apps/scripts/launch-playwright-mcp.js
@@ -6,6 +6,7 @@
// Self-contained — no external dependencies required.
const { spawn } = require('child_process');
+const os = require('os');
const path = require('path');
const { detectBrowser } = require('./lib/detect-browser');
@@ -40,7 +41,22 @@ function buildMcpArgs(browser, {
function launch({
browser = detectBrowser(),
spawnFn = spawn,
- onExit = (code) => process.exit(code || 0),
+ // Node passes (code, signal): on a SIGNAL termination `code` is null and `signal` is e.g.
+ // 'SIGTERM'/'SIGSEGV'. `code || 0` therefore turned every crash and every kill into exit 0, so an
+ // MCP host saw a server that had died as one that had shut down cleanly.
+ //
+ // The shell convention for a signal death is 128 + signum, which keeps the cause visible in the
+ // exit status instead of flattening it to a bare 1. An unknown signal name still exits non-zero.
+ onExit = (code, signal) => {
+ if (signal) {
+ process.stderr.write(`playwright-mcp terminated by signal ${signal}\n`);
+ // `return` is not redundant: `process.exit` is injectable/stubbable in tests, and without it
+ // the clean-exit line below also runs and reports 0 — the very outcome this guards against.
+ process.exit(128 + (os.constants.signals[signal] || 0));
+ return;
+ }
+ process.exit(code || 0);
+ },
onError = (err) => {
// `spawn` emits 'error' (not 'exit') when npx itself can't be launched
// (ENOENT, EACCES, ...). Without a handler Node throws the error as an
diff --git a/plugins/model-apps/scripts/lib/app-spec.js b/plugins/model-apps/scripts/lib/app-spec.js
index f4576e6a2..52ddf40f9 100644
--- a/plugins/model-apps/scripts/lib/app-spec.js
+++ b/plugins/model-apps/scripts/lib/app-spec.js
@@ -1491,7 +1491,7 @@ function validateFormFieldOptions(f, entityByLower, errors, warnings) {
for (const key of Object.keys(f.fieldOptions)) {
const v = f.fieldOptions[key];
if (!v || typeof v !== 'object' || Array.isArray(v)) {
- errors.push(`${label}: fieldOptions['${key}'] must be an object { readOnly?, hidden?, after? }`);
+ errors.push(`${label}: fieldOptions['${key}'] must be an object { readOnly?, hidden?, after?, colspan? }`);
continue;
}
seen.push({ name: String(key).toLowerCase(), opt: v, where: `fieldOptions['${key}']`, inline: false });
@@ -1500,6 +1500,25 @@ function validateFormFieldOptions(f, entityByLower, errors, warnings) {
}
for (const { name, opt, where, inline } of seen) {
+ // A form-level span reaches the compiler exactly as an inline one does (mergeFieldOptions), so it
+ // gets the same whole-number check. Inline entries are already checked by the layout validator;
+ // before this, a `fieldOptions` `colspan: 0` or `"abc"` was dropped in silence.
+ if (!inline) {
+ for (const key of ['colspan', 'rowspan']) {
+ const n = opt[key];
+ if (n === undefined) continue;
+ if (!Number.isInteger(n) || n < 1) {
+ errors.push(`${label}: ${where} has ${key} '${n}' — it must be a whole number of ${key === 'colspan' ? 'columns' : 'rows'}, 1 or greater`);
+ } else if (key === 'rowspan' && n > 1) {
+ // A row-spanning cell is only safe as the LAST cell of its section (the trailing rule in
+ // the layout validator). A form-level option cannot see where its field lands — an auto
+ // layout picks the order, and adding a column later can make a trailing span non-trailing —
+ // so the compiler would emit a reservation directly above the next field. Measured: under
+ // an auto layout `fieldOptions: { new_a: { rowspan: 2 } }` compiled new_a[r2] above new_b.
+ errors.push(`${label}: ${where} sets rowspan ${n}, which only an explicit layout can place safely — declare it inline on the LAST field of its section, as { "name": "${name}", "rowspan": ${n} }.`);
+ }
+ }
+ }
for (const flag of ['readOnly', 'hidden']) {
if (opt[flag] === undefined) continue;
if (typeof opt[flag] !== 'boolean') {
@@ -1592,6 +1611,30 @@ function validateFormFieldOptions(f, entityByLower, errors, warnings) {
}
}
+// Every sample-data row must be a real record object. The seeder spreads each row into a column map,
+// and JS spreads a non-object into something plausible rather than failing, so these reached
+// Dataverse as garbage instead of being rejected up front (MEASURED):
+// null → TypeError at Object.keys — a raw crash, not a diagnosable spec error
+// 'abc' → { "0":"a", "1":"b", "2":"c" } — index-keyed "columns"
+// 42/true → {} — an empty record, silently seeded
+// ['x'] → { "0":"x" } — same index-keyed shape
+// An array is rejected explicitly because `typeof [] === 'object'`.
+//
+// SHARED deliberately. There are TWO public provisioning entry points — `validateAppSpec` (the
+// app-builder path) and `validateProvisionInput` (the provision-entities CLI) — and both seed through
+// the same `provisionSampleData`. Gating only one left the other crashing on `null` and coercing
+// primitives, AFTER the solution and data model had already been written. One rule, one place.
+function validateSampleDataRows(entityKey, records, errors) {
+ if (!Array.isArray(records)) return errors;
+ records.forEach((rec, i) => {
+ if (rec === null || typeof rec !== 'object' || Array.isArray(rec)) {
+ errors.push(`sampleData['${entityKey}'][${i}] must be an object mapping column names to values, got `
+ + `${rec === null ? 'null' : Array.isArray(rec) ? 'an array' : typeof rec}`);
+ }
+ });
+ return errors;
+}
+
function validateAppSpec(spec, opts = {}) {
const profile = opts.profile || 'deploy';
const errors = [];
@@ -2757,6 +2800,9 @@ function validateAppSpec(spec, opts = {}) {
errors.push(`sampleData['${k}'] must be an array of records`);
continue;
}
+ // Every row must be a real record object — rejected here, before anything deploys. The
+ // measured failure modes and why this is shared are on validateSampleDataRows.
+ validateSampleDataRows(k, v, errors);
// #4: catch Choice/MultiChoice sample values that are NOT a declared option label. Unknown
// labels otherwise pass through resolveChoiceValue() unchanged and reach Dataverse as a raw
// string, which either 400s late in the build or (for a MultiChoice) is silently wrong — a
@@ -3371,6 +3417,7 @@ module.exports = {
generatedSectionName,
formColumnsOf,
validateAppSpec,
+ validateSampleDataRows,
normalizePageSource,
normalizeLanguageCode,
validateChoiceOptionLabels,
diff --git a/plugins/model-apps/scripts/lib/artifact-intent.js b/plugins/model-apps/scripts/lib/artifact-intent.js
index e65cdbe80..16cf3118e 100644
--- a/plugins/model-apps/scripts/lib/artifact-intent.js
+++ b/plugins/model-apps/scripts/lib/artifact-intent.js
@@ -59,12 +59,18 @@ function rowsFromCells(cells, columns) {
}
// The clamp has to reach the EMITTED cell, not just the row arithmetic. Packing a `colspan: 4`
// cell as width 2 while still serializing `colspan="4"` produces exactly the overrunning cell
- // this clamp exists to prevent, and contradicts the documented behaviour. A span clamped back
- // down to 1 drops the attribute entirely, matching fieldCellIntent's omit-the-default rule.
+ // this clamp exists to prevent, and contradicts the documented behaviour.
+ //
+ // The clamped value is written EVEN WHEN IT IS 1. Dropping the attribute there looked harmless
+ // ("1 is the default"), but it recreates the omission-vs-value ambiguity one layer down:
+ // reconcile reads a missing span as "no opinion" and LEAVES AN EXISTING WIDE CELL ALONE.
+ // Live-reproduced — a deployed colspan-2 cell, re-declared as `colspan: 4` in a ONE-column
+ // section, stayed at 2 across two applies instead of shrinking to the clamped 1. The author did
+ // declare a span here; 1 is its effective value, not an absence.
let out = cell;
if (span !== declared) {
out = Object.assign({}, cell);
- if (span > 1) out.colspan = span; else delete out.colspan;
+ out.colspan = span;
}
current.push(out);
used += span;
@@ -218,6 +224,23 @@ function fieldOptionsMap(formSpec) {
return map;
}
+// Merge a form-level `fieldOptions` default with an inline field entry: the inline entry wins
+// wherever it says something. Exported so `--verify` expects the span the compiler was ASKED to
+// emit, whichever surface declared it — re-deriving the precedence there left `fieldOptions` spans
+// unverified entirely, so a span the build had to skip went unreported.
+function mergeFieldOptions(base, inline, logical) {
+ if (!base) return inline || { name: logical, readOnly: false, hidden: false, after: undefined };
+ if (!inline) return base;
+ return {
+ name: logical,
+ readOnly: inline.readOnly || base.readOnly,
+ hidden: inline.hidden || base.hidden,
+ after: inline.after !== undefined ? inline.after : base.after,
+ colspan: inline.colspan !== undefined ? inline.colspan : base.colspan,
+ rowspan: inline.rowspan !== undefined ? inline.rowspan : base.rowspan,
+ };
+}
+
// Cell for the Notes/activity-timeline control.
//
// The classId IS the intent for non-field controls (it identifies which PCF/built-in
@@ -419,6 +442,22 @@ function reorderCellsByAnchors(cells, positions) {
return cells;
}
+// The grid width the compiler EMITS for an authored section. This is the ONE place that rule lives:
+// the compiler lays a section out with it, and `--verify` must judge the deployed form against the
+// same value. A second derivation in the verifier drifted — it read the raw `columns`, so a section
+// that omits it (the compiler's default is 1) or one on a QuickCreate form (capped at 1) was reported
+// as wrong even though it deployed exactly as compiled.
+//
+// This is the AUTHORED effective width, not the live one: the reconcile deliberately clamps against
+// the section it is writing into (`convergeCellSpans`), which on an existing form can differ.
+//
+// Quick Create forms must use single-column sections. Dataverse rejects multi-column
+// (columns="11"/"111") quick-create sections with "Columns in a section must be set to '1'".
+function sectionGridWidth(section, formType) {
+ const maxCols = formType === 'QuickCreate' ? 1 : 4;
+ return Math.min((section && section.columns) || 1, maxCols);
+}
+
// Compile an App Spec form entry into the SDK's canonical desired-state intent.
//
// NEW topology: tabs[] → columns[] → sections[] → rows[] → cells[].
@@ -445,9 +484,9 @@ function compileFormIntent(spec, formSpec, opts) {
const entity = entityByLogical(spec, entityLogical);
const formType = formSpec.formType || 'Main';
- // Quick Create forms must use single-column sections. Dataverse rejects multi-column
- // (columns="11"/"111") quick-create sections with "Columns in a section must be set
- // to '1'". This cap also blocks notes — quick-create forms don't host the timeline.
+ // The QuickCreate single-column cap — the same rule `sectionGridWidth` applies to explicit
+ // sections; the auto layout below picks its own 1-or-2 within it. It also blocks notes:
+ // quick-create forms don't host the timeline.
const maxCols = formType === 'QuickCreate' ? 1 : 4;
const explicit = Array.isArray(formSpec.tabs) || formSpec.layout === 'explicit';
@@ -469,22 +508,30 @@ function compileFormIntent(spec, formSpec, opts) {
// engine-only `__`-prefixed keys on the returned def are never sent (createFormShell hand-picks
// the fields it passes to createArtifact), so that is where positioning intent belongs.
const positions = {};
+ // RAW authored spans, by logical name: { <logical>: { colspan?, rowspan? } }.
+ //
+ // The cells carry the span already CLAMPED to the section the compiler laid out, which is right
+ // for the create path. It is wrong for reconcile on an existing form: an AUTO layout compiles a
+ // synthetic one-column section, but reconcile deliberately KEEPS the deployed section's geometry —
+ // so applying the synthetic clamp narrowed a maker's four-column cell to 1. The raw value has to
+ // survive compilation for the reconcile to re-clamp against the section it actually writes into.
+ //
+ // Kept off the cells, like `positions`, because a cell is pushed verbatim to the SDK and this is
+ // not part of its model.
+ const rawSpans = {};
+ const recordRawSpan = function (opt) {
+ if (!opt || !opt.name) return;
+ const out = {};
+ if (typeof opt.colspan === 'number') out.colspan = opt.colspan;
+ if (typeof opt.rowspan === 'number') out.rowspan = opt.rowspan;
+ if (Object.keys(out).length) rawSpans[opt.name] = out;
+ };
const recordPosition = function (opt) {
if (opt && opt.after && opt.name && opt.after !== opt.name) positions[opt.name] = opt.after;
};
- // Merge a form-level default with an inline override for one field.
+ // Merge a form-level default with an inline override for one field — see mergeFieldOptions.
const optionsFor = function (logical, inline) {
- const base = formOptions[logical];
- if (!base) return inline || { name: logical, readOnly: false, hidden: false, after: undefined };
- if (!inline) return base;
- return {
- name: logical,
- readOnly: inline.readOnly || base.readOnly,
- hidden: inline.hidden || base.hidden,
- after: inline.after !== undefined ? inline.after : base.after,
- colspan: inline.colspan !== undefined ? inline.colspan : base.colspan,
- rowspan: inline.rowspan !== undefined ? inline.rowspan : base.rowspan,
- };
+ return mergeFieldOptions(formOptions[logical], inline, logical);
};
let tabs;
@@ -514,9 +561,10 @@ function compileFormIntent(spec, formSpec, opts) {
const inline = normalizeFieldEntry(fl);
const opt = optionsFor(inline.name, inline);
recordPosition(opt);
+ recordRawSpan(opt);
return fieldCellIntent(inline.name, { isRequired: requiredFor(inline.name), readOnly: opt.readOnly, hidden: opt.hidden, colspan: opt.colspan, rowspan: opt.rowspan });
});
- const secCols = Math.min(s.columns || 1, maxCols);
+ const secCols = sectionGridWidth(s, formType);
return {
// The generated fallback name is the form's identity for this section on a REBUILD
// (topology reconcile matches deployed sections by name). Shared with the spec gate
@@ -543,6 +591,7 @@ function compileFormIntent(spec, formSpec, opts) {
const autoCell = function (logical, extra) {
const opt = optionsFor(logical, null);
recordPosition(opt);
+ recordRawSpan(opt);
return fieldCellIntent(logical, Object.assign({ readOnly: opt.readOnly, hidden: opt.hidden, colspan: opt.colspan, rowspan: opt.rowspan }, extra || {}));
};
if (entity) {
@@ -606,6 +655,9 @@ function compileFormIntent(spec, formSpec, opts) {
// precedence rule should hold in the code that implements it, not only in the gate in front of it.
for (const key of Object.keys(formOptions)) {
if (!Object.prototype.hasOwnProperty.call(positions, key)) recordPosition(formOptions[key]);
+ // Same catch-all for spans: a form-level `fieldOptions` entry whose field was not placed
+ // inline still carries authored intent the reconcile may need.
+ if (!Object.prototype.hasOwnProperty.call(rawSpans, key)) recordRawSpan(formOptions[key]);
}
// Notes section (opt-in: formSpec.notes or entity.hasNotes) — Main forms only.
@@ -643,6 +695,8 @@ function compileFormIntent(spec, formSpec, opts) {
// MOVES an existing control to sit immediately after its anchor. Kept off the cells because a
// cell is pushed verbatim to the SDK and `after` is not part of its model (see `positions`).
__fieldPositions: positions,
+ // RAW authored spans, for reconcile to re-clamp against the section it actually writes into.
+ __fieldSpans: rawSpans,
// Whether an EXPLICIT layout may prune deployed fields it does not list. Defaults to true (the
// long-standing behaviour: an explicit layout is the complete desired state). `prune: false`
// lets an author reorder or restyle a SUBSET of the fields without having to re-declare the
@@ -846,6 +900,8 @@ function findFieldCellPointer(formJson, logical) {
module.exports = {
compileFormIntent,
+ sectionGridWidth,
+ mergeFieldOptions,
clampedCellSpan,
cellFitsInRow,
// Exported for the build's in-place repack: a span widened on a DEPLOYED form can overflow its
diff --git a/plugins/model-apps/scripts/lib/changed-only-flow.js b/plugins/model-apps/scripts/lib/changed-only-flow.js
index 4c7af0f49..b06eb2716 100644
--- a/plugins/model-apps/scripts/lib/changed-only-flow.js
+++ b/plugins/model-apps/scripts/lib/changed-only-flow.js
@@ -86,14 +86,26 @@ async function resolveLiveIdentity({ sdk, envUrl, appUniqueName, whoAmI }) {
} catch { return null; }
if (!orgId) return null;
let appId = null;
+ let appIdKnown = true;
try {
// App discovery by unique name (same appmodule query fetchSitemap uses). appId is a SECONDARY identity
// signal — a fresh baseline (app not yet created) legitimately resolves null, so a miss is tolerated;
// identityMatches only compares appId when BOTH the snapshot and live carry one.
const apps = await sdk.queryRecords('appmodule', { select: ['appmoduleid'], filter: `uniquename eq '${odataLit(appUniqueName)}'`, top: 1 });
appId = (apps && apps[0] && apps[0].appmoduleid) || null;
- } catch { appId = null; }
- return { orgId, envUrl, appUniqueName, appId };
+ } catch {
+ // A FAILED READ is not a proven absence. Both used to collapse to `appId: null`, and the caller
+ // reads that as "the app did not exist when this flow started" — which is the single fact that
+ // certifies a fresh, ELIGIBLE changed-only baseline. So a transient app-query error against a
+ // PRE-EXISTING app minted an eligible baseline for an additive build that may not have converged,
+ // and a later page edit then took the fast path on the strength of it.
+ //
+ // `appIdKnown: false` keeps the tolerated-miss behaviour for identity MATCHING (an absent id is
+ // still not compared) while letting the caller refuse to certify what it could not read.
+ appId = null;
+ appIdKnown = false;
+ }
+ return { orgId, envUrl, appUniqueName, appId, appIdKnown };
}
// ---- snapshot assembly (post-apply) -------------------------------------------------------------------
@@ -187,7 +199,13 @@ async function runChangedOnlyApply({ spec, opts, deps }) {
// Whether the app already existed when the flow STARTED — the only proof a subsequent full build is a
// fresh create (→ eligible baseline). Captured before any write (Sol #7 / Opus H2).
- const appPreExisted = !!live.appId;
+ //
+ // An UNREADABLE app id counts as pre-existing. "We could not look" must not certify a fresh baseline:
+ // the alternative is that one transient app-query failure mints an eligible snapshot for an additive
+ // build on an app that was already there, and a later page edit rides the fast path on it. Treating
+ // it as pre-existing costs one extra full build and records `uncertified-baseline` debt, which is the
+ // recoverable direction.
+ const appPreExisted = live.appIdKnown === false ? true : !!live.appId;
let decision = decideChangedOnly({ annotatedSpec, snapshot, live });
// Sample-data guard (Sol #11): the baseline records whether --sample-data was applied. If THIS run asks
diff --git a/plugins/model-apps/scripts/lib/entity-provision.js b/plugins/model-apps/scripts/lib/entity-provision.js
index 2540847b8..a1ed26aab 100644
--- a/plugins/model-apps/scripts/lib/entity-provision.js
+++ b/plugins/model-apps/scripts/lib/entity-provision.js
@@ -587,8 +587,17 @@ function requireSuccessfulPush(result, what, warn) {
const opts = { phase: 'push', recoverable: true, cause: result.error };
// Reporting an already-exists collision as a concurrent edit tells the operator to re-download
// when nothing changed under them, and hides the actual cause.
+ //
+ // The remedy is NOT "re-run" and NOT a plain `fetchArtifact`. The collision means an earlier push
+ // committed but the workspace never recorded it, so it still holds a local copy marked never-
+ // pushed at that id. A plain fetch KEEPS such a copy and adopts nothing — and the build's
+ // existing-artifact path is exactly a plain fetch — so a re-run on the same workspace re-issues
+ // the create and halts here again. Measured against the vendored bundle: same workspace → the
+ // same ARTIFACT_ALREADY_EXISTS; a fresh workspace → the fetch adopts the row and the push is a
+ // conditional update. The SDK's own advice (`fetchArtifact(..., { overwrite: true })`) is an API
+ // call an operator of this plugin cannot make, so this names the step they can.
if (sdkCode === 'ARTIFACT_ALREADY_EXISTS') {
- throw new BuildHalt(`push ${label} failed: ${detail} — a row already exists at that id and no duplicate was created; adopt it (fetchArtifact) instead of re-creating it`, { ...opts, code: 'already-exists' });
+ throw new BuildHalt(`push ${label} failed: ${detail} — a row already exists at that id and no duplicate was created. The workspace still holds the local copy that push never recorded, and a re-run keeps it and halts here again: delete the .maker-workspace directory (or the --workspace one), then re-run the build to adopt the existing row.`, { ...opts, code: 'already-exists' });
}
// No code at all is the bare 412 this guard was originally written for, and `VERSION_CONFLICT`
// is the code the SDK actually attaches to one — both mean the artifact moved under us, and
diff --git a/plugins/model-apps/scripts/lib/genpage-cli.js b/plugins/model-apps/scripts/lib/genpage-cli.js
index 28b91d55e..d31059388 100644
--- a/plugins/model-apps/scripts/lib/genpage-cli.js
+++ b/plugins/model-apps/scripts/lib/genpage-cli.js
@@ -19,7 +19,18 @@ function quoteArg(a) {
const q = s.replace(/"/g, '""').replace(/%/g, '"^%"');
// cmd.exe expands %VAR% even inside double quotes; break out of the quoted segment and caret-escape
// each percent so prompts/names containing environment-variable syntax round-trip literally.
- return /[\s"'&|<>^()%]/.test(s) ? `"${q}"` : s;
+ if (!/[\s"'&|<>^()%]/.test(s)) return s;
+ // A run of backslashes immediately before the closing quote must be DOUBLED. Windows command-line
+ // parsing treats `\"` as an escaped quote, so a directory argument ending in a separator —
+ // --output-directory "C:\Users\Power User\download\"
+ // — escaped its own closing quote and swallowed the following flags into the path. MEASURED via a
+ // real cmd.exe parse:
+ // ["--output-directory", "C:\\Users\\Power User\\download\" --app-id after"]
+ // Only the trailing run matters: an interior `\` is literal to the parser, so escaping those would
+ // corrupt every ordinary Windows path.
+ // See: https://learn.microsoft.com/cpp/cpp/main-function-command-line-args#parsing-c-command-line-arguments
+ const trailingSlashesDoubled = q.replace(/(\\+)$/, (m) => m + m);
+ return `"${trailingSlashesDoubled}"`;
}
// Build the spawnSync invocation for a `pac` call, per platform. Windows: pac resolves as pac.cmd,
@@ -45,8 +56,29 @@ function runPac(args) {
}
// Extract the "Page ID: <guid>" pac prints on a successful upload.
+// A page id is DURABLE IDENTITY — it is stored in the manifest and drives every later update — so
+// only a complete, canonical GUID is accepted.
+//
+// The old pattern was `[0-9a-fA-F-]{36}`, which is 36 characters from an alphabet that includes
+// `-`. It therefore accepted a row of dashes, any mis-grouped hex, and — worst — an OVERLONG token,
+// because it matched the first 36 characters and silently discarded the rest, turning a malformed
+// id into a plausible one. MEASURED on the merged code: all three of
+// 'Page ID: ------------------------------------'
+// 'Page ID: 111111112222333344445555555555555555'
+// 'Page ID: 6e0c28a2-cdbf-41ec-9186-d10fd5de6e35f' (37 chars -> truncated to 36)
+// were accepted as identity.
+//
+// The group structure (8-4-4-4-12) is enforced, and the trailing boundary rejects any contiguous
+// IDENTIFIER character so a too-long token is REFUSED rather than trimmed. Restricting the boundary
+// to the GUID alphabet was not enough: `6e0c28a2-cdbf-41ec-9186-d10fd5de6e35oops` has a non-hex
+// character next, so the lookahead passed and the id was accepted with the suffix silently dropped.
+// `[\w-]` is the right class — a following `.` or `,` or `)` genuinely ends the token (pac prints the
+// id inside prose), while any letter, digit, underscore or hyphen means the token continues.
+// Returning null is the safe outcome: the caller treats a zero exit with no parsable id as an
+// UNCERTAIN create and reconciles by env-wide id diff.
+const GUID_RE = /[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 parsePageId(out) {
- const m = /Page ID:\s*([0-9a-fA-F-]{36})/.exec(String(out || ''));
+ const m = new RegExp('Page ID:\\s*(' + GUID_RE.source + ')(?![\\w-])').exec(String(out || ''));
return m ? m[1] : null;
}
@@ -105,8 +137,23 @@ function parseList(out) {
// Returns the integer, or null when the summary line is absent (unknown format). parseList skips
// the "Found …" line as metadata; this reads its N so classifyListOutput can prove the listing is
// COMPLETE (parsed page count == summary N).
+//
+// Matched as a STANDALONE, COMPLETE line, not anywhere in the output. Scanning the whole text let a
+// page NAME supply the summary: pac prints names in a fixed-width table, so a page called
+// "Found 1 generated page"
+// made a listing with NO real summary line read as authoritative — and an authoritative-looking
+// but TRUNCATED listing is exactly what drives a duplicate CREATE.
+//
+// Anchoring the START was still not enough: with the line-end unconstrained, a row whose name began
+// with the summary text — "Found 1 generated pagex", "Found 1 generated page(s) extra" — was accepted
+// just the same. The WHOLE line must be the summary grammar, so trailing content disqualifies it.
+// Every live-captured listing uses the exact form "Found N generated page(s):"; the small
+// tolerances here (optional "generated", "page"/"pages"/"page(s)", optional colon) cover plausible
+// pac wording drift without admitting arbitrary suffixes. Anything outside that returns null, which
+// classifyListOutput reports as 'unrecognized' — a failure, never "empty".
function parseListCount(stdout) {
- const m = /found\s+(\d+)\s+(?:generated\s+)?page/i.exec(String(stdout || ''));
+ const m = /^[^\S\r\n]*found[^\S\r\n]+(\d+)[^\S\r\n]+(?:generated[^\S\r\n]+)?pages?(?:\(s\))?[^\S\r\n]*:?[^\S\r\n]*$/im
+ .exec(String(stdout || ''));
return m ? Number(m[1]) : null;
}
@@ -145,7 +192,68 @@ function makeGenpageCli(env, deps = {}) {
const run = deps.run || runPac;
const sleep = deps.sleep || ((ms) => new Promise((r) => setTimeout(r, ms)));
const attempts = deps.attempts || 3; // pac genpage upload/list flake intermittently (transient help-dump exits)
- const lastLine = (r) => String(r.stderr || r.stdout || '').trim().split('\n').filter(Boolean).pop() || '';
+ // The DIAGNOSTIC pac actually produced, not merely its last line.
+ //
+ // MEASURED shape of a real failure (`pac model genpage download` with no --app-id):
+ // Microsoft PowerPlatform CLI
+ // Version: 0.1.0-dev (.NET 10.0.12)
+ // Online documentation: https://aka.ms/PowerPlatformCLI
+ // Feedback, Suggestions, Issues: https://github.com/...
+ //
+ // Error: A required argument --app-id is missing.
+ //
+ // Usage: pac model genpage download [--environment] --app-id [--page-id] [--output-directory]
+ // --environment Specifies the target Dataverse. ...
+ // --output-directory Directory to save pulled pages. ... (alias: -o)
+ //
+ // pac prints a banner, then the error, then a full help dump — so the LAST non-empty line is a
+ // flag description and the real cause is in the middle. Reporting that line told the caller
+ // nothing and actively hid the answer.
+ //
+ // Preference order: explicit `Error:` lines, else any line that is not banner/usage/flag-help,
+ // else any non-banner line even if flag-SHAPED, else the last few lines so an unrecognized format
+ // still says SOMETHING.
+ //
+ // That third step matters: `FLAG_HELP_RE` exists to drop the help dump, but pac can print the ONLY
+ // diagnostic in the same indented shape — e.g. ` --output-directory does not exist: C:\missing`.
+ // Dropping it left just the four banner lines, which say nothing at all. Falling back to the LAST
+ // lines rather than the first, for the same reason: the banner is always first.
+ const BANNER_RE = /^(?:Microsoft PowerPlatform CLI|Version:|Online documentation:|Feedback, Suggestions, Issues:|Usage:|Connected as)/i;
+ const FLAG_HELP_RE = /^\s+-{1,2}\S/; // an indented " --flag description" row from the help dump
+ const pacDiagnostic = (r) => {
+ const raw = `${String(r && r.stderr || '')}\n${String(r && r.stdout || '')}`;
+ const lines = raw.split(/\r?\n/).map((l) => l.replace(/\s+$/, '')).filter((l) => l.trim());
+ if (!lines.length) return `pac exited ${r && r.status}` + ' with no output';
+ const errors = lines.filter((l) => /^\s*Error:/i.test(l));
+ const notBanner = lines.filter((l) => !BANNER_RE.test(l.trim()));
+ const picked = errors.length ? errors.slice(0, 4)
+ : (notBanner.filter((l) => !FLAG_HELP_RE.test(l)).slice(0, 4).length
+ ? notBanner.filter((l) => !FLAG_HELP_RE.test(l)).slice(0, 4)
+ : (notBanner.length ? notBanner.slice(0, 4) : lines.slice(-4)));
+ return picked.map((l) => l.trim()).join(' | ');
+ };
+
+ // A failure pac will produce again for the SAME inputs, however many times it is asked. Retrying
+ // one cannot help: it burns the caller's time and buries the real message under "after 3
+ // attempt(s)".
+ //
+ // Every pattern carries ARGUMENT or FILE context, deliberately. Bare phrases like "does not exist"
+ // and "could not be found" were too loose — a transient service message such as
+ // "The resource does not exist yet; please retry."
+ // matched them and cost a retry that would have succeeded. A lost retry fails a build; a needless
+ // retry costs about a second, so the asymmetry decides the trade: match only what is unambiguous.
+ //
+ // The rich forms are MEASURED from a real pac build, e.g. a missing --code-file:
+ // Error: The value passed to '--code-file' is invalid. The file 'D:\nope\absent.tsx' could not be found.
+ const DETERMINISTIC_RE = new RegExp([
+ 'required argument', 'unknown argument', 'unrecognized (?:command|option)',
+ 'not a valid command', 'parse failed on', 'was it quote wrapped',
+ 'no such file', 'file not found',
+ "the value passed to '[^']*' is invalid",
+ "the file '[^']*' could not be found",
+ ].join('|'), 'i');
+ const isDeterministic = (text) => DETERMINISTIC_RE.test(String(text || ''));
+
// List the pages already in the app (parsed from its sitemap by pac). Returns [{ pageId, name }].
async function listPages(appId) {
@@ -172,7 +280,7 @@ function makeGenpageCli(env, deps = {}) {
// help-dump exits don't look like empty apps. Fail-closed: never return ok:true for this.
lastErr = 'unrecognized/incomplete `pac genpage list` output (zero exit, no valid page listing or a count mismatch) — refusing to treat as empty';
} else {
- lastErr = lastLine(r);
+ lastErr = pacDiagnostic(r);
}
if (i < attempts - 1) await sleep(500 * (i + 1));
}
@@ -198,7 +306,7 @@ function makeGenpageCli(env, deps = {}) {
}
lastErr = 'unrecognized/incomplete env-wide `pac genpage list` output (zero exit, no valid listing or a count mismatch) — refusing to treat as empty';
} else {
- lastErr = lastLine(r);
+ lastErr = pacDiagnostic(r);
}
if (i < attempts - 1) await sleep(500 * (i + 1));
}
@@ -293,6 +401,7 @@ function makeGenpageCli(env, deps = {}) {
}
beforeIds = new Set(before.ids);
}
+ const pidBeforeAttempt = pid;
const r = await once(pid);
if (r.status === 0) {
const id = parsePageId(r.stdout);
@@ -308,9 +417,9 @@ function makeGenpageCli(env, deps = {}) {
}
return sitemapPending ? { pageId: id, sitemapPending: true } : { pageId: id };
}
- lastErr = `returned no Page ID: ${lastLine(r)}`;
+ lastErr = `returned no Page ID: ${pacDiagnostic(r)}`;
} else {
- lastErr = lastLine(r);
+ lastErr = pacDiagnostic(r);
}
// Uncertain CREATE: no caller pid and result was non-zero or zero-without-Page-ID.
// Strict env-wide before/after id diff — never use name matching (names drift; app-scoped
@@ -337,9 +446,23 @@ function makeGenpageCli(env, deps = {}) {
);
}
}
+ // A DETERMINISTIC failure will repeat for the same inputs, so retrying it only burns the
+ // caller's time and buries the real message under "after 3 attempt(s)". Break out and
+ // report it immediately.
+ //
+ // The test is "will the NEXT attempt run the SAME command?", not "is this a create?".
+ // Keying on `!pid` got that wrong in one direction: an ordinary update — where the caller
+ // supplied `pageId`, so `pid` is truthy from the very first attempt — sat through all three
+ // attempts on a fault that could never resolve itself. The case the guard must NOT break is
+ // narrower than "pid is set": it is the single attempt in which an uncertain create was
+ // just ADOPTED, because the retry then becomes an update by id and the previous command's
+ // argument fault says nothing about it. Comparing `pid` across the attempt identifies
+ // exactly that transition.
+ const commandChanged = pid !== pidBeforeAttempt;
+ if (!commandChanged && isDeterministic(lastErr)) break;
if (i < attempts - 1) await sleep(500 * (i + 1));
}
- throw new Error(`pac genpage upload failed for '${name || '(unnamed)'}' after ${attempts} attempt(s): ${lastErr}`);
+ throw new Error(`pac genpage upload failed for '${name || '(unnamed)'}': ${lastErr}`);
} finally {
// Best-effort cleanup on EVERY exit path (success return, retry-exhaustion throw, mid-loop
// throws). A cleanup failure (e.g. a transient Windows file lock) must NEVER mask the upload's
@@ -371,7 +494,7 @@ function makeGenpageCli(env, deps = {}) {
const args = ['model', 'genpage', 'download', '--environment', env, '--app-id', appId, '--output-directory', outputDir];
if (pageIds && pageIds.length) args.push('--page-id', pageIds.join(','));
const r = await run(args);
- if (r.status !== 0) throw new Error(`pac genpage download failed: ${lastLine(r)}`);
+ if (r.status !== 0) throw new Error(`pac genpage download failed: ${pacDiagnostic(r)}`);
return true;
},
};
diff --git a/plugins/model-apps/scripts/lib/provision-input.js b/plugins/model-apps/scripts/lib/provision-input.js
index 235ddad52..bb32f59e9 100644
--- a/plugins/model-apps/scripts/lib/provision-input.js
+++ b/plugins/model-apps/scripts/lib/provision-input.js
@@ -5,7 +5,7 @@
// App-Spec subset: { solution, entities, relationships, globalChoices?, sampleData? }.
// Entities carry FULL schema names (e.g. cr_candidate), not bare suffixes.
-const { TYPE_MAP, normalizeLanguageCode, validateLabel, validateChoiceOptionLabels, isLocalizedLabelMap, labelIsMissing, rejectLocalizedGlobalChoice, ENTITY_KEYS, ENTITY_KEY_HINTS, invalidLanguageCodeMessage } = require('./app-spec.js');
+const { TYPE_MAP, normalizeLanguageCode, validateLabel, validateChoiceOptionLabels, isLocalizedLabelMap, labelIsMissing, rejectLocalizedGlobalChoice, validateSampleDataRows, ENTITY_KEYS, ENTITY_KEY_HINTS, invalidLanguageCodeMessage } = require('./app-spec.js');
// Validates provision-entities input. Returns { ok, errors }.
function validateProvisionInput(input) {
@@ -271,6 +271,12 @@ function validateProvisionInput(input) {
if (!Array.isArray(records)) {
errors.push(`sampleData['${entityKey}']: value must be an array of records`);
+ } else {
+ // Same row-level gate the app-builder path applies — see validateSampleDataRows. This is
+ // the OTHER public provisioning entry point and it seeds through the same loader, so
+ // without this a `null` row still crashed here and primitives were still coerced, after
+ // the solution and data model had already been written.
+ validateSampleDataRows(entityKey, records, errors);
}
}
}
diff --git a/plugins/model-apps/scripts/lib/sdk-build.js b/plugins/model-apps/scripts/lib/sdk-build.js
index b8a8edaac..03c78ef82 100644
--- a/plugins/model-apps/scripts/lib/sdk-build.js
+++ b/plugins/model-apps/scripts/lib/sdk-build.js
@@ -1473,7 +1473,7 @@ async function runSdkBuild(spec, opts = {}) {
};
}
- const result = { ok: true, created: { entities: {}, relationships: {}, records: {}, webResources: {}, views: {}, charts: {}, forms: {}, formIds: {}, businessRules: {}, businessProcessFlows: {}, bpfBackingTables: {}, commands: {}, dashboards: {}, pages: {}, pageDeployedShas: {}, ai: { appFeatures: null, summaries: {} }, roles: {}, roleGrants: {}, bpfRoleGrants: {}, app: null }, skipped: { businessRules: [], aiSummaries: [] } };
+ const result = { ok: true, created: { entities: {}, relationships: {}, records: {}, webResources: {}, views: {}, charts: {}, forms: {}, formIds: {}, businessRules: {}, businessProcessFlows: {}, bpfBackingTables: {}, commands: {}, dashboards: {}, pages: {}, pageDeployedShas: {}, ai: { appFeatures: null, summaries: {} }, roles: {}, roleGrants: {}, bpfRoleGrants: {}, app: null }, skipped: { businessRules: [], aiSummaries: [], layout: [] } };
// #changed-only (pages-only fast apply): seed the LIVE app id (discovered by unique name upstream) so the
// pages phase's `pages-requires-app` guard passes WITHOUT running the app-shell phase in this invocation.
// The full-build path never sets opts.changedOnly, so result.created.app stays null and app-shell
@@ -1967,7 +1967,33 @@ async function runSdkBuild(spec, opts = {}) {
// `columns` is the key that matters most: it is what makes a section render as two
// columns rather than one, and it was previously unreachable on an existing form.
const patch = diffPatch(live, wantSection, ['columns', 'label', 'showLabel', 'visible']);
+ // NARROWING the grid overflows rows that no cell changed. Three unit-width cells sit
+ // legally in a 4-column row and illegally in a 1-column one, so a width change alone can
+ // invalidate the layout — and the span-change repack never fires, because no span changed.
+ // Live-reproduced: occupancy 3 in width 1, on both applies.
+ //
+ // Only a NARROWING needs this. Widening cannot overflow a row that already fitted, and
+ // re-packing on every widen would reflow rows the author never asked to touch.
+ const narrowing = patch.columns !== undefined && Number(patch.columns) < Number(live.columns || 1);
+ let reflow = narrowing;
+ if (narrowing && reflowBreaksReservation(live.rows)) {
+ // A reflow here would move a cell into a row-spanning cell's reservation, so it cannot
+ // run — and the decision has to be made BEFORE the width is written. Writing the width
+ // and then refusing the reflow left rows overflowing the new grid for good: the next
+ // apply sees the width already applied and has nothing to do.
+ const width = Number(patch.columns);
+ reflow = false;
+ if (!(live.rows || []).every((r) => rowWidth((r && r.cells) || []) <= width)) {
+ delete patch.columns;
+ reportLayoutSkip(`form section '${live.name || pointer}' keeps its ${live.columns}-column grid: narrowing it `
+ + `to ${width} would overflow rows that cannot be re-flowed without moving a cell into a row-spanning `
+ + 'cell\'s reservation. Adjust the layout in the maker.');
+ }
+ // …otherwise every row already fits the narrower grid: the width is written and nothing
+ // is moved, because a reflow would only reshuffle cells that are already valid.
+ }
if (Object.keys(patch).length) await provision.updateElement('form', formId, pointer, patch);
+ if (reflow) await repackSectionRows(formId, pointer, Number(patch.columns));
}
}
}
@@ -1994,30 +2020,188 @@ async function runSdkBuild(spec, opts = {}) {
return (col && (col.sections || [])[Number(t[5])]) || null;
};
+ // Reflow an ENTIRE section against a new grid width, using the create path's own packer so both
+ // routes produce the same shape. Called when a section NARROWS: no cell changed, but rows that
+ // fitted the old width can overrun the new one.
+ //
+ // The cells are re-laid in their existing reading order, so the author's field order survives, and
+ // they are MOVED (written as cells arrays) rather than recreated, so ids and any maker-edited
+ // control state survive with them. Rows beyond the new count are removed from the END backwards,
+ // because removing by index shifts every later index.
+ const repackSectionRows = async (formId, sectionPointer, width) => {
+ const form = await provision.getArtifact('form', formId) || {};
+ const section = sectionAt(form, sectionPointer);
+ if (!section) return;
+ const liveRows = section.rows || [];
+ // A ROWSPAN makes a row's cells positionally meaningful: the cell beneath a vertically spanning
+ // one is a SPACER reserving the covered slot, and reading-order flattening moves it beside the
+ // spanning cell instead of under it. Live shape, narrowed 4 -> 2, before this guard:
+ // [A rowspan=2] [spacer, B] [C, D] became [A rowspan=2, spacer] [B, C] [D]
+ // i.e. B took the reserved position. `rowsFromCells` models width only, so it cannot express
+ // that reservation — and the authored-rowspan restriction does not help, because the span
+ // belongs to the fetched MAKER form, not to the spec.
+ //
+ // REFUSE rather than guess. Leaving a maker's valid arrangement alone is the recoverable
+ // outcome; silently rearranging their form is not. The caller makes this decision BEFORE it
+ // writes the new width (so the grid and its rows never disagree); this is the backstop for any
+ // future caller that does not.
+ if (reflowBreaksReservation(liveRows)) {
+ reportLayoutSkip(`form section at ${sectionPointer}: its rows were left as they are rather than re-flowed to `
+ + `${width} column(s) — re-flowing them would move a cell into a row-spanning cell's reservation. `
+ + 'Adjust the layout in the maker if it no longer fits.');
+ return;
+ }
+ const cells = liveRows.flatMap((r) => (r && r.cells) || []);
+ if (!cells.length) return;
+ const packed = rowsFromCells(cells, width);
+ const live = liveRows;
+ // Nothing to do only when the existing rows match the packing the new width implies — INCLUDING
+ // each cell's span. Comparing field names alone discarded exactly the change this exists to make:
+ // `rowsFromCells` clamps a too-wide cell without moving it, so a section narrowed to 1 while
+ // holding a colspan-4 cell had identical row membership and was judged unchanged. The stale
+ // width then survived, and a second apply issued no corrective write either.
+ const shapeOf = (rows) => JSON.stringify((rows || []).map((r) => ((r && r.cells) || []).map((c) => [
+ c.control && c.control.fieldName,
+ Number(c.colspan) || 1,
+ Number(c.rowspan) || 1,
+ ])));
+ if (shapeOf(packed) === shapeOf(live)) return;
+ for (let i = 0; i < packed.length; i += 1) {
+ if (i < live.length) {
+ await provision.updateElement('form', formId, `${sectionPointer}/rows/${i}`, { cells: packed[i].cells });
+ } else {
+ await provision.addElement('form', formId, `${sectionPointer}/rows`, { cells: [] });
+ await provision.updateElement('form', formId, `${sectionPointer}/rows/${i}`, { cells: packed[i].cells });
+ }
+ }
+ for (let i = live.length - 1; i >= packed.length; i -= 1) {
+ await provision.removeElement('form', formId, `${sectionPointer}/rows/${i}`);
+ }
+ };
+
+ // Re-laying rows by reading order is unsafe exactly when a cell FOLLOWS a row-spanning one. That
+ // later cell — or the empty spacer holding a covered slot — has a position only relative to the
+ // span above it, and `rowsFromCells` models WIDTH only, so a reflow can move it into the reserved
+ // slot. A section whose row spans are all TRAILING reflows safely: nothing comes after the span to
+ // land in its reservation. Stock account and contact Main forms put `rowspan` on the last cell of
+ // a section, so treating every rowspan as unsafe refused exactly the commonest real shape.
+ //
+ // Shared by BOTH reflow routes (whole-section on a grid narrowing, single-row on a span change).
+ // It does not cover PLACING a new or moved field into such a section: that path predates these
+ // guards and needs spacer-aware placement (#581).
+ const reflowBreaksReservation = (rows) => {
+ let spanning = false;
+ for (const r of rows || []) {
+ for (const c of (r && r.cells) || []) {
+ if (spanning) return true;
+ if ((Number(c.rowspan) || 1) > 1) spanning = true;
+ }
+ }
+ return false;
+ };
+ const rowWidth = (cells) => (cells || []).reduce((n, c) => n + (Number(c.colspan) || 1), 0);
+ // Whether any cell — a field or an empty spacer — comes after (rowIndex, cellIndex) in reading order.
+ const cellFollows = (rows, rowIndex, cellIndex) => (rows || []).some((r, ri) => ri >= rowIndex
+ && ((r && r.cells) || []).some((_, ci) => ri > rowIndex || ci > cellIndex));
+
+ // A layout change the build declined to make. Reported, AND recorded on the result: a stderr line
+ // alone is invisible to a non-interactive run, and `--verify` does not check every route — an
+ // auto layout's topology is never verified, so a skipped `fieldOptions` span would pass silently.
+ const reportLayoutSkip = (message) => {
+ result.skipped.layout.push(message);
+ if (typeof opts.warn === 'function') opts.warn(message);
+ };
+
+ // The span to WRITE for a cell landing in `liveSection`: the authored value when there is one,
+ // else the compiled one, with `colspan` clamped to the LIVE grid. `undefined` means no opinion —
+ // a span the author never declared is never written, so a maker's hand-widened cell survives.
+ //
+ // Clamped against the section the write actually lands in, NOT the one the compiler laid out. On
+ // an existing form they can differ: an AUTO layout compiles a synthetic section of one column (two
+ // once it holds more than six fields) while reconcile deliberately keeps the deployed geometry, so
+ // the compiled clamp narrowed a maker's four-column cell. `rawSpan` is the authored value carried
+ // past compilation for exactly this.
+ // Used by BOTH the existing-cell route and the add route — the add route once used the compiled
+ // span alone, so a newly added field landed narrow and was only widened by a second apply.
+ const spanForLiveSection = (key, wantCell, rawSpan, liveSection) => {
+ const raw = rawSpan && typeof rawSpan[key] === 'number' ? rawSpan[key] : undefined;
+ const compiled = wantCell && wantCell[key];
+ if (raw === undefined && compiled === undefined) return undefined;
+ const value = raw === undefined ? compiled : raw;
+ if (key !== 'colspan') return value; // only colspan is bounded by the grid
+ return Math.min(value, Math.max(1, Math.min(4, Number(liveSection && liveSection.columns) || 1)));
+ };
+
// Write an authored `colspan`/`rowspan` onto a cell that is already on the form. Only a span the
// author explicitly declared is sent, and only when the deployed value differs, so a rebuild that
// changes nothing issues no writes.
- const convergeCellSpans = async (formId, form, location, wantCell) => {
+ const convergeCellSpans = async (formId, form, location, wantCell, rawSpan) => {
if (!location || !wantCell) return;
const live = cellAt(form, location);
if (!live) return;
+ const liveSection = sectionAt(form, location.sectionPointer) || {};
const patch = {};
for (const key of ['colspan', 'rowspan']) {
- const want = wantCell[key];
- if (want === undefined) continue; // no opinion — never overwrite a maker's hand-set span
+ const want = spanForLiveSection(key, wantCell, rawSpan, liveSection);
+ if (want === undefined) continue; // no opinion — never overwrite a maker's span
const current = live[key] === undefined ? 1 : live[key];
if (current !== want) patch[key] = want;
}
- if (Object.keys(patch).length) {
+ if (!Object.keys(patch).length) return;
+
+ // A span change can require a REFLOW of its row, and a reflow by reading order cannot honour a
+ // row-spanning cell's reservation. For example, on a maker form holding
+ // `[A rowspan=2, B] / [spacer]`, widening `B` overflows the row, and `repackRowAt` splits it
+ // by reading order — placing `B` in the row `A` reserves. Judged on the rows AS THEY WILL BE.
+ const current = await provision.getArtifact('form', formId) || {};
+ const sec = sectionAt(current, location.sectionPointer) || {};
+ const rows = sec.rows || [];
+ const field = (live.control && live.control.fieldName) || location.cellPointer;
+ // A rowspan RAISED on a cell that other cells follow creates a reservation they must route
+ // around: the next row's cells are displaced past the covered slot, so a full row beneath needs
+ // more columns than its grid has — even when the patched row itself still fits, which the
+ // overflow check below cannot see. The validator only allows an authored rowspan on the LAST
+ // field of the spec's list, but the reconcile keeps a staying cell where the maker put it, so the
+ // deployed order can differ. Only the rowspan is withheld; a colspan in the same patch proceeds.
+ if (patch.rowspan !== undefined && patch.rowspan > (Number(live.rowspan) || 1)
+ && cellFollows(rows, location.rowIndex, location.cellIndex)) {
+ delete patch.rowspan;
+ reportLayoutSkip(`form section at ${location.sectionPointer}: the rowspan on '${field}' was not applied — `
+ + 'other cells follow it, and a row-spanning cell displaces the cells beneath it. Make it the last '
+ + 'field of its section in the maker.');
+ if (!Object.keys(patch).length) return;
+ }
+ const row = rows[location.rowIndex];
+ const beforeCells = (row && row.cells) || [];
+ const afterCells = beforeCells.map((c, i) => (i === location.cellIndex ? { ...c, ...patch } : c));
+ const overflows = rowsFromCells(afterCells, sec.columns).length > 1;
+ const unsafe = reflowBreaksReservation(rows.map((r, i) => (i === location.rowIndex ? { ...r, cells: afterCells } : r)));
+ if (overflows && unsafe) {
+ if (rowWidth(afterCells) > rowWidth(beforeCells)) {
+ // A WIDENING into an overflow: skipped whole, not half-applied. Applying it without the
+ // reflow would leave an overflowing row — a shape `rowsFromCells` would never emit and
+ // Dataverse renders unpredictably — which is worse than a form that does not match the spec.
+ reportLayoutSkip(`form section at ${location.sectionPointer}: the span change on '${field}' was skipped — `
+ + 'it would overflow the row, and re-flowing that row would move a cell into a row-spanning cell\'s '
+ + 'reservation. Adjust the layout in the maker.');
+ return;
+ }
+ // A narrowing inside a row that ALREADY overflowed is strictly an improvement, so it is
+ // written — but the row is not re-flowed, for the same reason.
await provision.updateElement('form', formId, location.cellPointer, patch);
- // A WIDENED span can overflow the row it sits in: a 2-column section holding two colspan-1
- // cells becomes 2+1 = 3 columns of content the moment one is widened to 2. The create path
- // packs rows by WIDTH (`rowsFromCells`), but an in-place span change never re-ran that
- // packing, so the row was left overflowing — a shape `rowsFromCells` would never emit, and one
- // Dataverse renders unpredictably. Live-reproduced: widening a field left three columns of
- // content in a two-column row across two applies.
- await repackRowAt(formId, location);
+ reportLayoutSkip(`form section at ${location.sectionPointer}: the span change on '${field}' was applied, `
+ + 'but its row still overflows the grid and was NOT re-flowed — that would move a cell into a '
+ + 'row-spanning cell\'s reservation. Adjust the layout in the maker.');
+ return;
}
+ await provision.updateElement('form', formId, location.cellPointer, patch);
+ // A WIDENED span can overflow the row it sits in: a 2-column section holding two colspan-1
+ // cells becomes 2+1 = 3 columns of content the moment one is widened to 2. The create path
+ // packs rows by WIDTH (`rowsFromCells`), but an in-place span change never re-ran that
+ // packing, so the row was left overflowing — a shape `rowsFromCells` would never emit, and one
+ // Dataverse renders unpredictably. Live-reproduced: widening a field left three columns of
+ // content in a two-column row across two applies.
+ await repackRowAt(formId, location);
};
// Re-pack the row a span change just overflowed, using the create path's own packer so both routes
@@ -2084,7 +2268,7 @@ async function runSdkBuild(spec, opts = {}) {
await provision.addElement('form', formId, sectionPointer + '/rows', { cells: [wantCell] });
};
- const placeFieldInSection = async (formId, logical, wantCell, target, vacated) => {
+ const placeFieldInSection = async (formId, logical, wantCell, target, vacated, rawSpan) => {
let form = await provision.getArtifact('form', formId) || {};
const targetPointer = resolveSectionPointer(form, target);
const existing = findFieldCellLocation(form, logical);
@@ -2092,7 +2276,18 @@ async function runSdkBuild(spec, opts = {}) {
if (!existing) {
const rowsPtr = targetPointer ? targetPointer + '/rows' : firstSectionRowsPointer(form);
if (!rowsPtr) return;
- await appendCellPacked(formId, form, rowsPtr.slice(0, -'/rows'.length), wantCell);
+ const sectionPointer = rowsPtr.slice(0, -'/rows'.length);
+ // Span the NEW cell for the section it is landing in, by the same rule as an existing one.
+ // The compiled cell alone carried the compiler's clamp, which for an auto layout is a
+ // synthetic one- or two-column section: a field added to a four-column maker form arrived
+ // narrow and was only widened — and its row reflowed — by a SECOND apply of the same spec.
+ const liveSection = sectionAt(form, sectionPointer) || {};
+ const cell = { ...wantCell };
+ for (const key of ['colspan', 'rowspan']) {
+ const span = spanForLiveSection(key, wantCell, rawSpan, liveSection);
+ if (span === undefined) delete cell[key]; else cell[key] = span;
+ }
+ await appendCellPacked(formId, form, sectionPointer, cell);
return;
}
// Converge the cell SHAPE even when the cell is already where it belongs. `colspan`/`rowspan`
@@ -2109,7 +2304,7 @@ async function runSdkBuild(spec, opts = {}) {
// cell is staying, converge here; when it is moving, converge in the DESTINATION after the move.
const staying = !targetPointer || existing.sectionPointer === targetPointer;
if (staying) {
- await convergeCellSpans(formId, form, existing, wantCell);
+ await convergeCellSpans(formId, form, existing, wantCell, rawSpan);
// Already on the form and already in the right section (or we have no opinion) — leave it be,
// so a rebuild converges instead of reshuffling the form on every run.
return;
@@ -2165,7 +2360,7 @@ async function runSdkBuild(spec, opts = {}) {
// possible stranded-row removal) invalidated every pointer computed above.
const settledForm = await provision.getArtifact('form', formId) || {};
const settled = findFieldCellLocation(settledForm, logical);
- if (settled) await convergeCellSpans(formId, settledForm, settled, wantCell);
+ if (settled) await convergeCellSpans(formId, settledForm, settled, wantCell, rawSpan);
};
const reconcileForm = async (formId, def) => {
@@ -2196,8 +2391,13 @@ async function runSdkBuild(spec, opts = {}) {
declaredSection = declaredSectionByField(def.tabs);
sectionTargets = await reconcileFormTopology(formId, def);
}
+ // RAW authored spans, kept off the compiled cells because a cell is pushed verbatim to the SDK.
+ // Reconcile re-clamps them against the section it actually writes into: the compiled span is
+ // clamped to the COMPILER's section, which for an auto layout is a synthetic one- or two-column
+ // stand-in that reconcile never deploys.
+ const rawSpans = def.__fieldSpans || {};
for (const logical of want) {
- await placeFieldInSection(formId, logical, wantCellByLogical[logical], sectionTargets[declaredSection[logical]], vacatedSections);
+ await placeFieldInSection(formId, logical, wantCellByLogical[logical], sectionTargets[declaredSection[logical]], vacatedSections, rawSpans[logical]);
}
await addSubgrids(formId, def.__subgrids);
// Re-assert per-control attributes (read-only / hidden) on fields that were ALREADY on the form.
diff --git a/plugins/model-apps/scripts/lib/sdk-http-client.js b/plugins/model-apps/scripts/lib/sdk-http-client.js
index 1ad103fed..79dca0da7 100644
--- a/plugins/model-apps/scripts/lib/sdk-http-client.js
+++ b/plugins/model-apps/scripts/lib/sdk-http-client.js
@@ -8,7 +8,8 @@
// We must NOT throw on non-2xx — the SDK inspects { status, body } and raises its own typed
// errors (ensureSuccess / VersionConflictError on 412). We throw only when we cannot obtain a token
// (ensureToken) or when the underlying transport itself fails — a network/timeout error (res.error)
-// after exhausting retries. We never throw purely on a non-2xx HTTP status.
+// after exhausting retries, or at once for a write that must not be re-sent (see `call`). We never
+// throw purely on a non-2xx HTTP status.
const { getAuthToken, makeRequest } = require('./dataverse-auth.js');
/**
@@ -44,7 +45,34 @@ function createAzHttpClient(orgUrl, deps = {}) {
const random = deps.random || Math.random;
// Transient HTTP statuses worth retrying with backoff — throttling, gateway hiccups, and
// SQL deadlocks (Dataverse surfaces deadlock 1205 as a 500 from PublishXml under load).
+ //
+ // ⚠ 502/503/504 come from an INTERMEDIARY, so the write behind them may have COMMITTED — and this
+ // retry then re-sends it. For a CONDITIONAL write (every SDK form, view, chart, dashboard and app
+ // update carries `If-Match`) or a KEYED create (a client-minted id, such as a business process
+ // flow), the re-send meets the row the first attempt already created or bumped, so the outcome
+ // comes back as a definitive-looking 412 — a version conflict, or "already exists" — for a write
+ // that succeeded. That is a spurious FAILURE, never a lost write, and it halts the build with the
+ // remedy for that code (`requireSuccessfulPush`, lib/entity-provision.js). Note "already exists" is
+ // NOT cleared by simply re-running: the workspace keeps the copy it never recorded as pushed, which
+ // is why that halt names a workspace reset. Without the retry the same commit would still fail (as
+ // a bare 502), while an attempt that genuinely did not commit would no longer recover. So the
+ // policy stays.
+ // It is NOT safe for a write whose failure path must know whether the first attempt landed: the
+ // SDK's business-process-flow `update`/`delete` settle an ambiguous deactivate by re-reading the
+ // row, and this retry pre-empts that. Nothing in this plugin issues those today; exempt such
+ // writes from the retry before anything does.
const TRANSIENT = new Set([429, 500, 502, 503, 504]);
+ // How long to wait for an answer before giving up. A WRITE gets far longer than a read, because a
+ // write we stop waiting for is not a failed write — the server may still be executing it, so its
+ // outcome becomes UNKNOWN, and every recovery from an unknown outcome is worse than waiting. A
+ // read is safe to abandon and re-issue.
+ // MEASURED live: activating a business process flow on a table created seconds earlier ran past
+ // 60 s (the platform creates the flow's backing table inside that request). At the old 60 s limit
+ // the activation committed after the client gave up; the re-send was refused with a 412 against
+ // the version the first attempt had produced, and the flow's create rolled itself back on that
+ // false "concurrent edit" — a build that failed over a write that had succeeded.
+ const READ_TIMEOUT_MS = 60000;
+ const WRITE_TIMEOUT_MS = 300000;
// Jittered, capped exponential backoff. Metadata customizations serialize on a per-entity
// lock; when several artifacts (forms/views/charts) for the same table retry concurrently,
// a fixed schedule wakes them in lockstep so they re-collide forever. Jitter de-syncs them.
@@ -103,6 +131,16 @@ function createAzHttpClient(orgUrl, deps = {}) {
const isMetadataDelete = /\/(EntityDefinitions|RelationshipDefinitions|GlobalOptionSetDefinitions)\b/i.test(url);
const isBatch = method_ === 'POST' && /\/\$batch(\?|$)/i.test(url);
const noRetry = (method_ === 'DELETE' && !isMetadataDelete) || isBatch;
+ const isWrite = method_ !== 'GET';
+ // A CONDITIONAL write that got NO answer (a timeout or a dropped connection) is never re-sent.
+ // It may still commit — and if it does, the re-send carries a token the first attempt already
+ // superseded, so it can only be refused with a 412 that reads exactly like somebody else's edit.
+ // The SDK acts on that: a business process flow create rolls itself back on a version conflict
+ // in its activation step, which is how one committed-but-slow activation failed a whole build.
+ // Surfacing the unknown outcome instead lets the caller report what really happened, and the
+ // idempotent rebuild then adopts whatever did land. A conditional write that got an ANSWER
+ // (429, 5xx) keeps the status retry above; that trade-off is unchanged.
+ const conditional = isWrite && Object.keys((options && options.headers) || {}).some((h) => h.toLowerCase() === 'if-match');
// 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
@@ -121,8 +159,11 @@ function createAzHttpClient(orgUrl, deps = {}) {
headers['Content-Type'] = 'application/json; charset=utf-8';
}
- const res = await request({ url, method, headers, body: bodyStr, includeHeaders: true });
+ const res = await request({ url, method, headers, body: bodyStr, includeHeaders: true, timeout: isWrite ? WRITE_TIMEOUT_MS : READ_TIMEOUT_MS });
if (res.error) {
+ if (conditional) {
+ throw new Error(`Request failed: ${res.error} — this conditional ${method_} was not re-sent, because it may still commit and a re-send could only be refused as a false version conflict`);
+ }
if (last || noRetry) throw new Error(`Request failed: ${res.error}`);
await sleep(backoffMs(attempt));
continue;
diff --git a/plugins/model-apps/scripts/lib/verify-spec.js b/plugins/model-apps/scripts/lib/verify-spec.js
index 5f1344025..59b73a7cc 100644
--- a/plugins/model-apps/scripts/lib/verify-spec.js
+++ b/plugins/model-apps/scripts/lib/verify-spec.js
@@ -15,6 +15,7 @@ const { declaredPrivileges, compareRolePrivileges } = require('./role-privileges
const { resolveSurfaces } = require('./surface-resolver.js');
const { selectSummaryTables } = require('./ai-candidates.js');
const { isVisualizationUnsupported } = require('./entity-provision.js');
+const { sectionGridWidth, mergeFieldOptions, fieldOptionsMap, normalizeFieldEntry } = require('./artifact-intent.js');
// 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
@@ -252,6 +253,7 @@ async function verifySpec(spec, read, opts = {}) {
if (!Array.isArray(f.tabs) || !f.tabs.length) continue;
const entity = String(f.entity || '').toLowerCase();
const name = f.name || `${f.entity} form`;
+ const formFieldOptions = fieldOptionsMap(f);
if (!canReadTopology) {
add('form-topology', `${entity}.${name}`, false,
'this reader exposes no deployed-layout source, so the layout is UNVERIFIED — not proven correct');
@@ -284,10 +286,20 @@ async function verifySpec(spec, read, opts = {}) {
}
const deployed = parseFormTopology(xml);
- // Where the DEPLOYED form actually placed each bound field, keyed by section name.
+ // Where the DEPLOYED form actually placed each bound field, as the IDENTITY of the section
+ // holding it — not merely its name.
+ //
+ // A name alone aliases: the builder can produce two sections called `packed_fields` in
+ // DIFFERENT tabs (one holding the fields, one empty in the requested tab), and a name-keyed
+ // comparison found the empty one equal to the real one and reported verify PASS while the
+ // requested relocation had not happened. Live-reproduced: 28/28 PASS against a form whose
+ // fields were in the wrong tab.
+ //
+ // The identity is the section object itself, so a later comparison can ask "is this the SAME
+ // section I matched?" rather than "does it have the same name as the one I matched?".
const placedIn = new Map();
for (const t of deployed) for (const c of t.columns || []) for (const sec of c.sections || []) {
- for (const fl of sec.fields || []) if (!placedIn.has(fl)) placedIn.set(fl, String(sec.name || '').toLowerCase());
+ for (const fl of sec.fields || []) if (!placedIn.has(fl)) placedIn.set(fl, sec);
}
const problems = [];
@@ -326,48 +338,101 @@ async function verifySpec(spec, read, opts = {}) {
return;
}
claimedSections.add(secHit.index);
+ // The grid width the COMPILER emits for this authored section — taken from the same
+ // function the compiler uses, never re-derived here. Reading the raw `columns` instead
+ // failed forms that deployed exactly as compiled: an omitted `columns` compiles to 1,
+ // and a QuickCreate section is capped at 1, so "the spec declares 2" was never what the
+ // build was asked to produce. It is still the AUTHORED width, not the deployed one — see
+ // the span comparison below for why that distinction matters.
+ const wantCols = sectionGridWidth(sec, f.formType || 'Main');
+ // GRID WIDTH. Checked independently, because the span comparison below derives its
+ // expectation from the AUTHORED width: without this, a section deployed narrower than
+ // asked would go unreported AND would quietly lower the span expectation to match
+ // itself.
+ const secCols = Number(secHit.item.columns);
+ if (Number.isFinite(secCols) && secCols !== wantCols) {
+ problems.push(`section '${secName}' is deployed ${secCols} column(s) wide, the spec declares ${wantCols}`);
+ }
// OCCUPANCY: no deployed row may carry more columns of content than its section has.
// This is the shape defect the reconcile fixes (a field packed into a full row, or a
// widened span overflowing one), and a field-to-section check alone cannot see it.
// Skipped when the deployed section declares no width — unknown is not "one".
- const secCols = Number(secHit.item.columns);
+ //
+ // A row-spanning cell also fills its column(s) in the rows beneath it (FormXML rows follow
+ // HTML-table semantics), so a row's occupancy is its own cells PLUS the slots still reserved
+ // by spans from the rows above. Counting a row's own cells alone verified a full row
+ // sitting under a rowspan — live, `[name rowspan=2, tier] / [code, zeta]` in a 2-column
+ // section passed, with row 2 needing three columns.
if (Number.isFinite(secCols) && secCols >= 1) {
+ let carried = []; // one entry per reserving cell: its width and the rows it still covers
for (const [ri, drow] of (secHit.item.rows || []).entries()) {
- const used = (drow.cells || []).reduce((n, c) => n + (Number(c.colspan) || 1), 0);
+ const own = (drow.cells || []).reduce((n, c) => n + (Number(c.colspan) || 1), 0);
+ const reserved = carried.reduce((n, r) => n + r.width, 0);
+ const used = own + reserved;
if (used > secCols) {
- problems.push(`section '${secName}' row ${ri + 1} carries ${used} columns of content in a ${secCols}-column section`);
+ problems.push(`section '${secName}' row ${ri + 1} carries ${used} columns of content`
+ + (reserved ? ` (${reserved} reserved by a row-spanning cell above)` : '')
+ + ` in a ${secCols}-column section`);
+ }
+ carried = carried.map((r) => ({ width: r.width, left: r.left - 1 })).filter((r) => r.left > 0);
+ for (const c of drow.cells || []) {
+ const rs = Number(c.rowspan) || 1;
+ if (rs > 1) carried.push({ width: Number(c.colspan) || 1, left: rs - 1 });
}
}
}
// A span the author DECLARED must be the deployed span. An UNDECLARED one is not
// checked — the build never writes it, so a maker's hand-widened cell must survive
// both the rebuild and the verification.
+ //
+ // "Declared" means what the COMPILER was asked for: the inline entry merged over the
+ // form's `fieldOptions`, by the compiler's own merge. Checking inline objects only left
+ // every `fieldOptions` span unverified — including one the build had to skip.
const deployedCellOf = (logical) => (secHit.item.rows || [])
.flatMap((r2) => r2.cells || [])
.find((c) => c.control && c.control.fieldName === logical);
for (const entry of (sec.fields || [])) {
- if (!entry || typeof entry !== 'object') continue;
- const fl = String(entry.name || '').toLowerCase();
+ const inline = normalizeFieldEntry(entry);
+ const fl = inline.name;
if (!fl) continue;
+ const eff = mergeFieldOptions(formFieldOptions[fl], inline, fl);
const dc = deployedCellOf(fl);
if (!dc) continue; // placement is reported separately below
for (const key of ['colspan', 'rowspan']) {
- const want = Number(entry[key]);
- if (!Number.isFinite(want) || want < 1) continue; // not declared
+ const declared = Number(eff[key]);
+ if (!Number.isFinite(declared) || declared < 1) continue; // not declared
+ // Compare the EFFECTIVE span, clamped against the AUTHORED grid width — never the
+ // deployed one. Deriving the expectation from what was deployed let a section that
+ // came out too narrow LOWER ITS OWN EXPECTATION and excuse a wrong span: authored
+ // `columns: 4, colspan: 4` deployed as `columns: 1, colspan: 1` verified PASS. The
+ // deployed width is now reported separately above, so both faults are visible.
+ //
+ // Only `colspan` is bounded by the grid; `rowspan` has no such limit, so it is
+ // compared as authored.
+ const want = key === 'colspan' ? Math.min(declared, wantCols) : declared;
const got = Number(dc[key]) || 1;
- if (got !== want) problems.push(`field '${fl}' has ${key} ${got}, the spec declares ${want}`);
+ if (got !== want) {
+ problems.push(`field '${fl}' has ${key} ${got}, the spec declares ${declared}`
+ + (want !== declared ? ` (clamped to ${want} by the ${wantCols}-column section)` : ''));
+ }
}
}
- // Fields are compared against the section that was MATCHED, not the authored name — the
- // deployed section legitimately keeps its own name.
- const deployedSecName = String(secHit.item.name || '').toLowerCase();
+ // Fields are compared against the section OBJECT that was matched, not its name — the
+ // deployed section legitimately keeps its own name, and two sections can share one.
+ // Identity comparison is what catches a field sitting in a same-named section under a
+ // DIFFERENT tab, which a name comparison reported as correct.
for (const entry of (sec.fields || [])) {
const fieldName = typeof entry === 'string' ? entry : (entry && entry.name);
if (!fieldName) continue;
const fl = String(fieldName).toLowerCase();
const where = placedIn.get(fl);
if (where === undefined) problems.push(`field '${fl}' is not placed on the deployed form`);
- else if (where !== deployedSecName) problems.push(`field '${fl}' is deployed in section '${where}', the spec places it in '${secName}'`);
+ else if (where !== secHit.item) {
+ const whereName = String(where.name || '').toLowerCase();
+ problems.push(`field '${fl}' is deployed in section '${whereName}'`
+ + (whereName === secName ? ' under a different tab' : '')
+ + `, the spec places it in '${secName}'`);
+ }
}
});
});
diff --git a/plugins/model-apps/scripts/lib/workspace-paths.js b/plugins/model-apps/scripts/lib/workspace-paths.js
index 5a6ad6037..d500bda43 100644
--- a/plugins/model-apps/scripts/lib/workspace-paths.js
+++ b/plugins/model-apps/scripts/lib/workspace-paths.js
@@ -56,7 +56,32 @@ function checkWorkspaceClearable(dir, deps = {}) {
if (typeof dir !== 'string' || !dir.trim()) return { ok: false, reason: 'no workspace path was given' };
const resolved = path.resolve(dir);
- // 1. Never a filesystem/drive root, and never directly inside one. `C:\\.maker-workspace` or
+ // 1. Never a UNC/network path. MEASURED: `\\server\share\proj\.maker-workspace` resolves with root
+ // `\\server\share\` and dirname `\\server\share\proj`, so the filesystem-root rules below do NOT
+ // reject it and it reaches `lstatSync` — which BLOCKS on an unreachable share until the SMB
+ // timeout. No try/catch helps a hang, and this cleanup runs immediately after a SUCCESSFUL
+ // teardown, so the operator is left staring at a command that appears wedged for no reason.
+ //
+ // Checked FIRST so the refusal names the real problem. `\\server\share\.maker-workspace` would
+ // otherwise be caught by the root rule below and reported as "directly inside a filesystem root"
+ // — true of its UNC root, but it tells the operator nothing about the path they typed.
+ //
+ // Refusing is also right on the merits: the workspace is a LOCAL metadata cache by design, and a
+ // recursive delete over SMB is slow and partially-fails in ways a local one does not. The cost is
+ // a stale cache directory the operator can remove by hand — the same trade the rest of this guard
+ // makes. A MAPPED DRIVE (`Z:\…`) is not a UNC path and is unaffected, so the ordinary way of
+ // working from a network location still clears.
+ //
+ // `\\?\C:\…` is the extended-length form of a LOCAL path and is allowed; `\\?\UNC\…` is not.
+ if (/^\\\\/.test(resolved) && !/^\\\\\?\\[A-Za-z]:\\/.test(resolved)) {
+ return {
+ ok: false,
+ reason: `refusing to delete '${resolved}': it is a UNC/network path, not a local workspace cache `
+ + '(a recursive delete there can block on an unreachable share)',
+ };
+ }
+
+ // 2. Never a filesystem/drive root, and never directly inside one. `C:\\.maker-workspace` or
// `/.maker-workspace` is not a project layout; it is what an empty or truncated base path
// produces, so treat it as a mistake rather than an instruction.
const parent = path.dirname(resolved);
@@ -67,7 +92,7 @@ function checkWorkspaceClearable(dir, deps = {}) {
return { ok: false, reason: `refusing to delete '${resolved}': a workspace directly inside a filesystem root is not a project workspace` };
}
- // 2. The final component must not be a symlink/junction. Deleting through one is how a directory
+ // 3. The final component must not be a symlink/junction. Deleting through one is how a directory
// that merely POINTS at something else (a source tree, a home directory) turns a cache cleanup
// into arbitrary data loss. Only the last component is checked, because a symlinked ANCESTOR is
// ordinary and legitimate (/tmp is a symlink on macOS) and refusing those would reject real
@@ -86,7 +111,7 @@ function checkWorkspaceClearable(dir, deps = {}) {
return { ok: false, reason: `refusing to delete '${resolved}': not a directory` };
}
- // 3. Resolve the real path BEFORE the identity test, so a junction in the chain cannot land the
+ // 4. Resolve the real path BEFORE the identity test, so a junction in the chain cannot land the
// delete somewhere that was never inspected.
let real;
try {
@@ -95,7 +120,7 @@ function checkWorkspaceClearable(dir, deps = {}) {
return { ok: false, reason: `cannot resolve '${resolved}' (${e.code || e.message})` };
}
- // 3b. Re-apply the root rules to the CANONICAL target. Adversarial review found the lexical-only
+ // 4b. Re-apply the root rules to the CANONICAL target. Adversarial review found the lexical-only
// check bypassable: `D:\review-link\project\.maker-workspace` reached through an ancestor
// junction resolves to `D:\.maker-workspace`, which passing directly would be refused. The
// rules have to hold for the path actually deleted, not merely the one typed.
@@ -104,7 +129,7 @@ function checkWorkspaceClearable(dir, deps = {}) {
return { ok: false, reason: `refusing to delete '${resolved}': it resolves to '${real}', at or directly inside a filesystem root` };
}
- // 4. IDENTITY, proven by CONTENT. The directory must carry the SDK's own workspace manifest.
+ // 5. IDENTITY, proven by CONTENT. The directory must carry the SDK's own workspace manifest.
//
// The default NAME is deliberately NOT accepted as an alternative. `--workspace` is
// caller-supplied, so `--workspace /some/important/.maker-workspace` would otherwise reach
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.js
index 2f78c84b7..473b0a8c7 100644
--- a/plugins/model-apps/scripts/tests/app-delete-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/app-delete-real-bundle.test.js
@@ -12,9 +12,10 @@
//
// 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).
+// every read it cannot trust: the app must carry an ETag and the sitemap's by-id read must return its
+// ROW token (so each 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');
@@ -76,14 +77,32 @@ function appRow(opts = {}) {
if (!opts.noAppEtag) row['@odata.etag'] = 'W/"1001"';
return row;
}
+// A sitemap has TWO concurrency tokens, and only one of them is valid on a write. The unpublished-
+// aware collection read carries a CONTENT token for the authored layer, which runs ahead of the row
+// version while an edit is unpublished; Dataverse validates `If-Match` against the ROW version, which
+// a plain by-id GET returns. Sending the content token made every delete of an app with a pending
+// sitemap edit answer 412. Clean, the two are equal — so they differ here by default, and a delete
+// carrying the wrong one is visible.
+const SITEMAP_ROW_ETAG = 'W/"2002"';
+const SITEMAP_CONTENT_ETAG = 'W/"2003"';
function sitemapRow(opts = {}) {
return {
- '@odata.etag': 'W/"2002"',
+ '@odata.etag': SITEMAP_CONTENT_ETAG,
sitemapid: SITEMAP_ID,
sitemapnameunique: opts.foreignSitemap ? 'co_someotherapp' : APP_UNIQUE,
sitemapxml: '<SiteMap></SiteMap>',
};
}
+// A by-id GET answers with the single ROW, not a collection, and carries its token twice — as the
+// `ETag` response header and as `@odata.etag` in the body:
+// GET /sitemaps(<id>)?$select=sitemapid
+// 200 ETag: W/"2002" { "@odata.etag": "W/\"2002\"", "sitemapid": "<id>" }
+// Node delivers header names lower-cased, so the fake does too.
+function sitemapByIdResponse(opts = {}) {
+ if (opts.noSitemapRowEtag) return { headers: {}, body: { sitemapid: SITEMAP_ID } };
+ return { headers: { etag: SITEMAP_ROW_ETAG }, body: { '@odata.etag': SITEMAP_ROW_ETAG, sitemapid: SITEMAP_ID } };
+}
+const SITEMAP_BY_ID = /\/sitemaps\([^)]+\)/;
/**
* A real SDK over a fake Dataverse that models the two-row app. `opts`:
@@ -91,6 +110,7 @@ function sitemapRow(opts = {}) {
* 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)
+ * noSitemapRowEtag - the sitemap's by-id read returns no ETag
* 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
@@ -116,6 +136,13 @@ async function freshSdk(opts = {}) {
if (status !== 200) return { status, headers: {}, body: null };
return { status, headers: {}, body: appRow(opts) };
}
+ // By-id sitemap read — the source of the ROW token the conditional delete is issued against.
+ // Must precede the collection branch below, which would otherwise answer it in the wrong shape.
+ if (SITEMAP_BY_ID.test(url)) {
+ const status = opts.sitemapLookupStatus || 200;
+ if (status !== 200) return { status, headers: {}, body: null };
+ return { status, ...sitemapByIdResponse(opts) };
+ }
// Sitemaps are read UNPUBLISHED (RetrieveUnpublishedMultiple) so a newly authored sitemap is
// visible before its app is published.
if (url.includes('/sitemaps')) {
@@ -224,6 +251,38 @@ test('REAL BUNDLE: an app read with no ETag refuses to delete (the DELETE cannot
assert.strictEqual(deletedPaths(calls).length, 0, 'nothing may be deleted without a concurrency token');
});
+/** The `If-Match` each DELETE in a $batch change set carries, keyed by the path it targets. */
+function batchIfMatch(body) {
+ const out = {};
+ for (const part of String(body).split(/^--changeset_\S*/m)) {
+ const target = /^DELETE\s+(\S+)/im.exec(part);
+ if (target) out[target[1]] = (/^If-Match:\s*(.+?)\s*$/im.exec(part) || [])[1] || null;
+ }
+ return out;
+}
+
+test("REAL BUNDLE: the sitemap delete is conditioned on its ROW token, never the unpublished read's content token", async () => {
+ // Teardown of an app whose sitemap carries an unpublished edit — a build that halted between its
+ // sitemap push and the publish leaves exactly that — answered 412 on every attempt while the
+ // delete carried the content token, so the app could not be torn down at all.
+ const { sdk, calls } = await freshSdk();
+ await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);
+ const [batch] = batches(calls);
+ assert.ok(batch, 'the atomic delete must be issued');
+ const ifMatch = batchIfMatch(batch.body);
+ const sitemapTarget = Object.keys(ifMatch).find((u) => u.includes(SITEMAP_ID));
+ assert.ok(sitemapTarget, `the sitemap must be in the change set: ${JSON.stringify(ifMatch)}`);
+ assert.strictEqual(ifMatch[sitemapTarget], SITEMAP_ROW_ETAG, `the sitemap DELETE must carry the ROW token; got ${JSON.stringify(ifMatch)}`);
+ const appTarget = Object.keys(ifMatch).find((u) => u.includes(`/appmodules(${APP_ID})`));
+ assert.strictEqual(ifMatch[appTarget], 'W/"1001"', 'the app DELETE stays conditional on the app row it read');
+});
+
+test('REAL BUNDLE: a sitemap by-id read with no ETag refuses to delete (fails CLOSED)', async () => {
+ const { sdk, calls } = await freshSdk({ noSitemapRowEtag: true });
+ await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID), /ETag|APP_SITEMAP_UNRESOLVED/);
+ assert.strictEqual(deletedPaths(calls).length, 0, 'an unconditional delete of either row must never be issued');
+});
+
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.
@@ -269,6 +328,10 @@ test('REAL BUNDLE + REAL TRANSPORT: the plugin HttpClient satisfies the SDK atom
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()) };
+ // The row token travels ONLY in the response header here (real Dataverse also puts it in the
+ // body), so a transport that dropped or mangled response headers fails this test instead of
+ // teardown refusing every app with APP_SITEMAP_UNRESOLVED.
+ if (SITEMAP_BY_ID.test(url)) return { statusCode: 200, headers: { etag: SITEMAP_ROW_ETAG }, body: JSON.stringify({ sitemapid: SITEMAP_ID }) };
if (url.includes('/sitemaps')) return { statusCode: 200, headers: {}, body: JSON.stringify({ value: [sitemapRow()] }) };
return { statusCode: 200, headers: {}, body: JSON.stringify({ value: [] }) };
};
@@ -283,4 +346,7 @@ test('REAL BUNDLE + REAL TRANSPORT: the plugin HttpClient satisfies the SDK atom
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');
+ const sitemapIfMatch = Object.entries(batchIfMatch(batch.body)).find(([u]) => u.includes(SITEMAP_ID));
+ assert.strictEqual(sitemapIfMatch && sitemapIfMatch[1], SITEMAP_ROW_ETAG,
+ 'the header-borne row token must reach the SDK through the real transport');
});
diff --git a/plugins/model-apps/scripts/tests/app-spec.test.js b/plugins/model-apps/scripts/tests/app-spec.test.js
index 63c62ddb9..c15a7b908 100644
--- a/plugins/model-apps/scripts/tests/app-spec.test.js
+++ b/plugins/model-apps/scripts/tests/app-spec.test.js
@@ -1312,3 +1312,38 @@ test('#583 a persona may record deliberate exclusions, and a malformed one is re
`${JSON.stringify(bad)} must be rejected — a blank exclusion documents nothing`);
}
});
+
+// --- a sample ROW must be a real record object ---------------------------------------------------
+// The seeder spreads each row into a column map, and JS spreads a non-object into something
+// plausible rather than failing, so these reached Dataverse as garbage instead of being rejected
+// (MEASURED): null throws a raw TypeError; "abc" becomes { "0":"a","1":"b","2":"c" }; 42 and true
+// become {}; ["x"] becomes { "0":"x" }. The sample-data phase runs AFTER tables, forms and views
+// are deployed, so without this gate a typo halts the build halfway and leaves artifacts behind.
+test('a non-object sample row is rejected at the gate, with its index and type named', () => {
+ const spec = {
+ schemaVersion: 2,
+ solution: { uniqueName: 'c', publisherPrefix: 'co' },
+ app: { name: 'C' },
+ entities: [{ schemaName: 'co_order', primaryAttribute: { schemaName: 'co_name' }, columns: [] }],
+ sampleData: { co_order: [null, 'abc', 42, true, ['x']] },
+ };
+ const v = validateAppSpec(spec, { profile: 'plan' });
+ const hits = (v.errors || []).filter((e) => /sampleData\['co_order'\]\[\d+\]/.test(e));
+ assert.strictEqual(hits.length, 5, `every bad row must be named; got ${JSON.stringify(v.errors)}`);
+ assert.ok(hits.some((e) => /\[0\].*got null/.test(e)), 'null is named as null, not as object');
+ assert.ok(hits.some((e) => /\[1\].*got string/.test(e)));
+ assert.ok(hits.some((e) => /\[4\].*got an array/.test(e)), 'typeof [] is object, so it needs its own wording');
+});
+
+test('ordinary sample rows still validate (the gate must not reject real data)', () => {
+ const spec = {
+ schemaVersion: 2,
+ solution: { uniqueName: 'c', publisherPrefix: 'co' },
+ app: { name: 'C' },
+ entities: [{ schemaName: 'co_order', primaryAttribute: { schemaName: 'co_name' }, columns: [] }],
+ sampleData: { co_order: [{ co_name: 'First' }, { co_name: 'Second' }] },
+ };
+ const v = validateAppSpec(spec, { profile: 'plan' });
+ const hits = (v.errors || []).filter((e) => /sampleData/.test(e));
+ assert.deepStrictEqual(hits, [], `valid rows must pass; got ${JSON.stringify(hits)}`);
+});
diff --git a/plugins/model-apps/scripts/tests/business-process-flows.test.js b/plugins/model-apps/scripts/tests/business-process-flows.test.js
index 1e75abd03..31574df87 100644
--- a/plugins/model-apps/scripts/tests/business-process-flows.test.js
+++ b/plugins/model-apps/scripts/tests/business-process-flows.test.js
@@ -293,23 +293,72 @@ test('every BPF query in build, verify and teardown goes through bpfFilter', ()
// --- 3. real bundle -----------------------------------------------------------------------------
-async function realSdk() {
+async function realSdk({ honourPrefer = true } = {}) {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bpf-'));
dirs.push(dir);
const writes = [];
+ const reads = [];
const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
+ // The `workflows` write contract, as MEASURED against a live org rather than assumed:
+ // plain POST -> 204, `OData-EntityId` only — no body, no ETag
+ // POST Prefer: return=representation -> 201, the row in the BODY with `@odata.etag`
+ // plain PATCH -> 204 — no body, NO ETag
+ // PATCH Prefer: return=representation -> 200, `ETag` header AND `@odata.etag`
+ // An earlier version of this fake answered EVERY PATCH with an ETag. No Dataverse does that, and
+ // it produced a wrong conclusion recorded downstream (that only a Draft flow could reach the
+ // create read-back the SDK then had). Answering by the request's own `Prefer` keeps the fixture
+ // honest about what the SDK asks for: a write that is not echoed gets no token here, exactly as
+ // against a real org, instead of one the server never sent papering over the gap.
+ // `honourPrefer: false` models an environment that ignores `Prefer` — which the SDK now REFUSES
+ // (`BPF_CREATE_NO_TOKEN`) rather than recovers with a by-id read-back.
+ // See: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/create-entity-web-api#create-with-data-returned
+ const echo = (options) => honourPrefer
+ && /return=representation/i.test(String(((options && options.headers) || {}).Prefer || ''));
+ const entityId = (id) => ({ 'odata-entityid': `https://contoso.crm.dynamics.com/api/data/v9.2/workflows(${id})` });
const sdk = createMakerSdk({
workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
- get: async () => ({ status: 200, headers: {}, body: { value: [] } }),
- post: async (url, body) => { writes.push({ verb: 'POST', url: String(url), body }); return { status: 200, headers: {}, body: { workflowid: '44444444-4444-4444-4444-444444444444' } }; },
- patch: async (url, body) => { writes.push({ verb: 'PATCH', url: String(url), body }); return { status: 204, headers: {}, body: {} }; },
+ // A real Dataverse GET of a record carries `@odata.etag`. A single-record read
+ // (`/workflows(<id>)`) returns the ROW; a collection read returns `{ value: [...] }`. Both
+ // shapes are produced here so the token lookup works whichever the SDK uses.
+ get: async (url) => {
+ reads.push(String(url));
+ const m = /\/workflows\(([^)]+)\)/i.exec(String(url));
+ if (m) {
+ return { status: 200, headers: { etag: 'W/"1001"' },
+ body: { workflowid: m[1].replace(/'/g, ''), '@odata.etag': 'W/"1001"', statecode: 0, statuscode: 1 } };
+ }
+ if (/\/workflows/i.test(String(url))) {
+ return { status: 200, headers: {}, body: { value: [] } };
+ }
+ return { status: 200, headers: {}, body: { value: [] } };
+ },
+ post: async (url, body, options) => {
+ writes.push({ verb: 'POST', url: String(url), body, headers: (options && options.headers) || {} });
+ // The workflowid is minted CLIENT-side (the keyed-create contract), so the row the server
+ // echoes carries the id that was posted.
+ const id = String((body && body.workflowid) || '44444444-4444-4444-4444-444444444444');
+ if (echo(options)) {
+ return { status: 201, headers: entityId(id), body: { workflowid: id, '@odata.etag': 'W/"1001"' } };
+ }
+ return { status: 204, headers: entityId(id), body: undefined };
+ },
+ patch: async (url, body, options) => {
+ writes.push({ verb: 'PATCH', url: String(url), body, headers: (options && options.headers) || {} });
+ if (echo(options)) {
+ return { status: 200, headers: { etag: 'W/"1002"' }, body: { '@odata.etag': 'W/"1002"' } };
+ }
+ return { status: 204, headers: {}, body: undefined };
+ },
put: async () => ({ status: 204, headers: {}, body: {} }),
- delete: async () => ({ status: 204, headers: {}, body: {} }),
+ delete: async (url, options) => {
+ writes.push({ verb: 'DELETE', url: String(url), body: undefined, headers: (options && options.headers) || {} });
+ return { status: 204, headers: {}, body: {} };
+ },
},
});
await sdk.initWorkspace();
- return { sdk, writes };
+ return { sdk, writes, reads };
}
test('REAL BUNDLE: a BPF is authored through the generic artifact lifecycle', async () => {
@@ -354,6 +403,75 @@ test('REAL BUNDLE: the wire payload is a category-4 BusinessFlow definition carr
assert.ok(xaml.includes('new_notes'), 'the second bound column reached the compiled process');
});
+// --- a create whose writes are not echoed is REFUSED, never recovered by reading the record back --
+// The bundle's bpf create takes its concurrency token ONLY from the echo of a write it issued itself
+// (the POST, then the activation PATCH), and asks each of them to echo (`Prefer:
+// return=representation`), so against an ordinary org no token is ever missing. It used to fall
+// back to reading the record back by id. The SDK removed that deliberately: the id is minted by the
+// caller and known before the POST lands, so a second writer can edit the row in the gap, and the
+// read-back then hands back THEIR token paired with OUR content — the next push overwrites them.
+// These tests pin the replacement: refuse, say the flow exists, and leave it exactly as created.
+// A by-id read of this fixture always yields a token, so only the SDK declining to issue one keeps
+// these green.
+//
+// What happens next is not the SDK's advice: this plugin's next build finds the flow with its reuse
+// query (name + table) and only converges its state. The advice itself —
+// `fetchArtifact('bpf', id, { overwrite: true })` — was measured against this bundle to adopt the row
+// and turn the next push into a conditional update; the plain `fetchArtifact` it used to prescribe
+// kept the never-pushed local copy, re-issued the create, and was refused with 412.
+const byIdReads = (reads) => reads.filter((u) => /\/workflows\([^)]+\)/i.test(u));
+
+test('REAL BUNDLE: a create whose write is not echoed is refused, not recovered by a by-id read-back', async () => {
+ const { sdk, reads, writes } = await realSdk({ honourPrefer: false });
+ const art = await sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Draft' }));
+ await assert.rejects(
+ () => sdk.pushArtifact('bpf', art.id),
+ (e) => {
+ assert.strictEqual(e.code, 'BPF_CREATE_NO_TOKEN', `unexpected code ${e && e.code}: ${e && e.message}`);
+ assert.match(String(e.message), /EXISTS/, 'the message must say the flow was created, so nobody authors it twice');
+ assert.match(String(e.message), /NOT rolled back/, 'and that it was left in place');
+ return true;
+ });
+ assert.deepStrictEqual(byIdReads(reads), [], 'no by-id read-back may be issued for a token');
+ assert.ok(!writes.some((w) => w.verb === 'DELETE'), 'a flow nobody can condition a delete on must not be deleted');
+});
+
+// An Active flow is not activated either: an activation that cannot be conditioned on our own write
+// would enable whatever the row holds by then, including another writer's edit.
+test('REAL BUNDLE: an Active create whose write is not echoed is left Draft, never activated blind', async () => {
+ const { sdk, reads, writes } = await realSdk({ honourPrefer: false });
+ const art = await sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Active' }));
+ await assert.rejects(
+ () => sdk.pushArtifact('bpf', art.id),
+ (e) => {
+ assert.strictEqual(e.code, 'BPF_CREATE_NO_TOKEN', `unexpected code ${e && e.code}: ${e && e.message}`);
+ assert.match(String(e.message), /NOT activated/, 'the message must say the flow is still Draft');
+ return true;
+ });
+ assert.ok(!writes.some((w) => w.verb === 'PATCH' && w.body && w.body.statecode === 1), 'no activation may be sent');
+ assert.deepStrictEqual(byIdReads(reads), [], 'no by-id read-back may be issued for a token');
+ assert.ok(!writes.some((w) => w.verb === 'DELETE'), 'the created flow is left in place, not rolled back');
+});
+
+// Against the MEASURED contract the token arrives WITH the write, so no read-back is issued. This
+// pins the premise the fixture above is built on: if a later bundle stops asking `workflows` writes
+// to echo, this fails loudly instead of the refusal tests quietly passing for the wrong reason.
+test('REAL BUNDLE: against an echoing server the create takes its token from the write itself', async () => {
+ const { sdk, reads, writes } = await realSdk();
+ const art = await sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Active' }));
+ const pushed = await sdk.pushArtifact('bpf', art.id);
+ assert.strictEqual(pushed.saved, true);
+ const post = writes.find((w) => w.verb === 'POST' && /\/workflows$/.test(w.url));
+ const activate = writes.find((w) => w.verb === 'PATCH' && w.body && w.body.statecode === 1);
+ for (const [label, w] of [['create', post], ['activation', activate]]) {
+ assert.ok(w, `the ${label} write must be issued`);
+ assert.match(String(w.headers.Prefer || ''), /return=representation/,
+ `the ${label} write must ask for its token to be echoed; headers were ${JSON.stringify(w.headers)}`);
+ }
+ assert.ok(!reads.some((u) => /\/workflows\([^)]+\)/i.test(u)),
+ `no by-id read-back may be needed; reads were ${JSON.stringify(reads)}`);
+});
+
test('REAL BUNDLE: an Active flow is activated in the same push (statecode 1 / statuscode 2)', async () => {
// Activation is a SECOND, non-atomic request. It is what makes the process appear on the form, so
// a re-vendor that stopped issuing it would deploy flows nobody can see.
@@ -365,6 +483,62 @@ test('REAL BUNDLE: an Active flow is activated in the same push (statecode 1 / s
assert.deepStrictEqual(patch.body, { statecode: 1, statuscode: 2 });
});
+// A live build failed this way: activating a flow on a table created seconds earlier outlasted the
+// transport's wait, the activation COMMITTED anyway, and the transport re-sent it — carrying the
+// token the first attempt had just superseded — so it was refused with a 412, and the create rolled
+// itself back on that false "concurrent edit". Driven through the plugin's REAL transport, because
+// that is where the re-send lived; every other test here injects its own client.
+test('REAL BUNDLE + REAL TRANSPORT: an activation that commits after the client stopped waiting is not re-sent', async () => {
+ const { createAzHttpClient } = require('../lib/sdk-http-client.js');
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bpf-timeout-'));
+ dirs.push(dir);
+ const ORG = 'https://contoso.crm.dynamics.com';
+ let row = null;
+ const activations = [];
+ const conflict = { statusCode: 412, headers: {}, body: JSON.stringify({ error: { code: '0x80060882', message: 'The version of the existing record doesn\'t match the RowVersion property provided.' } }) };
+ // The measured `workflows` contract: an echoed write carries the row version; a stale `If-Match`
+ // answers 412; the version moves on every committed write.
+ const request = async ({ url, method, headers, body }) => {
+ const u = String(url);
+ const tok = () => `W/"${row.version}"`;
+ const ifMatch = headers['If-Match'];
+ if (method === 'POST' && /\/workflows$/.test(u)) {
+ row = { id: JSON.parse(body).workflowid, version: 1, statecode: 0 };
+ return { statusCode: 201, headers: {}, body: JSON.stringify({ workflowid: row.id, '@odata.etag': tok() }) };
+ }
+ if (method === 'PATCH' && /\/workflows\(/.test(u)) {
+ const b = JSON.parse(body);
+ if (b.statecode === 1) activations.push(ifMatch);
+ if (ifMatch && ifMatch !== tok()) return conflict;
+ if (b.statecode !== undefined) row.statecode = b.statecode;
+ row.version += 1;
+ if (b.statecode === 1 && activations.length === 1) return { error: 'Request timed out' }; // committed, unanswered
+ return { statusCode: 200, headers: { etag: tok() }, body: JSON.stringify({ '@odata.etag': tok() }) };
+ }
+ if (method === 'GET' && /\/workflows\(/.test(u)) {
+ return { statusCode: 200, headers: { etag: tok() }, body: JSON.stringify({ workflowid: row.id, statecode: row.statecode, '@odata.etag': tok() }) };
+ }
+ if (method === 'DELETE' && /\/workflows\(/.test(u)) {
+ if (ifMatch && ifMatch !== tok()) return conflict;
+ row = null;
+ return { statusCode: 204, headers: {}, body: '' };
+ }
+ return { statusCode: 200, headers: {}, body: JSON.stringify({ value: [] }) };
+ };
+ const httpClient = createAzHttpClient(ORG, { getToken: () => 'TOK', request, sleep: async () => {} });
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: ORG, httpClient });
+ await sdk.initWorkspace();
+ const art = await sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Active' }));
+ await assert.rejects(() => sdk.pushArtifact('bpf', art.id), (e) => {
+ assert.doesNotMatch(String(e.message), /Original failure: Version conflict/, 'a committed activation must not be reported as somebody else\'s edit');
+ assert.match(String(e.message), /Request timed out/, 'the real cause — an unanswered write — is what must be reported');
+ return true;
+ });
+ assert.strictEqual(activations.length, 1, `the activation must be sent exactly once; got ${activations.length}`);
+ assert.ok(row && row.statecode === 1, 'the flow the platform activated is left in place for the next build to adopt');
+});
+
test('REAL BUNDLE: a Draft flow is NOT activated', async () => {
const { sdk, writes } = await realSdk();
const art = await sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Draft' }));
diff --git a/plugins/model-apps/scripts/tests/changed-only-flow.test.js b/plugins/model-apps/scripts/tests/changed-only-flow.test.js
index 6f1e39552..b4e45a529 100644
--- a/plugins/model-apps/scripts/tests/changed-only-flow.test.js
+++ b/plugins/model-apps/scripts/tests/changed-only-flow.test.js
@@ -148,7 +148,7 @@ test('resolveLiveIdentity: WhoAmI orgId + app discovery', async () => {
whoAmI: async () => ({ status: 200, data: { OrganizationId: 'org-9' } }),
sdk: { queryRecords: async () => [{ appmoduleid: 'app-9' }] },
});
- assert.deepStrictEqual(id, { orgId: 'org-9', envUrl: 'https://e', appUniqueName: 'new_app', appId: 'app-9' });
+ assert.deepStrictEqual(id, { orgId: 'org-9', envUrl: 'https://e', appUniqueName: 'new_app', appId: 'app-9', appIdKnown: true });
});
test('resolveLiveIdentity: WhoAmI failure -> null (degrade to full build)', async () => {
@@ -164,6 +164,21 @@ test('resolveLiveIdentity: app not found -> appId null (tolerated; fresh baselin
});
assert.strictEqual(id.appId, null);
assert.strictEqual(id.orgId, 'org-9');
+ assert.strictEqual(id.appIdKnown, true, 'an empty result is a PROVEN absence, not an unreadable one');
+});
+
+// #587.4 — a FAILED app query used to collapse to the same `appId: null` as a proven absence, and
+// that null is the single fact certifying a fresh (ELIGIBLE) changed-only baseline. So one transient
+// error against a PRE-EXISTING app minted an eligible baseline for an additive build that may not
+// have converged, and a later page edit rode the fast path on it.
+test('resolveLiveIdentity: a FAILED app query is distinguishable from a proven absence', async () => {
+ const id = await flow.resolveLiveIdentity({
+ envUrl: 'https://e', appUniqueName: 'a',
+ whoAmI: async () => ({ data: { OrganizationId: 'org-9' } }),
+ sdk: { queryRecords: async () => { throw new Error('transient 503'); } },
+ });
+ assert.strictEqual(id.appId, null, 'no id was read');
+ assert.strictEqual(id.appIdKnown, false, 'and the caller must be able to tell it was UNREADABLE');
});
// ---- assembleBaselineSnapshot ----
@@ -367,3 +382,42 @@ test('run: --sample-data requested but baseline did not seed rows -> forced FULL
assert.strictEqual(record.length, 1, 'a full build ran to seed the sample data');
} finally { rm(dir); }
});
+
+// #587.4, end to end: the consequence of the identity distinction, not just the field.
+// An unreadable app id must produce an INELIGIBLE baseline carrying `uncertified-baseline` debt,
+// exactly as a known-pre-existing app does — otherwise a later page edit takes the fast path on a
+// baseline that was never proven to be a fresh create.
+test('run: an unreadable app id must not certify an eligible fresh baseline', async () => {
+ const dir = ws();
+ try {
+ const unreadable = async () => ({ ...LIVE, appId: null, appIdKnown: false });
+ await flow.runChangedOnlyApply({
+ spec: baseSpec(),
+ opts: { workspaceDir: dir, apply: true },
+ deps: baseDeps(dir, { resolveLiveIdentity: unreadable }),
+ });
+ const snap = store.readSnapshot(dir);
+ assert.ok(snap, `a snapshot must still be written; got ${JSON.stringify(snap)}`);
+ assert.strictEqual(snap.eligible, false,
+ 'an identity we could not read cannot certify a fresh create');
+ assert.ok(JSON.stringify(snap.debt || []).includes('uncertified-baseline'),
+ `the reason must be recorded as debt; got ${JSON.stringify(snap.debt)}`);
+ } finally { rm(dir); }
+});
+
+// The control: a PROVEN absence still certifies a fresh baseline, so the fix cannot be satisfied by
+// making every baseline ineligible.
+test('run: a PROVEN absent app still certifies an eligible fresh baseline', async () => {
+ const dir = ws();
+ try {
+ const absent = async () => ({ ...LIVE, appId: null, appIdKnown: true });
+ await flow.runChangedOnlyApply({
+ spec: baseSpec(),
+ opts: { workspaceDir: dir, apply: true },
+ deps: baseDeps(dir, { resolveLiveIdentity: absent }),
+ });
+ const snap = store.readSnapshot(dir);
+ assert.strictEqual(snap.eligible, true,
+ `a fresh create must still yield an eligible baseline; debt=${JSON.stringify(snap.debt)}`);
+ } finally { rm(dir); }
+});
diff --git a/plugins/model-apps/scripts/tests/entity-provision.test.js b/plugins/model-apps/scripts/tests/entity-provision.test.js
index a32c7eedd..7f3a827b2 100644
--- a/plugins/model-apps/scripts/tests/entity-provision.test.js
+++ b/plugins/model-apps/scripts/tests/entity-provision.test.js
@@ -992,17 +992,113 @@ test('a saved push whose publish failed is reported even though the push itself
});
test('requireSuccessfulPush distinguishes an already-exists collision from a version conflict', () => {
- // Both are by-value failures, but the remedies are opposite: re-download for a concurrent edit,
- // adopt-the-existing-row for a replayed create. Reporting one as the other sends the operator
- // to re-download when nothing changed under them.
+ // Both are by-value failures, but the remedies are opposite: re-download for a concurrent edit, a
+ // fresh workspace for a create that committed unrecorded. Reporting one as the other sends the
+ // operator to re-download when nothing changed under them.
const err = new Error('a record already exists at that id');
err.code = 'ARTIFACT_ALREADY_EXISTS';
assert.throws(
() => requireSuccessfulPush({ type: 'view', id: 'v9', saved: false, error: err }, 'view V9'),
- (e) => e.name === 'BuildHalt' && e.code === 'already-exists' && /adopt it/.test(e.message) && !/re-download the app/.test(e.message)
+ (e) => {
+ assert.strictEqual(e.name, 'BuildHalt');
+ assert.strictEqual(e.code, 'already-exists');
+ assert.match(e.message, /delete the \.maker-workspace directory/, 'the halt must name the step that clears it');
+ assert.match(e.message, /halts here again/, 'and say why a plain re-run does not');
+ assert.doesNotMatch(e.message, /re-download the app/);
+ assert.doesNotMatch(e.message, /adopt it \(fetchArtifact\)/, 'a plain fetch adopts nothing here — it must not be prescribed');
+ return true;
+ }
);
});
+// The remedy above, FOLLOWED against the real bundle rather than asserted. A business process flow is
+// only the vehicle — the cheapest artifact to drive into the state with a fake server — and the state
+// is type-independent: the facade maps a create's 412 to ARTIFACT_ALREADY_EXISTS for every artifact,
+// and the workspace keeps a never-pushed local copy the same way for every artifact.
+// The fake models the measured `workflows` contract: a keyed create of an existing id → 412
+// `0x80040237`; a stale `If-Match` → 412 `0x80060882`; an echoed write carries the row version.
+test('REAL BUNDLE: the already-exists remedy works — the same workspace halts again, a fresh one adopts the row', async () => {
+ const fs = require('node:fs');
+ const os = require('node:os');
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(path.join(__dirname, '..', 'vendor', 'cds-maker-sdk.cjs'));
+ const rows = new Map();
+ const wire = [];
+ const srv = { honourPrefer: false };
+ const tok = (r) => `W/"${r.version}"`;
+ const echo = (o) => srv.honourPrefer && /return=representation/i.test(String(((o && o.headers) || {}).Prefer || ''));
+ const idOf = (url) => { const m = /\/workflows\(([^)]+)\)/i.exec(String(url)); return m ? m[1].replace(/'/g, '').toLowerCase() : null; };
+ const rowBody = (id, r) => ({ workflowid: id, ...r.fields, statecode: r.statecode, statuscode: r.statuscode, '@odata.etag': tok(r) });
+ const http = {
+ get: async (url) => {
+ const id = idOf(url);
+ if (!id) return { status: 200, headers: {}, body: { value: [] } };
+ const r = rows.get(id);
+ if (!r) return { status: 404, headers: {}, body: { error: { code: '0x80040217', message: 'Does Not Exist' } } };
+ return { status: 200, headers: { etag: tok(r) }, body: rowBody(id, r) };
+ },
+ post: async (url, body, o) => {
+ const id = String(body.workflowid).toLowerCase();
+ wire.push(`POST ${id}`);
+ if (rows.has(id)) return { status: 412, headers: {}, body: { error: { code: '0x80040237', message: 'Cannot insert duplicate key.' } } };
+ rows.set(id, { fields: { ...body }, statecode: 0, statuscode: 1, version: 1 });
+ const r = rows.get(id);
+ return echo(o) ? { status: 201, headers: {}, body: rowBody(id, r) } : { status: 204, headers: {}, body: undefined };
+ },
+ patch: async (url, body, o) => {
+ const id = idOf(url); const r = rows.get(id);
+ const ifMatch = ((o && o.headers) || {})['If-Match'];
+ wire.push(`PATCH ${id} If-Match=${ifMatch || '-'}`);
+ if (!r) return { status: 404, headers: {}, body: {} };
+ if (ifMatch && ifMatch !== tok(r)) return { status: 412, headers: {}, body: { error: { code: '0x80060882', message: 'The version of the existing record doesn\'t match the RowVersion property provided.' } } };
+ const { statecode, statuscode, ...rest } = body;
+ if (statecode !== undefined) r.statecode = statecode;
+ if (statuscode !== undefined) r.statuscode = statuscode;
+ Object.assign(r.fields, rest);
+ r.version += 1;
+ return echo(o) ? { status: 200, headers: { etag: tok(r) }, body: rowBody(id, r) } : { status: 204, headers: {}, body: undefined };
+ },
+ put: async () => ({ status: 204, headers: {}, body: {} }),
+ delete: async () => ({ status: 204, headers: {}, body: {} }),
+ };
+ const dirs = [];
+ const sdkOn = async () => {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'already-exists-'));
+ dirs.push(dir);
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com', httpClient: http });
+ await sdk.initWorkspace();
+ return sdk;
+ };
+ try {
+ // 1. A create that commits while the workspace never records it. An environment that ignores
+ // `Prefer` gets there deterministically; a lost response to a committed POST does the same.
+ const first = await sdkOn();
+ const def = { name: 'Ticket Handling', entityLogicalName: 'new_ticket', status: 'Draft',
+ stages: [{ name: 'Triage', entityLogicalName: 'new_ticket', steps: [{ name: 'Subject', fieldName: 'new_subject' }] }] };
+ const art = await first.createArtifact('bpf', def);
+ await assert.rejects(() => first.pushArtifact('bpf', art.id), (e) => e.code === 'BPF_CREATE_NO_TOKEN');
+ assert.ok(rows.has(art.id.toLowerCase()), 'precondition: the row committed');
+ srv.honourPrefer = true; // from here on, an ordinary org
+ // 2. A re-run on the SAME workspace — the build's existing-artifact path is a plain fetch.
+ await first.fetchArtifact('bpf', art.id);
+ const again = await first.pushArtifact('bpf', art.id);
+ assert.throws(() => requireSuccessfulPush(again, 'business process flow Ticket Handling'),
+ (e) => e.code === 'already-exists' && /\.maker-workspace/.test(e.message),
+ 'a re-run on the same workspace must halt again, which is why the halt does not say "re-run"');
+ // 3. The remedy: a fresh workspace, then the same plain fetch.
+ wire.length = 0;
+ const fresh = await sdkOn();
+ await fresh.fetchArtifact('bpf', art.id);
+ await fresh.updateElement('bpf', art.id, '/stages/0', { name: 'Triage (renamed)' });
+ const adopted = requireSuccessfulPush(await fresh.pushArtifact('bpf', art.id), 'business process flow Ticket Handling');
+ assert.ok(adopted && adopted.saved, 'the push after a fresh fetch must commit');
+ assert.ok(!wire.some((w) => w.startsWith('POST')), `no create may be re-issued; wire was ${JSON.stringify(wire)}`);
+ assert.ok(wire.some((w) => /^PATCH .* If-Match=W\/"\d+"$/.test(w)), `the push must be a CONDITIONAL update; wire was ${JSON.stringify(wire)}`);
+ assert.match(String(rows.get(art.id.toLowerCase()).fields.xaml || ''), /Triage \(renamed\)/, 'the edit must land');
+ } finally {
+ for (const d of dirs) fs.rmSync(d, { recursive: true, force: true });
+ }
+});
+
// The set of by-value push failures is OPEN and it grows: the SDK keeps moving failures from a throw
// to a return. Every newly-returned one used to land on the "changed in Maker" wording, which named
// a cause that could not possibly apply and sent the operator to re-download an untouched app.
diff --git a/plugins/model-apps/scripts/tests/form-field-options.test.js b/plugins/model-apps/scripts/tests/form-field-options.test.js
index 3de55e628..0776a872c 100644
--- a/plugins/model-apps/scripts/tests/form-field-options.test.js
+++ b/plugins/model-apps/scripts/tests/form-field-options.test.js
@@ -396,6 +396,41 @@ test('validation rejects a non-boolean flag rather than coercing it ("false" is
assert.ok(errsFor(spec).some((e) => /readOnly must be a boolean/.test(e)));
});
+// A form-level span reaches the compiler through mergeFieldOptions exactly as an inline one does, so
+// it must meet the same rules. Before, a bad value was dropped in silence, and a form-level rowspan
+// skipped the trailing rule entirely: under an auto layout `{ new_points: { rowspan: 2 } }` compiled
+// a reservation directly above the next field.
+test('validation checks a fieldOptions span the way it checks an inline one', () => {
+ for (const bad of [0, -1, 1.5, 'abc', '2']) {
+ const errs = errsFor(specWithBigInt({ fieldOptions: { new_points: { colspan: bad } } }));
+ assert.ok(errs.some((e) => /fieldOptions\['new_points'\] has colspan .* whole number/.test(e)), `colspan ${JSON.stringify(bad)}: ${errs.join(' | ')}`);
+ }
+ for (const good of [1, 2, 4]) {
+ assert.deepStrictEqual(errsFor(specWithBigInt({ fieldOptions: { new_points: { colspan: good } } })), [], `colspan ${good}`);
+ }
+});
+
+test('validation rejects a form-level rowspan above 1 under either layout, and still allows rowspan 1', () => {
+ const auto = specWithBigInt({ fieldOptions: { new_points: { rowspan: 2 } } });
+ const explicit = specWithBigInt({
+ layout: 'explicit',
+ fieldOptions: { new_points: { rowspan: 2 } },
+ tabs: [{ label: 'G', sections: [{ columns: 2, fields: ['new_name', 'new_points', 'new_duedate'] }] }],
+ });
+ for (const [lbl, spec] of [['auto', auto], ['explicit', explicit]]) {
+ const errs = errsFor(spec);
+ assert.ok(errs.some((e) => /sets rowspan 2, which only an explicit layout can place safely/.test(e) && /"name": "new_points", "rowspan": 2/.test(e)), `${lbl}: ${errs.join(' | ')}`);
+ }
+ // rowspan 1 is the explicit "narrow back" claim and places nothing beneath the cell.
+ assert.deepStrictEqual(errsFor(specWithBigInt({ fieldOptions: { new_points: { rowspan: 1 } } })), []);
+ // The inline route stays open for the one safe position — the LAST field of a section.
+ const inlineLast = specWithBigInt({
+ layout: 'explicit',
+ tabs: [{ label: 'G', sections: [{ columns: 2, fields: ['new_name', 'new_duedate', { name: 'new_points', rowspan: 2 }] }] }],
+ });
+ assert.deepStrictEqual(errsFor(inlineLast), []);
+});
+
test('validation rejects `after` inside an explicit tabs layout — two competing orderings', () => {
const spec = specWithBigInt({
layout: 'explicit',
diff --git a/plugins/model-apps/scripts/tests/generate-page-manifest.test.js b/plugins/model-apps/scripts/tests/generate-page-manifest.test.js
index 05eb523fa..4c2493b85 100644
--- a/plugins/model-apps/scripts/tests/generate-page-manifest.test.js
+++ b/plugins/model-apps/scripts/tests/generate-page-manifest.test.js
@@ -12,6 +12,7 @@ const {
parseArgs,
buildPackageJson,
buildAmbientDeclarations,
+ writeIfAllowed,
} = require('../generate-page-manifest.js');
function mkdirTemp() {
@@ -203,3 +204,534 @@ test('CLI: stdout is valid JSON summary', () => {
fs.rmSync(dir, { recursive: true, force: true });
}
});
+
+// --- #585.10: --force must overwrite the file this tool OWNS, not whatever it points at ---------
+// `writeFileSync` follows a symlink, so a `package.json` symlinked outside the working directory
+// was overwritten AT ITS REAL TARGET — turning a scaffolding step into an arbitrary-file write.
+//
+// Creating a symlink needs elevation or Developer Mode on Windows, so the test SKIPS rather than
+// fails when it cannot make one. It still runs the non-regular-file branch below, which needs no
+// privilege, so the guard is never left completely unexercised.
+test('--force refuses to write through a symlink that escapes the working directory', (t) => {
+ const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-outside-'));
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-work-'));
+ try {
+ const victim = path.join(outside, 'precious.json');
+ fs.writeFileSync(victim, '{"keep":true}', 'utf8');
+ const link = path.join(work, 'package.json');
+ try { fs.symlinkSync(victim, link, 'file'); }
+ catch { return t.skip('cannot create a symlink on this machine (needs elevation/Developer Mode)'); }
+
+ let threw = null;
+ try { writeIfAllowed(link, '{"overwritten":true}', true, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw, 'writing through the symlink must be refused');
+ assert.strictEqual(threw.code, 'UNSAFE_OUTPUT');
+ assert.strictEqual(fs.readFileSync(victim, 'utf8'), '{"keep":true}',
+ 'the file outside the working directory must be untouched');
+ return undefined;
+ } finally {
+ fs.rmSync(outside, { recursive: true, force: true });
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+test('--force refuses a non-regular output file (needs no symlink privilege)', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-dir-'));
+ try {
+ // A DIRECTORY named package.json reproduces "exists but is not ours to overwrite" portably.
+ const target = path.join(work, 'package.json');
+ fs.mkdirSync(target);
+ let threw = null;
+ try { writeIfAllowed(target, '{}', true, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw, 'a non-regular target must be refused');
+ assert.strictEqual(threw.code, 'UNSAFE_OUTPUT');
+ assert.match(threw.message, /not a regular file/);
+ } finally { fs.rmSync(work, { recursive: true, force: true }); }
+});
+
+// The control: an ordinary regular file is still overwritten by --force, so the guard cannot be
+// satisfied by refusing everything.
+test('--force still overwrites an ordinary file in the working directory', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-ok-'));
+ try {
+ const target = path.join(work, 'package.json');
+ fs.writeFileSync(target, '{"old":true}', 'utf8');
+ const r = writeIfAllowed(target, '{"new":true}', true, fs.realpathSync(work));
+ assert.strictEqual(r.wrote, true);
+ assert.strictEqual(fs.readFileSync(target, 'utf8'), '{"new":true}');
+ } finally { fs.rmSync(work, { recursive: true, force: true }); }
+});
+
+// A DANGLING symlink is the sharper version of the same bug, and the first fix for it missed this:
+// `existsSync` FOLLOWS symlinks, so a link whose target does not exist yet reported "nothing here",
+// skipped every check, and `writeFileSync` CREATED the file at the outside target. MEASURED before
+// the guard moved to `lstat`. That is worse than the overwrite case — it puts a file where none was.
+test('--force refuses a DANGLING symlink instead of creating its outside target', (t) => {
+ const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-dangle-out-'));
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-dangle-work-'));
+ try {
+ const victim = path.join(outside, 'created-by-escape.json'); // deliberately NOT created
+ const link = path.join(work, 'package.json');
+ try { fs.symlinkSync(victim, link, 'file'); }
+ catch { return t.skip('cannot create a symlink on this machine (needs elevation/Developer Mode)'); }
+
+ assert.strictEqual(fs.existsSync(link), false,
+ 'precondition: existsSync follows the link, so a dangling one reads false');
+
+ let threw = null;
+ try { writeIfAllowed(link, '{"escaped":true}', true, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw, 'a dangling symlink must be refused');
+ assert.strictEqual(threw.code, 'UNSAFE_OUTPUT');
+ assert.strictEqual(fs.existsSync(victim), false,
+ 'nothing may be CREATED outside the working directory');
+ return undefined;
+ } finally {
+ fs.rmSync(outside, { recursive: true, force: true });
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// Without --force an ordinary existing file is still preserved, not refused: the new lstat probe
+// must not turn "already there" into an error.
+test('without --force an existing ordinary file is preserved, not an error', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-keep-'));
+ try {
+ const target = path.join(work, 'package.json');
+ fs.writeFileSync(target, '{"old":true}', 'utf8');
+ const r = writeIfAllowed(target, '{"new":true}', false, fs.realpathSync(work));
+ assert.strictEqual(r.wrote, false);
+ assert.match(r.reason, /exists/);
+ assert.strictEqual(fs.readFileSync(target, 'utf8'), '{"old":true}');
+ } finally { fs.rmSync(work, { recursive: true, force: true }); }
+});
+
+test('a brand-new file is written normally (the guard must not block the common case)', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-new-'));
+ try {
+ const target = path.join(work, 'package.json');
+ const r = writeIfAllowed(target, '{"fresh":true}', false, fs.realpathSync(work));
+ assert.strictEqual(r.wrote, true);
+ assert.strictEqual(fs.readFileSync(target, 'utf8'), '{"fresh":true}');
+ } finally { fs.rmSync(work, { recursive: true, force: true }); }
+});
+
+// --- review follow-up: the leaf check alone did not confine anything --------------------------
+// Three separate escapes survived a guard that only lstat-ed the final path component.
+
+// 1. A HARD LINK is a regular file. `isFile()` is true, there is no link to notice, and the inode
+// is shared — so writing "the file in the working directory" edited the outside file just as
+// surely as a symlink would. A file this tool owns has exactly one name.
+test('--force refuses a hard link into a file outside the working directory', (t) => {
+ const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-hl-out-'));
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-hl-work-'));
+ try {
+ const victim = path.join(outside, 'precious.json');
+ fs.writeFileSync(victim, '{"keep":true}', 'utf8');
+ const target = path.join(work, 'package.json');
+ try { fs.linkSync(victim, target); }
+ catch { return t.skip('cannot create a hard link on this filesystem'); }
+
+ assert.strictEqual(fs.lstatSync(target).isFile(), true,
+ 'precondition: a hard link IS a regular file, which is why the isFile() check missed it');
+
+ let threw = null;
+ try { writeIfAllowed(target, '{"overwritten":true}', true, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw, 'writing through a hard link must be refused');
+ assert.strictEqual(threw.code, 'UNSAFE_OUTPUT');
+ assert.match(threw.message, /hard link/);
+ assert.strictEqual(fs.readFileSync(victim, 'utf8'), '{"keep":true}',
+ 'the file outside the working directory must be untouched');
+ return undefined;
+ } finally {
+ fs.rmSync(outside, { recursive: true, force: true });
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// 2. THE WORKING DIRECTORY RESOLVES SOMEWHERE ELSE AT WRITE TIME. `main` takes the approved root
+// once, at startup; if the directory is swapped for a link afterwards, the leaf is still an ordinary
+// file and passes every leaf check — only the re-resolution at write time can see that the output
+// now lands outside the root. That is what this pins: the approved root and the directory the write
+// resolves into disagree, so the write is refused. (A link planted at the working-directory path
+// BEFORE startup is refused by `main` itself — see the CLI tests below.)
+test('an output that no longer resolves inside the approved root is refused (directory swapped after startup)', (t) => {
+ const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-anc-out-'));
+ const approved = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-anc-root-'));
+ try {
+ // `approved/work` is a LINK to a directory outside the approved root.
+ const linkedWork = path.join(approved, 'work');
+ try { fs.symlinkSync(outside, linkedWork, 'dir'); }
+ catch { return t.skip('cannot create a symlink on this machine (needs elevation/Developer Mode)'); }
+
+ const victim = path.join(outside, 'package.json');
+ fs.writeFileSync(victim, '{"keep":true}', 'utf8');
+ const target = path.join(linkedWork, 'package.json');
+ assert.strictEqual(fs.lstatSync(target).isFile(), true,
+ 'precondition: the LEAF is an ordinary file — only the directory escapes');
+
+ let threw = null;
+ try { writeIfAllowed(target, '{"overwritten":true}', true, fs.realpathSync(approved)); } catch (e) { threw = e; }
+ assert.ok(threw, 'an output resolving outside the approved root must be refused');
+ assert.strictEqual(threw.code, 'UNSAFE_OUTPUT');
+ assert.match(threw.message, /outside the working directory/);
+ assert.strictEqual(fs.readFileSync(victim, 'utf8'), '{"keep":true}');
+ return undefined;
+ } finally {
+ fs.rmSync(outside, { recursive: true, force: true });
+ fs.rmSync(approved, { recursive: true, force: true });
+ }
+});
+
+// 3. A PARENT THAT IS NOT A DIRECTORY. `realpath` succeeds on a regular file, so a parent that is a
+// file must be refused by the directory check rather than surfacing as a failed write. ENOTDIR is
+// portable: a path whose PARENT is a regular file cannot be written into.
+test('a parent that is a regular file is refused as unsafe, not reported as a failed write', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-probe-'));
+ try {
+ const notADir = path.join(work, 'blocker');
+ fs.writeFileSync(notADir, 'i am a file', 'utf8');
+ const target = path.join(notADir, 'package.json'); // parent is a FILE -> ENOTDIR
+ let threw = null;
+ try { writeIfAllowed(target, '{}', true, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw, 'an uninspectable output must be refused');
+ assert.strictEqual(threw.code, 'UNSAFE_OUTPUT');
+ assert.strictEqual(fs.readFileSync(notADir, 'utf8'), 'i am a file',
+ 'and nothing may be written through it');
+ } finally { fs.rmSync(work, { recursive: true, force: true }); }
+});
+
+// The write is a temp-file-and-rename, so it must leave no debris behind on the happy path.
+test('the atomic replace leaves no temp file behind', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-tmp-'));
+ try {
+ const target = path.join(work, 'package.json');
+ writeIfAllowed(target, '{"fresh":true}', false, fs.realpathSync(work));
+ const left = fs.readdirSync(work);
+ assert.deepStrictEqual(left, ['package.json'],
+ `only the intended output may remain; got ${JSON.stringify(left)}`);
+ } finally { fs.rmSync(work, { recursive: true, force: true }); }
+});
+
+// --- review follow-up: pin each part of the confinement, one mutant at a time ------------------
+// Three parts could be reverted without any test failing: the fail-closed probe (only reached via a
+// case the directory check already caught), the atomic replace (a direct write also leaves no temp
+// file), and the retry guard's adoption case. Each test below fails when its part is reverted.
+
+// FAIL CLOSED: a leaf that cannot be INSPECTED is refused as unsafe. EACCES from a directory without
+// search permission is the portable-enough trigger; Windows has no such mode, and root bypasses it.
+test('a leaf whose probe fails with anything but ENOENT is refused as unsafe (POSIX)', (t) => {
+ if (process.platform === 'win32') return t.skip('no search-permission bit on Windows');
+ if (typeof process.getuid === 'function' && process.getuid() === 0) return t.skip('root bypasses permission checks');
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-eacces-'));
+ const locked = path.join(work, 'locked');
+ fs.mkdirSync(locked);
+ try {
+ fs.chmodSync(locked, 0o600); // readable, but no search permission: lstat of a child is EACCES
+ let threw = null;
+ try { writeIfAllowed(path.join(locked, 'package.json'), '{}', true, fs.realpathSync(locked)); } catch (e) { threw = e; }
+ assert.ok(threw, 'an uninspectable leaf must be refused');
+ assert.strictEqual(threw.code, 'UNSAFE_OUTPUT',
+ `"could not look" must be a safety refusal, not a failed write; got ${threw.code}: ${threw.message}`);
+ return undefined;
+ } finally {
+ fs.chmodSync(locked, 0o700);
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// The same branch on EVERY platform, deterministically: the leaf probe itself fails with EACCES.
+// With the probe swallowed as "nothing there", the write would simply go ahead.
+test('a leaf probe failing with EACCES is refused as unsafe (all platforms, stubbed probe)', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-eacces-stub-'));
+ const target = path.join(work, 'package.json');
+ const real = fs.lstatSync;
+ try {
+ const resolvedTarget = path.join(fs.realpathSync(work), 'package.json');
+ fs.lstatSync = (p, ...rest) => {
+ if (path.resolve(String(p)) === resolvedTarget) { const e = new Error('EACCES: permission denied'); e.code = 'EACCES'; throw e; }
+ return real(p, ...rest);
+ };
+ let threw = null;
+ try { writeIfAllowed(target, '{}', true, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw, 'an uninspectable leaf must be refused, not written');
+ assert.strictEqual(threw.code, 'UNSAFE_OUTPUT');
+ assert.strictEqual(fs.existsSync(target), false, 'nothing may be written');
+ } finally {
+ fs.lstatSync = real;
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// The PARENT gets the same fail-closed treatment as the leaf. A directory that cannot be resolved
+// (here: it does not exist) is refused as a safety failure, never created — the caller asked to
+// write inside the working directory, and a missing parent means that is not where this would land.
+test('a parent directory that cannot be resolved is refused as unsafe, and nothing is created', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-noparent-'));
+ try {
+ const missing = path.join(work, 'not-there');
+ let threw = null;
+ try { writeIfAllowed(path.join(missing, 'package.json'), '{}', true, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw, 'an unresolvable parent must be refused');
+ assert.strictEqual(threw.code, 'UNSAFE_OUTPUT');
+ assert.match(threw.message, /could not be resolved/);
+ assert.strictEqual(fs.existsSync(missing), false, 'the missing directory must not be created');
+ } finally {
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// A parent that resolves but cannot then be INSPECTED (permissions changed, or the entry vanished in
+// between) is refused too. Stubbed, because no real filesystem produces that ordering on demand.
+test('a parent directory that resolves but cannot be inspected is refused as unsafe (stubbed stat)', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-statfail-'));
+ const real = fs.statSync;
+ try {
+ const realWork = fs.realpathSync(work);
+ fs.statSync = (p, ...rest) => {
+ if (path.resolve(String(p)) === realWork) { const e = new Error('EACCES: permission denied'); e.code = 'EACCES'; throw e; }
+ return real(p, ...rest);
+ };
+ let threw = null;
+ try { writeIfAllowed(path.join(work, 'package.json'), '{}', true, realWork); } catch (e) { threw = e; }
+ assert.ok(threw, 'an uninspectable parent must be refused');
+ assert.strictEqual(threw.code, 'UNSAFE_OUTPUT');
+ assert.match(threw.message, /could not be inspected/);
+ assert.strictEqual(fs.existsSync(path.join(work, 'package.json')), false, 'nothing may be written');
+ } finally {
+ fs.statSync = real;
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// ATOMIC REPLACE: --force must replace the directory ENTRY, not write into the existing file. The
+// observable difference is the file identity — an in-place write keeps it, a rename changes it.
+test('--force replaces the file entry rather than writing into the existing file', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-atomic-'));
+ try {
+ const target = path.join(work, 'package.json');
+ fs.writeFileSync(target, '{"old":true}');
+ const before = fs.statSync(target, { bigint: true }).ino;
+ writeIfAllowed(target, '{"new":true}', true, fs.realpathSync(work));
+ assert.strictEqual(fs.readFileSync(target, 'utf8'), '{"new":true}');
+ assert.notStrictEqual(fs.statSync(target, { bigint: true }).ino, before,
+ 'the target must be a NEW file renamed into place — an in-place write would follow a link swapped in after the checks');
+ } finally { fs.rmSync(work, { recursive: true, force: true }); }
+});
+
+// Without --force nothing that exists is written, so it must be SKIPPED, not refused — refusing a
+// hard-linked package.json aborted the whole run, and genpage.d.ts was then never written.
+test('without --force a hard-linked existing file is skipped, and the run still writes the rest', (t) => {
+ const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-hlskip-out-'));
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-hlskip-'));
+ try {
+ const victim = path.join(outside, 'precious.json');
+ fs.writeFileSync(victim, '{"keep":true}');
+ try { fs.linkSync(victim, path.join(work, 'package.json')); }
+ catch { return t.skip('cannot create a hard link on this filesystem'); }
+ const r = runScript([work, 'probe-page']);
+ assert.strictEqual(r.code, 0, `a run without --force must not fail on an existing file; stderr: ${r.stderr}`);
+ assert.strictEqual(fs.readFileSync(victim, 'utf8'), '{"keep":true}', 'the linked file is untouched');
+ assert.ok(fs.existsSync(path.join(work, 'genpage.d.ts')), 'and the other output is still written');
+ return undefined;
+ } finally {
+ fs.rmSync(outside, { recursive: true, force: true });
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// A read-only file is a deliberate "do not modify". The in-place write refused it; a rename would
+// replace it silently, because replacing an entry needs write access to the directory, not the file.
+test('--force refuses a read-only file instead of silently replacing it', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-ro-'));
+ const target = path.join(work, 'package.json');
+ try {
+ fs.writeFileSync(target, '{"frozen":true}');
+ fs.chmodSync(target, 0o444);
+ let threw = null;
+ try { writeIfAllowed(target, '{}', true, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw, 'a read-only target must be refused');
+ assert.match(threw.message, /read-only/);
+ assert.strictEqual(fs.readFileSync(target, 'utf8'), '{"frozen":true}');
+ } finally {
+ fs.chmodSync(target, 0o644);
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// A replaced file keeps its permission bits — the rename would otherwise hand it the temp file's.
+test('--force keeps the replaced file\'s permission bits (POSIX)', (t) => {
+ if (process.platform === 'win32') return t.skip('POSIX permission bits only');
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-mode-'));
+ try {
+ const target = path.join(work, 'package.json');
+ fs.writeFileSync(target, '{}');
+ fs.chmodSync(target, 0o640);
+ writeIfAllowed(target, '{"new":true}', true, fs.realpathSync(work));
+ assert.strictEqual(fs.statSync(target).mode & 0o777, 0o640);
+ return undefined;
+ } finally { fs.rmSync(work, { recursive: true, force: true }); }
+});
+
+// A temp name that someone ELSE created is not ours to delete. `wx` refuses to reuse it; cleanup
+// must then leave it alone rather than remove a file this call never wrote.
+test('cleanup never deletes a temp-named file this call did not create', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-foreign-tmp-'));
+ const real = fs.writeFileSync;
+ const realOpen = fs.openSync;
+ let foreign = null;
+ // Another process takes the temp name first, so the exclusive create refuses. Intercepted in
+ // either shape the exclusive create can take: an `fs.openSync(p, 'wx')` or a `wx` writeFileSync.
+ const takenFirst = (p) => {
+ real(p, 'someone else');
+ foreign = String(p);
+ const e = new Error('EEXIST: file already exists'); e.code = 'EEXIST'; return e;
+ };
+ try {
+ fs.openSync = (p, flags, ...rest) => {
+ if (/\.tmp$/.test(String(p)) && flags === 'wx') throw takenFirst(p);
+ return realOpen(p, flags, ...rest);
+ };
+ fs.writeFileSync = (p, data, opts) => {
+ if (/\.tmp$/.test(String(p)) && opts && opts.flag === 'wx') throw takenFirst(p);
+ return real(p, data, opts);
+ };
+ let threw = null;
+ try { writeIfAllowed(path.join(work, 'package.json'), '{}', false, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw, 'the write must fail when its temp name is taken');
+ assert.ok(foreign && fs.existsSync(foreign), 'the other process\'s file must survive our cleanup');
+ } finally {
+ fs.writeFileSync = real;
+ fs.openSync = realOpen;
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// A failed replace must clean up ITS OWN temp file and report an I/O error.
+test('a failed rename removes the temp file this call created', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-fail-'));
+ const real = fs.renameSync;
+ try {
+ fs.renameSync = () => { const e = new Error('EXDEV: cross-device link not permitted'); e.code = 'EXDEV'; throw e; };
+ let threw = null;
+ try { writeIfAllowed(path.join(work, 'package.json'), '{}', false, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw);
+ assert.strictEqual(threw.code, 'IO_ERROR');
+ assert.deepStrictEqual(fs.readdirSync(work), [], 'no temp debris may remain');
+ } finally {
+ fs.renameSync = real;
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// The temp file is ours from the moment the exclusive open succeeds. A write that fails AFTER the
+// open (ENOSPC, EDQUOT, EIO) leaves the file behind — fs.writeFileSync closes it but does not remove
+// it — so ownership must not wait for the write to return, or each retry strands another temp file.
+test('a write that fails after the temp file was created still removes it', () => {
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-enospc-'));
+ const real = fs.writeFileSync;
+ try {
+ // Simulates the real failure for either write shape: by fd, or by path — where Node has already
+ // created the file when the write fails.
+ const enospc = () => { const e = new Error('ENOSPC: no space left on device, write'); e.code = 'ENOSPC'; return e; };
+ fs.writeFileSync = (target, ...rest) => {
+ if (typeof target === 'number') throw enospc();
+ if (String(target).endsWith('.tmp')) { fs.closeSync(fs.openSync(target, 'wx')); throw enospc(); }
+ return real(target, ...rest);
+ };
+ let threw = null;
+ try { writeIfAllowed(path.join(work, 'package.json'), '{}', false, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw, 'the failed write must be reported');
+ assert.strictEqual(threw.code, 'IO_ERROR');
+ assert.deepStrictEqual(fs.readdirSync(work), [], 'no temp debris may remain');
+ } finally {
+ fs.writeFileSync = real;
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// Windows: a scanner or indexer briefly holding the destination is retried; a lock that outlasts
+// the retry is reported as what it almost certainly is.
+test('a transiently locked destination is retried on Windows', (t) => {
+ if (process.platform !== 'win32') return t.skip('the lock retry is Windows-only');
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-lock-'));
+ const real = fs.renameSync;
+ try {
+ let calls = 0;
+ fs.renameSync = (a, b) => {
+ calls += 1;
+ if (calls <= 2) { const e = new Error('EPERM: operation not permitted'); e.code = 'EPERM'; throw e; }
+ return real(a, b);
+ };
+ const r = writeIfAllowed(path.join(work, 'package.json'), '{"ok":true}', false, fs.realpathSync(work));
+ assert.strictEqual(r.wrote, true);
+ assert.strictEqual(calls, 3, 'two refused renames, then success');
+ assert.deepStrictEqual(fs.readdirSync(work), ['package.json']);
+ return undefined;
+ } finally {
+ fs.renameSync = real;
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+test('a persistently locked destination fails with an actionable message on Windows', (t) => {
+ if (process.platform !== 'win32') return t.skip('the lock retry is Windows-only');
+ const work = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-lock2-'));
+ const real = fs.renameSync;
+ try {
+ fs.renameSync = () => { const e = new Error('EPERM: operation not permitted'); e.code = 'EPERM'; throw e; };
+ let threw = null;
+ try { writeIfAllowed(path.join(work, 'package.json'), '{}', false, fs.realpathSync(work)); } catch (e) { threw = e; }
+ assert.ok(threw);
+ assert.strictEqual(threw.code, 'IO_ERROR');
+ assert.match(threw.message, /another program may have it open/);
+ assert.deepStrictEqual(fs.readdirSync(work), [], 'the temp file is cleaned up');
+ return undefined;
+ } finally {
+ fs.renameSync = real;
+ fs.rmSync(work, { recursive: true, force: true });
+ }
+});
+
+// --- the working directory itself, through the REAL CLI ------------------------------------------
+// A link pre-planted at the path a caller creates (`mkdir -p` succeeds on one silently) would
+// redirect every write the run makes. A junction needs no privilege on Windows, so this runs there.
+function linkDir(target, link) {
+ fs.symlinkSync(target, link, process.platform === 'win32' ? 'junction' : 'dir');
+}
+
+test('CLI: a working directory that is itself a link or junction is refused', (t) => {
+ const base = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-cli-link-'));
+ try {
+ const realDir = path.join(base, 'real');
+ fs.mkdirSync(realDir);
+ const link = path.join(base, 'work');
+ try { linkDir(realDir, link); } catch { return t.skip('cannot create a directory link here'); }
+ const r = runScript([link, 'probe-page', '--force']);
+ assert.strictEqual(r.code, 2, `a linked working directory must be refused; stdout: ${r.stdout}`);
+ assert.match(r.stderr, /symbolic link or junction/);
+ assert.deepStrictEqual(fs.readdirSync(realDir), [], 'nothing may be written through the link');
+ return undefined;
+ } finally { fs.rmSync(base, { recursive: true, force: true }); }
+});
+
+test('CLI: a linked ANCESTOR is followed — the output lands in the real directory', (t) => {
+ const base = fs.mkdtempSync(path.join(os.tmpdir(), 'gpm-cli-anc-'));
+ try {
+ const realParent = path.join(base, 'realParent');
+ fs.mkdirSync(realParent);
+ const linkParent = path.join(base, 'linkParent');
+ try { linkDir(realParent, linkParent); } catch { return t.skip('cannot create a directory link here'); }
+ const work = path.join(linkParent, 'page');
+ fs.mkdirSync(work);
+ const r = runScript([work, 'probe-page']);
+ assert.strictEqual(r.code, 0, `a linked ancestor is a normal setup and must work; stderr: ${r.stderr}`);
+ assert.ok(fs.existsSync(path.join(realParent, 'page', 'package.json')), 'written at the real location');
+ return undefined;
+ } finally { fs.rmSync(base, { recursive: true, force: true }); }
+});
+
+test('writeIfAllowed without an approved root refuses the write, like every other unsafe output', () => {
+ const target = path.join(os.tmpdir(), `gpm-noroot-${process.pid}.json`);
+ assert.throws(() => writeIfAllowed(target, '{}', true), (e) => e.code === 'UNSAFE_OUTPUT');
+ assert.strictEqual(fs.existsSync(target), false, 'nothing may be written without a root to confine it to');
+});
diff --git a/plugins/model-apps/scripts/tests/genpage-cli.test.js b/plugins/model-apps/scripts/tests/genpage-cli.test.js
index e30b2c3e9..1c79eac15 100644
--- a/plugins/model-apps/scripts/tests/genpage-cli.test.js
+++ b/plugins/model-apps/scripts/tests/genpage-cli.test.js
@@ -634,3 +634,354 @@ test('a name-less create still snapshots and reconciles an uncertain result (no
assert.deepStrictEqual(uploadCalls[1].slice(uploadCalls[1].indexOf('--page-id'), uploadCalls[1].indexOf('--page-id') + 2),
['--page-id', GP_NEW], 'the retry targets the adopted page instead of creating a duplicate');
});
+
+// --- #588.1: a page NAME must not be able to supply the list summary ----------------------------
+// The count was matched anywhere in stdout, and pac prints names in a fixed-width table — so a page
+// called "Found 1 generated page" made a listing with NO real summary line read as AUTHORITATIVE.
+// An authoritative-looking but truncated listing is what drives a duplicate CREATE.
+test('a page NAME cannot spoof the summary and make a truncated listing authoritative', () => {
+ const spoof = [
+ 'Connected as [email protected]',
+ 'Page ID Name Published',
+ `${GUID} Found 1 generated page Yes`,
+ ].join('\n');
+ const k = classifyListOutput(spoof);
+ assert.strictEqual(k.kind, 'unrecognized',
+ `a name-supplied count is not a summary; got ${JSON.stringify(k)}`);
+ assert.deepStrictEqual(k.pages, [], 'an unrecognized listing yields no authoritative pages');
+});
+
+test('a REAL standalone summary line is still read (the fix must not break normal listings)', () => {
+ const k = classifyListOutput(listText([{ pageId: GUID, name: 'Overview' }]));
+ assert.strictEqual(k.kind, 'pages');
+ assert.strictEqual(k.pages.length, 1);
+ assert.strictEqual(parseListCount(LIST_EMPTY), 0, 'an explicit Found 0 is still read');
+});
+
+// --- #588.5: a page id is durable identity, so only a canonical GUID may become one --------------
+// `[0-9a-fA-F-]{36}` accepted 36 characters from an alphabet containing `-`, so a row of dashes and
+// any mis-grouped hex passed — and an OVERLONG token matched its first 36 characters, silently
+// TRUNCATING a malformed id into a plausible one.
+test('parsePageId REFUSES malformed and overlong ids instead of truncating them', () => {
+ assert.strictEqual(parsePageId('Page ID: ------------------------------------'), null,
+ 'a run of dashes is 36 characters but not a GUID');
+ assert.strictEqual(parsePageId('Page ID: 111111112222333344445555555555555555'), null,
+ 'ungrouped hex is not a canonical GUID');
+ assert.strictEqual(parsePageId('Page ID: 6e0c28a2-cdbf-41ec-9186-d10fd5de6e35f'), null,
+ 'an OVERLONG token must be refused, never trimmed to a valid-looking id');
+ assert.strictEqual(parsePageId('Page ID: 6e0c28a2-cdbf-41ec-9186-d10fd5de6e3'), null,
+ 'a short token is refused too');
+});
+
+test('parsePageId still accepts a real id, in either case, with trailing output', () => {
+ assert.strictEqual(parsePageId('Page ID: 6e0c28a2-cdbf-41ec-9186-d10fd5de6e35'),
+ '6e0c28a2-cdbf-41ec-9186-d10fd5de6e35');
+ assert.strictEqual(parsePageId('Page ID: 6E0C28A2-CDBF-41EC-9186-D10FD5DE6E35\nDone.'),
+ '6E0C28A2-CDBF-41EC-9186-D10FD5DE6E35', 'pac may normalize GUID casing');
+});
+
+// A malformed id must not simply vanish: with no parsable identity the upload is UNCERTAIN, and the
+// env-wide before/after diff has to run so a landed create is adopted rather than blindly retried.
+test('a malformed Page ID drives uncertain-create reconciliation, not a blind retry', async () => {
+ const seen = [];
+ let uploads = 0;
+ const cli = makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ seen.push(args);
+ if (args.includes('list')) {
+ return { status: 0, stdout: uploads === 0 ? LIST_EMPTY : listText([{ pageId: GUID, name: 'N' }]), stderr: '' };
+ }
+ uploads += 1;
+ // Zero exit, but the id is malformed — historically parsed and stored as identity.
+ if (uploads === 1) return { status: 0, stdout: 'Page ID: ------------------------------------', stderr: '' };
+ return { status: 0, stdout: `Page ID: ${GUID}`, stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ const res = await cli.upload({ appId: 'a1', codeFile: 'p.tsx', name: 'N', prompt: 'p', agentMessage: 'm' });
+ assert.strictEqual(res.pageId, GUID,
+ 'the landed create must be ADOPTED by id diff, not identified by the malformed token');
+ const uploadCalls = seen.filter((a) => a.includes('upload'));
+ assert.strictEqual(uploadCalls.length, 2, 'one create + one adopted update');
+ assert.ok(uploadCalls[1].includes('--page-id'), 'the retry targets the adopted page');
+});
+
+// --- G4: keep the diagnostic pac produced, and do not retry a deterministic failure -------------
+// CAPTURED VERBATIM from `pac model genpage download` with no --app-id. pac prints a banner, then
+// the error, then a full help dump — so the LAST non-empty line is a flag description and the real
+// cause sits in the middle. The wrapper used to report exactly that last line.
+const REAL_PAC_ARG_FAILURE = [
+ 'Microsoft PowerPlatform CLI',
+ 'Version: 0.1.0-dev (.NET 10.0.12)',
+ 'Online documentation: https://aka.ms/PowerPlatformCLI',
+ 'Feedback, Suggestions, Issues: https://github.com/microsoft/powerplatform-build-tools/discussions',
+ '',
+ 'Error: A required argument --app-id is missing.',
+ '',
+ 'Usage: pac model genpage download [--environment] --app-id [--page-id] [--output-directory]',
+ '',
+ ' --environment Specifies the target Dataverse. (alias: -env)',
+ ' --app-id The ID of the model-driven app.',
+ ' --output-directory Directory to save pulled pages. (alias: -o)',
+].join('\n');
+
+test('a REAL pac failure banner reports the Error line, not the last help row', async () => {
+ let thrown = null;
+ const cli = makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ if (args.includes('list')) return { status: 0, stdout: LIST_EMPTY, stderr: '' };
+ return { status: 1, stdout: REAL_PAC_ARG_FAILURE, stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ try { await cli.upload({ appId: 'a1', codeFile: 'p.tsx', name: 'N', prompt: 'p', agentMessage: 'm' }); }
+ catch (e) { thrown = e; }
+ assert.ok(thrown, 'the upload must fail');
+ assert.match(thrown.message, /required argument --app-id is missing/,
+ `the real cause must survive; got ${thrown.message}`);
+ assert.ok(!/alias: -o/.test(thrown.message),
+ `a help row must not be reported as the error; got ${thrown.message}`);
+});
+
+test('a deterministic failure is reported at once, not retried until the budget is spent', async () => {
+ let uploadAttempts = 0;
+ const cli = makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ if (args.includes('list')) return { status: 0, stdout: LIST_EMPTY, stderr: '' };
+ uploadAttempts += 1;
+ return { status: 1, stdout: REAL_PAC_ARG_FAILURE, stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ await assert.rejects(() => cli.upload({ appId: 'a1', codeFile: 'p.tsx', name: 'N', prompt: 'p', agentMessage: 'm' }));
+ assert.strictEqual(uploadAttempts, 1,
+ `an argument fault cannot succeed on a retry; attempted ${uploadAttempts} times`);
+});
+
+// The retry budget still exists for what it was built for: transient service flakes.
+test('a TRANSIENT failure is still retried and can succeed', async () => {
+ let uploadAttempts = 0;
+ const cli = makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ if (args.includes('list')) {
+ return { status: 0, stdout: uploadAttempts === 0 ? LIST_EMPTY : LIST_EMPTY, stderr: '' };
+ }
+ uploadAttempts += 1;
+ if (uploadAttempts === 1) return { status: 1, stdout: '', stderr: 'The service is temporarily unavailable. Please try again.' };
+ return { status: 0, stdout: `Page ID: ${GUID}`, stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ const res = await cli.upload({ appId: 'a1', codeFile: 'p.tsx', name: 'N', prompt: 'p', agentMessage: 'm' });
+ assert.strictEqual(res.pageId, GUID);
+ assert.strictEqual(uploadAttempts, 2, 'a transient failure must still be retried');
+});
+
+// --- #588.6: a path ending in a separator must not swallow the flags that follow ----------------
+// Windows command-line parsing treats `\"` as an ESCAPED QUOTE, so a directory argument ending in
+// a backslash escaped its own closing quote. Captured from a real cmd.exe parse before the fix:
+// ["--output-directory", "C:\\Users\\Power User\\download\" --app-id after"]
+// i.e. the path absorbed the rest of the command line and --app-id was never passed.
+test('a trailing backslash is doubled so it cannot escape the closing quote', () => {
+ // `String.raw` cannot be used here: a template literal may not END with a backslash, because it
+ // escapes the closing backtick. Ordinary escapes it is.
+ const dir = 'C:\\Users\\Power User\\download\\';
+ const inv = buildPacInvocation(['model', 'genpage', 'download', '--output-directory', dir, '--app-id', 'after'], 'win32');
+ // The run before the closing quote is doubled; the following flag stays a separate argument.
+ assert.match(inv.command, /--output-directory "C:\\Users\\Power User\\download\\\\" --app-id after$/,
+ `the trailing separator must be escaped; got ${inv.command}`);
+});
+
+test('interior backslashes are left alone (every Windows path has them)', () => {
+ const inv = buildPacInvocation(['model', 'genpage', 'download', '--output-directory', String.raw`C:\Users\Power User\download`], 'win32');
+ assert.match(inv.command, /"C:\\Users\\Power User\\download"/,
+ `an ordinary path must round-trip unchanged; got ${inv.command}`);
+});
+
+test('POSIX passes args verbatim, with no cmd-style quoting at all', () => {
+ const dir = '/home/user/download\\';
+ const inv = buildPacInvocation(['model', 'genpage', 'download', '--output-directory', dir], 'linux');
+ assert.deepStrictEqual(inv.args, ['model', 'genpage', 'download', '--output-directory', dir],
+ 'the POSIX path spawns pac directly, so nothing may be rewritten');
+});
+
+// --- review follow-up: a TRANSIENT message must NOT be mistaken for a deterministic one --------
+// The first version matched the bare phrases "does not exist" and "could not be found", so a
+// service message like "The resource does not exist yet; please retry." aborted the retry loop —
+// losing a retry that would have SUCCEEDED. A lost retry fails a build; a needless retry costs
+// about a second, and that asymmetry is what decides the trade.
+const runRetryCase = async (stderr) => {
+ let attempts = 0;
+ const cli = makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ if (args.includes('list')) return { status: 0, stdout: LIST_EMPTY, stderr: '' };
+ attempts += 1;
+ return { status: 1, stdout: '', stderr };
+ },
+ sleep: async () => {},
+ });
+ try { await cli.upload({ appId: 'a1', codeFile: 'p.tsx', name: 'N', prompt: 'p', agentMessage: 'm' }); } catch { /* expected */ }
+ return attempts;
+};
+
+test('a transient message containing "does not exist" is still RETRIED', async () => {
+ for (const msg of [
+ 'The resource does not exist yet; please retry.',
+ 'Error: The specified environment does not exist.',
+ 'Error: The app module could not be found.',
+ 'The service is temporarily unavailable. Please try again.',
+ ]) {
+ // eslint-disable-next-line no-await-in-loop
+ const attempts = await runRetryCase(msg);
+ assert.strictEqual(attempts, 3, `"${msg}" must be retried; attempted ${attempts} time(s)`);
+ }
+});
+
+// The real pac wording for a missing file, MEASURED, carries argument AND file context — which is
+// what makes it unambiguously deterministic where a bare phrase is not.
+test('a REAL pac argument/file fault is still short-circuited', async () => {
+ for (const msg of [
+ 'Error: A required argument --app-id is missing.',
+ "Error: The value passed to '--code-file' is invalid. The file 'D:\\nope\\absent.tsx' could not be found.",
+ ]) {
+ // eslint-disable-next-line no-await-in-loop
+ const attempts = await runRetryCase(msg);
+ assert.strictEqual(attempts, 1, `"${msg}" cannot succeed on a retry; attempted ${attempts} time(s)`);
+ }
+});
+
+// --- review follow-up: the diagnostic fallback must not report only the banner -----------------
+// `FLAG_HELP_RE` drops the help dump, but pac can print the ONLY diagnostic in that same indented
+// shape. With no `Error:` line, the filtered set was empty and the fallback took the FIRST four
+// lines — the banner — discarding the one line that said anything.
+test('a flag-SHAPED sole diagnostic survives instead of being replaced by the banner', async () => {
+ const out = [
+ 'Microsoft PowerPlatform CLI',
+ 'Version: 0.1.0-dev (.NET 10.0.12)',
+ 'Online documentation: https://aka.ms/PowerPlatformCLI',
+ 'Feedback, Suggestions, Issues: https://github.com/microsoft/powerplatform-build-tools/discussions',
+ ' --output-directory does not exist: C:\\missing',
+ ].join('\n');
+ let thrown = null;
+ const cli = makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ if (args.includes('list')) return { status: 0, stdout: LIST_EMPTY, stderr: '' };
+ return { status: 1, stdout: out, stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ try { await cli.upload({ appId: 'a1', codeFile: 'p.tsx', name: 'N', prompt: 'p', agentMessage: 'm' }); }
+ catch (e) { thrown = e; }
+ assert.ok(thrown);
+ assert.match(thrown.message, /output-directory does not exist/,
+ `the only real line must survive; got ${thrown.message}`);
+ assert.ok(!/Microsoft PowerPlatform CLI/.test(thrown.message),
+ `the banner must not be reported as the diagnostic; got ${thrown.message}`);
+});
+
+// --- review follow-up: both boundaries were the wrong SHAPE, not just missing ------------------
+
+// The trailing boundary only rejected the GUID alphabet, so a suffix starting with any other
+// character passed the lookahead and the id was accepted with the rest silently dropped. This
+// value becomes DURABLE page identity, so a truncated id is a wrong-page write later.
+test('parsePageId refuses a GUID followed by any identifier character, not just hex', () => {
+ const G = '6e0c28a2-cdbf-41ec-9186-d10fd5de6e35';
+ assert.strictEqual(parsePageId(`Page ID: ${G}`), G, 'the control: a clean id still parses');
+ for (const suffix of ['oops', 'f', '-', '_x', '0', 'Z']) {
+ assert.strictEqual(parsePageId(`Page ID: ${G}${suffix}`), null,
+ `a token continuing with ${JSON.stringify(suffix)} must be refused, not trimmed to the GUID`);
+ }
+ // ...but punctuation genuinely ENDS the token — pac prints the id inside prose.
+ for (const suffix of ['.', ',', ')', ' ', '\n']) {
+ assert.strictEqual(parsePageId(`Page ID: ${G}${suffix}`), G,
+ `${JSON.stringify(suffix)} terminates the id and must still parse`);
+ }
+});
+
+// Anchoring the START defeated the table-row spoof, but with the line END unconstrained a name
+// that merely BEGAN with the summary text was accepted just the same — and a listing that looks
+// authoritative but is truncated is exactly what drives a duplicate CREATE.
+test('parseListCount requires the WHOLE line to be the summary, not just its start', () => {
+ assert.strictEqual(parseListCount('Found 3 generated page(s):'), 3, 'the live-captured form still parses');
+ assert.strictEqual(parseListCount('Found 0 generated page(s):'), 0);
+ for (const bad of [
+ 'Found 1 generated pagex',
+ 'Found 1 generated page(s) extra',
+ 'Found 1 generated page(s): and then some',
+ ]) {
+ assert.strictEqual(parseListCount(bad), null,
+ `${JSON.stringify(bad)} is not the summary grammar and must not supply a count`);
+ }
+});
+
+// And the whole point: an unparsable summary must make the listing UNRECOGNIZED, never "empty" —
+// "empty" is what authorises a create.
+test('a malformed summary line makes the listing unrecognized, not empty', () => {
+ const out = 'Connected as [email protected]\nRetrieving generated pages...\nFound 0 generated pagex\n';
+ assert.strictEqual(classifyListOutput(out).kind, 'unrecognized',
+ 'a summary that does not parse must fail closed');
+});
+
+// --- review follow-up: the retry guard was keyed on the wrong condition ------------------------
+// "Stop retrying a deterministic failure" was gated on `!pid`, i.e. only on a CREATE. An ordinary
+// update — where the caller supplies `pageId`, so `pid` is truthy from the first attempt — sat
+// through every attempt on a fault that can never resolve itself, burying the real message under
+// "after 3 attempt(s)". The correct test is whether the NEXT attempt runs the SAME command.
+test('a deterministic failure on an ORDINARY update stops after one attempt', async () => {
+ let attempts = 0;
+ const run = async () => {
+ attempts += 1;
+ // Real pac wording for an argument fault — retrying cannot change the outcome.
+ return { status: 1, stdout: '', stderr: "Error: The value passed to '--code-file' is invalid. The file 'o.tsx' could not be found." };
+ };
+ await assert.rejects(
+ makeGenpageCli('https://x', { run, sleep: async () => {} })
+ .upload({ appId: 'a', pageId: GUID, codeFile: 'o.tsx', name: 'Overview' }),
+ /pac genpage upload failed/i);
+ assert.strictEqual(attempts, 1,
+ `a deterministic UPDATE fault must not be retried; ran ${attempts} attempt(s)`);
+});
+
+// The control: a TRANSIENT failure on the same ordinary update is still retried, so the guard did
+// not simply disable retries for updates.
+test('a transient failure on an ordinary update is still retried', async () => {
+ let attempts = 0;
+ const run = async () => {
+ attempts += 1;
+ return { status: 1, stdout: '', stderr: 'Error: The service is temporarily unavailable. Please try again.' };
+ };
+ await assert.rejects(
+ makeGenpageCli('https://x', { run, sleep: async () => {} })
+ .upload({ appId: 'a', pageId: GUID, codeFile: 'o.tsx', name: 'Overview' }),
+ /pac genpage upload failed/i);
+ assert.ok(attempts > 1,
+ `a transient fault must still be retried; ran ${attempts} attempt(s)`);
+});
+
+// The ONE case the deterministic-failure stop must not break: an uncertain CREATE that actually
+// landed. Once the env diff adopts the new page, the next attempt is an UPDATE by id — a different
+// command — so the create's argument fault says nothing about it. Every other adoption test used a
+// transient error, so a guard that ignored the adoption transition survived the whole suite; and
+// that mutant is a duplicate-create hazard, because the call throws without returning the id the
+// create already minted.
+test('a deterministic-looking error on a CREATE that landed is still adopted and returned', async () => {
+ const uploads = [];
+ let listN = 0;
+ const run = async (args) => {
+ if (args[2] === 'list') {
+ listN += 1;
+ // before the create: empty; after it: the page exists — the create DID land.
+ return { status: 0, stdout: listN === 1 ? LIST_EMPTY : listText([{ pageId: GUID, name: 'Overview' }]), stderr: '' };
+ }
+ uploads.push(args);
+ return uploads.length === 1
+ ? { status: 1, stdout: '', stderr: "Error: The value passed to '--code-file' is invalid. The file 'o.tsx' could not be found." }
+ : { status: 0, stdout: `Successfully pushed page. Page ID: ${GUID}`, stderr: '' };
+ };
+ const r = await makeGenpageCli('https://x', { run, sleep: async () => {} })
+ .upload({ appId: 'a', codeFile: 'o.tsx', name: 'Overview' });
+ assert.strictEqual(r.pageId, GUID, 'the adopted page must be returned, not lost to a thrown error');
+ assert.strictEqual(uploads.length, 2, 'exactly one follow-up attempt — the UPDATE of the adopted page');
+ assert.ok(!uploads[0].includes('--page-id'), 'the first attempt was the create');
+ assert.ok(uploads[1].includes('--page-id') && uploads[1].includes(GUID), 'the second attempt updated the adopted id');
+});
diff --git a/plugins/model-apps/scripts/tests/launch-playwright-mcp.test.js b/plugins/model-apps/scripts/tests/launch-playwright-mcp.test.js
index 56a21a491..0889af915 100644
--- a/plugins/model-apps/scripts/tests/launch-playwright-mcp.test.js
+++ b/plugins/model-apps/scripts/tests/launch-playwright-mcp.test.js
@@ -71,3 +71,55 @@ test('launch handles the child error event (npx fails to spawn)', () => {
child.emit('error', new Error('spawn npx ENOENT'));
assert.equal(handled, 'spawn npx ENOENT');
});
+
+// --- #588.7: a signal termination is a failure, not a clean shutdown -----------------------------
+// Node calls the exit handler with (code, signal); on a SIGNAL death `code` is null and `signal`
+// carries the name. `process.exit(code || 0)` therefore reported every crash and every kill as exit
+// 0, so an MCP host saw a server that had DIED as one that had shut down cleanly.
+test('a signal-terminated child exits non-zero and names the signal', () => {
+ const exits = [];
+ const errs = [];
+ const realExit = process.exit;
+ const realWrite = process.stderr.write.bind(process.stderr);
+ process.exit = (c) => { exits.push(c); };
+ process.stderr.write = (chunk) => { errs.push(String(chunk)); return true; };
+ try {
+ const handlers = {};
+ const child = { on: (evt, fn) => { handlers[evt] = fn; } };
+ launch({ spawnFn: () => child });
+ handlers.exit(null, 'SIGTERM');
+ } finally {
+ process.exit = realExit;
+ process.stderr.write = realWrite;
+ }
+ assert.strictEqual(exits.length, 1);
+ assert.notStrictEqual(exits[0], 0, `a signal death must not report success; got ${exits[0]}`);
+ assert.ok(exits[0] > 128, `the shell convention is 128 + signum; got ${exits[0]}`);
+ assert.ok(errs.join('').includes('SIGTERM'), `the signal must be named; got ${JSON.stringify(errs)}`);
+});
+
+test('an ordinary clean exit is still reported as success', () => {
+ const exits = [];
+ const realExit = process.exit;
+ process.exit = (c) => { exits.push(c); };
+ try {
+ const handlers = {};
+ const child = { on: (evt, fn) => { handlers[evt] = fn; } };
+ launch({ spawnFn: () => child });
+ handlers.exit(0, null);
+ } finally { process.exit = realExit; }
+ assert.deepStrictEqual(exits, [0], 'a clean shutdown must stay exit 0');
+});
+
+test('a non-zero child exit code is passed through unchanged', () => {
+ const exits = [];
+ const realExit = process.exit;
+ process.exit = (c) => { exits.push(c); };
+ try {
+ const handlers = {};
+ const child = { on: (evt, fn) => { handlers[evt] = fn; } };
+ launch({ spawnFn: () => child });
+ handlers.exit(3, null);
+ } finally { process.exit = realExit; }
+ assert.deepStrictEqual(exits, [3]);
+});
diff --git a/plugins/model-apps/scripts/tests/provision-input.test.js b/plugins/model-apps/scripts/tests/provision-input.test.js
index 29feb1dbb..d0922388a 100644
--- a/plugins/model-apps/scripts/tests/provision-input.test.js
+++ b/plugins/model-apps/scripts/tests/provision-input.test.js
@@ -175,3 +175,27 @@ test('#537 review: provision-input reports the SAME invalid-LCID message as the
assert.match(msg, /1033|1031/, `should name a concrete LCID: ${msg}`);
assert.match(msg, /language tag/, `should name the language-tag mistake: ${msg}`);
});
+
+// --- review follow-up: the OTHER public provisioning entry point ------------------------------
+// The sample-data row-level gate was added to `validateAppSpec` only. `provision-entities` is a
+// separate CLI that seeds through the SAME loader, and it checked only that the value was an
+// array — so `null` still crashed at Object.keys and primitives were still spread into
+// index-keyed "columns", AFTER the solution and data model had already been written.
+test('sampleData rows get the same row-level gate as the app-builder path', () => {
+ const mk = (rows) => ({
+ solution: { uniqueName: 's', displayName: 'S', publisherPrefix: 'pp' },
+ entities: [{ schemaName: 'pp_t', displayName: 'T', pluralName: 'Ts',
+ primaryAttribute: { schemaName: 'pp_name', displayName: 'N' }, columns: [] }],
+ sampleData: { pp_t: rows },
+ });
+ for (const [rows, want] of [[[null], 'null'], [['abc'], 'string'], [[42], 'number'], [[['x']], 'an array']]) {
+ const r = validateProvisionInput(mk(rows));
+ const hit = r.errors.filter((e) => /sampleData\[/.test(e));
+ assert.strictEqual(hit.length, 1, `${JSON.stringify(rows)} must be rejected; got ${JSON.stringify(r.errors)}`);
+ assert.match(hit[0], new RegExp(`got ${want}$`), `the offending type must be named; got ${hit[0]}`);
+ }
+ // The control: a real record object produces no sampleData error.
+ const ok = validateProvisionInput(mk([{ pp_name: 'fine' }]));
+ assert.deepStrictEqual(ok.errors.filter((e) => /sampleData\[/.test(e)), [],
+ 'a valid row must not be rejected');
+});
diff --git a/plugins/model-apps/scripts/tests/sdk-build.test.js b/plugins/model-apps/scripts/tests/sdk-build.test.js
index 44f0d5185..019af8f9e 100644
--- a/plugins/model-apps/scripts/tests/sdk-build.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-build.test.js
@@ -4643,3 +4643,601 @@ test('form topology: a relocated field is clamped against its DESTINATION, not i
'the authored span is clamped against the 4-column DESTINATION, not the 2-column source');
assert.strictEqual(moved.id, 'c1', 'the cell is moved, not recreated');
});
+
+// --- F2: a span CLAMPED to 1 is still an explicit claim -----------------------------------------
+// The clamp branch dropped the attribute when it reduced a span to 1, on the reasoning that "1 is
+// the default". That recreates exactly the omission/value ambiguity the explicit-1 fix removed one
+// layer up: reconcile reads the missing value as "no opinion" and LEAVES AN EXISTING WIDE CELL
+// ALONE. Live-reproduced — a deployed colspan-2 cell, re-declared as colspan 4 in a ONE-column
+// section, stayed at 2 across two applies instead of shrinking to the clamped 1.
+test('form topology: a clamped span is an EXPLICIT 1 and shrinks an existing wide cell', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 1, fields: [{ name: 'new_name', colspan: 4 }] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 1,
+ rows: [{ cells: [{ id: 'c1', colspan: 2, control: { fieldName: 'new_name' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const cell = (finalForm.tabs[0].columns[0].sections[0].rows || [])
+ .flatMap((r) => r.cells || []).find((c) => c.control && c.control.fieldName === 'new_name');
+ assert.ok(cell, `the field must still be on the form; got ${JSON.stringify(finalForm.tabs[0].columns[0].sections[0].rows)}`);
+ assert.strictEqual(cell.colspan, 1,
+ 'a colspan of 4 in a 1-column section clamps to 1, and that 1 must REACH the deployed cell');
+});
+
+// --- F3: shrinking the GRID must repack the rows it now overflows -------------------------------
+// The repack fires when a CELL span changes. A section whose width shrinks overflows without any
+// cell changing: three unit-width cells sit legally in a 4-column row and illegally in a 1-column
+// one. Live-reproduced: occupancy 3 in width 1, on both applies.
+test('form topology: shrinking a section grid repacks the rows that no longer fit', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push({ schemaName: 'new_code', displayName: 'Code', type: 'Text' });
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 1, fields: ['new_name', 'new_tier', 'new_code'] },
+ ] }]);
+ // Deployed as a 4-column section holding all three in ONE row — legal at width 4, not at width 1.
+ const cell = (id, f) => ({ id, control: { fieldName: f } });
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 4,
+ rows: [{ cells: [cell('c1', 'new_name'), cell('c2', 'new_tier'), cell('c3', 'new_code')] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const sec = finalForm.tabs[0].columns[0].sections[0];
+ for (const [ri, r] of (sec.rows || []).entries()) {
+ const used = (r.cells || []).reduce((n, c) => n + (c.colspan || 1), 0);
+ assert.ok(used <= 1, `row ${ri} carries ${used} columns of content in a 1-column section: ${JSON.stringify(r.cells)}`);
+ }
+ const names = (sec.rows || []).flatMap((r) => (r.cells || []).map((c) => c.control && c.control.fieldName));
+ assert.deepStrictEqual(names, ['new_name', 'new_tier', 'new_code'], 'no field may be lost by the reflow');
+});
+
+// --- review follow-up: clamp against the section actually WRITTEN INTO ---------------------------
+// An AUTO layout compiles a synthetic ONE-column section, but reconcile deliberately keeps the
+// DEPLOYED geometry. Applying the synthetic clamp narrowed a maker-widened cell: a live 4-column
+// section holding a colspan-3 cell, with `fieldOptions: { new_name: { colspan: 4 } }`, was written
+// down to 1. The authored span is now carried past compilation and re-clamped against the live
+// section.
+test('form topology: an auto layout clamps against the LIVE section, not the synthetic one-column intent', async () => {
+ const spec = makeSpec();
+ spec.forms = [{ entity: 'new_customer', name: 'Customer', fieldOptions: { new_name: { colspan: 4 } } }];
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 4,
+ rows: [{ cells: [{ id: 'c1', colspan: 3, control: { fieldName: 'new_name' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const cell = (finalForm.tabs[0].columns[0].sections[0].rows || [])
+ .flatMap((r) => r.cells || []).find((c) => c.control && c.control.fieldName === 'new_name');
+ assert.ok(cell, `the field must still be on the form; got ${JSON.stringify(finalForm.tabs[0].columns[0].sections[0].rows)}`);
+ assert.strictEqual(cell.colspan, 4,
+ 'the live section is 4 columns wide, so the authored 4 needs no clamp at all');
+});
+
+// The counterpart, and the one that matters most: with NO authored span, a maker-widened cell must
+// be left ALONE. This is the assertion whose absence let a mutant emit colspan 1 for every
+// one-column layout cell and survive the whole suite.
+test('form topology: an auto rebuild does not touch a maker-widened cell it was never told about', async () => {
+ const spec = makeSpec();
+ spec.forms = [{ entity: 'new_customer', name: 'Customer' }];
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 4,
+ rows: [{ cells: [{ id: 'c1', colspan: 3, control: { fieldName: 'new_name' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const cell = (finalForm.tabs[0].columns[0].sections[0].rows || [])
+ .flatMap((r) => r.cells || []).find((c) => c.control && c.control.fieldName === 'new_name');
+ assert.strictEqual(cell.colspan, 3, 'an undeclared span is no opinion — the maker keeps their 3');
+ assert.strictEqual(cell.id, 'c1', 'and it is the SAME cell, not a recreated one');
+ // No span write may be issued at all.
+ const spanWrites = find(calls, 'updateElement').filter((c) => c.args[3]
+ && (c.args[3].colspan !== undefined || c.args[3].rowspan !== undefined));
+ assert.deepStrictEqual(spanWrites, [],
+ `no span may be written when none was authored; saw ${JSON.stringify(spanWrites.map((c) => [c.args[2], c.args[3]]))}`);
+});
+
+// --- review follow-up: narrowing must clamp a stale WIDE cell, not just reflow rows -------------
+// `rowsFromCells` can change a cell SPAN without changing field names or row membership, and the
+// no-op check compared only field-name arrays — so it discarded exactly that change. A section
+// narrowed to 1 kept a colspan-4 cell, and a second apply issued no corrective write.
+test('form topology: narrowing a grid clamps a stale wide cell, and converges on the second apply', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 1, fields: ['new_name'] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 4,
+ rows: [{ cells: [{ id: 'c1', colspan: 4, control: { fieldName: 'new_name' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const sec = finalForm.tabs[0].columns[0].sections[0];
+ assert.strictEqual(sec.columns, 1, 'the grid narrows');
+ const cell = (sec.rows || []).flatMap((r) => r.cells || []).find((c) => c.control && c.control.fieldName === 'new_name');
+ assert.strictEqual(cell.colspan, 1,
+ `a stale colspan 4 cannot survive in a 1-column section; got ${JSON.stringify(sec.rows)}`);
+ assert.strictEqual(cell.id, 'c1', 'the cell is clamped in place, not recreated');
+
+ // Converged state is a fixed point.
+ const before = calls.length;
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const second = calls.slice(before);
+ const layoutWrites = find(second, 'updateElement').filter((c) => /\/(rows|cells)\/\d+$/.test(String(c.args[2]))
+ && c.args[3] && (Array.isArray(c.args[3].cells) || c.args[3].colspan !== undefined));
+ assert.deepStrictEqual(layoutWrites, [],
+ `a second apply must issue no corrective layout write; saw ${JSON.stringify(layoutWrites.map((c) => [c.args[2], c.args[3]]))}`);
+});
+
+// --- review follow-up: WIDENING a grid must not reflow rows the author never touched ------------
+// The narrowing predicate is deliberately `<`, not `!==`. A mutant that reflowed on WIDENING too
+// survived the whole suite, because nothing asserted that a widened section is left alone.
+test('form topology: WIDENING a section grid leaves its existing rows untouched', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push({ schemaName: 'new_code', displayName: 'Code', type: 'Text' });
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 4, fields: ['new_name', 'new_tier', 'new_code'] },
+ ] }]);
+ // Deployed as a 2-column section: three cells across two rows. Widening to 4 COULD densify them
+ // into one row, but the author asked for a width change, not a re-layout.
+ const cell = (id, f) => ({ id, control: { fieldName: f } });
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [cell('c1', 'new_name'), cell('c2', 'new_tier')] }, { cells: [cell('c3', 'new_code')] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const sec = finalForm.tabs[0].columns[0].sections[0];
+ assert.strictEqual(sec.columns, 4, 'the grid widens');
+ const shape = (sec.rows || []).map((r) => (r.cells || []).map((c) => c.control && c.control.fieldName));
+ assert.deepStrictEqual(shape, [['new_name', 'new_tier'], ['new_code']],
+ `widening must not reflow rows that already fitted; got ${JSON.stringify(shape)}`);
+});
+
+// --- review follow-up: a spacer under a rowspan has positional meaning --------------------------
+// Reading-order flattening destroys a vertical reservation. Live shape, narrowed 4 -> 2:
+// [A rowspan=2] [spacer, B] [C, D] became [A rowspan=2, spacer] [B, C] [D]
+// i.e. B took the slot the spacer was holding under A. `rowsFromCells` models WIDTH only, so it
+// cannot express that reservation — and the authored-rowspan restriction does not help, because
+// the span belongs to the fetched MAKER form, not to the spec. Refusing is the recoverable
+// outcome; silently rearranging a maker's form is not.
+test('form topology: a narrowing that the rows already fit is applied without moving any cell', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push(
+ { schemaName: 'new_code', displayName: 'Code', type: 'Text' },
+ { schemaName: 'new_note', displayName: 'Note', type: 'Text' },
+ );
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: ['new_name', 'new_tier', 'new_code', 'new_note'] },
+ ] }]);
+ // Deployed 4-wide, with a vertical reservation: the spacer sits UNDER the row-spanning cell.
+ const cell = (id, f) => ({ id, control: { fieldName: f } });
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 4,
+ rows: [
+ { cells: [{ id: 'cA', rowspan: 2, control: { fieldName: 'new_name' } }] },
+ { cells: [{ id: 'cSpacer' }, cell('cB', 'new_tier')] },
+ { cells: [cell('cC', 'new_code'), cell('cD', 'new_note')] },
+ ] },
+ ] }] }], bag: { a: [], c: [] } };
+ const warnings = [];
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ const res = await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: (m) => warnings.push(String(m)) });
+
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const sec = finalForm.tabs[0].columns[0].sections[0];
+ const shape = (sec.rows || []).map((r) => (r.cells || []).map((c) => (c.control && c.control.fieldName) || '(spacer)'));
+ assert.deepStrictEqual(shape,
+ [['new_name'], ['(spacer)', 'new_tier'], ['new_code', 'new_note']],
+ `no cell may move — every row already fits the narrower grid; got ${JSON.stringify(shape)}`);
+ assert.strictEqual(Number(sec.columns), 2, 'the narrower grid IS applied: nothing about it needs a reflow');
+ assert.deepStrictEqual(res.skipped.layout, [], 'nothing was refused, so nothing is reported as skipped');
+});
+
+// When the rows would NOT fit the narrower grid, the width must not be written either. Writing it
+// and then refusing the reflow left rows overflowing for good: the next apply saw the width already
+// applied and had nothing left to do. The decision is taken before the width is written.
+test('form topology: a narrowing that would overflow reservation-dependent rows keeps the old grid', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push(
+ { schemaName: 'new_code', displayName: 'Code', type: 'Text' },
+ { schemaName: 'new_note', displayName: 'Note', type: 'Text' },
+ );
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: ['new_name', 'new_tier', 'new_code', 'new_note'] },
+ ] }]);
+ const cell = (id, f) => ({ id, control: { fieldName: f } });
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 4,
+ rows: [
+ { cells: [{ id: 'cA', rowspan: 2, control: { fieldName: 'new_name' } }] },
+ { cells: [{ id: 'cSpacer' }, cell('cB', 'new_tier'), cell('cC', 'new_code')] }, // 3 wide
+ { cells: [cell('cD', 'new_note')] },
+ ] },
+ ] }] }], bag: { a: [], c: [] } };
+ const warnings = [];
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ const res = await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: (m) => warnings.push(String(m)) });
+
+ const finalForm = await sdk.getArtifact('form', 'form-existing');
+ const sec = finalForm.tabs[0].columns[0].sections[0];
+ const shape = (sec.rows || []).map((r) => (r.cells || []).map((c) => (c.control && c.control.fieldName) || '(spacer)'));
+ assert.deepStrictEqual(shape, [['new_name'], ['(spacer)', 'new_tier', 'new_code'], ['new_note']],
+ `the maker arrangement must be preserved intact; got ${JSON.stringify(shape)}`);
+ assert.strictEqual(Number(sec.columns), 4, 'the grid must NOT be narrowed underneath rows that cannot follow it');
+ assert.ok(res.skipped.layout.some((m) => /keeps its 4-column grid/.test(m)),
+ `the refusal must be recorded on the result, not only printed; got ${JSON.stringify(res.skipped.layout)}`);
+ assert.ok(warnings.some((w) => /row-spanning cell/.test(w)), 'and reported');
+ assert.ok(!calls.some((c) => c.name === 'updateElement' && c.args[0] === 'form' && c.args[3] && c.args[3].columns !== undefined),
+ 'no write may carry the narrower width');
+});
+
+// Over-refusal fixed: when every row span is TRAILING (stock account/contact forms put `rowspan` on
+// the last cell), nothing follows the span to land in its reservation, so the section reflows
+// normally — refusing it left a stock form overflowing the grid it was narrowed to.
+test('form topology: a section whose only rowspan is trailing reflows normally when narrowed', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push({ schemaName: 'new_code', displayName: 'Code', type: 'Text' });
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 1, fields: ['new_name', 'new_tier', 'new_code'] },
+ ] }]);
+ const cell = (id, f) => ({ id, control: { fieldName: f } });
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [
+ { cells: [cell('c1', 'new_name'), cell('c2', 'new_tier')] },
+ { cells: [{ id: 'c3', rowspan: 2, control: { fieldName: 'new_code' } }] }, // trailing span
+ ] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ const res = await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const sec = (await sdk.getArtifact('form', 'form-existing')).tabs[0].columns[0].sections[0];
+ assert.strictEqual(Number(sec.columns), 1);
+ for (const [ri, r] of (sec.rows || []).entries()) {
+ const used = (r.cells || []).reduce((n, c) => n + (Number(c.colspan) || 1), 0);
+ assert.ok(used <= 1, `row ${ri} must fit the 1-column grid; got ${JSON.stringify(r.cells)}`);
+ }
+ const order = (sec.rows || []).flatMap((r) => (r.cells || []).map((c) => c.control && c.control.fieldName));
+ assert.deepStrictEqual(order, ['new_name', 'new_tier', 'new_code'], 'reading order survives the reflow');
+ assert.deepStrictEqual(res.skipped.layout, []);
+});
+
+// A narrowing repack can need FEWER rows than the section holds: a maker form often leaves one field
+// per row in a wide section, and packing by width puts two of them side by side. The rows that repack
+// empties must be removed — and removed from the END, because removing by index shifts every later
+// index, so a front-to-back loop would delete a row that still holds a field.
+test('form topology: a narrowing repack that needs fewer rows removes the rows it emptied', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push({ schemaName: 'new_code', displayName: 'Code', type: 'Text' },
+ { schemaName: 'new_zeta', displayName: 'Zeta', type: 'Text' });
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: ['new_name', 'new_tier', 'new_code', 'new_zeta'] },
+ ] }]);
+ const cell = (id, f) => ({ id, control: { fieldName: f } });
+ // Two trailing rows to remove, so the removal ORDER is observable: front-to-back would skip one.
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 4,
+ rows: [{ cells: [cell('c1', 'new_name')] }, { cells: [cell('c2', 'new_tier')] }, { cells: [cell('c3', 'new_code')] }, { cells: [cell('c4', 'new_zeta')] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ const res = await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const sec = (await sdk.getArtifact('form', 'form-existing')).tabs[0].columns[0].sections[0];
+ const shape = sec.rows.map((r) => r.cells.map((c) => c.control && c.control.fieldName));
+ assert.deepStrictEqual(shape, [['new_name', 'new_tier'], ['new_code', 'new_zeta']], `got ${JSON.stringify(shape)}`);
+ assert.deepStrictEqual(res.skipped.layout, []);
+});
+
+// The repack's own reservation check is a BACKSTOP: its caller decides before writing the width, on
+// the same rows, so today it can only fire if those rows change between that decision and the repack.
+// Simulated by adding a row-spanning cell as the width is written. The contract: the rows are left
+// exactly as they are (never re-flowed into the reservation) and the refusal is recorded.
+test('form topology: the repack refuses rows that gained a reservation after the width decision', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push({ schemaName: 'new_code', displayName: 'Code', type: 'Text' });
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 1, fields: ['new_name', 'new_tier', 'new_code'] },
+ ] }]);
+ const cell = (id, f) => ({ id, control: { fieldName: f } });
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [cell('c1', 'new_name'), cell('c2', 'new_tier')] }, { cells: [cell('c3', 'new_code')] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ const realUpdate = sdk.updateElement;
+ sdk.updateElement = async (t, id, pointer, patch) => {
+ const out = await realUpdate(t, id, pointer, patch);
+ if (t === 'form' && patch && patch.columns !== undefined && /\/sections\/\d+$/.test(String(pointer))) {
+ const section = (await sdk.getArtifact('form', id)).tabs[0].columns[0].sections[0];
+ section.rows[0].cells[0].rowspan = 2; // new_tier now FOLLOWS a row-spanning cell
+ }
+ return out;
+ };
+ const res = await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: () => {} });
+ const sec = (await sdk.getArtifact('form', 'form-existing')).tabs[0].columns[0].sections[0];
+ const shape = sec.rows.map((r) => r.cells.map((c) => c.control && c.control.fieldName));
+ assert.deepStrictEqual(shape, [['new_name', 'new_tier'], ['new_code']], `the rows must not be re-flowed; got ${JSON.stringify(shape)}`);
+ assert.ok(res.skipped.layout.some((m) => /rows were left as they are rather than re-flowed/.test(m)),
+ `the refusal must be recorded; got ${JSON.stringify(res.skipped.layout)}`);
+});
+
+// The control: without a rowspan, the same narrowing DOES reflow — so the guard is specific to the
+// vertical reservation rather than a blanket refusal.
+test('form topology: the rowspan guard does not block an ordinary narrowing', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push({ schemaName: 'new_code', displayName: 'Code', type: 'Text' });
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 1, fields: ['new_name', 'new_tier', 'new_code'] },
+ ] }]);
+ const cell = (id, f) => ({ id, control: { fieldName: f } });
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 4,
+ rows: [{ cells: [cell('c1', 'new_name'), cell('c2', 'new_tier'), cell('c3', 'new_code')] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const sec = finalForm.tabs[0].columns[0].sections[0];
+ for (const [ri, r] of (sec.rows || []).entries()) {
+ const used = (r.cells || []).reduce((n, c) => n + (c.colspan || 1), 0);
+ assert.ok(used <= 1, `row ${ri} must fit the 1-column grid; got ${JSON.stringify(r.cells)}`);
+ }
+});
+
+// --- review follow-up: the OTHER repack route ---------------------------------------------------
+// The section-level guard only covers a grid CHANGE. A span change takes a different route —
+// `convergeCellSpans` -> `repackRowAt` — which re-lays a single row by reading order. On a maker
+// form holding `[A rowspan=2, B]`, widening `B` overflows the row and the split places `B` in the
+// row `A` reserves. The whole span change is skipped rather than half-applied: leaving an
+// OVERFLOWING row is worse than a form that merely does not match the spec, and `--verify` reports
+// the divergence either way.
+test('form topology: widening a cell beside a rowspan is skipped, not half-applied', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: ['new_name', { name: 'new_tier', colspan: 2 }] },
+ ] }]);
+ // Deployed: `[A rowspan=2, B]` in a 2-column section — widening B to 2 makes the row 1 + 2 = 3.
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [
+ { cells: [{ id: 'cA', rowspan: 2, control: { fieldName: 'new_name' } }, { id: 'cB', control: { fieldName: 'new_tier' } }] },
+ { cells: [{ id: 'cSpacer' }] },
+ ] },
+ ] }] }], bag: { a: [], c: [] } };
+ const warnings = [];
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: (m) => warnings.push(String(m)) });
+
+ // NOTE: with the change skipped there is NO form write at all, so the form is read by the mock's
+ // own id rather than via a call the fix is expected to suppress.
+ const finalForm = await sdk.getArtifact('form', 'form-existing');
+ const sec = finalForm.tabs[0].columns[0].sections[0];
+ const shape = (sec.rows || []).map((r) => (r.cells || []).map((c) => [(c.control && c.control.fieldName) || '(spacer)', Number(c.colspan) || 1]));
+ assert.deepStrictEqual(shape,
+ [[['new_name', 1], ['new_tier', 1]], [['(spacer)', 1]]],
+ `the maker arrangement must be untouched — no widened span, no split row; got ${JSON.stringify(shape)}`);
+ assert.ok(warnings.some((w) => /row-spanning cell/.test(w)),
+ `the skip must be reported, not silent; saw ${JSON.stringify(warnings)}`);
+ // And nothing at all was written to the form — a half-applied span is the failure mode here.
+ assert.ok(!calls.some((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form'),
+ `no form write may be issued; got ${JSON.stringify(calls.filter((c) => c.args && c.args[0] === 'form').map((c) => c.name))}`);
+});
+
+// The control: the SAME widening with no rowspan present does apply and does repack, so the guard
+// is specific to the vertical reservation rather than a blanket refusal to change spans.
+test('form topology: the rowspan guard does not block an ordinary widening', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: ['new_name', { name: 'new_tier', colspan: 2 }] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ id: 'cA', control: { fieldName: 'new_name' } }, { id: 'cB', control: { fieldName: 'new_tier' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const sec = finalForm.tabs[0].columns[0].sections[0];
+ const tier = (sec.rows || []).flatMap((r) => r.cells || []).find((c) => c.control && c.control.fieldName === 'new_tier');
+ assert.strictEqual(Number(tier.colspan) || 1, 2, 'the authored widening must still apply');
+ for (const [ri, r] of (sec.rows || []).entries()) {
+ const used = (r.cells || []).reduce((n, c) => n + (Number(c.colspan) || 1), 0);
+ assert.ok(used <= 2, `row ${ri} must fit the 2-column grid; got ${JSON.stringify(r.cells)}`);
+ }
+});
+
+// --- review follow-up: the ADD route spans against the live section too --------------------------
+// The raw authored span reached only the existing-cell route. A field ADDED under an auto layout was
+// appended with the compiler's clamp — a synthetic one-column section — so it arrived narrow, and a
+// SECOND apply of the unchanged spec widened it and reflowed its row. The same spec must converge in
+// one apply and then be a fixed point.
+test('form topology: a field ADDED under an auto layout gets its authored span in the first apply', async () => {
+ const spec = makeSpec();
+ spec.forms = [{ entity: 'new_customer', name: 'Customer', fieldOptions: { new_tier: { colspan: 4 } } }];
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 4,
+ rows: [{ cells: [{ id: 'c1', control: { fieldName: 'new_name' } }] }] }, // new_tier not on the form yet
+ ] }] }], bag: { a: [], c: [] } };
+ const first = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk: first.sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const afterFirst = await first.sdk.getArtifact('form', 'form-existing');
+ const tier = afterFirst.tabs[0].columns[0].sections[0].rows.flatMap((r) => r.cells || [])
+ .find((c) => c.control && c.control.fieldName === 'new_tier');
+ assert.ok(tier, 'the field must have been added');
+ assert.strictEqual(Number(tier.colspan) || 1, 4, 'the live section is 4 wide, so the authored 4 needs no clamp');
+
+ const second = mockSdk({ artifactsExist: true, existingFormJson: JSON.parse(JSON.stringify(afterFirst)) });
+ await runSdkBuild(spec, { sdk: second.sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const cellWrites = second.calls.filter((c) => (c.name === 'updateElement' || c.name === 'addElement')
+ && c.args[0] === 'form' && /\/rows/.test(String(c.args[2])));
+ assert.deepStrictEqual(cellWrites, [], 'an unchanged spec on its own output must issue no cell writes');
+});
+
+// A patch that INTRODUCES a rowspan is judged on the rows as they will be. The spec may only put
+// `rowspan` on a section's LAST field, but the maker's form can hold that field first: widening it
+// to a 2x2 cell beside a field that follows it would overflow, and the reflow would drop the
+// follower into the new reservation. Checking the section BEFORE the patch saw no rowspan at all.
+test('form topology: a span patch whose rowspan would displace following cells applies only its colspan', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: ['new_tier', { name: 'new_name', colspan: 2, rowspan: 2 }] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ id: 'cA', control: { fieldName: 'new_name' } }, { id: 'cB', control: { fieldName: 'new_tier' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ const res = await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: () => {} });
+ const sec = (await sdk.getArtifact('form', 'form-existing')).tabs[0].columns[0].sections[0];
+ const shape = sec.rows.map((r) => r.cells.map((c) => [c.control && c.control.fieldName, Number(c.colspan) || 1, Number(c.rowspan) || 1]));
+ // The rowspan is withheld (new_tier follows the cell); without it the section holds no reservation,
+ // so the widening converges and its row re-flows normally — nothing is left overflowing.
+ assert.deepStrictEqual(shape, [[['new_name', 2, 1]], [['new_tier', 1, 1]]], `got ${JSON.stringify(shape)}`);
+ assert.ok(res.skipped.layout.some((m) => /rowspan on 'new_name' was not applied/.test(m)),
+ `the withheld rowspan must be recorded; got ${JSON.stringify(res.skipped.layout)}`);
+});
+
+// The reservation guard is judged on the rows the patch PRODUCES. A patch that REMOVES the cell's own
+// rowspan while widening it leaves nothing to reserve, so the widening and its re-flow are safe —
+// judging the rows as they were would refuse a change that removes the hazard.
+test('form topology: a patch that removes a rowspan while widening is judged on the rows it produces', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push({ schemaName: 'new_code', displayName: 'Code', type: 'Text' });
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: [{ name: 'new_name', colspan: 2, rowspan: 1 }, 'new_tier', 'new_code'] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [
+ { cells: [{ id: 'cA', rowspan: 2, control: { fieldName: 'new_name' } }, { id: 'cB', control: { fieldName: 'new_tier' } }] },
+ { cells: [{ id: 'cC', control: { fieldName: 'new_code' } }] },
+ ] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ const res = await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: () => {} });
+ const sec = (await sdk.getArtifact('form', 'form-existing')).tabs[0].columns[0].sections[0];
+ const shape = sec.rows.map((r) => r.cells.map((c) => [c.control && c.control.fieldName, Number(c.colspan) || 1, Number(c.rowspan) || 1]));
+ assert.deepStrictEqual(shape, [[['new_name', 2, 1]], [['new_tier', 1, 1]], [['new_code', 1, 1]]], `got ${JSON.stringify(shape)}`);
+ assert.deepStrictEqual(res.skipped.layout, []);
+});
+
+// A rowspan RAISED on a deployed cell that other cells follow displaces them past the covered slot,
+// and a full row beneath then needs more columns than its grid has — even though the patched row
+// itself still fits. The validator only guarantees the rowspan field is LAST in the spec's list;
+// the reconcile keeps a staying cell where the maker put it, so the deployed order can differ.
+test('form topology: a rowspan raised on a cell that other cells follow is skipped even when its row fits', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push({ schemaName: 'new_code', displayName: 'Code', type: 'Text' },
+ { schemaName: 'new_zeta', displayName: 'Zeta', type: 'Text' });
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: ['new_tier', 'new_code', 'new_zeta', { name: 'new_name', rowspan: 2 }] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [
+ { cells: [{ id: 'cA', control: { fieldName: 'new_name' } }, { id: 'cB', control: { fieldName: 'new_tier' } }] },
+ { cells: [{ id: 'cC', control: { fieldName: 'new_code' } }, { id: 'cD', control: { fieldName: 'new_zeta' } }] },
+ ] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ const res = await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: () => {} });
+ const sec = (await sdk.getArtifact('form', 'form-existing')).tabs[0].columns[0].sections[0];
+ const shape = sec.rows.map((r) => r.cells.map((c) => [c.control && c.control.fieldName, Number(c.colspan) || 1, Number(c.rowspan) || 1]));
+ assert.deepStrictEqual(shape, [[['new_name', 1, 1], ['new_tier', 1, 1]], [['new_code', 1, 1], ['new_zeta', 1, 1]]],
+ `the rowspan must not be written over the cells that follow it; got ${JSON.stringify(shape)}`);
+ assert.ok(res.skipped.layout.some((m) => /rowspan on 'new_name' was not applied/.test(m)),
+ `the skip must be recorded; got ${JSON.stringify(res.skipped.layout)}`);
+});
+
+test('form topology: a rowspan raised on the LAST cell of a deployed section is still applied', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push({ schemaName: 'new_code', displayName: 'Code', type: 'Text' });
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: ['new_tier', 'new_code', { name: 'new_name', rowspan: 2 }] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [
+ { cells: [{ id: 'cB', control: { fieldName: 'new_tier' } }, { id: 'cC', control: { fieldName: 'new_code' } }] },
+ { cells: [{ id: 'cA', control: { fieldName: 'new_name' } }] },
+ ] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ const res = await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: () => {} });
+ const name = (await sdk.getArtifact('form', 'form-existing')).tabs[0].columns[0].sections[0]
+ .rows.flatMap((r) => r.cells).find((c) => c.control && c.control.fieldName === 'new_name');
+ assert.strictEqual(Number(name.rowspan) || 1, 2, 'nothing follows the last cell, so its rowspan is written');
+ assert.deepStrictEqual(res.skipped.layout, []);
+});
+
+// A NARROWING inside a row that already overflowed is strictly an improvement, so it is written —
+// but, in a reservation-dependent section, not re-flowed. Skipping it with "would overflow the row"
+// described a change that made the overflow smaller.
+test('form topology: narrowing a cell in an already-overflowing reserved row is applied, not re-flowed', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push({ schemaName: 'new_code', displayName: 'Code', type: 'Text' });
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: ['new_name', { name: 'new_tier', colspan: 1 }, 'new_code'] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [
+ { cells: [{ id: 'cA', rowspan: 2, control: { fieldName: 'new_name' } },
+ { id: 'cB', colspan: 2, control: { fieldName: 'new_tier' } },
+ { id: 'cC', control: { fieldName: 'new_code' } }] }, // 4 columns of content in a 2-wide grid
+ { cells: [{ id: 'cSpacer' }] },
+ ] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ const res = await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: () => {} });
+ const sec = (await sdk.getArtifact('form', 'form-existing')).tabs[0].columns[0].sections[0];
+ const tier = sec.rows.flatMap((r) => r.cells).find((c) => c.control && c.control.fieldName === 'new_tier');
+ assert.strictEqual(Number(tier.colspan) || 1, 1, 'the narrowing is applied');
+ assert.deepStrictEqual(sec.rows.map((r) => r.cells.map((c) => (c.control && c.control.fieldName) || '(spacer)')),
+ [['new_name', 'new_tier', 'new_code'], ['(spacer)']], 'but no cell moves — the row is not re-flowed');
+ assert.ok(res.skipped.layout.some((m) => /was applied, but its row still overflows/.test(m)),
+ `the remaining overflow must be recorded; got ${JSON.stringify(res.skipped.layout)}`);
+});
diff --git a/plugins/model-apps/scripts/tests/sdk-http-client.test.js b/plugins/model-apps/scripts/tests/sdk-http-client.test.js
index e9a371db4..3d089b4f7 100644
--- a/plugins/model-apps/scripts/tests/sdk-http-client.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-http-client.test.js
@@ -136,6 +136,50 @@ test('DOES retry a METADATA delete (EntityDefinitions) on a network error — as
assert.strictEqual(calls.length, 2);
});
+// A write we stop waiting for is an UNKNOWN outcome, not a failure, so writes wait far longer than
+// reads. Measured live: a business process flow activation on a fresh table ran past the old 60 s.
+test('a WRITE waits far longer than a read before giving up', async () => {
+ const { request, calls } = fakeTransport({ statusCode: 204, headers: {}, body: '' });
+ const http = createAzHttpClient('https://org', { getToken: () => 'TOK', request });
+ await http.get('https://org/x');
+ await http.post('https://org/x', { a: 1 });
+ await http.patch('https://org/x', { a: 1 });
+ await http.put('https://org/x', { a: 1 });
+ await http.delete('https://org/x');
+ const [get, ...writes] = calls.map((c) => c.timeout);
+ assert.strictEqual(get, 60000, 'a read keeps the short timeout — it is safe to abandon and re-issue');
+ for (const t of writes) assert.ok(t >= 120000, `every write must wait well past 60 s; got ${t}`);
+});
+
+// The retry that failed a build live: the activation committed after the client gave up, and the
+// re-send — carrying the token the activation had just superseded — was refused with a 412.
+test('a CONDITIONAL write that got no answer is NOT re-sent (it may still commit)', async () => {
+ for (const header of ['If-Match', 'if-match']) {
+ const { request, calls } = fakeTransport({ error: 'Request timed out' });
+ const http = createAzHttpClient('https://org', { getToken: () => 'TOK', request, sleep: async () => {} });
+ await assert.rejects(
+ () => http.patch('https://org/api/data/v9.2/workflows(1)', { statecode: 1 }, { headers: { [header]: 'W/"5"' } }),
+ /Request failed: Request timed out .*not re-sent/);
+ assert.strictEqual(calls.length, 1, `exactly one conditional PATCH may be sent (header spelled ${header})`);
+ }
+});
+
+test('the no-re-send rule is scoped: an UNCONDITIONAL write that got no answer is still retried', async () => {
+ const { request, calls } = fakeTransport(() => (calls.length <= 1 ? { error: 'ETIMEDOUT' } : { statusCode: 204, headers: {}, body: '' }));
+ const http = createAzHttpClient('https://org', { getToken: () => 'TOK', request, sleep: async () => {} });
+ const res = await http.patch('https://org/api/data/v9.2/workflows(1)', { statecode: 1 });
+ assert.strictEqual(res.status, 204);
+ assert.strictEqual(calls.length, 2);
+});
+
+test('a CONDITIONAL write that got an ANSWER keeps the status retry (429 means it was never processed)', async () => {
+ const { request, calls } = fakeTransport(() => (calls.length <= 1 ? { statusCode: 429, headers: {}, body: '' } : { statusCode: 204, headers: {}, body: '' }));
+ const http = createAzHttpClient('https://org', { getToken: () => 'TOK', request, sleep: async () => {} });
+ const res = await http.patch('https://org/x', { a: 1 }, { headers: { 'If-Match': 'W/"5"' } });
+ assert.strictEqual(res.status, 204, 'a throttled conditional write is retried');
+ assert.strictEqual(calls.length, 2);
+});
+
test('throws only when no token is available', async () => {
const { request } = fakeTransport({ statusCode: 200, headers: {}, body: '{}' });
const http = createAzHttpClient('https://org', { getToken: () => null, request });
diff --git a/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js b/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js
index cf95f95f6..c8d932eca 100644
--- a/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js
+++ b/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js
@@ -342,6 +342,11 @@ test('CONTRACT: vendored deleteAppCascade returns a structured { success, delete
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' } };
}
+ // The by-id sitemap read supplies the ROW token the conditional delete carries. It answers
+ // with the single row (never a collection) and the token in the header and the body.
+ if (/\/sitemaps\([^)]+\)/.test(url)) {
+ return { status: 200, headers: { etag: 'W/"2"' }, body: { '@odata.etag': 'W/"2"', sitemapid: SITEMAP_ID } };
+ }
// Only a navigational <SubArea GenPageId="…"> counts as a live generative-page reference.
if (/\/sitemaps/.test(url)) {
return {
diff --git a/plugins/model-apps/scripts/tests/verify-compile-roundtrip-real-bundle.test.js b/plugins/model-apps/scripts/tests/verify-compile-roundtrip-real-bundle.test.js
new file mode 100644
index 000000000..08b975859
--- /dev/null
+++ b/plugins/model-apps/scripts/tests/verify-compile-roundtrip-real-bundle.test.js
@@ -0,0 +1,129 @@
+'use strict';
+// COMPILE -> SERIALIZE -> VERIFY round trip against the REAL vendored bundle.
+//
+// `--verify` judges a deployed form against the spec; the compiler decides what that form should
+// be. When the two derive the same rule separately they drift, and the verifier then fails forms
+// that deployed exactly as compiled. That happened: the verifier read a section's raw `columns`
+// while the compiler defaults an omitted value to 1 and caps QuickCreate sections at 1, so both
+// shapes below were reported as wrong. Measured before the fix, on the real compiler and bundle:
+// omitted columns + colspan 2 -> "field 'new_notes' has colspan 1, the spec declares 2"
+// QuickCreate, columns: 2 -> "section 'sec_x' is deployed 1 column(s) wide, the spec declares 2"
+//
+// So the expectation here is not hand-written: every case is compiled by the real compiler,
+// serialized by the real bundle, and must then verify. The negative control proves the oracle is
+// not vacuous — the same pipeline with one span tampered must FAIL.
+const test = require('node:test');
+const assert = require('node:assert');
+const fs = require('node:fs');
+const os = require('node:os');
+const path = require('node:path');
+
+const BUNDLE = path.resolve(__dirname, '..', 'vendor', 'cds-maker-sdk.cjs');
+const ai = require('../lib/artifact-intent.js');
+const { verifySpec } = require('../lib/verify-spec.js');
+
+const META = { new_ticket: { new_name: 'String', new_notes: 'Memo', new_code: 'String', new_area: 'String' } };
+const NOTES_CLASS_ID = '06375649-C143-495E-A496-C962E5B4488E';
+const dirs = [];
+test.after(() => { for (const d of dirs) fs.rmSync(d, { recursive: true, force: true }); });
+
+const baseSpec = () => ({
+ $schemaVersion: '1.0',
+ solution: { uniqueName: 's', displayName: 'S', publisherPrefix: 'new' },
+ app: { name: 'A', uniqueName: 'new_a' },
+ entities: [{ schemaName: 'new_ticket', displayName: 'Ticket', pluralName: 'Tickets',
+ primaryAttribute: { schemaName: 'new_name', displayName: 'Name' },
+ columns: [
+ { schemaName: 'new_notes', displayName: 'Notes', type: 'Memo' },
+ { schemaName: 'new_code', displayName: 'Code', type: 'Text' },
+ { schemaName: 'new_area', displayName: 'Area', type: 'Text' },
+ ] }],
+});
+
+// The formxml the real bundle would send for a compiled form — the engine's createFormShell order.
+async function compiledFormXml(spec, form) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
+ const cap = [];
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'verify-rt-'));
+ dirs.push(dir);
+ const httpClient = {
+ get: async (url) => {
+ const m = /EntityDefinitions\(LogicalName='([^']+)'\)/.exec(url);
+ if (m && META[m[1]]) {
+ return { status: 200, headers: {}, body: { LogicalName: m[1], EntitySetName: `${m[1]}s`,
+ Attributes: Object.entries(META[m[1]]).map(([LogicalName, AttributeType]) => ({ LogicalName, AttributeType })) } };
+ }
+ return { status: 200, headers: {}, body: { value: [] } };
+ },
+ post: async (url, body) => { cap.push(body); return { status: 204, headers: { 'odata-entityid': 'https://x/y(11111111-1111-1111-1111-111111111111)' }, body: {} }; },
+ patch: async (url, body) => { cap.push(body); return { status: 204, headers: {}, body: {} }; },
+ delete: async () => ({ status: 204, headers: {}, body: {} }),
+ put: async () => ({ status: 204, headers: {}, body: {} }),
+ };
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
+ const intent = ai.compileFormIntent(spec, form, { notesClassId: NOTES_CLASS_ID });
+ const art = await sdk.createArtifact('form', { name: intent.name, entityLogicalName: intent.entityLogicalName, formType: intent.formType, status: intent.status });
+ for (const tab of intent.tabs) await sdk.addElement('form', art.id, '/tabs', tab);
+ await sdk.removeElement('form', art.id, '/tabs/0');
+ await sdk.pushArtifact('form', art.id);
+ const xml = String((cap.find((c) => c && typeof c.formxml === 'string') || {}).formxml || '');
+ assert.ok(xml.includes('<section'), 'the bundle must have serialized a form');
+ return xml;
+}
+
+async function topologyVerdict(form, tamper) {
+ const spec = baseSpec();
+ spec.forms = [form];
+ let xml = await compiledFormXml(spec, form);
+ if (tamper) xml = tamper(xml);
+ const read = {
+ findTable: async () => ({ logicalName: 'new_ticket' }),
+ findColumns: async () => [],
+ sitemapXml: async () => '',
+ queryRecords: async (set) => (set === 'systemform'
+ ? [{ formid: 'f1', name: form.name, objecttypecode: 'new_ticket', type: form.formType === 'QuickCreate' ? 7 : 2, isdefault: true }] : []),
+ formTopology: async () => xml,
+ };
+ const res = await verifySpec(spec, read);
+ return (res.checks || []).find((c) => c.kind === 'form-topology');
+}
+
+const explicit = (section, extra = {}) => ({ entity: 'new_ticket', name: 'Main', ...extra,
+ tabs: [{ name: 'tab_x', label: 'X', sections: [{ name: 'sec_x', label: 'X', ...section }] }] });
+
+const CASES = [
+ ['a section that omits columns, with a declared colspan', explicit({ fields: ['new_name', { name: 'new_notes', colspan: 2 }] })],
+ ['a QuickCreate section that asks for 2 columns', explicit({ columns: 2, fields: ['new_name', 'new_code'] }, { name: 'Quick', formType: 'QuickCreate' })],
+ ['a colspan wider than its section (clamped by the compiler)', explicit({ columns: 2, fields: [{ name: 'new_notes', colspan: 4 }, 'new_code'] })],
+ ['a four-column section with a full-width field', explicit({ columns: 4, fields: [{ name: 'new_notes', colspan: 4 }, 'new_name', 'new_code', 'new_area'] })],
+ ['a declared rowspan on the last field', explicit({ columns: 2, fields: ['new_name', 'new_code', { name: 'new_notes', rowspan: 3 }] })],
+ ['a span declared through form-level fieldOptions on a plain string entry',
+ { ...explicit({ columns: 2, fields: ['new_name', 'new_notes'] }), fieldOptions: { new_notes: { colspan: 2 } } }],
+];
+
+for (const [label, form] of CASES) {
+ test(`compile -> verify round trip PASSES: ${label}`, async () => {
+ const chk = await topologyVerdict(form);
+ assert.ok(chk, 'an explicit layout must produce a form-topology check');
+ assert.strictEqual(chk.present, true, `a form that deployed exactly as compiled must verify; got: ${chk.detail}`);
+ });
+}
+
+test('compile -> verify round trip still FAILS a form that did not deploy as compiled (negative control)', async () => {
+ // Same pipeline, one declared span tampered after serialization — the oracle must notice.
+ const form = explicit({ columns: 2, fields: ['new_name', { name: 'new_notes', colspan: 2 }] });
+ const chk = await topologyVerdict(form, (xml) => xml.replace(/(<cell\b[^>]*?)colspan="2"/, '$1colspan="1"'));
+ assert.strictEqual(chk.present, false, 'a tampered span must fail verification');
+ assert.match(chk.detail, /new_notes' has colspan 1, the spec declares 2/);
+});
+
+// The same control for a span declared through `fieldOptions`. Verify used to check inline objects
+// only, so this tampered form PASSED — the span was simply never looked at, and a span change the
+// build had to skip went unreported. The expectation now comes from the compiler's own merge.
+test('compile -> verify round trip FAILS a tampered span that was declared through fieldOptions', async () => {
+ const form = { ...explicit({ columns: 2, fields: ['new_name', 'new_notes'] }), fieldOptions: { new_notes: { colspan: 2 } } };
+ const chk = await topologyVerdict(form, (xml) => xml.replace(/(<cell\b[^>]*?)colspan="2"/, '$1colspan="1"'));
+ assert.strictEqual(chk.present, false, 'a fieldOptions span that did not deploy must fail verification');
+ assert.match(chk.detail, /new_notes' has colspan 1, the spec declares 2/);
+});
diff --git a/plugins/model-apps/scripts/tests/verify-spec.test.js b/plugins/model-apps/scripts/tests/verify-spec.test.js
index 858344a9b..90ace6ea7 100644
--- a/plugins/model-apps/scripts/tests/verify-spec.test.js
+++ b/plugins/model-apps/scripts/tests/verify-spec.test.js
@@ -1473,12 +1473,15 @@ const shapeXml = ({ cells, columns = '11' }) =>
`<form><tabs><tab name="tab_overview"><labels><label description="Overview" languagecode="1033"/></labels><columns>`
+ `<column width="100%"><sections><section name="sec_left" columns="${columns}">`
+ `<labels><label description="L" languagecode="1033"/></labels><rows><row>`
- + cells.map((c) => `<cell colspan="${c.span}"><control datafieldname="${c.f}" /></cell>`).join('')
+ + cells.map((c) => `<cell colspan="${c.span}"${c.rows ? ` rowspan="${c.rows}"` : ''}><control datafieldname="${c.f}" /></cell>`).join('')
+ `</row></rows></section></sections></column>`
+ `</columns></tab></tabs></form>`;
-const shapeSpec = (fields) => (spec) => {
+// `cols` defaults to 2 to match `shapeXml`'s default ratio "11". A test that deploys a different
+// grid must declare the SAME width here, or it is exercising the grid-width mismatch check rather
+// than whatever it meant to test.
+const shapeSpec = (fields, cols = 2) => (spec) => {
spec.forms[0].tabs = [{ name: 'tab_overview', label: 'Overview', columns: [
- { width: '100%', sections: [{ name: 'sec_left', label: 'L', columns: 2, fields }] }] }];
+ { width: '100%', sections: [{ name: 'sec_left', label: 'L', columns: cols, fields }] }] }];
};
test('verify FAILS when a deployed row carries more content than its grid', async () => {
@@ -1490,6 +1493,38 @@ test('verify FAILS when a deployed row carries more content than its grid', asyn
assert.match(chk.detail, /3 columns of content in a 2-column section/);
});
+// A row-spanning cell also fills its column in the rows beneath it — FormXML rows follow HTML-table
+// semantics — so a full row sitting under a rowspan carries one column more than its own cells.
+// Counting a row's own cells alone verified that layout as PASS: live, a 2-column section holding
+// `[name rowspan=2, tier] / [code, zeta]` passed, with row 2 needing three columns.
+const rowsXml = (rows, columns = '11') =>
+ `<form><tabs><tab name="tab_overview"><labels><label description="Overview" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections><section name="sec_left" columns="${columns}">`
+ + `<labels><label description="L" languagecode="1033"/></labels><rows>`
+ + rows.map((cells) => `<row>${cells.map((c) => `<cell colspan="${c.span || 1}"${c.rows ? ` rowspan="${c.rows}"` : ''}>`
+ + `<control datafieldname="${c.f}" /></cell>`).join('')}</row>`).join('')
+ + `</rows></section></sections></column>`
+ + `</columns></tab></tabs></form>`;
+
+test('verify FAILS a full row sitting under a row-spanning cell — the reserved slot counts', async () => {
+ const chk = await topoCheck(
+ rowsXml([[{ f: 'new_name', rows: 2 }, { f: 'new_notes' }], [{ f: 'new_c' }, { f: 'new_d' }]]),
+ shapeSpec(['new_notes', 'new_c', 'new_d', { name: 'new_name', rowspan: 2 }]));
+ assert.strictEqual(chk.present, false, 'a row overfilled by a reservation must not verify');
+ assert.match(chk.detail, /row 2 carries 3 columns of content \(1 reserved by a row-spanning cell above\) in a 2-column section/);
+});
+
+test('verify PASSES a rowspan whose reserved slot the row beneath leaves free, and a trailing one', async () => {
+ const beside = await topoCheck(
+ rowsXml([[{ f: 'new_name', rows: 2 }, { f: 'new_notes' }], [{ f: 'new_c' }]]),
+ shapeSpec(['new_name', 'new_notes', 'new_c']));
+ assert.strictEqual(beside.present, true, `a cell beside the reservation fits; got ${beside && beside.detail}`);
+ const trailing = await topoCheck(
+ rowsXml([[{ f: 'new_name' }, { f: 'new_notes' }], [{ f: 'new_c', rows: 2 }]]),
+ shapeSpec(['new_name', 'new_notes', { name: 'new_c', rowspan: 2 }]));
+ assert.strictEqual(trailing.present, true, `a trailing rowspan reserves nothing that is used; got ${trailing && trailing.detail}`);
+});
+
test('verify FAILS when an AUTHORED span does not match the deployed one', async () => {
const chk = await topoCheck(
shapeXml({ cells: [{ f: 'new_name', span: 1 }] }),
@@ -1503,10 +1538,48 @@ test('verify FAILS when an AUTHORED span does not match the deployed one', async
test('verify TOLERATES a deployed span the spec never declared', async () => {
const chk = await topoCheck(
shapeXml({ cells: [{ f: 'new_name', span: 2 }], columns: '1111' }),
- shapeSpec(['new_name']));
+ shapeSpec(['new_name'], 4));
assert.strictEqual(chk.present, true, `an undeclared span must not fail; got ${chk && chk.detail}`);
});
+// --- review follow-up: a section deployed NARROWER than authored must not excuse its own span ----
+// The expected span was clamped against the DEPLOYED width, so a section that came out too narrow
+// lowered its own expectation: authored `columns: 4, colspan: 4` deployed as `columns: 1,
+// colspan: 1` verified PASS. Both faults are now reported.
+test('verify FAILS when a section is deployed narrower than authored', async () => {
+ const chk = await topoCheck(
+ shapeXml({ cells: [{ f: 'new_name', span: 1 }], columns: '1' }),
+ shapeSpec([{ name: 'new_name', colspan: 4 }], 4));
+ assert.strictEqual(chk.present, false,
+ `a section narrower than authored must not excuse its own span; got ${chk && chk.detail}`);
+ assert.match(chk.detail, /deployed 1 column\(s\) wide, the spec declares 4/,
+ `the width fault must be named; got ${chk.detail}`);
+ assert.match(chk.detail, /has colspan 1, the spec declares 4/,
+ `and the span must still be judged against the AUTHORED width; got ${chk.detail}`);
+});
+
+// --- review follow-up: `rowspan` is NOT bounded by the grid ------------------------------------
+// The clamp deliberately tests `key === 'colspan'`. Dropping that guard — clamping both spans
+// against the section width — survived the whole suite, because nothing declared a rowspan at all.
+// A 3-row-tall cell in a 2-column section is perfectly legal: rows are unbounded.
+test('verify TOLERATES a rowspan larger than the section is wide', async () => {
+ const chk = await topoCheck(
+ shapeXml({ cells: [{ f: 'new_name', span: 1, rows: 3 }] }),
+ shapeSpec([{ name: 'new_name', colspan: 1, rowspan: 3 }]));
+ assert.strictEqual(chk.present, true,
+ `rowspan must be compared as authored, never clamped by the column count; got ${chk && chk.detail}`);
+});
+
+// And the counterpart, so "tolerates" above cannot be satisfied by ignoring rowspan entirely.
+test('verify FAILS when a declared rowspan did not deploy', async () => {
+ const chk = await topoCheck(
+ shapeXml({ cells: [{ f: 'new_name', span: 1 }] }),
+ shapeSpec([{ name: 'new_name', colspan: 1, rowspan: 3 }]));
+ assert.strictEqual(chk.present, false, 'a declared rowspan that did not deploy must fail');
+ assert.match(chk.detail, /rowspan 1, the spec declares 3/,
+ `the rowspan fault must be named exactly; got ${chk.detail}`);
+});
+
// A section that declares no width cannot be checked for overflow — unknown is not "one column".
test('verify skips the occupancy check when the deployed section declares no width', async () => {
const xml = `<form><tabs><tab name="tab_overview"><labels><label description="Overview" languagecode="1033"/></labels><columns>`
@@ -1517,3 +1590,87 @@ test('verify skips the occupancy check when the deployed section declares no wid
const chk = await topoCheck(xml, shapeSpec(['new_name', 'new_notes']));
assert.strictEqual(chk.present, true, `unknown width must not invent an overflow; got ${chk && chk.detail}`);
});
+
+// --- F1: a span the COMPILER clamps must verify against its effective value --------------------
+// The schema documents that a span wider than its section is clamped, so `colspan: 4` in a
+// one-column section deploys as 1. Comparing the RAW authored value failed a layout that had been
+// built exactly as documented. Live-reproduced:
+// verify FAIL — field 'qa18a_name' has colspan 1, the spec declares 4
+test('verify accepts a span the compiler CLAMPED to the section width', async () => {
+ const xml = `<form><tabs><tab name="tab_overview"><labels><label description="Overview" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections><section name="sec_left" columns="1">`
+ + `<labels><label description="L" languagecode="1033"/></labels><rows>`
+ + `<row><cell colspan="1"><control datafieldname="new_name" /></cell></row>`
+ + `</rows></section></sections></column></columns></tab></tabs></form>`;
+ const chk = await topoCheck(xml, (spec) => {
+ spec.forms[0].tabs = [{ name: 'tab_overview', label: 'Overview', columns: [
+ { width: '100%', sections: [{ name: 'sec_left', label: 'L', columns: 1, fields: [{ name: 'new_name', colspan: 4 }] }] }] }];
+ });
+ assert.strictEqual(chk.present, true,
+ `a correctly clamped span must verify; got ${chk && chk.detail}`);
+});
+
+test('verify STILL fails a span that is wrong after clamping', async () => {
+ // Declared 4 in a 2-column section clamps to 2, but the cell deployed as 1 — a real mismatch.
+ const xml = `<form><tabs><tab name="tab_overview"><labels><label description="Overview" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections><section name="sec_left" columns="11">`
+ + `<labels><label description="L" languagecode="1033"/></labels><rows>`
+ + `<row><cell colspan="1"><control datafieldname="new_name" /></cell></row>`
+ + `</rows></section></sections></column></columns></tab></tabs></form>`;
+ const chk = await topoCheck(xml, (spec) => {
+ spec.forms[0].tabs = [{ name: 'tab_overview', label: 'Overview', columns: [
+ { width: '100%', sections: [{ name: 'sec_left', label: 'L', columns: 2, fields: [{ name: 'new_name', colspan: 4 }] }] }] }];
+ });
+ assert.strictEqual(chk.present, false, `a genuine mismatch must still fail; got ${chk && chk.detail}`);
+ assert.match(chk.detail, /clamped to 2/, `the message must explain the clamp; got ${chk.detail}`);
+});
+
+// --- F4: a same-named section in ANOTHER tab must not satisfy the placement --------------------
+// The builder can produce two sections called `sec_fields` in different tabs — one holding the
+// fields, one empty in the tab that was requested. Keying placement by section NAME found the
+// empty one equal to the real one and reported PASS while the relocation had not happened.
+// Live-reproduced: verify PASS (28/28) against a form whose fields were in the wrong tab.
+test('verify FAILS when the fields sit in a same-named section under a DIFFERENT tab', async () => {
+ const xml = `<form><tabs>`
+ + `<tab name="tab_source"><labels><label description="Source" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections><section name="sec_fields" columns="1">`
+ + `<labels><label description="F" languagecode="1033"/></labels><rows>`
+ + `<row><cell><control datafieldname="new_name" /></cell></row>`
+ + `</rows></section></sections></column></columns></tab>`
+ + `<tab name="tab_destination"><labels><label description="Destination" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections><section name="sec_fields" columns="1">`
+ + `<labels><label description="F" languagecode="1033"/></labels><rows></rows></section>`
+ + `</sections></column></columns></tab>`
+ + `</tabs></form>`;
+ // The spec asks for the field in the DESTINATION tab. The deployed form has an empty section of
+ // that exact name there, and the real field still in the source tab.
+ const chk = await topoCheck(xml, (spec) => {
+ spec.forms[0].tabs = [{ name: 'tab_destination', label: 'Destination', columns: [
+ { width: '100%', sections: [{ name: 'sec_fields', label: 'F', columns: 1, fields: ['new_name'] }] }] }];
+ });
+ assert.strictEqual(chk.present, false,
+ 'an empty same-named section must not stand in for the real one');
+ assert.match(chk.detail, /under a different tab/,
+ `the message must name the aliasing; got ${chk && chk.detail}`);
+});
+
+// The control: a correctly relocated field must still PASS, so the fix cannot be satisfied by
+// failing every same-named section.
+test('verify PASSES when the field really is in the requested tab', async () => {
+ const xml = `<form><tabs>`
+ + `<tab name="tab_source"><labels><label description="Source" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections><section name="sec_fields" columns="1">`
+ + `<labels><label description="F" languagecode="1033"/></labels><rows></rows></section>`
+ + `</sections></column></columns></tab>`
+ + `<tab name="tab_destination"><labels><label description="Destination" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections><section name="sec_fields" columns="1">`
+ + `<labels><label description="F" languagecode="1033"/></labels><rows>`
+ + `<row><cell><control datafieldname="new_name" /></cell></row>`
+ + `</rows></section></sections></column></columns></tab>`
+ + `</tabs></form>`;
+ const chk = await topoCheck(xml, (spec) => {
+ spec.forms[0].tabs = [{ name: 'tab_destination', label: 'Destination', columns: [
+ { width: '100%', sections: [{ name: 'sec_fields', label: 'F', columns: 1, fields: ['new_name'] }] }] }];
+ });
+ assert.strictEqual(chk.present, true, `a real relocation must verify; got ${chk && chk.detail}`);
+});
diff --git a/plugins/model-apps/scripts/tests/workspace-paths.test.js b/plugins/model-apps/scripts/tests/workspace-paths.test.js
index 0b4be106a..09dd47cbf 100644
--- a/plugins/model-apps/scripts/tests/workspace-paths.test.js
+++ b/plugins/model-apps/scripts/tests/workspace-paths.test.js
@@ -165,3 +165,63 @@ test('an ancestor junction cannot land the delete at a filesystem root', () => {
});
assert.strictEqual(ok.ok, true, `an ordinary canonical target must still clear: ${JSON.stringify(ok)}`);
});
+
+// --- a UNC/network workspace is refused BEFORE any filesystem call ------------------------------
+// MEASURED on Windows: `\\server\share\proj\.maker-workspace` resolves with root `\\server\share\`,
+// so the filesystem-root rules do not reject it and it reaches `lstatSync` — which BLOCKS on an
+// unreachable share until the SMB timeout. A hang is not catchable, and this runs right after a
+// SUCCESSFUL teardown, so the command simply appears wedged.
+//
+// WINDOWS-ONLY by nature. UNC is a Windows/SMB concept: on POSIX a backslash is an ordinary filename
+// character, so `\\server\share\…` is a single relative component and `path.resolve` prepends the
+// cwd — there is no UNC path to detect, and no share to hang on. (A POSIX network mount is just a
+// path like `/mnt/share`, with no syntactic marker to key on.) The test therefore asserts the
+// Windows behaviour on Windows, and on POSIX asserts the thing that actually matters there: such a
+// string is still refused, as an ordinary path that is not a workspace.
+//
+// The injected deps THROW in the Windows case: if the guard ever reaches the filesystem for a UNC
+// path, this fails loudly instead of silently depending on whether the machine has such a share.
+test('a UNC workspace path is refused without touching the filesystem', () => {
+ const UNC = [
+ String.raw`\\server\share\proj\.maker-workspace`,
+ String.raw`\\server\share\.maker-workspace`,
+ String.raw`\\?\UNC\server\share\proj\.maker-workspace`,
+ ];
+ if (process.platform === 'win32') {
+ const boom = () => { throw new Error('the guard must not stat a UNC path'); };
+ for (const unc of UNC) {
+ const r = checkWorkspaceClearable(unc, { lstatSync: boom, realpathSync: boom, readFileSync: boom });
+ assert.strictEqual(r.ok, false, `${unc} must be refused`);
+ assert.match(r.reason, /UNC\/network path/);
+ }
+ return;
+ }
+ // POSIX: not a UNC path at all, but it must still never be deleted.
+ for (const unc of UNC) {
+ const r = checkWorkspaceClearable(unc, {
+ lstatSync: () => { const e = new Error('ENOENT'); e.code = 'ENOENT'; throw e; },
+ realpathSync: () => { const e = new Error('ENOENT'); e.code = 'ENOENT'; throw e; },
+ readFileSync: () => { const e = new Error('ENOENT'); e.code = 'ENOENT'; throw e; },
+ });
+ assert.strictEqual(r.ok, false, `${unc} must still be refused on POSIX`);
+ }
+});
+
+// The refusal must be narrow: a mapped drive is an ordinary local path and a real workspace on one
+// still has to clear, or the guard breaks the normal way of working from a network location.
+test('a mapped drive and an extended-length LOCAL path are not treated as UNC', () => {
+ const d = makeDir(WORKSPACE_DIR_NAME, SDK_MANIFEST);
+ const r = checkWorkspaceClearable(d);
+ assert.strictEqual(r.ok, true, `an ordinary local workspace must still clear; got ${JSON.stringify(r)}`);
+
+ // `\\?\C:\…` is the extended-length form of a LOCAL path — it must reach the normal checks
+ // rather than being rejected as a network path.
+ const ext = checkWorkspaceClearable(String.raw`\\?\C:\proj\.maker-workspace`, {
+ lstatSync: () => { throw new Error("ENOENT"); },
+ realpathSync: () => { throw new Error("ENOENT"); },
+ readFileSync: () => { throw new Error("ENOENT"); },
+ });
+ assert.strictEqual(ext.ok, false);
+ assert.ok(!/UNC\/network path/.test(ext.reason),
+ `an extended-length local path is not UNC; got ${ext.reason}`);
+});
diff --git a/plugins/model-apps/scripts/vendor/PROVENANCE.json b/plugins/model-apps/scripts/vendor/PROVENANCE.json
index 006cb8207..48e6bfdc6 100644
--- a/plugins/model-apps/scripts/vendor/PROVENANCE.json
+++ b/plugins/model-apps/scripts/vendor/PROVENANCE.json
@@ -1,14 +1,14 @@
{
- "commit": "50a43bd3f570ec9ea5545dcc257fae1949f22aaa",
- "subject": "fix(cds-maker-sdk): three regressions from the last two PRs, plus BPF concurrency tokens",
+ "commit": "e3483d6951cefa0876ce943501b9980317163856",
+ "subject": "fix(cds-maker-sdk): condition every BPF write on the token the previous write produced",
"dirtySdkPackage": 0,
- "libBuiltAt": "2026-09-17T23:34:42.907Z",
- "newestSrcAt": "2026-09-17T23:33:11.099Z",
+ "libBuiltAt": "2026-09-23T16:22:40.381Z",
+ "newestSrcAt": "2026-09-23T16:18:15.285Z",
"libIsStale": false,
"nostub": false,
"esbuildVersion": "0.28.1",
"nodeVersion": "v20.20.2",
- "builtAt": "2026-09-17T23:35:33.267Z",
- "bundleSha256": "609cfc9fda047b2a3f6cbea80823942e81e8b99b44a044a681ca98dcb6379467",
- "bundleBytes": 708362
+ "builtAt": "2026-09-23T16:23:33.084Z",
+ "bundleSha256": "7a64e8b1962d4845f7ea7b1cdb753b8934dbb16a2d2bad510843d32911a3a2b8",
+ "bundleBytes": 723384
}
diff --git a/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs b/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs
index 043abad41..7b87fd179 100644
--- a/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs
+++ b/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs
@@ -25,37 +25,37 @@
}
globalThis.document=globalThis.document||globalThis.window.document;
})();
-var XT=Object.create;var gs=Object.defineProperty;var YT=Object.getOwnPropertyDescriptor;var ZT=Object.getOwnPropertyNames;var eP=Object.getPrototypeOf,tP=Object.prototype.hasOwnProperty;var I=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var v=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ur=(e,t)=>{for(var r in t)gs(e,r,{get:t[r],enumerable:!0})},hs=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ZT(t))!tP.call(e,i)&&i!==r&&gs(e,i,{get:()=>t[i],enumerable:!(n=YT(t,i))||n.enumerable});return e},dn=(e,t,r)=>(hs(e,t,"default"),r&&hs(r,t,"default")),ne=(e,t,r)=>(r=e!=null?XT(eP(e)):{},hs(t||!e||!e.__esModule?gs(r,"default",{value:e,enumerable:!0}):r,e)),mr=e=>hs(gs({},"__esModule",{value:!0}),e);var Wn=v(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 Zm;(function(e){e.None="None",e.UserOwned="UserOwned",e.TeamOwned="TeamOwned",e.BusinessOwned="BusinessOwned",e.OrganizationOwned="OrganizationOwned",e.BusinessParented="BusinessParented",e.Filtered="Filtered"})(Zm||(C.OwnershipTypes=Zm={}));var eh;(function(e){e.User="Microsoft.Dynamics.CRM.systemuser",e.Team="Microsoft.Dynamics.CRM.team"})(eh||(C.PrincipalType=eh={}));var th;(function(e){e[e.DoNotDisplayInActivityMenus=0]="DoNotDisplayInActivityMenus",e[e.DisplayInActivityMenus=1]="DisplayInActivityMenus"})(th||(C.ActivityTypeMask=th={}));var rh;(function(e){e.Activity="Activity",e.Virtual="Virtual",e.Standard="Standard",e.Elastic="Elastic"})(rh||(C.TableTypes=rh={}));var nh;(function(e){e.Standard="Standard",e.Virtual="Virtual",e.Elastic="Elastic"})(nh||(C.TableTypeCode=nh={}));var ih;(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"})(ih||(C.FormType=ih={}));var ah;(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(ah||(C.FormPresentation=ah={}));var oh;(function(e){e[e.Inactive=0]="Inactive",e[e.Active=1]="Active"})(oh||(C.ActivationState=oh={}));var sh;(function(e){e[e.String=0]="String",e[e.Number=1]="Number",e[e.Picklist=2]="Picklist"})(sh||(C.AttributeType=sh={}));var lh;(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"})(lh||(C.ViewType=lh={}));var uh;(function(e){e[e.ASPChart=0]="ASPChart",e[e.PowerBI=1]="PowerBI"})(uh||(C.ChartsType=uh={}));var ch;(function(e){e[e.DataAndInteractionCentric=0]="DataAndInteractionCentric",e[e.InteractionCentric=1]="InteractionCentric"})(ch||(C.ChartType=ch={}));var dh;(function(e){e[e.Published=0]="Published",e[e.Unpublished=1]="Unpublished",e[e.Deleted=2]="Deleted",e[e.DeletedUnpublished=3]="DeletedUnpublished"})(dh||(C.ComponentState=dh={}));var ph;(function(e){e[e.None=1]="None",e[e.Sandbox=2]="Sandbox",e[e.External=3]="External"})(ph||(C.PluginIsolationMode=ph={}));var fh;(function(e){e[e.BasicAuth=0]="BasicAuth"})(fh||(C.AuthType=fh={}));var mh;(function(e){e[e.Database=0]="Database",e[e.Disk=1]="Disk",e[e.Normal=2]="Normal",e[e.AzureWebApp=3]="AzureWebApp"})(mh||(C.PluginSourceType=mh={}));var hh;(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"})(hh||(C.AttributeTypeCode=hh={}));var gh;(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"})(gh||(C.AttributeTypeName=gh={}));var vh;(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"})(vh||(C.AttributeFormatCode=vh={}));var yh;(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"})(yh||(C.AttributeFormatName=yh={}));var bh;(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"})(bh||(C.AttributeTypeCodeNum=bh={}));var wh;(function(e){e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean"})(wh||(C.OptionSetType=wh={}));var Ah;(function(e){e[e.Draft=0]="Draft",e[e.Activated=1]="Activated"})(Ah||(C.StateCode=Ah={}));var Ch;(function(e){e[e.Draft=1]="Draft",e[e.Activated=2]="Activated"})(Ch||(C.StatusCode=Ch={}));var Sh;(function(e){e[e.Enabled=0]="Enabled",e[e.Disabled=1]="Disabled"})(Sh||(C.StateCodeEnabledDisabled=Sh={}));var Eh;(function(e){e[e.Enabled=1]="Enabled",e[e.Disabled=2]="Disabled"})(Eh||(C.StatusCodeEnabledDisabled=Eh={}));var Nh;(function(e){e[e.Definition=1]="Definition",e[e.Activation=2]="Activation",e[e.Template=3]="Template"})(Nh||(C.WorkflowTypeCode=Nh={}));var Dh;(function(e){e[e.User=1]="User",e[e.BusinessUnit=2]="BusinessUnit",e[e.ParentChildBusinessUnit=3]="ParentChildBusinessUnit",e[e.Organization=4]="Organization"})(Dh||(C.WorkflowScope=Dh={}));var Ih;(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"})(Ih||(C.WorkflowCategory=Ih={}));var _h;(function(e){e[e.None=-1]="None",e[e.BusinessFlow=0]="BusinessFlow",e[e.TaskFlow=1]="TaskFlow"})(_h||(C.BusinessProcessType=_h={}));var Th;(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"})(Th||(C.AppSubType=Th={}));var Ph;(function(e){e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Ph||(C.RelationshipType=Ph={}));var Oh;(function(e){e.ManyToOneRelationship="ManyToOneRelationship",e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Oh||(C.RelationshipTypeExt=Oh={}));var Rh;(function(e){e.NoCascade="NoCascade",e.Cascade="Cascade",e.Active="Active",e.UserOwned="UserOwned",e.RemoveLink="RemoveLink",e.Restrict="Restrict"})(Rh||(C.CascadeType=Rh={}));var Fh;(function(e){e.None="None",e.Append="Append",e.ParentChild="ParentChild",e.Pointer="Pointer",e.Inheritance="Inheritance"})(Fh||(C.RelationshipSecurityTypes=Fh={}));var xh;(function(e){e[e.Active=1]="Active",e[e.Inactive=2]="Inactive"})(xh||(C.ViewStatusCode=xh={}));var Lh;(function(e){e[e.Active=0]="Active",e[e.Inactive=1]="Inactive"})(Lh||(C.ViewStateCode=Lh={}));var kh;(function(e){e.Active="Active",e.Failed="Failed",e.InProgress="InProgress",e.Pending="Pending"})(kh||(C.EntityKeyIndexStatus=kh={}));var Mh;(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"})(Mh||(C.SolutionComponentTypeCode=Mh={}));var Bh;(function(e){e[e.IncludeSubcomponents=0]="IncludeSubcomponents",e[e.DoNotIncludeSubcomponents=1]="DoNotIncludeSubcomponents",e[e.IncludeAsShellOnly=2]="IncludeAsShellOnly"})(Bh||(C.RootComponentBehavior=Bh={}));var vs;(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"})(vs||(C.SolutionComponentTypeCodeExt=vs={}));var ys;(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"})(ys||(C.EntityTypeCode=ys={}));var Uh;(function(e){e.MultiSelectPicklist="MultiSelectPicklist",e.File="File",e.Image="Image"})(Uh||(C.SolutionComponentVirtualAttributeSubtype=Uh={}));function rP(e){let t=vs[e];return ys[t]}C.SolutionComponentTypeCodeToEntityTypeCodeExt=rP;function nP(e){let t=ys[e];return vs[t]}C.SolutionEntityTypeCodeExtToComponentTypeCode=nP;var $h;(function(e){e.Active="Active",e.Auto="Auto",e.Disabled="Disabled",e.Inactive="Inactive"})($h||(C.ImeMode=$h={}));var qh;(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"})(qh||(C.SourceType=qh={}));var Vh;(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"})(Vh||(C.StringFormatName=Vh={}));var Gh;(function(e){e[e.PrecisionProperty=0]="PrecisionProperty",e[e.Organization=1]="Organization",e[e.TransactionCurrency=2]="TransactionCurrency"})(Gh||(C.PrecisionSource=Gh={}));var zh;(function(e){e.UserLocal="UserLocal",e.DateOnly="DateOnly",e.TimeZoneIndependent="TimeZoneIndependent"})(zh||(C.DateTimeBehavior=zh={}));var Wh;(function(e){e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(Wh||(C.DateTimeFormat=Wh={}));var Hh;(function(e){e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(Hh||(C.IntegerFormat=Hh={}));var jh;(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"})(jh||(C.WebResourceTypeCode=jh={}));var Jh;(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"})(Jh||(C.SdkMessageProcessingStage=Jh={}));var Qh;(function(e){e[e.ServerOnly=0]="ServerOnly",e[e.OutlookClientOnly=1]="OutlookClientOnly",e[e.Both=2]="Both"})(Qh||(C.SupportedDeployment=Qh={}));var Kh;(function(e){e[e.Synchronous=0]="Synchronous",e[e.Asynchronous=1]="Asynchronous"})(Kh||(C.SdkMessageProcessingMode=Kh={}));var Xh;(function(e){e[e.ReportingServicesReport=1]="ReportingServicesReport",e[e.OtherReport=2]="OtherReport",e[e.LinkedReport=3]="LinkedReport"})(Xh||(C.ReportTypeCode=Xh={}));var Yh;(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"})(Yh||(C.ConnectionRoleCategory=Yh={}));var Zh;(function(e){e[e.Name=1]="Name",e[e.Address=2]="Address"})(Zh||(C.ServiceNamespaceFormat=Zh={}));var eg;(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"})(eg||(C.ServiceEndpointContract=eg={}));var tg;(function(e){e[e.Normal=1]="Normal",e[e.Federated=2]="Federated"})(tg||(C.ServiceEndpointConnectionMode=tg={}));var rg;(function(e){e.CannotDeleteInUseComponent="0x8004f01f",e.CannotDeleteInUseAttribute="0x80048418",e.CannotDeleteInUseOptionSet="0x80048417",e.CannotDeleteInUseEntity="0x80048420",e.CannotUninstallWithDependencies="0x8004F01D"})(rg||(C.DeleteDependencyErrorCode=rg={}));var ng;(function(e){e.SystemAdministrator="627090FF-40A3-4053-8790-584EDC5BE201",e.SystemCustomizer="119F245C-3CC8-4B62-B31C-D1A046CED15D"})(ng||(C.DefaultRoleTemplates=ng={}));var ig;(function(e){e[e.DefaultTeamPrivilege=0]="DefaultTeamPrivilege",e[e.DirectUserAndTeamPrivilege=1]="DirectUserAndTeamPrivilege"})(ig||(C.RoleInheritance=ig={}));var ag;(function(e){e[e.NotSpecified=0]="NotSpecified",e[e.CustomConnector=1]="CustomConnector"})(ag||(C.ConnectorTypeEnum=ag={}));var og;(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"})(og||(C.EnvironmentVariableDefinitionTypeEnum=og={}));var sg;(function(e){e[e.Owner=0]="Owner",e[e.Access=1]="Access",e[e.AADSecurityGroup=2]="AADSecurityGroup",e[e.AADOfficeGroup=3]="AADOfficeGroup"})(sg||(C.TeamTypeEnum=sg={}));var lg;(function(e){e.Bots="bots"})(lg||(C.KnownCustomSolutionComponentEntitySetName=lg={}));var ug;(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"})(ug||(C.QueryType=ug={}))});var re=v(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.LocalEditsWouldBeLostError=Y.StaleArtifactError=Y.InvalidArgumentError=Y.ValidationError=Y.PathNotFoundError=Y.ArtifactNotFoundError=Y.readPartialTokens=Y.withPartialTokens=Y.SdkError=void 0;var Xe=class extends Error{constructor(t,r){super(r),this.code=t,Object.setPrototypeOf(this,new.target.prototype),this.name=new.target.name}};Y.SdkError=Xe;var cg=Symbol.for("cds-maker-sdk.partialWriteTokens");function iP(e,t){return typeof e=="object"&&e!==null&&(e[cg]=t),e}Y.withPartialTokens=iP;function aP(e){let t=e;for(let r=0;t&&typeof t=="object"&&r<8;r++){let n=t[cg];if(n&&typeof n=="object")return n;t=t.cause}}Y.readPartialTokens=aP;var cc=class extends Xe{constructor(t,r){super("ARTIFACT_NOT_FOUND",`Artifact ${t}/${r} not found in workspace`),this.type=t,this.id=r}};Y.ArtifactNotFoundError=cc;var dc=class extends Xe{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=dc;var pc=class extends Xe{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}:
+var yP=Object.create;var Ss=Object.defineProperty;var bP=Object.getOwnPropertyDescriptor;var wP=Object.getOwnPropertyNames;var AP=Object.getPrototypeOf,CP=Object.prototype.hasOwnProperty;var I=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var v=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},zr=(e,t)=>{for(var r in t)Ss(e,r,{get:t[r],enumerable:!0})},Es=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wP(t))!CP.call(e,i)&&i!==r&&Ss(e,i,{get:()=>t[i],enumerable:!(n=bP(t,i))||n.enumerable});return e},bn=(e,t,r)=>(Es(e,t,"default"),r&&Es(r,t,"default")),ie=(e,t,r)=>(r=e!=null?yP(AP(e)):{},Es(t||!e||!e.__esModule?Ss(r,"default",{value:e,enumerable:!0}):r,e)),br=e=>Es(Ss({},"__esModule",{value:!0}),e);var Yn=v(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.DateTimeBehavior=E.PrecisionSource=E.StringFormatName=E.SourceType=E.ImeMode=E.SolutionEntityTypeCodeExtToComponentTypeCode=E.SolutionComponentTypeCodeToEntityTypeCodeExt=E.SolutionComponentVirtualAttributeSubtype=E.EntityTypeCode=E.SolutionComponentTypeCodeExt=E.RootComponentBehavior=E.SolutionComponentTypeCode=E.EntityKeyIndexStatus=E.ViewStateCode=E.ViewStatusCode=E.RelationshipSecurityTypes=E.CascadeType=E.RelationshipTypeExt=E.RelationshipType=E.AppSubType=E.BusinessProcessType=E.WorkflowCategory=E.WorkflowScope=E.WorkflowTypeCode=E.StatusCodeEnabledDisabled=E.StateCodeEnabledDisabled=E.StatusCode=E.StateCode=E.OptionSetType=E.AttributeTypeCodeNum=E.AttributeFormatName=E.AttributeFormatCode=E.AttributeTypeName=E.AttributeTypeCode=E.PluginSourceType=E.AuthType=E.PluginIsolationMode=E.ComponentState=E.ChartType=E.ChartsType=E.ViewType=E.AttributeType=E.ActivationState=E.FormPresentation=E.FormType=E.TableTypeCode=E.TableTypes=E.ActivityTypeMask=E.PrincipalType=E.OwnershipTypes=void 0;E.QueryType=E.KnownCustomSolutionComponentEntitySetName=E.TeamTypeEnum=E.EnvironmentVariableDefinitionTypeEnum=E.ConnectorTypeEnum=E.RoleInheritance=E.DefaultRoleTemplates=E.DeleteDependencyErrorCode=E.ServiceEndpointConnectionMode=E.ServiceEndpointContract=E.ServiceNamespaceFormat=E.ConnectionRoleCategory=E.ReportTypeCode=E.SdkMessageProcessingMode=E.SupportedDeployment=E.SdkMessageProcessingStage=E.WebResourceTypeCode=E.IntegerFormat=E.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||(E.OwnershipTypes=vh={}));var yh;(function(e){e.User="Microsoft.Dynamics.CRM.systemuser",e.Team="Microsoft.Dynamics.CRM.team"})(yh||(E.PrincipalType=yh={}));var bh;(function(e){e[e.DoNotDisplayInActivityMenus=0]="DoNotDisplayInActivityMenus",e[e.DisplayInActivityMenus=1]="DisplayInActivityMenus"})(bh||(E.ActivityTypeMask=bh={}));var wh;(function(e){e.Activity="Activity",e.Virtual="Virtual",e.Standard="Standard",e.Elastic="Elastic"})(wh||(E.TableTypes=wh={}));var Ah;(function(e){e.Standard="Standard",e.Virtual="Virtual",e.Elastic="Elastic"})(Ah||(E.TableTypeCode=Ah={}));var Ch;(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"})(Ch||(E.FormType=Ch={}));var Eh;(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(Eh||(E.FormPresentation=Eh={}));var Sh;(function(e){e[e.Inactive=0]="Inactive",e[e.Active=1]="Active"})(Sh||(E.ActivationState=Sh={}));var Nh;(function(e){e[e.String=0]="String",e[e.Number=1]="Number",e[e.Picklist=2]="Picklist"})(Nh||(E.AttributeType=Nh={}));var Dh;(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"})(Dh||(E.ViewType=Dh={}));var Ih;(function(e){e[e.ASPChart=0]="ASPChart",e[e.PowerBI=1]="PowerBI"})(Ih||(E.ChartsType=Ih={}));var _h;(function(e){e[e.DataAndInteractionCentric=0]="DataAndInteractionCentric",e[e.InteractionCentric=1]="InteractionCentric"})(_h||(E.ChartType=_h={}));var Th;(function(e){e[e.Published=0]="Published",e[e.Unpublished=1]="Unpublished",e[e.Deleted=2]="Deleted",e[e.DeletedUnpublished=3]="DeletedUnpublished"})(Th||(E.ComponentState=Th={}));var Ph;(function(e){e[e.None=1]="None",e[e.Sandbox=2]="Sandbox",e[e.External=3]="External"})(Ph||(E.PluginIsolationMode=Ph={}));var Oh;(function(e){e[e.BasicAuth=0]="BasicAuth"})(Oh||(E.AuthType=Oh={}));var Rh;(function(e){e[e.Database=0]="Database",e[e.Disk=1]="Disk",e[e.Normal=2]="Normal",e[e.AzureWebApp=3]="AzureWebApp"})(Rh||(E.PluginSourceType=Rh={}));var Fh;(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"})(Fh||(E.AttributeTypeCode=Fh={}));var xh;(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"})(xh||(E.AttributeTypeName=xh={}));var Lh;(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"})(Lh||(E.AttributeFormatCode=Lh={}));var kh;(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"})(kh||(E.AttributeFormatName=kh={}));var Mh;(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"})(Mh||(E.AttributeTypeCodeNum=Mh={}));var Uh;(function(e){e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean"})(Uh||(E.OptionSetType=Uh={}));var Bh;(function(e){e[e.Draft=0]="Draft",e[e.Activated=1]="Activated"})(Bh||(E.StateCode=Bh={}));var $h;(function(e){e[e.Draft=1]="Draft",e[e.Activated=2]="Activated"})($h||(E.StatusCode=$h={}));var qh;(function(e){e[e.Enabled=0]="Enabled",e[e.Disabled=1]="Disabled"})(qh||(E.StateCodeEnabledDisabled=qh={}));var Vh;(function(e){e[e.Enabled=1]="Enabled",e[e.Disabled=2]="Disabled"})(Vh||(E.StatusCodeEnabledDisabled=Vh={}));var Gh;(function(e){e[e.Definition=1]="Definition",e[e.Activation=2]="Activation",e[e.Template=3]="Template"})(Gh||(E.WorkflowTypeCode=Gh={}));var zh;(function(e){e[e.User=1]="User",e[e.BusinessUnit=2]="BusinessUnit",e[e.ParentChildBusinessUnit=3]="ParentChildBusinessUnit",e[e.Organization=4]="Organization"})(zh||(E.WorkflowScope=zh={}));var Wh;(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"})(Wh||(E.WorkflowCategory=Wh={}));var Hh;(function(e){e[e.None=-1]="None",e[e.BusinessFlow=0]="BusinessFlow",e[e.TaskFlow=1]="TaskFlow"})(Hh||(E.BusinessProcessType=Hh={}));var jh;(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"})(jh||(E.AppSubType=jh={}));var Jh;(function(e){e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Jh||(E.RelationshipType=Jh={}));var Qh;(function(e){e.ManyToOneRelationship="ManyToOneRelationship",e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Qh||(E.RelationshipTypeExt=Qh={}));var Kh;(function(e){e.NoCascade="NoCascade",e.Cascade="Cascade",e.Active="Active",e.UserOwned="UserOwned",e.RemoveLink="RemoveLink",e.Restrict="Restrict"})(Kh||(E.CascadeType=Kh={}));var Xh;(function(e){e.None="None",e.Append="Append",e.ParentChild="ParentChild",e.Pointer="Pointer",e.Inheritance="Inheritance"})(Xh||(E.RelationshipSecurityTypes=Xh={}));var Yh;(function(e){e[e.Active=1]="Active",e[e.Inactive=2]="Inactive"})(Yh||(E.ViewStatusCode=Yh={}));var Zh;(function(e){e[e.Active=0]="Active",e[e.Inactive=1]="Inactive"})(Zh||(E.ViewStateCode=Zh={}));var eg;(function(e){e.Active="Active",e.Failed="Failed",e.InProgress="InProgress",e.Pending="Pending"})(eg||(E.EntityKeyIndexStatus=eg={}));var tg;(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"})(tg||(E.SolutionComponentTypeCode=tg={}));var rg;(function(e){e[e.IncludeSubcomponents=0]="IncludeSubcomponents",e[e.DoNotIncludeSubcomponents=1]="DoNotIncludeSubcomponents",e[e.IncludeAsShellOnly=2]="IncludeAsShellOnly"})(rg||(E.RootComponentBehavior=rg={}));var Ns;(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"})(Ns||(E.SolutionComponentTypeCodeExt=Ns={}));var Ds;(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"})(Ds||(E.EntityTypeCode=Ds={}));var ng;(function(e){e.MultiSelectPicklist="MultiSelectPicklist",e.File="File",e.Image="Image"})(ng||(E.SolutionComponentVirtualAttributeSubtype=ng={}));function EP(e){let t=Ns[e];return Ds[t]}E.SolutionComponentTypeCodeToEntityTypeCodeExt=EP;function SP(e){let t=Ds[e];return Ns[t]}E.SolutionEntityTypeCodeExtToComponentTypeCode=SP;var ig;(function(e){e.Active="Active",e.Auto="Auto",e.Disabled="Disabled",e.Inactive="Inactive"})(ig||(E.ImeMode=ig={}));var ag;(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"})(ag||(E.SourceType=ag={}));var og;(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"})(og||(E.StringFormatName=og={}));var sg;(function(e){e[e.PrecisionProperty=0]="PrecisionProperty",e[e.Organization=1]="Organization",e[e.TransactionCurrency=2]="TransactionCurrency"})(sg||(E.PrecisionSource=sg={}));var lg;(function(e){e.UserLocal="UserLocal",e.DateOnly="DateOnly",e.TimeZoneIndependent="TimeZoneIndependent"})(lg||(E.DateTimeBehavior=lg={}));var ug;(function(e){e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(ug||(E.DateTimeFormat=ug={}));var cg;(function(e){e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(cg||(E.IntegerFormat=cg={}));var dg;(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"})(dg||(E.WebResourceTypeCode=dg={}));var pg;(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"})(pg||(E.SdkMessageProcessingStage=pg={}));var fg;(function(e){e[e.ServerOnly=0]="ServerOnly",e[e.OutlookClientOnly=1]="OutlookClientOnly",e[e.Both=2]="Both"})(fg||(E.SupportedDeployment=fg={}));var mg;(function(e){e[e.Synchronous=0]="Synchronous",e[e.Asynchronous=1]="Asynchronous"})(mg||(E.SdkMessageProcessingMode=mg={}));var hg;(function(e){e[e.ReportingServicesReport=1]="ReportingServicesReport",e[e.OtherReport=2]="OtherReport",e[e.LinkedReport=3]="LinkedReport"})(hg||(E.ReportTypeCode=hg={}));var gg;(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"})(gg||(E.ConnectionRoleCategory=gg={}));var vg;(function(e){e[e.Name=1]="Name",e[e.Address=2]="Address"})(vg||(E.ServiceNamespaceFormat=vg={}));var yg;(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"})(yg||(E.ServiceEndpointContract=yg={}));var bg;(function(e){e[e.Normal=1]="Normal",e[e.Federated=2]="Federated"})(bg||(E.ServiceEndpointConnectionMode=bg={}));var wg;(function(e){e.CannotDeleteInUseComponent="0x8004f01f",e.CannotDeleteInUseAttribute="0x80048418",e.CannotDeleteInUseOptionSet="0x80048417",e.CannotDeleteInUseEntity="0x80048420",e.CannotUninstallWithDependencies="0x8004F01D"})(wg||(E.DeleteDependencyErrorCode=wg={}));var Ag;(function(e){e.SystemAdministrator="627090FF-40A3-4053-8790-584EDC5BE201",e.SystemCustomizer="119F245C-3CC8-4B62-B31C-D1A046CED15D"})(Ag||(E.DefaultRoleTemplates=Ag={}));var Cg;(function(e){e[e.DefaultTeamPrivilege=0]="DefaultTeamPrivilege",e[e.DirectUserAndTeamPrivilege=1]="DirectUserAndTeamPrivilege"})(Cg||(E.RoleInheritance=Cg={}));var Eg;(function(e){e[e.NotSpecified=0]="NotSpecified",e[e.CustomConnector=1]="CustomConnector"})(Eg||(E.ConnectorTypeEnum=Eg={}));var Sg;(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"})(Sg||(E.EnvironmentVariableDefinitionTypeEnum=Sg={}));var Ng;(function(e){e[e.Owner=0]="Owner",e[e.Access=1]="Access",e[e.AADSecurityGroup=2]="AADSecurityGroup",e[e.AADOfficeGroup=3]="AADOfficeGroup"})(Ng||(E.TeamTypeEnum=Ng={}));var Dg;(function(e){e.Bots="bots"})(Dg||(E.KnownCustomSolutionComponentEntitySetName=Dg={}));var Ig;(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"})(Ig||(E.QueryType=Ig={}))});var te=v(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.LocalEditsWouldBeLostError=Y.StaleArtifactError=Y.InvalidArgumentError=Y.ValidationError=Y.PathNotFoundError=Y.ArtifactNotFoundError=Y.readPartialTokens=Y.withPartialTokens=Y.SdkError=void 0;var Ke=class extends Error{constructor(t,r){super(r),this.code=t,Object.setPrototypeOf(this,new.target.prototype),this.name=new.target.name}};Y.SdkError=Ke;var _g=Symbol.for("cds-maker-sdk.partialWriteTokens");function NP(e,t){return typeof e=="object"&&e!==null&&(e[_g]=t),e}Y.withPartialTokens=NP;function DP(e){let t=e;for(let r=0;t&&typeof t=="object"&&r<8;r++){let n=t[_g];if(n&&typeof n=="object")return n;t=t.cause}}Y.readPartialTokens=DP;var bc=class extends Ke{constructor(t,r){super("ARTIFACT_NOT_FOUND",`Artifact ${t}/${r} not found in workspace`),this.type=t,this.id=r}};Y.ArtifactNotFoundError=bc;var wc=class extends Ke{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=wc;var Ac=class extends Ke{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=pc;var fc=class extends Xe{constructor(t){super("INVALID_ARGUMENT",t)}};Y.InvalidArgumentError=fc;var mc=class extends Xe{constructor(t,r,n){super("STALE_ARTIFACT",`Cannot apply the edit at ${n} to ${t}/${r}: the cached copy was stale and the server copy has since changed, so any pointer derived from the old copy may now identify a different node. The local copy has been refreshed \u2014 re-read the artifact, re-derive the pointer, and retry.`),this.type=t,this.id=r,this.pointer=n}};Y.StaleArtifactError=mc;var hc=class extends Xe{constructor(t,r,n,i){super("LOCAL_EDITS_WOULD_BE_LOST",`Refusing to fetch ${t}/${r}: the local copy has unpushed edits AND the server has moved since it was fetched (local=${n??"(none)"}, server=${i??"(none)"}). Overwriting now would discard your edits and replace them with another writer's changes. Push or discard your edits first, or pass { overwrite: true } to deliberately reset the local copy to the server version.`),this.type=t,this.id=r,this.localEtag=n,this.serverEtag=i}};Y.LocalEditsWouldBeLostError=hc;var gc=class extends Xe{constructor(t,r,n,i,a){super("VERSION_CONFLICT",`Version conflict for ${t}/${r}: local=${n??"(none)"}, server=${i??"(none)"}. Re-fetch and reapply changes.${a?` ${a}`:""}`),this.type=t,this.id=r,this.localEtag=n,this.serverEtag=i,this.detail=a}};Y.VersionConflictError=gc;var vc=class extends Xe{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=vc;var yc=class extends Xe{constructor(t){super("WORKSPACE_NOT_INITIALIZED",`Workspace not initialized at ${t}. Call initWorkspace() first.`),this.workspacePath=t}};Y.WorkspaceNotInitializedError=yc;var bc=class extends Xe{constructor(t,r){super("NOT_IMPLEMENTED",`Operation '${t}' is not implemented yet${r?`: ${r}`:""}.`),this.operation=t}};Y.NotImplementedError=bc;var wc=class extends Xe{constructor(t,r){super("INVALID_JSON_POINTER",`Invalid JSON Pointer '${t}': ${r}`),this.pointer=t}};Y.JsonPointerError=wc;var Ac=class extends Xe{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=Ac;var Cc=class extends Xe{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=Cc;var Sc=class extends Xe{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=Sc});var ie=v(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.odataQuery=Oe.normalizeGuid=Oe.createSafeXmlElement=Oe.assertNoControlChars=Oe.assertODataName=Oe.assertXmlName=Oe.xmlText=Oe.odataPathLiteral=Oe.odataLiteral=void 0;var bs=re();function dg(e){return String(e??"").replace(/'/g,"''")}Oe.odataLiteral=dg;function oP(e){return encodeURIComponent(dg(e))}Oe.odataPathLiteral=oP;function sP(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Oe.xmlText=sP;function pg(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 bs.InvalidArgumentError(`${t} must be a valid XML element name (got '${e}')`);return e}Oe.assertXmlName=pg;function lP(e,t){let r=String(e??"");if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r))throw new bs.InvalidArgumentError(`${t} must be a valid OData identifier (letters, digits, underscore): got '${e}'`);return e}Oe.assertODataName=lP;function uP(e,t){if(/[\u0000-\u001F\u007F]/.test(String(e??"")))throw new bs.InvalidArgumentError(`${t} must not contain control characters (including CR/LF): they would inject additional lines into the request`);return e}Oe.assertNoControlChars=uP;function cP(e,t,r){return e.createElement(pg(t,r))}Oe.createSafeXmlElement=cP;var dP=/^[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 pP(e,t){let r=String(e??""),n=r.length===38&&r.startsWith("{")&&r.endsWith("}")?r.slice(1,-1):r;if(!dP.test(n))throw new bs.InvalidArgumentError(`${t} must be a valid GUID (got '${e}')`);return n.toLowerCase()}Oe.normalizeGuid=pP;function fP(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=fP});var be=v(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.nowIso=ae.isAlreadyDeleted=ae.deleteRecord=ae.ensureSuccess=ae.resolveCreatedId=ae.requireCreatedId=ae.withClientMintedId=ae.readCreatedId=ae.readEtag=ae.requireEtag=ae.echoWrite=ae.UPDATE_NO_ETAG_CODE=ae.VERSION_CONFLICT_CODE=void 0;var yi=re(),qa=ie();ae.VERSION_CONFLICT_CODE="VERSION_CONFLICT";ae.UPDATE_NO_ETAG_CODE="ARTIFACT_UPDATE_NO_ETAG";function mP(e,t){return{query:`?$select=${encodeURIComponent(e)}`,options:{headers:{...t??{},Prefer:"return=representation"}}}}ae.echoWrite=mP;function hP(e,t,r){if(!e)throw new yi.SdkError(ae.UPDATE_NO_ETAG_CODE,`Refusing to push ${t} '${r}': no concurrency token is held for it, so the write could not be made conditional and would silently overwrite a concurrent edit. Re-fetch the ${t} and re-apply the change.`);return e}ae.requireEtag=hP;function gP(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}ae.readEtag=gP;function Ec(e,t){var r;let n=e.body;if(n&&typeof n[t]=="string")return(0,qa.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,qa.normalizeGuid)(o[1],t)}return null}ae.readCreatedId=Ec;function vP(e,t,r){return r?{...e,[t]:(0,qa.normalizeGuid)(r,t)}:e}ae.withClientMintedId=vP;function yP(e,t,r){let n=Ec(e,t);if(!n)throw new yi.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`);return n}ae.requireCreatedId=yP;function bP(e,t,r,n){let i=Ec(e,t);if(i)return i;if(n)return(0,qa.normalizeGuid)(n,t);throw new yi.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`)}ae.resolveCreatedId=bP;function fg(e,t){if(e.status===412)throw new yi.SdkError(ae.VERSION_CONFLICT_CODE,`Version conflict (412) from ${t}`);if(e.status<200||e.status>=300)throw new yi.ConnectionError(t,e.status,wP(e.body),e.body);return e}ae.ensureSuccess=fg;function wP(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 AP(e,t,r,n){let i=(0,qa.normalizeGuid)(r,"id"),a=`/${t}(${i})`;fg(await e.delete(a,n?{headers:{"If-Match":n}}:void 0),e.apiUrl(a))}ae.deleteRecord=AP;function CP(e){return e instanceof yi.ConnectionError&&e.statusCode===404}ae.isAlreadyDeleted=CP;function SP(){return new Date().toISOString()}ae.nowIso=SP});var $t=v(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.describeMalformedValue=bi.collectPages=void 0;var mg=be(),Nc=re();async function EP(e,t,r,n){let i=[],a=new Set,o=e.apiUrl(t),s=(0,mg.ensureSuccess)(await e.get(t),o);for(n?.(s);;){let l=s.body,u=l?.value;if(!Array.isArray(u))throw new Nc.ConnectionError(o,s.status,`${r}: paginated read returned a malformed page \u2014 expected an OData 'value' array but got ${Dc(u)}; refusing to return partial results.`);for(let d of u)i.push(d);let c=l?.["@odata.nextLink"];if(c==null)break;if(typeof c!="string"||c.length===0)throw new Nc.ConnectionError(o,s.status,`${r}: paginated read returned a malformed @odata.nextLink (${Dc(c)}); cannot follow it, and refusing to return partial results.`);if(a.has(c))throw new Nc.InvalidArgumentError(`${r}: aborting pagination \u2014 the server returned a repeated @odata.nextLink ('${c}'), which would loop indefinitely.`);a.add(c),o=c,s=(0,mg.ensureSuccess)(await e.getAbsolute(c),c)}return i}bi.collectPages=EP;function Dc(e){return e===null?"null":e===void 0?"undefined (missing)":`a ${typeof e}`}bi.describeMalformedValue=Dc});var Ic=v(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.businessRuleApi=hr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE=hr.WFOM_API_UNAVAILABLE_CODE=void 0;var $r=Wn(),NP=$t(),Ye=be(),pn=ie(),As=re();hr.WFOM_API_UNAVAILABLE_CODE="BUSINESS_RULE_API_UNAVAILABLE";hr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE="BUSINESS_RULE_LEFT_DEACTIVATED";async function hg(e,t,r,n){let i=`/workflows(${_P})/Microsoft.Dynamics.CRM.${t}`;try{return(0,Ye.ensureSuccess)(await e.post(i,{Entity:r.Entity,WfomJson:r.WfomJson},{headers:n}),e.apiUrl(i))}catch(a){throw a?.statusCode!==404?a:new As.SdkError(hr.WFOM_API_UNAVAILABLE_CODE,`Business-rule authoring (preview) is not enabled on this environment yet: it does not expose 'Microsoft.Dynamics.CRM.${t}'. The bound members are still rolling out, so re-check once the release flag reaches this environment. Nothing was written. The SDK does NOT fall back to generating workflow XAML: that covered only 4 of the 7 action types and would silently save a rule different from the one you wrote.`)}}async function DP(e,t){let r=`/workflows(${t})${(0,pn.odataQuery)([["$select","workflowid,statecode,statuscode"]])}`;try{let n=await e.get(r);if(n.status<200||n.status>=300)return null;let i=n.body;return{etag:(0,Ye.readEtag)(n),statecode:typeof i?.statecode=="number"?i.statecode:null,statuscode:typeof i?.statuscode=="number"?i.statuscode:null}}catch{return null}}async function IP(e,t,r){let n=await DP(e,t);if(n===null||n.etag===null)throw new As.SdkError(Ye.VERSION_CONFLICT_CODE,`Refusing to update business rule '${t}': its current version could not be read, so the write could not be verified as conditional. The supported update api does not enforce If-Match, so proceeding would risk silently overwriting a concurrent edit. Re-fetch the rule and try again.`);if(n.etag!==r)throw new As.SdkError(Ye.VERSION_CONFLICT_CODE,`Version conflict updating business rule '${t}': it changed on the server since it was fetched (held ${r}, server ${n.etag}). Re-fetch the rule and re-apply the change.`);return{statecode:n.statecode,statuscode:n.statuscode}}var _P="00000000-0000-0000-0000-000000000000",ws={"Content-Type":"application/json",Accept:"application/json","OData-Version":"4.0","OData-MaxVersion":"4.0"},TP="workflowid,name,description,primaryentity,statecode,category,type",PP="category eq 2 and type eq 1";async function gg(e,t,r){var n;if(r==="Draft")return null;let i=(0,pn.normalizeGuid)(t,"workflowid"),a=r==="Active",o={statecode:a?$r.StateCode.Activated:$r.StateCode.Draft,statuscode:a?$r.StatusCode.Activated:$r.StatusCode.Draft},s=`/workflows(${i})`,l=(0,Ye.ensureSuccess)(await e.patch(s,o,{headers:ws}),e.apiUrl(s));return(n=(0,Ye.readEtag)(l))!==null&&n!==void 0?n:await Va(e,i)}async function Va(e,t){let r=`/workflows(${t})${(0,pn.odataQuery)([["$select","workflowid"]])}`;try{let n=await e.get(r);return n.status>=200&&n.status<300?(0,Ye.readEtag)(n):null}catch{return null}}async function OP(e,t,r){let n=await Va(e,t),i=await r(),a=(0,Ye.readEtag)(i);if(a)return{response:i,etag:a};let o=await Va(e,t);return{response:i,etag:n!==null&&n===o?o:null}}hr.businessRuleApi={async get(e,t){let r=(0,pn.normalizeGuid)(t,"id"),n=`/workflows(${r})/Microsoft.Dynamics.CRM.RetrieveProcessWithWfomJson`,{response:i,etag:a}=await OP(e,r,async()=>(0,Ye.ensureSuccess)(await e.get(n),e.apiUrl(n)));return{raw:i.body,etag:a}},async list(e,t){let r=[PP];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,pn.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,pn.odataQuery)([["$select",TP],["$filter",r.join(" and ")]])}`;return(await(0,NP.collectPages)(e,n,"listArtifacts('businessRule')")).map(a=>{var o,s;return{type:"businessRule",id:(o=a.workflowid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.primaryentity,isDirty:!1}})},async create(e,t){var r;let n=t,i=(0,pn.normalizeGuid)(n.Entity.workflowid,"workflowid"),a=await hg(e,"CreateProcessWithWfomJson",n,ws),o=(0,Ye.resolveCreatedId)(a,"workflowid","business rule",i),s=null;try{s=await gg(e,o,n.status)}catch(l){try{await(0,Ye.deleteRecord)(e,"workflows",o)}catch{}throw l}return{id:o,etag:(r=s??(0,Ye.readEtag)(a))!==null&&r!==void 0?r:await Va(e,o)}},async update(e,t,r,n){var i,a;let o=r,s=(0,pn.normalizeGuid)(t,"id"),l=`/workflows(${s})`,u={...ws,"If-Match":(0,Ye.requireEtag)(n,"business rule",s)},c=await IP(e,s,u["If-Match"]),d=c.statecode===$r.StateCode.Activated;d&&(0,Ye.ensureSuccess)(await e.patch(l,{statecode:$r.StateCode.Draft,statuscode:$r.StatusCode.Draft},{headers:u}),e.apiUrl(l));let p;try{p=await hg(e,"UpdateProcessWithWfomJson",o,u)}catch(h){if(d)try{(0,Ye.ensureSuccess)(await e.patch(l,{statecode:$r.StateCode.Activated,statuscode:(i=c.statuscode)!==null&&i!==void 0?i:$r.StatusCode.Activated},{headers:ws}),e.apiUrl(l))}catch(g){throw new As.SdkError(hr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE,`The business-rule write failed AND the rule could not be re-activated, so '${s}' is left DEACTIVATED (Draft) on the server. Re-activate it before relying on it. Original write failure: ${h instanceof Error?h.message:String(h)}. Restore failure: ${g instanceof Error?g.message:String(g)}`)}throw h}let f=await gg(e,s,o.status);return{id:s,etag:(a=f??(0,Ye.readEtag)(p))!==null&&a!==void 0?a:await Va(e,s)}},delete(e,t){return(0,Ye.deleteRecord)(e,"workflows",t)}}});var Es=v(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.JsonPointer=void 0;var Rt=re(),Cs=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 Rt.JsonPointerError(t,'non-empty pointers must start with "/"');return t.substring(1).split("/").map(r=>{if(/~(?![01])/.test(r))throw new Rt.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 Rt.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 Rt.JsonPointerError(r,`'${o}' is not a valid array index`);if(s>a.length)throw new Rt.JsonPointerError(r,`array index '${o}' is out of range`);a[s]=n}else{if(e.isReservedToken(o))throw new Rt.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 Rt.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 Rt.JsonPointerError(r,`array index '${a}' is out of range`);i.splice(o,1)}else{if(e.isReservedToken(a))throw new Rt.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 Rt.JsonPointerError(r,"add target must be an array");u.push(n);return}let o=e.resolve(t,r);if(!Array.isArray(o))throw new Rt.JsonPointerError(r,"add target must be an array");let s=i===void 0?o.length:i;if(s<0||s>o.length)throw new Rt.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 Rt.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)}};Ss.JsonPointer=Cs;Cs.RESERVED_TOKENS=new Set(["__proto__","prototype","constructor"])});var yg=v(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.findElements=void 0;var vg=Es();function RP(e,t){let r=[];return _c(e,"",t,r),r}Ns.findElements=RP;function _c(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)=>{_c(i,vg.JsonPointer.append(t,a),r,n)});else for(let i of Object.keys(e))_c(e[i],vg.JsonPointer.append(t,i),r,n)}});var Tc=v(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.assertMutationResult=gr.assertExistsResult=gr.assertReadResult=gr.assertStorageContract=void 0;var FP=["readText","writeTextAtomic","deleteFile","deleteByPrefix"],xP=["ensureContainer","exists"];function LP(e){if(typeof e!="object"||e===null)throw new Error("workspaceStorage must be an object implementing WorkspaceStorage.");for(let t of FP)if(typeof e[t]!="function")throw new Error(`workspaceStorage is missing the required method '${t}'.`);for(let t of xP){let r=e[t];if(r!==void 0&&typeof r!="function")throw new Error(`workspaceStorage.${t} must be a function when present.`)}return e}gr.assertStorageContract=LP;function kP(e,t){if(e===null||typeof e=="string")return e;throw new Error(`workspaceStorage.readText must resolve to a string or null for ${t}; got ${typeof e}. Absence is null \u2014 resolving undefined would make a present value look absent.`)}gr.assertReadResult=kP;function MP(e,t){if(typeof e=="boolean")return e;throw new Error(`workspaceStorage.exists must resolve to a boolean for ${t}; got ${typeof e}. A truthy non-boolean would make an absent value look present.`)}gr.assertExistsResult=MP;function BP(e,t){if(e!==void 0)throw new Error(`workspaceStorage.${t} must resolve to undefined; got ${typeof e}. A status-returning implementation would let a failed write be reported as a completed one.`)}gr.assertMutationResult=BP});var Pc=v(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.retryTransientIoAsync=wi.retryTransientIo=void 0;var UP=new Set(["EPERM","EACCES","EBUSY","UNKNOWN"]),$P=5,bg=10;function qP(e){for(let t=1;;t+=1)try{return e()}catch(r){if(!wg(r,t))throw r;GP(bg*t)}}wi.retryTransientIo=qP;async function VP(e){for(let t=1;;t+=1)try{return await e()}catch(r){if(!wg(r,t))throw r;await new Promise(n=>setTimeout(n,bg*t))}}wi.retryTransientIoAsync=VP;function wg(e,t){let r=e.code;return t<$P&&!!r&&UP.has(r)}function GP(e){try{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}catch{let t=Date.now()+e;for(;Date.now()<t;);}}});var Eg=v(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.canonicalArtifactId=Ft.WorkspaceManager=Ft.WORKSPACE_SCHEMA_VERSION=Ft.retryTransientIo=void 0;var er=Tc(),Ds=re(),zP=Pc();Object.defineProperty(Ft,"retryTransientIo",{enumerable:!0,get:function(){return zP.retryTransientIo}});function Ag(e){let t=e;return typeof t.pathFor=="function"&&typeof t.getRoot=="function"?e:null}Ft.WORKSPACE_SCHEMA_VERSION=1;var fn={form:"forms",view:"views",businessRule:"business-rules",app:"apps",command:"commands",chart:"charts",dashboard:"dashboards",genPage:"gen-pages",bpf:"business-process-flows"},WP="manifest.json",Ga=".metadata",Cg="entities";function Sg(e){try{return Promise.resolve(e())}catch(t){return Promise.reject(t)}}var Oc=class{withManifest(t){let r=this.manifestQueue.then(t,t);return this.manifestQueue=r.then(()=>{},()=>{}),r}constructor(t,r,n){if(this.workspaceLabel=t,this.instanceUrl=r,this.manifestQueue=Promise.resolve(),n==null)throw new Error("WorkspaceManager requires a WorkspaceStorage. Node callers can build one with `createNodeWorkspaceStorage(path)` from '@maker-studio/cds-maker-sdk/node'.");this.storage=n}artifactKey(t,r){return this.assertSafeId(r),[fn[t],`${za(r)}.json`]}metaKey(t,r){return this.assertSafeId(r),[Ga,fn[t],`${za(r)}.meta.json`]}entityKey(t){return this.assertSafeId(t),[Ga,Cg,`${t}.json`]}fsStore(){let t=Ag(this.storage);if(!t)throw new Error("This workspace is not filesystem-backed, so it has no physical paths. Use the artifact/metadata/manifest accessors instead of the path helpers.");return t}getRoot(){let t=Ag(this.storage);return t?t.getRoot():this.workspaceLabel}getArtifactDir(t){return this.fsStore().pathFor([fn[t]])}getArtifactFilePath(t,r){return this.fsStore().pathFor(this.artifactKey(t,r))}getMetaFilePath(t,r){return this.fsStore().pathFor(this.metaKey(t,r))}getEntityMetaFilePath(t){return this.fsStore().pathFor(this.entityKey(t))}assertSafeId(t){if(typeof t!="string"||t.length===0||/[\u0000-\u001f]/.test(t)||t.includes("/")||t.includes("\\")||t.includes(":")||t==="."||t===".."||t.includes(".."))throw new Ds.PathTraversalError(String(t),this.workspaceLabel)}get manifestKey(){return[WP]}async init(){if(this.storage.ensureContainer){let t=this.storage.ensureContainer.bind(this.storage),r=[[Ga,Cg]];for(let i of Object.keys(fn))r.push([fn[i]],[Ga,fn[i]]);let n=await Promise.allSettled(r.map(i=>Sg(()=>t(i))));for(let i of n){if(i.status==="rejected")throw i.reason;(0,er.assertMutationResult)(i.value,"ensureContainer")}}await this.withManifest(async()=>{if(await this.isInitialized())return;let t={instanceUrl:this.instanceUrl,createdAt:new Date().toISOString(),artifacts:[]};await this.writeManifest(t)})}async isInitialized(){return this.storage.exists?(0,er.assertExistsResult)(await this.storage.exists(this.manifestKey),"manifest.json"):(0,er.assertReadResult)(await this.storage.readText(this.manifestKey),"manifest.json")!==null}async ensureInitialized(){if(!await this.isInitialized())throw new Ds.WorkspaceNotInitializedError(this.workspaceLabel)}async clean(){let t=Object.keys(fn).map(i=>[fn[i]]);t.push([Ga]);let r=await Promise.allSettled(t.map(i=>Sg(()=>this.storage.deleteByPrefix(i))));for(let i of r){if(i.status==="rejected")throw i.reason;(0,er.assertMutationResult)(i.value,"deleteByPrefix")}let n=await this.getManifest();n.artifacts=[],n.lastSyncAt=void 0,await this.init(),await this.writeManifest(n)}async readArtifact(t,r){return await this.ensureInitialized(),this.readJson(this.artifactKey(t,r))}async writeArtifact(t,r,n){await this.ensureInitialized(),await this.writeJson(this.artifactKey(t,r),n),await this.upsertManifestEntry(t,r,n)}async deleteArtifact(t,r){await this.ensureInitialized(),(0,er.assertMutationResult)(await this.storage.deleteFile(this.artifactKey(t,r)),"deleteFile"),(0,er.assertMutationResult)(await this.storage.deleteFile(this.metaKey(t,r)),"deleteFile");let n=za(r);await this.withManifest(async()=>{let i=await this.getManifest();i.artifacts=i.artifacts.filter(a=>!(a.type===t&&a.id===n)),await this.writeManifest(i)})}async readMeta(t,r){return this.readJson(this.metaKey(t,r))}async writeMeta(t,r,n){await this.writeJson(this.metaKey(t,r),n)}async listArtifacts(t,r){return await this.ensureInitialized(),(await this.getManifest()).artifacts.filter(n=>!(t&&n.type!==t||r?.entityLogicalName&&n.entityLogicalName!==r.entityLogicalName))}async readEntityMetadata(t){await this.ensureInitialized();let r=await this.readJson(this.entityKey(t));return!r||typeof r.schemaName!="string"||typeof r.primaryNameAttribute!="string"||typeof r.primaryIdAttribute!="string"||typeof r.isCustomEntity!="boolean"?null:r}async writeEntityMetadata(t,r){await this.ensureInitialized(),await this.writeJson(this.entityKey(t),r)}async getManifest(){await this.ensureInitialized();let t=await this.readJson(this.manifestKey);if(!t)throw new Ds.WorkspaceNotInitializedError(this.workspaceLabel);if(t.schemaVersion!==void 0&&t.schemaVersion>Ft.WORKSPACE_SCHEMA_VERSION)throw new Ds.IncompatibleWorkspaceError(t.schemaVersion,Ft.WORKSPACE_SCHEMA_VERSION);return t}async writeManifest(t){await this.writeJson(this.manifestKey,{...t,schemaVersion:Ft.WORKSPACE_SCHEMA_VERSION})}async updateManifest(t){await this.withManifest(async()=>{let r=await this.getManifest();await this.writeManifest({...r,...t})})}async upsertManifestEntry(t,r,n){await this.withManifest(async()=>{let i=await this.getManifest(),a=za(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}),await this.writeManifest(i)})}async readJson(t){let r=(0,er.assertReadResult)(await this.storage.readText(t),t.join("/"));return r===null?null:JSON.parse(r)}async writeJson(t,r){(0,er.assertMutationResult)(await this.storage.writeTextAtomic(t,`${JSON.stringify(r,null,2)}
-`),"writeTextAtomic")}async removeFile(t){(0,er.assertMutationResult)(await this.storage.deleteFile(t),"deleteFile")}async exists(t){return this.storage.exists?(0,er.assertExistsResult)(await this.storage.exists(t),t.join("/")):(0,er.assertReadResult)(await this.storage.readText(t),t.join("/"))!==null}};Ft.WorkspaceManager=Oc;function za(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()}Ft.canonicalArtifactId=za});var Rc=v(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.deepEqual=Ai.deepDiff=void 0;var HP=Es();function jP(e,t){let r=[];return Dg(e,t,"",r,0),r}Ai.deepDiff=jP;var Is=Symbol("missing"),_s=512;function Dg(e,t,r,n,i){if(e===t)return;if(i>_s)throw new RangeError(`deepDiff exceeded the maximum supported depth of ${_s}`);let a=Ts(e),o=Ts(t);if(a&&o&&Array.isArray(e)===Array.isArray(t)){let s=JP(e,t);for(let l of s){let u=Ng(e,l),c=Ng(t,l),d=HP.JsonPointer.append(r,l);u===Is?n.push({pointer:d,type:"added",newValue:c}):c===Is?n.push({pointer:d,type:"removed",oldValue:u}):Dg(u,c,d,n,i+1)}return}Ig(e,t)||n.push({pointer:r,type:"modified",oldValue:e,newValue:t})}function Ts(e){return e!==null&&typeof e=="object"}function JP(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 Ng(e,t){if(Array.isArray(e)){let r=Number(t);return r<e.length?e[r]:Is}return t in e?e[t]:Is}function Ig(e,t){return _g(e,t,0)}Ai.deepEqual=Ig;function _g(e,t,r){if(e===t)return!0;if(r>_s)throw new RangeError(`deepEqual exceeded the maximum supported depth of ${_s}`);if(!Ts(e)||!Ts(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&&_g(e[a],t[a],r+1))}});var Pg=v(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.VersionManager=void 0;var Tg=Rc(),Fc=class{constructor(t){this.workspace=t}async storeMeta(t,r,n){var i;let a=await this.getMeta(t,r),o=((i=n.snapshot)===null||i===void 0?void 0:i.status)==="Active",s=a?.everActivated===!0||o;await this.workspace.writeMeta(t,r,s?{...n,everActivated:s}:n)}async getMeta(t,r){return this.workspace.readMeta(t,r)}async isDirty(t,r){let n=await this.workspace.readArtifact(t,r);if(n===null)return!1;let i=await this.getMeta(t,r);return i?!(0,Tg.deepEqual)(i.snapshot,n):!0}async diff(t,r){let n=await this.workspace.readArtifact(t,r),i=await this.getMeta(t,r),a;return n===null?a=i?[{pointer:"",type:"removed",oldValue:i.snapshot}]:[]:i?a=(0,Tg.deepDiff)(i.snapshot,n):a=[{pointer:"",type:"added",newValue:n}],{artifactType:t,artifactId:r,changes:a}}async checkConflict(t,r,n){let i=await this.getMeta(t,r);return!i||i.etag===null?!1:i.etag!==n}};Ps.VersionManager=Fc});var Rg=v((xc,Og)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof xc=="object"?Og.exports=t():e.compareVersions=t()})(xc,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),p=parseInt(u[c]||0,10);if(d>p)return 1;if(p>d)return-1}var f=l[l.length-1],h=u[u.length-1];if(f&&h){var g=f.split(".").map(n),w=h.split(".").map(n);for(c=0;c<Math.max(g.length,w.length);c++){if(g[c]===void 0||typeof w[c]=="string"&&typeof g[c]=="number")return-1;if(w[c]===void 0||typeof g[c]=="string"&&typeof w[c]=="number"||g[c]>w[c])return 1;if(w[c]>g[c])return-1}}else if(f||h)return f?-1:1;return 0}})});var Mg=v(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.EnvironmentFlowHostingType=Ee.EnvironmentDisableReasonCode=Ee.EnvironmentMigrationConstants=Ee.EnvironmentProvisioningStates=Ee.EnvironmentLocations=Ee.EnvironmentCreationTypeConstants=Ee.EnvironmentType=Ee.EnvironmentSkuConstants=Ee.environmentPermissions=Ee.DatabaseType=void 0;var Fg;(function(e){e.CommonDataService="CommonDataService",e.None="None"})(Fg||(Ee.DatabaseType=Fg={}));Ee.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"};Ee.EnvironmentSkuConstants={NotSpecified:"NotSpecified",Standard:"Standard",Premium:"Premium",Developer:"Developer",Basic:"Basic",Production:"Production",Sandbox:"Sandbox",Trial:"Trial",Default:"Default",Teams:"Teams",Platform:"Platform"};var xg;(function(e){e[e.CDS2=0]="CDS2",e[e.CDS1=1]="CDS1",e[e.Empty=2]="Empty"})(xg||(Ee.EnvironmentType=xg={}));Ee.EnvironmentCreationTypeConstants={NotSpecified:"NotSpecified",Legacy:"Legacy",DefaultTenant:"DefaultTenant",User:"User",CommonDataModelLegacy:"CommonDataModelLegacy"};Ee.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"};Ee.EnvironmentProvisioningStates={NotSpecified:"NotSpecified",Succeeded:"Succeeded",Deleting:"Deleting",Deleted:"Deleted",FailedDeleting:"FailedDeleting",LinkedDatabaseProvisioning:"LinkedDatabaseProvisioning",LinkedDatabaseFailedProvisioning:"LinkedDatabaseFailedProvisioning",LinkedDatabaseFailedConfiguring:"LinkedDatabaseFailedConfiguring",LinkedDatabaseUnavailable:"LinkedDatabaseUnavailable",Creating:"Creating"};Ee.EnvironmentMigrationConstants={phases:{completed:"Completed"}};var Lg;(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"})(Lg||(Ee.EnvironmentDisableReasonCode=Lg={}));var kg;(function(e){e.LogicApps="LogicApps",e.SelfHostSingleTenant="SelfHostSingleTenant",e.SelfHostMultiTenant="SelfHostMultiTenant"})(kg||(Ee.EnvironmentFlowHostingType=kg={}))});var Wg=v(A=>{"use strict";var QP=A&&A.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(A,"__esModule",{value:!0});A.hasCommonDataServiceDatabase=A.getEnvironmentDiscoveryUrl=A.getEnvironmentWebApiUrl=A.getEnvironmentInstanceApiUrl=A.getEnvironmentLanguageCode=A.getEnvironmentUpdateCadence=A.checkVersions=A.isCds2EnvironmentVersionAtLeast=A.getSecurityOrConnectedGroupId=A.hasSecurityGroupId=A.doesCds2VersionSupportApiVersion9_1=A.doesCds2EnvironmentSupportApiVersion9_1=A.cdsVersionSupportingOSColorEdit=A.getEnvironmentDisplayName=A.getEnvironmentName=A.isEnvironmentInFirstReleaseCluster=A.isEnvironmentInPreprodCluster=A.isEnvironmentInTestCluster=A.isLiteEnvironmentUpgrading=A.isEnvironmentExpired=A.isEnvironmentInDeletedState=A.isEnvironmentInCreatingState=A.isDatabaseInProvisioningState=A.canUserCreateDatabase=A.isDisabledEnvironment=A.isDefaultEnvironment=A.isTrialEnvironment=A.isPlatformEnvironment=A.isTeamsEnvironment=A.isSandboxEnvironment=A.isProdEnvironment=A.isDevEnvironment=A.getEnvironmentType=A.getCrmInstanceName=A.getCrmInstanceUrl=A.getCrmAppDesignerUrl=A.getDevResourcesUrl=A.isEnvironmentInSuccessfulState=A.getAllThemesUrl=A.getAllPublishersUrl=A.getAllSolutionsUrl=A.getSecurityRolesUrl=A.getSecurityUsersUrl=A.environmentHasCds2Database=A.DEFAULT_SOLUTION_UNIQUE_NAME=A.DEFAULT_SOLUTION_ID=A.crmBapSolutionId=A.doesUserHavePermission=A.getLinkedEnvironmentMetadata=A.getCrmVersion=void 0;A.doesUserHaveFlowRunOnlyPermission=A.isUserPautoMakerWithoutDataAccess=A.isUserPautoMakerWithDataAccess=A.doesUserHaveCreateFlowPermission=A.equalsIgnoreCase=A.doesUserHaveCreateDatabasePermission=A.doesUserHaveDatabaseTablePermissions=A.isUserMakerWithoutDataAccess=A.isUserMakerWithDataAccess=A.doesUserHaveCreateAppPermission=A.doesUserHaveAdminPermission=void 0;var KP=QP(Rg()),ce=Mg(),Wa=kc();function XP(e){let t=Vr(e);return t&&t.version}A.getCrmVersion=XP;function Vr(e){return e&&e.properties&&e.properties.linkedEnvironmentMetadata}A.getLinkedEnvironmentMetadata=Vr;function qr(e,t){return e?!!e[t]:!1}A.doesUserHavePermission=qr;A.crmBapSolutionId="00000001-0000-0000-0001-00000000009b";A.DEFAULT_SOLUTION_ID="fd140aaf-4df4-11dd-bd17-0019b9312238";A.DEFAULT_SOLUTION_UNIQUE_NAME="Default";function Hn(e){return!!Vr(e)&&Bg(e)}A.environmentHasCds2Database=Hn;function YP(e){if(e&&Hn(e)){let t=mn(e);return(0,Wa.getCrmAdminSecurityRolesUrl)(t)}return""}A.getSecurityUsersUrl=YP;function ZP(e){if(e&&Hn(e)){let t=mn(e);return(0,Wa.getCrmAdminSecurityUsersUrl)(t)}return""}A.getSecurityRolesUrl=ZP;function e1(e){if(e&&Hn(e)){let t=mn(e);(0,Wa.getCrmAllSolutionsUrl)(t)}return""}A.getAllSolutionsUrl=e1;function t1(e){if(e&&Hn(e)){let t=mn(e);return(0,Wa.getCrmAllPublishersUrl)(t)}return""}A.getAllPublishersUrl=t1;function r1(e){return e&&Hn(e)?mn(e):""}A.getAllThemesUrl=r1;function Bg(e){return!!e&&e.properties&&!!e.properties.provisioningState&&e.properties.provisioningState.toUpperCase()===ce.EnvironmentProvisioningStates.Succeeded.toUpperCase()}A.isEnvironmentInSuccessfulState=Bg;function n1(e){if(e&&Hn(e)){let t=mn(e);return(0,Wa.getCrmDevResourcesUrl)(t)}return""}A.getDevResourcesUrl=n1;function i1(e){return`${e}designer/app/{${A.crmBapSolutionId}}/CreateNewApp}}`}A.getCrmAppDesignerUrl=i1;function mn(e){let t=Vr(e);if(t){let r=t.instanceUrl;return r?r.endsWith("/")?r:r+"/":""}return""}A.getCrmInstanceUrl=mn;function a1(e){let t=Vr(e);return t?t.uniqueName:""}A.getCrmInstanceName=a1;function o1(e){return Vr(e)?ce.EnvironmentType.CDS2:e&&e.properties&&e.properties.namespace?ce.EnvironmentType.CDS1:ce.EnvironmentType.Empty}A.getEnvironmentType=o1;function s1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Developer}A.isDevEnvironment=s1;function l1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Production}A.isProdEnvironment=l1;function u1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Sandbox}A.isSandboxEnvironment=u1;function Ha(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Teams}A.isTeamsEnvironment=Ha;function c1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Platform}A.isPlatformEnvironment=c1;var d1=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.environmentSku)===ce.EnvironmentSkuConstants.Trial};A.isTrialEnvironment=d1;function p1(e){return e&&e.properties&&(e.properties.isDefault||e.properties.creationType===ce.EnvironmentCreationTypeConstants.DefaultTenant)}A.isDefaultEnvironment=p1;function f1(e){return e&&e.properties&&!!e.properties.states&&!!e.properties.states.runtime&&e.properties.states.runtime.id==="Disabled"}A.isDisabledEnvironment=f1;function m1(e){return e&&e.properties&&qr(e.properties.permissions,ce.environmentPermissions.CreateDatabase)}A.canUserCreateDatabase=m1;function h1(e){return!!(e&&e.properties&&e.properties.provisioningState&&zg(e.properties.provisioningState,ce.EnvironmentProvisioningStates.LinkedDatabaseProvisioning))}A.isDatabaseInProvisioningState=h1;function g1(e){return!!e&&!!e.properties&&e.properties.provisioningState===ce.EnvironmentProvisioningStates.Creating}A.isEnvironmentInCreatingState=g1;function v1(e){return e&&e.properties&&(e.properties.provisioningState===ce.EnvironmentProvisioningStates.Deleted||e.properties.provisioningState===ce.EnvironmentProvisioningStates.Deleting||e.properties.provisioningState===ce.EnvironmentProvisioningStates.FailedDeleting)}A.isEnvironmentInDeletedState=v1;function y1(e){return!!e&&!!e.properties&&!!e.properties.expirationTime&&Date.parse(e.properties.expirationTime)<Date.now()}A.isEnvironmentExpired=y1;function b1(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"}A.isLiteEnvironmentUpgrading=b1;function w1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Test"}A.isEnvironmentInTestCluster=w1;function A1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Preprod"}A.isEnvironmentInPreprodCluster=A1;function C1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="FirstRelease"}A.isEnvironmentInFirstReleaseCluster=C1;function S1(e){return e&&e.name||""}A.getEnvironmentName=S1;function E1(e){return e&&e.properties&&e.properties.displayName||""}A.getEnvironmentDisplayName=E1;var Ug="9.1.0.8202";A.cdsVersionSupportingOSColorEdit="9.1.0000.20708";function N1(e){return Vg(e,Ug)}A.doesCds2EnvironmentSupportApiVersion9_1=N1;function D1(e){return Lc(e,Ug)}A.doesCds2VersionSupportApiVersion9_1=D1;function $g(e){let t=Vr(e);if(t)return t.securityGroupId}function qg(e){return e&&e.properties&&e.properties.connectedGroups}function I1(e,t){let r=qg(e);return!!r&&!!r.find(n=>n.id===t)||$g(e)===t}A.hasSecurityGroupId=I1;function _1(e){let t=qg(e);return t&&t.length>0&&t[0].id?t[0].id:$g(e)}A.getSecurityOrConnectedGroupId=_1;function Vg(e,t){let r=e.version;return r?Lc(r,t):!1}A.isCds2EnvironmentVersionAtLeast=Vg;function Lc(e,t){return t?e?(0,KP.default)(e,t)>=0:!1:!0}A.checkVersions=Lc;function T1(e){return e&&e.properties&&e.properties.updateCadence&&e.properties.updateCadence.id||"NotSpecified"}A.getEnvironmentUpdateCadence=T1;function P1(e){let t=Vr(e);return t?Number(t.baseLanguage):0}A.getEnvironmentLanguageCode=P1;function Gg(e){let t=Vr(e);return t?t.instanceApiUrl:void 0}A.getEnvironmentInstanceApiUrl=Gg;function O1(e){let t=Gg(e);return t?t+"/api/data/v9.2":""}A.getEnvironmentWebApiUrl=O1;function R1(e){let t=mn(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"}A.getEnvironmentDiscoveryUrl=R1;var F1=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.databaseType)===ce.DatabaseType.CommonDataService};A.hasCommonDataServiceDatabase=F1;var x1=e=>{var t;return qr((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.AdminReadEnvironment)};A.doesUserHaveAdminPermission=x1;var L1=e=>{var t;return qr((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreatePowerApp)};A.doesUserHaveCreateAppPermission=L1;var k1=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateAppPermission)(e)?Ha(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserMakerWithDataAccess=k1;var M1=e=>(0,A.doesUserHaveCreateAppPermission)(e)&&!Ha(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserMakerWithoutDataAccess=M1;var B1=e=>[ce.environmentPermissions.CreateDatabaseEntities,ce.environmentPermissions.ListDatabaseEntities,ce.environmentPermissions.UpdateDatabaseEntities,ce.environmentPermissions.DeleteDatabaseEntities].every(t=>{var r;return qr((r=e.properties)===null||r===void 0?void 0:r.permissions,t)});A.doesUserHaveDatabaseTablePermissions=B1;var U1=e=>{var t;return qr((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreateDatabase)};A.doesUserHaveCreateDatabasePermission=U1;function zg(e,t){return!e&&!t?!0:!e||!t?!1:e.toUpperCase()===t.toUpperCase()}A.equalsIgnoreCase=zg;var $1=e=>{var t;return qr((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreateFlow)};A.doesUserHaveCreateFlowPermission=$1;var q1=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateFlowPermission)(e)?Ha(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserPautoMakerWithDataAccess=q1;var V1=e=>(0,A.doesUserHaveCreateFlowPermission)(e)&&!Ha(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserPautoMakerWithoutDataAccess=V1;var G1=e=>{var t,r;return!qr((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreateFlow)&&qr((r=e.properties)===null||r===void 0?void 0:r.permissions,ce.environmentPermissions.ReadEnvironment)};A.doesUserHaveFlowRunOnlyPermission=G1});var kc=v(b=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});b.getRequiredComponentsQueryUrl=b.solutionComponentCountSummariesQueryUrl=b.solutionComponentSummariesQueryUrl=b.solutionComponentConfigurationsQueryUrl=b.chartsQueryUrl=b.workflowsQueryUrl=b.entityDefinitionsQueryUrl=b.solutionComponentDefinitionsQueryUrl=b.getCreateNewArticleTemplateUrl=b.getCreateNewPublisherUrl=b.getEnableSecurityRolesUrl=b.getArticleTemplateUrl=b.getFieldSecurityProfileDesignerUrl=b.getSecurityRoleDesignerUrl=b.getMailMergeTemplateDesignerUrl=b.getEmailTemplateDesignerUrl=b.getConnectionRoleDesignerUrl=b.getSiteMapDesignerUrl=b.getWebResourceFileUrl=b.getWebResourceDesignerUrl=b.getReportDesignerUrl=b.getBusinessProcessFlowDesignerUrl=b.getProcessShareUrl=b.getProcessDesignerUrl=b.getChartDesignerUrl=b.getOpenModernEntityDashboardUrl=b.getNewModernEntityDashboardUrl=b.getNewModernDashboardUrl=b.getOpenModernDashboardUrl=b.getDashboardDesignerUrl=b.getAppModuleDesignerUrl=b.privilegesQueryUrls=b.xrmApiUrl=b.getPlayAppModuleUrl=b.getCrmAdminSecurityUsersUrl=b.getCrmAdminSecurityRolesUrl=b.getCrmMyAppsUrl=b.getCrmAppDesignerUrl=b.getCrmDevResourcesUrl=b.getCrmAllPublishersUrl=b.getCrmAllSolutionsUrl=b.getSolutionPublisherUrl=b.getExportTranslationFileName=b.getExportSolutionTranslationUrl=b.getImportSolutionTranslationUrl=b.getShowSolutionDependenciesUrl=b.getShowComponentDependenciesUrl=b.cdsServiceUrl=b.ODATA_NEXT_LINK=b.ODATA_MAX_PAGE_SIZE=void 0;b.retrieveOrganizationResources=b.getUCIEntityRecordEditUrl=b.getUCIEntityRecordBaseUrl=b.getBusinessRuleDesignerUri=b.retrieveUnpublishedSuffix=b.getSavePowerSettingUri=b.getPowerSettingUri=b.getPowerSettingsUri=b.RetrievePlatform=b.getAppSettingOverrideUri=b.AppSettingOverrideName=b.getOrgSettingOverrideUri=b.OrgSettingOverrideName=b.getSettingDefinitionsUri=b.retrieveFeatureControlSettingsByNamespaceUrl=b.retrieveDeploymentPipelineConfigAppUrl=b.SPNPrincipalIdUrl=b.retrieveDeploymentEnvironmentInfoUrl=b.devSolutionInfoUrl=b.deployOperationStatusUrl=b.getAIGeneratedDeploymentNotesUrl=b.deploymentStageRunUrl=b.validatePackageAsyncUrl=b.deployPackageAsyncUrl=b.updateDeploymentStageRunUrl=b.createDeploymentStageRunUrl=b.retrieveDeploymentStagesUrl=b.retrievePipelinesUrl=b.retrieveDeploymentPipelineInfoUrl=b.getDeploymentStageRunsUrl=b.appDeploymentUrls=b.getProvisionLanguageUrl=b.getSolutionQueryUrl=b.getSolutionsByUniqueNameQueryUrl=b.solutionsQueryUrl=b.getDependentComponentsWithMetadataQueryUrl=void 0;var Hg=Wg();b.ODATA_MAX_PAGE_SIZE="odata.maxpagesize";b.ODATA_NEXT_LINK="@odata.nextLink";b.cdsServiceUrl="https://cds-org/";var Ja;(function(e){e.AllSolutions="11",e.AllPublishers="10",e.DevResources="05"})(Ja||(Ja={}));function z1(e,t,r,n){return`${e}tools/dependency/dependencyviewdialog.aspx?appSolutionId=%7b${t}%7d&dType=1&objectid=%7b${r}%7d&objecttype=${n}&operationtype=showdependency`}b.getShowComponentDependenciesUrl=z1;function W1(e,t){let r=`dType=1&isproactivecheck=true&objecttype=7100&operationtype=dependenciesforuninstall&objectid=${t}`;return`${e}tools/dependency/dependencyviewdialog.aspx?${r}`}b.getShowSolutionDependenciesUrl=W1;function H1(e,t){return`${e}tools/muiProvisioning/Dialogs/LangTranslationsImport.aspx?dType=1&appSolutionId=${t}`}b.getImportSolutionTranslationUrl=H1;function j1(e,t){return`${e}_grid/cmds/dlg_exportsolution.aspx?command=exporttranslation&appSolutionId=${t}`}b.getExportSolutionTranslationUrl=j1;function J1(e,t){return e!==void 0&&t!==void 0&&`CrmTranslations_${e}_${t.replace(/[.]/g,"_")}.zip`||""}b.getExportTranslationFileName=J1;function Q1(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`}b.getSolutionPublisherUrl=Q1;function Mc(e,t){return`${e}tools/systemcustomization/systemCustomization.aspx?pid=${t}`}function K1(e){return Mc(e,Ja.AllSolutions)}b.getCrmAllSolutionsUrl=K1;function X1(e){return Mc(e,Ja.AllPublishers)}b.getCrmAllPublishersUrl=X1;function Y1(e){return Mc(e,Ja.DevResources)}b.getCrmDevResourcesUrl=Y1;function Z1(e,t=Hg.crmBapSolutionId){return`${e}designer/app/${t}#/CreateNewApp`}b.getCrmAppDesignerUrl=Z1;function eO(e){return`${e}apps`}b.getCrmMyAppsUrl=eO;function tO(e){return jg(e,"role")+"&forceUCI=0"}b.getCrmAdminSecurityRolesUrl=tO;function rO(e){return`${jg(e,"systemuser")}&forceclassic=1`}b.getCrmAdminSecurityUsersUrl=rO;function jg(e,t){return`${e}main.aspx?pagetype=entitylist&etn=${t}`}function nO(e,t){return`${e}main.aspx?appid=${t}`}b.getPlayAppModuleUrl=nO;b.xrmApiUrl="api/data/v9.0";b.privilegesQueryUrls={systemUserInfo:e=>`${e}${b.xrmApiUrl}/WhoAmI`,userPrivileges:(e,t)=>`${e}${b.xrmApiUrl}/systemusers(${t})/Microsoft.Dynamics.CRM.RetrieveUserPrivileges`,systemPrivileges:e=>`${e}${b.xrmApiUrl}/privileges/Microsoft.Dynamics.CRM.RetrievePrivilegeSet`};function iO(e,t,r=Hg.crmBapSolutionId){return`${e}designer/app/${r}/${t}/AppDesignerCanvas/${t}`}b.getAppModuleDesignerUrl=iO;function aO(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${r}%7d&extraqs=%26formId%3d%7b${t}%7d%26dashboardType%3d1030&pagetype=${`${n?"ic":""}dashboardeditor`}`}b.getDashboardDesignerUrl=aO;function oO(e,t,r){return`/e/${e}/s/${t}/dashboard/${r}`}b.getOpenModernDashboardUrl=oO;function sO(e,t,r){let n=r!==void 0?r.toString():void 0;return`/e/${e}/s/${t}/dashboard/new${n?`/${n}`:""}`}b.getNewModernDashboardUrl=sO;function lO(e,t,r,n){let i=n!==void 0?n.toString():void 0;return`/e/${e}/s/${t}/n/${r}/dashboard/new${i?`/${i}`:""}`}b.getNewModernEntityDashboardUrl=lO;function uO(e,t,r,n){return`/e/${e}/s/${t}/n/${r}/dashboard/${n}`}b.getOpenModernEntityDashboardUrl=uO;function cO(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${t}%7d&extraqs=etc=${r||""}`+(n?`%26id=${n}`:"")+"&pagetype=vizdesigner"}b.getChartDesignerUrl=cO;function dO(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getProcessDesignerUrl=dO;function pO(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getProcessShareUrl=pO;function fO(e,t){return`${e}Tools/ProcessControl/UnifiedProcessDesigner.aspx?id=${t}`}b.getBusinessProcessFlowDesignerUrl=fO;function mO(e,t,r){return`${e}CRMReports/reportproperty.aspx?appSolutionId=%7b${r}%7d&disablePersonal=true&id=%7b${t}%7d`}b.getReportDesignerUrl=mO;function hO(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`}b.getWebResourceDesignerUrl=hO;function gO(e,t){return`${e}WebResources/${t}`}b.getWebResourceFileUrl=gO;function vO(e,t,r){return`${e}designer/sitemap/${r}/${t}/SiteMapHome/${t}`}b.getSiteMapDesignerUrl=vO;function yO(e,t,r){return`${e}connections/connectionroles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getConnectionRoleDesignerUrl=yO;function bO(e,t,r){return`${e}tools/emailtemplateeditor/emailtemplateeditor.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getEmailTemplateDesignerUrl=bO;function wO(e,t,r){return`${e}tools/mailmerge/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getMailMergeTemplateDesignerUrl=wO;function AO(e,t,r){return`${e}biz/roles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getSecurityRoleDesignerUrl=AO;function CO(e,t,r){return`${e}biz/fieldsecurityprofiles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getFieldSecurityProfileDesignerUrl=CO;function SO(e,t,r){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?_CreateFromId=%7b${t}%7d&_CreateFromType=7100&appSolutionId=%7b${t}%7d&id=%7b${r}%7d`}b.getArticleTemplateUrl=SO;function EO(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}`}b.getEnableSecurityRolesUrl=EO;function NO(e){return`${e}tools/publisher/edit.aspx`}b.getCreateNewPublisherUrl=NO;function DO(e,t){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?appSolutionId=${t}`}b.getCreateNewArticleTemplateUrl=DO;b.solutionComponentDefinitionsQueryUrl="api/data/v9.0/solutioncomponentdefinitions";b.entityDefinitionsQueryUrl="api/data/v9.0/EntityDefinitions?$select=EntitySetName,DisplayName,LogicalName&$filter=";b.workflowsQueryUrl="api/data/v9.0/workflows";b.chartsQueryUrl="/api/data/v9.0/savedqueryvisualizations";b.solutionComponentConfigurationsQueryUrl="/api/data/v9.1/solutioncomponentconfigurations?$filter=isdisplayable eq true&$select=name";b.solutionComponentSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentsummaries";b.solutionComponentCountSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentcountsummaries";function IO(e,t){return`${b.xrmApiUrl}/RetrieveRequiredComponents(ObjectId=${e},ComponentType=${t})`}b.getRequiredComponentsQueryUrl=IO;function _O(e,t){return`${b.cdsServiceUrl}${b.xrmApiUrl}/RetrieveDependentComponentsWithMetadata(ObjectId=${e},ComponentType=${t})`}b.getDependentComponentsWithMetadataQueryUrl=_O;b.solutionsQueryUrl="/api/data/v9.0/solutions?$expand=publisherid&$filter=(isvisible eq true)";function TO(e){return`/api/data/v9.0/solutions?$expand=publisherid&$filter=(uniquename eq '${e}')`}b.getSolutionsByUniqueNameQueryUrl=TO;function PO(e){return`/api/data/v9.0/solutions(${e})?$expand=publisherid`}b.getSolutionQueryUrl=PO;function OO(e){return`${e}api/data/v9.1/ProvisionLanguageForUser`}b.getProvisionLanguageUrl=OO;b.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 RO(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"}};Y.ValidationError=Ac;var Cc=class extends Ke{constructor(t){super("INVALID_ARGUMENT",t)}};Y.InvalidArgumentError=Cc;var Ec=class extends Ke{constructor(t,r,n){super("STALE_ARTIFACT",`Cannot apply the edit at ${n} to ${t}/${r}: the cached copy was stale and the server copy has since changed, so any pointer derived from the old copy may now identify a different node. The local copy has been refreshed \u2014 re-read the artifact, re-derive the pointer, and retry.`),this.type=t,this.id=r,this.pointer=n}};Y.StaleArtifactError=Ec;var Sc=class extends Ke{constructor(t,r,n,i){super("LOCAL_EDITS_WOULD_BE_LOST",`Refusing to fetch ${t}/${r}: the local copy has unpushed edits AND the server has moved since it was fetched (local=${n??"(none)"}, server=${i??"(none)"}). Overwriting now would discard your edits and replace them with another writer's changes. Push or discard your edits first, or pass { overwrite: true } to deliberately reset the local copy to the server version.`),this.type=t,this.id=r,this.localEtag=n,this.serverEtag=i}};Y.LocalEditsWouldBeLostError=Sc;var Nc=class extends Ke{constructor(t,r,n,i,a){super("VERSION_CONFLICT",`Version conflict for ${t}/${r}: local=${n??"(none)"}, server=${i??"(none)"}. Re-fetch and reapply changes.${a?` ${a}`:""}`),this.type=t,this.id=r,this.localEtag=n,this.serverEtag=i,this.detail=a}};Y.VersionConflictError=Nc;var Dc=class extends Ke{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=Dc;var Ic=class extends Ke{constructor(t){super("WORKSPACE_NOT_INITIALIZED",`Workspace not initialized at ${t}. Call initWorkspace() first.`),this.workspacePath=t}};Y.WorkspaceNotInitializedError=Ic;var _c=class extends Ke{constructor(t,r){super("NOT_IMPLEMENTED",`Operation '${t}' is not implemented yet${r?`: ${r}`:""}.`),this.operation=t}};Y.NotImplementedError=_c;var Tc=class extends Ke{constructor(t,r){super("INVALID_JSON_POINTER",`Invalid JSON Pointer '${t}': ${r}`),this.pointer=t}};Y.JsonPointerError=Tc;var Pc=class extends Ke{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=Pc;var Oc=class extends Ke{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=Oc;var Rc=class extends Ke{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=Rc});var ae=v(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.odataQuery=Pe.normalizeGuid=Pe.createSafeXmlElement=Pe.assertNoControlChars=Pe.assertODataName=Pe.assertXmlName=Pe.xmlText=Pe.odataPathLiteral=Pe.odataLiteral=void 0;var Is=te();function Tg(e){return String(e??"").replace(/'/g,"''")}Pe.odataLiteral=Tg;function IP(e){return encodeURIComponent(Tg(e))}Pe.odataPathLiteral=IP;function _P(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Pe.xmlText=_P;function Pg(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 Is.InvalidArgumentError(`${t} must be a valid XML element name (got '${e}')`);return e}Pe.assertXmlName=Pg;function TP(e,t){let r=String(e??"");if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r))throw new Is.InvalidArgumentError(`${t} must be a valid OData identifier (letters, digits, underscore): got '${e}'`);return e}Pe.assertODataName=TP;function PP(e,t){if(/[\u0000-\u001F\u007F]/.test(String(e??"")))throw new Is.InvalidArgumentError(`${t} must not contain control characters (including CR/LF): they would inject additional lines into the request`);return e}Pe.assertNoControlChars=PP;function OP(e,t,r){return e.createElement(Pg(t,r))}Pe.createSafeXmlElement=OP;var RP=/^[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 FP(e,t){let r=String(e??""),n=r.length===38&&r.startsWith("{")&&r.endsWith("}")?r.slice(1,-1):r;if(!RP.test(n))throw new Is.InvalidArgumentError(`${t} must be a valid GUID (got '${e}')`);return n.toLowerCase()}Pe.normalizeGuid=FP;function xP(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=xP});var be=v(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.nowIso=oe.isAlreadyDeleted=oe.deleteRecord=oe.ensureSuccess=oe.resolveCreatedId=oe.requireCreatedId=oe.withClientMintedId=oe.readCreatedId=oe.readEtag=oe.requireEtag=oe.echoWrite=oe.UPDATE_NO_ETAG_CODE=oe.VERSION_CONFLICT_CODE=void 0;var Ni=te(),Ka=ae();oe.VERSION_CONFLICT_CODE="VERSION_CONFLICT";oe.UPDATE_NO_ETAG_CODE="ARTIFACT_UPDATE_NO_ETAG";function LP(e,t){return{query:`?$select=${encodeURIComponent(e)}`,options:{headers:{...t??{},Prefer:"return=representation"}}}}oe.echoWrite=LP;function kP(e,t,r){if(!e)throw new Ni.SdkError(oe.UPDATE_NO_ETAG_CODE,`Refusing to push ${t} '${r}': no concurrency token is held for it, so the write could not be made conditional and would silently overwrite a concurrent edit. Re-fetch the ${t} and re-apply the change.`);return e}oe.requireEtag=kP;function MP(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}oe.readEtag=MP;function Fc(e,t){var r;let n=e.body;if(n&&typeof n[t]=="string")return(0,Ka.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,Ka.normalizeGuid)(o[1],t)}return null}oe.readCreatedId=Fc;function UP(e,t,r){return r?{...e,[t]:(0,Ka.normalizeGuid)(r,t)}:e}oe.withClientMintedId=UP;function BP(e,t,r){let n=Fc(e,t);if(!n)throw new Ni.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`);return n}oe.requireCreatedId=BP;function $P(e,t,r,n){let i=Fc(e,t);if(i)return i;if(n)return(0,Ka.normalizeGuid)(n,t);throw new Ni.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`)}oe.resolveCreatedId=$P;function Og(e,t){if(e.status===412)throw new Ni.SdkError(oe.VERSION_CONFLICT_CODE,`Version conflict (412) from ${t}`);if(e.status<200||e.status>=300)throw new Ni.ConnectionError(t,e.status,qP(e.body),e.body);return e}oe.ensureSuccess=Og;function qP(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 VP(e,t,r,n){let i=(0,Ka.normalizeGuid)(r,"id"),a=`/${t}(${i})`;Og(await e.delete(a,n?{headers:{"If-Match":n}}:void 0),e.apiUrl(a))}oe.deleteRecord=VP;function GP(e){return e instanceof Ni.ConnectionError&&e.statusCode===404}oe.isAlreadyDeleted=GP;function zP(){return new Date().toISOString()}oe.nowIso=zP});var qt=v(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.describeMalformedValue=Di.collectPages=void 0;var Rg=be(),xc=te();async function WP(e,t,r,n){let i=[],a=new Set,o=e.apiUrl(t),s=(0,Rg.ensureSuccess)(await e.get(t),o);for(n?.(s);;){let l=s.body,u=l?.value;if(!Array.isArray(u))throw new xc.ConnectionError(o,s.status,`${r}: paginated read returned a malformed page \u2014 expected an OData 'value' array but got ${Lc(u)}; refusing to return partial results.`);for(let d of u)i.push(d);let c=l?.["@odata.nextLink"];if(c==null)break;if(typeof c!="string"||c.length===0)throw new xc.ConnectionError(o,s.status,`${r}: paginated read returned a malformed @odata.nextLink (${Lc(c)}); cannot follow it, and refusing to return partial results.`);if(a.has(c))throw new xc.InvalidArgumentError(`${r}: aborting pagination \u2014 the server returned a repeated @odata.nextLink ('${c}'), which would loop indefinitely.`);a.add(c),o=c,s=(0,Rg.ensureSuccess)(await e.getAbsolute(c),c)}return i}Di.collectPages=WP;function Lc(e){return e===null?"null":e===void 0?"undefined (missing)":`a ${typeof e}`}Di.describeMalformedValue=Lc});var kc=v(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.businessRuleApi=wr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE=wr.WFOM_API_UNAVAILABLE_CODE=void 0;var Wr=Yn(),HP=qt(),Xe=be(),wn=ae(),Ts=te();wr.WFOM_API_UNAVAILABLE_CODE="BUSINESS_RULE_API_UNAVAILABLE";wr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE="BUSINESS_RULE_LEFT_DEACTIVATED";async function Fg(e,t,r,n){let i=`/workflows(${QP})/Microsoft.Dynamics.CRM.${t}`;try{return(0,Xe.ensureSuccess)(await e.post(i,{Entity:r.Entity,WfomJson:r.WfomJson},{headers:n}),e.apiUrl(i))}catch(a){throw a?.statusCode!==404?a:new Ts.SdkError(wr.WFOM_API_UNAVAILABLE_CODE,`Business-rule authoring (preview) is not enabled on this environment yet: it does not expose 'Microsoft.Dynamics.CRM.${t}'. The bound members are still rolling out, so re-check once the release flag reaches this environment. Nothing was written. The SDK does NOT fall back to generating workflow XAML: that covered only 4 of the 7 action types and would silently save a rule different from the one you wrote.`)}}async function jP(e,t){let r=`/workflows(${t})${(0,wn.odataQuery)([["$select","workflowid,statecode,statuscode"]])}`;try{let n=await e.get(r);if(n.status<200||n.status>=300)return null;let i=n.body;return{etag:(0,Xe.readEtag)(n),statecode:typeof i?.statecode=="number"?i.statecode:null,statuscode:typeof i?.statuscode=="number"?i.statuscode:null}}catch{return null}}async function JP(e,t,r){let n=await jP(e,t);if(n===null||n.etag===null)throw new Ts.SdkError(Xe.VERSION_CONFLICT_CODE,`Refusing to update business rule '${t}': its current version could not be read, so the write could not be verified as conditional. The supported update api does not enforce If-Match, so proceeding would risk silently overwriting a concurrent edit. Re-fetch the rule and try again.`);if(n.etag!==r)throw new Ts.SdkError(Xe.VERSION_CONFLICT_CODE,`Version conflict updating business rule '${t}': it changed on the server since it was fetched (held ${r}, server ${n.etag}). Re-fetch the rule and re-apply the change.`);return{statecode:n.statecode,statuscode:n.statuscode}}var QP="00000000-0000-0000-0000-000000000000",_s={"Content-Type":"application/json",Accept:"application/json","OData-Version":"4.0","OData-MaxVersion":"4.0"},KP="workflowid,name,description,primaryentity,statecode,category,type",XP="category eq 2 and type eq 1";async function xg(e,t,r){var n;if(r==="Draft")return null;let i=(0,wn.normalizeGuid)(t,"workflowid"),a=r==="Active",o={statecode:a?Wr.StateCode.Activated:Wr.StateCode.Draft,statuscode:a?Wr.StatusCode.Activated:Wr.StatusCode.Draft},s=`/workflows(${i})`,l=(0,Xe.ensureSuccess)(await e.patch(s,o,{headers:_s}),e.apiUrl(s));return(n=(0,Xe.readEtag)(l))!==null&&n!==void 0?n:await Xa(e,i)}async function Xa(e,t){let r=`/workflows(${t})${(0,wn.odataQuery)([["$select","workflowid"]])}`;try{let n=await e.get(r);return n.status>=200&&n.status<300?(0,Xe.readEtag)(n):null}catch{return null}}async function YP(e,t,r){let n=await Xa(e,t),i=await r(),a=(0,Xe.readEtag)(i);if(a)return{response:i,etag:a};let o=await Xa(e,t);return{response:i,etag:n!==null&&n===o?o:null}}wr.businessRuleApi={async get(e,t){let r=(0,wn.normalizeGuid)(t,"id"),n=`/workflows(${r})/Microsoft.Dynamics.CRM.RetrieveProcessWithWfomJson`,{response:i,etag:a}=await YP(e,r,async()=>(0,Xe.ensureSuccess)(await e.get(n),e.apiUrl(n)));return{raw:i.body,etag:a}},async list(e,t){let r=[XP];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,wn.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,wn.odataQuery)([["$select",KP],["$filter",r.join(" and ")]])}`;return(await(0,HP.collectPages)(e,n,"listArtifacts('businessRule')")).map(a=>{var o,s;return{type:"businessRule",id:(o=a.workflowid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.primaryentity,isDirty:!1}})},async create(e,t){var r;let n=t,i=(0,wn.normalizeGuid)(n.Entity.workflowid,"workflowid"),a=await Fg(e,"CreateProcessWithWfomJson",n,_s),o=(0,Xe.resolveCreatedId)(a,"workflowid","business rule",i),s=null;try{s=await xg(e,o,n.status)}catch(l){try{await(0,Xe.deleteRecord)(e,"workflows",o)}catch{}throw l}return{id:o,etag:(r=s??(0,Xe.readEtag)(a))!==null&&r!==void 0?r:await Xa(e,o)}},async update(e,t,r,n){var i,a;let o=r,s=(0,wn.normalizeGuid)(t,"id"),l=`/workflows(${s})`,u={..._s,"If-Match":(0,Xe.requireEtag)(n,"business rule",s)},c=await JP(e,s,u["If-Match"]),d=c.statecode===Wr.StateCode.Activated;d&&(0,Xe.ensureSuccess)(await e.patch(l,{statecode:Wr.StateCode.Draft,statuscode:Wr.StatusCode.Draft},{headers:u}),e.apiUrl(l));let p;try{p=await Fg(e,"UpdateProcessWithWfomJson",o,u)}catch(m){if(d)try{(0,Xe.ensureSuccess)(await e.patch(l,{statecode:Wr.StateCode.Activated,statuscode:(i=c.statuscode)!==null&&i!==void 0?i:Wr.StatusCode.Activated},{headers:_s}),e.apiUrl(l))}catch(g){throw new Ts.SdkError(wr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE,`The business-rule write failed AND the rule could not be re-activated, so '${s}' is left DEACTIVATED (Draft) on the server. Re-activate it before relying on it. Original write failure: ${m instanceof Error?m.message:String(m)}. Restore failure: ${g instanceof Error?g.message:String(g)}`)}throw m}let f=await xg(e,s,o.status);return{id:s,etag:(a=f??(0,Xe.readEtag)(p))!==null&&a!==void 0?a:await Xa(e,s)}},delete(e,t){return(0,Xe.deleteRecord)(e,"workflows",t)}}});var Rs=v(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.JsonPointer=void 0;var Ft=te(),Ps=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 Ft.JsonPointerError(t,'non-empty pointers must start with "/"');return t.substring(1).split("/").map(r=>{if(/~(?![01])/.test(r))throw new Ft.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 Ft.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 Ft.JsonPointerError(r,`'${o}' is not a valid array index`);if(s>a.length)throw new Ft.JsonPointerError(r,`array index '${o}' is out of range`);a[s]=n}else{if(e.isReservedToken(o))throw new Ft.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 Ft.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 Ft.JsonPointerError(r,`array index '${a}' is out of range`);i.splice(o,1)}else{if(e.isReservedToken(a))throw new Ft.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 Ft.JsonPointerError(r,"add target must be an array");u.push(n);return}let o=e.resolve(t,r);if(!Array.isArray(o))throw new Ft.JsonPointerError(r,"add target must be an array");let s=i===void 0?o.length:i;if(s<0||s>o.length)throw new Ft.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 Ft.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)}};Os.JsonPointer=Ps;Ps.RESERVED_TOKENS=new Set(["__proto__","prototype","constructor"])});var kg=v(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.findElements=void 0;var Lg=Rs();function ZP(e,t){let r=[];return Mc(e,"",t,r),r}Fs.findElements=ZP;function Mc(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)=>{Mc(i,Lg.JsonPointer.append(t,a),r,n)});else for(let i of Object.keys(e))Mc(e[i],Lg.JsonPointer.append(t,i),r,n)}});var Uc=v(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.assertMutationResult=Ar.assertExistsResult=Ar.assertReadResult=Ar.assertStorageContract=void 0;var e1=["readText","writeTextAtomic","deleteFile","deleteByPrefix"],t1=["ensureContainer","exists"];function r1(e){if(typeof e!="object"||e===null)throw new Error("workspaceStorage must be an object implementing WorkspaceStorage.");for(let t of e1)if(typeof e[t]!="function")throw new Error(`workspaceStorage is missing the required method '${t}'.`);for(let t of t1){let r=e[t];if(r!==void 0&&typeof r!="function")throw new Error(`workspaceStorage.${t} must be a function when present.`)}return e}Ar.assertStorageContract=r1;function n1(e,t){if(e===null||typeof e=="string")return e;throw new Error(`workspaceStorage.readText must resolve to a string or null for ${t}; got ${typeof e}. Absence is null \u2014 resolving undefined would make a present value look absent.`)}Ar.assertReadResult=n1;function i1(e,t){if(typeof e=="boolean")return e;throw new Error(`workspaceStorage.exists must resolve to a boolean for ${t}; got ${typeof e}. A truthy non-boolean would make an absent value look present.`)}Ar.assertExistsResult=i1;function a1(e,t){if(e!==void 0)throw new Error(`workspaceStorage.${t} must resolve to undefined; got ${typeof e}. A status-returning implementation would let a failed write be reported as a completed one.`)}Ar.assertMutationResult=a1});var Bc=v(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.retryTransientIoAsync=Ii.retryTransientIo=void 0;var o1=new Set(["EPERM","EACCES","EBUSY","UNKNOWN"]),s1=5,Mg=10;function l1(e){for(let t=1;;t+=1)try{return e()}catch(r){if(!Ug(r,t))throw r;c1(Mg*t)}}Ii.retryTransientIo=l1;async function u1(e){for(let t=1;;t+=1)try{return await e()}catch(r){if(!Ug(r,t))throw r;await new Promise(n=>setTimeout(n,Mg*t))}}Ii.retryTransientIoAsync=u1;function Ug(e,t){let r=e.code;return t<s1&&!!r&&o1.has(r)}function c1(e){try{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}catch{let t=Date.now()+e;for(;Date.now()<t;);}}});var Vg=v(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.canonicalArtifactId=xt.WorkspaceManager=xt.WORKSPACE_SCHEMA_VERSION=xt.retryTransientIo=void 0;var ar=Uc(),xs=te(),d1=Bc();Object.defineProperty(xt,"retryTransientIo",{enumerable:!0,get:function(){return d1.retryTransientIo}});function Bg(e){let t=e;return typeof t.pathFor=="function"&&typeof t.getRoot=="function"?e:null}xt.WORKSPACE_SCHEMA_VERSION=1;var An={form:"forms",view:"views",businessRule:"business-rules",app:"apps",command:"commands",chart:"charts",dashboard:"dashboards",genPage:"gen-pages",bpf:"business-process-flows"},p1="manifest.json",Ya=".metadata",$g="entities";function qg(e){try{return Promise.resolve(e())}catch(t){return Promise.reject(t)}}var $c=class{withManifest(t){let r=this.manifestQueue.then(t,t);return this.manifestQueue=r.then(()=>{},()=>{}),r}constructor(t,r,n){if(this.workspaceLabel=t,this.instanceUrl=r,this.manifestQueue=Promise.resolve(),n==null)throw new Error("WorkspaceManager requires a WorkspaceStorage. Node callers can build one with `createNodeWorkspaceStorage(path)` from '@maker-studio/cds-maker-sdk/node'.");this.storage=n}artifactKey(t,r){return this.assertSafeId(r),[An[t],`${Za(r)}.json`]}metaKey(t,r){return this.assertSafeId(r),[Ya,An[t],`${Za(r)}.meta.json`]}entityKey(t){return this.assertSafeId(t),[Ya,$g,`${t}.json`]}fsStore(){let t=Bg(this.storage);if(!t)throw new Error("This workspace is not filesystem-backed, so it has no physical paths. Use the artifact/metadata/manifest accessors instead of the path helpers.");return t}getRoot(){let t=Bg(this.storage);return t?t.getRoot():this.workspaceLabel}getArtifactDir(t){return this.fsStore().pathFor([An[t]])}getArtifactFilePath(t,r){return this.fsStore().pathFor(this.artifactKey(t,r))}getMetaFilePath(t,r){return this.fsStore().pathFor(this.metaKey(t,r))}getEntityMetaFilePath(t){return this.fsStore().pathFor(this.entityKey(t))}assertSafeId(t){if(typeof t!="string"||t.length===0||/[\u0000-\u001f]/.test(t)||t.includes("/")||t.includes("\\")||t.includes(":")||t==="."||t===".."||t.includes(".."))throw new xs.PathTraversalError(String(t),this.workspaceLabel)}get manifestKey(){return[p1]}async init(){if(this.storage.ensureContainer){let t=this.storage.ensureContainer.bind(this.storage),r=[[Ya,$g]];for(let i of Object.keys(An))r.push([An[i]],[Ya,An[i]]);let n=await Promise.allSettled(r.map(i=>qg(()=>t(i))));for(let i of n){if(i.status==="rejected")throw i.reason;(0,ar.assertMutationResult)(i.value,"ensureContainer")}}await this.withManifest(async()=>{if(await this.isInitialized())return;let t={instanceUrl:this.instanceUrl,createdAt:new Date().toISOString(),artifacts:[]};await this.writeManifest(t)})}async isInitialized(){return this.storage.exists?(0,ar.assertExistsResult)(await this.storage.exists(this.manifestKey),"manifest.json"):(0,ar.assertReadResult)(await this.storage.readText(this.manifestKey),"manifest.json")!==null}async ensureInitialized(){if(!await this.isInitialized())throw new xs.WorkspaceNotInitializedError(this.workspaceLabel)}async clean(){let t=Object.keys(An).map(i=>[An[i]]);t.push([Ya]);let r=await Promise.allSettled(t.map(i=>qg(()=>this.storage.deleteByPrefix(i))));for(let i of r){if(i.status==="rejected")throw i.reason;(0,ar.assertMutationResult)(i.value,"deleteByPrefix")}let n=await this.getManifest();n.artifacts=[],n.lastSyncAt=void 0,await this.init(),await this.writeManifest(n)}async readArtifact(t,r){return await this.ensureInitialized(),this.readJson(this.artifactKey(t,r))}async writeArtifact(t,r,n){await this.ensureInitialized(),await this.writeJson(this.artifactKey(t,r),n),await this.upsertManifestEntry(t,r,n)}async deleteArtifact(t,r){await this.ensureInitialized(),(0,ar.assertMutationResult)(await this.storage.deleteFile(this.artifactKey(t,r)),"deleteFile"),(0,ar.assertMutationResult)(await this.storage.deleteFile(this.metaKey(t,r)),"deleteFile");let n=Za(r);await this.withManifest(async()=>{let i=await this.getManifest();i.artifacts=i.artifacts.filter(a=>!(a.type===t&&a.id===n)),await this.writeManifest(i)})}async readMeta(t,r){return this.readJson(this.metaKey(t,r))}async writeMeta(t,r,n){await this.writeJson(this.metaKey(t,r),n)}async listArtifacts(t,r){return await this.ensureInitialized(),(await this.getManifest()).artifacts.filter(n=>!(t&&n.type!==t||r?.entityLogicalName&&n.entityLogicalName!==r.entityLogicalName))}async readEntityMetadata(t){await this.ensureInitialized();let r=await this.readJson(this.entityKey(t));return!r||typeof r.schemaName!="string"||typeof r.primaryNameAttribute!="string"||typeof r.primaryIdAttribute!="string"||typeof r.isCustomEntity!="boolean"?null:r}async writeEntityMetadata(t,r){await this.ensureInitialized(),await this.writeJson(this.entityKey(t),r)}async getManifest(){await this.ensureInitialized();let t=await this.readJson(this.manifestKey);if(!t)throw new xs.WorkspaceNotInitializedError(this.workspaceLabel);if(t.schemaVersion!==void 0&&t.schemaVersion>xt.WORKSPACE_SCHEMA_VERSION)throw new xs.IncompatibleWorkspaceError(t.schemaVersion,xt.WORKSPACE_SCHEMA_VERSION);return t}async writeManifest(t){await this.writeJson(this.manifestKey,{...t,schemaVersion:xt.WORKSPACE_SCHEMA_VERSION})}async updateManifest(t){await this.withManifest(async()=>{let r=await this.getManifest();await this.writeManifest({...r,...t})})}async upsertManifestEntry(t,r,n){await this.withManifest(async()=>{let i=await this.getManifest(),a=Za(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}),await this.writeManifest(i)})}async readJson(t){let r=(0,ar.assertReadResult)(await this.storage.readText(t),t.join("/"));return r===null?null:JSON.parse(r)}async writeJson(t,r){(0,ar.assertMutationResult)(await this.storage.writeTextAtomic(t,`${JSON.stringify(r,null,2)}
+`),"writeTextAtomic")}async removeFile(t){(0,ar.assertMutationResult)(await this.storage.deleteFile(t),"deleteFile")}async exists(t){return this.storage.exists?(0,ar.assertExistsResult)(await this.storage.exists(t),t.join("/")):(0,ar.assertReadResult)(await this.storage.readText(t),t.join("/"))!==null}};xt.WorkspaceManager=$c;function Za(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()}xt.canonicalArtifactId=Za});var qc=v(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.deepEqual=_i.deepDiff=void 0;var f1=Rs();function m1(e,t){let r=[];return zg(e,t,"",r,0),r}_i.deepDiff=m1;var Ls=Symbol("missing"),ks=512;function zg(e,t,r,n,i){if(e===t)return;if(i>ks)throw new RangeError(`deepDiff exceeded the maximum supported depth of ${ks}`);let a=Ms(e),o=Ms(t);if(a&&o&&Array.isArray(e)===Array.isArray(t)){let s=h1(e,t);for(let l of s){let u=Gg(e,l),c=Gg(t,l),d=f1.JsonPointer.append(r,l);u===Ls?n.push({pointer:d,type:"added",newValue:c}):c===Ls?n.push({pointer:d,type:"removed",oldValue:u}):zg(u,c,d,n,i+1)}return}Wg(e,t)||n.push({pointer:r,type:"modified",oldValue:e,newValue:t})}function Ms(e){return e!==null&&typeof e=="object"}function h1(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 Gg(e,t){if(Array.isArray(e)){let r=Number(t);return r<e.length?e[r]:Ls}return t in e?e[t]:Ls}function Wg(e,t){return Hg(e,t,0)}_i.deepEqual=Wg;function Hg(e,t,r){if(e===t)return!0;if(r>ks)throw new RangeError(`deepEqual exceeded the maximum supported depth of ${ks}`);if(!Ms(e)||!Ms(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&&Hg(e[a],t[a],r+1))}});var Jg=v(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.VersionManager=Ti.PROJECTION_VERSION=void 0;var jg=qc();Ti.PROJECTION_VERSION=3;var Vc=class{constructor(t){this.workspace=t}async storeMeta(t,r,n){var i;let a=await this.getMeta(t,r),o=((i=n.snapshot)===null||i===void 0?void 0:i.status)==="Active",s=a?.everActivated===!0||o;await this.workspace.writeMeta(t,r,s?{...n,everActivated:s}:n)}async getMeta(t,r){return this.workspace.readMeta(t,r)}async isDirty(t,r){let n=await this.workspace.readArtifact(t,r);if(n===null)return!1;let i=await this.getMeta(t,r);return i?!(0,jg.deepEqual)(i.snapshot,n):!0}async diff(t,r){let n=await this.workspace.readArtifact(t,r),i=await this.getMeta(t,r),a;return n===null?a=i?[{pointer:"",type:"removed",oldValue:i.snapshot}]:[]:i?a=(0,jg.deepDiff)(i.snapshot,n):a=[{pointer:"",type:"added",newValue:n}],{artifactType:t,artifactId:r,changes:a}}async checkConflict(t,r,n){let i=await this.getMeta(t,r);return!i||i.etag===null?!1:i.etag!==n}};Ti.VersionManager=Vc});var Kg=v((Gc,Qg)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof Gc=="object"?Qg.exports=t():e.compareVersions=t()})(Gc,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),p=parseInt(u[c]||0,10);if(d>p)return 1;if(p>d)return-1}var f=l[l.length-1],m=u[u.length-1];if(f&&m){var g=f.split(".").map(n),y=m.split(".").map(n);for(c=0;c<Math.max(g.length,y.length);c++){if(g[c]===void 0||typeof y[c]=="string"&&typeof g[c]=="number")return-1;if(y[c]===void 0||typeof g[c]=="string"&&typeof y[c]=="number"||g[c]>y[c])return 1;if(y[c]>g[c])return-1}}else if(f||m)return f?-1:1;return 0}})});var t0=v(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.EnvironmentFlowHostingType=Ee.EnvironmentDisableReasonCode=Ee.EnvironmentMigrationConstants=Ee.EnvironmentProvisioningStates=Ee.EnvironmentLocations=Ee.EnvironmentCreationTypeConstants=Ee.EnvironmentType=Ee.EnvironmentSkuConstants=Ee.environmentPermissions=Ee.DatabaseType=void 0;var Xg;(function(e){e.CommonDataService="CommonDataService",e.None="None"})(Xg||(Ee.DatabaseType=Xg={}));Ee.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"};Ee.EnvironmentSkuConstants={NotSpecified:"NotSpecified",Standard:"Standard",Premium:"Premium",Developer:"Developer",Basic:"Basic",Production:"Production",Sandbox:"Sandbox",Trial:"Trial",Default:"Default",Teams:"Teams",Platform:"Platform"};var Yg;(function(e){e[e.CDS2=0]="CDS2",e[e.CDS1=1]="CDS1",e[e.Empty=2]="Empty"})(Yg||(Ee.EnvironmentType=Yg={}));Ee.EnvironmentCreationTypeConstants={NotSpecified:"NotSpecified",Legacy:"Legacy",DefaultTenant:"DefaultTenant",User:"User",CommonDataModelLegacy:"CommonDataModelLegacy"};Ee.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"};Ee.EnvironmentProvisioningStates={NotSpecified:"NotSpecified",Succeeded:"Succeeded",Deleting:"Deleting",Deleted:"Deleted",FailedDeleting:"FailedDeleting",LinkedDatabaseProvisioning:"LinkedDatabaseProvisioning",LinkedDatabaseFailedProvisioning:"LinkedDatabaseFailedProvisioning",LinkedDatabaseFailedConfiguring:"LinkedDatabaseFailedConfiguring",LinkedDatabaseUnavailable:"LinkedDatabaseUnavailable",Creating:"Creating"};Ee.EnvironmentMigrationConstants={phases:{completed:"Completed"}};var Zg;(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"})(Zg||(Ee.EnvironmentDisableReasonCode=Zg={}));var e0;(function(e){e.LogicApps="LogicApps",e.SelfHostSingleTenant="SelfHostSingleTenant",e.SelfHostMultiTenant="SelfHostMultiTenant"})(e0||(Ee.EnvironmentFlowHostingType=e0={}))});var u0=v(C=>{"use strict";var g1=C&&C.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(C,"__esModule",{value:!0});C.hasCommonDataServiceDatabase=C.getEnvironmentDiscoveryUrl=C.getEnvironmentWebApiUrl=C.getEnvironmentInstanceApiUrl=C.getEnvironmentLanguageCode=C.getEnvironmentUpdateCadence=C.checkVersions=C.isCds2EnvironmentVersionAtLeast=C.getSecurityOrConnectedGroupId=C.hasSecurityGroupId=C.doesCds2VersionSupportApiVersion9_1=C.doesCds2EnvironmentSupportApiVersion9_1=C.cdsVersionSupportingOSColorEdit=C.getEnvironmentDisplayName=C.getEnvironmentName=C.isEnvironmentInFirstReleaseCluster=C.isEnvironmentInPreprodCluster=C.isEnvironmentInTestCluster=C.isLiteEnvironmentUpgrading=C.isEnvironmentExpired=C.isEnvironmentInDeletedState=C.isEnvironmentInCreatingState=C.isDatabaseInProvisioningState=C.canUserCreateDatabase=C.isDisabledEnvironment=C.isDefaultEnvironment=C.isTrialEnvironment=C.isPlatformEnvironment=C.isTeamsEnvironment=C.isSandboxEnvironment=C.isProdEnvironment=C.isDevEnvironment=C.getEnvironmentType=C.getCrmInstanceName=C.getCrmInstanceUrl=C.getCrmAppDesignerUrl=C.getDevResourcesUrl=C.isEnvironmentInSuccessfulState=C.getAllThemesUrl=C.getAllPublishersUrl=C.getAllSolutionsUrl=C.getSecurityRolesUrl=C.getSecurityUsersUrl=C.environmentHasCds2Database=C.DEFAULT_SOLUTION_UNIQUE_NAME=C.DEFAULT_SOLUTION_ID=C.crmBapSolutionId=C.doesUserHavePermission=C.getLinkedEnvironmentMetadata=C.getCrmVersion=void 0;C.doesUserHaveFlowRunOnlyPermission=C.isUserPautoMakerWithoutDataAccess=C.isUserPautoMakerWithDataAccess=C.doesUserHaveCreateFlowPermission=C.equalsIgnoreCase=C.doesUserHaveCreateDatabasePermission=C.doesUserHaveDatabaseTablePermissions=C.isUserMakerWithoutDataAccess=C.isUserMakerWithDataAccess=C.doesUserHaveCreateAppPermission=C.doesUserHaveAdminPermission=void 0;var v1=g1(Kg()),de=t0(),eo=Wc();function y1(e){let t=jr(e);return t&&t.version}C.getCrmVersion=y1;function jr(e){return e&&e.properties&&e.properties.linkedEnvironmentMetadata}C.getLinkedEnvironmentMetadata=jr;function Hr(e,t){return e?!!e[t]:!1}C.doesUserHavePermission=Hr;C.crmBapSolutionId="00000001-0000-0000-0001-00000000009b";C.DEFAULT_SOLUTION_ID="fd140aaf-4df4-11dd-bd17-0019b9312238";C.DEFAULT_SOLUTION_UNIQUE_NAME="Default";function Zn(e){return!!jr(e)&&r0(e)}C.environmentHasCds2Database=Zn;function b1(e){if(e&&Zn(e)){let t=Cn(e);return(0,eo.getCrmAdminSecurityRolesUrl)(t)}return""}C.getSecurityUsersUrl=b1;function w1(e){if(e&&Zn(e)){let t=Cn(e);return(0,eo.getCrmAdminSecurityUsersUrl)(t)}return""}C.getSecurityRolesUrl=w1;function A1(e){if(e&&Zn(e)){let t=Cn(e);(0,eo.getCrmAllSolutionsUrl)(t)}return""}C.getAllSolutionsUrl=A1;function C1(e){if(e&&Zn(e)){let t=Cn(e);return(0,eo.getCrmAllPublishersUrl)(t)}return""}C.getAllPublishersUrl=C1;function E1(e){return e&&Zn(e)?Cn(e):""}C.getAllThemesUrl=E1;function r0(e){return!!e&&e.properties&&!!e.properties.provisioningState&&e.properties.provisioningState.toUpperCase()===de.EnvironmentProvisioningStates.Succeeded.toUpperCase()}C.isEnvironmentInSuccessfulState=r0;function S1(e){if(e&&Zn(e)){let t=Cn(e);return(0,eo.getCrmDevResourcesUrl)(t)}return""}C.getDevResourcesUrl=S1;function N1(e){return`${e}designer/app/{${C.crmBapSolutionId}}/CreateNewApp}}`}C.getCrmAppDesignerUrl=N1;function Cn(e){let t=jr(e);if(t){let r=t.instanceUrl;return r?r.endsWith("/")?r:r+"/":""}return""}C.getCrmInstanceUrl=Cn;function D1(e){let t=jr(e);return t?t.uniqueName:""}C.getCrmInstanceName=D1;function I1(e){return jr(e)?de.EnvironmentType.CDS2:e&&e.properties&&e.properties.namespace?de.EnvironmentType.CDS1:de.EnvironmentType.Empty}C.getEnvironmentType=I1;function _1(e){return e&&e.properties&&e.properties.environmentSku===de.EnvironmentSkuConstants.Developer}C.isDevEnvironment=_1;function T1(e){return e&&e.properties&&e.properties.environmentSku===de.EnvironmentSkuConstants.Production}C.isProdEnvironment=T1;function P1(e){return e&&e.properties&&e.properties.environmentSku===de.EnvironmentSkuConstants.Sandbox}C.isSandboxEnvironment=P1;function to(e){return e&&e.properties&&e.properties.environmentSku===de.EnvironmentSkuConstants.Teams}C.isTeamsEnvironment=to;function O1(e){return e&&e.properties&&e.properties.environmentSku===de.EnvironmentSkuConstants.Platform}C.isPlatformEnvironment=O1;var R1=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.environmentSku)===de.EnvironmentSkuConstants.Trial};C.isTrialEnvironment=R1;function F1(e){return e&&e.properties&&(e.properties.isDefault||e.properties.creationType===de.EnvironmentCreationTypeConstants.DefaultTenant)}C.isDefaultEnvironment=F1;function x1(e){return e&&e.properties&&!!e.properties.states&&!!e.properties.states.runtime&&e.properties.states.runtime.id==="Disabled"}C.isDisabledEnvironment=x1;function L1(e){return e&&e.properties&&Hr(e.properties.permissions,de.environmentPermissions.CreateDatabase)}C.canUserCreateDatabase=L1;function k1(e){return!!(e&&e.properties&&e.properties.provisioningState&&l0(e.properties.provisioningState,de.EnvironmentProvisioningStates.LinkedDatabaseProvisioning))}C.isDatabaseInProvisioningState=k1;function M1(e){return!!e&&!!e.properties&&e.properties.provisioningState===de.EnvironmentProvisioningStates.Creating}C.isEnvironmentInCreatingState=M1;function U1(e){return e&&e.properties&&(e.properties.provisioningState===de.EnvironmentProvisioningStates.Deleted||e.properties.provisioningState===de.EnvironmentProvisioningStates.Deleting||e.properties.provisioningState===de.EnvironmentProvisioningStates.FailedDeleting)}C.isEnvironmentInDeletedState=U1;function B1(e){return!!e&&!!e.properties&&!!e.properties.expirationTime&&Date.parse(e.properties.expirationTime)<Date.now()}C.isEnvironmentExpired=B1;function $1(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"}C.isLiteEnvironmentUpgrading=$1;function q1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Test"}C.isEnvironmentInTestCluster=q1;function V1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Preprod"}C.isEnvironmentInPreprodCluster=V1;function G1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="FirstRelease"}C.isEnvironmentInFirstReleaseCluster=G1;function z1(e){return e&&e.name||""}C.getEnvironmentName=z1;function W1(e){return e&&e.properties&&e.properties.displayName||""}C.getEnvironmentDisplayName=W1;var n0="9.1.0.8202";C.cdsVersionSupportingOSColorEdit="9.1.0000.20708";function H1(e){return o0(e,n0)}C.doesCds2EnvironmentSupportApiVersion9_1=H1;function j1(e){return zc(e,n0)}C.doesCds2VersionSupportApiVersion9_1=j1;function i0(e){let t=jr(e);if(t)return t.securityGroupId}function a0(e){return e&&e.properties&&e.properties.connectedGroups}function J1(e,t){let r=a0(e);return!!r&&!!r.find(n=>n.id===t)||i0(e)===t}C.hasSecurityGroupId=J1;function Q1(e){let t=a0(e);return t&&t.length>0&&t[0].id?t[0].id:i0(e)}C.getSecurityOrConnectedGroupId=Q1;function o0(e,t){let r=e.version;return r?zc(r,t):!1}C.isCds2EnvironmentVersionAtLeast=o0;function zc(e,t){return t?e?(0,v1.default)(e,t)>=0:!1:!0}C.checkVersions=zc;function K1(e){return e&&e.properties&&e.properties.updateCadence&&e.properties.updateCadence.id||"NotSpecified"}C.getEnvironmentUpdateCadence=K1;function X1(e){let t=jr(e);return t?Number(t.baseLanguage):0}C.getEnvironmentLanguageCode=X1;function s0(e){let t=jr(e);return t?t.instanceApiUrl:void 0}C.getEnvironmentInstanceApiUrl=s0;function Y1(e){let t=s0(e);return t?t+"/api/data/v9.2":""}C.getEnvironmentWebApiUrl=Y1;function Z1(e){let t=Cn(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"}C.getEnvironmentDiscoveryUrl=Z1;var eO=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.databaseType)===de.DatabaseType.CommonDataService};C.hasCommonDataServiceDatabase=eO;var tO=e=>{var t;return Hr((t=e.properties)===null||t===void 0?void 0:t.permissions,de.environmentPermissions.AdminReadEnvironment)};C.doesUserHaveAdminPermission=tO;var rO=e=>{var t;return Hr((t=e.properties)===null||t===void 0?void 0:t.permissions,de.environmentPermissions.CreatePowerApp)};C.doesUserHaveCreateAppPermission=rO;var nO=e=>(0,C.doesUserHaveAdminPermission)(e)&&(0,C.hasCommonDataServiceDatabase)(e)?!0:(0,C.doesUserHaveCreateAppPermission)(e)?to(e)||(0,C.doesUserHaveDatabaseTablePermissions)(e):!1;C.isUserMakerWithDataAccess=nO;var iO=e=>(0,C.doesUserHaveCreateAppPermission)(e)&&!to(e)&&!(0,C.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,C.doesUserHaveAdminPermission)(e)||!(0,C.hasCommonDataServiceDatabase)(e));C.isUserMakerWithoutDataAccess=iO;var aO=e=>[de.environmentPermissions.CreateDatabaseEntities,de.environmentPermissions.ListDatabaseEntities,de.environmentPermissions.UpdateDatabaseEntities,de.environmentPermissions.DeleteDatabaseEntities].every(t=>{var r;return Hr((r=e.properties)===null||r===void 0?void 0:r.permissions,t)});C.doesUserHaveDatabaseTablePermissions=aO;var oO=e=>{var t;return Hr((t=e.properties)===null||t===void 0?void 0:t.permissions,de.environmentPermissions.CreateDatabase)};C.doesUserHaveCreateDatabasePermission=oO;function l0(e,t){return!e&&!t?!0:!e||!t?!1:e.toUpperCase()===t.toUpperCase()}C.equalsIgnoreCase=l0;var sO=e=>{var t;return Hr((t=e.properties)===null||t===void 0?void 0:t.permissions,de.environmentPermissions.CreateFlow)};C.doesUserHaveCreateFlowPermission=sO;var lO=e=>(0,C.doesUserHaveAdminPermission)(e)&&(0,C.hasCommonDataServiceDatabase)(e)?!0:(0,C.doesUserHaveCreateFlowPermission)(e)?to(e)||(0,C.doesUserHaveDatabaseTablePermissions)(e):!1;C.isUserPautoMakerWithDataAccess=lO;var uO=e=>(0,C.doesUserHaveCreateFlowPermission)(e)&&!to(e)&&!(0,C.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,C.doesUserHaveAdminPermission)(e)||!(0,C.hasCommonDataServiceDatabase)(e));C.isUserPautoMakerWithoutDataAccess=uO;var cO=e=>{var t,r;return!Hr((t=e.properties)===null||t===void 0?void 0:t.permissions,de.environmentPermissions.CreateFlow)&&Hr((r=e.properties)===null||r===void 0?void 0:r.permissions,de.environmentPermissions.ReadEnvironment)};C.doesUserHaveFlowRunOnlyPermission=cO});var Wc=v(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.getRequiredComponentsQueryUrl=w.solutionComponentCountSummariesQueryUrl=w.solutionComponentSummariesQueryUrl=w.solutionComponentConfigurationsQueryUrl=w.chartsQueryUrl=w.workflowsQueryUrl=w.entityDefinitionsQueryUrl=w.solutionComponentDefinitionsQueryUrl=w.getCreateNewArticleTemplateUrl=w.getCreateNewPublisherUrl=w.getEnableSecurityRolesUrl=w.getArticleTemplateUrl=w.getFieldSecurityProfileDesignerUrl=w.getSecurityRoleDesignerUrl=w.getMailMergeTemplateDesignerUrl=w.getEmailTemplateDesignerUrl=w.getConnectionRoleDesignerUrl=w.getSiteMapDesignerUrl=w.getWebResourceFileUrl=w.getWebResourceDesignerUrl=w.getReportDesignerUrl=w.getBusinessProcessFlowDesignerUrl=w.getProcessShareUrl=w.getProcessDesignerUrl=w.getChartDesignerUrl=w.getOpenModernEntityDashboardUrl=w.getNewModernEntityDashboardUrl=w.getNewModernDashboardUrl=w.getOpenModernDashboardUrl=w.getDashboardDesignerUrl=w.getAppModuleDesignerUrl=w.privilegesQueryUrls=w.xrmApiUrl=w.getPlayAppModuleUrl=w.getCrmAdminSecurityUsersUrl=w.getCrmAdminSecurityRolesUrl=w.getCrmMyAppsUrl=w.getCrmAppDesignerUrl=w.getCrmDevResourcesUrl=w.getCrmAllPublishersUrl=w.getCrmAllSolutionsUrl=w.getSolutionPublisherUrl=w.getExportTranslationFileName=w.getExportSolutionTranslationUrl=w.getImportSolutionTranslationUrl=w.getShowSolutionDependenciesUrl=w.getShowComponentDependenciesUrl=w.cdsServiceUrl=w.ODATA_NEXT_LINK=w.ODATA_MAX_PAGE_SIZE=void 0;w.retrieveOrganizationResources=w.getUCIEntityRecordEditUrl=w.getUCIEntityRecordBaseUrl=w.getBusinessRuleDesignerUri=w.retrieveUnpublishedSuffix=w.getSavePowerSettingUri=w.getPowerSettingUri=w.getPowerSettingsUri=w.RetrievePlatform=w.getAppSettingOverrideUri=w.AppSettingOverrideName=w.getOrgSettingOverrideUri=w.OrgSettingOverrideName=w.getSettingDefinitionsUri=w.retrieveFeatureControlSettingsByNamespaceUrl=w.retrieveDeploymentPipelineConfigAppUrl=w.SPNPrincipalIdUrl=w.retrieveDeploymentEnvironmentInfoUrl=w.devSolutionInfoUrl=w.deployOperationStatusUrl=w.getAIGeneratedDeploymentNotesUrl=w.deploymentStageRunUrl=w.validatePackageAsyncUrl=w.deployPackageAsyncUrl=w.updateDeploymentStageRunUrl=w.createDeploymentStageRunUrl=w.retrieveDeploymentStagesUrl=w.retrievePipelinesUrl=w.retrieveDeploymentPipelineInfoUrl=w.getDeploymentStageRunsUrl=w.appDeploymentUrls=w.getProvisionLanguageUrl=w.getSolutionQueryUrl=w.getSolutionsByUniqueNameQueryUrl=w.solutionsQueryUrl=w.getDependentComponentsWithMetadataQueryUrl=void 0;var c0=u0();w.ODATA_MAX_PAGE_SIZE="odata.maxpagesize";w.ODATA_NEXT_LINK="@odata.nextLink";w.cdsServiceUrl="https://cds-org/";var no;(function(e){e.AllSolutions="11",e.AllPublishers="10",e.DevResources="05"})(no||(no={}));function dO(e,t,r,n){return`${e}tools/dependency/dependencyviewdialog.aspx?appSolutionId=%7b${t}%7d&dType=1&objectid=%7b${r}%7d&objecttype=${n}&operationtype=showdependency`}w.getShowComponentDependenciesUrl=dO;function pO(e,t){let r=`dType=1&isproactivecheck=true&objecttype=7100&operationtype=dependenciesforuninstall&objectid=${t}`;return`${e}tools/dependency/dependencyviewdialog.aspx?${r}`}w.getShowSolutionDependenciesUrl=pO;function fO(e,t){return`${e}tools/muiProvisioning/Dialogs/LangTranslationsImport.aspx?dType=1&appSolutionId=${t}`}w.getImportSolutionTranslationUrl=fO;function mO(e,t){return`${e}_grid/cmds/dlg_exportsolution.aspx?command=exporttranslation&appSolutionId=${t}`}w.getExportSolutionTranslationUrl=mO;function hO(e,t){return e!==void 0&&t!==void 0&&`CrmTranslations_${e}_${t.replace(/[.]/g,"_")}.zip`||""}w.getExportTranslationFileName=hO;function gO(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`}w.getSolutionPublisherUrl=gO;function Hc(e,t){return`${e}tools/systemcustomization/systemCustomization.aspx?pid=${t}`}function vO(e){return Hc(e,no.AllSolutions)}w.getCrmAllSolutionsUrl=vO;function yO(e){return Hc(e,no.AllPublishers)}w.getCrmAllPublishersUrl=yO;function bO(e){return Hc(e,no.DevResources)}w.getCrmDevResourcesUrl=bO;function wO(e,t=c0.crmBapSolutionId){return`${e}designer/app/${t}#/CreateNewApp`}w.getCrmAppDesignerUrl=wO;function AO(e){return`${e}apps`}w.getCrmMyAppsUrl=AO;function CO(e){return d0(e,"role")+"&forceUCI=0"}w.getCrmAdminSecurityRolesUrl=CO;function EO(e){return`${d0(e,"systemuser")}&forceclassic=1`}w.getCrmAdminSecurityUsersUrl=EO;function d0(e,t){return`${e}main.aspx?pagetype=entitylist&etn=${t}`}function SO(e,t){return`${e}main.aspx?appid=${t}`}w.getPlayAppModuleUrl=SO;w.xrmApiUrl="api/data/v9.0";w.privilegesQueryUrls={systemUserInfo:e=>`${e}${w.xrmApiUrl}/WhoAmI`,userPrivileges:(e,t)=>`${e}${w.xrmApiUrl}/systemusers(${t})/Microsoft.Dynamics.CRM.RetrieveUserPrivileges`,systemPrivileges:e=>`${e}${w.xrmApiUrl}/privileges/Microsoft.Dynamics.CRM.RetrievePrivilegeSet`};function NO(e,t,r=c0.crmBapSolutionId){return`${e}designer/app/${r}/${t}/AppDesignerCanvas/${t}`}w.getAppModuleDesignerUrl=NO;function DO(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${r}%7d&extraqs=%26formId%3d%7b${t}%7d%26dashboardType%3d1030&pagetype=${`${n?"ic":""}dashboardeditor`}`}w.getDashboardDesignerUrl=DO;function IO(e,t,r){return`/e/${e}/s/${t}/dashboard/${r}`}w.getOpenModernDashboardUrl=IO;function _O(e,t,r){let n=r!==void 0?r.toString():void 0;return`/e/${e}/s/${t}/dashboard/new${n?`/${n}`:""}`}w.getNewModernDashboardUrl=_O;function TO(e,t,r,n){let i=n!==void 0?n.toString():void 0;return`/e/${e}/s/${t}/n/${r}/dashboard/new${i?`/${i}`:""}`}w.getNewModernEntityDashboardUrl=TO;function PO(e,t,r,n){return`/e/${e}/s/${t}/n/${r}/dashboard/${n}`}w.getOpenModernEntityDashboardUrl=PO;function OO(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${t}%7d&extraqs=etc=${r||""}`+(n?`%26id=${n}`:"")+"&pagetype=vizdesigner"}w.getChartDesignerUrl=OO;function RO(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}w.getProcessDesignerUrl=RO;function FO(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}w.getProcessShareUrl=FO;function xO(e,t){return`${e}Tools/ProcessControl/UnifiedProcessDesigner.aspx?id=${t}`}w.getBusinessProcessFlowDesignerUrl=xO;function LO(e,t,r){return`${e}CRMReports/reportproperty.aspx?appSolutionId=%7b${r}%7d&disablePersonal=true&id=%7b${t}%7d`}w.getReportDesignerUrl=LO;function kO(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`}w.getWebResourceDesignerUrl=kO;function MO(e,t){return`${e}WebResources/${t}`}w.getWebResourceFileUrl=MO;function UO(e,t,r){return`${e}designer/sitemap/${r}/${t}/SiteMapHome/${t}`}w.getSiteMapDesignerUrl=UO;function BO(e,t,r){return`${e}connections/connectionroles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}w.getConnectionRoleDesignerUrl=BO;function $O(e,t,r){return`${e}tools/emailtemplateeditor/emailtemplateeditor.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}w.getEmailTemplateDesignerUrl=$O;function qO(e,t,r){return`${e}tools/mailmerge/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}w.getMailMergeTemplateDesignerUrl=qO;function VO(e,t,r){return`${e}biz/roles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}w.getSecurityRoleDesignerUrl=VO;function GO(e,t,r){return`${e}biz/fieldsecurityprofiles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}w.getFieldSecurityProfileDesignerUrl=GO;function zO(e,t,r){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?_CreateFromId=%7b${t}%7d&_CreateFromType=7100&appSolutionId=%7b${t}%7d&id=%7b${r}%7d`}w.getArticleTemplateUrl=zO;function WO(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}`}w.getEnableSecurityRolesUrl=WO;function HO(e){return`${e}tools/publisher/edit.aspx`}w.getCreateNewPublisherUrl=HO;function jO(e,t){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?appSolutionId=${t}`}w.getCreateNewArticleTemplateUrl=jO;w.solutionComponentDefinitionsQueryUrl="api/data/v9.0/solutioncomponentdefinitions";w.entityDefinitionsQueryUrl="api/data/v9.0/EntityDefinitions?$select=EntitySetName,DisplayName,LogicalName&$filter=";w.workflowsQueryUrl="api/data/v9.0/workflows";w.chartsQueryUrl="/api/data/v9.0/savedqueryvisualizations";w.solutionComponentConfigurationsQueryUrl="/api/data/v9.1/solutioncomponentconfigurations?$filter=isdisplayable eq true&$select=name";w.solutionComponentSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentsummaries";w.solutionComponentCountSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentcountsummaries";function JO(e,t){return`${w.xrmApiUrl}/RetrieveRequiredComponents(ObjectId=${e},ComponentType=${t})`}w.getRequiredComponentsQueryUrl=JO;function QO(e,t){return`${w.cdsServiceUrl}${w.xrmApiUrl}/RetrieveDependentComponentsWithMetadata(ObjectId=${e},ComponentType=${t})`}w.getDependentComponentsWithMetadataQueryUrl=QO;w.solutionsQueryUrl="/api/data/v9.0/solutions?$expand=publisherid&$filter=(isvisible eq true)";function KO(e){return`/api/data/v9.0/solutions?$expand=publisherid&$filter=(uniquename eq '${e}')`}w.getSolutionsByUniqueNameQueryUrl=KO;function XO(e){return`/api/data/v9.0/solutions(${e})?$expand=publisherid`}w.getSolutionQueryUrl=XO;function YO(e){return`${e}api/data/v9.1/ProvisionLanguageForUser`}w.getProvisionLanguageUrl=YO;w.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 ZO(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`}b.getDeploymentStageRunsUrl=RO;function FO(e,t,r){return`/api/data/v9.1/RetrieveDeploymentPipelineInfo(DeploymentPipelineId=${e},SourceEnvironmentId='${t}',ArtifactName='${r}')`}b.retrieveDeploymentPipelineInfoUrl=FO;function xO(e){return`/api/data/v9.0/deploymentenvironments
+ &$orderby=starttime desc`}w.getDeploymentStageRunsUrl=ZO;function eR(e,t,r){return`/api/data/v9.1/RetrieveDeploymentPipelineInfo(DeploymentPipelineId=${e},SourceEnvironmentId='${t}',ArtifactName='${r}')`}w.retrieveDeploymentPipelineInfoUrl=eR;function tR(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}')`}b.retrievePipelinesUrl=xO;function LO(e){return`/api/data/v9.0/deploymentstages
+ &$filter=(environmentid eq '${e}')`}w.retrievePipelinesUrl=tR;function rR(e){return`/api/data/v9.0/deploymentstages
?$filter=(_deploymentpipelineid_value eq ${e})
&$select=name,description,deploymentstageid,_previousdeploymentstageid_value
- &$expand=targetdeploymentenvironmentid($select=deploymentenvironmentid,environmentid,name)`}b.retrieveDeploymentStagesUrl=LO;function kO(){return"/api/data/v9.0/deploymentstageruns?$select=deploymentstagerunid"}b.createDeploymentStageRunUrl=kO;function MO(e){return`/api/data/v9.0/deploymentstageruns(${e})`}b.updateDeploymentStageRunUrl=MO;function BO(){return"/api/data/v9.0/DeployPackageAsync"}b.deployPackageAsyncUrl=BO;function UO(){return"/api/data/v9.0/ValidatePackageAsync"}b.validatePackageAsyncUrl=UO;function $O(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)":""}`}b.deploymentStageRunUrl=$O;function qO(e){return`/api/data/v9.0/deploymentstageruns(${e})
- ?$select=aigenerateddeploymentnotes,deploymentstagerunid`}b.getAIGeneratedDeploymentNotesUrl=qO;function VO(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)`}w.retrieveDeploymentStagesUrl=rR;function nR(){return"/api/data/v9.0/deploymentstageruns?$select=deploymentstagerunid"}w.createDeploymentStageRunUrl=nR;function iR(e){return`/api/data/v9.0/deploymentstageruns(${e})`}w.updateDeploymentStageRunUrl=iR;function aR(){return"/api/data/v9.0/DeployPackageAsync"}w.deployPackageAsyncUrl=aR;function oR(){return"/api/data/v9.0/ValidatePackageAsync"}w.validatePackageAsyncUrl=oR;function sR(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)":""}`}w.deploymentStageRunUrl=sR;function lR(e){return`/api/data/v9.0/deploymentstageruns(${e})
+ ?$select=aigenerateddeploymentnotes,deploymentstagerunid`}w.getAIGeneratedDeploymentNotesUrl=lR;function uR(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`}b.deployOperationStatusUrl=VO;function GO(e){return`/api/data/v9.0/solutions(${e})
- ?$select=solutionid,uniquename,version`}b.devSolutionInfoUrl=GO;function zO(e){return`/api/data/v9.0/deploymentenvironments
+ &$select=_deploymentstageid_value,deploymentstagerunid,stagerunstatus,operation,operationstatus,suboperation,artifactname`}w.deployOperationStatusUrl=uR;function cR(e){return`/api/data/v9.0/solutions(${e})
+ ?$select=solutionid,uniquename,version`}w.devSolutionInfoUrl=cR;function dR(e){return`/api/data/v9.0/deploymentenvironments
?$select=deploymentenvironmentid,environmentid,environmenttype,name
- &$filter=(environmentid eq '${e}')`}b.retrieveDeploymentEnvironmentInfoUrl=zO;var WO=e=>`/api/data/v9.0/systemusers
+ &$filter=(environmentid eq '${e}')`}w.retrieveDeploymentEnvironmentInfoUrl=dR;var pR=e=>`/api/data/v9.0/systemusers
?$select=azureactivedirectoryobjectid
- &$filter=(applicationid eq '${e}')`;b.SPNPrincipalIdUrl=WO;function HO(){return"/api/data/v9.0/appmodules?$filter=(uniquename eq 'AppDeploymentConfiguration')"}b.retrieveDeploymentPipelineConfigAppUrl=HO;b.retrieveFeatureControlSettingsByNamespaceUrl="/api/data/v9.1/RetrieveFeatureControlSettingsByNamespace";function jO(e){return`/api/data/v9.0/settingdefinitions${e}`}b.getSettingDefinitionsUri=jO;b.OrgSettingOverrideName="organizationsettings";function JO(e,t=!1){let r=`/api/data/v9.0/${b.OrgSettingOverrideName}${e}`;return t?`${b.cdsServiceUrl}${r}`:r}b.getOrgSettingOverrideUri=JO;b.AppSettingOverrideName="appsettings";function QO(e,t=!1){let r=`/api/data/v9.0/${b.AppSettingOverrideName}${e}`;return t?`${b.cdsServiceUrl.replace("/$","")}${r}`:r}b.getAppSettingOverrideUri=QO;var ja;(function(e){e[e.All=0]="All",e[e.IsPlatformOnly=1]="IsPlatformOnly",e[e.NotPlatformOnly=2]="NotPlatformOnly"})(ja||(b.RetrievePlatform=ja={}));function KO(e,t,r,n=ja.All,i=!1){let a=[];e&&a.push(`AppUniqueName='${e}'`),t!=null&&a.push(`ReleaseLevel=${t}`),r&&a.push(`RetrieveHiddenSettings=${r}`),n!==ja.All&&a.push(`RetrievePlatformSettings=${n===ja.IsPlatformOnly?1:0}`);let o="/api/data/v9.0/RetrieveUnpublishedOverridableSettingsInfo";return a.length&&(o=`${o}(${a.join(",")})`),i?`${b.cdsServiceUrl}${o}`:o}b.getPowerSettingsUri=KO;function XO(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?`${b.cdsServiceUrl}${a}`:a}b.getPowerSettingUri=XO;function YO(e=!1){let t="/api/data/v9.0/SaveSettingValue()";return e?`${b.cdsServiceUrl}${t}`:t}b.getSavePowerSettingUri=YO;b.retrieveUnpublishedSuffix="Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()";function ZO(e){return`tools/systemcustomization/businessrules/businessRulesDesigner.aspx?BRlaunchpoint=BRGrid&appSolutionId={${e}}`}b.getBusinessRuleDesignerUri=ZO;function Jg({environmentInstanceUrl:e,entityLogicalName:t}){return e&&t?`${e}main.aspx?cmdbar=true&forceUCI=1&navbar=off&newWindow=true&pageType=entityRecord&etn=${t}`:void 0}b.getUCIEntityRecordBaseUrl=Jg;function eR({baseUrl:e,environmentInstanceUrl:t,entityLogicalName:r,recordId:n}){let i=e||Jg({environmentInstanceUrl:t,entityLogicalName:r});return i&&n?`${i}&id=${n}`:void 0}b.getUCIEntityRecordEditUrl=eR;b.retrieveOrganizationResources=`${b.cdsServiceUrl}api/data/v9.0/RetrieveOrganizationResources`});var Qg=v(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.DataverseClient=void 0;var tR=kc(),jn=re(),Bc=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}/${tR.xrmApiUrl}${n}`}async send(t,r){try{return await r()}catch(n){throw n instanceof jn.SdkError?n:new jn.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 jn.InvalidArgumentError(`Refusing to follow a malformed absolute URL: '${t}'`)}if(r.protocol!==n.protocol||r.host!==n.host)throw new jn.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"}get solutionName(){return this.solutionUniqueName}postBatch(t,r,n){if(!this.httpClient.postRaw)throw new jn.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)))}get supportsBinaryPatch(){return typeof this.httpClient.patchRaw=="function"}patchRaw(t,r,n){if(!this.httpClient.patchRaw)throw new jn.InvalidArgumentError("The injected HttpClient does not implement patchRaw(), required to upload file content (a Dataverse File column cannot be written through a JSON body)");let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.patchRaw(i,r,this.withSolution(n)))}put(t,r,n){if(!this.httpClient.put)throw new jn.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)))}};Os.DataverseClient=Bc});var Kg=v(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.findColumns=gn.findTables=gn.fetchEntityMetadataFromApi=void 0;var Uc=be(),vr=ie();function Qa(e){var t,r;return(r=(t=e?.UserLocalizedLabel)===null||t===void 0?void 0:t.Label)!==null&&r!==void 0?r:""}function Ci(e){let t=e?.LocalizedLabels;if(!Array.isArray(t)||t.length<2)return;let r={};for(let n of t)typeof n?.LanguageCode=="number"&&typeof n.Label=="string"&&(r[n.LanguageCode]=n.Label);return Object.keys(r).length?r:void 0}async function Si(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 hn(e){return`/EntityDefinitions(LogicalName='${(0,vr.odataPathLiteral)(e)}')`}async function rR(e,t,r){let n=await Si(e,`${hn(t)}/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata${(0,vr.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 nR(e,t,r){var n;let i=await Si(e,`${hn(t)}/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata${(0,vr.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:Qa(s.Label),...Ci(s.Label)?{localizedLabel:Ci(s.Label)}:{}}}))}}async function iR(e,t,r){let n=await Si(e,`${hn(t)}/Attributes/Microsoft.Dynamics.CRM.LookupAttributeMetadata${(0,vr.odataQuery)([["$select","LogicalName,Targets"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&i.Targets&&(a.targets=i.Targets)}}async function aR(e,t){var r,n,i,a;let o=[],s=await Si(e,`${hn(t)}/OneToManyRelationships${(0,vr.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 Si(e,`${hn(t)}/ManyToOneRelationships${(0,vr.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 Si(e,`${hn(t)}/ManyToManyRelationships${(0,vr.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 oR(e,t){var r,n,i,a,o;let s=`${hn(t)}`+(0,vr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,EntitySetName,IsCustomEntity,PrimaryNameAttribute,PrimaryIdAttribute"],["$expand","Attributes($select=LogicalName,DisplayName,AttributeType,IsCustomAttribute)"]]),u=(0,Uc.ensureSuccess)(await e.get(s),e.apiUrl(s)).body,c=((r=u.Attributes)!==null&&r!==void 0?r:[]).map(f=>{var h;return{logicalName:f.LogicalName,displayName:Qa(f.DisplayName),...Ci(f.DisplayName)?{localizedDisplayName:Ci(f.DisplayName)}:{},attributeType:(h=f.AttributeType)!==null&&h!==void 0?h:"Unknown",isCustomAttribute:!!f.IsCustomAttribute}}),d=new Map(c.map(f=>[f.logicalName,f])),[,,,p]=await Promise.all([rR(e,t,d),nR(e,t,d),iR(e,t,d),aR(e,t)]);return{logicalName:u.LogicalName,schemaName:(n=u.SchemaName)!==null&&n!==void 0?n:u.LogicalName,displayName:Qa(u.DisplayName),...Ci(u.DisplayName)?{localizedDisplayName:Ci(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:p}}gn.fetchEntityMetadataFromApi=oR;async function sR(e,t,r){var n,i;let a=`/EntityDefinitions${(0,vr.odataQuery)([["$select","LogicalName,SchemaName,EntitySetName,DisplayName,IsCustomEntity"]])}`,s=(i=(n=(0,Uc.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,p;return{logicalName:c.LogicalName,schemaName:(d=c.SchemaName)!==null&&d!==void 0?d:c.LogicalName,displayName:Qa(c.DisplayName),entitySetName:(p=c.EntitySetName)!==null&&p!==void 0?p:"",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}gn.findTables=sR;async function lR(e,t,r,n){var i,a;let o=`${hn(t)}/Attributes`+(0,vr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,AttributeType,IsCustomAttribute"]]),l=(a=(i=(0,Uc.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 p,f;return{logicalName:d.LogicalName,schemaName:(p=d.SchemaName)!==null&&p!==void 0?p:d.LogicalName,displayName:Qa(d.DisplayName),attributeType:(f=d.AttributeType)!==null&&f!==void 0?f:"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}gn.findColumns=lR});var Ei=v(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.DEFAULT_LCID=void 0;Rs.DEFAULT_LCID=1033});var ct=v(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.assignMissingIds=Ni.newId=void 0;function Xg(){return globalThis.crypto.randomUUID().toLowerCase()}Ni.newId=Xg;function uR(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var cR=new Set(["parameters","bag","expression","rawExpression","lookupValue","stepLabels"]);function dR(e){return $c(e),e}Ni.assignMissingIds=dR;function $c(e){if(Array.isArray(e)){e.forEach(t=>$c(t));return}if(uR(e)){(typeof e.id!="string"||e.id.length===0)&&(e.id=Xg());for(let t of Object.keys(e))t==="id"||cR.has(t)||$c(e[t])}}});var qc=v(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.postChangeSet=vn.parseChangeSetStatuses=vn.renderChangeSet=void 0;var Fs=re(),pR=be(),Yg=ct(),Zg=ie();function e0(e,t){let r=`batch_${(0,Yg.newId)()}`,n=`changeset_${(0,Yg.newId)()}`,i=t.map((s,l)=>String(l+1)),a=t.map((s,l)=>{let u=s.body===void 0?void 0:JSON.stringify(s.body);return(0,Zg.assertNoControlChars)(s.path,"batch operation path"),s.etag&&(0,Zg.assertNoControlChars)(s.etag,"batch operation etag"),[`--${n}`,"Content-Type: application/http","Content-Transfer-Encoding: binary",`Content-ID: ${i[l]}`,"",`${s.method} ${e.apiUrl(s.path)} HTTP/1.1`,...u===void 0?[]:["Content-Type: application/json;type=entry"],...e.solutionName?[`MSCRM.SolutionUniqueName: ${e.solutionName}`]:[],...s.etag?[`If-Match: ${s.etag}`]:[],"",...u===void 0?[]:[u]].join(`\r
+ &$filter=(applicationid eq '${e}')`;w.SPNPrincipalIdUrl=pR;function fR(){return"/api/data/v9.0/appmodules?$filter=(uniquename eq 'AppDeploymentConfiguration')"}w.retrieveDeploymentPipelineConfigAppUrl=fR;w.retrieveFeatureControlSettingsByNamespaceUrl="/api/data/v9.1/RetrieveFeatureControlSettingsByNamespace";function mR(e){return`/api/data/v9.0/settingdefinitions${e}`}w.getSettingDefinitionsUri=mR;w.OrgSettingOverrideName="organizationsettings";function hR(e,t=!1){let r=`/api/data/v9.0/${w.OrgSettingOverrideName}${e}`;return t?`${w.cdsServiceUrl}${r}`:r}w.getOrgSettingOverrideUri=hR;w.AppSettingOverrideName="appsettings";function gR(e,t=!1){let r=`/api/data/v9.0/${w.AppSettingOverrideName}${e}`;return t?`${w.cdsServiceUrl.replace("/$","")}${r}`:r}w.getAppSettingOverrideUri=gR;var ro;(function(e){e[e.All=0]="All",e[e.IsPlatformOnly=1]="IsPlatformOnly",e[e.NotPlatformOnly=2]="NotPlatformOnly"})(ro||(w.RetrievePlatform=ro={}));function vR(e,t,r,n=ro.All,i=!1){let a=[];e&&a.push(`AppUniqueName='${e}'`),t!=null&&a.push(`ReleaseLevel=${t}`),r&&a.push(`RetrieveHiddenSettings=${r}`),n!==ro.All&&a.push(`RetrievePlatformSettings=${n===ro.IsPlatformOnly?1:0}`);let o="/api/data/v9.0/RetrieveUnpublishedOverridableSettingsInfo";return a.length&&(o=`${o}(${a.join(",")})`),i?`${w.cdsServiceUrl}${o}`:o}w.getPowerSettingsUri=vR;function yR(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?`${w.cdsServiceUrl}${a}`:a}w.getPowerSettingUri=yR;function bR(e=!1){let t="/api/data/v9.0/SaveSettingValue()";return e?`${w.cdsServiceUrl}${t}`:t}w.getSavePowerSettingUri=bR;w.retrieveUnpublishedSuffix="Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()";function wR(e){return`tools/systemcustomization/businessrules/businessRulesDesigner.aspx?BRlaunchpoint=BRGrid&appSolutionId={${e}}`}w.getBusinessRuleDesignerUri=wR;function p0({environmentInstanceUrl:e,entityLogicalName:t}){return e&&t?`${e}main.aspx?cmdbar=true&forceUCI=1&navbar=off&newWindow=true&pageType=entityRecord&etn=${t}`:void 0}w.getUCIEntityRecordBaseUrl=p0;function AR({baseUrl:e,environmentInstanceUrl:t,entityLogicalName:r,recordId:n}){let i=e||p0({environmentInstanceUrl:t,entityLogicalName:r});return i&&n?`${i}&id=${n}`:void 0}w.getUCIEntityRecordEditUrl=AR;w.retrieveOrganizationResources=`${w.cdsServiceUrl}api/data/v9.0/RetrieveOrganizationResources`});var f0=v(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.DataverseClient=void 0;var CR=Wc(),ei=te(),jc=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}/${CR.xrmApiUrl}${n}`}async send(t,r){try{return await r()}catch(n){throw n instanceof ei.SdkError?n:new ei.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 ei.InvalidArgumentError(`Refusing to follow a malformed absolute URL: '${t}'`)}if(r.protocol!==n.protocol||r.host!==n.host)throw new ei.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"}get solutionName(){return this.solutionUniqueName}postBatch(t,r,n){if(!this.httpClient.postRaw)throw new ei.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)))}get supportsBinaryPatch(){return typeof this.httpClient.patchRaw=="function"}patchRaw(t,r,n){if(!this.httpClient.patchRaw)throw new ei.InvalidArgumentError("The injected HttpClient does not implement patchRaw(), required to upload file content (a Dataverse File column cannot be written through a JSON body)");let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.patchRaw(i,r,this.withSolution(n)))}put(t,r,n){if(!this.httpClient.put)throw new ei.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)))}};Us.DataverseClient=jc});var m0=v(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.findColumns=Sn.findTables=Sn.fetchEntityMetadataFromApi=void 0;var Jc=be(),Cr=ae();function io(e){var t,r;return(r=(t=e?.UserLocalizedLabel)===null||t===void 0?void 0:t.Label)!==null&&r!==void 0?r:""}function Pi(e){let t=e?.LocalizedLabels;if(!Array.isArray(t)||t.length<2)return;let r={};for(let n of t)typeof n?.LanguageCode=="number"&&typeof n.Label=="string"&&(r[n.LanguageCode]=n.Label);return Object.keys(r).length?r:void 0}async function Oi(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 En(e){return`/EntityDefinitions(LogicalName='${(0,Cr.odataPathLiteral)(e)}')`}async function ER(e,t,r){let n=await Oi(e,`${En(t)}/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata${(0,Cr.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 SR(e,t,r){var n;let i=await Oi(e,`${En(t)}/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata${(0,Cr.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:io(s.Label),...Pi(s.Label)?{localizedLabel:Pi(s.Label)}:{}}}))}}async function NR(e,t,r){let n=await Oi(e,`${En(t)}/Attributes/Microsoft.Dynamics.CRM.LookupAttributeMetadata${(0,Cr.odataQuery)([["$select","LogicalName,Targets"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&i.Targets&&(a.targets=i.Targets)}}async function DR(e,t){var r,n,i,a;let o=[],s=await Oi(e,`${En(t)}/OneToManyRelationships${(0,Cr.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 Oi(e,`${En(t)}/ManyToOneRelationships${(0,Cr.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 Oi(e,`${En(t)}/ManyToManyRelationships${(0,Cr.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 IR(e,t){var r,n,i,a,o;let s=`${En(t)}`+(0,Cr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,EntitySetName,IsCustomEntity,PrimaryNameAttribute,PrimaryIdAttribute"],["$expand","Attributes($select=LogicalName,DisplayName,AttributeType,IsCustomAttribute)"]]),u=(0,Jc.ensureSuccess)(await e.get(s),e.apiUrl(s)).body,c=((r=u.Attributes)!==null&&r!==void 0?r:[]).map(f=>{var m;return{logicalName:f.LogicalName,displayName:io(f.DisplayName),...Pi(f.DisplayName)?{localizedDisplayName:Pi(f.DisplayName)}:{},attributeType:(m=f.AttributeType)!==null&&m!==void 0?m:"Unknown",isCustomAttribute:!!f.IsCustomAttribute}}),d=new Map(c.map(f=>[f.logicalName,f])),[,,,p]=await Promise.all([ER(e,t,d),SR(e,t,d),NR(e,t,d),DR(e,t)]);return{logicalName:u.LogicalName,schemaName:(n=u.SchemaName)!==null&&n!==void 0?n:u.LogicalName,displayName:io(u.DisplayName),...Pi(u.DisplayName)?{localizedDisplayName:Pi(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:p}}Sn.fetchEntityMetadataFromApi=IR;async function _R(e,t,r){var n,i;let a=`/EntityDefinitions${(0,Cr.odataQuery)([["$select","LogicalName,SchemaName,EntitySetName,DisplayName,IsCustomEntity"]])}`,s=(i=(n=(0,Jc.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,p;return{logicalName:c.LogicalName,schemaName:(d=c.SchemaName)!==null&&d!==void 0?d:c.LogicalName,displayName:io(c.DisplayName),entitySetName:(p=c.EntitySetName)!==null&&p!==void 0?p:"",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}Sn.findTables=_R;async function TR(e,t,r,n){var i,a;let o=`${En(t)}/Attributes`+(0,Cr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,AttributeType,IsCustomAttribute"]]),l=(a=(i=(0,Jc.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 p,f;return{logicalName:d.LogicalName,schemaName:(p=d.SchemaName)!==null&&p!==void 0?p:d.LogicalName,displayName:io(d.DisplayName),attributeType:(f=d.AttributeType)!==null&&f!==void 0?f:"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}Sn.findColumns=TR});var Ri=v(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.DEFAULT_LCID=void 0;Bs.DEFAULT_LCID=1033});var pt=v(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.assignMissingIds=Fi.newId=void 0;function h0(){return globalThis.crypto.randomUUID().toLowerCase()}Fi.newId=h0;function PR(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var OR=new Set(["parameters","bag","expression","rawExpression","lookupValue","stepLabels"]);function RR(e){return Qc(e),e}Fi.assignMissingIds=RR;function Qc(e){if(Array.isArray(e)){e.forEach(t=>Qc(t));return}if(PR(e)){(typeof e.id!="string"||e.id.length===0)&&(e.id=h0());for(let t of Object.keys(e))t==="id"||OR.has(t)||Qc(e[t])}}});var Kc=v(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.postChangeSet=Nn.parseChangeSetStatuses=Nn.renderChangeSet=void 0;var $s=te(),FR=be(),g0=pt(),v0=ae();function y0(e,t){let r=`batch_${(0,g0.newId)()}`,n=`changeset_${(0,g0.newId)()}`,i=t.map((s,l)=>String(l+1)),a=t.map((s,l)=>{let u=s.body===void 0?void 0:JSON.stringify(s.body);return(0,v0.assertNoControlChars)(s.path,"batch operation path"),s.etag&&(0,v0.assertNoControlChars)(s.etag,"batch operation etag"),[`--${n}`,"Content-Type: application/http","Content-Transfer-Encoding: binary",`Content-ID: ${i[l]}`,"",`${s.method} ${e.apiUrl(s.path)} HTTP/1.1`,...u===void 0?[]:["Content-Type: application/json;type=entry"],...e.solutionName?[`MSCRM.SolutionUniqueName: ${e.solutionName}`]:[],...s.etag?[`If-Match: ${s.etag}`]:[],"",...u===void 0?[]:[u]].join(`\r
`)});return{body:[`--${r}`,`Content-Type: multipart/mixed;boundary=${n}`,"",...a,`--${n}--`,`--${r}--`,""].join(`\r
-`),batchId:r,contentIds:i}}vn.renderChangeSet=e0;function t0(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 p of l.slice(1)){if(p.startsWith("--"))break;let f=p.indexOf(`\r
+`),batchId:r,contentIds:i}}Nn.renderChangeSet=y0;function b0(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 p of l.slice(1)){if(p.startsWith("--"))break;let f=p.indexOf(`\r
\r
-`);if(f===-1)return;let h=p.slice(0,f),g=p.slice(f+4);if(!/^Content-Type:\s*application\/http\b/im.test(h))return;let w=/^HTTP\/1\.[01] (\d{3})\b/.exec(g);if(!w||((i=g.match(/^HTTP\/1\.[01] \d{3}\b/gm))!==null&&i!==void 0?i:[]).length!==1)return;let S=(a=/^Content-ID:\s*(\S+)/im.exec(h))===null||a===void 0?void 0:a[1];if(S===void 0||d.has(S)||!u.has(S))return;d.add(S),c.push(Number(w[1]))}return c.length===0?void 0:c}vn.parseChangeSetStatuses=t0;async function fR(e,t,r){if(t.length===0)return;let{body:n,batchId:i,contentIds:a}=e0(e,t),o=await e.postBatch(n,i),s=e.apiUrl("/$batch");if((0,pR.ensureSuccess)(o,s),typeof o.body!="string"||o.body.length===0)throw new Fs.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the $batch response had no readable body, so the change set's outcome is unknown`);let l=t0(o.body,a);if(l===void 0)throw new Fs.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the $batch response could not be parsed as a change set, so the outcome is unknown`);if(l.length!==t.length)throw new Fs.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the change set reported ${l.length} result(s) for ${t.length} operation(s)`);let u=l.find(c=>c<200||c>=300);if(u!==void 0)throw new Fs.ConnectionError(s,u,`atomic write of ${r} was rolled back: the change set reported HTTP ${u}`)}vn.postChangeSet=fR});var xs=v(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.updateTable=Q.deleteAlternateKey=Q.createAlternateKey=Q.deleteGlobalOptionSet=Q.createGlobalOptionSet=Q.deleteRelationship=Q.deleteColumn=Q.updateColumn=Q.deleteTable=Q.createRelationship=Q.insertStatusValue=Q.createCustomerColumn=Q.createColumns=Q.setColumnVisualization=Q.getColumnVisualization=Q.createColumn=Q.createTable=Q.resolveEntitySetName=Q.pluralFallback=void 0;var oe=be(),J=ie(),yr=Ei(),fe=re(),mR=qc(),hR={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"};function _e(e,t){return{"@odata.type":"Microsoft.Dynamics.CRM.Label",LocalizedLabels:gR(e,t)}}var r0=65535;function gR(e,t){let r=(a,o)=>({"@odata.type":"Microsoft.Dynamics.CRM.LocalizedLabel",Label:a,LanguageCode:o});if(typeof e=="string")return[r(e,t)];let n=Object.entries(e);if(!n.length)throw new fe.InvalidArgumentError("a localized label must contain at least one language");let i=new Set;return n.map(([a,o])=>{if(!/^[1-9]\d*$/.test(a))throw new fe.InvalidArgumentError(`localized label key '${a}' is not an LCID (expected a canonical positive integer, e.g. 1033)`);let s=Number(a);if(s>r0)throw new fe.InvalidArgumentError(`localized label LCID ${s} is out of range (1-${r0})`);if(i.has(s))throw new fe.InvalidArgumentError(`localized label LCID ${s} is specified more than once`);if(i.add(s),typeof o!="string")throw new fe.InvalidArgumentError(`localized label for LCID ${s} must be a string`);return r(o,s)})}function o0(e){return typeof e=="string"?`${e}s`:Object.fromEntries(Object.entries(e).map(([t,r])=>{if(typeof r!="string")throw new fe.InvalidArgumentError(`localized label for LCID ${t} must be a string`);return[t,`${r}s`]}))}Q.pluralFallback=o0;function Ka(e){return{Value:e,CanBeChanged:!0,ManagedPropertyLogicalName:"canmodifyrequirementlevelsettings"}}function zc(e){let t=e.indexOf("_");return t>0?e.slice(0,t):e}function n0(e,t,r){let n=e[t];n&&typeof n=="object"?n.Value=r:e[t]={Value:r}}function Xa(e){let t=(0,oe.readCreatedId)(e,"MetadataId");if(!t)throw new fe.InvalidArgumentError("Dataverse did not return a MetadataId for the created metadata component");return t}function vR(e,t,r){var n,i,a,o,s,l,u,c,d,p,f,h,g,w,S,D,x,F,G,L,q,U,$,W;if(t.defaultValue!==void 0&&e!=="boolean")throw new fe.InvalidArgumentError(`createColumn: 'defaultValue' applies to boolean columns, but '${t.schemaName}' is of type '${e}'.`);if(t.integerFormat!==void 0&&e!=="integer")throw new fe.InvalidArgumentError(`createColumn: 'integerFormat' applies to integer columns, but '${t.schemaName}' is of type '${e}'.`);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:(o=t.integerFormat)!==null&&o!==void 0?o:"None",MinValue:(s=t.minValue)!==null&&s!==void 0?s:-2147483648,MaxValue:(l=t.maxValue)!==null&&l!==void 0?l: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:(u=t.precision)!==null&&u!==void 0?u:2,MinValue:(c=t.minValue)!==null&&c!==void 0?c:-1e11,MaxValue:(d=t.maxValue)!==null&&d!==void 0?d: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:(f=t.minValue)!==null&&f!==void 0?f:-1e11,MaxValue:(h=t.maxValue)!==null&&h!==void 0?h:1e11};case"money":return{"@odata.type":"Microsoft.Dynamics.CRM.MoneyAttributeMetadata",AttributeType:"Money",AttributeTypeName:{Value:"MoneyType"},Precision:(g=t.precision)!==null&&g!==void 0?g:2,PrecisionSource:2,MinValue:(w=t.minValue)!==null&&w!==void 0?w:0,MaxValue:(S=t.maxValue)!==null&&S!==void 0?S:1e9};case"boolean":return{"@odata.type":"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",AttributeType:"Boolean",AttributeTypeName:{Value:"BooleanType"},DefaultValue:(D=t.defaultValue)!==null&&D!==void 0?D:!1,OptionSet:{"@odata.type":"Microsoft.Dynamics.CRM.BooleanOptionSetMetadata",TrueOption:{Value:1,Label:_e((x=t.trueLabel)!==null&&x!==void 0?x:"Yes",r)},FalseOption:{Value:0,Label:_e((F=t.falseLabel)!==null&&F!==void 0?F:"No",r)}}};case"dateTime":return{"@odata.type":"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",AttributeType:"DateTime",AttributeTypeName:{Value:"DateTimeType"},Format:(G=t.dateFormat)!==null&&G!==void 0?G:"DateAndTime"};case"choice":return i0(t,r,!1);case"multiChoice":return i0(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:(U=t.maxSizeKb)!==null&&U!==void 0?U:10240};case"autonumber":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},FormatName:{Value:"Text"},MaxLength:($=t.maxLength)!==null&&$!==void 0?$:100,AutoNumberFormat:(W=t.autoNumberFormat)!==null&&W!==void 0?W:""};default:throw new fe.InvalidArgumentError(`unsupported column type '${String(e)}'`)}}function i0(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,J.normalizeGuid)(e.globalChoiceMetadataId,"globalChoiceMetadataId")})`,i;if(!e.options||e.options.length===0)throw new fe.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:_e(a.label,t)}))},i}var Vc=new WeakMap;async function yR(e,t){var r,n;let i=(r=Vc.get(e))===null||r===void 0?void 0:r.get(t);if(i)return i;let a=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')${(0,J.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 fe.InvalidArgumentError(`could not resolve EntitySetName for '${t}'`);(0,J.assertODataName)(s,`server-derived EntitySetName for '${t}'`);let l=Vc.get(e);return l||(l=new Map,Vc.set(e,l)),l.set(t,s),s}Q.resolveEntitySetName=yR;async function bR(e,t){var r,n,i,a,o,s,l,u,c,d,p,f,h,g,w;let S=(r=t.languageCode)!==null&&r!==void 0?r:yr.DEFAULT_LCID,D=zc(t.schemaName),x=(n=t.primaryColumnSchemaName)!==null&&n!==void 0?n:`${D}_Name`,F={"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},SchemaName:x,RequiredLevel:Ka("None"),MaxLength:(i=t.primaryColumnMaxLength)!==null&&i!==void 0?i:100,FormatName:{Value:"Text"},DisplayName:_e((a=t.primaryColumnDisplayName)!==null&&a!==void 0?a:"Name",S),IsPrimaryName:!0};t.primaryColumnAutoNumberFormat&&(F.AutoNumberFormat=t.primaryColumnAutoNumberFormat),t.columns&&u0(t.columns,"createTable");let G={"@odata.type":"Microsoft.Dynamics.CRM.EntityMetadata",SchemaName:t.schemaName,DisplayName:_e(t.displayName,S),DisplayCollectionName:_e((o=t.pluralName)!==null&&o!==void 0?o:o0(t.displayName),S),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:[F,...((c=t.columns)!==null&&c!==void 0?c:[]).map(pe=>Wc(pe,S))]};t.description&&(G.Description=_e(t.description,S));let L="/EntityDefinitions",q=(0,oe.ensureSuccess)(await e.post(L,G),e.apiUrl(L)),U=Xa(q),$=`/EntityDefinitions(${U})`+(0,J.odataQuery)([["$select","LogicalName,EntitySetName,PrimaryIdAttribute,PrimaryNameAttribute"]]),W=Math.max(1,Math.trunc((d=t.readBackAttempts)!==null&&d!==void 0?d:6)),B=Math.max(0,(p=t.readBackDelayMs)!==null&&p!==void 0?p:1e3),Qe;for(let pe=1;pe<=W;pe+=1){let Ke=await e.get($);if(Ke.status>=200&&Ke.status<300){Qe=Ke;break}Ke.status!==404&&(0,oe.ensureSuccess)(Ke,e.apiUrl($)),pe<W&&B>0&&await new Promise(Z=>setTimeout(Z,B))}if(!Qe)throw new fe.SdkError("TABLE_METADATA_NOT_VISIBLE",`Table '${t.schemaName}' WAS CREATED (MetadataId ${U}) but its metadata was still not readable after ${W} attempt(s). Do NOT re-run the create \u2014 it will collide on the schema name. Re-read /EntityDefinitions(${U}) once the environment catches up, or raise 'readBackAttempts'.`);let vt=Qe.body;return{logicalName:(f=vt.LogicalName)!==null&&f!==void 0?f:t.schemaName.toLowerCase(),metadataId:U,entitySetName:(h=vt.EntitySetName)!==null&&h!==void 0?h:"",primaryIdAttribute:(g=vt.PrimaryIdAttribute)!==null&&g!==void 0?g:`${t.schemaName.toLowerCase()}id`,primaryNameAttribute:(w=vt.PrimaryNameAttribute)!==null&&w!==void 0?w:x.toLowerCase()}}Q.createTable=bR;function Wc(e,t){var r,n;let i=(r=e.languageCode)!==null&&r!==void 0?r:t,a={...vR(e.type,e,i),SchemaName:e.schemaName,RequiredLevel:Ka((n=e.required)!==null&&n!==void 0?n:"None"),DisplayName:_e(e.displayName,i)};return e.description&&(a.Description=_e(e.description,i)),e.sourceType&&e.sourceType!=="Simple"&&(a.SourceType=e.sourceType==="Rollup"?2:1,e.formulaDefinition&&(a.FormulaDefinition=e.formulaDefinition)),s0(a,e),a}function s0(e,t){t.isValidForCreate!==void 0&&(e.IsValidForCreate=t.isValidForCreate),t.isValidForUpdate!==void 0&&(e.IsValidForUpdate=t.isValidForUpdate),t.isValidForRead!==void 0&&(e.IsValidForRead=t.isValidForRead)}async function wR(e,t,r){var n;let i=Wc(r,(n=r.languageCode)!==null&&n!==void 0?n:yr.DEFAULT_LCID),a=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes`,o=(0,oe.ensureSuccess)(await e.post(a,i),e.apiUrl(a)),s={logicalName:r.schemaName.toLowerCase(),metadataId:Xa(o)};if(r.visualization&&r.visualization!=="None")try{await p0(e,t,s.logicalName,s.metadataId,r.visualization)}catch(l){let u=new fe.SdkError("COLUMN_VISUALIZATION_BIND_FAILED",`Column '${s.logicalName}' on '${t}' was created, but binding its '${r.visualization}' grid visualization failed; the column exists WITHOUT a visualization. Retry with setColumnVisualization('${t}', '${s.logicalName}', '${r.visualization}'). Cause: ${l instanceof Error?l.message:String(l)}`);throw u.cause=l,u}return s}Q.createColumn=wR;var Di="/controlconfigurations",l0="CustomRenderersConfiguration",Gc={RadialDial:"c3d4e5f6-a7b8-9012-cdef-345678901234",LineChart:"a1b2c3d4-e5f6-7890-abcd-ef1234567890",HeatMap:"e7f8a9b0-c1d2-4e3f-5a6b-7c8d9e0f1a2b",StarRating:"b5e4c3d2-f1a0-4e2b-8a7c-9d3f5c1e6b04"};function u0(e,t){let r=e.find(n=>n.visualization&&n.visualization!=="None");if(r)throw new fe.InvalidArgumentError(`${t}: setting 'visualization' on an inline column ('${r.schemaName}') is not supported \u2014 the attribute metadata and its control-configuration row are separate writes. Create the column, then call setColumnVisualization; or use the single-column createColumn.`)}function c0(e){return JSON.stringify({type:Gc[e]})}function AR(e){if(!e)return"None";let t;try{t=JSON.parse(e)}catch{return"None"}let r=t?.type,n=Object.keys(Gc).find(i=>Gc[i]===r);return n??"None"}async function d0(e,t,r){var n,i;let a=`entitylogicalname eq '${(0,J.odataLiteral)(t)}' and Attribute/logicalname eq '${(0,J.odataLiteral)(r)}'`,o=`${Di}${(0,J.odataQuery)([["$select","name,uniquename,metadatajson"],["$expand","Attribute($select=name,logicalname)"],["$filter",a]])}`,l=(i=(n=(0,oe.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[],u=r.toLowerCase();return l.filter(c=>{var d,p;return((p=(d=c.Attribute)===null||d===void 0?void 0:d.logicalname)===null||p===void 0?void 0:p.toLowerCase())===u})}async function CR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes(LogicalName='${(0,J.odataPathLiteral)(r)}')${(0,J.odataQuery)([["$select","MetadataId"]])}`,o=(n=(0,oe.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||n===void 0?void 0:n.MetadataId;if(!o)throw new fe.InvalidArgumentError(`cannot resolve column '${r}' on '${t}' to set its visualization`);return(0,J.normalizeGuid)(o,"MetadataId")}async function p0(e,t,r,n,i){let a={name:l0,uniquename:`msdyn_${t}_${r}_customrenderers`,metadatajson:c0(i),"[email protected]":`/attributes(${(0,J.normalizeGuid)(n,"MetadataId")})`,entitylogicalname:t};(0,oe.ensureSuccess)(await e.post(Di,a),e.apiUrl(Di))}async function SR(e,t,r){var n;let i=await d0(e,t,r);return AR((n=i[0])===null||n===void 0?void 0:n.metadatajson)}Q.getColumnVisualization=SR;async function ER(e,t,r,n){let a=(await d0(e,t,r)).map(u=>u.controlconfigurationid).filter(u=>!!u);if(n==="None"){for(let u of a){let c=`${Di}(${(0,J.normalizeGuid)(u,"controlconfigurationid")})`;(0,oe.ensureSuccess)(await e.delete(c),e.apiUrl(c))}return}let[o,...s]=a,l=await CR(e,t,r);if(o){let u=`${Di}(${(0,J.normalizeGuid)(o,"controlconfigurationid")})`,c={name:l0,metadatajson:c0(n),"[email protected]":`/attributes(${l})`,entitylogicalname:t};(0,oe.ensureSuccess)(await e.patch(u,c),e.apiUrl(u))}else await p0(e,t,r,l,n);for(let u of s){let c=`${Di}(${(0,J.normalizeGuid)(u,"controlconfigurationid")})`;(0,oe.ensureSuccess)(await e.delete(c),e.apiUrl(c))}}Q.setColumnVisualization=ER;async function NR(e,t,r){if(r.length===0)return;if(u0(r,"createColumns"),!e.supportsAtomicBatch)throw new fe.InvalidArgumentError(`createColumns writes ${r.length} columns on '${t}' as ONE atomic change set, which needs a verbatim request body. Implement HttpClient.postRaw, or call createColumn per column and accept that a failure can leave the table partly extended.`);let n=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes`;await(0,mR.postChangeSet)(e,r.map(i=>{var a;return{method:"POST",path:n,body:Wc(i,(a=i.languageCode)!==null&&a!==void 0?a:yr.DEFAULT_LCID)}}),`${r.length} column(s) on '${t}'`)}Q.createColumns=NR;async function DR(e,t,r){var n,i,a,o;let s=(n=r.languageCode)!==null&&n!==void 0?n:yr.DEFAULT_LCID,l=zc(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:_e(r.displayName,s),RequiredLevel:Ka((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:""}}Q.createCustomerColumn=DR;async function IR(e,t,r){var n,i,a,o,s;let l=(n=r.languageCode)!==null&&n!==void 0?n:yr.DEFAULT_LCID,u={EntityLogicalName:t,AttributeLogicalName:"statuscode",Label:_e(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)}Q.insertStatusValue=IR;async function _R(e,t){var r,n,i,a,o;let s=(r=t.languageCode)!==null&&r!==void 0?r:yr.DEFAULT_LCID,l,u;if(t.type==="OneToMany"){if(!t.referencedEntity||!t.referencingEntity)throw new fe.InvalidArgumentError("OneToMany relationship requires referencedEntity and referencingEntity");let p=(n=t.lookupSchemaName)!==null&&n!==void 0?n:`${zc(t.schemaName)}_${t.referencedEntity}Id`;u=p.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:p,RequiredLevel:Ka((i=t.lookupRequired)!==null&&i!==void 0?i:"None"),DisplayName:_e((a=t.lookupDisplayName)!==null&&a!==void 0?a:t.referencedEntity,s)}}}else{if(!t.entity1||!t.entity2)throw new fe.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:Xa(d),lookupLogicalName:u}}Q.createRelationship=_R;async function TR(e,t){let r=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')`;(0,oe.ensureSuccess)(await e.delete(r),e.apiUrl(r))}Q.deleteTable=TR;async function PR(e,t,r,n){var i,a;let o=(i=n.languageCode)!==null&&i!==void 0?i:yr.DEFAULT_LCID,s=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes`,l=`${s}(LogicalName='${(0,J.odataPathLiteral)(r)}')${(0,J.odataQuery)([["$select","MetadataId,AttributeType"]])}`,c=(0,oe.ensureSuccess)(await e.get(l),e.apiUrl(l)).body,d=hR[(a=c.AttributeType)!==null&&a!==void 0?a:""];if(!c.MetadataId||!d)throw new fe.InvalidArgumentError(`cannot update column '${r}' on '${t}' (type '${c.AttributeType}' not supported)`);let p=(0,J.normalizeGuid)(c.MetadataId,"MetadataId"),f=`${s}(${p})/${d}`,h=(0,oe.ensureSuccess)(await e.get(f),e.apiUrl(f)).body;for(let w of Object.keys(h))w.startsWith("@odata.")&&delete h[w];if(h["@odata.type"]=d,n.displayName!==void 0&&(h.DisplayName=_e(n.displayName,o)),n.description!==void 0&&(h.Description=_e(n.description,o)),n.required!==void 0&&(h.RequiredLevel=Ka(n.required)),n.maxLength!==void 0&&(h.MaxLength=n.maxLength),n.autoNumberFormat!==void 0&&(h.AutoNumberFormat=n.autoNumberFormat),n.defaultValue!==void 0&&c.AttributeType!=="Boolean")throw new fe.InvalidArgumentError(`updateColumn: 'defaultValue' applies to Boolean columns, but '${r}' on '${t}' is of type '${c.AttributeType}'.`);if(n.integerFormat!==void 0&&c.AttributeType!=="Integer")throw new fe.InvalidArgumentError(`updateColumn: 'integerFormat' applies to Integer columns, but '${r}' on '${t}' is of type '${c.AttributeType}'.`);n.defaultValue!==void 0&&(h.DefaultValue=n.defaultValue),n.integerFormat!==void 0&&(h.Format=n.integerFormat),s0(h,n);let g=`${s}(${p})`;(0,oe.ensureSuccess)(await e.put(g,h,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(g))}Q.updateColumn=PR;async function OR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes`,a=`${i}(LogicalName='${(0,J.odataPathLiteral)(r)}')${(0,J.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 fe.InvalidArgumentError(`column '${r}' not found on '${t}'`);let l=`${i}(${(0,J.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteColumn=OR;async function RR(e,t){var r,n,i;let a=`/RelationshipDefinitions${(0,J.odataQuery)([["$filter",`SchemaName eq '${(0,J.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 fe.InvalidArgumentError(`relationship '${t}' not found`);let l=`/RelationshipDefinitions(${(0,J.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteRelationship=RR;async function a0(e,t){var r;let n=`/GlobalOptionSetDefinitions(Name='${(0,J.odataPathLiteral)(t)}')${(0,J.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,J.normalizeGuid)(o,"MetadataId"):void 0}async function FR(e,t){var r;let n=t.name.toLowerCase(),i=await a0(e,n);if(i)return{name:n,metadataId:i};let a=(r=t.languageCode)!==null&&r!==void 0?r:yr.DEFAULT_LCID,o={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",Name:n,DisplayName:_e(t.displayName,a),IsGlobal:!0,OptionSetType:"Picklist",Options:t.options.map(l=>({Value:l.value,Label:_e(l.label,a)}))};t.description&&(o.Description=_e(t.description,a));let s="/GlobalOptionSetDefinitions";try{let l=(0,oe.ensureSuccess)(await e.post(s,o),e.apiUrl(s));return{name:n,metadataId:Xa(l)}}catch(l){let u;try{u=await a0(e,n)}catch{u=void 0}if(u)return{name:n,metadataId:u};throw l}}Q.createGlobalOptionSet=FR;async function xR(e,t){let r=`/GlobalOptionSetDefinitions(Name='${(0,J.odataPathLiteral)(t.toLowerCase())}')`;(0,oe.ensureSuccess)(await e.delete(r),e.apiUrl(r))}Q.deleteGlobalOptionSet=xR;async function LR(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:yr.DEFAULT_LCID,a={"@odata.type":"Microsoft.Dynamics.CRM.EntityKeyMetadata",SchemaName:r.schemaName,DisplayName:_e(r.displayName,i),KeyAttributes:r.keyAttributes},o=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Keys`,s=(0,oe.ensureSuccess)(await e.post(o,a),e.apiUrl(o));return{logicalName:r.schemaName.toLowerCase(),metadataId:Xa(s)}}Q.createAlternateKey=LR;async function kR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Keys`,a=`${i}(LogicalName='${(0,J.odataPathLiteral)(r.toLowerCase())}')${(0,J.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 fe.InvalidArgumentError(`alternate key '${r}' not found on '${t}'`);let l=`${i}(${(0,J.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteAlternateKey=kR;async function MR(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:yr.DEFAULT_LCID,a=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')`,s=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body,l=s.MetadataId;if(!l)throw new fe.InvalidArgumentError(`table '${t}' not found`);let u=(0,J.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=_e(r.displayName,i)),r.pluralName!==void 0&&(s.DisplayCollectionName=_e(r.pluralName,i)),r.description!==void 0&&(s.Description=_e(r.description,i)),r.auditEnabled!==void 0&&n0(s,"IsAuditEnabled",r.auditEnabled),r.duplicateDetectionEnabled!==void 0&&n0(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))}Q.updateTable=MR});var bn=v(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.rebuildRaw=bt.assembleChildren=bt.spliceChildren=bt.mergeAttrs=bt.rawFromNode=bt.emptyBag=void 0;var yn=re(),f0=1e6,ks=512;function BR(){return{a:[],c:[]}}bt.emptyBag=BR;function m0(e,t=0){if(t>ks)throw new yn.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=>m0(r,t+1))}}bt.rawFromNode=m0;function UR(e,t,r=[]){let n=new Map;for(let[s,l]of t)n.set(s,l);let i=new Set(r.filter(s=>!n.has(s))),a=new Set,o=[];for(let[s,l]of e)i.has(s)||(n.has(s)?o.push([s,n.get(s)]):o.push([s,l]),a.add(s));for(let[s,l]of t)a.has(s)||(o.push([s,l]),a.add(s));return o}bt.mergeAttrs=UR;function Ls(e,t){let r=new Set;for(let s of e){let l=s.i;if(!Number.isInteger(l)||l<0||l>f0)throw new yn.InvalidArgumentError(`Bag child index must be an integer in [0, ${f0}] (got ${String(l)})`);if(r.has(l))throw new yn.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}bt.spliceChildren=Ls;function $R(e,t){if(e.w){let r={n:e.w.n,a:e.w.a.map(n=>[n[0],n[1]]),c:Ls(e.w.c,t)};return Ls(e.c,[r])}return Ls(e.c,t)}bt.assembleChildren=$R;function h0(e,t,r,n=0){if(n>ks)throw new yn.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${ks}`);qR(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,h0(a,t,i,n+1));return i}bt.rebuildRaw=h0;function qR(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new yn.InvalidArgumentError(`Malformed hybrid node at depth ${t}: expected a JSON object`);let r=e;if(typeof r.n!="string")throw new yn.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 yn.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 yn.InvalidArgumentError(`Malformed hybrid node '${r.n}': each attribute must be a [string, string] pair`)}});var Ya=v(Ii=>{"use strict";function VR(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 Hc(e,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(e):e}function GR(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 g0=Hc({HTML:"text/html",isHTML:function(e){return e===g0.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),v0=Hc({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===v0.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Ii.assign=GR;Ii.find=VR;Ii.freeze=Hc;Ii.MIME_TYPE=g0;Ii.NAMESPACE=v0});var id=v(Hr=>{var N0=Ya(),br=N0.find,Za=N0.NAMESPACE;function zR(e){return e!==""}function WR(e){return e?e.split(/[\t\n\f\r ]+/).filter(zR):[]}function HR(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function y0(e){if(!e)return[];var t=WR(e);return Object.keys(t.reduce(HR,{}))}function jR(e){return function(t){return e&&e.indexOf(t)!==-1}}function to(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function At(e,t){var r=e.prototype;if(!(r instanceof t)){let i=function(){};var n=i;i.prototype=t.prototype,i=new i,to(r,i),e.prototype=r=i}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var Ct={},qt=Ct.ELEMENT_NODE=1,Ti=Ct.ATTRIBUTE_NODE=2,Bs=Ct.TEXT_NODE=3,D0=Ct.CDATA_SECTION_NODE=4,I0=Ct.ENTITY_REFERENCE_NODE=5,JR=Ct.ENTITY_NODE=6,jc=Ct.PROCESSING_INSTRUCTION_NODE=7,Jc=Ct.COMMENT_NODE=8,_0=Ct.DOCUMENT_NODE=9,T0=Ct.DOCUMENT_TYPE_NODE=10,Gr=Ct.DOCUMENT_FRAGMENT_NODE=11,QR=Ct.NOTATION_NODE=12,et={},qe={},Tz=et.INDEX_SIZE_ERR=(qe[1]="Index size error",1),Pz=et.DOMSTRING_SIZE_ERR=(qe[2]="DOMString size error",2),wt=et.HIERARCHY_REQUEST_ERR=(qe[3]="Hierarchy request error",3),Oz=et.WRONG_DOCUMENT_ERR=(qe[4]="Wrong document",4),KR=et.INVALID_CHARACTER_ERR=(qe[5]="Invalid character",5),Rz=et.NO_DATA_ALLOWED_ERR=(qe[6]="No data allowed",6),Fz=et.NO_MODIFICATION_ALLOWED_ERR=(qe[7]="No modification allowed",7),P0=et.NOT_FOUND_ERR=(qe[8]="Not found",8),xz=et.NOT_SUPPORTED_ERR=(qe[9]="Not supported",9),b0=et.INUSE_ATTRIBUTE_ERR=(qe[10]="Attribute in use",10),_i=et.INVALID_STATE_ERR=(qe[11]="Invalid state",11),Lz=et.SYNTAX_ERR=(qe[12]="Syntax error",12),kz=et.INVALID_MODIFICATION_ERR=(qe[13]="Invalid modification",13),Mz=et.NAMESPACE_ERR=(qe[14]="Invalid namespace",14),Bz=et.INVALID_ACCESS_ERR=(qe[15]="Invalid access",15);function de(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,qe[e]),this.message=qe[e],Error.captureStackTrace&&Error.captureStackTrace(this,de);return r.code=e,t&&(this.message=this.message+": "+t),r}de.prototype=Error.prototype;to(et,de);function zr(){}zr.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++)nd(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 Pi(e,t){this._node=e,this._refresh=t,Qc(this)}function Qc(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(V0(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];to(r,e),e._inc=t}}Pi.prototype.item=function(e){return Qc(this),this[e]||null};At(Pi,zr);function Us(){}function O0(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function w0(e,t,r,n){if(n?t[O0(t,n)]=r:t[t.length++]=r,e){r.ownerElement=e;var i=e.ownerDocument;i&&(n&&x0(i,e,n),XR(i,e,r))}}function A0(e,t,r){var n=O0(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&&(x0(a,e,r),r.ownerElement=null)}}else throw new de(P0,new Error(e.tagName+"@"+r))}Us.prototype={length:0,item:zr.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 de(b0);var r=this.getNamedItem(e.nodeName);return w0(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t=e.ownerElement,r;if(t&&t!=this._ownerElement)throw new de(b0);return r=this.getNamedItemNS(e.namespaceURI,e.localName),w0(this._ownerElement,this,e,r),r},removeNamedItem:function(e){var t=this.getNamedItem(e);return A0(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return A0(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 R0(){}R0.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new ro;if(n.implementation=this,n.childNodes=new zr,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 Gs;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n}};function ue(){}ue.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 qs(this,e,t)},replaceChild:function(e,t){qs(this,e,t,k0),t&&this.removeChild(t)},removeChild:function(e){return L0(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return q0(this.ownerDocument||this,this,e)},normalize:function(){$e(this,null,{enter:function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;r!==null&&r.nodeType===Bs&&t.nodeType===Bs?(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==Ti?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==Ti?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return t==null}};function F0(e){return e=="<"&&"&lt;"||e==">"&&"&gt;"||e=="&"&&"&amp;"||e=='"'&&"&quot;"||"&#"+e.charCodeAt()+";"}to(Ct,ue);to(Ct,ue.prototype);function $s(e,t){return $e(e,null,{enter:function(r){return t(r)?$e.STOP:!0}})===$e.STOP}function $e(e,t,r){for(var n=[{node:e,context:t,phase:$e.ENTER}];n.length>0;){var i=n.pop();if(i.phase===$e.ENTER){var a=r.enter(i.node,i.context);if(a===$e.STOP)return $e.STOP;if(n.push({node:i.node,context:a,phase:$e.EXIT}),a==null)continue;for(var o=i.node.lastChild;o;)n.push({node:o,context:a,phase:$e.ENTER}),o=o.previousSibling}else r.exit&&r.exit(i.node,i.context)}}$e.STOP=Symbol("walkDOM.STOP");$e.ENTER=0;$e.EXIT=1;function ro(){this.ownerDocument=this}function XR(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===Za.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function x0(e,t,r,n){e&&e._inc++;var i=r.namespaceURI;i===Za.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function Kc(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 L0(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,Kc(e.ownerDocument,e),t}function YR(e){return e&&(e.nodeType===ue.DOCUMENT_NODE||e.nodeType===ue.DOCUMENT_FRAGMENT_NODE||e.nodeType===ue.ELEMENT_NODE)}function ZR(e){return e&&(wr(e)||Xc(e)||Wr(e)||e.nodeType===ue.DOCUMENT_FRAGMENT_NODE||e.nodeType===ue.COMMENT_NODE||e.nodeType===ue.PROCESSING_INSTRUCTION_NODE)}function Wr(e){return e&&e.nodeType===ue.DOCUMENT_TYPE_NODE}function wr(e){return e&&e.nodeType===ue.ELEMENT_NODE}function Xc(e){return e&&e.nodeType===ue.TEXT_NODE}function C0(e,t){var r=e.childNodes||[];if(br(r,wr)||Wr(t))return!1;var n=br(r,Wr);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function S0(e,t){var r=e.childNodes||[];function n(a){return wr(a)&&a!==t}if(br(r,n))return!1;var i=br(r,Wr);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function eF(e,t,r){if(!YR(e))throw new de(wt,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new de(P0,"child not in parent");if(!ZR(t)||Wr(t)&&e.nodeType!==ue.DOCUMENT_NODE)throw new de(wt,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function tF(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===ue.DOCUMENT_FRAGMENT_NODE){var a=i.filter(wr);if(a.length>1||br(i,Xc))throw new de(wt,"More than one element or text in fragment");if(a.length===1&&!C0(e,r))throw new de(wt,"Element in fragment can not be inserted before doctype")}if(wr(t)&&!C0(e,r))throw new de(wt,"Only one element can be added and only after doctype");if(Wr(t)){if(br(n,Wr))throw new de(wt,"Only one doctype is allowed");var o=br(n,wr);if(r&&n.indexOf(o)<n.indexOf(r))throw new de(wt,"Doctype can only be inserted before an element");if(!r&&o)throw new de(wt,"Doctype can not be appended since element is present")}}function k0(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===ue.DOCUMENT_FRAGMENT_NODE){var a=i.filter(wr);if(a.length>1||br(i,Xc))throw new de(wt,"More than one element or text in fragment");if(a.length===1&&!S0(e,r))throw new de(wt,"Element in fragment can not be inserted before doctype")}if(wr(t)&&!S0(e,r))throw new de(wt,"Only one element can be added and only after doctype");if(Wr(t)){let l=function(u){return Wr(u)&&u!==r};var s=l;if(br(n,l))throw new de(wt,"Only one doctype is allowed");var o=br(n,wr);if(r&&n.indexOf(o)<n.indexOf(r))throw new de(wt,"Doctype can only be inserted before an element")}}function qs(e,t,r,n){eF(e,t,r),e.nodeType===ue.DOCUMENT_NODE&&(n||tF)(e,t,r);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===Gr){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;eo(a,l)}while(a!==o&&(a=a.nextSibling));return Kc(e.ownerDocument||e,e),t.nodeType==Gr&&(t.firstChild=t.lastChild=null),t}function eo(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===qt&&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;)eo(i,t),i=i.nextSibling}}function rF(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,Kc(e.ownerDocument,e,t);var r=e.ownerDocument||e;return eo(t,r),t}ro.prototype={nodeName:"#document",nodeType:_0,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==Gr){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return qs(this,e,t),eo(e,this),this.documentElement===null&&e.nodeType===qt&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),L0(this,e)},replaceChild:function(e,t){qs(this,e,t,k0),eo(e,this),t&&this.removeChild(t),wr(e)&&(this.documentElement=e)},importNode:function(e,t){return nF(this,e,t)},getElementById:function(e){var t=null;return $s(this.documentElement,function(r){if(r.nodeType==qt&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=y0(e);return new Pi(this,function(r){var n=[];return t.length>0&&$s(r.documentElement,function(i){if(i!==r&&i.nodeType===qt){var a=i.getAttribute("class");if(a){var o=e===a;if(!o){var s=y0(a);o=t.every(jR(s))}o&&n.push(i)}}}),n})},createElement:function(e){var t=new Jn;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new zr;var r=t.attributes=new Us;return r._ownerElement=t,t},createDocumentFragment:function(){var e=new zs;return e.ownerDocument=this,e.childNodes=new zr,e},createTextNode:function(e){var t=new Yc;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Zc;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new de(KR,'data contains "]]>"');var t=new ed;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new rd;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new Vs;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new td;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Jn,n=t.split(":"),i=r.attributes=new Us;return r.childNodes=new zr,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 Vs,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}};At(ro,ue);function Jn(){this._nsMap={}}Jn.prototype={nodeType:qt,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===Gr?this.insertBefore(e,null):rF(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 Pi(this,function(t){var r=[];return $s(t,function(n){n!==t&&n.nodeType==qt&&(e==="*"||n.tagName==e)&&r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new Pi(this,function(r){var n=[];return $s(r,function(i){i!==r&&i.nodeType===qt&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};ro.prototype.getElementsByTagName=Jn.prototype.getElementsByTagName;ro.prototype.getElementsByTagNameNS=Jn.prototype.getElementsByTagNameNS;At(Jn,ue);function Vs(){}Vs.prototype.nodeType=Ti;At(Vs,ue);function no(){}no.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(qe[wt])},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}};At(no,ue);function Yc(){}Yc.prototype={nodeName:"#text",nodeType:Bs,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}};At(Yc,no);function Zc(){}Zc.prototype={nodeName:"#comment",nodeType:Jc};At(Zc,no);function ed(){}ed.prototype={nodeName:"#cdata-section",nodeType:D0};At(ed,no);function Gs(){}Gs.prototype.nodeType=T0;At(Gs,ue);function M0(){}M0.prototype.nodeType=QR;At(M0,ue);function B0(){}B0.prototype.nodeType=JR;At(B0,ue);function td(){}td.prototype.nodeType=I0;At(td,ue);function zs(){}zs.prototype.nodeName="#document-fragment";zs.prototype.nodeType=Gr;At(zs,ue);function rd(){}rd.prototype.nodeType=jc;At(rd,ue);function U0(){}U0.prototype.serializeToString=function(e,t,r,n){return $0.call(e,t,r,n)};ue.prototype.toString=$0;function $0(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 nd(this,i,e,t,l,n),i.join("")}function E0(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!i||n==="xml"&&i===Za.XML||i===Za.XMLNS)return!1;for(var a=r.length;a--;){var o=r[a];if(o.prefix===n)return o.namespace!==i}return!0}function Ms(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,F0),'"')}function nd(e,t,r,n,i,a){i||(i=[]),$e(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 qt:var c=o.attributes,d=c.length,p=o.tagName;u=Za.isHTML(o.namespaceURI)||u;var f=p;if(!u&&!o.prefix&&o.namespaceURI){for(var h,g=0;g<c.length;g++)if(c.item(g).name==="xmlns"){h=c.item(g).value;break}if(!h)for(var w=l.length-1;w>=0;w--){var S=l[w];if(S.prefix===""&&S.namespace===o.namespaceURI){h=S.namespace;break}}if(h!==o.namespaceURI)for(var w=l.length-1;w>=0;w--){var S=l[w];if(S.namespace===o.namespaceURI){S.prefix&&(f=S.prefix+":"+p);break}}}t.push("<",f);for(var D=l.slice(),x=0;x<d;x++){var F=c.item(x);F.prefix=="xmlns"?D.push({prefix:F.localName,namespace:F.value}):F.nodeName=="xmlns"&&D.push({prefix:"",namespace:F.value})}for(var x=0;x<d;x++){var F=c.item(x);if(E0(F,u,D)){var G=F.prefix||"",L=F.namespaceURI;Ms(t,G?"xmlns:"+G:"xmlns",L),D.push({prefix:G,namespace:L})}var q=n?n(F):F;q&&(typeof q=="string"?t.push(q):Ms(t,q.name,q.value))}if(p===f&&E0(o,u,D)){var U=o.prefix||"",L=o.namespaceURI;Ms(t,U?"xmlns:"+U:"xmlns",L),D.push({prefix:U,namespace:L})}var $=o.firstChild;if($||u&&!/^(?:meta|link|img|br|hr|input)$/i.test(p)){if(t.push(">"),u&&/^script$/i.test(p)){for(;$;)$.data?t.push($.data):nd($,t,u,n,D.slice(),a),$=$.nextSibling;return t.push("</",p,">"),null}return{ns:D,isHTML:u,tag:f}}else return t.push("/>"),null;case _0:case Gr:return{ns:l.slice(),isHTML:u,tag:null};case Ti:return Ms(t,o.name,o.value),null;case Bs:return t.push(o.data.replace(/[<&>]/g,F0)),null;case D0:if(a&&o.data.indexOf("]]>")!==-1)throw new de(_i,'The CDATASection data contains "]]>"');return t.push("<![CDATA[",o.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case Jc:if(a&&o.data.indexOf("-->")!==-1)throw new de(_i,'The comment node data contains "-->"');return t.push("<!--",o.data,"-->"),null;case T0:if(a){if(o.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(o.publicId))throw new de(_i,"DocumentType publicId is not a valid PubidLiteral");if(o.systemId&&!/^("[^"]*"|'[^']*')$/.test(o.systemId))throw new de(_i,"DocumentType systemId is not a valid SystemLiteral");if(o.internalSubset&&o.internalSubset.indexOf("]>")!==-1)throw new de(_i,'DocumentType internalSubset contains "]>"')}var W=o.publicId,B=o.systemId;if(t.push("<!DOCTYPE ",o.name),W)t.push(" PUBLIC ",W),B&&B!="."&&t.push(" ",B),t.push(">");else if(B&&B!=".")t.push(" SYSTEM ",B,">");else{var Qe=o.internalSubset;Qe&&t.push(" [",Qe,"]"),t.push(">")}return null;case jc:if(a&&o.data.indexOf("?>")!==-1)throw new de(_i,'The ProcessingInstruction data contains "?>"');return t.push("<?",o.target," ",o.data,"?>"),null;case I0: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 nF(e,t,r){var n;return $e(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===Ti||r;return s?o:null}}),n}function q0(e,t,r){var n;return $e(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 zr),o.ownerDocument=e;var u=r;switch(o.nodeType){case qt:var c=i.attributes,d=o.attributes=new Us,p=c.length;d._ownerElement=o;for(var f=0;f<p;f++)o.setAttributeNode(q0(e,c.item(f),!0));break;case Ti:u=!0}return a!==null?a.appendChild(o):n=o,u?o:null}}),n}function V0(e,t,r){e[t]=r}try{Object.defineProperty&&(Object.defineProperty(Pi.prototype,"length",{get:function(){return Qc(this),this.$$length}}),Object.defineProperty(ue.prototype,"textContent",{get:function(){if(this.nodeType===qt||this.nodeType===Gr){var e=[];return $e(this,null,{enter:function(t){if(t.nodeType===qt||t.nodeType===Gr)return!0;if(t.nodeType===jc||t.nodeType===Jc)return null;e.push(t.nodeValue)}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case qt:case Gr: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}}}),V0=function(e,t,r){e["$$"+t]=r})}catch{}Hr.DocumentType=Gs;Hr.DOMException=de;Hr.DOMImplementation=R0;Hr.Element=Jn;Hr.Node=ue;Hr.NodeList=zr;Hr.walkDOM=$e;Hr.XMLSerializer=U0});var z0=v(io=>{"use strict";var G0=Ya().freeze;io.XML_ENTITIES=G0({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});io.HTML_ENTITIES=G0({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"});io.entityMap=io.HTML_ENTITIES});var Y0=v(od=>{var lo=Ya().NAMESPACE,ad=/[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]/,W0=new RegExp("[\\-\\.0-9"+ad.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),H0=new RegExp("^"+ad.source+W0.source+"*(?::"+ad.source+W0.source+"*)?$"),ao=0,wn=1,Oi=2,oo=3,Ri=4,Fi=5,so=6,Ws=7;function xi(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,xi)}xi.prototype=new Error;xi.prototype.name=xi.name;function Q0(){}Q0.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),K0(t,t={}),iF(e,t,r,n,this.errorHandler),n.endDocument()}};function iF(e,t,r,n,i){function a(Z){if(Z>65535){Z-=65536;var yt=55296+(Z>>10),uc=56320+(Z&1023);return String.fromCharCode(yt,uc)}else return String.fromCharCode(Z)}function o(Z){var yt=Z.slice(1,-1);return Object.hasOwnProperty.call(r,yt)?r[yt]:yt.charAt(0)==="#"?a(parseInt(yt.substr(1).replace("x","0x"))):(i.error("entity not found:"+Z),Z)}function s(Z){if(Z>g){var yt=e.substring(g,Z).replace(/&#?\w+;/g,o);p&&l(g),n.characters(yt,0,Z-g),g=Z}}function l(Z,yt){for(;Z>=c&&(yt=d.exec(e));)u=yt.index,c=u+yt[0].length,p.lineNumber++;p.columnNumber=Z-u+1}for(var u=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,p=n.locator,f=[{currentNSMap:t}],h={},g=0;;){try{var w=e.indexOf("<",g);if(w<0){if(!e.substr(g).match(/^\s*$/)){var S=n.doc,D=S.createTextNode(e.substr(g));S.appendChild(D),n.currentElement=D}return}switch(w>g&&s(w),e.charAt(w+1)){case"/":var B=e.indexOf(">",w+3),x=e.substring(w+2,B).replace(/[ \t\n\r]+$/g,""),F=f.pop();B<0?(x=e.substring(w+2).replace(/[\s<].*/,""),i.error("end tag name: "+x+" is not complete:"+F.tagName),B=w+1+x.length):x.match(/\s</)&&(x=x.replace(/[\s<].*/,""),i.error("end tag name: "+x+" maybe not complete"),B=w+1+x.length);var G=F.localNSMap,L=F.tagName==x,q=L||F.tagName&&F.tagName.toLowerCase()==x.toLowerCase();if(q){if(n.endElement(F.uri,F.localName,x),G)for(var U in G)Object.prototype.hasOwnProperty.call(G,U)&&n.endPrefixMapping(U);L||i.fatalError("end tag name: "+x+" is not match the current start tagName:"+F.tagName)}else f.push(F);B++;break;case"?":p&&l(w),B=uF(e,w,n);break;case"!":p&&l(w),B=lF(e,w,n,i);break;default:p&&l(w);var $=new X0,W=f[f.length-1].currentNSMap,B=aF(e,w,$,W,o,i),Qe=$.length;if(!$.closed&&sF(e,B,$.tagName,h)&&($.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),p&&Qe){for(var vt=j0(p,{}),pe=0;pe<Qe;pe++){var Ke=$[pe];l(Ke.offset),Ke.locator=j0(p,{})}n.locator=vt,J0($,n,W)&&f.push($),n.locator=p}else J0($,n,W)&&f.push($);lo.isHTML($.uri)&&!$.closed?B=oF(e,B,$.tagName,o,n):B++}}catch(Z){if(Z instanceof xi)throw Z;i.error("element parse error: "+Z),B=-1}B>g?g=B:s(Math.max(w,g)+1)}}function j0(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function aF(e,t,r,n,i,a){function o(f,h,g){r.attributeNames.hasOwnProperty(f)&&a.fatalError("Attribute "+f+" redefined"),r.addValue(f,h.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),g)}for(var s,l,u=++t,c=ao;;){var d=e.charAt(u);switch(d){case"=":if(c===wn)s=e.slice(t,u),c=oo;else if(c===Oi)c=oo;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===oo||c===wn)if(c===wn&&(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=Fi;else throw new Error("attribute value no end '"+d+"' match");else if(c==Ri)l=e.slice(t,u),o(s,l,t),a.warning('attribute "'+s+'" missed start quot('+d+")!!"),t=u+1,c=Fi;else throw new Error('attribute value must after "="');break;case"/":switch(c){case ao:r.setTagName(e.slice(t,u));case Fi:case so:case Ws:c=Ws,r.closed=!0;case Ri:case wn: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==ao&&r.setTagName(e.slice(t,u)),u;case">":switch(c){case ao:r.setTagName(e.slice(t,u));case Fi:case so:case Ws:break;case Ri:case wn:l=e.slice(t,u),l.slice(-1)==="/"&&(r.closed=!0,l=l.slice(0,-1));case Oi:c===Oi&&(l=s),c==Ri?(a.warning('attribute "'+l+'" missed quot(")!'),o(s,l,t)):((!lo.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),o(l,l,t));break;case oo:throw new Error("attribute value missed!!")}return u;case"\x80":d=" ";default:if(d<=" ")switch(c){case ao:r.setTagName(e.slice(t,u)),c=so;break;case wn:s=e.slice(t,u),c=Oi;break;case Ri:var l=e.slice(t,u);a.warning('attribute "'+l+'" missed quot(")!!'),o(s,l,t);case Fi:c=so;break}else switch(c){case Oi:var p=r.tagName;(!lo.isHTML(n[""])||!s.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=u,c=wn;break;case Fi:a.warning('attribute space is required"'+s+'"!!');case so:c=wn,t=u;break;case oo:c=Ri,t=u;break;case Ws:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function J0(e,t,r){for(var n=e.tagName,i=null,d=e.length;d--;){var a=e[d],o=a.qName,s=a.value,p=o.indexOf(":");if(p>0)var l=a.prefix=o.slice(0,p),u=o.slice(p+1),c=l==="xmlns"&&u;else u=o,l=null,c=o==="xmlns"&&"";a.localName=u,c!==!1&&(i==null&&(i={},K0(r,r={})),r[c]=i[c]=s,a.uri=lo.XMLNS,t.startPrefixMapping(c,s))}for(var d=e.length;d--;){a=e[d];var l=a.prefix;l&&(l==="xml"&&(a.uri=lo.XML),l!=="xmlns"&&(a.uri=r[l||""]))}var p=n.indexOf(":");p>0?(l=e.prefix=n.slice(0,p),u=e.localName=n.slice(p+1)):(l=null,u=e.localName=n);var f=e.uri=r[l||""];if(t.startElement(f,u,n,e),e.closed){if(t.endElement(f,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 oF(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 sF(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 K0(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function lF(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=cF(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 uF(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 X0(){this.attributeNames={}}X0.prototype={setTagName:function(e){if(!H0.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!H0.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 cF(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}od.XMLReader=Q0;od.ParseError=xi});var av=v(js=>{var dF=Ya(),pF=id(),Z0=z0(),rv=Y0(),fF=pF.DOMImplementation,ev=dF.NAMESPACE,mF=rv.ParseError,hF=rv.XMLReader;function nv(e){return e.replace(/\r[\n\u0085]/g,`
+`);if(f===-1)return;let m=p.slice(0,f),g=p.slice(f+4);if(!/^Content-Type:\s*application\/http\b/im.test(m))return;let y=/^HTTP\/1\.[01] (\d{3})\b/.exec(g);if(!y||((i=g.match(/^HTTP\/1\.[01] \d{3}\b/gm))!==null&&i!==void 0?i:[]).length!==1)return;let A=(a=/^Content-ID:\s*(\S+)/im.exec(m))===null||a===void 0?void 0:a[1];if(A===void 0||d.has(A)||!u.has(A))return;d.add(A),c.push(Number(y[1]))}return c.length===0?void 0:c}Nn.parseChangeSetStatuses=b0;async function xR(e,t,r){if(t.length===0)return;let{body:n,batchId:i,contentIds:a}=y0(e,t),o=await e.postBatch(n,i),s=e.apiUrl("/$batch");if((0,FR.ensureSuccess)(o,s),typeof o.body!="string"||o.body.length===0)throw new $s.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the $batch response had no readable body, so the change set's outcome is unknown`);let l=b0(o.body,a);if(l===void 0)throw new $s.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the $batch response could not be parsed as a change set, so the outcome is unknown`);if(l.length!==t.length)throw new $s.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the change set reported ${l.length} result(s) for ${t.length} operation(s)`);let u=l.find(c=>c<200||c>=300);if(u!==void 0)throw new $s.ConnectionError(s,u,`atomic write of ${r} was rolled back: the change set reported HTTP ${u}`)}Nn.postChangeSet=xR});var qs=v(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.updateTable=Q.deleteAlternateKey=Q.createAlternateKey=Q.deleteGlobalOptionSet=Q.createGlobalOptionSet=Q.deleteRelationship=Q.deleteColumn=Q.updateColumn=Q.deleteTable=Q.createRelationship=Q.insertStatusValue=Q.createCustomerColumn=Q.createColumns=Q.setColumnVisualization=Q.getColumnVisualization=Q.createColumn=Q.createTable=Q.resolveEntitySetName=Q.pluralFallback=void 0;var se=be(),J=ae(),Er=Ri(),pe=te(),LR=Kc(),kR={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"};function Ie(e,t){return{"@odata.type":"Microsoft.Dynamics.CRM.Label",LocalizedLabels:MR(e,t)}}var w0=65535;function MR(e,t){let r=(a,o)=>({"@odata.type":"Microsoft.Dynamics.CRM.LocalizedLabel",Label:a,LanguageCode:o});if(typeof e=="string")return[r(e,t)];let n=Object.entries(e);if(!n.length)throw new pe.InvalidArgumentError("a localized label must contain at least one language");let i=new Set;return n.map(([a,o])=>{if(!/^[1-9]\d*$/.test(a))throw new pe.InvalidArgumentError(`localized label key '${a}' is not an LCID (expected a canonical positive integer, e.g. 1033)`);let s=Number(a);if(s>w0)throw new pe.InvalidArgumentError(`localized label LCID ${s} is out of range (1-${w0})`);if(i.has(s))throw new pe.InvalidArgumentError(`localized label LCID ${s} is specified more than once`);if(i.add(s),typeof o!="string")throw new pe.InvalidArgumentError(`localized label for LCID ${s} must be a string`);return r(o,s)})}function S0(e){return typeof e=="string"?`${e}s`:Object.fromEntries(Object.entries(e).map(([t,r])=>{if(typeof r!="string")throw new pe.InvalidArgumentError(`localized label for LCID ${t} must be a string`);return[t,`${r}s`]}))}Q.pluralFallback=S0;function ao(e){return{Value:e,CanBeChanged:!0,ManagedPropertyLogicalName:"canmodifyrequirementlevelsettings"}}function Zc(e){let t=e.indexOf("_");return t>0?e.slice(0,t):e}function A0(e,t,r){let n=e[t];n&&typeof n=="object"?n.Value=r:e[t]={Value:r}}function oo(e){let t=(0,se.readCreatedId)(e,"MetadataId");if(!t)throw new pe.InvalidArgumentError("Dataverse did not return a MetadataId for the created metadata component");return t}function UR(e,t,r){var n,i,a,o,s,l,u,c,d,p,f,m,g,y,A,D,F,_,q,B,L,k,M,G;if(t.defaultValue!==void 0&&e!=="boolean")throw new pe.InvalidArgumentError(`createColumn: 'defaultValue' applies to boolean columns, but '${t.schemaName}' is of type '${e}'.`);if(t.integerFormat!==void 0&&e!=="integer")throw new pe.InvalidArgumentError(`createColumn: 'integerFormat' applies to integer columns, but '${t.schemaName}' is of type '${e}'.`);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:(o=t.integerFormat)!==null&&o!==void 0?o:"None",MinValue:(s=t.minValue)!==null&&s!==void 0?s:-2147483648,MaxValue:(l=t.maxValue)!==null&&l!==void 0?l: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:(u=t.precision)!==null&&u!==void 0?u:2,MinValue:(c=t.minValue)!==null&&c!==void 0?c:-1e11,MaxValue:(d=t.maxValue)!==null&&d!==void 0?d: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:(f=t.minValue)!==null&&f!==void 0?f:-1e11,MaxValue:(m=t.maxValue)!==null&&m!==void 0?m:1e11};case"money":return{"@odata.type":"Microsoft.Dynamics.CRM.MoneyAttributeMetadata",AttributeType:"Money",AttributeTypeName:{Value:"MoneyType"},Precision:(g=t.precision)!==null&&g!==void 0?g:2,PrecisionSource:2,MinValue:(y=t.minValue)!==null&&y!==void 0?y:0,MaxValue:(A=t.maxValue)!==null&&A!==void 0?A:1e9};case"boolean":return{"@odata.type":"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",AttributeType:"Boolean",AttributeTypeName:{Value:"BooleanType"},DefaultValue:(D=t.defaultValue)!==null&&D!==void 0?D:!1,OptionSet:{"@odata.type":"Microsoft.Dynamics.CRM.BooleanOptionSetMetadata",TrueOption:{Value:1,Label:Ie((F=t.trueLabel)!==null&&F!==void 0?F:"Yes",r)},FalseOption:{Value:0,Label:Ie((_=t.falseLabel)!==null&&_!==void 0?_:"No",r)}}};case"dateTime":return{"@odata.type":"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",AttributeType:"DateTime",AttributeTypeName:{Value:"DateTimeType"},Format:(q=t.dateFormat)!==null&&q!==void 0?q:"DateAndTime"};case"choice":return C0(t,r,!1);case"multiChoice":return C0(t,r,!0);case"file":return{"@odata.type":"Microsoft.Dynamics.CRM.FileAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"FileType"},MaxSizeInKB:(B=t.maxSizeKb)!==null&&B!==void 0?B:10240};case"image":return{"@odata.type":"Microsoft.Dynamics.CRM.ImageAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"ImageType"},IsPrimaryImage:(L=t.isPrimaryImage)!==null&&L!==void 0?L:!1,MaxSizeInKB:(k=t.maxSizeKb)!==null&&k!==void 0?k:10240};case"autonumber":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},FormatName:{Value:"Text"},MaxLength:(M=t.maxLength)!==null&&M!==void 0?M:100,AutoNumberFormat:(G=t.autoNumberFormat)!==null&&G!==void 0?G:""};default:throw new pe.InvalidArgumentError(`unsupported column type '${String(e)}'`)}}function C0(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,J.normalizeGuid)(e.globalChoiceMetadataId,"globalChoiceMetadataId")})`,i;if(!e.options||e.options.length===0)throw new pe.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:Ie(a.label,t)}))},i}var Xc=new WeakMap;async function BR(e,t){var r,n;let i=(r=Xc.get(e))===null||r===void 0?void 0:r.get(t);if(i)return i;let a=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')${(0,J.odataQuery)([["$select","EntitySetName"]])}`,s=(n=(0,se.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.EntitySetName;if(!s)throw new pe.InvalidArgumentError(`could not resolve EntitySetName for '${t}'`);(0,J.assertODataName)(s,`server-derived EntitySetName for '${t}'`);let l=Xc.get(e);return l||(l=new Map,Xc.set(e,l)),l.set(t,s),s}Q.resolveEntitySetName=BR;async function $R(e,t){var r,n,i,a,o,s,l,u,c,d,p,f,m,g,y;let A=(r=t.languageCode)!==null&&r!==void 0?r:Er.DEFAULT_LCID,D=Zc(t.schemaName),F=(n=t.primaryColumnSchemaName)!==null&&n!==void 0?n:`${D}_Name`,_={"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},SchemaName:F,RequiredLevel:ao("None"),MaxLength:(i=t.primaryColumnMaxLength)!==null&&i!==void 0?i:100,FormatName:{Value:"Text"},DisplayName:Ie((a=t.primaryColumnDisplayName)!==null&&a!==void 0?a:"Name",A),IsPrimaryName:!0};t.primaryColumnAutoNumberFormat&&(_.AutoNumberFormat=t.primaryColumnAutoNumberFormat),t.columns&&I0(t.columns,"createTable");let q={"@odata.type":"Microsoft.Dynamics.CRM.EntityMetadata",SchemaName:t.schemaName,DisplayName:Ie(t.displayName,A),DisplayCollectionName:Ie((o=t.pluralName)!==null&&o!==void 0?o:S0(t.displayName),A),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:[_,...((c=t.columns)!==null&&c!==void 0?c:[]).map(et=>ed(et,A))]};t.description&&(q.Description=Ie(t.description,A));let B="/EntityDefinitions",L=(0,se.ensureSuccess)(await e.post(B,q),e.apiUrl(B)),k=oo(L),M=`/EntityDefinitions(${k})`+(0,J.odataQuery)([["$select","LogicalName,EntitySetName,PrimaryIdAttribute,PrimaryNameAttribute"]]),G=Math.max(1,Math.trunc((d=t.readBackAttempts)!==null&&d!==void 0?d:6)),V=Math.max(0,(p=t.readBackDelayMs)!==null&&p!==void 0?p:1e3),Ze;for(let et=1;et<=G;et+=1){let dt=await e.get(M);if(dt.status>=200&&dt.status<300){Ze=dt;break}dt.status!==404&&(0,se.ensureSuccess)(dt,e.apiUrl(M)),et<G&&V>0&&await new Promise(ue=>setTimeout(ue,V))}if(!Ze)throw new pe.SdkError("TABLE_METADATA_NOT_VISIBLE",`Table '${t.schemaName}' WAS CREATED (MetadataId ${k}) but its metadata was still not readable after ${G} attempt(s). Do NOT re-run the create \u2014 it will collide on the schema name. Re-read /EntityDefinitions(${k}) once the environment catches up, or raise 'readBackAttempts'.`);let ir=Ze.body;return{logicalName:(f=ir.LogicalName)!==null&&f!==void 0?f:t.schemaName.toLowerCase(),metadataId:k,entitySetName:(m=ir.EntitySetName)!==null&&m!==void 0?m:"",primaryIdAttribute:(g=ir.PrimaryIdAttribute)!==null&&g!==void 0?g:`${t.schemaName.toLowerCase()}id`,primaryNameAttribute:(y=ir.PrimaryNameAttribute)!==null&&y!==void 0?y:F.toLowerCase()}}Q.createTable=$R;function ed(e,t){var r,n;let i=(r=e.languageCode)!==null&&r!==void 0?r:t,a={...UR(e.type,e,i),SchemaName:e.schemaName,RequiredLevel:ao((n=e.required)!==null&&n!==void 0?n:"None"),DisplayName:Ie(e.displayName,i)};return e.description&&(a.Description=Ie(e.description,i)),e.sourceType&&e.sourceType!=="Simple"&&(a.SourceType=e.sourceType==="Rollup"?2:1,e.formulaDefinition&&(a.FormulaDefinition=e.formulaDefinition)),N0(a,e),a}function N0(e,t){t.isValidForCreate!==void 0&&(e.IsValidForCreate=t.isValidForCreate),t.isValidForUpdate!==void 0&&(e.IsValidForUpdate=t.isValidForUpdate),t.isValidForRead!==void 0&&(e.IsValidForRead=t.isValidForRead)}async function qR(e,t,r){var n;let i=ed(r,(n=r.languageCode)!==null&&n!==void 0?n:Er.DEFAULT_LCID),a=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes`,o=(0,se.ensureSuccess)(await e.post(a,i),e.apiUrl(a)),s={logicalName:r.schemaName.toLowerCase(),metadataId:oo(o)};if(r.visualization&&r.visualization!=="None")try{await P0(e,t,s.logicalName,s.metadataId,r.visualization)}catch(l){let u=new pe.SdkError("COLUMN_VISUALIZATION_BIND_FAILED",`Column '${s.logicalName}' on '${t}' was created, but binding its '${r.visualization}' grid visualization failed; the column exists WITHOUT a visualization. Retry with setColumnVisualization('${t}', '${s.logicalName}', '${r.visualization}'). Cause: ${l instanceof Error?l.message:String(l)}`);throw u.cause=l,u}return s}Q.createColumn=qR;var xi="/controlconfigurations",D0="CustomRenderersConfiguration",Yc={RadialDial:"c3d4e5f6-a7b8-9012-cdef-345678901234",LineChart:"a1b2c3d4-e5f6-7890-abcd-ef1234567890",HeatMap:"e7f8a9b0-c1d2-4e3f-5a6b-7c8d9e0f1a2b",StarRating:"b5e4c3d2-f1a0-4e2b-8a7c-9d3f5c1e6b04"};function I0(e,t){let r=e.find(n=>n.visualization&&n.visualization!=="None");if(r)throw new pe.InvalidArgumentError(`${t}: setting 'visualization' on an inline column ('${r.schemaName}') is not supported \u2014 the attribute metadata and its control-configuration row are separate writes. Create the column, then call setColumnVisualization; or use the single-column createColumn.`)}function _0(e){return JSON.stringify({type:Yc[e]})}function VR(e){if(!e)return"None";let t;try{t=JSON.parse(e)}catch{return"None"}let r=t?.type,n=Object.keys(Yc).find(i=>Yc[i]===r);return n??"None"}async function T0(e,t,r){var n,i;let a=`entitylogicalname eq '${(0,J.odataLiteral)(t)}' and Attribute/logicalname eq '${(0,J.odataLiteral)(r)}'`,o=`${xi}${(0,J.odataQuery)([["$select","name,uniquename,metadatajson"],["$expand","Attribute($select=name,logicalname)"],["$filter",a]])}`,l=(i=(n=(0,se.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[],u=r.toLowerCase();return l.filter(c=>{var d,p;return((p=(d=c.Attribute)===null||d===void 0?void 0:d.logicalname)===null||p===void 0?void 0:p.toLowerCase())===u})}async function GR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes(LogicalName='${(0,J.odataPathLiteral)(r)}')${(0,J.odataQuery)([["$select","MetadataId"]])}`,o=(n=(0,se.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||n===void 0?void 0:n.MetadataId;if(!o)throw new pe.InvalidArgumentError(`cannot resolve column '${r}' on '${t}' to set its visualization`);return(0,J.normalizeGuid)(o,"MetadataId")}async function P0(e,t,r,n,i){let a={name:D0,uniquename:`msdyn_${t}_${r}_customrenderers`,metadatajson:_0(i),"[email protected]":`/attributes(${(0,J.normalizeGuid)(n,"MetadataId")})`,entitylogicalname:t};(0,se.ensureSuccess)(await e.post(xi,a),e.apiUrl(xi))}async function zR(e,t,r){var n;let i=await T0(e,t,r);return VR((n=i[0])===null||n===void 0?void 0:n.metadatajson)}Q.getColumnVisualization=zR;async function WR(e,t,r,n){let a=(await T0(e,t,r)).map(u=>u.controlconfigurationid).filter(u=>!!u);if(n==="None"){for(let u of a){let c=`${xi}(${(0,J.normalizeGuid)(u,"controlconfigurationid")})`;(0,se.ensureSuccess)(await e.delete(c),e.apiUrl(c))}return}let[o,...s]=a,l=await GR(e,t,r);if(o){let u=`${xi}(${(0,J.normalizeGuid)(o,"controlconfigurationid")})`,c={name:D0,metadatajson:_0(n),"[email protected]":`/attributes(${l})`,entitylogicalname:t};(0,se.ensureSuccess)(await e.patch(u,c),e.apiUrl(u))}else await P0(e,t,r,l,n);for(let u of s){let c=`${xi}(${(0,J.normalizeGuid)(u,"controlconfigurationid")})`;(0,se.ensureSuccess)(await e.delete(c),e.apiUrl(c))}}Q.setColumnVisualization=WR;async function HR(e,t,r){if(r.length===0)return;if(I0(r,"createColumns"),!e.supportsAtomicBatch)throw new pe.InvalidArgumentError(`createColumns writes ${r.length} columns on '${t}' as ONE atomic change set, which needs a verbatim request body. Implement HttpClient.postRaw, or call createColumn per column and accept that a failure can leave the table partly extended.`);let n=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes`;await(0,LR.postChangeSet)(e,r.map(i=>{var a;return{method:"POST",path:n,body:ed(i,(a=i.languageCode)!==null&&a!==void 0?a:Er.DEFAULT_LCID)}}),`${r.length} column(s) on '${t}'`)}Q.createColumns=HR;async function jR(e,t,r){var n,i,a,o;let s=(n=r.languageCode)!==null&&n!==void 0?n:Er.DEFAULT_LCID,l=Zc(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:Ie(r.displayName,s),RequiredLevel:ao((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,se.ensureSuccess)(await e.post("/CreateCustomerRelationships",d),e.apiUrl("/CreateCustomerRelationships")),{logicalName:r.schemaName.toLowerCase(),metadataId:""}}Q.createCustomerColumn=jR;async function JR(e,t,r){var n,i,a,o,s;let l=(n=r.languageCode)!==null&&n!==void 0?n:Er.DEFAULT_LCID,u={EntityLogicalName:t,AttributeLogicalName:"statuscode",Label:Ie(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,se.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)}Q.insertStatusValue=JR;async function QR(e,t){var r,n,i,a,o;let s=(r=t.languageCode)!==null&&r!==void 0?r:Er.DEFAULT_LCID,l,u;if(t.type==="OneToMany"){if(!t.referencedEntity||!t.referencingEntity)throw new pe.InvalidArgumentError("OneToMany relationship requires referencedEntity and referencingEntity");let p=(n=t.lookupSchemaName)!==null&&n!==void 0?n:`${Zc(t.schemaName)}_${t.referencedEntity}Id`;u=p.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:p,RequiredLevel:ao((i=t.lookupRequired)!==null&&i!==void 0?i:"None"),DisplayName:Ie((a=t.lookupDisplayName)!==null&&a!==void 0?a:t.referencedEntity,s)}}}else{if(!t.entity1||!t.entity2)throw new pe.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,se.ensureSuccess)(await e.post(c,l),e.apiUrl(c));return{schemaName:t.schemaName,metadataId:oo(d),lookupLogicalName:u}}Q.createRelationship=QR;async function KR(e,t){let r=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')`;(0,se.ensureSuccess)(await e.delete(r),e.apiUrl(r))}Q.deleteTable=KR;async function XR(e,t,r,n){var i,a;let o=(i=n.languageCode)!==null&&i!==void 0?i:Er.DEFAULT_LCID,s=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes`,l=`${s}(LogicalName='${(0,J.odataPathLiteral)(r)}')${(0,J.odataQuery)([["$select","MetadataId,AttributeType"]])}`,c=(0,se.ensureSuccess)(await e.get(l),e.apiUrl(l)).body,d=kR[(a=c.AttributeType)!==null&&a!==void 0?a:""];if(!c.MetadataId||!d)throw new pe.InvalidArgumentError(`cannot update column '${r}' on '${t}' (type '${c.AttributeType}' not supported)`);let p=(0,J.normalizeGuid)(c.MetadataId,"MetadataId"),f=`${s}(${p})/${d}`,m=(0,se.ensureSuccess)(await e.get(f),e.apiUrl(f)).body;for(let y of Object.keys(m))y.startsWith("@odata.")&&delete m[y];if(m["@odata.type"]=d,n.displayName!==void 0&&(m.DisplayName=Ie(n.displayName,o)),n.description!==void 0&&(m.Description=Ie(n.description,o)),n.required!==void 0&&(m.RequiredLevel=ao(n.required)),n.maxLength!==void 0&&(m.MaxLength=n.maxLength),n.autoNumberFormat!==void 0&&(m.AutoNumberFormat=n.autoNumberFormat),n.defaultValue!==void 0&&c.AttributeType!=="Boolean")throw new pe.InvalidArgumentError(`updateColumn: 'defaultValue' applies to Boolean columns, but '${r}' on '${t}' is of type '${c.AttributeType}'.`);if(n.integerFormat!==void 0&&c.AttributeType!=="Integer")throw new pe.InvalidArgumentError(`updateColumn: 'integerFormat' applies to Integer columns, but '${r}' on '${t}' is of type '${c.AttributeType}'.`);n.defaultValue!==void 0&&(m.DefaultValue=n.defaultValue),n.integerFormat!==void 0&&(m.Format=n.integerFormat),N0(m,n);let g=`${s}(${p})`;(0,se.ensureSuccess)(await e.put(g,m,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(g))}Q.updateColumn=XR;async function YR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes`,a=`${i}(LogicalName='${(0,J.odataPathLiteral)(r)}')${(0,J.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,se.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new pe.InvalidArgumentError(`column '${r}' not found on '${t}'`);let l=`${i}(${(0,J.normalizeGuid)(s,"MetadataId")})`;(0,se.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteColumn=YR;async function ZR(e,t){var r,n,i;let a=`/RelationshipDefinitions${(0,J.odataQuery)([["$filter",`SchemaName eq '${(0,J.odataLiteral)(t)}'`],["$select","MetadataId"]])}`,s=(i=(n=(r=(0,se.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 pe.InvalidArgumentError(`relationship '${t}' not found`);let l=`/RelationshipDefinitions(${(0,J.normalizeGuid)(s,"MetadataId")})`;(0,se.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteRelationship=ZR;async function E0(e,t){var r;let n=`/GlobalOptionSetDefinitions(Name='${(0,J.odataPathLiteral)(t)}')${(0,J.odataQuery)([["$select","MetadataId"]])}`,i=await e.get(n);if(i.status===404)return;let o=(r=(0,se.ensureSuccess)(i,e.apiUrl(n)).body)===null||r===void 0?void 0:r.MetadataId;return o?(0,J.normalizeGuid)(o,"MetadataId"):void 0}async function eF(e,t){var r;let n=t.name.toLowerCase(),i=await E0(e,n);if(i)return{name:n,metadataId:i};let a=(r=t.languageCode)!==null&&r!==void 0?r:Er.DEFAULT_LCID,o={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",Name:n,DisplayName:Ie(t.displayName,a),IsGlobal:!0,OptionSetType:"Picklist",Options:t.options.map(l=>({Value:l.value,Label:Ie(l.label,a)}))};t.description&&(o.Description=Ie(t.description,a));let s="/GlobalOptionSetDefinitions";try{let l=(0,se.ensureSuccess)(await e.post(s,o),e.apiUrl(s));return{name:n,metadataId:oo(l)}}catch(l){let u;try{u=await E0(e,n)}catch{u=void 0}if(u)return{name:n,metadataId:u};throw l}}Q.createGlobalOptionSet=eF;async function tF(e,t){let r=`/GlobalOptionSetDefinitions(Name='${(0,J.odataPathLiteral)(t.toLowerCase())}')`;(0,se.ensureSuccess)(await e.delete(r),e.apiUrl(r))}Q.deleteGlobalOptionSet=tF;async function rF(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:Er.DEFAULT_LCID,a={"@odata.type":"Microsoft.Dynamics.CRM.EntityKeyMetadata",SchemaName:r.schemaName,DisplayName:Ie(r.displayName,i),KeyAttributes:r.keyAttributes},o=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Keys`,s=(0,se.ensureSuccess)(await e.post(o,a),e.apiUrl(o));return{logicalName:r.schemaName.toLowerCase(),metadataId:oo(s)}}Q.createAlternateKey=rF;async function nF(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Keys`,a=`${i}(LogicalName='${(0,J.odataPathLiteral)(r.toLowerCase())}')${(0,J.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,se.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new pe.InvalidArgumentError(`alternate key '${r}' not found on '${t}'`);let l=`${i}(${(0,J.normalizeGuid)(s,"MetadataId")})`;(0,se.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteAlternateKey=nF;async function iF(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:Er.DEFAULT_LCID,a=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')`,s=(0,se.ensureSuccess)(await e.get(a),e.apiUrl(a)).body,l=s.MetadataId;if(!l)throw new pe.InvalidArgumentError(`table '${t}' not found`);let u=(0,J.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=Ie(r.displayName,i)),r.pluralName!==void 0&&(s.DisplayCollectionName=Ie(r.pluralName,i)),r.description!==void 0&&(s.Description=Ie(r.description,i)),r.auditEnabled!==void 0&&A0(s,"IsAuditEnabled",r.auditEnabled),r.duplicateDetectionEnabled!==void 0&&A0(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,se.ensureSuccess)(await e.put(c,s,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(c))}Q.updateTable=iF});var In=v(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.rebuildRaw=wt.assembleChildren=wt.spliceChildren=wt.mergeAttrs=wt.rawFromNode=wt.emptyBag=void 0;var Dn=te(),O0=1e6,Gs=512;function aF(){return{a:[],c:[]}}wt.emptyBag=aF;function R0(e,t=0){if(t>Gs)throw new Dn.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${Gs}`);return{n:e.getNodeName(),a:e.getAllProperties().map(r=>[r.key,r.value]),c:e.getAllChildren().map(r=>R0(r,t+1))}}wt.rawFromNode=R0;function oF(e,t,r=[]){let n=new Map;for(let[s,l]of t)n.set(s,l);let i=new Set(r.filter(s=>!n.has(s))),a=new Set,o=[];for(let[s,l]of e)i.has(s)||(n.has(s)?o.push([s,n.get(s)]):o.push([s,l]),a.add(s));for(let[s,l]of t)a.has(s)||(o.push([s,l]),a.add(s));return o}wt.mergeAttrs=oF;function Vs(e,t){let r=new Set;for(let s of e){let l=s.i;if(!Number.isInteger(l)||l<0||l>O0)throw new Dn.InvalidArgumentError(`Bag child index must be an integer in [0, ${O0}] (got ${String(l)})`);if(r.has(l))throw new Dn.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}wt.spliceChildren=Vs;function sF(e,t){if(e.w){let r={n:e.w.n,a:e.w.a.map(n=>[n[0],n[1]]),c:Vs(e.w.c,t)};return Vs(e.c,[r])}return Vs(e.c,t)}wt.assembleChildren=sF;function F0(e,t,r,n=0){if(n>Gs)throw new Dn.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${Gs}`);lF(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,F0(a,t,i,n+1));return i}wt.rebuildRaw=F0;function lF(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new Dn.InvalidArgumentError(`Malformed hybrid node at depth ${t}: expected a JSON object`);let r=e;if(typeof r.n!="string")throw new Dn.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 Dn.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 Dn.InvalidArgumentError(`Malformed hybrid node '${r.n}': each attribute must be a [string, string] pair`)}});var Li=v(Jr=>{"use strict";function uF(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 rd(e,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(e):e}function cF(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 x0=rd({HTML:"text/html",isHTML:function(e){return e===x0.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),L0=rd({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===L0.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),zs=/[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]/,td=new RegExp("[\\-\\.0-9"+zs.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),dF=new RegExp("^"+zs.source+td.source+"*(?::"+zs.source+td.source+"*)?$");Jr.assign=cF;Jr.find=uF;Jr.freeze=rd;Jr.MIME_TYPE=x0;Jr.NAMESPACE=L0;Jr.nameStartChar=zs;Jr.nameChar=td;Jr.tagNamePattern=dF});var md=v(Yr=>{var nd=Li(),Sr=nd.find,lo=nd.NAMESPACE,ki=nd.tagNamePattern;function pF(e){return e!==""}function fF(e){return e?e.split(/[\t\n\f\r ]+/).filter(pF):[]}function mF(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function k0(e){if(!e)return[];var t=fF(e);return Object.keys(t.reduce(mF,{}))}function hF(e){return function(t){return e&&e.indexOf(t)!==-1}}function co(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function Ct(e,t){var r=e.prototype;if(!(r instanceof t)){let i=function(){};var n=i;i.prototype=t.prototype,i=new i,co(r,i),e.prototype=r=i}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var Et={},Vt=Et.ELEMENT_NODE=1,Mi=Et.ATTRIBUTE_NODE=2,so=Et.TEXT_NODE=3,z0=Et.CDATA_SECTION_NODE=4,W0=Et.ENTITY_REFERENCE_NODE=5,gF=Et.ENTITY_NODE=6,id=Et.PROCESSING_INSTRUCTION_NODE=7,ad=Et.COMMENT_NODE=8,H0=Et.DOCUMENT_NODE=9,j0=Et.DOCUMENT_TYPE_NODE=10,Qr=Et.DOCUMENT_FRAGMENT_NODE=11,vF=Et.NOTATION_NODE=12,tt={},Ve={},oW=tt.INDEX_SIZE_ERR=(Ve[1]="Index size error",1),sW=tt.DOMSTRING_SIZE_ERR=(Ve[2]="DOMString size error",2),At=tt.HIERARCHY_REQUEST_ERR=(Ve[3]="Hierarchy request error",3),lW=tt.WRONG_DOCUMENT_ERR=(Ve[4]="Wrong document",4),M0=tt.INVALID_CHARACTER_ERR=(Ve[5]="Invalid character",5),uW=tt.NO_DATA_ALLOWED_ERR=(Ve[6]="No data allowed",6),cW=tt.NO_MODIFICATION_ALLOWED_ERR=(Ve[7]="No modification allowed",7),J0=tt.NOT_FOUND_ERR=(Ve[8]="Not found",8),dW=tt.NOT_SUPPORTED_ERR=(Ve[9]="Not supported",9),U0=tt.INUSE_ATTRIBUTE_ERR=(Ve[10]="Attribute in use",10),or=tt.INVALID_STATE_ERR=(Ve[11]="Invalid state",11),pW=tt.SYNTAX_ERR=(Ve[12]="Syntax error",12),fW=tt.INVALID_MODIFICATION_ERR=(Ve[13]="Invalid modification",13),mW=tt.NAMESPACE_ERR=(Ve[14]="Invalid namespace",14),hW=tt.INVALID_ACCESS_ERR=(Ve[15]="Invalid access",15);function Z(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,Ve[e]),this.message=Ve[e],Error.captureStackTrace&&Error.captureStackTrace(this,Z);return r.code=e,t&&(this.message=this.message+": "+t),r}Z.prototype=Error.prototype;co(tt,Z);function Kr(){}Kr.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++)fd(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 Ui(e,t){this._node=e,this._refresh=t,od(this)}function od(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(sv(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];co(r,e),e._inc=t}}Ui.prototype.item=function(e){return od(this),this[e]||null};Ct(Ui,Kr);function Hs(){this._nameIndex=Object.create(null)}function Q0(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function yF(e,t){e._nameIndex[t.nodeName]=t}function K0(e,t){e._nameIndex[t.nodeName]===t&&delete e._nameIndex[t.nodeName]}function B0(e,t,r,n){if(n?(t[Q0(t,n)]=r,K0(t,n)):t[t.length++]=r,yF(t,r),e){r.ownerElement=e;var i=e.ownerDocument;i&&(n&&Z0(i,e,n),bF(i,e,r))}}function $0(e,t,r){var n=Q0(t,r);if(n>=0){for(var i=t.length-1;n<i;)t[n]=t[++n];if(t.length=i,K0(t,r),e){var a=e.ownerDocument;a&&(Z0(a,e,r),r.ownerElement=null)}}else throw new Z(J0,new Error(e.tagName+"@"+r))}Hs.prototype={length:0,item:Kr.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 Z(U0);var r=this._nameIndex[e.nodeName];return B0(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t=e.ownerElement,r;if(t&&t!=this._ownerElement)throw new Z(U0);return r=this.getNamedItemNS(e.namespaceURI,e.localName),B0(this._ownerElement,this,e,r),r},removeNamedItem:function(e){var t=this.getNamedItem(e);return $0(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return $0(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 X0(){}X0.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new po;if(n.implementation=this,n.childNodes=new Kr,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 Xs;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n}};function ce(){}ce.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 Js(this,e,t)},replaceChild:function(e,t){Js(this,e,t,tv),t&&this.removeChild(t)},removeChild:function(e){return ev(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return ov(this.ownerDocument||this,this,e)},normalize:function(){qe(this,null,{enter:function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;if(r!==null&&r.nodeType===so&&t.nodeType===so){for(var n=[],i=r;i!==null&&i.nodeType===so;)n.push(i.data),i=i.nextSibling;for(var a=t.nextSibling;a!==i;){var o=a.nextSibling;a.parentNode=null,a.previousSibling=null,a.nextSibling=null,a=o}t.nextSibling=i,i!==null?i.previousSibling=t:e.lastChild=t,t.appendData(n.join("")),Ks(e.ownerDocument,e),t=i}else 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==Mi?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==Mi?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return t==null}};function Y0(e){return e=="<"&&"&lt;"||e==">"&&"&gt;"||e=="&"&&"&amp;"||e=='"'&&"&quot;"||"&#"+e.charCodeAt()+";"}co(Et,ce);co(Et,ce.prototype);function js(e,t){return qe(e,null,{enter:function(r){return t(r)?qe.STOP:!0}})===qe.STOP}function qe(e,t,r){for(var n=[{node:e,context:t,phase:qe.ENTER}];n.length>0;){var i=n.pop();if(i.phase===qe.ENTER){var a=r.enter(i.node,i.context);if(a===qe.STOP)return qe.STOP;if(n.push({node:i.node,context:a,phase:qe.EXIT}),a==null)continue;for(var o=i.node.lastChild;o;)n.push({node:o,context:a,phase:qe.ENTER}),o=o.previousSibling}else r.exit&&r.exit(i.node,i.context)}}qe.STOP=Symbol("walkDOM.STOP");qe.ENTER=0;qe.EXIT=1;function po(){this.ownerDocument=this}function bF(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===lo.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function Z0(e,t,r,n){e&&e._inc++;var i=r.namespaceURI;i===lo.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function Ks(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 ev(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,Ks(e.ownerDocument,e),t}function wF(e){return e&&(e.nodeType===ce.DOCUMENT_NODE||e.nodeType===ce.DOCUMENT_FRAGMENT_NODE||e.nodeType===ce.ELEMENT_NODE)}function AF(e){return e&&(Nr(e)||sd(e)||Xr(e)||e.nodeType===ce.DOCUMENT_FRAGMENT_NODE||e.nodeType===ce.COMMENT_NODE||e.nodeType===ce.PROCESSING_INSTRUCTION_NODE)}function Xr(e){return e&&e.nodeType===ce.DOCUMENT_TYPE_NODE}function Nr(e){return e&&e.nodeType===ce.ELEMENT_NODE}function sd(e){return e&&e.nodeType===ce.TEXT_NODE}function q0(e,t){var r=e.childNodes||[];if(Sr(r,Nr)||Xr(t))return!1;var n=Sr(r,Xr);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function V0(e,t){var r=e.childNodes||[];function n(a){return Nr(a)&&a!==t}if(Sr(r,n))return!1;var i=Sr(r,Xr);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function CF(e,t,r){if(!wF(e))throw new Z(At,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new Z(J0,"child not in parent");if(!AF(t)||Xr(t)&&e.nodeType!==ce.DOCUMENT_NODE)throw new Z(At,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function EF(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===ce.DOCUMENT_FRAGMENT_NODE){var a=i.filter(Nr);if(a.length>1||Sr(i,sd))throw new Z(At,"More than one element or text in fragment");if(a.length===1&&!q0(e,r))throw new Z(At,"Element in fragment can not be inserted before doctype")}if(Nr(t)&&!q0(e,r))throw new Z(At,"Only one element can be added and only after doctype");if(Xr(t)){if(Sr(n,Xr))throw new Z(At,"Only one doctype is allowed");var o=Sr(n,Nr);if(r&&n.indexOf(o)<n.indexOf(r))throw new Z(At,"Doctype can only be inserted before an element");if(!r&&o)throw new Z(At,"Doctype can not be appended since element is present")}}function tv(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===ce.DOCUMENT_FRAGMENT_NODE){var a=i.filter(Nr);if(a.length>1||Sr(i,sd))throw new Z(At,"More than one element or text in fragment");if(a.length===1&&!V0(e,r))throw new Z(At,"Element in fragment can not be inserted before doctype")}if(Nr(t)&&!V0(e,r))throw new Z(At,"Only one element can be added and only after doctype");if(Xr(t)){let l=function(u){return Xr(u)&&u!==r};var s=l;if(Sr(n,l))throw new Z(At,"Only one doctype is allowed");var o=Sr(n,Nr);if(r&&n.indexOf(o)<n.indexOf(r))throw new Z(At,"Doctype can only be inserted before an element")}}function Js(e,t,r,n){CF(e,t,r),e.nodeType===ce.DOCUMENT_NODE&&(n||EF)(e,t,r);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===Qr){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;uo(a,l)}while(a!==o&&(a=a.nextSibling));return Ks(e.ownerDocument||e,e),t.nodeType==Qr&&(t.firstChild=t.lastChild=null),t}function uo(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===Vt&&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;)uo(i,t),i=i.nextSibling}}function SF(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,Ks(e.ownerDocument,e,t);var r=e.ownerDocument||e;return uo(t,r),t}po.prototype={nodeName:"#document",nodeType:H0,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==Qr){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return Js(this,e,t),uo(e,this),this.documentElement===null&&e.nodeType===Vt&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),ev(this,e)},replaceChild:function(e,t){Js(this,e,t,tv),uo(e,this),t&&this.removeChild(t),Nr(e)&&(this.documentElement=e)},importNode:function(e,t){return NF(this,e,t)},getElementById:function(e){var t=null;return js(this.documentElement,function(r){if(r.nodeType==Vt&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=k0(e);return new Ui(this,function(r){var n=[];return t.length>0&&js(r.documentElement,function(i){if(i!==r&&i.nodeType===Vt){var a=i.getAttribute("class");if(a){var o=e===a;if(!o){var s=k0(a);o=t.every(hF(s))}o&&n.push(i)}}}),n})},createElement:function(e){var t=new ti;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new Kr;var r=t.attributes=new Hs;return r._ownerElement=t,t},createDocumentFragment:function(){var e=new Ys;return e.ownerDocument=this,e.childNodes=new Kr,e},createTextNode:function(e){var t=new ld;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new ud;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new Z(M0,'data contains "]]>"');var t=new cd;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new pd;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new Qs;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){if(!ki.test(e))throw new Z(M0,'not a valid xml name "'+e+'"');var t=new dd;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new ti,n=t.split(":"),i=r.attributes=new Hs;return r.childNodes=new Kr,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 Qs,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}};Ct(po,ce);function ti(){this._nsMap={}}ti.prototype={nodeType:Vt,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===Qr?this.insertBefore(e,null):SF(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 Ui(this,function(t){var r=[];return js(t,function(n){n!==t&&n.nodeType==Vt&&(e==="*"||n.tagName==e)&&r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new Ui(this,function(r){var n=[];return js(r,function(i){i!==r&&i.nodeType===Vt&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};po.prototype.getElementsByTagName=ti.prototype.getElementsByTagName;po.prototype.getElementsByTagNameNS=ti.prototype.getElementsByTagNameNS;Ct(ti,ce);function Qs(){}Qs.prototype.nodeType=Mi;Ct(Qs,ce);function fo(){}fo.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(Ve[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}};Ct(fo,ce);function ld(){}ld.prototype={nodeName:"#text",nodeType:so,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}};Ct(ld,fo);function ud(){}ud.prototype={nodeName:"#comment",nodeType:ad};Ct(ud,fo);function cd(){}cd.prototype={nodeName:"#cdata-section",nodeType:z0};Ct(cd,fo);function Xs(){}Xs.prototype.nodeType=j0;Ct(Xs,ce);function rv(){}rv.prototype.nodeType=vF;Ct(rv,ce);function nv(){}nv.prototype.nodeType=gF;Ct(nv,ce);function dd(){}dd.prototype.nodeType=W0;Ct(dd,ce);function Ys(){}Ys.prototype.nodeName="#document-fragment";Ys.prototype.nodeType=Qr;Ct(Ys,ce);function pd(){}pd.prototype.nodeType=id;Ct(pd,ce);function iv(){}iv.prototype.serializeToString=function(e,t,r,n){return av.call(e,t,r,n)};ce.prototype.toString=av;function av(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 fd(this,i,e,t,l,n),i.join("")}function G0(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!i||n==="xml"&&i===lo.XML||i===lo.XMLNS)return!1;for(var a=r.length;a--;){var o=r[a];if(o.prefix===n)return o.namespace!==i}return!0}function Ws(e,t,r,n){if(n&&!ki.test(t))throw new Z(or,'The attribute name "'+t+'" is not a valid XML QName');e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,Y0),'"')}function fd(e,t,r,n,i,a){i||(i=[]),qe(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 Vt:var c=o.attributes,d=c.length,p=o.tagName;u=lo.isHTML(o.namespaceURI)||u;var f=p;if(!u&&!o.prefix&&o.namespaceURI){for(var m,g=0;g<c.length;g++)if(c.item(g).name==="xmlns"){m=c.item(g).value;break}if(!m)for(var y=l.length-1;y>=0;y--){var A=l[y];if(A.prefix===""&&A.namespace===o.namespaceURI){m=A.namespace;break}}if(m!==o.namespaceURI)for(var y=l.length-1;y>=0;y--){var A=l[y];if(A.namespace===o.namespaceURI){A.prefix&&(f=A.prefix+":"+p);break}}}if(a&&!ki.test(f))throw new Z(or,'The element name "'+f+'" is not a valid XML QName');t.push("<",f);for(var D=l.slice(),F=0;F<d;F++){var _=c.item(F);_.prefix=="xmlns"?D.push({prefix:_.localName,namespace:_.value}):_.nodeName=="xmlns"&&D.push({prefix:"",namespace:_.value})}for(var F=0;F<d;F++){var _=c.item(F);if(G0(_,u,D)){var q=_.prefix||"",B=_.namespaceURI;Ws(t,q?"xmlns:"+q:"xmlns",B,a),D.push({prefix:q,namespace:B})}var L=n?n(_):_;L&&(typeof L=="string"?t.push(L):Ws(t,L.name,L.value,a))}if(p===f&&G0(o,u,D)){var k=o.prefix||"",B=o.namespaceURI;Ws(t,k?"xmlns:"+k:"xmlns",B,a),D.push({prefix:k,namespace:B})}var M=o.firstChild;if(M||u&&!/^(?:meta|link|img|br|hr|input)$/i.test(p)){if(t.push(">"),u&&/^script$/i.test(p)){for(;M;)M.data?t.push(M.data):fd(M,t,u,n,D.slice(),a),M=M.nextSibling;return t.push("</",p,">"),null}return{ns:D,isHTML:u,tag:f}}else return t.push("/>"),null;case H0:case Qr:return{ns:l.slice(),isHTML:u,tag:null};case Mi:return Ws(t,o.name,o.value,a),null;case so:return t.push(o.data.replace(/[<&>]/g,Y0)),null;case z0:if(a&&o.data.indexOf("]]>")!==-1)throw new Z(or,'The CDATASection data contains "]]>"');return t.push("<![CDATA[",o.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case ad:if(a&&o.data.indexOf("-->")!==-1)throw new Z(or,'The comment node data contains "-->"');return t.push("<!--",o.data,"-->"),null;case j0:if(a){if(!ki.test(o.name))throw new Z(or,'The doctype name "'+o.name+'" is not a valid XML Name');if(o.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(o.publicId))throw new Z(or,"DocumentType publicId is not a valid PubidLiteral");if(o.systemId&&!/^("[^"]*"|'[^']*')$/.test(o.systemId))throw new Z(or,"DocumentType systemId is not a valid SystemLiteral");if(o.internalSubset&&o.internalSubset.indexOf("]>")!==-1)throw new Z(or,'DocumentType internalSubset contains "]>"')}var G=o.publicId,V=o.systemId;if(t.push("<!DOCTYPE ",o.name),G)t.push(" PUBLIC ",G),V&&V!="."&&t.push(" ",V),t.push(">");else if(V&&V!=".")t.push(" SYSTEM ",V,">");else{var Ze=o.internalSubset;Ze&&t.push(" [",Ze,"]"),t.push(">")}return null;case id:if(a){if(!ki.test(o.target)||o.target.indexOf(":")!==-1||o.target.toLowerCase()==="xml")throw new Z(or,'The processing instruction target "'+o.target+'" is not a valid XML NCName or is reserved');if(o.data.indexOf("?>")!==-1)throw new Z(or,'The ProcessingInstruction data contains "?>"')}return t.push("<?",o.target," ",o.data,"?>"),null;case W0:if(a&&!ki.test(o.nodeName))throw new Z(or,'The entity reference name "'+o.nodeName+'" is not a valid XML Name');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 NF(e,t,r){var n;return qe(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===Mi||r;return s?o:null}}),n}function ov(e,t,r){var n;return qe(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 Kr),o.ownerDocument=e;var u=r;switch(o.nodeType){case Vt:var c=i.attributes,d=o.attributes=new Hs,p=c.length;d._ownerElement=o;for(var f=0;f<p;f++)o.setAttributeNode(ov(e,c.item(f),!0));break;case Mi:u=!0}return a!==null?a.appendChild(o):n=o,u?o:null}}),n}function sv(e,t,r){e[t]=r}try{Object.defineProperty&&(Object.defineProperty(Ui.prototype,"length",{get:function(){return od(this),this.$$length}}),Object.defineProperty(ce.prototype,"textContent",{get:function(){if(this.nodeType===Vt||this.nodeType===Qr){var e=[];return qe(this,null,{enter:function(t){if(t.nodeType===Vt||t.nodeType===Qr)return!0;if(t.nodeType===id||t.nodeType===ad)return null;e.push(t.nodeValue)}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case Vt:case Qr: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}}}),sv=function(e,t,r){e["$$"+t]=r})}catch{}Yr.DocumentType=Xs;Yr.DOMException=Z;Yr.DOMImplementation=X0;Yr.Element=ti;Yr.Node=ce;Yr.NodeList=Kr;Yr.walkDOM=qe;Yr.XMLSerializer=iv});var uv=v(mo=>{"use strict";var lv=Li().freeze;mo.XML_ENTITIES=lv({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});mo.HTML_ENTITIES=lv({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"});mo.entityMap=mo.HTML_ENTITIES});var mv=v(gd=>{var vo=Li().NAMESPACE,hd=Li().tagNamePattern,Bi=0,_n=1,$i=2,ho=3,qi=4,Vi=5,go=6,Zs=7;function Gi(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Gi)}Gi.prototype=new Error;Gi.prototype.name=Gi.name;function pv(){}pv.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),PF(t,t={}),DF(e,t,r,n,this.errorHandler),n.endDocument()}};function DF(e,t,r,n,i){function a(ue){if(ue>65535){ue-=65536;var $e=55296+(ue>>10),xe=56320+(ue&1023);return String.fromCharCode($e,xe)}else return String.fromCharCode(ue)}function o(ue){var $e=ue.slice(1,-1);return Object.hasOwnProperty.call(r,$e)?r[$e]:$e.charAt(0)==="#"?a(parseInt($e.substr(1).replace("x","0x"))):(i.error("entity not found:"+ue),ue)}function s(ue){if(ue>g){var $e=e.substring(g,ue).replace(/&#?\w+;/g,o);p&&l(g),n.characters($e,0,ue-g),g=ue}}function l(ue,$e){for(;ue>=c&&($e=d.exec(e));)u=$e.index,c=u+$e[0].length,p.lineNumber++;p.columnNumber=ue-u+1}for(var u=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,p=n.locator,f=[{currentNSMap:t}],m={},g=0;;){try{var y=e.indexOf("<",g);if(y<0){if(!e.substr(g).match(/^\s*$/)){var A=n.doc,D=A.createTextNode(e.substr(g));A.appendChild(D),n.currentElement=D}return}switch(y>g&&s(y),e.charAt(y+1)){case"/":var V=e.indexOf(">",y+3),F=e.substring(y+2,V).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/,"$1"),_=f.pop();V<0?(F=e.substring(y+2).replace(/[\s<].*/,""),i.error("end tag name: "+F+" is not complete:"+_.tagName),V=y+1+F.length):F.match(/\s</)?(F=F.replace(/[\s<].*/,""),i.error("end tag name: "+F+" maybe not complete"),V=y+1+F.length):/[ \t\n\r]/.test(F)&&hd.test(F.split(/[ \t\n\r]/)[0])&&i.error('end tag name is followed by whitespace and trailing content: "'+F+'"');var q=_.localNSMap,B=_.tagName==F,L=B||_.tagName&&_.tagName.toLowerCase()==F.toLowerCase();if(L){if(n.endElement(_.uri,_.localName,F),q)for(var k in q)Object.prototype.hasOwnProperty.call(q,k)&&n.endPrefixMapping(k);B||i.fatalError("end tag name: "+F+" is not match the current start tagName:"+_.tagName)}else f.push(_);V++;break;case"?":p&&l(y),V=RF(e,y,n);break;case"!":p&&l(y),V=OF(e,y,n,i);break;default:p&&l(y);var M=new fv,G=f[f.length-1].currentNSMap,V=IF(e,y,M,G,o,i),Ze=M.length;if(!M.closed&&TF(e,V,M.tagName,m)&&(M.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),p&&Ze){for(var ir=cv(p,{}),et=0;et<Ze;et++){var dt=M[et];l(dt.offset),dt.locator=cv(p,{})}n.locator=ir,dv(M,n,G)&&f.push(M),n.locator=p}else dv(M,n,G)&&f.push(M);vo.isHTML(M.uri)&&!M.closed?V=_F(e,V,M.tagName,o,n):V++}}catch(ue){if(ue instanceof Gi)throw ue;i.error("element parse error: "+ue),V=-1}V>g?g=V:s(Math.max(y,g)+1)}}function cv(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function IF(e,t,r,n,i,a){function o(f,m,g){r.attributeNames.hasOwnProperty(f)&&a.fatalError("Attribute "+f+" redefined"),r.addValue(f,m.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),g)}for(var s,l,u=++t,c=Bi;;){var d=e.charAt(u);if(c===Bi&&d==="<")throw new Error("unexpected < in tag name: "+e.slice(t,u));switch(d){case"=":if(c===_n)s=e.slice(t,u),c=ho;else if(c===$i)c=ho;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===ho||c===_n)if(c===_n&&(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=Vi;else throw new Error("attribute value no end '"+d+"' match");else if(c==qi)l=e.slice(t,u),o(s,l,t),a.warning('attribute "'+s+'" missed start quot('+d+")!!"),t=u+1,c=Vi;else throw new Error('attribute value must after "="');break;case"/":switch(c){case Bi:r.setTagName(e.slice(t,u));case Vi:case go:case Zs:c=Zs,r.closed=!0;case qi:case _n:break;case $i:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),c==Bi&&r.setTagName(e.slice(t,u)),u;case">":switch(c){case Bi:r.setTagName(e.slice(t,u));case Vi:case go:case Zs:break;case qi:case _n:l=e.slice(t,u),l.slice(-1)==="/"&&(r.closed=!0,l=l.slice(0,-1));case $i:c===$i&&(l=s),c==qi?(a.warning('attribute "'+l+'" missed quot(")!'),o(s,l,t)):((!vo.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),o(l,l,t));break;case ho:throw new Error("attribute value missed!!")}return u;case"\x80":d=" ";default:if(d<=" ")switch(c){case Bi:r.setTagName(e.slice(t,u)),c=go;break;case _n:s=e.slice(t,u),c=$i;break;case qi:var l=e.slice(t,u);a.warning('attribute "'+l+'" missed quot(")!!'),o(s,l,t);case Vi:c=go;break}else switch(c){case $i:var p=r.tagName;(!vo.isHTML(n[""])||!s.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=u,c=_n;break;case Vi:a.warning('attribute space is required"'+s+'"!!');case go:c=_n,t=u;break;case ho:c=qi,t=u;break;case Zs:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function dv(e,t,r){for(var n=e.tagName,i=null,d=e.length;d--;){var a=e[d],o=a.qName,s=a.value,p=o.indexOf(":");if(p>0)var l=a.prefix=o.slice(0,p),u=o.slice(p+1),c=l==="xmlns"&&u;else u=o,l=null,c=o==="xmlns"&&"";a.localName=u,c!==!1&&(i==null&&(i={},r=Object.create(r)),r[c]=i[c]=s,a.uri=vo.XMLNS,t.startPrefixMapping(c,s))}for(var d=e.length;d--;){a=e[d];var l=a.prefix;l&&(l==="xml"&&(a.uri=vo.XML),l!=="xmlns"&&(a.uri=r[l||""]))}var p=n.indexOf(":");p>0?(l=e.prefix=n.slice(0,p),u=e.localName=n.slice(p+1)):(l=null,u=e.localName=n);var f=e.uri=r[l||""];if(t.startElement(f,u,n,e),e.closed){if(t.endElement(f,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 _F(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 TF(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 PF(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function OF(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=FF(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 RF(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 fv(){this.attributeNames={}}fv.prototype={setTagName:function(e){if(!hd.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!hd.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 FF(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}gd.XMLReader=pv;gd.ParseError=Gi});var Av=v(tl=>{var xF=Li(),LF=md(),hv=uv(),yv=mv(),kF=LF.DOMImplementation,gv=xF.NAMESPACE,MF=yv.ParseError,UF=yv.XMLReader;function bv(e){return e.replace(/\r[\n\u0085]/g,`
`).replace(/[\r\u0085\u2028]/g,`
-`)}function iv(e){this.options=e||{locator:{}}}iv.prototype.parseFromString=function(e,t){var r=this.options,n=new hF,i=r.domBuilder||new uo,a=r.errorHandler,o=r.locator,s=r.xmlns||{},l=/\/x?html?$/.test(t),u=l?Z0.HTML_ENTITIES:Z0.XML_ENTITIES;o&&i.setDocumentLocator(o),n.errorHandler=gF(a,i,o),n.domBuilder=r.domBuilder||i,l&&(s[""]=ev.HTML),s.xml=s.xml||ev.XML;var c=r.normalizeLineEndings||nv;return e&&typeof e=="string"?n.parse(c(e),s,u):n.errorHandler.error("invalid doc source"),i.doc};function gF(e,t,r){if(!e){if(t instanceof uo)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+sd(r))}||function(){}}return a("warning"),a("error"),a("fatalError"),n}function uo(){this.cdata=!1}function Li(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}uo.prototype={startDocument:function(){this.doc=new fF().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;Hs(this,a),this.currentElement=a,this.locator&&Li(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&&Li(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&&Li(this.locator,r),Hs(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=tv.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&&Li(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=tv.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&Li(this.locator,n),Hs(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&&Li(this.locator,i),Hs(this,i),this.doc.doctype=i}},warning:function(e){console.warn("[xmldom warning] "+e,sd(this.locator))},error:function(e){console.error("[xmldom error] "+e,sd(this.locator))},fatalError:function(e){throw new mF(e,this.locator)}};function sd(e){if(e)return`
-@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function tv(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){uo.prototype[e]=function(){return null}});function Hs(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}js.__DOMHandler=uo;js.normalizeLineEndings=nv;js.DOMParser=iv});var ld=v(Js=>{var ov=id();Js.DOMImplementation=ov.DOMImplementation;Js.XMLSerializer=ov.XMLSerializer;Js.DOMParser=av().DOMParser});var An=v(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.installDomShim=void 0;var sv=ld(),lv=!1,vF={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 yF(){if(lv)return;let e=globalThis;typeof e.DOMParser>"u"&&(e.DOMParser=sv.DOMParser),typeof e.XMLSerializer>"u"&&(e.XMLSerializer=sv.XMLSerializer),typeof e.Node>"u"&&(e.Node=vF),lv=!0}Qs.installDomShim=yF});var Qn=v(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.projectElementBag=Te.serializeNode=Te.domEngine=Te.nodeLikeFromDom=Te.parseXmlRoot=Te.EMPTY_FORM_SENTINEL=Te.TEXT_SENTINEL=void 0;var bF=bn(),co=re(),wF=An();Te.TEXT_SENTINEL="#text";Te.EMPTY_FORM_SENTINEL="#empty";var Xs=new WeakSet;function AF(e,t){(0,wF.installDomShim)();let r=e&&e.trim()!==""?e:t,i=new DOMParser().parseFromString(r,"text/xml").documentElement;if(!i)throw new co.InvalidArgumentError("XML source has no root element (empty or malformed input)");return SF(i),EF(i),IF(i,r),i}Te.parseXmlRoot=AF;var CF=new Set([1,3]);function SF(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(!CF.has(a.nodeType))throw new co.InvalidArgumentError(`Unsupported XML node type ${a.nodeType} (CDATA / comment / processing-instruction) is outside the hybrid projection's lossless grammar and cannot be round-tripped`);a.nodeType===1&&t.push(a)}}}function EF(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 co.InvalidArgumentError(`Unsupported document-level XML node (type ${o.nodeType}: declaration / comment / processing-instruction outside the root element) cannot be round-tripped`)}}function NF(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 DF(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 cv(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 IF(e,t){let r=NF(t),n=DF(e),i=Math.min(r.length,n.length);for(let a=0;a<i;a+=1){if(r[a])continue;let o=n[a];cv(o)||Xs.add(o)}}function ud(e){let t=e.nodeType===3;return{getNodeName:()=>t?Te.TEXT_SENTINEL:e.tagName,getAllProperties:()=>{var r;if(t)return[{key:Te.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 Xs.has(e)&&!cv(e)&&i.push({key:Te.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(ud(a))}return r}}}Te.nodeLikeFromDom=ud;function _F(e){return{make:t=>t===Te.TEXT_SENTINEL?e.createTextNode(""):e.createElement(t),setProp:(t,r,n)=>{t.nodeType===3?t.nodeValue=n:r===Te.EMPTY_FORM_SENTINEL?Xs.add(t):t.setAttribute(r,n)},addChild:(t,r)=>{t.appendChild(r)}}}Te.domEngine=_F;function dv(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 Ks(r);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))throw Ks(r);t+=1;continue}if(r>=56320&&r<=57343)throw Ks(r)}}function Ks(e){let t=e.toString(16).toUpperCase().padStart(4,"0");return new co.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 TF(e){return dv(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/\r/g,"&#xD;").replace(/\n/g,"&#xA;").replace(/\t/g,"&#x9;")}function PF(e){return dv(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OF(e){return pv(e,0)}Te.serializeNode=OF;var uv=512;function pv(e,t){var r;if(t>uv)throw new co.InvalidArgumentError(`XML nesting exceeds the maximum supported depth of ${uv}`);if(e.nodeType===3)return PF((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+'="'+TF(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 Xs.has(n)?i+"></"+n.tagName+">":i+" />";i+=">";for(let l of o)i+=pv(l,t+1);return i+"</"+n.tagName+">"}function RF(e){let t=ud(e);return{a:t.getAllProperties().map(r=>[r.key,r.value]),c:t.getAllChildren().map((r,n)=>({i:n,node:(0,bF.rawFromNode)(r)}))}}Te.projectElementBag=RF});var pd=v(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.getFormSecurityRoles=Cn.setFormSecurityRoles=Cn.formApi=void 0;var FF=$t(),me=be(),Vt=ie(),ki=re(),cd=Qn(),xF="formid,formxml,name,type,objecttypecode,formpresentation,formactivationstate,uniquename,description,versionnumber",LF="formid,name,type,objecttypecode",kF=2,MF={Main:kF,QuickView:6,QuickCreate:7,Card:11};Cn.formApi={async get(e,t){let n=`/systemforms(${(0,Vt.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Vt.odataQuery)([["$select",xF]]),i=(0,me.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,me.readEtag)(i)}},async list(e,t){var r;let n=!((r=t?.formTypes)===null||r===void 0)&&r.length?t.formTypes:["Main"],i=[...new Set(n.map(u=>MF[u]))],o=[i.length===1?`type eq ${i[0]}`:`(${i.map(u=>`type eq ${u}`).join(" or ")})`];t?.entityLogicalName&&o.push(`objecttypecode eq '${(0,Vt.odataLiteral)(t.entityLogicalName)}'`);let s=`/systemforms${(0,Vt.odataQuery)([["$select",LF],["$filter",o.join(" and ")]])}`;return(await(0,FF.collectPages)(e,s,"listArtifacts('form')")).map(u=>{var c,d;return{type:"form",id:(c=u.formid)!==null&&c!==void 0?c:"",name:(d=u.name)!==null&&d!==void 0?d:"",entityLogicalName:u.objecttypecode,isDirty:!1}})},async create(e,t,r){let n=(0,me.echoWrite)("formid"),i=`/systemforms${n.query}`,a=(0,me.ensureSuccess)(await e.post(i,(0,me.withClientMintedId)(t,"formid",r),n.options),e.apiUrl(i));return{id:(0,me.resolveCreatedId)(a,"formid","form",r),etag:(0,me.readEtag)(a)}},async update(e,t,r,n){let i=(0,Vt.normalizeGuid)(t,"id");await hv(e,i,mv(i),n);let a=await fv(e,i),o=(0,me.echoWrite)("formid",{"If-Match":(0,me.requireEtag)(a,"form",i)}),s=`/systemforms(${i})${o.query}`;return(0,me.ensureSuccess)(await e.patch(s,r,o.options),e.apiUrl(s)),{id:i,etag:await UF(e,i)}},delete(e,t){return(0,me.deleteRecord)(e,"systemforms",t)}};var dd="DisplayConditions";async function BF(e,t,r){var n,i,a,o;if(r.everyone&&r.roleIds&&r.roleIds.length>0)throw new ki.InvalidArgumentError("setFormSecurityRoles: `everyone` and `roleIds` are mutually exclusive \u2014 the platform models <Everyone /> as a replacement for the <Role> list, not an addition to it.");let s=(0,Vt.normalizeGuid)(t,"formId"),l=`/systemforms(${s})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Vt.odataQuery)([["$select","formid,formxml"]]),u=(0,me.ensureSuccess)(await e.get(l),e.apiUrl(l)),c=(0,me.readEtag)(u),d=u.body,p=d?.formxml;if(!p)throw new ki.InvalidArgumentError(`form '${s}' returned no formxml, so its roles cannot be set`);let f=(0,cd.parseXmlRoot)(p,"<form/>"),h=f.ownerDocument;if(!h)throw new ki.InvalidArgumentError(`form '${s}' produced no owner document`);let g=gv(f,dd),w=g?.hasAttribute("Order")&&(n=g.getAttribute("Order"))!==null&&n!==void 0?n:void 0,S=g?.getAttribute("FallbackForm")||void 0;g&&f.removeChild(g);let D=!!r.everyone||((a=(i=r.roleIds)===null||i===void 0?void 0:i.length)!==null&&a!==void 0?a:0)>0;if(!D&&(r.order!==void 0||r.fallbackForm!==void 0)){if(!g)throw new ki.InvalidArgumentError("setFormSecurityRoles: `order`/`fallbackForm` were supplied without `roleIds` or `everyone`, but this form has no <DisplayConditions> to attach them to. Pass the roles as well.");r.order!==void 0&&g.setAttribute("Order",String(r.order)),r.fallbackForm!==void 0&&g.setAttribute("FallbackForm",String(r.fallbackForm)),f.appendChild(g)}else if(D){let q=h.createElement(dd),U=r.order!==void 0?String(r.order):w;U!==void 0&&q.setAttribute("Order",U);let $=r.fallbackForm!==void 0?String(r.fallbackForm):S??"false";if(q.setAttribute("FallbackForm",$),r.everyone)q.appendChild(h.createElement("Everyone"));else for(let W of(o=r.roleIds)!==null&&o!==void 0?o:[]){let B=h.createElement("Role");B.setAttribute("Id",`{${(0,Vt.normalizeGuid)(W,"roleId")}}`),q.appendChild(B)}f.appendChild(q)}let F=(0,cd.serializeNode)(f);await hv(e,s,l,c);let G=await fv(e,s),L=`/systemforms(${s})`;(0,me.ensureSuccess)(await e.patch(L,{formxml:F},{headers:{"Content-Type":"application/json","If-Match":(0,me.requireEtag)(G,"form",s)}}),e.apiUrl(L))}Cn.setFormSecurityRoles=BF;async function fv(e,t){let r=`/systemforms(${t})${(0,Vt.odataQuery)([["$select","formid"]])}`;return(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)))}function mv(e){return`/systemforms(${e})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Vt.odataQuery)([["$select","formid"]])}async function UF(e,t){let r=mv(t);return(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)))}async function hv(e,t,r,n){(0,me.requireEtag)(n,"form",t);let i=(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)));if(i===null)throw new ki.SdkError(me.VERSION_CONFLICT_CODE,`Refusing to write form '${t}': its current version could not be read, so the write could not be verified as conditional and would risk silently overwriting a concurrent edit.`);if(i!==n)throw new ki.SdkError(me.VERSION_CONFLICT_CODE,`Version conflict writing form '${t}': its formxml changed on the server since it was read (held ${n}, server ${i}). Re-fetch the form and re-apply the change.`)}function gv(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===t)return i}}async function $F(e,t){var r,n;let a=`/systemforms(${(0,Vt.normalizeGuid)(t,"formId")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Vt.odataQuery)([["$select","formid,formxml"]]),s=(r=(0,me.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.formxml;if(!s)return;let l=(0,cd.parseXmlRoot)(s,"<form/>"),u=gv(l,dd);if(!u)return;let c=[],d=!1,p=u.childNodes;for(let h=0;h<p.length;h+=1){let g=p[h];if(g.nodeType!==1)continue;let w=g;if(w.tagName==="Everyone")d=!0;else if(w.tagName==="Role"){let S=(n=w.getAttribute("Id"))!==null&&n!==void 0?n:"";S&&c.push(S.replace(/[{}]/g,"").toLowerCase())}}let f=u.getAttribute("Order");return{...d?{everyone:!0}:{},...c.length>0?{roleIds:c}:{},fallbackForm:u.getAttribute("FallbackForm")==="true",...f!==null&&f!==""?{order:Number(f)}:{}}}Cn.getFormSecurityRoles=$F});var el=v(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.disassociateRecords=Ne.associateRecords=Ne.createRecordsBulk=Ne.upsertRecord=Ne.queryAllRecords=Ne.queryRecords=Ne.getRecord=Ne.deleteRecord=Ne.updateRecord=Ne.createRecord=void 0;var qF=$t(),tr=be(),tt=ie(),Ys=re(),Ar=xs();function Zs(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 VF(e,t,r){let i=`/${await(0,Ar.resolveEntitySetName)(e,t)}`,a=(0,tr.ensureSuccess)(await e.post(i,Zs(r)),e.apiUrl(i)),o=(0,tr.readCreatedId)(a,`${t}id`);if(!o)throw new Ys.InvalidArgumentError(`Dataverse did not return an id for the created '${t}' row`);return{id:o,entityType:t}}Ne.createRecord=VF;async function GF(e,t,r,n){let i=(0,tt.normalizeGuid)(r,"id"),o=`/${await(0,Ar.resolveEntitySetName)(e,t)}(${i})`;(0,tr.ensureSuccess)(await e.patch(o,Zs(n)),e.apiUrl(o))}Ne.updateRecord=GF;async function zF(e,t,r){let n=(0,tt.normalizeGuid)(r,"id"),a=`/${await(0,Ar.resolveEntitySetName)(e,t)}(${n})`;(0,tr.ensureSuccess)(await e.delete(a),e.apiUrl(a))}Ne.deleteRecord=zF;async function WF(e,t,r,n){var i;let a=(0,tt.normalizeGuid)(r,"id"),o=await(0,Ar.resolveEntitySetName)(e,t),s=(0,tt.odataQuery)([["$select",n&&n.length>0?n.join(","):void 0]]),l=`/${o}(${a})${s}`;return(i=(0,tr.ensureSuccess)(await e.get(l),e.apiUrl(l)).body)!==null&&i!==void 0?i:{}}Ne.getRecord=WF;function HF(e){return e?.fetchXml?(0,tt.odataQuery)([["fetchXml",e.fetchXml]]):(0,tt.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 vv(e,t,r){var n,i;if(r?.paginate){if(r.top!==void 0)throw new Ys.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 Ys.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,Ar.resolveEntitySetName)(e,t)}${HF(r)}`;return r?.paginate?(0,qF.collectPages)(e,o,"queryRecords"):(i=(n=(0,tr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]}Ne.queryRecords=vv;async function jF(e,t,r){return vv(e,t,{...r,paginate:!0})}Ne.queryAllRecords=jF;function JF(e){if("id"in e)return`(${(0,tt.normalizeGuid)(e.id,"id")})`;let t=typeof e.value=="string"?`'${(0,tt.odataPathLiteral)(e.value)}'`:e.value;return`(${(0,tt.assertODataName)(e.key,"alternate key name")}=${t})`}async function QF(e,t,r,n){let i=JF(r),o=`/${await(0,Ar.resolveEntitySetName)(e,t)}${i}`,s=(0,tr.ensureSuccess)(await e.patch(o,Zs(n)),e.apiUrl(o)),l=s.status===201,u=(0,tr.readCreatedId)(s,`${t}id`);return{id:u??("id"in r?(0,tt.normalizeGuid)(r.id,"id"):""),created:l}}Ne.upsertRecord=QF;async function KF(e,t,r){var n,i;if(r.length===0)return[];let a=await(0,Ar.resolveEntitySetName)(e,t),o=r.map(c=>({"@odata.type":`Microsoft.Dynamics.CRM.${t}`,...Zs(c)})),s=`/${a}/Microsoft.Dynamics.CRM.CreateMultiple`,u=(i=(n=(0,tr.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 Ys.InvalidArgumentError(`CreateMultiple on '${t}' returned ${u.length} id(s) for ${r.length} row(s)`);return u}Ne.createRecordsBulk=KF;async function XF(e,t,r,n){let i=(0,tt.normalizeGuid)(r,"id"),a=(0,tt.normalizeGuid)(n.targetId,"targetId"),o=await(0,Ar.resolveEntitySetName)(e,t),s=await(0,Ar.resolveEntitySetName)(e,n.targetEntity),l=(0,tt.assertODataName)(n.relationshipName,"relationshipName"),u=`/${o}(${i})/${l}/$ref`,c={"@odata.id":e.apiUrl(`/${s}(${a})`)};(0,tr.ensureSuccess)(await e.post(u,c),e.apiUrl(u))}Ne.associateRecords=XF;async function YF(e,t,r,n,i){let a=(0,tt.normalizeGuid)(r,"id"),o=(0,tt.normalizeGuid)(i,"targetId"),s=await(0,Ar.resolveEntitySetName)(e,t),l=(0,tt.assertODataName)(n,"relationshipName"),u=`/${s}(${a})/${l}(${o})/$ref`;(0,tr.ensureSuccess)(await e.delete(u),e.apiUrl(u))}Ne.disassociateRecords=YF});var rr=v(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.publishBoundEntity=Ve.boundEntityPublishScope=Ve.publishGenPageById=Ve.publishDashboardById=Ve.publishWebResourceById=Ve.publishEntity=Ve.publishAppModule=Ve.publishXml=void 0;var ZF=be(),po=ie(),yv="/PublishXml";async function Mi(e,t){(0,ZF.ensureSuccess)(await e.post(yv,{ParameterXml:t}),e.apiUrl(yv))}Ve.publishXml=Mi;function ex(e,t){return Mi(e,`<importexportxml><appmodules><appmodule>${(0,po.xmlText)(t)}</appmodule></appmodules></importexportxml>`)}Ve.publishAppModule=ex;function bv(e,t){return Mi(e,`<importexportxml><entities><entity>${(0,po.xmlText)(t)}</entity></entities></importexportxml>`)}Ve.publishEntity=bv;function tx(e,t){return Mi(e,`<importexportxml><webresources><webresource>${(0,po.xmlText)(t)}</webresource></webresources></importexportxml>`)}Ve.publishWebResourceById=tx;function rx(e,t){return Mi(e,`<importexportxml><dashboards><dashboard>${(0,po.xmlText)(t)}</dashboard></dashboards></importexportxml>`)}Ve.publishDashboardById=rx;function nx(e,t){return Mi(e,`<importexportxml><uxagentprojects><uxagentproject>${(0,po.xmlText)(t)}</uxagentproject></uxagentprojects></importexportxml>`)}Ve.publishGenPageById=nx;function ix(e){let t=e?.entityLogicalName;return t?{envelope:"entity",entityLogicalName:t,blastRadiusWarning:"ENTITY_ENVELOPE_ALSO_SHIPS_UNRELATED_UNPUBLISHED_CHANGES"}:{envelope:"entity"}}Ve.boundEntityPublishScope=ix;function ax(e,t){let r=t?.entityLogicalName;return r?bv(e,r):Promise.resolve()}Ve.publishBoundEntity=ax});var md=v(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.base64ToBytes=Sn.bytesToBase64=Sn.utf8ToBase64=void 0;var wv=32768,St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function fd(){return globalThis}function ox(e){let t=[];for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>=55296&&n<=56319){let i=r+1<e.length?e.charCodeAt(r+1):0;i>=56320&&i<=57343?(n=(n-55296<<10)+(i-56320)+65536,r+=1):n=65533}else n>=56320&&n<=57343&&(n=65533);n<128?t.push(n):n<2048?t.push(192|n>>6,128|n&63):n<65536?t.push(224|n>>12,128|n>>6&63,128|n&63):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63)}return Uint8Array.from(t)}function sx(e){let t="";for(let r=0;r<e.length;r+=wv)t+=String.fromCharCode(...e.subarray(r,r+wv));return t}function lx(e){let t="";for(let r=0;r<e.length;r+=1){let n=String.fromCharCode(e.charCodeAt(r)&255);if(n==="=")break;n==="-"?t+="+":n==="_"?t+="/":St.indexOf(n)>=0&&(t+=n)}for(t.length%4===1&&(t=t.slice(0,-1));t.length%4!==0;)t+="=";return t}function ux(e){let t="",r=0;for(;r+2<e.length;r+=3){let i=e[r]<<16|e[r+1]<<8|e[r+2];t+=St[i>>18&63]+St[i>>12&63]+St[i>>6&63]+St[i&63]}let n=e.length-r;if(n===1){let i=e[r]<<16;t+=`${St[i>>18&63]}${St[i>>12&63]}==`}else if(n===2){let i=e[r]<<16|e[r+1]<<8,a=St[i>>18&63],o=St[i>>12&63],s=St[i>>6&63];t+=`${a}${o}${s}=`}return t}function cx(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0,r=e.length/4*3-t,n=new Uint8Array(r>0?r:0),i=0;for(let a=0;a<e.length;a+=4){let o=St.indexOf(e[a])<<18|St.indexOf(e[a+1])<<12|(e[a+2]==="="?0:St.indexOf(e[a+2]))<<6|(e[a+3]==="="?0:St.indexOf(e[a+3]));i<r&&(n[i++]=o>>16&255),i<r&&(n[i++]=o>>8&255),i<r&&(n[i++]=o&255)}return n}function dx(e){let t=fd();if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");let r=t.TextEncoder;return Av(r?new r().encode(e):ox(e))}Sn.utf8ToBase64=dx;function Av(e){let t=fd();return t.Buffer?t.Buffer.from(e).toString("base64"):t.btoa?t.btoa(sx(e)):ux(e)}Sn.bytesToBase64=Av;function px(e){let t=fd();if(t.Buffer)return new Uint8Array(t.Buffer.from(e,"base64"));let r=lx(e);if(t.atob){let n=t.atob(r);return Uint8Array.from(n,i=>i.charCodeAt(0))}return cx(r)}Sn.base64ToBytes=px});var Nv=v(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.deleteWebResource=Cr.getWebResource=Cr.updateWebResource=Cr.createWebResource=void 0;var fx=rr(),fo=be(),tl=ie(),mx=md(),Cv=re(),hx={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12};function Sv(e){if(e.contentBase64!==void 0)return e.contentBase64;if(e.content!==void 0)return(0,mx.utf8ToBase64)(e.content)}async function Ev(e,t){return(0,fx.publishWebResourceById)(e,t)}async function gx(e,t){var r;let n=Sv(t);if(n===void 0)throw new Cv.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:hx[t.type],content:n};t.description&&(i.description=t.description);let a=(0,fo.ensureSuccess)(await e.post("/webresourceset",i),e.apiUrl("/webresourceset")),o=(0,fo.readCreatedId)(a,"webresourceid");if(!o)throw new Cv.InvalidArgumentError(`Dataverse did not return an id for web resource '${t.name}'`);return t.publish!==!1&&await Ev(e,o),{id:o,name:t.name}}Cr.createWebResource=gx;async function vx(e,t,r){let n=(0,tl.normalizeGuid)(t,"id"),i={},a=Sv(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,fo.ensureSuccess)(await e.patch(o,i),e.apiUrl(o)),r.publish!==!1&&await Ev(e,n)}Cr.updateWebResource=vx;async function yx(e,t){var r;let i=`/webresourceset(${(0,tl.normalizeGuid)(t,"id")})${(0,tl.odataQuery)([["$select","name,displayname,webresourcetype,content,description"]])}`;return(r=(0,fo.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)!==null&&r!==void 0?r:{}}Cr.getWebResource=yx;async function bx(e,t){let n=`/webresourceset(${(0,tl.normalizeGuid)(t,"id")})`;(0,fo.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Cr.deleteWebResource=bx});var rl=v(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.applyAppSettings=Ge.setAppSetting=Ge.readAppSettings=Ge.resolveSettingDefinitions=Ge.APP_SETTING_UNSET=Ge.APP_SETTING_OFF=Ge.APP_SETTING_ON=Ge.HEADER_AND_NAVIGATION_REFRESH=void 0;var Bi=be(),jr=ie();Ge.HEADER_AND_NAVIGATION_REFRESH="HeaderAndNavigationRefresh";Ge.APP_SETTING_ON="2";Ge.APP_SETTING_OFF="1";Ge.APP_SETTING_UNSET="0";function _v(e,t){return"/appsettings/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,jr.odataQuery)([["$select",e],["$filter",t]])}async function Tv(e,t){var r,n;let i=[...new Set(t.filter(Boolean))],a=new Map;if(i.length===0)return a;let o=i.map(c=>`uniquename eq '${(0,jr.odataLiteral)(c)}'`).join(" or "),s=`/settingdefinitions${(0,jr.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",o]])}`,u=((n=(r=(0,Bi.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]).filter(Boolean);for(let c of u)c.uniquename&&a.set(c.uniquename,c);return a}Ge.resolveSettingDefinitions=Tv;async function wx(e,t){var r,n,i,a;let o=(0,jr.normalizeGuid)(t,"App id"),s=_v("appsettingid,value,_settingdefinitionid_value",`_parentappmoduleid_value eq ${o}`),u=((n=(r=(0,Bi.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]).filter(Boolean);if(u.length===0)return[];let c=[...new Set(u.map(p=>p._settingdefinitionid_value).filter(Boolean))],d=new Map;if(c.length>0){let p=c.map(g=>`settingdefinitionid eq ${(0,jr.normalizeGuid)(g,"Setting definition id")}`).join(" or "),f=`/settingdefinitions${(0,jr.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",p]])}`,h=(0,Bi.ensureSuccess)(await e.get(f),e.apiUrl(f));for(let g of((a=(i=h.body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[]).filter(Boolean))g.settingdefinitionid&&d.set(g.settingdefinitionid.toLowerCase(),g)}return u.map(p=>{var f,h,g,w,S;let D=d.get(((f=p._settingdefinitionid_value)!==null&&f!==void 0?f:"").toLowerCase());return{id:(h=p.appsettingid)!==null&&h!==void 0?h:"",name:(w=(g=D?.uniquename)!==null&&g!==void 0?g:p._settingdefinitionid_value)!==null&&w!==void 0?w:"",value:(S=p.value)!==null&&S!==void 0?S:"",...D?.displayname?{displayName:D.displayname}:{}}})}Ge.readAppSettings=wx;async function Dv(e,t,r){var n,i,a;let o=_v("appsettingid,value",`_parentappmoduleid_value eq ${t} and _settingdefinitionid_value eq ${r}`),l=((i=(n=(0,Bi.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]).filter(Boolean)[0];return l?.appsettingid?{id:l.appsettingid,value:(a=l.value)!==null&&a!==void 0?a:""}:void 0}async function Pv(e,t,r,n){let i=(0,jr.normalizeGuid)(t,"App id"),o=(await Tv(e,[r])).get(r),s=o?.settingdefinitionid;if(!s)throw new Error(`App setting '${r}' is not available in this environment: no settingdefinition row has that uniquename. The feature may be version-gated or its solution may not be installed.`);let l=(0,jr.normalizeGuid)(s,"Setting definition id"),u=await Dv(e,i,l);if(u)return Iv(e,u,n);let c="/appsettings",d={"[email protected]":`/appmodules(${i})`,"[email protected]":`/settingdefinitions(${l})`,value:n},p,f;try{if(p=await e.post(c,d),p.status>=200&&p.status<300)return"created"}catch(g){f=g}let h;try{h=await Dv(e,i,l)}catch{h=void 0}if(h)return Iv(e,h,n);throw p&&(0,Bi.ensureSuccess)(p,e.apiUrl(c)),f}Ge.setAppSetting=Pv;async function Iv(e,t,r){if(t.value===r)return"unchanged";let n=`/appsettings(${(0,jr.normalizeGuid)(t.id,"App setting id")})`;return(0,Bi.ensureSuccess)(await e.patch(n,{value:r}),e.apiUrl(n)),"updated"}async function Ax(e,t,r){var n;let i=[];for(let[a,o]of Object.entries(r??{}))try{await Pv(e,t,a,o)}catch(s){i.push(`App setting '${a}' was not applied: ${(n=s?.message)!==null&&n!==void 0?n:String(s)} The app was created; set it later with setAppSetting().`)}return i}Ge.applyAppSettings=Ax});var il=v(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.HEADER_NAV_BOOLEAN_RULE=void 0;nl.HEADER_NAV_BOOLEAN_RULE="headerAndNavigationRefresh-must-be-boolean"});var Rv=v(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.getSolution=te.fetchSolutionComponents=te.SolutionComponentType=void 0;var Ov=$t(),nr=be(),Et=ie(),Kn=re();te.SolutionComponentType={SavedQuery:26,Workflow:29,SavedQueryVisualization:59,SystemForm:60,AppModule:80,UxAgentProject:10372};var Cx=[te.SolutionComponentType.SavedQuery,te.SolutionComponentType.Workflow,te.SolutionComponentType.SavedQueryVisualization,te.SolutionComponentType.SystemForm,te.SolutionComponentType.AppModule,te.SolutionComponentType.UxAgentProject];async function Sx(e,t){let r=(0,Et.normalizeGuid)(t,"solutionId"),n=Cx.map(s=>`msdyn_componenttype eq ${s}`).join(" or "),i=`/msdyn_solutioncomponentsummaries${(0,Et.odataQuery)([["$select","msdyn_objectid,msdyn_componenttype,msdyn_workflowcategory,msdyn_displayname,msdyn_name"],["$filter",`msdyn_solutionid eq ${r} and (${n})`]])}`,o=(await(0,Ov.collectPages)(e,i,"fetchSolutionComponents")).filter(s=>typeof s.msdyn_objectid=="string").map(s=>({objectId:s.msdyn_objectid,componentType:Number(s.msdyn_componenttype),workflowCategory:s.msdyn_workflowcategory==null?void 0:Number(s.msdyn_workflowcategory),displayName:s.msdyn_displayname,name:s.msdyn_name}));return[...o,...await Ex(e,r,o)]}te.fetchSolutionComponents=Sx;async function Ex(e,t,r){let n=new Set(r.map(s=>s.objectId.toLowerCase())),i=`/solutioncomponents${(0,Et.odataQuery)([["$select","objectid,componenttype"],["$filter",`_solutionid_value eq ${t} and componenttype eq ${te.SolutionComponentType.UxAgentProject}`]])}`,a=await(0,Ov.collectPages)(e,i,"fetchSolutionComponents(draft pages)"),o=[];for(let s of a){let l=typeof s.objectid=="string"?s.objectid:void 0;l&&!n.has(l.toLowerCase())&&(n.add(l.toLowerCase()),o.push({objectId:l,componentType:te.SolutionComponentType.UxAgentProject}))}return o}function Nx(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 Dx(e,t){var r,n,i,a,o,s,l,u,c,d;let p=String(t??"").trim();if(!p)throw new Kn.InvalidArgumentError("getSolution: a solution unique name or id is required.");let f=Nx(p)?`solutionid eq ${(0,Et.normalizeGuid)(p,"solutionId")}`:`uniquename eq '${(0,Et.odataLiteral)(p)}'`,h=`/solutions${(0,Et.odataQuery)([["$select","solutionid,uniquename,friendlyname,version,ismanaged"],["$expand","publisherid($select=publisherid,uniquename,customizationprefix,customizationoptionvalueprefix)"],["$filter",f]])}`,S=((n=(r=(0,nr.ensureSuccess)(await e.get(h),e.apiUrl(h)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!S?.solutionid)throw new Kn.InvalidArgumentError(`No solution found for '${t}'.`);let D=S.publisherid;if(!D?.publisherid)throw new Kn.InvalidArgumentError(`Solution '${(i=S.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 D))throw new Kn.InvalidArgumentError(`Solution '${(a=S.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,Et.normalizeGuid)(S.solutionid,"solutionId"),uniqueName:(o=S.uniquename)!==null&&o!==void 0?o:"",friendlyName:(s=S.friendlyname)!==null&&s!==void 0?s:"",version:(l=S.version)!==null&&l!==void 0?l:"",isManaged:!!S.ismanaged,publisherId:(0,Et.normalizeGuid)(D.publisherid,"publisherId"),publisherUniqueName:(u=D.uniquename)!==null&&u!==void 0?u:"",publisherPrefix:(c=D.customizationprefix)!==null&&c!==void 0?c:"",publisherOptionValuePrefix:(d=D.customizationoptionvalueprefix)!==null&&d!==void 0?d:0}}te.getSolution=Dx;async function Ix(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,nr.ensureSuccess)(await e.post("/publishers",n),e.apiUrl("/publishers")),a=(0,nr.readCreatedId)(i,"publisherid");if(!a)throw new Kn.InvalidArgumentError(`Dataverse did not return an id for publisher '${t.uniqueName}'`);return{id:a,uniqueName:t.uniqueName}}te.createPublisher=Ix;async function _x(e,t){var r;let n=(0,Et.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,nr.ensureSuccess)(await e.post("/solutions",i),e.apiUrl("/solutions")),o=(0,nr.readCreatedId)(a,"solutionid");if(!o)throw new Kn.InvalidArgumentError(`Dataverse did not return an id for solution '${t.uniqueName}'`);return{id:o,uniqueName:t.uniqueName}}te.createSolution=_x;async function Tx(e,t,r){let i=`/solutions(${(0,Et.normalizeGuid)(t,"solutionId")})`;(0,nr.ensureSuccess)(await e.patch(i,{version:r}),e.apiUrl(i))}te.setSolutionVersion=Tx;async function Px(e,t){var r;let i={ComponentId:(0,Et.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,nr.ensureSuccess)(await e.post("/AddSolutionComponent",i),e.apiUrl("/AddSolutionComponent"))}te.addSolutionComponent=Px;async function Ox(e,t,r,n){let a={SolutionComponent:{"@odata.type":"Microsoft.Dynamics.CRM.solutioncomponent",solutioncomponentid:(0,Et.normalizeGuid)(t,"componentId")},ComponentType:r,SolutionUniqueName:n};(0,nr.ensureSuccess)(await e.post("/RemoveSolutionComponent",a),e.apiUrl("/RemoveSolutionComponent"))}te.removeSolutionComponent=Ox;async function Rx(e,t){var r,n;let i={SolutionName:t.solutionName,Managed:(r=t.managed)!==null&&r!==void 0?r:!1},o=(n=(0,nr.ensureSuccess)(await e.post("/ExportSolution",i),e.apiUrl("/ExportSolution")).body)===null||n===void 0?void 0:n.ExportSolutionFile;if(!o)throw new Kn.InvalidArgumentError(`ExportSolution returned no file for '${t.solutionName}'`);return{base64:o}}te.exportSolution=Rx;async function Fx(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,Et.normalizeGuid)(t.importJobId,"importJobId")),(0,nr.ensureSuccess)(await e.post("/ImportSolution",i),e.apiUrl("/ImportSolution"))}te.importSolution=Fx;async function xx(e,t){let n=`/solutions(${(0,Et.normalizeGuid)(t,"solutionId")})`;(0,nr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}te.deleteSolution=xx});var sl=v(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.appApi=En.deleteAppResolvingOnce=En.unpublishedAppModulesQuery=void 0;var wd=$t(),Lx=Cd(),Fv=rr(),kx=rl(),Ae=be(),se=ie(),bd=ct(),Mx=qc(),he=re(),Bx=(0,se.odataQuery)([["$select","appmoduleid,name,uniquename,description,aiappdescription"]]),hd="appmoduleid,name,uniquename,description,aiappdescription";function $v(e,t,r){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select",e],["$filter",t],["$top",r]])}En.unpublishedAppModulesQuery=$v;function gd(e,t){return $v(e,t?`appmoduleid eq ${t}`:void 0,t?1:void 0)}function ol(e,t){return"/sitemaps/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select",t],["$filter",`sitemapid eq ${e}`],["$top",1]])}function Ui(e){var t;let r=(t=e.body)===null||t===void 0?void 0:t.value;if(Array.isArray(r))return r[0]}function al(e){let t=e?.["@odata.etag"];return typeof t=="string"?t:null}function mo(e){let t=new Set,r=[];for(let n of e??[])n&&!t.has(n)&&(t.add(n),r.push(n));return r}function Ux(e){return`cdsapp_${(e||"").replace(/[^a-zA-Z0-9]/g,"")||"app"}`}async function qv(e,t){var r,n;let i=u=>{throw new he.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,se.odataQuery)([["$select","sitemapid"],["$filter",`sitemapnameunique eq '${(0,se.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 $x(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,se.odataQuery)([["$select","webresourceid"],["$top",1],["$filter",s]])}`,n="(webresourcetype eq 5 or webresourcetype eq 6 or webresourcetype eq 7 or webresourcetype eq 10 or webresourcetype eq 11)",i=t(await e.get(r("webresourcetype eq 5 and ismanaged eq false and contains(name,'icon')")));if(i)return{id:i,managed:!1};let a=t(await e.get(r(`${n} and ismanaged eq false`)));if(a)return{id:a,managed:!1};let o=t(await e.get(r(n)));return o?{id:o,managed:!0}:void 0}function Ad(e){return e instanceof Error?e.message:String(e)}async function qx(e,t){var r,n,i;try{let a=`/roles${(0,se.odataQuery)([["$select","roleid"],["$filter","name eq 'System Administrator'"],["$top",1]])}`,s=(i=(n=(r=(0,Ae.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.roleid;if(!s)return"App roles: no 'System Administrator' role was found in this environment, so the app was created with NO security role associated \u2014 it will not be visible or playable until a role is granted access to it.";let l=`/appmodules(${t})/appmoduleroles_association/$ref`;return(0,Ae.ensureSuccess)(await e.post(l,{"@odata.id":e.apiUrl(`/roles(${s})`)}),e.apiUrl(l)),null}catch(a){return`App roles: could not associate the 'System Administrator' role with the app (${Ad(a)}); it will not be visible or playable until a role is granted access to it.`}}async function Vx(e,t){let r=[];async function n(s,l,u){try{return(await(0,wd.collectPages)(e,s,`app assets (${u} for '${t}')`)).map(d=>String(d[l])).filter(d=>d&&d!=="undefined")}catch(c){return r.push(`App components: could not enumerate ${u} for table '${t}' (${Ad(c)}); they were NOT added to the app.`),[]}}let[i,a,o]=await Promise.all([n(`/systemforms${(0,se.odataQuery)([["$select","formid"],["$filter",`objecttypecode eq '${(0,se.odataLiteral)(t)}' and type eq 2 and formactivationstate eq 1`]])}`,"formid","forms"),n(`/savedqueries${(0,se.odataQuery)([["$select","savedqueryid"],["$filter",`returnedtypecode eq '${(0,se.odataLiteral)(t)}' and querytype eq 0 and statecode eq 0`]])}`,"savedqueryid","views"),n(`/savedqueryvisualizations${(0,se.odataQuery)([["$select","savedqueryvisualizationid"],["$filter",`primaryentitytypecode eq '${(0,se.odataLiteral)(t)}'`]])}`,"savedqueryvisualizationid","charts")]);return{forms:i,views:a,charts:o,warnings:r}}var xv=new WeakMap;async function Gx(e,t){let r=xv.get(e);r||(r=new Map,xv.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=await zx(e,t);return i&&r.set(t,i),i}async function Lv(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 zx(e,t){let r=`/EntityDefinitions(LogicalName='${(0,se.odataPathLiteral)(t)}')${(0,se.odataQuery)([["$select","MetadataId,EntitySetName"]])}`,n=await e.get(r);if(n.status>=200&&n.status<300){let i=n.body;if(i?.MetadataId&&i.EntitySetName)return{logicalName:t,metadataId:i.MetadataId,entitySetName:i.EntitySetName}}}async function kv(e,t){let r=[],n=mo(t.entities),i=4,a=await Lv(n,i,f=>Gx(e,f)),o=n.filter((f,h)=>!a[h]);if(o.length>0)throw new he.SdkError("APP_ENTITY_COMPONENT_UNRESOLVED",`Refusing to build app components: table(s) ${o.map(f=>`'${f}'`).join(", ")} could not be resolved to an EntityDefinitions MetadataId + EntitySetName. Pinning the rest would produce an app whose navigation references a table the app does not contain. Verify the table name(s) exist in this environment and retry.`);let s=a.filter(f=>!!f);for(let f of s)r.push({"@odata.id":`${f.entitySetName}(${f.metadataId})`});for(let f of mo(t.components.forms))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:f});for(let f of mo(t.components.views))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:f});for(let f of mo(t.components.charts))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:f});for(let f of mo(t.components.dashboards))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:f});let l=new Set(t.components.forms),u=new Set(t.components.views),c=new Set(t.components.charts),d=await Lv(n,i,f=>Vx(e,f)),p=d.flatMap(f=>f.warnings);for(let f of d){for(let h of f.forms)l.has(h)||(l.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:h}));for(let h of f.views)u.has(h)||(u.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:h}));for(let h of f.charts)c.has(h)||(c.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:h}))}return{components:r,tables:s,warnings:p}}async function Mv(e,t,r){if(r.length===0)return;let n="/AddAppComponents";(0,Ae.ensureSuccess)(await e.post(n,{AppId:t,Components:r}),e.apiUrl(n))}function Wx(e){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select","appmoduleid,appmoduleidunique"],["$filter",`appmoduleid eq ${e}`],["$top",1]])}async function Bv(e,t,r){var n;if(r.length===0)return;let i=Wx(t),a=await e.get(i);if(a.status<200||a.status>=300)throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its components were written but could not be verified \u2014 the unpublished-aware read returned HTTP ${a.status}. Re-push to retry.`);let o=Ui(a),s=o?.appmoduleidunique;if(typeof s!="string"||!s)throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its components were written but could not be verified \u2014 the app did not return an 'appmoduleidunique' to file components under. Re-push to retry.`);let l=`/appmodulecomponents${(0,se.odataQuery)([["$select","objectid,componenttype"],["$filter",`_appmoduleidunique_value eq ${(0,se.normalizeGuid)(s,`App '${t}' appmoduleidunique`)} and componenttype eq 1`]])}`,u=await e.get(l);if(u.status<200||u.status>=300)throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its table components were written but could not be verified \u2014 reading them back returned HTTP ${u.status}. Re-push to retry.`);let c=(n=u.body)===null||n===void 0?void 0:n.value;if(!Array.isArray(c))throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its table components were written but could not be verified \u2014 the read-back returned no readable result set. Re-push to retry.`);let d=new Set(c.map(f=>f.objectid).filter(f=>typeof f=="string").map(f=>f.toLowerCase())),p=r.filter(f=>!d.has(f.metadataId.toLowerCase()));if(p.length>0)throw new he.SdkError("APP_COMPONENTS_NOT_PERSISTED",`App '${t}': ${p.length} declared table(s) are NOT components of the app after AddAppComponents reported success \u2014 ${p.map(f=>`'${f.logicalName}' (expected objectid ${f.metadataId})`).join(", ")}. The app's navigation would reference content the app does not contain.`)}async function Hx(e,t,r){let n=`/appmodules(${t})`,i=`/sitemaps(${r.sitemapId})`;try{let a=await jx(e,r.sitemapId,r.sitemapNameUnique);if(a==="absent"){r.serverRefusedSitemap&&(0,Ae.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}if(a==="foreign"){r.serverRefusedSitemap&&(0,Ae.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}e.supportsAtomicBatch&&await Gv(e,[{path:n},{path:i,etag:r.sitemapEtag}])}catch{}}async function jx(e,t,r){var n,i,a;let o=ol(t,"sitemapid,sitemapnameunique"),s=await e.get(o);if(s.status<200||s.status>=300)throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned HTTP ${s.status}, so it cannot be determined whether the row exists.`);let l=(n=s.body)===null||n===void 0?void 0:n.value;if(!Array.isArray(l))throw new he.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 l.length===0?"absent":String((a=(i=l[0])===null||i===void 0?void 0:i.sitemapnameunique)!==null&&a!==void 0?a:"")===r?"ours":"foreign"}async function Vv(e,t){var r;let n=(0,se.normalizeGuid)(t,"id"),i=h=>{throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to delete app '${n}': ${h} 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})${Bx}`,o;try{o=await e.get(a)}catch(h){return i(`reading the app failed (${h.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 qv(e,s);if(!l)return{uniquename:s,appEtag:(0,Ae.readEtag)(o)};let u=(0,se.normalizeGuid)(l,"sitemapId"),c=ol(u,"sitemapid,sitemapnameunique,sitemapxml"),d;try{d=await e.get(c)}catch(h){return i(`reading sitemap '${u}' failed (${h.message}).`)}if(d.status<200||d.status>=300)return i(`reading sitemap '${u}' returned HTTP ${d.status}.`);let p=Ui(d);if(!p)return i(`sitemap '${u}' was not returned by the unpublished-aware read.`);if(p.sitemapnameunique!==s)return i(`sitemap '${u}' now carries sitemapnameunique '${String(p.sitemapnameunique)}', not '${s}', so it is no longer this app's sitemap.`);let f=p.sitemapxml;return typeof f!="string"?i(`sitemap '${u}' returned no sitemapxml.`):{sitemapId:u,uniquename:s,sitemapXml:f,appEtag:(0,Ae.readEtag)(o),sitemapEtag:al(p)}}async function Jx(e,t,r){let n=(0,se.normalizeGuid)(t,"id"),i=await Vv(e,n);await r?.(i.sitemapXml),await zv(e,n,i)}En.deleteAppResolvingOnce=Jx;async function Gv(e,t){let r=`batch_${(0,bd.newId)()}`,n=`changeset_${(0,bd.newId)()}`,i=t.map((d,p)=>[`--${n}`,"Content-Type: application/http","Content-Transfer-Encoding: binary",`Content-ID: ${p+1}`,"",`DELETE ${e.apiUrl(d.path)} HTTP/1.1`,...d.etag?[`If-Match: ${d.etag}`]:[],""].join(`\r
+`)}function wv(e){this.options=e||{locator:{}}}wv.prototype.parseFromString=function(e,t){var r=this.options,n=new UF,i=r.domBuilder||new yo,a=r.errorHandler,o=r.locator,s=r.xmlns||{},l=/\/x?html?$/.test(t),u=l?hv.HTML_ENTITIES:hv.XML_ENTITIES;o&&i.setDocumentLocator(o),n.errorHandler=BF(a,i,o),n.domBuilder=r.domBuilder||i,l&&(s[""]=gv.HTML),s.xml=s.xml||gv.XML;var c=r.normalizeLineEndings||bv;return e&&typeof e=="string"?n.parse(c(e),s,u):n.errorHandler.error("invalid doc source"),i.doc};function BF(e,t,r){if(!e){if(t instanceof yo)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+vd(r))}||function(){}}return a("warning"),a("error"),a("fatalError"),n}function yo(){this.cdata=!1}function zi(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}yo.prototype={startDocument:function(){this.doc=new kF().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;el(this,a),this.currentElement=a,this.locator&&zi(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&&zi(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&&zi(this.locator,r),el(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=vv.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&&zi(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=vv.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&zi(this.locator,n),el(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&&zi(this.locator,i),el(this,i),this.doc.doctype=i}},warning:function(e){console.warn("[xmldom warning] "+e,vd(this.locator))},error:function(e){console.error("[xmldom error] "+e,vd(this.locator))},fatalError:function(e){throw new MF(e,this.locator)}};function vd(e){if(e)return`
+@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function vv(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){yo.prototype[e]=function(){return null}});function el(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}tl.__DOMHandler=yo;tl.normalizeLineEndings=bv;tl.DOMParser=wv});var yd=v(rl=>{var Cv=md();rl.DOMImplementation=Cv.DOMImplementation;rl.XMLSerializer=Cv.XMLSerializer;rl.DOMParser=Av().DOMParser});var Tn=v(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.installDomShim=void 0;var Ev=yd(),Sv=!1,$F={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 qF(){if(Sv)return;let e=globalThis;typeof e.DOMParser>"u"&&(e.DOMParser=Ev.DOMParser),typeof e.XMLSerializer>"u"&&(e.XMLSerializer=Ev.XMLSerializer),typeof e.Node>"u"&&(e.Node=$F),Sv=!0}nl.installDomShim=qF});var ri=v(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.projectElementBag=_e.serializeNode=_e.domEngine=_e.nodeLikeFromDom=_e.parseXmlRoot=_e.EMPTY_FORM_SENTINEL=_e.TEXT_SENTINEL=void 0;var VF=In(),bo=te(),GF=Tn();_e.TEXT_SENTINEL="#text";_e.EMPTY_FORM_SENTINEL="#empty";var al=new WeakSet;function zF(e,t){(0,GF.installDomShim)();let r=e&&e.trim()!==""?e:t,i=new DOMParser().parseFromString(r,"text/xml").documentElement;if(!i)throw new bo.InvalidArgumentError("XML source has no root element (empty or malformed input)");return HF(i),jF(i),KF(i,r),i}_e.parseXmlRoot=zF;var WF=new Set([1,3]);function HF(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(!WF.has(a.nodeType))throw new bo.InvalidArgumentError(`Unsupported XML node type ${a.nodeType} (CDATA / comment / processing-instruction) is outside the hybrid projection's lossless grammar and cannot be round-tripped`);a.nodeType===1&&t.push(a)}}}function jF(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 bo.InvalidArgumentError(`Unsupported document-level XML node (type ${o.nodeType}: declaration / comment / processing-instruction outside the root element) cannot be round-tripped`)}}function JF(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 QF(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 Dv(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 KF(e,t){let r=JF(t),n=QF(e),i=Math.min(r.length,n.length);for(let a=0;a<i;a+=1){if(r[a])continue;let o=n[a];Dv(o)||al.add(o)}}function bd(e){let t=e.nodeType===3;return{getNodeName:()=>t?_e.TEXT_SENTINEL:e.tagName,getAllProperties:()=>{var r;if(t)return[{key:_e.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 al.has(e)&&!Dv(e)&&i.push({key:_e.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(bd(a))}return r}}}_e.nodeLikeFromDom=bd;function XF(e){return{make:t=>t===_e.TEXT_SENTINEL?e.createTextNode(""):e.createElement(t),setProp:(t,r,n)=>{t.nodeType===3?t.nodeValue=n:r===_e.EMPTY_FORM_SENTINEL?al.add(t):t.setAttribute(r,n)},addChild:(t,r)=>{t.appendChild(r)}}}_e.domEngine=XF;function Iv(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 il(r);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))throw il(r);t+=1;continue}if(r>=56320&&r<=57343)throw il(r)}}function il(e){let t=e.toString(16).toUpperCase().padStart(4,"0");return new bo.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 YF(e){return Iv(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/\r/g,"&#xD;").replace(/\n/g,"&#xA;").replace(/\t/g,"&#x9;")}function ZF(e){return Iv(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ex(e){return _v(e,0)}_e.serializeNode=ex;var Nv=512;function _v(e,t){var r;if(t>Nv)throw new bo.InvalidArgumentError(`XML nesting exceeds the maximum supported depth of ${Nv}`);if(e.nodeType===3)return ZF((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+'="'+YF(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 al.has(n)?i+"></"+n.tagName+">":i+" />";i+=">";for(let l of o)i+=_v(l,t+1);return i+"</"+n.tagName+">"}function tx(e){let t=bd(e);return{a:t.getAllProperties().map(r=>[r.key,r.value]),c:t.getAllChildren().map((r,n)=>({i:n,node:(0,VF.rawFromNode)(r)}))}}_e.projectElementBag=tx});var Cd=v(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.getFormSecurityRoles=Pn.setFormSecurityRoles=Pn.formApi=void 0;var rx=qt(),he=be(),Gt=ae(),Wi=te(),wd=ri(),nx="formid,formxml,name,type,objecttypecode,formpresentation,formactivationstate,uniquename,description,versionnumber",ix="formid,name,type,objecttypecode",ax=2,ox={Main:ax,QuickView:6,QuickCreate:7,Card:11};Pn.formApi={async get(e,t){let n=`/systemforms(${(0,Gt.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Gt.odataQuery)([["$select",nx]]),i=(0,he.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,he.readEtag)(i)}},async list(e,t){var r;let n=!((r=t?.formTypes)===null||r===void 0)&&r.length?t.formTypes:["Main"],i=[...new Set(n.map(u=>ox[u]))],o=[i.length===1?`type eq ${i[0]}`:`(${i.map(u=>`type eq ${u}`).join(" or ")})`];t?.entityLogicalName&&o.push(`objecttypecode eq '${(0,Gt.odataLiteral)(t.entityLogicalName)}'`);let s=`/systemforms${(0,Gt.odataQuery)([["$select",ix],["$filter",o.join(" and ")]])}`;return(await(0,rx.collectPages)(e,s,"listArtifacts('form')")).map(u=>{var c,d;return{type:"form",id:(c=u.formid)!==null&&c!==void 0?c:"",name:(d=u.name)!==null&&d!==void 0?d:"",entityLogicalName:u.objecttypecode,isDirty:!1}})},async create(e,t,r){let n=(0,he.echoWrite)("formid"),i=`/systemforms${n.query}`,a=(0,he.ensureSuccess)(await e.post(i,(0,he.withClientMintedId)(t,"formid",r),n.options),e.apiUrl(i));return{id:(0,he.resolveCreatedId)(a,"formid","form",r),etag:(0,he.readEtag)(a)}},async update(e,t,r,n){let i=(0,Gt.normalizeGuid)(t,"id");await Ov(e,i,Pv(i),n);let a=await Tv(e,i),o=(0,he.echoWrite)("formid",{"If-Match":(0,he.requireEtag)(a,"form",i)}),s=`/systemforms(${i})${o.query}`;return(0,he.ensureSuccess)(await e.patch(s,r,o.options),e.apiUrl(s)),{id:i,etag:await lx(e,i)}},delete(e,t){return(0,he.deleteRecord)(e,"systemforms",t)}};var Ad="DisplayConditions";async function sx(e,t,r){var n,i,a,o;if(r.everyone&&r.roleIds&&r.roleIds.length>0)throw new Wi.InvalidArgumentError("setFormSecurityRoles: `everyone` and `roleIds` are mutually exclusive \u2014 the platform models <Everyone /> as a replacement for the <Role> list, not an addition to it.");let s=(0,Gt.normalizeGuid)(t,"formId"),l=`/systemforms(${s})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Gt.odataQuery)([["$select","formid,formxml"]]),u=(0,he.ensureSuccess)(await e.get(l),e.apiUrl(l)),c=(0,he.readEtag)(u),d=u.body,p=d?.formxml;if(!p)throw new Wi.InvalidArgumentError(`form '${s}' returned no formxml, so its roles cannot be set`);let f=(0,wd.parseXmlRoot)(p,"<form/>"),m=f.ownerDocument;if(!m)throw new Wi.InvalidArgumentError(`form '${s}' produced no owner document`);let g=Rv(f,Ad),y=g?.hasAttribute("Order")&&(n=g.getAttribute("Order"))!==null&&n!==void 0?n:void 0,A=g?.getAttribute("FallbackForm")||void 0;g&&f.removeChild(g);let D=!!r.everyone||((a=(i=r.roleIds)===null||i===void 0?void 0:i.length)!==null&&a!==void 0?a:0)>0;if(!D&&(r.order!==void 0||r.fallbackForm!==void 0)){if(!g)throw new Wi.InvalidArgumentError("setFormSecurityRoles: `order`/`fallbackForm` were supplied without `roleIds` or `everyone`, but this form has no <DisplayConditions> to attach them to. Pass the roles as well.");r.order!==void 0&&g.setAttribute("Order",String(r.order)),r.fallbackForm!==void 0&&g.setAttribute("FallbackForm",String(r.fallbackForm)),f.appendChild(g)}else if(D){let L=m.createElement(Ad),k=r.order!==void 0?String(r.order):y;k!==void 0&&L.setAttribute("Order",k);let M=r.fallbackForm!==void 0?String(r.fallbackForm):A??"false";if(L.setAttribute("FallbackForm",M),r.everyone)L.appendChild(m.createElement("Everyone"));else for(let G of(o=r.roleIds)!==null&&o!==void 0?o:[]){let V=m.createElement("Role");V.setAttribute("Id",`{${(0,Gt.normalizeGuid)(G,"roleId")}}`),L.appendChild(V)}f.appendChild(L)}let _=(0,wd.serializeNode)(f);await Ov(e,s,l,c);let q=await Tv(e,s),B=`/systemforms(${s})`;(0,he.ensureSuccess)(await e.patch(B,{formxml:_},{headers:{"Content-Type":"application/json","If-Match":(0,he.requireEtag)(q,"form",s)}}),e.apiUrl(B))}Pn.setFormSecurityRoles=sx;async function Tv(e,t){let r=`/systemforms(${t})${(0,Gt.odataQuery)([["$select","formid"]])}`;return(0,he.readEtag)((0,he.ensureSuccess)(await e.get(r),e.apiUrl(r)))}function Pv(e){return`/systemforms(${e})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Gt.odataQuery)([["$select","formid"]])}async function lx(e,t){let r=Pv(t);return(0,he.readEtag)((0,he.ensureSuccess)(await e.get(r),e.apiUrl(r)))}async function Ov(e,t,r,n){(0,he.requireEtag)(n,"form",t);let i=(0,he.readEtag)((0,he.ensureSuccess)(await e.get(r),e.apiUrl(r)));if(i===null)throw new Wi.SdkError(he.VERSION_CONFLICT_CODE,`Refusing to write form '${t}': its current version could not be read, so the write could not be verified as conditional and would risk silently overwriting a concurrent edit.`);if(i!==n)throw new Wi.SdkError(he.VERSION_CONFLICT_CODE,`Version conflict writing form '${t}': its formxml changed on the server since it was read (held ${n}, server ${i}). Re-fetch the form and re-apply the change.`)}function Rv(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===t)return i}}async function ux(e,t){var r,n;let a=`/systemforms(${(0,Gt.normalizeGuid)(t,"formId")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Gt.odataQuery)([["$select","formid,formxml"]]),s=(r=(0,he.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.formxml;if(!s)return;let l=(0,wd.parseXmlRoot)(s,"<form/>"),u=Rv(l,Ad);if(!u)return;let c=[],d=!1,p=u.childNodes;for(let m=0;m<p.length;m+=1){let g=p[m];if(g.nodeType!==1)continue;let y=g;if(y.tagName==="Everyone")d=!0;else if(y.tagName==="Role"){let A=(n=y.getAttribute("Id"))!==null&&n!==void 0?n:"";A&&c.push(A.replace(/[{}]/g,"").toLowerCase())}}let f=u.getAttribute("Order");return{...d?{everyone:!0}:{},...c.length>0?{roleIds:c}:{},fallbackForm:u.getAttribute("FallbackForm")==="true",...f!==null&&f!==""?{order:Number(f)}:{}}}Pn.getFormSecurityRoles=ux});var ll=v(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.disassociateRecords=Se.associateRecords=Se.createRecordsBulk=Se.upsertRecord=Se.queryAllRecords=Se.queryRecords=Se.getRecord=Se.deleteRecord=Se.updateRecord=Se.createRecord=void 0;var cx=qt(),sr=be(),rt=ae(),ol=te(),Dr=qs();function sl(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 dx(e,t,r){let i=`/${await(0,Dr.resolveEntitySetName)(e,t)}`,a=(0,sr.ensureSuccess)(await e.post(i,sl(r)),e.apiUrl(i)),o=(0,sr.readCreatedId)(a,`${t}id`);if(!o)throw new ol.InvalidArgumentError(`Dataverse did not return an id for the created '${t}' row`);return{id:o,entityType:t}}Se.createRecord=dx;async function px(e,t,r,n){let i=(0,rt.normalizeGuid)(r,"id"),o=`/${await(0,Dr.resolveEntitySetName)(e,t)}(${i})`;(0,sr.ensureSuccess)(await e.patch(o,sl(n)),e.apiUrl(o))}Se.updateRecord=px;async function fx(e,t,r){let n=(0,rt.normalizeGuid)(r,"id"),a=`/${await(0,Dr.resolveEntitySetName)(e,t)}(${n})`;(0,sr.ensureSuccess)(await e.delete(a),e.apiUrl(a))}Se.deleteRecord=fx;async function mx(e,t,r,n){var i;let a=(0,rt.normalizeGuid)(r,"id"),o=await(0,Dr.resolveEntitySetName)(e,t),s=(0,rt.odataQuery)([["$select",n&&n.length>0?n.join(","):void 0]]),l=`/${o}(${a})${s}`;return(i=(0,sr.ensureSuccess)(await e.get(l),e.apiUrl(l)).body)!==null&&i!==void 0?i:{}}Se.getRecord=mx;function hx(e){return e?.fetchXml?(0,rt.odataQuery)([["fetchXml",e.fetchXml]]):(0,rt.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 Fv(e,t,r){var n,i;if(r?.paginate){if(r.top!==void 0)throw new ol.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 ol.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,Dr.resolveEntitySetName)(e,t)}${hx(r)}`;return r?.paginate?(0,cx.collectPages)(e,o,"queryRecords"):(i=(n=(0,sr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]}Se.queryRecords=Fv;async function gx(e,t,r){return Fv(e,t,{...r,paginate:!0})}Se.queryAllRecords=gx;function vx(e){if("id"in e)return`(${(0,rt.normalizeGuid)(e.id,"id")})`;let t=typeof e.value=="string"?`'${(0,rt.odataPathLiteral)(e.value)}'`:e.value;return`(${(0,rt.assertODataName)(e.key,"alternate key name")}=${t})`}async function yx(e,t,r,n){let i=vx(r),o=`/${await(0,Dr.resolveEntitySetName)(e,t)}${i}`,s=(0,sr.ensureSuccess)(await e.patch(o,sl(n)),e.apiUrl(o)),l=s.status===201,u=(0,sr.readCreatedId)(s,`${t}id`);return{id:u??("id"in r?(0,rt.normalizeGuid)(r.id,"id"):""),created:l}}Se.upsertRecord=yx;async function bx(e,t,r){var n,i;if(r.length===0)return[];let a=await(0,Dr.resolveEntitySetName)(e,t),o=r.map(c=>({"@odata.type":`Microsoft.Dynamics.CRM.${t}`,...sl(c)})),s=`/${a}/Microsoft.Dynamics.CRM.CreateMultiple`,u=(i=(n=(0,sr.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 ol.InvalidArgumentError(`CreateMultiple on '${t}' returned ${u.length} id(s) for ${r.length} row(s)`);return u}Se.createRecordsBulk=bx;async function wx(e,t,r,n){let i=(0,rt.normalizeGuid)(r,"id"),a=(0,rt.normalizeGuid)(n.targetId,"targetId"),o=await(0,Dr.resolveEntitySetName)(e,t),s=await(0,Dr.resolveEntitySetName)(e,n.targetEntity),l=(0,rt.assertODataName)(n.relationshipName,"relationshipName"),u=`/${o}(${i})/${l}/$ref`,c={"@odata.id":e.apiUrl(`/${s}(${a})`)};(0,sr.ensureSuccess)(await e.post(u,c),e.apiUrl(u))}Se.associateRecords=wx;async function Ax(e,t,r,n,i){let a=(0,rt.normalizeGuid)(r,"id"),o=(0,rt.normalizeGuid)(i,"targetId"),s=await(0,Dr.resolveEntitySetName)(e,t),l=(0,rt.assertODataName)(n,"relationshipName"),u=`/${s}(${a})/${l}(${o})/$ref`;(0,sr.ensureSuccess)(await e.delete(u),e.apiUrl(u))}Se.disassociateRecords=Ax});var lr=v(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.publishBoundEntity=Ge.boundEntityPublishScope=Ge.publishGenPageById=Ge.publishDashboardById=Ge.publishWebResourceById=Ge.publishEntity=Ge.publishAppModule=Ge.publishXml=void 0;var Cx=be(),wo=ae(),xv="/PublishXml";async function Hi(e,t){(0,Cx.ensureSuccess)(await e.post(xv,{ParameterXml:t}),e.apiUrl(xv))}Ge.publishXml=Hi;function Ex(e,t){return Hi(e,`<importexportxml><appmodules><appmodule>${(0,wo.xmlText)(t)}</appmodule></appmodules></importexportxml>`)}Ge.publishAppModule=Ex;function Lv(e,t){return Hi(e,`<importexportxml><entities><entity>${(0,wo.xmlText)(t)}</entity></entities></importexportxml>`)}Ge.publishEntity=Lv;function Sx(e,t){return Hi(e,`<importexportxml><webresources><webresource>${(0,wo.xmlText)(t)}</webresource></webresources></importexportxml>`)}Ge.publishWebResourceById=Sx;function Nx(e,t){return Hi(e,`<importexportxml><dashboards><dashboard>${(0,wo.xmlText)(t)}</dashboard></dashboards></importexportxml>`)}Ge.publishDashboardById=Nx;function Dx(e,t){return Hi(e,`<importexportxml><uxagentprojects><uxagentproject>${(0,wo.xmlText)(t)}</uxagentproject></uxagentprojects></importexportxml>`)}Ge.publishGenPageById=Dx;function Ix(e){let t=e?.entityLogicalName;return t?{envelope:"entity",entityLogicalName:t,blastRadiusWarning:"ENTITY_ENVELOPE_ALSO_SHIPS_UNRELATED_UNPUBLISHED_CHANGES"}:{envelope:"entity"}}Ge.boundEntityPublishScope=Ix;function _x(e,t){let r=t?.entityLogicalName;return r?Lv(e,r):Promise.resolve()}Ge.publishBoundEntity=_x});var Sd=v(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.base64ToBytes=On.bytesToBase64=On.utf8ToBase64=void 0;var kv=32768,St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Ed(){return globalThis}function Tx(e){let t=[];for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>=55296&&n<=56319){let i=r+1<e.length?e.charCodeAt(r+1):0;i>=56320&&i<=57343?(n=(n-55296<<10)+(i-56320)+65536,r+=1):n=65533}else n>=56320&&n<=57343&&(n=65533);n<128?t.push(n):n<2048?t.push(192|n>>6,128|n&63):n<65536?t.push(224|n>>12,128|n>>6&63,128|n&63):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63)}return Uint8Array.from(t)}function Px(e){let t="";for(let r=0;r<e.length;r+=kv)t+=String.fromCharCode(...e.subarray(r,r+kv));return t}function Ox(e){let t="";for(let r=0;r<e.length;r+=1){let n=String.fromCharCode(e.charCodeAt(r)&255);if(n==="=")break;n==="-"?t+="+":n==="_"?t+="/":St.indexOf(n)>=0&&(t+=n)}for(t.length%4===1&&(t=t.slice(0,-1));t.length%4!==0;)t+="=";return t}function Rx(e){let t="",r=0;for(;r+2<e.length;r+=3){let i=e[r]<<16|e[r+1]<<8|e[r+2];t+=St[i>>18&63]+St[i>>12&63]+St[i>>6&63]+St[i&63]}let n=e.length-r;if(n===1){let i=e[r]<<16;t+=`${St[i>>18&63]}${St[i>>12&63]}==`}else if(n===2){let i=e[r]<<16|e[r+1]<<8,a=St[i>>18&63],o=St[i>>12&63],s=St[i>>6&63];t+=`${a}${o}${s}=`}return t}function Fx(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0,r=e.length/4*3-t,n=new Uint8Array(r>0?r:0),i=0;for(let a=0;a<e.length;a+=4){let o=St.indexOf(e[a])<<18|St.indexOf(e[a+1])<<12|(e[a+2]==="="?0:St.indexOf(e[a+2]))<<6|(e[a+3]==="="?0:St.indexOf(e[a+3]));i<r&&(n[i++]=o>>16&255),i<r&&(n[i++]=o>>8&255),i<r&&(n[i++]=o&255)}return n}function xx(e){let t=Ed();if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");let r=t.TextEncoder;return Mv(r?new r().encode(e):Tx(e))}On.utf8ToBase64=xx;function Mv(e){let t=Ed();return t.Buffer?t.Buffer.from(e).toString("base64"):t.btoa?t.btoa(Px(e)):Rx(e)}On.bytesToBase64=Mv;function Lx(e){let t=Ed();if(t.Buffer)return new Uint8Array(t.Buffer.from(e,"base64"));let r=Ox(e);if(t.atob){let n=t.atob(r);return Uint8Array.from(n,i=>i.charCodeAt(0))}return Fx(r)}On.base64ToBytes=Lx});var qv=v(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.deleteWebResource=Ir.getWebResource=Ir.updateWebResource=Ir.createWebResource=void 0;var kx=lr(),Ao=be(),ul=ae(),Mx=Sd(),Uv=te(),Ux={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12};function Bv(e){if(e.contentBase64!==void 0)return e.contentBase64;if(e.content!==void 0)return(0,Mx.utf8ToBase64)(e.content)}async function $v(e,t){return(0,kx.publishWebResourceById)(e,t)}async function Bx(e,t){var r;let n=Bv(t);if(n===void 0)throw new Uv.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:Ux[t.type],content:n};t.description&&(i.description=t.description);let a=(0,Ao.ensureSuccess)(await e.post("/webresourceset",i),e.apiUrl("/webresourceset")),o=(0,Ao.readCreatedId)(a,"webresourceid");if(!o)throw new Uv.InvalidArgumentError(`Dataverse did not return an id for web resource '${t.name}'`);return t.publish!==!1&&await $v(e,o),{id:o,name:t.name}}Ir.createWebResource=Bx;async function $x(e,t,r){let n=(0,ul.normalizeGuid)(t,"id"),i={},a=Bv(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,Ao.ensureSuccess)(await e.patch(o,i),e.apiUrl(o)),r.publish!==!1&&await $v(e,n)}Ir.updateWebResource=$x;async function qx(e,t){var r;let i=`/webresourceset(${(0,ul.normalizeGuid)(t,"id")})${(0,ul.odataQuery)([["$select","name,displayname,webresourcetype,content,description"]])}`;return(r=(0,Ao.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)!==null&&r!==void 0?r:{}}Ir.getWebResource=qx;async function Vx(e,t){let n=`/webresourceset(${(0,ul.normalizeGuid)(t,"id")})`;(0,Ao.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Ir.deleteWebResource=Vx});var cl=v(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.applyAppSettings=ze.setAppSetting=ze.readAppSettings=ze.resolveSettingDefinitions=ze.APP_SETTING_UNSET=ze.APP_SETTING_OFF=ze.APP_SETTING_ON=ze.HEADER_AND_NAVIGATION_REFRESH=void 0;var ji=be(),Zr=ae();ze.HEADER_AND_NAVIGATION_REFRESH="HeaderAndNavigationRefresh";ze.APP_SETTING_ON="2";ze.APP_SETTING_OFF="1";ze.APP_SETTING_UNSET="0";function zv(e,t){return"/appsettings/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,Zr.odataQuery)([["$select",e],["$filter",t]])}async function Wv(e,t){var r,n;let i=[...new Set(t.filter(Boolean))],a=new Map;if(i.length===0)return a;let o=i.map(c=>`uniquename eq '${(0,Zr.odataLiteral)(c)}'`).join(" or "),s=`/settingdefinitions${(0,Zr.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",o]])}`,u=((n=(r=(0,ji.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]).filter(Boolean);for(let c of u)c.uniquename&&a.set(c.uniquename,c);return a}ze.resolveSettingDefinitions=Wv;async function Gx(e,t){var r,n,i,a;let o=(0,Zr.normalizeGuid)(t,"App id"),s=zv("appsettingid,value,_settingdefinitionid_value",`_parentappmoduleid_value eq ${o}`),u=((n=(r=(0,ji.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]).filter(Boolean);if(u.length===0)return[];let c=[...new Set(u.map(p=>p._settingdefinitionid_value).filter(Boolean))],d=new Map;if(c.length>0){let p=c.map(g=>`settingdefinitionid eq ${(0,Zr.normalizeGuid)(g,"Setting definition id")}`).join(" or "),f=`/settingdefinitions${(0,Zr.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",p]])}`,m=(0,ji.ensureSuccess)(await e.get(f),e.apiUrl(f));for(let g of((a=(i=m.body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[]).filter(Boolean))g.settingdefinitionid&&d.set(g.settingdefinitionid.toLowerCase(),g)}return u.map(p=>{var f,m,g,y,A;let D=d.get(((f=p._settingdefinitionid_value)!==null&&f!==void 0?f:"").toLowerCase());return{id:(m=p.appsettingid)!==null&&m!==void 0?m:"",name:(y=(g=D?.uniquename)!==null&&g!==void 0?g:p._settingdefinitionid_value)!==null&&y!==void 0?y:"",value:(A=p.value)!==null&&A!==void 0?A:"",...D?.displayname?{displayName:D.displayname}:{}}})}ze.readAppSettings=Gx;async function Vv(e,t,r){var n,i,a;let o=zv("appsettingid,value",`_parentappmoduleid_value eq ${t} and _settingdefinitionid_value eq ${r}`),l=((i=(n=(0,ji.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]).filter(Boolean)[0];return l?.appsettingid?{id:l.appsettingid,value:(a=l.value)!==null&&a!==void 0?a:""}:void 0}async function Hv(e,t,r,n){let i=(0,Zr.normalizeGuid)(t,"App id"),o=(await Wv(e,[r])).get(r),s=o?.settingdefinitionid;if(!s)throw new Error(`App setting '${r}' is not available in this environment: no settingdefinition row has that uniquename. The feature may be version-gated or its solution may not be installed.`);let l=(0,Zr.normalizeGuid)(s,"Setting definition id"),u=await Vv(e,i,l);if(u)return Gv(e,u,n);let c="/appsettings",d={"[email protected]":`/appmodules(${i})`,"[email protected]":`/settingdefinitions(${l})`,value:n},p,f;try{if(p=await e.post(c,d),p.status>=200&&p.status<300)return"created"}catch(g){f=g}let m;try{m=await Vv(e,i,l)}catch{m=void 0}if(m)return Gv(e,m,n);throw p&&(0,ji.ensureSuccess)(p,e.apiUrl(c)),f}ze.setAppSetting=Hv;async function Gv(e,t,r){if(t.value===r)return"unchanged";let n=`/appsettings(${(0,Zr.normalizeGuid)(t.id,"App setting id")})`;return(0,ji.ensureSuccess)(await e.patch(n,{value:r}),e.apiUrl(n)),"updated"}async function zx(e,t,r){var n;let i=[];for(let[a,o]of Object.entries(r??{}))try{await Hv(e,t,a,o)}catch(s){i.push(`App setting '${a}' was not applied: ${(n=s?.message)!==null&&n!==void 0?n:String(s)} The app was created; set it later with setAppSetting().`)}return i}ze.applyAppSettings=zx});var pl=v(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.HEADER_NAV_BOOLEAN_RULE=void 0;dl.HEADER_NAV_BOOLEAN_RULE="headerAndNavigationRefresh-must-be-boolean"});var Jv=v(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.deleteSolution=re.importSolution=re.exportSolution=re.removeSolutionComponent=re.addSolutionComponent=re.setSolutionVersion=re.createSolution=re.createPublisher=re.getSolution=re.fetchSolutionComponents=re.SolutionComponentType=void 0;var jv=qt(),ur=be(),Nt=ae(),ni=te();re.SolutionComponentType={SavedQuery:26,Workflow:29,SavedQueryVisualization:59,SystemForm:60,AppModule:80,UxAgentProject:10372};var Wx=[re.SolutionComponentType.SavedQuery,re.SolutionComponentType.Workflow,re.SolutionComponentType.SavedQueryVisualization,re.SolutionComponentType.SystemForm,re.SolutionComponentType.AppModule,re.SolutionComponentType.UxAgentProject];async function Hx(e,t){let r=(0,Nt.normalizeGuid)(t,"solutionId"),n=Wx.map(s=>`msdyn_componenttype eq ${s}`).join(" or "),i=`/msdyn_solutioncomponentsummaries${(0,Nt.odataQuery)([["$select","msdyn_objectid,msdyn_componenttype,msdyn_workflowcategory,msdyn_displayname,msdyn_name"],["$filter",`msdyn_solutionid eq ${r} and (${n})`]])}`,o=(await(0,jv.collectPages)(e,i,"fetchSolutionComponents")).filter(s=>typeof s.msdyn_objectid=="string").map(s=>({objectId:s.msdyn_objectid,componentType:Number(s.msdyn_componenttype),workflowCategory:s.msdyn_workflowcategory==null?void 0:Number(s.msdyn_workflowcategory),displayName:s.msdyn_displayname,name:s.msdyn_name}));return[...o,...await jx(e,r,o)]}re.fetchSolutionComponents=Hx;async function jx(e,t,r){let n=new Set(r.map(s=>s.objectId.toLowerCase())),i=`/solutioncomponents${(0,Nt.odataQuery)([["$select","objectid,componenttype"],["$filter",`_solutionid_value eq ${t} and componenttype eq ${re.SolutionComponentType.UxAgentProject}`]])}`,a=await(0,jv.collectPages)(e,i,"fetchSolutionComponents(draft pages)"),o=[];for(let s of a){let l=typeof s.objectid=="string"?s.objectid:void 0;l&&!n.has(l.toLowerCase())&&(n.add(l.toLowerCase()),o.push({objectId:l,componentType:re.SolutionComponentType.UxAgentProject}))}return o}function Jx(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 Qx(e,t){var r,n,i,a,o,s,l,u,c,d;let p=String(t??"").trim();if(!p)throw new ni.InvalidArgumentError("getSolution: a solution unique name or id is required.");let f=Jx(p)?`solutionid eq ${(0,Nt.normalizeGuid)(p,"solutionId")}`:`uniquename eq '${(0,Nt.odataLiteral)(p)}'`,m=`/solutions${(0,Nt.odataQuery)([["$select","solutionid,uniquename,friendlyname,version,ismanaged"],["$expand","publisherid($select=publisherid,uniquename,customizationprefix,customizationoptionvalueprefix)"],["$filter",f]])}`,A=((n=(r=(0,ur.ensureSuccess)(await e.get(m),e.apiUrl(m)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!A?.solutionid)throw new ni.InvalidArgumentError(`No solution found for '${t}'.`);let D=A.publisherid;if(!D?.publisherid)throw new ni.InvalidArgumentError(`Solution '${(i=A.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 D))throw new ni.InvalidArgumentError(`Solution '${(a=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,Nt.normalizeGuid)(A.solutionid,"solutionId"),uniqueName:(o=A.uniquename)!==null&&o!==void 0?o:"",friendlyName:(s=A.friendlyname)!==null&&s!==void 0?s:"",version:(l=A.version)!==null&&l!==void 0?l:"",isManaged:!!A.ismanaged,publisherId:(0,Nt.normalizeGuid)(D.publisherid,"publisherId"),publisherUniqueName:(u=D.uniquename)!==null&&u!==void 0?u:"",publisherPrefix:(c=D.customizationprefix)!==null&&c!==void 0?c:"",publisherOptionValuePrefix:(d=D.customizationoptionvalueprefix)!==null&&d!==void 0?d:0}}re.getSolution=Qx;async function Kx(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,ur.ensureSuccess)(await e.post("/publishers",n),e.apiUrl("/publishers")),a=(0,ur.readCreatedId)(i,"publisherid");if(!a)throw new ni.InvalidArgumentError(`Dataverse did not return an id for publisher '${t.uniqueName}'`);return{id:a,uniqueName:t.uniqueName}}re.createPublisher=Kx;async function Xx(e,t){var r;let n=(0,Nt.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,ur.ensureSuccess)(await e.post("/solutions",i),e.apiUrl("/solutions")),o=(0,ur.readCreatedId)(a,"solutionid");if(!o)throw new ni.InvalidArgumentError(`Dataverse did not return an id for solution '${t.uniqueName}'`);return{id:o,uniqueName:t.uniqueName}}re.createSolution=Xx;async function Yx(e,t,r){let i=`/solutions(${(0,Nt.normalizeGuid)(t,"solutionId")})`;(0,ur.ensureSuccess)(await e.patch(i,{version:r}),e.apiUrl(i))}re.setSolutionVersion=Yx;async function Zx(e,t){var r;let i={ComponentId:(0,Nt.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,ur.ensureSuccess)(await e.post("/AddSolutionComponent",i),e.apiUrl("/AddSolutionComponent"))}re.addSolutionComponent=Zx;async function eL(e,t,r,n){let a={SolutionComponent:{"@odata.type":"Microsoft.Dynamics.CRM.solutioncomponent",solutioncomponentid:(0,Nt.normalizeGuid)(t,"componentId")},ComponentType:r,SolutionUniqueName:n};(0,ur.ensureSuccess)(await e.post("/RemoveSolutionComponent",a),e.apiUrl("/RemoveSolutionComponent"))}re.removeSolutionComponent=eL;async function tL(e,t){var r,n;let i={SolutionName:t.solutionName,Managed:(r=t.managed)!==null&&r!==void 0?r:!1},o=(n=(0,ur.ensureSuccess)(await e.post("/ExportSolution",i),e.apiUrl("/ExportSolution")).body)===null||n===void 0?void 0:n.ExportSolutionFile;if(!o)throw new ni.InvalidArgumentError(`ExportSolution returned no file for '${t.solutionName}'`);return{base64:o}}re.exportSolution=tL;async function rL(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,Nt.normalizeGuid)(t.importJobId,"importJobId")),(0,ur.ensureSuccess)(await e.post("/ImportSolution",i),e.apiUrl("/ImportSolution"))}re.importSolution=rL;async function nL(e,t){let n=`/solutions(${(0,Nt.normalizeGuid)(t,"solutionId")})`;(0,ur.ensureSuccess)(await e.delete(n),e.apiUrl(n))}re.deleteSolution=nL});var ml=v(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.appApi=Rn.deleteAppResolvingOnce=Rn.unpublishedAppModulesQuery=void 0;var Pd=qt(),iL=xd(),Qv=lr(),aL=cl(),fe=be(),ne=ae(),Td=pt(),oL=Kc(),me=te(),sL=(0,ne.odataQuery)([["$select","appmoduleid,name,uniquename,description,aiappdescription"]]),Nd="appmoduleid,name,uniquename,description,aiappdescription";function ry(e,t,r){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ne.odataQuery)([["$select",e],["$filter",t],["$top",r]])}Rn.unpublishedAppModulesQuery=ry;function Dd(e,t){return ry(e,t?`appmoduleid eq ${t}`:void 0,t?1:void 0)}function fl(e,t){return"/sitemaps/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ne.odataQuery)([["$select",t],["$filter",`sitemapid eq ${e}`],["$top",1]])}function Ji(e){var t;let r=(t=e.body)===null||t===void 0?void 0:t.value;if(Array.isArray(r))return r[0]}function lL(e){let t=e?.["@odata.etag"];return typeof t=="string"?t:null}function Od(e,t){if(typeof e!="string")return!1;try{return(0,ne.normalizeGuid)(e,"sitemapid")===t}catch{return!1}}function Co(e){let t=new Set,r=[];for(let n of e??[])n&&!t.has(n)&&(t.add(n),r.push(n));return r}function uL(e){return`cdsapp_${(e||"").replace(/[^a-zA-Z0-9]/g,"")||"app"}`}async function ny(e,t){var r,n;let i=u=>{throw new me.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,ne.odataQuery)([["$select","sitemapid"],["$filter",`sitemapnameunique eq '${(0,ne.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 cL(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,ne.odataQuery)([["$select","webresourceid"],["$top",1],["$filter",s]])}`,n="(webresourcetype eq 5 or webresourcetype eq 6 or webresourcetype eq 7 or webresourcetype eq 10 or webresourcetype eq 11)",i=t(await e.get(r("webresourcetype eq 5 and ismanaged eq false and contains(name,'icon')")));if(i)return{id:i,managed:!1};let a=t(await e.get(r(`${n} and ismanaged eq false`)));if(a)return{id:a,managed:!1};let o=t(await e.get(r(n)));return o?{id:o,managed:!0}:void 0}function Rd(e){return e instanceof Error?e.message:String(e)}async function dL(e,t){var r,n,i;try{let a=`/roles${(0,ne.odataQuery)([["$select","roleid"],["$filter","name eq 'System Administrator'"],["$top",1]])}`,s=(i=(n=(r=(0,fe.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.roleid;if(!s)return"App roles: no 'System Administrator' role was found in this environment, so the app was created with NO security role associated \u2014 it will not be visible or playable until a role is granted access to it.";let l=`/appmodules(${t})/appmoduleroles_association/$ref`;return(0,fe.ensureSuccess)(await e.post(l,{"@odata.id":e.apiUrl(`/roles(${s})`)}),e.apiUrl(l)),null}catch(a){return`App roles: could not associate the 'System Administrator' role with the app (${Rd(a)}); it will not be visible or playable until a role is granted access to it.`}}async function pL(e,t){let r=[];async function n(s,l,u){try{return(await(0,Pd.collectPages)(e,s,`app assets (${u} for '${t}')`)).map(d=>String(d[l])).filter(d=>d&&d!=="undefined")}catch(c){return r.push(`App components: could not enumerate ${u} for table '${t}' (${Rd(c)}); they were NOT added to the app.`),[]}}let[i,a,o]=await Promise.all([n(`/systemforms${(0,ne.odataQuery)([["$select","formid"],["$filter",`objecttypecode eq '${(0,ne.odataLiteral)(t)}' and type eq 2 and formactivationstate eq 1`]])}`,"formid","forms"),n(`/savedqueries${(0,ne.odataQuery)([["$select","savedqueryid"],["$filter",`returnedtypecode eq '${(0,ne.odataLiteral)(t)}' and querytype eq 0 and statecode eq 0`]])}`,"savedqueryid","views"),n(`/savedqueryvisualizations${(0,ne.odataQuery)([["$select","savedqueryvisualizationid"],["$filter",`primaryentitytypecode eq '${(0,ne.odataLiteral)(t)}'`]])}`,"savedqueryvisualizationid","charts")]);return{forms:i,views:a,charts:o,warnings:r}}var Kv=new WeakMap;async function fL(e,t){let r=Kv.get(e);r||(r=new Map,Kv.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=await mL(e,t);return i&&r.set(t,i),i}async function Xv(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 mL(e,t){let r=`/EntityDefinitions(LogicalName='${(0,ne.odataPathLiteral)(t)}')${(0,ne.odataQuery)([["$select","MetadataId,EntitySetName"]])}`,n=await e.get(r);if(n.status>=200&&n.status<300){let i=n.body;if(i?.MetadataId&&i.EntitySetName)return{logicalName:t,metadataId:i.MetadataId,entitySetName:i.EntitySetName}}}async function Yv(e,t){let r=[],n=Co(t.entities),i=4,a=await Xv(n,i,f=>fL(e,f)),o=n.filter((f,m)=>!a[m]);if(o.length>0)throw new me.SdkError("APP_ENTITY_COMPONENT_UNRESOLVED",`Refusing to build app components: table(s) ${o.map(f=>`'${f}'`).join(", ")} could not be resolved to an EntityDefinitions MetadataId + EntitySetName. Pinning the rest would produce an app whose navigation references a table the app does not contain. Verify the table name(s) exist in this environment and retry.`);let s=a.filter(f=>!!f);for(let f of s)r.push({"@odata.id":`${f.entitySetName}(${f.metadataId})`});for(let f of Co(t.components.forms))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:f});for(let f of Co(t.components.views))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:f});for(let f of Co(t.components.charts))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:f});for(let f of Co(t.components.dashboards))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:f});let l=new Set(t.components.forms),u=new Set(t.components.views),c=new Set(t.components.charts),d=await Xv(n,i,f=>pL(e,f)),p=d.flatMap(f=>f.warnings);for(let f of d){for(let m of f.forms)l.has(m)||(l.add(m),r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:m}));for(let m of f.views)u.has(m)||(u.add(m),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:m}));for(let m of f.charts)c.has(m)||(c.add(m),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:m}))}return{components:r,tables:s,warnings:p}}async function Zv(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))}function hL(e){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ne.odataQuery)([["$select","appmoduleid,appmoduleidunique"],["$filter",`appmoduleid eq ${e}`],["$top",1]])}async function ey(e,t,r){var n;if(r.length===0)return;let i=hL(t),a=await e.get(i);if(a.status<200||a.status>=300)throw new me.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its components were written but could not be verified \u2014 the unpublished-aware read returned HTTP ${a.status}. Re-push to retry.`);let o=Ji(a),s=o?.appmoduleidunique;if(typeof s!="string"||!s)throw new me.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its components were written but could not be verified \u2014 the app did not return an 'appmoduleidunique' to file components under. Re-push to retry.`);let l=`/appmodulecomponents${(0,ne.odataQuery)([["$select","objectid,componenttype"],["$filter",`_appmoduleidunique_value eq ${(0,ne.normalizeGuid)(s,`App '${t}' appmoduleidunique`)} and componenttype eq 1`]])}`,u=await e.get(l);if(u.status<200||u.status>=300)throw new me.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its table components were written but could not be verified \u2014 reading them back returned HTTP ${u.status}. Re-push to retry.`);let c=(n=u.body)===null||n===void 0?void 0:n.value;if(!Array.isArray(c))throw new me.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its table components were written but could not be verified \u2014 the read-back returned no readable result set. Re-push to retry.`);let d=new Set(c.map(f=>f.objectid).filter(f=>typeof f=="string").map(f=>f.toLowerCase())),p=r.filter(f=>!d.has(f.metadataId.toLowerCase()));if(p.length>0)throw new me.SdkError("APP_COMPONENTS_NOT_PERSISTED",`App '${t}': ${p.length} declared table(s) are NOT components of the app after AddAppComponents reported success \u2014 ${p.map(f=>`'${f.logicalName}' (expected objectid ${f.metadataId})`).join(", ")}. The app's navigation would reference content the app does not contain.`)}async function gL(e,t,r){let n=`/appmodules(${t})`,i=`/sitemaps(${r.sitemapId})`;try{let a=await vL(e,r.sitemapId,r.sitemapNameUnique);if(a==="absent"){r.serverRefusedSitemap&&(0,fe.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}if(a==="foreign"){r.serverRefusedSitemap&&(0,fe.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}if(e.supportsAtomicBatch){if(!r.sitemapWriteToken)return;await ay(e,[{path:n},{path:i,etag:r.sitemapWriteToken}])}}catch{}}async function vL(e,t,r){var n,i,a;let o=fl(t,"sitemapid,sitemapnameunique"),s=await e.get(o);if(s.status<200||s.status>=300)throw new me.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned HTTP ${s.status}, so it cannot be determined whether the row exists.`);let l=(n=s.body)===null||n===void 0?void 0:n.value;if(!Array.isArray(l))throw new me.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 l.length===0?"absent":String((a=(i=l[0])===null||i===void 0?void 0:i.sitemapnameunique)!==null&&a!==void 0?a:"")===r?"ours":"foreign"}async function iy(e,t){var r;let n=(0,ne.normalizeGuid)(t,"id"),i=g=>{throw new me.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to delete app '${n}': ${g} 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})${sL}`,o;try{o=await e.get(a)}catch(g){return i(`reading the app failed (${g.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 ny(e,s);if(!l)return{uniquename:s,appEtag:(0,fe.readEtag)(o)};let u=(0,ne.normalizeGuid)(l,"sitemapId"),c=await Fd(e,u),d=fl(u,"sitemapid,sitemapnameunique,sitemapxml"),p;try{p=await e.get(d)}catch(g){return i(`reading sitemap '${u}' failed (${g.message}).`)}if(p.status<200||p.status>=300)return i(`reading sitemap '${u}' returned HTTP ${p.status}.`);let f=Ji(p);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.`);if(!Od(f.sitemapid,u))return i(`sitemap '${u}' was read back as a row carrying sitemapid '${String(f.sitemapid)}'.`);let m=f.sitemapxml;return typeof m!="string"?i(`sitemap '${u}' returned no sitemapxml.`):{sitemapId:u,uniquename:s,sitemapXml:m,appEtag:(0,fe.readEtag)(o),sitemapEtag:c}}async function yL(e,t,r){let n=(0,ne.normalizeGuid)(t,"id"),i=await iy(e,n);await r?.(i.sitemapXml),await oy(e,n,i)}Rn.deleteAppResolvingOnce=yL;async function ay(e,t){let r=`batch_${(0,Td.newId)()}`,n=`changeset_${(0,Td.newId)()}`,i=t.map((d,p)=>[`--${n}`,"Content-Type: application/http","Content-Transfer-Encoding: binary",`Content-ID: ${p+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,Ae.ensureSuccess)(o,s);let l=`app '${t[0].path}'`;if(typeof o.body!="string"||o.body.length===0)throw new he.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=(0,Mx.parseChangeSetStatuses)(o.body,i.map((d,p)=>String(p+1)));if(u===void 0)throw new he.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 he.ConnectionError(s,c,`atomic delete of ${l} was rolled back: the change set reported HTTP ${c}`);if(u.length!==i.length)throw new he.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response reported ${u.length} operation result(s), expected exactly ${i.length}`)}async function vd(e,t){try{let r=ol(t,"sitemapid"),n=await e.get(r);return n.status<200||n.status>=300?null:al(Ui(n))}catch{return null}}function Qx(e){return e>=400&&e<500&&e!==408&&e!==429}function yd(e,t,r){if(!e)throw new he.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 zv(e,t,r){let n=`/appmodules(${t})`;if(!r.sitemapId){await Kx(e,n,yd(r.appEtag,t,"app"));return}if(!e.supportsAtomicBatch)throw new he.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 Gv(e,[{path:n,etag:yd(r.appEtag,t,"app")},{path:`/sitemaps(${r.sitemapId})`,etag:yd(r.sitemapEtag,t,"sitemap")}])}async function Kx(e,t,r){(0,Ae.ensureSuccess)(await e.delete(t,{headers:{"If-Match":r}}),e.apiUrl(t))}async function Uv(e,t){if(!/GenPageId/i.test(t))return;let r;try{r=[...new Set((0,Lx.collectGenPageIds)(t))]}catch(o){throw new he.SdkError("SITEMAP_TARGET_UNVERIFIABLE",`Refusing to push the app: its sitemap xml could not be parsed, so the generative pages it navigates to cannot be verified (${Ad(o)}).`)}if(r.length===0)return;let n=new Set,i=50;for(let o=0;o<r.length;o+=i){let s=r.slice(o,o+i),l="/uxagentprojects/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select","uxagentprojectid"],["$filter",s.map(c=>`uxagentprojectid eq ${c}`).join(" or ")]]),u=await(0,wd.collectPages)(e,l,"sitemap generative-page preflight");for(let c of u){let d=c.uxagentprojectid;typeof d=="string"&&d.trim()!==""&&n.add((0,se.normalizeGuid)(d,"uxagentprojectid"))}}let a=r.filter(o=>!n.has(o));if(a.length>0)throw new he.SdkError("SITEMAP_TARGET_NOT_FOUND",`Refusing to push the app: its sitemap navigates to generative page(s) ${a.map(o=>`'${o}'`).join(", ")} that do not exist in this environment. Push the page before the app that links to it.`)}function Xx(e){var t,r;if(e.status!==400)return!1;let n=e.body;return String((r=(t=n?.error)===null||t===void 0?void 0:t.message)!==null&&r!==void 0?r:"").includes("retrieval of version numbers failed")}En.appApi={async get(e,t){var r;let n=(0,se.normalizeGuid)(t,"id"),i=gd(hd,n),a=(0,Ae.ensureSuccess)(await e.get(i),e.apiUrl(i)),o=(r=Ui(a))!==null&&r!==void 0?r:{};if(!o.appmoduleid)throw new he.SdkError("APP_NOT_FOUND",`App '${n}' was not found (checked the unpublished-aware projection, which includes drafts).`);let s=await qv(e,o.uniquename),l=s?(0,se.normalizeGuid)(s,"sitemapId"):void 0,u=null;if(l){let d=ol(l,"sitemapid,sitemapname,sitemapnameunique,sitemapxml"),p=(0,Ae.ensureSuccess)(await e.get(d),e.apiUrl(d)),f=Ui(p);if(f&&f.sitemapnameunique!==o.uniquename)throw new he.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=al(f)}let c=al(o);return{raw:o,etag:u,...o.appmoduleid?{siblingEtags:{[(0,se.normalizeGuid)(o.appmoduleid,"appmoduleid")]:c}}:{}}},async list(e,t){let r=gd(hd);return(await(0,wd.collectPages)(e,r,"listArtifacts('app')")).map(i=>{var a,o;return{type:"app",id:(a=i.appmoduleid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",isDirty:!1}})},async create(e,t,r){let n=t;await Uv(e,n.sitemapxml);let i=n.iconWebResourceId?void 0:await $x(e),a=n.iconWebResourceId||i?.id;if(!a)throw new he.SdkError("APP_ICON_UNRESOLVED",`Cannot create app '${n.appModuleName}': its icon (\`appmodule.webresourceid\`) is a REQUIRED attribute and this environment has no image web resource to use. Pass \`iconWebResourceId\` explicitly, or add an image (PNG/JPG/GIF/ICO/SVG) web resource to the environment.`);let o=null;i?.managed&&(o=`No unmanaged image web resource was available, so the app icon resolved to a MANAGED one (${i.id}). That creates a cross-solution dependency which can fail to import into an environment without the owning managed solution. Pass \`iconWebResourceId\` with an in-solution image to avoid it.`);let s=n.appModuleUniqueName||Ux(n.appModuleId),l={name:n.appModuleName,uniquename:s,clienttype:4,formfactor:1,navigationtype:0};n.appModuleDescription&&(l.description=n.appModuleDescription),n.appModuleAiDescription&&(l.aiappdescription=n.appModuleAiDescription),a&&(l.webresourceid=a);let u="/appmodules",c=(0,Ae.ensureSuccess)(await e.post(u,(0,Ae.withClientMintedId)(l,"appmoduleid",r)),e.apiUrl(u)),d=(0,Ae.resolveCreatedId)(c,"appmoduleid","app module",r),p=null,f=[];o&&f.push(o);let h={kind:"notRequested"},g=n.sitemapId?(0,se.normalizeGuid)(n.sitemapId,"sitemapId"):(0,bd.newId)(),w=!1;try{let D="/sitemaps",x=await e.post(D,{sitemapid:g,sitemapnameunique:s,sitemapname:n.sitemapname,sitemapxml:n.sitemapxml});w=Qx(x.status);let F=(0,Ae.ensureSuccess)(x,e.apiUrl(D));p=(0,Ae.readEtag)(F),p||(p=await vd(e,g));let G=await kv(e,n);f.push(...G.warnings);let L=G.components;L.unshift({"@odata.type":"Microsoft.Dynamics.CRM.sitemap",sitemapid:g}),await Mv(e,d,L),await Bv(e,d,G.tables);let q=await qx(e,d);q&&f.push(q),n.appSettings&&Object.keys(n.appSettings).length>0&&f.push(...await(0,kx.applyAppSettings)(e,d,n.appSettings)),n.published!==!1&&(await(0,Fv.publishAppModule)(e,d),h={kind:"submitted"})}catch(D){throw await Hx(e,d,{sitemapId:g,sitemapNameUnique:s,serverRefusedSitemap:w,sitemapEtag:p}),D}let S=null;if(h.kind==="submitted")try{let D=await e.get(`/appmodules(${d})?$select=appmoduleid`);D.status>=200&&D.status<300&&(S=(0,Ae.readEtag)(D))}catch{}return{id:d,etag:p,serverIdentity:{sitemapId:g},siblingEtags:{[d]:S},publish:h,...f.length>0?{warnings:f}:{}}},async update(e,t,r,n,i,a){var o,s,l,u,c,d,p,f;let h=r,g=(0,se.normalizeGuid)(t,"id");if(await Uv(e,h.sitemapxml),!h.sitemapId)throw new he.ValidationError("app",g,"/sitemapId","missing sitemap identity \u2014 re-fetch the app before pushing edits");let w=(0,se.normalizeGuid)(h.sitemapId,"sitemapId");if(!n)throw new he.SdkError("APP_UPDATE_NO_ETAG",`Refusing to push app '${g}': 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 S=await kv(e,h),D=`/appmodules(${g})`,x=(o=a?.[g])!==null&&o!==void 0?o:null,F=!0,G=!1;try{let pe=gd(hd,g),Ke=await e.get(pe);if(Ke.status>=200&&Ke.status<300){let Z=(s=Ui(Ke))!==null&&s!==void 0?s:{};G=!0,F=String((l=Z.name)!==null&&l!==void 0?l:"")!==String((u=h.appModuleName)!==null&&u!==void 0?u:"")||String((c=Z.description)!==null&&c!==void 0?c:"")!==String((d=h.appModuleDescription)!==null&&d!==void 0?d:"")||h.appModuleAiDescription!==void 0&&String((p=Z.aiappdescription)!==null&&p!==void 0?p:"")!==String(h.appModuleAiDescription)}}catch{}let L=x;if(F){let pe=G?x:null,Ke=pe?(0,Ae.echoWrite)("appmoduleid",{"If-Match":pe}):{query:"",options:void 0},Z=await e.patch(`${D}${Ke.query}`,{name:h.appModuleName,description:h.appModuleDescription,...h.appModuleAiDescription!==void 0?{aiappdescription:h.appModuleAiDescription}:{}},Ke.options);if(Xx(Z))throw new he.SdkError("APP_DRAFT_HEADER_NOT_WRITABLE",`Refusing to update app '${g}': its appmodule row is UNPUBLISHED, and Dataverse cannot resolve version numbers for a draft appmodule (HTTP 400). A draft header cannot be PATCHed at all \u2014 a plain retry fails too, as an upsert-create ("webresourceid cannot be NULL"). Publish the app first, then push the header edit. Nothing was modified by this call.`);(0,Ae.ensureSuccess)(Z,e.apiUrl(D)),L=(0,Ae.readEtag)(Z)}let q={"If-Match":n},U=`/sitemaps(${w})`,$;try{$=(0,Ae.ensureSuccess)(await e.patch(U,{sitemapxml:h.sitemapxml,sitemapname:h.sitemapname},q?{headers:q}:void 0),e.apiUrl(U))}catch(pe){throw(0,he.withPartialTokens)(pe,{siblingEtags:{[g]:L}})}let W=[...S.warnings];try{await Mv(e,g,S.components),await Bv(e,g,S.tables)}catch(pe){W.push(`App '${g}': one or more components were not pinned (${pe.message}). Navigation may reference content not included in the app; re-push to retry.`)}let B={kind:"notRequested"},Qe=L,vt=(0,Ae.readEtag)($);if(h.published===!0){try{await(0,Fv.publishAppModule)(e,g),B={kind:"submitted"}}catch(pe){B={kind:"failed",error:pe},W.push(`App '${g}': saved, but publishing failed (${pe.message}). The app remains unpublished; re-push to retry.`)}if(B.kind==="submitted"){Qe=null;try{let pe=await e.get(`/appmodules(${g})?$select=appmoduleid`);pe.status>=200&&pe.status<300&&(Qe=(0,Ae.readEtag)(pe)),vt=(f=await vd(e,w))!==null&&f!==void 0?f:vt}catch{}}}return{id:g,etag:vt??await vd(e,w),siblingEtags:{[g]:Qe},publish:B,...W.length>0?{warnings:W}:{}}},async delete(e,t){let r=(0,se.normalizeGuid)(t,"id");await zv(e,r,await Vv(e,r))}}});var Cd=v($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.deleteAppCascade=$i.collectGenPageIds=void 0;var Yx=sl(),Zx=re(),Sd=ie(),eL=ld();function Wv(e){let t=[],r=s=>l=>t.push(`${s}: ${l}`),i=new eL.DOMParser({errorHandler:{warning:r("warning"),error:r("error"),fatalError:r("fatalError")}}).parseFromString(e,"text/xml").documentElement;if(!i||t.length>0)throw new Zx.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,Sd.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}$i.collectGenPageIds=Wv;async function tL(e,t,r){let n=(0,Sd.normalizeGuid)(t,"appModuleId");(0,Sd.normalizeGuid)(r,"appModuleIdUnique");let i=[],a=[],o=[];await(0,Yx.deleteAppResolvingOnce)(e,n,l=>{l!==void 0&&o.push(...Wv(l))}),i.push({type:"app",id:n});let s=[...new Set(o)].map(l=>({type:"genPage",id:l}));return{success:a.length===0,deleted:i,failures:a,retained:s}}$i.deleteAppCascade=tL});var Hv={};Ur(Hv,{Guid:()=>T});var T,xe=I(()=>{"use strict";T=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,rt=I(()=>{"use strict";Re();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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),r&&(n=n.replace(/"/g,"&quot;").replace(/'/g,"&apos;"))),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 jv={};Ur(jv,{ScriptUtilities:()=>N});var N,Re=I(()=>{"use strict";xe();rt();N=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:T.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 ll,ul,Xn,cl,Ed,dl,Nd=I(()=>{"use strict";(function(e){e[e.FormElementNodeChange=0]="FormElementNodeChange",e[e.FormElementAttributeChange=1]="FormElementAttributeChange"})(ll||(ll={}));ul=class{type;targetNode;constructor(t,r){this.type=t,this.targetNode=r}},Xn=class extends ul{key;oldValue;newValue;constructor(t,r,n,i){super(ll.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)}},cl=class extends ul{property;oldValue;newValue;constructor(t,r,n,i){super(ll.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)}},Ed=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()})}},dl=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 Ed(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 Jv={};Ur(Jv,{ChartGridMode:()=>Gt,ColumnLayoutWidths:()=>oL,ComponentCategory:()=>fl,ComponentType:()=>Dd,ControlLayoutTypes:()=>Fd,DisplayConditionsInfo:()=>iL,ElementNames:()=>y,ElementProperties:()=>m,ElementType:()=>_d,EntityAttributeProperty:()=>Td,EventType:()=>ho,FormActivationState:()=>Rd,FormCanvasServiceScope:()=>yL,FormDesignerSideBarTab:()=>Id,FormPresentation:()=>Pd,FormState:()=>pl,FormType:()=>Le,HeaderDensityType:()=>Nn,LookUpTable:()=>Sr,MORE_TAB_PREFIX:()=>lL,NavBarChildElementType:()=>Od,PREVIEW_ID_HEADER_FLYOUT:()=>pL,PREVIEW_ID_HEADER_OVERFLOW_BUTTON:()=>mL,PREVIEW_ID_NAVIGATION_AREA:()=>cL,PREVIEW_ID_QUICKCREATE_ROOT:()=>gL,PREVIEW_ID_TAB:()=>hL,PREVIEW_ID_TAB_LIST:()=>fL,PREVIEW_ID_TAB_PANEL:()=>dL,PropertyModelKeys:()=>kd,PropertyModelSectionKeys:()=>sL,RELATED_TAB_ID:()=>Md,RELATED_TAB_PREFIX:()=>uL,SectionDefaultProperties:()=>aL,SectionLayoutTypes:()=>Se,TabContentType:()=>xd,TabDefaultProperties:()=>Dn,TabLayoutTypes:()=>Ce,TelemetryPropertyNames:()=>vL,UnboundControlPropertyKeys:()=>Ld,compositeAddressFields:()=>nL,compositeFieldNames:()=>xt,compositeFields:()=>rL});var Le,Dd,Id,y,m,_d,xt,rL,nL,Td,Sr,pl,Nn,Pd,iL,Od,Rd,Ce,aL,Dn,Se,Fd,xd,oL,Ld,kd,sL,ho,Gt,Md,lL,uL,cL,dL,pL,fL,mL,hL,gL,vL,fl,yL,X=I(()=>{"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"})(Le||(Le={}));(function(e){e[e.Form=0]="Form",e[e.Dialog=1]="Dialog"})(Dd||(Dd={}));(function(e){e[e.Components=0]="Components",e[e.Properties=1]="Properties",e[e.Relationship=2]="Relationship",e[e.BusinessRules=3]="BusinessRules"})(Id||(Id={}));(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"})(y||(y={}));m={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"})(_d||(_d={}));xt={fullname:"fullname",yomifullname:"yomifullname",address1_composite:"address1_composite",address2_composite:"address2_composite",address3_composite:"address3_composite",billto:"billto_composite",shipto:"shipto_composite"},rL=[xt.fullname,xt.yomifullname,xt.address1_composite,xt.address2_composite,xt.address3_composite,xt.billto,xt.shipto],nL=[xt.address1_composite,xt.address2_composite,xt.address3_composite,xt.billto,xt.shipto];(function(e){e[e.IsValidForForm=0]="IsValidForForm",e[e.IsValidForCreate=1]="IsValidForCreate"})(Td||(Td={}));(function(e){e[e.DependencyFieldTable=0]="DependencyFieldTable",e[e.LockedFieldTable=1]="LockedFieldTable"})(Sr||(Sr={}));(function(e){e[e.Published=0]="Published",e[e.Draft=1]="Draft",e[e.New=2]="New",e[e.SaveAs=3]="SaveAs"})(pl||(pl={}));(function(e){e.Low="Low",e.HighReadOnlyValues="HighReadOnlyValues",e.HighWithControls="HighWithControls"})(Nn||(Nn={}));(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(Pd||(Pd={}));iL={TopOrderFormId:"topOrderFormId",NextDisplayOrder:"nextDisplayOrder"};(function(e){e[e.NavBarRelationShipItem=0]="NavBarRelationShipItem",e[e.NavBarItem=1]="NavBarItem"})(Od||(Od={}));(function(e){e[e.InActive=0]="InActive",e[e.Active=1]="Active"})(Rd||(Rd={}));(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={}));aL={ShowLabel:"false",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_"},Dn={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"})(Se||(Se={}));(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"})(Fd||(Fd={}));(function(e){e.cardSections="cardSections",e.singleComponent="singleComponent",e.default="default",e.expandAvailableSpace="expandAvailableSpace"})(xd||(xd={}));oL={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"})(Ld||(Ld={}));(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"})(kd||(kd={}));sL={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"})(ho||(ho={}));(function(e){e.All="All",e.Chart="Chart",e.Grid="Grid"})(Gt||(Gt={}));Md="tab_related3b554255-7717-4d17-bb7f-9936fb1e75ca",lL="more_tab_",uL="related_tab_",cL="preview_id_navigation_area",dL="tab-section",pL="headerFieldsFlyout",fL="tablist",mL="header_overflowButton",hL="tab",gL="quickCreateRoot",vL={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"})(fl||(fl={}));yL="CellCanvasServiceScope"});var Qv={};Ur(Qv,{Attribute:()=>ml,FormElementNode:()=>H});var ml,H,ze=I(()=>{"use strict";Re();rt();Nd();X();xe();ml=class{key;value;constructor(t,r){this.key=t,this.value=r}},H=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-${T.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(y.form);r&&r.raiseMetadataChange(t)}trackPropertyAddition(t,r){this.trackPropertyCollectionChange(()=>{this.properties.push(new ml(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 Xn(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 Xn(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 Xn(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 cl(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 Xn(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: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=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 y.formCell:let t=this.getAncestor(y.formSection);return t||(t=this.getAncestor(y.formHeader),t)||(t=this.getAncestor(y.formFooter),t)?t:null;case y.formSection:return this.getAncestor(y.formTab);case y.formTab:return this.getAncestor(y.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(y.form);return t?t.changeTracker():null}}});var Kv={};Ur(Kv,{ControlClassId:()=>E,ControlNamePrefixes:()=>hl,getControlDisplayNames:()=>bL});function bL(e){return{[E.AccessPrivilegeControl]:e("controls.controlNames.accessPrivilege"),[E.AccessTeamTablePickerControl]:e("controls.controlNames.accessTeamTablePicker"),[E.ACIControl]:e("controls.controlNames.aci"),[E.ActivitiesContainerControl]:e("controls.controlNames.activitiesContainer"),[E.ActivitiesWallControl]:e("controls.controlNames.activitiesWall"),[E.AppliedFiltersControl]:e("controls.controlNames.appliedFilters"),[E.ArticleContentControl]:e("controls.controlNames.articleContent"),[E.BooleanControl]:e("controls.controlNames.twoOption"),[E.ButtonControl]:e("controls.controlNames.button"),[E.CheckboxControl]:e("controls.controlNames.checkbox"),[E.CompositionLinkControl]:e("controls.controlNames.compositionLink"),[E.ConnectionControl]:e("controls.controlNames.connection"),[E.ConnectionRoleObjectTypeListControl]:e("controls.controlNames.connectionRoleObjectTypeList"),[E.CoverageChoiceControl]:e("controls.controlNames.coverageChoice"),[E.DashboardControl]:e("controls.controlNames.dashboard"),[E.DynamicPropertyListControl]:e("controls.controlNames.dynamicPropertyList"),[E.EditFilterControl]:e("controls.controlNames.editFilter"),[E.ErrorStatusControl]:e("controls.controlNames.errorStatus"),[E.GlobalFilterControl]:e("controls.controlNames.globalFilter"),[E.HiddenInputControl]:e("controls.controlNames.hiddenInput"),[E.KBViewerControl]:e("controls.controlNames.kbViewer"),[E.LabelControl]:e("controls.controlNames.label"),[E.MailMergeLanguagePickerControl]:e("controls.controlNames.mailMergeLanguagePicker"),[E.MapLinkControl]:e("controls.controlNames.mapLink"),[E.OrgInsightsControl]:e("controls.controlNames.orgInsights"),[E.ChoiceLookupControl]:e("controls.controlNames.choiceLookup"),[E.PowerBIControl]:e("controls.controlNames.powerBI"),[E.ProcessControl]:e("controls.controlNames.process"),[E.RelatedInformationControl]:e("controls.controlNames.relatedInformation"),[E.RelationshipRoleChoiceControl]:e("controls.controlNames.relationshipRoleChoice"),[E.ReportControl]:e("controls.controlNames.report"),[E.StreamsControl]:e("controls.controlNames.streams"),[E.WebResourceSilverlightControl]:e("controls.controlNames.webResourceSilverlight"),[E.CurrencyControl]:e("controls.controlNames.currency"),[E.DateTimeControl]:e("controls.controlNames.dateAndTime"),[E.DecimalControl]:e("controls.controlNames.decimal"),[E.DurationControl]:e("controls.controlNames.duration"),[E.EmailAddressControl]:e("controls.controlNames.email"),[E.FileControl]:e("controls.controlNames.file"),[E.FloatingNumberControl]:e("controls.controlNames.floatingNumber"),[E.IframeControl]:e("controls.controlNames.iframe"),[E.ImageControl]:e("controls.controlNames.image"),[E.LookupControl]:e("controls.controlNames.lookup"),[E.MapsControl]:e("controls.controlNames.maps"),[E.PhoneNumberControl]:e("controls.controlNames.phoneNumber"),[E.ChoiceControl]:e("controls.controlNames.choice"),[E.QuickViewControl]:e("controls.controlNames.quickView"),[E.QuickFormControl]:e("controls.controlNames.quickForm"),[E.CustomControl]:e("controls.controlNames.customControl"),[E.SearchWidgetControl]:e("controls.controlNames.searchWidget"),[E.SocialInsightsControl]:e("controls.controlNames.socialInsights"),[E.SubgridControl]:e("controls.controlNames.subgrid"),[E.TextAreaControl]:e("controls.controlNames.textArea"),[E.TextboxControl]:e("controls.controlNames.textBox"),[E.TickerControl]:e("controls.controlNames.ticker"),[E.UrlControl]:e("controls.controlNames.url"),[E.WebResourceHTMLControl]:e("controls.controlNames.webResourceHTML"),[E.WebResourceImageControl]:e("controls.controlNames.webResourceImage"),[E.IntegerControl]:e("controls.controlNames.integer"),[E.TimerControl]:e("controls.controlNames.timer"),[E.TimelineControl]:e("controls.controlNames.timeline"),[E.EmailBodyControl]:e("controls.controlNames.emailBody"),[E.PartyListControl]:e("controls.controlNames.partyList"),[E.TimezoneControl]:e("controls.controlNames.timezone"),[E.LanguageControl]:e("controls.controlNames.language"),[E.ChoiceStatusControl]:e("controls.controlNames.choiceStatus"),[E.ChoicesControl]:e("controls.controlNames.choices"),[E.RegardingControl]:e("controls.controlNames.regarding"),[E.EmailEngagementActionsControl]:e("controls.controlNames.emailEngagementActions"),[E.EmailRecipientActivityControl]:e("controls.controlNames.emailRecipientActivity"),[E.ReferencePanelSearchWidgetControl]:e("controls.controlNames.referencePanelSearchWidget"),[E.ReferencePanelQuickViewControl]:e("controls.controlNames.referencePanelQuickView"),[E.ReferencePanelSubgridControl]:e("controls.controlNames.referencePanelSubgrid"),[E.KBEditorControl]:e("controls.controlNames.KBEditor"),[E.LinkControl]:e("controls.controlNames.link")}}var E,hl,Yn=I(()=>{"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"})(E||(E={}));hl={[E.WebResourceHTMLControl]:"WebResource",[E.WebResourceImageControl]:"WebResource",[E.IframeControl]:"IFRAME",[E.SearchWidgetControl]:"Search widget",[E.SubgridControl]:"Subgrid",[E.TimelineControl]:"Timeline",[E.QuickViewControl]:"QuickviewControl"}});var Zn=v((pW,Yv)=>{var go=new Proxy(function(){return go},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:go},apply:function(){return go},construct:function(){return{}}}),Xv=function(){return go};Object.setPrototypeOf(Xv,go);Yv.exports=Xv});var dt,Jr,Zv,ey,qi=I(()=>{"use strict";dt="cds-designer-models",Jr="FormCustomControl",Zv="FormCell",ey="Form"});var Vi,pt,vo=I(()=>{"use strict";Vi=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}},pt=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 ei,Bd=I(()=>{"use strict";vo();X();ei=class e{static lockedFieldCount=new pt;static dependencyFieldCount=new pt;static getNecessaryLookUpTable(t){switch(t){case Sr.DependencyFieldTable:return e.dependencyFieldCount;case Sr.LockedFieldTable:return e.lockedFieldCount}}static initCanvasLockedFieldLookUp(t){switch(t){case Sr.DependencyFieldTable:e.dependencyFieldCount=new pt;case Sr.LockedFieldTable:e.lockedFieldCount=new pt}}}});var gl,ty=I(()=>{"use strict";xe();Re();X();ze();gl=class extends H{constructor(t){super(y.controlDescription,t)}get forControl(){let t=this.getProperty(m.ForControl);return N.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new T(t))}set forControl(t){this.setProperty(m.ForControl,`{${t.ToString()}}`)}get customControls(){return this.getChildren(y.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 ny,iy,ft,_,ry,In,ti,Gi,Ud,$d,zi=I(()=>{"use strict";ny={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"},iy={GroupDefinition:"GroupDefinition"},ft={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"})(_||(_={}));(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"})(ry||(ry={}));(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"})(In||(In={}));(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"})(ti||(ti={}));(function(e){e[e.Bound=0]="Bound",e[e.Input=1]="Input",e[e.Output=2]="Output"})(Gi||(Gi={}));Ud=[_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.LookupSimple],$d=[_.WholeNone,_.WholeDuration,_.WholeLanguage,_.WholeTimeZone,_.FP,_.Decimal]});function Qr(){return Er||(Er=window._makerConfig,Er&&window?.location?.search?.indexOf("useProductionConfig")>-1&&(Er={...Er,region:"prod",graphQLEndpoint:"https://graph.make.powerapps.com/"}),Er?.region==="prod"&&(Er={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/"}}},...Er}),Er||{aadClientId:"a8f7a65c-f5ba-4859-b2d6-df772c264e9d",location:"cus",region:"test",publicPath:"/",graphQLEndpoint:"https://graph.make.test.powerapps.com/"})}var Er,vl=I(()=>{"use strict";});function ay(e,t,r){if(!e)return yl.has(e)||(window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoIsEmpty"}),yl.add("")),!1;if(e){if(e=e.toLowerCase(),yl.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}}),yl.add(e),!1}return!0}function wL(e){return ay(e,qd,"Location dictionary")?qd[e.toLowerCase()]:"us"}function AL(){let e=Qr().location.toLowerCase();return ay(e,qd,"Current location dictionary")?e:"us"}var yl,qd,IW,oy=I(()=>{"use strict";vl();yl=new Set,qd={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"};IW=wL(AL())});var k,TW,sy=I(()=>{"use strict";k={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"},TW={[k.USWest]:{geoName:"us",regionShortName:"wus"},[k.USCentral]:{geoName:"us",regionShortName:"cus"},[k.USEast]:{geoName:"us",regionShortName:"eus"},[k.USEast2]:{geoName:"us",regionShortName:"eus2"},[k.USWestCentral]:{geoName:"us",regionShortName:"wcus"},[k.USWest2]:{geoName:"us",regionShortName:"wus2"},[k.USSouthCentral]:{geoName:"br",regionShortName:"scus"},[k.BrazilSouth]:{geoName:"br",regionShortName:"sbr"},[k.UKSouth]:{geoName:"uk",regionShortName:"suk"},[k.UKWest]:{geoName:"uk",regionShortName:"wuk"},[k.JapanEast]:{geoName:"jp",regionShortName:"ejp"},[k.JapanWest]:{geoName:"jp",regionShortName:"wjp"},[k.IndiaCentral]:{geoName:"in",regionShortName:"cin"},[k.IndiaSouth]:{geoName:"in",regionShortName:"sin"},[k.ItalyNorth]:{geoName:"it",regionShortName:"nit"},[k.GermanyWestCentral]:{geoName:"de",regionShortName:"wcde"},[k.GermanyNorth]:{geoName:"de",regionShortName:"nde"},[k.EuropeNorth]:{geoName:"eu",regionShortName:"neu"},[k.EuropeWest]:{geoName:"eu",regionShortName:"weu"},[k.AustraliaEast]:{geoName:"au",regionShortName:"eau"},[k.AustraliaSouthEast]:{geoName:"au",regionShortName:"seau"},[k.AsiaSouthEast]:{geoName:"as",regionShortName:"seas"},[k.AsiaEast]:{geoName:"as",regionShortName:"eas"},[k.CanadaCentral]:{geoName:"ca",regionShortName:"cca"},[k.CanadaEast]:{geoName:"ca",regionShortName:"eca"},[k.SouthAfricaNorth]:{geoName:"za",regionShortName:"nza"},[k.SouthAfricaWest]:{geoName:"za",regionShortName:"wza"},[k.FranceCentral]:{geoName:"fr",regionShortName:"cfr"},[k.FranceSouth]:{geoName:"fr",regionShortName:"sfr"},[k.UAENorth]:{geoName:"ae",regionShortName:"nae"},[k.UAECentral]:{geoName:"ae",regionShortName:"cae"},[k.SwedenCentral]:{geoName:"se",regionShortName:"cse"},[k.SwitzerlandNorth]:{geoName:"ch",regionShortName:"nch"},[k.SwitzerlandWest]:{geoName:"ch",regionShortName:"wch"},[k.NorwayEast]:{geoName:"no",regionShortName:"eno"},[k.NorwayWest]:{geoName:"no",regionShortName:"wno"},[k.KoreaCentral]:{geoName:"kr",regionShortName:"ckr"},[k.KoreaSouth]:{geoName:"kr",regionShortName:"skr"},[k.SingaporeSouthEast]:{geoName:"sg",regionShortName:"seas"},[k.PolandCentral]:{geoName:"pl",regionShortName:"cpl"},[k.QatarCentral]:{geoName:"qa",regionShortName:"cqa"},[k.NewZealandNorth]:{geoName:"nz",regionShortName:"nnz"},[k.GovernmentUSTexas]:{geoName:"us",regionShortName:"ugtx"},[k.GovernmentUSVirginia]:{geoName:"us",regionShortName:"ugva"},[k.GovernmentUSDodCentral]:{regionShortName:"udc"},[k.GovernmentUSDodEast]:{regionShortName:"ude"},[k.ChinaEast]:{regionShortName:"cne"},[k.ChinaEast2]:{regionShortName:"cne2"},[k.ChinaEast3]:{regionShortName:"cne3"},[k.ChinaNorth]:{regionShortName:"cnn"},[k.ChinaNorth2]:{regionShortName:"cnn2"},[k.ChinaNorth3]:{regionShortName:"cnn3"},[k.UssecEast]:{geoName:"us",regionShortName:"erx"},[k.UssecWest]:{geoName:"us",regionShortName:"wrx"},[k.UsnatEast]:{geoName:"us",regionShortName:"eex"},[k.UsnatWest]:{geoName:"us",regionShortName:"wex"}}});var ly=I(()=>{"use strict";vl();});var yo=I(()=>{"use strict";vl();oy();sy();ly();});function bo(e,t){return uy?uy.isOverridden(e,t):{overridden:!1}}var uy,wo=I(()=>{"use strict";});var Vd=I(()=>{"use strict";yo();wo();});function CL(e,t){let{region:r}=Qr();return()=>{let n=e.settings[t];if(n.allowOverrides){let s=bo(e.packageName,t);if(s.overridden)return typeof s.value=="string"?SL(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 SL(e){return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}function EL(e){let t=e.packageName;if(bl.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=>zd(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=>!Al(i))){let i=`error parsing settings config for package ${t}, setting ${r} has invalid region`;throw console.error(i),new Error(i)}})}function Ao(e){EL(e);let t={};return Object.keys(e.settings).forEach(r=>{t[r]={enumerable:!0,get:CL(e,r)}}),bl.set(e.packageName,e),Object.defineProperties({},t)}function Gd(e,t){return bl.has(e)?!!bl.get(e).settings[t]:!1}var bl,wl=I(()=>{"use strict";yo();wo();Wd();Co();bl=new Map});function cy(e,t){let{region:r}=Qr();return()=>{let n=bo(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 NL(e){let t=e.packageName;if(Cl.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=>Gd(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=>!Al(i))){let i=`error parsing feature gates config for package ${t}, feature ${r} has invalid region`;throw console.error(i),new Error(i)}})}function Hd(e){NL(e);let t={};Object.keys(e.features).forEach(i=>{t[i]={enumerable:!0,configurable:!0,get:cy(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:cy(e,a.toString())}}),Object.defineProperties(r,i),n.clear()}},Cl.set(e.packageName,e),Object.defineProperties(r,t)}function zd(e,t){return Cl.has(e)?!!Cl.get(e).features[t]:!1}var Cl,Wd=I(()=>{"use strict";yo();Co();wo();wl();Cl=new Map});var py=v((eH,dy)=>{"use strict";dy.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 hy=v(jd=>{"use strict";var DL=Object.prototype.hasOwnProperty,IL;function fy(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function my(e){try{return encodeURIComponent(e)}catch{return null}}function _L(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var i=fy(n[1]),a=fy(n[2]);i===null||a===null||i in r||(r[i]=a)}return r}function TL(e,t){t=t||"";var r=[],n,i;typeof t!="string"&&(t="?");for(i in e)if(DL.call(e,i)){if(n=e[i],!n&&(n===null||n===IL||isNaN(n))&&(n=""),i=my(i),n=my(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""}jd.stringify=TL;jd.parse=_L});var Kd=v((rH,Ay)=>{"use strict";var vy=py(),Sl=hy(),yy=/[\n\r\t]/g,PL=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,OL=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,RL=/^[a-zA-Z]:/,FL=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;function Qd(e){return(e||"").toString().replace(FL,"")}var Jd=[["#","hash"],["?","query"],function(t,r){return Nr(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]],gy={hash:1,query:1};function by(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 Dr(unescape(e.pathname),{});else if(i==="string"){n=new Dr(e,{});for(a in gy)delete n[a]}else if(i==="object"){for(a in e)a in gy||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=PL.test(e.href))}return n}function Nr(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function wy(e,t){e=Qd(e),e=e.replace(yy,""),t=t||{};var r=OL.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)):Nr(n)?s=r[4]:n?i&&(s=s.slice(2)):o>=2&&Nr(t.protocol)&&(s=r[4]),{protocol:n,slashes:i||Nr(n),slashesCount:o,rest:s}}function xL(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 Dr(e,t,r){if(e=Qd(e),e=e.replace(yy,""),!(this instanceof Dr))return new Dr(e,t,r);var n,i,a,o,s,l,u=Jd.slice(),c=typeof t,d=this,p=0;for(c!=="object"&&c!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=Sl.parse),t=by(t),i=wy(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||RL.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!Nr(d.protocol)))&&(u[3]=[/(.*)/,"pathname"]);p<u.length;p++){if(o=u[p],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=xL(d.pathname,t.pathname)),d.pathname.charAt(0)!=="/"&&Nr(d.protocol)&&(d.pathname="/"+d.pathname),vy(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:"&&Nr(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function LL(e,t,r){var n=this;switch(e){case"query":typeof t=="string"&&t.length&&(t=(r||Sl.parse)(t)),n[e]=t;break;case"port":n[e]=t,vy(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<Jd.length;o++){var s=Jd[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:"&&Nr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function kL(e){(!e||typeof e!="function")&&(e=Sl.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||Nr(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&Nr(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}Dr.prototype={set:LL,toString:kL};Dr.extractProtocol=wy;Dr.location=by;Dr.trimLeft=Qd;Dr.qs=Sl;Ay.exports=Dr});var ML,Cy=I(()=>{"use strict";ML=ne(Kd());});function Xd(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 El=I(()=>{"use strict";});var Yd,Zd,ep=I(()=>{"use strict";El();Yd=class{features=new Map;register(t,r){let n=Xd(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()}},Zd=new Yd});var tp=I(()=>{"use strict";});function Al(e){return BL.has(e)}var BL,Co=I(()=>{"use strict";Vd();Wd();wl();wo();Vd();Cy();ep();El();tp();BL=new Set(["tie","test","prod","preview","preprod","gov","high","dod","mooncake","ex","rx"])});var UL,Sy=I(()=>{"use strict";Co();UL=Ao({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 Nl,O,M,ri,Wi,Dl,Ey,Ny,rp,So=I(()=>{"use strict";vo();Nl=class{name;constructor(t){this.name=t}toString(){return this.name}getName(){return this.name}getDisplayNameResourceKey(){return rp.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"})(M||(M={}));ri=class extends Nl{constructor(t){super(t)}static get None(){return"None"}static get SystemRequired(){return"SystemRequired"}static get ApplicationRequired(){return"ApplicationRequired"}static get Recommended(){return"Recommended"}},Wi=class e extends Nl{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?Dl.Persistent:parseInt(Dl[this.name])}};(function(e){e[e.Persistent=0]="Persistent",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup"})(Dl||(Dl={}));(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"})(Ey||(Ey={}));(function(e){e[e.Attribute=0]="Attribute",e[e.Organization=1]="Organization",e[e.Currency=2]="Currency"})(Ny||(Ny={}));rp=class e{static resourceKeyMap=e.initResourceKeyMap();static initResourceKeyMap(){let t=new Vi;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(M.Email,"SystemCustomization.String.Format.email"),t.add(M.Text,"SystemCustomization.String.Format.text"),t.add(M.TextArea,"SystemCustomization.String.Format.textarea"),t.add(M.Url,"SystemCustomization.String.Format.url"),t.add(M.TickerSymbol,"SystemCustomization.String.Format.tickersymbol"),t.add(M.PhoneticGuide,"SystemCustomization.String.Format.phoneticguide"),t.add(M.VersionNumber,"SystemCustomization.String.Format.versionnumber"),t.add(M.Phone,"SystemCustomization.String.Format.phone"),t.add(M.None,"SystemCustomization.Integer.Format."),t.add(M.Duration,"SystemCustomization.Integer.Format.duration"),t.add(M.TimeZone,"SystemCustomization.Integer.Format.timezone"),t.add(M.Language,"SystemCustomization.Integer.Format.language"),t.add(M.Locale,"SystemCustomization.Integer.Format.language"),t.add(M.DateOnly,"SystemCustomization.DateTime.Format.date"),t.add(M.DateAndTime,"SystemCustomization.DateTime.Format.datetime"),t.add(M.Regarding,"SystemCustomization.Lookup.Format.regarding"),t.add(Wi.Persistent,"SystemCustomization.String.Source.persistent"),t.add(Wi.Calculated,"SystemCustomization.String.Source.calculated"),t.add(Wi.Rollup,"SystemCustomization.String.Source.rollup"),t.add(Wi.None,"SystemCustomization.String.Source.none"),t}static getDisplayNameResourceKey(t){return e.resourceKeyMap.getValue(t)}}});var Ty,ip,Hi,ni,np,Il,ji,Kr,we,Dy,Iy,_y,ir=I(()=>{"use strict";Ty={ThreeEqColumn_FirstColumn:34,ThreeEqColumn_SecondColumn:33,ThreeEqColumn_ThirdColumn:33,FiveEqColumn:20},ip={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"})(Hi||(Hi={}));(function(e){e.Left="Left",e.Right="Right",e.Center="Center"})(ni||(ni={}));(function(e){e[e.Mobile=0]="Mobile",e[e.Tablet=1]="Tablet",e[e.Web=2]="Web"})(np||(np={}));Il=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"})(ji||(ji={}));Kr=class{static StartTag="<"},we={ShowLabel:"true",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_",labelAlignment:ni.Left,labelPosition:ji.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"})(Dy||(Dy={}));(function(e){e.TabWithLockedFieldRemoval="TabWithLockedFieldRemoval",e.SectionWithLockedFieldRemoval="SectionWithLockedFieldRemoval",e.LockedSectionRemoval="LockedSectionRemoval",e.LockedFieldRemoval="LockedFieldRemoval",e.RequiredFieldRemoval="RequiredFieldRemoval",e.LastRemainingTab="LastRemainingTab",e.UnknownRemoval="UnknownRemoval"})(Iy||(Iy={}));(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"})(_y||(_y={}))});var ap,Py=I(()=>{"use strict";(function(e){e.DefaultValue="defaultValue",e.Loaded="loaded"})(ap||(ap={}))});var Fy,$L,Oy,ej,tj,Eo,Ry,rj,nj,xy=I(()=>{"use strict";Fy=ne(Zn());Re();qi();Sy();So();ir();zi();X();$L=ne(Wn());Py();(function(e){e.Model="Model",e.Canvas="Canvas",e.CustomPages="CustomPages"})(Oy||(Oy={}));ej={Read:ti.Read,Edit:ti.Edit,Both:ti.Both,Container:ti.Container},tj={input:Gi.Input,bound:Gi.Bound,output:Gi.Output};(function(e){e[e.dataset=0]="dataset",e[e.property=1]="property",e[e.groups=2]="groups",e[e.group=3]="group"})(Eo||(Eo={}));(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"})(Ry||(Ry={}));rj=new Set([_.Currency,_.Decimal,_.FP,_.Multiple,_.SingleLineEmail,_.SingleLinePhone,_.SingleLineText,_.SingleLineTextArea,_.SingleLineURL,_.SingleLineTickerSymbol,_.WholeNone,_.WholeDuration,_.WholeLanguage,_.WholeTimeZone,_.Enum,_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.TwoOptions,_.Boolean,_.PowerBIReport,_.DateAndTimeDateAndTime,_.DateAndTimeDateOnly,_.OptionSet,_.MultiSelectOptionSet,_.CardForm]),nj={numbers:[_.WholeNone,_.FP,_.Decimal,_.Currency],text:[_.SingleLineText,_.SingleLineTextArea,_.Multiple],lookup:[_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding],dates:[_.DateAndTimeDateOnly,_.DateAndTimeDateAndTime],allFields:[_.TwoOptions,_.DateAndTimeDateOnly,_.DateAndTimeDateAndTime,_.FP,_.Decimal,_.WholeNone,_.WholeDuration,_.WholeTimeZone,_.WholeLanguage,_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.Multiple,_.OptionSet,_.SingleLineText,_.SingleLineTextArea,_.SingleLineEmail,_.SingleLineURL,_.SingleLineTickerSymbol,_.SingleLinePhone]}});var ar,_l,Ly=I(()=>{"use strict";ar=ne(Zn());xe();Re();rt();qi();zi();xy();So();X();ze();ir();_l=class extends H{constructor(t){super(y.customControl,t)}customControlId;get id(){let t=this.getProperty(m.id);return N.IsNullOrUndefined(t)?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new T(t.substr(1,t.length-2)):new T(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(ft.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===ft.name)?.value}getParameterChildrenValues(t,r,n){if(this.isDataSet(t)){let i=r.find(u=>u.key===ft.name)?.value,a={Name:i,Type:_.Grid,Columns:[]},l=this.getParameters().get(ft.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===m.static&&a.value==="true"){r=!0;break}}return r}get name(){return this.getProperty(m.Name)}get formFactor(){return this.getProperty(m.formFactor)}set formFactor(t){this.setProperty(m.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(Kr.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),p=await this.parameterJSON(o,u,d,t);r.push({Name:c,Value:p})}else if(this.isGroups(s))r.push({Name:o,Value:{Type:iy.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===Eo.dataset?a.get(ft.dataset)?.some(f=>this.getDatasetName(f)===d)||r.push({Name:d,Value:{Name:d,Columns:[],Type:_.Grid}}):c.propertyType===Eo.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,ar.trackInfoTrace)(dt,{eventName:`${Jr}/parametersToJSON`,eventData:{message:`Configuration metadata for custom control parameter ${o} is not available for custom control : ${this.name}.`}}),r=[];break}}}else(0,ar.trackErrorTrace)(dt,{eventName:`${Jr}/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,ar.trackErrorTrace)(dt,{eventName:`${Jr}/parametersToJSON`,eventData:{message:"Custom Control Manifest not found"}},new Error(`No custom control manifest found for ${this.name}`))}catch(n){(0,ar.trackErrorTrace)(dt,{eventName:`${Jr}/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===ft.name)?.value;if(a)return this.getParameterChildrenValues(t,r);{let s=new Error(`No dataset manifest info for ${o}`);(0,ar.trackErrorTrace)(dt,{eventName:`${Jr}/parameterJSON`,eventData:{message:"Missing custom control manifest dataset info"}},s)}}else{let a=n,o=r&&r.find(l=>l.key===m.Type),s=a&&!a.ofTypeGroup.every(l=>!Ud.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===In.FormComponent){let d=this.getFormComponentValueByParameterName(m.bindAttribute),p=await i.formModelService.loadLookupModel(d),f=p.lookupColumn,h=this.getLookupDataTypeFromAttributeMetadata(f);return{Name:t,Type:h,Usage:l,Static:u,Primary:c,EntityName:p.primaryTableName,Value:d,ViewId:this.getFormComponentValueByParameterName(ny.DefaultViewId),TargetEntityType:f.targets[0],FilterRelationshipName:this.getFormComponentValueByParameterName(m.FilterRelationshipName),AvailableViewIds:this.getFormComponentValueByParameterName(m.AvailableViewIds),DependentAttributeName:this.getFormComponentValueByParameterName(m.DependentAttributeName),DependentAttributeType:this.getFormComponentValueByParameterName(m.DependentAttributeType),AllowFilterOff:P.IsStrictTrue(this.getFormComponentValueByParameterName(m.AllowFilterOff)),DisableQuickFind:P.IsStrictTrue(this.getFormComponentValueByParameterName(m.DisableQuickFind)),EnableViewPicker:!P.IsStrictTrue(this.getFormComponentValueByParameterName(m.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,ar.trackErrorTrace)(dt,{eventName:`${Jr}/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 f=o.value;return{Type:f,Static:u,Usage:l,Value:this.isNumberTypeProperty(a,f)&&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 p=new Error(`No property type info for ${t}`);(0,ar.trackErrorTrace)(dt,{eventName:`${Jr}/parameterJSON`,eventData:{message:"Missing property type info"}},p)}else{let l=new Error(`No property manifest info for ${t}`);(0,ar.trackWarningTrace)(dt,{eventName:`${Jr}/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 _.LookupCustomer;case O.Owner:return _.LookupOwner;case O.PartyList:return _.LookupPartyList;default:return n===M.Regarding?_.LookupRegarding:_.LookupSimple}}isLookupType(t){return Ud.includes(t)}isNumberTypeProperty(t,r){return $d.includes(r)||t.ofTypeGroup.some(n=>$d.includes(n))}isDataSet(t){return ft.dataset===t}isGroups(t){return!!t[0].getAllProperties().find(n=>n.key==="isGroup"&&n.value==="true")}}});var V,op=I(()=>{"use strict";V=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 R,Ji,ke,Tl=I(()=>{"use strict";xe();vo();Re();rt();So();Yn();op();ir();R=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"}},Ji=class{static get RelationshipAssistant(){return"3ff9a528-dd50-4aca-8f10-2e5ed73513ad"}static get PredictiveLeadScoring(){return"6f503f2a-d033-4106-b62c-f8f2e5f01a57"}},ke=class e{static FieldControlIds=e.initializeFieldControls();static UnboundControlIds=e.initializeUnboundControls();static ControlsAllowedForReferencePanel=e.initializeReferencePanelControls();static ControlsAllowedForFooter=e.initializeFooterControls();static CustomControlIdMap=new pt;static initializeFieldControls(){let t=new pt,r=e.getControlName(O.SingleLineofText,M.Phone);t.add(r,new T(R.PhoneNumberControl));let n=e.getControlName(O.SingleLineofText,M.TextArea);t.add(n,new T(R.TextAreaControl));let i=e.getControlName(O.SingleLineofText,M.Text);t.add(i,new T(R.TextBoxControl));let a=e.getControlName(O.SingleLineofText,M.Email);t.add(a,new T(R.EmailAddressControl));let o=e.getControlName(O.SingleLineofText,M.Url);t.add(o,new T(R.UrlControl));let s=e.getControlName(O.SingleLineofText,M.TickerSymbol);t.add(s,new T(R.TickerControl));let l=e.getControlName(O.SingleLineofText,M.PhoneticGuide);t.add(l,new T(R.TextBoxControl));let u=e.getControlName(O.WholeNumber,M.Duration);t.add(u,new T(R.DurationControl));let c=e.getControlName(O.WholeNumber,M.Language);t.add(c,new T(R.LanguagePickerControl));let d=e.getControlName(O.WholeNumber,M.TimeZone);t.add(d,new T(R.TimeZonePicklistControl));let p=e.getControlName(O.WholeNumber,M.None);t.add(p,new T(R.IntegerControl));let f=e.getControlName(O.DateTime,M.DateOnly);t.add(f,new T(R.DateTimeControl));let h=e.getControlName(O.DateTime,M.DateAndTime);t.add(h,new T(R.DateTimeControl));let g=e.getControlName(O.LookupType,M.None);t.add(g,new T(R.LookupControl));let w=e.getControlName(O.CustomerType,M.None);t.add(w,new T(R.LookupControl));let S=e.getControlName(O.FloatingPointNumber,M.None);t.add(S,new T(R.FloatControl));let D=e.getControlName(O.DecimalNumber,M.None);t.add(D,new T(R.DecimalControl));let x=e.getControlName(O.Currency,M.None);t.add(x,new T(R.MoneyControl));let F=e.getControlName(O.MultipleLineofText,M.None);t.add(F,new T(R.TextAreaControl));let G=e.getControlName(O.MultipleLineofText,M.Text);t.add(G,new T(R.TextAreaControl));let L=e.getControlName(O.MultipleLineofText,M.TextArea);t.add(L,new T(R.TextAreaControl));let q=e.getControlName(O.MultipleLineofText,M.Email);t.add(q,new T(R.EmailBodyControl));let U=e.getControlName(O.OptionSet,M.None);t.add(U,new T(R.PicklistControl));let $=e.getControlName(O.TwoOptions,M.None);t.add($,new T(R.RadioControl));let W=e.getControlName(O.Image,M.None);t.add(W,new T(R.WebResourceImageControl));let B=e.getControlName(O.Image,M.None);t.add(B,new T(R.WebResourceHtmlControl));let Qe=e.getControlName(O.TwoOptions,"Radio");t.add(Qe,new T(R.RadioControl));let vt=e.getControlName(O.TwoOptions,"CheckBox");t.add(vt,new T(R.CheckBoxControl));let pe=e.getControlName(O.TwoOptions,"List");t.add(pe,new T(R.PicklistControl));let Ke=e.getControlName(O.State,M.None);t.add(Ke,new T(R.PicklistControl));let Z=e.getControlName(O.Status,M.None);t.add(Z,new T(R.PicklistStatusControl));let yt=e.getControlName(O.OwnerType,M.None);t.add(yt,new T(R.LookupControl));let uc=e.getControlName(O.PartyListType,M.None);t.add(uc,new T(R.PartyListControl));let QT=e.getControlName(O.LookupType,M.Regarding);t.add(QT,new T(R.RegardingControl));let KT=e.getControlName(O.MultiSelectOptionSet,M.None);return t.add(KT,new T(R.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===R.CustomControl}static initializeUnboundControls(){let t=new pt;return t.add(R.ACIControl,V.ACIControl),t.add(R.IframeControl,V.IframeControl),t.add(R.SearchWidgetControl,V.SearchWidgetControl),t.add(R.MapsControl,V.MapsControl),t.add(R.QuickFormCollectionControl,V.QuickFormCollectionControl),t.add(R.GridControl,V.SubGridControl),t.add(R.WebResourceImageControl,V.WebResourceImageControl),t.add(R.WebResourceHtmlControl,V.WebResourceHtmlControl),t.add(R.ReferencePanelSearchWidget,V.SearchWidgetControl),t.add(R.ReferencePanelQuickFormCollectionControl,V.QuickFormCollectionControl),t.add(R.ReferencePanelSubgridControl,V.SubGridControl),t.add(R.TimerControl,V.TimerControl),t.add(R.TimeLineControl,V.NotesControl),t.add(R.TimeLineControlUC,V.NotesControl),t.add(R.SocialInsightControl,V.SocialInsightControl),t.add(Ji.RelationshipAssistant,V.CustomControl),t}static initializeReferencePanelControls(){let t=new pt;return t.add(R.IframeControl,V.IframeControl),t.add(R.ReferencePanelSearchWidget,V.SearchWidgetControl),t.add(R.ReferencePanelQuickFormCollectionControl,V.QuickFormCollectionControl),t.add(R.ReferencePanelSubgridControl,V.SubGridControl),t.add(R.WebResourceHtmlControl,V.WebResourceHtmlControl),t.add(R.WebResourceImageControl,V.WebResourceHtmlControl),t}static initializeFooterControls(){let t=new Vi;return t.add(Hi.IFRAME,!0),t.add(Hi.SPACER,!0),t.add(Hi.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(we.referencePanelNamePrefix)===0}static isUnboundFormControlByIdentifier(t){return N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.guidString)?!1:e.UnboundControlIds.containsKey(t.guidString)}static getUnboundFormControlName(t){let r=P.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)?P.EmptyString:e.UnboundControlIds.getValue(t.guidString).toString()}static isSpacerControl(t){return t===R.SpacerControl}static GetRowSpan(t){let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===R.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 V.IframeControl:case V.ACIControl:case V.SocialInsightControl:return 6;case V.SubGridControl:case V.CustomControl:return 4;case V.WebResourceImageControl:return 15;case V.WebResourceHtmlControl:return 15;case V.MapsControl:return 8;case V.SearchWidgetControl:return 10;case V.NotesControl:case V.TimeLineControl:return 15;case V.TimerControl:return 2;default:}}static isLookUpControl(t){return!N.IsNullOrUndefined(t)&&t.ClassId.guidString===R.LookupControl}static isRelationshipAssistantOrLeadScoringControl(t){return!N.IsNullOrUndefined(t)&&e.isRelationshipAssistantOrLeadScoring(t.UniqueId)}static isRelationshipAssistantOrLeadScoring(t){return!N.IsNullOrUndefined(t)&&(t.guidString===Ji.RelationshipAssistant||t.guidString===Ji.PredictiveLeadScoring)}static isRelationshipAssistantControl(t){return!N.IsNullOrUndefined(t)&&e.isRelationshipAssistant(t.UniqueId)}static isRelationshipAssistant(t){return!N.IsNullOrUndefined(t)&&t.guidString===Ji.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===R.CustomControl&&!N.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}return r}}});var Pl,ky=I(()=>{"use strict";Pl=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 ii,Qi,My,By,_n,Uy,$y,sp=I(()=>{"use strict";(function(e){e[e.Center=0]="Center",e[e.Left=1]="Left",e[e.Right=2]="Right"})(ii||(ii={}));(function(e){e[e.Left=0]="Left",e[e.Top=1]="Top"})(Qi||(Qi={}));(function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle"})(My||(My={}));(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"})(By||(By={}));(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"})(_n||(_n={}));(function(e){e[e.None=0]="None",e[e.SystemRequired=1]="SystemRequired",e[e.ApplicationRequired=2]="ApplicationRequired",e[e.Recommended=3]="Recommended"})(Uy||(Uy={}));(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"})($y||($y={}))});var Ki,qy=I(()=>{"use strict";Co();Ki=Hd({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 Vy(e){return{...e,extractConfig:t=>qL(t,Object.keys(e.fallback))}}function qL(e,t){let r={};for(let n of t)typeof e[n]<"u"&&(r[n]=e[n]);return r}var lp=I(()=>{"use strict";});var up=v((Oj,zy)=>{var No=new Proxy(function(){return No},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:No},apply:function(){return No},construct:function(){return{}}}),Gy=function(){return No};Object.setPrototypeOf(Gy,No);zy.exports=Gy});var jy=v((Rj,Hy)=>{var Do=new Proxy(function(){return Do},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Do},apply:function(){return Do},construct:function(){return{}}}),Wy=function(){return Do};Object.setPrototypeOf(Wy,Do);Hy.exports=Wy});var cp=v((Fj,Qy)=>{var Io=new Proxy(function(){return Io},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Io},apply:function(){return Io},construct:function(){return{}}}),Jy=function(){return Io};Object.setPrototypeOf(Jy,Io);Qy.exports=Jy});var Xy=v((xj,Ky)=>{function VL(){this.__data__=[],this.size=0}Ky.exports=VL});var Xi=v((Lj,Yy)=>{function GL(e,t){return e===t||e!==e&&t!==t}Yy.exports=GL});var _o=v((kj,Zy)=>{var zL=Xi();function WL(e,t){for(var r=e.length;r--;)if(zL(e[r][0],t))return r;return-1}Zy.exports=WL});var tb=v((Mj,eb)=>{var HL=_o(),jL=Array.prototype,JL=jL.splice;function QL(e){var t=this.__data__,r=HL(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():JL.call(t,r,1),--this.size,!0}eb.exports=QL});var nb=v((Bj,rb)=>{var KL=_o();function XL(e){var t=this.__data__,r=KL(t,e);return r<0?void 0:t[r][1]}rb.exports=XL});var ab=v((Uj,ib)=>{var YL=_o();function ZL(e){return YL(this.__data__,e)>-1}ib.exports=ZL});var sb=v(($j,ob)=>{var ek=_o();function tk(e,t){var r=this.__data__,n=ek(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}ob.exports=tk});var To=v((qj,lb)=>{var rk=Xy(),nk=tb(),ik=nb(),ak=ab(),ok=sb();function Yi(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])}}Yi.prototype.clear=rk;Yi.prototype.delete=nk;Yi.prototype.get=ik;Yi.prototype.has=ak;Yi.prototype.set=ok;lb.exports=Yi});var cb=v((Vj,ub)=>{var sk=To();function lk(){this.__data__=new sk,this.size=0}ub.exports=lk});var pb=v((Gj,db)=>{function uk(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}db.exports=uk});var mb=v((zj,fb)=>{function ck(e){return this.__data__.get(e)}fb.exports=ck});var gb=v((Wj,hb)=>{function dk(e){return this.__data__.has(e)}hb.exports=dk});var dp=v((Hj,vb)=>{var pk=typeof global=="object"&&global&&global.Object===Object&&global;vb.exports=pk});var or=v((jj,yb)=>{var fk=dp(),mk=typeof self=="object"&&self&&self.Object===Object&&self,hk=fk||mk||Function("return this")();yb.exports=hk});var Po=v((Jj,bb)=>{var gk=or(),vk=gk.Symbol;bb.exports=vk});var Sb=v((Qj,Cb)=>{var wb=Po(),Ab=Object.prototype,yk=Ab.hasOwnProperty,bk=Ab.toString,Oo=wb?wb.toStringTag:void 0;function wk(e){var t=yk.call(e,Oo),r=e[Oo];try{e[Oo]=void 0;var n=!0}catch{}var i=bk.call(e);return n&&(t?e[Oo]=r:delete e[Oo]),i}Cb.exports=wk});var Nb=v((Kj,Eb)=>{var Ak=Object.prototype,Ck=Ak.toString;function Sk(e){return Ck.call(e)}Eb.exports=Sk});var ai=v((Xj,_b)=>{var Db=Po(),Ek=Sb(),Nk=Nb(),Dk="[object Null]",Ik="[object Undefined]",Ib=Db?Db.toStringTag:void 0;function _k(e){return e==null?e===void 0?Ik:Dk:Ib&&Ib in Object(e)?Ek(e):Nk(e)}_b.exports=_k});var Xr=v((Yj,Tb)=>{function Tk(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}Tb.exports=Tk});var Ol=v((Zj,Pb)=>{var Pk=ai(),Ok=Xr(),Rk="[object AsyncFunction]",Fk="[object Function]",xk="[object GeneratorFunction]",Lk="[object Proxy]";function kk(e){if(!Ok(e))return!1;var t=Pk(e);return t==Fk||t==xk||t==Rk||t==Lk}Pb.exports=kk});var Rb=v((eJ,Ob)=>{var Mk=or(),Bk=Mk["__core-js_shared__"];Ob.exports=Bk});var Lb=v((tJ,xb)=>{var pp=Rb(),Fb=(function(){var e=/[^.]+$/.exec(pp&&pp.keys&&pp.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function Uk(e){return!!Fb&&Fb in e}xb.exports=Uk});var fp=v((rJ,kb)=>{var $k=Function.prototype,qk=$k.toString;function Vk(e){if(e!=null){try{return qk.call(e)}catch{}try{return e+""}catch{}}return""}kb.exports=Vk});var Bb=v((nJ,Mb)=>{var Gk=Ol(),zk=Lb(),Wk=Xr(),Hk=fp(),jk=/[\\^$.*+?()[\]{}|]/g,Jk=/^\[object .+?Constructor\]$/,Qk=Function.prototype,Kk=Object.prototype,Xk=Qk.toString,Yk=Kk.hasOwnProperty,Zk=RegExp("^"+Xk.call(Yk).replace(jk,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function eM(e){if(!Wk(e)||zk(e))return!1;var t=Gk(e)?Zk:Jk;return t.test(Hk(e))}Mb.exports=eM});var $b=v((iJ,Ub)=>{function tM(e,t){return e?.[t]}Ub.exports=tM});var Tn=v((aJ,qb)=>{var rM=Bb(),nM=$b();function iM(e,t){var r=nM(e,t);return rM(r)?r:void 0}qb.exports=iM});var Rl=v((oJ,Vb)=>{var aM=Tn(),oM=or(),sM=aM(oM,"Map");Vb.exports=sM});var Ro=v((sJ,Gb)=>{var lM=Tn(),uM=lM(Object,"create");Gb.exports=uM});var Hb=v((lJ,Wb)=>{var zb=Ro();function cM(){this.__data__=zb?zb(null):{},this.size=0}Wb.exports=cM});var Jb=v((uJ,jb)=>{function dM(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}jb.exports=dM});var Kb=v((cJ,Qb)=>{var pM=Ro(),fM="__lodash_hash_undefined__",mM=Object.prototype,hM=mM.hasOwnProperty;function gM(e){var t=this.__data__;if(pM){var r=t[e];return r===fM?void 0:r}return hM.call(t,e)?t[e]:void 0}Qb.exports=gM});var Yb=v((dJ,Xb)=>{var vM=Ro(),yM=Object.prototype,bM=yM.hasOwnProperty;function wM(e){var t=this.__data__;return vM?t[e]!==void 0:bM.call(t,e)}Xb.exports=wM});var ew=v((pJ,Zb)=>{var AM=Ro(),CM="__lodash_hash_undefined__";function SM(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=AM&&t===void 0?CM:t,this}Zb.exports=SM});var rw=v((fJ,tw)=>{var EM=Hb(),NM=Jb(),DM=Kb(),IM=Yb(),_M=ew();function Zi(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])}}Zi.prototype.clear=EM;Zi.prototype.delete=NM;Zi.prototype.get=DM;Zi.prototype.has=IM;Zi.prototype.set=_M;tw.exports=Zi});var aw=v((mJ,iw)=>{var nw=rw(),TM=To(),PM=Rl();function OM(){this.size=0,this.__data__={hash:new nw,map:new(PM||TM),string:new nw}}iw.exports=OM});var sw=v((hJ,ow)=>{function RM(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}ow.exports=RM});var Fo=v((gJ,lw)=>{var FM=sw();function xM(e,t){var r=e.__data__;return FM(t)?r[typeof t=="string"?"string":"hash"]:r.map}lw.exports=xM});var cw=v((vJ,uw)=>{var LM=Fo();function kM(e){var t=LM(this,e).delete(e);return this.size-=t?1:0,t}uw.exports=kM});var pw=v((yJ,dw)=>{var MM=Fo();function BM(e){return MM(this,e).get(e)}dw.exports=BM});var mw=v((bJ,fw)=>{var UM=Fo();function $M(e){return UM(this,e).has(e)}fw.exports=$M});var gw=v((wJ,hw)=>{var qM=Fo();function VM(e,t){var r=qM(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}hw.exports=VM});var Fl=v((AJ,vw)=>{var GM=aw(),zM=cw(),WM=pw(),HM=mw(),jM=gw();function ea(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])}}ea.prototype.clear=GM;ea.prototype.delete=zM;ea.prototype.get=WM;ea.prototype.has=HM;ea.prototype.set=jM;vw.exports=ea});var bw=v((CJ,yw)=>{var JM=To(),QM=Rl(),KM=Fl(),XM=200;function YM(e,t){var r=this.__data__;if(r instanceof JM){var n=r.__data__;if(!QM||n.length<XM-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new KM(n)}return r.set(e,t),this.size=r.size,this}yw.exports=YM});var mp=v((SJ,ww)=>{var ZM=To(),eB=cb(),tB=pb(),rB=mb(),nB=gb(),iB=bw();function ta(e){var t=this.__data__=new ZM(e);this.size=t.size}ta.prototype.clear=eB;ta.prototype.delete=tB;ta.prototype.get=rB;ta.prototype.has=nB;ta.prototype.set=iB;ww.exports=ta});var Cw=v((EJ,Aw)=>{var aB="__lodash_hash_undefined__";function oB(e){return this.__data__.set(e,aB),this}Aw.exports=oB});var Ew=v((NJ,Sw)=>{function sB(e){return this.__data__.has(e)}Sw.exports=sB});var Dw=v((DJ,Nw)=>{var lB=Fl(),uB=Cw(),cB=Ew();function xl(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new lB;++t<r;)this.add(e[t])}xl.prototype.add=xl.prototype.push=uB;xl.prototype.has=cB;Nw.exports=xl});var _w=v((IJ,Iw)=>{function dB(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}Iw.exports=dB});var Pw=v((_J,Tw)=>{function pB(e,t){return e.has(t)}Tw.exports=pB});var hp=v((TJ,Ow)=>{var fB=Dw(),mB=_w(),hB=Pw(),gB=1,vB=2;function yB(e,t,r,n,i,a){var o=r&gB,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,p=!0,f=r&vB?new fB:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var h=e[d],g=t[d];if(n)var w=o?n(g,h,d,t,e,a):n(h,g,d,e,t,a);if(w!==void 0){if(w)continue;p=!1;break}if(f){if(!mB(t,function(S,D){if(!hB(f,D)&&(h===S||i(h,S,r,n,a)))return f.push(D)})){p=!1;break}}else if(!(h===g||i(h,g,r,n,a))){p=!1;break}}return a.delete(e),a.delete(t),p}Ow.exports=yB});var gp=v((PJ,Rw)=>{var bB=or(),wB=bB.Uint8Array;Rw.exports=wB});var xw=v((OJ,Fw)=>{function AB(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}Fw.exports=AB});var kw=v((RJ,Lw)=>{function CB(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}Lw.exports=CB});var qw=v((FJ,$w)=>{var Mw=Po(),Bw=gp(),SB=Xi(),EB=hp(),NB=xw(),DB=kw(),IB=1,_B=2,TB="[object Boolean]",PB="[object Date]",OB="[object Error]",RB="[object Map]",FB="[object Number]",xB="[object RegExp]",LB="[object Set]",kB="[object String]",MB="[object Symbol]",BB="[object ArrayBuffer]",UB="[object DataView]",Uw=Mw?Mw.prototype:void 0,vp=Uw?Uw.valueOf:void 0;function $B(e,t,r,n,i,a,o){switch(r){case UB:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case BB:return!(e.byteLength!=t.byteLength||!a(new Bw(e),new Bw(t)));case TB:case PB:case FB:return SB(+e,+t);case OB:return e.name==t.name&&e.message==t.message;case xB:case kB:return e==t+"";case RB:var s=NB;case LB:var l=n&IB;if(s||(s=DB),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;n|=_B,o.set(e,t);var c=EB(s(e),s(t),n,i,a,o);return o.delete(e),c;case MB:if(vp)return vp.call(e)==vp.call(t)}return!1}$w.exports=$B});var Gw=v((xJ,Vw)=>{function qB(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}Vw.exports=qB});var Pn=v((LJ,zw)=>{var VB=Array.isArray;zw.exports=VB});var Hw=v((kJ,Ww)=>{var GB=Gw(),zB=Pn();function WB(e,t,r){var n=t(e);return zB(e)?n:GB(n,r(e))}Ww.exports=WB});var Jw=v((MJ,jw)=>{function HB(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}jw.exports=HB});var Kw=v((BJ,Qw)=>{function jB(){return[]}Qw.exports=jB});var Zw=v((UJ,Yw)=>{var JB=Jw(),QB=Kw(),KB=Object.prototype,XB=KB.propertyIsEnumerable,Xw=Object.getOwnPropertySymbols,YB=Xw?function(e){return e==null?[]:(e=Object(e),JB(Xw(e),function(t){return XB.call(e,t)}))}:QB;Yw.exports=YB});var tA=v(($J,eA)=>{function ZB(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}eA.exports=ZB});var On=v((qJ,rA)=>{function eU(e){return e!=null&&typeof e=="object"}rA.exports=eU});var iA=v((VJ,nA)=>{var tU=ai(),rU=On(),nU="[object Arguments]";function iU(e){return rU(e)&&tU(e)==nU}nA.exports=iU});var yp=v((GJ,sA)=>{var aA=iA(),aU=On(),oA=Object.prototype,oU=oA.hasOwnProperty,sU=oA.propertyIsEnumerable,lU=aA((function(){return arguments})())?aA:function(e){return aU(e)&&oU.call(e,"callee")&&!sU.call(e,"callee")};sA.exports=lU});var uA=v((zJ,lA)=>{function uU(){return!1}lA.exports=uU});var Ll=v((xo,ra)=>{var cU=or(),dU=uA(),pA=typeof xo=="object"&&xo&&!xo.nodeType&&xo,cA=pA&&typeof ra=="object"&&ra&&!ra.nodeType&&ra,pU=cA&&cA.exports===pA,dA=pU?cU.Buffer:void 0,fU=dA?dA.isBuffer:void 0,mU=fU||dU;ra.exports=mU});var kl=v((WJ,fA)=>{var hU=9007199254740991,gU=/^(?:0|[1-9]\d*)$/;function vU(e,t){var r=typeof e;return t=t??hU,!!t&&(r=="number"||r!="symbol"&&gU.test(e))&&e>-1&&e%1==0&&e<t}fA.exports=vU});var bp=v((HJ,mA)=>{var yU=9007199254740991;function bU(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=yU}mA.exports=bU});var gA=v((jJ,hA)=>{var wU=ai(),AU=bp(),CU=On(),SU="[object Arguments]",EU="[object Array]",NU="[object Boolean]",DU="[object Date]",IU="[object Error]",_U="[object Function]",TU="[object Map]",PU="[object Number]",OU="[object Object]",RU="[object RegExp]",FU="[object Set]",xU="[object String]",LU="[object WeakMap]",kU="[object ArrayBuffer]",MU="[object DataView]",BU="[object Float32Array]",UU="[object Float64Array]",$U="[object Int8Array]",qU="[object Int16Array]",VU="[object Int32Array]",GU="[object Uint8Array]",zU="[object Uint8ClampedArray]",WU="[object Uint16Array]",HU="[object Uint32Array]",ge={};ge[BU]=ge[UU]=ge[$U]=ge[qU]=ge[VU]=ge[GU]=ge[zU]=ge[WU]=ge[HU]=!0;ge[SU]=ge[EU]=ge[kU]=ge[NU]=ge[MU]=ge[DU]=ge[IU]=ge[_U]=ge[TU]=ge[PU]=ge[OU]=ge[RU]=ge[FU]=ge[xU]=ge[LU]=!1;function jU(e){return CU(e)&&AU(e.length)&&!!ge[wU(e)]}hA.exports=jU});var yA=v((JJ,vA)=>{function JU(e){return function(t){return e(t)}}vA.exports=JU});var wA=v((Lo,na)=>{var QU=dp(),bA=typeof Lo=="object"&&Lo&&!Lo.nodeType&&Lo,ko=bA&&typeof na=="object"&&na&&!na.nodeType&&na,KU=ko&&ko.exports===bA,wp=KU&&QU.process,XU=(function(){try{var e=ko&&ko.require&&ko.require("util").types;return e||wp&&wp.binding&&wp.binding("util")}catch{}})();na.exports=XU});var Ml=v((QJ,SA)=>{var YU=gA(),ZU=yA(),AA=wA(),CA=AA&&AA.isTypedArray,e$=CA?ZU(CA):YU;SA.exports=e$});var Ap=v((KJ,EA)=>{var t$=tA(),r$=yp(),n$=Pn(),i$=Ll(),a$=kl(),o$=Ml(),s$=Object.prototype,l$=s$.hasOwnProperty;function u$(e,t){var r=n$(e),n=!r&&r$(e),i=!r&&!n&&i$(e),a=!r&&!n&&!i&&o$(e),o=r||n||i||a,s=o?t$(e.length,String):[],l=s.length;for(var u in e)(t||l$.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||a$(u,l)))&&s.push(u);return s}EA.exports=u$});var Bl=v((XJ,NA)=>{var c$=Object.prototype;function d$(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||c$;return e===r}NA.exports=d$});var Cp=v((YJ,DA)=>{function p$(e,t){return function(r){return e(t(r))}}DA.exports=p$});var _A=v((ZJ,IA)=>{var f$=Cp(),m$=f$(Object.keys,Object);IA.exports=m$});var PA=v((eQ,TA)=>{var h$=Bl(),g$=_A(),v$=Object.prototype,y$=v$.hasOwnProperty;function b$(e){if(!h$(e))return g$(e);var t=[];for(var r in Object(e))y$.call(e,r)&&r!="constructor"&&t.push(r);return t}TA.exports=b$});var Mo=v((tQ,OA)=>{var w$=Ol(),A$=bp();function C$(e){return e!=null&&A$(e.length)&&!w$(e)}OA.exports=C$});var FA=v((rQ,RA)=>{var S$=Ap(),E$=PA(),N$=Mo();function D$(e){return N$(e)?S$(e):E$(e)}RA.exports=D$});var LA=v((nQ,xA)=>{var I$=Hw(),_$=Zw(),T$=FA();function P$(e){return I$(e,T$,_$)}xA.exports=P$});var BA=v((iQ,MA)=>{var kA=LA(),O$=1,R$=Object.prototype,F$=R$.hasOwnProperty;function x$(e,t,r,n,i,a){var o=r&O$,s=kA(e),l=s.length,u=kA(t),c=u.length;if(l!=c&&!o)return!1;for(var d=l;d--;){var p=s[d];if(!(o?p in t:F$.call(t,p)))return!1}var f=a.get(e),h=a.get(t);if(f&&h)return f==t&&h==e;var g=!0;a.set(e,t),a.set(t,e);for(var w=o;++d<l;){p=s[d];var S=e[p],D=t[p];if(n)var x=o?n(D,S,p,t,e,a):n(S,D,p,e,t,a);if(!(x===void 0?S===D||i(S,D,r,n,a):x)){g=!1;break}w||(w=p=="constructor")}if(g&&!w){var F=e.constructor,G=t.constructor;F!=G&&"constructor"in e&&"constructor"in t&&!(typeof F=="function"&&F instanceof F&&typeof G=="function"&&G instanceof G)&&(g=!1)}return a.delete(e),a.delete(t),g}MA.exports=x$});var $A=v((aQ,UA)=>{var L$=Tn(),k$=or(),M$=L$(k$,"DataView");UA.exports=M$});var VA=v((oQ,qA)=>{var B$=Tn(),U$=or(),$$=B$(U$,"Promise");qA.exports=$$});var zA=v((sQ,GA)=>{var q$=Tn(),V$=or(),G$=q$(V$,"Set");GA.exports=G$});var HA=v((lQ,WA)=>{var z$=Tn(),W$=or(),H$=z$(W$,"WeakMap");WA.exports=H$});var eC=v((uQ,ZA)=>{var Sp=$A(),Ep=Rl(),Np=VA(),Dp=zA(),Ip=HA(),YA=ai(),ia=fp(),jA="[object Map]",j$="[object Object]",JA="[object Promise]",QA="[object Set]",KA="[object WeakMap]",XA="[object DataView]",J$=ia(Sp),Q$=ia(Ep),K$=ia(Np),X$=ia(Dp),Y$=ia(Ip),oi=YA;(Sp&&oi(new Sp(new ArrayBuffer(1)))!=XA||Ep&&oi(new Ep)!=jA||Np&&oi(Np.resolve())!=JA||Dp&&oi(new Dp)!=QA||Ip&&oi(new Ip)!=KA)&&(oi=function(e){var t=YA(e),r=t==j$?e.constructor:void 0,n=r?ia(r):"";if(n)switch(n){case J$:return XA;case Q$:return jA;case K$:return JA;case X$:return QA;case Y$:return KA}return t});ZA.exports=oi});var lC=v((cQ,sC)=>{var _p=mp(),Z$=hp(),eq=qw(),tq=BA(),tC=eC(),rC=Pn(),nC=Ll(),rq=Ml(),nq=1,iC="[object Arguments]",aC="[object Array]",Ul="[object Object]",iq=Object.prototype,oC=iq.hasOwnProperty;function aq(e,t,r,n,i,a){var o=rC(e),s=rC(t),l=o?aC:tC(e),u=s?aC:tC(t);l=l==iC?Ul:l,u=u==iC?Ul:u;var c=l==Ul,d=u==Ul,p=l==u;if(p&&nC(e)){if(!nC(t))return!1;o=!0,c=!1}if(p&&!c)return a||(a=new _p),o||rq(e)?Z$(e,t,r,n,i,a):eq(e,t,l,r,n,i,a);if(!(r&nq)){var f=c&&oC.call(e,"__wrapped__"),h=d&&oC.call(t,"__wrapped__");if(f||h){var g=f?e.value():e,w=h?t.value():t;return a||(a=new _p),i(g,w,r,n,a)}}return p?(a||(a=new _p),tq(e,t,r,n,i,a)):!1}sC.exports=aq});var pC=v((dQ,dC)=>{var oq=lC(),uC=On();function cC(e,t,r,n,i){return e===t?!0:e==null||t==null||!uC(e)&&!uC(t)?e!==e&&t!==t:oq(e,t,r,n,cC,i)}dC.exports=cC});var mC=v((pQ,fC)=>{var sq=pC();function lq(e,t){return sq(e,t)}fC.exports=lq});var Tp=v((fQ,hC)=>{var uq=Tn(),cq=(function(){try{var e=uq(Object,"defineProperty");return e({},"",{}),e}catch{}})();hC.exports=cq});var $l=v((mQ,vC)=>{var gC=Tp();function dq(e,t,r){t=="__proto__"&&gC?gC(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}vC.exports=dq});var Pp=v((hQ,yC)=>{var pq=$l(),fq=Xi();function mq(e,t,r){(r!==void 0&&!fq(e[t],r)||r===void 0&&!(t in e))&&pq(e,t,r)}yC.exports=mq});var wC=v((gQ,bC)=>{function hq(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}}bC.exports=hq});var CC=v((vQ,AC)=>{var gq=wC(),vq=gq();AC.exports=vq});var IC=v((Bo,aa)=>{var yq=or(),DC=typeof Bo=="object"&&Bo&&!Bo.nodeType&&Bo,SC=DC&&typeof aa=="object"&&aa&&!aa.nodeType&&aa,bq=SC&&SC.exports===DC,EC=bq?yq.Buffer:void 0,NC=EC?EC.allocUnsafe:void 0;function wq(e,t){if(t)return e.slice();var r=e.length,n=NC?NC(r):new e.constructor(r);return e.copy(n),n}aa.exports=wq});var PC=v((yQ,TC)=>{var _C=gp();function Aq(e){var t=new e.constructor(e.byteLength);return new _C(t).set(new _C(e)),t}TC.exports=Aq});var RC=v((bQ,OC)=>{var Cq=PC();function Sq(e,t){var r=t?Cq(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}OC.exports=Sq});var xC=v((wQ,FC)=>{function Eq(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}FC.exports=Eq});var MC=v((AQ,kC)=>{var Nq=Xr(),LC=Object.create,Dq=(function(){function e(){}return function(t){if(!Nq(t))return{};if(LC)return LC(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();kC.exports=Dq});var Op=v((CQ,BC)=>{var Iq=Cp(),_q=Iq(Object.getPrototypeOf,Object);BC.exports=_q});var $C=v((SQ,UC)=>{var Tq=MC(),Pq=Op(),Oq=Bl();function Rq(e){return typeof e.constructor=="function"&&!Oq(e)?Tq(Pq(e)):{}}UC.exports=Rq});var VC=v((EQ,qC)=>{var Fq=Mo(),xq=On();function Lq(e){return xq(e)&&Fq(e)}qC.exports=Lq});var WC=v((NQ,zC)=>{var kq=ai(),Mq=Op(),Bq=On(),Uq="[object Object]",$q=Function.prototype,qq=Object.prototype,GC=$q.toString,Vq=qq.hasOwnProperty,Gq=GC.call(Object);function zq(e){if(!Bq(e)||kq(e)!=Uq)return!1;var t=Mq(e);if(t===null)return!0;var r=Vq.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&GC.call(r)==Gq}zC.exports=zq});var Rp=v((DQ,HC)=>{function Wq(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}HC.exports=Wq});var Fp=v((IQ,jC)=>{var Hq=$l(),jq=Xi(),Jq=Object.prototype,Qq=Jq.hasOwnProperty;function Kq(e,t,r){var n=e[t];(!(Qq.call(e,t)&&jq(n,r))||r===void 0&&!(t in e))&&Hq(e,t,r)}jC.exports=Kq});var QC=v((_Q,JC)=>{var Xq=Fp(),Yq=$l();function Zq(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?Yq(r,s,l):Xq(r,s,l)}return r}JC.exports=Zq});var XC=v((TQ,KC)=>{function e3(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}KC.exports=e3});var ZC=v((PQ,YC)=>{var t3=Xr(),r3=Bl(),n3=XC(),i3=Object.prototype,a3=i3.hasOwnProperty;function o3(e){if(!t3(e))return n3(e);var t=r3(e),r=[];for(var n in e)n=="constructor"&&(t||!a3.call(e,n))||r.push(n);return r}YC.exports=o3});var xp=v((OQ,eS)=>{var s3=Ap(),l3=ZC(),u3=Mo();function c3(e){return u3(e)?s3(e,!0):l3(e)}eS.exports=c3});var rS=v((RQ,tS)=>{var d3=QC(),p3=xp();function f3(e){return d3(e,p3(e))}tS.exports=f3});var lS=v((FQ,sS)=>{var nS=Pp(),m3=IC(),h3=RC(),g3=xC(),v3=$C(),iS=yp(),aS=Pn(),y3=VC(),b3=Ll(),w3=Ol(),A3=Xr(),C3=WC(),S3=Ml(),oS=Rp(),E3=rS();function N3(e,t,r,n,i,a,o){var s=oS(e,r),l=oS(t,r),u=o.get(l);if(u){nS(e,r,u);return}var c=a?a(s,l,r+"",e,t,o):void 0,d=c===void 0;if(d){var p=aS(l),f=!p&&b3(l),h=!p&&!f&&S3(l);c=l,p||f||h?aS(s)?c=s:y3(s)?c=g3(s):f?(d=!1,c=m3(l,!0)):h?(d=!1,c=h3(l,!0)):c=[]:C3(l)||iS(l)?(c=s,iS(s)?c=E3(s):(!A3(s)||w3(s))&&(c=v3(l))):d=!1}d&&(o.set(l,c),i(c,l,n,a,o),o.delete(l)),nS(e,r,c)}sS.exports=N3});var Lp=v((xQ,cS)=>{var D3=mp(),I3=Pp(),_3=CC(),T3=lS(),P3=Xr(),O3=xp(),R3=Rp();function uS(e,t,r,n,i){e!==t&&_3(t,function(a,o){if(i||(i=new D3),P3(a))T3(e,t,o,r,uS,n,i);else{var s=n?n(R3(e,o),a,o+"",e,t,i):void 0;s===void 0&&(s=a),I3(e,o,s)}},O3)}cS.exports=uS});var kp=v((LQ,dS)=>{function F3(e){return e}dS.exports=F3});var fS=v((kQ,pS)=>{function x3(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)}pS.exports=x3});var gS=v((MQ,hS)=>{var L3=fS(),mS=Math.max;function k3(e,t,r){return t=mS(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=mS(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),L3(e,this,s)}}hS.exports=k3});var yS=v((BQ,vS)=>{function M3(e){return function(){return e}}vS.exports=M3});var AS=v((UQ,wS)=>{var B3=yS(),bS=Tp(),U3=kp(),$3=bS?function(e,t){return bS(e,"toString",{configurable:!0,enumerable:!1,value:B3(t),writable:!0})}:U3;wS.exports=$3});var SS=v(($Q,CS)=>{var q3=800,V3=16,G3=Date.now;function z3(e){var t=0,r=0;return function(){var n=G3(),i=V3-(n-r);if(r=n,i>0){if(++t>=q3)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}CS.exports=z3});var NS=v((qQ,ES)=>{var W3=AS(),H3=SS(),j3=H3(W3);ES.exports=j3});var IS=v((VQ,DS)=>{var J3=kp(),Q3=gS(),K3=NS();function X3(e,t){return K3(Q3(e,t,J3),e+"")}DS.exports=X3});var TS=v((GQ,_S)=>{var Y3=Xi(),Z3=Mo(),e4=kl(),t4=Xr();function r4(e,t,r){if(!t4(r))return!1;var n=typeof t;return(n=="number"?Z3(r)&&e4(t,r.length):n=="string"&&t in r)?Y3(r[t],e):!1}_S.exports=r4});var Mp=v((zQ,PS)=>{var n4=IS(),i4=TS();function a4(e){return n4(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&&i4(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})}PS.exports=a4});var RS=v((WQ,OS)=>{var o4=Lp(),s4=Mp(),l4=s4(function(e,t,r,n){o4(e,t,r,n)});OS.exports=l4});var zt,Uo=I(()=>{"use strict";(function(e){e[e.NotLoaded=0]="NotLoaded",e[e.Initialized=1]="Initialized",e[e.ConfigsLoaded=2]="ConfigsLoaded",e[e.Error=3]="Error"})(zt||(zt={}))});function xS(e,t,r="PROD"){let n=i=>`ShellSettings_ECS_ClientCache_${e}_${FS.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 FS,u4,LS=I(()=>{"use strict";FS=ne(cp()),u4=ne(up());});var Bp,kS=I(()=>{"use strict";wl();Bp=Ao({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 BS,US,$S,qS,Up,c4,ql,MS,$p=I(()=>{"use strict";BS=ne(up()),US=ne(jy()),$S=ne(cp()),qS=ne(mC()),Up=ne(RS());Uo();LS();kS();c4=60*1e3,ql=class{clientName;logger;ecsEndpoint;resolveLoadingPromise;loadingPromise=new Promise(t=>this.resolveLoadingPromise=t);_status=zt.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"?Bp.prodEcsEndpoint:Bp.integrationEcsEndpoint}client=new US.default;init=async({clientVersion:t,getFilters:r,cacheStorage:n=BS.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:[$S.EcsConfigType.Default],hosts:[this.ecsEndpoint],initialAppActiveState:!0,getEcsParameters:o,databaseInterface:xS(this.clientName,n,this.endpointType),...a}),this.client.requestUpdate(),this._status===zt.NotLoaded&&(this._status=zt.Initialized)}catch(s){this._status=zt.Error,this.resolveLoadingPromise(),this.logEvent("FeaturesClient/initializationFailed",{ecsClientName:this.clientName,error:s},"Error")}i&&window.setInterval(()=>this.client.requestUpdate(),i*c4)};getConfig=t=>{let r=this.getMergedClientConfigByTeamName(t.teamName),n=r?t.extractConfig(r):{};return(0,Up.default)({},t.fallback,n,t.override,MS)};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,qS.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,Up.default)({},this.client.getConfig()?.config,this.clientConfigOverride,MS);getMergedClientConfigByTeamName=t=>this.getMergedClientConfig()?.[t];handleConfigUpdated=()=>{let t=this.client.getConfig();if(t===void 0)return;this.resolveLoadingPromise(),this._status=zt.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})}},MS=(e,t)=>{if(Array.isArray(t))return t}});var GS=v((eK,VS)=>{"use strict";var d4=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};VS.exports=d4});var qp=v((tK,WS)=>{var $o=new Proxy(function(){return $o},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:$o},apply:function(){return $o},construct:function(){return{}}}),zS=function(){return $o};Object.setPrototypeOf(zS,$o);WS.exports=zS});var JS=v((rK,jS)=>{var qo=new Proxy(function(){return qo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:qo},apply:function(){return qo},construct:function(){return{}}}),HS=function(){return qo};Object.setPrototypeOf(HS,qo);jS.exports=HS});var tE=v((nK,eE)=>{"use strict";var Vp=JS(),p4={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},f4={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},m4={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},YS={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Gp={};Gp[Vp.ForwardRef]=m4;Gp[Vp.Memo]=YS;function QS(e){return Vp.isMemo(e)?YS:Gp[e.$$typeof]||p4}var h4=Object.defineProperty,g4=Object.getOwnPropertyNames,KS=Object.getOwnPropertySymbols,v4=Object.getOwnPropertyDescriptor,y4=Object.getPrototypeOf,XS=Object.prototype;function ZS(e,t,r){if(typeof t!="string"){if(XS){var n=y4(t);n&&n!==XS&&ZS(e,n,r)}var i=g4(t);KS&&(i=i.concat(KS(t)));for(var a=QS(e),o=QS(t),s=0;s<i.length;++s){var l=i[s];if(!f4[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var u=v4(t,l);try{h4(e,l,u)}catch{}}}}return e}eE.exports=ZS});function nE(e,t,r){let[n,i]=(0,oa.useState)(e.getConfig(t));return(0,oa.useEffect)(()=>{if(!r?.subscribe&&e.status===zt.ConfigsLoaded)return;let a=e.subscribe(t,o=>{i(o),r?.subscribe||a.unsubscribe()});return a?.unsubscribe},[]),n}function iE(e){return function(t,r){return nE(e,t,r)}}function aE(e,t,r,n){let i=a=>{let o=nE(e,t,n),s={...a,...o};return oa.default.createElement(r,{...s})};return(0,rE.default)(i,r),i.displayName=`WithFeature(${r.name})`,i}function oE(e,t,r,n){return t.reduce((i,a)=>aE(e,a,i,n),r)}function sE(e){return function(t,r,n){return aE(e,t,r,n)}}var rE,oa,zp=I(()=>{"use strict";rE=ne(tE()),oa=ne(qp());Uo();});var uE=v((oK,lE)=>{var b4=Lp(),w4=Mp(),A4=w4(function(e,t,r){b4(e,t,r)});lE.exports=A4});var Vl=v((sK,cE)=>{var C4=ai(),S4=On(),E4="[object Symbol]";function N4(e){return typeof e=="symbol"||S4(e)&&C4(e)==E4}cE.exports=N4});var pE=v((lK,dE)=>{var D4=Pn(),I4=Vl(),_4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,T4=/^\w*$/;function P4(e,t){if(D4(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||I4(e)?!0:T4.test(e)||!_4.test(e)||t!=null&&e in Object(t)}dE.exports=P4});var hE=v((uK,mE)=>{var fE=Fl(),O4="Expected a function";function Wp(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(O4);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(Wp.Cache||fE),r}Wp.Cache=fE;mE.exports=Wp});var vE=v((cK,gE)=>{var R4=hE(),F4=500;function x4(e){var t=R4(e,function(n){return r.size===F4&&r.clear(),n}),r=t.cache;return t}gE.exports=x4});var bE=v((dK,yE)=>{var L4=vE(),k4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,M4=/\\(\\)?/g,B4=L4(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(k4,function(r,n,i,a){t.push(i?a.replace(M4,"$1"):n||r)}),t});yE.exports=B4});var AE=v((pK,wE)=>{function U4(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}wE.exports=U4});var IE=v((fK,DE)=>{var CE=Po(),$4=AE(),q4=Pn(),V4=Vl(),G4=1/0,SE=CE?CE.prototype:void 0,EE=SE?SE.toString:void 0;function NE(e){if(typeof e=="string")return e;if(q4(e))return $4(e,NE)+"";if(V4(e))return EE?EE.call(e):"";var t=e+"";return t=="0"&&1/e==-G4?"-0":t}DE.exports=NE});var TE=v((mK,_E)=>{var z4=IE();function W4(e){return e==null?"":z4(e)}_E.exports=W4});var OE=v((hK,PE)=>{var H4=Pn(),j4=pE(),J4=bE(),Q4=TE();function K4(e,t){return H4(e)?e:j4(e,t)?[e]:J4(Q4(e))}PE.exports=K4});var FE=v((gK,RE)=>{var X4=Vl(),Y4=1/0;function Z4(e){if(typeof e=="string"||X4(e))return e;var t=e+"";return t=="0"&&1/e==-Y4?"-0":t}RE.exports=Z4});var kE=v((vK,LE)=>{var eV=Fp(),tV=OE(),rV=kl(),xE=Xr(),nV=FE();function iV(e,t,r,n){if(!xE(e))return e;t=tV(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=nV(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=xE(c)?c:rV(t[i+1])?[]:{})}eV(s,l,u),s=s[l]}return e}LE.exports=iV});var BE=v((yK,ME)=>{var aV=kE();function oV(e,t,r){return e==null?e:aV(e,t,r)}ME.exports=oV});function VE(e){let{query:t}=(0,qE.default)(window.location.href,!0);return lV(e,t),e}function lV(e,t){let r=sV+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+GE,u={};if(a===r)u=s;else if(a.startsWith(l)){let c=a.substring(l.length);(0,$E.default)(u,c,s)}(0,UE.default)(i,u)}catch{}}),Object.keys(i).length>0&&e.overrideClientConfig(i)}var UE,$E,qE,GE,sV,zE=I(()=>{"use strict";UE=ne(uE()),$E=ne(BE()),qE=ne(Kd());GE=".",sV="ecs"+GE});function zl(e,t,r){let n=VE(new ql(e,t,r));function i(a){(0,Gl.useEffect)(()=>{n.init(a)},[])}return{featuresClient:n,createFeature:cV(n),useFeaturesClientInitParams:i,withFeatures:(a,o,s)=>oE(n,a,o,s)}}function cV(e){let t=iE(e),r=sE(e);return function(i){let a=Vy(i);return a.getConfig=()=>e.getConfig(a),a.isLoaded=()=>e.status===zt.ConfigsLoaded,Zd.register(a,e.clientName),{useFeature:o=>t(a,o),withFeature:(o,s)=>r(a,o,s),feature:a}}}var uV,Gl,Hp=I(()=>{"use strict";uV=ne(GS()),Gl=ne(qp());lp();$p();Uo();zp();zE();ep();});var WE=I(()=>{"use strict";lp();$p();Hp();Uo();zp();El();tp();});function Wl(e){return{logEvent:(t,r,n)=>{switch(n){case"Error":(0,sa.trackErrorTrace)(e,{eventName:t,eventData:r});break;case"Warning":(0,sa.trackWarningTrace)(e,{eventName:t,eventData:r});break;default:(0,sa.trackInfoTrace)(e,{eventName:t,eventData:r});break}}}}var sa,jp=I(()=>{"use strict";sa=ne(Zn());});var BK,UK,$K,HE=I(()=>{"use strict";WE();jp();({featuresClient:BK,createFeature:UK,useFeaturesClientInitParams:$K}=zl("PowerApps-Shell-Test",Wl("shell-features")))});var QE=v((VK,JE)=>{var Vo=new Proxy(function(){return Vo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Vo},apply:function(){return Vo},construct:function(){return{}}}),jE=function(){return Vo};Object.setPrototypeOf(jE,Vo);JE.exports=jE});var dV,pV,KE=I(()=>{"use strict";yo();dV=ne(QE()),pV=ne(Zn());});var XE=I(()=>{"use strict";HE();jp();KE();});var XK,la,YK,YE=I(()=>{"use strict";XE();Hp();({featuresClient:XK,createFeature:la,useFeaturesClientInitParams:YK}=zl("PowerApps-MakerPortal",Wl("powerapps-features")))});var ZE,eN,rX,nX,iX,aX,Jp=I(()=>{"use strict";qy();YE();({feature:ZE}=la({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:Ki.enableAutoInsertionOfCellInRow}})),{feature:eN}=la({teamName:"MakerPortal",owners:["aansu"],description:"Enable the one grid events for form designer",createdOn:"08/21/2024",fallback:{enableOneGridEventsForFormDesigner:Ki.enableOneGridEvents}}),{feature:rX}=la({teamName:"MakerPortal",owners:["adekulkarni"],description:"Disables PBI components and cleans them up from the form",createdOn:"01/03/2023",fallback:{enableFallbackFormTemplate:Ki.disablePBIComponents}}),{feature:nX}=la({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:Ki.enableAgentResponse}}),{feature:iX,useFeature:aX}=la({teamName:"MakerPortal",owners:["aansu"],description:"Enables delayed localization of custom control",createdOn:"06/08/2025",fallback:{enableDelayedLocalizationForCustomControls:Ki.enableDelayedLocalizationForCustomControls}})});var nN=v((sX,rN)=>{var Go=new Proxy(function(){return Go},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Go},apply:function(){return Go},construct:function(){return{}}}),tN=function(){return Go};Object.setPrototypeOf(tN,Go);rN.exports=tN});var nt,Rn=I(()=>{"use strict";xe();Re();rt();Tl();X();ze();nt=class extends H{static HighestUsedIndexByClass=new Map;get colspan(){let t=this.getProperty(m.colspan);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set colspan(t){N.IsNullOrUndefined(t)||this.setProperty(m.colspan,String(t))}constructor(t,r){super(t,r)}get id(){let t=this.getProperty(m.id);return t==null?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new T(t.substr(1,t.length-2)):new T(t)}set id(t){this.setProperty(m.id,`{${t.ToString()}}`)}set labelId(t){this.setProperty(m.labelId,`{${t.ToString()}}`)}get labelId(){let t=this.getProperty(m.labelId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new T(t.substr(1,t.length-2)):new T(t)}get Name(){return this.getProperty(m.Name)}set Name(t){this.setProperty(m.Name,t)}setDisplayName(t,r){for(let i of this.getAllLabels())if(+i.getProperty(m.languagecode)===r){i.setProperty(m.description,t);return}let n=new H(y.formLabel,null);n.setProperty(m.description,t),n.setProperty(m.languagecode,String(r)),this.addGrandChild("labels",n)}getDisplayName(t){for(let r of this.getAllLabels())if(+r.getProperty(m.languagecode)===t)return r.getProperty(m.description)}getAllLabels(){let t=this.getChildren("labels");return t.length!==1?[]:t[0].getChildren("label")}get isLocked(){return+this.getProperty(m.locklevel)==1}set isLocked(t){!this.IsUnboundControl&&this.setProperty(m.locklevel,t?"1":"0")}get availableforphone(){return this.getProcessedValue(m.availableforphone)}set availableforphone(t){N.IsNullOrUndefined(t)||!this.IsAllowedUBCForAvailableOnPhone()||this.setProperty(m.availableforphone,String(t))}get visible(){return this.getProcessedValue(m.visible)}set visible(t){N.IsNullOrUndefined(t)||!this.IsAllowedUBCForVisibleByDefault()||this.setProperty(m.visible,String(t))}isLockLevelSettable(){return!this.IsUnboundControl}get showlabel(){return this.getProcessedValue(m.showlabel)}set showlabel(t){N.IsNullOrUndefined(t)||this.setProperty(m.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(y.formControl);return t?t.disabled:!1}set readonly(t){let r=this.getFirstChild(y.formControl);r&&(r.disabled=t)}get allowfilteroff(){let t=this.getFirstChild(y.formControl);if(t)return t.getParam(m.AllowFilterOff)==="true"}set allowfilteroff(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.AllowFilterOff,t)}get autoresolve(){let t=this.getFirstChild(y.formControl);if(t)return t.getParam(m.AutoResolve)==="true"}set autoresolve(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.AutoResolve,t)}get defaultviewid(){let t=this.getFirstChild(y.formControl);return t?t.getParam(m.DefaultViewId):P.EmptyString}set defaultviewid(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DefaultViewId,t)}get dependentattributename(){let t=this.getFirstChild(y.formControl);return t?t.getParam(m.DependentAttributeName):P.EmptyString}set dependentattributename(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DependentAttributeName,t)}get dependentattributetype(){let t=this.getFirstChild(y.formControl);return t?t.getParam(m.DependentAttributeType):P.EmptyString}set dependentattributetype(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DependentAttributeType,t)}get disablequickfind(){let t=this.getFirstChild(y.formControl);if(t)return t.getParam(m.DisableQuickFind)==="true"}set disablequickfind(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DisableQuickFind,t)}get disableviewpicker(){let t=this.getFirstChild(y.formControl);if(t)return t.getParam(m.DisableViewPicker)==="true"}set disableviewpicker(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DisableViewPicker,t)}get filterrelationshipname(){let t=this.getFirstChild(y.formControl);return t?t.getParam(m.FilterRelationshipName):P.EmptyString}set filterrelationshipname(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.FilterRelationshipName,t)}get availableviewids(){let t=this.getFirstChild(y.formControl);return t?t.getParam(m.AvailableViewIds):P.EmptyString}set availableviewids(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.AvailableViewIds,t)}get IsUnboundControl(){let t=this.getFirstChild(y.formControl);if(t&&t.ClassId){let r=ke.getUniqueIdentifierForControl(t);return!N.IsNullOrUndefined(r)&&ke.isUnboundFormControlByIdentifier(r)}else return!1}IsAllowedUBCForAvailableOnPhone(){let t=this.getFirstChild(y.formControl);if(t){let n=ke.getUniqueIdentifierForControl(t).guidString,i=n===R.GridControl||n===R.TimeLineControl||n===R.TimeLineControlUC;return this.IsUnboundControl?i:!0}return this.NodeName===y.formSection||this.NodeName===y.formTab}IsAllowedUBCForVisibleByDefault(){let t=this.getFirstChild(y.formControl);if(t){let n=ke.getUniqueIdentifierForControl(t).guidString,i=n===R.MapsControl||n===R.WebResourceHtmlControl||n===R.WebResourceImageControl||n===R.IframeControl||n===R.SocialInsightControl;return this.IsUnboundControl?i:!0}else return!0}get events(){let t=this.getChildren(y.formEvents);return t.length===1?t[0].getAllChildren():[]}addEvent(t){this.addGrandChild(y.formEvents,t)}getUsedNodeNameSet(t){return null}getHighestIndexById(t,r){return null}}});var ua,Qp=I(()=>{"use strict";rt();X();ze();ua=class extends H{constructor(t,r){super(y.dependency,t),P.IsNullOrEmpty(r)||this.setDefaultProperties(r)}set id(t){this.setProperty(m.id,t)}get id(){return this.getProperty(m.id)}setDefaultProperties(t){this.id=t}}});var iN,ca,Kp=I(()=>{"use strict";Re();Qp();X();ze();Rn();(function(e){e[e.Form=0]="Form",e[e.Cell=1]="Cell",e[e.Tab=2]="Tab",e[e.Control=3]="Control"})(iN||(iN={}));ca=class extends nt{constructor(t,r){super(y.formEvent,t),r&&(this.eventName=r,this.application="false",this.active="false")}set eventName(t){this.setProperty(m.Name,t)}get eventName(){return this.getProperty(m.Name)}set application(t){this.setProperty(m.application,t)}get application(){return this.getProperty(m.application)}set attribute(t){this.setProperty(m.EventAttribute,t)}get attribute(){return this.getProperty(m.EventAttribute)}set relationship(t){this.setProperty(m.Relationship,t)}get relationship(){return this.getProperty(m.Relationship)}set control(t){this.setProperty(m.Control,t)}get control(){return this.getProperty(m.Control)}set active(t){this.setProperty(m.EventActive,t)}get active(){return this.getProperty(m.EventActive)}getAllHandlers(){let t=this.getChildren(y.EventHandlers);return t&&t.length?t[0].getChildren(y.handler):[]}getAllDependencies(){let t=this.getChildren(y.formDependencies);return t.length===0?[]:t[0].getAllChildren()}setDependencies(t){let r=this.getFirstChild(y.formDependencies);if(N.IsNullOrUndefined(r)){if(t.length===0)return;this.addChild(new H(y.formDependencies,this)),r=this.getFirstChild(y.formDependencies)}if(t.length===0)r.getParentNode().deleteChild(r);else{r.deleteAllChildren();for(let n of t)r.addChild(new ua(r,n.toString()))}}}});var sr,zo=I(()=>{"use strict";xe();vo();Re();Yn();X();ze();ir();sr=class extends H{previewVersion;constructor(t){super(y.formControl,t)}updatePreview(){this.previewVersion=Date.now()}get ClassId(){let t=this.getProperty(m.classid);return t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new T(t)}set ClassId(t){this.setProperty(m.classid,`{${t.ToString()}}`)}get dataFieldName(){return this.getProperty(m.datafieldname)}set dataFieldName(t){this.setProperty(m.datafieldname,t)}set id(t){this.setProperty(m.id,t)}get id(){return this.getProperty(m.id)}get UniqueId(){let t=this.getProperty(m.uniqueid);return N.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new T(t))}set UniqueId(t){this.setProperty(m.uniqueid,`{${t.ToString()}}`)}get isRequired(){return this.getProperty(m.isRequired)==="true"}set isRequired(t){N.IsNullOrUndefined(t)||this.setProperty(m.isRequired,String(t))}get disableMru(){return this.getParam(m.DisableMru)==="true"}set disableMru(t){N.IsNullOrUndefined(t)||this.setParameter(m.DisableMru,t)}get useMFDForCreate(){return this.getParam(m.UseMFDForCreate)==="true"}set useMFDForCreate(t){N.IsNullOrUndefined(t)||this.setParameter(m.UseMFDForCreate,t)}get useMFDForEdit(){return this.getParam(m.UseMFDForEdit)==="true"}set useMFDForEdit(t){N.IsNullOrUndefined(t)||this.setParameter(m.UseMFDForEdit,t)}get disabled(){return this.getProperty(m.disabled)==="true"}set disabled(t){N.IsNullOrUndefined(t)||this.setProperty(m.disabled,String(t))}get indicationOfSubgrid(){return this.getProperty(m.indicationOfSubgrid)==="true"}set indicationOfSubgrid(t){this.setProperty(m.indicationOfSubgrid,String(t))}getAllParameters(){let t=new pt,r=this.getFirstChild(m.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=(Kr.StartTag+r).toString(),a=this.parametersNode;if(a){let o=a.findFirst(s=>s&&s.getNodeName()===t);if(o)if(n){this.deleteFirstGrandChildOfName(y.controlParameters,o);return}else{let s=o.getAllChildren();s&&s.length>0&&s[0]?s[0].setNodeName(i):o.addChild(new H(i,o))}else n||(o=new H(t,a),o.addChild(new H(i,o)),a.addChild(o))}else if(!n){a=new H("parameters",this);let o=new H(t,a);o.addChild(new H(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)===Kr.StartTag?a.substring(1):a}}}return null}get parametersNode(){let t=this.getChildren(m.parameters);return t.length===0?null:t[0]}async serializeParameters(t,r){let n=new pt;switch(this.ClassId.guidString.toUpperCase()){case E.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(m.isUnbound)==="true"}getAttributeTypeFromClassId(t){if(t)switch(t.toUpperCase()){case E.BooleanControl:case E.CheckboxControl:return 0;case E.DateTimeControl:return 2;case E.DecimalControl:return 3;case E.FloatingNumberControl:return 4;case E.IntegerControl:case E.DurationControl:case E.LanguageControl:case E.TimezoneControl:return 5;case E.LookupControl:return 6;case E.CurrencyControl:return 8;case E.PartyListControl:return 10;case E.ChoiceControl:case E.RelationshipRoleChoiceControl:return 11;case E.ChoiceStatusControl:return 13;case E.TextAreaControl:case E.TextboxControl:case E.LabelControl:case E.EmailAddressControl:case E.UrlControl:case E.TickerControl:case E.ButtonControl:case E.PhoneNumberControl:return 14;case E.ChoicesControl:return 24;default:return}return 14}async toJSON(t){let r=this.getParent(),n=t&&t.formModelService&&t.formModelService.getFormType()===Le.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 da,Xp=I(()=>{"use strict";rt();zi();zo();X();ze();da=class extends sr{constructor(t){super(t)}get targetEntityType(){return this.getParam(m.targetEntityType)||P.EmptyString}set targetEntityType(t){this.setParameter(m.targetEntityType,t)}get viewId(){return P.StripBraces(this.getParam(m.viewId))||P.EmptyString}set viewId(t){this.setParameter(m.viewId,P.AddBraces(t))}get viewIds(){return this.getParam(m.viewIds)||P.EmptyString}set viewIds(t){this.setParameter(m.viewIds,t)}get relationshipName(){return this.getParam(m.RelationshipName)||P.EmptyString}set relationshipName(t){this.setParameter(m.RelationshipName,t)}get isUserView(){return P.IsStrictTrue(this.getParam(m.isUserView))}set isUserView(t){this.setParameter(m.isUserView,t.toString())}get enableViewPicker(){return P.IsStrictTrue(this.getParam(m.enableViewPicker))}set enableViewPicker(t){this.setParameter(m.enableViewPicker,t)}get autoExpand(){return this.getParent().autoexpand&&this.getParam(m.autoExpand)===m.Auto}set autoExpand(t){let r=this.getParent();this.setParameter(m.autoExpand,t?m.Auto:m.Fixed),r.autoexpand=t}get recordsPerPage(){return this.getParam(m.recordsPerPage)?Number(this.getParam(m.recordsPerPage)):Number(m.RecordsPerPageRAControlDefault)}set recordsPerPage(t){this.setParameter(m.recordsPerPage,String(t))}get enableQuickFind(){return P.IsStrictTrue(this.getParam(m.enableQuickFind))}set enableQuickFind(t){this.setParameter(m.enableQuickFind,t)}get teamTemplateId(){return P.StripBraces(this.getParam(m.teamTemplateId))||P.EmptyString}set teamTemplateId(t){this.setParameter(m.teamTemplateId,P.AddBraces(t))}get chartId(){return this.getParam(m.visualizationId)||P.EmptyString}set chartId(t){this.setParameter(m.visualizationId,t)}get enableChartPicker(){return P.IsStrictTrue(this.getParam(m.enableChartPicker))}set enableChartPicker(t){this.setParameter(m.enableChartPicker,t)}get chartGridMode(){switch(this.getParam(m.chartGridMode)){case Gt.Chart:return Gt.Chart;case Gt.Grid:return Gt.Grid;default:return Gt.All}}set chartGridMode(t){this.setParameter(m.chartGridMode,t)}updateChartGridMode(t){t?this.chartGridMode=Gt.Chart:this.chartGridMode=this.enableChartPicker?Gt.All:Gt.Grid}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case m.targetEntityType:n.getAllChildren()[0].setNodeName("<"+r.targetEntityType);break;case m.viewId:n.getAllChildren()[0].setNodeName("<"+P.AddBraces(r.viewId));break;case m.isUserView:n.getAllChildren()[0].setNodeName("<"+r.isUserView);break;case m.enableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.enableViewPicker);break;case m.RelationshipName:let i=n.getAllChildren(),a="<"+r.relationshipName;i.length?n.getAllChildren()[0].setNodeName(a):n.addChild(new H(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(ft.dataset)?n[i].getParameters().get(ft.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 pa,Yp=I(()=>{"use strict";rt();zi();zo();X();pa=class extends sr{constructor(t){super(t)}get defaultViewId(){return P.StripBraces(this.getParam(m.DefaultViewId))||P.EmptyString}set defaultViewId(t){this.setParameter(m.DefaultViewId,P.AddBraces(t))}get autoResolve(){return P.IsStrictTrue(this.getParam(m.AutoResolve))}set autoResolve(t){this.setParameter(m.AutoResolve,t)}get disableQuickFind(){return P.IsStrictTrue(this.getParam(m.DisableQuickFind))}set disableQuickFind(t){this.setParameter(m.DisableQuickFind,t)}get disableViewPicker(){return P.IsStrictTrue(this.getParam(m.DisableViewPicker))}set disableViewPicker(t){this.setParameter(m.DisableViewPicker,t)}get allowFilterOff(){return P.IsStrictTrue(this.getParam(m.AllowFilterOff))}set allowFilterOff(t){this.setParameter(m.AllowFilterOff,t)}get disableMru(){return P.IsStrictTrue(this.getParam(m.DisableMru))}set disableMru(t){this.setParameter(m.DisableMru,t)}get dependentAttributeName(){return this.getParam(m.DependentAttributeName)||P.EmptyString}set dependentAttributeName(t){this.setParameter(m.DependentAttributeName,t)}get dependentAttributeType(){return this.getParam(m.DependentAttributeType)||P.EmptyString}set dependentAttributeType(t){this.setParameter(m.DependentAttributeType,t)}get filterRelationshipName(){return this.getParam(m.FilterRelationshipName)||P.EmptyString}set filterRelationshipName(t){this.setParameter(m.FilterRelationshipName,t)}get availableViewIds(){return this.getParam(m.AvailableViewIds)||P.EmptyString}set availableViewIds(t){this.setParameter(m.AvailableViewIds,t)}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case m.datafieldname:case m.bindAttribute:n.getAllChildren()[0].setNodeName("<"+r.dataFieldName);break;case m.DefaultViewId:n.getAllChildren()[0].setNodeName("<"+P.AddBraces(r.defaultViewId));break;case m.AllowFilterOff:n.getAllChildren()[0].setNodeName("<"+r.allowFilterOff);break;case m.DisableQuickFind:n.getAllChildren()[0].setNodeName("<"+r.disableQuickFind);break;case m.DisableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.disableViewPicker);break;case m.FilterRelationshipName:n.getAllChildren()[0].setNodeName("<"+r.filterRelationshipName);break;case m.DependentAttributeName:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeName);break;case m.DependentAttributeType:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeType);break;case m.AvailableViewIds:n.getAllChildren()[0].setNodeName("<"+r.availableViewIds);break;case m.DisableMru:n.getAllChildren()[0].setNodeName("<"+r.disableMru);break;case m.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(ft.value)?n[i].getParameters().get(ft.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 aN,Zp,Nt,Wo=I(()=>{"use strict";aN=ne(nN());Rn();X();Re();xe();Kp();zo();Tl();op();Bd();ir();Yn();qi();Xp();Yp();ef();So();Zp="_",Nt=class e extends nt{fieldPlaceholder;fieldRequiredLevel;isNewField;cellColType;dependentFields=[];constructor(t){super(y.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(m.id))&&(this.id=new T(T.NewGuid()))}addControl(t,r,n,i,a,o,s){n instanceof sr?this.addChild(n):n instanceof T&&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:!ei.dependencyFieldCount.containsKey(this.control.id):!ei.dependencyFieldCount.containsKey(this.control.dataFieldName)}createOnLoadEvent(){this.addEvent(new ca(this,ho.onLoad))}get dependencies(){let t=this.getChildren(y.formEvents);for(let r of t){let n=r.getChildren(y.formEvent);for(let i of n)this.buildDependencyList(i,this.dependentFields)}return this.dependentFields}getNextAvailableControlName(t,r,n,i){let a;if(i&&hl[i])a=hl[i].replace(/ /g,Zp)+Zp;else{a="Control_";let u=new Error("Control class id does not exist or is undefined");(0,aN.trackErrorTrace)(dt,{eventName:`${Zv}/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,m.isUnbound,"true"),e.prototype.setProperty.call(t,m.isRequired,"false")}getControlWithControlSpecificProperties(t,r,n,i,a,o,s){let l;a===Wt.Grid?(l=new da(this),l.indicationOfSubgrid=!0):a===Wt.Lookup?l=new pa(this):l=new sr(this);let u=n.guidString,c=o||this.getNextAvailableControlName(t,i,this.getUsedNodeNameSet(t),u);if(e.prototype.setProperty.call(l,m.id,c),l.ClassId=n,!N.IsNullOrUndefined(s)&&(l.UniqueId=s),!o&&r)this.getUnboundControlProperties(l);else{let d=ke.getUniqueIdentifierForControl(l);N.IsNullOrUndefined(d)||(ke.getControlDataTypeByControlOrUniqueId(d)===V.QuickFormCollectionControl||!ke.isUnboundFormControlByIdentifier(d)?a!==Wt.Grid&&o&&u!==E.IframeControl&&u!==E.SubgridControl&&u!==E.ReferencePanelSubgridControl&&(l.dataFieldName=o,e.prototype.setProperty.call(l,m.disabled,"false")):(this.rowspan=ke.GetRowSpan(l),(ke.getControlDataTypeByControlOrUniqueId(d)===V.NotesControl||ke.getControlDataTypeByControlOrUniqueId(d)===V.TimeLineControl)&&(e.prototype.setProperty.call(l,m.disabled,"false"),l.id=V.NotesControl)),(ke.getUnboundControlNameFromIdentifier(n)===V.SubGridControl||ke.getUnboundControlNameFromIdentifier(n)===V.NotesControl||ke.getUnboundControlNameFromIdentifier(n)===V.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(m.id);o.getNodeName()===y.dependency&&s?r.push(s):this.buildDependencyList(o,r)}}}get control(){return this.getFirstChild(y.formControl)}set rowspan(t){this.setProperty(m.rowspan,String(t))}get rowspan(){let t=this.getProperty(m.rowspan);return N.IsNullOrUndefined(t)?1:parseInt(t,10)}set autoexpand(t){this.setProperty(m.auto,String(t))}get autoexpand(){return this.getProperty(m.auto)==="true"}set colspan(t){let r=Number(ip.ONE_COLUMN),n=Number(ip.FOUR_COLUMN);N.IsNullOrUndefined(t)||t>n||t<r||this.setProperty(m.colspan,String(t))}get colspan(){let t=this.getProperty(m.colspan);return N.IsNullOrUndefined(t)?1:parseInt(t,10)}getParentRow(){return this.getAncestor(y.formRow)}getParentSection(){return this.getAncestor(y.formSection)}getParentTab(){return this.getAncestor(y.formTab)}getParentForm(){return this.getAncestor(y.form)}isInHeader(){let t=this.getAncestor(y.formHeader);return!N.IsNullOrUndefined(t)}isInFooter(){let t=this.getAncestor(y.formFooter);return!N.IsNullOrUndefined(t)}isEmpty(){return N.IsNullOrUndefined(this.control)&&!this.IsUserSpacer}getHeaderFooter(){return this.isInHeader()?this.getAncestor(y.formHeader):this.isInFooter()?this.getAncestor(y.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(m.userspacer);return N.IsNullOrUndefined(t)?!1:t==="true"}SetUserSpacer(){this.setProperty(m.userspacer,"true")}ClearUserSpacer(){this.setProperty(m.userspacer,"false")}get columns(){let t=this.getProperty(m.columnName);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}getColumnLayoutValue(t){let r;switch(t){case Se.TWO_COLUMN:r="11";break;case Se.THREE_COLUMN:r="111";break;case Se.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===ri.ApplicationRequired||o===ri.SystemRequired)&&!a||this.isCellLockedByExternal(t)&&!a)return!0}}return!1}getRequiredLevel(t){return!this.control?.dataFieldName||!this.control?.id||this.IsNewField||!this.control?.ClassId?ri.None:t.getEntityAttributeByName(this.control.dataFieldName)?.requiredLevel?.toString()??ri.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()===y.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()===y.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)===Zp&&(r++,n=parseInt(t.substr(r,t.length-r),10)),n}}});var fa,tf=I(()=>{"use strict";rt();X();ze();fa=class extends H{isInternal;constructor(t,r,n,i){super(y.library,t),this.isInternal=!!i,P.IsNullOrEmpty(n)||(this.name=r,this.libraryUniqueId=n)}get libraryUniqueId(){let t=this.getProperty(m.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(m.libraryUniqueId,t)}get name(){return this.getProperty(m.libraryName)}set name(t){this.setProperty(m.libraryName,t)}get displayName(){return this.getProperty(m.displayName)}set displayName(t){this.setProperty(m.displayName,t)}get description(){return this.getProperty(m.description)}set description(t){this.setProperty(m.description,t)}}});var si,rf=I(()=>{"use strict";Re();Wo();X();ze();si=class extends H{isRowAddedOnDragOver;constructor(t){super(y.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(y.formSection)}insertPaddingCellAtIndex(t){let r=new Nt(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(y.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 fV(e){switch(e){case ni.Left:return ii.Left;case ni.Right:return ii.Right;case ni.Center:return ii.Center;default:return ii.Left}}function mV(e){switch(e){case ji.Left:return Qi.Left;case ji.Top:return Qi.Top;default:return Qi.Left}}function oN(e){switch(e){case 1:return 1;case 2:return 11;case 3:return 111;case 4:return 1111;default:return 1}}var hV,Ir,Ho=I(()=>{"use strict";sp();xe();Re();rt();Jp();Wo();X();ir();Rn();rf();hV=115,Ir=class e extends nt{colSpan=1;constructor(t,r){super(t,r)}getSectionType(){let t;switch(this.columns){case 1:t=Se.ONE_COLUMN;break;case 11:t=Se.TWO_COLUMN;break;case 111:t=Se.THREE_COLUMN;break;case 1111:t=Se.FOUR_COLUMN;break;default:t=this.colSpan-1}return t}setUniqueName(){let t=this.getParentTab(),r=we.namePrefix;if(t){let n=t.Name,i=t.TotalSectionsCount+1;r=n+we.namePrefix+i.toString()}else r+=Math.floor(Math.random()*1e3);this.setProperty(m.Name,r)}initializeDefaultProperties(t,r,n){if(n===Se.REFERENCE_PANEL){this.addProperty(m.rowheight,"25");let i=`${we.referencePanelNamePrefix}${T.NewGuid()}${we.namePrefix}`;this.addProperty(m.Name,i)}else this.setUniqueName();if(this.addProperty(m.id,new T(T.NewGuid()).guidString),this.addProperty(m.IsUserDefined,we.IsUserDefined),this.addProperty(m.locklevel,we.LockLevel),this.addProperty(m.showlabel,we.ShowLabel),this.addProperty(m.showbar,we.ShowBar),this.addProperty(m.layout,we.Layout),this.addProperty(m.Fieldlabelalignment,we.labelAlignment),this.addProperty(m.Fieldlabelposition,we.labelPosition),N.IsNullOrUndefined(n))this.addProperty(m.columnName,we.columns);else{let i=this.getColumnLayoutValue(n);this.addProperty(m.columnName,i)}this.addProperty(m.LabelWidth,we.LabelWidth),this.setDisplayName(r,t)}getColumnLayoutValue(t){let r;switch(t){case Se.TWO_COLUMN:r="11";break;case Se.THREE_COLUMN:r="111";break;case Se.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(P.EmptyString).forEach(r=>{t+=parseInt(r,10)}),t}get ColSpan(){return this.colSpan}initializeRow(t){if(t>0&&t<5){let r=new si(null);if(this.addGrandChild(y.formRows,r),ZE.getConfig().enableAutoInsertionOfCellInRow)for(let n=0;n<t;n++){let i=new Nt(r);i.setDefaultProperties(!1),r.addCell(i)}}}initialize(t,r,n){this.initializeDefaultProperties(t,r,n),n===Se.REFERENCE_PANEL&&(n=Se.ONE_COLUMN),this.initializeRow(n+1)}setColSpan(t){this.colSpan=t}appendRow(t){this.addGrandChild(y.formRows,t)}insertRowAtIndex(t,r){this.addGrandChildAtIndex(y.formRows,t,r)}insertRowsAtIndex(t,r){if(t&&t.length>0)for(let n=0;n<t.length;n++)this.addGrandChildAtIndex(y.formRows,t[n],r+n)}indexOfRow(t){return this.rows.indexOf(t)}deleteRow(t){return this.deleteFirstGrandChildOfName(y.formRows,t)}deleteRows(t,r){this.deleteGrandChildren(y.formRows,t,r)}get rows(){return this.getRows()}getRows(){let t=this.getChildren(y.formRows);return t.length===0?[]:t[0].getChildren(y.formRow)}get columns(){let t=this.getProperty(m.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 oN(n)}return r}set columns(t){N.IsNullOrUndefined(t)||this.setProperty(m.columnName,String(t))}get rowHeight(){let t=this.getProperty(m.rowheight);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set rowHeight(t){this.setProperty(m.rowheight,String(t))}set autoexpand(t){this.setProperty(m.autoExpand.toLowerCase(),String(t))}get autoexpand(){return this.getProperty(m.autoExpand.toLowerCase())==="true"}get isUserDefined(){return+this.getProperty(m.IsUserDefined)!=0}set isUserDefined(t){t?this.setProperty(m.IsUserDefined,"1"):this.setProperty(m.IsUserDefined,"0")}getParentColumn(){return this.getAncestor(y.formColumn)}getParentTab(){return this.getAncestor(y.formTab)}get hasMultiColumnRow(){return this.getColumnCountValue()>1}get showlabel(){return this.getProperty(m.showlabel)==="true"}set showlabel(t){N.IsNullOrUndefined(t)||this.setProperty(m.showlabel,String(t))}get fieldLabelAlignment(){let t=we.labelAlignment,r=this.getProperty(m.Fieldlabelalignment);return N.IsNullOrUndefined(r)?t:r}set fieldLabelAlignment(t){N.IsNullOrUndefined(t)||this.setProperty(m.Fieldlabelalignment,t)}get fieldLabelPosition(){let t=this.getProperty(m.Fieldlabelposition);return N.IsNullOrUndefined(t)?we.labelPosition:t}set fieldLabelPosition(t){N.IsNullOrUndefined(t)||this.setProperty(m.Fieldlabelposition,String(t))}get showbar(){return this.getProperty(m.showbar)==="true"}set showbar(t){N.IsNullOrUndefined(t)||this.setProperty(m.showbar,String(t))}get labelwidth(){let t=+this.getProperty(m.LabelWidth);return t===0?hV:t}set labelwidth(t){N.IsNullOrUndefined(t)||t>283&&t<57||this.setProperty(m.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:fV(this.fieldLabelAlignment),Position:mV(this.fieldLabelPosition)},Columns:oN(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()===y.formSection){let i=n;i.Name&&!P.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(we.referencePanelNamePrefix)===0}getAllMultiRowCells(){return this.findAll(t=>{if(t.getNodeName()===y.formCell){let r=t;return!r.isEmpty()&&r.rowspan>1}return!1})}isHeaderOrFooterSection(){return this.NodeName===y.formFooter||this.NodeName===y.formHeader}}});var Fn,Hl=I(()=>{"use strict";X();ze();Ho();Fn=class e extends H{constructor(t){super(y.formColumn,t)}initializeDefaultProperties(t){this.addProperty(m.width,t.toString()+"%")}insertSectionAtIndex(t,r){this.addGrandChildAtIndex(y.formSections,t,r)}static createAndInitNewSection(t,r,n){let i=new Ir(y.formSection,null);return i.initialize(t,r,n),i}addSectionAtIndex(t,r){this.addGrandChildAtIndex(y.formSections,t,r)}initialize(t,r,n,i=Se.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(y.formTab)}get sections(){let t=this.getChildren("sections");return t.length!==1?[]:t[0].getChildren(y.formSection)}get width(){return this.getProperty(m.width)}set width(t){this.setProperty(m.width,t)}deleteSection(t){return this.deleteFirstGrandChildOfName(y.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(m.Name),Id:this.getProperty(m.id),Label:null,ShowLabel:!1,Visible:!0,LabelId:null,PreviewId:this.getProperty(m.id),Sections:await this.getSectionsJSON(t),Width:this.width}}}});var jl,sN=I(()=>{"use strict";xe();X();ir();Ho();jl=class extends Ir{initializeNavArea(t,r,n){this.initializeNavAreaProps(t,r,n)}get AreaName(){return this.Name}initializeNavAreaProps(t,r,n){this.addProperty(m.Name,n),this.addProperty(m.id,new T(T.NewGuid()).guidString),this.addProperty(m.columnName,we.columns),this.setDisplayName(r,t)}}});var Jl,lN=I(()=>{"use strict";Hl();X();sN();Jl=class extends Fn{addAndIntializeNavBarSection(t,r,n,i){let a=new jl(y.formSection,null);return a.initializeNavArea(t,r,i),this.addGrandChildAtIndex(y.formSections,a,n),a}}});var Yr,Ql=I(()=>{"use strict";xe();Re();rt();Hl();X();ze();Rn();Yr=class extends nt{tabContainsAutoExpandControl;autoExpandCell;constructor(t,r){super(y.formTab,t),this.tabContainsAutoExpandControl=!1}getParentForm(){return this.getAncestor(y.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(m.Name,Dn.namePrefix+t.toString()),this.addProperty(m.id,new T(T.NewGuid()).guidString),this.addProperty(m.IsUserDefined,Dn.IsUserDefined),this.addProperty(m.locklevel,Dn.LockLevel),this.addProperty(m.showlabel,Dn.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=Se.ONE_COLUMN,a=!0,o){let s=this.getChildren(y.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 Fn(s);c.initialize(u,r,n,i),this.addGrandChild(y.formColumns,c)}}initialize(t,r,n,i,a,o=Se.ONE_COLUMN,s=!0,l){this.addChild(new H(y.formColumns,this)),this.initializeProperties(r,n,i),this.initializeColumns(t,n,a,o,s,l)}get columns(){let t=this.getChildren(y.formColumns);return t.length!==1?[]:t[0].getChildren(y.formColumn)}get expanded(){return this.getProcessedValue(m.expanded)}set expanded(t){N.IsNullOrUndefined(t)||this.setProperty(m.expanded,String(t))}get groupName(){return this.getProperty(m.groupName)}get contentType(){return this.getProperty(m.contentType)}set contentType(t){this.setProperty(m.contentType,t)}insertNewColumnAtIndex(t,r,n,i,a){t.initialize(n,i,a),this.addGrandChildAtIndex(y.formColumns,t,r)}insertColumnAtIndex(t,r){this.addGrandChildAtIndex(y.formColumns,t,r)}deleteColumn(t){return this.deleteFirstGrandChildOfName(y.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()===y.formTab){let i=n;i.Name&&!P.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}}});var li,nf=I(()=>{"use strict";xe();X();ze();ir();lN();Ql();li=class extends Yr{constructor(t,r,n){super(t,Ce.THREE_COLUMN_EQUAL),this.setDisplayName(r,n),this.id=new T(T.NewGuid())}initializeDefaultProps(){this.addChild(new H(y.formColumns,this)),this.initializeFiveColumns()}get columns(){let t=this.getChildren("columns");return t.length!==1?[]:t[0].getChildren(y.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<Il.FIVE_COLUMN;t++){let r=new Jl(this.getChildren(y.formColumns)[0]);r.initializeDefaultProperties(Ty.FiveEqColumn),this.addGrandChild(y.formColumns,r)}}}});function vV(e){switch(e){case Le.Main:return _n.Main;case Le.QuickCreate:return _n.QuickCreate;case Le.QuickViewForm:return _n.Quick;case Le.Dialog:return _n.Dialog;default:return _n.None}}function yV(e,t){if(t===Le.Main){if(e)switch(e.toLowerCase()){case"low":return Nn.Low;case"highreadonlyvalues":return Nn.HighReadOnlyValues;default:return Nn.HighWithControls}return Nn.Low}}var Xl,gV,Kl,uN=I(()=>{"use strict";ky();Xl=ne(Zn());sp();Re();rt();qi();Jp();X();zi();Nd();Yn();Wo();X();Rn();tf();nf();Ql();gV="1920";Kl=class e extends nt{_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(y.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 dl,this._metadataChangeEvent=new Pl}get FormLibraries(){let t=this.getFirstChild(y.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 Nt).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 Nt){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()===y.internalLibraries),r=[],n="src";return t.length>0&&(r=t.map(i=>{let a=i.GetPropertyByParameter(n).replace("$webresource:",""),o=new fa(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,Xl.trackErrorTrace)(ey,{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(m.ShowImage))?!0:this.getProperty(m.ShowImage)!=="false"}set ShowImagecheck(t){t?this.setProperty(m.ShowImage,String(t)):this.setProperty(m.ShowImage,"false")}get ShowNavigation(){return P.IsNullOrEmpty(this.getProperty(m.ShowNavigationbar))?!0:this.getProperty(m.ShowNavigationbar)!=="false"}set ShowNavigation(t){t?this.setProperty(m.ShowNavigationbar,String(t)):this.setProperty(m.ShowNavigationbar,"false")}get MaxWidth(){return P.IsNullOrEmpty(this.getProperty(m.MaxWidth))?gV:this.getProperty(m.MaxWidth)}set MaxWidth(t){this.setProperty(m.MaxWidth,t)}get headerDensityType(){return this.getProperty(m.HeaderDensityType)}set headerDensityType(t){t&&this.formType===Le.Main?this.setProperty(m.HeaderDensityType,t):this.formType!==Le.Main&&this.headerDensityType&&this.removeProperty(m.HeaderDensityType)}IsMainOrQuickCreateForm(){return this.formType===Le.Main||this.formType===Le.QuickCreate}get FormPresentation(){return this._formPresentation}get LanguageCode(){return this._langCode}set LanguageCode(t){this._langCode=t}get header(){let t=this.getChildren(y.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(y.quickFormDependencies).length===0?[]:this.ConvertModelToArray(this.getChildren(y.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(y.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 Yr(null,t),a=this.getNextTabCounter(this.tabs.length+1);return i.initialize(t,a,this.LanguageCode,r,n),i}addTabAtIndex(t,r){this.addGrandChildAtIndex(y.formTabs,t,r)}createAndInitNewTabWithMarginalControl(t,r,n,i,a){let o=new Yr(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(y.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===Dn.namePrefix+t.toString())return this.getNextTabCounter(t+1);return t}get allTabs(){let t=this.getChildren(y.formTabs);return t.length!==1?[]:t[0].getChildren(y.formTab)}get CanvasNavigationTab(){if(this.tabs.length>0){let t=this.tabs[this.tabs.length-1];if(t instanceof li)return t}return null}get NavigationNode(){let t=this.getChildren(y.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(y.formTabs,t)}insertTabAtIndex(t,r){this.addGrandChildAtIndex(y.formTabs,t,r)}insertRelatedTab(t){let r=this.getAllGrandChildren(y.formTabs);if(!N.IsNullOrUndefined(r)){let n=r.length;this.insertTabAtIndex(t,n)}}get isfooterPresent(){return this.getChildren(y.formFooter).length>0}get displayCondition(){let t=this.getChildren(y.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(y.formTabs).indexOf(t)}get ControlDescriptions(){return this.getAllGrandChildren(y.controlDescriptions)}addControlDescriptionNode(t){this.addGrandChild(y.controlDescriptions,t)}deleteControlDescByForControlId(t){let r=this.getControlDescriptionByForControl(t);N.IsNullOrUndefined(r)||this.deleteFirstGrandChildOfName(y.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 Nt))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 Nt&&i.control&&t.control&&a&&i.control.dataFieldName===t.control.dataFieldName})}isCellEditableGridControl(t){return!t?.control?.indicationOfSubgrid||t.control.ClassId.guidString.toUpperCase()!==E.CustomControl?!1:this.cellHasCustomControlWithName(t,In.EditableGridControl)||eN.getConfig()?.enableOneGridEventsForFormDesigner&&this.cellHasCustomControlWithName(t,In.PowerAppsOneGrid)}isCellCanvasAppControl(t){return t?.control?.ClassId.guidString.toUpperCase()===E.CustomControl&&this.cellHasCustomControlWithName(t,In.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()===y.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 li)){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,Xl.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===Le.Main?{HeaderDensity:yV(this.headerDensityType,this.formType)}:{},InlineEditGridRow:[],InlineQuickForms:[],QuickFormEntities:[],EventHandlers:[],LinkControlSections:[],FormType:vV(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 Yl,af,cN=I(()=>{"use strict";xe();Re();X();ze();Rn();Yl=class extends nt{constructor(t){super(y.formDisplayConditions,t)}get Order(){let t=this.getProperty(m.Order);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set Order(t){this.setProperty(m.Order,t.toString())}get FallbackForm(){return this.getProperty(m.FallbackForm)==="true"}set FallbackForm(t){this.setProperty(m.FallbackForm,t.toString())}addRoles(t){this.deleteAllChildren();for(let r=0;r<t.length;r++)this.addChild(t[r])}isRoleEveryone(){return!!(this.getChildren(y.formEveryOne)&&this.getChildren(y.formEveryOne)[0])}setRoleEveryone(){this.deleteAllChildren(),this.addChild(new af(this))}},af=class extends H{constructor(t){super(y.formEveryOne,t)}}});var Zl,dN=I(()=>{"use strict";X();ze();Zl=class extends H{constructor(t,r){super(y.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(m.HandlerUniqueId)}set HandlerUniqueID(t){this.setProperty(m.HandlerUniqueId,t)}get FunctionName(){return this.getProperty(m.functionName)}set FunctionName(t){this.setProperty(m.functionName,t)}get LibraryName(){return this.getProperty(m.libraryNameEventHandler)}set LibraryName(t){this.setProperty(m.libraryNameEventHandler,t)}get Enabled(){return this.getProperty(m.enabledForField)}set Enabled(t){this.setProperty(m.enabledForField,t)}get PassExecutionContext(){return this.getProperty(m.passExecutionContext)}set PassExecutionContext(t){this.setProperty(m.passExecutionContext,t)}get Parameters(){return this.getProperty(m.parameters)}set Parameters(t){this.setProperty(m.parameters,t)}}});var ma,of=I(()=>{"use strict";X();Ho();ma=class extends Ir{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(y.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 jo,pN=I(()=>{"use strict";X();of();jo=class extends ma{_customFooter;constructor(t,r){super(y.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 Jo,fN=I(()=>{"use strict";X();of();Jo=class extends ma{_customHeader;constructor(t,r){super(y.formHeader,t),this._customHeader=r}get customHeader(){return this._customHeader}set customHeader(t){this._customHeader=t}get showCommandBar(){return this.getProcessedValue(m.showCommandBar)}set showCommandBar(t){t!=null&&this.setProperty(m.showCommandBar,String(t))}get showBody(){return this.getProcessedValue(m.showBody)}set showBody(t){t!=null&&this.setProperty(m.showBody,String(t))}get showTabNavigator(){return this.getProcessedValue(m.showTabNavigator)}set showTabNavigator(t){t!=null&&this.setProperty(m.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 Dt,ui=I(()=>{"use strict";xe();rt();X();Rn();Dt=class e extends nt{constructor(t,r){super(t,r)}getTitle(t){for(let r of this.getAllTitles())if(+r.getProperty(m.LCID)===t)return r.getProperty(m.text);return null}getAllTitles(){let t=this.getChildren(y.Titles);return t.length===0?[]:t[0].getChildren(y.Title)}setTitle(t,r){for(let i of this.getAllTitles())if(+i.getProperty(m.LCID)===r){i.setProperty(m.text,t);return}let n=new e(y.Title,null);n.setProperty(m.text,t),n.setProperty(m.LCID,String(r)),this.addGrandChild(y.Titles,n)}get Sequence(){return+this.getProperty(m.Sequence)}set Sequence(t){this.setProperty(m.Sequence,t.toString())}get Area(){return this.getProperty(m.Area)}set Area(t){this.setProperty(m.Area,t)}set Id(t){this.setProperty(m.Id,t)}get Id(){return this.getProperty(m.Id)}get id(){return new T(this.Id??"",!0)}set id(t){this.Id=t.guidString}get Show(){return!0}get Icon(){return this.getProperty(m.icon)}set Icon(t){t=t||P.EmptyString,this.setProperty(m.icon,t)}updateCommonProperties(t,r){this.Area=t.Area,this.Sequence=t.Sequence,this.setTitle(t.getDisplayName(r),r)}}});var Qo,mN=I(()=>{"use strict";(function(e){e[e.NavLinkNotAvailable=-1]="NavLinkNotAvailable",e[e.NavLinkIdConflict=-2]="NavLinkIdConflict",e[e.NavBarNotAvailable=-3]="NavBarNotAvailable"})(Qo||(Qo={}))});var eu,hN=I(()=>{"use strict";Re();X();ui();mN();eu=class extends Dt{constructor(t){super(y.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)?Qo.NavLinkNotAvailable:r.length===1?this.deleteChild(r[0]):Qo.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 ve,bV,gN,KZ,ha,sf=I(()=>{"use strict";xe();X();ui();(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"})(ve||(ve={}));bV=new Map([[ve.Info,"Info"],[ve.Sales,"Sales"],[ve.Service,"Service"],[ve.Marketing,"Marketing"],[ve.ProcessCenter,"ProcessCenter"]]),gN=new Map([["Info",ve.Info],["Sales",ve.Sales],["Service",ve.Service],["Marketing",ve.Marketing],["ProcessCenter",ve.ProcessCenter]]),KZ=new Map([[ve.Info,9e3],[ve.Sales,9200],[ve.Service,9400],[ve.Marketing,9600],[ve.ProcessCenter,9800],[ve.InternetMarketing,1e4],[ve.Async,10200]]),ha=class extends Dt{constructor(t,r){super(y.formNavBarArea,r)}setDefaultPropertiesByType(t,r,n){this.AreaId=bV.get(t);let i=n?.(`navBarArea.title.${this.AreaId}`)??this.AreaId;this.setTitle(i,r)}get ParentNavigation(){return this.getAncestor(y.formNavigation)}get AreaId(){return this.getProperty(m.Id)}set AreaId(t){this.setProperty(m.Id,t)}get id(){return new T(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 ga,lf=I(()=>{"use strict";X();ui();ga=class extends Dt{constructor(t,r){super(y.formNavBarAreas,r)}get AllNavBarAreaItems(){return this.getChildren(y.formNavBarArea)}get ParentNavigation(){return this.getAncestor(y.formNavigation)}addNavBarArea(t){this.addChild(t)}}});var tu,vN=I(()=>{"use strict";Re();X();ui();tu=class extends Dt{RelationshipNameUCIRuntime;constructor(t){super(y.formNavBarByRelationshipItem,t)}get RelationshipName(){return this.getProperty(m.RelationshipName)}set RelationshipName(t){this.setProperty(m.RelationshipName,t)}set Show(t){this.setProperty(m.Show,String(t))}get Show(){let t=this.getProperty(m.Show);return N.IsNullOrUndefined(t)||t==="true"}get TitleResourceId(){return this.getProperty(m.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 ru,yN=I(()=>{"use strict";X();ui();ru=class extends Dt{constructor(t){super(y.formNavBarItem,t)}get Url(){return this.getProperty(m.url)}set Url(t){this.setProperty(m.url,t)}}});var nu,bN=I(()=>{"use strict";xe();X();sf();lf();ui();nu=class extends Dt{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(y.formNavBarAreas)}setDefaultNavBarAreas(t,r){let n=[ve.Info,ve.Sales,ve.Service,ve.Marketing,ve.ProcessCenter];if(this.navBarAreas){let i=this.navBarAreas?.AllNavBarAreaItems;if(i&&i.length>0){let a=new Set(i.map(o=>gN.get(o.AreaId)));n=n.filter(o=>!a.has(o))}}else{let i=new ga(y.formNavBarAreas,this);i.isTransient=!0,this.addChild(i)}return n.length>0?(n.forEach(i=>{let a=new ha(y.formNavBarArea,this.navBarAreas);a.setDefaultPropertiesByType(i,t,r),this.navBarAreas.addNavBarArea(a)}),!0):!1}get navBar(){return this.getFirstChild(y.formNavBar)}get id(){return new T(Md,!0)}replaceNavAreaToGivenIndex(t,r){this.navBarAreas?.AllNavBarAreaItems.indexOf(r)!==-1&&(this.deleteFirstGrandChildOfName(y.formNavBarAreas,r),this.addGrandChildAtIndex(y.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 wN={};Ur(wN,{ControlType:()=>Wt,DeserializationService:()=>df,DeserializationServiceScope:()=>cf,DeserializedFormElementNode:()=>It});var uf,It,cf,Wt,df,ef=I(()=>{"use strict";uf=ne(Zn());xe();Re();rt();qi();Bd();Yn();ty();Ly();Tl();uN();Wo();Hl();zo();Qp();X();X();cN();ze();ir();Kp();dN();pN();Xp();Yp();fN();tf();rf();Ho();Ql();hN();sf();lf();vN();yN();bN();It=class extends H{constructor(t,r){super(t,r)}insertProperty(t,r){this.addProperty(t,r)}insertChild(t){this.addChild(t)}},cf="DeserializationService";(function(e){e.Grid="Grid",e.Lookup="Lookup",e.Base="Base"})(Wt||(Wt={}));df=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 f="";throw d.length===0?f="FormXml has no form node.":f="FormXml has multiple form nodes.",(0,uf.trackErrorTrace)(dt,{eventName:cf,eventData:{error:f}}),new Error(f)}let p=this.createFormModel(d.item(0),r,n,i,a,o,s,l,u,c);return N.IsNullOrUndefined(p.displayCondition)&&s!==Le.Dialog&&this.appendDefaultDisplayCondition(p),p}upsertFieldCount(t,r){let n=ei.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 d=new Kl(r,n,i,a,o,s,l,u,c);return this.populateElementProperties(d,t.attributes),this.populateElementChildren(d,t.childNodes),s===Le.Main&&(this.insertHeaderFooterElementProperties(y.formHeader,d,d.header),this.insertHeaderFooterElementProperties(y.formFooter,d,d.footer)),d}insertHeaderFooterElementProperties(t,r,n){if(N.IsNullOrUndefined(n)){let i=t===y.formHeader?new Jo(r,!0):new jo(r,!0);It.prototype.insertProperty.call(i,m.id,"{"+T.NewGuid()+"}"),It.prototype.insertProperty.call(i,m.Fieldlabelposition,"Top"),It.prototype.insertProperty.call(i,m.columnName,we.MarginalControlColumns),It.prototype.insertProperty.call(i,m.LabelWidth,we.LabelWidth),It.prototype.insertProperty.call(i,m.Fieldlabelalignment,"Left");let a=null,o=new si(a);for(let s=0;s<i.maxColumns;s++){let l=new Nt(o);It.prototype.insertProperty.call(l,m.id,"{"+T.NewGuid()+"}"),l.setDisplayName(P.EmptyString,this.lcid),It.prototype.insertProperty.call(l,m.showlabel,"false"),o.addCell(l)}i.appendRow(o),t===y.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 It(`<${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,uf.trackErrorTrace)(dt,{eventName:cf,eventData:{error:n}}),new Error(n)}for(let n=0;n<r.length;n++){let i=r.item(n);i&&(It.prototype.insertProperty.call(t,i.name,i.value),t.getNodeName()===y.formCell&&i.name===m.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&&It.prototype.insertChild.call(t,a)}}createModelNode(t,r){switch(t.nodeName){case y.form:throw new Error("Form node shouldn't be created using this method");case y.formTab:return new Yr(r);case y.formColumn:return new Fn(r);case y.formHeader:return new Jo(r,!1);case y.formFooter:return new jo(r,!1);case y.formSection:return new Ir(y.formSection,r);case y.formRow:return new si(r);case y.formCell:return new Nt(r);case y.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===m.indicationOfSubgrid&&l.value==="true"||l.name===m.classid&&(l.value?.toLocaleUpperCase()===`{${E.SubgridControl}}`||l.value?.toLocaleUpperCase()===`{${E.ReferencePanelSubgridControl}}`))a=Wt.Grid;else if(l.name===m.classid&&l.value?.toLocaleUpperCase()===`{${E.LookupControl}}`)a=Wt.Lookup;else if(l.name===m.classid&&l.value?.toLocaleUpperCase()===`{${E.CustomControl}}`)for(let u=0;u<i?.length;u++)i[u].nodeName===m.DefaultViewId&&(a=Wt.Lookup)}return a===Wt.Grid?new da(r):a===Wt.Lookup?new pa(r):new sr(r);case y.formEvent:return new ca(r,P.EmptyString);case y.dependency:return this.populateDependencyTable(t),new ua(r,P.EmptyString);case y.Handler:let o=[];return new Zl(o,r);case y.formNavigation:return new nu(t.nodeName,r);case y.formNavBarArea:return new ha(t.nodeName,r);case y.formNavBarAreas:return new ga(t.nodeName,r);case y.formNavBar:return new eu(r);case y.formNavBarByRelationshipItem:return new tu(r);case y.formNavBarItem:return new ru(r);case y.formDisplayConditions:return new Yl(r);case y.library:return new fa(r,P.EmptyString,P.EmptyString);case y.controlDescription:return new gl(r);case y.customControl:return this.populateCustomControlConfigurationId(t),new _l(r);default:return new It(t.nodeName,r)}}populateDependencyTable(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);i.name===m.id&&this.upsertFieldCount(i.value,Sr.DependencyFieldTable)}}populateCustomControlConfigurationId(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);if(i.name===m.id){let a=new T(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===m.ForControl){let l=s.value.substr(1,i.value.length-2);ke.CustomControlIdMap.upsert(l,a);break}}break}}}}});var AN={};Ur(AN,{SerializationService:()=>pf,SerializationServiceScope:()=>wV,SerializedFormElementNode:()=>va});var wV,va,pf,CN=I(()=>{"use strict";rt();ze();ir();nf();wV="SerializationService",va=class extends H{fetchNodeName(){return this.getNodeName()}enumerateProperties(){return this.getAllProperties()}enumerateChildren(){return this.getAllChildren()}},pf=class{langCode;constructor(t){this.langCode=t}serializeFormXmlNode(t){let r=va.prototype.fetchNodeName.call(t);if(r.charAt(0)===Kr.StartTag)return P.EscapeXml(r.substr(1),!1);if(t.isTransient&&!t.isDirty())return P.EmptyString;let n=va.prototype.enumerateProperties.call(t),i=va.prototype.enumerateChildren.call(t);if(!(t instanceof li)){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 _r=v(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.rejectUnknownKeys=it.childObjects=it.optionalGuidId=it.optionalEnum=it.eachObject=it.issue=it.isJsonObject=void 0;function SN(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}it.isJsonObject=SN;function ya(e,t,r,n){return n?{pointer:e,rule:t,message:r,fatal:n}:{pointer:e,rule:t,message:r}}it.issue=ya;function EN(e,t,r,n){if(!Array.isArray(e))return[];let i=[];return e.forEach((a,o)=>{SN(a)?i.push({node:a,index:o}):n.push(ya(`${t}/${o}`,`${r}-must-be-object`,`a ${r} must be a JSON object, got ${a===null?"null":typeof a}`))}),i}it.eachObject=EN;function AV(e,t,r,n,i,a){let o=e[t];o!==void 0&&(typeof o!="string"||!r.includes(o))&&a.push(ya(`${n}/${t}`,i,`${t} must be one of ${r.map(s=>`'${s}'`).join(", ")}, got ${JSON.stringify(o)}`))}it.optionalEnum=AV;var CV=/^(?:\{[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 SV(e,t,r,n,i){let a=e[t];typeof a=="string"&&a!==""&&!CV.test(a)&&i.push(ya(`${r}/${t}`,n,`${t} must be a GUID or empty, got '${a}'`))}it.optionalGuidId=SV;function EV(e,t,r,n,i){let a=e[t],o=`${r}/${t}`;return a===void 0?[]:Array.isArray(a)?EN(a,o,n,i):(i.push(ya(o,`${n}-list-must-be-array`,`${t} must be an array when present, got ${typeof a}`)),[])}it.childObjects=EV;function NV(e,t,r,n,i,a={}){var o,s;for(let l of Object.keys(e)){if(t.has(l))continue;let u=(o=a.elsewhere)===null||o===void 0?void 0:o[l],c=(s=a.unsupported)===null||s===void 0?void 0:s[l],d=u?` '${l}' is a ${u} key \u2014 set it on the ${u} instead.`:c?` ${c}`:` Put values the typed layer does not model in '${n}.bag', which round-trips them verbatim.`;i.push(ya(`${r}/${l}`,`${n}-unknown-key`,`'${l}' is not a ${n} property, and would be SILENTLY DROPPED at serialization.${d}`))}}it.rejectUnknownKeys=NV});var $N=v(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.classIdForAttributeType=Tt.QUICK_VIEW_CLASS_ID=Tt.NOTES_CLASS_ID=Tt.SUBGRID_CLASS_ID=Tt.formRegistration=Tt.FormAdapter=void 0;var Zr=(xe(),mr(Hv)),DV=(Re(),mr(jv)),IV=(ze(),mr(Qv)),at=(X(),mr(Jv)),Fe=(Yn(),mr(Kv)),_V=(ef(),mr(wN)),TV=(CN(),mr(AN)),Me=bn(),NN=rr(),_t=_r(),PV=pd(),Ko=ct(),gf=ie(),PN=An(),ON=Ei(),OV={[at.FormType.Main]:"Main",[at.FormType.QuickCreate]:"QuickCreate",[at.FormType.QuickViewForm]:"QuickView",[at.FormType.Card]:"Card"},ff={Main:at.FormType.Main,QuickCreate:at.FormType.QuickCreate,QuickView:at.FormType.QuickViewForm,Card:at.FormType.Card},RV=new Map(Object.entries(Fe.ControlClassId).map(([e,t])=>[String(t).toUpperCase(),e]));function RN(e){var t;return e&&(t=RV.get(e.toUpperCase()))!==null&&t!==void 0?t:"Unknown"}function Xo(e){return e.getAllProperties().map(t=>[t.key,t.value])}function ci(e){let t=new Map;for(let r of e.getAllProperties())t.has(r.key)||t.set(r.key,r.value);return t}function FN(e,t){return e.getAllChildren().find(r=>r.getNodeName()===t)}function vf(e,t){var r,n;let i=FN(e,"labels");if(!i)return"";let a=i.getAllChildren().filter(s=>s.getNodeName()==="label"),o=(r=a.find(s=>ci(s).get("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return o&&(n=ci(o).get("description"))!==null&&n!==void 0?n:""}function FV(e){let t=FN(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 xN(e){return/^1+$/.test(e)&&e.length>=1&&e.length<=4?e.length:1}function mf(e){let t=Math.min(Math.max(Math.trunc(e),1),4);return"1".repeat(t)}function Yo(e){return String(e??"").replace(/[{}]/g,"")}function hf(e){return`{${Yo(e)}}`}function DN(e,t){if(e===void 0||e==="")return t;let r=Number(e);return Number.isNaN(r)?t:r}function au(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,Me.rawFromNode)(u)})}),i<0)return{modeled:[],bag:{a:Xo(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,Me.rawFromNode)(u)})}),{modeled:s,bag:{a:Xo(e),c:a,w:{n:o.getNodeName(),a:Xo(o),c:l}}}}function LN(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,Me.rawFromNode)(a)})}),{modeled:n,bag:{a:Xo(e),c:i}}}function xV(e,t){let{modeled:r,bag:n}=au(e,"tabs","tab");return{tabs:r.map(i=>LV(i,t)),bag:n}}function LV(e,t){var r,n;let i=ci(e),{modeled:a,bag:o}=au(e,"columns","column");return{id:(r=i.get("id"))!==null&&r!==void 0?r:"",name:(n=i.get("name"))!==null&&n!==void 0?n:"",label:vf(e,t),expanded:i.get("expanded")==="true",visible:i.has("visible")?i.get("visible")==="true":!0,columns:a.map(s=>kV(s,t)),bag:o}}function kV(e,t){let r=ci(e),{modeled:n,bag:i}=au(e,"sections","section");return{width:r.get("width"),sections:n.map(a=>MV(a,t)),bag:i}}function MV(e,t){var r,n,i;let a=ci(e),{modeled:o,bag:s}=au(e,"rows","row");return{id:(r=a.get("id"))!==null&&r!==void 0?r:"",name:(n=a.get("name"))!==null&&n!==void 0?n:"",label:vf(e,t),visible:a.has("visible")?a.get("visible")==="true":!0,showLabel:a.get("showlabel")==="true",columns:xN((i=a.get("columns"))!==null&&i!==void 0?i:"1"),rows:o.map(l=>BV(l,t)),bag:s}}function BV(e,t){let{modeled:r,bag:n}=LN(e,"cell",!1);return{cells:r.map(i=>UV(i,t)),bag:n}}function UV(e,t){var r;let n=ci(e),{modeled:i,bag:a}=LN(e,"control",!0),o=vf(e,t),s=n.get("showlabel")==="true",l=i[0]?$V(i[0],o,s):null;return{id:(r=n.get("id"))!==null&&r!==void 0?r:"",visible:n.has("visible")?n.get("visible")==="true":!0,colspan:DN(n.get("colspan"),1),rowspan:DN(n.get("rowspan"),1),control:l,bag:a}}function $V(e,t,r){var n,i;let a=ci(e),o=Yo((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:RN(o),isRequired:a.get("isrequired")==="true",isReadOnly:a.get("disabled")==="true",label:t,showLabel:r,parameters:FV(e),bag:{a:Xo(e),c:e.getAllChildren().map((l,u)=>({i:u,node:(0,Me.rawFromNode)(l)}))}}}function ba(e){return e.a.length===0&&e.c.length===0&&!e.w}function kN(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function di(e,t){var r;let n=new Set(e.a.map(o=>o[0])),i=ba(e),a=[];for(let o of t)if(n.has(o.key)){let s=(r=kN(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,Me.mergeAttrs)(e.a,a)}var xn=(e,t)=>({key:e,matches:r=>r===t,render:()=>t,absentDefault:""}),Ln=(e,t,r=!1)=>({key:e,matches:n=>n==="true"===t,render:()=>String(t),absentDefault:String(r)}),IN=(e,t,r=1)=>({key:e,matches:n=>Number(n)===t,render:()=>String(t),absentDefault:String(r)});function yf(e,t){return{n:"labels",a:[],c:[{n:"label",a:[["description",e],["languagecode",String(t)]],c:[]}]}}function MN(e){return{n:"parameters",a:[],c:Object.keys(e).map(t=>({n:(0,gf.assertXmlName)(t,"Form control parameter name"),a:[],c:[{n:`<${e[t]}`,a:[],c:[]}]}))}}function qV(e,t){var r,n;let i=e.c.find(o=>o.n==="label"&&o.a.some(s=>s[0]==="languagecode"&&s[1]===String(t))),a=i??e.c.find(o=>o.n==="label");return(n=(r=a?.a.find(o=>o[0]==="description"))===null||r===void 0?void 0:r[1])!==null&&n!==void 0?n:""}function VV(e,t,r){let n=!1,i=e.c.map(a=>a.n!=="label"||!a.a.some(s=>s[0]==="languagecode"&&s[1]===String(r))?a:(n=!0,{...a,a:a.a.map(s=>s[0]==="description"?["description",t]:s)}));return n||i.push({n:"label",a:[["description",t],["languagecode",String(r)]],c:[]}),{...e,c:i}}function bf(e,t,r){let n=e.c.findIndex(a=>a.node.n==="labels");if(n<0||qV(e.c[n].node,r)===t)return e;let i=VV(e.c[n].node,t,r);return{...e,c:e.c.map((a,o)=>o===n?{...a,node:i}:a)}}function GV(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 zV(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(i=>e[i]===t[i])}function WV(e,t){return e.a.some(r=>r[0]===t)?{...e,a:e.a.filter(r=>r[0]!==t)}:e}function HV(e,t){let r=e.c.findIndex(i=>i.node.n==="parameters");if(r<0||zV(GV(e.c[r].node),t))return e;let n=MN(t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function ou(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,Me.spliceChildren)(e.w.c,r)};return(0,Me.spliceChildren)(e.c,[o])}let i=n(),a={n:t,a:[],c:r};return e.c.length===0?[...i,a]:(0,Me.spliceChildren)(e.c,[...i,a])}function jV(e,t){let r=e.tabs.map(n=>JV(n,t));return{n:"form",a:di(e.bag,[]),c:e.tabs.length===0&&ba(e.bag)?[]:ou(e.bag,"tabs",r,()=>[])}}function JV(e,t){let r=[xn("id",e.id),xn("name",e.name),Ln("expanded",e.expanded),Ln("visible",e.visible,!0)],n=e.columns.map(a=>QV(a,t)),i=bf(e.bag,e.label,t);return{n:"tab",a:di(i,r),c:ou(i,"columns",n,()=>e.label?[yf(e.label,t)]:[])}}function QV(e,t){let r=e.width!==void 0?[xn("width",e.width)]:[],n=e.sections.map(i=>KV(i,t));return{n:"column",a:di(e.bag,r),c:ou(e.bag,"sections",n,()=>[])}}function KV(e,t){let r=[xn("id",e.id),xn("name",e.name),Ln("showlabel",e.showLabel),Ln("visible",e.visible,!0),{key:"columns",matches:a=>xN(a)===e.columns,render:()=>mf(e.columns),absentDefault:mf(1)}],n=e.rows.map(a=>XV(a,t)),i=bf(e.bag,e.label,t);return{n:"section",a:di(i,r),c:ou(i,"rows",n,()=>e.label?[yf(e.label,t)]:[])}}function XV(e,t){let r=e.cells.map(n=>YV(n,t));return{n:"row",a:di(e.bag,[]),c:ba(e.bag)?r:(0,Me.assembleChildren)(e.bag,r)}}function YV(e,t){let r=e.control?e.control.showLabel:kN(e.bag,"showlabel")==="true",n=[xn("id",e.id),Ln("showlabel",r),Ln("visible",e.visible,!0),IN("colspan",e.colspan),IN("rowspan",e.rowspan)],i=e.control?[ZV(e.control)]:[],a;if(ba(e.bag))a=[...e.control&&e.control.label?[yf(e.control.label,t)]:[],...i];else{let o=e.control?bf(e.bag,e.control.label,t):e.bag;a=(0,Me.assembleChildren)(o,i)}return{n:"cell",a:di(e.bag,n),c:a}}function ZV(e){let t=[xn("id",e.id),{key:"classid",matches:i=>Yo(i)===e.classId,render:()=>hf(e.classId),absentDefault:""}];e.fieldName!==null&&t.push(xn("datafieldname",e.fieldName)),t.push(Ln("disabled",e.isReadOnly)),t.push(Ln("isrequired",e.isRequired));let r=e.fieldName===null?WV(e.bag,"datafieldname"):e.bag,n;return ba(r)?n=Object.keys(e.parameters).length>0?[MN(e.parameters)]:[]:n=(0,Me.assembleChildren)(HV(r,e.parameters),[]),{n:"control",a:di(r,t),c:n}}var e5={make:(e,t)=>new IV.FormElementNode(e,t),setProp:(e,t,r)=>e.setProperty(t,r),addChild:(e,t)=>e.addChild(t)};function _N(e,t,r){(0,PN.installDomShim)();let n=r5(e,r),i=(0,Me.rebuildRaw)(jV(n,t),e5,null);return new TV.SerializationService(t).serializeFormXmlNode(i)}function t5(e){return JSON.parse(JSON.stringify(e))}function r5(e,t){var r;let n=t5(e);n.bag||(n.bag=(0,Me.emptyBag)()),c5(n.bag),t&&n5(n,t);for(let i of(r=n.tabs)!==null&&r!==void 0?r:[])i5(i);return n}function n5(e,t){var r;let n=(r=e.entityLogicalName)!==null&&r!==void 0?r:"";BN(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=UN(s.attributeType)))})}function BN(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 i5(e){e.id||(e.id=Zr.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)a5(t);e.bag||(e.bag=(0,Me.emptyBag)())}function a5(e){e.sections||(e.sections=[]);for(let t of e.sections)o5(t);e.bag||(e.bag=(0,Me.emptyBag)()),e.width===void 0&&ba(e.bag)&&(e.width="100%")}function o5(e){e.id||(e.id=Zr.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)s5(t);e.bag||(e.bag=(0,Me.emptyBag)())}function s5(e){e.cells||(e.cells=[]);for(let t of e.cells)l5(t);e.bag||(e.bag=(0,Me.emptyBag)())}function l5(e){e.id||(e.id=Zr.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&&u5(e.control),e.bag||(e.bag=(0,Me.emptyBag)())}function u5(e){var t;e.id||(e.id=Zr.Guid.NewGuid()),e.classId===void 0&&(e.classId=String(Fe.ControlClassId.TextboxControl)),e.fieldName===void 0&&(e.fieldName=null),e.type===void 0&&(e.type=e.fieldName?"Field":RN(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,gf.assertXmlName)(r,"Form control parameter name");e.bag||(e.bag=(0,Me.emptyBag)())}function c5(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"&&!TN(a,"handlerUniqueId")&&a.a.push(["handlerUniqueId",hf(Zr.Guid.NewGuid())])}}else if(r.n==="formLibraries")for(let n of r.c)n.n==="Library"&&!TN(n,"libraryUniqueId")&&n.a.push(["libraryUniqueId",hf(Zr.Guid.NewGuid())])}}var iu=class{constructor(t=ON.DEFAULT_LCID){this.lcid=t}toArtifact(t,r){var n,i,a;let{tabs:o,bag:s}=xV(t,this.lcid);return{id:t.formId?t.formId.guidString:"",name:(n=t.formName)!==null&&n!==void 0?n:"",entityLogicalName:(i=t.entityName)!==null&&i!==void 0?i:"",formType:(a=OV[t.formType])!==null&&a!==void 0?a:"Main",status:this.readActivationStatus(t),...r!==void 0&&r!==""?{description:r}:{},tabs:o,bag:s}}fromArtifact(t){var r;return this.deserialize({formxml:_N(t,this.lcid),formid:t.id||(0,Ko.newId)(),objecttypecode:t.entityLogicalName,type:ff[t.formType],name:t.name,uniquename:t.name,description:(r=t.description)!==null&&r!==void 0?r:"",formpresentation:at.FormPresentation.AirForm,formactivationstate:t.status==="Active"?at.FormActivationState.Active:at.FormActivationState.InActive})}fromApiResponse(t){var r,n,i,a,o,s,l;let u=t,c=this.deserialize({formxml:(r=u.formxml)!==null&&r!==void 0?r:"",formid:(n=u.formid)!==null&&n!==void 0?n:(0,Ko.newId)(),objecttypecode:(i=u.objecttypecode)!==null&&i!==void 0?i:"",type:u.type,name:(a=u.name)!==null&&a!==void 0?a:"",uniquename:(o=u.uniquename)!==null&&o!==void 0?o:"",description:(s=u.description)!==null&&s!==void 0?s:"",formpresentation:u.formpresentation,formactivationstate:u.formactivationstate});return this.toArtifact(c,(l=u.description)!==null&&l!==void 0?l:void 0)}toApiPayload(t,r,n){return{formxml:_N(t,this.lcid,n),name:t.name,type:ff[t.formType],objecttypecode:t.entityLogicalName,...t.description!==void 0?{description:t.description}:{}}}metadataNeeds(t){let r=t.entityLogicalName;if(!r)return[];let n=new Set,i=[];return BN(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,p;let f=t.tabs&&t.tabs.length>0?void 0:b5(this.lcid),h=f!==void 0?f:t.tabs.map(S=>d5(S,this.lcid)).join(""),g=this.deserialize({formxml:`<form><tabs>${h}</tabs></form>`,formid:t.id||(0,Ko.newId)(),objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",type:ff[(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:(o=t.description)!==null&&o!==void 0?o:"",formpresentation:at.FormPresentation.AirForm,formactivationstate:((s=t.status)!==null&&s!==void 0?s:"Active")==="Active"?at.FormActivationState.Active:at.FormActivationState.InActive}),w=this.toArtifact(g,t.description);return{id:(l=t.id)!==null&&l!==void 0?l:w.id,name:(u=t.name)!==null&&u!==void 0?u:"New Form",entityLogicalName:(c=t.entityLogicalName)!==null&&c!==void 0?c:"",formType:(d=t.formType)!==null&&d!==void 0?d:"Main",status:(p=t.status)!==null&&p!==void 0?p:"Active",...t.description!==void 0?{description:t.description}:{},tabs:w.tabs,bag:w.bag}}assignMissingIds(t){return(0,Ko.assignMissingIds)(t)}validate(t){return _5(t)}deserialize(t){(0,PN.installDomShim)();let r=DV.ScriptUtilities.ParseXml(t.formxml),n=new _V.DeserializationService(this.lcid).deSerializeFormXml(r,new Zr.Guid(t.formid),t.objecttypecode,at.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===at.FormActivationState.InActive?"Inactive":"Active"}};Tt.FormAdapter=iu;function lr(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function wf(e,t){return e?`<labels><label description="${lr(e)}" languagecode="${t}" /></labels>`:""}function Af(e){return e&&e.length>0?Yo(e):(0,Ko.newId)()}function d5(e,t){var r,n,i,a;let o=(r=e.columns)!==null&&r!==void 0?r:[],s=(o.length>0?o:[y5()]).map(l=>p5(l,t)).join("");return`<tab id="{${lr(Af(e.id))}}" name="${lr((n=e.name)!==null&&n!==void 0?n:"")}" expanded="${(i=e.expanded)!==null&&i!==void 0?i:!0}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}">${wf(e.label,t)}<columns>${s}</columns></tab>`}function p5(e,t){var r,n;let i=((r=e.sections)!==null&&r!==void 0?r:[]).map(a=>f5(a,t)).join("");return`<column width="${lr((n=e.width)!==null&&n!==void 0?n:"100%")}"><sections>${i}</sections></column>`}function f5(e,t){var r,n,i,a,o;let s=((r=e.rows)!==null&&r!==void 0?r:[]).map(l=>m5(l,t)).join("");return`<section id="{${lr(Af(e.id))}}" name="${lr((n=e.name)!==null&&n!==void 0?n:"")}" showlabel="${(i=e.showLabel)!==null&&i!==void 0?i:!1}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}" columns="${mf((o=e.columns)!==null&&o!==void 0?o:1)}">${wf(e.label,t)}<rows>${s}</rows></section>`}function m5(e,t){var r;return`<row>${((r=e.cells)!==null&&r!==void 0?r:[]).map(n=>h5(n,t)).join("")}</row>`}function h5(e,t){var r,n,i,a,o,s;let l=e.control,u=l?wf((n=(r=l.label)!==null&&r!==void 0?r:l.fieldName)!==null&&n!==void 0?n:"",t):"",c=l?g5(l):"";return`<cell id="{${lr(Af(e.id))}}" showlabel="${l?(i=l.showLabel)!==null&&i!==void 0?i:!0:!1}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}" colspan="${(o=e.colspan)!==null&&o!==void 0?o:1}" rowspan="${(s=e.rowspan)!==null&&s!==void 0?s:1}">${u}${c}</cell>`}function g5(e){var t,r,n;let i=e.fieldName?` datafieldname="${lr(e.fieldName)}"`:"",a=v5(e.parameters),o=e.classId?Yo(e.classId):String(Fe.ControlClassId.TextboxControl);return`<control id="${lr((t=e.id)!==null&&t!==void 0?t:"")}" classid="{${lr(o)}}"${i} disabled="${(r=e.isReadOnly)!==null&&r!==void 0?r:!1}" isrequired="${(n=e.isRequired)!==null&&n!==void 0?n:!1}">${a}</control>`}function v5(e){let t=Object.keys(e??{});return t.length===0?"":(t.forEach(n=>(0,gf.assertXmlName)(n,"Form control parameter name")),`<parameters>${t.map(n=>`<${n}>${lr(e[n])}</${n}>`).join("")}</parameters>`)}function y5(){return{width:"100%",sections:[],bag:{a:[],c:[]}}}function b5(e){return`<tab id="{${Zr.Guid.NewGuid()}}" name="tab_general" expanded="true" visible="true"><labels><label description="General" languagecode="${e}" /></labels><columns><column width="100%"><sections><section id="{${Zr.Guid.NewGuid()}}" name="section_general" showlabel="false" visible="true" columns="1"><labels><label description="General" languagecode="${e}" /></labels><rows></rows></section></sections></column></columns></tab>`}function w5(e=ON.DEFAULT_LCID){return{adapter:new iu(e),api:PV.formApi,languageSensitive:!0,publish:(t,r,n)=>(0,NN.publishBoundEntity)(t,n),publishScope:(t,r)=>(0,NN.boundEntityPublishScope)(r)}}Tt.formRegistration=w5;var A5=new Set(["id","name","label","expanded","visible","columns","bag"]),C5=new Set(["id","width","sections","bag"]),S5=new Set(["id","name","label","visible","showLabel","columns","rows","bag"]),E5=new Set(["id","cells","bag"]),N5=new Set(["id","visible","colspan","rowspan","control","bag"]),D5=new Set(["id","classId","fieldName","type","isRequired","isReadOnly","label","showLabel","parameters","bag"]),I5={elsewhere:{isReadOnly:"control",isRequired:"control",fieldName:"control",classId:"control",label:"control",showLabel:"control",parameters:"control"},unsupported:{createOnly:"FormXml has no create-only concept; gate the field with a business rule instead. Raise it with the SDK owners if you need it modeled.",updateOnly:"FormXml has no update-only concept; gate the field with a business rule instead. Raise it with the SDK owners if you need it modeled."}};function _5(e){let t=[];return(0,_t.childObjects)(e,"tabs","","tab",t).forEach(({node:n,index:i})=>{let a=`/tabs/${i}`;(0,_t.rejectUnknownKeys)(n,A5,a,"tab",t),(0,_t.childObjects)(n,"columns",a,"column",t).forEach(({node:s,index:l})=>{let u=`${a}/columns/${l}`;(0,_t.rejectUnknownKeys)(s,C5,u,"column",t),(0,_t.childObjects)(s,"sections",u,"section",t).forEach(({node:d,index:p})=>{let f=`${u}/sections/${p}`;(0,_t.rejectUnknownKeys)(d,S5,f,"section",t),(0,_t.childObjects)(d,"rows",f,"row",t).forEach(({node:g,index:w})=>{let S=`${f}/rows/${w}`;(0,_t.rejectUnknownKeys)(g,E5,S,"row",t),(0,_t.childObjects)(g,"cells",S,"cell",t).forEach(({node:x,index:F})=>{let G=`${S}/cells/${F}`;(0,_t.rejectUnknownKeys)(x,N5,G,"cell",t,I5);let L=x.control;L!=null&&!(0,_t.isJsonObject)(L)?t.push((0,_t.issue)(`${G}/control`,"control-must-be-object-or-null",`a cell control must be a JSON object or null, got ${typeof L}`)):(0,_t.isJsonObject)(L)&&(0,_t.rejectUnknownKeys)(L,D5,`${G}/control`,"control",t)})})})})}),t}Tt.SUBGRID_CLASS_ID=Fe.ControlClassId.SubgridControl;Tt.NOTES_CLASS_ID=Fe.ControlClassId.TimelineControl;Tt.QUICK_VIEW_CLASS_ID=Fe.ControlClassId.QuickViewControl;var T5={Lookup:String(Fe.ControlClassId.LookupControl),Customer:String(Fe.ControlClassId.LookupControl),Owner:String(Fe.ControlClassId.LookupControl),PartyList:String(Fe.ControlClassId.PartyListControl),Boolean:String(Fe.ControlClassId.BooleanControl),DateTime:String(Fe.ControlClassId.DateTimeControl),Decimal:String(Fe.ControlClassId.DecimalControl),Double:String(Fe.ControlClassId.FloatingNumberControl),Money:String(Fe.ControlClassId.CurrencyControl),Integer:String(Fe.ControlClassId.IntegerControl),BigInt:String(Fe.ControlClassId.IntegerControl),Memo:String(Fe.ControlClassId.TextAreaControl),String:String(Fe.ControlClassId.TextboxControl)},P5="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE";function UN(e){return e==="Picklist"||e==="State"||e==="Status"?P5:e&&T5[e]||String(Fe.ControlClassId.TextboxControl)}Tt.classIdForAttributeType=UN;function TN(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}});var Cf=v(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.viewApi=wa.findDefaultViews=void 0;var VN=$t(),Ht=be(),en=ie(),O5="savedqueryid,name,description,fetchxml,layoutxml,querytype,returnedtypecode,isdefault",R5="savedqueryid,name,returnedtypecode,querytype,isdefault";async function F5(e,t,r={}){var n;let i=new Set(((n=r.excludeViewIds)!==null&&n!==void 0?n:[]).filter(Boolean)),a=`returnedtypecode eq '${(0,en.odataLiteral)(t)}' and querytype eq 0`,o=`/savedqueries${(0,en.odataQuery)([["$select","savedqueryid,name,isdefault"],["$filter",a]])}`;return(await(0,VN.collectPages)(e,o,`findDefaultViews('${t}')`)).filter(l=>{var u;return l.savedqueryid&&!i.has(l.savedqueryid)&&(l.isdefault||/^(Active|Inactive)\b/i.test((u=l.name)!==null&&u!==void 0?u:""))}).map(l=>{var u;return{id:String(l.savedqueryid),name:String((u=l.name)!==null&&u!==void 0?u:"")}})}wa.findDefaultViews=F5;async function x5(e,t){var r;let n=`/EntityDefinitions(LogicalName='${(0,en.odataPathLiteral)(t)}')${(0,en.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 qN(e,t,r){if(!r||!/<grid\b/.test(t)||/<grid[^>]*\bobject=/.test(t))return t;let n=await x5(e,r);return n===void 0?t:t.replace(/<grid\b/,`<grid object="${n}"`)}wa.viewApi={async get(e,t){let n=`/savedqueries(${(0,en.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,en.odataQuery)([["$select",O5]]),i=(0,Ht.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Ht.readEtag)(i)}},async list(e,t){let r=`/savedqueries${(0,en.odataQuery)([["$select",R5],["$filter",t?.entityLogicalName?`returnedtypecode eq '${(0,en.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,VN.collectPages)(e,r,"listArtifacts('view')")).map(i=>{var a,o;return{type:"view",id:(a=i.savedqueryid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",entityLogicalName:i.returnedtypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Ht.echoWrite)("savedqueryid"),a=`/savedqueries${i.query}`,o=await qN(e,n.layoutxml,n.returnedtypecode),s=(0,Ht.ensureSuccess)(await e.post(a,(0,Ht.withClientMintedId)({name:n.name,description:n.description,fetchxml:n.fetchxml,layoutxml:o,returnedtypecode:n.returnedtypecode,querytype:n.querytype,isdefault:n.isdefault},"savedqueryid",r),i.options),e.apiUrl(a));return{id:(0,Ht.resolveCreatedId)(s,"savedqueryid","view",r),etag:(0,Ht.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,en.normalizeGuid)(t,"id"),o=(0,Ht.echoWrite)("savedqueryid",{"If-Match":(0,Ht.requireEtag)(n,"view",a)}),s=`/savedqueries(${a})${o.query}`,l=await qN(e,i.layoutxml,i.returnedtypecode),u=(0,Ht.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,fetchxml:i.fetchxml,layoutxml:l},o.options),e.apiUrl(s));return{id:a,etag:(0,Ht.readEtag)(u)}},delete(e,t){return(0,Ht.deleteRecord)(e,"savedqueries",t)}}});var nD=v(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.viewRegistration=Aa.ViewAdapter=void 0;var QN=re(),Lt=_r(),Sf=bn(),pi=Qn(),GN=rr(),L5=Cf(),Ef=An(),k5=ct(),KN=100,lu=class{toArtifact(t){var r,n,i,a,o,s,l,u;(0,Ef.installDomShim)();let c=(r=t.fetchxml)!==null&&r!==void 0?r:"",d=(n=t.layoutxml)!==null&&n!==void 0?n:"",p=(0,pi.parseXmlRoot)(c,"<fetch/>"),f=(0,pi.parseXmlRoot)(d,"<grid/>"),h=YN(p);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:B5(p),queryType:(l=t.querytype)!==null&&l!==void 0?l:0,isDefault:(u=t.isdefault)!==null&&u!==void 0?u:!1,columns:XN(f,p),filters:eD(p),sort:ZN(p),...h.length>0?{linkEntities:h}:{},fetchBag:c?(0,pi.projectElementBag)(p):void 0,layoutBag:d?(0,pi.projectElementBag)(f):void 0}}fromArtifact(t){(0,Ef.installDomShim)();let{fetchxml:r,layoutxml:n}=zN(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,Ef.installDomShim)();let{fetchxml:s,layoutxml:l}=zN(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,k5.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:[],...t.linkEntities&&t.linkEntities.length>0?{linkEntities:t.linkEntities}:{}}}assignMissingIds(t){return t}validate(t){let r=[],n=t;(0,Lt.childObjects)(n,"columns","","column",r),(0,Lt.childObjects)(n,"sort","","sort",r),(0,Lt.childObjects)(n,"linkEntities","","linkEntity",r),M5(n.linkEntities,r);let i=n.filters;return i!=null&&((0,Lt.isJsonObject)(i)?Nf(i,"/filters",r):r.push((0,Lt.issue)("/filters","filters-must-be-object",`filters must be a JSON object, got ${typeof i}`))),r}};Aa.ViewAdapter=lu;function M5(e,t){Array.isArray(e)&&e.forEach((r,n)=>{if(!(0,Lt.isJsonObject)(r))return;for(let a of["name","from","to"]){let o=r[a];(typeof o!="string"||o.trim()==="")&&t.push((0,Lt.issue)(`/linkEntities/${n}/${a}`,"linkentity-needs-keys",`a join needs a non-empty '${a}' \u2014 'from'/'to' are what DEFINE the relationship, and a link without them is unresolvable. Got ${JSON.stringify(o)}.`))}let i=r.filters;i!=null&&((0,Lt.isJsonObject)(i)?Nf(i,`/linkEntities/${n}/filters`,t):t.push((0,Lt.issue)(`/linkEntities/${n}/filters`,"filters-must-be-object",`filters must be a JSON object, got ${typeof i}`)))})}function Nf(e,t,r){(0,Lt.childObjects)(e,"conditions",t,"condition",r),(0,Lt.childObjects)(e,"groups",t,"filterGroup",r).forEach(({node:i,index:a})=>Nf(i,`${t}/groups/${a}`,r))}function B5(e){var t;let r=e.getElementsByTagName("entity")[0];return(t=r?.getAttribute("name"))!==null&&t!==void 0?t:""}function XN(e,t){var r;let n=Df(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)?KN:c,order:o},p=n.get(u);p&&(d.relatedEntity=p.linkKey,p.attributeName&&p.attributeName!==u&&(d.sourceAttribute=p.attributeName)),o+=1,a.push(d)}return a}function Df(e){let t=new Map,r=e.getElementsByTagName("link-entity");for(let n=0;n<r.length;n+=1){let i=r[n],a=i.getAttribute("name");if(!a)continue;let o=i.getElementsByTagName("attribute");for(let s=0;s<o.length;s+=1){let l=o[s],u=l.getAttribute("name")||"",c=l.getAttribute("alias")||u;c&&t.set(c,{linkKey:i.getAttribute("alias")||a,linkName:a,attributeName:u,link:i})}}return t}function YN(e){let t=e.getElementsByTagName("entity")[0];if(!t)return[];let r=[];for(let n of ot(t,"link-entity")){let i=n.getAttribute("name"),a=n.getAttribute("from"),o=n.getAttribute("to");if(!i||!a||!o)continue;let s=n.getAttribute("alias"),l=n.getAttribute("link-type"),u=ot(n,"filter").find(c=>!uu(c));r.push({name:i,from:a,to:o,...s?{alias:s}:{},...l==="inner"||l==="outer"?{linkType:l}:{},...u?{filters:If(u)}:{}})}return r}function ZN(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 eD(e){let t=e.getElementsByTagName("entity")[0],r={type:"and",conditions:[],groups:[]};if(!t)return r;let n=ot(t,"filter").filter(i=>!uu(i)).map(If);return n.length===0?r:n.length===1?n[0]:{type:"and",conditions:[],groups:n}}function uu(e){if(e.getAttribute("isquickfindfields")==="1")return!0;if(ot(e,"filter").length>0)return!1;let t=ot(e,"condition");return t.length===0?!1:t.some(r=>r.getAttribute("isquickfindfields")==="1"||ot(r,"value").length>0||$5(r))}var U5=new Set(["attribute","operator","value","entityname","uiname","uitype"]);function $5(e){var t;let r=e.attributes;for(let n=0;n<r.length;n+=1){let i=(t=r[n])===null||t===void 0?void 0:t.name;if(i&&!U5.has(i))return!0}return!1}function If(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);let p=l.getAttribute("entityname")||"";p&&(c.entityname=p),i.push(c)}else l.tagName==="filter"&&a.push(If(l))}return{type:n,conditions:i,groups:a}}function ot(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}var _f=e=>{var t,r;return`${(t=e.relatedEntity)!==null&&t!==void 0?t:""}::${(r=e.sourceAttribute)!==null&&r!==void 0?r:e.name}`};function q5(e,t){let r=Df(e),n=new Map;for(let i of t){if(!i.relatedEntity)continue;let a=r.get(i.name);if(a){let o=_f(i),s=n.get(o);s?s.push(a.link):n.set(o,[a.link])}}return n}function V5(e,t,r,n){if(!n||n.size===0)return;let i=new Set,a=t.getElementsByTagName("link-entity");for(let s=0;s<a.length;s+=1)i.add(a[s]);let o=r.filter(s=>{if(!s.relatedEntity)return!1;let l=n.get(_f(s));return!!l&&l.some(u=>!i.has(u))});if(o.length!==0)throw new QN.ValidationError("view",e.id,o.map(s=>(0,Lt.issue)(`/columns/${r.indexOf(s)}`,"view-column-orphaned-by-join-removal",`column '${s.name}' came from a join this push REMOVED. Another join matching '${s.relatedEntity}' still exists, but nothing can say whether it is the one the column belonged to \u2014 re-attaching it there would silently change the data the column shows. Remove the column too, keep the join it came from, or point the column at the join you want by setting relatedEntity to that join's alias.`)))}function zN(e){let t=G5(e.columns);if(!WN(e.fetchBag)||!WN(e.layoutBag))return{fetchxml:t9({...e,columns:t}),layoutxml:r9({...e,columns:t},`${e.entityLogicalName}id`)};let r=new DOMParser().parseFromString("<root/>","text/xml"),n=HN(e.fetchBag,"fetch",r),i=HN(e.layoutBag,"grid",r),a=XN(i,n),o=!su(t,a),s=!su(e.sort,ZN(n)),l=!su(e.filters,eD(n)),u=e.linkEntities,c=u!==void 0&&!su(u,YN(n)),d=c?q5(n,a):void 0;return c&&Y5(r,n,u),c&&(e9(e,n,t,d),V5(e,n,t,d)),o?(jN(r,n,t,a),j5(r,i,t)):c&&jN(r,n,t,a),s&&K5(r,n,e.sort),l&&X5(r,n,e.filters),{fetchxml:(0,pi.serializeNode)(n),layoutxml:(0,pi.serializeNode)(i)}}function G5(e){return(e??[]).map((t,r)=>{var n,i;return{name:String(t.name).toLowerCase(),width:(n=t.width)!==null&&n!==void 0?n:KN,order:(i=t.order)!==null&&i!==void 0?i:r,...t.relatedEntity?{relatedEntity:t.relatedEntity}:{},...t.sourceAttribute?{sourceAttribute:String(t.sourceAttribute).toLowerCase()}:{}}})}function WN(e){return!!e&&(e.c.length>0||e.a.length>0)}function HN(e,t,r){let n={n:t,a:(0,Sf.mergeAttrs)(e.a,[]),c:(0,Sf.spliceChildren)(e.c,[])};return(0,Sf.rebuildRaw)(n,(0,pi.domEngine)(r),null)}function jN(e,t,r,n){var i,a;let o=t.getElementsByTagName("entity")[0];if(!o)return;let s=d=>{var p,f;return`${(p=d.relatedEntity)!==null&&p!==void 0?p:""}:${d.name}:${(f=d.sourceAttribute)!==null&&f!==void 0?f:d.name}`},l=new Set(r.map(s));for(let d of n)l.has(s(d))||z5(o,d);let u=Df(t),c=new Set(ot(o,"attribute").map(d=>d.getAttribute("name")).filter(d=>!!d));for(let d of[...r].sort((p,f)=>p.order-f.order))if(d.relatedEntity){let p=u.get(d.name);if(p&&p.attributeName===((i=d.sourceAttribute)!==null&&i!==void 0?i:d.name)&&(p.linkKey===d.relatedEntity||p.linkName===d.relatedEntity||!rD(o,d.relatedEntity)))continue;let f=W5(e,o,d.relatedEntity),h=e.createElement("attribute");tD(h,d),f.appendChild(h),u.set(d.name,{linkKey:d.relatedEntity,linkName:f.getAttribute("name")||d.relatedEntity,attributeName:(a=d.sourceAttribute)!==null&&a!==void 0?a:d.name,link:f})}else{if(c.has(d.name))continue;let p=e.createElement("attribute");p.setAttribute("name",d.name),H5(o,p),c.add(d.name)}}function tD(e,t){if(t.sourceAttribute&&t.sourceAttribute!==t.name){e.setAttribute("name",t.sourceAttribute),e.setAttribute("alias",t.name);return}e.setAttribute("name",t.name)}function z5(e,t){if(t.relatedEntity){for(let r of ot(e,"link-entity"))if(!(r.getAttribute("alias")!==t.relatedEntity&&r.getAttribute("name")!==t.relatedEntity)){for(let n of ot(r,"attribute"))if((n.getAttribute("alias")||n.getAttribute("name"))===t.name){r.removeChild(n);return}}return}for(let r of ot(e,"attribute"))if(r.getAttribute("name")===t.name){e.removeChild(r);return}}function rD(e,t,r=!1){let n=a=>a.getAttribute("alias")===t||a.getAttribute("name")===t;for(let a of ot(e,"link-entity"))if(n(a))return a;if(r)return;let i=e.getElementsByTagName("link-entity");for(let a=0;a<i.length;a+=1)if(n(i[a]))return i[a]}function W5(e,t,r){let n=rD(t,r);if(n)return n;let i=e.createElement("link-entity");return i.setAttribute("name",r),t.appendChild(i),i}function H5(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 j5(e,t,r){let n=t.getElementsByTagName("row")[0];if(!n)return;let i=[...r].sort((s,l)=>s.order-l.order),a=J5(n);if(Q5(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 J5(e){return ot(e,"cell").filter(t=>!!t.getAttribute("name")&&t.getAttribute("ishidden")!=="1")}function Q5(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 K5(e,t,r){let n=t.getElementsByTagName("entity")[0];if(!n)return;let i=new Map;for(let a of ot(n,"order")){let o=(a.getAttribute("attribute")||"").toLowerCase();if(o){let s=i.get(o);s?s.push(a):i.set(o,[a])}n.removeChild(a)}for(let a of r){let o=i.get(String(a.attribute).toLowerCase()),s=o&&o.length>0?o.shift():void 0,l=s??e.createElement("order");l.setAttribute("attribute",a.attribute),l.setAttribute("descending",String(a.descending)),n.appendChild(l)}}function X5(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of ot(n,"filter"))uu(i)||n.removeChild(i);(r.conditions.length>0||r.groups.length>0)&&n.appendChild(Zo(e,r))}}function su(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Y5(e,t,r){var n;let i=t.getElementsByTagName("entity")[0];if(!i)return;let a=ot(i,"link-entity").filter(h=>h.getAttribute("name")&&h.getAttribute("from")&&h.getAttribute("to")),o=(h,g)=>h.getAttribute(g)||"",s=new Array(r.length),l=new Set,u=h=>{r.forEach((g,w)=>{if(s[w])return;let S=a.filter(F=>!l.has(F)&&h(F,g));if(S.length!==1)return;let D=S[0];r.some((F,G)=>G!==w&&!s[G]&&h(D,F))||(s[w]=D,l.add(D))})};u((h,g)=>!!g.alias&&o(h,"name")===g.name&&o(h,"alias")===g.alias),u((h,g)=>o(h,"name")===g.name&&o(h,"from")===g.from&&o(h,"to")===g.to),u((h,g)=>o(h,"name")===g.name&&o(h,"from")===g.from),u((h,g)=>o(h,"name")===g.name&&o(h,"to")===g.to),u((h,g)=>o(h,"name")===g.name);let c=r.map((h,g)=>g).filter(h=>!s[h]),d=a.filter(h=>!l.has(h)),p=new Map;for(let h of d){let g=p.get(o(h,"name"));g?g.push(h):p.set(o(h,"name"),[h])}let f=new Map;for(let h of c){let g=f.get(r[h].name);g?g.push(h):f.set(r[h].name,[h])}for(let[h,g]of f){let w=(n=p.get(h))!==null&&n!==void 0?n:[];w.length===g.length&&g.forEach((S,D)=>{s[S]=w[D],l.add(w[D])})}r.forEach((h,g)=>{let w=s[g];if(w){JN(e,w,h);return}let S=e.createElement("link-entity");JN(e,S,h),i.appendChild(S)});for(let h of a)l.has(h)||i.removeChild(h)}var Z5=new Set(["inner","outer"]);function e9(e,t,r,n){if(!t.getElementsByTagName("entity")[0])return;let a=new Set,o=t.getElementsByTagName("link-entity");for(let c=0;c<o.length;c+=1){let d=o[c],p=d.getAttribute("name"),f=d.getAttribute("alias");p&&a.add(p),f&&a.add(f)}let s=new Set;for(let c=0;c<o.length;c+=1)s.add(o[c]);let l=c=>{let d=n?.get(_f(c));return!!d&&d.every(p=>s.has(p))},u=r.filter(c=>c.relatedEntity&&!a.has(c.relatedEntity)&&!l(c));if(u.length!==0)throw new QN.ValidationError("view",e.id,u.map(c=>{var d;let p=((d=e.linkEntities)!==null&&d!==void 0?d:[]).some(f=>f.name===c.relatedEntity||f.alias===c.relatedEntity);return(0,Lt.issue)(`/columns/${r.indexOf(c)}`,"view-column-dangling-link",`column '${c.name}' has relatedEntity '${c.relatedEntity}', but no matching join remains in linkEntities. `+(p?"Remove the column too, or keep the join.":"That join is NESTED (a join off a join), which the typed layer does not model, so it cannot be re-declared in linkEntities \u2014 it only survives while the join above it does. Remove the column, or restore the parent join this push replaced."))}))}function JN(e,t,r){t.setAttribute("name",r.name),t.setAttribute("from",r.from),t.setAttribute("to",r.to),r.alias?t.setAttribute("alias",r.alias):t.removeAttribute("alias"),r.linkType?t.setAttribute("link-type",r.linkType):Z5.has(t.getAttribute("link-type")||"")&&t.removeAttribute("link-type");let n=ot(t,"filter").find(a=>!uu(a)),i=r.filters&&(r.filters.conditions.length>0||r.filters.groups.length>0)?Zo(e,r.filters):null;n&&i?t.replaceChild(i,n):n?t.removeChild(n):i&&t.appendChild(i)}function t9(e){var t;let r=new DOMParser().parseFromString("<fetch/>","text/xml"),n=r.documentElement;n.setAttribute("version","1.0"),n.setAttribute("mapping","logical");let i=r.createElement("entity");i.setAttribute("name",e.entityLogicalName),n.appendChild(i);let a=new Map;for(let o of(t=e.linkEntities)!==null&&t!==void 0?t:[]){let s=r.createElement("link-entity");s.setAttribute("name",o.name),s.setAttribute("from",o.from),s.setAttribute("to",o.to),o.alias&&s.setAttribute("alias",o.alias),o.linkType&&s.setAttribute("link-type",o.linkType),o.filters&&(o.filters.conditions.length>0||o.filters.groups.length>0)&&s.appendChild(Zo(r,o.filters)),i.appendChild(s);for(let l of[o.alias||o.name,o.name])a.has(l)||a.set(l,s)}for(let o of[...e.columns].sort((s,l)=>s.order-l.order)){let s=r.createElement("attribute");if(o.relatedEntity){tD(s,o);let l=a.get(o.relatedEntity);l||(l=r.createElement("link-entity"),l.setAttribute("name",o.relatedEntity),i.appendChild(l),a.set(o.relatedEntity,l)),l.appendChild(s)}else s.setAttribute("name",o.name),i.appendChild(s)}for(let o of e.sort){let s=r.createElement("order");s.setAttribute("attribute",o.attribute),s.setAttribute("descending",String(o.descending)),i.appendChild(s)}return(e.filters.conditions.length>0||e.filters.groups.length>0)&&i.appendChild(Zo(r,e.filters)),new XMLSerializer().serializeToString(r)}function Zo(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.entityname&&i.setAttribute("entityname",n.entityname),n.value!==void 0&&i.setAttribute("value",n.value),r.appendChild(i)}for(let n of t.groups)r.appendChild(Zo(e,n));return r}function r9(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 n9(){return{adapter:new lu,api:L5.viewApi,publish:(e,t,r)=>(0,GN.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,GN.boundEntityPublishScope)(t)}}Aa.viewRegistration=n9});function cu(e,t){return e==="SetFieldValue"&&t!==void 0&&i9.has(t.attributeType)&&(t.requiredLevel==="None"||t.requiredLevel==="Recommended")}var i9,Tf=I(()=>{"use strict";i9=new Set(["Integer","Double","Decimal","Money","String","Memo","DateTime","Picklist","Lookup"])});function iD(e){return e!=="Entity"&&e!=="AllForms"&&typeof e=="string"&&e.trim()!==""}function Pf(e){return iD(e)?1:2}function Of(e){return iD(e)?e:void 0}function aD(e,t){let r=Of(e.scope);return{"@odata.type":"#Microsoft.Dynamics.CRM.workflow",name:e.name,description:e.description,workflowid:t,ondemand:!1,subprocess:!1,triggeroncreate:!1,triggerondelete:!1,category:Ca.WorkflowCategory.BusinessRule,type:Ca.WorkflowTypeCode.Definition,mode:1,scope:Ca.WorkflowScope.Organization,primaryentity:e.entityLogicalName,iscrmuiworkflow:!0,processtriggerscope:Pf(e.scope),...r!==void 0?{processtriggerformid:r}:{}}}var Ca,oD=I(()=>{"use strict";Ca=ne(Wn());});function sD(e,t=0){return(Ze[e[t+0]]+Ze[e[t+1]]+Ze[e[t+2]]+Ze[e[t+3]]+"-"+Ze[e[t+4]]+Ze[e[t+5]]+"-"+Ze[e[t+6]]+Ze[e[t+7]]+"-"+Ze[e[t+8]]+Ze[e[t+9]]+"-"+Ze[e[t+10]]+Ze[e[t+11]]+Ze[e[t+12]]+Ze[e[t+13]]+Ze[e[t+14]]+Ze[e[t+15]]).toLowerCase()}var Ze,lD=I(()=>{Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1))});function Rf(){return du>pu.length-16&&((0,uD.randomFillSync)(pu),du=0),pu.slice(du,du+=16)}var uD,pu,du,cD=I(()=>{uD=require("crypto"),pu=new Uint8Array(256),du=pu.length});var dD,Ff,pD=I(()=>{dD=require("crypto"),Ff={randomUUID:dD.randomUUID}});function a9(e,t,r){if(Ff.randomUUID&&!t&&!e)return Ff.randomUUID();e=e||{};let n=e.random??e.rng?.()??Rf();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 sD(n)}var mt,fD=I(()=>{pD();cD();lD();mt=a9});var xf=I(()=>{fD()});var mD=I(()=>{"use strict";});var Lf=v(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.WorkflowConditionOperator=jt.WorkflowAttributeType=jt.SystemStep=jt.FieldRequiredLevelTypes=jt.AttributeDateTimeBehavior=void 0;jt.AttributeDateTimeBehavior={None:0,Dynamic:1,DateOnly:2,StaticTimeZoneInvariant:3,UserLocal:4};jt.FieldRequiredLevelTypes={None:"0",Required:"1",Recommended:"2"};jt.SystemStep={IdentifyContact:"IdentifyContact",IdentifyAccount:"IdentifyAccount",IdentifyCustomer:"IdentifyCustomer",IdentifyCase:"IdentifyCase",Solution:"Solution",Resolve:"Resolve"};jt.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"};jt.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"}});function yD(e){switch(e){case"Boolean":return ye.WorkflowAttributeType.Boolean;case"Customer":return ye.WorkflowAttributeType.Customer;case"DateTime":return ye.WorkflowAttributeType.DateTime;case"Decimal":return ye.WorkflowAttributeType.Decimal;case"Double":return ye.WorkflowAttributeType.Float;case"Integer":return ye.WorkflowAttributeType.Integer;case"Lookup":return ye.WorkflowAttributeType.Lookup;case"Money":return ye.WorkflowAttributeType.Money;case"Owner":return ye.WorkflowAttributeType.Owner;case"Picklist":return ye.WorkflowAttributeType.Picklist;case"State":return ye.WorkflowAttributeType.State;case"Status":return ye.WorkflowAttributeType.Status;case"Uniqueidentifier":case"UniqueIdentifier":return ye.WorkflowAttributeType.UniqueIdentifier;case"BigInt":return ye.WorkflowAttributeType.BigType;default:return ye.WorkflowAttributeType.String}}function ND(e){return e&&e!==ye.WorkflowAttributeType.String?e:void 0}function l9(e){return{__class:ED,parameterName:"primaryEntity",entityName:e}}function hD(e){return{__class:Mf,type:kf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,method:bD,parameters:[e]}}function gD(e,t,r=ye.WorkflowAttributeType.String){return{__class:AD,type:r,behavior:ye.AttributeDateTimeBehavior.None,typeSet:!1,entity:l9(t),attributeName:e}}function u9(e,t=ye.WorkflowAttributeType.String){return{__class:CD,type:t,behavior:ye.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function c9(e){return{__class:SD,type:kf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,days:e,hours:"0",minutes:"0",months:"0",years:"0"}}function DD(e,t){let r=o9[e.operator],n=hD(gD(e.leftField,t,e.leftWorkflowType)),i;e.dateArithmetic?i=c9(e.right.value??"0"):e.right.kind==="field"?i=gD(e.right.field??"",t,e.right.workflowType):i=u9(e.right.value??"",e.right.workflowType??e.leftWorkflowType);let a=hD(i);return{__class:Mf,type:kf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,method:wD,parameters:[r,n,a]}}function ID(e){return typeof e=="object"&&e.__class===Mf}function d9(e){return typeof e=="object"&&e.__class===SD}function fu(e){return ID(e)&&e.method===bD&&e.parameters.length>0?fu(e.parameters[0]):e}function vD(e){if(typeof e!="object"||e.__class!==AD)return null;let t=e.entity;if(t&&t.__class&&t.__class!==ED)return null;let r=e.attributeName;return r?{field:r,workflowType:ND(e.type)}:null}function _D(e){if(!e)return null;let t=fu(e);if(!ID(t)||t.method!==wD||t.parameters.length!==3)return null;let r=t.parameters[0],n=s9[String(r)];if(!n)return null;let i=vD(fu(t.parameters[1]));if(!i)return null;let a=fu(t.parameters[2]);if(d9(a))return n!=="+"&&n!=="-"?null:{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:String(a.days??"")},dateArithmetic:!0};let o=vD(a);if(o)return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"field",field:o.field,workflowType:o.workflowType}};if(typeof a=="object"&&a.__class===CD){let s=a.primitiveValue;return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:s!=null?String(s):"",workflowType:ND(a.type)}}}return null}function Uf(e){let t=(e??"").trim();if(!/^\d+$/.test(t))return!1;let r=Number(t);return Number.isSafeInteger(r)&&r>=Bf&&r<=Sa}function fi(e){if(!e||!e.leftField)return"incomplete";if(e.right.kind==="field")return e.right.field&&e.right.field.trim()?null:"incomplete";let t=e.right.value;return!t||!t.trim()?"incomplete":e.dateArithmetic&&!Uf(t)?"invalidDayCount":null}function Ea(e){return fi(e)===null}var ye,bD,wD,kf,AD,CD,Mf,SD,ED,o9,s9,Bf,Sa,es=I(()=>{"use strict";ye=ne(Lf());bD="0",wD="3",kf="0",AD="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",CD="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",Mf="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions",SD="TimeSpanExpression:#Microsoft.Crm.Workflow.Expressions",ED="PrimaryEntity:#Microsoft.Crm.Workflow.Expressions";o9={"+":0,"-":1,"*":2,"/":3},s9={0:"+",1:"-",2:"*",3:"/"};Bf=0,Sa=2147483647});function TD(e){return e.__class==="BinaryExpression:#Microsoft.Crm.Workflow.Expressions"}function p9(e){return e.__class==="ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel"}function ts(){return{list:[]}}function PD(e,t,r){return e&&e.list.length>0?{list:[{...e.list[0],description:t},...e.list.slice(1)]}:{list:[{labelId:mt(),languageCode:r,description:t}]}}function Gf(e){return{__class:"PrimaryEntity:#Microsoft.Crm.Workflow.Expressions",parameterName:"primaryEntity",entityName:e}}function zf(e,t,r){return{__class:"EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,entity:Gf(t),attributeName:e}}function rs(e,t){return{__class:"PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",type:t,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function MD(e){return{__class:"LookupExpression:#Microsoft.Crm.Workflow.Expressions",type:e.workflowType??z.WorkflowAttributeType.Lookup,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,entityType:e.entityType,label:e.label??"",staticValue:rs(e.id.replace(/[{}]/g,""),z.WorkflowAttributeType.UniqueIdentifier)}}function OD(e,t){let r=e.valueType==="Lookup"?e.lookupValue?.workflowType??z.WorkflowAttributeType.Lookup:e.valueWorkflowType??z.WorkflowAttributeType.String,n=Vf[e.operator]??z.WorkflowConditionOperator.Equal,i=zf(e.field,t,r),a;if(e.operator==="ContainsData"||e.operator==="DoesNotContainData")a=[];else if(e.valueType==="Field"&&e.valueField)a=[zf(e.valueField,t,r)];else if(e.valueType==="Lookup"){if(!e.lookupValue)throw new Error("Lookup condition is missing its record value.");a=[MD(e.lookupValue)]}else e.valueType==="Clear"?a=[rs(null,r)]:e.valueType==="Expression"?a=[hu(e.valueType,e.value,e.valueField,t,e.expression,e.rawExpression)]:a=[rs(e.value??"",r)];return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:z.WorkflowAttributeType.Boolean,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function f9(e,t,r){if(e.length===0)return null;if(e.length===1)return OD(e[0],r);let n=t==="AND"?z.WorkflowConditionOperator.LogicalAnd:z.WorkflowConditionOperator.LogicalOr,[i,...a]=e.map(o=>OD(o,r));return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:z.WorkflowAttributeType.Boolean,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function mu(e){if(!e)return{valueType:"Value",value:""};if(e.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions")return{valueType:"Field",valueField:e.attributeName};if(e.__class==="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions")return e.primitiveValue==null?{valueType:"Clear",valueWorkflowType:e.type}:{valueType:"Value",value:e.primitiveValue!=null?String(e.primitiveValue):""};if(e.__class==="LookupExpression:#Microsoft.Crm.Workflow.Expressions"){let t=e.staticValue,r=typeof t=="object"&&t?.__class==="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions"?t.primitiveValue:t;return{valueType:"Lookup",lookupValue:{entityType:e.entityType,id:String(r??""),label:e.label,...e.type!==z.WorkflowAttributeType.Lookup?{workflowType:e.type}:{}}}}if(e.__class==="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions"){let t=_D(e);return t?{valueType:"Expression",expression:t}:{valueType:"Expression",rawExpression:e}}return{valueType:"Value",value:""}}function $f(e){let t=kD[e.conditionOperatoroperator]??"Equals",r=e.left,n=r.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",i=n?r.attributeName:"",a=n?r.type:void 0,s=t==="ContainsData"||t==="DoesNotContainData"?{valueType:"Value"}:mu(e.right[0]),l=s.valueWorkflowType??a;return{id:mt(),field:i,fieldDisplayName:i,operator:t,...s,...l?{valueWorkflowType:l}:{}}}function RD(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:[...TD(e.left)?[$f(e.left)]:[],...e.right.filter(TD).map($f)],logic:r}}return{clauses:[$f(e)],logic:"AND"}}function hu(e,t,r,n,i,a,o,s){if(e==="Field"&&r)return zf(r,n,z.WorkflowAttributeType.String);if(e==="Expression"){if(i)return DD(i,n);if(a!=null)return a}return e==="Lookup"&&o?MD(o):e==="Clear"?rs(null,s??z.WorkflowAttributeType.String):rs(t??"",z.WorkflowAttributeType.String)}function qf(e,t){return{propertyName:e,propertyValueExpr:t}}function Na(e){return`Step_${e.value++}`}function Jt(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 FD(e,t,r){return e&&!r.used.has(e)?(r.used.add(e),e):Jt(t,r)}function m9(e){return e===LD.StateCode.Activated?"Active":"Draft"}function h9(e,t){let r=e.processtriggerscope,n=e.processtriggerformid;return r===1&&n?n:r===2?"Entity":t??"Entity"}function BD(e,t=1033){return new Da({languageCode:t}).serialize(e)}function UD(e){return new Da().deserialize(e)}var LD,z,Vf,kD,Wf,Da,Hf=I(()=>{"use strict";xf();LD=ne(Wn());mD();es();z=ne(Lf());Vf={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},kD={};for(let e of Object.keys(Vf))kD[Vf[e]]=e;Wf={setFieldValue:"Set Field Value",setDefaultValue:"Set Default Value",lockUnlock:"Lock/Unlock",setBusinessRequired:"Set Business Required",setVisibility:"Set Visibility",recommendation:"Recommendation",showErrorMessage:"Show Error Message",condition:"Condition"};Da=class{resolveLabel;languageCode;entityName="";stepCounter={value:0};idCounter={counts:{},used:new Set};constructor(t={}){this.resolveLabel=t.resolveLabel??(r=>Wf[r]),this.languageCode=t.languageCode??1033}label(t){return this.resolveLabel(t)}serialize(t){let r=t.wfomRoot;this.entityName=t.entityLogicalName,this.stepCounter={value:r?Number(r.nextStepIndex):1},this.idCounter={counts:{},used:new Set};let n=t.scope!=="Entity"&&t.scope!=="AllForms"?t.scope:null,i=t.rootCondition?[this.serializeConditionNode(t.rootCondition)]:[],a={__class:"WorkflowStep:#Microsoft.Crm.Workflow.ObjectModel",id:r?.id??t.ruleId??mt(),name:r?.name??"Step_0",description:r!==void 0?r.description:t.description||null,stepLabels:ts(),argumentsArray:[],primaryEntityName:r?.primaryEntityName??this.entityName,nextStepIndex:String(this.stepCounter.value),isCrmUIWorkflow:!0,category:r?.category??"2",businessProcessType:r?.businessProcessType??"0",mode:r?.mode??"0",title:r?.title??t.name,formId:n,workflowEntityId:r?.workflowEntityId??t.ruleId??"",variables:r?.variables??[],inputs:r?.inputs??[],steps:{list:i}};return JSON.stringify(a)}makeApplyActionStep(t){return{__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",id:Jt("SetAttributeValueStep",this.idCounter),description:t.displayName||"New Action",name:t.stepName??Na(this.stepCounter),stepLabels:{list:[]},specification:qf(t.field,hu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType)),entity:Gf(this.entityName)}}makeRecommendationActionStep(t,r,n){let i=r.map(l=>this.makeApplyActionStep(l)),a=t??"",o=n?.stepLabels,s=PD(o,a,this.languageCode);return{__class:"ActionStep:#Microsoft.Crm.Workflow.ObjectModel",id:FD(n?.id,"ActionStep",this.idCounter),name:n?.name??Na(this.stepCounter),description:n?.description??"Action step",stepLabels:s,steps:{list:i},actionId:null,actionType:n?.actionType??"4",processId:n?.processId??mt(),uniqueName:n?.uniqueName??`id_${mt().replace(/-/g,"")}ActionStep`}}serializeAction(t){let r=Gf(this.entityName),n=t.stepName??Na(this.stepCounter),i=t.stepLabels??ts(),a={name:n,stepLabels:i,description:t.displayName},o=t.type;switch(o){case"SetFieldValue":return{...a,id:Jt("SetAttributeValueStep",this.idCounter),__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:qf(t.field,hu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"SetDefaultValue":return{...a,id:Jt("SetDefaultValueStep",this.idCounter),__class:"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:qf(t.field,hu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"LockUnlock":return{...a,id:Jt("SetDisplayModeStep",this.idCounter),__class:"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",isReadOnly:t.lock,entity:r};case"SetBusinessRequired":return{...a,id:Jt("SetFieldRequiredLevelStep",this.idCounter),__class:"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",requiredLevel:t.required?z.FieldRequiredLevelTypes.Required:z.FieldRequiredLevelTypes.None,entity:r};case"SetVisibility":return{...a,id:Jt("SetVisibilityStep",this.idCounter),__class:"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",isVisible:t.visible,entity:r};case"ShowErrorMessage":{let s=t.errorMessage||t.displayName,l=t.stepLabels&&t.stepLabels.list.length>0?t.stepLabels:{list:[{labelId:mt(),languageCode:this.languageCode,description:s}]};return{...a,id:Jt("SetMessageStep",this.idCounter),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:l,name:s,controlId:t.field,entity:r,level:t.messageLevel??"error",actionSteps:t.messageActionSteps??{list:[]}}}case"Recommendation":{let s=t.messageText??t.recommendationTitle??t.displayName,l=PD(t.stepLabels,s,this.languageCode),u={list:[this.makeRecommendationActionStep(t.acceptanceText,t.applyActions??[],t.recommendationActionStepMeta)]};return{...a,id:Jt("SetMessageStep",this.idCounter),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:l,description:t.recommendationTitle||t.displayName,controlId:t.field,entity:r,level:"RECOMMENDATION",actionSteps:u}}default:throw new Error(`Unsupported action type: ${o}`)}}serializeConditionNode(t){let r=t.stepName??Na(this.stepCounter),n=Jt("ConditionStep",this.idCounter),i=[],a=t,o=!0;for(;a;){let s=f9(a.clauses,a.logic,this.entityName),l=o?a.branchName??Na(this.stepCounter):Na(this.stepCounter),c={__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:o?FD(a.branchId,"ConditionBranchStep",this.idCounter):Jt("ConditionBranchStep",this.idCounter),name:l,description:a.displayName,stepLabels:ts(),conditionExpression:s??void 0,steps:{list:a.trueBranch.map(p=>this.serializeBranchItem(p))}};i.push(c);let d=a.falseBranch;if(d.length===1&&d[0].kind==="condition"){a=d[0],o=!1;continue}d.length>0&&i.push(this.makeTerminalElseBranch(d)),a=void 0}return{__class:"ConditionStep:#Microsoft.Crm.Workflow.ObjectModel",id:n,name:r,description:"",stepLabels:ts(),containsElsebranch:i.length>1,steps:{list:i}}}makeTerminalElseBranch(t){return{__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:Jt("ConditionBranchStep",this.idCounter),name:"Else",description:null,stepLabels:ts(),conditionExpression:void 0,steps:{list:t.map(r=>this.serializeBranchItem(r))}}}serializeBranchItem(t){return t.kind==="condition"?this.serializeConditionNode(t):this.serializeAction(t)}deserialize(t){let r=t,n=null,i;if(t.wfomJson)try{let a=JSON.parse(t.wfomJson);i={id:a.id==="WorkflowStep0"||!a.id?t.workflowid??mt():a.id,name:a.name,description:a.description,nextStepIndex:a.nextStepIndex,category:a.category==="0"||a.category===0?"2":a.category,businessProcessType:a.businessProcessType,mode:a.mode,title:a.title||t.name||"",primaryEntityName:a.primaryEntityName==="1"||!a.primaryEntityName?t.primaryentity??"":a.primaryEntityName,workflowEntityId:a.workflowEntityId==="00000000-0000-0000-0000-000000000000"||!a.workflowEntityId?t.workflowid??"":a.workflowEntityId,formId:a.formId,variables:a.variables,inputs:a.inputs};let s=(a.steps?.list??[]).find(l=>l.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel");s&&(n=this.deserializeConditionStep(s))}catch{}return{ruleId:t.workflowid??null,name:t.name??"",description:t.description??"",entityLogicalName:t.primaryentity??"",scope:h9(r,i?.formId),status:m9(t.statecode),rootCondition:n,wfomRoot:i}}deserializeConditionStep(t){let r=(t.steps?.list??[]).filter(p9);return this.buildConditionNodeFromBranches(r,t,!0)}buildConditionNodeFromBranches(t,r,n){let[i,...a]=t,{clauses:o,logic:s}=RD(i?.conditionExpression),l=this.deserializeBranch(i?.steps?.list??[]),u=this.deserializeElseChain(a,r),c=i?.description||i?.name||r.description||r.name||this.label("condition");return{kind:"condition",id:(n?r.id:i?.id)??mt(),displayName:c,clauses:o,logic:s,trueBranch:l,falseBranch:u,isCollapsed:!1,stepName:n?r.name:void 0,branchId:n?i?.id:void 0,branchName:n?i?.name:void 0}}deserializeElseChain(t,r){if(t.length===0)return[];let[n]=t,{clauses:i}=RD(n.conditionExpression);return i.length===0?this.deserializeBranch(n.steps?.list??[]):[this.buildConditionNodeFromBranches(t,r,!1)]}deserializeBranch(t){return t.map(r=>r.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel"?this.deserializeConditionStep(r):this.deserializeAction(r)).filter(r=>r!==null)}parseRecommendationApplyActions(t){let n=(t?.list??[])[0];if(!n)return{applyActions:[]};let i={id:n.id,name:n.name,description:n.description??void 0,stepLabels:n.stepLabels,processId:n.processId,uniqueName:n.uniqueName,actionType:n.actionType},a=n.stepLabels?.list,o=a&&a.length>0?a[0].description??"":"";return{applyActions:(n.steps?.list??[]).filter(l=>l.__class==="SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel").map(l=>{let u=l.specification;return{id:l.id||mt(),field:u?.propertyName??"",stepName:l.name??void 0,displayName:l.description??void 0,...mu(u?.propertyValueExpr)}}),meta:i,acceptanceText:o}}deserializeAction(t){switch(t.__class){case"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=mu(t.specification.propertyValueExpr);return{kind:"action",id:t.id,type:"SetFieldValue",displayName:t.description||t.name||this.label("setFieldValue"),stepName:t.name,stepLabels:t.stepLabels,field:t.specification.propertyName,...r}}case"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=mu(t.specification.propertyValueExpr);return{kind:"action",id:t.id,type:"SetDefaultValue",displayName:t.description||t.name||this.label("setDefaultValue"),stepName:t.name,stepLabels:t.stepLabels,field:t.specification.propertyName,...r}}case"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"LockUnlock",displayName:t.description||t.name||this.label("lockUnlock"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,lock:t.isReadOnly};case"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"SetBusinessRequired",displayName:t.description||t.name||this.label("setBusinessRequired"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,required:t.requiredLevel!==z.FieldRequiredLevelTypes.None};case"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"SetVisibility",displayName:t.description||t.name||this.label("setVisibility"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,visible:t.isVisible};case"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=t.stepLabels?.list,n=r&&r.length>0?r[0].description??"":"";if((t.level??"").toUpperCase()==="RECOMMENDATION"){let{applyActions:i,meta:a,acceptanceText:o}=this.parseRecommendationApplyActions(t.actionSteps);return{kind:"action",id:t.id,type:"Recommendation",displayName:t.description||this.label("recommendation"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,recommendationTitle:t.description||"",messageText:n,acceptanceText:o,applyActions:i,recommendationActionStepMeta:a}}return{kind:"action",id:t.id,type:"ShowErrorMessage",displayName:t.description||this.label("showErrorMessage"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,errorMessage:n||t.name||"",messageLevel:t.level??void 0,messageActionSteps:t.actionSteps}}case"ActionStep:#Microsoft.Crm.Workflow.ObjectModel":{let{applyActions:r,meta:n,acceptanceText:i}=this.parseRecommendationApplyActions({list:[t]});return{kind:"action",id:t.id,type:"Recommendation",displayName:t.name||this.label("recommendation"),stepName:t.name,stepLabels:t.stepLabels,field:t.actionControl?.controlId??"",recommendationTitle:t.name||"",messageText:t.description||"",acceptanceText:i,applyActions:r,recommendationActionStepMeta:n}}default:return null}}}});function kn(e){return!g9.has(e)}function GD(e){return S9.has(e)}function gu(e){return qD.has(e)?v9:A9.has(e)?y9:VD.has(e)?b9:w9}function zD(e){return gu(e)[0]}function WD(e,t){return gu(t).includes(e)}function $D(e){return qD.has(e)?"string":e==="Money"?"money":e==="Integer"||e==="BigInt"?"integer":e==="Decimal"||e==="Double"?"decimal":VD.has(e)?"date":C9.has(e)?"boolean":"other"}function vu(e,t){let r=$D(e),n=$D(t);return r==="other"||n==="other"?e===t:r===n}var g9,v9,y9,b9,w9,qD,A9,VD,C9,S9,jf=I(()=>{"use strict";g9=new Set(["ContainsData","DoesNotContainData"]);v9=["Equals","DoesNotEqual","Contains","DoesNotContain","BeginsWith","DoesNotBeginWith","EndsWith","DoesNotEndWith","ContainsData","DoesNotContainData"],y9=["Equals","DoesNotEqual","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],b9=["On","NotOn","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],w9=["Equals","DoesNotEqual","ContainsData","DoesNotContainData"],qD=new Set(["String","Memo","EntityName"]),A9=new Set(["Integer","BigInt","Money","Decimal","Double"]),VD=new Set(["DateTime"]),C9=new Set(["Boolean"]),S9=new Set(["Equals","DoesNotEqual"])});function Xf(e){return E9.has(e.type)}function Jf(e,t,r,n,i,a,o){let s=i.get(r);!s||!N9.has(s.attributeType)||n!=="Value"||o?.operator&&!GD(o.operator)||a.push({nodeId:e,kind:"INVALID_VALUE_TYPE_FOR_FIELD",message:`${t}: please select a record for this lookup field; a typed text value cannot be saved.`,target:o?.target,itemId:o?.itemId,messageKey:"Validation.InvalidValueTypeForField",messageParams:{label:t}})}function Qf(e){return!!(e?.entityType?.trim()&&e.id?.trim())}function Kf(e,t,r){return{nodeId:e,kind:"INVALID_DAY_COUNT",message:`Please enter a whole number of days between 0 and ${Sa}.`,target:t,itemId:r,messageKey:"Validation.InvalidDayCount",messageParams:{max:Sa}}}function HD(e,t,r,n,i,a,o,s){if(i!=="Clear")return;let l=a.get(n);cu(r,l)||o.push({nodeId:e,kind:"INVALID_CLEAR_FOR_FIELD",message:`${t}: Clear is only supported for optional fields with a legacy-compatible type.`,target:s?.target,itemId:s?.itemId,messageKey:"Validation.InvalidClearForField",messageParams:{label:t}})}function bu(e){if(!e)return!1;for(let t of[...e.trueBranch,...e.falseBranch])if(t.kind==="action"){if(Xf(t))return!0}else if(bu(t))return!0;return!1}function Yf(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=Yf(r,t);if(n)return n}}return null}function Ia(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=Ia(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=Ia(n,t);if(i)return i}}return null}function Zf(e,t){return{...e,trueBranch:jD(e.trueBranch,t),falseBranch:jD(e.falseBranch,t)}}function jD(e,t){return e.filter(r=>r.id!==t).map(r=>r.kind==="condition"?Zf(r,t):r)}function Mn(e,t,r){return e.id===t?r(e):{...e,trueBranch:e.trueBranch.map(n=>n.kind==="condition"?Mn(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="condition"?Mn(n,t,r):n)}}function yu(e,t,r){return{...e,trueBranch:e.trueBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?yu(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?yu(n,t,r):n)}}function JD(e,t,r,n){return Mn(e,t,i=>({...i,trueBranch:r==="true"?[...i.trueBranch,n]:i.trueBranch,falseBranch:r==="false"?[...i.falseBranch,n]:i.falseBranch}))}function em(e){return e.length===1&&e[0].kind==="condition"}function I9(e){let t=0,r=e??void 0;for(;r;){t+=1;let{falseBranch:n}=r;if(em(n)){r=n[0];continue}n.length>0&&(t+=1),r=void 0}return t}function _9(e){return!!e&&I9(e)<D9}function T9(e,t){if(!e)return;let r=(n,i)=>{if(n.id===t)return i;let a=[];if(em(n.falseBranch)){let o=r(n.falseBranch[0],i);if(o)return o}else a.push(...n.falseBranch.filter(o=>o.kind==="condition"));a.push(...n.trueBranch.filter(o=>o.kind==="condition"));for(let o of a){let s=r(o,o);if(s)return s}};return r(e,e)}function QD(e,t,r){let n=T9(e,t);return!n||!_9(n)?e:Mn(e,t,i=>KD(i,r))}function KD(e,t){if(em(e.falseBranch))return{...e,falseBranch:[KD(e.falseBranch[0],t)]};let r=tm(t);return r.falseBranch=e.falseBranch,{...e,falseBranch:[r]}}function XD(e,t){let r=Ia(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 Mn(e,r.node.id,a=>({...a,falseBranch:i}))}function YD(e,t,r){let n=Ia(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 Mn(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 tm(e){return{kind:"condition",id:mt(),displayName:e??"New Condition",clauses:[],logic:"AND",trueBranch:[],falseBranch:[],isCollapsed:!1}}function ZD(e,t){let r={kind:"action",id:mt(),type:e,displayName:t??`New ${e}`};switch(e){case"Recommendation":return{...r,type:"Recommendation",field:"",recommendationTitle:"",messageText:"",applyActions:[{id:mt(),field:"",valueType:"Value",value:""}]};case"LockUnlock":return{...r,type:"LockUnlock",field:"",lock:!0};case"ShowErrorMessage":return{...r,type:"ShowErrorMessage",field:"",errorMessage:""};case"SetFieldValue":return{...r,type:"SetFieldValue",field:"",valueType:"Value",value:""};case"SetDefaultValue":return{...r,type:"SetDefaultValue",field:"",valueType:"Value",value:""};case"SetBusinessRequired":return{...r,type:"SetBusinessRequired",field:"",required:!0};case"SetVisibility":return{...r,type:"SetVisibility",field:"",visible:!0};default:return{...r,type:"SetFieldValue",field:"",valueType:"Value",value:""}}}function e2(e){if(!e)return[];let t=[];return t2(e,t),[...new Set(t)]}function t2(e,t){e.clauses.forEach(r=>{r.field&&t.push(r.field)}),[...e.trueBranch,...e.falseBranch].forEach(r=>{r.kind==="condition"?t2(r,t):"field"in r&&r.field&&t.push(r.field)})}function r2(e,t=[]){if(!e)return[{nodeId:"root",kind:"NO_CONDITION",message:"A business rule must include at least one condition.",target:"node"}];let r=[],n=new Map(t.map(i=>[i.logicalName,i]));return n2(e,r,n),bu(e)||r.push({nodeId:"root",kind:"NO_ACTION",message:"A business rule must include at least one action step.",target:"node"}),r}function n2(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.",target:"node",messageKey:"Validation.AddClause"}),e.clauses.forEach(n=>{let i=n.valueType==="Expression"&&!n.rawExpression?fi(n.expression):null;if(!n.field)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Please select a field for this clause.",target:"clauseField",itemId:n.id});else if(kn(n.operator)&&n.valueType==="Value"&&!n.value)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please enter a value for this clause.",target:"clauseValue",itemId:n.id});else if(kn(n.operator)&&n.valueType==="Value"&&n.value){let a=r.get(n.field);a?.maxLength&&n.value.length>a.maxLength&&t.push({nodeId:e.id,kind:"CLAUSE_VALUE_TOO_LONG",message:`Value exceeds the field's maximum length of ${a.maxLength} characters.`,target:"clauseValue",itemId:n.id,messageParams:{maxLength:a.maxLength}})}else kn(n.operator)&&n.valueType==="Expression"&&!n.rawExpression&&!Ea(n.expression)&&t.push(i==="invalidDayCount"?Kf(e.id,"clauseValue",n.id):{nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please complete the formula for this clause.",target:"clauseValue",itemId:n.id,messageKey:"Validation.CompleteClauseFormula"});kn(n.operator)&&n.valueType==="Lookup"&&(Qf(n.lookupValue)||t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please select a lookup record for this clause.",target:"clauseValue",itemId:n.id,messageKey:"Validation.EmptyClauseLookupValue"})),kn(n.operator)&&Jf(e.id,"Condition",n.field,n.valueType,r,t,{operator:n.operator,target:"clauseValue",itemId:n.id})}),[...e.trueBranch,...e.falseBranch].forEach(n=>{if(n.kind==="condition")n2(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.`,target:"actionField",messageParams:{actionType:n.type}});else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&(n.valueType??"Value")==="Value"&&!n.value?.trim())t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please provide a value.`,target:"actionValue",messageParams:{actionType:n.type}});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.`,target:"actionValue",messageParams:{actionType:n.type,maxLength:i.maxLength}})}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.`,target:"actionValue",messageKey:"Validation.SelectActionSourceField",messageParams:{actionType:n.type}});else if(r.size>0){let i=r.get(n.field),a=r.get(n.valueField);i&&a&&!vu(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.`,target:"actionValue",messageKey:"Validation.IncompatibleActionSourceField",messageParams:{actionType:n.type}})}}else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Expression"){let i=n.rawExpression?null:fi(n.expression);!n.rawExpression&&!Ea(n.expression)&&t.push(i==="invalidDayCount"?Kf(n.id,"actionValue"):{nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the formula.`,target:"actionValue",messageKey:"Validation.CompleteActionFormula",messageParams:{actionType:n.type}})}else(n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Lookup"&&!Qf(n.lookupValue)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the lookup record.`,target:"actionValue",messageKey:"Validation.EmptyActionLookupValue",messageParams:{actionType:n.type}});if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.field&&(Jf(n.id,n.type,n.field,n.valueType,r,t,{target:"actionValue"}),HD(n.id,n.type,n.type,n.field,n.valueType,r,t,{target:"actionValue"})),n.type==="ShowErrorMessage"&&!n.errorMessage?.trim()&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_MESSAGE",message:"Show error message: please enter an error message.",target:"actionMessage"}),n.type==="Recommendation"){let i=n.applyActions??[];n.recommendationTitle?.trim()||t.push({nodeId:n.id,kind:"EMPTY_RECOMMENDATION_TITLE",message:"Recommendation: please enter a recommendation title.",target:"recommendationTitle"}),n.messageText?.trim()||t.push({nodeId:n.id,kind:"EMPTY_RECOMMENDATION_MESSAGE",message:"Recommendation: please enter a recommendation message.",target:"recommendationMessage"}),i.length===0&&t.push({nodeId:n.id,kind:"RECOMMENDATION_NO_APPLY_ACTION",message:"Recommendation: add at least one action to apply.",target:"node"}),i.forEach(a=>{if(!a.field)t.push({nodeId:n.id,kind:"EMPTY_ACTION_FIELD",message:"Recommendation: a target field is required for each action to apply.",target:"applyActionField",itemId:a.id,messageKey:"Validation.RecommendationApplyField"});else if(a.valueType==="Field")a.valueField||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please select a field to copy from.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplySourceField"});else if(a.valueType==="Expression"){let o=a.rawExpression?null:fi(a.expression);!a.rawExpression&&!Ea(a.expression)&&t.push(o==="invalidDayCount"?Kf(n.id,"applyActionValue",a.id):{nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the formula.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyFormula"})}else a.valueType==="Lookup"?Qf(a.lookupValue)||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the lookup record.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyLookupValue"}):a.valueType==="Clear"||a.value?.trim()||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please enter a value for each action to apply.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyValue"});a.field&&(Jf(n.id,"Recommendation",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}),HD(n.id,"Recommendation","SetFieldValue",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}))})}}})}var E9,N9,D9,rm=I(()=>{"use strict";xf();Tf();jf();es();E9=new Set(["LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]);N9=new Set(["Lookup","Customer","Owner"]);D9=10});var i2={};Ur(i2,{DAY_COUNT_MAX:()=>Sa,DAY_COUNT_MIN:()=>Bf,DEFAULT_DESERIALIZE_LABELS:()=>Wf,WorkflowJsonMapper:()=>Da,addElseIfInTree:()=>QD,appendToBranch:()=>JD,areFieldKindsCompatible:()=>vu,attributeTypeToWorkflowType:()=>yD,buildWorkflowEntity:()=>aD,collectUsedFields:()=>e2,createEmptyAction:()=>ZD,createEmptyCondition:()=>tm,deserializeWorkflowJson:()=>UD,findNode:()=>Yf,findParent:()=>Ia,getDefaultOperatorForFieldType:()=>zD,getExpressionModelIssue:()=>fi,getOperatorsForFieldType:()=>gu,hasAnyTriggerGeneratingAction:()=>bu,isDayCountValid:()=>Uf,isExpressionModelComplete:()=>Ea,isOperatorCompatible:()=>WD,isTriggerGeneratingAction:()=>Xf,moveBranchItemInTree:()=>YD,operatorNeedsValue:()=>kn,processTriggerFormIdFromScope:()=>Of,processTriggerScopeFromScope:()=>Pf,removeElseIfInTree:()=>XD,removeNodeFromTree:()=>Zf,serializeToWorkflowJson:()=>BD,supportsClearForActionType:()=>cu,updateActionInTree:()=>yu,updateConditionInTree:()=>Mn,validateBusinessRule:()=>r2});var a2=I(()=>{"use strict";Tf();oD();Hf();Hf();rm();rm();jf();es();es();});var nm=v(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.cloneJson=void 0;function P9(e){return JSON.parse(JSON.stringify(e))}wu.cloneJson=P9});var g2=v(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.BUSINESS_RULE_NULL_GUID=Bn.businessRuleRegistration=Bn.BusinessRuleAdapter=void 0;var o2=ct(),ns=(a2(),mr(i2)),s2=rr(),l2=re(),O9=nm(),Tr=_r(),R9=Ic(),F9=ct();function x9(e){return p2((0,O9.cloneJson)(e))}function p2(e){var t,r;let n=i=>(i??[]).map(a=>L9(a)?p2(a):a);return{...e,logic:(t=e.logic)!==null&&t!==void 0?t:"AND",clauses:(r=e.clauses)!==null&&r!==void 0?r:[],trueBranch:n(e.trueBranch),falseBranch:n(e.falseBranch)}}function L9(e){return Object.prototype.hasOwnProperty.call(e,"type")?!1:Object.prototype.hasOwnProperty.call(e,"clauses")||Object.prototype.hasOwnProperty.call(e,"trueBranch")||Object.prototype.hasOwnProperty.call(e,"falseBranch")||Object.prototype.hasOwnProperty.call(e,"logic")}function k9(e){var t;if(e===null||typeof e!="object"||Array.isArray(e))throw new l2.ValidationError("businessRule","(new)","/rootCondition",`rootCondition must be a condition object or null, got ${Array.isArray(e)?"array":typeof e}`);if(Object.prototype.hasOwnProperty.call(e,"type"))throw new l2.ValidationError("businessRule",(t=e.id)!==null&&t!==void 0?t:"(new)","/rootCondition","rootCondition looks like an ACTION (it carries 'type'), but it must be a condition. Wrap the action in a condition's trueBranch instead \u2014 a bare action would compile to an empty rule that saves successfully and does nothing.");return e}var M9="00000000-0000-0000-0000-000000000000";Bn.BUSINESS_RULE_NULL_GUID=M9;var B9=new Set(["Recommendation","LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]),U9=["ruleId","name","description","entityLogicalName","scope","status","rootCondition"],$9=["kind","id","displayName","logic","clauses","trueBranch","falseBranch"],q9=["id","field","fieldDisplayName","operator","valueType","value","valueField","lookupValue","expression","rawExpression","valueWorkflowType"];function ur(e,t){return e===void 0?t:{...e,...t}}var mi=["kind","id","type","displayName","field","stepName","stepLabels"],u2=["valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression"],V9={Recommendation:[...mi,"recommendationTitle","messageText","acceptanceText","applyActions","recommendationActionStepMeta"],LockUnlock:[...mi,"lock"],ShowErrorMessage:[...mi,"errorMessage","messageLevel","messageActionSteps"],SetFieldValue:[...mi,...u2],SetDefaultValue:[...mi,...u2],SetBusinessRequired:[...mi,"required"],SetVisibility:[...mi,"visible"]};function j(e,t){return t===void 0?{}:{[e]:t}}function f2(e){var t;return e===void 0?void 0:{...e,label:(t=e.label)!==null&&t!==void 0?t:""}}function im(e){return{valueType:e.valueType,...j("valueWorkflowType",e.valueWorkflowType),...j("value",e.value),...j("valueField",e.valueField),...j("lookupValue",f2(e.lookupValue)),...j("expression",e.expression),...j("rawExpression",e.rawExpression)}}function m2(e,t){let r=new Set(t),n={};for(let[i,a]of Object.entries(e))r.has(i)||a!==void 0&&(n[i]=a);return Object.keys(n).length>0?n:void 0}var G9=["id","field","valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression","stepName","displayName"];function z9(e){return ur(e.bag,{id:e.id,field:e.field,...im(e),...j("stepName",e.stepName),...j("displayName",e.displayName)})}function W9(e){let t=m2(e,G9);return{id:e.id,field:e.field,valueType:e.valueType,...j("valueWorkflowType",e.valueWorkflowType),...j("value",e.value),...j("valueField",e.valueField),...j("lookupValue",e.lookupValue),...j("expression",e.expression),...j("rawExpression",e.rawExpression),...j("stepName",e.stepName),...j("displayName",e.displayName),...j("bag",t)}}function c2(e){return{valueType:e.valueType,...j("valueWorkflowType",e.valueWorkflowType),...j("value",e.value),...j("valueField",e.valueField),...j("lookupValue",e.lookupValue),...j("expression",e.expression),...j("rawExpression",e.rawExpression)}}function d2(e){throw new Error(`Unsupported business-rule action type: ${e.type}`)}var H9=new Set(["INVALID_CLEAR_FOR_FIELD","INVALID_VALUE_TYPE_FOR_FIELD","CLAUSE_VALUE_TOO_LONG","ACTION_VALUE_TOO_LONG"]),j9=new Set,J9="INVALID_CLEAR_FOR_FIELD";function Q9(e){let t=n=>{var i;return(0,Tr.isJsonObject)(n)&&(n.label===""||n.label===void 0)?{...n,label:String((i=n.id)!==null&&i!==void 0?i:"")}:n},r=n=>{if(!(0,Tr.isJsonObject)(n))return n;let i={...n};"lookupValue"in i&&(i.lookupValue=t(i.lookupValue)),Array.isArray(i.applyActions)&&(i.applyActions=i.applyActions.map(r));for(let a of["clauses","trueBranch","falseBranch"])Array.isArray(i[a])&&(i[a]=i[a].map(r));return i};return r(e)}var Au=class{toArtifact(t){let r=this.residualBag(t,U9),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){let r=t.rootCondition?this.conditionFromJson(t.rootCondition):null;return ur(t.bag,{ruleId:t.id,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:r})}fromApiResponse(t){var r;let n=t??{},i={...(r=n.Entity)!==null&&r!==void 0?r:{},wfomJson:n.WfomJson},a=(0,ns.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,ns.serializeToWorkflowJson)(n),a=(r=n.ruleId)!==null&&r!==void 0?r:(0,o2.newId)();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:t.rootCondition===void 0?(0,ns.createEmptyCondition)():t.rootCondition===null?null:this.conditionFromJson(x9(k9(t.rootCondition)))},u=this.toArtifact(l);return u.id||(u.id=(0,o2.newId)()),u}assignMissingIds(t){return(0,F9.assignMissingIds)(t)}validate(t){let r=[],n=t.rootCondition;return n==null?r:(0,Tr.isJsonObject)(n)?(h2(n,"/rootCondition",r),r):(r.push((0,Tr.issue)("/rootCondition","condition-must-be-object",`rootCondition must be a JSON object or null, got ${typeof n}`)),r)}semanticIssues(t,r=[]){let n;try{n=this.fromArtifact(t)}catch(o){return[(0,Tr.issue)("/rootCondition","rule-not-representable",o instanceof Error?o.message:String(o))]}let i=n.rootCondition===null?null:Q9(n.rootCondition),a;return r.length===0?a=H9:r.some(o=>o.requiredLevel!==void 0)?a=j9:a=new Set([J9]),(0,ns.validateBusinessRule)(i,r).filter(o=>!a.has(o.kind)).map(o=>(0,Tr.issue)(`/rootCondition (${o.nodeId})`,`business-rule-${o.kind}`,o.message))}issuesBlockingPush(t,r=[],n){return this.semanticIssues(t,r)}residualBag(t,r){return m2(t,r)}buildWorkflowEntity(t,r){return(0,ns.buildWorkflowEntity)(t,r)}conditionToJson(t){let r=this.residualBag(t,$9),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){let r=this.residualBag(t,q9),n={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}:{},...t.lookupValue!==void 0?{lookupValue:t.lookupValue}:{},...t.expression!==void 0?{expression:t.expression}:{},...t.rawExpression!==void 0?{rawExpression:t.rawExpression}:{},...t.valueWorkflowType!==void 0?{valueWorkflowType:t.valueWorkflowType}:{}};return r&&(n.bag=r),n}branchItemToJson(t){return t.kind==="condition"?this.conditionToJson(t):this.actionToJson(t)}actionToJson(t){let r=this.residualBag(t,V9[t.type]),n={kind:"action",id:t.id,displayName:t.displayName,field:t.field,...j("stepName",t.stepName),...j("stepLabels",t.stepLabels),...j("bag",r)};switch(t.type){case"Recommendation":return{...n,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...j("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(W9),...j("recommendationActionStepMeta",t.recommendationActionStepMeta)};case"LockUnlock":return{...n,type:"LockUnlock",lock:t.lock};case"ShowErrorMessage":return{...n,type:"ShowErrorMessage",errorMessage:t.errorMessage,...j("messageLevel",t.messageLevel),...j("messageActionSteps",t.messageActionSteps)};case"SetFieldValue":return{...n,type:"SetFieldValue",...c2(t)};case"SetDefaultValue":return{...n,type:"SetDefaultValue",...c2(t)};case"SetBusinessRequired":return{...n,type:"SetBusinessRequired",required:t.required};case"SetVisibility":return{...n,type:"SetVisibility",visible:t.visible};default:return d2(t)}}conditionFromJson(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:{};return ur(n,{kind:"condition",isCollapsed:typeof n.isCollapsed=="boolean"?n.isCollapsed:!1,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 ur(t.bag,{id:t.id,field:t.field,fieldDisplayName:(r=t.fieldDisplayName)!==null&&r!==void 0?r:t.field,operator:t.operator,valueType:t.valueType,...j("value",t.value),...j("valueField",t.valueField),...j("lookupValue",f2(t.lookupValue)),...j("expression",t.expression),...j("rawExpression",t.rawExpression),...j("valueWorkflowType",t.valueWorkflowType)})}branchItemFromJson(t){return this.isConditionJson(t)?this.conditionFromJson(t):this.actionFromJson(t)}actionFromJson(t){if(!B9.has(t.type))throw new Error(`Unsupported business-rule action type: ${t.type}`);X9(t);let r={kind:"action",id:t.id,displayName:t.displayName,field:t.field,...j("stepName",t.stepName),...j("stepLabels",t.stepLabels)};switch(t.type){case"Recommendation":return ur(t.bag,{...r,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...j("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(z9),...j("recommendationActionStepMeta",t.recommendationActionStepMeta)});case"LockUnlock":return ur(t.bag,{...r,type:"LockUnlock",lock:t.lock});case"ShowErrorMessage":return ur(t.bag,{...r,type:"ShowErrorMessage",errorMessage:t.errorMessage,...j("messageLevel",t.messageLevel),...j("messageActionSteps",t.messageActionSteps)});case"SetFieldValue":return ur(t.bag,{...r,type:"SetFieldValue",...im(t)});case"SetDefaultValue":return ur(t.bag,{...r,type:"SetDefaultValue",...im(t)});case"SetBusinessRequired":return ur(t.bag,{...r,type:"SetBusinessRequired",required:t.required});case"SetVisibility":return ur(t.bag,{...r,type:"SetVisibility",visible:t.visible});default:return d2(t)}}isConditionJson(t){return Object.prototype.hasOwnProperty.call(t,"clauses")&&Object.prototype.hasOwnProperty.call(t,"logic")&&!Object.prototype.hasOwnProperty.call(t,"type")}};Bn.BusinessRuleAdapter=Au;function h2(e,t,r){(0,Tr.optionalEnum)(e,"logic",["AND","OR"],t,"condition-logic-invalid",r),(0,Tr.childObjects)(e,"clauses",t,"clause",r);for(let n of["trueBranch","falseBranch"])(0,Tr.childObjects)(e,n,t,"branchItem",r).forEach(({node:a,index:o})=>{"clauses"in a||"trueBranch"in a||"falseBranch"in a?h2(a,`${t}/${n}/${o}`,r):K9(a,`${t}/${n}/${o}`,r)})}function K9(e,t,r){e.type==="SetDefaultValue"&&e.valueType==="Clear"&&r.push((0,Tr.issue)(`${t}/valueType`,"clear-only-set-field-value","Clear is only supported for SetFieldValue actions."))}function X9(e){if(e.type==="SetDefaultValue"&&e.valueType==="Clear")throw new Error("Clear is only supported for SetFieldValue actions.")}function Y9(){return{adapter:new Au,api:R9.businessRuleApi,publish:(e,t,r)=>(0,s2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,s2.boundEntityPublishScope)(t)}}Bn.businessRuleRegistration=Y9});var R2=v(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.appRegistration=Un.AppAdapter=Un.HEADER_NAV_BOOLEAN_RULE=void 0;var tn=_r(),We=bn(),as=Qn(),Z9=rr(),e8=sl(),am=rl(),om=An(),t8=ct(),r8=ie(),D2=Ei(),I2=re(),_2=il();Object.defineProperty(Un,"HEADER_NAV_BOOLEAN_RULE",{enumerable:!0,get:function(){return _2.HEADER_NAV_BOOLEAN_RULE}});var Nu="7.0.0.0",v2=`<SiteMap IntroducedVersion="${Nu}"></SiteMap>`,y2="/_imgs/imagestrips/transparent_spacer.gif",b2="/_imgs/TableIconsFluentV9/document_one_page_sparkle.svg",n8=["Entity","Url","DefaultDashboard","Page","GenPageId"],is="sitemapId",w2="sitemapName",i8="sitemapNameUnique",A2="aiDescription",C2="[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}",a8=new RegExp(`^(?:\\{${C2}\\}|${C2})$`);function S2(e,t){if(!a8.test(e.trim()))throw new I2.ValidationError("app",t,[{pointer:"/sitemapId",rule:"app-sitemapid-guid",message:`sitemapId must be a GUID; received '${e}'.`}]);return e.trim()}function E2(e,t,r){if(e===void 0)return r;if(typeof e!="boolean")throw new I2.ValidationError("app",t,[T2(e)]);return e}function T2(e){return(0,tn.issue)("/headerAndNavigationRefresh",_2.HEADER_NAV_BOOLEAN_RULE,`headerAndNavigationRefresh must be a boolean, got ${typeof e}`)}function o8(e){let t=n=>{let i=e[n];return typeof i=="string"&&i.trim()!==""?i.trim():void 0},r=n=>{let i=t(n);if(i!==void 0)try{return(0,r8.normalizeGuid)(i,n)}catch{return}};switch(e.type){case"Entity":return t("entity")&&`Entity:${t("entity").toLowerCase()}`;case"URL":return t("url")&&`URL:${t("url").toLowerCase()}`;case"DashBoard":return r("dashboardId")&&`DashBoard:${r("dashboardId")}`;case"CustomPage":return t("page")&&`CustomPage:${t("page").toLowerCase()}`;case"GenPage":return r("genPageId")&&`GenPage:${r("genPageId")}`;default:return}}var Du=class{constructor(t=D2.DEFAULT_LCID){this.lcid=t}toArtifact(t){let{bag:r,modeledEls:n}=Cu(t,"Area");return{id:"",name:"",uniqueName:"",description:"",siteMap:{areas:n.map(i=>this.areaToJson(i)),bag:r},bag:(0,We.emptyBag)()}}fromArtifact(t){(0,om.installDomShim)();let r=this.assignMissingIds(JSON.parse(JSON.stringify(t))),n=new DOMParser().parseFromString("<root/>","text/xml"),i=this.rootToRaw(r);return(0,We.rebuildRaw)(i,(0,as.domEngine)(n),null)}fromApiResponse(t){var r,n,i,a,o,s,l,u,c,d,p;(0,om.installDomShim)();let f=t??{},h=(r=f.$sitemap)!==null&&r!==void 0?r:f,g=(0,as.parseXmlRoot)((n=h.sitemapxml)!==null&&n!==void 0?n:v2,v2),w=this.toArtifact(g);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:"",f.aiappdescription&&(w.aiDescription=f.aiappdescription),w.bag={a:[[is,(u=(l=h.sitemapid)!==null&&l!==void 0?l:f._sitemapid_value)!==null&&u!==void 0?u:""],[w2,(c=h.sitemapname)!==null&&c!==void 0?c:""],[i8,(d=h.sitemapnameunique)!==null&&d!==void 0?d:""],[A2,(p=f.aiappdescription)!==null&&p!==void 0?p:""]],c:[]},w}toApiPayload(t){var r,n,i,a,o,s,l,u,c,d,p,f,h,g;(0,om.installDomShim)();let w=(0,as.serializeNode)(this.fromArtifact(t)),S=[],D=[];for(let F of(n=(r=t.siteMap)===null||r===void 0?void 0:r.areas)!==null&&n!==void 0?n:[])for(let G of(i=F.groups)!==null&&i!==void 0?i:[])for(let L of(a=G.subAreas)!==null&&a!==void 0?a:[])L.type==="Entity"&&L.entity?S.push(L.entity):L.type==="DashBoard"&&L.dashboardId&&D.push(L.dashboardId);let x=(o=t.bag)!==null&&o!==void 0?o:(0,We.emptyBag)();return{sitemapId:lm(x,is)||(t.sitemapId?S2(t.sitemapId,t.id):""),sitemapxml:w,sitemapname:lm(x,w2)||t.name,appModuleId:t.id,appModuleName:t.name,appModuleDescription:t.description,...t.aiDescription!==void 0&&t.aiDescription!==lm(x,A2)?{appModuleAiDescription:t.aiDescription}:{},appModuleUniqueName:t.uniqueName,...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},...t.headerAndNavigationRefresh===void 0?{}:{appSettings:{[am.HEADER_AND_NAVIGATION_REFRESH]:E2(t.headerAndNavigationRefresh,(s=t.id)!==null&&s!==void 0?s:"(unknown)",!0)?am.APP_SETTING_ON:am.APP_SETTING_OFF}},...typeof t.published=="boolean"?{published:t.published}:{},entities:S,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:(f=(p=t.components)===null||p===void 0?void 0:p.charts)!==null&&f!==void 0?f:[],dashboards:[...(g=(h=t.components)===null||h===void 0?void 0:h.dashboards)!==null&&g!==void 0?g:[],...D]}}}createDefault(t){var r,n,i,a,o,s;let l=!((r=t.siteMap)===null||r===void 0)&&r.areas&&t.siteMap.areas.length>0?t.siteMap.areas:[{id:"",title:"Area",groups:[{id:"",title:"Group",subAreas:[]}]}],u=(n=t.id)!==null&&n!==void 0?n:(0,t8.newId)();return{id:u,name:(i=t.name)!==null&&i!==void 0?i:"New App",uniqueName:(a=t.uniqueName)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",...t.aiDescription?{aiDescription:t.aiDescription}:{},siteMap:{areas:l},...t.sitemapId?{sitemapId:S2(t.sitemapId,u)}:{},...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},headerAndNavigationRefresh:E2(t.headerAndNavigationRefresh,(s=t.id)!==null&&s!==void 0?s:"(new)",!0),...typeof t.published=="boolean"?{published:t.published}:{},...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(cm):Array.isArray(r.areas)?r.areas.forEach(cm):Array.isArray(r.groups)?cm(r):Array.isArray(r.subAreas)?O2(r):"type"in r&&Iu(r,"subarea"),t}validate(t){let r=[],n=t.published;n!==void 0&&typeof n!="boolean"&&r.push((0,tn.issue)("/published","published-must-be-boolean",`published must be a boolean, got ${typeof n}`));let i=t.siteMap,a=t.headerAndNavigationRefresh;if(a!==void 0&&typeof a!="boolean"&&r.push(T2(a)),i==null)return r;if(!(0,tn.isJsonObject)(i))return r.push((0,tn.issue)("/siteMap","sitemap-must-be-object",`siteMap must be a JSON object, got ${typeof i}`)),r;let o=(0,tn.childObjects)(i,"areas","/siteMap","area",r),s=new Map;return o.forEach(({node:l,index:u})=>{let c=`/siteMap/areas/${u}`;(0,tn.childObjects)(l,"groups",c,"group",r).forEach(({node:p,index:f})=>{let h=`${c}/groups/${f}`;(0,tn.childObjects)(p,"subAreas",h,"subArea",r).forEach(({node:w,index:S})=>{let D=`${h}/subAreas/${S}`;(0,tn.optionalEnum)(w,"type",["Entity","URL","DashBoard","CustomPage","GenPage"],D,"subarea-type-invalid",r);let x=o8(w);if(!x)return;let F=s.get(x);if(F===void 0){s.set(x,D);return}r.push((0,tn.issue)(D,"subarea-duplicate-target",`the sitemap already navigates to this target at ${F}; a duplicate SubArea would pin it twice and a single removeElement would leave one behind`))})})}),r}applyServerIdentity(t,r){let n=r[is];if(!n)return;t.bag||(t.bag=(0,We.emptyBag)());let i=t.bag.a.find(a=>a[0]===is);i?i[1]=n:t.bag.a.push([is,n])}areaToJson(t){var r;let{bag:n,modeledEls:i}=Cu(t,"Group"),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:sm(t,this.lcid),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}=Cu(t,"SubArea");return{id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:sm(t,this.lcid),subAreas:i.map(a=>this.subAreaToJson(a)),bag:n}}subAreaToJson(t){var r;let{bag:n}=Cu(t,null),i=s8(t),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",type:i,title:sm(t,this.lcid),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!==y2&&(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,We.emptyBag)(),l=Su(o)?[["IntroducedVersion",Nu]]:[],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,We.mergeAttrs)(o.a,l),c:(0,We.spliceChildren)(o.c,u)}}areaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,We.emptyBag)(),i=Su(n),a=[],o=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ShowGroups","true"],["ResourceId","SitemapDesigner.NewTitle"],["DescriptionResourceId","SitemapDesigner.NewTitle"],["IntroducedVersion",Nu]),t.icon!==void 0?a.push(["Icon",t.icon]):Eu(n.a,"Icon")&&o.push("Icon"),t.vectorIcon!==void 0?a.push(["VectorIcon",t.vectorIcon]):Eu(n.a,"VectorIcon")&&o.push("VectorIcon");let s=t.groups.map(u=>this.groupToRaw(u)),l=um((0,We.spliceChildren)(n.c,s),t.title,i,this.lcid);return{n:"Area",a:(0,We.mergeAttrs)(n.a,a,o),c:l}}groupToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,We.emptyBag)(),i=Su(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ResourceId","SitemapDesigner.NewGroup"],["DescriptionResourceId","SitemapDesigner.NewGroup"],["ToolTipResourseId","SitemapDesigner.Unknown"],["IntroducedVersion",Nu],["IsProfile","false"]);let o=t.subAreas.map(l=>this.subAreaToRaw(l)),s=um((0,We.spliceChildren)(n.c,o),t.title,i,this.lcid);return{n:"Group",a:(0,We.mergeAttrs)(n.a,a),c:s}}subAreaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,We.emptyBag)(),i=Su(n),a=u8(n.a,t.type),o=[],s=[];t.id&&o.push(["Id",t.id]),d8(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]):Eu(a,"Icon",y2)&&s.push("Icon"),t.vectorIcon!==void 0?o.push(["VectorIcon",t.vectorIcon]):Eu(a,"VectorIcon")?t.type==="GenPage"?o.push(["VectorIcon",b2]):s.push("VectorIcon"):t.type==="GenPage"&&!l8(a,"VectorIcon")&&o.push(["VectorIcon",b2]);let l=um((0,We.spliceChildren)(n.c,[]),t.title,i,this.lcid);return{n:"SubArea",a:(0,We.mergeAttrs)(a,o,s),c:l}}};Un.AppAdapter=Du;function Cu(e,t){let r=(0,as.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,We.rawFromNode)((0,as.nodeLikeFromDom)(l))}),o+=1)}return{bag:{a:r,c:n},modeledEls:i}}function N2(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 sm(e,t){var r;let n=N2(e,"Titles")[0];if(!n)return"";let a=N2(n,"Title").find(o=>o.getAttribute("LCID")===String(t));return a&&(r=a.getAttribute("Title"))!==null&&r!==void 0?r:""}function s8(e){return e.getAttribute("GenPageId")?"GenPage":e.getAttribute("Entity")?"Entity":e.getAttribute("Page")?"CustomPage":e.getAttribute("DefaultDashboard")?"DashBoard":"URL"}function Su(e){return e.a.length===0&&e.c.length===0}function l8(e,t){return e.some(([r])=>r===t)}function Eu(e,t,r){let n=e.find(([a])=>a===t),i=n?.[1];return!!i&&i!==r}function lm(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function u8(e,t){let r=c8(t);return e.filter(([n])=>!n8.includes(n)||r.has(n)).map(n=>[n[0],n[1]])}function c8(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 d8(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 um(e,t,r,n){if(!t)return e;let i=e.findIndex(a=>a.n==="Titles");if(i>=0){let a=e.slice();return a[i]=p8(e[i],t,n),a}return r?[f8(t,n),...e]:e}function p8(e,t,r){let n=!1,i=e.c.map(a=>!n&&a.n==="Title"&&m8(a,"LCID")===String(r)?(n=!0,{n:a.n,a:(0,We.mergeAttrs)(a.a,[["Title",t]]),c:a.c}):a);return n||i.unshift(P2(t,r)),{n:e.n,a:e.a.map(a=>[a[0],a[1]]),c:i}}function f8(e,t){return{n:"Titles",a:[],c:[P2(e,t)]}}function P2(e,t){return{n:"Title",a:[["LCID",String(t)],["Title",e]],c:[]}}function m8(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function h8(e){let t="0123456789abcdef",r="";for(let n=0;n<e;n+=1)r+=t[Math.floor(Math.random()*t.length)];return r}function Iu(e,t){e&&(typeof e.id!="string"||e.id.length===0)&&(e.id=`${t}_${h8(8)}`)}function cm(e){var t;Iu(e,"area");for(let r of(t=e.groups)!==null&&t!==void 0?t:[])O2(r)}function O2(e){var t;Iu(e,"group");for(let r of(t=e.subAreas)!==null&&t!==void 0?t:[])Iu(r,"subarea")}function g8(e=D2.DEFAULT_LCID){return{adapter:new Du(e),api:e8.appApi,languageSensitive:!0,publish:(t,r)=>(0,Z9.publishAppModule)(t,r),publishScope:t=>({envelope:"appmodule",targetIds:[t]})}}Un.appRegistration=g8});var F2={};Ur(F2,{ActionType:()=>pm,AppActionOrigin:()=>wm,AppActionVisibilityType:()=>bm,ButtonType:()=>mm,CannotUpdateAppActionColumns:()=>v8,Context:()=>gm,IconType:()=>fm,Location:()=>hm,OnClickEventType:()=>ym,Scope:()=>vm,VisibilityType:()=>dm});var dm,pm,fm,mm,hm,gm,vm,ym,bm,wm,v8,x2=I(()=>{"use strict";(function(e){e[e.NotSupported=0]="NotSupported",e[e.Show=1]="Show",e[e.ClassicRules=2]="ClassicRules",e[e.Expression=3]="Expression"})(dm||(dm={}));(function(e){e[e.NotSupported=0]="NotSupported",e[e.None=1]="None",e[e.JavaScript=2]="JavaScript",e[e.Expression=3]="Expression"})(pm||(pm={}));(function(e){e[e.NoIcon=0]="NoIcon",e[e.UseIcon=1]="UseIcon",e[e.UseWebResource=2]="UseWebResource"})(fm||(fm={}));(function(e){e[e.Standard=0]="Standard",e[e.Dropdown=1]="Dropdown",e[e.Split=2]="Split",e[e.Group=3]="Group"})(mm||(mm={}));(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"})(hm||(hm={}));(function(e){e[e.All=0]="All",e[e.Entity=1]="Entity"})(gm||(gm={}));(function(e){e[e.App=0]="App",e[e.Entity=1]="Entity",e[e.Global=2]="Global"})(vm||(vm={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.JavaScript=2]="JavaScript"})(ym||(ym={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.ClassicRules=2]="ClassicRules"})(bm||(bm={}));(function(e){e[e.Default=0]="Default",e[e.Migrated=1]="Migrated",e[e.MigratedClone=2]="MigratedClone"})(wm||(wm={}));v8=["appactionid","appmoduleid","context","contextvalue","location","name","type","uniquename","isdisabled","origin"]});var B2=v(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.commandApi=void 0;var L2=$t(),cr=be(),M2=re(),Qt=ie(),y8="OnClickEventJavaScriptWebResourceId($select=name,webresourceid),IconWebResourceId($select=name,webresourceid)";async function _u(e,t){let r=`/EntityDefinitions(LogicalName='${(0,Qt.odataPathLiteral)(t)}')${(0,Qt.odataQuery)([["$select","MetadataId"]])}`,i=(0,cr.ensureSuccess)(await e.get(r),e.apiUrl(r)).body,a=i?.MetadataId;return a?(0,Qt.normalizeGuid)(a,"entityMetadataId"):""}Tu.commandApi={async get(e,t){let r=t,n=await _u(e,r),i=n?`_contextentity_value eq ${n}`:`contextvalue eq '${(0,Qt.odataLiteral)(r)}'`,a=`/appactions${(0,Qt.odataQuery)([["$expand",y8],["$filter",i]])}`,o,s=await(0,L2.collectPages)(e,a,"fetchArtifact('command')",c=>{o=c}),l={entityLogicalName:r,entityMetadataId:n,appActions:s},u={};for(let c of s){let d=typeof c.appactionid=="string"?c.appactionid:void 0;if(d){let p=c["@odata.etag"];u[(0,Qt.normalizeGuid)(d,"appactionid")]=typeof p=="string"?p:null}}return{raw:l,etag:o?(0,cr.readEtag)(o):null,memberEtags:u}},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 _u(e,r.entityLogicalName);return k2(e,{...r,entityMetadataId:n},!1)},async update(e,t,r,n,i){let a=r,o=a.entityMetadataId||await _u(e,a.entityLogicalName);return k2(e,{...a,entityMetadataId:o},!0,i)},async delete(e,t){let r=await _u(e,t),n=r?`_contextentity_value eq ${r}`:`contextvalue eq '${(0,Qt.odataLiteral)(t)}'`,i=`/appactions${(0,Qt.odataQuery)([["$select","appactionid"],["$filter",n]])}`,a=await(0,L2.collectPages)(e,i,"deleteArtifact('command')");for(let o of a)o.appactionid&&await(0,cr.deleteRecord)(e,"appactions",o.appactionid)}};async function k2(e,t,r,n){let i=t.entityMetadataId?(0,Qt.normalizeGuid)(t.entityMetadataId,"entityMetadataId"):"",a=w8(t.rows),o={};try{await b8(e,t,a,i,r,n,o)}catch(s){throw(0,M2.withPartialTokens)(s,{memberEtags:o})}return{id:t.entityLogicalName,etag:null,memberEtags:o}}async function b8(e,t,r,n,i,a,o){var s,l,u;for(let c of r)if(i&&c.exists){let d=(0,Qt.normalizeGuid)(c.appactionid,"id"),p=(s=a?.[d])!==null&&s!==void 0?s:c.etag,f=(0,cr.echoWrite)("appactionid",p?{"If-Match":p}:void 0),h=`/appactions(${d})${f.query}`,g=(0,cr.ensureSuccess)(await e.patch(h,c.body,f.options),e.apiUrl(h));o[d]=(0,cr.readEtag)(g)}else{let d=(0,cr.echoWrite)("appactionid"),p=`/appactions${d.query}`,f={...c.body};if(f["[email protected]"]===void 0){if(!n)throw new M2.SdkError("COMMAND_CONTEXT_ENTITY_UNRESOLVED",`Cannot create app action '${c.appactionid}' for entity '${t.entityLogicalName}': the entity MetadataId could not be resolved, so the required ContextEntity bind cannot be set. A row written without it is created but is permanently unreadable \u2014 commandApi.get filters on _contextentity_value. Verify the entity logical name exists and is readable, then retry.`);f["[email protected]"]=`/entities(${n})`}let h=(0,cr.ensureSuccess)(await e.post(p,f,d.options),e.apiUrl(p)),g=(0,cr.readCreatedId)(h,"appactionid");g&&(o[(0,Qt.normalizeGuid)(g,"appactionid")]=(0,cr.readEtag)(h))}for(let c of[...(l=t.deletedRowIds)!==null&&l!==void 0?l:[]].reverse()){let d=(0,Qt.normalizeGuid)(c,"id");await(0,cr.deleteRecord)(e,"appactions",d,(u=a?.[d])!==null&&u!==void 0?u:void 0),delete o[d]}}function w8(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 Z2=v(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.commandRegistration=_a.CommandAdapter=void 0;var Be=(x2(),mr(F2)),U2=rr(),Kt=_r(),A8=B2(),q2=ct(),Ta=ie(),Cm="$ClientSvg:",Sm=".svg",C8=2,S8=1,E8=1,V2="entityMetadataId",N8=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"]),Pu=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 f of l){let h=typeof f._parentappactionid_value=="string"&&f._parentappactionid_value?f._parentappactionid_value:"",g=(i=c.get(h))!==null&&i!==void 0?i:[];g.push(f),c.set(h,g)}let d=new Map;for(let f of(a=c.get(""))!==null&&a!==void 0?a:[]){let h=P8(f.location),g=(o=d.get(h))!==null&&o!==void 0?o:[];g.push(f),d.set(h,g)}let p=[];for(let[f,h]of d)p.push({location:f,groups:I8(h,c,j2(f),u)});return{id:u,entityLogicalName:u,commandBars:T8(p),bag:{a:[[V2,(s=t.entityMetadataId)!==null&&s!==void 0?s:""]]}}}fromArtifact(t){return{entityLogicalName:t.entityLogicalName,entityMetadataId:Nm(t),appActions:Am(t).map(r=>r.row)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t,r){let n=new Set(r?Am(r).map(l=>l.appactionid):[]),i=Am(t,new Set([...n].map(l=>l.toLowerCase()))),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?V8(l.row):Y2(l.row)}}),s=[...n].filter(l=>!a.has(l));return{entityLogicalName:t.entityLogicalName,entityMetadataId:Nm(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,q2.assignMissingIds)(t)}validate(t){let r=[];return(0,Kt.childObjects)(t,"commandBars","","commandBar",r).forEach(({node:i,index:a})=>{let o=`/commandBars/${a}`;(0,Kt.optionalEnum)(i,"location",["MainTab","ContextualTab","HomeTab"],o,"bar-location-invalid",r),(0,Kt.childObjects)(i,"groups",o,"group",r).forEach(({node:l,index:u})=>{let c=`${o}/groups/${u}`;(0,Kt.optionalGuidId)(l,"id",c,"group-id-invalid",r),G2((0,Kt.childObjects)(l,"controls",c,"control",r),`${c}/controls`,r)})}),r}};_a.CommandAdapter=Pu;function G2(e,t,r){e.forEach(({node:n,index:i})=>{let a=`${t}/${i}`;(0,Kt.optionalGuidId)(n,"id",a,"control-id-invalid",r),(0,Kt.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,Kt.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,Kt.isJsonObject)(n.action)?(0,Kt.optionalEnum)(n.action,"type",["javascript"],`${a}/action`,"action-type-invalid",r):r.push((0,Kt.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,Kt.childObjects)(n,"children",a,"control",r);s.length>0&&G2(s,`${a}/children`,r)})}function z2(e){return{a:Object.entries(e)}}function D8(e){return Object.fromEntries(e.a)}function Em(e,t){if(e){for(let[r,n]of e.a)if(r===t)return n}}function Nm(e){let t=Em(e.bag,V2);return typeof t=="string"?t:""}function I8(e,t,r,n){var i,a;let o=[],s=[];for(let l of Ru(e))l.type===Be.ButtonType.Group?o.push({id:H2(l.name,n),title:typeof l.grouptitle=="string"?l.grouptitle:"",controls:Ru((a=t.get((i=l.appactionid)!==null&&i!==void 0?i:""))!==null&&a!==void 0?a:[]).map(u=>Ou(u,t,r,n)),bag:z2(l)}):s.push(Ou(l,t,r,n));return s.length>0&&o.unshift({id:(0,q2.newId)(),title:"",controls:s}),o}function Ou(e,t,r,n){var i,a,o,s;let l=H2(e.name,n),u={id:l,type:O8(e.type),label:typeof e.buttonlabeltext=="string"?e.buttonlabeltext:"",command:typeof e.appactionid=="string"?e.appactionid:l,bag:z2(e)},c=W2(e);c&&(u.icon=c);let d=_8(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 p=t.get((i=e.appactionid)!==null&&i!==void 0?i:"");if(p&&p.length>0){let f=[];for(let h of Ru(p))if(h.type===Be.ButtonType.Group){u.flyoutGroupId=(a=h.appactionid)!==null&&a!==void 0?a:void 0;for(let g of Ru((s=t.get((o=h.appactionid)!==null&&o!==void 0?o:""))!==null&&s!==void 0?s:[]))f.push(Ou(g,t,r,n))}else f.push(Ou(h,t,r,n));u.children=f}return u}function W2(e){var t;if(!((t=e.IconWebResourceId)===null||t===void 0)&&t.name)return e.IconWebResourceId.name;if(e.fonticon)return e.fonticon.startsWith(Cm)?e.fonticon.slice(Cm.length)+Sm:e.fonticon}function _8(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 $2(e){return typeof e.sequence=="number"?e.sequence:typeof e.buttonsequencepriority=="number"?e.buttonsequencepriority:0}function Ru(e){return[...e].sort((t,r)=>$2(t)-$2(r))}function T8(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 H2(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 P8(e){switch(e){case Be.Location.Form:case Be.Location.QuickForm:return"MainTab";case Be.Location.HomePageGrid:case Be.Location.Dashboard:return"HomeTab";default:return"ContextualTab"}}function j2(e){switch(e){case"MainTab":return Be.Location.Form;case"HomeTab":return Be.Location.HomePageGrid;default:return Be.Location.SubGridStandard}}function O8(e){switch(e){case Be.ButtonType.Dropdown:return"FlyoutAnchor";case Be.ButtonType.Split:return"SplitButton";default:return"Button"}}function R8(e){switch(e){case"FlyoutAnchor":return Be.ButtonType.Dropdown;case"SplitButton":return Be.ButtonType.Split;default:return Be.ButtonType.Standard}}function F8(e){var t;return e.bag&&e.bag.a.length>0?!0:((t=e.title)!==null&&t!==void 0?t:"").length>0}function J2(e,t){var r,n,i;return((n=(r=e.bag)===null||r===void 0?void 0:r.a.length)!==null&&n!==void 0?n:0)>0?!0:t.has(((i=e.id)!==null&&i!==void 0?i:"").toLowerCase())}function Am(e,t=new Set){var r,n,i,a;let o=[],s=Nm(e);for(let l of(r=e.commandBars)!==null&&r!==void 0?r:[]){let u=j2(l.location),c=((n=l.groups)!==null&&n!==void 0?n:[]).flatMap(f=>{var h;return(h=f.controls)!==null&&h!==void 0?h:[]}),d=c.length>0&&c.every(f=>!J2(f,t)),p=0;for(let f of(i=l.groups)!==null&&i!==void 0?i:[]){let h;if(F8(f)){let g=L8(f,u,void 0,e,s);o.push(g),h=g.appactionid}for(let g of(a=f.controls)!==null&&a!==void 0?a:[])Q2(g,u,h,e,s,o,d?p:void 0,t),p+=1}}return o}function Q2(e,t,r,n,i,a,o,s=new Set){var l;let u=x8(e,t,r,n,i,o);a.push(u);let c=(l=e.children)!==null&&l!==void 0?l:[];if(c.length===0)return;let d=e.flyoutGroupId||q8(u.appactionid);a.push(k8(d,t,u.appactionid,n,i));let p=c.every(f=>!J2(f,s));for(let[f,h]of c.entries())Q2(h,t,d,n,i,a,p?f:void 0,s)}function x8(e,t,r,n,i,a){let o=K2(e,t,r,n,i),s=o.row;a!==void 0&&typeof s.sequence!="number"&&(s.sequence=a);let l=W2(s);return e.location!==void 0&&(s.location=e.location),s.type=R8(e.type),s.buttonlabeltext=e.label,M8(s,e.icon,l),U8(s,e.action),B8(s),e.hidden!==void 0&&(s.hidden=e.hidden),e.disabled!==void 0&&(s.isdisabled=e.disabled),{...o,row:s}}function L8(e,t,r,n,i){let a=K2(e,t,r,n,i);return a.row.type=Be.ButtonType.Group,a.row.grouptitle=e.title,a}function k8(e,t,r,n,i){let a=X2(e,t,n,i);return a["[email protected]"]=`/appactions(${(0,Ta.normalizeGuid)(r,"Command flyout group id")})`,a.type=Be.ButtonType.Group,a.grouptitle===void 0&&(a.grouptitle=""),a.isgrouptitlehidden=!0,{appactionid:e,exists:!1,etag:null,row:a}}function K2(e,t,r,n,i){let a,o,s,l;if(e.bag&&e.bag.a.length>0){a=D8(e.bag),o=!0;let u=Em(e.bag,"@odata.etag");s=typeof u=="string"?u:null;let c=Em(e.bag,"appactionid");l=typeof c=="string"&&c?c:e.id}else l=e.id,a=X2(l,t,n,i),o=!1,s=null;return r&&(a["[email protected]"]=`/appactions(${(0,Ta.normalizeGuid)(r,"Command parent appaction id")})`),{appactionid:l,exists:o,etag:s,row:a}}function X2(e,t,r,n){let i={appactionid:e,name:`${e}!${e.replace(/-/g,"").slice(0,32)}`,uniquename:"",location:t,context:Be.Context.Entity,contextvalue:r.entityLogicalName,scope:Be.Scope.Entity};return n&&(i["[email protected]"]=`/entities(${(0,Ta.normalizeGuid)(n,"Command context entity metadata id")})`),i}function M8(e,t,r){if(t===r){let n=e._iconwebresourceid_value;typeof n=="string"&&n&&!e.fonticon&&(e["[email protected]"]=`/webresourceset(${(0,Ta.normalizeGuid)(n,"Command icon web resource id")})`);return}if(t===void 0){e.fonticon="",e.IconWebResourceId=null;return}e.fonticon=t.toLowerCase().endsWith(Sm)?Cm+t.slice(0,t.length-Sm.length):t,e.IconWebResourceId=null}function B8(e){let t=(n,i)=>{let a=e[n];if(typeof a!="string"||a.length===0||e[`${i}@odata.bind`]!==void 0)return;let o=(0,Ta.normalizeGuid)(a,`Command ${i}`);e[`${i}@odata.bind`]=`/canvasapps(${o})`};e.onclickeventtype===S8&&t("_onclickeventformulacomponentlibraryid_value","OnClickEventFormulaComponentLibraryId");let r=e.visibilitytype;(!r||r===E8)&&t("_visibilityformulacomponentlibraryid_value","VisibilityFormulaComponentLibraryId")}function U8(e,t){if(!(!t||t.type!=="javascript")){if(e.onclickeventtype=C8,t.webResourceId){let r=(0,Ta.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 $8(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 q8(e){let t="";for(let r=0;r<4;r+=1)t+=$8(`${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 Y2(e){let t={...e};for(let r of N8)delete t[r];return t}function V8(e){let t=Y2(e);for(let r of Be.CannotUpdateAppActionColumns)delete t[r];return t}function G8(){return{adapter:new Pu,api:A8.commandApi,publish:(e,t,r)=>(0,U2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,U2.boundEntityPublishScope)(t)}}_a.commandRegistration=G8});var eI=v(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.chartApi=void 0;var z8=$t(),Xt=be(),os=ie(),W8="savedqueryvisualizationid,name,description,primaryentitytypecode,datadescription,presentationdescription,charttype,type,isdefault",H8="savedqueryvisualizationid,name,primaryentitytypecode,charttype,isdefault";Fu.chartApi={async get(e,t){let n=`/savedqueryvisualizations(${(0,os.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,os.odataQuery)([["$select",W8]]),i=(0,Xt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Xt.readEtag)(i)}},async list(e,t){let r=`/savedqueryvisualizations${(0,os.odataQuery)([["$select",H8],["$filter",t?.entityLogicalName?`primaryentitytypecode eq '${(0,os.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,z8.collectPages)(e,r,"listArtifacts('chart')")).map(i=>{var a,o;return{type:"chart",id:(a=i.savedqueryvisualizationid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",entityLogicalName:i.primaryentitytypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Xt.echoWrite)("savedqueryvisualizationid"),a=`/savedqueryvisualizations${i.query}`,o=(0,Xt.ensureSuccess)(await e.post(a,(0,Xt.withClientMintedId)({name:n.name,description:n.description,datadescription:n.datadescription,presentationdescription:n.presentationdescription,primaryentitytypecode:n.primaryentitytypecode,charttype:n.charttype,isdefault:n.isdefault},"savedqueryvisualizationid",r),i.options),e.apiUrl(a));return{id:(0,Xt.resolveCreatedId)(o,"savedqueryvisualizationid","chart",r),etag:(0,Xt.readEtag)(o)}},async update(e,t,r,n){let i=r,a=(0,os.normalizeGuid)(t,"id"),o=(0,Xt.echoWrite)("savedqueryvisualizationid",{"If-Match":(0,Xt.requireEtag)(n,"chart",a)}),s=`/savedqueryvisualizations(${a})${o.query}`,l=(0,Xt.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,datadescription:i.datadescription,presentationdescription:i.presentationdescription},o.options),e.apiUrl(s));return{id:a,etag:(0,Xt.readEtag)(l)}},delete(e,t){return(0,Xt.deleteRecord)(e,"savedqueryvisualizations",t)}}});var gI=v(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.chartRegistration=Pa.ChartAdapter=void 0;var Dm=bn(),tI=_r(),rn=Qn(),rI=rr(),j8=eI(),Im=An(),J8=ct(),Q8=["Column","StackedColumn","StackedColumn100","Bar","StackedBar","StackedBar100","Area","StackedArea","StackedArea100","Line","Pie","Doughnut","Funnel","Tag"],K8=new Map(Q8.map(e=>[e.toLowerCase(),e]));function oI(e){var t;return e&&(t=K8.get(e.toLowerCase()))!==null&&t!==void 0?t:"Column"}function X8(){return'<Chart Palette="BrightPastel"><Series><Series ChartType="Column" ChartArea="Default" /></Series><ChartAreas><ChartArea Name="Default" /></ChartAreas><Legends><Legend Name="Default" /></Legends></Chart>'}function Y8(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="${ss(u.series.attribute)}" aggregate="${ss(u.series.aggregate)}" />`).join("")+a.map(u=>`<attribute alias="${u.alias}" name="${ss(u.category.attribute)}" groupby="true"${u.category.dateGrouping?` dategrouping="${ss(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="${ss(n)}">${o}</entity></fetch></fetchcollection><categorycollection><category alias="${l}"><measurecollection>${s}</measurecollection></category></categorycollection></datadefinition>`}var xu=class{toArtifact(t){var r,n,i,a,o,s,l;(0,Im.installDomShim)();let u=(r=t.datadescription)!==null&&r!==void 0?r:"",c=(n=t.presentationdescription)!==null&&n!==void 0?n:"",d=(0,rn.parseXmlRoot)(u,"<datadefinition/>"),p=(0,rn.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:sI(p),isDefault:(l=t.isdefault)!==null&&l!==void 0?l:!1,series:cI(d),categories:dI(d),presentation:lI(p),dataBag:u?(0,rn.projectElementBag)(d):void 0,presentationBag:c?(0,rn.projectElementBag)(p):void 0,rowBag:Z8(t.charttype,t.type)}}fromArtifact(t){(0,Im.installDomShim)();let{datadescription:r,presentationdescription:n}=eG(t);return{savedqueryvisualizationid:t.id,name:t.name,description:t.description,primaryentitytypecode:t.entityLogicalName,datadescription:r,presentationdescription:n,charttype:nI(t.rowBag,"charttype"),type:nI(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,Im.installDomShim)();let u=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,J8.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,tI.childObjects)(n,"series","","series",r),(0,tI.childObjects)(n,"categories","","category",r),r}};Pa.ChartAdapter=xu;function Z8(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 nI(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 sI(e){let t=e.getElementsByTagName("Series");for(let r=0;r<t.length;r+=1)if(t[r].getAttribute("ChartType"))return oI(t[r].getAttribute("ChartType"));return"Column"}function lI(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 Lu(e){return e.getElementsByTagName("fetch")[0]}function uI(e){let t=new Map;if(!e)return t;let r=e.getElementsByTagName("link-entity");for(let n=0;n<r.length;n+=1){let i=r[n],a=i.getAttribute("name");if(!a)continue;let o=i.getElementsByTagName("attribute");for(let s=0;s<o.length;s+=1){let l=o[s],u=l.getAttribute("alias")||l.getAttribute("name");u&&t.set(u,a)}}return t}function cI(e){let t=Lu(e);if(!t)return[];let r=uI(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=oI(c));let d=o.getAttribute("alias");d&&(u.alias=d);let p=d??l,f=r.get(p);f&&(u.relatedEntity=f),i.push(u)}return i}function dI(e){var t;let r=Lu(e);if(!r)return[];let n=uI(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 p=d??l,f=n.get(p);f&&(u.relatedEntity=f),a.push(u)}return a}function eG(e){if(!iI(e.dataBag)||!iI(e.presentationBag))return{datadescription:Y8(e),presentationdescription:wG(e)};let t=new DOMParser().parseFromString("<root/>","text/xml"),r=aI(e.dataBag,"datadefinition",t),n=aI(e.presentationBag,"Chart",t);return _m(e.series,cI(r))||(rG(t,r,e.series),tG(t,n,e.series.length,e.chartType)),_m(e.categories,dI(r))||nG(t,r,e.categories),e.chartType!==sI(n)&&mI(n,e.chartType),_m(e.presentation,lI(n))||hI(n,e.presentation),{datadescription:(0,rn.serializeNode)(r),presentationdescription:(0,rn.serializeNode)(n)}}function iI(e){return!!e&&(e.c.length>0||e.a.length>0)}function tG(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 aI(e,t,r){let n={n:t,a:(0,Dm.mergeAttrs)(e.a,[]),c:(0,Dm.spliceChildren)(e.c,[])};return(0,Dm.rebuildRaw)(n,(0,rn.domEngine)(r),null)}function rG(e,t,r){let n=Lu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||pI(e,t,i,cG(n),r,pG,{aliasPrefix:"aggregate_column",addRef:oG,removeRef:uG})}function nG(e,t,r){let n=Lu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||pI(e,t,i,dG(n),r,fG,{aliasPrefix:"groupby_column",addRef:sG,removeRef:lG})}function pI(e,t,r,n,i,a,o){let s=new Map;for(let p of n){let f=p.getAttribute("alias");f&&s.set(f,p)}let l=new Set,u=[];for(let p of i){let f=p.alias?s.get(p.alias):void 0;f&&!l.has(f)?(a(f,p),l.add(f)):u.push(p)}let c=n.filter(p=>!l.has(p)),d=0;for(let p of u)if(d<c.length){let f=c[d];a(f,p),l.add(f),d+=1}else{let f=e.createElement("attribute"),h=p.alias||aG(t,o.aliasPrefix);f.setAttribute("alias",h),a(f,p),mG(e,r,f,p.relatedEntity),o.addRef(e,t,h)}for(let p of n)if(!l.has(p)){let f=p.getAttribute("alias");f&&o.removeRef(t,f),gG(p)}}function iG(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 aG(e,t){let r=iG(e);if(!r.has(t))return t;for(let n=2;;n+=1){let i=`${t}_${n}`;if(!r.has(i))return i}}function fI(e,t){let r=t.getElementsByTagName("categorycollection")[0];if(r)return r;let n=e.createElement("categorycollection");return t.appendChild(n),n}function oG(e,t,r){let n=fI(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 sG(e,t,r){let n=fI(e,t),i=e.createElement("category");i.setAttribute("alias",r),n.appendChild(i)}function lG(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 uG(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"&&!yG(o)&&((r=o.parentNode)===null||r===void 0||r.removeChild(o))}}function cG(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 dG(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 pG(e,t){e.setAttribute("name",t.attribute),e.setAttribute("aggregate",t.aggregate),t.seriesType&&e.setAttribute("charttype",t.seriesType)}function fG(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 mG(e,t,r,n){n?hG(e,t,n).appendChild(r):t.appendChild(r)}function hG(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 gG(e){let t=e.parentNode;if(t&&(t.removeChild(e),t.tagName==="link-entity"&&!vG(t))){let r=t.parentNode;r&&r.removeChild(t)}}function vG(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 yG(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1)if(t[r].nodeType===1)return!0;return!1}function mI(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(!bG(r[i])){r[i].setAttribute("ChartType",t);return}}}function bG(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 hI(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 wG(e){let t=(0,rn.parseXmlRoot)(X8(),"<Chart/>");return mI(t,e.chartType),hI(t,e.presentation),(0,rn.serializeNode)(t)}function _m(e,t){return JSON.stringify(e)===JSON.stringify(t)}function ss(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function AG(){return{adapter:new xu,api:j8.chartApi,publish:(e,t,r)=>(0,rI.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,rI.boundEntityPublishScope)(t)}}Pa.chartRegistration=AG});var vI=v(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.dashboardApi=void 0;var CG=$t(),Yt=be(),ls=ie(),SG="formid,name,description,formxml,type,objecttypecode,istabletenabled,iscustomizable,componentstate,versionnumber",EG="formid,name,type,objecttypecode",NG=0,DG=10;ku.dashboardApi={async get(e,t){let n=`/systemforms(${(0,ls.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,ls.odataQuery)([["$select",SG]]),i=(0,Yt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Yt.readEtag)(i)}},async list(e,t){let r=[`(type eq ${NG} or type eq ${DG})`];t?.entityLogicalName&&r.push(`objecttypecode eq '${(0,ls.odataLiteral)(t.entityLogicalName)}'`);let n=`/systemforms${(0,ls.odataQuery)([["$select",EG],["$filter",r.join(" and ")]])}`;return(await(0,CG.collectPages)(e,n,"listArtifacts('dashboard')")).map(a=>{var o,s;return{type:"dashboard",id:(o=a.formid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.objecttypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Yt.echoWrite)("formid"),a=`/systemforms${i.query}`,o={name:n.name,description:n.description,formxml:n.formxml,istabletenabled:n.istabletenabled,type:n.type};n.objecttypecode&&(o.objecttypecode=n.objecttypecode);let s=(0,Yt.ensureSuccess)(await e.post(a,(0,Yt.withClientMintedId)(o,"formid",r),i.options),e.apiUrl(a));return{id:(0,Yt.resolveCreatedId)(s,"formid","dashboard",r),etag:(0,Yt.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,ls.normalizeGuid)(t,"id"),o=(0,Yt.echoWrite)("formid",{"If-Match":(0,Yt.requireEtag)(n,"dashboard",a)}),s=`/systemforms(${a})${o.query}`,l=(0,Yt.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,formxml:i.formxml,istabletenabled:i.istabletenabled},o.options),e.apiUrl(s));return{id:a,etag:(0,Yt.readEtag)(l)}},delete(e,t){return(0,Yt.deleteRecord)(e,"systemforms",t)}}});var TI=v(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.dashboardRegistration=Pr.TILE_CLASS_ID=Pr.DashboardAdapter=void 0;var cs=bn(),Zt=Qn(),Tm=rr(),us=_r(),IG=vI(),Pm=An(),hi=ct(),SI=ie(),EI=Ei(),yI="0",Om="10",_G=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"]]),TG="{3FF9A528-DD50-4ACA-8F10-2E5ED73513AD}",Bu=class{constructor(t=EI.DEFAULT_LCID){this.lcid=t}toArtifact(t){var r,n,i,a;(0,Pm.installDomShim)();let o=(r=t.formxml)!==null&&r!==void 0?r:"",s=(0,Zt.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:PG(t.type),entityLogicalName:t.objecttypecode?t.objecttypecode:null,enabledForMobile:!!t.istabletenabled,layoutType:OG(s),components:bI(s,this.lcid),bag:(0,Zt.projectElementBag)(s)}}fromArtifact(t){var r;return(0,Pm.installDomShim)(),{formid:t.id,name:t.name,description:t.description,type:t.dashboardType==="Interactive"?Om:yI,objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",istabletenabled:t.enabledForMobile,formxml:wI(t,this.lcid)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){return{name:t.name,description:t.description,formxml:wI(t,this.lcid),istabletenabled:t.enabledForMobile,type:t.dashboardType==="Interactive"?Om:yI,objecttypecode:t.entityLogicalName}}createDefault(t){var r,n,i,a,o,s,l,u;(0,Pm.installDomShim)();let c=(0,Zt.parseXmlRoot)(zG(),"<form/>");return{id:(r=t.id)!==null&&r!==void 0?r:(0,hi.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:bI(c,this.lcid),bag:(0,Zt.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,hi.newId)())}return t}validate(t){let r=[],n=(0,us.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,us.isJsonObject)(u)&&r.push((0,us.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,us.isJsonObject)(a.position)){let l=ds(a.position);i.has(l)?r.push((0,us.issue)(`${s}/position`,"component-position-collision",`two components occupy the same dashboard position (${l}); move one to a free cell`)):i.add(l)}}),r}};Pr.DashboardAdapter=Bu;function PG(e){return String(e??"")===Om?"Interactive":"Standard"}function OG(e){let t=e?.getAttribute("formLayout")||e?.getAttribute("layoutType"),r=parseInt(t??"",10);return Number.isNaN(r)?0:r}function K(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 bI(e,t){let r=[];return K(e,"tabs").flatMap(i=>K(i,"tab")).forEach((i,a)=>{K(i,"columns").flatMap(s=>K(s,"column")).forEach((s,l)=>{K(s,"sections").flatMap(c=>K(c,"section")).forEach((c,d)=>{RG(c,{tabIndex:a,columnIndex:l,sectionIndex:d},r,t)})})}),r}function RG(e,t,r,n){K(e,"rows").flatMap(a=>K(a,"row")).forEach((a,o)=>{K(a,"cell").forEach((s,l)=>{let u=FG(s,{...t,rowIndex:o,cellIndex:l},n);u&&r.push(u)})})}function FG(e,t,r){var n,i;let a=II((n=e.getAttribute("id"))!==null&&n!==void 0?n:"");if(a.toLowerCase().startsWith("spacer"))return null;let o=K(e,"control")[0];if(!o)return null;let s=(i=o.getAttribute("classid"))!==null&&i!==void 0?i:"",l=kG(o),u=MG(s,l,o),c=xG(o);return{id:o.getAttribute("id")||a,type:u,name:DI(e,r),classId:s,position:t,colspan:Rm(e,"colspan",1),rowspan:Rm(e,"rowspan",1),parameters:l,bag:(0,Zt.projectElementBag)(e),...c?{icProperties:c}:{}}}function NI(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 xG(e){let t=NI(e);return t?(0,Zt.serializeNode)(t):void 0}function LG(e,t,r){let n=NI(t);if(!r){n&&t.removeChild(n);return}let i=new DOMParser().parseFromString(r,"text/xml").documentElement,a=(0,cs.rebuildRaw)((0,cs.rawFromNode)((0,Zt.nodeLikeFromDom)(i)),(0,Zt.domEngine)(e),null);n&&(0,Zt.serializeNode)(n)===(0,Zt.serializeNode)(a)||(n?t.replaceChild(a,n):t.appendChild(a))}function DI(e,t){var r,n;let i=K(e,"labels")[0];if(!i)return"";let a=K(i,"label"),o=(r=a.find(s=>s.getAttribute("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return(n=o?.getAttribute("description"))!==null&&n!==void 0?n:""}function kG(e){var t;let r={},n=K(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 MG(e,t,r){var n;let i=_G.get(e.toUpperCase());return i?i==="chart"?t.ChartGridMode==="Chart"?"chart":"list":i==="assistant"&&((n=r.getAttribute("uniqueid"))!==null&&n!==void 0?n:"").toUpperCase()===TG?"assistant":i:"unknown"}function Rm(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 II(e){return e.replace(/^\{/,"").replace(/\}$/,"")}function BG(e,t){let r={n:"form",a:(0,cs.mergeAttrs)(e.bag.a,[]),c:(0,cs.spliceChildren)(e.bag.c,[])};return(0,cs.rebuildRaw)(r,(0,Zt.domEngine)(t),null)}function wI(e,t){let r=new DOMParser().parseFromString("<root/>","text/xml"),n=BG(e,r);return qG(r,n,e.components,t),UG(r,n,e.components,t),(0,Zt.serializeNode)(n)}function UG(e,t,r,n){let i=_I(t);for(let a of r)i.has(ds(a.position))||$G(e,t,a,n)}function $G(e,t,r,n){var i,a,o,s;let l=(a=(i=r.position)===null||i===void 0?void 0:i.sectionIndex)!==null&&a!==void 0?a:0,u=WG(t,e,l);for(let W of K(u,"row"))K(W,"cell").some(B=>K(B,"control").length>0)||u.removeChild(W);let c=r.classId||Pr.TILE_CLASS_ID[r.type]||Pr.TILE_CLASS_ID.iframe,d=r.rowspan&&r.rowspan>0?r.rowspan:4,p=r.bag&&AI(r.bag,"id")?String(AI(r.bag,"id")):Mu((0,hi.newId)()),f=r.id?Mu(r.id):Mu((0,hi.newId)()),h=u.parentNode,g=Math.max(1,parseInt(h&&h.getAttribute&&h.getAttribute("columns")||"1",10)||1),w=Math.min(Math.max(1,r.colspan&&r.colspan>0?r.colspan:1),g),S=K(u,"row"),D=S[S.length-1],x=D?K(D,"cell").reduce((W,B)=>W+Rm(B,"colspan",1),0):0;(!D||x+w>g)&&(D=e.createElement("row"),u.appendChild(D));let F=e.createElement("cell");F.setAttribute("id",p),F.setAttribute("colspan",String(w)),F.setAttribute("rowspan",String(d)),F.setAttribute("showlabel","true");let G=e.createElement("labels"),L=e.createElement("label");L.setAttribute("description",(o=r.name)!==null&&o!==void 0?o:""),L.setAttribute("languagecode",String(n)),G.appendChild(L),F.appendChild(G);let q=e.createElement("control");q.setAttribute("id",f),q.setAttribute("classid",Mu(c));let U=e.createElement("parameters"),$=(s=r.parameters)!==null&&s!==void 0?s:{};for(let W of Object.keys($)){let B=(0,SI.createSafeXmlElement)(e,W,"dashboard tile parameter");B.textContent=$[W],U.appendChild(B)}q.appendChild(U),F.appendChild(q),D.appendChild(F)}function AI(e,t){if(!e)return;let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function qG(e,t,r,n){var i;let a=_I(t),o=new Set(r.map(s=>ds(s.position)));for(let s of r){let l=a.get(ds(s.position));if(!l)continue;let u=K(l,"control")[0];u&&(VG(e,l,s.name,n),GG(e,u,s.parameters),CI(l,"colspan",s.colspan),CI(l,"rowspan",s.rowspan),s.icProperties!==void 0&&LG(e,u,s.icProperties))}for(let[s,l]of a)o.has(s)||(i=l.parentNode)===null||i===void 0||i.removeChild(l)}function _I(e){let t=new Map;return K(e,"tabs").flatMap(n=>K(n,"tab")).forEach((n,i)=>{K(n,"columns").flatMap(o=>K(o,"column")).forEach((o,s)=>{K(o,"sections").flatMap(u=>K(u,"section")).forEach((u,c)=>{K(u,"rows").flatMap(p=>K(p,"row")).forEach((p,f)=>{K(p,"cell").forEach((h,g)=>{var w;II((w=h.getAttribute("id"))!==null&&w!==void 0?w:"").toLowerCase().startsWith("spacer")||K(h,"control")[0]&&t.set(ds({tabIndex:i,columnIndex:s,sectionIndex:c,rowIndex:f,cellIndex:g}),h)})})})})}),t}function ds(e){let t=e??{};return`${t.tabIndex}.${t.columnIndex}.${t.sectionIndex}.${t.rowIndex}.${t.cellIndex}`}function VG(e,t,r,n){if(r===DI(t,n))return;let i=K(t,"labels")[0];i||(i=e.createElement("labels"),t.appendChild(i));let a=K(i,"label").find(o=>o.getAttribute("languagecode")===String(n));a||(a=e.createElement("label"),a.setAttribute("languagecode",String(n)),i.appendChild(a)),a.setAttribute("description",r)}function GG(e,t,r){var n;if(!r)return;let i=Object.keys(r);if(i.length===0)return;let a=K(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,SI.createSafeXmlElement)(e,l,"dashboard component parameter");d.textContent=u,a.appendChild(d)}}}function CI(e,t,r){var n;((n=e.getAttribute(t))!==null&&n!==void 0?n:"")!==String(r)&&e.setAttribute(t,String(r))}function zG(e=2){let t=`{${(0,hi.newId)()}}`,r=`{${(0,hi.newId)()}}`,n=`{${(0,hi.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>`}Pr.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 Mu(e){return`{${e.replace(/[{}]/g,"")}}`}function WG(e,t,r){var n;let i=K(e,"tabs").flatMap(u=>K(u,"tab"))[0];if(!i)throw new Error("addDashboardTile: dashboard formxml has no <tab>");let a=K(i,"columns").flatMap(u=>K(u,"column"))[0];if(!a)throw new Error("addDashboardTile: dashboard formxml has no <column>");let o=K(a,"sections").flatMap(u=>K(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=K(s,"rows")[0];return l||(l=t.createElement("rows"),s.appendChild(l)),l}function HG(e=EI.DEFAULT_LCID){return{adapter:new Bu(e),api:IG.dashboardApi,languageSensitive:!0,publish:(t,r,n)=>n?.entityLogicalName?(0,Tm.publishBoundEntity)(t,n):(0,Tm.publishDashboardById)(t,r),publishScope:(t,r)=>r?.entityLogicalName?(0,Tm.boundEntityPublishScope)(r):{envelope:"dashboard",targetIds:[t]}}}Pr.dashboardRegistration=HG});var LI=v(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.genPageApi=void 0;var xI=$t(),De=be(),Pt=ie(),Uu=md(),Or=re();function jG(e){let t=globalThis;return t.Buffer?t.Buffer.isBuffer(e):!1}var $n="uxagentprojects",Ra="uxagentprojectfiles",Oa="uxagentprojectid",Rr="uxagentprojectfileid",$u=`${Oa},name`,JG=`${Rr},filename,filetype`;async function Fm(e,t,r,n){var i;let a=`/${t}(${r})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Pt.odataQuery)([["$select",n]]),o=(0,De.ensureSuccess)(await e.get(a),e.apiUrl(a));return{row:(i=o.body)!==null&&i!==void 0?i:{},etag:(0,De.readEtag)(o)}}async function QG(e,t){let r=`/${Ra}(${t})/filecontent/$value`,n=await e.get(r);if(n.status===404)return{status:"unavailable",reason:"unpublished"};(0,De.ensureSuccess)(n,e.apiUrl(r));let i=n.body;if(i instanceof Uint8Array||jG(i))return{status:"available",data:(0,Uu.bytesToBase64)(i)};if(i instanceof ArrayBuffer)return{status:"available",data:(0,Uu.bytesToBase64)(new Uint8Array(i))};if(typeof i=="string")return{status:"available",data:(0,Uu.utf8ToBase64)(i)};throw new Or.SdkError("GENPAGE_CONTENT_UNREADABLE",`Read the content of file '${t}' but the injected HttpClient returned a body this SDK cannot encode (${typeof i}). Return the response as a string, Uint8Array, Buffer, or ArrayBuffer; a byte-returning transport is required to round-trip non-UTF8 assets.`)}async function KG(e,t,r,n){if(!e.supportsBinaryPatch)throw new Or.SdkError("GENPAGE_CONTENT_WRITE_UNSUPPORTED",`Refusing to push generative-page file '${t}': its content cannot be written because the injected HttpClient does not implement patchRaw(). A Dataverse File column is not writable through a JSON body, so saving the row without its bytes would report success for a page whose source never uploaded.`);let i=`/${Ra}(${t})/filecontent`,a=(0,Uu.base64ToBytes)(n);(0,Pt.assertNoControlChars)(r,"generative-page file name"),(0,De.ensureSuccess)(await e.patchRaw(i,a,{headers:{"Content-Type":"application/octet-stream","Content-Length":String(a.byteLength),"x-ms-file-name":r}}),e.apiUrl(i))}async function xm(e,t){let r=`/${Ra}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Pt.odataQuery)([["$select",JG],["$filter",`_${Oa}_value eq ${t}`]]);return(await(0,xI.collectPages)(e,r,"fetchArtifact('genPage')")).map(i=>({row:i,etag:typeof i["@odata.etag"]=="string"?i["@odata.etag"]:null}))}async function PI(e,t,r){var n;let{etag:i}=await Fm(e,$n,t,$u),a={};for(let{row:l,etag:u}of await xm(e,t))a[(0,Pt.normalizeGuid)(String((n=l[Rr])!==null&&n!==void 0?n:""),Rr)]=u;let o=Object.keys(a),s=!i||o.length!==r.size||o.some(l=>!r.has(l))||Object.values(a).some(l=>!l);return{etag:i,memberEtags:a,mismatch:s}}function OI(e,t){return t.mismatch?{etag:null,memberEtags:{},warnings:[`Generative page '${e}' was written, but its files changed on the server while the write was in progress, so the new concurrency tokens cannot be trusted. The local baseline is now unusable: re-fetch the page before editing it again \u2014 the next push will refuse rather than overwrite blind.`]}:{etag:t.etag,memberEtags:t.memberEtags}}qu.genPageApi={async get(e,t){var r;let n=(0,Pt.normalizeGuid)(t,"id"),{row:i,etag:a}=await Fm(e,$n,n,$u),o=await xm(e,n),s={},l=[];for(let{row:u,etag:c}of o){let d=(0,Pt.normalizeGuid)(String((r=u[Rr])!==null&&r!==void 0?r:""),Rr);s[d]=c;let p=await QG(e,d);l.push({...u,content:p})}return{raw:{project:i,files:l},etag:a,memberEtags:s}},async list(e,t){let r=`/${$n}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Pt.odataQuery)([["$select",$u]]);return(await(0,xI.collectPages)(e,r,"listArtifacts('genPage')")).map(i=>{var a,o;return{type:"genPage",id:String((a=i[Oa])!==null&&a!==void 0?a:""),name:String((o=i.name)!==null&&o!==void 0?o:""),isDirty:!1}})},async create(e,t,r){let n=t;RI(e,n);let i=`/${$n}`,a=(0,De.ensureSuccess)(await e.post(i,(0,De.withClientMintedId)({name:n.name},Oa,r)),e.apiUrl(i)),o=(0,De.resolveCreatedId)(a,Oa,"generative page",r),s=new Set;for(let l of n.files){let u=await FI(e,o,l,!0);s.add((0,Pt.normalizeGuid)(u.id,"file id"))}try{return{id:o,...OI(o,await PI(e,o,s))}}catch(l){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was created, but re-reading its concurrency tokens failed (${l instanceof Error?l.message:String(l)}). The local baseline is unusable: re-fetch the page before editing it \u2014 the next push will refuse rather than overwrite blind.`]}}},async update(e,t,r,n,i){let a=r,o=(0,Pt.normalizeGuid)(t,"id");RI(e,a);let s=await xm(e,o),{etag:l}=await Fm(e,$n,o,$u);if(n&&l&&n!==l)throw new Or.SdkError(De.VERSION_CONFLICT_CODE,`Generative page '${o}' changed on the server after it was fetched (baseline ${n}, server ${l}) \u2014 another writer edited it. A page row accepts no If-Match validator, so this push would silently overwrite them. Re-fetch the page and re-apply the edit.`);if(!n||!l)throw new Or.SdkError(De.VERSION_CONFLICT_CODE,`Cannot verify generative page '${o}' before writing: ${n?"the server did not return the page's current token":"no baseline token was recorded"}. This entity accepts no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);let u=new Set(s.map(({row:f})=>{var h;return(0,Pt.normalizeGuid)(String((h=f[Rr])!==null&&h!==void 0?h:""),Rr)})),c=new Set(a.files.map(f=>(0,Pt.normalizeGuid)(f.id,"file id")));if(!i)throw new Or.SdkError(De.VERSION_CONFLICT_CODE,`Cannot verify the files of generative page '${o}' before writing: no child baseline was recorded. These rows accept no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);let d=new Set(Object.keys(i).map(f=>f.toLowerCase()));{for(let h of c)if(!u.has(h)&&d.has(h))throw new Or.SdkError(De.VERSION_CONFLICT_CODE,`Generative-page file '${h}' existed when this page was fetched but is gone from the server now \u2014 another writer deleted it. Refusing to recreate it, because a blind re-create would undo that delete and, for an unpublished page, restore the row WITHOUT its content. Re-fetch the page and re-apply the edit.`);for(let h of u)if(!d.has(h))throw new Or.SdkError(De.VERSION_CONFLICT_CODE,`Generative-page file '${h}' is on the server but absent from this page's baseline \u2014 another writer added it after the page was fetched, so its contents cannot be verified. Refusing to write over or delete it. Re-fetch the page so the addition is part of your baseline.`);let f=new Map(s.map(({row:h,etag:g})=>{var w;return[(0,Pt.normalizeGuid)(String((w=h[Rr])!==null&&w!==void 0?w:""),Rr),g]}));for(let[h,g]of Object.entries(i??{})){let w=h.toLowerCase();if(!u.has(w))continue;let S=f.get(w);if(!g||!S)throw new Or.SdkError(De.VERSION_CONFLICT_CODE,`Cannot verify generative-page file '${w}' before writing: ${g?"the server did not return its current token":"no baseline token was recorded"}. A file row accepts no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);if(g!==S)throw new Or.SdkError(De.VERSION_CONFLICT_CODE,`Generative-page file '${w}' changed on the server after this page was fetched (baseline ${g}, server ${S}) \u2014 another writer edited it. A file row accepts no If-Match validator, so this push would silently overwrite that change. Re-fetch the page and re-apply the edit.`)}}let p=`/${$n}(${o})`;(0,De.ensureSuccess)(await e.patch(p,{name:a.name},{headers:{"If-Match":"*"}}),e.apiUrl(p));for(let f of a.files){let h=(0,Pt.normalizeGuid)(f.id,"file id");await FI(e,o,f,!u.has(h))}for(let f of u)c.has(f)||await(0,De.deleteRecord)(e,Ra,f);try{return{id:o,...OI(o,await PI(e,o,c))}}catch(f){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was written, but re-reading its concurrency tokens failed (${f instanceof Error?f.message:String(f)}). The local baseline is now unusable: re-fetch the page before editing it again \u2014 the next push will refuse rather than overwrite blind.`]}}},delete(e,t){return(0,De.deleteRecord)(e,$n,t)}};function RI(e,t){var r;if(((r=t.files)!==null&&r!==void 0?r:[]).some(i=>i.content.status==="available")&&!e.supportsBinaryPatch)throw new Or.SdkError("GENPAGE_CONTENT_WRITE_UNSUPPORTED","Refusing to write this generative page: it has file content to upload, but the injected HttpClient does not implement patchRaw(). A Dataverse File column is not writable through a JSON body, so proceeding would create the page and its rows and then fail, leaving a page whose source never uploaded.")}async function FI(e,t,r,n){let i=(0,Pt.normalizeGuid)(r.id,"file id"),a;if(n){let o=`/${Ra}`,s=(0,De.ensureSuccess)(await e.post(o,(0,De.withClientMintedId)({filename:r.name,filetype:r.fileType,[`${Oa}@odata.bind`]:`/${$n}(${t})`},Rr,i)),e.apiUrl(o));a=(0,De.readEtag)(s)}else{let o=`/${Ra}(${i})`,s=(0,De.ensureSuccess)(await e.patch(o,{filename:r.name,filetype:r.fileType},{headers:{"If-Match":"*"}}),e.apiUrl(o));a=(0,De.readEtag)(s)}return r.content.status==="available"&&await KG(e,i,r.name,r.content.data),{id:i,etag:a}}});var UI=v(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.genPageRegistration=xa.GenPageAdapter=void 0;var XG=LI(),YG=rr(),qn=_r(),BI=ct(),kI=2e8;function MI(e){return typeof e=="string"&&e.trim()!==""?e:(0,BI.newId)()}function Fa(e){return(0,qn.isJsonObject)(e)?e:{}}function ZG(e){let t=Fa(e);return t.status==="available"&&typeof t.data=="string"?{status:"available",data:t.data}:{status:"unavailable",reason:"unpublished"}}var Vu=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;let i=t,a=Fa(i?.project),o=Array.isArray(i?.files)?i.files:[];return{id:String((r=a.uxagentprojectid)!==null&&r!==void 0?r:""),name:String((n=a.name)!==null&&n!==void 0?n:""),files:o.map(s=>{var l,u,c;let d=Fa(s);return{id:String((l=d.uxagentprojectfileid)!==null&&l!==void 0?l:""),name:String((u=d.filename)!==null&&u!==void 0?u:""),fileType:Number((c=d.filetype)!==null&&c!==void 0?c:kI),content:ZG(d.content)}})}}toApiPayload(t){var r;return{name:t.name,files:((r=t.files)!==null&&r!==void 0?r:[]).map(n=>({id:n.id,name:n.name,fileType:n.fileType,content:n.content}))}}createDefault(t){var r,n;return{id:MI(t.id),name:(r=t.name)!==null&&r!==void 0?r:"New page",files:((n=t.files)!==null&&n!==void 0?n:[]).map(i=>{var a,o,s;return{id:MI(i.id),name:(a=i.name)!==null&&a!==void 0?a:"index.tsx",fileType:(o=i.fileType)!==null&&o!==void 0?o:kI,content:(s=i.content)!==null&&s!==void 0?s:{status:"available",data:""}}})}}assignMissingIds(t){let r=Fa(t);return(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,BI.newId)()),r}validate(t){let r=[],n=t.files;if(n!==void 0&&!Array.isArray(n))return r.push((0,qn.issue)("/files","files-must-be-array",`files must be an array, got ${typeof n}`)),r;let i=new Map;return(Array.isArray(n)?n:[]).forEach((a,o)=>{let s=`/files/${o}`,l=Fa(a),u=typeof l.id=="string"?l.id.trim().toLowerCase():"";if(u==="")r.push((0,qn.issue)(s,"file-id-required","a generative-page file needs an id"));else{let f=i.get(u);f!==void 0?r.push((0,qn.issue)(s,"file-id-duplicate",`two files share the id '${l.id}' (also at /files/${f}); a file's id is its identity, so a duplicate makes an edit ambiguous`)):i.set(u,o)}let c=typeof l.name=="string"?l.name:"";(c===""||/[\u0000-\u001F\u007F]/.test(c)||/[\\/]/.test(c))&&r.push((0,qn.issue)(s+"/name","file-name-invalid",`a file name must be a non-empty single path segment with no control characters or path separators (it is sent as an HTTP header on upload); got '${c}'`));let d=l.content;if(d===void 0){r.push((0,qn.issue)(s+"/content","file-content-required","content is required: omitting it is indistinguishable from an empty file, and the two have opposite effects on the next push"));return}let p=Fa(d);p.status==="available"?typeof p.data!="string"&&r.push((0,qn.issue)(s+"/content/data","file-content-data-invalid","available content needs base64 `data`")):p.status!=="unavailable"&&r.push((0,qn.issue)(s+"/content/status","file-content-status-invalid",`content.status must be 'available' or 'unavailable', got ${String(p.status)}`))}),r}};xa.GenPageAdapter=Vu;function e6(){return{adapter:new Vu,api:XG.genPageApi,publish:(e,t)=>(0,YG.publishGenPageById)(e,t),publishScope:e=>({envelope:"uxagentproject",targetIds:[e]})}}xa.genPageRegistration=e6});var qI=v(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.reconcileBpfSecurityRoles=void 0;var zu=be(),Gu=ie(),t6="Global",$I={create:"Create",read:"Read",write:"Write",delete:"Delete"};async function r6(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,Gu.odataPathLiteral)(t)}')?$select=LogicalName,Privileges`,o=(n=(r=(0,zu.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.Privileges)!==null&&n!==void 0?n:[],s={},l=new Set;return Object.keys($I).forEach(u=>{let c=o.find(d=>d.PrivilegeType===$I[u]);if(c){let d=(0,Gu.normalizeGuid)(c.PrivilegeId,"PrivilegeId");s[u]=d,l.add(d)}}),{byAccess:s,all:l}}async function n6(e,t){var r,n;let i=`/RetrieveRolePrivilegesRole(RoleId=${t})`,o=(n=(r=(0,zu.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.RolePrivileges)!==null&&n!==void 0?n:[];return new Set(o.map(s=>(0,Gu.normalizeGuid)(s.PrivilegeId,"PrivilegeId")))}async function i6(e,t,r){if(r.length===0)return;let n={Privileges:r.map(a=>({Depth:t6,PrivilegeId:a}))},i=`/roles(${t})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;(0,zu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function a6(e,t,r){let n={Privilege:{"@odata.type":"Microsoft.Dynamics.CRM.privilege",privilegeid:r}},i=`/roles(${t})/Microsoft.Dynamics.CRM.RemovePrivilegeRole`;(0,zu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function o6(e,t,r){var n;if(!r||r.length===0)return;let i=await r6(e,t.toLowerCase());for(let a of r){let o=(0,Gu.normalizeGuid)(a.roleId,"roleId"),s=new Set(((n=a.access)!==null&&n!==void 0?n:[]).map(p=>i.byAccess[p]).filter(p=>!!p)),l=await n6(e,o),u=new Set([...l].filter(p=>i.all.has(p))),c=[...s].filter(p=>!u.has(p)),d=[...u].filter(p=>!s.has(p));await i6(e,o,c);for(let p of d)await a6(e,o,p)}}Wu.reconcileBpfSecurityRoles=o6});var WI=v(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.bpfApi=void 0;var Vn=Wn(),s6=$t(),kt=be(),Fr=ie(),l6=qI(),Hu={"Content-Type":"application/json",Accept:"application/json"},u6=`category eq ${Vn.WorkflowCategory.BusinessProcessFlow} and type eq ${Vn.WorkflowTypeCode.Definition} and businessprocesstype eq ${Vn.BusinessProcessType.BusinessFlow}`,c6="workflowid,name,description,primaryentity,statecode,category,type,businessprocesstype,processorder",d6="workflowid,name,uniquename,description,primaryentity,statecode,statuscode,category,type,businessprocesstype,processorder,xaml,clientdata",p6=["xaml","name","description","processorder"];async function VI(e,t){var r;if(t.status!=="Active"||!t.securityRoles||t.securityRoles.length===0)return;let n=String((r=t.record.uniquename)!==null&&r!==void 0?r:"");n!==""&&await(0,l6.reconcileBpfSecurityRoles)(e,n,t.securityRoles)}async function Lm(e,t,r){var n;if(r==="Draft")return null;let i=(0,Fr.normalizeGuid)(t,"workflowid"),a={statecode:Vn.StateCode.Activated,statuscode:Vn.StatusCode.Activated},o=`/workflows(${i})`,s=(0,kt.ensureSuccess)(await e.patch(o,a,{headers:Hu}),e.apiUrl(o));return(n=(0,kt.readEtag)(s))!==null&&n!==void 0?n:await km(e,i)}async function km(e,t){let r=`/workflows(${t})${(0,Fr.odataQuery)([["$select","workflowid"]])}`,n=await e.get(r);return n.status>=200&&n.status<300?(0,kt.readEtag)(n):null}async function f6(e,t){var r;let n=`/workflows(${t})${(0,Fr.odataQuery)([["$select","statecode"]])}`,i=await e.get(n);if(i.status<200||i.status>=300)return null;let a=(r=i.body)===null||r===void 0?void 0:r.statecode;return a==null?null:Number(a)}async function GI(e,t,r){if(await f6(e,t)!==Vn.StateCode.Activated)return!1;let n={statecode:Vn.StateCode.Draft,statuscode:Vn.StatusCode.Draft},i=`/workflows(${t})`,a={...Hu};return r&&(a["If-Match"]=r),(0,kt.ensureSuccess)(await e.patch(i,n,{headers:a}),e.apiUrl(i)),!0}async function zI(e,t){try{await Lm(e,t,"Active")}catch{}}function m6(e){let t={};for(let r of p6)e[r]!==void 0&&(t[r]=e[r]);return t}ju.bpfApi={async get(e,t){let n=`/workflows(${(0,Fr.normalizeGuid)(t,"id")})${(0,Fr.odataQuery)([["$select",d6]])}`,i=(0,kt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,kt.readEtag)(i)}},async list(e,t){let r=[u6];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,Fr.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,Fr.odataQuery)([["$select",c6],["$filter",r.join(" and ")]])}`;return(await(0,s6.collectPages)(e,n,"listArtifacts('bpf')")).map(a=>{var o,s;return{type:"bpf",id:(o=a.workflowid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.primaryentity,isDirty:!1}})},async create(e,t){var r;let n=t,i=(0,Fr.normalizeGuid)(n.record.workflowid,"workflowid"),a="/workflows",o=(0,kt.ensureSuccess)(await e.post(a,n.record,{headers:Hu}),e.apiUrl(a)),s=null;try{s=await Lm(e,i,n.status),await VI(e,n)}catch(u){try{await(0,kt.deleteRecord)(e,"workflows",i)}catch{}throw u}let l=(r=s??(0,kt.readEtag)(o))!==null&&r!==void 0?r:await km(e,i);return{id:i,etag:l}},async update(e,t,r,n){var i;let a=r,o=(0,Fr.normalizeGuid)(t,"id"),s=(0,kt.requireEtag)(n,"bpf",o),l=await GI(e,o,s);try{let u=`/workflows(${o})`,c={...Hu};l||(c["If-Match"]=s);let d=(0,kt.ensureSuccess)(await e.patch(u,m6(a.record),{headers:c}),e.apiUrl(u)),p=await Lm(e,o,a.status);return await VI(e,a),{id:o,etag:(i=p??(0,kt.readEtag)(d))!==null&&i!==void 0?i:await km(e,o)}}catch(u){throw l&&await zI(e,o),u}},async delete(e,t){let r=(0,Fr.normalizeGuid)(t,"id"),n=await GI(e,r,null);try{await(0,kt.deleteRecord)(e,"workflows",r)}catch(i){throw n&&await zI(e,r),i}}}});var __=v(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.bpfRegistration=ka.BpfAdapter=void 0;var Ju=Wn(),h6=WI(),Mm=bn(),gi=Qn(),i_=An(),Mt=_r(),Ot=ct(),xr=re(),g6=100,Um='<?xml version="1.0" encoding="utf-16"?>',HI=1033,a_="mxswa:Workflow",v6="mxswa:ActivityReference.Properties",y6="mcwo:StepLabel",b6="mcwb:Control",jI="mcwb:Control.ControlDisplayName",o_="mcwb:Control.DataFieldName",s_="DataFieldName",JI="ControlDisplayName",l_="Literal",Qu="x:Null",QI="x:String",$m="x:Key",qm="DisplayName",Xu="Activities",w6="StepLabels",u_="StageId",c_="StageCategory",d_="NextStageId",p_="ProcessStepId",Vm="IsProcessRequired",f_="EntityComposite",m_="StageComposite",h_="StepComposite";function Bm(e){return(0,Mt.isJsonObject)(e)?e:{}}function Lr(e){if(!e)return[];let t=[],r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];i.nodeType===1&&t.push(i)}return t}function vi(e,t){var r;return(r=Lr(e).find(n=>n.tagName===t))!==null&&r!==void 0?r:null}function kr(e){return vi(e,v6)}function ht(e,t){var r;return(r=Lr(e).find(n=>n.getAttribute($m)===t))!==null&&r!==void 0?r:null}function La(e,t){var r;return((r=e.getAttribute("AssemblyQualifiedName"))!==null&&r!==void 0?r:"").includes(t)}function an(e){var t;return!e||!e.firstChild?"":(t=e.firstChild.nodeValue)!==null&&t!==void 0?t:""}function g_(e,t,r){e.firstChild?e.firstChild.nodeValue=r:e.appendChild(t.createTextNode(r))}function ps(e){var t;let r=(t=e.getAttribute(qm))!==null&&t!==void 0?t:"",n=r.indexOf(": ");return n>=0?r.slice(n+2):r}function v_(e,t){var r;let n=(r=e.getAttribute(qm))!==null&&r!==void 0?r:"",i=n.indexOf(": ");e.setAttribute(qm,i>=0?n.slice(0,i+2)+t:t)}function y_(e,t){let r=ht(e,w6),n=vi(r,y6);n&&n.setAttribute("Description",t)}function A6(e){let t=ht(e,c_);if(!t||t.tagName===Qu)return;let r=an(t).trim();return r===""?void 0:Number(r)}function C6(e){let t=ht(e,d_);if(!t||t.tagName===Qu)return;let r=an(t).trim();return r===""?void 0:r}function b_(e){let t=w_(e);if(!t)return;let r=C_(t,s_,o_);return r===""?void 0:r}function Gm(e,t){let r=Lr(e);for(;r.length>0;){let n=r.pop();if(n.tagName===t)return n;for(let i of Lr(n))r.push(i)}return null}function w_(e){let t=ht(kr(e),Xu);return t?Gm(t,b6):null}function A_(e,t){let r=e.attributes;for(let n=0;n<r.length;n+=1)if(r[n].name===t)return!0;return!1}function C_(e,t,r){var n;return A_(e,t)?(n=e.getAttribute(t))!==null&&n!==void 0?n:"":I6(e,r)}function KI(e,t,r,n){if(A_(e,t)){e.setAttribute(t,n);return}if(vi(e,r)){S6(e,r,n);return}throw new xr.InvalidArgumentError(`BPF step control exposes neither a '${t}' attribute nor a <${r}> wrapper to bind a column`)}function S6(e,t,r){let n=vi(e,t),i=n?Gm(n,l_):null;i&&i.setAttribute("Value",r)}function S_(e){return ps(e)}function Yu(e){let t=vi(e,a_),r=[];for(let n of Lr(t).filter(i=>La(i,f_))){let i=ht(kr(n),Xu);for(let a of Lr(i).filter(o=>La(o,m_)))r.push({el:a,entity:S_(n)})}return r}function zm(e){let t=ht(kr(e),Xu);return Lr(t).filter(r=>La(r,h_))}function E6(e){let t=kr(e),r=an(ht(t,Vm)).trim().toLowerCase(),n=b_(e),i={id:an(ht(t,p_)),name:ps(e)};return n!==void 0&&(i.fieldName=n),r==="true"&&(i.required=!0),i}function N6(e,t){let r=kr(e),n=A6(r),i=C6(r),a={id:an(ht(r,u_)),name:ps(e),entityLogicalName:t,steps:zm(e).map(E6)};return n!==void 0&&(a.category=n),i!==void 0&&(a.nextStageId=i),a}function D6(e){return Yu(e).map(({el:t,entity:r})=>N6(t,r))}function nn(e){return new xr.NotImplementedError("bpf-structural-authoring",`${e} is not supported yet (this phase authors identity, stage/step names, step required, step field binding, stage categories, and adding/removing/reordering stages & steps on a single-table process; branching, actions, security-role wiring and multi-table processes land in later phases). The rest of the process round-trips losslessly.`)}function I6(e,t){var r;let n=vi(e,t),i=n?Gm(n,l_):null;return(r=i?.getAttribute("Value"))!==null&&r!==void 0?r:""}function Wm(e,t){var r;let n=e.createElement(t.tagName),i=t.attributes;for(let o=0;o<i.length;o+=1)n.setAttribute(i[o].name,i[o].value);let a=t.childNodes;for(let o=0;o<a.length;o+=1){let s=a[o];s.nodeType===1?n.appendChild(Wm(e,s)):s.nodeType===3&&n.appendChild(e.createTextNode((r=s.nodeValue)!==null&&r!==void 0?r:""))}return n}function E_(e){return ht(kr(e),Xu)}function _6(e,t,r){var n;let i=t.entityLogicalName&&t.entityLogicalName.trim()!==""?t.entityLogicalName:r,a=!((n=t.steps[0])===null||n===void 0)&&n.id&&t.steps[0].id.trim()!==""?t.steps[0].id:(0,Ot.newId)(),{body:o}=Zu(Hm(i,(0,Ot.newId)(),t.id,a));return Wm(e,Yu((0,gi.parseXmlRoot)(o,"<Activity/>"))[0].el)}function T6(e,t){let{body:r}=Zu(Hm("account",(0,Ot.newId)(),(0,Ot.newId)(),t.id));return Wm(e,zm(Yu((0,gi.parseXmlRoot)(r,"<Activity/>"))[0].el)[0])}function N_(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(let r of t)e.appendChild(r)}function D_(e,t,r,n){let i=ht(e,r);if(!i||!i.parentNode){if(n!==void 0&&n!=="")throw nn(`setting '${r}' on a stage whose xaml does not expose that slot`);return}let a=i.parentNode;if(n===void 0||n===""){if(i.tagName!==Qu){let s=t.createElement(Qu);s.setAttribute($m,r),a.replaceChild(s,i)}return}if(i.tagName===QI){an(i)!==n&&g_(i,t,n);return}let o=t.createElement(QI);o.setAttribute($m,r),o.appendChild(t.createTextNode(n)),a.replaceChild(o,i)}function P6(e,t,r){D_(e,t,c_,r===void 0?void 0:String(r))}function O6(e,t,r){D_(e,t,d_,r)}function I_(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(r(e[n])!==t[n])return!1;return!0}function XI(e){return an(ht(kr(e),u_))}function YI(e){return an(ht(kr(e),p_))}function ZI(e,t,r){var n,i,a,o;let s=kr(e);r.name!==ps(e)&&(v_(e,r.name),y_(s,r.name));let l=an(ht(s,Vm)).trim().toLowerCase()==="true";if(((n=r.required)!==null&&n!==void 0?n:!1)!==l){let u=ht(s,Vm);u&&g_(u,t,r.required?"True":"False")}if(((i=r.fieldName)!==null&&i!==void 0?i:"")!==((a=b_(e))!==null&&a!==void 0?a:"")){let u=w_(e);if(!u)throw new xr.InvalidArgumentError("BPF step has no <mcwb:Control> element to bind a column to");let c=(o=r.fieldName)!==null&&o!==void 0?o:"";KI(u,s_,o_,c),c!==""&&C_(u,JI,jI)===""&&KI(u,JI,jI,c)}}function e_(e,t,r,n){var i;let a=kr(e);if(!a)throw new xr.InvalidArgumentError("BPF stage composite has no <\u2026ActivityReference.Properties>");if(r.name!==ps(e)&&(v_(e,r.name),y_(a,r.name)),P6(a,t,r.category),O6(a,t,n),r.relationshipName&&r.relationshipName.trim()!=="")throw nn("a stage relationship / table change (multi-table authoring)");if(r.actions&&r.actions.length>0||r.branch)throw nn("stage actions or conditional branching");let o=E_(e);if(!o)throw new xr.InvalidArgumentError("BPF stage has no [Activities] collection");let s=(i=r.steps)!==null&&i!==void 0?i:[];if(s.length===0)throw new xr.InvalidArgumentError(`BPF stage '${r.name}' must have at least one step`);let l=zm(e);if(I_(l,s.map(d=>d.id),YI)){l.forEach((d,p)=>ZI(d,t,s[p]));return}let u=new Map(l.map(d=>[YI(d),d]));if(Lr(o).some(d=>!La(d,h_)))throw nn("adding, removing or reordering steps on a stage that also contains branching or actions");let c=s.map(d=>{var p;return(p=u.get(d.id))!==null&&p!==void 0?p:T6(t,d)});N_(o,c),c.forEach((d,p)=>ZI(d,t,s[p]))}function R6(e,t,r){let n=vi(e,a_);if(!n)throw new xr.InvalidArgumentError("BPF xaml has no <mxswa:Workflow> root activity");if(r.globalActions&&r.globalActions.length>0)throw nn("global (process-completed/abandoned) actions");if(!r.stages||r.stages.length===0)throw new xr.InvalidArgumentError("a BPF must have at least one stage");let i=Yu(e),a=i.map(p=>p.el);if(I_(a,r.stages.map(p=>p.id),XI)){i.forEach(({el:p,entity:f},h)=>{let g=r.stages[h];if(g.entityLogicalName&&g.entityLogicalName.trim()!==""&&g.entityLogicalName!==f)throw nn(`changing a stage's table ('${g.entityLogicalName}' vs the process's '${f}')`);e_(p,t,g,g.nextStageId)});return}let o=Lr(n).filter(p=>La(p,f_));if(o.length!==1)throw nn("adding, removing or reordering stages on a multi-table process");let s=o[0],l=S_(s),u=E_(s);if(!u)throw new xr.InvalidArgumentError("BPF primary entity composite has no [Activities] collection");if(Lr(u).some(p=>!La(p,m_)))throw nn("adding, removing or reordering stages on a process whose primary composite holds non-stage activities (multi-table nesting or advanced constructs)");for(let p of r.stages)if(p.entityLogicalName&&p.entityLogicalName.trim()!==""&&p.entityLogicalName!==l)throw nn(`a stage on a different table ('${p.entityLogicalName}') than the process primary ('${l}')`);let c=new Map(a.map(p=>[XI(p),p])),d=r.stages.map(p=>{var f;return(f=c.get(p.id))!==null&&f!==void 0?f:_6(t,p,l)});N_(u,d),d.forEach((p,f)=>{let h=f<d.length-1?r.stages[f+1].id:void 0;e_(p,t,r.stages[f],h)})}function Zu(e){let t=e.match(/^<\?xml[^>]*\?>\s*/),r=t?t[0]:"";return{prolog:r,body:e.slice(r.length)}}function F6(e){var t,r,n,i,a,o;(0,i_.installDomShim)();let s=(t=e.bag)===null||t===void 0?void 0:t.xaml;if(s){let p=new DOMParser().parseFromString("<root/>","text/xml"),f={n:"Activity",a:(0,Mm.mergeAttrs)(s.a,[]),c:(0,Mm.spliceChildren)(s.c,[])};return{root:(0,Mm.rebuildRaw)(f,(0,gi.domEngine)(p),null),prolog:(n=(r=e.bag)===null||r===void 0?void 0:r.xamlProlog)!==null&&n!==void 0?n:Um,eol:(a=(i=e.bag)===null||i===void 0?void 0:i.xamlEol)!==null&&a!==void 0?a:"lf"}}let l=e.stages[0],u=(o=l?.steps)===null||o===void 0?void 0:o[0],c=Hm(e.entityLogicalName,(0,Ot.newId)(),l?.id&&l.id.trim()!==""?l.id:(0,Ot.newId)(),u?.id&&u.id.trim()!==""?u.id:(0,Ot.newId)()),{body:d}=Zu(c);return{root:(0,gi.parseXmlRoot)(d,"<Activity/>"),prolog:Um,eol:"lf"}}function x6(e){let{root:t,prolog:r,eol:n}=F6(e);R6(t,t.ownerDocument,e);let i=(0,gi.serializeNode)(t);return n==="crlf"&&(i=i.replace(/\n/g,`\r
-`)),r+i}function L6(e){return e.uniqueName&&e.uniqueName.trim()!==""?e.uniqueName:`new_${(e.name||"businessprocessflow").toLowerCase().replace(/[^a-z0-9]/g,"")||"businessprocessflow"}`}var Ku=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;(0,i_.installDomShim)();let i=t,a=typeof i.xaml=="string"?i.xaml:"",o={id:i.workflowid?String(i.workflowid):null,name:String((r=i.name)!==null&&r!==void 0?r:""),entityLogicalName:String((n=i.primaryentity)!==null&&n!==void 0?n:""),status:Number(i.statecode)===1?"Active":"Draft",stages:[]};if(i.uniquename&&(o.uniqueName=String(i.uniquename)),i.description!=null&&i.description!==""&&(o.description=String(i.description)),i.processorder!=null&&i.processorder!==""&&(o.order=Number(i.processorder)),a.trim()!==""){let{prolog:s,body:l}=Zu(a),u=(0,gi.parseXmlRoot)(l,"<Activity/>");o.stages=D6(u),o.bag={xaml:(0,gi.projectElementBag)(u),xamlProlog:s,xamlEol:/\r\n/.test(a)?"crlf":"lf"}}return o}toApiPayload(t){var r;let n={workflowid:t.id&&t.id.trim()!==""?t.id:(0,Ot.newId)(),name:t.name,uniquename:L6(t),primaryentity:t.entityLogicalName,xaml:x6(t),category:Ju.WorkflowCategory.BusinessProcessFlow,type:Ju.WorkflowTypeCode.Definition,businessprocesstype:Ju.BusinessProcessType.BusinessFlow,scope:Ju.WorkflowScope.Organization,processorder:(r=t.order)!==null&&r!==void 0?r:g6};t.description!==void 0&&(n.description=t.description);let i={record:n,status:t.status};if(t.securityRoles&&t.securityRoles.length>0){if(t.status!=="Active")throw new xr.InvalidArgumentError('securityRoles require the BPF to be Active \u2014 the backing table they grant access to is created on activation; set status to "Active" to wire security roles');i.securityRoles=t.securityRoles}return i}createDefault(t){var r,n,i;let a=t.stages&&t.stages.length>0?t.stages.map(r_):[r_({id:(0,Ot.newId)(),name:"New Stage",steps:[]})],o={id:t.id&&t.id.trim()!==""?t.id:(0,Ot.newId)(),name:(r=t.name)!==null&&r!==void 0?r:"New business process flow",entityLogicalName:(n=t.entityLogicalName)!==null&&n!==void 0?n:"",status:(i=t.status)!==null&&i!==void 0?i:"Draft",stages:a};return t.uniqueName&&(o.uniqueName=t.uniqueName),t.description!==void 0&&(o.description=t.description),t.order!==void 0&&(o.order=t.order),t.globalActions!==void 0&&(o.globalActions=t.globalActions),t.securityRoles!==void 0&&(o.securityRoles=t.securityRoles),o}assignMissingIds(t){let r=Bm(t);(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,Ot.newId)());for(let n of["stages","steps","actions","globalActions"]){let i=r[n];Array.isArray(i)&&i.forEach(a=>this.assignMissingIds(a))}return r}validate(t){let r=[],n=t.stages;if(n!==void 0&&!Array.isArray(n))return r.push((0,Mt.issue)("/stages","stages-must-be-array",`stages must be an array, got ${typeof n}`)),r;let i=Array.isArray(n)?n:[];i.length>30&&r.push((0,Mt.issue)("/stages","too-many-stages",`a BPF allows at most 30 stages, got ${i.length}`));let a=new Set,o=new Map;i.forEach((l,u)=>{let c=`/stages/${u}`,d=Bm(l),p=typeof d.id=="string"?d.id.trim():"";p===""?r.push((0,Mt.issue)(`${c}/id`,"stage-id-required","a stage needs an id")):o.has(p.toLowerCase())?r.push((0,Mt.issue)(`${c}/id`,"stage-id-duplicate",`two stages share the id '${l.id}' (also at /stages/${o.get(p.toLowerCase())})`)):o.set(p.toLowerCase(),u),typeof l.entityLogicalName=="string"&&l.entityLogicalName!==""&&a.add(l.entityLogicalName);let f=Array.isArray(l.steps)?l.steps:[];f.length===0&&r.push((0,Mt.issue)(`${c}/steps`,"stage-needs-step","a BPF stage must have at least one step")),f.length>30&&r.push((0,Mt.issue)(`${c}/steps`,"too-many-steps",`a stage allows at most 30 steps, got ${f.length}`));let h=new Map;f.forEach((g,w)=>{let S=`${c}/steps/${w}`,D=typeof Bm(g).id=="string"?g.id.trim():"";D===""?r.push((0,Mt.issue)(`${S}/id`,"step-id-required","a step needs an id")):h.has(D.toLowerCase())?r.push((0,Mt.issue)(`${S}/id`,"step-id-duplicate",`two steps in this stage share the id '${g.id}'`)):h.set(D.toLowerCase(),w)}),l.branch&&!t_(i,l.branch.nextStageId)&&r.push((0,Mt.issue)(`${c}/branch/nextStageId`,"branch-target-unknown",`branch nextStageId '${l.branch.nextStageId}' does not match any stage id`)),typeof l.nextStageId=="string"&&l.nextStageId!==""&&!t_(i,l.nextStageId)&&r.push((0,Mt.issue)(`${c}/nextStageId`,"next-stage-unknown",`nextStageId '${l.nextStageId}' does not match any stage id`))}),a.size>5&&r.push((0,Mt.issue)("/stages","too-many-tables",`a BPF spans at most 5 tables, got ${a.size}`));let s=k6(i);return s>=0&&r.push((0,Mt.issue)(`/stages/${s}/nextStageId`,"next-stage-cycle","the stage nextStageId links form a cycle; the flow must be acyclic")),r}};ka.BpfAdapter=Ku;function k6(e){let t=new Map(e.map(r=>[r.id,r]));for(let r=0;r<e.length;r+=1){let n=new Set,i=e[r];for(;i&&typeof i.nextStageId=="string"&&i.nextStageId!=="";){if(n.has(i.id))return r;n.add(i.id),i=t.get(i.nextStageId)}}return-1}function t_(e,t){return e.some(r=>r.id===t)}function r_(e){var t,r;let n=e.steps&&e.steps.length>0?e.steps.map(n_):[n_({id:(0,Ot.newId)(),name:"New Step"})],i={id:e.id&&e.id.trim()!==""?e.id:(0,Ot.newId)(),name:(t=e.name)!==null&&t!==void 0?t:"New Stage",entityLogicalName:(r=e.entityLogicalName)!==null&&r!==void 0?r:"",steps:n};return e.category!==void 0&&(i.category=e.category),e.nextStageId!==void 0&&(i.nextStageId=e.nextStageId),e.relationshipName!==void 0&&(i.relationshipName=e.relationshipName),e.actions!==void 0&&(i.actions=e.actions),e.branch!==void 0&&(i.branch=e.branch),i}function n_(e){var t;let r={id:e.id&&e.id.trim()!==""?e.id:(0,Ot.newId)(),name:(t=e.name)!==null&&t!==void 0?t:"New Step"};return e.fieldName!==void 0&&(r.fieldName=e.fieldName),e.required!==void 0&&(r.required=e.required),r}function Hm(e,t,r,n){return`${Um}<Activity x:Class="XrmWorkflow00000000000000000000000000000000" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mcwb="clr-namespace:Microsoft.Crm.Workflow.BusinessProcessFlowActivities;assembly=Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mcwo="clr-namespace:Microsoft.Crm.Workflow.ObjectModel;assembly=Microsoft.Crm, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxs="clr-namespace:Microsoft.Xrm.Sdk;assembly=Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxswa="clr-namespace:Microsoft.Xrm.Sdk.Workflow.Activities;assembly=Microsoft.Xrm.Sdk.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:srs="clr-namespace:System.Runtime.Serialization;assembly=System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:this="clr-namespace:" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><x:Members><x:Property Name="InputEntities" Type="InArgument(scg:IDictionary(x:String, mxs:Entity))" /><x:Property Name="CreatedEntities" Type="InArgument(scg:IDictionary(x:String, mxs:Entity))" /></x:Members><this:XrmWorkflow00000000000000000000000000000000.InputEntities><InArgument x:TypeArguments="scg:IDictionary(x:String, mxs:Entity)" /></this:XrmWorkflow00000000000000000000000000000000.InputEntities><this:XrmWorkflow00000000000000000000000000000000.CreatedEntities><InArgument x:TypeArguments="scg:IDictionary(x:String, mxs:Entity)" /></this:XrmWorkflow00000000000000000000000000000000.CreatedEntities><mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings><mxswa:Workflow><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EntityComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EntityStep1: ${e}"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.StageComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="StageStep2: New Stage"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.StepComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="StepStep3: New Step"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><Sequence DisplayName="ControlStep4"><mcwb:Control ControlId="${t}" IsSystemControl="False" IsUnbound="False" SystemStepType="0"><mcwb:Control.ClassId><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.ClassId><mcwb:Control.ControlDisplayName><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.ControlDisplayName><mcwb:Control.DataFieldName><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.DataFieldName><mcwb:Control.Parameters><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.Parameters></mcwb:Control></Sequence></sco:Collection><sco:Collection x:TypeArguments="mcwo:StepLabel" x:Key="StepLabels"><mcwo:StepLabel Description="New Step" LabelId="${n}" LanguageCode="${HI}" /></sco:Collection><x:String x:Key="ProcessStepId">${n}</x:String><x:Boolean x:Key="IsProcessRequired">False</x:Boolean></mxswa:ActivityReference.Properties></mxswa:ActivityReference></sco:Collection><sco:Collection x:TypeArguments="mcwo:StepLabel" x:Key="StepLabels"><mcwo:StepLabel Description="New Stage" LabelId="${r}" LanguageCode="${HI}" /></sco:Collection><x:String x:Key="StageId">${r}</x:String><x:Null x:Key="StageCategory" /><x:Null x:Key="NextStageId" /></mxswa:ActivityReference.Properties></mxswa:ActivityReference></sco:Collection><x:Null x:Key="RelationshipName" /><x:Null x:Key="AttributeName" /><x:Boolean x:Key="IsClosedLoop">False</x:Boolean></mxswa:ActivityReference.Properties></mxswa:ActivityReference></mxswa:Workflow></Activity>`}function M6(){return{adapter:new Ku,api:h6.bpfApi,languageSensitive:!0}}ka.bpfRegistration=M6});var T_=v(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.buildRegistrations=void 0;var B6=$N(),U6=nD(),$6=g2(),q6=R2(),V6=Z2(),G6=gI(),z6=TI(),W6=UI(),H6=__();function j6(e){let t=new Map;return t.set("form",(0,B6.formRegistration)(e)),t.set("view",(0,U6.viewRegistration)()),t.set("businessRule",(0,$6.businessRuleRegistration)()),t.set("app",(0,q6.appRegistration)(e)),t.set("command",(0,V6.commandRegistration)()),t.set("chart",(0,G6.chartRegistration)()),t.set("dashboard",(0,z6.dashboardRegistration)(e)),t.set("genPage",(0,W6.genPageRegistration)()),t.set("bpf",(0,H6.bpfRegistration)()),t}ec.buildRegistrations=j6});var B_=v(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.removeRowSummary=Pe.configureRowSummary=Pe.buildGptDynamicPrompt=Pe.setAppAiFeatures=Pe.getAiReadiness=Pe.saveSettingValue=Pe.retrieveSetting=Pe.AI_GATE=void 0;var dr=be(),He=ie(),P_=ct(),on=re();Pe.AI_GATE={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabled",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"EnableNLGridSearch",nlChart:"NLChartVisualizationSetting",summaries:"EnableFormInsights",m365:"m365copilotmodelappenabled"};var x_={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabledOnByDefault",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"NLGridSearchSetting",nlChart:"NLChartDataVisualizationSetting",m365:"m365copilotmodelappenabled"},J6=new Set(Object.entries(Pe.AI_GATE).filter(([e,t])=>x_[e]===t).map(([e])=>e)),Q6={formFill:{enabled:"2",disabled:"1"},formFillSuggestions:{enabled:"2",disabled:"1"},formFillSmartPaste:{enabled:"2",disabled:"1"},formFillFiles:{enabled:"2",disabled:"1"}};function jm(e){return Q6[e]}var tc=1e6;function K6(e,t){let r=jm(t),n=()=>{throw new on.InvalidArgumentError(`setAppAiFeatures: '${t}' must be a boolean or an integer between 0 and ${tc} (e.g. 0, 1, 2); got '${String(e)}'.`)},i=a=>r?a?r.enabled:r.disabled:a?"1":"0";if(typeof e=="boolean")return i(e);if(typeof e=="number")return!Number.isSafeInteger(e)||e<0||e>tc?n():String(e);if(typeof e=="string"){let a=e.trim(),o=a.toLowerCase();if(o==="true")return i(!0);if(o==="false")return i(!1);if(/^[0-9]+$/.test(a)){let s=a.replace(/^0+(?=[0-9])/,"");return s.length>String(tc).length||Number(s)>tc?n():s}}return n()}function X6(e,t){let r=jm(t);return r?e===r.enabled:e!=="0"}async function Y6(e,t){var r,n,i;let a=`/appmodules${(0,He.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,He.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 Z6(e,t){var r,n;let i=`/appmodules${(0,He.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,He.odataLiteral)(t)}'`]])}`,a;try{a=await e.get(i)}catch(l){throw new on.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 on.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 on.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 on.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a row with no appmoduleid.`);return s}var O_=new WeakMap;async function e7(e,t){var r,n,i;let a=O_.get(e);if(a||(a=new Map,O_.set(e,a)),a.has(t))return a.get(t);let o=`/settingdefinitions${(0,He.odataQuery)([["$select","settingdefinitionid"],["$filter",`uniquename eq '${(0,He.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 t7(e,t,r){var n,i;let a=await e7(e,r);if(!t||!a)return;let o=`/appsettings${(0,He.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 r7=4,n7=500,R_=20,F_=3e4;function i7(e){if(e===void 0)return r7;if(!Number.isFinite(e))throw new on.InvalidArgumentError(`setAppAiFeatures: verifyAttempts must be a finite integer between 1 and ${R_}; got ${e}.`);return Math.min(R_,Math.max(1,Math.floor(e)))}function a7(e){if(e===void 0)return n7;if(!Number.isFinite(e))throw new on.InvalidArgumentError(`setAppAiFeatures: verifyDelayMs must be a finite number between 0 and ${F_}; got ${e}.`);return Math.min(F_,Math.max(0,Math.floor(e)))}async function o7(e,t,r,n,i,a,o){let s,l,u,c=!1;for(let d=0;d<a;d+=1){d>0&&await new Promise(f=>setTimeout(f,o*d));let p;try{let f=await t();f?(p=await t7(e,f,n),p===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(f){p=void 0,u=f.message}c=p!==void 0,l=p?.exists;try{s=(await rc(e,n,{appUniqueName:r})).value}catch{}if(p?.exists&&p.value===i)return{result:"proven",effectiveValue:p.value,appOverrideExists:!0}}return c?{result:"absent",effectiveValue:s,appOverrideExists:l}:{result:"unverifiable",effectiveValue:s,appOverrideExists:void 0,reason:u}}function L_(e,t,r){if(t===2)return String(e).toLowerCase()==="true";let n=r?jm(r):void 0;return n?e===n.enabled:e!=null&&e!=="0"&&e!==""}async function rc(e,t,r={}){var n,i;let a=[`SettingName='${(0,He.odataPathLiteral)(t)}'`];r.appUniqueName&&a.push(`AppUniqueName='${(0,He.odataPathLiteral)(r.appUniqueName)}'`);let o=`/RetrieveSetting(${a.join(",")})`,l=(i=(n=(0,dr.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}}Pe.retrieveSetting=rc;async function k_(e,t,r,n={}){let i={SettingName:t,Value:r};n.appUniqueName&&(i.AppUniqueName=n.appUniqueName),n.solutionUniqueName&&(i.SolutionUniqueName=n.solutionUniqueName),(0,dr.ensureSuccess)(await e.post("/SaveSettingValue",i),e.apiUrl("/SaveSettingValue"))}Pe.saveSettingValue=k_;async function s7(e,t={}){let r={};for(let[n,i]of Object.entries(Pe.AI_GATE)){let{value:a,dataType:o}=await rc(e,i,t);r[n]={enabled:L_(a,o,n),setting:i,value:a}}return r}Pe.getAiReadiness=s7;async function l7(e,t,r,n={}){var i,a;if(!t||!t.trim())throw new on.InvalidArgumentError("setAppAiFeatures: a non-empty appUniqueName is required (an empty value would write the setting at organization scope, affecting every app).");let o=i7(n.verifyAttempts),s=a7(n.verifyDelayMs),l=[];for(let[g,w]of Object.entries(r)){if(w===void 0)continue;let S=x_[g];S&&l.push({feature:g,setting:S,requestedValue:K6(w,g)})}let u=[],c=n.appModuleId?(0,He.normalizeGuid)(n.appModuleId,"appModuleId"):void 0;if(c){let g=await Z6(e,t);if(g&&(0,He.normalizeGuid)(g,"appModuleId")!==c)throw new on.InvalidArgumentError(`setAppAiFeatures: appModuleId '${c}' does not belong to app '${t}' (which resolves to '${g}'). Settings are written by unique name, so verifying against a different app would report success for a write that never landed.`)}let d,p=async()=>c||(d||(d=await Y6(e,t)),d),f=new Map,h=async g=>{if(J6.has(g))return;let w=Pe.AI_GATE[g];if(w){if(!f.has(w))try{let{value:S,dataType:D}=await rc(e,w);f.set(w,{enabled:L_(S,D,g),setting:w,value:S})}catch{f.set(w,void 0)}return f.get(w)}};for(let{feature:g,setting:w,requestedValue:S}of l)try{await k_(e,w,S,{appUniqueName:t,solutionUniqueName:n.solutionUniqueName});let D=await o7(e,p,t,w,S,o,s),x={feature:g,setting:w,requestedValue:S,effectiveValue:D.effectiveValue,appOverrideExists:D.appOverrideExists};if(D.result==="proven")u.push({...x,status:"applied"});else if(D.result==="absent"){let F=X6(S,g)?await h(g):void 0;F&&!F.enabled?u.push({...x,status:"skipped",reason:`the write was issued and no app-scope override holding '${S}' was observed for '${w}' after ${o} attempt(s); the org readiness gate '${F.setting}' reads '${F.value}', so an environment admin must enable it before this app can turn the feature on`}):u.push({...x,status:"notPersisted",reason:`the write reported success but no app-scope override holding '${S}' was observed for '${w}' after ${o} attempt(s) \u2014 it reads '${(i=D.effectiveValue)!==null&&i!==void 0?i:""}' for this app (Dataverse can accept an app-scope write without storing it)`})}else u.push({...x,status:"unverified",reason:`the write was issued but could not be confirmed: ${(a=D.reason)!==null&&a!==void 0?a:"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(D){u.push({feature:g,setting:w,requestedValue:S,status:"failed",reason:D.message})}return{applied:u.filter(g=>g.status==="applied").map(g=>g.feature),skipped:u.filter(g=>g.status==="skipped").map(g=>g.feature),notPersisted:u.filter(g=>g.status==="notPersisted").map(g=>g.feature),unverified:u.filter(g=>g.status==="unverified").map(g=>g.feature),failed:u.filter(g=>g.status==="failed").map(g=>g.feature),outcomes:u}}Pe.setAppAiFeatures=l7;var u7="GptPowerPrompt",c7='{ "consumptionSource": "Api", "partnerSource": "AIBuilder", "consumptionSourceVersion": "GptApiClient"}';function M_(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:""}}Pe.buildGptDynamicPrompt=M_;async function d7(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,He.odataPathLiteral)(t)}')${(0,He.odataQuery)([["$select","MetadataId"]])}`;return(n=(r=(0,dr.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.MetadataId)!==null&&n!==void 0?n:""}async function p7(e,t,r={}){var n,i,a,o,s;let l=`ais_RowSummary_${t.entityLogicalName}`,u=`/aiskillconfigs${(0,He.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,He.odataLiteral)(l)}'`],["$top",1]])}`,c=((i=(n=(0,dr.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,He.odataQuery)([["$select","msdyn_aitemplateid"],["$filter",`msdyn_uniquename eq '${u7}'`],["$top",1]])}`,p=((s=(o=(a=(0,dr.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,f=(0,P_.newId)(),h=(0,P_.newId)(),g=JSON.stringify(M_(t)),w={ModelId:f,RunConfigurationId:h,ModelName:`${t.entityLogicalName} row summary`,TemplateId:p,CustomConfiguration:g,Source:c7,RunConfiguration:""};(0,dr.ensureSuccess)(await e.post("/AIModelPublish",w),e.apiUrl("/AIModelPublish"));try{let S=await d7(e,t.entityLogicalName),D={uniquename:l,description:`${t.entityLogicalName} row summary`,"[email protected]":`/entities(${S})`,"[email protected]":`/msdyn_aimodels(${f})`,aiskill:"RowSummary"},x=(0,dr.ensureSuccess)(await e.post("/aiskillconfigs",D),e.apiUrl("/aiskillconfigs")),F=(0,dr.requireCreatedId)(x,"aiskillconfigid","row-summary skill");return{modelId:f,aiSkillConfigId:F}}catch(S){try{await e.delete(`/msdyn_aimodels(${f})`)}catch{}throw S}}Pe.configureRowSummary=p7;async function f7(e,t){var r,n;let i=`ais_RowSummary_${t.entityLogicalName}`,a=`/aiskillconfigs${(0,He.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,He.odataLiteral)(i)}'`],["$top",1]])}`,o=((n=(r=(0,dr.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,dr.ensureSuccess)(await e.delete(s),e.apiUrl(s)),o._aimodel_value){let l=`/msdyn_aimodels(${o._aimodel_value})`;(0,dr.ensureSuccess)(await e.delete(l),e.apiUrl(l))}}Pe.removeRowSummary=f7});var U_=v(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.findArtifact=Ma.resolveArtifact=void 0;var gt=ie(),sn=el(),m7=sl(),h7=be(),g7=re();async function v7(e,t,r){var n,i,a,o,s,l,u,c,d,p,f,h;switch(t){case"app":{let g=(0,m7.unpublishedAppModulesQuery)("appmoduleid,name,appmoduleidunique",`uniquename eq '${(0,gt.odataLiteral)((n=r.uniqueName)!==null&&n!==void 0?n:"")}'`,1),S=(i=(0,h7.ensureSuccess)(await e.get(g),e.apiUrl(g)).body)===null||i===void 0?void 0:i.value,D=S&&S[0];return D?[{id:String(D.appmoduleid),name:String(D.name),appModuleIdUnique:String(D.appmoduleidunique)}]:[]}case"dashboard":return(await(0,sn.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,gt.odataLiteral)((a=r.name)!==null&&a!==void 0?a:"")}' and type eq 0`,top:10})||[]).map(w=>({id:String(w.formid),name:String(w.name)}));case"command":{let g=await(0,sn.queryRecords)(e,"appaction",{select:["appactionid","buttonlabeltext"],filter:`contextvalue eq '${(0,gt.odataLiteral)((o=r.entity)!==null&&o!==void 0?o:"")}'`,top:1});return g&&g.length?[{id:String(r.entity),entity:String(r.entity)}]:[]}case"form":return(await(0,sn.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,gt.odataLiteral)((s=r.name)!==null&&s!==void 0?s:"")}' and objecttypecode eq '${(0,gt.odataLiteral)((l=r.entity)!==null&&l!==void 0?l:"")}'`,top:10})||[]).map(w=>({id:String(w.formid),name:String(w.name)}));case"chart":return(await(0,sn.queryRecords)(e,"savedqueryvisualization",{select:["savedqueryvisualizationid","name"],filter:`name eq '${(0,gt.odataLiteral)((u=r.name)!==null&&u!==void 0?u:"")}' and primaryentitytypecode eq '${(0,gt.odataLiteral)((c=r.entity)!==null&&c!==void 0?c:"")}'`,top:10})||[]).map(w=>({id:String(w.savedqueryvisualizationid),name:String(w.name)}));case"view":return(await(0,sn.queryRecords)(e,"savedquery",{select:["savedqueryid","name"],filter:`name eq '${(0,gt.odataLiteral)((d=r.name)!==null&&d!==void 0?d:"")}' and returnedtypecode eq '${(0,gt.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,sn.queryRecords)(e,"webresource",{select:["webresourceid","name"],filter:`name eq '${(0,gt.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,sn.queryRecords)(e,"solution",{select:["solutionid","uniquename"],filter:`uniquename eq '${(0,gt.odataLiteral)((h=r.uniqueName)!==null&&h!==void 0?h:"")}'`,top:1})||[]).map(w=>({id:String(w.solutionid),name:String(w.uniquename)}));default:return[]}}Ma.resolveArtifact=v7;async function y7(e,t,r){var n,i,a,o,s;let l=(0,gt.odataLiteral)((n=r.name)!==null&&n!==void 0?n:""),u=(0,gt.odataLiteral)((i=r.entity)!==null&&i!==void 0?i:"");if(t==="command"){let h=await(0,sn.queryRecords)(e,"appaction",{select:["appactionid"],filter:`contextvalue eq '${(0,gt.odataLiteral)((a=r.entity)!==null&&a!==void 0?a:"")}'`,top:1});return h&&h.length?String(r.entity):null}let c=b7(t,l,u,r),d=t!=="app",p=await(0,sn.queryRecords)(e,c.set,{select:[c.idField],filter:c.filter,top:d?2:1});if(d&&p&&p.length>1)throw new g7.AmbiguousArtifactError(t,(s=(o=r.name)!==null&&o!==void 0?o:r.uniqueName)!==null&&s!==void 0?s:"",p.length);let f=p&&p[0]&&p[0][c.idField];return f!=null?String(f):null}Ma.findArtifact=y7;function b7(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,gt.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 q_=v(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.seedRecordGraph=void 0;var $_=el(),w7=xs(),nc=ie(),A7=re();async function C7(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:(p=>(0,w7.resolveEntitySetName)(e,p)),c={},d=p=>{var f;return(f=c[p])!==null&&f!==void 0?f:l[p]};for(let p of t){let f=p.entityLogical.toLowerCase(),h=(a=p.matchOn)===null||a===void 0?void 0:a.toLowerCase(),g=[];for(let L of p.records){let q={...L.body};for(let U of(o=L.binds)!==null&&o!==void 0?o:[]){let $=U.parentEntity.toLowerCase(),W=(s=d($))===null||s===void 0?void 0:s[U.parentIndex];if(!W)throw new A7.InvalidArgumentError(`Cannot resolve bind '${U.navProperty}' on a '${f}' record: parent '${U.parentEntity}'[${U.parentIndex}] has no created id. Seed the parent group before the child, or supply it via options.createdIds.`);let B=(0,nc.assertODataName)(await u($),`entity set for parent '${U.parentEntity}'`),Qe=(0,nc.normalizeGuid)(W,`parent id for bind '${U.navProperty}'`);q[`${U.navProperty}@odata.bind`]=`/${B}(${Qe})`}g.push(q)}let w=h?g.map(L=>{let q=L[h];return q!=null&&q!==""?String(q):null}):g.map(()=>null),S=new Map;if(h){let L=(0,nc.assertODataName)(h,"RecordGraph matchOn key"),q=[...new Set(w.filter(U=>U!==null))];if(q.length){let U=q.map(W=>`${L} eq '${(0,nc.odataLiteral)(W)}'`).join(" or "),$=await(0,$_.queryRecords)(e,f,{select:[L,`${f}id`],filter:U,top:5e3});for(let W of $??[]){let B=W[L];B!=null&&S.set(String(B).toLowerCase(),String(W[`${f}id`]))}}}let D=[],x=new Map,F=g.map((L,q)=>{let U=w[q];if(U&&S.has(U.toLowerCase()))return null;if(U){let $=U.toLowerCase(),W=x.get($);if(W!==void 0)return W;let B=D.push(L)-1;return x.set($,B),B}return D.push(L)-1}),G=D.length?await(0,$_.createRecordsBulk)(e,f,D):[];c[f]=g.map((L,q)=>{let U=w[q];return U&&S.has(U.toLowerCase())?S.get(U.toLowerCase()):G[F[q]]})}return{createdIds:c}}ic.seedRecordGraph=C7});var X_=v(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.getEntityPrivileges=st.addEntityPrivilegesToRole=st.deleteSecurityRole=st.createPersonaRole=st.createSecurityRole=st.SDK_ROLE_MARKER=void 0;var pr=be(),je=ie(),Bt=re(),ac={read:"Read",create:"Create",write:"Write",delete:"Delete",append:"Append",appendTo:"AppendTo",assign:"Assign",share:"Share"},Qm={user:"Basic",businessUnit:"Local",parentChild:"Deep",organization:"Global"},V_={user:1,businessUnit:2,parentChild:3,organization:4},Jm={user:"CanBeBasic",businessUnit:"CanBeLocal",parentChild:"CanBeDeep",organization:"CanBeGlobal"};st.SDK_ROLE_MARKER="Authored by @maker-studio/cds-maker-sdk (persona/security role).";function S7(e){return Object.prototype.hasOwnProperty.call(ac,e)?ac[e]:void 0}function E7(e){return Object.prototype.hasOwnProperty.call(Qm,e)}var G_=new WeakMap,z_=new WeakMap;async function j_(e,t){var r,n;(0,je.assertODataName)(t,"entity logical name");let i=G_.get(e);i||(i=new Map,G_.set(e,i));let a=i.get(t);if(a)return a;let o=`/EntityDefinitions(LogicalName='${(0,je.odataPathLiteral)(t)}')${(0,je.odataQuery)([["$select","LogicalName,Privileges"]])}`,l=(n=(r=(0,pr.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 Bt.InvalidArgumentError(`Entity '${t}' exposes no privileges (unknown or non-securable entity).`);return i.set(t,l),l}async function N7(e){var t,r,n;let i=z_.get(e);if(i)return i;let a=`/businessunits${(0,je.odataQuery)([["$select","businessunitid"],["$filter","_parentbusinessunitid_value eq null"],["$top",1]])}`,l=(n=((r=(t=(0,pr.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 Bt.InvalidArgumentError("Could not resolve the root business unit.");let u=(0,je.normalizeGuid)(l,"businessUnitId");return z_.set(e,u),u}async function J_(e,t){var r;let n=new Map;for(let i of t){if(!i.access||i.access.length===0)throw new Bt.InvalidArgumentError(`Entity '${i.entity}' privilege request has no access levels.`);let a=(r=i.scope)!==null&&r!==void 0?r:"user";if(!E7(a))throw new Bt.InvalidArgumentError(`Unknown privilege scope '${a}' for entity '${i.entity}'.`);let o=await j_(e,i.entity);for(let s of i.access){let l=S7(s);if(!l)throw new Bt.InvalidArgumentError(`Unknown access level '${s}' for entity '${i.entity}'.`);let u=o.find(h=>h.PrivilegeType===l);if(!u)throw new Bt.InvalidArgumentError(`Entity '${i.entity}' does not support '${s}' access.`);let c=Jm[a];if(u[c]===!1)throw new Bt.InvalidArgumentError(`Privilege '${u.Name}' on '${i.entity}' does not support the '${a}' scope.`);let d=(0,je.normalizeGuid)(u.PrivilegeId,"PrivilegeId"),p=n.get(d);if(!p){n.set(d,{privilegeName:u.Name,privilegeType:l,scope:a,entities:new Set([i.entity])});continue}if(p.scope===a){p.entities.add(i.entity);continue}if(!(p.entities.size===1&&p.entities.has(i.entity))){let h=[...p.entities].sort().join(", ");throw new Bt.InvalidArgumentError(`Entities '${h}' 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.`)}p.scope=V_[a]>V_[p.scope]?a:p.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 D7(e,t,r,n){if(r.length===0&&!n)return;let i={Privileges:r.map(o=>({Depth:Qm[o.scope],PrivilegeId:o.privilegeId}))},a=`/roles(${t})/Microsoft.Dynamics.CRM.ReplacePrivilegesRole`;(0,pr.ensureSuccess)(await e.post(a,i),e.apiUrl(a))}async function W_(e,t,r,n,i){var a,o;let s=`/${t}(${r})/${n}${(0,je.odataQuery)([["$select","roleid"],["$filter",`roleid eq ${i}`]])}`;return((o=(a=(0,pr.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 I7(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,je.normalizeGuid)(l,"teamId");if(!await W_(e,"teams",u,"teamroles_association",t)){let c=`/teams(${u})/teamroles_association/$ref`;(0,pr.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,je.normalizeGuid)(l,"userId");if(!await W_(e,"systemusers",u,"systemuserroles_association",t)){let c=`/systemusers(${u})/systemuserroles_association/$ref`;(0,pr.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}o.push(u)}return{teams:a,users:o}}async function H_(e,t,r){var n,i;let a=`/roles${(0,je.odataQuery)([["$select","roleid,description,ismanaged"],["$filter",`name eq '${(0,je.odataLiteral)(t)}' and _businessunitid_value eq ${r}`]])}`,l=((i=(n=(0,pr.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 p;return d.ismanaged!==!0&&((p=d.description)!==null&&p!==void 0?p:"")===st.SDK_ROLE_MARKER};if(l.some(d=>!u(d)))throw new Bt.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 Bt.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,je.normalizeGuid)(c,"roleId"):void 0}function _7(e){var t,r;return{teams:((t=e?.teams)!==null&&t!==void 0?t:[]).map(n=>(0,je.normalizeGuid)(n,"teamId")),users:((r=e?.users)!==null&&r!==void 0?r:[]).map(n=>(0,je.normalizeGuid)(n,"userId"))}}function Q_(e){return e.map(t=>({entity:t.entity,privilegeName:t.privilegeName,privilegeType:t.privilegeType,scope:t.scope}))}async function K_(e,t){var r,n;let i=(r=t.name)===null||r===void 0?void 0:r.trim();if(!i)throw new Bt.InvalidArgumentError("createSecurityRole: a non-empty role name is required.");let a=t.businessUnitId?(0,je.normalizeGuid)(t.businessUnitId,"businessUnitId"):await N7(e),o=await J_(e,(n=t.privileges)!==null&&n!==void 0?n:[]),s=_7(t.assignTo),l=await H_(e,i,a),u=l!==void 0;if(!l){let d="/roles",p={name:i,description:st.SDK_ROLE_MARKER,"[email protected]":`/businessunits(${a})`};try{let f=(0,pr.ensureSuccess)(await e.post(d,p),e.apiUrl(d));l=(0,je.normalizeGuid)((0,pr.requireCreatedId)(f,"roleid","role"),"roleId")}catch(f){let h;try{h=await H_(e,i,a)}catch{h=void 0}if(!h)throw f;l=h}}await D7(e,l,o,u);let c=await I7(e,l,s);return{roleId:l,name:i,reused:u,appliedPrivileges:Q_(o),assignedTeams:c.teams,assignedUsers:c.users}}st.createSecurityRole=K_;async function T7(e,t){var r,n;let i=(r=t.persona)===null||r===void 0?void 0:r.trim();if(!i)throw new Bt.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 K_(e,{name:i,businessUnitId:t.businessUnitId,privileges:a,assignTo:t.assignTo})}st.createPersonaRole=T7;async function P7(e,t){let n=`/roles(${(0,je.normalizeGuid)(t,"roleId")})`;(0,pr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}st.deleteSecurityRole=P7;async function O7(e,t,r){let n=(0,je.normalizeGuid)(t,"roleId");if(r.length===0)throw new Bt.InvalidArgumentError("addEntityPrivilegesToRole requires at least one entity privilege (an empty grant would be a silent no-op).");let i=await J_(e,r),a={Privileges:i.map(s=>({Depth:Qm[s.scope],PrivilegeId:s.privilegeId}))},o=`/roles(${n})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;return(0,pr.ensureSuccess)(await e.post(o,a),e.apiUrl(o)),Q_(i)}st.addEntityPrivilegesToRole=O7;var R7=new Map(Object.keys(ac).map(e=>[ac[e],e]));async function F7(e,t){return(await j_(e,t)).map(n=>{let i=Object.keys(Jm).filter(o=>n[Jm[o]]!==!1),a=R7.get(n.PrivilegeType);return{name:n.Name,privilegeId:n.PrivilegeId,privilegeType:n.PrivilegeType,...a?{access:a}:{},scopes:i}})}st.getEntityPrivileges=F7});var nT=v(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.createMakerSdk=Ut.MakerSdk=Ut.PUSH_NOT_ATTEMPTED_CODE=Ut.ALREADY_EXISTS_CODE=void 0;var Y_=Ic(),ee=re(),fr=Es(),x7=yg(),rT=Eg(),L7=Pg(),k7=Tc(),M7=Qg(),Km=Kg(),Je=xs(),Z_=pd(),ln=el(),oc=Nv(),Ba=rl(),B7=il(),lt=Rv(),U7=Cd(),$7=T_(),q7=ct(),V7=Ei(),un=nm(),eT=Rc(),G7=3e5,Mr=be(),Gn=ie(),Ua=B_(),tT=U_(),z7=q_(),W7=Cf(),fs=X_();function H7(e){let t=e.workspaceStorage;if(t==null)throw new Error("createMakerSdk requires a workspaceStorage. Node callers can build one with `createNodeWorkspaceStorage(path)` from '@maker-studio/cds-maker-sdk/node'; a host with no filesystem implements WorkspaceStorage directly.");return new rT.WorkspaceManager(j7,e.instanceUrl,(0,k7.assertStorageContract)(t))}Ut.ALREADY_EXISTS_CODE="ARTIFACT_ALREADY_EXISTS";Ut.PUSH_NOT_ATTEMPTED_CODE="PUSH_NOT_ATTEMPTED";var j7="<injected workspaceStorage>",sc=class{constructor(t){var r,n;this.artifactLocks=new Map,this.languageCode=(r=t.languageCode)!==null&&r!==void 0?r:V7.DEFAULT_LCID,this.cacheStalenessMs=(n=t.cacheStalenessMs)!==null&&n!==void 0?n:G7,this.workspace=H7(t),this.versions=new L7.VersionManager(this.workspace),this.dataverse=new M7.DataverseClient(t.instanceUrl,t.httpClient,t.solutionUniqueName),this.registrations=(0,$7.buildRegistrations)(this.languageCode)}async initWorkspace(){await this.workspace.init()}async getManifest(){return this.workspace.getManifest()}async cleanWorkspace(){await this.workspace.clean()}withArtifactLock(t,r,n){var i;let a=`${t}\0${(0,rT.canonicalArtifactId)(r)}`,s=((i=this.artifactLocks.get(a))!==null&&i!==void 0?i:Promise.resolve()).then(n,n),l=s.then(()=>{},()=>{});return this.artifactLocks.set(a,l),l.then(()=>{this.artifactLocks.get(a)===l&&this.artifactLocks.delete(a)}),s}async fetchArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.fetchArtifactUnlocked(t,r,n))}async fetchArtifactUnlocked(t,r,n){var i,a;let o=this.requireRegistration(t,"fetchArtifact"),{raw:s,etag:l,memberEtags:u,siblingEtags:c}=await o.api.get(this.dataverse,r),d=o.adapter.fromApiResponse(s);if(!n?.overwrite&&await this.versions.isDirty(t,r)){let p=(a=(i=await this.versions.getMeta(t,r))===null||i===void 0?void 0:i.etag)!==null&&a!==void 0?a:null;if(p&&l&&p!==l)throw new ee.LocalEditsWouldBeLostError(t,r,p,l);let f=await this.workspace.readArtifact(t,r);if(f){let h=await this.versions.getMeta(t,r);if(h&&!h.etag&&l){if(!(0,eT.deepEqual)(h.snapshot,d))throw new ee.LocalEditsWouldBeLostError(t,r,p,l);await this.versions.storeMeta(t,r,{...h,etag:l,fetchedAt:(0,Mr.nowIso)()})}return(0,un.cloneJson)(f)}}return await this.workspace.writeArtifact(t,r,d),await this.versions.storeMeta(t,r,{etag:l,languageCode:this.languageCode,fetchedAt:(0,Mr.nowIso)(),snapshot:(0,un.cloneJson)(d),...u?{memberEtags:u}:{},...c?{siblingEtags:c}:{}}),(0,un.cloneJson)(d)}async fetchArtifactList(t,r){return this.requireRegistration(t,"fetchArtifactList").api.list(this.dataverse,r)}async fetchSolution(t){var r;let n=await(0,lt.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,Mr.nowIso)(),isDirty:!1})}catch(s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"failed",error:ms(s)})}return await this.workspace.updateManifest({lastSyncAt:(0,Mr.nowIso)()}),{summaries:i,skipped:a}}async fetchEntityMetadata(t){let r=await(0,Km.fetchEntityMetadataFromApi)(this.dataverse,t);return await this.workspace.writeEntityMetadata(t,r),r}findTables(t,r){return(0,Km.findTables)(this.dataverse,t,r)}findColumns(t,r,n){return(0,Km.findColumns)(this.dataverse,t,r,n)}createTable(t){return(0,Je.createTable)(this.dataverse,t)}createColumn(t,r){return(0,Je.createColumn)(this.dataverse,t,r)}createColumns(t,r){return(0,Je.createColumns)(this.dataverse,t,r)}updateColumn(t,r,n){return(0,Je.updateColumn)(this.dataverse,t,r,n)}deleteColumn(t,r){return(0,Je.deleteColumn)(this.dataverse,t,r)}setFormSecurityRoles(t,r){return(0,Z_.setFormSecurityRoles)(this.dataverse,t,r)}getFormSecurityRoles(t){return(0,Z_.getFormSecurityRoles)(this.dataverse,t)}setColumnVisualization(t,r,n){return(0,Je.setColumnVisualization)(this.dataverse,t,r,n)}getColumnVisualization(t,r){return(0,Je.getColumnVisualization)(this.dataverse,t,r)}createCustomerColumn(t,r){return(0,Je.createCustomerColumn)(this.dataverse,t,r)}insertStatusValue(t,r){return(0,Je.insertStatusValue)(this.dataverse,t,r)}updateTable(t,r){return(0,Je.updateTable)(this.dataverse,t,r)}async setEntityIcon(t,r){if(await(0,Je.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,Gn.xmlText)(t)}</entity></entities></importexportxml>`;(0,Mr.ensureSuccess)(await this.dataverse.post("/PublishXml",{ParameterXml:n}),this.dataverse.apiUrl("/PublishXml"))}}createAlternateKey(t,r){return(0,Je.createAlternateKey)(this.dataverse,t,r)}deleteAlternateKey(t,r){return(0,Je.deleteAlternateKey)(this.dataverse,t,r)}createRelationship(t){return(0,Je.createRelationship)(this.dataverse,t)}deleteRelationship(t){return(0,Je.deleteRelationship)(this.dataverse,t)}createGlobalOptionSet(t){return(0,Je.createGlobalOptionSet)(this.dataverse,t)}deleteGlobalOptionSet(t){return(0,Je.deleteGlobalOptionSet)(this.dataverse,t)}deleteTable(t){return(0,Je.deleteTable)(this.dataverse,t)}createSecurityRole(t){return(0,fs.createSecurityRole)(this.dataverse,t)}createPersonaRole(t){return(0,fs.createPersonaRole)(this.dataverse,t)}deleteSecurityRole(t){return(0,fs.deleteSecurityRole)(this.dataverse,t)}addEntityPrivilegesToRole(t,r){return(0,fs.addEntityPrivilegesToRole)(this.dataverse,t,r)}getEntityPrivileges(t){return(0,fs.getEntityPrivileges)(this.dataverse,t)}createRecord(t,r){return(0,ln.createRecord)(this.dataverse,t,r)}createRecordsBulk(t,r){return(0,ln.createRecordsBulk)(this.dataverse,t,r)}updateRecord(t,r,n){return(0,ln.updateRecord)(this.dataverse,t,r,n)}upsertRecord(t,r,n){return(0,ln.upsertRecord)(this.dataverse,t,r,n)}deleteRecord(t,r){return(0,ln.deleteRecord)(this.dataverse,t,r)}getRecord(t,r,n){return(0,ln.getRecord)(this.dataverse,t,r,n)}queryRecords(t,r){return(0,ln.queryRecords)(this.dataverse,t,r)}seedRecordGraph(t,r){return(0,z7.seedRecordGraph)(this.dataverse,t,r)}resolveArtifact(t,r){return(0,tT.resolveArtifact)(this.dataverse,t,r)}findArtifact(t,r){return(0,tT.findArtifact)(this.dataverse,t,r)}async deleteAppCascade(t,r){let n=await(0,U7.deleteAppCascade)(this.dataverse,t,r),i=(0,Gn.normalizeGuid)(t,"appModuleId");return await this.workspace.readArtifact("app",i)&&await this.workspace.deleteArtifact("app",i),n}associateRecords(t,r,n){return(0,ln.associateRecords)(this.dataverse,t,r,n)}disassociateRecords(t,r,n,i){return(0,ln.disassociateRecords)(this.dataverse,t,r,n,i)}createWebResource(t){return(0,oc.createWebResource)(this.dataverse,t)}updateWebResource(t,r){return(0,oc.updateWebResource)(this.dataverse,t,r)}getWebResource(t){return(0,oc.getWebResource)(this.dataverse,t)}deleteWebResource(t){return(0,oc.deleteWebResource)(this.dataverse,t)}getAppSettings(t){return(0,Ba.readAppSettings)(this.dataverse,t)}setAppSetting(t,r,n){return(0,Ba.setAppSetting)(this.dataverse,t,r,n)}setHeaderAndNavigationRefresh(t,r){if(typeof r!="boolean")throw new ee.ValidationError("app",t,[{pointer:"/headerAndNavigationRefresh",rule:B7.HEADER_NAV_BOOLEAN_RULE,message:`enabled must be a boolean, got ${typeof r}`}]);return(0,Ba.setAppSetting)(this.dataverse,t,Ba.HEADER_AND_NAVIGATION_REFRESH,r?Ba.APP_SETTING_ON:Ba.APP_SETTING_OFF)}getSolution(t){return(0,lt.getSolution)(this.dataverse,t)}createPublisher(t){return(0,lt.createPublisher)(this.dataverse,t)}createSolution(t){return(0,lt.createSolution)(this.dataverse,t)}setSolutionVersion(t,r){return(0,lt.setSolutionVersion)(this.dataverse,t,r)}addSolutionComponent(t){return(0,lt.addSolutionComponent)(this.dataverse,t)}removeSolutionComponent(t,r,n){return(0,lt.removeSolutionComponent)(this.dataverse,t,r,n)}exportSolution(t){return(0,lt.exportSolution)(this.dataverse,t)}importSolution(t){return(0,lt.importSolution)(this.dataverse,t)}deleteSolution(t){return(0,lt.deleteSolution)(this.dataverse,t)}async getArtifact(t,r){return this.withArtifactLock(t,r,()=>this.getArtifactUnlocked(t,r))}async getArtifactUnlocked(t,r){return(0,un.cloneJson)(await this.readRaw(t,r))}async readRaw(t,r){return await this.revalidateIfStale(t,r),this.readLocal(t,r)}async readForMutation(t,r,n){if(await this.revalidateIfStale(t,r)==="refreshed-changed")throw new ee.StaleArtifactError(t,r,n);return this.readLocal(t,r)}async readLocal(t,r){let n=await this.workspace.readArtifact(t,r);if(!n)throw new ee.ArtifactNotFoundError(t,r);return n}async revalidateIfStale(t,r){let n=await this.versions.getMeta(t,r);if(!n)return"skipped";let i=n.fetchedAt?Date.parse(n.fetchedAt):NaN,a=Date.now()-i;if(!Number.isNaN(i)&&this.cacheStalenessMs>0&&a<=this.cacheStalenessMs)return"fresh";if(await this.versions.isDirty(t,r))return"skipped";let o=await this.workspace.readArtifact(t,r);await this.fetchArtifactUnlocked(t,r);let s=await this.workspace.readArtifact(t,r);return(0,eT.deepEqual)(o,s)?"refreshed-unchanged":"refreshed-changed"}async queryTree(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.getArtifactUnlocked(t,r),a=fr.JsonPointer.resolve(i,n);if(a===void 0)throw new ee.PathNotFoundError(t,r,n);return a})}async findElements(t,r,n){return this.withArtifactLock(t,r,async()=>(0,x7.findElements)(await this.getArtifactUnlocked(t,r),n))}async withDirtyFlags(t){let r=[];for(let n of t)r.push({...n,isDirty:await this.versions.isDirty(n.type,n.id)});return r}async listArtifacts(t,r){return this.withDirtyFlags(await this.workspace.listArtifacts(t,r))}async getEntityMetadata(t){let r=await this.workspace.readEntityMetadata(t);if(!r)throw new ee.ArtifactNotFoundError("entityMetadata",t);return r}async getFieldMetadata(t,r){let i=(await this.getEntityMetadata(t)).attributes.find(a=>a.logicalName===r);if(!i)throw new ee.PathNotFoundError("entityMetadata",t,r);return i}async updateElement(t,r,n,i){return this.withArtifactLock(t,r,async()=>{let a=await this.readForMutation(t,r,n),o=fr.JsonPointer.resolve(a,n);if(o===void 0)throw new ee.PathNotFoundError(t,r,n);let s=zn(o)&&zn(i)?{...o,...i}:i;return fr.JsonPointer.set(a,n,(0,un.cloneJson)(s)),this.assertStructurallyValid(t,r,a,n),await this.workspace.writeArtifact(t,r,a),this.getArtifactUnlocked(t,r)})}async addElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{let o=await this.readForMutation(t,r,n),s=fr.JsonPointer.resolve(o,n);if(s===void 0)throw new ee.PathNotFoundError(t,r,n);if(!Array.isArray(s)){if(!zn(s)||!zn(i))throw new ee.ValidationError(t,r,n,"parent must be an array, or an object with an object of properties to add");if(a?.position!==void 0)throw new ee.ValidationError(t,r,n,"position is not supported for an object parent");let c={};for(let d of Object.keys(i)){if(d==="id")throw new ee.ValidationError(t,r,n,"refusing to write 'id' \u2014 that re-keys the node rather than adding a property");let p=(0,un.cloneJson)(i[d]);c[d]=Array.isArray(p)?p.map(f=>zn(f)?this.assignMissingIds(t,f):f):zn(p)?this.assignMissingIds(t,p):p}for(let d of Object.keys(c))fr.JsonPointer.set(o,fr.JsonPointer.append(n,d),c[d]);return this.assertStructurallyValid(t,r,o,n),await this.workspace.writeArtifact(t,r,o),this.getArtifactUnlocked(t,r)}let l=this.assignMissingIds(t,(0,un.cloneJson)(i)),u=K7(s,a?.position);return s.splice(u,0,l),this.assertStructurallyValid(t,r,o,n),await this.workspace.writeArtifact(t,r,o),this.getArtifactUnlocked(t,r)})}async moveElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{var o;let s=await this.readForMutation(t,r,n),l=fr.JsonPointer.resolve(s,n);if(l===void 0)throw new ee.PathNotFoundError(t,r,n);let u=fr.JsonPointer.resolve(s,i);if(u===void 0)throw new ee.PathNotFoundError(t,r,i);if(!Array.isArray(u))throw new ee.ValidationError(t,r,i,"move target must be an array");if(i===n||i.startsWith(`${n}/`))throw new ee.ValidationError(t,r,i,"cannot move an element into its own subtree");fr.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),await this.workspace.writeArtifact(t,r,s),this.getArtifactUnlocked(t,r)})}async removeElement(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.readForMutation(t,r,n);if(fr.JsonPointer.resolve(i,n)===void 0)throw new ee.PathNotFoundError(t,r,n);return fr.JsonPointer.remove(i,n),this.assertStructurallyValid(t,r,i,Q7(n)),await this.workspace.writeArtifact(t,r,i),this.getArtifactUnlocked(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 ee.ValidationError(t,r,u)}retrieveSetting(t,r){return(0,Ua.retrieveSetting)(this.dataverse,t,r)}saveSettingValue(t,r,n){return(0,Ua.saveSettingValue)(this.dataverse,t,r,n)}getAiReadiness(t){return(0,Ua.getAiReadiness)(this.dataverse,t)}setAppAiFeatures(t,r,n){return(0,Ua.setAppAiFeatures)(this.dataverse,t,r,n)}configureRowSummary(t,r){return(0,Ua.configureRowSummary)(this.dataverse,t,r)}removeRowSummary(t){return(0,Ua.removeRowSummary)(this.dataverse,t)}async enrichDefaultViews(t,r,n={}){let i=await(0,W7.findDefaultViews)(this.dataverse,t,n),a=[];for(let o of i)await this.fetchArtifact("view",o.id),await this.updateElement("view",o.id,"/columns",r),(await this.pushArtifact("view",o.id)).saved&&a.push(o.id);if(a.length){let o=await this.publishArtifact("view",a[0]);if(o.publish.kind==="failed")throw new ee.SdkError("ENRICH_DEFAULT_VIEWS_PUBLISH_FAILED",`enrichDefaultViews: ${a.length} view(s) on '${t}' were saved but the publish FAILED, so none of them is live (${o.publish.error.message}). Re-publish the entity to make them visible; the saves themselves are unaffected.`)}return{updated:a}}async createArtifact(t,r){let n=this.requireRegistration(t,"createArtifact"),i=n.adapter.assignMissingIds(n.adapter.createDefault(r)),a=i.id;if(!a)throw new ee.ValidationError(t,"(new)","/id","created artifact must have an id");return this.withArtifactLock(t,a,async()=>(await this.workspace.writeArtifact(t,a,i),(0,un.cloneJson)(i)))}async deleteArtifact(t,r){return this.withArtifactLock(t,r,async()=>{await this.workspace.deleteArtifact(t,r)})}async deleteRemoteArtifact(t,r){return this.withArtifactLock(t,r,async()=>{await this.requireRegistration(t,"deleteRemoteArtifact").api.delete(this.dataverse,r),await this.workspace.readArtifact(t,r)&&await this.workspace.deleteArtifact(t,r)})}async publishArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.publishArtifactUnlocked(t,r,n))}async publishArtifactUnlocked(t,r,n){var i;let a=await this.readRaw(t,r),o=this.registrations.get(t);if(!o?.publish)return{type:t,id:r,shipped:!1,publish:{kind:"notApplicable"}};let s=(i=o.publishScope)===null||i===void 0?void 0:i.call(o,r,a);try{await o.publish(this.dataverse,r,a)}catch(u){return{type:t,id:r,shipped:!1,publish:{kind:"failed",error:ms(u)},...s?{publishScope:s}:{}}}if(!n?.verify)return{type:t,id:r,shipped:!1,publish:{kind:"submitted"},...s?{publishScope:s}:{}};let l=await this.verifyPublished(t,r);return{type:t,id:r,shipped:l.kind==="verified",publish:l,...s?{publishScope:s}:{}}}async verifyPublished(t,r){if(t!=="app")return{kind:"unverifiable",reason:`published-projection verification is not characterised for '${t}'; the publish was submitted`};try{let n=`/appmodules(${(0,Gn.normalizeGuid)(r,"id")})${(0,Gn.odataQuery)([["$select","appmoduleid"]])}`,i=await this.dataverse.get(n);return i.status>=200&&i.status<300?{kind:"verified"}:{kind:"unverifiable",reason:`the published projection answered HTTP ${i.status}`}}catch(n){return{kind:"unverifiable",reason:ms(n).message}}}async pushArtifact(t,r){return this.withArtifactLock(t,r,()=>this.pushArtifactUnlocked(t,r))}async prepareArtifactUnlocked(t,r){let n=this.requireRegistration(t,"pushArtifact"),i=await this.readLocal(t,r),a=await this.versions.getMeta(t,r);this.assertLanguageMatches(t,r,a,n);let o=await this.buildMetadataContext(n.adapter,i),s=await n.adapter.toApiPayload(i,a?.snapshot,o);return await this.assertSemanticallyComplete(n,t,r,i,a===null,a?.everActivated),{type:t,id:r,reg:n,json:i,meta:a,payload:s}}async assertSemanticallyComplete(t,r,n,i,a,o){var s;let l=t.adapter.issuesBlockingPush;if(!l)return;let u=i.entityLogicalName,c=u?await this.workspace.readEntityMetadata(u):null,d=((s=c?.attributes)!==null&&s!==void 0?s:[]).map(f=>({logicalName:f.logicalName,displayName:f.displayName,attributeType:f.attributeType,isCustomAttribute:f.isCustomAttribute,...f.maxLength!==void 0?{maxLength:f.maxLength}:{},...f.options?{options:f.options.map(h=>({value:h.value,label:h.label}))}:{},...f.targets?{targets:f.targets}:{}})),p=l.call(t.adapter,i,d,{isCreate:a,everActivated:o});if(p.length>0)throw new ee.ValidationError(r,n,p)}async pushArtifactUnlocked(t,r){return this.executePrepared(await this.prepareArtifactUnlocked(t,r))}async executePrepared(t){var r,n,i,a,o,s;let{type:l,id:u,reg:c,json:d,meta:p,payload:f}=t;try{let h=p?await c.api.update(this.dataverse,u,f,p.etag,p.memberEtags,p.siblingEtags):await this.createWithMintedId(c,l,u,f),g=u;return p||(h.serverIdentity&&c.adapter.applyServerIdentity&&c.adapter.applyServerIdentity(d,h.serverIdentity),h.id&&h.id!==u&&(d.id=h.id,await this.workspace.deleteArtifact(l,u),g=h.id),await this.workspace.writeArtifact(l,g,d)),await this.versions.storeMeta(l,g,{etag:h.etag,languageCode:this.languageCode,fetchedAt:(0,Mr.nowIso)(),snapshot:(0,un.cloneJson)(d),...h.memberEtags?{memberEtags:h.memberEtags}:{},...h.siblingEtags?{siblingEtags:h.siblingEtags}:{}}),{type:l,id:g,saved:!0,shipped:!1,publish:(r=h.publish)!==null&&r!==void 0?r:{kind:"notRequested"},...h.publish&&h.publish.kind!=="notRequested"?(()=>{var w;let S=(w=c.publishScope)===null||w===void 0?void 0:w.call(c,g,d);return S?{publishScope:S}:{}})():{},...h.warnings&&h.warnings.length>0?{warnings:h.warnings}:{}}}catch(h){let g=(0,ee.readPartialTokens)(h);if(g&&p){let w={...(n=p.memberEtags)!==null&&n!==void 0?n:{},...(i=g.memberEtags)!==null&&i!==void 0?i:{}},S={...(a=p.siblingEtags)!==null&&a!==void 0?a:{},...(o=g.siblingEtags)!==null&&o!==void 0?o:{}};await this.versions.storeMeta(l,u,{...p,...Object.keys(w).length>0?{memberEtags:w}:{},...Object.keys(S).length>0?{siblingEtags:S}:{}})}if(h instanceof ee.SdkError&&h.code===Ut.ALREADY_EXISTS_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ee.SdkError&&h.code===Y_.WFOM_API_UNAVAILABLE_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ee.SdkError&&h.code===Y_.BUSINESS_RULE_LEFT_DEACTIVATED_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ee.SdkError&&h.code===Mr.VERSION_CONFLICT_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:new ee.VersionConflictError(l,u,(s=p?.etag)!==null&&s!==void 0?s:null,null,h.message)};throw h}}assertLanguageMatches(t,r,n,i){if(i?.languageSensitive&&!(n?.languageCode===void 0||n.languageCode===this.languageCode))throw new ee.SdkError("ARTIFACT_LANGUAGE_MISMATCH",`Refusing to push ${t} '${r}': it was fetched with languageCode ${n.languageCode} but this SDK is configured with ${this.languageCode}. Pushing would rewrite labels read in one language as labels in another. Re-fetch with languageCode ${this.languageCode}, or create the SDK with languageCode ${n.languageCode}.`)}async createWithMintedId(t,r,n,i){try{return await t.api.create(this.dataverse,i,n)}catch(a){throw!(a instanceof ee.SdkError)||a.code!==Mr.VERSION_CONFLICT_CODE?a:new ee.SdkError(Ut.ALREADY_EXISTS_CODE,`Cannot create ${r} '${n}': a record already exists at that id, so an earlier push of this artifact committed before its local version metadata was saved. No duplicate was created. Run fetchArtifact('${r}', '${n}') to adopt the existing record's identity, etag and snapshot, then push again \u2014 that push will be a conditional update. This is not done automatically because the only recovery available here would be an UNCONDITIONAL overwrite, which would destroy any edit made to the record in the meantime.`)}}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(l=>l.entityLogicalName).filter(l=>!!l)),s=new Map;for(let l of o){let u=await this.workspace.readEntityMetadata(l);if(!u)try{await this.fetchEntityMetadata(l),u=await this.workspace.readEntityMetadata(l)}catch{}u&&s.set(l,u)}return{resolveField:(l,u)=>{let c=s.get(l),d=c?.attributes.find(p=>p.logicalName===u);return d?{displayName:d.displayName,attributeType:d.attributeType}:void 0}}}async pushAll(){let t=await this.getDirtyArtifacts();await this.warmBatchMetadata(t);let r=new Map;for(let i=0;i<t.length;i+=1){let a=t[i];try{await this.withArtifactLock(a.type,a.id,()=>this.prepareArtifactUnlocked(a.type,a.id))}catch(o){r.set(i,{type:a.type,id:a.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:ms(o)})}}if(r.size>0)return t.map((i,a)=>{var o;return(o=r.get(a))!==null&&o!==void 0?o:{type:i.type,id:i.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:new ee.SdkError(Ut.PUSH_NOT_ATTEMPTED_CODE,`Not attempted: ${r.size} artifact(s) in this batch could not be prepared, so no writes were issued. Fix the reported failures and push again.`)}});let n=[];for(let i of t)try{n.push(await this.pushArtifact(i.type,i.id))}catch(a){n.push({type:i.type,id:i.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:ms(a)})}return n}async warmBatchMetadata(t){var r,n,i;let a=new Set;for(let o of t){let s=this.registrations.get(o.type);if(!s)continue;let l;try{l=await this.readLocal(o.type,o.id)}catch{continue}let u=l.entityLogicalName;u&&a.add(u);for(let c of(i=(n=(r=s.adapter).metadataNeeds)===null||n===void 0?void 0:n.call(r,l))!==null&&i!==void 0?i:[])c.entityLogicalName&&a.add(c.entityLogicalName)}for(let o of a)if(!await this.workspace.readEntityMetadata(o))try{await this.fetchEntityMetadata(o)}catch{}}async getDirtyArtifacts(){return(await this.withDirtyFlags(await this.workspace.listArtifacts())).filter(r=>r.isDirty)}async 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,q7.assignMissingIds)(r)}async resolveComponentType(t){switch(t.componentType){case lt.SolutionComponentType.SavedQuery:return"view";case lt.SolutionComponentType.SavedQueryVisualization:return"chart";case lt.SolutionComponentType.AppModule:return"app";case lt.SolutionComponentType.UxAgentProject:return"genPage";case lt.SolutionComponentType.Workflow:return t.workflowCategory===2?"businessRule":t.workflowCategory===4&&await this.isBusinessFlowWorkflow(t.objectId)?"bpf":void 0;case lt.SolutionComponentType.SystemForm:return await this.isDashboardForm(t.objectId)?"dashboard":"form";default:return}}async isDashboardForm(t){let n=`/systemforms(${(0,Gn.normalizeGuid)(t,"formId")})${(0,Gn.odataQuery)([["$select","type"]])}`,i=(0,Mr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n)),a=Number(i.body.type);return a===0||a===10}async isBusinessFlowWorkflow(t){let n=`/workflows(${(0,Gn.normalizeGuid)(t,"workflowId")})${(0,Gn.odataQuery)([["$select","businessprocesstype"]])}`,i=(0,Mr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n));return Number(i.body.businessprocesstype)===0}requireRegistration(t,r){let n=this.registrations.get(t);if(!n)throw new ee.NotImplementedError(r,`no adapter registered for artifact type '${t}'`);return n}};Ut.MakerSdk=sc;function J7(e){return new sc(e)}Ut.createMakerSdk=J7;function ms(e){return e instanceof Error?e:new Error(String(e))}function zn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Q7(e){let t=e.lastIndexOf("/");return t<=0?"":e.slice(0,t)}function K7(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=>zn(i)&&i.id===t.before);return n<0?e.length:n}let r=e.findIndex(n=>zn(n)&&n.id===t.after);return r<0?e.length:r+1}});var iT=v(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.ARTIFACT_TYPES=void 0;lc.ARTIFACT_TYPES=["form","view","businessRule","app","command","chart","dashboard","genPage","bpf"]});var oT=v(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0})});var lT=v(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0})});var cT=v(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0})});var pT=v(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0})});var mT=v(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0})});var gT=v(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0})});var yT=v(vT=>{"use strict";Object.defineProperty(vT,"__esModule",{value:!0})});var wT=v(bT=>{"use strict";Object.defineProperty(bT,"__esModule",{value:!0})});var CT=v(AT=>{"use strict";Object.defineProperty(AT,"__esModule",{value:!0})});var ET=v(ST=>{"use strict";Object.defineProperty(ST,"__esModule",{value:!0})});var DT=v(NT=>{"use strict";Object.defineProperty(NT,"__esModule",{value:!0})});var _T=v(IT=>{"use strict";Object.defineProperty(IT,"__esModule",{value:!0})});var PT=v(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0})});var RT=v(OT=>{"use strict";Object.defineProperty(OT,"__esModule",{value:!0})});var xT=v(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0})});var kT=v(LT=>{"use strict";Object.defineProperty(LT,"__esModule",{value:!0})});var BT=v(MT=>{"use strict";Object.defineProperty(MT,"__esModule",{value:!0})});var $T=v(UT=>{"use strict";Object.defineProperty(UT,"__esModule",{value:!0})});var VT=v(qT=>{"use strict";Object.defineProperty(qT,"__esModule",{value:!0})});var GT=v(le=>{"use strict";var X7=le&&le.__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]})),Ie=le&&le.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&X7(t,e,r)};Object.defineProperty(le,"__esModule",{value:!0});le.createMakerSdk=void 0;var Y7=nT();Object.defineProperty(le,"createMakerSdk",{enumerable:!0,get:function(){return Y7.createMakerSdk}});Ie(iT(),le);Ie(oT(),le);Ie(lT(),le);Ie(cT(),le);Ie(pT(),le);Ie(mT(),le);Ie(gT(),le);Ie(yT(),le);Ie(wT(),le);Ie(CT(),le);Ie(ET(),le);Ie(DT(),le);Ie(_T(),le);Ie(il(),le);Ie(PT(),le);Ie(RT(),le);Ie(xT(),le);Ie(kT(),le);Ie(BT(),le);Ie($T(),le);Ie(VT(),le);Ie(re(),le)});var Ym=v(Br=>{"use strict";var Z7=Br&&Br.__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]})),ez=Br&&Br.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),HT=Br&&Br.__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)&&Z7(t,e,r);return ez(t,e),t};Object.defineProperty(Br,"__esModule",{value:!0});Br.NodeFileSystemStorage=void 0;var Ue=HT(require("fs")),ut=HT(require("path")),zT=re(),WT=Pc();async function jT(e){let t;try{t=await Ue.promises.lstat(e)}catch{return}if(t.isSymbolicLink()){try{await Ue.promises.unlink(e)}catch{await Ue.promises.rmdir(e)}return}if(!t.isDirectory()){await Ue.promises.unlink(e);return}for(let r of await Ue.promises.readdir(e))await jT(ut.join(e,r));await Ue.promises.rmdir(e)}var Xm=class{constructor(t){this.root=t}getRoot(){return this.root}pathFor(t,r=!0){return this.assertWithinRoot(ut.join(this.root,...t),r)}realPathThroughNearestAncestor(t){let r=t,n=[];for(;!Ue.existsSync(r);){n.unshift(ut.basename(r));let i=ut.dirname(r);if(i===r)return ut.resolve(t);r=i}return ut.resolve(Ue.realpathSync(r),...n)}assertWithinRoot(t,r){let n=ut.resolve(this.root),i=ut.resolve(t);if(i!==n&&!i.startsWith(n+ut.sep))throw new zT.PathTraversalError(t,this.root);let a=this.realPathThroughNearestAncestor(n),o=r?this.realPathThroughNearestAncestor(i):ut.resolve(this.realPathThroughNearestAncestor(ut.dirname(i)),ut.basename(i));if(o!==a&&!o.startsWith(a+ut.sep))throw new zT.PathTraversalError(t,this.root);return i}async readText(t){let r=this.pathFor(t);if(!Ue.existsSync(r))return null;try{return await(0,WT.retryTransientIoAsync)(()=>Ue.promises.readFile(r,"utf8"))}catch(n){if(n.code==="ENOENT")return null;throw n}}async writeTextAtomic(t,r){let n=this.pathFor(t),i=ut.dirname(n);await Ue.promises.mkdir(i,{recursive:!0});let a=ut.join(i,`.${ut.basename(n)}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);try{await Ue.promises.writeFile(a,r,"utf8"),await(0,WT.retryTransientIoAsync)(()=>Ue.promises.rename(a,n))}catch(o){try{Ue.existsSync(a)&&await Ue.promises.unlink(a)}catch{}throw o}}async deleteFile(t){let r=this.pathFor(t);Ue.existsSync(r)&&await Ue.promises.unlink(r)}async deleteByPrefix(t){await jT(this.pathFor(t,!1))}async ensureContainer(t){await Ue.promises.mkdir(this.pathFor(t),{recursive:!0})}async exists(t){return Ue.existsSync(this.pathFor(t))}};Br.NodeFileSystemStorage=Xm});var JT=v($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.createNodeWorkspaceStorage=$a.NodeFileSystemStorage=void 0;var tz=Ym(),rz=Ym();Object.defineProperty($a,"NodeFileSystemStorage",{enumerable:!0,get:function(){return rz.NodeFileSystemStorage}});function nz(e){return new tz.NodeFileSystemStorage(e)}$a.createNodeWorkspaceStorage=nz});var cn={};module.exports=mr(cn);dn(cn,ne(GT()),module.exports);dn(cn,ne(JT()),module.exports);
+`),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 me.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=(0,oL.parseChangeSetStatuses)(o.body,i.map((d,p)=>String(p+1)));if(u===void 0)throw new me.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 me.ConnectionError(s,c,`atomic delete of ${l} was rolled back: the change set reported HTTP ${c}`);if(u.length!==i.length)throw new me.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response reported ${u.length} operation result(s), expected exactly ${i.length}`)}async function Fd(e,t){try{let r=await e.get(`/sitemaps(${t})?$select=sitemapid`);return r.status<200||r.status>=300?null:(0,fe.readEtag)(r)}catch{return null}}async function Id(e,t,r,n){if(!n)return null;let i=await Fd(e,t);if(!i)return null;try{let a=await e.get(fl(t,"sitemapid,sitemapname,sitemapnameunique,sitemapxml"));if(a.status<200||a.status>=300)return null;let o=Ji(a);return!o||!Od(o.sitemapid,t)||o.sitemapnameunique!==n||o.sitemapxml!==r.sitemapxml||o.sitemapname!==r.sitemapname?null:i}catch{return null}}function bL(e){return e>=400&&e<500&&e!==408&&e!==429}function _d(e,t,r){if(!e)throw new me.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 oy(e,t,r){let n=`/appmodules(${t})`;if(!r.sitemapId){await wL(e,n,_d(r.appEtag,t,"app"));return}if(!e.supportsAtomicBatch)throw new me.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 ay(e,[{path:n,etag:_d(r.appEtag,t,"app")},{path:`/sitemaps(${r.sitemapId})`,etag:_d(r.sitemapEtag,t,"sitemap")}])}async function wL(e,t,r){(0,fe.ensureSuccess)(await e.delete(t,{headers:{"If-Match":r}}),e.apiUrl(t))}async function ty(e,t){if(!/GenPageId/i.test(t))return;let r;try{r=[...new Set((0,iL.collectGenPageIds)(t))]}catch(o){throw new me.SdkError("SITEMAP_TARGET_UNVERIFIABLE",`Refusing to push the app: its sitemap xml could not be parsed, so the generative pages it navigates to cannot be verified (${Rd(o)}).`)}if(r.length===0)return;let n=new Set,i=50;for(let o=0;o<r.length;o+=i){let s=r.slice(o,o+i),l="/uxagentprojects/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ne.odataQuery)([["$select","uxagentprojectid"],["$filter",s.map(c=>`uxagentprojectid eq ${c}`).join(" or ")]]),u=await(0,Pd.collectPages)(e,l,"sitemap generative-page preflight");for(let c of u){let d=c.uxagentprojectid;typeof d=="string"&&d.trim()!==""&&n.add((0,ne.normalizeGuid)(d,"uxagentprojectid"))}}let a=r.filter(o=>!n.has(o));if(a.length>0)throw new me.SdkError("SITEMAP_TARGET_NOT_FOUND",`Refusing to push the app: its sitemap navigates to generative page(s) ${a.map(o=>`'${o}'`).join(", ")} that do not exist in this environment. Push the page before the app that links to it.`)}function AL(e){var t,r;if(e.status!==400)return!1;let n=e.body;return String((r=(t=n?.error)===null||t===void 0?void 0:t.message)!==null&&r!==void 0?r:"").includes("retrieval of version numbers failed")}Rn.appApi={async get(e,t){var r;let n=(0,ne.normalizeGuid)(t,"id"),i=Dd(Nd,n),a=(0,fe.ensureSuccess)(await e.get(i),e.apiUrl(i)),o=(r=Ji(a))!==null&&r!==void 0?r:{};if(!o.appmoduleid)throw new me.SdkError("APP_NOT_FOUND",`App '${n}' was not found (checked the unpublished-aware projection, which includes drafts).`);let s=await ny(e,o.uniquename),l=s?(0,ne.normalizeGuid)(s,"sitemapId"):void 0,u=null;if(l){u=await Fd(e,l);let d=fl(l,"sitemapid,sitemapname,sitemapnameunique,sitemapxml"),p=(0,fe.ensureSuccess)(await e.get(d),e.apiUrl(d)),f=Ji(p),m=g=>{throw new me.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to fetch app '${n}': its sitemap '${l}' was located by unique name, but ${g}, so the sitemap cannot be read. Persisting the app without it would misreport it as having no sitemap, or write an empty one over its navigation. Retry.`)};if(!f)return m("the by-id read returned no row");if(f.sitemapnameunique!==o.uniquename)throw new me.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.`);if(!Od(f.sitemapid,l))return m(`the by-id read returned a row carrying sitemapid '${String(f.sitemapid)}'`);if(typeof f.sitemapxml!="string")return m("the by-id read returned no sitemapxml");o.$sitemap=f}let c=lL(o);return{raw:o,etag:u,...o.appmoduleid?{siblingEtags:{[(0,ne.normalizeGuid)(o.appmoduleid,"appmoduleid")]:c}}:{}}},async list(e,t){let r=Dd(Nd);return(await(0,Pd.collectPages)(e,r,"listArtifacts('app')")).map(i=>{var a,o;return{type:"app",id:(a=i.appmoduleid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",isDirty:!1}})},async create(e,t,r){let n=t;await ty(e,n.sitemapxml);let i=n.iconWebResourceId?void 0:await cL(e),a=n.iconWebResourceId||i?.id;if(!a)throw new me.SdkError("APP_ICON_UNRESOLVED",`Cannot create app '${n.appModuleName}': its icon (\`appmodule.webresourceid\`) is a REQUIRED attribute and this environment has no image web resource to use. Pass \`iconWebResourceId\` explicitly, or add an image (PNG/JPG/GIF/ICO/SVG) web resource to the environment.`);let o=null;i?.managed&&(o=`No unmanaged image web resource was available, so the app icon resolved to a MANAGED one (${i.id}). That creates a cross-solution dependency which can fail to import into an environment without the owning managed solution. Pass \`iconWebResourceId\` with an in-solution image to avoid it.`);let s=n.appModuleUniqueName||uL(n.appModuleId),l={name:n.appModuleName,uniquename:s,clienttype:4,formfactor:1,navigationtype:0};n.appModuleDescription&&(l.description=n.appModuleDescription),n.appModuleAiDescription&&(l.aiappdescription=n.appModuleAiDescription),a&&(l.webresourceid=a);let u="/appmodules",c=(0,fe.ensureSuccess)(await e.post(u,(0,fe.withClientMintedId)(l,"appmoduleid",r)),e.apiUrl(u)),d=(0,fe.resolveCreatedId)(c,"appmoduleid","app module",r),p=null,f=null,m=[];o&&m.push(o);let g={kind:"notRequested"},y=n.sitemapId?(0,ne.normalizeGuid)(n.sitemapId,"sitemapId"):(0,Td.newId)(),A=!1,D={sitemapxml:n.sitemapxml,sitemapname:n.sitemapname};try{let _="/sitemaps",q=(0,fe.echoWrite)("sitemapid"),B=await e.post(`${_}${q.query}`,{sitemapid:y,sitemapnameunique:s,...D},q.options);A=bL(B.status);let L=(0,fe.ensureSuccess)(B,e.apiUrl(_));f=(0,fe.readEtag)(L),p=f??await Id(e,y,D,s);let k=await Yv(e,n);m.push(...k.warnings);let M=k.components;M.unshift({"@odata.type":"Microsoft.Dynamics.CRM.sitemap",sitemapid:y}),await Zv(e,d,M),await ey(e,d,k.tables);let G=await dL(e,d);G&&m.push(G),n.appSettings&&Object.keys(n.appSettings).length>0&&m.push(...await(0,aL.applyAppSettings)(e,d,n.appSettings)),n.published!==!1&&(await(0,Qv.publishAppModule)(e,d),g={kind:"submitted"})}catch(_){throw await gL(e,d,{sitemapId:y,sitemapNameUnique:s,serverRefusedSitemap:A,sitemapWriteToken:f}),_}let F=null;if(g.kind==="submitted")try{let _=await e.get(`/appmodules(${d})?$select=appmoduleid`);_.status>=200&&_.status<300&&(F=(0,fe.readEtag)(_))}catch{}return{id:d,etag:p,serverIdentity:{sitemapId:y},siblingEtags:{[d]:F},publish:g,...m.length>0?{warnings:m}:{}}},async update(e,t,r,n,i,a){var o,s,l,u,c,d,p,f,m;let g=r,y=(0,ne.normalizeGuid)(t,"id");if(await ty(e,g.sitemapxml),!g.sitemapId)throw new me.ValidationError("app",y,[{pointer:"/sitemapId",rule:"app-sitemap-identity-missing",message:`missing sitemap identity \u2014 re-fetch the app before pushing edits: fetchArtifact('app', '${y}', { overwrite: true }) (it REPLACES the local copy \u2014 keep outstanding changes aside), push that refreshed copy UNTOUCHED, then re-apply your changes and push again. If the untouched push is refused with this same rule, the app has NO sitemap on the server \u2014 an earlier create committed its appmodule but not its sitemap \u2014 and it can be neither updated, published nor removed with deleteRemoteArtifact (an unpublished app reads back 404). Only for an app you have confirmed is your own abandoned partial create, with nothing else provisioning it: remove its appmodule row with deleteRecord('appmodule', '${y}'), clear the local copy with deleteArtifact('app', '${y}'), then author the app again and push.`}]);let A=(0,ne.normalizeGuid)(g.sitemapId,"sitemapId");if(!n)throw new me.SdkError("APP_UPDATE_NO_ETAG",`Refusing to push app '${y}': 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 D=await Yv(e,g),F=`/appmodules(${y})`,_=(o=a?.[y])!==null&&o!==void 0?o:null,q=!0,B=!1,L;try{let xe=Dd(Nd,y),yn=await e.get(xe);if(yn.status>=200&&yn.status<300){let $t=(s=Ji(yn))!==null&&s!==void 0?s:{};B=!0,L=typeof $t.uniquename=="string"&&$t.uniquename?$t.uniquename:void 0,q=String((l=$t.name)!==null&&l!==void 0?l:"")!==String((u=g.appModuleName)!==null&&u!==void 0?u:"")||String((c=$t.description)!==null&&c!==void 0?c:"")!==String((d=g.appModuleDescription)!==null&&d!==void 0?d:"")||g.appModuleAiDescription!==void 0&&String((p=$t.aiappdescription)!==null&&p!==void 0?p:"")!==String(g.appModuleAiDescription)}}catch{}let k=_;if(q){let xe=B?_:null,yn=xe?(0,fe.echoWrite)("appmoduleid",{"If-Match":xe}):{query:"",options:void 0},$t=await e.patch(`${F}${yn.query}`,{name:g.appModuleName,description:g.appModuleDescription,...g.appModuleAiDescription!==void 0?{aiappdescription:g.appModuleAiDescription}:{}},yn.options);if(AL($t))throw new me.SdkError("APP_DRAFT_HEADER_NOT_WRITABLE",`Refusing to update app '${y}': its appmodule row is UNPUBLISHED, and Dataverse cannot resolve version numbers for a draft appmodule (HTTP 400). A draft header cannot be PATCHed at all \u2014 a plain retry fails too, as an upsert-create ("webresourceid cannot be NULL"). Publish the app first, then push the header edit. Nothing was modified by this call.`);(0,fe.ensureSuccess)($t,e.apiUrl(F)),k=(0,fe.readEtag)($t)}let M={sitemapxml:g.sitemapxml,sitemapname:g.sitemapname},G=L||g.appModuleUniqueName||void 0,V=(0,fe.echoWrite)("sitemapid",{"If-Match":n}),Ze=`/sitemaps(${A})`,ir;try{ir=(0,fe.ensureSuccess)(await e.patch(`${Ze}${V.query}`,{...M},V.options),e.apiUrl(Ze))}catch(xe){throw(0,me.withPartialTokens)(xe,{siblingEtags:{[y]:k}})}let et=[...D.warnings];try{await Zv(e,y,D.components),await ey(e,y,D.tables)}catch(xe){et.push(`App '${y}': one or more components were not pinned (${xe.message}). Navigation may reference content not included in the app; re-push to retry.`)}let dt={kind:"notRequested"},ue=k,$e=(f=(0,fe.readEtag)(ir))!==null&&f!==void 0?f:await Id(e,A,M,G);if(g.published===!0){try{await(0,Qv.publishAppModule)(e,y),dt={kind:"submitted"}}catch(xe){dt={kind:"failed",error:xe},et.push(`App '${y}': saved, but publishing failed (${xe.message}). The app remains unpublished; re-push to retry.`)}if(dt.kind==="submitted"){ue=null;try{let xe=await e.get(`/appmodules(${y})?$select=appmoduleid`);xe.status>=200&&xe.status<300&&(ue=(0,fe.readEtag)(xe)),$e=(m=await Id(e,A,M,G))!==null&&m!==void 0?m:$e}catch{}}}return{id:y,etag:$e,siblingEtags:{[y]:ue},publish:dt,...et.length>0?{warnings:et}:{}}},async delete(e,t){let r=(0,ne.normalizeGuid)(t,"id");await oy(e,r,await iy(e,r))}}});var xd=v(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.deleteAppCascade=Qi.collectGenPageIds=void 0;var CL=ml(),EL=te(),Ld=ae(),SL=yd();function sy(e){let t=[],r=s=>l=>t.push(`${s}: ${l}`),i=new SL.DOMParser({errorHandler:{warning:r("warning"),error:r("error"),fatalError:r("fatalError")}}).parseFromString(e,"text/xml").documentElement;if(!i||t.length>0)throw new EL.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,Ld.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}Qi.collectGenPageIds=sy;async function NL(e,t,r){let n=(0,Ld.normalizeGuid)(t,"appModuleId");(0,Ld.normalizeGuid)(r,"appModuleIdUnique");let i=[],a=[],o=[];await(0,CL.deleteAppResolvingOnce)(e,n,l=>{l!==void 0&&o.push(...sy(l))}),i.push({type:"app",id:n});let s=[...new Set(o)].map(l=>({type:"genPage",id:l}));return{success:a.length===0,deleted:i,failures:a,retained:s}}Qi.deleteAppCascade=NL});var ly={};zr(ly,{Guid:()=>P});var P,Le=I(()=>{"use strict";P=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 O,nt=I(()=>{"use strict";Oe();O=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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),r&&(n=n.replace(/"/g,"&quot;").replace(/'/g,"&apos;"))),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 uy={};zr(uy,{ScriptUtilities:()=>N});var N,Oe=I(()=>{"use strict";Le();nt();N=class e{static IsNullOrUndefined(t){return t==null||t===void 0}static IsMacMachine(){return navigator.platform.indexOf("Mac")!==-1}static IsNullOrEmptyGuid(t){return O.IsNullOrEmpty(t.ToString())?!0:P.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:O.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 hl,gl,ii,vl,kd,yl,Md=I(()=>{"use strict";(function(e){e[e.FormElementNodeChange=0]="FormElementNodeChange",e[e.FormElementAttributeChange=1]="FormElementAttributeChange"})(hl||(hl={}));gl=class{type;targetNode;constructor(t,r){this.type=t,this.targetNode=r}},ii=class extends gl{key;oldValue;newValue;constructor(t,r,n,i){super(hl.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)}},vl=class extends gl{property;oldValue;newValue;constructor(t,r,n,i){super(hl.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)}},kd=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()})}},yl=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 kd(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 cy={};zr(cy,{ChartGridMode:()=>zt,ColumnLayoutWidths:()=>PL,ComponentCategory:()=>wl,ComponentType:()=>Ud,ControlLayoutTypes:()=>Wd,DisplayConditionsInfo:()=>_L,ElementNames:()=>b,ElementProperties:()=>h,ElementType:()=>$d,EntityAttributeProperty:()=>qd,EventType:()=>Eo,FormActivationState:()=>zd,FormCanvasServiceScope:()=>VL,FormDesignerSideBarTab:()=>Bd,FormPresentation:()=>Vd,FormState:()=>bl,FormType:()=>ke,HeaderDensityType:()=>Fn,LookUpTable:()=>_r,MORE_TAB_PREFIX:()=>RL,NavBarChildElementType:()=>Gd,PREVIEW_ID_HEADER_FLYOUT:()=>kL,PREVIEW_ID_HEADER_OVERFLOW_BUTTON:()=>UL,PREVIEW_ID_NAVIGATION_AREA:()=>xL,PREVIEW_ID_QUICKCREATE_ROOT:()=>$L,PREVIEW_ID_TAB:()=>BL,PREVIEW_ID_TAB_LIST:()=>ML,PREVIEW_ID_TAB_PANEL:()=>LL,PropertyModelKeys:()=>Jd,PropertyModelSectionKeys:()=>OL,RELATED_TAB_ID:()=>Qd,RELATED_TAB_PREFIX:()=>FL,SectionDefaultProperties:()=>TL,SectionLayoutTypes:()=>Ce,TabContentType:()=>Hd,TabDefaultProperties:()=>xn,TabLayoutTypes:()=>Ae,TelemetryPropertyNames:()=>qL,UnboundControlPropertyKeys:()=>jd,compositeAddressFields:()=>IL,compositeFieldNames:()=>Lt,compositeFields:()=>DL});var ke,Ud,Bd,b,h,$d,Lt,DL,IL,qd,_r,bl,Fn,Vd,_L,Gd,zd,Ae,TL,xn,Ce,Wd,Hd,PL,jd,Jd,OL,Eo,zt,Qd,RL,FL,xL,LL,kL,ML,UL,BL,$L,qL,wl,VL,X=I(()=>{"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"})(ke||(ke={}));(function(e){e[e.Form=0]="Form",e[e.Dialog=1]="Dialog"})(Ud||(Ud={}));(function(e){e[e.Components=0]="Components",e[e.Properties=1]="Properties",e[e.Relationship=2]="Relationship",e[e.BusinessRules=3]="BusinessRules"})(Bd||(Bd={}));(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"})(b||(b={}));h={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"})($d||($d={}));Lt={fullname:"fullname",yomifullname:"yomifullname",address1_composite:"address1_composite",address2_composite:"address2_composite",address3_composite:"address3_composite",billto:"billto_composite",shipto:"shipto_composite"},DL=[Lt.fullname,Lt.yomifullname,Lt.address1_composite,Lt.address2_composite,Lt.address3_composite,Lt.billto,Lt.shipto],IL=[Lt.address1_composite,Lt.address2_composite,Lt.address3_composite,Lt.billto,Lt.shipto];(function(e){e[e.IsValidForForm=0]="IsValidForForm",e[e.IsValidForCreate=1]="IsValidForCreate"})(qd||(qd={}));(function(e){e[e.DependencyFieldTable=0]="DependencyFieldTable",e[e.LockedFieldTable=1]="LockedFieldTable"})(_r||(_r={}));(function(e){e[e.Published=0]="Published",e[e.Draft=1]="Draft",e[e.New=2]="New",e[e.SaveAs=3]="SaveAs"})(bl||(bl={}));(function(e){e.Low="Low",e.HighReadOnlyValues="HighReadOnlyValues",e.HighWithControls="HighWithControls"})(Fn||(Fn={}));(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(Vd||(Vd={}));_L={TopOrderFormId:"topOrderFormId",NextDisplayOrder:"nextDisplayOrder"};(function(e){e[e.NavBarRelationShipItem=0]="NavBarRelationShipItem",e[e.NavBarItem=1]="NavBarItem"})(Gd||(Gd={}));(function(e){e[e.InActive=0]="InActive",e[e.Active=1]="Active"})(zd||(zd={}));(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"})(Ae||(Ae={}));TL={ShowLabel:"false",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_"},xn={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"})(Ce||(Ce={}));(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"})(Wd||(Wd={}));(function(e){e.cardSections="cardSections",e.singleComponent="singleComponent",e.default="default",e.expandAvailableSpace="expandAvailableSpace"})(Hd||(Hd={}));PL={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"})(jd||(jd={}));(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"})(Jd||(Jd={}));OL={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"})(Eo||(Eo={}));(function(e){e.All="All",e.Chart="Chart",e.Grid="Grid"})(zt||(zt={}));Qd="tab_related3b554255-7717-4d17-bb7f-9936fb1e75ca",RL="more_tab_",FL="related_tab_",xL="preview_id_navigation_area",LL="tab-section",kL="headerFieldsFlyout",ML="tablist",UL="header_overflowButton",BL="tab",$L="quickCreateRoot",qL={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"})(wl||(wl={}));VL="CellCanvasServiceScope"});var dy={};zr(dy,{Attribute:()=>Al,FormElementNode:()=>H});var Al,H,We=I(()=>{"use strict";Oe();nt();Md();X();Le();Al=class{key;value;constructor(t,r){this.key=t,this.value=r}},H=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-${P.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(b.form);r&&r.raiseMetadataChange(t)}trackPropertyAddition(t,r){this.trackPropertyCollectionChange(()=>{this.properties.push(new Al(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 ii(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 ii(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 ii(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 vl(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 ii(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:O.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 b.formCell:let t=this.getAncestor(b.formSection);return t||(t=this.getAncestor(b.formHeader),t)||(t=this.getAncestor(b.formFooter),t)?t:null;case b.formSection:return this.getAncestor(b.formTab);case b.formTab:return this.getAncestor(b.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(b.form);return t?t.changeTracker():null}}});var py={};zr(py,{ControlClassId:()=>S,ControlNamePrefixes:()=>Cl,getControlDisplayNames:()=>GL});function GL(e){return{[S.AccessPrivilegeControl]:e("controls.controlNames.accessPrivilege"),[S.AccessTeamTablePickerControl]:e("controls.controlNames.accessTeamTablePicker"),[S.ACIControl]:e("controls.controlNames.aci"),[S.ActivitiesContainerControl]:e("controls.controlNames.activitiesContainer"),[S.ActivitiesWallControl]:e("controls.controlNames.activitiesWall"),[S.AppliedFiltersControl]:e("controls.controlNames.appliedFilters"),[S.ArticleContentControl]:e("controls.controlNames.articleContent"),[S.BooleanControl]:e("controls.controlNames.twoOption"),[S.ButtonControl]:e("controls.controlNames.button"),[S.CheckboxControl]:e("controls.controlNames.checkbox"),[S.CompositionLinkControl]:e("controls.controlNames.compositionLink"),[S.ConnectionControl]:e("controls.controlNames.connection"),[S.ConnectionRoleObjectTypeListControl]:e("controls.controlNames.connectionRoleObjectTypeList"),[S.CoverageChoiceControl]:e("controls.controlNames.coverageChoice"),[S.DashboardControl]:e("controls.controlNames.dashboard"),[S.DynamicPropertyListControl]:e("controls.controlNames.dynamicPropertyList"),[S.EditFilterControl]:e("controls.controlNames.editFilter"),[S.ErrorStatusControl]:e("controls.controlNames.errorStatus"),[S.GlobalFilterControl]:e("controls.controlNames.globalFilter"),[S.HiddenInputControl]:e("controls.controlNames.hiddenInput"),[S.KBViewerControl]:e("controls.controlNames.kbViewer"),[S.LabelControl]:e("controls.controlNames.label"),[S.MailMergeLanguagePickerControl]:e("controls.controlNames.mailMergeLanguagePicker"),[S.MapLinkControl]:e("controls.controlNames.mapLink"),[S.OrgInsightsControl]:e("controls.controlNames.orgInsights"),[S.ChoiceLookupControl]:e("controls.controlNames.choiceLookup"),[S.PowerBIControl]:e("controls.controlNames.powerBI"),[S.ProcessControl]:e("controls.controlNames.process"),[S.RelatedInformationControl]:e("controls.controlNames.relatedInformation"),[S.RelationshipRoleChoiceControl]:e("controls.controlNames.relationshipRoleChoice"),[S.ReportControl]:e("controls.controlNames.report"),[S.StreamsControl]:e("controls.controlNames.streams"),[S.WebResourceSilverlightControl]:e("controls.controlNames.webResourceSilverlight"),[S.CurrencyControl]:e("controls.controlNames.currency"),[S.DateTimeControl]:e("controls.controlNames.dateAndTime"),[S.DecimalControl]:e("controls.controlNames.decimal"),[S.DurationControl]:e("controls.controlNames.duration"),[S.EmailAddressControl]:e("controls.controlNames.email"),[S.FileControl]:e("controls.controlNames.file"),[S.FloatingNumberControl]:e("controls.controlNames.floatingNumber"),[S.IframeControl]:e("controls.controlNames.iframe"),[S.ImageControl]:e("controls.controlNames.image"),[S.LookupControl]:e("controls.controlNames.lookup"),[S.MapsControl]:e("controls.controlNames.maps"),[S.PhoneNumberControl]:e("controls.controlNames.phoneNumber"),[S.ChoiceControl]:e("controls.controlNames.choice"),[S.QuickViewControl]:e("controls.controlNames.quickView"),[S.QuickFormControl]:e("controls.controlNames.quickForm"),[S.CustomControl]:e("controls.controlNames.customControl"),[S.SearchWidgetControl]:e("controls.controlNames.searchWidget"),[S.SocialInsightsControl]:e("controls.controlNames.socialInsights"),[S.SubgridControl]:e("controls.controlNames.subgrid"),[S.TextAreaControl]:e("controls.controlNames.textArea"),[S.TextboxControl]:e("controls.controlNames.textBox"),[S.TickerControl]:e("controls.controlNames.ticker"),[S.UrlControl]:e("controls.controlNames.url"),[S.WebResourceHTMLControl]:e("controls.controlNames.webResourceHTML"),[S.WebResourceImageControl]:e("controls.controlNames.webResourceImage"),[S.IntegerControl]:e("controls.controlNames.integer"),[S.TimerControl]:e("controls.controlNames.timer"),[S.TimelineControl]:e("controls.controlNames.timeline"),[S.EmailBodyControl]:e("controls.controlNames.emailBody"),[S.PartyListControl]:e("controls.controlNames.partyList"),[S.TimezoneControl]:e("controls.controlNames.timezone"),[S.LanguageControl]:e("controls.controlNames.language"),[S.ChoiceStatusControl]:e("controls.controlNames.choiceStatus"),[S.ChoicesControl]:e("controls.controlNames.choices"),[S.RegardingControl]:e("controls.controlNames.regarding"),[S.EmailEngagementActionsControl]:e("controls.controlNames.emailEngagementActions"),[S.EmailRecipientActivityControl]:e("controls.controlNames.emailRecipientActivity"),[S.ReferencePanelSearchWidgetControl]:e("controls.controlNames.referencePanelSearchWidget"),[S.ReferencePanelQuickViewControl]:e("controls.controlNames.referencePanelQuickView"),[S.ReferencePanelSubgridControl]:e("controls.controlNames.referencePanelSubgrid"),[S.KBEditorControl]:e("controls.controlNames.KBEditor"),[S.LinkControl]:e("controls.controlNames.link")}}var S,Cl,ai=I(()=>{"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"})(S||(S={}));Cl={[S.WebResourceHTMLControl]:"WebResource",[S.WebResourceImageControl]:"WebResource",[S.IframeControl]:"IFRAME",[S.SearchWidgetControl]:"Search widget",[S.SubgridControl]:"Subgrid",[S.TimelineControl]:"Timeline",[S.QuickViewControl]:"QuickviewControl"}});var oi=v((GW,my)=>{var So=new Proxy(function(){return So},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:So},apply:function(){return So},construct:function(){return{}}}),fy=function(){return So};Object.setPrototypeOf(fy,So);my.exports=fy});var ft,en,hy,gy,Ki=I(()=>{"use strict";ft="cds-designer-models",en="FormCustomControl",hy="FormCell",gy="Form"});var Xi,mt,No=I(()=>{"use strict";Xi=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}},mt=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 si,Kd=I(()=>{"use strict";No();X();si=class e{static lockedFieldCount=new mt;static dependencyFieldCount=new mt;static getNecessaryLookUpTable(t){switch(t){case _r.DependencyFieldTable:return e.dependencyFieldCount;case _r.LockedFieldTable:return e.lockedFieldCount}}static initCanvasLockedFieldLookUp(t){switch(t){case _r.DependencyFieldTable:e.dependencyFieldCount=new mt;case _r.LockedFieldTable:e.lockedFieldCount=new mt}}}});var El,vy=I(()=>{"use strict";Le();Oe();X();We();El=class extends H{constructor(t){super(b.controlDescription,t)}get forControl(){let t=this.getProperty(h.ForControl);return N.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t))}set forControl(t){this.setProperty(h.ForControl,`{${t.ToString()}}`)}get customControls(){return this.getChildren(b.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 by,wy,ht,T,yy,Ln,li,Yi,Xd,Yd,Zi=I(()=>{"use strict";by={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"},wy={GroupDefinition:"GroupDefinition"},ht={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"})(T||(T={}));(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"})(yy||(yy={}));(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"})(Ln||(Ln={}));(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"})(li||(li={}));(function(e){e[e.Bound=0]="Bound",e[e.Input=1]="Input",e[e.Output=2]="Output"})(Yi||(Yi={}));Xd=[T.LookupCustomer,T.LookupOwner,T.LookupPartyList,T.LookupRegarding,T.LookupSimple],Yd=[T.WholeNone,T.WholeDuration,T.WholeLanguage,T.WholeTimeZone,T.FP,T.Decimal]});function tn(){return Tr||(Tr=window._makerConfig,Tr&&window?.location?.search?.indexOf("useProductionConfig")>-1&&(Tr={...Tr,region:"prod",graphQLEndpoint:"https://graph.make.powerapps.com/"}),Tr?.region==="prod"&&(Tr={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/"}}},...Tr}),Tr||{aadClientId:"a8f7a65c-f5ba-4859-b2d6-df772c264e9d",location:"cus",region:"test",publicPath:"/",graphQLEndpoint:"https://graph.make.test.powerapps.com/"})}var Tr,Sl=I(()=>{"use strict";});function Ay(e,t,r){if(!e)return Nl.has(e)||(window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoIsEmpty"}),Nl.add("")),!1;if(e){if(e=e.toLowerCase(),Nl.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}}),Nl.add(e),!1}return!0}function zL(e){return Ay(e,Zd,"Location dictionary")?Zd[e.toLowerCase()]:"us"}function WL(){let e=tn().location.toLowerCase();return Ay(e,Zd,"Current location dictionary")?e:"us"}var Nl,Zd,iH,Cy=I(()=>{"use strict";Sl();Nl=new Set,Zd={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"};iH=zL(WL())});var U,oH,Ey=I(()=>{"use strict";U={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"},oH={[U.USWest]:{geoName:"us",regionShortName:"wus"},[U.USCentral]:{geoName:"us",regionShortName:"cus"},[U.USEast]:{geoName:"us",regionShortName:"eus"},[U.USEast2]:{geoName:"us",regionShortName:"eus2"},[U.USWestCentral]:{geoName:"us",regionShortName:"wcus"},[U.USWest2]:{geoName:"us",regionShortName:"wus2"},[U.USSouthCentral]:{geoName:"br",regionShortName:"scus"},[U.BrazilSouth]:{geoName:"br",regionShortName:"sbr"},[U.UKSouth]:{geoName:"uk",regionShortName:"suk"},[U.UKWest]:{geoName:"uk",regionShortName:"wuk"},[U.JapanEast]:{geoName:"jp",regionShortName:"ejp"},[U.JapanWest]:{geoName:"jp",regionShortName:"wjp"},[U.IndiaCentral]:{geoName:"in",regionShortName:"cin"},[U.IndiaSouth]:{geoName:"in",regionShortName:"sin"},[U.ItalyNorth]:{geoName:"it",regionShortName:"nit"},[U.GermanyWestCentral]:{geoName:"de",regionShortName:"wcde"},[U.GermanyNorth]:{geoName:"de",regionShortName:"nde"},[U.EuropeNorth]:{geoName:"eu",regionShortName:"neu"},[U.EuropeWest]:{geoName:"eu",regionShortName:"weu"},[U.AustraliaEast]:{geoName:"au",regionShortName:"eau"},[U.AustraliaSouthEast]:{geoName:"au",regionShortName:"seau"},[U.AsiaSouthEast]:{geoName:"as",regionShortName:"seas"},[U.AsiaEast]:{geoName:"as",regionShortName:"eas"},[U.CanadaCentral]:{geoName:"ca",regionShortName:"cca"},[U.CanadaEast]:{geoName:"ca",regionShortName:"eca"},[U.SouthAfricaNorth]:{geoName:"za",regionShortName:"nza"},[U.SouthAfricaWest]:{geoName:"za",regionShortName:"wza"},[U.FranceCentral]:{geoName:"fr",regionShortName:"cfr"},[U.FranceSouth]:{geoName:"fr",regionShortName:"sfr"},[U.UAENorth]:{geoName:"ae",regionShortName:"nae"},[U.UAECentral]:{geoName:"ae",regionShortName:"cae"},[U.SwedenCentral]:{geoName:"se",regionShortName:"cse"},[U.SwitzerlandNorth]:{geoName:"ch",regionShortName:"nch"},[U.SwitzerlandWest]:{geoName:"ch",regionShortName:"wch"},[U.NorwayEast]:{geoName:"no",regionShortName:"eno"},[U.NorwayWest]:{geoName:"no",regionShortName:"wno"},[U.KoreaCentral]:{geoName:"kr",regionShortName:"ckr"},[U.KoreaSouth]:{geoName:"kr",regionShortName:"skr"},[U.SingaporeSouthEast]:{geoName:"sg",regionShortName:"seas"},[U.PolandCentral]:{geoName:"pl",regionShortName:"cpl"},[U.QatarCentral]:{geoName:"qa",regionShortName:"cqa"},[U.NewZealandNorth]:{geoName:"nz",regionShortName:"nnz"},[U.GovernmentUSTexas]:{geoName:"us",regionShortName:"ugtx"},[U.GovernmentUSVirginia]:{geoName:"us",regionShortName:"ugva"},[U.GovernmentUSDodCentral]:{regionShortName:"udc"},[U.GovernmentUSDodEast]:{regionShortName:"ude"},[U.ChinaEast]:{regionShortName:"cne"},[U.ChinaEast2]:{regionShortName:"cne2"},[U.ChinaEast3]:{regionShortName:"cne3"},[U.ChinaNorth]:{regionShortName:"cnn"},[U.ChinaNorth2]:{regionShortName:"cnn2"},[U.ChinaNorth3]:{regionShortName:"cnn3"},[U.UssecEast]:{geoName:"us",regionShortName:"erx"},[U.UssecWest]:{geoName:"us",regionShortName:"wrx"},[U.UsnatEast]:{geoName:"us",regionShortName:"eex"},[U.UsnatWest]:{geoName:"us",regionShortName:"wex"}}});var Sy=I(()=>{"use strict";Sl();});var Do=I(()=>{"use strict";Sl();Cy();Ey();Sy();});function Io(e,t){return Ny?Ny.isOverridden(e,t):{overridden:!1}}var Ny,_o=I(()=>{"use strict";});var ep=I(()=>{"use strict";Do();_o();});function HL(e,t){let{region:r}=tn();return()=>{let n=e.settings[t];if(n.allowOverrides){let s=Io(e.packageName,t);if(s.overridden)return typeof s.value=="string"?jL(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 jL(e){return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}function JL(e){let t=e.packageName;if(Dl.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=>rp(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=>!_l(i))){let i=`error parsing settings config for package ${t}, setting ${r} has invalid region`;throw console.error(i),new Error(i)}})}function To(e){JL(e);let t={};return Object.keys(e.settings).forEach(r=>{t[r]={enumerable:!0,get:HL(e,r)}}),Dl.set(e.packageName,e),Object.defineProperties({},t)}function tp(e,t){return Dl.has(e)?!!Dl.get(e).settings[t]:!1}var Dl,Il=I(()=>{"use strict";Do();_o();np();Po();Dl=new Map});function Dy(e,t){let{region:r}=tn();return()=>{let n=Io(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 QL(e){let t=e.packageName;if(Tl.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=>tp(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=>!_l(i))){let i=`error parsing feature gates config for package ${t}, feature ${r} has invalid region`;throw console.error(i),new Error(i)}})}function ip(e){QL(e);let t={};Object.keys(e.features).forEach(i=>{t[i]={enumerable:!0,configurable:!0,get:Dy(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:Dy(e,a.toString())}}),Object.defineProperties(r,i),n.clear()}},Tl.set(e.packageName,e),Object.defineProperties(r,t)}function rp(e,t){return Tl.has(e)?!!Tl.get(e).features[t]:!1}var Tl,np=I(()=>{"use strict";Do();Po();_o();Il();Tl=new Map});var _y=v((OH,Iy)=>{"use strict";Iy.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 Oy=v(ap=>{"use strict";var KL=Object.prototype.hasOwnProperty,XL;function Ty(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Py(e){try{return encodeURIComponent(e)}catch{return null}}function YL(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var i=Ty(n[1]),a=Ty(n[2]);i===null||a===null||i in r||(r[i]=a)}return r}function ZL(e,t){t=t||"";var r=[],n,i;typeof t!="string"&&(t="?");for(i in e)if(KL.call(e,i)){if(n=e[i],!n&&(n===null||n===XL||isNaN(n))&&(n=""),i=Py(i),n=Py(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""}ap.stringify=ZL;ap.parse=YL});var lp=v((FH,My)=>{"use strict";var Fy=_y(),Pl=Oy(),xy=/[\n\r\t]/g,ek=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,tk=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,rk=/^[a-zA-Z]:/,nk=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;function sp(e){return(e||"").toString().replace(nk,"")}var op=[["#","hash"],["?","query"],function(t,r){return Pr(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]],Ry={hash:1,query:1};function Ly(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 Or(unescape(e.pathname),{});else if(i==="string"){n=new Or(e,{});for(a in Ry)delete n[a]}else if(i==="object"){for(a in e)a in Ry||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=ek.test(e.href))}return n}function Pr(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function ky(e,t){e=sp(e),e=e.replace(xy,""),t=t||{};var r=tk.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)):Pr(n)?s=r[4]:n?i&&(s=s.slice(2)):o>=2&&Pr(t.protocol)&&(s=r[4]),{protocol:n,slashes:i||Pr(n),slashesCount:o,rest:s}}function ik(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 Or(e,t,r){if(e=sp(e),e=e.replace(xy,""),!(this instanceof Or))return new Or(e,t,r);var n,i,a,o,s,l,u=op.slice(),c=typeof t,d=this,p=0;for(c!=="object"&&c!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=Pl.parse),t=Ly(t),i=ky(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||rk.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!Pr(d.protocol)))&&(u[3]=[/(.*)/,"pathname"]);p<u.length;p++){if(o=u[p],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=ik(d.pathname,t.pathname)),d.pathname.charAt(0)!=="/"&&Pr(d.protocol)&&(d.pathname="/"+d.pathname),Fy(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:"&&Pr(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function ak(e,t,r){var n=this;switch(e){case"query":typeof t=="string"&&t.length&&(t=(r||Pl.parse)(t)),n[e]=t;break;case"port":n[e]=t,Fy(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<op.length;o++){var s=op[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:"&&Pr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function ok(e){(!e||typeof e!="function")&&(e=Pl.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||Pr(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&Pr(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}Or.prototype={set:ak,toString:ok};Or.extractProtocol=ky;Or.location=Ly;Or.trimLeft=sp;Or.qs=Pl;My.exports=Or});var sk,Uy=I(()=>{"use strict";sk=ie(lp());});function up(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 Ol=I(()=>{"use strict";});var cp,dp,pp=I(()=>{"use strict";Ol();cp=class{features=new Map;register(t,r){let n=up(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()}},dp=new cp});var fp=I(()=>{"use strict";});function _l(e){return lk.has(e)}var lk,Po=I(()=>{"use strict";ep();np();Il();_o();ep();Uy();pp();Ol();fp();lk=new Set(["tie","test","prod","preview","preprod","gov","high","dod","mooncake","ex","rx"])});var uk,By=I(()=>{"use strict";Po();uk=To({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 Rl,R,$,ui,ea,Fl,$y,qy,mp,Oo=I(()=>{"use strict";No();Rl=class{name;constructor(t){this.name=t}toString(){return this.name}getName(){return this.name}getDisplayNameResourceKey(){return mp.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"})(R||(R={}));(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"})($||($={}));ui=class extends Rl{constructor(t){super(t)}static get None(){return"None"}static get SystemRequired(){return"SystemRequired"}static get ApplicationRequired(){return"ApplicationRequired"}static get Recommended(){return"Recommended"}},ea=class e extends Rl{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?Fl.Persistent:parseInt(Fl[this.name])}};(function(e){e[e.Persistent=0]="Persistent",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup"})(Fl||(Fl={}));(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"})($y||($y={}));(function(e){e[e.Attribute=0]="Attribute",e[e.Organization=1]="Organization",e[e.Currency=2]="Currency"})(qy||(qy={}));mp=class e{static resourceKeyMap=e.initResourceKeyMap();static initResourceKeyMap(){let t=new Xi;return t.add(R.TwoOptions,"SystemCustomization.type.bit.label"),t.add(R.Customer,"SystemCustomization.type.customer.label"),t.add(R.CustomerType,"SystemCustomization.type.customer.label"),t.add(R.DateTime,"SystemCustomization.type.datetime.label"),t.add(R.DecimalNumber,"SystemCustomization.type.decimal.label"),t.add(R.FloatingPointNumber,"SystemCustomization.type.float.label"),t.add(R.WholeNumber,"SystemCustomization.type.int.label"),t.add(R.LookupType,"SystemCustomization.type.lookup.label"),t.add(R.Lookup,"SystemCustomization.type.lookup.label"),t.add(R.MultipleLineofText,"SystemCustomization.type.ntext.label"),t.add(R.Currency,"SystemCustomization.type.money.label"),t.add(R.Owner,"SystemCustomization.type.owner.label"),t.add(R.OwnerType,"SystemCustomization.type.owner.label"),t.add(R.PartyList,"SystemCustomization.type.partylist.label"),t.add(R.PartyListType,"SystemCustomization.type.partylist.label"),t.add(R.OptionSet,"SystemCustomization.type.picklist.label"),t.add(R.State,"SystemCustomization.type.state.label"),t.add(R.Status,"SystemCustomization.type.status.label"),t.add(R.SingleLineofText,"SystemCustomization.type.nvarchar.label"),t.add(R.UniqueIdentifier,"SystemCustomization.type.uniqueidentifier.label"),t.add(R.UniqueIdentifierType,"SystemCustomization.type.uniqueidentifiertype.label"),t.add(R.CalendarRulesType,"SystemCustomization.type.calendarrules.label"),t.add(R.VirtualType,"SystemCustomization.type.virtual.label"),t.add(R.BigInt,"SystemCustomization.type.bigint.label"),t.add(R.ManagedPropertyType,"SystemCustomization.type.managedproperty.label"),t.add(R.EntityNameType,"SystemCustomization.type.entityname.label"),t.add(R.Image,"SystemCustomization.type.image.label"),t.add(R.MultiSelectOptionSet,"SystemCustomization.type.multiselectpicklist.label"),t.add(R.PrimaryNameAttributeType,"SystemCustomization.type.primaryname.label"),t.add(R.LookupType,"SystemCustomization.type.lookuptype.label"),t.add(R.Subject,"SystemCustomization.type.subject.label"),t.add($.Email,"SystemCustomization.String.Format.email"),t.add($.Text,"SystemCustomization.String.Format.text"),t.add($.TextArea,"SystemCustomization.String.Format.textarea"),t.add($.Url,"SystemCustomization.String.Format.url"),t.add($.TickerSymbol,"SystemCustomization.String.Format.tickersymbol"),t.add($.PhoneticGuide,"SystemCustomization.String.Format.phoneticguide"),t.add($.VersionNumber,"SystemCustomization.String.Format.versionnumber"),t.add($.Phone,"SystemCustomization.String.Format.phone"),t.add($.None,"SystemCustomization.Integer.Format."),t.add($.Duration,"SystemCustomization.Integer.Format.duration"),t.add($.TimeZone,"SystemCustomization.Integer.Format.timezone"),t.add($.Language,"SystemCustomization.Integer.Format.language"),t.add($.Locale,"SystemCustomization.Integer.Format.language"),t.add($.DateOnly,"SystemCustomization.DateTime.Format.date"),t.add($.DateAndTime,"SystemCustomization.DateTime.Format.datetime"),t.add($.Regarding,"SystemCustomization.Lookup.Format.regarding"),t.add(ea.Persistent,"SystemCustomization.String.Source.persistent"),t.add(ea.Calculated,"SystemCustomization.String.Source.calculated"),t.add(ea.Rollup,"SystemCustomization.String.Source.rollup"),t.add(ea.None,"SystemCustomization.String.Source.none"),t}static getDisplayNameResourceKey(t){return e.resourceKeyMap.getValue(t)}}});var Wy,gp,ta,ci,hp,xl,ra,rn,we,Vy,Gy,zy,cr=I(()=>{"use strict";Wy={ThreeEqColumn_FirstColumn:34,ThreeEqColumn_SecondColumn:33,ThreeEqColumn_ThirdColumn:33,FiveEqColumn:20},gp={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"})(ta||(ta={}));(function(e){e.Left="Left",e.Right="Right",e.Center="Center"})(ci||(ci={}));(function(e){e[e.Mobile=0]="Mobile",e[e.Tablet=1]="Tablet",e[e.Web=2]="Web"})(hp||(hp={}));xl=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"})(ra||(ra={}));rn=class{static StartTag="<"},we={ShowLabel:"true",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_",labelAlignment:ci.Left,labelPosition:ra.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"})(Vy||(Vy={}));(function(e){e.TabWithLockedFieldRemoval="TabWithLockedFieldRemoval",e.SectionWithLockedFieldRemoval="SectionWithLockedFieldRemoval",e.LockedSectionRemoval="LockedSectionRemoval",e.LockedFieldRemoval="LockedFieldRemoval",e.RequiredFieldRemoval="RequiredFieldRemoval",e.LastRemainingTab="LastRemainingTab",e.UnknownRemoval="UnknownRemoval"})(Gy||(Gy={}));(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"})(zy||(zy={}))});var vp,Hy=I(()=>{"use strict";(function(e){e.DefaultValue="defaultValue",e.Loaded="loaded"})(vp||(vp={}))});var Qy,ck,jy,Oj,Rj,Ro,Jy,Fj,xj,Ky=I(()=>{"use strict";Qy=ie(oi());Oe();Ki();By();Oo();cr();Zi();X();ck=ie(Yn());Hy();(function(e){e.Model="Model",e.Canvas="Canvas",e.CustomPages="CustomPages"})(jy||(jy={}));Oj={Read:li.Read,Edit:li.Edit,Both:li.Both,Container:li.Container},Rj={input:Yi.Input,bound:Yi.Bound,output:Yi.Output};(function(e){e[e.dataset=0]="dataset",e[e.property=1]="property",e[e.groups=2]="groups",e[e.group=3]="group"})(Ro||(Ro={}));(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"})(Jy||(Jy={}));Fj=new Set([T.Currency,T.Decimal,T.FP,T.Multiple,T.SingleLineEmail,T.SingleLinePhone,T.SingleLineText,T.SingleLineTextArea,T.SingleLineURL,T.SingleLineTickerSymbol,T.WholeNone,T.WholeDuration,T.WholeLanguage,T.WholeTimeZone,T.Enum,T.LookupSimple,T.LookupCustomer,T.LookupOwner,T.LookupPartyList,T.LookupRegarding,T.TwoOptions,T.Boolean,T.PowerBIReport,T.DateAndTimeDateAndTime,T.DateAndTimeDateOnly,T.OptionSet,T.MultiSelectOptionSet,T.CardForm]),xj={numbers:[T.WholeNone,T.FP,T.Decimal,T.Currency],text:[T.SingleLineText,T.SingleLineTextArea,T.Multiple],lookup:[T.LookupSimple,T.LookupCustomer,T.LookupOwner,T.LookupPartyList,T.LookupRegarding],dates:[T.DateAndTimeDateOnly,T.DateAndTimeDateAndTime],allFields:[T.TwoOptions,T.DateAndTimeDateOnly,T.DateAndTimeDateAndTime,T.FP,T.Decimal,T.WholeNone,T.WholeDuration,T.WholeTimeZone,T.WholeLanguage,T.LookupSimple,T.LookupCustomer,T.LookupOwner,T.LookupPartyList,T.LookupRegarding,T.Multiple,T.OptionSet,T.SingleLineText,T.SingleLineTextArea,T.SingleLineEmail,T.SingleLineURL,T.SingleLineTickerSymbol,T.SingleLinePhone]}});var dr,Ll,Xy=I(()=>{"use strict";dr=ie(oi());Le();Oe();nt();Ki();Zi();Ky();Oo();X();We();cr();Ll=class extends H{constructor(t){super(b.customControl,t)}customControlId;get id(){let t=this.getProperty(h.id);return N.IsNullOrUndefined(t)?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(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(ht.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===ht.name)?.value}getParameterChildrenValues(t,r,n){if(this.isDataSet(t)){let i=r.find(u=>u.key===ht.name)?.value,a={Name:i,Type:T.Grid,Columns:[]},l=this.getParameters().get(ht.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===h.static&&a.value==="true"){r=!0;break}}return r}get name(){return this.getProperty(h.Name)}get formFactor(){return this.getProperty(h.formFactor)}set formFactor(t){this.setProperty(h.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(rn.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),p=await this.parameterJSON(o,u,d,t);r.push({Name:c,Value:p})}else if(this.isGroups(s))r.push({Name:o,Value:{Type:wy.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===Ro.dataset?a.get(ht.dataset)?.some(f=>this.getDatasetName(f)===d)||r.push({Name:d,Value:{Name:d,Columns:[],Type:T.Grid}}):c.propertyType===Ro.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,dr.trackInfoTrace)(ft,{eventName:`${en}/parametersToJSON`,eventData:{message:`Configuration metadata for custom control parameter ${o} is not available for custom control : ${this.name}.`}}),r=[];break}}}else(0,dr.trackErrorTrace)(ft,{eventName:`${en}/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,dr.trackErrorTrace)(ft,{eventName:`${en}/parametersToJSON`,eventData:{message:"Custom Control Manifest not found"}},new Error(`No custom control manifest found for ${this.name}`))}catch(n){(0,dr.trackErrorTrace)(ft,{eventName:`${en}/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===ht.name)?.value;if(a)return this.getParameterChildrenValues(t,r);{let s=new Error(`No dataset manifest info for ${o}`);(0,dr.trackErrorTrace)(ft,{eventName:`${en}/parameterJSON`,eventData:{message:"Missing custom control manifest dataset info"}},s)}}else{let a=n,o=r&&r.find(l=>l.key===h.Type),s=a&&!a.ofTypeGroup.every(l=>!Xd.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===Ln.FormComponent){let d=this.getFormComponentValueByParameterName(h.bindAttribute),p=await i.formModelService.loadLookupModel(d),f=p.lookupColumn,m=this.getLookupDataTypeFromAttributeMetadata(f);return{Name:t,Type:m,Usage:l,Static:u,Primary:c,EntityName:p.primaryTableName,Value:d,ViewId:this.getFormComponentValueByParameterName(by.DefaultViewId),TargetEntityType:f.targets[0],FilterRelationshipName:this.getFormComponentValueByParameterName(h.FilterRelationshipName),AvailableViewIds:this.getFormComponentValueByParameterName(h.AvailableViewIds),DependentAttributeName:this.getFormComponentValueByParameterName(h.DependentAttributeName),DependentAttributeType:this.getFormComponentValueByParameterName(h.DependentAttributeType),AllowFilterOff:O.IsStrictTrue(this.getFormComponentValueByParameterName(h.AllowFilterOff)),DisableQuickFind:O.IsStrictTrue(this.getFormComponentValueByParameterName(h.DisableQuickFind)),EnableViewPicker:!O.IsStrictTrue(this.getFormComponentValueByParameterName(h.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,dr.trackErrorTrace)(ft,{eventName:`${en}/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 f=o.value;return{Type:f,Static:u,Usage:l,Value:this.isNumberTypeProperty(a,f)&&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 p=new Error(`No property type info for ${t}`);(0,dr.trackErrorTrace)(ft,{eventName:`${en}/parameterJSON`,eventData:{message:"Missing property type info"}},p)}else{let l=new Error(`No property manifest info for ${t}`);(0,dr.trackWarningTrace)(ft,{eventName:`${en}/parameterJSON`,eventData:{message:"Missing custom control manifest property info"}},l)}}return null}getLookupDataTypeFromAttributeMetadata(t){let{attributeType:r,format:n}=t;switch(r){case R.Customer:return T.LookupCustomer;case R.Owner:return T.LookupOwner;case R.PartyList:return T.LookupPartyList;default:return n===$.Regarding?T.LookupRegarding:T.LookupSimple}}isLookupType(t){return Xd.includes(t)}isNumberTypeProperty(t,r){return Yd.includes(r)||t.ofTypeGroup.some(n=>Yd.includes(n))}isDataSet(t){return ht.dataset===t}isGroups(t){return!!t[0].getAllProperties().find(n=>n.key==="isGroup"&&n.value==="true")}}});var z,yp=I(()=>{"use strict";z=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 x,na,Me,kl=I(()=>{"use strict";Le();No();Oe();nt();Oo();ai();yp();cr();x=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"}},na=class{static get RelationshipAssistant(){return"3ff9a528-dd50-4aca-8f10-2e5ed73513ad"}static get PredictiveLeadScoring(){return"6f503f2a-d033-4106-b62c-f8f2e5f01a57"}},Me=class e{static FieldControlIds=e.initializeFieldControls();static UnboundControlIds=e.initializeUnboundControls();static ControlsAllowedForReferencePanel=e.initializeReferencePanelControls();static ControlsAllowedForFooter=e.initializeFooterControls();static CustomControlIdMap=new mt;static initializeFieldControls(){let t=new mt,r=e.getControlName(R.SingleLineofText,$.Phone);t.add(r,new P(x.PhoneNumberControl));let n=e.getControlName(R.SingleLineofText,$.TextArea);t.add(n,new P(x.TextAreaControl));let i=e.getControlName(R.SingleLineofText,$.Text);t.add(i,new P(x.TextBoxControl));let a=e.getControlName(R.SingleLineofText,$.Email);t.add(a,new P(x.EmailAddressControl));let o=e.getControlName(R.SingleLineofText,$.Url);t.add(o,new P(x.UrlControl));let s=e.getControlName(R.SingleLineofText,$.TickerSymbol);t.add(s,new P(x.TickerControl));let l=e.getControlName(R.SingleLineofText,$.PhoneticGuide);t.add(l,new P(x.TextBoxControl));let u=e.getControlName(R.WholeNumber,$.Duration);t.add(u,new P(x.DurationControl));let c=e.getControlName(R.WholeNumber,$.Language);t.add(c,new P(x.LanguagePickerControl));let d=e.getControlName(R.WholeNumber,$.TimeZone);t.add(d,new P(x.TimeZonePicklistControl));let p=e.getControlName(R.WholeNumber,$.None);t.add(p,new P(x.IntegerControl));let f=e.getControlName(R.DateTime,$.DateOnly);t.add(f,new P(x.DateTimeControl));let m=e.getControlName(R.DateTime,$.DateAndTime);t.add(m,new P(x.DateTimeControl));let g=e.getControlName(R.LookupType,$.None);t.add(g,new P(x.LookupControl));let y=e.getControlName(R.CustomerType,$.None);t.add(y,new P(x.LookupControl));let A=e.getControlName(R.FloatingPointNumber,$.None);t.add(A,new P(x.FloatControl));let D=e.getControlName(R.DecimalNumber,$.None);t.add(D,new P(x.DecimalControl));let F=e.getControlName(R.Currency,$.None);t.add(F,new P(x.MoneyControl));let _=e.getControlName(R.MultipleLineofText,$.None);t.add(_,new P(x.TextAreaControl));let q=e.getControlName(R.MultipleLineofText,$.Text);t.add(q,new P(x.TextAreaControl));let B=e.getControlName(R.MultipleLineofText,$.TextArea);t.add(B,new P(x.TextAreaControl));let L=e.getControlName(R.MultipleLineofText,$.Email);t.add(L,new P(x.EmailBodyControl));let k=e.getControlName(R.OptionSet,$.None);t.add(k,new P(x.PicklistControl));let M=e.getControlName(R.TwoOptions,$.None);t.add(M,new P(x.RadioControl));let G=e.getControlName(R.Image,$.None);t.add(G,new P(x.WebResourceImageControl));let V=e.getControlName(R.Image,$.None);t.add(V,new P(x.WebResourceHtmlControl));let Ze=e.getControlName(R.TwoOptions,"Radio");t.add(Ze,new P(x.RadioControl));let ir=e.getControlName(R.TwoOptions,"CheckBox");t.add(ir,new P(x.CheckBoxControl));let et=e.getControlName(R.TwoOptions,"List");t.add(et,new P(x.PicklistControl));let dt=e.getControlName(R.State,$.None);t.add(dt,new P(x.PicklistControl));let ue=e.getControlName(R.Status,$.None);t.add(ue,new P(x.PicklistStatusControl));let $e=e.getControlName(R.OwnerType,$.None);t.add($e,new P(x.LookupControl));let xe=e.getControlName(R.PartyListType,$.None);t.add(xe,new P(x.PartyListControl));let yn=e.getControlName(R.LookupType,$.Regarding);t.add(yn,new P(x.RegardingControl));let $t=e.getControlName(R.MultiSelectOptionSet,$.None);return t.add($t,new P(x.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===x.CustomControl}static initializeUnboundControls(){let t=new mt;return t.add(x.ACIControl,z.ACIControl),t.add(x.IframeControl,z.IframeControl),t.add(x.SearchWidgetControl,z.SearchWidgetControl),t.add(x.MapsControl,z.MapsControl),t.add(x.QuickFormCollectionControl,z.QuickFormCollectionControl),t.add(x.GridControl,z.SubGridControl),t.add(x.WebResourceImageControl,z.WebResourceImageControl),t.add(x.WebResourceHtmlControl,z.WebResourceHtmlControl),t.add(x.ReferencePanelSearchWidget,z.SearchWidgetControl),t.add(x.ReferencePanelQuickFormCollectionControl,z.QuickFormCollectionControl),t.add(x.ReferencePanelSubgridControl,z.SubGridControl),t.add(x.TimerControl,z.TimerControl),t.add(x.TimeLineControl,z.NotesControl),t.add(x.TimeLineControlUC,z.NotesControl),t.add(x.SocialInsightControl,z.SocialInsightControl),t.add(na.RelationshipAssistant,z.CustomControl),t}static initializeReferencePanelControls(){let t=new mt;return t.add(x.IframeControl,z.IframeControl),t.add(x.ReferencePanelSearchWidget,z.SearchWidgetControl),t.add(x.ReferencePanelQuickFormCollectionControl,z.QuickFormCollectionControl),t.add(x.ReferencePanelSubgridControl,z.SubGridControl),t.add(x.WebResourceHtmlControl,z.WebResourceHtmlControl),t.add(x.WebResourceImageControl,z.WebResourceHtmlControl),t}static initializeFooterControls(){let t=new Xi;return t.add(ta.IFRAME,!0),t.add(ta.SPACER,!0),t.add(ta.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(we.referencePanelNamePrefix)===0}static isUnboundFormControlByIdentifier(t){return N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.guidString)?!1:e.UnboundControlIds.containsKey(t.guidString)}static getUnboundFormControlName(t){let r=O.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)?O.EmptyString:e.UnboundControlIds.getValue(t.guidString).toString()}static isSpacerControl(t){return t===x.SpacerControl}static GetRowSpan(t){let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===x.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 z.IframeControl:case z.ACIControl:case z.SocialInsightControl:return 6;case z.SubGridControl:case z.CustomControl:return 4;case z.WebResourceImageControl:return 15;case z.WebResourceHtmlControl:return 15;case z.MapsControl:return 8;case z.SearchWidgetControl:return 10;case z.NotesControl:case z.TimeLineControl:return 15;case z.TimerControl:return 2;default:}}static isLookUpControl(t){return!N.IsNullOrUndefined(t)&&t.ClassId.guidString===x.LookupControl}static isRelationshipAssistantOrLeadScoringControl(t){return!N.IsNullOrUndefined(t)&&e.isRelationshipAssistantOrLeadScoring(t.UniqueId)}static isRelationshipAssistantOrLeadScoring(t){return!N.IsNullOrUndefined(t)&&(t.guidString===na.RelationshipAssistant||t.guidString===na.PredictiveLeadScoring)}static isRelationshipAssistantControl(t){return!N.IsNullOrUndefined(t)&&e.isRelationshipAssistant(t.UniqueId)}static isRelationshipAssistant(t){return!N.IsNullOrUndefined(t)&&t.guidString===na.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===x.CustomControl&&!N.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}return r}}});var Ml,Yy=I(()=>{"use strict";Ml=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 di,ia,Zy,eb,kn,tb,rb,bp=I(()=>{"use strict";(function(e){e[e.Center=0]="Center",e[e.Left=1]="Left",e[e.Right=2]="Right"})(di||(di={}));(function(e){e[e.Left=0]="Left",e[e.Top=1]="Top"})(ia||(ia={}));(function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle"})(Zy||(Zy={}));(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"})(eb||(eb={}));(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"})(kn||(kn={}));(function(e){e[e.None=0]="None",e[e.SystemRequired=1]="SystemRequired",e[e.ApplicationRequired=2]="ApplicationRequired",e[e.Recommended=3]="Recommended"})(tb||(tb={}));(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"})(rb||(rb={}))});var aa,nb=I(()=>{"use strict";Po();aa=ip({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 ib(e){return{...e,extractConfig:t=>dk(t,Object.keys(e.fallback))}}function dk(e,t){let r={};for(let n of t)typeof e[n]<"u"&&(r[n]=e[n]);return r}var wp=I(()=>{"use strict";});var Ap=v((lJ,ob)=>{var Fo=new Proxy(function(){return Fo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Fo},apply:function(){return Fo},construct:function(){return{}}}),ab=function(){return Fo};Object.setPrototypeOf(ab,Fo);ob.exports=ab});var ub=v((uJ,lb)=>{var xo=new Proxy(function(){return xo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:xo},apply:function(){return xo},construct:function(){return{}}}),sb=function(){return xo};Object.setPrototypeOf(sb,xo);lb.exports=sb});var Cp=v((cJ,db)=>{var Lo=new Proxy(function(){return Lo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Lo},apply:function(){return Lo},construct:function(){return{}}}),cb=function(){return Lo};Object.setPrototypeOf(cb,Lo);db.exports=cb});var fb=v((dJ,pb)=>{function pk(){this.__data__=[],this.size=0}pb.exports=pk});var oa=v((pJ,mb)=>{function fk(e,t){return e===t||e!==e&&t!==t}mb.exports=fk});var ko=v((fJ,hb)=>{var mk=oa();function hk(e,t){for(var r=e.length;r--;)if(mk(e[r][0],t))return r;return-1}hb.exports=hk});var vb=v((mJ,gb)=>{var gk=ko(),vk=Array.prototype,yk=vk.splice;function bk(e){var t=this.__data__,r=gk(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():yk.call(t,r,1),--this.size,!0}gb.exports=bk});var bb=v((hJ,yb)=>{var wk=ko();function Ak(e){var t=this.__data__,r=wk(t,e);return r<0?void 0:t[r][1]}yb.exports=Ak});var Ab=v((gJ,wb)=>{var Ck=ko();function Ek(e){return Ck(this.__data__,e)>-1}wb.exports=Ek});var Eb=v((vJ,Cb)=>{var Sk=ko();function Nk(e,t){var r=this.__data__,n=Sk(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}Cb.exports=Nk});var Mo=v((yJ,Sb)=>{var Dk=fb(),Ik=vb(),_k=bb(),Tk=Ab(),Pk=Eb();function sa(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])}}sa.prototype.clear=Dk;sa.prototype.delete=Ik;sa.prototype.get=_k;sa.prototype.has=Tk;sa.prototype.set=Pk;Sb.exports=sa});var Db=v((bJ,Nb)=>{var Ok=Mo();function Rk(){this.__data__=new Ok,this.size=0}Nb.exports=Rk});var _b=v((wJ,Ib)=>{function Fk(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}Ib.exports=Fk});var Pb=v((AJ,Tb)=>{function xk(e){return this.__data__.get(e)}Tb.exports=xk});var Rb=v((CJ,Ob)=>{function Lk(e){return this.__data__.has(e)}Ob.exports=Lk});var Ep=v((EJ,Fb)=>{var kk=typeof global=="object"&&global&&global.Object===Object&&global;Fb.exports=kk});var pr=v((SJ,xb)=>{var Mk=Ep(),Uk=typeof self=="object"&&self&&self.Object===Object&&self,Bk=Mk||Uk||Function("return this")();xb.exports=Bk});var Uo=v((NJ,Lb)=>{var $k=pr(),qk=$k.Symbol;Lb.exports=qk});var Bb=v((DJ,Ub)=>{var kb=Uo(),Mb=Object.prototype,Vk=Mb.hasOwnProperty,Gk=Mb.toString,Bo=kb?kb.toStringTag:void 0;function zk(e){var t=Vk.call(e,Bo),r=e[Bo];try{e[Bo]=void 0;var n=!0}catch{}var i=Gk.call(e);return n&&(t?e[Bo]=r:delete e[Bo]),i}Ub.exports=zk});var qb=v((IJ,$b)=>{var Wk=Object.prototype,Hk=Wk.toString;function jk(e){return Hk.call(e)}$b.exports=jk});var pi=v((_J,zb)=>{var Vb=Uo(),Jk=Bb(),Qk=qb(),Kk="[object Null]",Xk="[object Undefined]",Gb=Vb?Vb.toStringTag:void 0;function Yk(e){return e==null?e===void 0?Xk:Kk:Gb&&Gb in Object(e)?Jk(e):Qk(e)}zb.exports=Yk});var nn=v((TJ,Wb)=>{function Zk(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}Wb.exports=Zk});var Ul=v((PJ,Hb)=>{var eM=pi(),tM=nn(),rM="[object AsyncFunction]",nM="[object Function]",iM="[object GeneratorFunction]",aM="[object Proxy]";function oM(e){if(!tM(e))return!1;var t=eM(e);return t==nM||t==iM||t==rM||t==aM}Hb.exports=oM});var Jb=v((OJ,jb)=>{var sM=pr(),lM=sM["__core-js_shared__"];jb.exports=lM});var Xb=v((RJ,Kb)=>{var Sp=Jb(),Qb=(function(){var e=/[^.]+$/.exec(Sp&&Sp.keys&&Sp.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function uM(e){return!!Qb&&Qb in e}Kb.exports=uM});var Np=v((FJ,Yb)=>{var cM=Function.prototype,dM=cM.toString;function pM(e){if(e!=null){try{return dM.call(e)}catch{}try{return e+""}catch{}}return""}Yb.exports=pM});var ew=v((xJ,Zb)=>{var fM=Ul(),mM=Xb(),hM=nn(),gM=Np(),vM=/[\\^$.*+?()[\]{}|]/g,yM=/^\[object .+?Constructor\]$/,bM=Function.prototype,wM=Object.prototype,AM=bM.toString,CM=wM.hasOwnProperty,EM=RegExp("^"+AM.call(CM).replace(vM,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function SM(e){if(!hM(e)||mM(e))return!1;var t=fM(e)?EM:yM;return t.test(gM(e))}Zb.exports=SM});var rw=v((LJ,tw)=>{function NM(e,t){return e?.[t]}tw.exports=NM});var Mn=v((kJ,nw)=>{var DM=ew(),IM=rw();function _M(e,t){var r=IM(e,t);return DM(r)?r:void 0}nw.exports=_M});var Bl=v((MJ,iw)=>{var TM=Mn(),PM=pr(),OM=TM(PM,"Map");iw.exports=OM});var $o=v((UJ,aw)=>{var RM=Mn(),FM=RM(Object,"create");aw.exports=FM});var lw=v((BJ,sw)=>{var ow=$o();function xM(){this.__data__=ow?ow(null):{},this.size=0}sw.exports=xM});var cw=v(($J,uw)=>{function LM(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}uw.exports=LM});var pw=v((qJ,dw)=>{var kM=$o(),MM="__lodash_hash_undefined__",UM=Object.prototype,BM=UM.hasOwnProperty;function $M(e){var t=this.__data__;if(kM){var r=t[e];return r===MM?void 0:r}return BM.call(t,e)?t[e]:void 0}dw.exports=$M});var mw=v((VJ,fw)=>{var qM=$o(),VM=Object.prototype,GM=VM.hasOwnProperty;function zM(e){var t=this.__data__;return qM?t[e]!==void 0:GM.call(t,e)}fw.exports=zM});var gw=v((GJ,hw)=>{var WM=$o(),HM="__lodash_hash_undefined__";function jM(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=WM&&t===void 0?HM:t,this}hw.exports=jM});var yw=v((zJ,vw)=>{var JM=lw(),QM=cw(),KM=pw(),XM=mw(),YM=gw();function la(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])}}la.prototype.clear=JM;la.prototype.delete=QM;la.prototype.get=KM;la.prototype.has=XM;la.prototype.set=YM;vw.exports=la});var Aw=v((WJ,ww)=>{var bw=yw(),ZM=Mo(),eU=Bl();function tU(){this.size=0,this.__data__={hash:new bw,map:new(eU||ZM),string:new bw}}ww.exports=tU});var Ew=v((HJ,Cw)=>{function rU(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}Cw.exports=rU});var qo=v((jJ,Sw)=>{var nU=Ew();function iU(e,t){var r=e.__data__;return nU(t)?r[typeof t=="string"?"string":"hash"]:r.map}Sw.exports=iU});var Dw=v((JJ,Nw)=>{var aU=qo();function oU(e){var t=aU(this,e).delete(e);return this.size-=t?1:0,t}Nw.exports=oU});var _w=v((QJ,Iw)=>{var sU=qo();function lU(e){return sU(this,e).get(e)}Iw.exports=lU});var Pw=v((KJ,Tw)=>{var uU=qo();function cU(e){return uU(this,e).has(e)}Tw.exports=cU});var Rw=v((XJ,Ow)=>{var dU=qo();function pU(e,t){var r=dU(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}Ow.exports=pU});var $l=v((YJ,Fw)=>{var fU=Aw(),mU=Dw(),hU=_w(),gU=Pw(),vU=Rw();function ua(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])}}ua.prototype.clear=fU;ua.prototype.delete=mU;ua.prototype.get=hU;ua.prototype.has=gU;ua.prototype.set=vU;Fw.exports=ua});var Lw=v((ZJ,xw)=>{var yU=Mo(),bU=Bl(),wU=$l(),AU=200;function CU(e,t){var r=this.__data__;if(r instanceof yU){var n=r.__data__;if(!bU||n.length<AU-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new wU(n)}return r.set(e,t),this.size=r.size,this}xw.exports=CU});var Dp=v((eQ,kw)=>{var EU=Mo(),SU=Db(),NU=_b(),DU=Pb(),IU=Rb(),_U=Lw();function ca(e){var t=this.__data__=new EU(e);this.size=t.size}ca.prototype.clear=SU;ca.prototype.delete=NU;ca.prototype.get=DU;ca.prototype.has=IU;ca.prototype.set=_U;kw.exports=ca});var Uw=v((tQ,Mw)=>{var TU="__lodash_hash_undefined__";function PU(e){return this.__data__.set(e,TU),this}Mw.exports=PU});var $w=v((rQ,Bw)=>{function OU(e){return this.__data__.has(e)}Bw.exports=OU});var Vw=v((nQ,qw)=>{var RU=$l(),FU=Uw(),xU=$w();function ql(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new RU;++t<r;)this.add(e[t])}ql.prototype.add=ql.prototype.push=FU;ql.prototype.has=xU;qw.exports=ql});var zw=v((iQ,Gw)=>{function LU(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}Gw.exports=LU});var Hw=v((aQ,Ww)=>{function kU(e,t){return e.has(t)}Ww.exports=kU});var Ip=v((oQ,jw)=>{var MU=Vw(),UU=zw(),BU=Hw(),$U=1,qU=2;function VU(e,t,r,n,i,a){var o=r&$U,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,p=!0,f=r&qU?new MU:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],g=t[d];if(n)var y=o?n(g,m,d,t,e,a):n(m,g,d,e,t,a);if(y!==void 0){if(y)continue;p=!1;break}if(f){if(!UU(t,function(A,D){if(!BU(f,D)&&(m===A||i(m,A,r,n,a)))return f.push(D)})){p=!1;break}}else if(!(m===g||i(m,g,r,n,a))){p=!1;break}}return a.delete(e),a.delete(t),p}jw.exports=VU});var _p=v((sQ,Jw)=>{var GU=pr(),zU=GU.Uint8Array;Jw.exports=zU});var Kw=v((lQ,Qw)=>{function WU(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}Qw.exports=WU});var Yw=v((uQ,Xw)=>{function HU(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}Xw.exports=HU});var nA=v((cQ,rA)=>{var Zw=Uo(),eA=_p(),jU=oa(),JU=Ip(),QU=Kw(),KU=Yw(),XU=1,YU=2,ZU="[object Boolean]",eB="[object Date]",tB="[object Error]",rB="[object Map]",nB="[object Number]",iB="[object RegExp]",aB="[object Set]",oB="[object String]",sB="[object Symbol]",lB="[object ArrayBuffer]",uB="[object DataView]",tA=Zw?Zw.prototype:void 0,Tp=tA?tA.valueOf:void 0;function cB(e,t,r,n,i,a,o){switch(r){case uB:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case lB:return!(e.byteLength!=t.byteLength||!a(new eA(e),new eA(t)));case ZU:case eB:case nB:return jU(+e,+t);case tB:return e.name==t.name&&e.message==t.message;case iB:case oB:return e==t+"";case rB:var s=QU;case aB:var l=n&XU;if(s||(s=KU),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;n|=YU,o.set(e,t);var c=JU(s(e),s(t),n,i,a,o);return o.delete(e),c;case sB:if(Tp)return Tp.call(e)==Tp.call(t)}return!1}rA.exports=cB});var aA=v((dQ,iA)=>{function dB(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}iA.exports=dB});var Un=v((pQ,oA)=>{var pB=Array.isArray;oA.exports=pB});var lA=v((fQ,sA)=>{var fB=aA(),mB=Un();function hB(e,t,r){var n=t(e);return mB(e)?n:fB(n,r(e))}sA.exports=hB});var cA=v((mQ,uA)=>{function gB(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}uA.exports=gB});var pA=v((hQ,dA)=>{function vB(){return[]}dA.exports=vB});var hA=v((gQ,mA)=>{var yB=cA(),bB=pA(),wB=Object.prototype,AB=wB.propertyIsEnumerable,fA=Object.getOwnPropertySymbols,CB=fA?function(e){return e==null?[]:(e=Object(e),yB(fA(e),function(t){return AB.call(e,t)}))}:bB;mA.exports=CB});var vA=v((vQ,gA)=>{function EB(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}gA.exports=EB});var Bn=v((yQ,yA)=>{function SB(e){return e!=null&&typeof e=="object"}yA.exports=SB});var wA=v((bQ,bA)=>{var NB=pi(),DB=Bn(),IB="[object Arguments]";function _B(e){return DB(e)&&NB(e)==IB}bA.exports=_B});var Pp=v((wQ,EA)=>{var AA=wA(),TB=Bn(),CA=Object.prototype,PB=CA.hasOwnProperty,OB=CA.propertyIsEnumerable,RB=AA((function(){return arguments})())?AA:function(e){return TB(e)&&PB.call(e,"callee")&&!OB.call(e,"callee")};EA.exports=RB});var NA=v((AQ,SA)=>{function FB(){return!1}SA.exports=FB});var Vl=v((Vo,da)=>{var xB=pr(),LB=NA(),_A=typeof Vo=="object"&&Vo&&!Vo.nodeType&&Vo,DA=_A&&typeof da=="object"&&da&&!da.nodeType&&da,kB=DA&&DA.exports===_A,IA=kB?xB.Buffer:void 0,MB=IA?IA.isBuffer:void 0,UB=MB||LB;da.exports=UB});var Gl=v((CQ,TA)=>{var BB=9007199254740991,$B=/^(?:0|[1-9]\d*)$/;function qB(e,t){var r=typeof e;return t=t??BB,!!t&&(r=="number"||r!="symbol"&&$B.test(e))&&e>-1&&e%1==0&&e<t}TA.exports=qB});var Op=v((EQ,PA)=>{var VB=9007199254740991;function GB(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=VB}PA.exports=GB});var RA=v((SQ,OA)=>{var zB=pi(),WB=Op(),HB=Bn(),jB="[object Arguments]",JB="[object Array]",QB="[object Boolean]",KB="[object Date]",XB="[object Error]",YB="[object Function]",ZB="[object Map]",e$="[object Number]",t$="[object Object]",r$="[object RegExp]",n$="[object Set]",i$="[object String]",a$="[object WeakMap]",o$="[object ArrayBuffer]",s$="[object DataView]",l$="[object Float32Array]",u$="[object Float64Array]",c$="[object Int8Array]",d$="[object Int16Array]",p$="[object Int32Array]",f$="[object Uint8Array]",m$="[object Uint8ClampedArray]",h$="[object Uint16Array]",g$="[object Uint32Array]",ge={};ge[l$]=ge[u$]=ge[c$]=ge[d$]=ge[p$]=ge[f$]=ge[m$]=ge[h$]=ge[g$]=!0;ge[jB]=ge[JB]=ge[o$]=ge[QB]=ge[s$]=ge[KB]=ge[XB]=ge[YB]=ge[ZB]=ge[e$]=ge[t$]=ge[r$]=ge[n$]=ge[i$]=ge[a$]=!1;function v$(e){return HB(e)&&WB(e.length)&&!!ge[zB(e)]}OA.exports=v$});var xA=v((NQ,FA)=>{function y$(e){return function(t){return e(t)}}FA.exports=y$});var kA=v((Go,pa)=>{var b$=Ep(),LA=typeof Go=="object"&&Go&&!Go.nodeType&&Go,zo=LA&&typeof pa=="object"&&pa&&!pa.nodeType&&pa,w$=zo&&zo.exports===LA,Rp=w$&&b$.process,A$=(function(){try{var e=zo&&zo.require&&zo.require("util").types;return e||Rp&&Rp.binding&&Rp.binding("util")}catch{}})();pa.exports=A$});var zl=v((DQ,BA)=>{var C$=RA(),E$=xA(),MA=kA(),UA=MA&&MA.isTypedArray,S$=UA?E$(UA):C$;BA.exports=S$});var Fp=v((IQ,$A)=>{var N$=vA(),D$=Pp(),I$=Un(),_$=Vl(),T$=Gl(),P$=zl(),O$=Object.prototype,R$=O$.hasOwnProperty;function F$(e,t){var r=I$(e),n=!r&&D$(e),i=!r&&!n&&_$(e),a=!r&&!n&&!i&&P$(e),o=r||n||i||a,s=o?N$(e.length,String):[],l=s.length;for(var u in e)(t||R$.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||T$(u,l)))&&s.push(u);return s}$A.exports=F$});var Wl=v((_Q,qA)=>{var x$=Object.prototype;function L$(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||x$;return e===r}qA.exports=L$});var xp=v((TQ,VA)=>{function k$(e,t){return function(r){return e(t(r))}}VA.exports=k$});var zA=v((PQ,GA)=>{var M$=xp(),U$=M$(Object.keys,Object);GA.exports=U$});var HA=v((OQ,WA)=>{var B$=Wl(),$$=zA(),q$=Object.prototype,V$=q$.hasOwnProperty;function G$(e){if(!B$(e))return $$(e);var t=[];for(var r in Object(e))V$.call(e,r)&&r!="constructor"&&t.push(r);return t}WA.exports=G$});var Wo=v((RQ,jA)=>{var z$=Ul(),W$=Op();function H$(e){return e!=null&&W$(e.length)&&!z$(e)}jA.exports=H$});var QA=v((FQ,JA)=>{var j$=Fp(),J$=HA(),Q$=Wo();function K$(e){return Q$(e)?j$(e):J$(e)}JA.exports=K$});var XA=v((xQ,KA)=>{var X$=lA(),Y$=hA(),Z$=QA();function eq(e){return X$(e,Z$,Y$)}KA.exports=eq});var eC=v((LQ,ZA)=>{var YA=XA(),tq=1,rq=Object.prototype,nq=rq.hasOwnProperty;function iq(e,t,r,n,i,a){var o=r&tq,s=YA(e),l=s.length,u=YA(t),c=u.length;if(l!=c&&!o)return!1;for(var d=l;d--;){var p=s[d];if(!(o?p in t:nq.call(t,p)))return!1}var f=a.get(e),m=a.get(t);if(f&&m)return f==t&&m==e;var g=!0;a.set(e,t),a.set(t,e);for(var y=o;++d<l;){p=s[d];var A=e[p],D=t[p];if(n)var F=o?n(D,A,p,t,e,a):n(A,D,p,e,t,a);if(!(F===void 0?A===D||i(A,D,r,n,a):F)){g=!1;break}y||(y=p=="constructor")}if(g&&!y){var _=e.constructor,q=t.constructor;_!=q&&"constructor"in e&&"constructor"in t&&!(typeof _=="function"&&_ instanceof _&&typeof q=="function"&&q instanceof q)&&(g=!1)}return a.delete(e),a.delete(t),g}ZA.exports=iq});var rC=v((kQ,tC)=>{var aq=Mn(),oq=pr(),sq=aq(oq,"DataView");tC.exports=sq});var iC=v((MQ,nC)=>{var lq=Mn(),uq=pr(),cq=lq(uq,"Promise");nC.exports=cq});var oC=v((UQ,aC)=>{var dq=Mn(),pq=pr(),fq=dq(pq,"Set");aC.exports=fq});var lC=v((BQ,sC)=>{var mq=Mn(),hq=pr(),gq=mq(hq,"WeakMap");sC.exports=gq});var gC=v(($Q,hC)=>{var Lp=rC(),kp=Bl(),Mp=iC(),Up=oC(),Bp=lC(),mC=pi(),fa=Np(),uC="[object Map]",vq="[object Object]",cC="[object Promise]",dC="[object Set]",pC="[object WeakMap]",fC="[object DataView]",yq=fa(Lp),bq=fa(kp),wq=fa(Mp),Aq=fa(Up),Cq=fa(Bp),fi=mC;(Lp&&fi(new Lp(new ArrayBuffer(1)))!=fC||kp&&fi(new kp)!=uC||Mp&&fi(Mp.resolve())!=cC||Up&&fi(new Up)!=dC||Bp&&fi(new Bp)!=pC)&&(fi=function(e){var t=mC(e),r=t==vq?e.constructor:void 0,n=r?fa(r):"";if(n)switch(n){case yq:return fC;case bq:return uC;case wq:return cC;case Aq:return dC;case Cq:return pC}return t});hC.exports=fi});var SC=v((qQ,EC)=>{var $p=Dp(),Eq=Ip(),Sq=nA(),Nq=eC(),vC=gC(),yC=Un(),bC=Vl(),Dq=zl(),Iq=1,wC="[object Arguments]",AC="[object Array]",Hl="[object Object]",_q=Object.prototype,CC=_q.hasOwnProperty;function Tq(e,t,r,n,i,a){var o=yC(e),s=yC(t),l=o?AC:vC(e),u=s?AC:vC(t);l=l==wC?Hl:l,u=u==wC?Hl:u;var c=l==Hl,d=u==Hl,p=l==u;if(p&&bC(e)){if(!bC(t))return!1;o=!0,c=!1}if(p&&!c)return a||(a=new $p),o||Dq(e)?Eq(e,t,r,n,i,a):Sq(e,t,l,r,n,i,a);if(!(r&Iq)){var f=c&&CC.call(e,"__wrapped__"),m=d&&CC.call(t,"__wrapped__");if(f||m){var g=f?e.value():e,y=m?t.value():t;return a||(a=new $p),i(g,y,r,n,a)}}return p?(a||(a=new $p),Nq(e,t,r,n,i,a)):!1}EC.exports=Tq});var _C=v((VQ,IC)=>{var Pq=SC(),NC=Bn();function DC(e,t,r,n,i){return e===t?!0:e==null||t==null||!NC(e)&&!NC(t)?e!==e&&t!==t:Pq(e,t,r,n,DC,i)}IC.exports=DC});var PC=v((GQ,TC)=>{var Oq=_C();function Rq(e,t){return Oq(e,t)}TC.exports=Rq});var qp=v((zQ,OC)=>{var Fq=Mn(),xq=(function(){try{var e=Fq(Object,"defineProperty");return e({},"",{}),e}catch{}})();OC.exports=xq});var jl=v((WQ,FC)=>{var RC=qp();function Lq(e,t,r){t=="__proto__"&&RC?RC(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}FC.exports=Lq});var Vp=v((HQ,xC)=>{var kq=jl(),Mq=oa();function Uq(e,t,r){(r!==void 0&&!Mq(e[t],r)||r===void 0&&!(t in e))&&kq(e,t,r)}xC.exports=Uq});var kC=v((jQ,LC)=>{function Bq(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}}LC.exports=Bq});var UC=v((JQ,MC)=>{var $q=kC(),qq=$q();MC.exports=qq});var GC=v((Ho,ma)=>{var Vq=pr(),VC=typeof Ho=="object"&&Ho&&!Ho.nodeType&&Ho,BC=VC&&typeof ma=="object"&&ma&&!ma.nodeType&&ma,Gq=BC&&BC.exports===VC,$C=Gq?Vq.Buffer:void 0,qC=$C?$C.allocUnsafe:void 0;function zq(e,t){if(t)return e.slice();var r=e.length,n=qC?qC(r):new e.constructor(r);return e.copy(n),n}ma.exports=zq});var HC=v((QQ,WC)=>{var zC=_p();function Wq(e){var t=new e.constructor(e.byteLength);return new zC(t).set(new zC(e)),t}WC.exports=Wq});var JC=v((KQ,jC)=>{var Hq=HC();function jq(e,t){var r=t?Hq(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}jC.exports=jq});var KC=v((XQ,QC)=>{function Jq(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}QC.exports=Jq});var ZC=v((YQ,YC)=>{var Qq=nn(),XC=Object.create,Kq=(function(){function e(){}return function(t){if(!Qq(t))return{};if(XC)return XC(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();YC.exports=Kq});var Gp=v((ZQ,eE)=>{var Xq=xp(),Yq=Xq(Object.getPrototypeOf,Object);eE.exports=Yq});var rE=v((eK,tE)=>{var Zq=ZC(),e3=Gp(),t3=Wl();function r3(e){return typeof e.constructor=="function"&&!t3(e)?Zq(e3(e)):{}}tE.exports=r3});var iE=v((tK,nE)=>{var n3=Wo(),i3=Bn();function a3(e){return i3(e)&&n3(e)}nE.exports=a3});var sE=v((rK,oE)=>{var o3=pi(),s3=Gp(),l3=Bn(),u3="[object Object]",c3=Function.prototype,d3=Object.prototype,aE=c3.toString,p3=d3.hasOwnProperty,f3=aE.call(Object);function m3(e){if(!l3(e)||o3(e)!=u3)return!1;var t=s3(e);if(t===null)return!0;var r=p3.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&aE.call(r)==f3}oE.exports=m3});var zp=v((nK,lE)=>{function h3(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}lE.exports=h3});var Wp=v((iK,uE)=>{var g3=jl(),v3=oa(),y3=Object.prototype,b3=y3.hasOwnProperty;function w3(e,t,r){var n=e[t];(!(b3.call(e,t)&&v3(n,r))||r===void 0&&!(t in e))&&g3(e,t,r)}uE.exports=w3});var dE=v((aK,cE)=>{var A3=Wp(),C3=jl();function E3(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?C3(r,s,l):A3(r,s,l)}return r}cE.exports=E3});var fE=v((oK,pE)=>{function S3(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}pE.exports=S3});var hE=v((sK,mE)=>{var N3=nn(),D3=Wl(),I3=fE(),_3=Object.prototype,T3=_3.hasOwnProperty;function P3(e){if(!N3(e))return I3(e);var t=D3(e),r=[];for(var n in e)n=="constructor"&&(t||!T3.call(e,n))||r.push(n);return r}mE.exports=P3});var Hp=v((lK,gE)=>{var O3=Fp(),R3=hE(),F3=Wo();function x3(e){return F3(e)?O3(e,!0):R3(e)}gE.exports=x3});var yE=v((uK,vE)=>{var L3=dE(),k3=Hp();function M3(e){return L3(e,k3(e))}vE.exports=M3});var SE=v((cK,EE)=>{var bE=Vp(),U3=GC(),B3=JC(),$3=KC(),q3=rE(),wE=Pp(),AE=Un(),V3=iE(),G3=Vl(),z3=Ul(),W3=nn(),H3=sE(),j3=zl(),CE=zp(),J3=yE();function Q3(e,t,r,n,i,a,o){var s=CE(e,r),l=CE(t,r),u=o.get(l);if(u){bE(e,r,u);return}var c=a?a(s,l,r+"",e,t,o):void 0,d=c===void 0;if(d){var p=AE(l),f=!p&&G3(l),m=!p&&!f&&j3(l);c=l,p||f||m?AE(s)?c=s:V3(s)?c=$3(s):f?(d=!1,c=U3(l,!0)):m?(d=!1,c=B3(l,!0)):c=[]:H3(l)||wE(l)?(c=s,wE(s)?c=J3(s):(!W3(s)||z3(s))&&(c=q3(l))):d=!1}d&&(o.set(l,c),i(c,l,n,a,o),o.delete(l)),bE(e,r,c)}EE.exports=Q3});var jp=v((dK,DE)=>{var K3=Dp(),X3=Vp(),Y3=UC(),Z3=SE(),e4=nn(),t4=Hp(),r4=zp();function NE(e,t,r,n,i){e!==t&&Y3(t,function(a,o){if(i||(i=new K3),e4(a))Z3(e,t,o,r,NE,n,i);else{var s=n?n(r4(e,o),a,o+"",e,t,i):void 0;s===void 0&&(s=a),X3(e,o,s)}},t4)}DE.exports=NE});var Jp=v((pK,IE)=>{function n4(e){return e}IE.exports=n4});var TE=v((fK,_E)=>{function i4(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)}_E.exports=i4});var RE=v((mK,OE)=>{var a4=TE(),PE=Math.max;function o4(e,t,r){return t=PE(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=PE(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),a4(e,this,s)}}OE.exports=o4});var xE=v((hK,FE)=>{function s4(e){return function(){return e}}FE.exports=s4});var ME=v((gK,kE)=>{var l4=xE(),LE=qp(),u4=Jp(),c4=LE?function(e,t){return LE(e,"toString",{configurable:!0,enumerable:!1,value:l4(t),writable:!0})}:u4;kE.exports=c4});var BE=v((vK,UE)=>{var d4=800,p4=16,f4=Date.now;function m4(e){var t=0,r=0;return function(){var n=f4(),i=p4-(n-r);if(r=n,i>0){if(++t>=d4)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}UE.exports=m4});var qE=v((yK,$E)=>{var h4=ME(),g4=BE(),v4=g4(h4);$E.exports=v4});var GE=v((bK,VE)=>{var y4=Jp(),b4=RE(),w4=qE();function A4(e,t){return w4(b4(e,t,y4),e+"")}VE.exports=A4});var WE=v((wK,zE)=>{var C4=oa(),E4=Wo(),S4=Gl(),N4=nn();function D4(e,t,r){if(!N4(r))return!1;var n=typeof t;return(n=="number"?E4(r)&&S4(t,r.length):n=="string"&&t in r)?C4(r[t],e):!1}zE.exports=D4});var Qp=v((AK,HE)=>{var I4=GE(),_4=WE();function T4(e){return I4(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&&_4(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})}HE.exports=T4});var JE=v((CK,jE)=>{var P4=jp(),O4=Qp(),R4=O4(function(e,t,r,n){P4(e,t,r,n)});jE.exports=R4});var Wt,jo=I(()=>{"use strict";(function(e){e[e.NotLoaded=0]="NotLoaded",e[e.Initialized=1]="Initialized",e[e.ConfigsLoaded=2]="ConfigsLoaded",e[e.Error=3]="Error"})(Wt||(Wt={}))});function KE(e,t,r="PROD"){let n=i=>`ShellSettings_ECS_ClientCache_${e}_${QE.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 QE,F4,XE=I(()=>{"use strict";QE=ie(Cp()),F4=ie(Ap());});var Kp,YE=I(()=>{"use strict";Il();Kp=To({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 eS,tS,rS,nS,Xp,x4,Jl,ZE,Yp=I(()=>{"use strict";eS=ie(Ap()),tS=ie(ub()),rS=ie(Cp()),nS=ie(PC()),Xp=ie(JE());jo();XE();YE();x4=60*1e3,Jl=class{clientName;logger;ecsEndpoint;resolveLoadingPromise;loadingPromise=new Promise(t=>this.resolveLoadingPromise=t);_status=Wt.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"?Kp.prodEcsEndpoint:Kp.integrationEcsEndpoint}client=new tS.default;init=async({clientVersion:t,getFilters:r,cacheStorage:n=eS.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:[rS.EcsConfigType.Default],hosts:[this.ecsEndpoint],initialAppActiveState:!0,getEcsParameters:o,databaseInterface:KE(this.clientName,n,this.endpointType),...a}),this.client.requestUpdate(),this._status===Wt.NotLoaded&&(this._status=Wt.Initialized)}catch(s){this._status=Wt.Error,this.resolveLoadingPromise(),this.logEvent("FeaturesClient/initializationFailed",{ecsClientName:this.clientName,error:s},"Error")}i&&window.setInterval(()=>this.client.requestUpdate(),i*x4)};getConfig=t=>{let r=this.getMergedClientConfigByTeamName(t.teamName),n=r?t.extractConfig(r):{};return(0,Xp.default)({},t.fallback,n,t.override,ZE)};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,nS.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,Xp.default)({},this.client.getConfig()?.config,this.clientConfigOverride,ZE);getMergedClientConfigByTeamName=t=>this.getMergedClientConfig()?.[t];handleConfigUpdated=()=>{let t=this.client.getConfig();if(t===void 0)return;this.resolveLoadingPromise(),this._status=Wt.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})}},ZE=(e,t)=>{if(Array.isArray(t))return t}});var aS=v((OK,iS)=>{"use strict";var L4=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};iS.exports=L4});var Zp=v((RK,sS)=>{var Jo=new Proxy(function(){return Jo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Jo},apply:function(){return Jo},construct:function(){return{}}}),oS=function(){return Jo};Object.setPrototypeOf(oS,Jo);sS.exports=oS});var cS=v((FK,uS)=>{var Qo=new Proxy(function(){return Qo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Qo},apply:function(){return Qo},construct:function(){return{}}}),lS=function(){return Qo};Object.setPrototypeOf(lS,Qo);uS.exports=lS});var vS=v((xK,gS)=>{"use strict";var ef=cS(),k4={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},M4={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},U4={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},mS={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},tf={};tf[ef.ForwardRef]=U4;tf[ef.Memo]=mS;function dS(e){return ef.isMemo(e)?mS:tf[e.$$typeof]||k4}var B4=Object.defineProperty,$4=Object.getOwnPropertyNames,pS=Object.getOwnPropertySymbols,q4=Object.getOwnPropertyDescriptor,V4=Object.getPrototypeOf,fS=Object.prototype;function hS(e,t,r){if(typeof t!="string"){if(fS){var n=V4(t);n&&n!==fS&&hS(e,n,r)}var i=$4(t);pS&&(i=i.concat(pS(t)));for(var a=dS(e),o=dS(t),s=0;s<i.length;++s){var l=i[s];if(!M4[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var u=q4(t,l);try{B4(e,l,u)}catch{}}}}return e}gS.exports=hS});function bS(e,t,r){let[n,i]=(0,ha.useState)(e.getConfig(t));return(0,ha.useEffect)(()=>{if(!r?.subscribe&&e.status===Wt.ConfigsLoaded)return;let a=e.subscribe(t,o=>{i(o),r?.subscribe||a.unsubscribe()});return a?.unsubscribe},[]),n}function wS(e){return function(t,r){return bS(e,t,r)}}function AS(e,t,r,n){let i=a=>{let o=bS(e,t,n),s={...a,...o};return ha.default.createElement(r,{...s})};return(0,yS.default)(i,r),i.displayName=`WithFeature(${r.name})`,i}function CS(e,t,r,n){return t.reduce((i,a)=>AS(e,a,i,n),r)}function ES(e){return function(t,r,n){return AS(e,t,r,n)}}var yS,ha,rf=I(()=>{"use strict";yS=ie(vS()),ha=ie(Zp());jo();});var NS=v((MK,SS)=>{var G4=jp(),z4=Qp(),W4=z4(function(e,t,r){G4(e,t,r)});SS.exports=W4});var Ql=v((UK,DS)=>{var H4=pi(),j4=Bn(),J4="[object Symbol]";function Q4(e){return typeof e=="symbol"||j4(e)&&H4(e)==J4}DS.exports=Q4});var _S=v((BK,IS)=>{var K4=Un(),X4=Ql(),Y4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z4=/^\w*$/;function eV(e,t){if(K4(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||X4(e)?!0:Z4.test(e)||!Y4.test(e)||t!=null&&e in Object(t)}IS.exports=eV});var OS=v(($K,PS)=>{var TS=$l(),tV="Expected a function";function nf(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(tV);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(nf.Cache||TS),r}nf.Cache=TS;PS.exports=nf});var FS=v((qK,RS)=>{var rV=OS(),nV=500;function iV(e){var t=rV(e,function(n){return r.size===nV&&r.clear(),n}),r=t.cache;return t}RS.exports=iV});var LS=v((VK,xS)=>{var aV=FS(),oV=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,sV=/\\(\\)?/g,lV=aV(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(oV,function(r,n,i,a){t.push(i?a.replace(sV,"$1"):n||r)}),t});xS.exports=lV});var MS=v((GK,kS)=>{function uV(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}kS.exports=uV});var GS=v((zK,VS)=>{var US=Uo(),cV=MS(),dV=Un(),pV=Ql(),fV=1/0,BS=US?US.prototype:void 0,$S=BS?BS.toString:void 0;function qS(e){if(typeof e=="string")return e;if(dV(e))return cV(e,qS)+"";if(pV(e))return $S?$S.call(e):"";var t=e+"";return t=="0"&&1/e==-fV?"-0":t}VS.exports=qS});var WS=v((WK,zS)=>{var mV=GS();function hV(e){return e==null?"":mV(e)}zS.exports=hV});var jS=v((HK,HS)=>{var gV=Un(),vV=_S(),yV=LS(),bV=WS();function wV(e,t){return gV(e)?e:vV(e,t)?[e]:yV(bV(e))}HS.exports=wV});var QS=v((jK,JS)=>{var AV=Ql(),CV=1/0;function EV(e){if(typeof e=="string"||AV(e))return e;var t=e+"";return t=="0"&&1/e==-CV?"-0":t}JS.exports=EV});var YS=v((JK,XS)=>{var SV=Wp(),NV=jS(),DV=Gl(),KS=nn(),IV=QS();function _V(e,t,r,n){if(!KS(e))return e;t=NV(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=IV(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=KS(c)?c:DV(t[i+1])?[]:{})}SV(s,l,u),s=s[l]}return e}XS.exports=_V});var eN=v((QK,ZS)=>{var TV=YS();function PV(e,t,r){return e==null?e:TV(e,t,r)}ZS.exports=PV});function iN(e){let{query:t}=(0,nN.default)(window.location.href,!0);return RV(e,t),e}function RV(e,t){let r=OV+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+aN,u={};if(a===r)u=s;else if(a.startsWith(l)){let c=a.substring(l.length);(0,rN.default)(u,c,s)}(0,tN.default)(i,u)}catch{}}),Object.keys(i).length>0&&e.overrideClientConfig(i)}var tN,rN,nN,aN,OV,oN=I(()=>{"use strict";tN=ie(NS()),rN=ie(eN()),nN=ie(lp());aN=".",OV="ecs"+aN});function Xl(e,t,r){let n=iN(new Jl(e,t,r));function i(a){(0,Kl.useEffect)(()=>{n.init(a)},[])}return{featuresClient:n,createFeature:xV(n),useFeaturesClientInitParams:i,withFeatures:(a,o,s)=>CS(n,a,o,s)}}function xV(e){let t=wS(e),r=ES(e);return function(i){let a=ib(i);return a.getConfig=()=>e.getConfig(a),a.isLoaded=()=>e.status===Wt.ConfigsLoaded,dp.register(a,e.clientName),{useFeature:o=>t(a,o),withFeature:(o,s)=>r(a,o,s),feature:a}}}var FV,Kl,af=I(()=>{"use strict";FV=ie(aS()),Kl=ie(Zp());wp();Yp();jo();rf();oN();pp();});var sN=I(()=>{"use strict";wp();Yp();af();jo();rf();Ol();fp();});function Yl(e){return{logEvent:(t,r,n)=>{switch(n){case"Error":(0,ga.trackErrorTrace)(e,{eventName:t,eventData:r});break;case"Warning":(0,ga.trackWarningTrace)(e,{eventName:t,eventData:r});break;default:(0,ga.trackInfoTrace)(e,{eventName:t,eventData:r});break}}}}var ga,of=I(()=>{"use strict";ga=ie(oi());});var hX,gX,vX,lN=I(()=>{"use strict";sN();of();({featuresClient:hX,createFeature:gX,useFeaturesClientInitParams:vX}=Xl("PowerApps-Shell-Test",Yl("shell-features")))});var dN=v((bX,cN)=>{var Ko=new Proxy(function(){return Ko},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Ko},apply:function(){return Ko},construct:function(){return{}}}),uN=function(){return Ko};Object.setPrototypeOf(uN,Ko);cN.exports=uN});var LV,kV,pN=I(()=>{"use strict";Do();LV=ie(dN()),kV=ie(oi());});var fN=I(()=>{"use strict";lN();of();pN();});var _X,va,TX,mN=I(()=>{"use strict";fN();af();({featuresClient:_X,createFeature:va,useFeaturesClientInitParams:TX}=Xl("PowerApps-MakerPortal",Yl("powerapps-features")))});var hN,gN,FX,xX,LX,kX,sf=I(()=>{"use strict";nb();mN();({feature:hN}=va({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:aa.enableAutoInsertionOfCellInRow}})),{feature:gN}=va({teamName:"MakerPortal",owners:["aansu"],description:"Enable the one grid events for form designer",createdOn:"08/21/2024",fallback:{enableOneGridEventsForFormDesigner:aa.enableOneGridEvents}}),{feature:FX}=va({teamName:"MakerPortal",owners:["adekulkarni"],description:"Disables PBI components and cleans them up from the form",createdOn:"01/03/2023",fallback:{enableFallbackFormTemplate:aa.disablePBIComponents}}),{feature:xX}=va({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:aa.enableAgentResponse}}),{feature:LX,useFeature:kX}=va({teamName:"MakerPortal",owners:["aansu"],description:"Enables delayed localization of custom control",createdOn:"06/08/2025",fallback:{enableDelayedLocalizationForCustomControls:aa.enableDelayedLocalizationForCustomControls}})});var bN=v((UX,yN)=>{var Xo=new Proxy(function(){return Xo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Xo},apply:function(){return Xo},construct:function(){return{}}}),vN=function(){return Xo};Object.setPrototypeOf(vN,Xo);yN.exports=vN});var it,$n=I(()=>{"use strict";Le();Oe();nt();kl();X();We();it=class extends H{static HighestUsedIndexByClass=new Map;get colspan(){let t=this.getProperty(h.colspan);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set colspan(t){N.IsNullOrUndefined(t)||this.setProperty(h.colspan,String(t))}constructor(t,r){super(t,r)}get id(){let t=this.getProperty(h.id);return t==null?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}set id(t){this.setProperty(h.id,`{${t.ToString()}}`)}set labelId(t){this.setProperty(h.labelId,`{${t.ToString()}}`)}get labelId(){let t=this.getProperty(h.labelId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}get Name(){return this.getProperty(h.Name)}set Name(t){this.setProperty(h.Name,t)}setDisplayName(t,r){for(let i of this.getAllLabels())if(+i.getProperty(h.languagecode)===r){i.setProperty(h.description,t);return}let n=new H(b.formLabel,null);n.setProperty(h.description,t),n.setProperty(h.languagecode,String(r)),this.addGrandChild("labels",n)}getDisplayName(t){for(let r of this.getAllLabels())if(+r.getProperty(h.languagecode)===t)return r.getProperty(h.description)}getAllLabels(){let t=this.getChildren("labels");return t.length!==1?[]:t[0].getChildren("label")}get isLocked(){return+this.getProperty(h.locklevel)==1}set isLocked(t){!this.IsUnboundControl&&this.setProperty(h.locklevel,t?"1":"0")}get availableforphone(){return this.getProcessedValue(h.availableforphone)}set availableforphone(t){N.IsNullOrUndefined(t)||!this.IsAllowedUBCForAvailableOnPhone()||this.setProperty(h.availableforphone,String(t))}get visible(){return this.getProcessedValue(h.visible)}set visible(t){N.IsNullOrUndefined(t)||!this.IsAllowedUBCForVisibleByDefault()||this.setProperty(h.visible,String(t))}isLockLevelSettable(){return!this.IsUnboundControl}get showlabel(){return this.getProcessedValue(h.showlabel)}set showlabel(t){N.IsNullOrUndefined(t)||this.setProperty(h.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(b.formControl);return t?t.disabled:!1}set readonly(t){let r=this.getFirstChild(b.formControl);r&&(r.disabled=t)}get allowfilteroff(){let t=this.getFirstChild(b.formControl);if(t)return t.getParam(h.AllowFilterOff)==="true"}set allowfilteroff(t){let r=this.getFirstChild(b.formControl);r&&!this.IsUnboundControl&&r.setParameter(h.AllowFilterOff,t)}get autoresolve(){let t=this.getFirstChild(b.formControl);if(t)return t.getParam(h.AutoResolve)==="true"}set autoresolve(t){let r=this.getFirstChild(b.formControl);r&&!this.IsUnboundControl&&r.setParameter(h.AutoResolve,t)}get defaultviewid(){let t=this.getFirstChild(b.formControl);return t?t.getParam(h.DefaultViewId):O.EmptyString}set defaultviewid(t){let r=this.getFirstChild(b.formControl);r&&!this.IsUnboundControl&&r.setParameter(h.DefaultViewId,t)}get dependentattributename(){let t=this.getFirstChild(b.formControl);return t?t.getParam(h.DependentAttributeName):O.EmptyString}set dependentattributename(t){let r=this.getFirstChild(b.formControl);r&&!this.IsUnboundControl&&r.setParameter(h.DependentAttributeName,t)}get dependentattributetype(){let t=this.getFirstChild(b.formControl);return t?t.getParam(h.DependentAttributeType):O.EmptyString}set dependentattributetype(t){let r=this.getFirstChild(b.formControl);r&&!this.IsUnboundControl&&r.setParameter(h.DependentAttributeType,t)}get disablequickfind(){let t=this.getFirstChild(b.formControl);if(t)return t.getParam(h.DisableQuickFind)==="true"}set disablequickfind(t){let r=this.getFirstChild(b.formControl);r&&!this.IsUnboundControl&&r.setParameter(h.DisableQuickFind,t)}get disableviewpicker(){let t=this.getFirstChild(b.formControl);if(t)return t.getParam(h.DisableViewPicker)==="true"}set disableviewpicker(t){let r=this.getFirstChild(b.formControl);r&&!this.IsUnboundControl&&r.setParameter(h.DisableViewPicker,t)}get filterrelationshipname(){let t=this.getFirstChild(b.formControl);return t?t.getParam(h.FilterRelationshipName):O.EmptyString}set filterrelationshipname(t){let r=this.getFirstChild(b.formControl);r&&!this.IsUnboundControl&&r.setParameter(h.FilterRelationshipName,t)}get availableviewids(){let t=this.getFirstChild(b.formControl);return t?t.getParam(h.AvailableViewIds):O.EmptyString}set availableviewids(t){let r=this.getFirstChild(b.formControl);r&&!this.IsUnboundControl&&r.setParameter(h.AvailableViewIds,t)}get IsUnboundControl(){let t=this.getFirstChild(b.formControl);if(t&&t.ClassId){let r=Me.getUniqueIdentifierForControl(t);return!N.IsNullOrUndefined(r)&&Me.isUnboundFormControlByIdentifier(r)}else return!1}IsAllowedUBCForAvailableOnPhone(){let t=this.getFirstChild(b.formControl);if(t){let n=Me.getUniqueIdentifierForControl(t).guidString,i=n===x.GridControl||n===x.TimeLineControl||n===x.TimeLineControlUC;return this.IsUnboundControl?i:!0}return this.NodeName===b.formSection||this.NodeName===b.formTab}IsAllowedUBCForVisibleByDefault(){let t=this.getFirstChild(b.formControl);if(t){let n=Me.getUniqueIdentifierForControl(t).guidString,i=n===x.MapsControl||n===x.WebResourceHtmlControl||n===x.WebResourceImageControl||n===x.IframeControl||n===x.SocialInsightControl;return this.IsUnboundControl?i:!0}else return!0}get events(){let t=this.getChildren(b.formEvents);return t.length===1?t[0].getAllChildren():[]}addEvent(t){this.addGrandChild(b.formEvents,t)}getUsedNodeNameSet(t){return null}getHighestIndexById(t,r){return null}}});var ya,lf=I(()=>{"use strict";nt();X();We();ya=class extends H{constructor(t,r){super(b.dependency,t),O.IsNullOrEmpty(r)||this.setDefaultProperties(r)}set id(t){this.setProperty(h.id,t)}get id(){return this.getProperty(h.id)}setDefaultProperties(t){this.id=t}}});var wN,ba,uf=I(()=>{"use strict";Oe();lf();X();We();$n();(function(e){e[e.Form=0]="Form",e[e.Cell=1]="Cell",e[e.Tab=2]="Tab",e[e.Control=3]="Control"})(wN||(wN={}));ba=class extends it{constructor(t,r){super(b.formEvent,t),r&&(this.eventName=r,this.application="false",this.active="false")}set eventName(t){this.setProperty(h.Name,t)}get eventName(){return this.getProperty(h.Name)}set application(t){this.setProperty(h.application,t)}get application(){return this.getProperty(h.application)}set attribute(t){this.setProperty(h.EventAttribute,t)}get attribute(){return this.getProperty(h.EventAttribute)}set relationship(t){this.setProperty(h.Relationship,t)}get relationship(){return this.getProperty(h.Relationship)}set control(t){this.setProperty(h.Control,t)}get control(){return this.getProperty(h.Control)}set active(t){this.setProperty(h.EventActive,t)}get active(){return this.getProperty(h.EventActive)}getAllHandlers(){let t=this.getChildren(b.EventHandlers);return t&&t.length?t[0].getChildren(b.handler):[]}getAllDependencies(){let t=this.getChildren(b.formDependencies);return t.length===0?[]:t[0].getAllChildren()}setDependencies(t){let r=this.getFirstChild(b.formDependencies);if(N.IsNullOrUndefined(r)){if(t.length===0)return;this.addChild(new H(b.formDependencies,this)),r=this.getFirstChild(b.formDependencies)}if(t.length===0)r.getParentNode().deleteChild(r);else{r.deleteAllChildren();for(let n of t)r.addChild(new ya(r,n.toString()))}}}});var fr,Yo=I(()=>{"use strict";Le();No();Oe();ai();X();We();cr();fr=class extends H{previewVersion;constructor(t){super(b.formControl,t)}updatePreview(){this.previewVersion=Date.now()}get ClassId(){let t=this.getProperty(h.classid);return t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t)}set ClassId(t){this.setProperty(h.classid,`{${t.ToString()}}`)}get dataFieldName(){return this.getProperty(h.datafieldname)}set dataFieldName(t){this.setProperty(h.datafieldname,t)}set id(t){this.setProperty(h.id,t)}get id(){return this.getProperty(h.id)}get UniqueId(){let t=this.getProperty(h.uniqueid);return N.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t))}set UniqueId(t){this.setProperty(h.uniqueid,`{${t.ToString()}}`)}get isRequired(){return this.getProperty(h.isRequired)==="true"}set isRequired(t){N.IsNullOrUndefined(t)||this.setProperty(h.isRequired,String(t))}get disableMru(){return this.getParam(h.DisableMru)==="true"}set disableMru(t){N.IsNullOrUndefined(t)||this.setParameter(h.DisableMru,t)}get useMFDForCreate(){return this.getParam(h.UseMFDForCreate)==="true"}set useMFDForCreate(t){N.IsNullOrUndefined(t)||this.setParameter(h.UseMFDForCreate,t)}get useMFDForEdit(){return this.getParam(h.UseMFDForEdit)==="true"}set useMFDForEdit(t){N.IsNullOrUndefined(t)||this.setParameter(h.UseMFDForEdit,t)}get disabled(){return this.getProperty(h.disabled)==="true"}set disabled(t){N.IsNullOrUndefined(t)||this.setProperty(h.disabled,String(t))}get indicationOfSubgrid(){return this.getProperty(h.indicationOfSubgrid)==="true"}set indicationOfSubgrid(t){this.setProperty(h.indicationOfSubgrid,String(t))}getAllParameters(){let t=new mt,r=this.getFirstChild(h.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=(rn.StartTag+r).toString(),a=this.parametersNode;if(a){let o=a.findFirst(s=>s&&s.getNodeName()===t);if(o)if(n){this.deleteFirstGrandChildOfName(b.controlParameters,o);return}else{let s=o.getAllChildren();s&&s.length>0&&s[0]?s[0].setNodeName(i):o.addChild(new H(i,o))}else n||(o=new H(t,a),o.addChild(new H(i,o)),a.addChild(o))}else if(!n){a=new H("parameters",this);let o=new H(t,a);o.addChild(new H(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)===rn.StartTag?a.substring(1):a}}}return null}get parametersNode(){let t=this.getChildren(h.parameters);return t.length===0?null:t[0]}async serializeParameters(t,r){let n=new mt;switch(this.ClassId.guidString.toUpperCase()){case S.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(h.isUnbound)==="true"}getAttributeTypeFromClassId(t){if(t)switch(t.toUpperCase()){case S.BooleanControl:case S.CheckboxControl:return 0;case S.DateTimeControl:return 2;case S.DecimalControl:return 3;case S.FloatingNumberControl:return 4;case S.IntegerControl:case S.DurationControl:case S.LanguageControl:case S.TimezoneControl:return 5;case S.LookupControl:return 6;case S.CurrencyControl:return 8;case S.PartyListControl:return 10;case S.ChoiceControl:case S.RelationshipRoleChoiceControl:return 11;case S.ChoiceStatusControl:return 13;case S.TextAreaControl:case S.TextboxControl:case S.LabelControl:case S.EmailAddressControl:case S.UrlControl:case S.TickerControl:case S.ButtonControl:case S.PhoneNumberControl:return 14;case S.ChoicesControl:return 24;default:return}return 14}async toJSON(t){let r=this.getParent(),n=t&&t.formModelService&&t.formModelService.getFormType()===ke.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 wa,cf=I(()=>{"use strict";nt();Zi();Yo();X();We();wa=class extends fr{constructor(t){super(t)}get targetEntityType(){return this.getParam(h.targetEntityType)||O.EmptyString}set targetEntityType(t){this.setParameter(h.targetEntityType,t)}get viewId(){return O.StripBraces(this.getParam(h.viewId))||O.EmptyString}set viewId(t){this.setParameter(h.viewId,O.AddBraces(t))}get viewIds(){return this.getParam(h.viewIds)||O.EmptyString}set viewIds(t){this.setParameter(h.viewIds,t)}get relationshipName(){return this.getParam(h.RelationshipName)||O.EmptyString}set relationshipName(t){this.setParameter(h.RelationshipName,t)}get isUserView(){return O.IsStrictTrue(this.getParam(h.isUserView))}set isUserView(t){this.setParameter(h.isUserView,t.toString())}get enableViewPicker(){return O.IsStrictTrue(this.getParam(h.enableViewPicker))}set enableViewPicker(t){this.setParameter(h.enableViewPicker,t)}get autoExpand(){return this.getParent().autoexpand&&this.getParam(h.autoExpand)===h.Auto}set autoExpand(t){let r=this.getParent();this.setParameter(h.autoExpand,t?h.Auto:h.Fixed),r.autoexpand=t}get recordsPerPage(){return this.getParam(h.recordsPerPage)?Number(this.getParam(h.recordsPerPage)):Number(h.RecordsPerPageRAControlDefault)}set recordsPerPage(t){this.setParameter(h.recordsPerPage,String(t))}get enableQuickFind(){return O.IsStrictTrue(this.getParam(h.enableQuickFind))}set enableQuickFind(t){this.setParameter(h.enableQuickFind,t)}get teamTemplateId(){return O.StripBraces(this.getParam(h.teamTemplateId))||O.EmptyString}set teamTemplateId(t){this.setParameter(h.teamTemplateId,O.AddBraces(t))}get chartId(){return this.getParam(h.visualizationId)||O.EmptyString}set chartId(t){this.setParameter(h.visualizationId,t)}get enableChartPicker(){return O.IsStrictTrue(this.getParam(h.enableChartPicker))}set enableChartPicker(t){this.setParameter(h.enableChartPicker,t)}get chartGridMode(){switch(this.getParam(h.chartGridMode)){case zt.Chart:return zt.Chart;case zt.Grid:return zt.Grid;default:return zt.All}}set chartGridMode(t){this.setParameter(h.chartGridMode,t)}updateChartGridMode(t){t?this.chartGridMode=zt.Chart:this.chartGridMode=this.enableChartPicker?zt.All:zt.Grid}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case h.targetEntityType:n.getAllChildren()[0].setNodeName("<"+r.targetEntityType);break;case h.viewId:n.getAllChildren()[0].setNodeName("<"+O.AddBraces(r.viewId));break;case h.isUserView:n.getAllChildren()[0].setNodeName("<"+r.isUserView);break;case h.enableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.enableViewPicker);break;case h.RelationshipName:let i=n.getAllChildren(),a="<"+r.relationshipName;i.length?n.getAllChildren()[0].setNodeName(a):n.addChild(new H(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(ht.dataset)?n[i].getParameters().get(ht.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 Aa,df=I(()=>{"use strict";nt();Zi();Yo();X();Aa=class extends fr{constructor(t){super(t)}get defaultViewId(){return O.StripBraces(this.getParam(h.DefaultViewId))||O.EmptyString}set defaultViewId(t){this.setParameter(h.DefaultViewId,O.AddBraces(t))}get autoResolve(){return O.IsStrictTrue(this.getParam(h.AutoResolve))}set autoResolve(t){this.setParameter(h.AutoResolve,t)}get disableQuickFind(){return O.IsStrictTrue(this.getParam(h.DisableQuickFind))}set disableQuickFind(t){this.setParameter(h.DisableQuickFind,t)}get disableViewPicker(){return O.IsStrictTrue(this.getParam(h.DisableViewPicker))}set disableViewPicker(t){this.setParameter(h.DisableViewPicker,t)}get allowFilterOff(){return O.IsStrictTrue(this.getParam(h.AllowFilterOff))}set allowFilterOff(t){this.setParameter(h.AllowFilterOff,t)}get disableMru(){return O.IsStrictTrue(this.getParam(h.DisableMru))}set disableMru(t){this.setParameter(h.DisableMru,t)}get dependentAttributeName(){return this.getParam(h.DependentAttributeName)||O.EmptyString}set dependentAttributeName(t){this.setParameter(h.DependentAttributeName,t)}get dependentAttributeType(){return this.getParam(h.DependentAttributeType)||O.EmptyString}set dependentAttributeType(t){this.setParameter(h.DependentAttributeType,t)}get filterRelationshipName(){return this.getParam(h.FilterRelationshipName)||O.EmptyString}set filterRelationshipName(t){this.setParameter(h.FilterRelationshipName,t)}get availableViewIds(){return this.getParam(h.AvailableViewIds)||O.EmptyString}set availableViewIds(t){this.setParameter(h.AvailableViewIds,t)}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case h.datafieldname:case h.bindAttribute:n.getAllChildren()[0].setNodeName("<"+r.dataFieldName);break;case h.DefaultViewId:n.getAllChildren()[0].setNodeName("<"+O.AddBraces(r.defaultViewId));break;case h.AllowFilterOff:n.getAllChildren()[0].setNodeName("<"+r.allowFilterOff);break;case h.DisableQuickFind:n.getAllChildren()[0].setNodeName("<"+r.disableQuickFind);break;case h.DisableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.disableViewPicker);break;case h.FilterRelationshipName:n.getAllChildren()[0].setNodeName("<"+r.filterRelationshipName);break;case h.DependentAttributeName:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeName);break;case h.DependentAttributeType:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeType);break;case h.AvailableViewIds:n.getAllChildren()[0].setNodeName("<"+r.availableViewIds);break;case h.DisableMru:n.getAllChildren()[0].setNodeName("<"+r.disableMru);break;case h.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(ht.value)?n[i].getParameters().get(ht.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 AN,pf,Dt,Zo=I(()=>{"use strict";AN=ie(bN());$n();X();Oe();Le();uf();Yo();kl();yp();Kd();cr();ai();Ki();cf();df();ff();Oo();pf="_",Dt=class e extends it{fieldPlaceholder;fieldRequiredLevel;isNewField;cellColType;dependentFields=[];constructor(t){super(b.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(h.id))&&(this.id=new P(P.NewGuid()))}addControl(t,r,n,i,a,o,s){n instanceof fr?this.addChild(n):n instanceof P&&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:!si.dependencyFieldCount.containsKey(this.control.id):!si.dependencyFieldCount.containsKey(this.control.dataFieldName)}createOnLoadEvent(){this.addEvent(new ba(this,Eo.onLoad))}get dependencies(){let t=this.getChildren(b.formEvents);for(let r of t){let n=r.getChildren(b.formEvent);for(let i of n)this.buildDependencyList(i,this.dependentFields)}return this.dependentFields}getNextAvailableControlName(t,r,n,i){let a;if(i&&Cl[i])a=Cl[i].replace(/ /g,pf)+pf;else{a="Control_";let u=new Error("Control class id does not exist or is undefined");(0,AN.trackErrorTrace)(ft,{eventName:`${hy}/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,h.isUnbound,"true"),e.prototype.setProperty.call(t,h.isRequired,"false")}getControlWithControlSpecificProperties(t,r,n,i,a,o,s){let l;a===Ht.Grid?(l=new wa(this),l.indicationOfSubgrid=!0):a===Ht.Lookup?l=new Aa(this):l=new fr(this);let u=n.guidString,c=o||this.getNextAvailableControlName(t,i,this.getUsedNodeNameSet(t),u);if(e.prototype.setProperty.call(l,h.id,c),l.ClassId=n,!N.IsNullOrUndefined(s)&&(l.UniqueId=s),!o&&r)this.getUnboundControlProperties(l);else{let d=Me.getUniqueIdentifierForControl(l);N.IsNullOrUndefined(d)||(Me.getControlDataTypeByControlOrUniqueId(d)===z.QuickFormCollectionControl||!Me.isUnboundFormControlByIdentifier(d)?a!==Ht.Grid&&o&&u!==S.IframeControl&&u!==S.SubgridControl&&u!==S.ReferencePanelSubgridControl&&(l.dataFieldName=o,e.prototype.setProperty.call(l,h.disabled,"false")):(this.rowspan=Me.GetRowSpan(l),(Me.getControlDataTypeByControlOrUniqueId(d)===z.NotesControl||Me.getControlDataTypeByControlOrUniqueId(d)===z.TimeLineControl)&&(e.prototype.setProperty.call(l,h.disabled,"false"),l.id=z.NotesControl)),(Me.getUnboundControlNameFromIdentifier(n)===z.SubGridControl||Me.getUnboundControlNameFromIdentifier(n)===z.NotesControl||Me.getUnboundControlNameFromIdentifier(n)===z.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(h.id);o.getNodeName()===b.dependency&&s?r.push(s):this.buildDependencyList(o,r)}}}get control(){return this.getFirstChild(b.formControl)}set rowspan(t){this.setProperty(h.rowspan,String(t))}get rowspan(){let t=this.getProperty(h.rowspan);return N.IsNullOrUndefined(t)?1:parseInt(t,10)}set autoexpand(t){this.setProperty(h.auto,String(t))}get autoexpand(){return this.getProperty(h.auto)==="true"}set colspan(t){let r=Number(gp.ONE_COLUMN),n=Number(gp.FOUR_COLUMN);N.IsNullOrUndefined(t)||t>n||t<r||this.setProperty(h.colspan,String(t))}get colspan(){let t=this.getProperty(h.colspan);return N.IsNullOrUndefined(t)?1:parseInt(t,10)}getParentRow(){return this.getAncestor(b.formRow)}getParentSection(){return this.getAncestor(b.formSection)}getParentTab(){return this.getAncestor(b.formTab)}getParentForm(){return this.getAncestor(b.form)}isInHeader(){let t=this.getAncestor(b.formHeader);return!N.IsNullOrUndefined(t)}isInFooter(){let t=this.getAncestor(b.formFooter);return!N.IsNullOrUndefined(t)}isEmpty(){return N.IsNullOrUndefined(this.control)&&!this.IsUserSpacer}getHeaderFooter(){return this.isInHeader()?this.getAncestor(b.formHeader):this.isInFooter()?this.getAncestor(b.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(h.userspacer);return N.IsNullOrUndefined(t)?!1:t==="true"}SetUserSpacer(){this.setProperty(h.userspacer,"true")}ClearUserSpacer(){this.setProperty(h.userspacer,"false")}get columns(){let t=this.getProperty(h.columnName);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}getColumnLayoutValue(t){let r;switch(t){case Ce.TWO_COLUMN:r="11";break;case Ce.THREE_COLUMN:r="111";break;case Ce.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===ui.ApplicationRequired||o===ui.SystemRequired)&&!a||this.isCellLockedByExternal(t)&&!a)return!0}}return!1}getRequiredLevel(t){return!this.control?.dataFieldName||!this.control?.id||this.IsNewField||!this.control?.ClassId?ui.None:t.getEntityAttributeByName(this.control.dataFieldName)?.requiredLevel?.toString()??ui.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()===b.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()===b.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)===pf&&(r++,n=parseInt(t.substr(r,t.length-r),10)),n}}});var Ca,mf=I(()=>{"use strict";nt();X();We();Ca=class extends H{isInternal;constructor(t,r,n,i){super(b.library,t),this.isInternal=!!i,O.IsNullOrEmpty(n)||(this.name=r,this.libraryUniqueId=n)}get libraryUniqueId(){let t=this.getProperty(h.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(h.libraryUniqueId,t)}get name(){return this.getProperty(h.libraryName)}set name(t){this.setProperty(h.libraryName,t)}get displayName(){return this.getProperty(h.displayName)}set displayName(t){this.setProperty(h.displayName,t)}get description(){return this.getProperty(h.description)}set description(t){this.setProperty(h.description,t)}}});var mi,hf=I(()=>{"use strict";Oe();Zo();X();We();mi=class extends H{isRowAddedOnDragOver;constructor(t){super(b.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(b.formSection)}insertPaddingCellAtIndex(t){let r=new Dt(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(b.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 MV(e){switch(e){case ci.Left:return di.Left;case ci.Right:return di.Right;case ci.Center:return di.Center;default:return di.Left}}function UV(e){switch(e){case ra.Left:return ia.Left;case ra.Top:return ia.Top;default:return ia.Left}}function CN(e){switch(e){case 1:return 1;case 2:return 11;case 3:return 111;case 4:return 1111;default:return 1}}var BV,Rr,es=I(()=>{"use strict";bp();Le();Oe();nt();sf();Zo();X();cr();$n();hf();BV=115,Rr=class e extends it{colSpan=1;constructor(t,r){super(t,r)}getSectionType(){let t;switch(this.columns){case 1:t=Ce.ONE_COLUMN;break;case 11:t=Ce.TWO_COLUMN;break;case 111:t=Ce.THREE_COLUMN;break;case 1111:t=Ce.FOUR_COLUMN;break;default:t=this.colSpan-1}return t}setUniqueName(){let t=this.getParentTab(),r=we.namePrefix;if(t){let n=t.Name,i=t.TotalSectionsCount+1;r=n+we.namePrefix+i.toString()}else r+=Math.floor(Math.random()*1e3);this.setProperty(h.Name,r)}initializeDefaultProperties(t,r,n){if(n===Ce.REFERENCE_PANEL){this.addProperty(h.rowheight,"25");let i=`${we.referencePanelNamePrefix}${P.NewGuid()}${we.namePrefix}`;this.addProperty(h.Name,i)}else this.setUniqueName();if(this.addProperty(h.id,new P(P.NewGuid()).guidString),this.addProperty(h.IsUserDefined,we.IsUserDefined),this.addProperty(h.locklevel,we.LockLevel),this.addProperty(h.showlabel,we.ShowLabel),this.addProperty(h.showbar,we.ShowBar),this.addProperty(h.layout,we.Layout),this.addProperty(h.Fieldlabelalignment,we.labelAlignment),this.addProperty(h.Fieldlabelposition,we.labelPosition),N.IsNullOrUndefined(n))this.addProperty(h.columnName,we.columns);else{let i=this.getColumnLayoutValue(n);this.addProperty(h.columnName,i)}this.addProperty(h.LabelWidth,we.LabelWidth),this.setDisplayName(r,t)}getColumnLayoutValue(t){let r;switch(t){case Ce.TWO_COLUMN:r="11";break;case Ce.THREE_COLUMN:r="111";break;case Ce.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(O.EmptyString).forEach(r=>{t+=parseInt(r,10)}),t}get ColSpan(){return this.colSpan}initializeRow(t){if(t>0&&t<5){let r=new mi(null);if(this.addGrandChild(b.formRows,r),hN.getConfig().enableAutoInsertionOfCellInRow)for(let n=0;n<t;n++){let i=new Dt(r);i.setDefaultProperties(!1),r.addCell(i)}}}initialize(t,r,n){this.initializeDefaultProperties(t,r,n),n===Ce.REFERENCE_PANEL&&(n=Ce.ONE_COLUMN),this.initializeRow(n+1)}setColSpan(t){this.colSpan=t}appendRow(t){this.addGrandChild(b.formRows,t)}insertRowAtIndex(t,r){this.addGrandChildAtIndex(b.formRows,t,r)}insertRowsAtIndex(t,r){if(t&&t.length>0)for(let n=0;n<t.length;n++)this.addGrandChildAtIndex(b.formRows,t[n],r+n)}indexOfRow(t){return this.rows.indexOf(t)}deleteRow(t){return this.deleteFirstGrandChildOfName(b.formRows,t)}deleteRows(t,r){this.deleteGrandChildren(b.formRows,t,r)}get rows(){return this.getRows()}getRows(){let t=this.getChildren(b.formRows);return t.length===0?[]:t[0].getChildren(b.formRow)}get columns(){let t=this.getProperty(h.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 CN(n)}return r}set columns(t){N.IsNullOrUndefined(t)||this.setProperty(h.columnName,String(t))}get rowHeight(){let t=this.getProperty(h.rowheight);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set rowHeight(t){this.setProperty(h.rowheight,String(t))}set autoexpand(t){this.setProperty(h.autoExpand.toLowerCase(),String(t))}get autoexpand(){return this.getProperty(h.autoExpand.toLowerCase())==="true"}get isUserDefined(){return+this.getProperty(h.IsUserDefined)!=0}set isUserDefined(t){t?this.setProperty(h.IsUserDefined,"1"):this.setProperty(h.IsUserDefined,"0")}getParentColumn(){return this.getAncestor(b.formColumn)}getParentTab(){return this.getAncestor(b.formTab)}get hasMultiColumnRow(){return this.getColumnCountValue()>1}get showlabel(){return this.getProperty(h.showlabel)==="true"}set showlabel(t){N.IsNullOrUndefined(t)||this.setProperty(h.showlabel,String(t))}get fieldLabelAlignment(){let t=we.labelAlignment,r=this.getProperty(h.Fieldlabelalignment);return N.IsNullOrUndefined(r)?t:r}set fieldLabelAlignment(t){N.IsNullOrUndefined(t)||this.setProperty(h.Fieldlabelalignment,t)}get fieldLabelPosition(){let t=this.getProperty(h.Fieldlabelposition);return N.IsNullOrUndefined(t)?we.labelPosition:t}set fieldLabelPosition(t){N.IsNullOrUndefined(t)||this.setProperty(h.Fieldlabelposition,String(t))}get showbar(){return this.getProperty(h.showbar)==="true"}set showbar(t){N.IsNullOrUndefined(t)||this.setProperty(h.showbar,String(t))}get labelwidth(){let t=+this.getProperty(h.LabelWidth);return t===0?BV:t}set labelwidth(t){N.IsNullOrUndefined(t)||t>283&&t<57||this.setProperty(h.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:MV(this.fieldLabelAlignment),Position:UV(this.fieldLabelPosition)},Columns:CN(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()===b.formSection){let i=n;i.Name&&!O.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(we.referencePanelNamePrefix)===0}getAllMultiRowCells(){return this.findAll(t=>{if(t.getNodeName()===b.formCell){let r=t;return!r.isEmpty()&&r.rowspan>1}return!1})}isHeaderOrFooterSection(){return this.NodeName===b.formFooter||this.NodeName===b.formHeader}}});var qn,Zl=I(()=>{"use strict";X();We();es();qn=class e extends H{constructor(t){super(b.formColumn,t)}initializeDefaultProperties(t){this.addProperty(h.width,t.toString()+"%")}insertSectionAtIndex(t,r){this.addGrandChildAtIndex(b.formSections,t,r)}static createAndInitNewSection(t,r,n){let i=new Rr(b.formSection,null);return i.initialize(t,r,n),i}addSectionAtIndex(t,r){this.addGrandChildAtIndex(b.formSections,t,r)}initialize(t,r,n,i=Ce.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(b.formTab)}get sections(){let t=this.getChildren("sections");return t.length!==1?[]:t[0].getChildren(b.formSection)}get width(){return this.getProperty(h.width)}set width(t){this.setProperty(h.width,t)}deleteSection(t){return this.deleteFirstGrandChildOfName(b.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(h.Name),Id:this.getProperty(h.id),Label:null,ShowLabel:!1,Visible:!0,LabelId:null,PreviewId:this.getProperty(h.id),Sections:await this.getSectionsJSON(t),Width:this.width}}}});var eu,EN=I(()=>{"use strict";Le();X();cr();es();eu=class extends Rr{initializeNavArea(t,r,n){this.initializeNavAreaProps(t,r,n)}get AreaName(){return this.Name}initializeNavAreaProps(t,r,n){this.addProperty(h.Name,n),this.addProperty(h.id,new P(P.NewGuid()).guidString),this.addProperty(h.columnName,we.columns),this.setDisplayName(r,t)}}});var tu,SN=I(()=>{"use strict";Zl();X();EN();tu=class extends qn{addAndIntializeNavBarSection(t,r,n,i){let a=new eu(b.formSection,null);return a.initializeNavArea(t,r,i),this.addGrandChildAtIndex(b.formSections,a,n),a}}});var an,ru=I(()=>{"use strict";Le();Oe();nt();Zl();X();We();$n();an=class extends it{tabContainsAutoExpandControl;autoExpandCell;constructor(t,r){super(b.formTab,t),this.tabContainsAutoExpandControl=!1}getParentForm(){return this.getAncestor(b.form)}getTabLayoutType(){let t;switch(this.columns.length){case 1:t=Ae.ONE_COLUMN;break;case 2:if(parseInt(this.columns[0].width,10)===50&&parseInt(this.columns[1].width,10)===50){t=Ae.TWO_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===67&&parseInt(this.columns[1].width,10)===33){t=Ae.TWO_COLUMN_WIDER_LEFT;break}if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===66){t=Ae.TWO_COLUMN_WIDER_RIGHT;break}t=Ae.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=Ae.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=Ae.THREE_COLUMN_WIDER_MID;break}t=Ae.THREE_COLUMN_CUSTOM_LAYOUT;break;default:}return t}initializeProperties(t,r,n){this.addProperty(h.Name,xn.namePrefix+t.toString()),this.addProperty(h.id,new P(P.NewGuid()).guidString),this.addProperty(h.IsUserDefined,xn.IsUserDefined),this.addProperty(h.locklevel,xn.LockLevel),this.addProperty(h.showlabel,xn.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=Ce.ONE_COLUMN,a=!0,o){let s=this.getChildren(b.formColumns)[0],l=[];switch(t){case Ae.ONE_COLUMN:l.push(100);break;case Ae.TWO_COLUMN_EQUAL:l.push(50),l.push(50);break;case Ae.TWO_COLUMN_WIDER_LEFT:l.push(67),l.push(33);break;case Ae.TWO_COLUMN_WIDER_RIGHT:l.push(34),l.push(66);break;case Ae.THREE_COLUMN_EQUAL:l.push(34),l.push(33),l.push(33);break;case Ae.THREE_COLUMN_WIDER_MID:l.push(28),l.push(44),l.push(28);break;default:}for(let u of l){let c=new qn(s);c.initialize(u,r,n,i),this.addGrandChild(b.formColumns,c)}}initialize(t,r,n,i,a,o=Ce.ONE_COLUMN,s=!0,l){this.addChild(new H(b.formColumns,this)),this.initializeProperties(r,n,i),this.initializeColumns(t,n,a,o,s,l)}get columns(){let t=this.getChildren(b.formColumns);return t.length!==1?[]:t[0].getChildren(b.formColumn)}get expanded(){return this.getProcessedValue(h.expanded)}set expanded(t){N.IsNullOrUndefined(t)||this.setProperty(h.expanded,String(t))}get groupName(){return this.getProperty(h.groupName)}get contentType(){return this.getProperty(h.contentType)}set contentType(t){this.setProperty(h.contentType,t)}insertNewColumnAtIndex(t,r,n,i,a){t.initialize(n,i,a),this.addGrandChildAtIndex(b.formColumns,t,r)}insertColumnAtIndex(t,r){this.addGrandChildAtIndex(b.formColumns,t,r)}deleteColumn(t){return this.deleteFirstGrandChildOfName(b.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()===b.formTab){let i=n;i.Name&&!O.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}}});var hi,gf=I(()=>{"use strict";Le();X();We();cr();SN();ru();hi=class extends an{constructor(t,r,n){super(t,Ae.THREE_COLUMN_EQUAL),this.setDisplayName(r,n),this.id=new P(P.NewGuid())}initializeDefaultProps(){this.addChild(new H(b.formColumns,this)),this.initializeFiveColumns()}get columns(){let t=this.getChildren("columns");return t.length!==1?[]:t[0].getChildren(b.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<xl.FIVE_COLUMN;t++){let r=new tu(this.getChildren(b.formColumns)[0]);r.initializeDefaultProperties(Wy.FiveEqColumn),this.addGrandChild(b.formColumns,r)}}}});function qV(e){switch(e){case ke.Main:return kn.Main;case ke.QuickCreate:return kn.QuickCreate;case ke.QuickViewForm:return kn.Quick;case ke.Dialog:return kn.Dialog;default:return kn.None}}function VV(e,t){if(t===ke.Main){if(e)switch(e.toLowerCase()){case"low":return Fn.Low;case"highreadonlyvalues":return Fn.HighReadOnlyValues;default:return Fn.HighWithControls}return Fn.Low}}var iu,$V,nu,NN=I(()=>{"use strict";Yy();iu=ie(oi());bp();Oe();nt();Ki();sf();X();Zi();Md();ai();Zo();X();$n();mf();gf();ru();$V="1920";nu=class e extends it{_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(b.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 yl,this._metadataChangeEvent=new Ml}get FormLibraries(){let t=this.getFirstChild(b.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 Dt).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 Dt){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()===b.internalLibraries),r=[],n="src";return t.length>0&&(r=t.map(i=>{let a=i.GetPropertyByParameter(n).replace("$webresource:",""),o=new Ca(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,iu.trackErrorTrace)(gy,{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 O.IsNullOrEmpty(this.getProperty(h.ShowImage))?!0:this.getProperty(h.ShowImage)!=="false"}set ShowImagecheck(t){t?this.setProperty(h.ShowImage,String(t)):this.setProperty(h.ShowImage,"false")}get ShowNavigation(){return O.IsNullOrEmpty(this.getProperty(h.ShowNavigationbar))?!0:this.getProperty(h.ShowNavigationbar)!=="false"}set ShowNavigation(t){t?this.setProperty(h.ShowNavigationbar,String(t)):this.setProperty(h.ShowNavigationbar,"false")}get MaxWidth(){return O.IsNullOrEmpty(this.getProperty(h.MaxWidth))?$V:this.getProperty(h.MaxWidth)}set MaxWidth(t){this.setProperty(h.MaxWidth,t)}get headerDensityType(){return this.getProperty(h.HeaderDensityType)}set headerDensityType(t){t&&this.formType===ke.Main?this.setProperty(h.HeaderDensityType,t):this.formType!==ke.Main&&this.headerDensityType&&this.removeProperty(h.HeaderDensityType)}IsMainOrQuickCreateForm(){return this.formType===ke.Main||this.formType===ke.QuickCreate}get FormPresentation(){return this._formPresentation}get LanguageCode(){return this._langCode}set LanguageCode(t){this._langCode=t}get header(){let t=this.getChildren(b.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(b.quickFormDependencies).length===0?[]:this.ConvertModelToArray(this.getChildren(b.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(b.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 an(null,t),a=this.getNextTabCounter(this.tabs.length+1);return i.initialize(t,a,this.LanguageCode,r,n),i}addTabAtIndex(t,r){this.addGrandChildAtIndex(b.formTabs,t,r)}createAndInitNewTabWithMarginalControl(t,r,n,i,a){let o=new an(null,Ae.ONE_COLUMN),s=this.getNextTabCounter(this.tabs.length+1);o.initialize(Ae.ONE_COLUMN,s,this.LanguageCode,r,n,a,!1),this.addGrandChildAtIndex(b.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===xn.namePrefix+t.toString())return this.getNextTabCounter(t+1);return t}get allTabs(){let t=this.getChildren(b.formTabs);return t.length!==1?[]:t[0].getChildren(b.formTab)}get CanvasNavigationTab(){if(this.tabs.length>0){let t=this.tabs[this.tabs.length-1];if(t instanceof hi)return t}return null}get NavigationNode(){let t=this.getChildren(b.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(b.formTabs,t)}insertTabAtIndex(t,r){this.addGrandChildAtIndex(b.formTabs,t,r)}insertRelatedTab(t){let r=this.getAllGrandChildren(b.formTabs);if(!N.IsNullOrUndefined(r)){let n=r.length;this.insertTabAtIndex(t,n)}}get isfooterPresent(){return this.getChildren(b.formFooter).length>0}get displayCondition(){let t=this.getChildren(b.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(b.formTabs).indexOf(t)}get ControlDescriptions(){return this.getAllGrandChildren(b.controlDescriptions)}addControlDescriptionNode(t){this.addGrandChild(b.controlDescriptions,t)}deleteControlDescByForControlId(t){let r=this.getControlDescriptionByForControl(t);N.IsNullOrUndefined(r)||this.deleteFirstGrandChildOfName(b.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 Dt))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 Dt&&i.control&&t.control&&a&&i.control.dataFieldName===t.control.dataFieldName})}isCellEditableGridControl(t){return!t?.control?.indicationOfSubgrid||t.control.ClassId.guidString.toUpperCase()!==S.CustomControl?!1:this.cellHasCustomControlWithName(t,Ln.EditableGridControl)||gN.getConfig()?.enableOneGridEventsForFormDesigner&&this.cellHasCustomControlWithName(t,Ln.PowerAppsOneGrid)}isCellCanvasAppControl(t){return t?.control?.ClassId.guidString.toUpperCase()===S.CustomControl&&this.cellHasCustomControlWithName(t,Ln.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()===b.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 hi)){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,iu.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===ke.Main?{HeaderDensity:VV(this.headerDensityType,this.formType)}:{},InlineEditGridRow:[],InlineQuickForms:[],QuickFormEntities:[],EventHandlers:[],LinkControlSections:[],FormType:qV(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 au,vf,DN=I(()=>{"use strict";Le();Oe();X();We();$n();au=class extends it{constructor(t){super(b.formDisplayConditions,t)}get Order(){let t=this.getProperty(h.Order);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set Order(t){this.setProperty(h.Order,t.toString())}get FallbackForm(){return this.getProperty(h.FallbackForm)==="true"}set FallbackForm(t){this.setProperty(h.FallbackForm,t.toString())}addRoles(t){this.deleteAllChildren();for(let r=0;r<t.length;r++)this.addChild(t[r])}isRoleEveryone(){return!!(this.getChildren(b.formEveryOne)&&this.getChildren(b.formEveryOne)[0])}setRoleEveryone(){this.deleteAllChildren(),this.addChild(new vf(this))}},vf=class extends H{constructor(t){super(b.formEveryOne,t)}}});var ou,IN=I(()=>{"use strict";X();We();ou=class extends H{constructor(t,r){super(b.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(h.HandlerUniqueId)}set HandlerUniqueID(t){this.setProperty(h.HandlerUniqueId,t)}get FunctionName(){return this.getProperty(h.functionName)}set FunctionName(t){this.setProperty(h.functionName,t)}get LibraryName(){return this.getProperty(h.libraryNameEventHandler)}set LibraryName(t){this.setProperty(h.libraryNameEventHandler,t)}get Enabled(){return this.getProperty(h.enabledForField)}set Enabled(t){this.setProperty(h.enabledForField,t)}get PassExecutionContext(){return this.getProperty(h.passExecutionContext)}set PassExecutionContext(t){this.setProperty(h.passExecutionContext,t)}get Parameters(){return this.getProperty(h.parameters)}set Parameters(t){this.setProperty(h.parameters,t)}}});var Ea,yf=I(()=>{"use strict";X();es();Ea=class extends Rr{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(b.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 ts,_N=I(()=>{"use strict";X();yf();ts=class extends Ea{_customFooter;constructor(t,r){super(b.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 rs,TN=I(()=>{"use strict";X();yf();rs=class extends Ea{_customHeader;constructor(t,r){super(b.formHeader,t),this._customHeader=r}get customHeader(){return this._customHeader}set customHeader(t){this._customHeader=t}get showCommandBar(){return this.getProcessedValue(h.showCommandBar)}set showCommandBar(t){t!=null&&this.setProperty(h.showCommandBar,String(t))}get showBody(){return this.getProcessedValue(h.showBody)}set showBody(t){t!=null&&this.setProperty(h.showBody,String(t))}get showTabNavigator(){return this.getProcessedValue(h.showTabNavigator)}set showTabNavigator(t){t!=null&&this.setProperty(h.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 It,gi=I(()=>{"use strict";Le();nt();X();$n();It=class e extends it{constructor(t,r){super(t,r)}getTitle(t){for(let r of this.getAllTitles())if(+r.getProperty(h.LCID)===t)return r.getProperty(h.text);return null}getAllTitles(){let t=this.getChildren(b.Titles);return t.length===0?[]:t[0].getChildren(b.Title)}setTitle(t,r){for(let i of this.getAllTitles())if(+i.getProperty(h.LCID)===r){i.setProperty(h.text,t);return}let n=new e(b.Title,null);n.setProperty(h.text,t),n.setProperty(h.LCID,String(r)),this.addGrandChild(b.Titles,n)}get Sequence(){return+this.getProperty(h.Sequence)}set Sequence(t){this.setProperty(h.Sequence,t.toString())}get Area(){return this.getProperty(h.Area)}set Area(t){this.setProperty(h.Area,t)}set Id(t){this.setProperty(h.Id,t)}get Id(){return this.getProperty(h.Id)}get id(){return new P(this.Id??"",!0)}set id(t){this.Id=t.guidString}get Show(){return!0}get Icon(){return this.getProperty(h.icon)}set Icon(t){t=t||O.EmptyString,this.setProperty(h.icon,t)}updateCommonProperties(t,r){this.Area=t.Area,this.Sequence=t.Sequence,this.setTitle(t.getDisplayName(r),r)}}});var ns,PN=I(()=>{"use strict";(function(e){e[e.NavLinkNotAvailable=-1]="NavLinkNotAvailable",e[e.NavLinkIdConflict=-2]="NavLinkIdConflict",e[e.NavBarNotAvailable=-3]="NavBarNotAvailable"})(ns||(ns={}))});var su,ON=I(()=>{"use strict";Oe();X();gi();PN();su=class extends It{constructor(t){super(b.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)?ns.NavLinkNotAvailable:r.length===1?this.deleteChild(r[0]):ns.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 ve,GV,RN,Iee,Sa,bf=I(()=>{"use strict";Le();X();gi();(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"})(ve||(ve={}));GV=new Map([[ve.Info,"Info"],[ve.Sales,"Sales"],[ve.Service,"Service"],[ve.Marketing,"Marketing"],[ve.ProcessCenter,"ProcessCenter"]]),RN=new Map([["Info",ve.Info],["Sales",ve.Sales],["Service",ve.Service],["Marketing",ve.Marketing],["ProcessCenter",ve.ProcessCenter]]),Iee=new Map([[ve.Info,9e3],[ve.Sales,9200],[ve.Service,9400],[ve.Marketing,9600],[ve.ProcessCenter,9800],[ve.InternetMarketing,1e4],[ve.Async,10200]]),Sa=class extends It{constructor(t,r){super(b.formNavBarArea,r)}setDefaultPropertiesByType(t,r,n){this.AreaId=GV.get(t);let i=n?.(`navBarArea.title.${this.AreaId}`)??this.AreaId;this.setTitle(i,r)}get ParentNavigation(){return this.getAncestor(b.formNavigation)}get AreaId(){return this.getProperty(h.Id)}set AreaId(t){this.setProperty(h.Id,t)}get id(){return new P(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 Na,wf=I(()=>{"use strict";X();gi();Na=class extends It{constructor(t,r){super(b.formNavBarAreas,r)}get AllNavBarAreaItems(){return this.getChildren(b.formNavBarArea)}get ParentNavigation(){return this.getAncestor(b.formNavigation)}addNavBarArea(t){this.addChild(t)}}});var lu,FN=I(()=>{"use strict";Oe();X();gi();lu=class extends It{RelationshipNameUCIRuntime;constructor(t){super(b.formNavBarByRelationshipItem,t)}get RelationshipName(){return this.getProperty(h.RelationshipName)}set RelationshipName(t){this.setProperty(h.RelationshipName,t)}set Show(t){this.setProperty(h.Show,String(t))}get Show(){let t=this.getProperty(h.Show);return N.IsNullOrUndefined(t)||t==="true"}get TitleResourceId(){return this.getProperty(h.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 uu,xN=I(()=>{"use strict";X();gi();uu=class extends It{constructor(t){super(b.formNavBarItem,t)}get Url(){return this.getProperty(h.url)}set Url(t){this.setProperty(h.url,t)}}});var cu,LN=I(()=>{"use strict";Le();X();bf();wf();gi();cu=class extends It{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(b.formNavBarAreas)}setDefaultNavBarAreas(t,r){let n=[ve.Info,ve.Sales,ve.Service,ve.Marketing,ve.ProcessCenter];if(this.navBarAreas){let i=this.navBarAreas?.AllNavBarAreaItems;if(i&&i.length>0){let a=new Set(i.map(o=>RN.get(o.AreaId)));n=n.filter(o=>!a.has(o))}}else{let i=new Na(b.formNavBarAreas,this);i.isTransient=!0,this.addChild(i)}return n.length>0?(n.forEach(i=>{let a=new Sa(b.formNavBarArea,this.navBarAreas);a.setDefaultPropertiesByType(i,t,r),this.navBarAreas.addNavBarArea(a)}),!0):!1}get navBar(){return this.getFirstChild(b.formNavBar)}get id(){return new P(Qd,!0)}replaceNavAreaToGivenIndex(t,r){this.navBarAreas?.AllNavBarAreaItems.indexOf(r)!==-1&&(this.deleteFirstGrandChildOfName(b.formNavBarAreas,r),this.addGrandChildAtIndex(b.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 kN={};zr(kN,{ControlType:()=>Ht,DeserializationService:()=>Ef,DeserializationServiceScope:()=>Cf,DeserializedFormElementNode:()=>_t});var Af,_t,Cf,Ht,Ef,ff=I(()=>{"use strict";Af=ie(oi());Le();Oe();nt();Ki();Kd();ai();vy();Xy();kl();NN();Zo();Zl();Yo();lf();X();X();DN();We();cr();uf();IN();_N();cf();df();TN();mf();hf();es();ru();ON();bf();wf();FN();xN();LN();_t=class extends H{constructor(t,r){super(t,r)}insertProperty(t,r){this.addProperty(t,r)}insertChild(t){this.addChild(t)}},Cf="DeserializationService";(function(e){e.Grid="Grid",e.Lookup="Lookup",e.Base="Base"})(Ht||(Ht={}));Ef=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 f="";throw d.length===0?f="FormXml has no form node.":f="FormXml has multiple form nodes.",(0,Af.trackErrorTrace)(ft,{eventName:Cf,eventData:{error:f}}),new Error(f)}let p=this.createFormModel(d.item(0),r,n,i,a,o,s,l,u,c);return N.IsNullOrUndefined(p.displayCondition)&&s!==ke.Dialog&&this.appendDefaultDisplayCondition(p),p}upsertFieldCount(t,r){let n=si.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 d=new nu(r,n,i,a,o,s,l,u,c);return this.populateElementProperties(d,t.attributes),this.populateElementChildren(d,t.childNodes),s===ke.Main&&(this.insertHeaderFooterElementProperties(b.formHeader,d,d.header),this.insertHeaderFooterElementProperties(b.formFooter,d,d.footer)),d}insertHeaderFooterElementProperties(t,r,n){if(N.IsNullOrUndefined(n)){let i=t===b.formHeader?new rs(r,!0):new ts(r,!0);_t.prototype.insertProperty.call(i,h.id,"{"+P.NewGuid()+"}"),_t.prototype.insertProperty.call(i,h.Fieldlabelposition,"Top"),_t.prototype.insertProperty.call(i,h.columnName,we.MarginalControlColumns),_t.prototype.insertProperty.call(i,h.LabelWidth,we.LabelWidth),_t.prototype.insertProperty.call(i,h.Fieldlabelalignment,"Left");let a=null,o=new mi(a);for(let s=0;s<i.maxColumns;s++){let l=new Dt(o);_t.prototype.insertProperty.call(l,h.id,"{"+P.NewGuid()+"}"),l.setDisplayName(O.EmptyString,this.lcid),_t.prototype.insertProperty.call(l,h.showlabel,"false"),o.addCell(l)}i.appendRow(o),t===b.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 _t(`<${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,Af.trackErrorTrace)(ft,{eventName:Cf,eventData:{error:n}}),new Error(n)}for(let n=0;n<r.length;n++){let i=r.item(n);i&&(_t.prototype.insertProperty.call(t,i.name,i.value),t.getNodeName()===b.formCell&&i.name===h.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&&_t.prototype.insertChild.call(t,a)}}createModelNode(t,r){switch(t.nodeName){case b.form:throw new Error("Form node shouldn't be created using this method");case b.formTab:return new an(r);case b.formColumn:return new qn(r);case b.formHeader:return new rs(r,!1);case b.formFooter:return new ts(r,!1);case b.formSection:return new Rr(b.formSection,r);case b.formRow:return new mi(r);case b.formCell:return new Dt(r);case b.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===h.indicationOfSubgrid&&l.value==="true"||l.name===h.classid&&(l.value?.toLocaleUpperCase()===`{${S.SubgridControl}}`||l.value?.toLocaleUpperCase()===`{${S.ReferencePanelSubgridControl}}`))a=Ht.Grid;else if(l.name===h.classid&&l.value?.toLocaleUpperCase()===`{${S.LookupControl}}`)a=Ht.Lookup;else if(l.name===h.classid&&l.value?.toLocaleUpperCase()===`{${S.CustomControl}}`)for(let u=0;u<i?.length;u++)i[u].nodeName===h.DefaultViewId&&(a=Ht.Lookup)}return a===Ht.Grid?new wa(r):a===Ht.Lookup?new Aa(r):new fr(r);case b.formEvent:return new ba(r,O.EmptyString);case b.dependency:return this.populateDependencyTable(t),new ya(r,O.EmptyString);case b.Handler:let o=[];return new ou(o,r);case b.formNavigation:return new cu(t.nodeName,r);case b.formNavBarArea:return new Sa(t.nodeName,r);case b.formNavBarAreas:return new Na(t.nodeName,r);case b.formNavBar:return new su(r);case b.formNavBarByRelationshipItem:return new lu(r);case b.formNavBarItem:return new uu(r);case b.formDisplayConditions:return new au(r);case b.library:return new Ca(r,O.EmptyString,O.EmptyString);case b.controlDescription:return new El(r);case b.customControl:return this.populateCustomControlConfigurationId(t),new Ll(r);default:return new _t(t.nodeName,r)}}populateDependencyTable(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);i.name===h.id&&this.upsertFieldCount(i.value,_r.DependencyFieldTable)}}populateCustomControlConfigurationId(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);if(i.name===h.id){let a=new P(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===h.ForControl){let l=s.value.substr(1,i.value.length-2);Me.CustomControlIdMap.upsert(l,a);break}}break}}}}});var MN={};zr(MN,{SerializationService:()=>Sf,SerializationServiceScope:()=>zV,SerializedFormElementNode:()=>Da});var zV,Da,Sf,UN=I(()=>{"use strict";nt();We();cr();gf();zV="SerializationService",Da=class extends H{fetchNodeName(){return this.getNodeName()}enumerateProperties(){return this.getAllProperties()}enumerateChildren(){return this.getAllChildren()}},Sf=class{langCode;constructor(t){this.langCode=t}serializeFormXmlNode(t){let r=Da.prototype.fetchNodeName.call(t);if(r.charAt(0)===rn.StartTag)return O.EscapeXml(r.substr(1),!1);if(t.isTransient&&!t.isDirty())return O.EmptyString;let n=Da.prototype.enumerateProperties.call(t),i=Da.prototype.enumerateChildren.call(t);if(!(t instanceof hi)){let a=`<${r}`;if(n.length!==0&&(a+=` ${this.getPropertiesString(n)}`),i.length===0)a+=" />";else{let o=O.EmptyString;for(let s of i)o+=this.serializeFormXmlNode(s);a+=`>${o}</${r}>`}return a}return O.EmptyString}getPropertiesString(t){let r=O.EmptyString;return t.forEach((n,i)=>{i!==0&&(r+=" "),r+=`${n.key}="${O.EscapeXml(n.value,!0)}"`}),r}}});var Fr=v(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.rejectUnknownKeys=at.childObjects=at.optionalGuidId=at.optionalEnum=at.eachObject=at.issue=at.isJsonObject=void 0;function BN(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}at.isJsonObject=BN;function Ia(e,t,r,n){return n?{pointer:e,rule:t,message:r,fatal:n}:{pointer:e,rule:t,message:r}}at.issue=Ia;function $N(e,t,r,n){if(!Array.isArray(e))return[];let i=[];return e.forEach((a,o)=>{BN(a)?i.push({node:a,index:o}):n.push(Ia(`${t}/${o}`,`${r}-must-be-object`,`a ${r} must be a JSON object, got ${a===null?"null":typeof a}`))}),i}at.eachObject=$N;function WV(e,t,r,n,i,a){let o=e[t];o!==void 0&&(typeof o!="string"||!r.includes(o))&&a.push(Ia(`${n}/${t}`,i,`${t} must be one of ${r.map(s=>`'${s}'`).join(", ")}, got ${JSON.stringify(o)}`))}at.optionalEnum=WV;var HV=/^(?:\{[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 jV(e,t,r,n,i){let a=e[t];typeof a=="string"&&a!==""&&!HV.test(a)&&i.push(Ia(`${r}/${t}`,n,`${t} must be a GUID or empty, got '${a}'`))}at.optionalGuidId=jV;function JV(e,t,r,n,i){let a=e[t],o=`${r}/${t}`;return a===void 0?[]:Array.isArray(a)?$N(a,o,n,i):(i.push(Ia(o,`${n}-list-must-be-array`,`${t} must be an array when present, got ${typeof a}`)),[])}at.childObjects=JV;function QV(e,t,r,n,i,a={}){var o,s;for(let l of Object.keys(e)){if(t.has(l))continue;let u=(o=a.elsewhere)===null||o===void 0?void 0:o[l],c=(s=a.unsupported)===null||s===void 0?void 0:s[l],d=u?` '${l}' is a ${u} key \u2014 set it on the ${u} instead.`:c?` ${c}`:` Put values the typed layer does not model in '${n}.bag', which round-trips them verbatim.`;i.push(Ia(`${r}/${l}`,`${n}-unknown-key`,`'${l}' is not a ${n} property, and would be SILENTLY DROPPED at serialization.${d}`))}}at.rejectUnknownKeys=QV});var tD=v(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.classIdForAttributeType=Pt.QUICK_VIEW_CLASS_ID=Pt.NOTES_CLASS_ID=Pt.SUBGRID_CLASS_ID=Pt.formRegistration=Pt.FormAdapter=void 0;var on=(Le(),br(ly)),KV=(Oe(),br(uy)),XV=(We(),br(dy)),ot=(X(),br(cy)),Re=(ai(),br(py)),YV=(ff(),br(kN)),ZV=(UN(),br(MN)),Ue=In(),qN=lr(),Tt=Fr(),e5=Cd(),is=pt(),Tf=ae(),jN=Tn(),JN=Ri(),t5={[ot.FormType.Main]:"Main",[ot.FormType.QuickCreate]:"QuickCreate",[ot.FormType.QuickViewForm]:"QuickView",[ot.FormType.Card]:"Card"},Nf={Main:ot.FormType.Main,QuickCreate:ot.FormType.QuickCreate,QuickView:ot.FormType.QuickViewForm,Card:ot.FormType.Card},r5=new Map(Object.entries(Re.ControlClassId).map(([e,t])=>[String(t).toUpperCase(),e]));function QN(e){var t;return e&&(t=r5.get(e.toUpperCase()))!==null&&t!==void 0?t:"Unknown"}function as(e){return e.getAllProperties().map(t=>[t.key,t.value])}function vi(e){let t=new Map;for(let r of e.getAllProperties())t.has(r.key)||t.set(r.key,r.value);return t}function KN(e,t){return e.getAllChildren().find(r=>r.getNodeName()===t)}function Pf(e,t){var r,n;let i=KN(e,"labels");if(!i)return"";let a=i.getAllChildren().filter(s=>s.getNodeName()==="label"),o=(r=a.find(s=>vi(s).get("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return o&&(n=vi(o).get("description"))!==null&&n!==void 0?n:""}function n5(e){let t=KN(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 XN(e){return/^1+$/.test(e)&&e.length>=1&&e.length<=4?e.length:1}function Df(e){let t=Math.min(Math.max(Math.trunc(e),1),4);return"1".repeat(t)}function os(e){return String(e??"").replace(/[{}]/g,"")}function If(e){return`{${os(e)}}`}function VN(e,t){if(e===void 0||e==="")return t;let r=Number(e);return Number.isNaN(r)?t:r}function pu(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,Ue.rawFromNode)(u)})}),i<0)return{modeled:[],bag:{a:as(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,Ue.rawFromNode)(u)})}),{modeled:s,bag:{a:as(e),c:a,w:{n:o.getNodeName(),a:as(o),c:l}}}}function YN(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,Ue.rawFromNode)(a)})}),{modeled:n,bag:{a:as(e),c:i}}}function i5(e,t){let{modeled:r,bag:n}=pu(e,"tabs","tab");return{tabs:r.map(i=>a5(i,t)),bag:n}}function a5(e,t){var r,n;let i=vi(e),{modeled:a,bag:o}=pu(e,"columns","column");return{id:(r=i.get("id"))!==null&&r!==void 0?r:"",name:(n=i.get("name"))!==null&&n!==void 0?n:"",label:Pf(e,t),expanded:i.get("expanded")==="true",visible:i.has("visible")?i.get("visible")==="true":!0,columns:a.map(s=>o5(s,t)),bag:o}}function o5(e,t){let r=vi(e),{modeled:n,bag:i}=pu(e,"sections","section");return{width:r.get("width"),sections:n.map(a=>s5(a,t)),bag:i}}function s5(e,t){var r,n,i;let a=vi(e),{modeled:o,bag:s}=pu(e,"rows","row");return{id:(r=a.get("id"))!==null&&r!==void 0?r:"",name:(n=a.get("name"))!==null&&n!==void 0?n:"",label:Pf(e,t),visible:a.has("visible")?a.get("visible")==="true":!0,showLabel:a.get("showlabel")==="true",columns:XN((i=a.get("columns"))!==null&&i!==void 0?i:"1"),rows:o.map(l=>l5(l,t)),bag:s}}function l5(e,t){let{modeled:r,bag:n}=YN(e,"cell",!1);return{cells:r.map(i=>u5(i,t)),bag:n}}function u5(e,t){var r;let n=vi(e),{modeled:i,bag:a}=YN(e,"control",!0),o=Pf(e,t),s=n.get("showlabel")==="true",l=i[0]?c5(i[0],o,s):null;return{id:(r=n.get("id"))!==null&&r!==void 0?r:"",visible:n.has("visible")?n.get("visible")==="true":!0,colspan:VN(n.get("colspan"),1),rowspan:VN(n.get("rowspan"),1),control:l,bag:a}}function c5(e,t,r){var n,i;let a=vi(e),o=os((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:QN(o),isRequired:a.get("isrequired")==="true",isReadOnly:a.get("disabled")==="true",label:t,showLabel:r,parameters:n5(e),bag:{a:as(e),c:e.getAllChildren().map((l,u)=>({i:u,node:(0,Ue.rawFromNode)(l)}))}}}function zn(e){return e.a.length===0&&e.c.length===0&&!e.w}function ZN(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function yi(e,t){var r;let n=new Set(e.a.map(o=>o[0])),i=zn(e),a=[];for(let o of t)if(n.has(o.key)){let s=(r=ZN(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,Ue.mergeAttrs)(e.a,a)}var Vn=(e,t)=>({key:e,matches:r=>r===t,render:()=>t,absentDefault:""}),Gn=(e,t,r=!1)=>({key:e,matches:n=>n==="true"===t,render:()=>String(t),absentDefault:String(r)}),GN=(e,t,r=1)=>({key:e,matches:n=>Number(n)===t,render:()=>String(t),absentDefault:String(r)});function fu(e,t){return{n:"labels",a:[],c:[{n:"label",a:[["description",e],["languagecode",String(t)]],c:[]}]}}function _f(e){return{n:"parameters",a:[],c:Object.keys(e).map(t=>({n:(0,Tf.assertXmlName)(t,"Form control parameter name"),a:[],c:[{n:`<${e[t]}`,a:[],c:[]}]}))}}function d5(e,t){var r,n;let i=e.c.find(o=>o.n==="label"&&o.a.some(s=>s[0]==="languagecode"&&s[1]===String(t))),a=i??e.c.find(o=>o.n==="label");return(n=(r=a?.a.find(o=>o[0]==="description"))===null||r===void 0?void 0:r[1])!==null&&n!==void 0?n:""}function p5(e,t,r){let n=!1,i=e.c.map(a=>a.n!=="label"||!a.a.some(s=>s[0]==="languagecode"&&s[1]===String(r))?a:(n=!0,{...a,a:a.a.map(s=>s[0]==="description"?["description",t]:s)}));return n||i.push({n:"label",a:[["description",t],["languagecode",String(r)]],c:[]}),{...e,c:i}}function Of(e,t,r){let n=e.c.findIndex(a=>a.node.n==="labels");if(n<0){if(!t||zn(e))return e;let o=e.c.some(s=>s.i===0)?e.c.map(s=>({...s,i:s.i+1})):e.c;return{...e,c:[{i:0,node:fu(t,r)},...o]}}if(d5(e.c[n].node,r)===t)return e;let i=p5(e.c[n].node,t,r);return{...e,c:e.c.map((a,o)=>o===n?{...a,node:i}:a)}}function f5(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 m5(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(i=>e[i]===t[i])}function h5(e,t){return e.a.some(r=>r[0]===t)?{...e,a:e.a.filter(r=>r[0]!==t)}:e}function g5(e,t){let r=e.c.findIndex(i=>i.node.n==="parameters");if(r<0){if(Object.keys(t).length===0||zn(e))return e;let i=e.c.reduce((a,o)=>o.i>a?o.i:a,-1);return{...e,c:[...e.c,{i:i+1,node:_f(t)}]}}if(m5(f5(e.c[r].node),t))return e;let n=_f(t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function mu(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,Ue.spliceChildren)(e.w.c,r)};return(0,Ue.spliceChildren)(e.c,[o])}let i=n(),a={n:t,a:[],c:r};return e.c.length===0?[...i,a]:(0,Ue.spliceChildren)(e.c,[...i,a])}function v5(e,t){let r=e.tabs.map(n=>y5(n,t));return{n:"form",a:yi(e.bag,[]),c:e.tabs.length===0&&zn(e.bag)?[]:mu(e.bag,"tabs",r,()=>[])}}function y5(e,t){let r=[Vn("id",e.id),Vn("name",e.name),Gn("expanded",e.expanded),Gn("visible",e.visible,!0)],n=e.columns.map(a=>b5(a,t)),i=Of(e.bag,e.label,t);return{n:"tab",a:yi(i,r),c:mu(i,"columns",n,()=>e.label?[fu(e.label,t)]:[])}}function b5(e,t){let r=e.width!==void 0?[Vn("width",e.width)]:[],n=e.sections.map(i=>w5(i,t));return{n:"column",a:yi(e.bag,r),c:mu(e.bag,"sections",n,()=>[])}}function w5(e,t){let r=[Vn("id",e.id),Vn("name",e.name),Gn("showlabel",e.showLabel),Gn("visible",e.visible,!0),{key:"columns",matches:a=>XN(a)===e.columns,render:()=>Df(e.columns),absentDefault:Df(1)}],n=e.rows.map(a=>A5(a,t)),i=Of(e.bag,e.label,t);return{n:"section",a:yi(i,r),c:mu(i,"rows",n,()=>e.label?[fu(e.label,t)]:[])}}function A5(e,t){let r=e.cells.map(n=>C5(n,t));return{n:"row",a:yi(e.bag,[]),c:zn(e.bag)?r:(0,Ue.assembleChildren)(e.bag,r)}}function C5(e,t){let r=e.control?e.control.showLabel:ZN(e.bag,"showlabel")==="true",n=[Vn("id",e.id),Gn("showlabel",r),Gn("visible",e.visible,!0),GN("colspan",e.colspan),GN("rowspan",e.rowspan)],i=e.control?[E5(e.control)]:[],a;if(zn(e.bag))a=[...e.control&&e.control.label?[fu(e.control.label,t)]:[],...i];else{let o=e.control?Of(e.bag,e.control.label,t):e.bag;a=(0,Ue.assembleChildren)(o,i)}return{n:"cell",a:yi(e.bag,n),c:a}}function E5(e){let t=[Vn("id",e.id),{key:"classid",matches:i=>os(i)===e.classId,render:()=>If(e.classId),absentDefault:""}];e.fieldName!==null&&t.push(Vn("datafieldname",e.fieldName)),t.push(Gn("disabled",e.isReadOnly)),t.push(Gn("isrequired",e.isRequired));let r=e.fieldName===null?h5(e.bag,"datafieldname"):e.bag,n;return zn(r)?n=Object.keys(e.parameters).length>0?[_f(e.parameters)]:[]:n=(0,Ue.assembleChildren)(g5(r,e.parameters),[]),{n:"control",a:yi(r,t),c:n}}var S5={make:(e,t)=>new XV.FormElementNode(e,t),setProp:(e,t,r)=>e.setProperty(t,r),addChild:(e,t)=>e.addChild(t)};function zN(e,t,r){(0,jN.installDomShim)();let n=D5(e,r),i=(0,Ue.rebuildRaw)(v5(n,t),S5,null);return new ZV.SerializationService(t).serializeFormXmlNode(i)}function N5(e){return JSON.parse(JSON.stringify(e))}function D5(e,t){var r;let n=N5(e);n.bag||(n.bag=(0,Ue.emptyBag)()),x5(n.bag),t&&I5(n,t);for(let i of(r=n.tabs)!==null&&r!==void 0?r:[])_5(i);return n}function I5(e,t){var r;let n=(r=e.entityLogicalName)!==null&&r!==void 0?r:"";Rf(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=eD(s.attributeType)))})}function WN(e){let t=[];return Rf(e,r=>t.push(r)),t}function Rf(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 _5(e){e.id||(e.id=on.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)T5(t);e.bag||(e.bag=(0,Ue.emptyBag)())}function T5(e){e.sections||(e.sections=[]);for(let t of e.sections)P5(t);e.bag||(e.bag=(0,Ue.emptyBag)()),e.width===void 0&&zn(e.bag)&&(e.width="100%")}function P5(e){e.id||(e.id=on.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)O5(t);e.bag||(e.bag=(0,Ue.emptyBag)())}function O5(e){e.cells||(e.cells=[]);for(let t of e.cells)R5(t);e.bag||(e.bag=(0,Ue.emptyBag)())}function R5(e){e.id||(e.id=on.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&&F5(e.control),e.bag||(e.bag=(0,Ue.emptyBag)())}function F5(e){var t;e.id||(e.id=on.Guid.NewGuid()),e.classId===void 0&&(e.classId=String(Re.ControlClassId.TextboxControl)),e.fieldName===void 0&&(e.fieldName=null),e.type===void 0&&(e.type=e.fieldName?"Field":QN(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,Tf.assertXmlName)(r,"Form control parameter name");e.bag||(e.bag=(0,Ue.emptyBag)())}function x5(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"&&!HN(a,"handlerUniqueId")&&a.a.push(["handlerUniqueId",If(on.Guid.NewGuid())])}}else if(r.n==="formLibraries")for(let n of r.c)n.n==="Library"&&!HN(n,"libraryUniqueId")&&n.a.push(["libraryUniqueId",If(on.Guid.NewGuid())])}}var du=class{constructor(t=JN.DEFAULT_LCID){this.lcid=t}toArtifact(t,r){var n,i,a;let{tabs:o,bag:s}=i5(t,this.lcid);return{id:t.formId?t.formId.guidString:"",name:(n=t.formName)!==null&&n!==void 0?n:"",entityLogicalName:(i=t.entityName)!==null&&i!==void 0?i:"",formType:(a=t5[t.formType])!==null&&a!==void 0?a:"Main",status:this.readActivationStatus(t),...r!==void 0&&r!==""?{description:r}:{},tabs:o,bag:s}}fromArtifact(t){var r;return this.deserialize({formxml:zN(t,this.lcid),formid:t.id||(0,is.newId)(),objecttypecode:t.entityLogicalName,type:Nf[t.formType],name:t.name,uniquename:t.name,description:(r=t.description)!==null&&r!==void 0?r:"",formpresentation:ot.FormPresentation.AirForm,formactivationstate:t.status==="Active"?ot.FormActivationState.Active:ot.FormActivationState.InActive})}fromApiResponse(t){var r,n,i,a,o,s,l;let u=t,c=this.deserialize({formxml:(r=u.formxml)!==null&&r!==void 0?r:"",formid:(n=u.formid)!==null&&n!==void 0?n:(0,is.newId)(),objecttypecode:(i=u.objecttypecode)!==null&&i!==void 0?i:"",type:u.type,name:(a=u.name)!==null&&a!==void 0?a:"",uniquename:(o=u.uniquename)!==null&&o!==void 0?o:"",description:(s=u.description)!==null&&s!==void 0?s:"",formpresentation:u.formpresentation,formactivationstate:u.formactivationstate});return this.toArtifact(c,(l=u.description)!==null&&l!==void 0?l:void 0)}toApiPayload(t,r,n){return{formxml:zN(t,this.lcid,n),name:t.name,type:Nf[t.formType],objecttypecode:t.entityLogicalName,...t.description!==void 0?{description:t.description}:{}}}metadataNeeds(t){let r=t.entityLogicalName;if(!r)return[];let n=new Set,i=[];return Rf(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,p;let f=t.tabs&&t.tabs.length>0?void 0:G5(this.lcid),m=f!==void 0?f:t.tabs.map(A=>L5(A,this.lcid)).join(""),g=this.deserialize({formxml:`<form><tabs>${m}</tabs></form>`,formid:t.id||(0,is.newId)(),objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",type:Nf[(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:(o=t.description)!==null&&o!==void 0?o:"",formpresentation:ot.FormPresentation.AirForm,formactivationstate:((s=t.status)!==null&&s!==void 0?s:"Active")==="Active"?ot.FormActivationState.Active:ot.FormActivationState.InActive}),y=this.toArtifact(g,t.description);if(t.tabs&&t.tabs.length>0){let A=WN(t);WN(y).forEach((D,F)=>{A[F]&&A[F].label===void 0&&delete D.label})}return{id:(l=t.id)!==null&&l!==void 0?l:y.id,name:(u=t.name)!==null&&u!==void 0?u:"New Form",entityLogicalName:(c=t.entityLogicalName)!==null&&c!==void 0?c:"",formType:(d=t.formType)!==null&&d!==void 0?d:"Main",status:(p=t.status)!==null&&p!==void 0?p:"Active",...t.description!==void 0?{description:t.description}:{},tabs:y.tabs,bag:y.bag}}assignMissingIds(t){return(0,is.assignMissingIds)(t)}validate(t){return Y5(t)}deserialize(t){(0,jN.installDomShim)();let r=KV.ScriptUtilities.ParseXml(t.formxml),n=new YV.DeserializationService(this.lcid).deSerializeFormXml(r,new on.Guid(t.formid),t.objecttypecode,ot.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===ot.FormActivationState.InActive?"Inactive":"Active"}};Pt.FormAdapter=du;function mr(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ff(e,t){return e?`<labels><label description="${mr(e)}" languagecode="${t}" /></labels>`:""}function xf(e){return e&&e.length>0?os(e):(0,is.newId)()}function L5(e,t){var r,n,i,a;let o=(r=e.columns)!==null&&r!==void 0?r:[],s=(o.length>0?o:[V5()]).map(l=>k5(l,t)).join("");return`<tab id="{${mr(xf(e.id))}}" name="${mr((n=e.name)!==null&&n!==void 0?n:"")}" expanded="${(i=e.expanded)!==null&&i!==void 0?i:!0}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}">${Ff(e.label,t)}<columns>${s}</columns></tab>`}function k5(e,t){var r,n;let i=((r=e.sections)!==null&&r!==void 0?r:[]).map(a=>M5(a,t)).join("");return`<column width="${mr((n=e.width)!==null&&n!==void 0?n:"100%")}"><sections>${i}</sections></column>`}function M5(e,t){var r,n,i,a,o;let s=((r=e.rows)!==null&&r!==void 0?r:[]).map(l=>U5(l,t)).join("");return`<section id="{${mr(xf(e.id))}}" name="${mr((n=e.name)!==null&&n!==void 0?n:"")}" showlabel="${(i=e.showLabel)!==null&&i!==void 0?i:!1}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}" columns="${Df((o=e.columns)!==null&&o!==void 0?o:1)}">${Ff(e.label,t)}<rows>${s}</rows></section>`}function U5(e,t){var r;return`<row>${((r=e.cells)!==null&&r!==void 0?r:[]).map(n=>B5(n,t)).join("")}</row>`}function B5(e,t){var r,n,i,a,o;let s=e.control,l=s?Ff((r=s.label)!==null&&r!==void 0?r:"",t):"",u=s?$5(s):"";return`<cell id="{${mr(xf(e.id))}}" showlabel="${s?(n=s.showLabel)!==null&&n!==void 0?n:!0:!1}" visible="${(i=e.visible)!==null&&i!==void 0?i:!0}" colspan="${(a=e.colspan)!==null&&a!==void 0?a:1}" rowspan="${(o=e.rowspan)!==null&&o!==void 0?o:1}">${l}${u}</cell>`}function $5(e){var t,r,n;let i=e.fieldName?` datafieldname="${mr(e.fieldName)}"`:"",a=q5(e.parameters),o=e.classId?os(e.classId):String(Re.ControlClassId.TextboxControl);return`<control id="${mr((t=e.id)!==null&&t!==void 0?t:"")}" classid="{${mr(o)}}"${i} disabled="${(r=e.isReadOnly)!==null&&r!==void 0?r:!1}" isrequired="${(n=e.isRequired)!==null&&n!==void 0?n:!1}">${a}</control>`}function q5(e){let t=Object.keys(e??{});return t.length===0?"":(t.forEach(n=>(0,Tf.assertXmlName)(n,"Form control parameter name")),`<parameters>${t.map(n=>`<${n}>${mr(e[n])}</${n}>`).join("")}</parameters>`)}function V5(){return{width:"100%",sections:[],bag:{a:[],c:[]}}}function G5(e){return`<tab id="{${on.Guid.NewGuid()}}" name="tab_general" expanded="true" visible="true"><labels><label description="General" languagecode="${e}" /></labels><columns><column width="100%"><sections><section id="{${on.Guid.NewGuid()}}" name="section_general" showlabel="false" visible="true" columns="1"><labels><label description="General" languagecode="${e}" /></labels><rows></rows></section></sections></column></columns></tab>`}function z5(e=JN.DEFAULT_LCID){return{adapter:new du(e),api:e5.formApi,languageSensitive:!0,publish:(t,r,n)=>(0,qN.publishBoundEntity)(t,n),publishScope:(t,r)=>(0,qN.boundEntityPublishScope)(r)}}Pt.formRegistration=z5;var W5=new Set(["id","name","label","expanded","visible","columns","bag"]),H5=new Set(["id","width","sections","bag"]),j5=new Set(["id","name","label","visible","showLabel","columns","rows","bag"]),J5=new Set(["id","cells","bag"]),Q5=new Set(["id","visible","colspan","rowspan","control","bag"]),K5=new Set(["id","classId","fieldName","type","isRequired","isReadOnly","label","showLabel","parameters","bag"]),X5={elsewhere:{isReadOnly:"control",isRequired:"control",fieldName:"control",classId:"control",label:"control",showLabel:"control",parameters:"control"},unsupported:{createOnly:"FormXml has no create-only concept; gate the field with a business rule instead. Raise it with the SDK owners if you need it modeled.",updateOnly:"FormXml has no update-only concept; gate the field with a business rule instead. Raise it with the SDK owners if you need it modeled."}};function Y5(e){let t=[];return(0,Tt.childObjects)(e,"tabs","","tab",t).forEach(({node:n,index:i})=>{let a=`/tabs/${i}`;(0,Tt.rejectUnknownKeys)(n,W5,a,"tab",t),(0,Tt.childObjects)(n,"columns",a,"column",t).forEach(({node:s,index:l})=>{let u=`${a}/columns/${l}`;(0,Tt.rejectUnknownKeys)(s,H5,u,"column",t),(0,Tt.childObjects)(s,"sections",u,"section",t).forEach(({node:d,index:p})=>{let f=`${u}/sections/${p}`;(0,Tt.rejectUnknownKeys)(d,j5,f,"section",t),(0,Tt.childObjects)(d,"rows",f,"row",t).forEach(({node:g,index:y})=>{let A=`${f}/rows/${y}`;(0,Tt.rejectUnknownKeys)(g,J5,A,"row",t),(0,Tt.childObjects)(g,"cells",A,"cell",t).forEach(({node:F,index:_})=>{let q=`${A}/cells/${_}`;(0,Tt.rejectUnknownKeys)(F,Q5,q,"cell",t,X5);let B=F.control;B!=null&&!(0,Tt.isJsonObject)(B)?t.push((0,Tt.issue)(`${q}/control`,"control-must-be-object-or-null",`a cell control must be a JSON object or null, got ${typeof B}`)):(0,Tt.isJsonObject)(B)&&(0,Tt.rejectUnknownKeys)(B,K5,`${q}/control`,"control",t)})})})})}),t}Pt.SUBGRID_CLASS_ID=Re.ControlClassId.SubgridControl;Pt.NOTES_CLASS_ID=Re.ControlClassId.TimelineControl;Pt.QUICK_VIEW_CLASS_ID=Re.ControlClassId.QuickViewControl;var Z5={Lookup:String(Re.ControlClassId.LookupControl),Customer:String(Re.ControlClassId.LookupControl),Owner:String(Re.ControlClassId.LookupControl),PartyList:String(Re.ControlClassId.PartyListControl),Boolean:String(Re.ControlClassId.BooleanControl),DateTime:String(Re.ControlClassId.DateTimeControl),Decimal:String(Re.ControlClassId.DecimalControl),Double:String(Re.ControlClassId.FloatingNumberControl),Money:String(Re.ControlClassId.CurrencyControl),Integer:String(Re.ControlClassId.IntegerControl),BigInt:String(Re.ControlClassId.IntegerControl),Memo:String(Re.ControlClassId.TextAreaControl),String:String(Re.ControlClassId.TextboxControl)},e9="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE";function eD(e){return e==="Picklist"||e==="State"||e==="Status"?e9:e&&Z5[e]||String(Re.ControlClassId.TextboxControl)}Pt.classIdForAttributeType=eD;function HN(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}});var Lf=v(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.viewApi=_a.findDefaultViews=void 0;var nD=qt(),jt=be(),sn=ae(),t9="savedqueryid,name,description,fetchxml,layoutxml,querytype,returnedtypecode,isdefault",r9="savedqueryid,name,returnedtypecode,querytype,isdefault";async function n9(e,t,r={}){var n;let i=new Set(((n=r.excludeViewIds)!==null&&n!==void 0?n:[]).filter(Boolean)),a=`returnedtypecode eq '${(0,sn.odataLiteral)(t)}' and querytype eq 0`,o=`/savedqueries${(0,sn.odataQuery)([["$select","savedqueryid,name,isdefault"],["$filter",a]])}`;return(await(0,nD.collectPages)(e,o,`findDefaultViews('${t}')`)).filter(l=>{var u;return l.savedqueryid&&!i.has(l.savedqueryid)&&(l.isdefault||/^(Active|Inactive)\b/i.test((u=l.name)!==null&&u!==void 0?u:""))}).map(l=>{var u;return{id:String(l.savedqueryid),name:String((u=l.name)!==null&&u!==void 0?u:"")}})}_a.findDefaultViews=n9;async function i9(e,t){var r;let n=`/EntityDefinitions(LogicalName='${(0,sn.odataPathLiteral)(t)}')${(0,sn.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 rD(e,t,r){if(!r||!/<grid\b/.test(t)||/<grid[^>]*\bobject=/.test(t))return t;let n=await i9(e,r);return n===void 0?t:t.replace(/<grid\b/,`<grid object="${n}"`)}_a.viewApi={async get(e,t){let n=`/savedqueries(${(0,sn.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,sn.odataQuery)([["$select",t9]]),i=(0,jt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,jt.readEtag)(i)}},async list(e,t){let r=`/savedqueries${(0,sn.odataQuery)([["$select",r9],["$filter",t?.entityLogicalName?`returnedtypecode eq '${(0,sn.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,nD.collectPages)(e,r,"listArtifacts('view')")).map(i=>{var a,o;return{type:"view",id:(a=i.savedqueryid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",entityLogicalName:i.returnedtypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,jt.echoWrite)("savedqueryid"),a=`/savedqueries${i.query}`,o=await rD(e,n.layoutxml,n.returnedtypecode),s=(0,jt.ensureSuccess)(await e.post(a,(0,jt.withClientMintedId)({name:n.name,description:n.description,fetchxml:n.fetchxml,layoutxml:o,returnedtypecode:n.returnedtypecode,querytype:n.querytype,isdefault:n.isdefault},"savedqueryid",r),i.options),e.apiUrl(a));return{id:(0,jt.resolveCreatedId)(s,"savedqueryid","view",r),etag:(0,jt.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,sn.normalizeGuid)(t,"id"),o=(0,jt.echoWrite)("savedqueryid",{"If-Match":(0,jt.requireEtag)(n,"view",a)}),s=`/savedqueries(${a})${o.query}`,l=await rD(e,i.layoutxml,i.returnedtypecode),u=(0,jt.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,fetchxml:i.fetchxml,layoutxml:l},o.options),e.apiUrl(s));return{id:a,etag:(0,jt.readEtag)(u)}},delete(e,t){return(0,jt.deleteRecord)(e,"savedqueries",t)}}});var yD=v(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.viewRegistration=Ta.ViewAdapter=void 0;var cD=te(),kt=Fr(),kf=In(),bi=ri(),iD=lr(),a9=Lf(),Mf=Tn(),o9=pt(),dD=100,gu=class{toArtifact(t){var r,n,i,a,o,s,l,u;(0,Mf.installDomShim)();let c=(r=t.fetchxml)!==null&&r!==void 0?r:"",d=(n=t.layoutxml)!==null&&n!==void 0?n:"",p=(0,bi.parseXmlRoot)(c,"<fetch/>"),f=(0,bi.parseXmlRoot)(d,"<grid/>"),m=fD(p);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:l9(p),queryType:(l=t.querytype)!==null&&l!==void 0?l:0,isDefault:(u=t.isdefault)!==null&&u!==void 0?u:!1,columns:pD(f,p),filters:hD(p),sort:mD(p),...m.length>0?{linkEntities:m}:{},fetchBag:c?(0,bi.projectElementBag)(p):void 0,layoutBag:d?(0,bi.projectElementBag)(f):void 0}}fromArtifact(t){(0,Mf.installDomShim)();let{fetchxml:r,layoutxml:n}=aD(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,Mf.installDomShim)();let{fetchxml:s,layoutxml:l}=aD(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,o9.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:[],...t.linkEntities&&t.linkEntities.length>0?{linkEntities:t.linkEntities}:{}}}assignMissingIds(t){return t}validate(t){let r=[],n=t;(0,kt.childObjects)(n,"columns","","column",r),(0,kt.childObjects)(n,"sort","","sort",r),(0,kt.childObjects)(n,"linkEntities","","linkEntity",r),s9(n.linkEntities,r);let i=n.filters;return i!=null&&((0,kt.isJsonObject)(i)?Uf(i,"/filters",r):r.push((0,kt.issue)("/filters","filters-must-be-object",`filters must be a JSON object, got ${typeof i}`))),r}};Ta.ViewAdapter=gu;function s9(e,t){Array.isArray(e)&&e.forEach((r,n)=>{if(!(0,kt.isJsonObject)(r))return;for(let a of["name","from","to"]){let o=r[a];(typeof o!="string"||o.trim()==="")&&t.push((0,kt.issue)(`/linkEntities/${n}/${a}`,"linkentity-needs-keys",`a join needs a non-empty '${a}' \u2014 'from'/'to' are what DEFINE the relationship, and a link without them is unresolvable. Got ${JSON.stringify(o)}.`))}let i=r.filters;i!=null&&((0,kt.isJsonObject)(i)?Uf(i,`/linkEntities/${n}/filters`,t):t.push((0,kt.issue)(`/linkEntities/${n}/filters`,"filters-must-be-object",`filters must be a JSON object, got ${typeof i}`)))})}function Uf(e,t,r){(0,kt.childObjects)(e,"conditions",t,"condition",r),(0,kt.childObjects)(e,"groups",t,"filterGroup",r).forEach(({node:i,index:a})=>Uf(i,`${t}/groups/${a}`,r))}function l9(e){var t;let r=e.getElementsByTagName("entity")[0];return(t=r?.getAttribute("name"))!==null&&t!==void 0?t:""}function pD(e,t){var r;let n=Bf(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)?dD:c,order:o},p=n.get(u);p&&(d.relatedEntity=p.linkKey,p.attributeName&&p.attributeName!==u&&(d.sourceAttribute=p.attributeName)),o+=1,a.push(d)}return a}function Bf(e){let t=new Map,r=e.getElementsByTagName("link-entity");for(let n=0;n<r.length;n+=1){let i=r[n],a=i.getAttribute("name");if(!a)continue;let o=i.getElementsByTagName("attribute");for(let s=0;s<o.length;s+=1){let l=o[s],u=l.getAttribute("name")||"",c=l.getAttribute("alias")||u;c&&t.set(c,{linkKey:i.getAttribute("alias")||a,linkName:a,attributeName:u,link:i})}}return t}function fD(e){let t=e.getElementsByTagName("entity")[0];if(!t)return[];let r=[];for(let n of st(t,"link-entity")){let i=n.getAttribute("name"),a=n.getAttribute("from"),o=n.getAttribute("to");if(!i||!a||!o)continue;let s=n.getAttribute("alias"),l=n.getAttribute("link-type"),u=st(n,"filter").find(c=>!vu(c));r.push({name:i,from:a,to:o,...s?{alias:s}:{},...l==="inner"||l==="outer"?{linkType:l}:{},...u?{filters:$f(u)}:{}})}return r}function mD(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",entityname:o.getAttribute("entityname")||""})}}return n}function hD(e){let t=e.getElementsByTagName("entity")[0],r={type:"and",conditions:[],groups:[]};if(!t)return r;let n=st(t,"filter").filter(i=>!vu(i)).map($f);return n.length===0?r:n.length===1?n[0]:{type:"and",conditions:[],groups:n}}function vu(e){if(e.getAttribute("isquickfindfields")==="1")return!0;if(st(e,"filter").length>0)return!1;let t=st(e,"condition");return t.length===0?!1:t.some(r=>r.getAttribute("isquickfindfields")==="1"||st(r,"value").length>0||c9(r))}var u9=new Set(["attribute","operator","value","entityname","uiname","uitype"]);function c9(e){var t;let r=e.attributes;for(let n=0;n<r.length;n+=1){let i=(t=r[n])===null||t===void 0?void 0:t.name;if(i&&!u9.has(i))return!0}return!1}function $f(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);let p=l.getAttribute("entityname")||"";p&&(c.entityname=p),i.push(c)}else l.tagName==="filter"&&a.push($f(l))}return{type:n,conditions:i,groups:a}}function st(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}var qf=e=>{var t,r;return`${(t=e.relatedEntity)!==null&&t!==void 0?t:""}::${(r=e.sourceAttribute)!==null&&r!==void 0?r:e.name}`};function d9(e,t){let r=Bf(e),n=new Map;for(let i of t){if(!i.relatedEntity)continue;let a=r.get(i.name);if(a){let o=qf(i),s=n.get(o);s?s.push(a.link):n.set(o,[a.link])}}return n}function p9(e,t,r,n){if(!n||n.size===0)return;let i=new Set,a=t.getElementsByTagName("link-entity");for(let s=0;s<a.length;s+=1)i.add(a[s]);let o=r.filter(s=>{if(!s.relatedEntity)return!1;let l=n.get(qf(s));return!!l&&l.some(u=>!i.has(u))});if(o.length!==0)throw new cD.ValidationError("view",e.id,o.map(s=>(0,kt.issue)(`/columns/${r.indexOf(s)}`,"view-column-orphaned-by-join-removal",`column '${s.name}' came from a join this push REMOVED. Another join matching '${s.relatedEntity}' still exists, but nothing can say whether it is the one the column belonged to \u2014 re-attaching it there would silently change the data the column shows. Remove the column too, keep the join it came from, or point the column at the join you want by setting relatedEntity to that join's alias.`)))}function aD(e){let t=f9(e.columns);if(!oD(e.fetchBag)||!oD(e.layoutBag))return{fetchxml:N9({...e,columns:t}),layoutxml:D9({...e,columns:t},`${e.entityLogicalName}id`)};let r=new DOMParser().parseFromString("<root/>","text/xml"),n=sD(e.fetchBag,"fetch",r),i=sD(e.layoutBag,"grid",r),a=pD(i,n),o=!hu(t,a),s=!hu(e.sort,mD(n)),l=!hu(e.filters,hD(n)),u=e.linkEntities,c=u!==void 0&&!hu(u,fD(n)),d=c?d9(n,a):void 0;return c&&C9(r,n,u),c&&(S9(e,n,t,d),p9(e,n,t,d)),o?(lD(r,n,t,a),v9(r,i,t)):c&&lD(r,n,t,a),s&&w9(r,n,e.sort),l&&A9(r,n,e.filters),{fetchxml:(0,bi.serializeNode)(n),layoutxml:(0,bi.serializeNode)(i)}}function f9(e){return(e??[]).map((t,r)=>{var n,i;return{name:String(t.name).toLowerCase(),width:(n=t.width)!==null&&n!==void 0?n:dD,order:(i=t.order)!==null&&i!==void 0?i:r,...t.relatedEntity?{relatedEntity:t.relatedEntity}:{},...t.sourceAttribute?{sourceAttribute:String(t.sourceAttribute).toLowerCase()}:{}}})}function oD(e){return!!e&&(e.c.length>0||e.a.length>0)}function sD(e,t,r){let n={n:t,a:(0,kf.mergeAttrs)(e.a,[]),c:(0,kf.spliceChildren)(e.c,[])};return(0,kf.rebuildRaw)(n,(0,bi.domEngine)(r),null)}function lD(e,t,r,n){var i,a;let o=t.getElementsByTagName("entity")[0];if(!o)return;let s=d=>{var p,f;return`${(p=d.relatedEntity)!==null&&p!==void 0?p:""}:${d.name}:${(f=d.sourceAttribute)!==null&&f!==void 0?f:d.name}`},l=new Set(r.map(s));for(let d of n)l.has(s(d))||m9(o,d);let u=Bf(t),c=new Set(st(o,"attribute").map(d=>d.getAttribute("name")).filter(d=>!!d));for(let d of[...r].sort((p,f)=>p.order-f.order))if(d.relatedEntity){let p=u.get(d.name);if(p&&p.attributeName===((i=d.sourceAttribute)!==null&&i!==void 0?i:d.name)&&(p.linkKey===d.relatedEntity||p.linkName===d.relatedEntity||!vD(o,d.relatedEntity)))continue;let f=h9(e,o,d.relatedEntity),m=e.createElement("attribute");gD(m,d),f.appendChild(m),u.set(d.name,{linkKey:d.relatedEntity,linkName:f.getAttribute("name")||d.relatedEntity,attributeName:(a=d.sourceAttribute)!==null&&a!==void 0?a:d.name,link:f})}else{if(c.has(d.name))continue;let p=e.createElement("attribute");p.setAttribute("name",d.name),g9(o,p),c.add(d.name)}}function gD(e,t){if(t.sourceAttribute&&t.sourceAttribute!==t.name){e.setAttribute("name",t.sourceAttribute),e.setAttribute("alias",t.name);return}e.setAttribute("name",t.name)}function m9(e,t){if(t.relatedEntity){for(let r of st(e,"link-entity"))if(!(r.getAttribute("alias")!==t.relatedEntity&&r.getAttribute("name")!==t.relatedEntity)){for(let n of st(r,"attribute"))if((n.getAttribute("alias")||n.getAttribute("name"))===t.name){r.removeChild(n);return}}return}for(let r of st(e,"attribute"))if(r.getAttribute("name")===t.name){e.removeChild(r);return}}function vD(e,t,r=!1){let n=a=>a.getAttribute("alias")===t||a.getAttribute("name")===t;for(let a of st(e,"link-entity"))if(n(a))return a;if(r)return;let i=e.getElementsByTagName("link-entity");for(let a=0;a<i.length;a+=1)if(n(i[a]))return i[a]}function h9(e,t,r){let n=vD(t,r);if(n)return n;let i=e.createElement("link-entity");return i.setAttribute("name",r),t.appendChild(i),i}function g9(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 v9(e,t,r){let n=t.getElementsByTagName("row")[0];if(!n)return;let i=[...r].sort((s,l)=>s.order-l.order),a=y9(n);if(b9(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 y9(e){return st(e,"cell").filter(t=>!!t.getAttribute("name")&&t.getAttribute("ishidden")!=="1")}function b9(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 w9(e,t,r){let n=t.getElementsByTagName("entity")[0];if(!n)return;let i=(p,f)=>`${p.toLowerCase()}\0${f.toLowerCase()}`,a=new Map,o=new Map,s=(p,f,m)=>{let g=p.get(f);g?g.push(m):p.set(f,[m])};for(let p of st(n,"order")){let f=p.getAttribute("attribute")||"";f&&(s(a,i(p.getAttribute("entityname")||"",f),p),s(o,f.toLowerCase(),p)),n.removeChild(p)}let l=new Set,u=(p,f)=>{let m=p.get(f);for(;m&&m.length>0;){let g=m.shift();if(!l.has(g))return l.add(g),g}},c=p=>{var f;let m=o.get(p.toLowerCase());if(!m)return;let g=m.filter(A=>!l.has(A)),y=(f=g.find(A=>!A.getAttribute("entityname")))!==null&&f!==void 0?f:g[0];return y&&l.add(y),y},d=r.map(p=>{let f=String(p.attribute);return p.entityname===void 0?{expression:p,element:void 0}:{expression:p,element:u(a,i(p.entityname,f))}});for(let p of d)p.expression.entityname===void 0&&(p.element=c(String(p.expression.attribute)));for(let{expression:p,element:f}of d){let m=f??e.createElement("order");m.setAttribute("attribute",p.attribute),m.setAttribute("descending",String(p.descending)),p.entityname?m.setAttribute("entityname",p.entityname):p.entityname===""&&m.removeAttribute("entityname"),n.appendChild(m)}}function A9(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of st(n,"filter"))vu(i)||n.removeChild(i);(r.conditions.length>0||r.groups.length>0)&&n.appendChild(ss(e,r))}}function hu(e,t){return JSON.stringify(e)===JSON.stringify(t)}function C9(e,t,r){var n;let i=t.getElementsByTagName("entity")[0];if(!i)return;let a=st(i,"link-entity").filter(m=>m.getAttribute("name")&&m.getAttribute("from")&&m.getAttribute("to")),o=(m,g)=>m.getAttribute(g)||"",s=new Array(r.length),l=new Set,u=m=>{r.forEach((g,y)=>{if(s[y])return;let A=a.filter(_=>!l.has(_)&&m(_,g));if(A.length!==1)return;let D=A[0];r.some((_,q)=>q!==y&&!s[q]&&m(D,_))||(s[y]=D,l.add(D))})};u((m,g)=>!!g.alias&&o(m,"name")===g.name&&o(m,"alias")===g.alias),u((m,g)=>o(m,"name")===g.name&&o(m,"from")===g.from&&o(m,"to")===g.to),u((m,g)=>o(m,"name")===g.name&&o(m,"from")===g.from),u((m,g)=>o(m,"name")===g.name&&o(m,"to")===g.to),u((m,g)=>o(m,"name")===g.name);let c=r.map((m,g)=>g).filter(m=>!s[m]),d=a.filter(m=>!l.has(m)),p=new Map;for(let m of d){let g=p.get(o(m,"name"));g?g.push(m):p.set(o(m,"name"),[m])}let f=new Map;for(let m of c){let g=f.get(r[m].name);g?g.push(m):f.set(r[m].name,[m])}for(let[m,g]of f){let y=(n=p.get(m))!==null&&n!==void 0?n:[];y.length===g.length&&g.forEach((A,D)=>{s[A]=y[D],l.add(y[D])})}r.forEach((m,g)=>{let y=s[g];if(y){uD(e,y,m);return}let A=e.createElement("link-entity");uD(e,A,m),i.appendChild(A)});for(let m of a)l.has(m)||i.removeChild(m)}var E9=new Set(["inner","outer"]);function S9(e,t,r,n){if(!t.getElementsByTagName("entity")[0])return;let a=new Set,o=t.getElementsByTagName("link-entity");for(let c=0;c<o.length;c+=1){let d=o[c],p=d.getAttribute("name"),f=d.getAttribute("alias");p&&a.add(p),f&&a.add(f)}let s=new Set;for(let c=0;c<o.length;c+=1)s.add(o[c]);let l=c=>{let d=n?.get(qf(c));return!!d&&d.every(p=>s.has(p))},u=r.filter(c=>c.relatedEntity&&!a.has(c.relatedEntity)&&!l(c));if(u.length!==0)throw new cD.ValidationError("view",e.id,u.map(c=>{var d;let p=((d=e.linkEntities)!==null&&d!==void 0?d:[]).some(f=>f.name===c.relatedEntity||f.alias===c.relatedEntity);return(0,kt.issue)(`/columns/${r.indexOf(c)}`,"view-column-dangling-link",`column '${c.name}' has relatedEntity '${c.relatedEntity}', but no matching join remains in linkEntities. `+(p?"Remove the column too, or keep the join.":"That join is NESTED (a join off a join), which the typed layer does not model, so it cannot be re-declared in linkEntities \u2014 it only survives while the join above it does. Remove the column, or restore the parent join this push replaced."))}))}function uD(e,t,r){t.setAttribute("name",r.name),t.setAttribute("from",r.from),t.setAttribute("to",r.to),r.alias?t.setAttribute("alias",r.alias):t.removeAttribute("alias"),r.linkType?t.setAttribute("link-type",r.linkType):E9.has(t.getAttribute("link-type")||"")&&t.removeAttribute("link-type");let n=st(t,"filter").find(a=>!vu(a)),i=r.filters&&(r.filters.conditions.length>0||r.filters.groups.length>0)?ss(e,r.filters):null;n&&i?t.replaceChild(i,n):n?t.removeChild(n):i&&t.appendChild(i)}function N9(e){var t;let r=new DOMParser().parseFromString("<fetch/>","text/xml"),n=r.documentElement;n.setAttribute("version","1.0"),n.setAttribute("mapping","logical");let i=r.createElement("entity");i.setAttribute("name",e.entityLogicalName),n.appendChild(i);let a=new Map;for(let o of(t=e.linkEntities)!==null&&t!==void 0?t:[]){let s=r.createElement("link-entity");s.setAttribute("name",o.name),s.setAttribute("from",o.from),s.setAttribute("to",o.to),o.alias&&s.setAttribute("alias",o.alias),o.linkType&&s.setAttribute("link-type",o.linkType),o.filters&&(o.filters.conditions.length>0||o.filters.groups.length>0)&&s.appendChild(ss(r,o.filters)),i.appendChild(s);for(let l of[o.alias||o.name,o.name])a.has(l)||a.set(l,s)}for(let o of[...e.columns].sort((s,l)=>s.order-l.order)){let s=r.createElement("attribute");if(o.relatedEntity){gD(s,o);let l=a.get(o.relatedEntity);l||(l=r.createElement("link-entity"),l.setAttribute("name",o.relatedEntity),i.appendChild(l),a.set(o.relatedEntity,l)),l.appendChild(s)}else s.setAttribute("name",o.name),i.appendChild(s)}for(let o of e.sort){let s=r.createElement("order");s.setAttribute("attribute",o.attribute),s.setAttribute("descending",String(o.descending)),o.entityname&&s.setAttribute("entityname",o.entityname),i.appendChild(s)}return(e.filters.conditions.length>0||e.filters.groups.length>0)&&i.appendChild(ss(r,e.filters)),new XMLSerializer().serializeToString(r)}function ss(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.entityname&&i.setAttribute("entityname",n.entityname),n.value!==void 0&&i.setAttribute("value",n.value),r.appendChild(i)}for(let n of t.groups)r.appendChild(ss(e,n));return r}function D9(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 I9(){return{adapter:new gu,api:a9.viewApi,publish:(e,t,r)=>(0,iD.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,iD.boundEntityPublishScope)(t)}}Ta.viewRegistration=I9});function yu(e,t){return e==="SetFieldValue"&&t!==void 0&&_9.has(t.attributeType)&&(t.requiredLevel==="None"||t.requiredLevel==="Recommended")}var _9,Vf=I(()=>{"use strict";_9=new Set(["Integer","Double","Decimal","Money","String","Memo","DateTime","Picklist","Lookup"])});function bD(e){return e!=="Entity"&&e!=="AllForms"&&typeof e=="string"&&e.trim()!==""}function Gf(e){return bD(e)?1:2}function zf(e){return bD(e)?e:void 0}function wD(e,t){let r=zf(e.scope);return{"@odata.type":"#Microsoft.Dynamics.CRM.workflow",name:e.name,description:e.description,workflowid:t,ondemand:!1,subprocess:!1,triggeroncreate:!1,triggerondelete:!1,category:Pa.WorkflowCategory.BusinessRule,type:Pa.WorkflowTypeCode.Definition,mode:1,scope:Pa.WorkflowScope.Organization,primaryentity:e.entityLogicalName,iscrmuiworkflow:!0,processtriggerscope:Gf(e.scope),...r!==void 0?{processtriggerformid:r}:{}}}var Pa,AD=I(()=>{"use strict";Pa=ie(Yn());});function CD(e,t=0){return(Ye[e[t+0]]+Ye[e[t+1]]+Ye[e[t+2]]+Ye[e[t+3]]+"-"+Ye[e[t+4]]+Ye[e[t+5]]+"-"+Ye[e[t+6]]+Ye[e[t+7]]+"-"+Ye[e[t+8]]+Ye[e[t+9]]+"-"+Ye[e[t+10]]+Ye[e[t+11]]+Ye[e[t+12]]+Ye[e[t+13]]+Ye[e[t+14]]+Ye[e[t+15]]).toLowerCase()}var Ye,ED=I(()=>{Ye=[];for(let e=0;e<256;++e)Ye.push((e+256).toString(16).slice(1))});function Wf(){return bu>wu.length-16&&((0,SD.randomFillSync)(wu),bu=0),wu.slice(bu,bu+=16)}var SD,wu,bu,ND=I(()=>{SD=require("crypto"),wu=new Uint8Array(256),bu=wu.length});var DD,Hf,ID=I(()=>{DD=require("crypto"),Hf={randomUUID:DD.randomUUID}});function T9(e,t,r){if(Hf.randomUUID&&!t&&!e)return Hf.randomUUID();e=e||{};let n=e.random??e.rng?.()??Wf();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 CD(n)}var gt,_D=I(()=>{ID();ND();ED();gt=T9});var jf=I(()=>{_D()});var TD=I(()=>{"use strict";});var Jf=v(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.WorkflowConditionOperator=Jt.WorkflowAttributeType=Jt.SystemStep=Jt.FieldRequiredLevelTypes=Jt.AttributeDateTimeBehavior=void 0;Jt.AttributeDateTimeBehavior={None:0,Dynamic:1,DateOnly:2,StaticTimeZoneInvariant:3,UserLocal:4};Jt.FieldRequiredLevelTypes={None:"0",Required:"1",Recommended:"2"};Jt.SystemStep={IdentifyContact:"IdentifyContact",IdentifyAccount:"IdentifyAccount",IdentifyCustomer:"IdentifyCustomer",IdentifyCase:"IdentifyCase",Solution:"Solution",Resolve:"Resolve"};Jt.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"};Jt.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"}});function FD(e){switch(e){case"Boolean":return ye.WorkflowAttributeType.Boolean;case"Customer":return ye.WorkflowAttributeType.Customer;case"DateTime":return ye.WorkflowAttributeType.DateTime;case"Decimal":return ye.WorkflowAttributeType.Decimal;case"Double":return ye.WorkflowAttributeType.Float;case"Integer":return ye.WorkflowAttributeType.Integer;case"Lookup":return ye.WorkflowAttributeType.Lookup;case"Money":return ye.WorkflowAttributeType.Money;case"Owner":return ye.WorkflowAttributeType.Owner;case"Picklist":return ye.WorkflowAttributeType.Picklist;case"State":return ye.WorkflowAttributeType.State;case"Status":return ye.WorkflowAttributeType.Status;case"Uniqueidentifier":case"UniqueIdentifier":return ye.WorkflowAttributeType.UniqueIdentifier;case"BigInt":return ye.WorkflowAttributeType.BigType;default:return ye.WorkflowAttributeType.String}}function $D(e){return e&&e!==ye.WorkflowAttributeType.String?e:void 0}function R9(e){return{__class:BD,parameterName:"primaryEntity",entityName:e}}function PD(e){return{__class:Kf,type:Qf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,method:xD,parameters:[e]}}function OD(e,t,r=ye.WorkflowAttributeType.String){return{__class:kD,type:r,behavior:ye.AttributeDateTimeBehavior.None,typeSet:!1,entity:R9(t),attributeName:e}}function F9(e,t=ye.WorkflowAttributeType.String){return{__class:MD,type:t,behavior:ye.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function x9(e){return{__class:UD,type:Qf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,days:e,hours:"0",minutes:"0",months:"0",years:"0"}}function qD(e,t){let r=P9[e.operator],n=PD(OD(e.leftField,t,e.leftWorkflowType)),i;e.dateArithmetic?i=x9(e.right.value??"0"):e.right.kind==="field"?i=OD(e.right.field??"",t,e.right.workflowType):i=F9(e.right.value??"",e.right.workflowType??e.leftWorkflowType);let a=PD(i);return{__class:Kf,type:Qf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,method:LD,parameters:[r,n,a]}}function VD(e){return typeof e=="object"&&e.__class===Kf}function L9(e){return typeof e=="object"&&e.__class===UD}function Au(e){return VD(e)&&e.method===xD&&e.parameters.length>0?Au(e.parameters[0]):e}function RD(e){if(typeof e!="object"||e.__class!==kD)return null;let t=e.entity;if(t&&t.__class&&t.__class!==BD)return null;let r=e.attributeName;return r?{field:r,workflowType:$D(e.type)}:null}function GD(e){if(!e)return null;let t=Au(e);if(!VD(t)||t.method!==LD||t.parameters.length!==3)return null;let r=t.parameters[0],n=O9[String(r)];if(!n)return null;let i=RD(Au(t.parameters[1]));if(!i)return null;let a=Au(t.parameters[2]);if(L9(a))return n!=="+"&&n!=="-"?null:{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:String(a.days??"")},dateArithmetic:!0};let o=RD(a);if(o)return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"field",field:o.field,workflowType:o.workflowType}};if(typeof a=="object"&&a.__class===MD){let s=a.primitiveValue;return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:s!=null?String(s):"",workflowType:$D(a.type)}}}return null}function Yf(e){let t=(e??"").trim();if(!/^\d+$/.test(t))return!1;let r=Number(t);return Number.isSafeInteger(r)&&r>=Xf&&r<=Oa}function wi(e){if(!e||!e.leftField)return"incomplete";if(e.right.kind==="field")return e.right.field&&e.right.field.trim()?null:"incomplete";let t=e.right.value;return!t||!t.trim()?"incomplete":e.dateArithmetic&&!Yf(t)?"invalidDayCount":null}function Ra(e){return wi(e)===null}var ye,xD,LD,Qf,kD,MD,Kf,UD,BD,P9,O9,Xf,Oa,ls=I(()=>{"use strict";ye=ie(Jf());xD="0",LD="3",Qf="0",kD="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",MD="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",Kf="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions",UD="TimeSpanExpression:#Microsoft.Crm.Workflow.Expressions",BD="PrimaryEntity:#Microsoft.Crm.Workflow.Expressions";P9={"+":0,"-":1,"*":2,"/":3},O9={0:"+",1:"-",2:"*",3:"/"};Xf=0,Oa=2147483647});function M9(e){return e.startsWith("__")&&!k9.has(e)}function U9(e){let t=Object.create(null);return Object.keys(e).forEach(r=>{M9(r)&&(t[r]=e[r])}),Object.keys(t).length>0?t:void 0}function zD(e){return e.__class==="BinaryExpression:#Microsoft.Crm.Workflow.Expressions"}function B9(e){return e.__class==="ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel"}function us(){return{list:[]}}function WD(e,t,r){return e&&e.list.length>0?{list:[{...e.list[0],description:t},...e.list.slice(1)]}:{list:[{labelId:gt(),languageCode:r,description:t}]}}function rm(e){return{__class:"PrimaryEntity:#Microsoft.Crm.Workflow.Expressions",parameterName:"primaryEntity",entityName:e}}function nm(e,t,r){return{__class:"EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:W.AttributeDateTimeBehavior.None,typeSet:!1,entity:rm(t),attributeName:e}}function cs(e,t){return{__class:"PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",type:t,behavior:W.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function YD(e){return{__class:"LookupExpression:#Microsoft.Crm.Workflow.Expressions",type:e.workflowType??W.WorkflowAttributeType.Lookup,behavior:W.AttributeDateTimeBehavior.None,typeSet:!1,entityType:e.entityType,label:e.label??"",staticValue:cs(e.id.replace(/[{}]/g,""),W.WorkflowAttributeType.UniqueIdentifier)}}function HD(e,t){let r=e.valueType==="Lookup"?e.lookupValue?.workflowType??W.WorkflowAttributeType.Lookup:e.valueWorkflowType??W.WorkflowAttributeType.String,n=tm[e.operator]??W.WorkflowConditionOperator.Equal,i=nm(e.field,t,r),a;if(e.operator==="ContainsData"||e.operator==="DoesNotContainData")a=[];else if(e.valueType==="Field"&&e.valueField)a=[nm(e.valueField,t,r)];else if(e.valueType==="Lookup"){if(!e.lookupValue)throw new Error("Lookup condition is missing its record value.");a=[YD(e.lookupValue)]}else e.valueType==="Clear"?a=[cs(null,r)]:e.valueType==="Expression"?a=[Eu(e.valueType,e.value,e.valueField,t,e.expression,e.rawExpression)]:a=[cs(e.value??"",r)];return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:W.WorkflowAttributeType.Boolean,behavior:W.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function $9(e,t,r){if(e.length===0)return null;if(e.length===1)return HD(e[0],r);let n=t==="AND"?W.WorkflowConditionOperator.LogicalAnd:W.WorkflowConditionOperator.LogicalOr,[i,...a]=e.map(o=>HD(o,r));return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:W.WorkflowAttributeType.Boolean,behavior:W.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function Cu(e){if(!e)return{valueType:"Value",value:""};if(e.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions")return{valueType:"Field",valueField:e.attributeName};if(e.__class==="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions")return e.primitiveValue==null?{valueType:"Clear",valueWorkflowType:e.type}:{valueType:"Value",value:e.primitiveValue!=null?String(e.primitiveValue):""};if(e.__class==="LookupExpression:#Microsoft.Crm.Workflow.Expressions"){let t=e.staticValue,r=typeof t=="object"&&t?.__class==="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions"?t.primitiveValue:t;return{valueType:"Lookup",lookupValue:{entityType:e.entityType,id:String(r??""),label:e.label,...e.type!==W.WorkflowAttributeType.Lookup?{workflowType:e.type}:{}}}}if(e.__class==="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions"){let t=GD(e);return t?{valueType:"Expression",expression:t}:{valueType:"Expression",rawExpression:e}}return{valueType:"Value",value:""}}function Zf(e){let t=XD[e.conditionOperatoroperator]??"Equals",r=e.left,n=r.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",i=n?r.attributeName:"",a=n?r.type:void 0,s=t==="ContainsData"||t==="DoesNotContainData"?{valueType:"Value"}:Cu(e.right[0]),l=s.valueWorkflowType??a;return{id:gt(),field:i,fieldDisplayName:i,operator:t,...s,...l?{valueWorkflowType:l}:{}}}function jD(e){if(!e||e.__class!=="BinaryExpression:#Microsoft.Crm.Workflow.Expressions")return{clauses:[],logic:"AND"};let t=e.conditionOperatoroperator;if(t===W.WorkflowConditionOperator.LogicalAnd||t===W.WorkflowConditionOperator.LogicalOr){let r=t===W.WorkflowConditionOperator.LogicalAnd?"AND":"OR";return{clauses:[...zD(e.left)?[Zf(e.left)]:[],...e.right.filter(zD).map(Zf)],logic:r}}return{clauses:[Zf(e)],logic:"AND"}}function Eu(e,t,r,n,i,a,o,s){if(e==="Field"&&r)return nm(r,n,W.WorkflowAttributeType.String);if(e==="Expression"){if(i)return qD(i,n);if(a!=null)return a}return e==="Lookup"&&o?YD(o):e==="Clear"?cs(null,s??W.WorkflowAttributeType.String):cs(t??"",W.WorkflowAttributeType.String)}function em(e,t){return{propertyName:e,propertyValueExpr:t}}function Fa(e){return`Step_${e.value++}`}function Qt(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 JD(e,t,r){return e&&!r.used.has(e)?(r.used.add(e),e):Qt(t,r)}function q9(e){return e===KD.StateCode.Activated?"Active":"Draft"}function V9(e,t){let r=e.processtriggerscope,n=e.processtriggerformid;return r===1&&n?n:r===2?"Entity":t??"Entity"}function ZD(e,t=1033){return new xa({languageCode:t}).serialize(e)}function eI(e){return new xa().deserialize(e)}var KD,W,k9,tm,XD,im,xa,am=I(()=>{"use strict";jf();KD=ie(Yn());TD();ls();W=ie(Jf());k9=new Set(["__class"]);tm={Equals:W.WorkflowConditionOperator.Equal,DoesNotEqual:W.WorkflowConditionOperator.NotEqual,IsGreaterThan:W.WorkflowConditionOperator.GreaterThan,IsLessThan:W.WorkflowConditionOperator.LessThan,IsGreaterThanEqualTo:W.WorkflowConditionOperator.GreaterThanOrEqual,IsLessThanEqualTo:W.WorkflowConditionOperator.LessThanOrEqual,Contains:W.WorkflowConditionOperator.Contains,DoesNotContain:W.WorkflowConditionOperator.DoesNotContain,BeginsWith:W.WorkflowConditionOperator.BeginsWith,DoesNotBeginWith:W.WorkflowConditionOperator.DoesNotBeginWith,EndsWith:W.WorkflowConditionOperator.EndsWith,DoesNotEndWith:W.WorkflowConditionOperator.DoesNotEndWith,On:W.WorkflowConditionOperator.On,NotOn:W.WorkflowConditionOperator.NotOn,ContainsData:W.WorkflowConditionOperator.NotNull,DoesNotContainData:W.WorkflowConditionOperator.IsNull},XD={};for(let e of Object.keys(tm))XD[tm[e]]=e;im={setFieldValue:"Set Field Value",setDefaultValue:"Set Default Value",lockUnlock:"Lock/Unlock",setBusinessRequired:"Set Business Required",setVisibility:"Set Visibility",recommendation:"Recommendation",showErrorMessage:"Show Error Message",condition:"Condition"};xa=class{resolveLabel;languageCode;entityName="";stepCounter={value:0};idCounter={counts:{},used:new Set};constructor(t={}){this.resolveLabel=t.resolveLabel??(r=>im[r]),this.languageCode=t.languageCode??1033}label(t){return this.resolveLabel(t)}serialize(t){let r=t.wfomRoot;this.entityName=t.entityLogicalName,this.stepCounter={value:r?Number(r.nextStepIndex):1},this.idCounter={counts:{},used:new Set};let n=t.scope!=="Entity"&&t.scope!=="AllForms"?t.scope:null,i=t.rootCondition?[this.serializeConditionNode(t.rootCondition)]:[],a={...r?.reservedProperties??{},__class:"WorkflowStep:#Microsoft.Crm.Workflow.ObjectModel",id:r?.id??t.ruleId??gt(),name:r?.name??"Step_0",description:r!==void 0?r.description:t.description||null,stepLabels:us(),argumentsArray:[],primaryEntityName:r?.primaryEntityName??this.entityName,nextStepIndex:String(this.stepCounter.value),isCrmUIWorkflow:!0,category:r?.category??"2",businessProcessType:r?.businessProcessType??"0",mode:r?.mode??"0",title:r?.title??t.name,formId:n,workflowEntityId:r?.workflowEntityId??t.ruleId??"",variables:r?.variables??[],inputs:r?.inputs??[],steps:{list:i}};return JSON.stringify(a)}makeApplyActionStep(t){return{__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",id:Qt("SetAttributeValueStep",this.idCounter),description:t.displayName||"New Action",name:t.stepName??Fa(this.stepCounter),stepLabels:{list:[]},specification:em(t.field,Eu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType)),entity:rm(this.entityName)}}makeRecommendationActionStep(t,r,n){let i=r.map(l=>this.makeApplyActionStep(l)),a=t??"",o=n?.stepLabels,s=WD(o,a,this.languageCode);return{__class:"ActionStep:#Microsoft.Crm.Workflow.ObjectModel",id:JD(n?.id,"ActionStep",this.idCounter),name:n?.name??Fa(this.stepCounter),description:n?.description??"Action step",stepLabels:s,steps:{list:i},actionId:null,actionType:n?.actionType??"4",processId:n?.processId??gt(),uniqueName:n?.uniqueName??`id_${gt().replace(/-/g,"")}ActionStep`}}serializeAction(t){let r=rm(this.entityName),n=t.stepName??Fa(this.stepCounter),i=t.stepLabels??us(),a={name:n,stepLabels:i,description:t.displayName},o=t.type;switch(o){case"SetFieldValue":return{...a,id:Qt("SetAttributeValueStep",this.idCounter),__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:em(t.field,Eu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"SetDefaultValue":return{...a,id:Qt("SetDefaultValueStep",this.idCounter),__class:"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:em(t.field,Eu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"LockUnlock":return{...a,id:Qt("SetDisplayModeStep",this.idCounter),__class:"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",isReadOnly:t.lock,entity:r};case"SetBusinessRequired":return{...a,id:Qt("SetFieldRequiredLevelStep",this.idCounter),__class:"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",requiredLevel:t.required?W.FieldRequiredLevelTypes.Required:W.FieldRequiredLevelTypes.None,entity:r};case"SetVisibility":return{...a,id:Qt("SetVisibilityStep",this.idCounter),__class:"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",isVisible:t.visible,entity:r};case"ShowErrorMessage":{let s=t.errorMessage||t.displayName,l=t.stepLabels&&t.stepLabels.list.length>0?t.stepLabels:{list:[{labelId:gt(),languageCode:this.languageCode,description:s}]};return{...a,id:Qt("SetMessageStep",this.idCounter),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:l,name:s,controlId:t.field,entity:r,level:t.messageLevel??"error",actionSteps:t.messageActionSteps??{list:[]}}}case"Recommendation":{let s=t.messageText??t.recommendationTitle??t.displayName,l=WD(t.stepLabels,s,this.languageCode),u={list:[this.makeRecommendationActionStep(t.acceptanceText,t.applyActions??[],t.recommendationActionStepMeta)]};return{...a,id:Qt("SetMessageStep",this.idCounter),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:l,description:t.recommendationTitle||t.displayName,controlId:t.field,entity:r,level:"RECOMMENDATION",actionSteps:u}}default:throw new Error(`Unsupported action type: ${o}`)}}serializeConditionNode(t){let r=t.stepName??Fa(this.stepCounter),n=Qt("ConditionStep",this.idCounter),i=[],a=t,o=!0;for(;a;){let s=$9(a.clauses,a.logic,this.entityName),l=o?a.branchName??Fa(this.stepCounter):Fa(this.stepCounter),c={__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:o?JD(a.branchId,"ConditionBranchStep",this.idCounter):Qt("ConditionBranchStep",this.idCounter),name:l,description:a.displayName,stepLabels:us(),conditionExpression:s??void 0,steps:{list:a.trueBranch.map(p=>this.serializeBranchItem(p))}};i.push(c);let d=a.falseBranch;if(d.length===1&&d[0].kind==="condition"){a=d[0],o=!1;continue}d.length>0&&i.push(this.makeTerminalElseBranch(d)),a=void 0}return{__class:"ConditionStep:#Microsoft.Crm.Workflow.ObjectModel",id:n,name:r,description:"",stepLabels:us(),containsElsebranch:i.length>1,steps:{list:i}}}makeTerminalElseBranch(t){return{__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:Qt("ConditionBranchStep",this.idCounter),name:"Else",description:null,stepLabels:us(),conditionExpression:void 0,steps:{list:t.map(r=>this.serializeBranchItem(r))}}}serializeBranchItem(t){return t.kind==="condition"?this.serializeConditionNode(t):this.serializeAction(t)}deserialize(t){let r=t,n=null,i;if(t.wfomJson)try{let a=JSON.parse(t.wfomJson);i={id:a.id==="WorkflowStep0"||!a.id?t.workflowid??gt():a.id,name:a.name,description:a.description,nextStepIndex:a.nextStepIndex,category:a.category==="0"||a.category===0?"2":a.category,businessProcessType:a.businessProcessType,mode:a.mode,title:a.title||t.name||"",primaryEntityName:a.primaryEntityName==="1"||!a.primaryEntityName?t.primaryentity??"":a.primaryEntityName,workflowEntityId:a.workflowEntityId==="00000000-0000-0000-0000-000000000000"||!a.workflowEntityId?t.workflowid??"":a.workflowEntityId,formId:a.formId,variables:a.variables,inputs:a.inputs,reservedProperties:U9(a)};let s=(a.steps?.list??[]).find(l=>l.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel");s&&(n=this.deserializeConditionStep(s))}catch{}return{ruleId:t.workflowid??null,name:t.name??"",description:t.description??"",entityLogicalName:t.primaryentity??"",scope:V9(r,i?.formId),status:q9(t.statecode),rootCondition:n,wfomRoot:i}}deserializeConditionStep(t){let r=(t.steps?.list??[]).filter(B9);return this.buildConditionNodeFromBranches(r,t,!0)}buildConditionNodeFromBranches(t,r,n){let[i,...a]=t,{clauses:o,logic:s}=jD(i?.conditionExpression),l=this.deserializeBranch(i?.steps?.list??[]),u=this.deserializeElseChain(a,r),c=i?.description||i?.name||r.description||r.name||this.label("condition");return{kind:"condition",id:(n?r.id:i?.id)??gt(),displayName:c,clauses:o,logic:s,trueBranch:l,falseBranch:u,isCollapsed:!1,stepName:n?r.name:void 0,branchId:n?i?.id:void 0,branchName:n?i?.name:void 0}}deserializeElseChain(t,r){if(t.length===0)return[];let[n]=t,{clauses:i}=jD(n.conditionExpression);return i.length===0?this.deserializeBranch(n.steps?.list??[]):[this.buildConditionNodeFromBranches(t,r,!1)]}deserializeBranch(t){return t.map(r=>r.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel"?this.deserializeConditionStep(r):this.deserializeAction(r)).filter(r=>r!==null)}parseRecommendationApplyActions(t){let n=(t?.list??[])[0];if(!n)return{applyActions:[]};let i={id:n.id,name:n.name,description:n.description??void 0,stepLabels:n.stepLabels,processId:n.processId,uniqueName:n.uniqueName,actionType:n.actionType},a=n.stepLabels?.list,o=a&&a.length>0?a[0].description??"":"";return{applyActions:(n.steps?.list??[]).filter(l=>l.__class==="SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel").map(l=>{let u=l.specification;return{id:l.id||gt(),field:u?.propertyName??"",stepName:l.name??void 0,displayName:l.description??void 0,...Cu(u?.propertyValueExpr)}}),meta:i,acceptanceText:o}}deserializeAction(t){switch(t.__class){case"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=Cu(t.specification.propertyValueExpr);return{kind:"action",id:t.id,type:"SetFieldValue",displayName:t.description||t.name||this.label("setFieldValue"),stepName:t.name,stepLabels:t.stepLabels,field:t.specification.propertyName,...r}}case"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=Cu(t.specification.propertyValueExpr);return{kind:"action",id:t.id,type:"SetDefaultValue",displayName:t.description||t.name||this.label("setDefaultValue"),stepName:t.name,stepLabels:t.stepLabels,field:t.specification.propertyName,...r}}case"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"LockUnlock",displayName:t.description||t.name||this.label("lockUnlock"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,lock:t.isReadOnly};case"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"SetBusinessRequired",displayName:t.description||t.name||this.label("setBusinessRequired"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,required:t.requiredLevel!==W.FieldRequiredLevelTypes.None};case"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"SetVisibility",displayName:t.description||t.name||this.label("setVisibility"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,visible:t.isVisible};case"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=t.stepLabels?.list,n=r&&r.length>0?r[0].description??"":"";if((t.level??"").toUpperCase()==="RECOMMENDATION"){let{applyActions:i,meta:a,acceptanceText:o}=this.parseRecommendationApplyActions(t.actionSteps);return{kind:"action",id:t.id,type:"Recommendation",displayName:t.description||this.label("recommendation"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,recommendationTitle:t.description||"",messageText:n,acceptanceText:o,applyActions:i,recommendationActionStepMeta:a}}return{kind:"action",id:t.id,type:"ShowErrorMessage",displayName:t.description||this.label("showErrorMessage"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,errorMessage:n||t.name||"",messageLevel:t.level??void 0,messageActionSteps:t.actionSteps}}case"ActionStep:#Microsoft.Crm.Workflow.ObjectModel":{let{applyActions:r,meta:n,acceptanceText:i}=this.parseRecommendationApplyActions({list:[t]});return{kind:"action",id:t.id,type:"Recommendation",displayName:t.name||this.label("recommendation"),stepName:t.name,stepLabels:t.stepLabels,field:t.actionControl?.controlId??"",recommendationTitle:t.name||"",messageText:t.description||"",acceptanceText:i,applyActions:r,recommendationActionStepMeta:n}}default:return null}}}});var tI=I(()=>{"use strict";});function Wn(e){return!G9.has(e)}function aI(e){return K9.has(e)}function Su(e){return nI.has(e)?z9:J9.has(e)?W9:iI.has(e)?H9:j9}function oI(e){return Su(e)[0]}function sI(e,t){return Su(t).includes(e)}function rI(e){return nI.has(e)?"string":e==="Money"?"money":e==="Integer"||e==="BigInt"?"integer":e==="Decimal"||e==="Double"?"decimal":iI.has(e)?"date":Q9.has(e)?"boolean":"other"}function Nu(e,t){let r=rI(e),n=rI(t);return r==="other"||n==="other"?e===t:r===n}var G9,z9,W9,H9,j9,nI,J9,iI,Q9,K9,om=I(()=>{"use strict";tI();G9=new Set(["ContainsData","DoesNotContainData"]);z9=["Equals","DoesNotEqual","Contains","DoesNotContain","BeginsWith","DoesNotBeginWith","EndsWith","DoesNotEndWith","ContainsData","DoesNotContainData"],W9=["Equals","DoesNotEqual","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],H9=["On","NotOn","Equals","DoesNotEqual","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],j9=["Equals","DoesNotEqual","ContainsData","DoesNotContainData"],nI=new Set(["String","Memo","EntityName"]),J9=new Set(["Integer","BigInt","Money","Decimal","Double"]),iI=new Set(["DateTime"]),Q9=new Set(["Boolean"]),K9=new Set(["Equals","DoesNotEqual"])});function cm(e){return X9.has(e.type)}function sm(e,t,r,n,i,a,o){let s=i.get(r);!s||!Y9.has(s.attributeType)||n!=="Value"||o?.operator&&!aI(o.operator)||a.push({nodeId:e,kind:"INVALID_VALUE_TYPE_FOR_FIELD",message:`${t}: please select a record for this lookup field; a typed text value cannot be saved.`,target:o?.target,itemId:o?.itemId,messageKey:"Validation.InvalidValueTypeForField",messageParams:{label:t}})}function lm(e){return!!(e?.entityType?.trim()&&e.id?.trim())}function um(e,t,r){return{nodeId:e,kind:"INVALID_DAY_COUNT",message:`Please enter a whole number of days between 0 and ${Oa}.`,target:t,itemId:r,messageKey:"Validation.InvalidDayCount",messageParams:{max:Oa}}}function lI(e,t,r,n,i,a,o,s){if(i!=="Clear")return;let l=a.get(n);yu(r,l)||o.push({nodeId:e,kind:"INVALID_CLEAR_FOR_FIELD",message:`${t}: Clear is only supported for optional fields with a legacy-compatible type.`,target:s?.target,itemId:s?.itemId,messageKey:"Validation.InvalidClearForField",messageParams:{label:t}})}function Iu(e){if(!e)return!1;for(let t of[...e.trueBranch,...e.falseBranch])if(t.kind==="action"){if(cm(t))return!0}else if(Iu(t))return!0;return!1}function dm(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=dm(r,t);if(n)return n}}return null}function La(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=La(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=La(n,t);if(i)return i}}return null}function pm(e,t){return{...e,trueBranch:uI(e.trueBranch,t),falseBranch:uI(e.falseBranch,t)}}function uI(e,t){return e.filter(r=>r.id!==t).map(r=>r.kind==="condition"?pm(r,t):r)}function Hn(e,t,r){return e.id===t?r(e):{...e,trueBranch:e.trueBranch.map(n=>n.kind==="condition"?Hn(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="condition"?Hn(n,t,r):n)}}function Du(e,t,r){return{...e,trueBranch:e.trueBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?Du(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?Du(n,t,r):n)}}function cI(e,t,r,n){return Hn(e,t,i=>({...i,trueBranch:r==="true"?[...i.trueBranch,n]:i.trueBranch,falseBranch:r==="false"?[...i.falseBranch,n]:i.falseBranch}))}function fm(e){return e.length===1&&e[0].kind==="condition"}function e8(e){let t=0,r=e??void 0;for(;r;){t+=1;let{falseBranch:n}=r;if(fm(n)){r=n[0];continue}n.length>0&&(t+=1),r=void 0}return t}function t8(e){return!!e&&e8(e)<Z9}function r8(e,t){if(!e)return;let r=(n,i)=>{if(n.id===t)return i;let a=[];if(fm(n.falseBranch)){let o=r(n.falseBranch[0],i);if(o)return o}else a.push(...n.falseBranch.filter(o=>o.kind==="condition"));a.push(...n.trueBranch.filter(o=>o.kind==="condition"));for(let o of a){let s=r(o,o);if(s)return s}};return r(e,e)}function dI(e,t,r){let n=r8(e,t);return!n||!t8(n)?e:Hn(e,t,i=>pI(i,r))}function pI(e,t){if(fm(e.falseBranch))return{...e,falseBranch:[pI(e.falseBranch[0],t)]};let r=mm(t);return r.falseBranch=e.falseBranch,{...e,falseBranch:[r]}}function fI(e,t){let r=La(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 Hn(e,r.node.id,a=>({...a,falseBranch:i}))}function mI(e,t,r){let n=La(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 Hn(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 mm(e){return{kind:"condition",id:gt(),displayName:e??"New Condition",clauses:[],logic:"AND",trueBranch:[],falseBranch:[],isCollapsed:!1}}function hI(e,t){let r={kind:"action",id:gt(),type:e,displayName:t??`New ${e}`};switch(e){case"Recommendation":return{...r,type:"Recommendation",field:"",recommendationTitle:"",messageText:"",applyActions:[{id:gt(),field:"",valueType:"Value",value:""}]};case"LockUnlock":return{...r,type:"LockUnlock",field:"",lock:!0};case"ShowErrorMessage":return{...r,type:"ShowErrorMessage",field:"",errorMessage:""};case"SetFieldValue":return{...r,type:"SetFieldValue",field:"",valueType:"Value",value:""};case"SetDefaultValue":return{...r,type:"SetDefaultValue",field:"",valueType:"Value",value:""};case"SetBusinessRequired":return{...r,type:"SetBusinessRequired",field:"",required:!0};case"SetVisibility":return{...r,type:"SetVisibility",field:"",visible:!0};default:return{...r,type:"SetFieldValue",field:"",valueType:"Value",value:""}}}function gI(e){if(!e)return[];let t=[];return vI(e,t),[...new Set(t)]}function vI(e,t){e.clauses.forEach(r=>{r.field&&t.push(r.field)}),[...e.trueBranch,...e.falseBranch].forEach(r=>{r.kind==="condition"?vI(r,t):"field"in r&&r.field&&t.push(r.field)})}function yI(e,t=[]){if(!e)return[{nodeId:"root",kind:"NO_CONDITION",message:"A business rule must include at least one condition.",target:"node"}];let r=[],n=new Map(t.map(i=>[i.logicalName,i]));return bI(e,r,n),Iu(e)||r.push({nodeId:"root",kind:"NO_ACTION",message:"A business rule must include at least one action step.",target:"node"}),r}function bI(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.",target:"node",messageKey:"Validation.AddClause"}),e.clauses.forEach(n=>{let i=n.valueType==="Expression"&&!n.rawExpression?wi(n.expression):null;if(!n.field)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Please select a field for this clause.",target:"clauseField",itemId:n.id});else if(Wn(n.operator)&&n.valueType==="Value"&&!n.value)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please enter a value for this clause.",target:"clauseValue",itemId:n.id});else if(Wn(n.operator)&&n.valueType==="Value"&&n.value){let a=r.get(n.field);a?.maxLength&&n.value.length>a.maxLength&&t.push({nodeId:e.id,kind:"CLAUSE_VALUE_TOO_LONG",message:`Value exceeds the field's maximum length of ${a.maxLength} characters.`,target:"clauseValue",itemId:n.id,messageParams:{maxLength:a.maxLength}})}else Wn(n.operator)&&n.valueType==="Expression"&&!n.rawExpression&&!Ra(n.expression)&&t.push(i==="invalidDayCount"?um(e.id,"clauseValue",n.id):{nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please complete the formula for this clause.",target:"clauseValue",itemId:n.id,messageKey:"Validation.CompleteClauseFormula"});Wn(n.operator)&&n.valueType==="Lookup"&&(lm(n.lookupValue)||t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please select a lookup record for this clause.",target:"clauseValue",itemId:n.id,messageKey:"Validation.EmptyClauseLookupValue"})),Wn(n.operator)&&sm(e.id,"Condition",n.field,n.valueType,r,t,{operator:n.operator,target:"clauseValue",itemId:n.id})}),[...e.trueBranch,...e.falseBranch].forEach(n=>{if(n.kind==="condition")bI(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.`,target:"actionField",messageParams:{actionType:n.type}});else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&(n.valueType??"Value")==="Value"&&!n.value?.trim())t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please provide a value.`,target:"actionValue",messageParams:{actionType:n.type}});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.`,target:"actionValue",messageParams:{actionType:n.type,maxLength:i.maxLength}})}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.`,target:"actionValue",messageKey:"Validation.SelectActionSourceField",messageParams:{actionType:n.type}});else if(r.size>0){let i=r.get(n.field),a=r.get(n.valueField);i&&a&&!Nu(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.`,target:"actionValue",messageKey:"Validation.IncompatibleActionSourceField",messageParams:{actionType:n.type}})}}else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Expression"){let i=n.rawExpression?null:wi(n.expression);!n.rawExpression&&!Ra(n.expression)&&t.push(i==="invalidDayCount"?um(n.id,"actionValue"):{nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the formula.`,target:"actionValue",messageKey:"Validation.CompleteActionFormula",messageParams:{actionType:n.type}})}else(n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Lookup"&&!lm(n.lookupValue)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the lookup record.`,target:"actionValue",messageKey:"Validation.EmptyActionLookupValue",messageParams:{actionType:n.type}});if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.field&&(sm(n.id,n.type,n.field,n.valueType,r,t,{target:"actionValue"}),lI(n.id,n.type,n.type,n.field,n.valueType,r,t,{target:"actionValue"})),n.type==="ShowErrorMessage"&&!n.errorMessage?.trim()&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_MESSAGE",message:"Show error message: please enter an error message.",target:"actionMessage"}),n.type==="Recommendation"){let i=n.applyActions??[];n.recommendationTitle?.trim()||t.push({nodeId:n.id,kind:"EMPTY_RECOMMENDATION_TITLE",message:"Recommendation: please enter a recommendation title.",target:"recommendationTitle"}),n.messageText?.trim()||t.push({nodeId:n.id,kind:"EMPTY_RECOMMENDATION_MESSAGE",message:"Recommendation: please enter a recommendation message.",target:"recommendationMessage"}),i.length===0&&t.push({nodeId:n.id,kind:"RECOMMENDATION_NO_APPLY_ACTION",message:"Recommendation: add at least one action to apply.",target:"node"}),i.forEach(a=>{if(!a.field)t.push({nodeId:n.id,kind:"EMPTY_ACTION_FIELD",message:"Recommendation: a target field is required for each action to apply.",target:"applyActionField",itemId:a.id,messageKey:"Validation.RecommendationApplyField"});else if(a.valueType==="Field")a.valueField||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please select a field to copy from.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplySourceField"});else if(a.valueType==="Expression"){let o=a.rawExpression?null:wi(a.expression);!a.rawExpression&&!Ra(a.expression)&&t.push(o==="invalidDayCount"?um(n.id,"applyActionValue",a.id):{nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the formula.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyFormula"})}else a.valueType==="Lookup"?lm(a.lookupValue)||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the lookup record.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyLookupValue"}):a.valueType==="Clear"||a.value?.trim()||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please enter a value for each action to apply.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyValue"});a.field&&(sm(n.id,"Recommendation",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}),lI(n.id,"Recommendation","SetFieldValue",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}))})}}})}var X9,Y9,Z9,hm=I(()=>{"use strict";jf();Vf();om();ls();X9=new Set(["LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]);Y9=new Set(["Lookup","Customer","Owner"]);Z9=10});var wI={};zr(wI,{DAY_COUNT_MAX:()=>Oa,DAY_COUNT_MIN:()=>Xf,DEFAULT_DESERIALIZE_LABELS:()=>im,WorkflowJsonMapper:()=>xa,addElseIfInTree:()=>dI,appendToBranch:()=>cI,areFieldKindsCompatible:()=>Nu,attributeTypeToWorkflowType:()=>FD,buildWorkflowEntity:()=>wD,collectUsedFields:()=>gI,createEmptyAction:()=>hI,createEmptyCondition:()=>mm,deserializeWorkflowJson:()=>eI,findNode:()=>dm,findParent:()=>La,getDefaultOperatorForFieldType:()=>oI,getExpressionModelIssue:()=>wi,getOperatorsForFieldType:()=>Su,hasAnyTriggerGeneratingAction:()=>Iu,isDayCountValid:()=>Yf,isExpressionModelComplete:()=>Ra,isOperatorCompatible:()=>sI,isTriggerGeneratingAction:()=>cm,moveBranchItemInTree:()=>mI,operatorNeedsValue:()=>Wn,processTriggerFormIdFromScope:()=>zf,processTriggerScopeFromScope:()=>Gf,removeElseIfInTree:()=>fI,removeNodeFromTree:()=>pm,serializeToWorkflowJson:()=>ZD,supportsClearForActionType:()=>yu,updateActionInTree:()=>Du,updateConditionInTree:()=>Hn,validateBusinessRule:()=>yI});var AI=I(()=>{"use strict";Vf();AD();am();am();hm();hm();om();ls();ls();});var gm=v(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.cloneJson=void 0;function n8(e){return JSON.parse(JSON.stringify(e))}_u.cloneJson=n8});var RI=v(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.BUSINESS_RULE_NULL_GUID=jn.businessRuleRegistration=jn.BusinessRuleAdapter=void 0;var CI=pt(),ds=(AI(),br(wI)),EI=lr(),SI=te(),i8=gm(),xr=Fr(),a8=kc(),o8=pt();function s8(e){return _I((0,i8.cloneJson)(e))}function _I(e){var t,r;let n=i=>(i??[]).map(a=>l8(a)?_I(a):a);return{...e,logic:(t=e.logic)!==null&&t!==void 0?t:"AND",clauses:(r=e.clauses)!==null&&r!==void 0?r:[],trueBranch:n(e.trueBranch),falseBranch:n(e.falseBranch)}}function l8(e){return Object.prototype.hasOwnProperty.call(e,"type")?!1:Object.prototype.hasOwnProperty.call(e,"clauses")||Object.prototype.hasOwnProperty.call(e,"trueBranch")||Object.prototype.hasOwnProperty.call(e,"falseBranch")||Object.prototype.hasOwnProperty.call(e,"logic")}function u8(e){var t;if(e===null||typeof e!="object"||Array.isArray(e))throw new SI.ValidationError("businessRule","(new)","/rootCondition",`rootCondition must be a condition object or null, got ${Array.isArray(e)?"array":typeof e}`);if(Object.prototype.hasOwnProperty.call(e,"type"))throw new SI.ValidationError("businessRule",(t=e.id)!==null&&t!==void 0?t:"(new)","/rootCondition","rootCondition looks like an ACTION (it carries 'type'), but it must be a condition. Wrap the action in a condition's trueBranch instead \u2014 a bare action would compile to an empty rule that saves successfully and does nothing.");return e}var c8="00000000-0000-0000-0000-000000000000";jn.BUSINESS_RULE_NULL_GUID=c8;var d8=new Set(["Recommendation","LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]),p8=["ruleId","name","description","entityLogicalName","scope","status","rootCondition"],f8=["kind","id","displayName","logic","clauses","trueBranch","falseBranch"],m8=["id","field","fieldDisplayName","operator","valueType","value","valueField","lookupValue","expression","rawExpression","valueWorkflowType"];function hr(e,t){return e===void 0?t:{...e,...t}}var Ai=["kind","id","type","displayName","field","stepName","stepLabels"],NI=["valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression"],h8={Recommendation:[...Ai,"recommendationTitle","messageText","acceptanceText","applyActions","recommendationActionStepMeta"],LockUnlock:[...Ai,"lock"],ShowErrorMessage:[...Ai,"errorMessage","messageLevel","messageActionSteps"],SetFieldValue:[...Ai,...NI],SetDefaultValue:[...Ai,...NI],SetBusinessRequired:[...Ai,"required"],SetVisibility:[...Ai,"visible"]};function j(e,t){return t===void 0?{}:{[e]:t}}function TI(e){var t;return e===void 0?void 0:{...e,label:(t=e.label)!==null&&t!==void 0?t:""}}function vm(e){return{valueType:e.valueType,...j("valueWorkflowType",e.valueWorkflowType),...j("value",e.value),...j("valueField",e.valueField),...j("lookupValue",TI(e.lookupValue)),...j("expression",e.expression),...j("rawExpression",e.rawExpression)}}function PI(e,t){let r=new Set(t),n={};for(let[i,a]of Object.entries(e))r.has(i)||a!==void 0&&(n[i]=a);return Object.keys(n).length>0?n:void 0}var g8=["id","field","valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression","stepName","displayName"];function v8(e){return hr(e.bag,{id:e.id,field:e.field,...vm(e),...j("stepName",e.stepName),...j("displayName",e.displayName)})}function y8(e){let t=PI(e,g8);return{id:e.id,field:e.field,valueType:e.valueType,...j("valueWorkflowType",e.valueWorkflowType),...j("value",e.value),...j("valueField",e.valueField),...j("lookupValue",e.lookupValue),...j("expression",e.expression),...j("rawExpression",e.rawExpression),...j("stepName",e.stepName),...j("displayName",e.displayName),...j("bag",t)}}function DI(e){return{valueType:e.valueType,...j("valueWorkflowType",e.valueWorkflowType),...j("value",e.value),...j("valueField",e.valueField),...j("lookupValue",e.lookupValue),...j("expression",e.expression),...j("rawExpression",e.rawExpression)}}function II(e){throw new Error(`Unsupported business-rule action type: ${e.type}`)}var b8=new Set(["INVALID_CLEAR_FOR_FIELD","INVALID_VALUE_TYPE_FOR_FIELD","CLAUSE_VALUE_TOO_LONG","ACTION_VALUE_TOO_LONG"]),w8=new Set,A8="INVALID_CLEAR_FOR_FIELD";function C8(e){let t=n=>{var i;return(0,xr.isJsonObject)(n)&&(n.label===""||n.label===void 0)?{...n,label:String((i=n.id)!==null&&i!==void 0?i:"")}:n},r=n=>{if(!(0,xr.isJsonObject)(n))return n;let i={...n};"lookupValue"in i&&(i.lookupValue=t(i.lookupValue)),Array.isArray(i.applyActions)&&(i.applyActions=i.applyActions.map(r));for(let a of["clauses","trueBranch","falseBranch"])Array.isArray(i[a])&&(i[a]=i[a].map(r));return i};return r(e)}var Tu=class{toArtifact(t){let r=this.residualBag(t,p8),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){let r=t.rootCondition?this.conditionFromJson(t.rootCondition):null;return hr(t.bag,{ruleId:t.id,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:r})}fromApiResponse(t){var r;let n=t??{},i={...(r=n.Entity)!==null&&r!==void 0?r:{},wfomJson:n.WfomJson},a=(0,ds.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,ds.serializeToWorkflowJson)(n),a=(r=n.ruleId)!==null&&r!==void 0?r:(0,CI.newId)();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:t.rootCondition===void 0?(0,ds.createEmptyCondition)():t.rootCondition===null?null:this.conditionFromJson(s8(u8(t.rootCondition)))},u=this.toArtifact(l);return u.id||(u.id=(0,CI.newId)()),u}assignMissingIds(t){return(0,o8.assignMissingIds)(t)}validate(t){let r=[],n=t.rootCondition;return n==null?r:(0,xr.isJsonObject)(n)?(OI(n,"/rootCondition",r),r):(r.push((0,xr.issue)("/rootCondition","condition-must-be-object",`rootCondition must be a JSON object or null, got ${typeof n}`)),r)}semanticIssues(t,r=[]){let n;try{n=this.fromArtifact(t)}catch(o){return[(0,xr.issue)("/rootCondition","rule-not-representable",o instanceof Error?o.message:String(o))]}let i=n.rootCondition===null?null:C8(n.rootCondition),a;return r.length===0?a=b8:r.some(o=>o.requiredLevel!==void 0)?a=w8:a=new Set([A8]),(0,ds.validateBusinessRule)(i,r).filter(o=>!a.has(o.kind)).map(o=>(0,xr.issue)(`/rootCondition (${o.nodeId})`,`business-rule-${o.kind}`,o.message))}issuesBlockingPush(t,r=[],n){return this.semanticIssues(t,r)}residualBag(t,r){return PI(t,r)}buildWorkflowEntity(t,r){return(0,ds.buildWorkflowEntity)(t,r)}conditionToJson(t){let r=this.residualBag(t,f8),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){let r=this.residualBag(t,m8),n={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}:{},...t.lookupValue!==void 0?{lookupValue:t.lookupValue}:{},...t.expression!==void 0?{expression:t.expression}:{},...t.rawExpression!==void 0?{rawExpression:t.rawExpression}:{},...t.valueWorkflowType!==void 0?{valueWorkflowType:t.valueWorkflowType}:{}};return r&&(n.bag=r),n}branchItemToJson(t){return t.kind==="condition"?this.conditionToJson(t):this.actionToJson(t)}actionToJson(t){let r=this.residualBag(t,h8[t.type]),n={kind:"action",id:t.id,displayName:t.displayName,field:t.field,...j("stepName",t.stepName),...j("stepLabels",t.stepLabels),...j("bag",r)};switch(t.type){case"Recommendation":return{...n,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...j("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(y8),...j("recommendationActionStepMeta",t.recommendationActionStepMeta)};case"LockUnlock":return{...n,type:"LockUnlock",lock:t.lock};case"ShowErrorMessage":return{...n,type:"ShowErrorMessage",errorMessage:t.errorMessage,...j("messageLevel",t.messageLevel),...j("messageActionSteps",t.messageActionSteps)};case"SetFieldValue":return{...n,type:"SetFieldValue",...DI(t)};case"SetDefaultValue":return{...n,type:"SetDefaultValue",...DI(t)};case"SetBusinessRequired":return{...n,type:"SetBusinessRequired",required:t.required};case"SetVisibility":return{...n,type:"SetVisibility",visible:t.visible};default:return II(t)}}conditionFromJson(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:{};return hr(n,{kind:"condition",isCollapsed:typeof n.isCollapsed=="boolean"?n.isCollapsed:!1,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 hr(t.bag,{id:t.id,field:t.field,fieldDisplayName:(r=t.fieldDisplayName)!==null&&r!==void 0?r:t.field,operator:t.operator,valueType:t.valueType,...j("value",t.value),...j("valueField",t.valueField),...j("lookupValue",TI(t.lookupValue)),...j("expression",t.expression),...j("rawExpression",t.rawExpression),...j("valueWorkflowType",t.valueWorkflowType)})}branchItemFromJson(t){return this.isConditionJson(t)?this.conditionFromJson(t):this.actionFromJson(t)}actionFromJson(t){if(!d8.has(t.type))throw new Error(`Unsupported business-rule action type: ${t.type}`);S8(t);let r={kind:"action",id:t.id,displayName:t.displayName,field:t.field,...j("stepName",t.stepName),...j("stepLabels",t.stepLabels)};switch(t.type){case"Recommendation":return hr(t.bag,{...r,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...j("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(v8),...j("recommendationActionStepMeta",t.recommendationActionStepMeta)});case"LockUnlock":return hr(t.bag,{...r,type:"LockUnlock",lock:t.lock});case"ShowErrorMessage":return hr(t.bag,{...r,type:"ShowErrorMessage",errorMessage:t.errorMessage,...j("messageLevel",t.messageLevel),...j("messageActionSteps",t.messageActionSteps)});case"SetFieldValue":return hr(t.bag,{...r,type:"SetFieldValue",...vm(t)});case"SetDefaultValue":return hr(t.bag,{...r,type:"SetDefaultValue",...vm(t)});case"SetBusinessRequired":return hr(t.bag,{...r,type:"SetBusinessRequired",required:t.required});case"SetVisibility":return hr(t.bag,{...r,type:"SetVisibility",visible:t.visible});default:return II(t)}}isConditionJson(t){return Object.prototype.hasOwnProperty.call(t,"clauses")&&Object.prototype.hasOwnProperty.call(t,"logic")&&!Object.prototype.hasOwnProperty.call(t,"type")}};jn.BusinessRuleAdapter=Tu;function OI(e,t,r){(0,xr.optionalEnum)(e,"logic",["AND","OR"],t,"condition-logic-invalid",r),(0,xr.childObjects)(e,"clauses",t,"clause",r);for(let n of["trueBranch","falseBranch"])(0,xr.childObjects)(e,n,t,"branchItem",r).forEach(({node:a,index:o})=>{"clauses"in a||"trueBranch"in a||"falseBranch"in a?OI(a,`${t}/${n}/${o}`,r):E8(a,`${t}/${n}/${o}`,r)})}function E8(e,t,r){e.type==="SetDefaultValue"&&e.valueType==="Clear"&&r.push((0,xr.issue)(`${t}/valueType`,"clear-only-set-field-value","Clear is only supported for SetFieldValue actions."))}function S8(e){if(e.type==="SetDefaultValue"&&e.valueType==="Clear")throw new Error("Clear is only supported for SetFieldValue actions.")}function N8(){return{adapter:new Tu,api:a8.businessRuleApi,publish:(e,t,r)=>(0,EI.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,EI.boundEntityPublishScope)(t)}}jn.businessRuleRegistration=N8});var JI=v(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.appRegistration=Jn.AppAdapter=Jn.HEADER_NAV_BOOLEAN_RULE=void 0;var ln=Fr(),He=In(),fs=ri(),D8=lr(),I8=ml(),ym=cl(),bm=Tn(),_8=pt(),T8=ae(),VI=Ri(),GI=te(),zI=pl();Object.defineProperty(Jn,"HEADER_NAV_BOOLEAN_RULE",{enumerable:!0,get:function(){return zI.HEADER_NAV_BOOLEAN_RULE}});var Fu="7.0.0.0",FI=`<SiteMap IntroducedVersion="${Fu}"></SiteMap>`,xI="/_imgs/imagestrips/transparent_spacer.gif",LI="/_imgs/TableIconsFluentV9/document_one_page_sparkle.svg",P8=["Entity","Url","DefaultDashboard","Page","GenPageId"],ps="sitemapId",kI="sitemapName",O8="sitemapNameUnique",MI="aiDescription",UI="[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}",R8=new RegExp(`^(?:\\{${UI}\\}|${UI})$`);function BI(e,t){if(!R8.test(e.trim()))throw new GI.ValidationError("app",t,[{pointer:"/sitemapId",rule:"app-sitemapid-guid",message:`sitemapId must be a GUID; received '${e}'.`}]);return e.trim()}function $I(e,t,r){if(e===void 0)return r;if(typeof e!="boolean")throw new GI.ValidationError("app",t,[WI(e)]);return e}function WI(e){return(0,ln.issue)("/headerAndNavigationRefresh",zI.HEADER_NAV_BOOLEAN_RULE,`headerAndNavigationRefresh must be a boolean, got ${typeof e}`)}function F8(e){let t=n=>{let i=e[n];return typeof i=="string"&&i.trim()!==""?i.trim():void 0},r=n=>{let i=t(n);if(i!==void 0)try{return(0,T8.normalizeGuid)(i,n)}catch{return}};switch(e.type){case"Entity":return t("entity")&&`Entity:${t("entity").toLowerCase()}`;case"URL":return t("url")&&`URL:${t("url").toLowerCase()}`;case"DashBoard":return r("dashboardId")&&`DashBoard:${r("dashboardId")}`;case"CustomPage":return t("page")&&`CustomPage:${t("page").toLowerCase()}`;case"GenPage":return r("genPageId")&&`GenPage:${r("genPageId")}`;default:return}}var xu=class{constructor(t=VI.DEFAULT_LCID){this.lcid=t}toArtifact(t){let{bag:r,modeledEls:n}=Pu(t,"Area");return{id:"",name:"",uniqueName:"",description:"",siteMap:{areas:n.map(i=>this.areaToJson(i)),bag:r},bag:(0,He.emptyBag)()}}fromArtifact(t){(0,bm.installDomShim)();let r=this.assignMissingIds(JSON.parse(JSON.stringify(t))),n=new DOMParser().parseFromString("<root/>","text/xml"),i=this.rootToRaw(r);return(0,He.rebuildRaw)(i,(0,fs.domEngine)(n),null)}fromApiResponse(t){var r,n,i,a,o,s,l,u,c,d,p;(0,bm.installDomShim)();let f=t??{},m=(r=f.$sitemap)!==null&&r!==void 0?r:f,g=(0,fs.parseXmlRoot)((n=m.sitemapxml)!==null&&n!==void 0?n:FI,FI),y=this.toArtifact(g);return y.id=(i=f.appmoduleid)!==null&&i!==void 0?i:"",y.name=(a=f.name)!==null&&a!==void 0?a:"",y.uniqueName=(o=f.uniquename)!==null&&o!==void 0?o:"",y.description=(s=f.description)!==null&&s!==void 0?s:"",f.aiappdescription&&(y.aiDescription=f.aiappdescription),y.bag={a:[[ps,(u=(l=m.sitemapid)!==null&&l!==void 0?l:f._sitemapid_value)!==null&&u!==void 0?u:""],[kI,(c=m.sitemapname)!==null&&c!==void 0?c:""],[O8,(d=m.sitemapnameunique)!==null&&d!==void 0?d:""],[MI,(p=f.aiappdescription)!==null&&p!==void 0?p:""]],c:[]},y}toApiPayload(t,r){var n,i,a,o,s,l,u,c,d,p,f,m,g,y;(0,bm.installDomShim)();let A=(0,fs.serializeNode)(this.fromArtifact(t)),D=[],F=[];for(let q of(i=(n=t.siteMap)===null||n===void 0?void 0:n.areas)!==null&&i!==void 0?i:[])for(let B of(a=q.groups)!==null&&a!==void 0?a:[])for(let L of(o=B.subAreas)!==null&&o!==void 0?o:[])L.type==="Entity"&&L.entity?D.push(L.entity):L.type==="DashBoard"&&L.dashboardId&&F.push(L.dashboardId);let _=(s=t.bag)!==null&&s!==void 0?s:(0,He.emptyBag)();return{sitemapId:Am(_,ps)||(t.sitemapId?BI(t.sitemapId,t.id):""),sitemapxml:A,sitemapname:Am(_,kI)||t.name,appModuleId:t.id,appModuleName:t.name,appModuleDescription:t.description,...t.aiDescription!==void 0&&t.aiDescription!==(r?r.aiDescription:Am(_,MI))?{appModuleAiDescription:t.aiDescription}:{},appModuleUniqueName:t.uniqueName,...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},...t.headerAndNavigationRefresh===void 0?{}:{appSettings:{[ym.HEADER_AND_NAVIGATION_REFRESH]:$I(t.headerAndNavigationRefresh,(l=t.id)!==null&&l!==void 0?l:"(unknown)",!0)?ym.APP_SETTING_ON:ym.APP_SETTING_OFF}},...typeof t.published=="boolean"?{published:t.published}:{},entities:D,components:{forms:(c=(u=t.components)===null||u===void 0?void 0:u.forms)!==null&&c!==void 0?c:[],views:(p=(d=t.components)===null||d===void 0?void 0:d.views)!==null&&p!==void 0?p:[],charts:(m=(f=t.components)===null||f===void 0?void 0:f.charts)!==null&&m!==void 0?m:[],dashboards:[...(y=(g=t.components)===null||g===void 0?void 0:g.dashboards)!==null&&y!==void 0?y:[],...F]}}}createDefault(t){var r,n,i,a,o,s;let l=!((r=t.siteMap)===null||r===void 0)&&r.areas&&t.siteMap.areas.length>0?t.siteMap.areas:[{id:"",title:"Area",groups:[{id:"",title:"Group",subAreas:[]}]}],u=(n=t.id)!==null&&n!==void 0?n:(0,_8.newId)();return{id:u,name:(i=t.name)!==null&&i!==void 0?i:"New App",uniqueName:(a=t.uniqueName)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",...t.aiDescription?{aiDescription:t.aiDescription}:{},siteMap:{areas:l},...t.sitemapId?{sitemapId:BI(t.sitemapId,u)}:{},...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},headerAndNavigationRefresh:$I(t.headerAndNavigationRefresh,(s=t.id)!==null&&s!==void 0?s:"(new)",!0),...typeof t.published=="boolean"?{published:t.published}:{},...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(Em):Array.isArray(r.areas)?r.areas.forEach(Em):Array.isArray(r.groups)?Em(r):Array.isArray(r.subAreas)?jI(r):"type"in r&&Lu(r,"subarea"),t}validate(t){let r=[],n=t.published;n!==void 0&&typeof n!="boolean"&&r.push((0,ln.issue)("/published","published-must-be-boolean",`published must be a boolean, got ${typeof n}`));let i=t.siteMap,a=t.headerAndNavigationRefresh;if(a!==void 0&&typeof a!="boolean"&&r.push(WI(a)),i==null)return r;if(!(0,ln.isJsonObject)(i))return r.push((0,ln.issue)("/siteMap","sitemap-must-be-object",`siteMap must be a JSON object, got ${typeof i}`)),r;let o=(0,ln.childObjects)(i,"areas","/siteMap","area",r),s=new Map;return o.forEach(({node:l,index:u})=>{let c=`/siteMap/areas/${u}`;(0,ln.childObjects)(l,"groups",c,"group",r).forEach(({node:p,index:f})=>{let m=`${c}/groups/${f}`;(0,ln.childObjects)(p,"subAreas",m,"subArea",r).forEach(({node:y,index:A})=>{let D=`${m}/subAreas/${A}`;(0,ln.optionalEnum)(y,"type",["Entity","URL","DashBoard","CustomPage","GenPage"],D,"subarea-type-invalid",r);let F=F8(y);if(!F)return;let _=s.get(F);if(_===void 0){s.set(F,D);return}r.push((0,ln.issue)(D,"subarea-duplicate-target",`the sitemap already navigates to this target at ${_}; a duplicate SubArea would pin it twice and a single removeElement would leave one behind`))})})}),r}applyServerIdentity(t,r){let n=r[ps];if(!n)return;t.bag||(t.bag=(0,He.emptyBag)());let i=t.bag.a.find(a=>a[0]===ps);i?i[1]=n:t.bag.a.push([ps,n])}areaToJson(t){var r;let{bag:n,modeledEls:i}=Pu(t,"Group"),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:wm(t,this.lcid),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}=Pu(t,"SubArea");return{id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:wm(t,this.lcid),subAreas:i.map(a=>this.subAreaToJson(a)),bag:n}}subAreaToJson(t){var r;let{bag:n}=Pu(t,null),i=x8(t),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",type:i,title:wm(t,this.lcid),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!==xI&&(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,He.emptyBag)(),l=Ou(o)?[["IntroducedVersion",Fu]]:[],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,He.mergeAttrs)(o.a,l),c:(0,He.spliceChildren)(o.c,u)}}areaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,He.emptyBag)(),i=Ou(n),a=[],o=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ShowGroups","true"],["ResourceId","SitemapDesigner.NewTitle"],["DescriptionResourceId","SitemapDesigner.NewTitle"],["IntroducedVersion",Fu]),t.icon!==void 0?a.push(["Icon",t.icon]):Ru(n.a,"Icon")&&o.push("Icon"),t.vectorIcon!==void 0?a.push(["VectorIcon",t.vectorIcon]):Ru(n.a,"VectorIcon")&&o.push("VectorIcon");let s=t.groups.map(u=>this.groupToRaw(u)),l=Cm((0,He.spliceChildren)(n.c,s),t.title,i,this.lcid);return{n:"Area",a:(0,He.mergeAttrs)(n.a,a,o),c:l}}groupToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,He.emptyBag)(),i=Ou(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ResourceId","SitemapDesigner.NewGroup"],["DescriptionResourceId","SitemapDesigner.NewGroup"],["ToolTipResourseId","SitemapDesigner.Unknown"],["IntroducedVersion",Fu],["IsProfile","false"]);let o=t.subAreas.map(l=>this.subAreaToRaw(l)),s=Cm((0,He.spliceChildren)(n.c,o),t.title,i,this.lcid);return{n:"Group",a:(0,He.mergeAttrs)(n.a,a),c:s}}subAreaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,He.emptyBag)(),i=Ou(n),a=k8(n.a,t.type),o=[],s=[];t.id&&o.push(["Id",t.id]),U8(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]):Ru(a,"Icon",xI)&&s.push("Icon"),t.vectorIcon!==void 0?o.push(["VectorIcon",t.vectorIcon]):Ru(a,"VectorIcon")?t.type==="GenPage"?o.push(["VectorIcon",LI]):s.push("VectorIcon"):t.type==="GenPage"&&!L8(a,"VectorIcon")&&o.push(["VectorIcon",LI]);let l=Cm((0,He.spliceChildren)(n.c,[]),t.title,i,this.lcid);return{n:"SubArea",a:(0,He.mergeAttrs)(a,o,s),c:l}}};Jn.AppAdapter=xu;function Pu(e,t){let r=(0,fs.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,He.rawFromNode)((0,fs.nodeLikeFromDom)(l))}),o+=1)}return{bag:{a:r,c:n},modeledEls:i}}function qI(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 wm(e,t){var r;let n=qI(e,"Titles")[0];if(!n)return"";let a=qI(n,"Title").find(o=>o.getAttribute("LCID")===String(t));return a&&(r=a.getAttribute("Title"))!==null&&r!==void 0?r:""}function x8(e){return e.getAttribute("GenPageId")?"GenPage":e.getAttribute("Entity")?"Entity":e.getAttribute("Page")?"CustomPage":e.getAttribute("DefaultDashboard")?"DashBoard":"URL"}function Ou(e){return e.a.length===0&&e.c.length===0}function L8(e,t){return e.some(([r])=>r===t)}function Ru(e,t,r){let n=e.find(([a])=>a===t),i=n?.[1];return!!i&&i!==r}function Am(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function k8(e,t){let r=M8(t);return e.filter(([n])=>!P8.includes(n)||r.has(n)).map(n=>[n[0],n[1]])}function M8(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 U8(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 Cm(e,t,r,n){if(!t)return e;let i=e.findIndex(a=>a.n==="Titles");if(i>=0){let a=e.slice();return a[i]=B8(e[i],t,n),a}return r?[$8(t,n),...e]:e}function B8(e,t,r){let n=!1,i=e.c.map(a=>!n&&a.n==="Title"&&q8(a,"LCID")===String(r)?(n=!0,{n:a.n,a:(0,He.mergeAttrs)(a.a,[["Title",t]]),c:a.c}):a);return n||i.unshift(HI(t,r)),{n:e.n,a:e.a.map(a=>[a[0],a[1]]),c:i}}function $8(e,t){return{n:"Titles",a:[],c:[HI(e,t)]}}function HI(e,t){return{n:"Title",a:[["LCID",String(t)],["Title",e]],c:[]}}function q8(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function V8(e){let t="0123456789abcdef",r="";for(let n=0;n<e;n+=1)r+=t[Math.floor(Math.random()*t.length)];return r}function Lu(e,t){e&&(typeof e.id!="string"||e.id.length===0)&&(e.id=`${t}_${V8(8)}`)}function Em(e){var t;Lu(e,"area");for(let r of(t=e.groups)!==null&&t!==void 0?t:[])jI(r)}function jI(e){var t;Lu(e,"group");for(let r of(t=e.subAreas)!==null&&t!==void 0?t:[])Lu(r,"subarea")}function G8(e=VI.DEFAULT_LCID){return{adapter:new xu(e),api:I8.appApi,languageSensitive:!0,publish:(t,r)=>(0,D8.publishAppModule)(t,r),publishScope:t=>({envelope:"appmodule",targetIds:[t]})}}Jn.appRegistration=G8});var QI={};zr(QI,{ActionType:()=>Nm,AppActionOrigin:()=>Fm,AppActionVisibilityType:()=>Rm,ButtonType:()=>Im,CannotUpdateAppActionColumns:()=>z8,Context:()=>Tm,IconType:()=>Dm,Location:()=>_m,OnClickEventType:()=>Om,Scope:()=>Pm,VisibilityType:()=>Sm});var Sm,Nm,Dm,Im,_m,Tm,Pm,Om,Rm,Fm,z8,KI=I(()=>{"use strict";(function(e){e[e.NotSupported=0]="NotSupported",e[e.Show=1]="Show",e[e.ClassicRules=2]="ClassicRules",e[e.Expression=3]="Expression"})(Sm||(Sm={}));(function(e){e[e.NotSupported=0]="NotSupported",e[e.None=1]="None",e[e.JavaScript=2]="JavaScript",e[e.Expression=3]="Expression"})(Nm||(Nm={}));(function(e){e[e.NoIcon=0]="NoIcon",e[e.UseIcon=1]="UseIcon",e[e.UseWebResource=2]="UseWebResource"})(Dm||(Dm={}));(function(e){e[e.Standard=0]="Standard",e[e.Dropdown=1]="Dropdown",e[e.Split=2]="Split",e[e.Group=3]="Group"})(Im||(Im={}));(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"})(_m||(_m={}));(function(e){e[e.All=0]="All",e[e.Entity=1]="Entity"})(Tm||(Tm={}));(function(e){e[e.App=0]="App",e[e.Entity=1]="Entity",e[e.Global=2]="Global"})(Pm||(Pm={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.JavaScript=2]="JavaScript"})(Om||(Om={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.ClassicRules=2]="ClassicRules"})(Rm||(Rm={}));(function(e){e[e.Default=0]="Default",e[e.Migrated=1]="Migrated",e[e.MigratedClone=2]="MigratedClone"})(Fm||(Fm={}));z8=["appactionid","appmoduleid","context","contextvalue","location","name","type","uniquename","isdisabled","origin"]});var e2=v(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.commandApi=void 0;var XI=qt(),gr=be(),ZI=te(),Kt=ae(),W8="OnClickEventJavaScriptWebResourceId($select=name,webresourceid),IconWebResourceId($select=name,webresourceid)";async function ku(e,t){let r=`/EntityDefinitions(LogicalName='${(0,Kt.odataPathLiteral)(t)}')${(0,Kt.odataQuery)([["$select","MetadataId"]])}`,i=(0,gr.ensureSuccess)(await e.get(r),e.apiUrl(r)).body,a=i?.MetadataId;return a?(0,Kt.normalizeGuid)(a,"entityMetadataId"):""}Mu.commandApi={async get(e,t){let r=t,n=await ku(e,r),i=n?`_contextentity_value eq ${n}`:`contextvalue eq '${(0,Kt.odataLiteral)(r)}'`,a=`/appactions${(0,Kt.odataQuery)([["$expand",W8],["$filter",i]])}`,o,s=await(0,XI.collectPages)(e,a,"fetchArtifact('command')",c=>{o=c}),l={entityLogicalName:r,entityMetadataId:n,appActions:s},u={};for(let c of s){let d=typeof c.appactionid=="string"?c.appactionid:void 0;if(d){let p=c["@odata.etag"];u[(0,Kt.normalizeGuid)(d,"appactionid")]=typeof p=="string"?p:null}}return{raw:l,etag:o?(0,gr.readEtag)(o):null,memberEtags:u}},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 ku(e,r.entityLogicalName);return YI(e,{...r,entityMetadataId:n},!1)},async update(e,t,r,n,i){let a=r,o=a.entityMetadataId||await ku(e,a.entityLogicalName);return YI(e,{...a,entityMetadataId:o},!0,i)},async delete(e,t){let r=await ku(e,t),n=r?`_contextentity_value eq ${r}`:`contextvalue eq '${(0,Kt.odataLiteral)(t)}'`,i=`/appactions${(0,Kt.odataQuery)([["$select","appactionid"],["$filter",n]])}`,a=await(0,XI.collectPages)(e,i,"deleteArtifact('command')");for(let o of a)o.appactionid&&await(0,gr.deleteRecord)(e,"appactions",o.appactionid)}};async function YI(e,t,r,n){let i=t.entityMetadataId?(0,Kt.normalizeGuid)(t.entityMetadataId,"entityMetadataId"):"",a=j8(t.rows),o={};try{await H8(e,t,a,i,r,n,o)}catch(s){throw(0,ZI.withPartialTokens)(s,{memberEtags:o})}return{id:t.entityLogicalName,etag:null,memberEtags:o}}async function H8(e,t,r,n,i,a,o){var s,l,u;for(let c of r)if(i&&c.exists){let d=(0,Kt.normalizeGuid)(c.appactionid,"id"),p=(s=a?.[d])!==null&&s!==void 0?s:c.etag,f=(0,gr.echoWrite)("appactionid",p?{"If-Match":p}:void 0),m=`/appactions(${d})${f.query}`,g=(0,gr.ensureSuccess)(await e.patch(m,c.body,f.options),e.apiUrl(m));o[d]=(0,gr.readEtag)(g)}else{let d=(0,gr.echoWrite)("appactionid"),p=`/appactions${d.query}`,f={...c.body};if(f["[email protected]"]===void 0){if(!n)throw new ZI.SdkError("COMMAND_CONTEXT_ENTITY_UNRESOLVED",`Cannot create app action '${c.appactionid}' for entity '${t.entityLogicalName}': the entity MetadataId could not be resolved, so the required ContextEntity bind cannot be set. A row written without it is created but is permanently unreadable \u2014 commandApi.get filters on _contextentity_value. Verify the entity logical name exists and is readable, then retry.`);f["[email protected]"]=`/entities(${n})`}let m=(0,gr.ensureSuccess)(await e.post(p,f,d.options),e.apiUrl(p)),g=(0,gr.readCreatedId)(m,"appactionid");g&&(o[(0,Kt.normalizeGuid)(g,"appactionid")]=(0,gr.readEtag)(m))}for(let c of[...(l=t.deletedRowIds)!==null&&l!==void 0?l:[]].reverse()){let d=(0,Kt.normalizeGuid)(c,"id");await(0,gr.deleteRecord)(e,"appactions",d,(u=a?.[d])!==null&&u!==void 0?u:void 0),delete o[d]}}function j8(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 f2=v(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.commandRegistration=ka.CommandAdapter=void 0;var Fe=(KI(),br(QI)),t2=lr(),Xt=Fr(),J8=e2(),Q8=pt(),Ma=ae(),km="$ClientSvg:",Mm=".svg",K8=2,X8=1,Y8=1,i2="entityMetadataId",Z8=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"]),Uu=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 f of l){let m=typeof f._parentappactionid_value=="string"&&f._parentappactionid_value?f._parentappactionid_value:"",g=(i=c.get(m))!==null&&i!==void 0?i:[];g.push(f),c.set(m,g)}let d=new Map;for(let f of(a=c.get(""))!==null&&a!==void 0?a:[]){let m=iG(f.location),g=(o=d.get(m))!==null&&o!==void 0?o:[];g.push(f),d.set(m,g)}let p=[];for(let[f,m]of d)p.push({location:f,groups:tG(m,c,u2(f),u)});return{id:u,entityLogicalName:u,commandBars:nG(p),bag:{a:[[i2,(s=t.entityMetadataId)!==null&&s!==void 0?s:""]]}}}fromArtifact(t){return{entityLogicalName:t.entityLogicalName,entityMetadataId:Bm(t),appActions:xm(t).map(r=>r.row)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t,r){let n=new Set(r?xm(r).map(l=>l.appactionid):[]),i=xm(t,new Set([...n].map(l=>l.toLowerCase()))),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?gG(l.row):p2(l.row)}}),s=[...n].filter(l=>!a.has(l));return{entityLogicalName:t.entityLogicalName,entityMetadataId:Bm(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,Q8.assignMissingIds)(t)}validate(t){let r=[];return(0,Xt.childObjects)(t,"commandBars","","commandBar",r).forEach(({node:i,index:a})=>{let o=`/commandBars/${a}`;(0,Xt.optionalEnum)(i,"location",["MainTab","ContextualTab","HomeTab"],o,"bar-location-invalid",r),(0,Xt.childObjects)(i,"groups",o,"group",r).forEach(({node:l,index:u})=>{let c=`${o}/groups/${u}`;a2(l.bag)||((0,Xt.optionalGuidId)(l,"id",c,"group-id-invalid",r),typeof l.title=="string"&&l.title.length>0&&r.push({pointer:`${c}/title`,rule:"group-toplevel-title-unsupported",message:"a new top-level command group cannot have a title: Dataverse rejects a Group row with no parent (0x80040265). Leave the title empty to hold the commands without creating a group row, or nest them under a FlyoutAnchor control, which supplies the parent a group needs."})),o2((0,Xt.childObjects)(l,"controls",c,"control",r),`${c}/controls`,r)})}),r}};ka.CommandAdapter=Uu;function a2(e){let t=e?.a;return Array.isArray(t)&&t.length>0}function o2(e,t,r){e.forEach(({node:n,index:i})=>{let a=`${t}/${i}`;a2(n.bag)||(0,Xt.optionalGuidId)(n,"id",a,"control-id-invalid",r),(0,Xt.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,Xt.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,Xt.isJsonObject)(n.action)?(0,Xt.optionalEnum)(n.action,"type",["javascript"],`${a}/action`,"action-type-invalid",r):r.push((0,Xt.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,Xt.childObjects)(n,"children",a,"control",r);s.length>0&&o2(s,`${a}/children`,r)})}function Um(e){return{a:Object.entries(e)}}function eG(e){return Object.fromEntries(e.a)}function Bu(e,t){if(e){for(let[r,n]of e.a)if(r===t)return n}}function Bm(e){let t=Bu(e.bag,i2);return typeof t=="string"?t:""}function tG(e,t,r,n){var i,a;let o=[],s=[];for(let l of qu(e))l.type===Fe.ButtonType.Group?o.push({id:l2(l.name,n),title:typeof l.grouptitle=="string"?l.grouptitle:"",controls:qu((a=t.get((i=l.appactionid)!==null&&i!==void 0?i:""))!==null&&a!==void 0?a:[]).map(u=>$u(u,t,r,n)),bag:Um(l)}):s.push($u(l,t,r,n));return s.length>0&&o.unshift({id:hG(n,r),title:"",controls:s}),o}function $m(e){let t=e.bag?Bu(e.bag,"appactionid"):void 0;return typeof t=="string"&&t.trim()!==""?t:e.id}function $u(e,t,r,n){var i,a,o,s,l;let u=l2(e.name,n),c={id:u,type:aG(e.type),label:typeof e.buttonlabeltext=="string"?e.buttonlabeltext:"",command:typeof e.appactionid=="string"?e.appactionid:u,bag:Um(e)},d=s2(e);d&&(c.icon=d);let p=rG(e);p&&(c.action=p),typeof e.hidden=="boolean"&&(c.hidden=e.hidden),typeof e.isdisabled=="boolean"&&(c.disabled=e.isdisabled),typeof e.location=="number"&&e.location!==r&&(c.location=e.location);let f=t.get((i=e.appactionid)!==null&&i!==void 0?i:"");if(f&&f.length>0){let m=[],g=[];for(let y of qu(f))if(y.type===Fe.ButtonType.Group){let A=(a=y.appactionid)!==null&&a!==void 0?a:"",D=Um(y);c.flyoutGroupId===void 0&&(c.flyoutGroupId=(o=y.appactionid)!==null&&o!==void 0?o:void 0,c.flyoutGroupBag=D);let F=[];for(let _ of qu((l=t.get((s=y.appactionid)!==null&&s!==void 0?s:""))!==null&&l!==void 0?l:[])){let q=$u(_,t,r,n);m.push(q),F.push($m(q))}g.push({id:A,bag:D,childIds:F})}else m.push($u(y,t,r,n));c.children=m,g.length>1&&(c.flyoutGroups=g)}return c}function s2(e){var t;if(!((t=e.IconWebResourceId)===null||t===void 0)&&t.name)return e.IconWebResourceId.name;if(e.fonticon)return e.fonticon.startsWith(km)?e.fonticon.slice(km.length)+Mm:e.fonticon}function rG(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 r2(e){return typeof e.sequence=="number"?e.sequence:typeof e.buttonsequencepriority=="number"?e.buttonsequencepriority:0}function qu(e){return[...e].sort((t,r)=>r2(t)-r2(r))}function nG(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 l2(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 iG(e){switch(e){case Fe.Location.Form:case Fe.Location.QuickForm:return"MainTab";case Fe.Location.HomePageGrid:case Fe.Location.Dashboard:return"HomeTab";default:return"ContextualTab"}}function u2(e){switch(e){case"MainTab":return Fe.Location.Form;case"HomeTab":return Fe.Location.HomePageGrid;default:return Fe.Location.SubGridStandard}}function aG(e){switch(e){case Fe.ButtonType.Dropdown:return"FlyoutAnchor";case Fe.ButtonType.Split:return"SplitButton";default:return"Button"}}function oG(e){switch(e){case"FlyoutAnchor":return Fe.ButtonType.Dropdown;case"SplitButton":return Fe.ButtonType.Split;default:return Fe.ButtonType.Standard}}function sG(e){var t;return e.bag&&e.bag.a.length>0?!0:((t=e.title)!==null&&t!==void 0?t:"").length>0}function c2(e,t){var r,n,i;return((n=(r=e.bag)===null||r===void 0?void 0:r.a.length)!==null&&n!==void 0?n:0)>0?!0:t.has(((i=e.id)!==null&&i!==void 0?i:"").toLowerCase())}function xm(e,t=new Set){var r,n,i,a;let o=[],s=Bm(e);for(let l of(r=e.commandBars)!==null&&r!==void 0?r:[]){let u=u2(l.location),c=((n=l.groups)!==null&&n!==void 0?n:[]).flatMap(f=>{var m;return(m=f.controls)!==null&&m!==void 0?m:[]}),d=c.length>0&&c.every(f=>!c2(f,t)),p=0;for(let f of(i=l.groups)!==null&&i!==void 0?i:[]){let m;if(sG(f)){let g=uG(f,u,void 0,e,s);o.push(g),m=g.appactionid}for(let g of(a=f.controls)!==null&&a!==void 0?a:[])d2(g,u,m,e,s,o,d?p:void 0,t),p+=1}}return o}function d2(e,t,r,n,i,a,o,s=new Set){var l;let u=lG(e,t,r,n,i,o);a.push(u);let c=(l=e.children)!==null&&l!==void 0?l:[];if(c.length===0&&!(e.flyoutGroups&&e.flyoutGroups.length>0))return;let d=c.every(g=>!c2(g,s)),p=(g,y,A)=>{d2(g,t,y,n,i,a,d?A:void 0,s)},f=e.flyoutGroups;if(f&&f.length>0){let g=new Map(c.map(_=>[$m(_),_])),y=new Set,A=0,D;for(let[_,q]of f.entries()){let B=q.id||(_===0?Lm(u.appactionid):Vm("flyout-group",`${u.appactionid}#${_}`)),L=n2(B,t,u.appactionid,n,i,q.bag);a.push(L);let k=L.appactionid;D===void 0&&(D=k);for(let M of q.childIds){let G=g.get(M);!G||y.has(M)||(y.add(M),p(G,k,A),A+=1)}}let F=D??Lm(u.appactionid);for(let _ of c){let q=$m(_);y.has(q)||(y.add(q),p(_,F,A),A+=1)}return}let m=e.flyoutGroupId||Lm(u.appactionid);a.push(n2(m,t,u.appactionid,n,i,e.flyoutGroupBag));for(let[g,y]of c.entries())p(y,m,g)}function lG(e,t,r,n,i,a){let o=qm(e,t,r,n,i),s=o.row;a!==void 0&&typeof s.sequence!="number"&&(s.sequence=a);let l=s2(s);return e.location!==void 0&&(s.location=e.location),s.type=oG(e.type),s.buttonlabeltext=e.label,dG(s,e.icon,l),fG(s,e.action),pG(s),e.hidden!==void 0&&(s.hidden=e.hidden),e.disabled!==void 0&&(s.isdisabled=e.disabled),{...o,row:s}}function uG(e,t,r,n,i){let a=qm(e,t,r,n,i);return a.row.type=Fe.ButtonType.Group,a.row.grouptitle=e.title,a}function n2(e,t,r,n,i,a){let o=qm({id:e,bag:a},t,r,n,i),s=o.row;return s["[email protected]"]=`/appactions(${(0,Ma.normalizeGuid)(r,"Command flyout group id")})`,s.type=Fe.ButtonType.Group,s.grouptitle===void 0&&(s.grouptitle=""),s.isgrouptitlehidden===void 0&&(s.isgrouptitlehidden=!0),o}function qm(e,t,r,n,i){let a,o,s,l;if(e.bag&&e.bag.a.length>0){a=eG(e.bag),o=!0;let u=Bu(e.bag,"@odata.etag");s=typeof u=="string"?u:null;let c=Bu(e.bag,"appactionid");l=typeof c=="string"&&c?c:e.id}else l=e.id,a=cG(l,t,n,i),o=!1,s=null;return r?a["[email protected]"]=`/appactions(${(0,Ma.normalizeGuid)(r,"Command parent appaction id")})`:o&&typeof a._parentappactionid_value=="string"&&a._parentappactionid_value&&a.type!==Fe.ButtonType.Group&&(a["[email protected]"]=null),delete a._parentappactionid_value,{appactionid:l,exists:o,etag:s,row:a}}function cG(e,t,r,n){let i={appactionid:e,name:`${e}!${e.replace(/-/g,"").slice(0,32)}`,uniquename:"",location:t,context:Fe.Context.Entity,contextvalue:r.entityLogicalName,scope:Fe.Scope.Entity};return n&&(i["[email protected]"]=`/entities(${(0,Ma.normalizeGuid)(n,"Command context entity metadata id")})`),i}function dG(e,t,r){if(t===r){let n=e._iconwebresourceid_value;typeof n=="string"&&n&&!e.fonticon&&(e["[email protected]"]=`/webresourceset(${(0,Ma.normalizeGuid)(n,"Command icon web resource id")})`);return}if(t===void 0){e.fonticon="",e.IconWebResourceId=null;return}e.fonticon=t.toLowerCase().endsWith(Mm)?km+t.slice(0,t.length-Mm.length):t,e.IconWebResourceId=null}function pG(e){let t=(n,i)=>{let a=e[n];if(typeof a!="string"||a.length===0||e[`${i}@odata.bind`]!==void 0)return;let o=(0,Ma.normalizeGuid)(a,`Command ${i}`);e[`${i}@odata.bind`]=`/canvasapps(${o})`};e.onclickeventtype===X8&&t("_onclickeventformulacomponentlibraryid_value","OnClickEventFormulaComponentLibraryId");let r=e.visibilitytype;(!r||r===Y8)&&t("_visibilityformulacomponentlibraryid_value","VisibilityFormulaComponentLibraryId")}function fG(e,t){if(!(!t||t.type!=="javascript")){if(e.onclickeventtype=K8,t.webResourceId){let r=(0,Ma.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 mG(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 Vm(e,t){let r="";for(let n=0;n<4;n+=1)r+=mG(`${n}:${e}:${t}`).toString(16).padStart(8,"0");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function Lm(e){return Vm("flyout-group",e)}function hG(e,t){return Vm("loose-group",`${e}|${t}`)}function p2(e){let t={...e};for(let r of Z8)delete t[r];return t}function gG(e){let t=p2(e);for(let r of Fe.CannotUpdateAppActionColumns)delete t[r];return t}function vG(){return{adapter:new Uu,api:J8.commandApi,publish:(e,t,r)=>(0,t2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,t2.boundEntityPublishScope)(t)}}ka.commandRegistration=vG});var m2=v(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.chartApi=void 0;var yG=qt(),Yt=be(),ms=ae(),bG="savedqueryvisualizationid,name,description,primaryentitytypecode,datadescription,presentationdescription,charttype,type,isdefault",wG="savedqueryvisualizationid,name,primaryentitytypecode,charttype,isdefault";Vu.chartApi={async get(e,t){let n=`/savedqueryvisualizations(${(0,ms.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,ms.odataQuery)([["$select",bG]]),i=(0,Yt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Yt.readEtag)(i)}},async list(e,t){let r=`/savedqueryvisualizations${(0,ms.odataQuery)([["$select",wG],["$filter",t?.entityLogicalName?`primaryentitytypecode eq '${(0,ms.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,yG.collectPages)(e,r,"listArtifacts('chart')")).map(i=>{var a,o;return{type:"chart",id:(a=i.savedqueryvisualizationid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",entityLogicalName:i.primaryentitytypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Yt.echoWrite)("savedqueryvisualizationid"),a=`/savedqueryvisualizations${i.query}`,o=(0,Yt.ensureSuccess)(await e.post(a,(0,Yt.withClientMintedId)({name:n.name,description:n.description,datadescription:n.datadescription,presentationdescription:n.presentationdescription,primaryentitytypecode:n.primaryentitytypecode,charttype:n.charttype,isdefault:n.isdefault},"savedqueryvisualizationid",r),i.options),e.apiUrl(a));return{id:(0,Yt.resolveCreatedId)(o,"savedqueryvisualizationid","chart",r),etag:(0,Yt.readEtag)(o)}},async update(e,t,r,n){let i=r,a=(0,ms.normalizeGuid)(t,"id"),o=(0,Yt.echoWrite)("savedqueryvisualizationid",{"If-Match":(0,Yt.requireEtag)(n,"chart",a)}),s=`/savedqueryvisualizations(${a})${o.query}`,l=(0,Yt.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,datadescription:i.datadescription,presentationdescription:i.presentationdescription},o.options),e.apiUrl(s));return{id:a,etag:(0,Yt.readEtag)(l)}},delete(e,t){return(0,Yt.deleteRecord)(e,"savedqueryvisualizations",t)}}});var R2=v(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.chartRegistration=Ba.ChartAdapter=void 0;var Gm=In(),h2=Fr(),Lr=ri(),g2=lr(),AG=m2(),zm=Tn(),CG=pt(),EG=["Column","StackedColumn","StackedColumn100","Bar","StackedBar","StackedBar100","Area","StackedArea","StackedArea100","Line","Pie","Doughnut","Funnel","Tag"],SG=new Map(EG.map(e=>[e.toLowerCase(),e]));function A2(e){var t;return e&&(t=SG.get(e.toLowerCase()))!==null&&t!==void 0?t:"Column"}function NG(){return'<Chart Palette="BrightPastel"><Series><Series ChartType="Column" ChartArea="Default" /></Series><ChartAreas><ChartArea Name="Default" /></ChartAreas><Legends><Legend Name="Default" /></Legends></Chart>'}function DG(e){var t,r;let n=e.entityLogicalName,i=e.series.map((g,y)=>({alias:`agg_${y}`,series:g})),a=e.categories.map((g,y)=>({alias:`grp_${y}`,category:g})),o=g=>`<attribute alias="${g.alias}" name="${Ua(g.series.attribute)}" aggregate="${Ua(g.series.aggregate)}" />`,s=g=>`<attribute alias="${g.alias}" name="${Ua(g.category.attribute)}" groupby="true"${g.category.dateGrouping?` dategrouping="${Ua(g.category.dateGrouping)}"`:""} />`,l=[],u=new Map,c=(g,y)=>{if(!g){l.push(y);return}let A=u.get(g);A?A.push(y):u.set(g,[y])};i.forEach(g=>c(g.series.relatedEntity,o(g))),a.forEach(g=>c(g.category.relatedEntity,s(g)));let d=[...u.entries()].map(([g,y])=>`<link-entity name="${Ua(g)}">${y.join("")}</link-entity>`).join(""),p=l.join("")+d,f=i.map(g=>`<measurecollection><measure alias="${g.alias}" /></measurecollection>`).join(""),m=(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="${Ua(n)}">${p}</entity></fetch></fetchcollection><categorycollection><category alias="${m}">${f}</category></categorycollection></datadefinition>`}var Gu=class{toArtifact(t){var r,n,i,a,o,s,l;(0,zm.installDomShim)();let u=(r=t.datadescription)!==null&&r!==void 0?r:"",c=(n=t.presentationdescription)!==null&&n!==void 0?n:"",d=(0,Lr.parseXmlRoot)(u,"<datadefinition/>"),p=(0,Lr.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:C2(p),isDefault:(l=t.isdefault)!==null&&l!==void 0?l:!1,series:N2(d),categories:D2(d),presentation:E2(p),dataBag:u?(0,Lr.projectElementBag)(d):void 0,presentationBag:c?(0,Lr.projectElementBag)(p):void 0,rowBag:IG(t.charttype,t.type)}}fromArtifact(t){(0,zm.installDomShim)();let{datadescription:r,presentationdescription:n}=_G(t);return{savedqueryvisualizationid:t.id,name:t.name,description:t.description,primaryentitytypecode:t.entityLogicalName,datadescription:r,presentationdescription:n,charttype:v2(t.rowBag,"charttype"),type:v2(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,zm.installDomShim)();let u=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,CG.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,h2.childObjects)(n,"series","","series",r),(0,h2.childObjects)(n,"categories","","category",r),r}};Ba.ChartAdapter=Gu;function IG(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 v2(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 C2(e){let t=e.getElementsByTagName("Series");for(let r=0;r<t.length;r+=1)if(t[r].getAttribute("ChartType"))return A2(t[r].getAttribute("ChartType"));return"Column"}function E2(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 zu(e){return e.getElementsByTagName("fetch")[0]}function S2(e){let t=new Map;if(!e)return t;let r=e.getElementsByTagName("link-entity");for(let n=0;n<r.length;n+=1){let i=r[n],a=i.getAttribute("name");if(!a)continue;let o=i.getElementsByTagName("attribute");for(let s=0;s<o.length;s+=1){let l=o[s],u=l.getAttribute("alias")||l.getAttribute("name");u&&t.set(u,a)}}return t}function N2(e){let t=zu(e);if(!t)return[];let r=S2(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=A2(c));let d=o.getAttribute("alias");d&&(u.alias=d);let p=d??l,f=r.get(p);f&&(u.relatedEntity=f),i.push(u)}return i}function D2(e){var t;let r=zu(e);if(!r)return[];let n=S2(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 p=d??l,f=n.get(p);f&&(u.relatedEntity=f),a.push(u)}return a}function _G(e){if(!y2(e.dataBag)||!y2(e.presentationBag)){let a=DG(e);return{datadescription:a,presentationdescription:jG(e,a)}}let t=new DOMParser().parseFromString("<root/>","text/xml"),r=b2(e.dataBag,"datadefinition",t),n=b2(e.presentationBag,"Chart",t),i=N2(r);if(!Wm(e.series,i)){let a=Hm(r);TG(t,r,e.series);let o=Hm(r),s=o.length>0?o:e.series.map(()=>"");I2(t,n,s,a,e.chartType)}return Wm(e.categories,D2(r))||PG(t,r,e.categories),e.chartType!==C2(n)&&P2(n,e.chartType),Wm(e.presentation,E2(n))||O2(n,e.presentation),{datadescription:(0,Lr.serializeNode)(r),presentationdescription:(0,Lr.serializeNode)(n)}}function y2(e){return!!e&&(e.c.length>0||e.a.length>0)}function I2(e,t,r,n,i){let a,o=t.childNodes;for(let d=0;d<o.length;d+=1)if(o[d].nodeType===1&&o[d].tagName==="Series"){a=o[d];break}a||(a=e.createElement("Series"),t.insertBefore(a,t.firstChild));let s=[],l=a.childNodes;for(let d=0;d<l.length;d+=1)l[d].nodeType===1&&l[d].tagName==="Series"&&s.push(l[d]);let u=new Map;n.forEach((d,p)=>{let f=s[p];if(!f)return;let m=u.get(d);m?m.push(f):u.set(d,[f])});let c=r.map(d=>{let p=u.get(d),f=p&&p.length>0?p.shift():void 0;if(f)return f;let m=e.createElement("Series");m.setAttribute("ChartType",i);let g=s.length>0?s[0].getAttribute("ChartArea"):null;return g&&m.setAttribute("ChartArea",g),m});for(let d of s)a.removeChild(d);for(let d of c)a.appendChild(d)}function Hm(e){let t=[],r=e.getElementsByTagName("measure");for(let n=0;n<r.length;n+=1)t.push(r[n].getAttribute("alias")||"");return t}function b2(e,t,r){let n={n:t,a:(0,Gm.mergeAttrs)(e.a,[]),c:(0,Gm.spliceChildren)(e.c,[])};return(0,Gm.rebuildRaw)(n,(0,Lr.domEngine)(r),null)}function TG(e,t,r){let n=zu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||_2(e,t,i,MG(n),r,BG,{aliasPrefix:"aggregate_column",addRef:FG,removeRef:kG})}function PG(e,t,r){let n=zu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||_2(e,t,i,UG(n),r,$G,{aliasPrefix:"groupby_column",addRef:xG,removeRef:LG})}function _2(e,t,r,n,i,a,o){let s=new Map;for(let f of n){let m=f.getAttribute("alias");m&&s.set(m,f)}let l=new Set,u=[],c=(f,m)=>{var g;let y=qG(r,f),A=m.relatedEntity;(y??void 0)!==(A??void 0)&&((g=f.parentNode)===null||g===void 0||g.removeChild(f),w2(e,r,f,A))};for(let f of i){let m=f.alias?s.get(f.alias):void 0;m&&!l.has(m)?(a(m,f),c(m,f),l.add(m)):u.push(f)}let d=n.filter(f=>!l.has(f)),p=0;for(let f of u)if(p<d.length){let m=d[p];a(m,f),c(m,f),l.add(m),p+=1}else{let m=e.createElement("attribute"),g=f.alias||RG(t,o.aliasPrefix);m.setAttribute("alias",g),a(m,f),w2(e,r,m,f.relatedEntity),o.addRef(e,t,g)}for(let f of n)if(!l.has(f)){let m=f.getAttribute("alias");m&&o.removeRef(t,m),GG(f)}}function OG(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 RG(e,t){let r=OG(e);if(!r.has(t))return t;for(let n=2;;n+=1){let i=`${t}_${n}`;if(!r.has(i))return i}}function T2(e,t){let r=t.getElementsByTagName("categorycollection")[0];if(r)return r;let n=e.createElement("categorycollection");return t.appendChild(n),n}function FG(e,t,r){let n=T2(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 xG(e,t,r){let n=T2(e,t),i=e.createElement("category");i.setAttribute("alias",r),n.appendChild(i)}function LG(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 kG(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"&&!WG(o)&&((r=o.parentNode)===null||r===void 0||r.removeChild(o))}}function MG(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 UG(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 BG(e,t){e.setAttribute("name",t.attribute),e.setAttribute("aggregate",t.aggregate),t.seriesType&&e.setAttribute("charttype",t.seriesType)}function $G(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 qG(e,t){let r=t.parentNode;for(;r&&r!==e;){let n=r;if(n.nodeType===1&&n.tagName==="link-entity")return n.getAttribute("name")||void 0;r=n.parentNode}}function w2(e,t,r,n){n?VG(e,t,n).appendChild(r):t.appendChild(r)}function VG(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 GG(e){let t=e.parentNode;if(t&&(t.removeChild(e),t.tagName==="link-entity"&&!zG(t))){let r=t.parentNode;r&&r.removeChild(t)}}function zG(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 WG(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1)if(t[r].nodeType===1)return!0;return!1}function P2(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(!HG(r[i])){r[i].setAttribute("ChartType",t);return}}}function HG(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 O2(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 jG(e,t){let r=(0,Lr.parseXmlRoot)(NG(),"<Chart/>");P2(r,e.chartType),O2(r,e.presentation);let n=Hm((0,Lr.parseXmlRoot)(t,"<datadefinition/>"));return n.length>0&&I2(r.ownerDocument,r,n,n.slice(0,1),e.chartType),(0,Lr.serializeNode)(r)}function Wm(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Ua(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function JG(){return{adapter:new Gu,api:AG.chartApi,publish:(e,t,r)=>(0,g2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,g2.boundEntityPublishScope)(t)}}Ba.chartRegistration=JG});var F2=v(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.dashboardApi=void 0;var QG=qt(),Zt=be(),hs=ae(),KG="formid,name,description,formxml,type,objecttypecode,istabletenabled,iscustomizable,componentstate,versionnumber",XG="formid,name,type,objecttypecode",YG=0,ZG=10;Wu.dashboardApi={async get(e,t){let n=`/systemforms(${(0,hs.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,hs.odataQuery)([["$select",KG]]),i=(0,Zt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Zt.readEtag)(i)}},async list(e,t){let r=[`(type eq ${YG} or type eq ${ZG})`];t?.entityLogicalName&&r.push(`objecttypecode eq '${(0,hs.odataLiteral)(t.entityLogicalName)}'`);let n=`/systemforms${(0,hs.odataQuery)([["$select",XG],["$filter",r.join(" and ")]])}`;return(await(0,QG.collectPages)(e,n,"listArtifacts('dashboard')")).map(a=>{var o,s;return{type:"dashboard",id:(o=a.formid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.objecttypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Zt.echoWrite)("formid"),a=`/systemforms${i.query}`,o={name:n.name,description:n.description,formxml:n.formxml,istabletenabled:n.istabletenabled,type:n.type};n.objecttypecode&&(o.objecttypecode=n.objecttypecode);let s=(0,Zt.ensureSuccess)(await e.post(a,(0,Zt.withClientMintedId)(o,"formid",r),i.options),e.apiUrl(a));return{id:(0,Zt.resolveCreatedId)(s,"formid","dashboard",r),etag:(0,Zt.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,hs.normalizeGuid)(t,"id"),o=(0,Zt.echoWrite)("formid",{"If-Match":(0,Zt.requireEtag)(n,"dashboard",a)}),s=`/systemforms(${a})${o.query}`,l=(0,Zt.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,formxml:i.formxml,istabletenabled:i.istabletenabled},o.options),e.apiUrl(s));return{id:a,etag:(0,Zt.readEtag)(l)}},delete(e,t){return(0,Zt.deleteRecord)(e,"systemforms",t)}}});var W2=v(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.dashboardRegistration=kr.TILE_CLASS_ID=kr.DashboardAdapter=void 0;var vs=In(),er=ri(),jm=lr(),gs=Fr(),e6=F2(),Jm=Tn(),Ci=pt(),B2=ae(),$2=Ri(),x2="0",Qm="10",t6=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"]]),r6="{3FF9A528-DD50-4ACA-8F10-2E5ED73513AD}",ju=class{constructor(t=$2.DEFAULT_LCID){this.lcid=t}toArtifact(t){var r,n,i,a;(0,Jm.installDomShim)();let o=(r=t.formxml)!==null&&r!==void 0?r:"",s=(0,er.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:n6(t.type),entityLogicalName:t.objecttypecode?t.objecttypecode:null,enabledForMobile:!!t.istabletenabled,layoutType:i6(s),components:L2(s,this.lcid),bag:(0,er.projectElementBag)(s)}}fromArtifact(t){var r;return(0,Jm.installDomShim)(),{formid:t.id,name:t.name,description:t.description,type:t.dashboardType==="Interactive"?Qm:x2,objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",istabletenabled:t.enabledForMobile,formxml:k2(t,this.lcid)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){return{name:t.name,description:t.description,formxml:k2(t,this.lcid),istabletenabled:t.enabledForMobile,type:t.dashboardType==="Interactive"?Qm:x2,objecttypecode:t.entityLogicalName}}createDefault(t){var r,n,i,a,o,s,l,u;(0,Jm.installDomShim)();let c=(0,er.parseXmlRoot)(v6(),"<form/>");return{id:(r=t.id)!==null&&r!==void 0?r:(0,Ci.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:L2(c,this.lcid),bag:(0,er.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,Ci.newId)())}return t}validate(t){let r=[],n=(0,gs.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,gs.isJsonObject)(u)&&r.push((0,gs.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,gs.isJsonObject)(a.position)){let l=ys(a.position);i.has(l)?r.push((0,gs.issue)(`${s}/position`,"component-position-collision",`two components occupy the same dashboard position (${l}); move one to a free cell`)):i.add(l)}}),r}};kr.DashboardAdapter=ju;function n6(e){return String(e??"")===Qm?"Interactive":"Standard"}function i6(e){let t=e?.getAttribute("formLayout")||e?.getAttribute("layoutType"),r=parseInt(t??"",10);return Number.isNaN(r)?0:r}function K(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 L2(e,t){let r=[];return K(e,"tabs").flatMap(i=>K(i,"tab")).forEach((i,a)=>{K(i,"columns").flatMap(s=>K(s,"column")).forEach((s,l)=>{K(s,"sections").flatMap(c=>K(c,"section")).forEach((c,d)=>{a6(c,{tabIndex:a,columnIndex:l,sectionIndex:d},r,t)})})}),r}function a6(e,t,r,n){K(e,"rows").flatMap(a=>K(a,"row")).forEach((a,o)=>{K(a,"cell").forEach((s,l)=>{let u=o6(s,{...t,rowIndex:o,cellIndex:l},n);u&&r.push(u)})})}function o6(e,t,r){var n,i;let a=G2((n=e.getAttribute("id"))!==null&&n!==void 0?n:"");if(a.toLowerCase().startsWith("spacer"))return null;let o=K(e,"control")[0];if(!o)return null;let s=(i=o.getAttribute("classid"))!==null&&i!==void 0?i:"",l=u6(o),u=c6(s,l,o),c=s6(o);return{id:o.getAttribute("id")||a,type:u,name:V2(e,r),classId:s,position:t,colspan:Km(e,"colspan",1),rowspan:Km(e,"rowspan",1),parameters:l,bag:(0,er.projectElementBag)(e),...c?{icProperties:c}:{}}}function q2(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 s6(e){let t=q2(e);return t?(0,er.serializeNode)(t):void 0}function l6(e,t,r){let n=q2(t);if(!r){n&&t.removeChild(n);return}let i=new DOMParser().parseFromString(r,"text/xml").documentElement,a=(0,vs.rebuildRaw)((0,vs.rawFromNode)((0,er.nodeLikeFromDom)(i)),(0,er.domEngine)(e),null);n&&(0,er.serializeNode)(n)===(0,er.serializeNode)(a)||(n?t.replaceChild(a,n):t.appendChild(a))}function V2(e,t){var r,n;let i=K(e,"labels")[0];if(!i)return"";let a=K(i,"label"),o=(r=a.find(s=>s.getAttribute("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return(n=o?.getAttribute("description"))!==null&&n!==void 0?n:""}function u6(e){var t;let r={},n=K(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 c6(e,t,r){var n;let i=t6.get(e.toUpperCase());return i?i==="chart"?t.ChartGridMode==="Chart"?"chart":"list":i==="assistant"&&((n=r.getAttribute("uniqueid"))!==null&&n!==void 0?n:"").toUpperCase()===r6?"assistant":i:"unknown"}function Km(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 G2(e){return e.replace(/^\{/,"").replace(/\}$/,"")}function d6(e,t){let r={n:"form",a:(0,vs.mergeAttrs)(e.bag.a,[]),c:(0,vs.spliceChildren)(e.bag.c,[])};return(0,vs.rebuildRaw)(r,(0,er.domEngine)(t),null)}function k2(e,t){let r=new DOMParser().parseFromString("<root/>","text/xml"),n=d6(e,r);return m6(r,n,e.components,t),p6(r,n,e.components,t),(0,er.serializeNode)(n)}function p6(e,t,r,n){let i=z2(t);for(let a of r)i.has(ys(a.position))||f6(e,t,a,n)}function f6(e,t,r,n){var i,a,o,s;let l=(a=(i=r.position)===null||i===void 0?void 0:i.sectionIndex)!==null&&a!==void 0?a:0,u=y6(t,e,l);for(let G of K(u,"row"))K(G,"cell").some(V=>K(V,"control").length>0)||u.removeChild(G);let c=r.classId||kr.TILE_CLASS_ID[r.type]||kr.TILE_CLASS_ID.iframe,d=r.rowspan&&r.rowspan>0?r.rowspan:4,p=r.bag&&M2(r.bag,"id")?String(M2(r.bag,"id")):Hu((0,Ci.newId)()),f=r.id?Hu(r.id):Hu((0,Ci.newId)()),m=u.parentNode,g=Math.max(1,parseInt(m&&m.getAttribute&&m.getAttribute("columns")||"1",10)||1),y=Math.min(Math.max(1,r.colspan&&r.colspan>0?r.colspan:1),g),A=K(u,"row"),D=A[A.length-1],F=D?K(D,"cell").reduce((G,V)=>G+Km(V,"colspan",1),0):0;(!D||F+y>g)&&(D=e.createElement("row"),u.appendChild(D));let _=e.createElement("cell");_.setAttribute("id",p),_.setAttribute("colspan",String(y)),_.setAttribute("rowspan",String(d)),_.setAttribute("showlabel","true");let q=e.createElement("labels"),B=e.createElement("label");B.setAttribute("description",(o=r.name)!==null&&o!==void 0?o:""),B.setAttribute("languagecode",String(n)),q.appendChild(B),_.appendChild(q);let L=e.createElement("control");L.setAttribute("id",f),L.setAttribute("classid",Hu(c));let k=e.createElement("parameters"),M=(s=r.parameters)!==null&&s!==void 0?s:{};for(let G of Object.keys(M)){let V=(0,B2.createSafeXmlElement)(e,G,"dashboard tile parameter");V.textContent=M[G],k.appendChild(V)}L.appendChild(k),_.appendChild(L),D.appendChild(_)}function M2(e,t){if(!e)return;let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function m6(e,t,r,n){var i;let a=z2(t),o=new Set(r.map(s=>ys(s.position)));for(let s of r){let l=a.get(ys(s.position));if(!l)continue;let u=K(l,"control")[0];u&&(h6(e,l,s.name,n),g6(e,u,s.parameters),U2(l,"colspan",s.colspan),U2(l,"rowspan",s.rowspan),s.icProperties!==void 0&&l6(e,u,s.icProperties))}for(let[s,l]of a)o.has(s)||(i=l.parentNode)===null||i===void 0||i.removeChild(l)}function z2(e){let t=new Map;return K(e,"tabs").flatMap(n=>K(n,"tab")).forEach((n,i)=>{K(n,"columns").flatMap(o=>K(o,"column")).forEach((o,s)=>{K(o,"sections").flatMap(u=>K(u,"section")).forEach((u,c)=>{K(u,"rows").flatMap(p=>K(p,"row")).forEach((p,f)=>{K(p,"cell").forEach((m,g)=>{var y;G2((y=m.getAttribute("id"))!==null&&y!==void 0?y:"").toLowerCase().startsWith("spacer")||K(m,"control")[0]&&t.set(ys({tabIndex:i,columnIndex:s,sectionIndex:c,rowIndex:f,cellIndex:g}),m)})})})})}),t}function ys(e){let t=e??{};return`${t.tabIndex}.${t.columnIndex}.${t.sectionIndex}.${t.rowIndex}.${t.cellIndex}`}function h6(e,t,r,n){if(r===V2(t,n))return;let i=K(t,"labels")[0];i||(i=e.createElement("labels"),t.appendChild(i));let a=K(i,"label").find(o=>o.getAttribute("languagecode")===String(n));a||(a=e.createElement("label"),a.setAttribute("languagecode",String(n)),i.appendChild(a)),a.setAttribute("description",r)}function g6(e,t,r){var n;if(!r)return;let i=Object.keys(r);if(i.length===0)return;let a=K(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,B2.createSafeXmlElement)(e,l,"dashboard component parameter");d.textContent=u,a.appendChild(d)}}}function U2(e,t,r){var n;((n=e.getAttribute(t))!==null&&n!==void 0?n:"")!==String(r)&&e.setAttribute(t,String(r))}function v6(e=2){let t=`{${(0,Ci.newId)()}}`,r=`{${(0,Ci.newId)()}}`,n=`{${(0,Ci.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>`}kr.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 Hu(e){return`{${e.replace(/[{}]/g,"")}}`}function y6(e,t,r){var n;let i=K(e,"tabs").flatMap(u=>K(u,"tab"))[0];if(!i)throw new Error("addDashboardTile: dashboard formxml has no <tab>");let a=K(i,"columns").flatMap(u=>K(u,"column"))[0];if(!a)throw new Error("addDashboardTile: dashboard formxml has no <column>");let o=K(a,"sections").flatMap(u=>K(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=K(s,"rows")[0];return l||(l=t.createElement("rows"),s.appendChild(l)),l}function b6(e=$2.DEFAULT_LCID){return{adapter:new ju(e),api:e6.dashboardApi,languageSensitive:!0,publish:(t,r,n)=>n?.entityLogicalName?(0,jm.publishBoundEntity)(t,n):(0,jm.publishDashboardById)(t,r),publishScope:(t,r)=>r?.entityLogicalName?(0,jm.boundEntityPublishScope)(r):{envelope:"dashboard",targetIds:[t]}}}kr.dashboardRegistration=b6});var X2=v(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.genPageApi=void 0;var K2=qt(),Ne=be(),Ot=ae(),Xm=Sd(),Mr=te();function w6(e){if(ArrayBuffer.isView(e)){let r=e;return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}if(Object.prototype.toString.call(e)==="[object ArrayBuffer]")return new Uint8Array(e);let t=globalThis;if(t.Buffer&&t.Buffer.isBuffer(e)){let r=e;return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}}var Qn="uxagentprojects",qa="uxagentprojectfiles",$a="uxagentprojectid",Ur="uxagentprojectfileid",Ju=`${$a},name`,A6=`${Ur},filename,filetype`;async function Ym(e,t,r,n){var i;let a=`/${t}(${r})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Ot.odataQuery)([["$select",n]]),o=(0,Ne.ensureSuccess)(await e.get(a),e.apiUrl(a));return{row:(i=o.body)!==null&&i!==void 0?i:{},etag:(0,Ne.readEtag)(o)}}async function C6(e,t){let r=`/${qa}(${t})/filecontent/$value`,n=await e.get(r);if(n.status===404)return{status:"unavailable",reason:"unpublished"};(0,Ne.ensureSuccess)(n,e.apiUrl(r));let i=n.body,a=w6(i);if(a)return{status:"available",data:(0,Xm.bytesToBase64)(a)};if(typeof i=="string")return{status:"available",data:(0,Xm.utf8ToBase64)(i)};throw new Mr.SdkError("GENPAGE_CONTENT_UNREADABLE",`Read the content of file '${t}' but the injected HttpClient returned a body this SDK cannot encode (${typeof i}). Return the response as a string, Uint8Array, Buffer, or ArrayBuffer; a byte-returning transport is required to round-trip non-UTF8 assets.`)}async function E6(e,t,r,n){if(!e.supportsBinaryPatch)throw new Mr.SdkError("GENPAGE_CONTENT_WRITE_UNSUPPORTED",`Refusing to push generative-page file '${t}': its content cannot be written because the injected HttpClient does not implement patchRaw(). A Dataverse File column is not writable through a JSON body, so saving the row without its bytes would report success for a page whose source never uploaded.`);let i=`/${qa}(${t})/filecontent`,a=(0,Xm.base64ToBytes)(n);(0,Ot.assertNoControlChars)(r,"generative-page file name"),(0,Ne.ensureSuccess)(await e.patchRaw(i,a,{headers:{"Content-Type":"application/octet-stream","Content-Length":String(a.byteLength),"x-ms-file-name":r}}),e.apiUrl(i))}async function Zm(e,t){let r=`/${qa}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Ot.odataQuery)([["$select",A6],["$filter",`_${$a}_value eq ${t}`]]);return(await(0,K2.collectPages)(e,r,"fetchArtifact('genPage')")).map(i=>({row:i,etag:typeof i["@odata.etag"]=="string"?i["@odata.etag"]:null}))}async function H2(e,t,r){var n;let{etag:i}=await Ym(e,Qn,t,Ju),a={};for(let{row:l,etag:u}of await Zm(e,t))a[(0,Ot.normalizeGuid)(String((n=l[Ur])!==null&&n!==void 0?n:""),Ur)]=u;let o=Object.keys(a),s=!i||o.length!==r.size||o.some(l=>!r.has(l))||Object.values(a).some(l=>!l);return{etag:i,memberEtags:a,mismatch:s}}function j2(e,t){return t.mismatch?{etag:null,memberEtags:{},warnings:[`Generative page '${e}' was written, but its files changed on the server while the write was in progress, so the new concurrency tokens cannot be trusted. The local baseline is now unusable: re-fetch the page before editing it again \u2014 the next push will refuse rather than overwrite blind.`]}:{etag:t.etag,memberEtags:t.memberEtags}}Qu.genPageApi={async get(e,t){var r;let n=(0,Ot.normalizeGuid)(t,"id"),{row:i,etag:a}=await Ym(e,Qn,n,Ju),o=await Zm(e,n),s={},l=[];for(let{row:u,etag:c}of o){let d=(0,Ot.normalizeGuid)(String((r=u[Ur])!==null&&r!==void 0?r:""),Ur);s[d]=c;let p=await C6(e,d);l.push({...u,content:p})}return{raw:{project:i,files:l},etag:a,memberEtags:s}},async list(e,t){let r=`/${Qn}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Ot.odataQuery)([["$select",Ju]]);return(await(0,K2.collectPages)(e,r,"listArtifacts('genPage')")).map(i=>{var a,o;return{type:"genPage",id:String((a=i[$a])!==null&&a!==void 0?a:""),name:String((o=i.name)!==null&&o!==void 0?o:""),isDirty:!1}})},async create(e,t,r){let n=t;J2(e,n);let i=`/${Qn}`,a=(0,Ne.ensureSuccess)(await e.post(i,(0,Ne.withClientMintedId)({name:n.name},$a,r)),e.apiUrl(i)),o=(0,Ne.resolveCreatedId)(a,$a,"generative page",r),s=new Set;for(let l of n.files){let u=await Q2(e,o,l,!0);s.add((0,Ot.normalizeGuid)(u.id,"file id"))}try{return{id:o,...j2(o,await H2(e,o,s))}}catch(l){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was created, but re-reading its concurrency tokens failed (${l instanceof Error?l.message:String(l)}). The local baseline is unusable: re-fetch the page before editing it \u2014 the next push will refuse rather than overwrite blind.`]}}},async update(e,t,r,n,i){let a=r,o=(0,Ot.normalizeGuid)(t,"id");J2(e,a);let s=await Zm(e,o),{etag:l}=await Ym(e,Qn,o,Ju);if(n&&l&&n!==l)throw new Mr.SdkError(Ne.VERSION_CONFLICT_CODE,`Generative page '${o}' changed on the server after it was fetched (baseline ${n}, server ${l}) \u2014 another writer edited it. A page row accepts no If-Match validator, so this push would silently overwrite them. Re-fetch the page and re-apply the edit.`);if(!n||!l)throw new Mr.SdkError(Ne.VERSION_CONFLICT_CODE,`Cannot verify generative page '${o}' before writing: ${n?"the server did not return the page's current token":"no baseline token was recorded"}. This entity accepts no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);let u=new Set(s.map(({row:f})=>{var m;return(0,Ot.normalizeGuid)(String((m=f[Ur])!==null&&m!==void 0?m:""),Ur)})),c=new Set(a.files.map(f=>(0,Ot.normalizeGuid)(f.id,"file id")));if(!i)throw new Mr.SdkError(Ne.VERSION_CONFLICT_CODE,`Cannot verify the files of generative page '${o}' before writing: no child baseline was recorded. These rows accept no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);let d=new Set(Object.keys(i).map(f=>f.toLowerCase()));{for(let m of c)if(!u.has(m)&&d.has(m))throw new Mr.SdkError(Ne.VERSION_CONFLICT_CODE,`Generative-page file '${m}' existed when this page was fetched but is gone from the server now \u2014 another writer deleted it. Refusing to recreate it, because a blind re-create would undo that delete and, for an unpublished page, restore the row WITHOUT its content. Re-fetch the page and re-apply the edit.`);for(let m of u)if(!d.has(m))throw new Mr.SdkError(Ne.VERSION_CONFLICT_CODE,`Generative-page file '${m}' is on the server but absent from this page's baseline \u2014 another writer added it after the page was fetched, so its contents cannot be verified. Refusing to write over or delete it. Re-fetch the page so the addition is part of your baseline.`);let f=new Map(s.map(({row:m,etag:g})=>{var y;return[(0,Ot.normalizeGuid)(String((y=m[Ur])!==null&&y!==void 0?y:""),Ur),g]}));for(let[m,g]of Object.entries(i??{})){let y=m.toLowerCase();if(!u.has(y))continue;let A=f.get(y);if(!g||!A)throw new Mr.SdkError(Ne.VERSION_CONFLICT_CODE,`Cannot verify generative-page file '${y}' before writing: ${g?"the server did not return its current token":"no baseline token was recorded"}. A file row accepts no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);if(g!==A)throw new Mr.SdkError(Ne.VERSION_CONFLICT_CODE,`Generative-page file '${y}' changed on the server after this page was fetched (baseline ${g}, server ${A}) \u2014 another writer edited it. A file row accepts no If-Match validator, so this push would silently overwrite that change. Re-fetch the page and re-apply the edit.`)}}let p=`/${Qn}(${o})`;(0,Ne.ensureSuccess)(await e.patch(p,{name:a.name},{headers:{"If-Match":"*"}}),e.apiUrl(p));for(let f of a.files){let m=(0,Ot.normalizeGuid)(f.id,"file id");await Q2(e,o,f,!u.has(m))}for(let f of u)c.has(f)||await(0,Ne.deleteRecord)(e,qa,f);try{return{id:o,...j2(o,await H2(e,o,c))}}catch(f){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was written, but re-reading its concurrency tokens failed (${f instanceof Error?f.message:String(f)}). The local baseline is now unusable: re-fetch the page before editing it again \u2014 the next push will refuse rather than overwrite blind.`]}}},delete(e,t){return(0,Ne.deleteRecord)(e,Qn,t)}};function J2(e,t){var r;if(((r=t.files)!==null&&r!==void 0?r:[]).some(i=>i.content.status==="available")&&!e.supportsBinaryPatch)throw new Mr.SdkError("GENPAGE_CONTENT_WRITE_UNSUPPORTED","Refusing to write this generative page: it has file content to upload, but the injected HttpClient does not implement patchRaw(). A Dataverse File column is not writable through a JSON body, so proceeding would create the page and its rows and then fail, leaving a page whose source never uploaded.")}async function Q2(e,t,r,n){let i=(0,Ot.normalizeGuid)(r.id,"file id"),a;if(n){let o=`/${qa}`,s=(0,Ne.ensureSuccess)(await e.post(o,(0,Ne.withClientMintedId)({filename:r.name,filetype:r.fileType,[`${$a}@odata.bind`]:`/${Qn}(${t})`},Ur,i)),e.apiUrl(o));a=(0,Ne.readEtag)(s)}else{let o=`/${qa}(${i})`,s=(0,Ne.ensureSuccess)(await e.patch(o,{filename:r.name,filetype:r.fileType},{headers:{"If-Match":"*"}}),e.apiUrl(o));a=(0,Ne.readEtag)(s)}return r.content.status==="available"&&await E6(e,i,r.name,r.content.data),{id:i,etag:a}}});var t_=v(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.genPageRegistration=Ga.GenPageAdapter=void 0;var S6=X2(),N6=lr(),Kn=Fr(),e_=pt(),Y2=2e8;function Z2(e){return typeof e=="string"&&e.trim()!==""?e:(0,e_.newId)()}function Va(e){return(0,Kn.isJsonObject)(e)?e:{}}function D6(e){let t=Va(e);return t.status==="available"&&typeof t.data=="string"?{status:"available",data:t.data}:{status:"unavailable",reason:"unpublished"}}var Ku=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;let i=t,a=Va(i?.project),o=Array.isArray(i?.files)?i.files:[];return{id:String((r=a.uxagentprojectid)!==null&&r!==void 0?r:""),name:String((n=a.name)!==null&&n!==void 0?n:""),files:o.map(s=>{var l,u,c;let d=Va(s);return{id:String((l=d.uxagentprojectfileid)!==null&&l!==void 0?l:""),name:String((u=d.filename)!==null&&u!==void 0?u:""),fileType:Number((c=d.filetype)!==null&&c!==void 0?c:Y2),content:D6(d.content)}})}}toApiPayload(t){var r;return{name:t.name,files:((r=t.files)!==null&&r!==void 0?r:[]).map(n=>({id:n.id,name:n.name,fileType:n.fileType,content:n.content}))}}createDefault(t){var r,n;return{id:Z2(t.id),name:(r=t.name)!==null&&r!==void 0?r:"New page",files:((n=t.files)!==null&&n!==void 0?n:[]).map(i=>{var a,o,s;return{id:Z2(i.id),name:(a=i.name)!==null&&a!==void 0?a:"index.tsx",fileType:(o=i.fileType)!==null&&o!==void 0?o:Y2,content:(s=i.content)!==null&&s!==void 0?s:{status:"available",data:""}}})}}assignMissingIds(t){let r=Va(t);return(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,e_.newId)()),r}validate(t){let r=[],n=t.files;if(n!==void 0&&!Array.isArray(n))return r.push((0,Kn.issue)("/files","files-must-be-array",`files must be an array, got ${typeof n}`)),r;let i=new Map;return(Array.isArray(n)?n:[]).forEach((a,o)=>{let s=`/files/${o}`,l=Va(a),u=typeof l.id=="string"?l.id.trim().toLowerCase():"";if(u==="")r.push((0,Kn.issue)(s,"file-id-required","a generative-page file needs an id"));else{let f=i.get(u);f!==void 0?r.push((0,Kn.issue)(s,"file-id-duplicate",`two files share the id '${l.id}' (also at /files/${f}); a file's id is its identity, so a duplicate makes an edit ambiguous`)):i.set(u,o)}let c=typeof l.name=="string"?l.name:"";(c===""||/[\u0000-\u001F\u007F]/.test(c)||/[\\/]/.test(c))&&r.push((0,Kn.issue)(s+"/name","file-name-invalid",`a file name must be a non-empty single path segment with no control characters or path separators (it is sent as an HTTP header on upload); got '${c}'`));let d=l.content;if(d===void 0){r.push((0,Kn.issue)(s+"/content","file-content-required","content is required: omitting it is indistinguishable from an empty file, and the two have opposite effects on the next push"));return}let p=Va(d);p.status==="available"?typeof p.data!="string"&&r.push((0,Kn.issue)(s+"/content/data","file-content-data-invalid","available content needs base64 `data`")):p.status!=="unavailable"&&r.push((0,Kn.issue)(s+"/content/status","file-content-status-invalid",`content.status must be 'available' or 'unavailable', got ${String(p.status)}`))}),r}};Ga.GenPageAdapter=Ku;function I6(){return{adapter:new Ku,api:S6.genPageApi,publish:(e,t)=>(0,N6.publishGenPageById)(e,t),publishScope:e=>({envelope:"uxagentproject",targetIds:[e]})}}Ga.genPageRegistration=I6});var n_=v(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.reconcileBpfSecurityRoles=void 0;var Yu=be(),Xu=ae(),_6="Global",r_={create:"Create",read:"Read",write:"Write",delete:"Delete"};async function T6(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,Xu.odataPathLiteral)(t)}')?$select=LogicalName,Privileges`,o=(n=(r=(0,Yu.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.Privileges)!==null&&n!==void 0?n:[],s={},l=new Set;return Object.keys(r_).forEach(u=>{let c=o.find(d=>d.PrivilegeType===r_[u]);if(c){let d=(0,Xu.normalizeGuid)(c.PrivilegeId,"PrivilegeId");s[u]=d,l.add(d)}}),{byAccess:s,all:l}}async function P6(e,t){var r,n;let i=`/RetrieveRolePrivilegesRole(RoleId=${t})`,o=(n=(r=(0,Yu.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.RolePrivileges)!==null&&n!==void 0?n:[];return new Set(o.map(s=>(0,Xu.normalizeGuid)(s.PrivilegeId,"PrivilegeId")))}async function O6(e,t,r){if(r.length===0)return;let n={Privileges:r.map(a=>({Depth:_6,PrivilegeId:a}))},i=`/roles(${t})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;(0,Yu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function R6(e,t,r){let n={Privilege:{"@odata.type":"Microsoft.Dynamics.CRM.privilege",privilegeid:r}},i=`/roles(${t})/Microsoft.Dynamics.CRM.RemovePrivilegeRole`;(0,Yu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function F6(e,t,r){var n;if(!r||r.length===0)return;let i=await T6(e,t.toLowerCase());for(let a of r){let o=(0,Xu.normalizeGuid)(a.roleId,"roleId"),s=new Set(((n=a.access)!==null&&n!==void 0?n:[]).map(p=>i.byAccess[p]).filter(p=>!!p)),l=await P6(e,o),u=new Set([...l].filter(p=>i.all.has(p))),c=[...s].filter(p=>!u.has(p)),d=[...u].filter(p=>!s.has(p));await O6(e,o,c);for(let p of d)await R6(e,o,p)}}Zu.reconcileBpfSecurityRoles=F6});var p_=v(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.bpfApi=void 0;var tr=Yn(),x6=qt(),rr=te(),vt=be(),un=ae(),L6=n_(),k6={"Content-Type":"application/json",Accept:"application/json"},ec={...k6,Prefer:"return=representation"},M6=new Set([408,502,503,504]),U6=`category eq ${tr.WorkflowCategory.BusinessProcessFlow} and type eq ${tr.WorkflowTypeCode.Definition} and businessprocesstype eq ${tr.BusinessProcessType.BusinessFlow}`,B6="workflowid,name,description,primaryentity,statecode,category,type,businessprocesstype,processorder",$6="workflowid,name,uniquename,description,primaryentity,statecode,statuscode,category,type,businessprocesstype,processorder,xaml,clientdata",q6=["xaml","name","description","processorder"];async function i_(e,t){var r;if(t.status!=="Active"||!t.securityRoles||t.securityRoles.length===0)return;let n=String((r=t.record.uniquename)!==null&&r!==void 0?r:"");n!==""&&await(0,L6.reconcileBpfSecurityRoles)(e,n,t.securityRoles)}async function d_(e,t,r){let n={statecode:tr.StateCode.Activated,statuscode:tr.StatusCode.Activated},i=`/workflows(${t})`,a={...ec};return r&&(a["If-Match"]=r),(0,vt.ensureSuccess)(await e.patch(i,n,{headers:a}),e.apiUrl(i))}async function a_(e,t,r){return(0,vt.readEtag)(await d_(e,t,r))}function o_(e,t){return new rr.SdkError("BPF_WRITE_NOT_ECHOED",`The ${t} of business process flow '${e}' was applied, but the server returned no concurrency token for it (this environment did not honour 'Prefer: return=representation'), so the next step could not be conditioned on a token this push produced and was NOT sent. `+rc(e))}async function tc(e,t){var r;let n=`/workflows(${t})${(0,un.odataQuery)([["$select","statecode"]])}`,i=(0,vt.ensureSuccess)(await e.get(n),e.apiUrl(n)),a=(r=i.body)===null||r===void 0?void 0:r.statecode,o=Number(a);if(a==null||a===""||!Number.isFinite(o))throw new rr.SdkError("BPF_STATE_UNREADABLE",`Reading the state of business process flow '${t}' answered HTTP ${i.status} without a usable statecode, so whether it is Active cannot be decided.`);return o}async function eh(e,t,r){if(await tc(e,t)!==tr.StateCode.Activated)return{deactivated:!1,etag:null};let n={statecode:tr.StateCode.Draft,statuscode:tr.StatusCode.Draft},i=`/workflows(${t})`,a={...ec};r&&(a["If-Match"]=r);let o;try{o=await e.patch(i,n,{headers:a})}catch(l){return await s_(e,t,l)}if(M6.has(o.status))return await s_(e,t,new rr.SdkError("BPF_DEACTIVATE_OUTCOME_UNKNOWN",`Deactivating business process flow '${t}' answered HTTP ${o.status} from an intermediary, so whether it committed is unknown.`));let s=(0,vt.ensureSuccess)(o,e.apiUrl(i));return{deactivated:!0,etag:(0,vt.readEtag)(s)}}async function s_(e,t,r){let n;try{n=await tc(e,t)}catch{n=void 0}if(n===tr.StateCode.Draft)return{deactivated:!0,etag:null,uncertainCause:r};if(n===tr.StateCode.Activated)throw r;let i=new rr.SdkError("BPF_DEACTIVATE_OUTCOME_UNKNOWN",`Deactivating business process flow '${t}' did not complete, and its state could not be re-read \u2014 it MAY be left DISABLED and needs reconciling. Original failure: ${r instanceof Error?r.message:String(r)}`);throw i.cause=r,i}async function l_(e,t){let r=(0,un.normalizeGuid)(t,"workflowid");try{return await d_(e,r,null),"restored"}catch{try{let n=await tc(e,r);return n===tr.StateCode.Activated?"restored":n===tr.StateCode.Draft?"disabled":"unknown"}catch{return"unknown"}}}function u_(e,t,r,n){let i=`Original failure: ${n instanceof Error?n.message:String(n)}`,a=r==="disabled"?new rr.SdkError("BPF_LEFT_DEACTIVATED",`Business process flow '${e}' was deactivated ${t}, and it could NOT be reactivated \u2014 it is left DISABLED. ${i}`):new rr.SdkError("BPF_REACTIVATE_OUTCOME_UNKNOWN",`Business process flow '${e}' was deactivated ${t}, and whether it was reactivated could not be confirmed \u2014 it MAY be left DISABLED and needs checking. ${i}`);return a.cause=n,a}async function V6(e,t){try{return await tc(e,t),"survived"}catch(r){return r instanceof rr.ConnectionError&&r.statusCode===404?"removed":"unknown"}}async function G6(e,t,r){if(r)try{let{deactivated:n,etag:i}=await eh(e,t,r),a=n?i:r;if(a)return await(0,vt.deleteRecord)(e,"workflows",t,a),"removed"}catch{}return V6(e,t)}function rc(e){return`Adopt the server's copy with fetchArtifact('bpf', '${e}', { overwrite: true }) \u2014 it REPLACES the local copy, so keep any outstanding local changes aside first \u2014 then re-apply them and push.`}function c_(e,t){return new rr.SdkError("BPF_CREATE_NO_TOKEN",`Created business process flow '${e}' but the server returned no concurrency token for it (this environment did not honour 'Prefer: return=representation'), so the next push would have nothing to condition on. ${t} It was NOT rolled back: deleting it without a token could remove an edit made since. ${rc(e)}`)}function z6(e,t){let r=new rr.SdkError("BPF_CREATE_NOT_ROLLED_BACK",`Creating business process flow '${e}' failed part-way, and the rollback could NOT remove it \u2014 it still EXISTS, possibly Active and half-configured. (The rollback deletes only on a token this create produced, so a row somebody has since edited is left in place on purpose; a delete the platform refused or failed leaves it too.) ${rc(e)} Or delete it. Original failure: ${t instanceof Error?t.message:String(t)}`);return r.cause=t,r}function W6(e,t){let r=new rr.SdkError("BPF_CREATE_ROLLBACK_OUTCOME_UNKNOWN",`Creating business process flow '${e}' failed part-way, and whether its rollback removed the process could not be confirmed \u2014 it MAY still exist, possibly Active and half-configured. ${rc(e)} Or delete it. Original failure: ${t instanceof Error?t.message:String(t)}`);return r.cause=t,r}function H6(e,t){let r=new rr.SdkError("BPF_CREATE_REMOVED_AFTER_CONFLICT",`Creating business process flow '${e}' was interrupted: another writer changed it right after it was created, so this push's next step was refused rather than overwrite or activate their edit \u2014 and the process has since been removed. Nothing is left behind and there is nothing to fetch. If the removal was deliberate, stop here; otherwise push again to re-create it at the same id. Original failure: ${t instanceof Error?t.message:String(t)}`);return r.cause=t,r}function j6(e){let t={};for(let r of q6)e[r]!==void 0&&(t[r]=e[r]);return t}nc.bpfApi={async get(e,t){let n=`/workflows(${(0,un.normalizeGuid)(t,"id")})${(0,un.odataQuery)([["$select",$6]])}`,i=(0,vt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,vt.readEtag)(i)}},async list(e,t){let r=[U6];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,un.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,un.odataQuery)([["$select",B6],["$filter",r.join(" and ")]])}`;return(await(0,x6.collectPages)(e,n,"listArtifacts('bpf')")).map(a=>{var o,s;return{type:"bpf",id:(o=a.workflowid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.primaryentity,isDirty:!1}})},async create(e,t){let r=t,n=(0,un.normalizeGuid)(r.record.workflowid,"workflowid"),i="/workflows",a=(0,vt.ensureSuccess)(await e.post(i,r.record,{headers:ec}),e.apiUrl(i)),o=(0,vt.readEtag)(a);if(!o)throw c_(n,r.status==="Active"?"The process EXISTS as Draft and was NOT activated \u2014 an activation that cannot be conditioned on our own write could activate somebody else's edit.":"The process EXISTS as Draft.");let s=o;try{r.status==="Active"&&(s=await a_(e,n,o)),await i_(e,r)}catch(l){let u=await G6(e,n,s);throw u==="survived"?z6(n,l):u==="unknown"?W6(n,l):l instanceof rr.SdkError&&l.code===vt.VERSION_CONFLICT_CODE?H6(n,l):l}if(!s)throw c_(n,"The process EXISTS and IS Active, but its activation returned no token.");return{id:n,etag:s}},async update(e,t,r,n){let i=r,a=(0,un.normalizeGuid)(t,"id"),o=(0,vt.requireEtag)(n,"bpf",a),{deactivated:s,etag:l,uncertainCause:u}=await eh(e,a,o);try{if(u!==void 0)throw u;let c=o;if(s){if(!l)throw o_(a,"deactivation");c=l}let d=`/workflows(${a})`,p=(0,vt.ensureSuccess)(await e.patch(d,j6(i.record),{headers:{...ec,"If-Match":c}}),e.apiUrl(d)),f=(0,vt.readEtag)(p);if(i.status==="Active"){if(!f)throw o_(a,"definition write");f=await a_(e,a,f)}return await i_(e,i),{id:a,etag:f}}catch(c){if(s){let d=await l_(e,a);if(d!=="restored")throw u_(a,"to apply an edit, the edit failed",d,c)}throw c}},async delete(e,t){let r=(0,un.normalizeGuid)(t,"id"),{deactivated:n}=await eh(e,r,null);try{await(0,vt.deleteRecord)(e,"workflows",r)}catch(i){if(n){let a=await l_(e,r);if(a!=="restored")throw u_(r,"so it could be deleted, the delete failed",a,i)}throw i}}}});var Q_=v(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.bpfRegistration=Wa.BpfAdapter=void 0;var ic=Yn(),J6=p_(),th=In(),Ei=ri(),N_=Tn(),Mt=Fr(),Rt=pt(),Br=te(),Q6=100,nh='<?xml version="1.0" encoding="utf-16"?>',f_=1033,D_="mxswa:Workflow",K6="mxswa:ActivityReference.Properties",X6="mcwo:StepLabel",Y6="mcwb:Control",m_="mcwb:Control.ControlDisplayName",I_="mcwb:Control.DataFieldName",__="DataFieldName",h_="ControlDisplayName",T_="Literal",ac="x:Null",g_="x:String",ih="x:Key",ah="DisplayName",sc="Activities",Z6="StepLabels",P_="StageId",O_="StageCategory",R_="NextStageId",F_="ProcessStepId",oh="IsProcessRequired",x_="EntityComposite",L_="StageComposite",k_="StepComposite";function rh(e){return(0,Mt.isJsonObject)(e)?e:{}}function $r(e){if(!e)return[];let t=[],r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];i.nodeType===1&&t.push(i)}return t}function Si(e,t){var r;return(r=$r(e).find(n=>n.tagName===t))!==null&&r!==void 0?r:null}function qr(e){return Si(e,K6)}function yt(e,t){var r;return(r=$r(e).find(n=>n.getAttribute(ih)===t))!==null&&r!==void 0?r:null}function za(e,t){var r;return((r=e.getAttribute("AssemblyQualifiedName"))!==null&&r!==void 0?r:"").includes(t)}function dn(e){var t;return!e||!e.firstChild?"":(t=e.firstChild.nodeValue)!==null&&t!==void 0?t:""}function M_(e,t,r){e.firstChild?e.firstChild.nodeValue=r:e.appendChild(t.createTextNode(r))}function bs(e){var t;let r=(t=e.getAttribute(ah))!==null&&t!==void 0?t:"",n=r.indexOf(": ");return n>=0?r.slice(n+2):r}function U_(e,t){var r;let n=(r=e.getAttribute(ah))!==null&&r!==void 0?r:"",i=n.indexOf(": ");e.setAttribute(ah,i>=0?n.slice(0,i+2)+t:t)}function B_(e,t){let r=yt(e,Z6),n=Si(r,X6);n&&n.setAttribute("Description",t)}function e7(e){let t=yt(e,O_);if(!t||t.tagName===ac)return;let r=dn(t).trim();return r===""?void 0:Number(r)}function t7(e){let t=yt(e,R_);if(!t||t.tagName===ac)return;let r=dn(t).trim();return r===""?void 0:r}function $_(e){let t=q_(e);if(!t)return;let r=G_(t,__,I_);return r===""?void 0:r}function sh(e,t){let r=$r(e);for(;r.length>0;){let n=r.pop();if(n.tagName===t)return n;for(let i of $r(n))r.push(i)}return null}function q_(e){let t=yt(qr(e),sc);return t?sh(t,Y6):null}function V_(e,t){let r=e.attributes;for(let n=0;n<r.length;n+=1)if(r[n].name===t)return!0;return!1}function G_(e,t,r){var n;return V_(e,t)?(n=e.getAttribute(t))!==null&&n!==void 0?n:"":o7(e,r)}function v_(e,t,r,n){if(V_(e,t)){e.setAttribute(t,n);return}if(Si(e,r)){r7(e,r,n);return}throw new Br.InvalidArgumentError(`BPF step control exposes neither a '${t}' attribute nor a <${r}> wrapper to bind a column`)}function r7(e,t,r){let n=Si(e,t),i=n?sh(n,T_):null;i&&i.setAttribute("Value",r)}function z_(e){return bs(e)}function lc(e){let t=Si(e,D_),r=[];for(let n of $r(t).filter(i=>za(i,x_))){let i=yt(qr(n),sc);for(let a of $r(i).filter(o=>za(o,L_)))r.push({el:a,entity:z_(n)})}return r}function lh(e){let t=yt(qr(e),sc);return $r(t).filter(r=>za(r,k_))}function n7(e){let t=qr(e),r=dn(yt(t,oh)).trim().toLowerCase(),n=$_(e),i={id:dn(yt(t,F_)),name:bs(e)};return n!==void 0&&(i.fieldName=n),r==="true"&&(i.required=!0),i}function i7(e,t){let r=qr(e),n=e7(r),i=t7(r),a={id:dn(yt(r,P_)),name:bs(e),entityLogicalName:t,steps:lh(e).map(n7)};return n!==void 0&&(a.category=n),i!==void 0&&(a.nextStageId=i),a}function a7(e){return lc(e).map(({el:t,entity:r})=>i7(t,r))}function cn(e){return new Br.NotImplementedError("bpf-structural-authoring",`${e} is not supported yet (this phase authors identity, stage/step names, step required, step field binding, stage categories, and adding/removing/reordering stages & steps on a single-table process; branching, actions, security-role wiring and multi-table processes land in later phases). The rest of the process round-trips losslessly.`)}function o7(e,t){var r;let n=Si(e,t),i=n?sh(n,T_):null;return(r=i?.getAttribute("Value"))!==null&&r!==void 0?r:""}function uh(e,t){var r;let n=e.createElement(t.tagName),i=t.attributes;for(let o=0;o<i.length;o+=1)n.setAttribute(i[o].name,i[o].value);let a=t.childNodes;for(let o=0;o<a.length;o+=1){let s=a[o];s.nodeType===1?n.appendChild(uh(e,s)):s.nodeType===3&&n.appendChild(e.createTextNode((r=s.nodeValue)!==null&&r!==void 0?r:""))}return n}function W_(e){return yt(qr(e),sc)}function s7(e,t,r){var n;let i=t.entityLogicalName&&t.entityLogicalName.trim()!==""?t.entityLogicalName:r,a=!((n=t.steps[0])===null||n===void 0)&&n.id&&t.steps[0].id.trim()!==""?t.steps[0].id:(0,Rt.newId)(),{body:o}=uc(ch(i,(0,Rt.newId)(),t.id,a));return uh(e,lc((0,Ei.parseXmlRoot)(o,"<Activity/>"))[0].el)}function l7(e,t){let{body:r}=uc(ch("account",(0,Rt.newId)(),(0,Rt.newId)(),t.id));return uh(e,lh(lc((0,Ei.parseXmlRoot)(r,"<Activity/>"))[0].el)[0])}function H_(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(let r of t)e.appendChild(r)}function j_(e,t,r,n){let i=yt(e,r);if(!i||!i.parentNode){if(n!==void 0&&n!=="")throw cn(`setting '${r}' on a stage whose xaml does not expose that slot`);return}let a=i.parentNode;if(n===void 0||n===""){if(i.tagName!==ac){let s=t.createElement(ac);s.setAttribute(ih,r),a.replaceChild(s,i)}return}if(i.tagName===g_){dn(i)!==n&&M_(i,t,n);return}let o=t.createElement(g_);o.setAttribute(ih,r),o.appendChild(t.createTextNode(n)),a.replaceChild(o,i)}function u7(e,t,r){j_(e,t,O_,r===void 0?void 0:String(r))}function c7(e,t,r){j_(e,t,R_,r)}function J_(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(r(e[n])!==t[n])return!1;return!0}function y_(e){return dn(yt(qr(e),P_))}function b_(e){return dn(yt(qr(e),F_))}function w_(e,t,r){var n,i,a,o;let s=qr(e);r.name!==bs(e)&&(U_(e,r.name),B_(s,r.name));let l=dn(yt(s,oh)).trim().toLowerCase()==="true";if(((n=r.required)!==null&&n!==void 0?n:!1)!==l){let u=yt(s,oh);u&&M_(u,t,r.required?"True":"False")}if(((i=r.fieldName)!==null&&i!==void 0?i:"")!==((a=$_(e))!==null&&a!==void 0?a:"")){let u=q_(e);if(!u)throw new Br.InvalidArgumentError("BPF step has no <mcwb:Control> element to bind a column to");let c=(o=r.fieldName)!==null&&o!==void 0?o:"";v_(u,__,I_,c),c!==""&&G_(u,h_,m_)===""&&v_(u,h_,m_,c)}}function A_(e,t,r,n){var i;let a=qr(e);if(!a)throw new Br.InvalidArgumentError("BPF stage composite has no <\u2026ActivityReference.Properties>");if(r.name!==bs(e)&&(U_(e,r.name),B_(a,r.name)),u7(a,t,r.category),c7(a,t,n),r.relationshipName&&r.relationshipName.trim()!=="")throw cn("a stage relationship / table change (multi-table authoring)");if(r.actions&&r.actions.length>0||r.branch)throw cn("stage actions or conditional branching");let o=W_(e);if(!o)throw new Br.InvalidArgumentError("BPF stage has no [Activities] collection");let s=(i=r.steps)!==null&&i!==void 0?i:[];if(s.length===0)throw new Br.InvalidArgumentError(`BPF stage '${r.name}' must have at least one step`);let l=lh(e);if(J_(l,s.map(d=>d.id),b_)){l.forEach((d,p)=>w_(d,t,s[p]));return}let u=new Map(l.map(d=>[b_(d),d]));if($r(o).some(d=>!za(d,k_)))throw cn("adding, removing or reordering steps on a stage that also contains branching or actions");let c=s.map(d=>{var p;return(p=u.get(d.id))!==null&&p!==void 0?p:l7(t,d)});H_(o,c),c.forEach((d,p)=>w_(d,t,s[p]))}function d7(e,t,r){let n=Si(e,D_);if(!n)throw new Br.InvalidArgumentError("BPF xaml has no <mxswa:Workflow> root activity");if(r.globalActions&&r.globalActions.length>0)throw cn("global (process-completed/abandoned) actions");if(!r.stages||r.stages.length===0)throw new Br.InvalidArgumentError("a BPF must have at least one stage");let i=lc(e),a=i.map(p=>p.el);if(J_(a,r.stages.map(p=>p.id),y_)){i.forEach(({el:p,entity:f},m)=>{let g=r.stages[m];if(g.entityLogicalName&&g.entityLogicalName.trim()!==""&&g.entityLogicalName!==f)throw cn(`changing a stage's table ('${g.entityLogicalName}' vs the process's '${f}')`);A_(p,t,g,g.nextStageId)});return}let o=$r(n).filter(p=>za(p,x_));if(o.length!==1)throw cn("adding, removing or reordering stages on a multi-table process");let s=o[0],l=z_(s),u=W_(s);if(!u)throw new Br.InvalidArgumentError("BPF primary entity composite has no [Activities] collection");if($r(u).some(p=>!za(p,L_)))throw cn("adding, removing or reordering stages on a process whose primary composite holds non-stage activities (multi-table nesting or advanced constructs)");for(let p of r.stages)if(p.entityLogicalName&&p.entityLogicalName.trim()!==""&&p.entityLogicalName!==l)throw cn(`a stage on a different table ('${p.entityLogicalName}') than the process primary ('${l}')`);let c=new Map(a.map(p=>[y_(p),p])),d=r.stages.map(p=>{var f;return(f=c.get(p.id))!==null&&f!==void 0?f:s7(t,p,l)});H_(u,d),d.forEach((p,f)=>{let m=f<d.length-1?r.stages[f+1].id:void 0;A_(p,t,r.stages[f],m)})}function uc(e){let t=e.match(/^<\?xml[^>]*\?>\s*/),r=t?t[0]:"";return{prolog:r,body:e.slice(r.length)}}function p7(e){var t,r,n,i,a,o;(0,N_.installDomShim)();let s=(t=e.bag)===null||t===void 0?void 0:t.xaml;if(s){let p=new DOMParser().parseFromString("<root/>","text/xml"),f={n:"Activity",a:(0,th.mergeAttrs)(s.a,[]),c:(0,th.spliceChildren)(s.c,[])};return{root:(0,th.rebuildRaw)(f,(0,Ei.domEngine)(p),null),prolog:(n=(r=e.bag)===null||r===void 0?void 0:r.xamlProlog)!==null&&n!==void 0?n:nh,eol:(a=(i=e.bag)===null||i===void 0?void 0:i.xamlEol)!==null&&a!==void 0?a:"lf"}}let l=e.stages[0],u=(o=l?.steps)===null||o===void 0?void 0:o[0],c=ch(e.entityLogicalName,(0,Rt.newId)(),l?.id&&l.id.trim()!==""?l.id:(0,Rt.newId)(),u?.id&&u.id.trim()!==""?u.id:(0,Rt.newId)()),{body:d}=uc(c);return{root:(0,Ei.parseXmlRoot)(d,"<Activity/>"),prolog:nh,eol:"lf"}}function f7(e){let{root:t,prolog:r,eol:n}=p7(e);d7(t,t.ownerDocument,e);let i=(0,Ei.serializeNode)(t);return n==="crlf"&&(i=i.replace(/\n/g,`\r
+`)),r+i}function m7(e){return e.uniqueName&&e.uniqueName.trim()!==""?e.uniqueName:`new_${(e.name||"businessprocessflow").toLowerCase().replace(/[^a-z0-9]/g,"")||"businessprocessflow"}`}var oc=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;(0,N_.installDomShim)();let i=t,a=typeof i.xaml=="string"?i.xaml:"",o={id:i.workflowid?String(i.workflowid):null,name:String((r=i.name)!==null&&r!==void 0?r:""),entityLogicalName:String((n=i.primaryentity)!==null&&n!==void 0?n:""),status:Number(i.statecode)===1?"Active":"Draft",stages:[]};if(i.uniquename&&(o.uniqueName=String(i.uniquename)),i.description!=null&&i.description!==""&&(o.description=String(i.description)),i.processorder!=null&&i.processorder!==""&&(o.order=Number(i.processorder)),a.trim()!==""){let{prolog:s,body:l}=uc(a),u=(0,Ei.parseXmlRoot)(l,"<Activity/>");o.stages=a7(u),o.bag={xaml:(0,Ei.projectElementBag)(u),xamlProlog:s,xamlEol:/\r\n/.test(a)?"crlf":"lf"}}return o}toApiPayload(t){var r;let n={workflowid:t.id&&t.id.trim()!==""?t.id:(0,Rt.newId)(),name:t.name,uniquename:m7(t),primaryentity:t.entityLogicalName,xaml:f7(t),category:ic.WorkflowCategory.BusinessProcessFlow,type:ic.WorkflowTypeCode.Definition,businessprocesstype:ic.BusinessProcessType.BusinessFlow,scope:ic.WorkflowScope.Organization,processorder:(r=t.order)!==null&&r!==void 0?r:Q6};t.description!==void 0&&(n.description=t.description);let i={record:n,status:t.status};if(t.securityRoles&&t.securityRoles.length>0){if(t.status!=="Active")throw new Br.InvalidArgumentError('securityRoles require the BPF to be Active \u2014 the backing table they grant access to is created on activation; set status to "Active" to wire security roles');i.securityRoles=t.securityRoles}return i}createDefault(t){var r,n,i;let a=t.stages&&t.stages.length>0?t.stages.map(E_):[E_({id:(0,Rt.newId)(),name:"New Stage",steps:[]})],o={id:t.id&&t.id.trim()!==""?t.id:(0,Rt.newId)(),name:(r=t.name)!==null&&r!==void 0?r:"New business process flow",entityLogicalName:(n=t.entityLogicalName)!==null&&n!==void 0?n:"",status:(i=t.status)!==null&&i!==void 0?i:"Draft",stages:a};return t.uniqueName&&(o.uniqueName=t.uniqueName),t.description!==void 0&&(o.description=t.description),t.order!==void 0&&(o.order=t.order),t.globalActions!==void 0&&(o.globalActions=t.globalActions),t.securityRoles!==void 0&&(o.securityRoles=t.securityRoles),o}assignMissingIds(t){let r=rh(t);(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,Rt.newId)());for(let n of["stages","steps","actions","globalActions"]){let i=r[n];Array.isArray(i)&&i.forEach(a=>this.assignMissingIds(a))}return r}validate(t){let r=[],n=t.stages;if(n!==void 0&&!Array.isArray(n))return r.push((0,Mt.issue)("/stages","stages-must-be-array",`stages must be an array, got ${typeof n}`)),r;let i=Array.isArray(n)?n:[];i.length>30&&r.push((0,Mt.issue)("/stages","too-many-stages",`a BPF allows at most 30 stages, got ${i.length}`));let a=new Set,o=new Map;i.forEach((l,u)=>{let c=`/stages/${u}`,d=rh(l),p=typeof d.id=="string"?d.id.trim():"";p===""?r.push((0,Mt.issue)(`${c}/id`,"stage-id-required","a stage needs an id")):o.has(p.toLowerCase())?r.push((0,Mt.issue)(`${c}/id`,"stage-id-duplicate",`two stages share the id '${l.id}' (also at /stages/${o.get(p.toLowerCase())})`)):o.set(p.toLowerCase(),u),typeof l.entityLogicalName=="string"&&l.entityLogicalName!==""&&a.add(l.entityLogicalName);let f=Array.isArray(l.steps)?l.steps:[];f.length===0&&r.push((0,Mt.issue)(`${c}/steps`,"stage-needs-step","a BPF stage must have at least one step")),f.length>30&&r.push((0,Mt.issue)(`${c}/steps`,"too-many-steps",`a stage allows at most 30 steps, got ${f.length}`));let m=new Map;f.forEach((g,y)=>{let A=`${c}/steps/${y}`,D=typeof rh(g).id=="string"?g.id.trim():"";D===""?r.push((0,Mt.issue)(`${A}/id`,"step-id-required","a step needs an id")):m.has(D.toLowerCase())?r.push((0,Mt.issue)(`${A}/id`,"step-id-duplicate",`two steps in this stage share the id '${g.id}'`)):m.set(D.toLowerCase(),y)}),l.branch&&!C_(i,l.branch.nextStageId)&&r.push((0,Mt.issue)(`${c}/branch/nextStageId`,"branch-target-unknown",`branch nextStageId '${l.branch.nextStageId}' does not match any stage id`)),typeof l.nextStageId=="string"&&l.nextStageId!==""&&!C_(i,l.nextStageId)&&r.push((0,Mt.issue)(`${c}/nextStageId`,"next-stage-unknown",`nextStageId '${l.nextStageId}' does not match any stage id`))}),a.size>5&&r.push((0,Mt.issue)("/stages","too-many-tables",`a BPF spans at most 5 tables, got ${a.size}`));let s=h7(i);return s>=0&&r.push((0,Mt.issue)(`/stages/${s}/nextStageId`,"next-stage-cycle","the stage nextStageId links form a cycle; the flow must be acyclic")),r}};Wa.BpfAdapter=oc;function h7(e){let t=new Map(e.map(r=>[r.id,r]));for(let r=0;r<e.length;r+=1){let n=new Set,i=e[r];for(;i&&typeof i.nextStageId=="string"&&i.nextStageId!=="";){if(n.has(i.id))return r;n.add(i.id),i=t.get(i.nextStageId)}}return-1}function C_(e,t){return e.some(r=>r.id===t)}function E_(e){var t,r;let n=e.steps&&e.steps.length>0?e.steps.map(S_):[S_({id:(0,Rt.newId)(),name:"New Step"})],i={id:e.id&&e.id.trim()!==""?e.id:(0,Rt.newId)(),name:(t=e.name)!==null&&t!==void 0?t:"New Stage",entityLogicalName:(r=e.entityLogicalName)!==null&&r!==void 0?r:"",steps:n};return e.category!==void 0&&(i.category=e.category),e.nextStageId!==void 0&&(i.nextStageId=e.nextStageId),e.relationshipName!==void 0&&(i.relationshipName=e.relationshipName),e.actions!==void 0&&(i.actions=e.actions),e.branch!==void 0&&(i.branch=e.branch),i}function S_(e){var t;let r={id:e.id&&e.id.trim()!==""?e.id:(0,Rt.newId)(),name:(t=e.name)!==null&&t!==void 0?t:"New Step"};return e.fieldName!==void 0&&(r.fieldName=e.fieldName),e.required!==void 0&&(r.required=e.required),r}function ch(e,t,r,n){return`${nh}<Activity x:Class="XrmWorkflow00000000000000000000000000000000" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mcwb="clr-namespace:Microsoft.Crm.Workflow.BusinessProcessFlowActivities;assembly=Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mcwo="clr-namespace:Microsoft.Crm.Workflow.ObjectModel;assembly=Microsoft.Crm, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxs="clr-namespace:Microsoft.Xrm.Sdk;assembly=Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxswa="clr-namespace:Microsoft.Xrm.Sdk.Workflow.Activities;assembly=Microsoft.Xrm.Sdk.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:srs="clr-namespace:System.Runtime.Serialization;assembly=System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:this="clr-namespace:" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><x:Members><x:Property Name="InputEntities" Type="InArgument(scg:IDictionary(x:String, mxs:Entity))" /><x:Property Name="CreatedEntities" Type="InArgument(scg:IDictionary(x:String, mxs:Entity))" /></x:Members><this:XrmWorkflow00000000000000000000000000000000.InputEntities><InArgument x:TypeArguments="scg:IDictionary(x:String, mxs:Entity)" /></this:XrmWorkflow00000000000000000000000000000000.InputEntities><this:XrmWorkflow00000000000000000000000000000000.CreatedEntities><InArgument x:TypeArguments="scg:IDictionary(x:String, mxs:Entity)" /></this:XrmWorkflow00000000000000000000000000000000.CreatedEntities><mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings><mxswa:Workflow><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EntityComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EntityStep1: ${e}"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.StageComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="StageStep2: New Stage"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.StepComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="StepStep3: New Step"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><Sequence DisplayName="ControlStep4"><mcwb:Control ControlId="${t}" IsSystemControl="False" IsUnbound="False" SystemStepType="0"><mcwb:Control.ClassId><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.ClassId><mcwb:Control.ControlDisplayName><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.ControlDisplayName><mcwb:Control.DataFieldName><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.DataFieldName><mcwb:Control.Parameters><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.Parameters></mcwb:Control></Sequence></sco:Collection><sco:Collection x:TypeArguments="mcwo:StepLabel" x:Key="StepLabels"><mcwo:StepLabel Description="New Step" LabelId="${n}" LanguageCode="${f_}" /></sco:Collection><x:String x:Key="ProcessStepId">${n}</x:String><x:Boolean x:Key="IsProcessRequired">False</x:Boolean></mxswa:ActivityReference.Properties></mxswa:ActivityReference></sco:Collection><sco:Collection x:TypeArguments="mcwo:StepLabel" x:Key="StepLabels"><mcwo:StepLabel Description="New Stage" LabelId="${r}" LanguageCode="${f_}" /></sco:Collection><x:String x:Key="StageId">${r}</x:String><x:Null x:Key="StageCategory" /><x:Null x:Key="NextStageId" /></mxswa:ActivityReference.Properties></mxswa:ActivityReference></sco:Collection><x:Null x:Key="RelationshipName" /><x:Null x:Key="AttributeName" /><x:Boolean x:Key="IsClosedLoop">False</x:Boolean></mxswa:ActivityReference.Properties></mxswa:ActivityReference></mxswa:Workflow></Activity>`}function g7(){return{adapter:new oc,api:J6.bpfApi,languageSensitive:!0}}Wa.bpfRegistration=g7});var K_=v(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.buildRegistrations=void 0;var v7=tD(),y7=yD(),b7=RI(),w7=JI(),A7=f2(),C7=R2(),E7=W2(),S7=t_(),N7=Q_();function D7(e){let t=new Map;return t.set("form",(0,v7.formRegistration)(e)),t.set("view",(0,y7.viewRegistration)()),t.set("businessRule",(0,b7.businessRuleRegistration)()),t.set("app",(0,w7.appRegistration)(e)),t.set("command",(0,A7.commandRegistration)()),t.set("chart",(0,C7.chartRegistration)()),t.set("dashboard",(0,E7.dashboardRegistration)(e)),t.set("genPage",(0,S7.genPageRegistration)()),t.set("bpf",(0,N7.bpfRegistration)()),t}cc.buildRegistrations=D7});var aT=v(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.removeRowSummary=Te.configureRowSummary=Te.buildGptDynamicPrompt=Te.setAppAiFeatures=Te.getAiReadiness=Te.saveSettingValue=Te.retrieveSetting=Te.AI_GATE=void 0;var vr=be(),je=ae(),X_=pt(),pn=te();Te.AI_GATE={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabled",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"EnableNLGridSearch",nlChart:"NLChartVisualizationSetting",summaries:"EnableFormInsights",m365:"m365copilotmodelappenabled"};var tT={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabledOnByDefault",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"NLGridSearchSetting",nlChart:"NLChartDataVisualizationSetting",m365:"m365copilotmodelappenabled"},I7=new Set(Object.entries(Te.AI_GATE).filter(([e,t])=>tT[e]===t).map(([e])=>e)),_7={formFill:{enabled:"2",disabled:"1"},formFillSuggestions:{enabled:"2",disabled:"1"},formFillSmartPaste:{enabled:"2",disabled:"1"},formFillFiles:{enabled:"2",disabled:"1"}};function dh(e){return _7[e]}var dc=1e6;function T7(e,t){let r=dh(t),n=()=>{throw new pn.InvalidArgumentError(`setAppAiFeatures: '${t}' must be a boolean or an integer between 0 and ${dc} (e.g. 0, 1, 2); got '${String(e)}'.`)},i=a=>r?a?r.enabled:r.disabled:a?"1":"0";if(typeof e=="boolean")return i(e);if(typeof e=="number")return!Number.isSafeInteger(e)||e<0||e>dc?n():String(e);if(typeof e=="string"){let a=e.trim(),o=a.toLowerCase();if(o==="true")return i(!0);if(o==="false")return i(!1);if(/^[0-9]+$/.test(a)){let s=a.replace(/^0+(?=[0-9])/,"");return s.length>String(dc).length||Number(s)>dc?n():s}}return n()}function P7(e,t){let r=dh(t);return r?e===r.enabled:e!=="0"}async function O7(e,t){var r,n,i;let a=`/appmodules${(0,je.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,je.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 R7(e,t){var r,n;let i=`/appmodules${(0,je.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,je.odataLiteral)(t)}'`]])}`,a;try{a=await e.get(i)}catch(l){throw new pn.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 pn.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 pn.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 pn.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a row with no appmoduleid.`);return s}var Y_=new WeakMap;async function F7(e,t){var r,n,i;let a=Y_.get(e);if(a||(a=new Map,Y_.set(e,a)),a.has(t))return a.get(t);let o=`/settingdefinitions${(0,je.odataQuery)([["$select","settingdefinitionid"],["$filter",`uniquename eq '${(0,je.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 x7(e,t,r){var n,i;let a=await F7(e,r);if(!t||!a)return;let o=`/appsettings${(0,je.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 L7=4,k7=500,Z_=20,eT=3e4;function M7(e){if(e===void 0)return L7;if(!Number.isFinite(e))throw new pn.InvalidArgumentError(`setAppAiFeatures: verifyAttempts must be a finite integer between 1 and ${Z_}; got ${e}.`);return Math.min(Z_,Math.max(1,Math.floor(e)))}function U7(e){if(e===void 0)return k7;if(!Number.isFinite(e))throw new pn.InvalidArgumentError(`setAppAiFeatures: verifyDelayMs must be a finite number between 0 and ${eT}; got ${e}.`);return Math.min(eT,Math.max(0,Math.floor(e)))}async function B7(e,t,r,n,i,a,o){let s,l,u,c=!1;for(let d=0;d<a;d+=1){d>0&&await new Promise(f=>setTimeout(f,o*d));let p;try{let f=await t();f?(p=await x7(e,f,n),p===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(f){p=void 0,u=f.message}c=p!==void 0,l=p?.exists;try{s=(await pc(e,n,{appUniqueName:r})).value}catch{}if(p?.exists&&p.value===i)return{result:"proven",effectiveValue:p.value,appOverrideExists:!0}}return c?{result:"absent",effectiveValue:s,appOverrideExists:l}:{result:"unverifiable",effectiveValue:s,appOverrideExists:void 0,reason:u}}function rT(e,t,r){if(t===2)return String(e).toLowerCase()==="true";let n=r?dh(r):void 0;return n?e===n.enabled:e!=null&&e!=="0"&&e!==""}async function pc(e,t,r={}){var n,i;let a=[`SettingName='${(0,je.odataPathLiteral)(t)}'`];r.appUniqueName&&a.push(`AppUniqueName='${(0,je.odataPathLiteral)(r.appUniqueName)}'`);let o=`/RetrieveSetting(${a.join(",")})`,l=(i=(n=(0,vr.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}}Te.retrieveSetting=pc;async function nT(e,t,r,n={}){let i={SettingName:t,Value:r};n.appUniqueName&&(i.AppUniqueName=n.appUniqueName),n.solutionUniqueName&&(i.SolutionUniqueName=n.solutionUniqueName),(0,vr.ensureSuccess)(await e.post("/SaveSettingValue",i),e.apiUrl("/SaveSettingValue"))}Te.saveSettingValue=nT;async function $7(e,t={}){let r={};for(let[n,i]of Object.entries(Te.AI_GATE)){let{value:a,dataType:o}=await pc(e,i,t);r[n]={enabled:rT(a,o,n),setting:i,value:a}}return r}Te.getAiReadiness=$7;async function q7(e,t,r,n={}){var i,a;if(!t||!t.trim())throw new pn.InvalidArgumentError("setAppAiFeatures: a non-empty appUniqueName is required (an empty value would write the setting at organization scope, affecting every app).");let o=M7(n.verifyAttempts),s=U7(n.verifyDelayMs),l=[];for(let[g,y]of Object.entries(r)){if(y===void 0)continue;let A=tT[g];A&&l.push({feature:g,setting:A,requestedValue:T7(y,g)})}let u=[],c=n.appModuleId?(0,je.normalizeGuid)(n.appModuleId,"appModuleId"):void 0;if(c){let g=await R7(e,t);if(g&&(0,je.normalizeGuid)(g,"appModuleId")!==c)throw new pn.InvalidArgumentError(`setAppAiFeatures: appModuleId '${c}' does not belong to app '${t}' (which resolves to '${g}'). Settings are written by unique name, so verifying against a different app would report success for a write that never landed.`)}let d,p=async()=>c||(d||(d=await O7(e,t)),d),f=new Map,m=async g=>{if(I7.has(g))return;let y=Te.AI_GATE[g];if(y){if(!f.has(y))try{let{value:A,dataType:D}=await pc(e,y);f.set(y,{enabled:rT(A,D,g),setting:y,value:A})}catch{f.set(y,void 0)}return f.get(y)}};for(let{feature:g,setting:y,requestedValue:A}of l)try{await nT(e,y,A,{appUniqueName:t,solutionUniqueName:n.solutionUniqueName});let D=await B7(e,p,t,y,A,o,s),F={feature:g,setting:y,requestedValue:A,effectiveValue:D.effectiveValue,appOverrideExists:D.appOverrideExists};if(D.result==="proven")u.push({...F,status:"applied"});else if(D.result==="absent"){let _=P7(A,g)?await m(g):void 0;_&&!_.enabled?u.push({...F,status:"skipped",reason:`the write was issued and no app-scope override holding '${A}' was observed for '${y}' after ${o} attempt(s); the org readiness gate '${_.setting}' reads '${_.value}', so an environment admin must enable it before this app can turn the feature on`}):u.push({...F,status:"notPersisted",reason:`the write reported success but no app-scope override holding '${A}' was observed for '${y}' after ${o} attempt(s) \u2014 it reads '${(i=D.effectiveValue)!==null&&i!==void 0?i:""}' for this app (Dataverse can accept an app-scope write without storing it)`})}else u.push({...F,status:"unverified",reason:`the write was issued but could not be confirmed: ${(a=D.reason)!==null&&a!==void 0?a:"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(D){u.push({feature:g,setting:y,requestedValue:A,status:"failed",reason:D.message})}return{applied:u.filter(g=>g.status==="applied").map(g=>g.feature),skipped:u.filter(g=>g.status==="skipped").map(g=>g.feature),notPersisted:u.filter(g=>g.status==="notPersisted").map(g=>g.feature),unverified:u.filter(g=>g.status==="unverified").map(g=>g.feature),failed:u.filter(g=>g.status==="failed").map(g=>g.feature),outcomes:u}}Te.setAppAiFeatures=q7;var V7="GptPowerPrompt",G7='{ "consumptionSource": "Api", "partnerSource": "AIBuilder", "consumptionSourceVersion": "GptApiClient"}';function iT(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:""}}Te.buildGptDynamicPrompt=iT;async function z7(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,je.odataPathLiteral)(t)}')${(0,je.odataQuery)([["$select","MetadataId"]])}`;return(n=(r=(0,vr.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.MetadataId)!==null&&n!==void 0?n:""}async function W7(e,t,r={}){var n,i,a,o,s;let l=`ais_RowSummary_${t.entityLogicalName}`,u=`/aiskillconfigs${(0,je.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,je.odataLiteral)(l)}'`],["$top",1]])}`,c=((i=(n=(0,vr.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,je.odataQuery)([["$select","msdyn_aitemplateid"],["$filter",`msdyn_uniquename eq '${V7}'`],["$top",1]])}`,p=((s=(o=(a=(0,vr.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,f=(0,X_.newId)(),m=(0,X_.newId)(),g=JSON.stringify(iT(t)),y={ModelId:f,RunConfigurationId:m,ModelName:`${t.entityLogicalName} row summary`,TemplateId:p,CustomConfiguration:g,Source:G7,RunConfiguration:""};(0,vr.ensureSuccess)(await e.post("/AIModelPublish",y),e.apiUrl("/AIModelPublish"));try{let A=await z7(e,t.entityLogicalName),D={uniquename:l,description:`${t.entityLogicalName} row summary`,"[email protected]":`/entities(${A})`,"[email protected]":`/msdyn_aimodels(${f})`,aiskill:"RowSummary"},F=(0,vr.ensureSuccess)(await e.post("/aiskillconfigs",D),e.apiUrl("/aiskillconfigs")),_=(0,vr.requireCreatedId)(F,"aiskillconfigid","row-summary skill");return{modelId:f,aiSkillConfigId:_}}catch(A){try{await e.delete(`/msdyn_aimodels(${f})`)}catch{}throw A}}Te.configureRowSummary=W7;async function H7(e,t){var r,n;let i=`ais_RowSummary_${t.entityLogicalName}`,a=`/aiskillconfigs${(0,je.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,je.odataLiteral)(i)}'`],["$top",1]])}`,o=((n=(r=(0,vr.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,vr.ensureSuccess)(await e.delete(s),e.apiUrl(s)),o._aimodel_value){let l=`/msdyn_aimodels(${o._aimodel_value})`;(0,vr.ensureSuccess)(await e.delete(l),e.apiUrl(l))}}Te.removeRowSummary=H7});var oT=v(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.findArtifact=Ha.resolveArtifact=void 0;var bt=ae(),fn=ll(),j7=ml(),J7=be(),Q7=te();async function K7(e,t,r){var n,i,a,o,s,l,u,c,d,p,f,m;switch(t){case"app":{let g=(0,j7.unpublishedAppModulesQuery)("appmoduleid,name,appmoduleidunique",`uniquename eq '${(0,bt.odataLiteral)((n=r.uniqueName)!==null&&n!==void 0?n:"")}'`,1),A=(i=(0,J7.ensureSuccess)(await e.get(g),e.apiUrl(g)).body)===null||i===void 0?void 0:i.value,D=A&&A[0];return D?[{id:String(D.appmoduleid),name:String(D.name),appModuleIdUnique:String(D.appmoduleidunique)}]:[]}case"dashboard":return(await(0,fn.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,bt.odataLiteral)((a=r.name)!==null&&a!==void 0?a:"")}' and type eq 0`,top:10})||[]).map(y=>({id:String(y.formid),name:String(y.name)}));case"command":{let g=await(0,fn.queryRecords)(e,"appaction",{select:["appactionid","buttonlabeltext"],filter:`contextvalue eq '${(0,bt.odataLiteral)((o=r.entity)!==null&&o!==void 0?o:"")}'`,top:1});return g&&g.length?[{id:String(r.entity),entity:String(r.entity)}]:[]}case"form":return(await(0,fn.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,bt.odataLiteral)((s=r.name)!==null&&s!==void 0?s:"")}' and objecttypecode eq '${(0,bt.odataLiteral)((l=r.entity)!==null&&l!==void 0?l:"")}'`,top:10})||[]).map(y=>({id:String(y.formid),name:String(y.name)}));case"chart":return(await(0,fn.queryRecords)(e,"savedqueryvisualization",{select:["savedqueryvisualizationid","name"],filter:`name eq '${(0,bt.odataLiteral)((u=r.name)!==null&&u!==void 0?u:"")}' and primaryentitytypecode eq '${(0,bt.odataLiteral)((c=r.entity)!==null&&c!==void 0?c:"")}'`,top:10})||[]).map(y=>({id:String(y.savedqueryvisualizationid),name:String(y.name)}));case"view":return(await(0,fn.queryRecords)(e,"savedquery",{select:["savedqueryid","name"],filter:`name eq '${(0,bt.odataLiteral)((d=r.name)!==null&&d!==void 0?d:"")}' and returnedtypecode eq '${(0,bt.odataLiteral)((p=r.entity)!==null&&p!==void 0?p:"")}'`,top:10})||[]).map(y=>({id:String(y.savedqueryid),name:String(y.name)}));case"webResource":return(await(0,fn.queryRecords)(e,"webresource",{select:["webresourceid","name"],filter:`name eq '${(0,bt.odataLiteral)((f=r.name)!==null&&f!==void 0?f:"")}'`,top:1})||[]).map(y=>({id:String(y.webresourceid),name:String(y.name)}));case"solution":return(await(0,fn.queryRecords)(e,"solution",{select:["solutionid","uniquename"],filter:`uniquename eq '${(0,bt.odataLiteral)((m=r.uniqueName)!==null&&m!==void 0?m:"")}'`,top:1})||[]).map(y=>({id:String(y.solutionid),name:String(y.uniquename)}));default:return[]}}Ha.resolveArtifact=K7;async function X7(e,t,r){var n,i,a,o,s;let l=(0,bt.odataLiteral)((n=r.name)!==null&&n!==void 0?n:""),u=(0,bt.odataLiteral)((i=r.entity)!==null&&i!==void 0?i:"");if(t==="command"){let m=await(0,fn.queryRecords)(e,"appaction",{select:["appactionid"],filter:`contextvalue eq '${(0,bt.odataLiteral)((a=r.entity)!==null&&a!==void 0?a:"")}'`,top:1});return m&&m.length?String(r.entity):null}let c=Y7(t,l,u,r),d=t!=="app",p=await(0,fn.queryRecords)(e,c.set,{select:[c.idField],filter:c.filter,top:d?2:1});if(d&&p&&p.length>1)throw new Q7.AmbiguousArtifactError(t,(s=(o=r.name)!==null&&o!==void 0?o:r.uniqueName)!==null&&s!==void 0?s:"",p.length);let f=p&&p[0]&&p[0][c.idField];return f!=null?String(f):null}Ha.findArtifact=X7;function Y7(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,bt.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 lT=v(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.seedRecordGraph=void 0;var sT=ll(),Z7=qs(),fc=ae(),ez=te();async function tz(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:(p=>(0,Z7.resolveEntitySetName)(e,p)),c={},d=p=>{var f;return(f=c[p])!==null&&f!==void 0?f:l[p]};for(let p of t){let f=p.entityLogical.toLowerCase(),m=(a=p.matchOn)===null||a===void 0?void 0:a.toLowerCase(),g=[];for(let B of p.records){let L={...B.body};for(let k of(o=B.binds)!==null&&o!==void 0?o:[]){let M=k.parentEntity.toLowerCase(),G=(s=d(M))===null||s===void 0?void 0:s[k.parentIndex];if(!G)throw new ez.InvalidArgumentError(`Cannot resolve bind '${k.navProperty}' on a '${f}' record: parent '${k.parentEntity}'[${k.parentIndex}] has no created id. Seed the parent group before the child, or supply it via options.createdIds.`);let V=(0,fc.assertODataName)(await u(M),`entity set for parent '${k.parentEntity}'`),Ze=(0,fc.normalizeGuid)(G,`parent id for bind '${k.navProperty}'`);L[`${k.navProperty}@odata.bind`]=`/${V}(${Ze})`}g.push(L)}let y=m?g.map(B=>{let L=B[m];return L!=null&&L!==""?String(L):null}):g.map(()=>null),A=new Map;if(m){let B=(0,fc.assertODataName)(m,"RecordGraph matchOn key"),L=[...new Set(y.filter(k=>k!==null))];if(L.length){let k=L.map(G=>`${B} eq '${(0,fc.odataLiteral)(G)}'`).join(" or "),M=await(0,sT.queryRecords)(e,f,{select:[B,`${f}id`],filter:k,top:5e3});for(let G of M??[]){let V=G[B];V!=null&&A.set(String(V).toLowerCase(),String(G[`${f}id`]))}}}let D=[],F=new Map,_=g.map((B,L)=>{let k=y[L];if(k&&A.has(k.toLowerCase()))return null;if(k){let M=k.toLowerCase(),G=F.get(M);if(G!==void 0)return G;let V=D.push(B)-1;return F.set(M,V),V}return D.push(B)-1}),q=D.length?await(0,sT.createRecordsBulk)(e,f,D):[];c[f]=g.map((B,L)=>{let k=y[L];return k&&A.has(k.toLowerCase())?A.get(k.toLowerCase()):q[_[L]]})}return{createdIds:c}}mc.seedRecordGraph=tz});var yT=v(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.getEntityPrivileges=lt.addEntityPrivilegesToRole=lt.deleteSecurityRole=lt.createPersonaRole=lt.createSecurityRole=lt.SDK_ROLE_MARKER=void 0;var yr=be(),Je=ae(),Ut=te(),hc={read:"Read",create:"Create",write:"Write",delete:"Delete",append:"Append",appendTo:"AppendTo",assign:"Assign",share:"Share"},fh={user:"Basic",businessUnit:"Local",parentChild:"Deep",organization:"Global"},uT={user:1,businessUnit:2,parentChild:3,organization:4},ph={user:"CanBeBasic",businessUnit:"CanBeLocal",parentChild:"CanBeDeep",organization:"CanBeGlobal"};lt.SDK_ROLE_MARKER="Authored by @maker-studio/cds-maker-sdk (persona/security role).";function rz(e){return Object.prototype.hasOwnProperty.call(hc,e)?hc[e]:void 0}function nz(e){return Object.prototype.hasOwnProperty.call(fh,e)}var cT=new WeakMap,dT=new WeakMap;async function mT(e,t){var r,n;(0,Je.assertODataName)(t,"entity logical name");let i=cT.get(e);i||(i=new Map,cT.set(e,i));let a=i.get(t);if(a)return a;let o=`/EntityDefinitions(LogicalName='${(0,Je.odataPathLiteral)(t)}')${(0,Je.odataQuery)([["$select","LogicalName,Privileges"]])}`,l=(n=(r=(0,yr.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 Ut.InvalidArgumentError(`Entity '${t}' exposes no privileges (unknown or non-securable entity).`);return i.set(t,l),l}async function iz(e){var t,r,n;let i=dT.get(e);if(i)return i;let a=`/businessunits${(0,Je.odataQuery)([["$select","businessunitid"],["$filter","_parentbusinessunitid_value eq null"],["$top",1]])}`,l=(n=((r=(t=(0,yr.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 Ut.InvalidArgumentError("Could not resolve the root business unit.");let u=(0,Je.normalizeGuid)(l,"businessUnitId");return dT.set(e,u),u}async function hT(e,t){var r;let n=new Map;for(let i of t){if(!i.access||i.access.length===0)throw new Ut.InvalidArgumentError(`Entity '${i.entity}' privilege request has no access levels.`);let a=(r=i.scope)!==null&&r!==void 0?r:"user";if(!nz(a))throw new Ut.InvalidArgumentError(`Unknown privilege scope '${a}' for entity '${i.entity}'.`);let o=await mT(e,i.entity);for(let s of i.access){let l=rz(s);if(!l)throw new Ut.InvalidArgumentError(`Unknown access level '${s}' for entity '${i.entity}'.`);let u=o.find(m=>m.PrivilegeType===l);if(!u)throw new Ut.InvalidArgumentError(`Entity '${i.entity}' does not support '${s}' access.`);let c=ph[a];if(u[c]===!1)throw new Ut.InvalidArgumentError(`Privilege '${u.Name}' on '${i.entity}' does not support the '${a}' scope.`);let d=(0,Je.normalizeGuid)(u.PrivilegeId,"PrivilegeId"),p=n.get(d);if(!p){n.set(d,{privilegeName:u.Name,privilegeType:l,scope:a,entities:new Set([i.entity])});continue}if(p.scope===a){p.entities.add(i.entity);continue}if(!(p.entities.size===1&&p.entities.has(i.entity))){let m=[...p.entities].sort().join(", ");throw new Ut.InvalidArgumentError(`Entities '${m}' 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.`)}p.scope=uT[a]>uT[p.scope]?a:p.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 az(e,t,r,n){if(r.length===0&&!n)return;let i={Privileges:r.map(o=>({Depth:fh[o.scope],PrivilegeId:o.privilegeId}))},a=`/roles(${t})/Microsoft.Dynamics.CRM.ReplacePrivilegesRole`;(0,yr.ensureSuccess)(await e.post(a,i),e.apiUrl(a))}async function pT(e,t,r,n,i){var a,o;let s=`/${t}(${r})/${n}${(0,Je.odataQuery)([["$select","roleid"],["$filter",`roleid eq ${i}`]])}`;return((o=(a=(0,yr.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 oz(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,Je.normalizeGuid)(l,"teamId");if(!await pT(e,"teams",u,"teamroles_association",t)){let c=`/teams(${u})/teamroles_association/$ref`;(0,yr.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,Je.normalizeGuid)(l,"userId");if(!await pT(e,"systemusers",u,"systemuserroles_association",t)){let c=`/systemusers(${u})/systemuserroles_association/$ref`;(0,yr.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}o.push(u)}return{teams:a,users:o}}async function fT(e,t,r){var n,i;let a=`/roles${(0,Je.odataQuery)([["$select","roleid,description,ismanaged"],["$filter",`name eq '${(0,Je.odataLiteral)(t)}' and _businessunitid_value eq ${r}`]])}`,l=((i=(n=(0,yr.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 p;return d.ismanaged!==!0&&((p=d.description)!==null&&p!==void 0?p:"")===lt.SDK_ROLE_MARKER};if(l.some(d=>!u(d)))throw new Ut.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 Ut.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,Je.normalizeGuid)(c,"roleId"):void 0}function sz(e){var t,r;return{teams:((t=e?.teams)!==null&&t!==void 0?t:[]).map(n=>(0,Je.normalizeGuid)(n,"teamId")),users:((r=e?.users)!==null&&r!==void 0?r:[]).map(n=>(0,Je.normalizeGuid)(n,"userId"))}}function gT(e){return e.map(t=>({entity:t.entity,privilegeName:t.privilegeName,privilegeType:t.privilegeType,scope:t.scope}))}async function vT(e,t){var r,n;let i=(r=t.name)===null||r===void 0?void 0:r.trim();if(!i)throw new Ut.InvalidArgumentError("createSecurityRole: a non-empty role name is required.");let a=t.businessUnitId?(0,Je.normalizeGuid)(t.businessUnitId,"businessUnitId"):await iz(e),o=await hT(e,(n=t.privileges)!==null&&n!==void 0?n:[]),s=sz(t.assignTo),l=await fT(e,i,a),u=l!==void 0;if(!l){let d="/roles",p={name:i,description:lt.SDK_ROLE_MARKER,"[email protected]":`/businessunits(${a})`};try{let f=(0,yr.ensureSuccess)(await e.post(d,p),e.apiUrl(d));l=(0,Je.normalizeGuid)((0,yr.requireCreatedId)(f,"roleid","role"),"roleId")}catch(f){let m;try{m=await fT(e,i,a)}catch{m=void 0}if(!m)throw f;l=m}}await az(e,l,o,u);let c=await oz(e,l,s);return{roleId:l,name:i,reused:u,appliedPrivileges:gT(o),assignedTeams:c.teams,assignedUsers:c.users}}lt.createSecurityRole=vT;async function lz(e,t){var r,n;let i=(r=t.persona)===null||r===void 0?void 0:r.trim();if(!i)throw new Ut.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 vT(e,{name:i,businessUnitId:t.businessUnitId,privileges:a,assignTo:t.assignTo})}lt.createPersonaRole=lz;async function uz(e,t){let n=`/roles(${(0,Je.normalizeGuid)(t,"roleId")})`;(0,yr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}lt.deleteSecurityRole=uz;async function cz(e,t,r){let n=(0,Je.normalizeGuid)(t,"roleId");if(r.length===0)throw new Ut.InvalidArgumentError("addEntityPrivilegesToRole requires at least one entity privilege (an empty grant would be a silent no-op).");let i=await hT(e,r),a={Privileges:i.map(s=>({Depth:fh[s.scope],PrivilegeId:s.privilegeId}))},o=`/roles(${n})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;return(0,yr.ensureSuccess)(await e.post(o,a),e.apiUrl(o)),gT(i)}lt.addEntityPrivilegesToRole=cz;var dz=new Map(Object.keys(hc).map(e=>[hc[e],e]));async function pz(e,t){return(await mT(e,t)).map(n=>{let i=Object.keys(ph).filter(o=>n[ph[o]]!==!1),a=dz.get(n.PrivilegeType);return{name:n.Name,privilegeId:n.PrivilegeId,privilegeType:n.PrivilegeType,...a?{access:a}:{},scopes:i}})}lt.getEntityPrivileges=pz});var DT=v(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.createMakerSdk=Bt.MakerSdk=Bt.PUSH_NOT_ATTEMPTED_CODE=Bt.ALREADY_EXISTS_CODE=void 0;var bT=kc(),ee=te(),nr=Rs(),fz=kg(),NT=Vg(),ws=Jg(),mz=Uc(),hz=f0(),mh=m0(),Qe=qs(),wT=Cd(),mn=ll(),gc=qv(),ja=cl(),gz=pl(),ut=Jv(),vz=xd(),yz=K_(),bz=pt(),wz=Ri(),hn=gm(),AT=qc(),Az=3e5,Vr=be(),Xn=ae(),Ja=aT(),CT=oT(),Cz=lT(),Ez=Lf(),As=yT();function Sz(e){let t=e.workspaceStorage;if(t==null)throw new Error("createMakerSdk requires a workspaceStorage. Node callers can build one with `createNodeWorkspaceStorage(path)` from '@maker-studio/cds-maker-sdk/node'; a host with no filesystem implements WorkspaceStorage directly.");return new NT.WorkspaceManager(Nz,e.instanceUrl,(0,mz.assertStorageContract)(t))}Bt.ALREADY_EXISTS_CODE="ARTIFACT_ALREADY_EXISTS";Bt.PUSH_NOT_ATTEMPTED_CODE="PUSH_NOT_ATTEMPTED";var Nz="<injected workspaceStorage>",vc=class{constructor(t){var r,n;this.artifactLocks=new Map,this.languageCode=(r=t.languageCode)!==null&&r!==void 0?r:wz.DEFAULT_LCID,this.cacheStalenessMs=(n=t.cacheStalenessMs)!==null&&n!==void 0?n:Az,this.workspace=Sz(t),this.versions=new ws.VersionManager(this.workspace),this.dataverse=new hz.DataverseClient(t.instanceUrl,t.httpClient,t.solutionUniqueName),this.registrations=(0,yz.buildRegistrations)(this.languageCode)}async initWorkspace(){await this.workspace.init()}async getManifest(){return this.workspace.getManifest()}async cleanWorkspace(){await this.workspace.clean()}withArtifactLock(t,r,n){var i;let a=`${t}\0${(0,NT.canonicalArtifactId)(r)}`,s=((i=this.artifactLocks.get(a))!==null&&i!==void 0?i:Promise.resolve()).then(n,n),l=s.then(()=>{},()=>{});return this.artifactLocks.set(a,l),l.then(()=>{this.artifactLocks.get(a)===l&&this.artifactLocks.delete(a)}),s}async fetchArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.fetchArtifactUnlocked(t,r,n))}async fetchArtifactUnlocked(t,r,n){var i,a;let o=this.requireRegistration(t,"fetchArtifact"),{raw:s,etag:l,memberEtags:u,siblingEtags:c}=await o.api.get(this.dataverse,r),d=o.adapter.fromApiResponse(s);if(!n?.overwrite&&await this.versions.isDirty(t,r)){let p=(a=(i=await this.versions.getMeta(t,r))===null||i===void 0?void 0:i.etag)!==null&&a!==void 0?a:null;if(p&&l&&p!==l)throw new ee.LocalEditsWouldBeLostError(t,r,p,l);let f=await this.workspace.readArtifact(t,r);if(f){let m=await this.versions.getMeta(t,r);if(m&&!m.etag&&l){if(!(0,AT.deepEqual)(m.snapshot,d))throw new ee.LocalEditsWouldBeLostError(t,r,p,l);await this.versions.storeMeta(t,r,{...m,etag:l,fetchedAt:(0,Vr.nowIso)()})}return(0,hn.cloneJson)(f)}}return await this.workspace.writeArtifact(t,r,d),await this.versions.storeMeta(t,r,{etag:l,languageCode:this.languageCode,projectionVersion:ws.PROJECTION_VERSION,fetchedAt:(0,Vr.nowIso)(),snapshot:(0,hn.cloneJson)(d),...u?{memberEtags:u}:{},...c?{siblingEtags:c}:{}}),(0,hn.cloneJson)(d)}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,Vr.nowIso)(),isDirty:!1})}catch(s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"failed",error:Cs(s)})}return await this.workspace.updateManifest({lastSyncAt:(0,Vr.nowIso)()}),{summaries:i,skipped:a}}async fetchEntityMetadata(t){let r=await(0,mh.fetchEntityMetadataFromApi)(this.dataverse,t);return await this.workspace.writeEntityMetadata(t,r),r}findTables(t,r){return(0,mh.findTables)(this.dataverse,t,r)}findColumns(t,r,n){return(0,mh.findColumns)(this.dataverse,t,r,n)}createTable(t){return(0,Qe.createTable)(this.dataverse,t)}createColumn(t,r){return(0,Qe.createColumn)(this.dataverse,t,r)}createColumns(t,r){return(0,Qe.createColumns)(this.dataverse,t,r)}updateColumn(t,r,n){return(0,Qe.updateColumn)(this.dataverse,t,r,n)}deleteColumn(t,r){return(0,Qe.deleteColumn)(this.dataverse,t,r)}setFormSecurityRoles(t,r){return(0,wT.setFormSecurityRoles)(this.dataverse,t,r)}getFormSecurityRoles(t){return(0,wT.getFormSecurityRoles)(this.dataverse,t)}setColumnVisualization(t,r,n){return(0,Qe.setColumnVisualization)(this.dataverse,t,r,n)}getColumnVisualization(t,r){return(0,Qe.getColumnVisualization)(this.dataverse,t,r)}createCustomerColumn(t,r){return(0,Qe.createCustomerColumn)(this.dataverse,t,r)}insertStatusValue(t,r){return(0,Qe.insertStatusValue)(this.dataverse,t,r)}updateTable(t,r){return(0,Qe.updateTable)(this.dataverse,t,r)}async setEntityIcon(t,r){if(await(0,Qe.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,Xn.xmlText)(t)}</entity></entities></importexportxml>`;(0,Vr.ensureSuccess)(await this.dataverse.post("/PublishXml",{ParameterXml:n}),this.dataverse.apiUrl("/PublishXml"))}}createAlternateKey(t,r){return(0,Qe.createAlternateKey)(this.dataverse,t,r)}deleteAlternateKey(t,r){return(0,Qe.deleteAlternateKey)(this.dataverse,t,r)}createRelationship(t){return(0,Qe.createRelationship)(this.dataverse,t)}deleteRelationship(t){return(0,Qe.deleteRelationship)(this.dataverse,t)}createGlobalOptionSet(t){return(0,Qe.createGlobalOptionSet)(this.dataverse,t)}deleteGlobalOptionSet(t){return(0,Qe.deleteGlobalOptionSet)(this.dataverse,t)}deleteTable(t){return(0,Qe.deleteTable)(this.dataverse,t)}createSecurityRole(t){return(0,As.createSecurityRole)(this.dataverse,t)}createPersonaRole(t){return(0,As.createPersonaRole)(this.dataverse,t)}deleteSecurityRole(t){return(0,As.deleteSecurityRole)(this.dataverse,t)}addEntityPrivilegesToRole(t,r){return(0,As.addEntityPrivilegesToRole)(this.dataverse,t,r)}getEntityPrivileges(t){return(0,As.getEntityPrivileges)(this.dataverse,t)}createRecord(t,r){return(0,mn.createRecord)(this.dataverse,t,r)}createRecordsBulk(t,r){return(0,mn.createRecordsBulk)(this.dataverse,t,r)}updateRecord(t,r,n){return(0,mn.updateRecord)(this.dataverse,t,r,n)}upsertRecord(t,r,n){return(0,mn.upsertRecord)(this.dataverse,t,r,n)}deleteRecord(t,r){return(0,mn.deleteRecord)(this.dataverse,t,r)}getRecord(t,r,n){return(0,mn.getRecord)(this.dataverse,t,r,n)}queryRecords(t,r){return(0,mn.queryRecords)(this.dataverse,t,r)}seedRecordGraph(t,r){return(0,Cz.seedRecordGraph)(this.dataverse,t,r)}resolveArtifact(t,r){return(0,CT.resolveArtifact)(this.dataverse,t,r)}findArtifact(t,r){return(0,CT.findArtifact)(this.dataverse,t,r)}async deleteAppCascade(t,r){let n=await(0,vz.deleteAppCascade)(this.dataverse,t,r),i=(0,Xn.normalizeGuid)(t,"appModuleId");return await this.workspace.readArtifact("app",i)&&await this.workspace.deleteArtifact("app",i),n}associateRecords(t,r,n){return(0,mn.associateRecords)(this.dataverse,t,r,n)}disassociateRecords(t,r,n,i){return(0,mn.disassociateRecords)(this.dataverse,t,r,n,i)}createWebResource(t){return(0,gc.createWebResource)(this.dataverse,t)}updateWebResource(t,r){return(0,gc.updateWebResource)(this.dataverse,t,r)}getWebResource(t){return(0,gc.getWebResource)(this.dataverse,t)}deleteWebResource(t){return(0,gc.deleteWebResource)(this.dataverse,t)}getAppSettings(t){return(0,ja.readAppSettings)(this.dataverse,t)}setAppSetting(t,r,n){return(0,ja.setAppSetting)(this.dataverse,t,r,n)}setHeaderAndNavigationRefresh(t,r){if(typeof r!="boolean")throw new ee.ValidationError("app",t,[{pointer:"/headerAndNavigationRefresh",rule:gz.HEADER_NAV_BOOLEAN_RULE,message:`enabled must be a boolean, got ${typeof r}`}]);return(0,ja.setAppSetting)(this.dataverse,t,ja.HEADER_AND_NAVIGATION_REFRESH,r?ja.APP_SETTING_ON:ja.APP_SETTING_OFF)}getSolution(t){return(0,ut.getSolution)(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)}async getArtifact(t,r){return this.withArtifactLock(t,r,()=>this.getArtifactUnlocked(t,r))}async getArtifactUnlocked(t,r){return(0,hn.cloneJson)(await this.readRaw(t,r))}async readRaw(t,r){return await this.revalidateIfStale(t,r),this.readLocal(t,r)}async readForMutation(t,r,n){if(await this.revalidateIfStale(t,r)==="refreshed-changed")throw new ee.StaleArtifactError(t,r,n);return this.readLocal(t,r)}async readLocal(t,r){let n=await this.workspace.readArtifact(t,r);if(!n)throw new ee.ArtifactNotFoundError(t,r);return n}async revalidateIfStale(t,r){let n=await this.versions.getMeta(t,r);if(!n)return"skipped";let i=n.fetchedAt?Date.parse(n.fetchedAt):NaN,a=Date.now()-i;if(!Number.isNaN(i)&&this.cacheStalenessMs>0&&a<=this.cacheStalenessMs)return"fresh";if(await this.versions.isDirty(t,r))return"skipped";let o=await this.workspace.readArtifact(t,r);await this.fetchArtifactUnlocked(t,r);let s=await this.workspace.readArtifact(t,r);return(0,AT.deepEqual)(o,s)?"refreshed-unchanged":"refreshed-changed"}async queryTree(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.getArtifactUnlocked(t,r),a=nr.JsonPointer.resolve(i,n);if(a===void 0)throw new ee.PathNotFoundError(t,r,n);return a})}async findElements(t,r,n){return this.withArtifactLock(t,r,async()=>(0,fz.findElements)(await this.getArtifactUnlocked(t,r),n))}async withDirtyFlags(t){let r=[];for(let n of t)r.push({...n,isDirty:await this.versions.isDirty(n.type,n.id)});return r}async listArtifacts(t,r){return this.withDirtyFlags(await this.workspace.listArtifacts(t,r))}async getEntityMetadata(t){let r=await this.workspace.readEntityMetadata(t);if(!r)throw new ee.ArtifactNotFoundError("entityMetadata",t);return r}async getFieldMetadata(t,r){let i=(await this.getEntityMetadata(t)).attributes.find(a=>a.logicalName===r);if(!i)throw new ee.PathNotFoundError("entityMetadata",t,r);return i}async updateElement(t,r,n,i){return this.withArtifactLock(t,r,async()=>{let a=await this.readForMutation(t,r,n),o=nr.JsonPointer.resolve(a,n);if(o===void 0)throw new ee.PathNotFoundError(t,r,n);let s=gn(o)&&gn(i)?{...o,...i}:i;return nr.JsonPointer.set(a,n,(0,hn.cloneJson)(s)),this.assertStructurallyValid(t,r,a,n),await this.workspace.writeArtifact(t,r,a),this.getArtifactUnlocked(t,r)})}async addElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{let o=await this.readForMutation(t,r,n),s=nr.JsonPointer.resolve(o,n);if(s===void 0)throw new ee.PathNotFoundError(t,r,n);if(!Array.isArray(s)){if(!gn(s)||!gn(i))throw new ee.ValidationError(t,r,n,"parent must be an array, or an object with an object of properties to add");if(a?.position!==void 0)throw new ee.ValidationError(t,r,n,"position is not supported for an object parent");let c={};for(let d of Object.keys(i)){if(d==="id")throw new ee.ValidationError(t,r,n,"refusing to write 'id' \u2014 that re-keys the node rather than adding a property");let p=(0,hn.cloneJson)(i[d]);c[d]=Array.isArray(p)?p.map(f=>gn(f)?this.assignMissingIds(t,f):f):gn(p)?this.assignMissingIds(t,p):p}for(let d of Object.keys(c))nr.JsonPointer.set(o,nr.JsonPointer.append(n,d),c[d]);return this.assertStructurallyValid(t,r,o,n),await this.workspace.writeArtifact(t,r,o),this.getArtifactUnlocked(t,r)}let l=this.assignMissingIds(t,(0,hn.cloneJson)(i)),u=Iz(s,a?.position);return s.splice(u,0,l),this.assertStructurallyValid(t,r,o,n),await this.workspace.writeArtifact(t,r,o),this.getArtifactUnlocked(t,r)})}async moveElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{var o;let s=await this.readForMutation(t,r,n),l=nr.JsonPointer.resolve(s,n);if(l===void 0)throw new ee.PathNotFoundError(t,r,n);let u=nr.JsonPointer.resolve(s,i);if(u===void 0)throw new ee.PathNotFoundError(t,r,i);if(!Array.isArray(u))throw new ee.ValidationError(t,r,i,"move target must be an array");if(i===n||i.startsWith(`${n}/`))throw new ee.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;u.splice(Math.max(0,Math.min(c,u.length)),0,l),ST(u);let d=nr.JsonPointer.resolve(s,ET(n));return Array.isArray(d)&&d!==u&&ST(d),this.assertStructurallyValid(t,r,s,i),await this.workspace.writeArtifact(t,r,s),this.getArtifactUnlocked(t,r)})}async removeElement(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.readForMutation(t,r,n);if(nr.JsonPointer.resolve(i,n)===void 0)throw new ee.PathNotFoundError(t,r,n);return nr.JsonPointer.remove(i,n),this.assertStructurallyValid(t,r,i,ET(n)),await this.workspace.writeArtifact(t,r,i),this.getArtifactUnlocked(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 ee.ValidationError(t,r,u)}retrieveSetting(t,r){return(0,Ja.retrieveSetting)(this.dataverse,t,r)}saveSettingValue(t,r,n){return(0,Ja.saveSettingValue)(this.dataverse,t,r,n)}getAiReadiness(t){return(0,Ja.getAiReadiness)(this.dataverse,t)}setAppAiFeatures(t,r,n){return(0,Ja.setAppAiFeatures)(this.dataverse,t,r,n)}configureRowSummary(t,r){return(0,Ja.configureRowSummary)(this.dataverse,t,r)}removeRowSummary(t){return(0,Ja.removeRowSummary)(this.dataverse,t)}async enrichDefaultViews(t,r,n={}){let i=await(0,Ez.findDefaultViews)(this.dataverse,t,n),a=[];for(let o of i)await this.fetchArtifact("view",o.id),await this.updateElement("view",o.id,"/columns",r),(await this.pushArtifact("view",o.id)).saved&&a.push(o.id);if(a.length){let o=await this.publishArtifact("view",a[0]);if(o.publish.kind==="failed")throw new ee.SdkError("ENRICH_DEFAULT_VIEWS_PUBLISH_FAILED",`enrichDefaultViews: ${a.length} view(s) on '${t}' were saved but the publish FAILED, so none of them is live (${o.publish.error.message}). Re-publish the entity to make them visible; the saves themselves are unaffected.`)}return{updated:a}}async createArtifact(t,r){let n=this.requireRegistration(t,"createArtifact"),i=n.adapter.assignMissingIds(n.adapter.createDefault(r)),a=i.id;if(!a)throw new ee.ValidationError(t,"(new)","/id","created artifact must have an id");return this.withArtifactLock(t,a,async()=>(await this.workspace.writeArtifact(t,a,i),(0,hn.cloneJson)(i)))}async deleteArtifact(t,r){return this.withArtifactLock(t,r,async()=>{await this.workspace.deleteArtifact(t,r)})}async deleteRemoteArtifact(t,r){return this.withArtifactLock(t,r,async()=>{await this.requireRegistration(t,"deleteRemoteArtifact").api.delete(this.dataverse,r),await this.workspace.readArtifact(t,r)&&await this.workspace.deleteArtifact(t,r)})}async publishArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.publishArtifactUnlocked(t,r,n))}async publishArtifactUnlocked(t,r,n){var i;let a=await this.readRaw(t,r),o=this.registrations.get(t);if(!o?.publish)return{type:t,id:r,shipped:!1,publish:{kind:"notApplicable"}};let s=(i=o.publishScope)===null||i===void 0?void 0:i.call(o,r,a);try{await o.publish(this.dataverse,r,a)}catch(u){return{type:t,id:r,shipped:!1,publish:{kind:"failed",error:Cs(u)},...s?{publishScope:s}:{}}}if(!n?.verify)return{type:t,id:r,shipped:!1,publish:{kind:"submitted"},...s?{publishScope:s}:{}};let l=await this.verifyPublished(t,r);return{type:t,id:r,shipped:l.kind==="verified",publish:l,...s?{publishScope:s}:{}}}async verifyPublished(t,r){var n,i,a,o,s;if(t!=="app")return{kind:"unverifiable",reason:`published-projection verification is not characterised for '${t}'; the publish was submitted`};try{let l=`/appmodules(${(0,Xn.normalizeGuid)(r,"id")})${(0,Xn.odataQuery)([["$select","appmoduleid,name,description"]])}`,u=await this.dataverse.get(l);if(u.status>=200&&u.status<300){let c=(n=u.body)!==null&&n!==void 0?n:{},d=await this.workspace.readArtifact("app",r);if(!d)return{kind:"verified"};let p=[];return((i=d.name)!==null&&i!==void 0?i:"")!==((a=c.name)!==null&&a!==void 0?a:"")&&p.push("name"),((o=d.description)!==null&&o!==void 0?o:"")!==((s=c.description)!==null&&s!==void 0?s:"")&&p.push("description"),p.length>0?{kind:"unverifiable",reason:`the published projection does not yet match the saved app (${p.join(", ")} still differ). PublishXml is asynchronous \u2014 re-read shortly, or re-publish if it persists`}:{kind:"verified"}}return{kind:"unverifiable",reason:`the published projection answered HTTP ${u.status}`}}catch(l){return{kind:"unverifiable",reason:Cs(l).message}}}async pushArtifact(t,r){return this.withArtifactLock(t,r,()=>this.pushArtifactUnlocked(t,r))}async prepareArtifactUnlocked(t,r){let n=this.requireRegistration(t,"pushArtifact"),i=await this.readLocal(t,r),a=await this.versions.getMeta(t,r);this.assertLanguageMatches(t,r,a,n),this.assertProjectionMatches(t,r,a);let o=await this.buildMetadataContext(n.adapter,i),s=await n.adapter.toApiPayload(i,a?.snapshot,o);return await this.assertSemanticallyComplete(n,t,r,i,a===null,a?.everActivated),{type:t,id:r,reg:n,json:i,meta:a,payload:s}}async assertSemanticallyComplete(t,r,n,i,a,o){var s;let l=t.adapter.issuesBlockingPush;if(!l)return;let u=i.entityLogicalName,c=u?await this.workspace.readEntityMetadata(u):null,d=((s=c?.attributes)!==null&&s!==void 0?s:[]).map(f=>({logicalName:f.logicalName,displayName:f.displayName,attributeType:f.attributeType,isCustomAttribute:f.isCustomAttribute,...f.maxLength!==void 0?{maxLength:f.maxLength}:{},...f.options?{options:f.options.map(m=>({value:m.value,label:m.label}))}:{},...f.targets?{targets:f.targets}:{}})),p=l.call(t.adapter,i,d,{isCreate:a,everActivated:o});if(p.length>0)throw new ee.ValidationError(r,n,p)}async pushArtifactUnlocked(t,r){return this.executePrepared(await this.prepareArtifactUnlocked(t,r))}async executePrepared(t){var r,n,i,a,o,s;let{type:l,id:u,reg:c,json:d,meta:p,payload:f}=t;try{let m=p?await c.api.update(this.dataverse,u,f,p.etag,p.memberEtags,p.siblingEtags):await this.createWithMintedId(c,l,u,f),g=u;return p||(m.serverIdentity&&c.adapter.applyServerIdentity&&c.adapter.applyServerIdentity(d,m.serverIdentity),m.id&&m.id!==u&&(d.id=m.id,await this.workspace.deleteArtifact(l,u),g=m.id),await this.workspace.writeArtifact(l,g,d)),await this.versions.storeMeta(l,g,{etag:m.etag,languageCode:this.languageCode,projectionVersion:ws.PROJECTION_VERSION,fetchedAt:(0,Vr.nowIso)(),snapshot:(0,hn.cloneJson)(d),...m.memberEtags?{memberEtags:m.memberEtags}:{},...m.siblingEtags?{siblingEtags:m.siblingEtags}:{}}),{type:l,id:g,saved:!0,shipped:!1,publish:(r=m.publish)!==null&&r!==void 0?r:{kind:"notRequested"},...m.publish&&m.publish.kind!=="notRequested"?(()=>{var y;let A=(y=c.publishScope)===null||y===void 0?void 0:y.call(c,g,d);return A?{publishScope:A}:{}})():{},...m.warnings&&m.warnings.length>0?{warnings:m.warnings}:{}}}catch(m){let g=(0,ee.readPartialTokens)(m);if(g&&p){let y={...(n=p.memberEtags)!==null&&n!==void 0?n:{},...(i=g.memberEtags)!==null&&i!==void 0?i:{}},A={...(a=p.siblingEtags)!==null&&a!==void 0?a:{},...(o=g.siblingEtags)!==null&&o!==void 0?o:{}};await this.versions.storeMeta(l,u,{...p,...Object.keys(y).length>0?{memberEtags:y}:{},...Object.keys(A).length>0?{siblingEtags:A}:{}})}if(m instanceof ee.SdkError&&m.code===Bt.ALREADY_EXISTS_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:m};if(m instanceof ee.SdkError&&m.code===bT.WFOM_API_UNAVAILABLE_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:m};if(m instanceof ee.SdkError&&m.code===bT.BUSINESS_RULE_LEFT_DEACTIVATED_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:m};if(m instanceof ee.SdkError&&m.code===Vr.VERSION_CONFLICT_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:new ee.VersionConflictError(l,u,(s=p?.etag)!==null&&s!==void 0?s:null,null,m.message)};throw m}}assertLanguageMatches(t,r,n,i){if(i?.languageSensitive&&!(n?.languageCode===void 0||n.languageCode===this.languageCode))throw new ee.SdkError("ARTIFACT_LANGUAGE_MISMATCH",`Refusing to push ${t} '${r}': it was fetched with languageCode ${n.languageCode} but this SDK is configured with ${this.languageCode}. Pushing would rewrite labels read in one language as labels in another. Re-fetch with languageCode ${this.languageCode}, or create the SDK with languageCode ${n.languageCode}.`)}assertProjectionMatches(t,r,n){var i;if(n&&n.projectionVersion!==ws.PROJECTION_VERSION)throw new ee.SdkError("ARTIFACT_PROJECTION_STALE",`Refusing to push ${t} '${r}': its workspace copy was produced by projection version ${(i=n.projectionVersion)!==null&&i!==void 0?i:"unknown (pre-versioning)"}, but this SDK produces version ${ws.PROJECTION_VERSION}. The parsers changed in between, so an unedited part of this artifact can no longer be told apart from an edited one and pushing could overwrite server content the caller never touched. Re-fetch it with fetchArtifact('${t}', '${r}') and re-apply any local edits.`)}async createWithMintedId(t,r,n,i){try{return await t.api.create(this.dataverse,i,n)}catch(a){throw!(a instanceof ee.SdkError)||a.code!==Vr.VERSION_CONFLICT_CODE?a:new ee.SdkError(Bt.ALREADY_EXISTS_CODE,`Cannot create ${r} '${n}': a record already exists at that id, so an earlier push of this artifact committed before its local version metadata was saved. No duplicate was created. Run fetchArtifact('${r}', '${n}', { overwrite: true }) to adopt the existing record's identity, etag and snapshot \u2014 the overwrite is required, because this local copy has never been pushed, so a plain fetch keeps it and adopts nothing; it REPLACES the local copy, so keep any outstanding local changes aside first \u2014 then re-apply them and push again: a conditional update, provided the adopted record is complete. If the earlier push committed only PART of a multi-row artifact (e.g. an app's appmodule without its sitemap), that update refuses, naming what is missing and how to remove the partial record. This is not done automatically because the only recovery available here would be an UNCONDITIONAL overwrite, which would destroy any edit made to the record in the meantime.`)}}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(l=>l.entityLogicalName).filter(l=>!!l)),s=new Map;for(let l of o){let u=await this.workspace.readEntityMetadata(l);if(!u)try{await this.fetchEntityMetadata(l),u=await this.workspace.readEntityMetadata(l)}catch{}u&&s.set(l,u)}return{resolveField:(l,u)=>{let c=s.get(l),d=c?.attributes.find(p=>p.logicalName===u);return d?{displayName:d.displayName,attributeType:d.attributeType}:void 0}}}async pushAll(){let t=await this.getDirtyArtifacts();await this.warmBatchMetadata(t);let r=new Map;for(let i=0;i<t.length;i+=1){let a=t[i];try{await this.withArtifactLock(a.type,a.id,()=>this.prepareArtifactUnlocked(a.type,a.id))}catch(o){r.set(i,{type:a.type,id:a.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:Cs(o)})}}if(r.size>0)return t.map((i,a)=>{var o;return(o=r.get(a))!==null&&o!==void 0?o:{type:i.type,id:i.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:new ee.SdkError(Bt.PUSH_NOT_ATTEMPTED_CODE,`Not attempted: ${r.size} artifact(s) in this batch could not be prepared, so no writes were issued. Fix the reported failures and push again.`)}});let n=[];for(let i of t)try{n.push(await this.pushArtifact(i.type,i.id))}catch(a){n.push({type:i.type,id:i.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:Cs(a)})}return n}async warmBatchMetadata(t){var r,n,i;let a=new Set;for(let o of t){let s=this.registrations.get(o.type);if(!s)continue;let l;try{l=await this.readLocal(o.type,o.id)}catch{continue}let u=l.entityLogicalName;u&&a.add(u);for(let c of(i=(n=(r=s.adapter).metadataNeeds)===null||n===void 0?void 0:n.call(r,l))!==null&&i!==void 0?i:[])c.entityLogicalName&&a.add(c.entityLogicalName)}for(let o of a)if(!await this.workspace.readEntityMetadata(o))try{await this.fetchEntityMetadata(o)}catch{}}async getDirtyArtifacts(){return(await this.withDirtyFlags(await this.workspace.listArtifacts())).filter(r=>r.isDirty)}async 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,bz.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.UxAgentProject:return"genPage";case ut.SolutionComponentType.Workflow:return t.workflowCategory===2?"businessRule":t.workflowCategory===4&&await this.isBusinessFlowWorkflow(t.objectId)?"bpf":void 0;case ut.SolutionComponentType.SystemForm:return await this.isDashboardForm(t.objectId)?"dashboard":"form";default:return}}async isDashboardForm(t){let n=`/systemforms(${(0,Xn.normalizeGuid)(t,"formId")})${(0,Xn.odataQuery)([["$select","type"]])}`,i=(0,Vr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n)),a=Number(i.body.type);return a===0||a===10}async isBusinessFlowWorkflow(t){let n=`/workflows(${(0,Xn.normalizeGuid)(t,"workflowId")})${(0,Xn.odataQuery)([["$select","businessprocesstype"]])}`,i=(0,Vr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n));return Number(i.body.businessprocesstype)===0}requireRegistration(t,r){let n=this.registrations.get(t);if(!n)throw new ee.NotImplementedError(r,`no adapter registered for artifact type '${t}'`);return n}};Bt.MakerSdk=vc;function Dz(e){return new vc(e)}Bt.createMakerSdk=Dz;function Cs(e){return e instanceof Error?e:new Error(String(e))}function gn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ET(e){let t=e.lastIndexOf("/");return t<=0?"":e.slice(0,t)}function ST(e){e.length===0||!e.every(t=>gn(t)&&typeof t.order=="number")||e.forEach((t,r)=>{t.order=r})}function Iz(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=>gn(i)&&i.id===t.before);return n<0?e.length:n}let r=e.findIndex(n=>gn(n)&&n.id===t.after);return r<0?e.length:r+1}});var IT=v(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.ARTIFACT_TYPES=void 0;yc.ARTIFACT_TYPES=["form","view","businessRule","app","command","chart","dashboard","genPage","bpf"]});var TT=v(_T=>{"use strict";Object.defineProperty(_T,"__esModule",{value:!0})});var OT=v(PT=>{"use strict";Object.defineProperty(PT,"__esModule",{value:!0})});var FT=v(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0})});var LT=v(xT=>{"use strict";Object.defineProperty(xT,"__esModule",{value:!0})});var MT=v(kT=>{"use strict";Object.defineProperty(kT,"__esModule",{value:!0})});var BT=v(UT=>{"use strict";Object.defineProperty(UT,"__esModule",{value:!0})});var qT=v($T=>{"use strict";Object.defineProperty($T,"__esModule",{value:!0})});var GT=v(VT=>{"use strict";Object.defineProperty(VT,"__esModule",{value:!0})});var WT=v(zT=>{"use strict";Object.defineProperty(zT,"__esModule",{value:!0})});var jT=v(HT=>{"use strict";Object.defineProperty(HT,"__esModule",{value:!0})});var QT=v(JT=>{"use strict";Object.defineProperty(JT,"__esModule",{value:!0})});var XT=v(KT=>{"use strict";Object.defineProperty(KT,"__esModule",{value:!0})});var ZT=v(YT=>{"use strict";Object.defineProperty(YT,"__esModule",{value:!0})});var tP=v(eP=>{"use strict";Object.defineProperty(eP,"__esModule",{value:!0})});var nP=v(rP=>{"use strict";Object.defineProperty(rP,"__esModule",{value:!0})});var aP=v(iP=>{"use strict";Object.defineProperty(iP,"__esModule",{value:!0})});var sP=v(oP=>{"use strict";Object.defineProperty(oP,"__esModule",{value:!0})});var uP=v(lP=>{"use strict";Object.defineProperty(lP,"__esModule",{value:!0})});var dP=v(cP=>{"use strict";Object.defineProperty(cP,"__esModule",{value:!0})});var pP=v(le=>{"use strict";var _z=le&&le.__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]})),De=le&&le.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&_z(t,e,r)};Object.defineProperty(le,"__esModule",{value:!0});le.createMakerSdk=void 0;var Tz=DT();Object.defineProperty(le,"createMakerSdk",{enumerable:!0,get:function(){return Tz.createMakerSdk}});De(IT(),le);De(TT(),le);De(OT(),le);De(FT(),le);De(LT(),le);De(MT(),le);De(BT(),le);De(qT(),le);De(GT(),le);De(WT(),le);De(jT(),le);De(QT(),le);De(XT(),le);De(pl(),le);De(ZT(),le);De(tP(),le);De(nP(),le);De(aP(),le);De(sP(),le);De(uP(),le);De(dP(),le);De(te(),le)});var gh=v(Gr=>{"use strict";var Pz=Gr&&Gr.__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]})),Oz=Gr&&Gr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),hP=Gr&&Gr.__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)&&Pz(t,e,r);return Oz(t,e),t};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.NodeFileSystemStorage=void 0;var Be=hP(require("fs")),ct=hP(require("path")),fP=te(),mP=Bc();async function gP(e){let t;try{t=await Be.promises.lstat(e)}catch{return}if(t.isSymbolicLink()){try{await Be.promises.unlink(e)}catch{await Be.promises.rmdir(e)}return}if(!t.isDirectory()){await Be.promises.unlink(e);return}for(let r of await Be.promises.readdir(e))await gP(ct.join(e,r));await Be.promises.rmdir(e)}var hh=class{constructor(t){this.root=t}getRoot(){return this.root}pathFor(t,r=!0){return this.assertWithinRoot(ct.join(this.root,...t),r)}realPathThroughNearestAncestor(t){let r=t,n=[];for(;!Be.existsSync(r);){n.unshift(ct.basename(r));let i=ct.dirname(r);if(i===r)return ct.resolve(t);r=i}return ct.resolve(Be.realpathSync(r),...n)}assertWithinRoot(t,r){let n=ct.resolve(this.root),i=ct.resolve(t);if(i!==n&&!i.startsWith(n+ct.sep))throw new fP.PathTraversalError(t,this.root);let a=this.realPathThroughNearestAncestor(n),o=r?this.realPathThroughNearestAncestor(i):ct.resolve(this.realPathThroughNearestAncestor(ct.dirname(i)),ct.basename(i));if(o!==a&&!o.startsWith(a+ct.sep))throw new fP.PathTraversalError(t,this.root);return i}async readText(t){let r=this.pathFor(t);if(!Be.existsSync(r))return null;try{return await(0,mP.retryTransientIoAsync)(()=>Be.promises.readFile(r,"utf8"))}catch(n){if(n.code==="ENOENT")return null;throw n}}async writeTextAtomic(t,r){let n=this.pathFor(t),i=ct.dirname(n);await Be.promises.mkdir(i,{recursive:!0});let a=ct.join(i,`.${ct.basename(n)}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);try{await Be.promises.writeFile(a,r,"utf8"),await(0,mP.retryTransientIoAsync)(()=>Be.promises.rename(a,n))}catch(o){try{Be.existsSync(a)&&await Be.promises.unlink(a)}catch{}throw o}}async deleteFile(t){let r=this.pathFor(t);Be.existsSync(r)&&await Be.promises.unlink(r)}async deleteByPrefix(t){await gP(this.pathFor(t,!1))}async ensureContainer(t){await Be.promises.mkdir(this.pathFor(t),{recursive:!0})}async exists(t){return Be.existsSync(this.pathFor(t))}};Gr.NodeFileSystemStorage=hh});var vP=v(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.createNodeWorkspaceStorage=Qa.NodeFileSystemStorage=void 0;var Rz=gh(),Fz=gh();Object.defineProperty(Qa,"NodeFileSystemStorage",{enumerable:!0,get:function(){return Fz.NodeFileSystemStorage}});function xz(e){return new Rz.NodeFileSystemStorage(e)}Qa.createNodeWorkspaceStorage=xz});var vn={};module.exports=br(vn);bn(vn,ie(pP()),module.exports);bn(vn,ie(vP()),module.exports);
diff --git a/plugins/model-apps/skills/app-builder/SKILL.md b/plugins/model-apps/skills/app-builder/SKILL.md
index 46e952e7c..58b5d53c3 100644
--- a/plugins/model-apps/skills/app-builder/SKILL.md
+++ b/plugins/model-apps/skills/app-builder/SKILL.md
@@ -403,7 +403,8 @@ change takes effect (see *Notes & limits*).
**Recovery from a failed or halted build: run the full build again.** The build is idempotent — every
phase re-uses what's already created and only fills the gaps. SDK metadata is persisted under
`<working-dir>/.maker-workspace/` (override with `--workspace`). There is no apply-safe
-`--from <phase>` shortcut; a full rerun is the correct and safe recovery path.
+`--from <phase>` shortcut; a full rerun is the correct and safe recovery path. One exception: an
+`already-exists` halt recurs on a rerun until that workspace directory is deleted — follow its message.
### Phase 3 — Verify & iterate
**`--apply --verify` already reconciled the spec against what deployed** (Phase 2) — the build appends a