@esri/solutions-components 5.1.0-next.152 → 5.1.0-next.153

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,30 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { c as Te } from "../../chunks/runtime.js";
3
- import { u as Ee } from "../../chunks/useT9n.js";
4
- import { LitElement as ke, createEvent as Z, nothing as ee } from "@arcgis/lumina";
5
- import { css as Ae, html as I } from "lit";
6
- import { unsafeHTML as Le } from "lit/directives/unsafe-html.js";
7
- import { useContextConsumer as te } from "@arcgis/lumina/context";
8
- import { c as De, b as Re } from "../../chunks/deployAppContexts.js";
9
- import { T as R } from "../../chunks/interfaces.js";
10
- import { m as Fe } from "../../chunks/helpers.js";
11
- import se from "@arcgis/core/config.js";
12
- import { createRef as $e, ref as Ne } from "lit-html/directives/ref.js";
13
- import { Annotation as b, StateGraph as z, START as j, END as x, NodeInterrupt as ie } from "@langchain/langgraph/web";
14
- import { createAgentRuntimeState as J, sendTraceMessage as w, invokeStructuredPrompt as T, getEmbeddings as Me, cosineSimilarity as Be, invokeTextPrompt as Pe } from "@arcgis/ai-orchestrator";
15
- import r, { z as F } from "zod";
16
- import * as G from "@esri/arcgis-rest-portal";
17
- import { applyPatch as qe } from "fast-json-patch";
2
+ import { c as ke } from "../../chunks/runtime.js";
3
+ import { u as Ae } from "../../chunks/useT9n.js";
4
+ import { LitElement as Le, createEvent as te, nothing as se } from "@arcgis/lumina";
5
+ import { css as Re, html as I } from "lit";
6
+ import { unsafeHTML as $e } from "lit/directives/unsafe-html.js";
7
+ import { useContextConsumer as ie } from "@arcgis/lumina/context";
8
+ import { c as De, b as Fe } from "../../chunks/deployAppContexts.js";
9
+ import { T as $ } from "../../chunks/interfaces.js";
10
+ import { m as Ne } from "../../chunks/helpers.js";
11
+ import ne from "@arcgis/core/config.js";
12
+ import { createRef as Me, ref as Be } from "lit-html/directives/ref.js";
13
+ import { Annotation as b, StateGraph as V, START as J, END as x, NodeInterrupt as ae } from "@langchain/langgraph/web";
14
+ import { createAgentRuntimeState as G, sendTraceMessage as w, invokeStructuredPrompt as T, getEmbeddings as Pe, cosineSimilarity as qe, invokeTextPrompt as Ue } from "@arcgis/ai-orchestrator";
15
+ import r, { z as D } from "zod";
16
+ import * as H from "@esri/arcgis-rest-portal";
17
+ import { applyPatch as Oe } from "fast-json-patch";
18
18
  import "@langchain/core/messages";
19
- import { C as oe } from "../../chunks/converter.js";
20
- import { t as ae, g as B, c as re, r as le, d as L } from "../../chunks/templates.js";
21
- import Ue from "@arcgis/core/portal/Portal.js";
22
- import Oe from "@arcgis/core/portal/PortalItem.js";
23
- const ze = Ae`:host{display:block;height:100%}.margin-lg{margin:var(--calcite-spacing-lg)}.display-flex-row{display:flex;flex-direction:row}.assistant-split-container{display:flex;width:100%;height:calc(100vh - 78px);overflow:hidden;border-radius:10px}.assistant-panel{display:flex;flex-direction:column;height:100%;border:1px solid var(--calcite-color-surface-3);background-color:var(--calcite-color-surface-2);overflow:hidden}.chat-panel{min-width:320px}.builder-panel{min-width:320px;max-width:100%;border-left:1px solid var(--calcite-color-surface-3)}.panel-actions{display:flex;gap:8px;padding:6px;align-items:center}.builder-header,.builder-footer{padding:10px;background:var(--calcite-color-surface-1);border-bottom:1px solid var(--calcite-color-surface-3)}.builder-content{flex:1;overflow:auto;padding:12px}.builder-content pre{white-space:pre-wrap;word-wrap:break-word;max-height:100%;overflow:auto}.builder-actions{display:flex;gap:6px;align-items:center}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-surface-4);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-surface-1);border-radius:10px;padding:10px}.chat-panel{--calcite-color-focus: var(--calcite-color-brand);--calcite-panel-border-color: var(--calcite-color-border-2);--calcite-internal-panel-header-vertical-padding: 0px;--calcite-panel-header-content-space: 0px;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);height:100%}.header-content{display:flex;align-items:center;gap:var(--calcite-spacing-sm);height:65px;box-sizing:border-box;padding-inline-start:var(--calcite-space-2xl)}.header-title{font-size:var(--calcite-font-size-md);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}.beta-chip{--calcite-chip-corner-radius: var(--calcite-corner-radius-half)}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button,.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-surface-1, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-surface-3);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-surface-4);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-surface-4)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;align-items:center;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-surface-1)}#closeAssistantButton{--calcite-action-text-color: var(--calcite-color-text-1)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-surface-1)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;
19
+ import { C as re } from "../../chunks/converter.js";
20
+ import { v as U, b as O, S as ze, g as je } from "../../chunks/validators.js";
21
+ import { t as le, g as B, c as ce, r as de, d as L } from "../../chunks/templates.js";
22
+ import Ve from "@arcgis/core/portal/Portal.js";
23
+ import Je from "@arcgis/core/portal/PortalItem.js";
24
+ const Ge = Re`:host{display:block;height:100%}.margin-lg{margin:var(--calcite-spacing-lg)}.display-flex-row{display:flex;flex-direction:row}.assistant-split-container{display:flex;width:100%;height:calc(100vh - 78px);overflow:hidden;border-radius:10px}.assistant-panel{display:flex;flex-direction:column;height:100%;border:1px solid var(--calcite-color-surface-3);background-color:var(--calcite-color-surface-2);overflow:hidden}.chat-panel{min-width:320px}.builder-panel{min-width:320px;max-width:100%;border-left:1px solid var(--calcite-color-surface-3)}.panel-actions{display:flex;gap:8px;padding:6px;align-items:center}.builder-header,.builder-footer{padding:10px;background:var(--calcite-color-surface-1);border-bottom:1px solid var(--calcite-color-surface-3)}.builder-content{flex:1;overflow:auto;padding:12px}.builder-content pre{white-space:pre-wrap;word-wrap:break-word;max-height:100%;overflow:auto}.builder-actions{display:flex;gap:6px;align-items:center}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-surface-4);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-surface-1);border-radius:10px;padding:10px}.chat-panel{--calcite-color-focus: var(--calcite-color-brand);--calcite-panel-border-color: var(--calcite-color-border-2);--calcite-internal-panel-header-vertical-padding: 0px;--calcite-panel-header-content-space: 0px;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);height:100%}.header-content{display:flex;align-items:center;gap:var(--calcite-spacing-sm);height:65px;box-sizing:border-box;padding-inline-start:var(--calcite-space-2xl)}.header-title{font-size:var(--calcite-font-size-md);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}.beta-chip{--calcite-chip-corner-radius: var(--calcite-corner-radius-half)}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button,.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-surface-1, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-surface-3);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-surface-4);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-surface-4)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;align-items:center;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-surface-1)}#closeAssistantButton{--calcite-action-text-color: var(--calcite-color-text-1)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-surface-1)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;
24
25
  async function y(t, e) {
25
26
  const s = Object.entries(t).find(
26
- ([n]) => n.endsWith(`/${e}.md`)
27
+ ([i]) => i.endsWith(`/${e}.md`)
27
28
  );
28
29
  if (!s)
29
30
  throw new Error(
@@ -37,10 +38,10 @@ ${Object.keys(t).join(`
37
38
  function P(t) {
38
39
  return t?.configurable?.context?.translations;
39
40
  }
40
- function ce(t) {
41
+ function ue(t) {
41
42
  if (typeof window > "u" || t.length <= 1)
42
43
  return;
43
- const e = t.map((n) => n.solution.id), s = t.map((n) => n.solution.title);
44
+ const e = t.map((i) => i.solution.id), s = t.map((i) => i.solution.title);
44
45
  window.dispatchEvent(new CustomEvent("searchTermSet", {
45
46
  detail: {
46
47
  scope: "all-solutions",
@@ -59,7 +60,7 @@ function ce(t) {
59
60
  }
60
61
  }));
61
62
  }
62
- function de(t) {
63
+ function pe(t) {
63
64
  if (typeof window > "u" || !t)
64
65
  return;
65
66
  const e = new CustomEvent("solutionIDFromAssistant", {
@@ -69,39 +70,39 @@ function de(t) {
69
70
  });
70
71
  window.dispatchEvent(e);
71
72
  }
72
- const je = /* @__PURE__ */ Object.assign({
73
+ const He = /* @__PURE__ */ Object.assign({
73
74
  "./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((t) => t.default)
74
75
  });
75
- function Je(t) {
76
+ function We(t) {
76
77
  return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">&#91;$1&#93;</a></sup>');
77
78
  }
78
- function Ge(t, e) {
79
+ function Qe(t, e) {
79
80
  const s = [];
80
- return (e?.configurable?.context?.configContext.allCards ?? []).forEach((i) => {
81
- const o = i.title;
81
+ return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
82
+ const o = n.title;
82
83
  if (!o)
83
84
  return;
84
85
  const a = new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`, "giu");
85
86
  let l = !1;
86
- t = t.replace(a, () => (l = !0, `<a href="" target="solutionId:${i.deployCommonId}">${o}</a>`)), l && s.push({
87
+ t = t.replace(a, () => (l = !0, `<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`)), l && s.push({
87
88
  solution: {
88
- title: i.title,
89
- id: i.deployCommonId,
90
- snippet: i.snippet,
91
- description: i.description
89
+ title: n.title,
90
+ id: n.deployCommonId,
91
+ snippet: n.snippet,
92
+ description: n.description
92
93
  },
93
94
  score: 100
94
95
  });
95
96
  }), { source: t, allMatches: s };
96
97
  }
97
- function Ve(t) {
98
+ function Ke(t) {
98
99
  return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
99
100
  }
100
- function ue(t) {
101
+ function me(t) {
101
102
  return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
102
103
  }
103
- async function O(t, e, s) {
104
- const n = await fetch(e, {
104
+ async function j(t, e, s) {
105
+ const i = await fetch(e, {
105
106
  method: "POST",
106
107
  headers: {
107
108
  "Content-Type": "application/json",
@@ -109,16 +110,16 @@ async function O(t, e, s) {
109
110
  },
110
111
  body: JSON.stringify(t)
111
112
  });
112
- if (!n.ok)
113
- throw new Error(`HTTP ${n.status} calling ${e}`);
114
- return n.json();
113
+ if (!i.ok)
114
+ throw new Error(`HTTP ${i.status} calling ${e}`);
115
+ return i.json();
115
116
  }
116
- const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
117
+ const Ye = (t) => new Promise((e) => setTimeout(e, t)), Xe = b.Root({
117
118
  // Provides agentExecutionContext, outputMessage, summary, and status
118
119
  // channels with the orchestrator's standard reducers/defaults so the
119
120
  // sub-agent reports back through the same shape the orchestrator
120
121
  // persists into priorSteps.
121
- ...J(),
122
+ ...G(),
122
123
  solutionResponse: b({
123
124
  reducer: (t, e) => e ?? null,
124
125
  default: () => null
@@ -134,10 +135,10 @@ const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
134
135
  reducer: (t, e) => e ?? t,
135
136
  default: () => null
136
137
  })
137
- }), Ke = () => new z(We).addNode("initializeAgent", Ye).addNode("askSolutionsQuestions", Qe).addEdge(j, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", x), pe = async (t, e, s, n) => {
138
+ }), Ze = () => new V(Xe).addNode("initializeAgent", tt).addNode("askSolutionsQuestions", et).addEdge(J, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", x), ge = async (t, e, s, i) => {
138
139
  if (!t) return;
139
- const i = ue(t);
140
- if (!i) return;
140
+ const n = me(t);
141
+ if (!n) return;
141
142
  const a = { context: {
142
143
  kind: "DocAIAssistantRequest",
143
144
  filters: {
@@ -148,17 +149,17 @@ const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
148
149
  }
149
150
  }
150
151
  } };
151
- n && (a.conversationId = n), O(a, i, e ?? "");
152
- }, Qe = async (t, e) => {
152
+ i && (a.conversationId = i), j(a, n, e ?? "");
153
+ }, et = async (t, e) => {
153
154
  if (e?.configurable?.abortSignal?.aborted)
154
155
  return {};
155
- const s = P(e), n = t.documentSkillUrl;
156
- let i = [];
156
+ const s = P(e), i = t.documentSkillUrl;
157
+ let n = [];
157
158
  await w(
158
159
  { text: s.agentProgress.explorerAgentSearching },
159
160
  e
160
161
  );
161
- let o = await O(
162
+ let o = await j(
162
163
  {
163
164
  message: t.agentExecutionContext.userRequest,
164
165
  conversationId: e?.configurable?.context?.convoId ?? void 0,
@@ -173,7 +174,7 @@ const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
173
174
  }
174
175
  }
175
176
  },
176
- n,
177
+ i,
177
178
  e?.configurable?.context?.token ?? ""
178
179
  );
179
180
  o.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(o.conversationId);
@@ -187,11 +188,11 @@ const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
187
188
  const u = async (m) => {
188
189
  const f = m.context?.results?.[0]?.reply ?? "";
189
190
  if (f !== "") {
190
- const g = Je(f), A = Ge(g, e);
191
- l = A.source, i = [
192
- ...i,
191
+ const g = We(f), A = Qe(g, e);
192
+ l = A.source, n = [
193
+ ...n,
193
194
  ...A.allMatches.filter(
194
- (E) => !i.some((k) => k.solution.id === E.solution.id)
195
+ (E) => !n.some((k) => k.solution.id === E.solution.id)
195
196
  )
196
197
  ];
197
198
  }
@@ -204,13 +205,13 @@ const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
204
205
  for (await u(o); a.hasMore; ) {
205
206
  if (e?.configurable?.abortSignal?.aborted)
206
207
  return {};
207
- await He(500), o = await O(
208
+ await Ye(500), o = await j(
208
209
  {
209
210
  conversationId: a.conversationId,
210
211
  ackSequenceNumber: a.ackSequenceNumber,
211
212
  inquiryId: a.inquiryId
212
213
  },
213
- n,
214
+ i,
214
215
  e?.configurable?.context?.token ?? ""
215
216
  ), a = {
216
217
  message: o.message,
@@ -220,26 +221,26 @@ const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
220
221
  inquiryId: o.inquiryId
221
222
  }, await u(o);
222
223
  }
223
- return ue(e?.configurable?.context.portal) && pe(
224
+ return me(e?.configurable?.context.portal) && ge(
224
225
  e?.configurable?.context.portal,
225
226
  e?.configurable?.context.token ?? "",
226
227
  e?.configurable?.context.configContext.locale ?? "en",
227
228
  a.conversationId
228
- ), i.length && (i.length === 1 ? de(i[0].solution.id) : ce(i)), {
229
+ ), n.length && (n.length === 1 ? pe(n[0].solution.id) : ue(n)), {
229
230
  outputMessage: l,
230
231
  summary: l,
231
232
  status: "success",
232
233
  solutionResponse: a,
233
234
  conversationId: a.conversationId
234
235
  };
235
- }, Ye = async (t, e) => {
236
+ }, tt = async (t, e) => {
236
237
  let s = null;
237
- return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Ve(e.configurable.context.portal)), {
238
+ return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Ke(e.configurable.context.portal)), {
238
239
  documentSkillUrl: s
239
240
  };
240
241
  };
241
- await y(je, "solutions_explorer_description");
242
- const me = (t) => {
242
+ await y(He, "solutions_explorer_description");
243
+ const he = (t) => {
243
244
  if (t && Array.isArray(t.id) && t.id.length > 0)
244
245
  return t.id[t.id.length - 1].replace("Message", "").toLowerCase();
245
246
  if (t && typeof t._getType == "function")
@@ -249,8 +250,8 @@ const me = (t) => {
249
250
  return "human";
250
251
  }
251
252
  return "human";
252
- }, Xe = (t) => {
253
- const e = me(t);
253
+ }, st = (t) => {
254
+ const e = he(t);
254
255
  if (t && t.kwargs)
255
256
  return {
256
257
  role: e,
@@ -265,76 +266,12 @@ const me = (t) => {
265
266
  return t.id && (s.id = t.id), t.name && (s.name = t.name), t.additional_kwargs && (s.additional_kwargs = t.additional_kwargs), t.response_metadata && (s.response_metadata = t.response_metadata), s;
266
267
  }
267
268
  return { role: "human", content: String(t) };
268
- }, Ze = (t) => me(t) === "human", et = (t, e = 3) => t.filter((s) => Ze(s)).slice(-e).map(Xe), tt = (t, e = " ") => et(t).map((i) => i.content).join(e).trim(), st = { understandingRequest: "Understanding your request...", selectTemplatePrompt: "This use case could be supported in a few different ways. Choose the option that best matches what you want to accomplish.", searchingExistingSolutions: "Searching for existing solutions...", existingSolutionMatch: "I found one or more existing solutions that match your use case. These are ready-to-use solutions that may already meet your needs and can be deployed now. Do you want to continue building your own solution?", continueBuildingYes: "Yes, I want to build a new solution", continueBuildingNo: "No, I’ll review existing solutions", continueBuildingDeclined: "Sounds good. We can focus on existing solutions. Let me know if I can help answer any questions or provide more details.", creatingDesign: "Generating solution design...", updatingDesign: "Updating solution design...", applyChangeFailed: "I wasn't able to apply that change. The design was not modified. Please try rephrasing your request.", createDesignFailed: "I wasn't able to create a solution design from that request. Please try rephrasing and try again.", discardMessage: "Are you sure you want to discard your solution?", discardForNewSolution: "I can help you build a new solution, but I will need to discard your current solution design. Do you want to continue?" }, nt = {
269
- builderMessages: st
270
- }, it = /* @__PURE__ */ new Set([
271
- "add",
272
- "all",
273
- "alter",
274
- "and",
275
- "any",
276
- "as",
277
- "asc",
278
- "backup",
279
- "between",
280
- "by",
281
- "case",
282
- "check",
283
- "column",
284
- "constraint",
285
- "create",
286
- "database",
287
- "date",
288
- "default",
289
- "delete",
290
- "desc",
291
- "distinct",
292
- "drop",
293
- "exec",
294
- "exists",
295
- "foreign",
296
- "from",
297
- "full",
298
- "group",
299
- "having",
300
- "in",
301
- "index",
302
- "inner",
303
- "insert",
304
- "into",
305
- "is",
306
- "join",
307
- "key",
308
- "left",
309
- "like",
310
- "limit",
311
- "not",
312
- "null",
313
- "on",
314
- "or",
315
- "order",
316
- "outer",
317
- "primary",
318
- "procedure",
319
- "right",
320
- "rownum",
321
- "select",
322
- "set",
323
- "shape",
324
- "subtype",
325
- "table",
326
- "top",
327
- "truncate",
328
- "union",
329
- "unique",
330
- "update",
331
- "values",
332
- "view",
333
- "where"
334
- ]);
335
- class ge {
336
- constructor(e, s, n = !0) {
337
- this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = s, this.newDesign = n, this.validate();
269
+ }, it = (t) => he(t) === "human", nt = (t, e = 3) => t.filter((s) => it(s)).slice(-e).map(st), ot = (t, e = " ") => nt(t).map((n) => n.content).join(e).trim(), at = { understandingRequest: "Understanding your request...", selectTemplatePrompt: "This use case could be supported in a few different ways. Choose the option that best matches what you want to accomplish.", searchingExistingSolutions: "Searching for existing solutions...", existingSolutionMatch: "I found one or more existing solutions that match your use case. These are ready-to-use solutions that may already meet your needs and can be deployed now. Do you want to continue building your own solution?", continueBuildingYes: "Yes, I want to build a new solution", continueBuildingNo: "No, I’ll review existing solutions", continueBuildingDeclined: "Sounds good. We can focus on existing solutions. Let me know if I can help answer any questions or provide more details.", creatingDesign: "Generating solution design...", updatingDesign: "Updating solution design...", applyChangeFailed: "I wasn't able to apply that change. The design was not modified. Please try rephrasing your request.", createDesignFailed: "I wasn't able to create a solution design from that request. Please try rephrasing and try again.", discardMessage: "Are you sure you want to discard your solution?", discardForNewSolution: "I can help you build a new solution, but I will need to discard your current solution design. Do you want to continue?" }, rt = {
270
+ builderMessages: at
271
+ };
272
+ class fe {
273
+ constructor(e, s, i = !0) {
274
+ this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = s, this.newDesign = i, this.validate();
338
275
  }
339
276
  validate() {
340
277
  this.compareModels(), this.validateResponse();
@@ -342,15 +279,18 @@ class ge {
342
279
  compareModels() {
343
280
  this.compareStrings(), this.compareItems(), this.compareFeatureLayers();
344
281
  }
282
+ validateResponse() {
283
+ this.validateSolutionProps(), this.validateItems(), this.validateFeatureLayer();
284
+ }
345
285
  compareStrings() {
346
- const e = new Set(this.template.solution.strings.map((n) => n.key)), s = new Set(this.response.solution.strings.map((n) => n.key));
347
- e.size === s.size && [...e].every((n) => s.has(n)) || this.logIssue("String keys in llm response do not match the template.");
348
- for (const n of this.response.solution.strings)
349
- n.value || this.logIssue(`String key '${n.key}' has no value in the design. It must be populated.`);
286
+ const e = new Set(this.template.solution.strings.map((i) => i.key)), s = new Set(this.response.solution.strings.map((i) => i.key));
287
+ e.size === s.size && [...e].every((i) => s.has(i)) || this.logIssue("String keys in llm response do not match the template.");
288
+ for (const i of this.response.solution.strings)
289
+ i.value || this.logIssue(`String key '${i.key}' has no value in the design. It must be populated.`);
350
290
  }
351
291
  compareItems() {
352
- const e = new Set(this.template.items.map((n) => n.id)), s = new Set(this.response.items.map((n) => n.id));
353
- e.size === s.size && [...e].every((n) => s.has(n)) || this.logIssue("Item IDs in design do not match the template.");
292
+ const e = new Set(this.template.items.map((i) => i.id)), s = new Set(this.response.items.map((i) => i.id));
293
+ e.size === s.size && [...e].every((i) => s.has(i)) || this.logIssue("Item IDs in design do not match the template.");
354
294
  }
355
295
  compareFeatureLayers() {
356
296
  const e = this.template.featureLayer, s = this.response.featureLayer;
@@ -359,8 +299,8 @@ class ge {
359
299
  return;
360
300
  }
361
301
  if (!e.addLayers) {
362
- const n = new Set(e.layers.map((o) => o.id)), i = new Set(s.layers.map((o) => o.id));
363
- if (!(n.size === i.size && [...n].every((o) => i.has(o))))
302
+ const i = new Set(e.layers.map((o) => o.id)), n = new Set(s.layers.map((o) => o.id));
303
+ if (!(i.size === n.size && [...i].every((o) => n.has(o))))
364
304
  this.logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
365
305
  else
366
306
  for (const o of e.layers)
@@ -370,32 +310,53 @@ class ge {
370
310
  }
371
311
  }
372
312
  }
373
- validateResponse() {
313
+ validateSolutionProps() {
314
+ const e = this.response.solution.title, s = this.response.solution.description, i = U(e ?? "");
315
+ if (i.isValid || this.logIssue(`Solution title is invalid (${i.errorType}).`), s) {
316
+ const n = O(s, 2048);
317
+ n.isValid || this.logIssue(`Solution description is invalid (${n.errorType}).`);
318
+ }
319
+ }
320
+ validateItems() {
374
321
  const e = /* @__PURE__ */ new Set([
375
322
  "Feature Layer (hosted)",
376
323
  "Feature Layer (hosted, view)"
377
324
  ]);
378
- for (const i of this.response.items)
379
- e.has(i.type) && i.title.length > 100 && this.logIssue(`Service name '${i.title}' exceeds 100 characters.`);
380
- const s = this.template.featureLayer.layers;
325
+ for (const s of this.response.items) {
326
+ e.has(s.type) && s.title.length > 100 && this.logIssue(`Service name '${s.title}' exceeds 100 characters.`);
327
+ const i = U(s.title ?? "");
328
+ if (i.isValid || this.logIssue(`Item '${s.id}' title is invalid (${i.errorType}).`), s.description) {
329
+ const n = O(s.description, 2048);
330
+ n.isValid || this.logIssue(`Item '${s.id}' description is invalid (${n.errorType}).`);
331
+ }
332
+ }
333
+ }
334
+ validateFeatureLayer() {
335
+ const e = this.template.featureLayer.layers;
381
336
  this.response.featureLayer.layers.length || this.logIssue("Feature layer item must contain at least one layer.");
382
- const n = this.response.featureLayer.layers.map((i) => i.name.toLowerCase());
383
- n.length !== new Set(n).size && this.logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${n}.`);
337
+ const s = this.response.featureLayer.layers.map((i) => i.name.toLowerCase());
338
+ s.length !== new Set(s).size && this.logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${s}.`);
384
339
  for (const i of this.response.featureLayer.layers) {
385
340
  this.validateLayer(i, this.response.featureLayer.addLayers);
386
- const o = s.find((a) => a.id === i.id);
387
- o && this.validateRequiredFields(i, o);
341
+ const n = e.find((o) => o.id === i.id);
342
+ n && this.validateRequiredFields(i, n);
388
343
  }
389
344
  }
390
345
  validateRequiredFields(e, s) {
391
- const n = new Set(e.requiredFields.map((i) => i.name));
392
- for (const i of s.requiredFields)
393
- n.has(i.name) || this.logIssue(`Layer '${e.name}' is missing required field '${i.name}'.`);
346
+ const i = new Set(e.requiredFields.map((n) => n.name));
347
+ for (const n of s.requiredFields)
348
+ i.has(n.name) || this.logIssue(`Layer '${e.name}' is missing required field '${n.name}'.`);
394
349
  }
395
350
  validateLayer(e, s) {
396
351
  !s && e.typeMutable === !0 && e.type === "Table" && this.logIssue(
397
352
  `Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`
398
- ), this.validateLayerFields(e);
353
+ );
354
+ const i = U(e.name ?? "");
355
+ if (i.isValid || this.logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
356
+ const n = O(e.description, 2048);
357
+ n.isValid || this.logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
358
+ }
359
+ this.validateLayerFields(e);
399
360
  }
400
361
  validateLayerFields(e) {
401
362
  const s = /* @__PURE__ */ new Set([
@@ -405,13 +366,13 @@ class ge {
405
366
  "created_user",
406
367
  "last_edited_date",
407
368
  "last_edited_user"
408
- ]), n = e.customFields.map((c) => c.name), i = new Set(e.requiredFields.map((c) => c.name)), o = [...new Set(
409
- n.filter((c) => s.has(c))
369
+ ]), i = e.customFields.map((c) => c.name), n = new Set(e.requiredFields.map((c) => c.name)), o = [...new Set(
370
+ i.filter((c) => s.has(c))
410
371
  )];
411
372
  for (const c of o)
412
373
  this.logIssue(`Layer '${e.name}' field '${c}' collides with a reserved system field name.`);
413
374
  const a = [...new Set(
414
- n.filter((c) => i.has(c))
375
+ i.filter((c) => n.has(c))
415
376
  )];
416
377
  for (const c of a)
417
378
  this.logIssue(`Layer '${e.name}' field '${c}' collides with a required field name.`);
@@ -430,43 +391,49 @@ class ge {
430
391
  this.fieldNameRegistry = null;
431
392
  }
432
393
  getUniqueTruncatedFieldName(e) {
433
- const n = this.fieldNameRegistry;
434
- if (!n)
394
+ const i = this.fieldNameRegistry;
395
+ if (!i)
435
396
  return e.slice(0, 31);
436
- const i = e.toLowerCase();
437
- n.delete(i);
397
+ const n = e.toLowerCase();
398
+ i.delete(n);
438
399
  const o = e.slice(0, 31);
439
400
  let a = o, l = 1;
440
- for (; n.has(a.toLowerCase()); ) {
401
+ for (; i.has(a.toLowerCase()); ) {
441
402
  const u = `_${l}`, c = Math.max(1, 31 - u.length);
442
403
  a = `${o.slice(0, c)}${u}`, l += 1;
443
404
  }
444
- return n.add(a.toLowerCase()), a;
405
+ return i.add(a.toLowerCase()), a;
445
406
  }
446
407
  validateField(e) {
447
- const s = /^\p{L}/u, n = /^.[\p{L}\p{M}\p{N}_]*$/u;
448
- if (e.alias || this.logIssue(`Field '${e.name}' has no display name (alias).`), s.test(e.name) || this.logIssue(`Field '${e.name}' does not start with a letter.`), n.test(e.name) || this.logIssue(
408
+ const s = /^\p{L}/u, i = /^.[\p{L}\p{M}\p{N}_]*$/u;
409
+ if (e.alias || this.logIssue(`Field '${e.name}' has no display name (alias).`), s.test(e.name) || this.logIssue(`Field '${e.name}' does not start with a letter.`), i.test(e.name) || this.logIssue(
449
410
  `Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
450
411
  ), e.name.length > 31)
451
412
  if (this.newDesign) {
452
- const i = e.name;
453
- e.name = this.getUniqueTruncatedFieldName(e.name), console.debug(`Field '${i}' exceeds 31 characters. Auto-fixing to '${e.name}'.`);
413
+ const n = e.name;
414
+ e.name = this.getUniqueTruncatedFieldName(e.name), console.debug(`Field '${n}' exceeds 31 characters. Auto-fixing to '${e.name}'.`);
454
415
  } else
455
416
  this.logIssue(`Field '${e.name}' exceeds 31 characters.`);
456
- if (it.has(e.name.toLowerCase()) && this.logIssue(`Field '${e.name}' is a SQL reserved keyword.`), e.choiceList && (e.type !== "string" && this.logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`), e.choiceList.some((i) => !i) && this.logIssue(`Field '${e.name}' has empty domain values.`), e.choiceList.length !== new Set(e.choiceList).size && this.logIssue(`Field '${e.name}' has duplicate domain values.`), e.length != null)) {
457
- const i = Math.max(...e.choiceList.map((o) => o.length));
458
- i > e.length && (this.newDesign ? (console.debug(`Field '${e.name}' length ${e.length} is insufficient for choiceList value of length ${i}. Auto-fixing to ${i}.`), e.length = i) : this.logIssue(`Field '${e.name}' length ${e.length} is insufficient for choiceList value of length ${i}.`));
417
+ if (ze.has(e.name.toLowerCase()))
418
+ if (this.newDesign) {
419
+ const n = e.name;
420
+ e.name = `${n}_`, console.debug(`Field '${n}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`);
421
+ } else
422
+ this.logIssue(`Field '${e.name}' is a SQL reserved keyword.`);
423
+ if (e.type === "string" && (typeof e.length != "number" || Number.isNaN(e.length) ? this.logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`) : je(e.length).isValid || this.logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`)), Array.isArray(e.choiceList) && (e.type !== "string" && this.logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`), e.choiceList.length || this.logIssue(`Field '${e.name}' has an empty domain. At least one value is required.`), e.choiceList.some((n) => !n?.trim()) && this.logIssue(`A blank domain value was added to Field '${e.name}'.`), e.choiceList.length !== new Set(e.choiceList).size && this.logIssue(`Field '${e.name}' has duplicate domain values.`), e.length != null)) {
424
+ const n = Math.max(...e.choiceList.map((o) => o.length));
425
+ n > e.length && (this.newDesign ? (console.debug(`Field '${e.name}' has a field length of ${e.length}, which is insufficient for the required length of ${n}. Auto-fixing to ${n}.`), e.length = n) : this.logIssue(`Field '${e.name}' has a field length of ${e.length}, which is insufficient for the choiceList options.`));
459
426
  }
460
427
  }
461
428
  logIssue(e) {
462
429
  console.debug(e), this.issues.push(e), this.isValid = !1;
463
430
  }
464
431
  }
465
- const ot = r.object({
432
+ const lt = r.object({
466
433
  key: r.string().describe("Stable key identifier for the string."),
467
434
  value: r.string().describe("Display value for the string."),
468
435
  description: r.string().describe("Explanation of where/how the string is used.")
469
- }), at = r.object({
436
+ }), ct = r.object({
470
437
  id: r.string().describe("ArcGIS item id (32 hex characters)."),
471
438
  title: r.string().describe("Item title."),
472
439
  description: r.string().describe("Item description."),
@@ -489,7 +456,7 @@ const ot = r.object({
489
456
  "Notebook",
490
457
  "QuickCapture Project"
491
458
  ]).describe("ArcGIS item type.")
492
- }), ne = r.object({
459
+ }), oe = r.object({
493
460
  name: r.string().describe("Field name."),
494
461
  type: r.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
495
462
  alias: r.string().describe("Field alias for display."),
@@ -498,60 +465,60 @@ const ot = r.object({
498
465
  "List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
499
466
  ),
500
467
  length: r.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
501
- }), rt = r.object({
468
+ }), dt = r.object({
502
469
  id: r.number().int().describe("Layer/table id within the feature service."),
503
470
  type: r.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
504
471
  typeMutable: r.boolean().describe("Indicates whether the layer type can be changed."),
505
472
  name: r.string().describe("Layer/table name."),
506
473
  description: r.string().describe("Layer/table description."),
507
- customFields: r.array(ne).describe("User/business fields specific to the solution."),
508
- requiredFields: r.array(ne).describe("Fields required for solution functionality (e.g., relationship keys).")
509
- }), lt = r.object({
474
+ customFields: r.array(oe).describe("User/business fields specific to the solution."),
475
+ requiredFields: r.array(oe).describe("Fields required for solution functionality (e.g., relationship keys).")
476
+ }), ut = r.object({
510
477
  itemId: r.string().describe("ArcGIS item id for the feature layer."),
511
478
  addLayers: r.boolean().describe("Indicates whether new layers can be added during solution design."),
512
- layers: r.array(rt)
513
- }), V = r.object({
479
+ layers: r.array(dt)
480
+ }), W = r.object({
514
481
  response: r.string().describe("Conversational response to the user's query."),
515
482
  solution: r.object({
516
483
  itemId: r.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),
517
484
  title: r.string().describe("Title of the solution."),
518
485
  description: r.string().describe("Description of the solution."),
519
486
  tags: r.array(r.string()).describe("Keywords/tags associated with the solution."),
520
- strings: r.array(ot).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
487
+ strings: r.array(lt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
521
488
  }),
522
- items: r.array(at).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
523
- featureLayer: lt.describe("Primary feature layer item and its schema/layers/tables details.")
524
- }), ct = r.object({
489
+ items: r.array(ct).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
490
+ featureLayer: ut.describe("Primary feature layer item and its schema/layers/tables details.")
491
+ }), pt = r.object({
525
492
  op: r.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
526
493
  path: r.string().describe("RFC 6901 JSON Pointer to the target location."),
527
494
  value: r.string().nullable().describe(`JSON-encoded value to apply (required for add and replace). Must be null — not an empty string — for remove, move, and copy operations. Serialize as a JSON string, e.g. '\\"text\\"' for a string, '[\\"a\\",\\"b\\"]' for an array, or '{\\"name\\":\\"x\\"}' for an object.`),
528
495
  from: r.string().nullable().describe("RFC 6901 JSON Pointer to the source location (required for move and copy). Must be null — not an empty string — for all other operations.")
529
- }), dt = r.object({
496
+ }), mt = r.object({
530
497
  response: r.string().describe("Conversational response describing the accepted design changes."),
531
- patches: r.array(ct).describe("Minimal RFC 6902 patch operations needed to update the current design.")
532
- }), ut = r.object({
498
+ patches: r.array(pt).describe("Minimal RFC 6902 patch operations needed to update the current design.")
499
+ }), gt = r.object({
533
500
  response: r.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
534
- }), pt = r.object({
501
+ }), ht = r.object({
535
502
  assistantResponse: r.string().describe("Natural-language response for the user."),
536
503
  isValidUpdate: r.boolean().describe("True only when the request is in scope for supported design updates.")
537
- }), mt = r.object({
504
+ }), ft = r.object({
538
505
  matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
539
- }), gt = r.object({
506
+ }), bt = r.object({
540
507
  templateId: r.string().min(1).describe("Template id from the available template list."),
541
508
  confidence: r.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
542
509
  templateDescription: r.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
543
- }), ht = r.object({
510
+ }), yt = r.object({
544
511
  assistantResponse: r.string().nullable().describe("Natural-language response for the user."),
545
512
  isValidUseCase: r.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
546
- matchedTemplates: r.array(gt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists."),
513
+ matchedTemplates: r.array(bt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists."),
547
514
  rationale: r.string().min(1).describe("A brief rationale for the choice for isValidUseCase and matchedTemplates (≤140 characters)")
548
- }), ft = (t) => t.length ? t.map((e, s) => `${s + 1}. ${e}`).join(`
549
- `) : "No validation errors were provided.", bt = async (t) => {
515
+ }), vt = (t) => t.length ? t.map((e, s) => `${s + 1}. ${e}`).join(`
516
+ `) : "No validation errors were provided.", xt = async (t) => {
550
517
  const {
551
518
  query: e,
552
519
  validationIssues: s,
553
- recentMessages: n,
554
- fallbackMessage: i,
520
+ recentMessages: i,
521
+ fallbackMessage: n,
555
522
  promptModules: o
556
523
  } = t;
557
524
  try {
@@ -559,23 +526,23 @@ const ot = r.object({
559
526
  promptText: await y(o, "explainValidationFailure"),
560
527
  modelTier: "fast",
561
528
  temperature: 0,
562
- schema: ut,
563
- messages: n,
529
+ schema: gt,
530
+ messages: i,
564
531
  inputVariables: {
565
532
  query: e,
566
533
  validationIssueCount: String(s.length),
567
- validationIssues: ft(s)
534
+ validationIssues: vt(s)
568
535
  }
569
- })).response?.trim() || i;
536
+ })).response?.trim() || n;
570
537
  } catch (a) {
571
538
  return console.warn(
572
539
  "Natural language response failed:",
573
540
  { error: a }
574
- ), i;
541
+ ), n;
575
542
  }
576
- }, H = (t) => t in L, yt = 5, vt = 0.8, xt = 0.15, wt = "Web Mapping Application", St = "Embeddings";
577
- let $ = null, U = null, N = null, M = null;
578
- const It = "Build", C = /* @__PURE__ */ Object.assign({
543
+ }, Q = (t) => t in L, wt = 5, St = 0.8, It = 0.15, Ct = "Web Mapping Application", _t = "Embeddings";
544
+ let F = null, z = null, N = null, M = null;
545
+ const Tt = "Build", C = /* @__PURE__ */ Object.assign({
579
546
  "./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((t) => t.default),
580
547
  "./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((t) => t.default),
581
548
  "./prompts/description.md": () => import("../../chunks/description2.js").then((t) => t.default),
@@ -583,48 +550,48 @@ const It = "Build", C = /* @__PURE__ */ Object.assign({
583
550
  "./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((t) => t.default),
584
551
  "./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
585
552
  "./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
586
- }), Ct = nt.builderMessages, h = (t, e, s) => P(e)?.builderMessages?.[t] ?? Ct[t], he = (t) => {
553
+ }), Et = rt.builderMessages, h = (t, e, s) => P(e)?.builderMessages?.[t] ?? Et[t], be = (t) => {
587
554
  typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
588
555
  detail: t
589
556
  }));
590
- }, _t = async (t, e, s) => {
557
+ }, kt = async (t, e, s) => {
591
558
  if (!t) return null;
592
- const n = `type:"${wt}" AND typekeywords:${St} AND group:${t}`;
593
- return (await G.searchItems({
594
- q: n,
559
+ const i = `type:"${Ct}" AND typekeywords:${_t} AND group:${t}`;
560
+ return (await H.searchItems({
561
+ q: i,
595
562
  params: e ? { token: e } : void 0,
596
563
  portal: s,
597
564
  num: 1
598
565
  }))?.results?.[0] ?? null;
599
566
  };
600
- async function Tt(t, e, s) {
567
+ async function At(t, e, s) {
601
568
  try {
602
- const n = await _t(t, e, s);
603
- if (!n) return null;
604
- const i = new Oe({ id: n.id });
605
- return await i.load(), await i.fetchData("json");
569
+ const i = await kt(t, e, s);
570
+ if (!i) return null;
571
+ const n = new Je({ id: i.id });
572
+ return await n.load(), await n.fetchData("json");
606
573
  } catch {
607
574
  return null;
608
575
  }
609
576
  }
610
- const Et = async (t, e, s) => {
577
+ const Lt = async (t, e, s) => {
611
578
  if (!t) return [];
612
- const n = `type:Solution AND typekeywords:${It} AND group:${t}`;
613
- return (await G.searchItems({
614
- q: n,
579
+ const i = `type:Solution AND typekeywords:${Tt} AND group:${t}`;
580
+ return (await H.searchItems({
581
+ q: i,
615
582
  params: e ? { token: e } : void 0,
616
583
  portal: s,
617
584
  num: 100
618
585
  }))?.results ?? [];
619
- }, kt = async (t, e, s) => {
586
+ }, Rt = async (t, e, s) => {
620
587
  try {
621
- const n = await G.getItemData(t, {
588
+ const i = await H.getItemData(t, {
622
589
  params: e ? { token: e } : void 0,
623
590
  portal: s
624
- }), i = n?.buildSolution;
625
- if (!i) return null;
626
- const o = n?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
627
- return { buildSolution: i, params: a };
591
+ }), n = i?.buildSolution;
592
+ if (!n) return null;
593
+ const o = i?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
594
+ return { buildSolution: n, params: a };
628
595
  } catch {
629
596
  return null;
630
597
  }
@@ -646,49 +613,49 @@ const Et = async (t, e, s) => {
646
613
  ...s,
647
614
  templateId: e.templateId ?? null
648
615
  }), s;
649
- }, fe = (t, e) => {
616
+ }, ye = (t, e) => {
650
617
  if (t == null || e == null)
651
618
  return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
652
619
  try {
653
620
  const s = structuredClone(e);
654
- return new oe({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
621
+ return new re({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
655
622
  } catch (s) {
656
623
  return {
657
624
  ok: !1,
658
625
  error: s instanceof Error ? s.stack ?? s.message : String(s)
659
626
  };
660
627
  }
661
- }, W = async (t) => {
662
- if (U) {
663
- Object.entries(U).forEach(([a, l]) => {
628
+ }, K = async (t) => {
629
+ if (z) {
630
+ Object.entries(z).forEach(([a, l]) => {
664
631
  L[a] && (L[a].initialTemplate = l);
665
632
  });
666
633
  return;
667
634
  }
668
- const e = t?.configurable?.context?.token, s = ye(t), n = ve(t);
635
+ const e = t?.configurable?.context?.token, s = xe(t), i = we(t);
669
636
  if (!s) {
670
637
  console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
671
638
  return;
672
639
  }
673
- const i = await Et(s, e, n), o = {};
674
- await Promise.all(i.map(async (a) => {
640
+ const n = await Lt(s, e, i), o = {};
641
+ await Promise.all(n.map(async (a) => {
675
642
  const l = a.properties?.templateInfo;
676
643
  if (!l || typeof l != "object") return;
677
644
  const u = l.id;
678
645
  if (typeof u != "string" || o[u]) return;
679
- const c = await kt(a.id, e, n);
646
+ const c = await Rt(a.id, e, i);
680
647
  if (!c) return;
681
648
  const { buildSolution: m, params: f } = c;
682
649
  if (typeof m == "object" && m !== null && "solution" in m) {
683
650
  const g = m.solution;
684
- g.thumbnailUrl = a.thumbnail ? `${n ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
651
+ g.thumbnailUrl = a.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
685
652
  }
686
653
  const d = {
687
654
  ...l,
688
655
  buildSolution: m
689
656
  };
690
657
  o[u] = _(
691
- new oe(d).dumpToLlmTemplate(),
658
+ new re(d).dumpToLlmTemplate(),
692
659
  {
693
660
  itemId: a.id,
694
661
  sourceBuildSolution: structuredClone(m),
@@ -698,54 +665,54 @@ const Et = async (t, e, s) => {
698
665
  ...l,
699
666
  initialTemplate: o[u]
700
667
  };
701
- })), U = o;
702
- }, be = (t) => {
668
+ })), z = o;
669
+ }, ve = (t) => {
703
670
  const e = t?.configurable?.context?.token;
704
671
  return typeof e != "string" || !e.trim() ? null : e;
705
- }, ye = (t) => {
672
+ }, xe = (t) => {
706
673
  const e = t?.configurable?.context?.configContext?.primarySolutionsGroupId;
707
674
  return typeof e != "string" || !e.trim() ? null : e;
708
- }, ve = (t) => {
675
+ }, we = (t) => {
709
676
  const e = t?.configurable?.context?.configContext?.portalURL;
710
677
  if (!(typeof e != "string" || !e.trim()))
711
678
  return `${e.replace(/\/+$/, "")}/sharing/rest`;
712
- }, At = async (t) => {
679
+ }, $t = async (t) => {
713
680
  await Promise.all([
714
- we(t),
715
- W(t)
681
+ Ie(t),
682
+ K(t)
716
683
  ]);
717
- }, xe = async (t) => {
718
- const e = be(t);
719
- (!N || e && e !== M) && (M = e ?? M, N = At(t).catch((n) => {
720
- throw N = null, M = null, n;
684
+ }, Se = async (t) => {
685
+ const e = ve(t);
686
+ (!N || e && e !== M) && (M = e ?? M, N = $t(t).catch((i) => {
687
+ throw N = null, M = null, i;
721
688
  })), await N;
722
689
  };
723
- async function we(t) {
724
- if ($) return $;
725
- const e = ye(t);
690
+ async function Ie(t) {
691
+ if (F) return F;
692
+ const e = xe(t);
726
693
  if (!e)
727
694
  return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
728
- const s = ve(t), n = t?.configurable?.context?.configContext?.portalURL;
729
- await new Ue(n ? { url: n } : void 0).load();
730
- const o = be(t) ?? void 0, a = await Tt(e, o, s);
731
- return a ? ($ = a.items, $) : null;
695
+ const s = we(t), i = t?.configurable?.context?.configContext?.portalURL;
696
+ await new Ve(i ? { url: i } : void 0).load();
697
+ const o = ve(t) ?? void 0, a = await At(e, o, s);
698
+ return a ? (F = a.items, F) : null;
732
699
  }
733
- const Lt = () => Object.entries(L).map(([t, e]) => `ID: ${t}
700
+ const Dt = () => Object.entries(L).map(([t, e]) => `ID: ${t}
734
701
  Label: ${e.label}
735
702
  Description: ${e.description}`).join(`
736
703
 
737
- `), Dt = (t) => {
704
+ `), Ft = (t) => {
738
705
  const e = t?.configurable?.context?.solutionDesignJson;
739
706
  if (typeof e != "string" || !e.trim())
740
707
  return null;
741
708
  try {
742
- const s = JSON.parse(e), n = _(
709
+ const s = JSON.parse(e), i = _(
743
710
  { response: "", ...s },
744
711
  { itemId: s?.solution?.itemId ?? null }
745
- ), i = V.safeParse(n);
746
- if (!i.success)
712
+ ), n = W.safeParse(i);
713
+ if (!n.success)
747
714
  return null;
748
- const { response: o, ...a } = i.data, l = s.templateId, u = typeof l == "string" && H(l) ? l : null;
715
+ const { response: o, ...a } = n.data, l = s.templateId, u = typeof l == "string" && Q(l) ? l : null;
749
716
  return _(
750
717
  a,
751
718
  {
@@ -757,8 +724,8 @@ Description: ${e.description}`).join(`
757
724
  } catch {
758
725
  return null;
759
726
  }
760
- }, Rt = b.Root({
761
- ...J(),
727
+ }, Nt = b.Root({
728
+ ...G(),
762
729
  /** Optional human-readable template description retained for UI use. */
763
730
  templateDescription: b({
764
731
  reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
@@ -794,38 +761,38 @@ Description: ${e.description}`).join(`
794
761
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
795
762
  default: () => null
796
763
  })
797
- }), Ft = (t, e) => {
798
- const s = Dt(e), n = s?.templateId ?? null, i = {};
799
- return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (i.currentDesign = s), n && t.selectedTemplate !== n && (i.selectedTemplate = n), i;
800
- }, $t = async (t, e) => {
801
- await w({ text: h("understandingRequest", e) }, e), await xe(e);
802
- const s = t.agentExecutionContext.userRequest, n = Lt(), i = t.agentExecutionContext.messages.slice(-11), o = await T({
764
+ }), Mt = (t, e) => {
765
+ const s = Ft(e), i = s?.templateId ?? null, n = {};
766
+ return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (n.currentDesign = s), i && t.selectedTemplate !== i && (n.selectedTemplate = i), n;
767
+ }, Bt = async (t, e) => {
768
+ await w({ text: h("understandingRequest", e) }, e), await Se(e);
769
+ const s = t.agentExecutionContext.userRequest, i = Dt(), n = t.agentExecutionContext.messages.slice(-11), o = await T({
803
770
  promptText: await y(C, "assessBuildRequest"),
804
771
  modelTier: "advanced",
805
772
  temperature: 0,
806
- schema: ht,
807
- messages: i,
808
- inputVariables: { query: s, availableTemplates: n }
773
+ schema: yt,
774
+ messages: n,
775
+ inputVariables: { query: s, availableTemplates: i }
809
776
  }), a = o.matchedTemplates.filter(
810
- (d) => H(d.templateId)
777
+ (d) => Q(d.templateId)
811
778
  ), l = {
812
779
  ...o,
813
780
  matchedTemplates: a
814
- }, [u, c] = a, f = !!u && u.confidence >= vt && (c === void 0 || u.confidence - c.confidence >= xt) ? u.templateId : null;
781
+ }, [u, c] = a, f = !!u && u.confidence >= St && (c === void 0 || u.confidence - c.confidence >= It) ? u.templateId : null;
815
782
  return {
816
783
  assessment: l,
817
784
  selectedTemplate: f,
818
785
  existingMatches: [],
819
786
  continueBuilding: null
820
787
  };
821
- }, Nt = (t) => {
788
+ }, Pt = (t) => {
822
789
  const e = t.assessment?.assistantResponse ?? "";
823
790
  return {
824
791
  outputMessage: e,
825
792
  summary: e,
826
793
  status: "success"
827
794
  };
828
- }, Mt = async (t, e) => {
795
+ }, qt = async (t, e) => {
829
796
  const { currentDesign: s } = t;
830
797
  if (!s)
831
798
  return {
@@ -835,58 +802,58 @@ Description: ${e.description}`).join(`
835
802
  }
836
803
  };
837
804
  await w({ text: h("understandingRequest", e) }, e);
838
- const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11);
805
+ const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
839
806
  return {
840
807
  updateAssessment: await T({
841
808
  promptText: await y(C, "assessUpdateRequest"),
842
809
  modelTier: "advanced",
843
810
  temperature: 0,
844
- schema: pt,
845
- messages: i,
811
+ schema: ht,
812
+ messages: n,
846
813
  inputVariables: {
847
- currentDesign: JSON.stringify(ae(s)),
848
- query: n
814
+ currentDesign: JSON.stringify(le(s)),
815
+ query: i
849
816
  }
850
817
  })
851
818
  };
852
- }, Bt = (t, e) => {
819
+ }, Ut = (t, e) => {
853
820
  const s = t.updateAssessment?.assistantResponse ?? h("applyChangeFailed", e);
854
821
  return {
855
822
  outputMessage: s,
856
823
  summary: s,
857
824
  status: "success"
858
825
  };
859
- }, Pt = (t, e) => {
860
- const { hitlResponse: s } = e.configurable, n = "selectTemplate", i = t.assessment?.matchedTemplates.filter(
861
- (c) => H(c.templateId)
862
- ) ?? [], o = i.map((c) => `${c.templateDescription}`);
863
- if (s?.agentId !== "solutionBuilder" || s.id !== n) {
826
+ }, Ot = (t, e) => {
827
+ const { hitlResponse: s } = e.configurable, i = "selectTemplate", n = t.assessment?.matchedTemplates.filter(
828
+ (c) => Q(c.templateId)
829
+ ) ?? [], o = n.map((c) => `${c.templateDescription}`);
830
+ if (s?.agentId !== "solutionBuilder" || s.id !== i) {
864
831
  const c = {
865
832
  agentId: "solutionBuilder",
866
- id: n,
833
+ id: i,
867
834
  kind: "singleSelection",
868
835
  message: h("selectTemplatePrompt", e),
869
836
  metadata: [...o]
870
837
  };
871
- throw new ie(c);
838
+ throw new ae(c);
872
839
  }
873
840
  const a = String(s.payload ?? ""), l = o.findIndex((c) => c === a);
874
841
  return {
875
- selectedTemplate: (l >= 0 ? i[l] : void 0)?.templateId ?? i[0]?.templateId ?? null
842
+ selectedTemplate: (l >= 0 ? n[l] : void 0)?.templateId ?? n[0]?.templateId ?? null
876
843
  };
877
- }, qt = async (t, e) => {
844
+ }, zt = async (t, e) => {
878
845
  await w({ text: h("searchingExistingSolutions", e) }, e);
879
- const s = t.agentExecutionContext.userRequest, n = tt(t.agentExecutionContext.messages) || s, i = await we(e);
880
- if (!i)
846
+ const s = t.agentExecutionContext.userRequest, i = ot(t.agentExecutionContext.messages) || s, n = await Ie(e);
847
+ if (!n)
881
848
  return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
882
- if (!i.length)
849
+ if (!n.length)
883
850
  return { existingMatches: [] };
884
- const [o] = await Me([n]), a = i.map((d) => ({
851
+ const [o] = await Pe([i]), a = n.map((d) => ({
885
852
  solution: d,
886
- score: Be(o, d.embedding)
853
+ score: qe(o, d.embedding)
887
854
  }));
888
855
  a.sort((d, g) => g.score - d.score);
889
- const l = a.slice(0, yt);
856
+ const l = a.slice(0, wt);
890
857
  if (!l.length)
891
858
  return { existingMatches: [] };
892
859
  const u = l.map(({ solution: d }) => `${d.title}
@@ -898,61 +865,61 @@ Description: ${d.description}`).join(`
898
865
  promptText: await y(C, "findExistingSolution"),
899
866
  modelTier: "fast",
900
867
  temperature: 0,
901
- schema: mt,
868
+ schema: ft,
902
869
  messages: c,
903
870
  inputVariables: { query: s, candidates: u }
904
871
  })).matchedTitles.map((d) => l.find(({ solution: g }) => g.title === d)).filter((d) => d !== void 0) };
905
- }, Ut = (t, e) => {
906
- const { existingMatches: s } = t, { hitlResponse: n } = e.configurable, i = `confirmExistingSolution:${s[0].solution.id}`;
907
- if (n?.agentId !== "solutionBuilder" || n.id !== i) {
908
- s.length === 1 ? de(s[0].solution.id) : ce(s);
872
+ }, jt = (t, e) => {
873
+ const { existingMatches: s } = t, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${s[0].solution.id}`;
874
+ if (i?.agentId !== "solutionBuilder" || i.id !== n) {
875
+ s.length === 1 ? pe(s[0].solution.id) : ue(s);
909
876
  const u = h("existingSolutionMatch", e), c = [
910
877
  h("continueBuildingYes", e),
911
878
  h("continueBuildingNo", e)
912
879
  ], m = {
913
880
  agentId: "solutionBuilder",
914
- id: i,
881
+ id: n,
915
882
  kind: "singleSelection",
916
883
  message: u,
917
884
  metadata: c
918
885
  };
919
- throw new ie(m);
886
+ throw new ae(m);
920
887
  }
921
- const o = String(n.payload ?? "").trim(), a = h("continueBuildingNo", e);
888
+ const o = String(i.payload ?? "").trim(), a = h("continueBuildingNo", e);
922
889
  return { continueBuilding: o !== a };
923
- }, Ot = (t, e) => {
890
+ }, Vt = (t, e) => {
924
891
  const s = h("continueBuildingDeclined", e);
925
892
  return {
926
893
  outputMessage: s,
927
894
  summary: s,
928
895
  status: "success"
929
896
  };
930
- }, Se = async (t, e) => {
931
- await xe(e);
932
- const { currentDesign: s } = t, n = t.agentExecutionContext.userRequest;
897
+ }, Ce = async (t, e) => {
898
+ await Se(e);
899
+ const { currentDesign: s } = t, i = t.agentExecutionContext.userRequest;
933
900
  await w({ text: h("creatingDesign", e) }, e);
934
- let i = B(t.selectedTemplate);
935
- if (i?.initialTemplate || (await W(e), i = B(t.selectedTemplate)), !i?.initialTemplate)
901
+ let n = B(t.selectedTemplate);
902
+ if (n?.initialTemplate || (await K(e), n = B(t.selectedTemplate)), !n?.initialTemplate)
936
903
  throw new Error("No hydrated templates are available for solution design.");
937
904
  const o = _(
938
- s ?? i.initialTemplate,
905
+ s ?? n.initialTemplate,
939
906
  {
940
- itemId: (s ?? i.initialTemplate)?.solution?.itemId ?? null,
941
- sourceBuildSolution: s?.sourceBuildSolution ?? i.initialTemplate.sourceBuildSolution,
942
- params: s?.params ?? i.initialTemplate.params ?? null
907
+ itemId: (s ?? n.initialTemplate)?.solution?.itemId ?? null,
908
+ sourceBuildSolution: s?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
909
+ params: s?.params ?? n.initialTemplate.params ?? null
943
910
  }
944
911
  ), a = t.agentExecutionContext.messages.slice(-11), l = await T({
945
912
  promptText: await y(C, "designSolution"),
946
913
  modelTier: "advanced",
947
914
  temperature: 0,
948
- schema: V,
915
+ schema: W,
949
916
  messages: a,
950
917
  inputVariables: {
951
- currentDesign: JSON.stringify(re(o)),
952
- templateInstructions: i.instructions,
953
- query: n
918
+ currentDesign: JSON.stringify(ce(o)),
919
+ templateInstructions: n.instructions,
920
+ query: i
954
921
  }
955
- }), { response: u, featureLayer: c, ...m } = l, f = le(
922
+ }), { response: u, featureLayer: c, ...m } = l, f = de(
956
923
  c,
957
924
  o.featureLayer
958
925
  ), d = _(
@@ -963,7 +930,7 @@ Description: ${d.description}`).join(`
963
930
  templateId: t.selectedTemplate ?? null,
964
931
  params: o.params ?? null
965
932
  }
966
- ), g = new ge(d, i.initialTemplate);
933
+ ), g = new fe(d, n.initialTemplate);
967
934
  if (!g.isValid)
968
935
  return console.warn(
969
936
  "[SolutionBuilder] designSolution validation failed:",
@@ -971,7 +938,7 @@ Description: ${d.description}`).join(`
971
938
  ), {
972
939
  outputMessage: h("createDesignFailed", e)
973
940
  };
974
- const A = d.sourceBuildSolution, E = fe(d, A);
941
+ const A = d.sourceBuildSolution, E = ye(d, A);
975
942
  if (!E.ok) {
976
943
  console.warn(
977
944
  "[SolutionBuilder] designSolution Esri JSON conversion failed:",
@@ -984,17 +951,17 @@ Description: ${d.description}`).join(`
984
951
  status: "success"
985
952
  };
986
953
  }
987
- return he(d), {
954
+ return be(d), {
988
955
  outputMessage: u,
989
956
  summary: u,
990
957
  status: "success",
991
958
  currentDesign: d
992
959
  };
993
- }, zt = async (t, e) => {
960
+ }, Jt = async (t, e) => {
994
961
  const { currentDesign: s } = t;
995
962
  if (!s)
996
- return Se(t, e);
997
- const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11);
963
+ return Ce(t, e);
964
+ const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
998
965
  await w({ text: h("updatingDesign", e) }, e);
999
966
  let o;
1000
967
  try {
@@ -1002,11 +969,11 @@ Description: ${d.description}`).join(`
1002
969
  promptText: await y(C, "updateDesign"),
1003
970
  modelTier: "advanced",
1004
971
  temperature: 0,
1005
- schema: dt,
1006
- messages: i,
972
+ schema: mt,
973
+ messages: n,
1007
974
  inputVariables: {
1008
- currentDesign: JSON.stringify(ae(s)),
1009
- query: n
975
+ currentDesign: JSON.stringify(le(s)),
976
+ query: i
1010
977
  }
1011
978
  });
1012
979
  } catch (p) {
@@ -1029,8 +996,8 @@ Description: ${d.description}`).join(`
1029
996
  try {
1030
997
  return JSON.parse(p);
1031
998
  } catch {
1032
- const v = p.replace(/[\u0000-\u001F]/g, (X) => {
1033
- switch (X) {
999
+ const v = p.replace(/[\u0000-\u001F]/g, (ee) => {
1000
+ switch (ee) {
1034
1001
  case "\b":
1035
1002
  return "\\b";
1036
1003
  case "\f":
@@ -1043,7 +1010,7 @@ Description: ${d.description}`).join(`
1043
1010
  case " ":
1044
1011
  return "\\t";
1045
1012
  default:
1046
- return "\\u" + X.charCodeAt(0).toString(16).padStart(4, "0");
1013
+ return "\\u" + ee.charCodeAt(0).toString(16).padStart(4, "0");
1047
1014
  }
1048
1015
  });
1049
1016
  try {
@@ -1058,10 +1025,10 @@ Description: ${d.description}`).join(`
1058
1025
  ...p.value != null && p.value !== "" ? { value: u(p.value) } : {},
1059
1026
  ...p.from != null && p.from !== "" ? { from: p.from } : {}
1060
1027
  }))].sort((p, v) => p.op !== "remove" || v.op !== "remove" ? 0 : v.path.localeCompare(p.path, void 0, { numeric: !0 })), f = structuredClone(
1061
- re(s)
1028
+ ce(s)
1062
1029
  );
1063
1030
  try {
1064
- qe(f, m, !0);
1031
+ Oe(f, m, !0);
1065
1032
  } catch (p) {
1066
1033
  console.warn(
1067
1034
  "[SolutionBuilder] updateDesign JSON patch failed:",
@@ -1077,7 +1044,7 @@ Description: ${d.description}`).join(`
1077
1044
  const d = _(
1078
1045
  { response: "", ...f },
1079
1046
  { itemId: s.solution?.itemId ?? null }
1080
- ), g = V.safeParse(d);
1047
+ ), g = W.safeParse(d);
1081
1048
  if (!g.success) {
1082
1049
  console.warn(
1083
1050
  "[SolutionBuilder] updateDesign schema validation failed:",
@@ -1090,11 +1057,11 @@ Description: ${d.description}`).join(`
1090
1057
  status: "success"
1091
1058
  };
1092
1059
  }
1093
- const { response: A, featureLayer: E, ...k } = g.data, Ce = le(
1060
+ const { response: A, featureLayer: E, ...k } = g.data, Te = de(
1094
1061
  E,
1095
1062
  s.featureLayer
1096
1063
  ), S = _(
1097
- { ...k, featureLayer: Ce },
1064
+ { ...k, featureLayer: Te },
1098
1065
  {
1099
1066
  itemId: s.solution?.itemId,
1100
1067
  sourceBuildSolution: s.sourceBuildSolution,
@@ -1102,19 +1069,19 @@ Description: ${d.description}`).join(`
1102
1069
  params: s.params ?? null
1103
1070
  }
1104
1071
  );
1105
- let D = B(t.selectedTemplate);
1106
- if (D?.initialTemplate || (await W(e), D = B(t.selectedTemplate)), !D?.initialTemplate)
1072
+ let R = B(t.selectedTemplate);
1073
+ if (R?.initialTemplate || (await K(e), R = B(t.selectedTemplate)), !R?.initialTemplate)
1107
1074
  throw new Error("No hydrated templates are available for solution design.");
1108
- const q = new ge(S, D.initialTemplate, !1);
1075
+ const q = new fe(S, R.initialTemplate, !1);
1109
1076
  if (!q.isValid) {
1110
1077
  console.warn(
1111
1078
  "[SolutionBuilder] updateDesign validation failed:",
1112
1079
  { issues: q.issues, llmResponse: o, patchedDesign: S }
1113
1080
  );
1114
- const p = await bt({
1115
- query: n,
1081
+ const p = await xt({
1082
+ query: i,
1116
1083
  validationIssues: q.issues,
1117
- recentMessages: i,
1084
+ recentMessages: n,
1118
1085
  fallbackMessage: h("applyChangeFailed", e),
1119
1086
  promptModules: C
1120
1087
  });
@@ -1124,11 +1091,11 @@ Description: ${d.description}`).join(`
1124
1091
  status: "success"
1125
1092
  };
1126
1093
  }
1127
- const _e = S.sourceBuildSolution, Y = fe(S, _e);
1128
- if (!Y.ok) {
1094
+ const Ee = S.sourceBuildSolution, Z = ye(S, Ee);
1095
+ if (!Z.ok) {
1129
1096
  console.warn(
1130
1097
  "[SolutionBuilder] updateDesign Esri JSON conversion failed:",
1131
- { error: Y.error, llmResponse: o, design: S }
1098
+ { error: Z.error, llmResponse: o, design: S }
1132
1099
  );
1133
1100
  const p = h("applyChangeFailed", e);
1134
1101
  return {
@@ -1137,45 +1104,45 @@ Description: ${d.description}`).join(`
1137
1104
  status: "success"
1138
1105
  };
1139
1106
  }
1140
- return he(S), {
1107
+ return be(S), {
1141
1108
  outputMessage: a,
1142
1109
  summary: a,
1143
1110
  status: "success",
1144
1111
  currentDesign: S
1145
1112
  };
1146
- }, jt = (t) => t.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", Jt = (t) => !t.updateAssessment || !t.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", Gt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidBuildExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Vt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", Ht = (t) => t.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", Wt = () => new z(Rt).addNode("syncCurrentDesignFromContext", Ft).addNode("assessBuildRequest", $t).addNode("assessUpdateRequest", Mt).addNode("invalidBuildExit", Nt).addNode("invalidUpdateExit", Bt).addNode("selectTemplateHIL", Pt).addNode("findExistingSolutions", qt).addNode("confirmContinueBuildingHIL", Ut).addNode("declineContinueBuildingExit", Ot).addNode("designSolution", Se).addNode("updateDesign", zt).addEdge(j, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", jt, {
1113
+ }, Gt = (t) => t.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", Ht = (t) => !t.updateAssessment || !t.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", Wt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidBuildExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Qt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", Kt = (t) => t.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", Yt = () => new V(Nt).addNode("syncCurrentDesignFromContext", Mt).addNode("assessBuildRequest", Bt).addNode("assessUpdateRequest", qt).addNode("invalidBuildExit", Pt).addNode("invalidUpdateExit", Ut).addNode("selectTemplateHIL", Ot).addNode("findExistingSolutions", zt).addNode("confirmContinueBuildingHIL", jt).addNode("declineContinueBuildingExit", Vt).addNode("designSolution", Ce).addNode("updateDesign", Jt).addEdge(J, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Gt, {
1147
1114
  assessUpdateRequest: "assessUpdateRequest",
1148
1115
  assessBuildRequest: "assessBuildRequest"
1149
- }).addConditionalEdges("assessUpdateRequest", Jt, {
1116
+ }).addConditionalEdges("assessUpdateRequest", Ht, {
1150
1117
  invalidUpdateExit: "invalidUpdateExit",
1151
1118
  updateDesign: "updateDesign"
1152
- }).addConditionalEdges("assessBuildRequest", Gt, {
1119
+ }).addConditionalEdges("assessBuildRequest", Wt, {
1153
1120
  invalidBuildExit: "invalidBuildExit",
1154
1121
  selectTemplateHIL: "selectTemplateHIL",
1155
1122
  findExistingSolutions: "findExistingSolutions"
1156
- }).addEdge("invalidBuildExit", x).addEdge("invalidUpdateExit", x).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Vt, {
1123
+ }).addEdge("invalidBuildExit", x).addEdge("invalidUpdateExit", x).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Qt, {
1157
1124
  confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
1158
1125
  designSolution: "designSolution"
1159
- }).addConditionalEdges("confirmContinueBuildingHIL", Ht, {
1126
+ }).addConditionalEdges("confirmContinueBuildingHIL", Kt, {
1160
1127
  declineContinueBuildingExit: "declineContinueBuildingExit",
1161
1128
  designSolution: "designSolution"
1162
1129
  }).addEdge("declineContinueBuildingExit", x).addEdge("designSolution", x).addEdge("updateDesign", x);
1163
1130
  await y(C, "description");
1164
- const Kt = F.object({
1165
- tool: F.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
1166
- confidence: F.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
1167
- rationale: F.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
1168
- }), K = /* @__PURE__ */ Object.assign({
1131
+ const Xt = D.object({
1132
+ tool: D.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
1133
+ confidence: D.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
1134
+ rationale: D.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
1135
+ }), Y = /* @__PURE__ */ Object.assign({
1169
1136
  "./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((t) => t.default),
1170
1137
  "./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((t) => t.default),
1171
1138
  "./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default)
1172
- }), Q = (t) => {
1139
+ }), X = (t) => {
1173
1140
  const e = new CustomEvent("assistantProcessing", {
1174
1141
  detail: { finished: !0, agent: t }
1175
1142
  });
1176
1143
  window.dispatchEvent(e);
1177
- }, Ie = b.Root({
1178
- ...J(),
1144
+ }, _e = b.Root({
1145
+ ...G(),
1179
1146
  selectedTool: b({
1180
1147
  reducer: (t, e) => e ?? null,
1181
1148
  default: () => null
@@ -1184,7 +1151,7 @@ const Kt = F.object({
1184
1151
  reducer: (t, e) => e ?? null,
1185
1152
  default: () => null
1186
1153
  })
1187
- }), Qt = async (t, e) => {
1154
+ }), Zt = async (t, e) => {
1188
1155
  if (e?.configurable?.abortSignal?.aborted)
1189
1156
  return {};
1190
1157
  const s = P(e);
@@ -1192,7 +1159,7 @@ const Kt = F.object({
1192
1159
  { text: s?.builderMessages.understandingRequest },
1193
1160
  e
1194
1161
  );
1195
- const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11), o = e?.configurable?.context?.solutionDesignJson;
1162
+ const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11), o = e?.configurable?.context?.solutionDesignJson;
1196
1163
  let a = !1;
1197
1164
  if (typeof o == "string" && o.trim())
1198
1165
  try {
@@ -1200,73 +1167,73 @@ const Kt = F.object({
1200
1167
  } catch {
1201
1168
  a = !1;
1202
1169
  }
1203
- const l = await y(K, "classifyIntent"), u = await T({
1170
+ const l = await y(Y, "classifyIntent"), u = await T({
1204
1171
  promptText: l,
1205
1172
  modelTier: "advanced",
1206
1173
  temperature: 0,
1207
- schema: Kt,
1208
- messages: i,
1209
- inputVariables: { query: n, activeSolutionDesign: a }
1174
+ schema: Xt,
1175
+ messages: n,
1176
+ inputVariables: { query: i, activeSolutionDesign: a }
1210
1177
  });
1211
1178
  return {
1212
1179
  selectedTool: u.tool,
1213
1180
  intentRationale: u.rationale
1214
1181
  };
1215
- }, Yt = async (t, e) => {
1182
+ }, es = async (t, e) => {
1216
1183
  if (e?.configurable?.abortSignal?.aborted)
1217
1184
  return {};
1218
- const n = await Ke().compile().invoke(t, e);
1219
- return Q("explorer"), n;
1220
- }, Xt = async (t, e) => {
1185
+ const i = await Ze().compile().invoke(t, e);
1186
+ return X("explorer"), i;
1187
+ }, ts = async (t, e) => {
1221
1188
  if (e?.configurable?.abortSignal?.aborted)
1222
1189
  return {};
1223
- const n = await Wt().compile().invoke(t, e);
1224
- return Q("builder"), n;
1225
- }, Zt = async (t, e) => {
1190
+ const i = await Yt().compile().invoke(t, e);
1191
+ return X("builder"), i;
1192
+ }, ss = async (t, e) => {
1226
1193
  if (e?.configurable?.abortSignal?.aborted)
1227
1194
  return {};
1228
- const s = P(e), n = t.agentExecutionContext.userRequest, i = t.intentRationale ?? "No rationale available.";
1195
+ const s = P(e), i = t.agentExecutionContext.userRequest, n = t.intentRationale ?? "No rationale available.";
1229
1196
  await w(
1230
1197
  { text: s?.executingSolutionsAssistantAgent },
1231
1198
  e
1232
1199
  );
1233
- const o = await y(K, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await Pe({
1200
+ const o = await y(Y, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await Ue({
1234
1201
  promptText: o,
1235
1202
  modelTier: "advanced",
1236
1203
  temperature: 0,
1237
1204
  messages: a,
1238
- inputVariables: { query: n, rationale: i }
1205
+ inputVariables: { query: i, rationale: n }
1239
1206
  });
1240
- return Q("assistant"), {
1207
+ return X("assistant"), {
1241
1208
  outputMessage: l,
1242
1209
  summary: l,
1243
1210
  status: "success"
1244
1211
  };
1245
- }, es = (t) => t.selectedTool ?? "other", ts = () => new z(Ie).addNode("classifyIntent", Qt).addNode("routeToExplorer", Yt).addNode("routeToBuilder", Xt).addNode("assistantResponse", Zt).addEdge(j, "classifyIntent").addConditionalEdges("classifyIntent", es, {
1212
+ }, is = (t) => t.selectedTool ?? "other", ns = () => new V(_e).addNode("classifyIntent", Zt).addNode("routeToExplorer", es).addNode("routeToBuilder", ts).addNode("assistantResponse", ss).addEdge(J, "classifyIntent").addConditionalEdges("classifyIntent", is, {
1246
1213
  explorer: "routeToExplorer",
1247
1214
  builder: "routeToBuilder",
1248
1215
  other: "assistantResponse"
1249
- }).addEdge("routeToExplorer", x).addEdge("routeToBuilder", x).addEdge("assistantResponse", x), ss = await y(K, "description"), ns = {
1216
+ }).addEdge("routeToExplorer", x).addEdge("routeToBuilder", x).addEdge("assistantResponse", x), os = await y(Y, "description"), as = {
1250
1217
  id: "solutionsAssistant",
1251
1218
  name: "Solutions Assistant Agent",
1252
- description: ss,
1253
- createGraph: ts,
1254
- workspace: Ie
1255
- }, is = "https://links.esri.com/solutions/agol-organizational-account", os = "https://links.esri.com/solutions/configure-assistants";
1256
- class as extends ke {
1219
+ description: os,
1220
+ createGraph: ns,
1221
+ workspace: _e
1222
+ }, rs = "https://links.esri.com/solutions/agol-organizational-account", ls = "https://links.esri.com/solutions/configure-assistants";
1223
+ class cs extends Le {
1257
1224
  constructor() {
1258
1225
  super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._orgSettings = {
1259
1226
  aiAssistantsEnabled: !1,
1260
1227
  blockBetaApps: !0,
1261
1228
  colocateCompute: !1
1262
- }, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Ee({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._showNewChatConfirm = !1, this._assistantRef = $e(), this._configContextConsumer = te({
1229
+ }, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Ae({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._showNewChatConfirm = !1, this._assistantRef = Me(), this._configContextConsumer = ie({
1263
1230
  context: De,
1264
1231
  subscribe: !0,
1265
1232
  callback: (e) => {
1266
- e?.portalURL && (se.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1233
+ e?.portalURL && (ne.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1267
1234
  }
1268
- }), this._builderDesignContextConsumer = te({
1269
- context: Re,
1235
+ }), this._builderDesignContextConsumer = ie({
1236
+ context: Fe,
1270
1237
  subscribe: !0,
1271
1238
  callback: (e) => {
1272
1239
  e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
@@ -1276,32 +1243,32 @@ class as extends ke {
1276
1243
  }, this._chatStartTime = null, this._handleAssistantProcessingFinished = (e) => {
1277
1244
  const s = e;
1278
1245
  if (s.detail?.finished && this._chatStartTime !== null) {
1279
- const n = Fe(this._chatStartTime);
1246
+ const i = Ne(this._chatStartTime);
1280
1247
  this._telemetry?.logEvent({
1281
- category: R.ASSISTANT,
1248
+ category: $.ASSISTANT,
1282
1249
  action: "Chat",
1283
1250
  dimensions: [s.detail.agent],
1284
- metrics: [n]
1251
+ metrics: [i]
1285
1252
  }), this._chatStartTime = null, this.assistantProcessing.emit(!1);
1286
1253
  }
1287
- }, this.closeAssistant = Z(), this.assistantProcessing = Z(), this._handleAssistantLinkClick = (e) => {
1288
- const s = e.composedPath().find((n) => n instanceof HTMLAnchorElement);
1254
+ }, this.closeAssistant = te(), this.assistantProcessing = te(), this._handleAssistantLinkClick = (e) => {
1255
+ const s = e.composedPath().find((i) => i instanceof HTMLAnchorElement);
1289
1256
  if (s?.href)
1290
1257
  if (e.preventDefault(), s.target.indexOf("solutionId:") > -1) {
1291
- const n = s.target.split("solutionId:")[1];
1292
- this._emitItemIdFromAI(n);
1258
+ const i = s.target.split("solutionId:")[1];
1259
+ this._emitItemIdFromAI(i);
1293
1260
  } else
1294
1261
  window.open(s.href, "_blank", "noopener,noreferrer");
1295
1262
  }, this._onSolutionDesignUpdate = (e) => {
1296
- const n = e.detail;
1297
- this._solutionDesignJson = n ? JSON.stringify(n, null, 2) : '{ "solution": null }';
1263
+ const i = e.detail;
1264
+ this._solutionDesignJson = i ? JSON.stringify(i, null, 2) : '{ "solution": null }';
1298
1265
  }, this._handleSignIn = () => {
1299
1266
  this._configContextConsumer.value?.authentication?.signIn("aiOpen");
1300
1267
  }, this._checkURLOpenParameter = () => {
1301
1268
  this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
1302
1269
  }, this.listenOn(window, "arcgisFeedback", (e) => {
1303
- const s = e.detail, { agentPicked: n, taskAssigned: i, userMessage: o } = this._parseAgentPickedAndTask(s);
1304
- this._sendFeedback(s.content, o ?? i ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", n ?? "");
1270
+ const s = e.detail, { agentPicked: i, taskAssigned: n, userMessage: o } = this._parseAgentPickedAndTask(s);
1271
+ this._sendFeedback(s.content, o ?? n ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", i ?? "");
1305
1272
  }), this.listenOn(window, "clearAssistantConversation", () => {
1306
1273
  this._clearConversation();
1307
1274
  });
@@ -1310,7 +1277,7 @@ class as extends ke {
1310
1277
  this.properties = { open: 5, userFirstName: 1, builderVisible: 5, hasActiveBuilderDesign: 5, _conversationId: 16, _orgSettings: 16, _suggestedPrompts: 16, _hasInteracted: 16, _isMobile: 16, _translations: 16, _builderWidth: 16, _solutionDesignJson: 16, _isAssistantBusy: 16, _isBuilderBusy: 16, _preChatCheck: 16, _showNewChatConfirm: 16 };
1311
1278
  }
1312
1279
  static {
1313
- this.styles = ze;
1280
+ this.styles = Ge;
1314
1281
  }
1315
1282
  get _telemetry() {
1316
1283
  return this._configContextConsumer.value?.telemetrySession;
@@ -1325,29 +1292,29 @@ class as extends ke {
1325
1292
  this._checkURLOpenParameter();
1326
1293
  }
1327
1294
  load() {
1328
- this._configContextConsumer.value?.portalURL && (se.portalUrl = this._configContextConsumer.value.portalURL);
1295
+ this._configContextConsumer.value?.portalURL && (ne.portalUrl = this._configContextConsumer.value.portalURL);
1329
1296
  }
1330
1297
  firstUpdated(e) {
1331
1298
  this._loadUserFirstName();
1332
1299
  }
1333
1300
  willUpdate(e) {
1334
- e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (pe(this._configContextConsumer.value?.authentication.Portal, this._configContextConsumer.value?.userSession?.token, this._configContextConsumer.value?.locale ?? "en"), this._preChatCheck = !0)), this._configContextConsumer.value?.userSession?.token && this._configContextConsumer.value?.authentication?.CanUseAI;
1301
+ e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (ge(this._configContextConsumer.value?.authentication.Portal, this._configContextConsumer.value?.userSession?.token, this._configContextConsumer.value?.locale ?? "en"), this._preChatCheck = !0)), this._configContextConsumer.value?.userSession?.token && this._configContextConsumer.value?.authentication?.CanUseAI;
1335
1302
  }
1336
1303
  _renderNoSign() {
1337
- return I`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage ?? ee} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
1304
+ return I`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage ?? se} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
1338
1305
  }
1339
1306
  _renderNoPermission() {
1340
- return I`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${Le(this._translations.noPermissionMessage.replace("{{orgUrl}}", is).replace("{{configAI}}", os))}</div></calcite-notice>`;
1307
+ return I`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${$e(this._translations.noPermissionMessage.replace("{{orgUrl}}", rs).replace("{{configAI}}", ls))}</div></calcite-notice>`;
1341
1308
  }
1342
1309
  render() {
1343
1310
  let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
1344
1311
  return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), I`<calcite-panel class="chat-panel"><div class="header-content" slot=header-content><span class="header-title">${this._translations.solutionAssistantTitle}</span></div>${this._configContextConsumer.value?.userSession?.token ? this._configContextConsumer.value?.authentication?.CanUseAI ? I`${!this._isMobile && I`<calcite-action id=solutionBuilderAction icon=pencil-square .text=${this._translations.tooltips.builder} text-enabled .indicator=${this.hasActiveBuilderDesign} .disabled=${!this.hasActiveBuilderDesign} .active=${this.builderVisible} selection-appearance=highlight @click=${() => {
1345
1312
  this._telemetry?.logEvent({
1346
- category: R.ASSISTANT,
1313
+ category: $.ASSISTANT,
1347
1314
  action: "Toggle Builder Panel",
1348
1315
  dimensions: [this.builderVisible ? "Close" : "Open"]
1349
1316
  }), window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
1350
- }} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && I`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.solutionBuilder}</span></calcite-tooltip>` || ""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage ?? ee} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
1317
+ }} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && I`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.solutionBuilder}</span></calcite-tooltip>` || ""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage ?? se} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
1351
1318
  console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
1352
1319
  }} @arcgisFeedback=${(s) => {
1353
1320
  s.detail;
@@ -1357,13 +1324,13 @@ class as extends ke {
1357
1324
  this._queryElementInShadowDom(this.el, ".footer-container", !1);
1358
1325
  }} @arcgisInterruptSubmit=${() => {
1359
1326
  this._queryElementInShadowDom(this.el, ".footer-container", !1);
1360
- }} ${Ne(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
1327
+ }} ${Be(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
1361
1328
  this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
1362
- category: R.ASSISTANT,
1329
+ category: $.ASSISTANT,
1363
1330
  action: "New Chat",
1364
1331
  dimensions: ["No Active Design"]
1365
1332
  }), this._clearConversation());
1366
- }} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${ns} .context=${{
1333
+ }} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${as} .context=${{
1367
1334
  token: this._configContextConsumer.value?.userSession?.token,
1368
1335
  configContext: this._configContextConsumer.value,
1369
1336
  convoId: this._conversationId,
@@ -1381,7 +1348,7 @@ class as extends ke {
1381
1348
  this._showNewChatConfirm = !1;
1382
1349
  }} slot=footer-end>\r\n Cancel</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
1383
1350
  this._telemetry?.logEvent({
1384
- category: R.ASSISTANT,
1351
+ category: $.ASSISTANT,
1385
1352
  action: "New Chat",
1386
1353
  dimensions: ["With Design Discard"]
1387
1354
  }), this._showNewChatConfirm = !1, window.dispatchEvent(new CustomEvent("requestBuilderDiscard"));
@@ -1392,8 +1359,8 @@ class as extends ke {
1392
1359
  _clearConversation() {
1393
1360
  this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory(), this._queryElementInShadowDom(this.el, ".footer-container", !1);
1394
1361
  }
1395
- _sendFeedback(e, s, n, i) {
1396
- const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(n)}&field:question=${encodeURIComponent(s)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: i }))}&field:version=${encodeURIComponent("v2")}`;
1362
+ _sendFeedback(e, s, i, n) {
1363
+ const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(i)}&field:question=${encodeURIComponent(s)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: n }))}&field:version=${encodeURIComponent("v2")}`;
1397
1364
  window.open(o, "_blank");
1398
1365
  }
1399
1366
  async _loadUserFirstName() {
@@ -1407,7 +1374,7 @@ class as extends ke {
1407
1374
  }
1408
1375
  }
1409
1376
  _parseAgentPickedAndTask(e) {
1410
- const s = Array.from(this._assistantRef.value?.messages || []), n = e.log || [], a = [...s].sort((d, g) => g.id - d.id).find((d) => d.role === "user" && d.id <= e.id)?.content || null, l = n.find((d) => typeof d == "string" && d.includes("Agent picked:")) ?? null;
1377
+ const s = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], a = [...s].sort((d, g) => g.id - d.id).find((d) => d.role === "user" && d.id <= e.id)?.content || null, l = i.find((d) => typeof d == "string" && d.includes("Agent picked:")) ?? null;
1411
1378
  if (!l)
1412
1379
  return { agentPicked: null, taskAssigned: null, userMessage: a };
1413
1380
  const u = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, c = l.match(u);
@@ -1424,30 +1391,30 @@ class as extends ke {
1424
1391
  });
1425
1392
  window.dispatchEvent(s);
1426
1393
  }
1427
- _queryElementInShadowDom(e, s, n) {
1428
- const i = e.shadowRoot;
1429
- if (i) {
1430
- const o = i.querySelector("arcgis-assistant");
1431
- o && o.shadowRoot && this._findElementInShadowDom(o.shadowRoot, s, n);
1394
+ _queryElementInShadowDom(e, s, i) {
1395
+ const n = e.shadowRoot;
1396
+ if (n) {
1397
+ const o = n.querySelector("arcgis-assistant");
1398
+ o && o.shadowRoot && this._findElementInShadowDom(o.shadowRoot, s, i);
1432
1399
  } else
1433
1400
  console.log("No shadowRoot found on this component.");
1434
1401
  }
1435
- _findElementInShadowDom(e, s, n) {
1436
- const i = e.querySelector(s);
1437
- i && this._disableElementAndChildren(i, n);
1402
+ _findElementInShadowDom(e, s, i) {
1403
+ const n = e.querySelector(s);
1404
+ n && this._disableElementAndChildren(n, i);
1438
1405
  const o = e.children;
1439
1406
  for (const a of Array.from(o))
1440
- a.classList.contains(s) && this._disableElementAndChildren(a, n), this._findElementInShadowDom(a, s, n);
1407
+ a.classList.contains(s) && this._disableElementAndChildren(a, i), this._findElementInShadowDom(a, s, i);
1441
1408
  }
1442
1409
  _disableElementAndChildren(e, s) {
1443
- "disabled" in e && (e.disabled = s), e.querySelectorAll("*").forEach((i) => {
1444
- i.nodeName.toLowerCase() === "arcgis-assistant-chat-entry" && i.shadowRoot && i.shadowRoot.querySelectorAll("*").forEach((l) => {
1410
+ "disabled" in e && (e.disabled = s), e.querySelectorAll("*").forEach((n) => {
1411
+ n.nodeName.toLowerCase() === "arcgis-assistant-chat-entry" && n.shadowRoot && n.shadowRoot.querySelectorAll("*").forEach((l) => {
1445
1412
  "disabled" in l && (l.disabled = s);
1446
- }), "disabled" in i && (i.disabled = s);
1413
+ }), "disabled" in n && (n.disabled = s);
1447
1414
  });
1448
1415
  }
1449
1416
  }
1450
- Te("arcgis-solutions-assistant", as);
1417
+ ke("arcgis-solutions-assistant", cs);
1451
1418
  export {
1452
- as as ArcgisSolutionsAssistant
1419
+ cs as ArcgisSolutionsAssistant
1453
1420
  };