@esri/solutions-components 5.1.0-next.141 → 5.1.0-next.142

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.
Files changed (29) hide show
  1. package/dist/cdn/{AYQT4HC4.js → 34JROLRM.js} +1 -1
  2. package/dist/cdn/4WJ2UJWQ.js +2 -0
  3. package/dist/cdn/{PV6MK2E6.js → FV4F6RW3.js} +1 -1
  4. package/dist/cdn/{QTZMCFZB.js → LLPT3R4B.js} +16 -16
  5. package/dist/cdn/{7J2F4TFI.js → PUQBEN7F.js} +1 -1
  6. package/dist/cdn/{TSYIZSCP.js → RYEEEMFO.js} +11 -1
  7. package/dist/cdn/S6U6SXMD.js +2 -0
  8. package/dist/cdn/{RMCQZMLA.js → TIRNZIMX.js} +1 -1
  9. package/dist/cdn/{OYBEDO63.js → UVOAWVML.js} +1 -1
  10. package/dist/cdn/{SAJPXZDW.js → WCOEPRRK.js} +1 -1
  11. package/dist/cdn/{NN52IXXG.js → YM3CRTWP.js} +1 -1
  12. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.en.json +1 -1
  13. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.json +1 -1
  14. package/dist/cdn/index.js +1 -1
  15. package/dist/chunks/converter.js +114 -105
  16. package/dist/chunks/designSolution.js +11 -1
  17. package/dist/chunks/solution-builder-assistant.js +56 -27
  18. package/dist/chunks/updateDesign.js +1 -1
  19. package/dist/components/arcgis-solutions-assistant/customElement.js +182 -174
  20. package/dist/components/solution-builder-assistant/customElement.d.ts +2 -0
  21. package/dist/components/solution-builder-assistant/customElement.js +3 -2
  22. package/dist/components/solution-builder-assistant/index.js +1 -0
  23. package/dist/docs/api.json +1 -1
  24. package/dist/docs/docs.json +1 -1
  25. package/dist/docs/web-types.json +1 -1
  26. package/dist/solutions-components_commit.txt +8 -5
  27. package/package.json +1 -1
  28. package/dist/cdn/LDNPRHOM.js +0 -2
  29. package/dist/cdn/WPGT2HLS.js +0 -2
@@ -5,13 +5,13 @@ import { LitElement as ke, createEvent as X, nothing as ee } from "@arcgis/lumin
5
5
  import { css as Te, html as T } from "lit";
6
6
  import { unsafeHTML as Ee } from "lit/directives/unsafe-html.js";
7
7
  import { useContextConsumer as te } from "@arcgis/lumina/context";
8
- import { c as Ae, b as De } from "../../chunks/deployAppContexts.js";
9
- import { T as Le } from "../../chunks/interfaces.js";
8
+ import { c as Ae, b as Le } from "../../chunks/deployAppContexts.js";
9
+ import { T as De } from "../../chunks/interfaces.js";
10
10
  import { c as Me } from "../../chunks/helpers.js";
11
11
  import se from "@arcgis/core/config.js";
12
- import { createRef as Re, ref as $e } from "lit-html/directives/ref.js";
12
+ import { createRef as $e, ref as Re } from "lit-html/directives/ref.js";
13
13
  import { StateGraph as z, START as O, END as C, Annotation as f, NodeInterrupt as ie } from "@langchain/langgraph/web";
14
- import { createAgentRuntimeState as j, sendTraceMessage as v, invokeStructuredPrompt as A, getEmbeddings as Fe, cosineSimilarity as Pe, invokeTextPrompt as Ne } from "@arcgis/ai-orchestrator";
14
+ import { createAgentRuntimeState as j, sendTraceMessage as x, invokeStructuredPrompt as A, getEmbeddings as Fe, cosineSimilarity as Pe, invokeTextPrompt as Ne } from "@arcgis/ai-orchestrator";
15
15
  import r, { z as M } from "zod";
16
16
  import * as J from "@esri/arcgis-rest-portal";
17
17
  import { applyPatch as Be } from "fast-json-patch";
@@ -21,7 +21,7 @@ import { g as P, d as ae, r as re, t as qe, T as E } from "../../chunks/template
21
21
  import Ue from "@arcgis/core/portal/Portal.js";
22
22
  import ze from "@arcgis/core/portal/PortalItem.js";
23
23
  const Oe = Te`: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
- async function x(t, e) {
24
+ async function v(t, e) {
25
25
  const s = Object.entries(t).find(
26
26
  ([n]) => n.endsWith(`/${e}.md`)
27
27
  );
@@ -77,16 +77,16 @@ function Je(t) {
77
77
  }
78
78
  function Ge(t, e) {
79
79
  const s = [];
80
- return (e?.configurable?.context?.configContext.allCards ?? []).forEach((i) => {
81
- const o = i.title;
82
- if (t.toLowerCase().includes(o.toLowerCase())) {
83
- const a = `<a href="" target="solutionId:${i.deployCommonId}">${o}</a>`, l = new RegExp(o, "gi");
80
+ return (e?.configurable?.context?.configContext.allCards ?? []).forEach((o) => {
81
+ const i = o.title;
82
+ if (t.toLowerCase().includes(i.toLowerCase())) {
83
+ const a = `<a href="" target="solutionId:${o.deployCommonId}">${i}</a>`, l = new RegExp(i, "gi");
84
84
  t = t.replace(l, a), s.push({
85
85
  solution: {
86
- title: i.title,
87
- id: i.deployCommonId,
88
- snippet: i.snippet,
89
- description: i.description
86
+ title: o.title,
87
+ id: o.deployCommonId,
88
+ snippet: o.snippet,
89
+ description: o.description
90
90
  },
91
91
  score: 100
92
92
  });
@@ -137,22 +137,22 @@ const Ve = (t) => new Promise((e) => setTimeout(e, t)), Qe = f.Root({
137
137
  if (!t) return;
138
138
  const n = de(t);
139
139
  if (!n) return;
140
- const o = { context: {
140
+ const i = { context: {
141
141
  kind: "DocAIAssistantRequest",
142
142
  filters: {
143
143
  products: "ArcGIS Solutions",
144
144
  persona: { persona: "apps-solutions" }
145
145
  }
146
146
  } };
147
- s && (o.conversationId = s), U(o, n, e ?? "");
147
+ s && (i.conversationId = s), U(i, n, e ?? "");
148
148
  }, We = async (t, e) => {
149
149
  const s = N(e), n = t.documentSkillUrl;
150
- let i = [];
151
- await v(
150
+ let o = [];
151
+ await x(
152
152
  { text: s.agentProgress.explorerAgentSearching },
153
153
  e
154
154
  );
155
- let o = await U(
155
+ let i = await U(
156
156
  {
157
157
  message: t.agentExecutionContext.userRequest,
158
158
  conversationId: e?.configurable?.context?.convoId ?? void 0,
@@ -167,22 +167,22 @@ const Ve = (t) => new Promise((e) => setTimeout(e, t)), Qe = f.Root({
167
167
  n,
168
168
  e?.configurable?.context?.token ?? ""
169
169
  );
170
- o.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(o.conversationId);
170
+ i.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(i.conversationId);
171
171
  let a = {
172
- message: o.message,
173
- conversationId: o.conversationId,
174
- hasMore: o.hasMore,
175
- ackSequenceNumber: o.sequenceNumber,
176
- inquiryId: o.inquiryId
172
+ message: i.message,
173
+ conversationId: i.conversationId,
174
+ hasMore: i.hasMore,
175
+ ackSequenceNumber: i.sequenceNumber,
176
+ inquiryId: i.inquiryId
177
177
  }, l = "", d = null;
178
178
  const u = async (m) => {
179
179
  const c = m.context?.results?.[0]?.reply ?? "";
180
180
  if (c !== "") {
181
181
  const y = Je(c), w = Ge(y, e);
182
- l = w.source, i = [
183
- ...i,
182
+ l = w.source, o = [
183
+ ...o,
184
184
  ...w.allMatches.filter(
185
- (k) => !i.some((B) => B.solution.id === k.solution.id)
185
+ (k) => !o.some((B) => B.solution.id === k.solution.id)
186
186
  )
187
187
  ];
188
188
  }
@@ -190,11 +190,11 @@ const Ve = (t) => new Promise((e) => setTimeout(e, t)), Qe = f.Root({
190
190
  const g = m.context?.results?.[0]?.status?.currentStatusStep;
191
191
  if (g) {
192
192
  let y = "";
193
- g === 1 ? y = s.agentProgress.explorerAgentReading : g === 2 ? y = s.agentProgress.explorerAgentReviewing : g === 3 && (y = s.agentProgress.explorerAgentPreparing), await v({ text: y }, e);
193
+ g === 1 ? y = s.agentProgress.explorerAgentReading : g === 2 ? y = s.agentProgress.explorerAgentReviewing : g === 3 && (y = s.agentProgress.explorerAgentPreparing), await x({ text: y }, e);
194
194
  }
195
195
  };
196
- for (await u(o); a.hasMore; )
197
- await Ve(500), o = await U(
196
+ for (await u(i); a.hasMore; )
197
+ await Ve(500), i = await U(
198
198
  {
199
199
  conversationId: a.conversationId,
200
200
  ackSequenceNumber: a.ackSequenceNumber,
@@ -203,17 +203,17 @@ const Ve = (t) => new Promise((e) => setTimeout(e, t)), Qe = f.Root({
203
203
  n,
204
204
  e?.configurable?.context?.token ?? ""
205
205
  ), a = {
206
- message: o.message,
207
- conversationId: o.conversationId,
208
- hasMore: o.hasMore,
209
- ackSequenceNumber: o.sequenceNumber,
210
- inquiryId: o.inquiryId
211
- }, await u(o);
206
+ message: i.message,
207
+ conversationId: i.conversationId,
208
+ hasMore: i.hasMore,
209
+ ackSequenceNumber: i.sequenceNumber,
210
+ inquiryId: i.inquiryId
211
+ }, await u(i);
212
212
  if (d && e?.configurable?.context?.updateSuggestedPrompts) {
213
213
  const m = e.configurable.context.updateSuggestedPrompts, c = d;
214
214
  setTimeout(() => m(c), 0);
215
215
  }
216
- return de(e?.configurable?.context.portal) && ue(e?.configurable?.context.portal, e?.configurable?.context.token ?? "", a.conversationId), i.length && (i.length === 1 ? ce(i[0].solution.id) : le(i)), {
216
+ return de(e?.configurable?.context.portal) && ue(e?.configurable?.context.portal, e?.configurable?.context.token ?? "", a.conversationId), o.length && (o.length === 1 ? ce(o[0].solution.id) : le(o)), {
217
217
  outputMessage: l,
218
218
  summary: l,
219
219
  status: "success",
@@ -226,7 +226,7 @@ const Ve = (t) => new Promise((e) => setTimeout(e, t)), Qe = f.Root({
226
226
  documentSkillUrl: s
227
227
  };
228
228
  };
229
- await x(je, "solutions_explorer_description");
229
+ await v(je, "solutions_explorer_description");
230
230
  const pe = (t) => {
231
231
  if (t && Array.isArray(t.id) && t.id.length > 0)
232
232
  return t.id[t.id.length - 1].replace("Message", "").toLowerCase();
@@ -253,7 +253,7 @@ const pe = (t) => {
253
253
  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;
254
254
  }
255
255
  return { role: "human", content: String(t) };
256
- }, Xe = (t) => pe(t) === "human", et = (t, e = 3) => t.filter((s) => Xe(s)).slice(-e).map(Ze), 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 an existing solution that closely matches your use case and may already meet your needs: {{solutionMatch}}. Do you want to continue building your solution?", 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 = {
256
+ }, Xe = (t) => pe(t) === "human", et = (t, e = 3) => t.filter((s) => Xe(s)).slice(-e).map(Ze), tt = (t, e = " ") => et(t).map((o) => o.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 an existing solution that closely matches your use case and may already meet your needs: {{solutionMatch}}. Do you want to continue building your solution?", 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 = {
257
257
  builderMessages: st
258
258
  }, it = /* @__PURE__ */ new Set([
259
259
  "add",
@@ -330,13 +330,13 @@ class me {
330
330
  }
331
331
  compareStrings() {
332
332
  const e = new Set(this.template.solution.strings.map((n) => n.key)), s = new Set(this.response.solution.strings.map((n) => n.key));
333
- (e.size !== s.size || [...e].some((n) => !s.has(n))) && this.logIssue("String keys in llm response do not match the template.");
333
+ e.size === s.size && [...e].every((n) => s.has(n)) || this.logIssue("String keys in llm response do not match the template.");
334
334
  for (const n of this.response.solution.strings)
335
335
  n.value || this.logIssue(`String key '${n.key}' has no value.`);
336
336
  }
337
337
  compareItems() {
338
338
  const e = new Set(this.template.items.map((n) => n.id)), s = new Set(this.response.items.map((n) => n.id));
339
- (e.size !== s.size || [...e].some((n) => !s.has(n))) && this.logIssue("Item ids in llm response do not match the template.");
339
+ e.size === s.size && [...e].every((n) => s.has(n)) || this.logIssue("Item ids in llm response do not match the template.");
340
340
  }
341
341
  compareFeatureLayers() {
342
342
  const e = this.template.featureLayer, s = this.response.featureLayer;
@@ -345,8 +345,15 @@ class me {
345
345
  return;
346
346
  }
347
347
  if (!e.addLayers) {
348
- const n = new Set(e.layers.map((o) => o.id)), i = new Set(s.layers.map((o) => o.id));
349
- (n.size !== i.size || [...n].some((o) => !i.has(o))) && this.logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
348
+ const n = new Set(e.layers.map((i) => i.id)), o = new Set(s.layers.map((i) => i.id));
349
+ if (!(n.size === o.size && [...n].every((i) => o.has(i))))
350
+ this.logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
351
+ else
352
+ for (const i of e.layers)
353
+ if (i.type) {
354
+ const a = s.layers.find((l) => l.id === i.id);
355
+ a && a.type !== i.type && this.logIssue(`Layer '${i.id}' type '${a.type}' does not match template type '${i.type}'. This layer type is immutable.`);
356
+ }
350
357
  }
351
358
  }
352
359
  validateResponse() {
@@ -356,14 +363,14 @@ class me {
356
363
  s.length !== new Set(s).size && this.logIssue("Layer names must be unique (case-insensitive).");
357
364
  for (const n of this.response.featureLayer.layers) {
358
365
  this.validateLayer(n);
359
- const i = e.find((o) => o.id === n.id);
360
- i && this.validateRequiredFields(n, i);
366
+ const o = e.find((i) => i.id === n.id);
367
+ o && this.validateRequiredFields(n, o);
361
368
  }
362
369
  }
363
370
  validateRequiredFields(e, s) {
364
- const n = new Set(e.requiredFields.map((i) => i.name));
365
- for (const i of s.requiredFields)
366
- n.has(i.name) || this.logIssue(`Layer '${e.name}' is missing required field '${i.name}'.`);
371
+ const n = new Set(e.requiredFields.map((o) => o.name));
372
+ for (const o of s.requiredFields)
373
+ n.has(o.name) || this.logIssue(`Layer '${e.name}' is missing required field '${o.name}'.`);
367
374
  }
368
375
  validateLayer(e) {
369
376
  const s = /* @__PURE__ */ new Set([
@@ -375,19 +382,19 @@ class me {
375
382
  "last_edited_user"
376
383
  ]), n = e.systemFields ?? [];
377
384
  if (n.length) {
378
- const o = new Set(n.map((l) => l.name));
379
- (o.size !== s.size || [...s].some((l) => !o.has(l))) && this.logIssue(
380
- `Layer '${e.name}' has invalid system fields: ${JSON.stringify([...o])}.`
385
+ const i = new Set(n.map((l) => l.name));
386
+ (i.size !== s.size || [...s].some((l) => !i.has(l))) && this.logIssue(
387
+ `Layer '${e.name}' has invalid system fields: ${JSON.stringify([...i])}.`
381
388
  );
382
389
  }
383
- const i = [
390
+ const o = [
384
391
  ...e.customFields,
385
392
  ...e.requiredFields,
386
393
  ...n
387
- ].map((o) => o.name);
388
- i.length !== new Set(i).size && this.logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(i)}.`);
389
- for (const o of [...e.customFields, ...e.requiredFields, ...n])
390
- this.validateField(o);
394
+ ].map((i) => i.name);
395
+ o.length !== new Set(o).size && this.logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(o)}.`);
396
+ for (const i of [...e.customFields, ...e.requiredFields, ...n])
397
+ this.validateField(i);
391
398
  }
392
399
  validateField(e) {
393
400
  if (e.alias || this.logIssue(`Field '${e.name}' has no display name (alias).`), /^[A-Za-z]/u.test(e.name) || this.logIssue(`Field '${e.name}' does not start with a letter.`), /^[A-Za-z][A-Za-z0-9_]*$/u.test(e.name) || this.logIssue(`Field '${e.name}' contains invalid characters (only letters, numbers, and underscores allowed).`), e.name.length > 31 && this.logIssue(`Field '${e.name}' exceeds 31 characters.`), it.has(e.name.toLowerCase()) && this.logIssue(`Field '${e.name}' is a SQL reserved keyword.`), e.choiceList && (e.choiceList.some((s) => !s) && 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)) {
@@ -438,6 +445,7 @@ const ot = r.object({
438
445
  }), rt = r.object({
439
446
  id: r.number().int().describe("Layer/table id within the feature service."),
440
447
  type: r.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
448
+ typeMutable: r.boolean().describe("Indicates whether the layer type can be changed."),
441
449
  name: r.string().describe("Layer/table name."),
442
450
  description: r.string().describe("Layer/table description."),
443
451
  customFields: r.array(ne).describe("User/business fields specific to the solution."),
@@ -476,20 +484,20 @@ const ot = r.object({
476
484
  isValidUseCase: r.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
477
485
  matchedTemplates: r.array(pt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
478
486
  }), H = (t) => t in E, gt = 5, ht = 0.8, ft = 0.15, bt = "Web Mapping Application", yt = "Embeddings";
479
- let R = null, q = null, $ = null, F = null;
480
- const xt = "Build", D = /* @__PURE__ */ Object.assign({
487
+ let $ = null, q = null, R = null, F = null;
488
+ const vt = "Build", L = /* @__PURE__ */ Object.assign({
481
489
  "./prompts/description.md": () => import("../../chunks/description2.js").then((t) => t.default),
482
490
  "./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((t) => t.default),
483
491
  "./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
484
492
  "./prompts/initialAssessment.md": () => import("../../chunks/initialAssessment.js").then((t) => t.default),
485
493
  "./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
486
- }), vt = nt.builderMessages, b = (t, e, s) => {
487
- let i = N(e)?.builderMessages?.[t] ?? vt[t];
494
+ }), xt = nt.builderMessages, b = (t, e, s) => {
495
+ let o = N(e)?.builderMessages?.[t] ?? xt[t];
488
496
  if (!s)
489
- return i;
490
- for (const [o, a] of Object.entries(s))
491
- i = i.replaceAll(`{{${o}}}`, a);
492
- return i;
497
+ return o;
498
+ for (const [i, a] of Object.entries(s))
499
+ o = o.replaceAll(`{{${i}}}`, a);
500
+ return o;
493
501
  }, ge = (t) => {
494
502
  typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
495
503
  detail: t
@@ -508,15 +516,15 @@ async function St(t, e, s) {
508
516
  try {
509
517
  const n = await wt(t, e, s);
510
518
  if (!n) return null;
511
- const i = new ze({ id: n.id });
512
- return await i.load(), await i.fetchData("json");
519
+ const o = new ze({ id: n.id });
520
+ return await o.load(), await o.fetchData("json");
513
521
  } catch {
514
522
  return null;
515
523
  }
516
524
  }
517
525
  const It = async (t, e, s) => {
518
526
  if (!t) return [];
519
- const n = `type:Solution AND typekeywords:${xt} AND group:${t}`;
527
+ const n = `type:Solution AND typekeywords:${vt} AND group:${t}`;
520
528
  return (await J.searchItems({
521
529
  q: n,
522
530
  params: e ? { token: e } : void 0,
@@ -528,10 +536,10 @@ const It = async (t, e, s) => {
528
536
  const n = await J.getItemData(t, {
529
537
  params: e ? { token: e } : void 0,
530
538
  portal: s
531
- }), i = n?.buildSolution;
532
- if (!i) return null;
533
- const o = n?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
534
- return { buildSolution: i, params: a };
539
+ }), o = n?.buildSolution;
540
+ if (!o) return null;
541
+ const i = n?.params, a = i && typeof i == "object" && !Array.isArray(i) ? i : null;
542
+ return { buildSolution: o, params: a };
535
543
  } catch {
536
544
  return null;
537
545
  }
@@ -577,24 +585,24 @@ const It = async (t, e, s) => {
577
585
  console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
578
586
  return;
579
587
  }
580
- const i = await It(s, e, n), o = {};
581
- await Promise.all(i.map(async (a) => {
588
+ const o = await It(s, e, n), i = {};
589
+ await Promise.all(o.map(async (a) => {
582
590
  const l = a.properties?.templateInfo;
583
591
  if (!l || typeof l != "object") return;
584
592
  const d = l.id;
585
- if (typeof d != "string" || o[d]) return;
593
+ if (typeof d != "string" || i[d]) return;
586
594
  const u = await Ct(a.id, e, n);
587
595
  if (!u) return;
588
596
  const { buildSolution: h, params: m } = u;
589
597
  if (typeof h == "object" && h !== null && "solution" in h) {
590
598
  const g = h.solution;
591
- g.thumbnailUrl = a.thumbnail ? `${n ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0;
599
+ g.thumbnailUrl = a.thumbnail ? `${n ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
592
600
  }
593
601
  const c = {
594
602
  ...l,
595
603
  buildSolution: h
596
604
  };
597
- o[d] = _(
605
+ i[d] = _(
598
606
  new oe(c).dumpToLlmTemplate(),
599
607
  {
600
608
  itemId: a.id,
@@ -603,9 +611,9 @@ const It = async (t, e, s) => {
603
611
  }
604
612
  ), E[d] = {
605
613
  ...l,
606
- initialTemplate: o[d]
614
+ initialTemplate: i[d]
607
615
  };
608
- })), q = o;
616
+ })), q = i;
609
617
  }, fe = (t) => {
610
618
  const e = t?.configurable?.context?.token;
611
619
  return typeof e != "string" || !e.trim() ? null : e;
@@ -618,24 +626,24 @@ const It = async (t, e, s) => {
618
626
  return `${e.replace(/\/+$/, "")}/sharing/rest`;
619
627
  }, _t = async (t) => {
620
628
  await Promise.all([
621
- ve(t),
629
+ xe(t),
622
630
  V(t)
623
631
  ]);
624
- }, xe = async (t) => {
632
+ }, ve = async (t) => {
625
633
  const e = fe(t);
626
- (!$ || e && e !== F) && (F = e ?? F, $ = _t(t).catch((n) => {
627
- throw $ = null, F = null, n;
628
- })), await $;
634
+ (!R || e && e !== F) && (F = e ?? F, R = _t(t).catch((n) => {
635
+ throw R = null, F = null, n;
636
+ })), await R;
629
637
  };
630
- async function ve(t) {
631
- if (R) return R;
638
+ async function xe(t) {
639
+ if ($) return $;
632
640
  const e = be(t);
633
641
  if (!e)
634
642
  return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
635
643
  const s = ye(t), n = t?.configurable?.context?.configContext?.portalURL;
636
644
  await new Ue(n ? { url: n } : void 0).load();
637
- const o = fe(t) ?? void 0, a = await St(e, o, s);
638
- return a ? (R = a.items, R) : null;
645
+ const i = fe(t) ?? void 0, a = await St(e, i, s);
646
+ return a ? ($ = a.items, $) : null;
639
647
  }
640
648
  const kt = () => Object.entries(E).map(([t, e]) => `ID: ${t}
641
649
  Label: ${e.label}
@@ -649,10 +657,10 @@ Description: ${e.description}`).join(`
649
657
  const s = JSON.parse(e), n = _(
650
658
  { response: "", ...s },
651
659
  { itemId: s?.solution?.itemId ?? null }
652
- ), i = G.safeParse(n);
653
- if (!i.success)
660
+ ), o = G.safeParse(n);
661
+ if (!o.success)
654
662
  return null;
655
- const { response: o, ...a } = i.data, l = s.templateId, d = typeof l == "string" && H(l) ? l : null;
663
+ const { response: i, ...a } = o.data, l = s.templateId, d = typeof l == "string" && H(l) ? l : null;
656
664
  return _(
657
665
  a,
658
666
  {
@@ -692,21 +700,21 @@ Description: ${e.description}`).join(`
692
700
  default: () => []
693
701
  })
694
702
  }), At = (t, e) => {
695
- const s = Tt(e), n = s?.templateId ?? null, i = {};
696
- return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (i.currentDesign = s), n && t.selectedTemplate !== n && (i.selectedTemplate = n), i;
697
- }, Dt = async (t, e) => {
698
- await v({ text: b("understandingRequest", e) }, e), await xe(e);
699
- const s = t.agentExecutionContext.userRequest, n = kt(), i = t.agentExecutionContext.messages.slice(-11), o = await A({
700
- promptText: await x(D, "initialAssessment"),
703
+ const s = Tt(e), n = s?.templateId ?? null, o = {};
704
+ return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (o.currentDesign = s), n && t.selectedTemplate !== n && (o.selectedTemplate = n), o;
705
+ }, Lt = async (t, e) => {
706
+ await x({ text: b("understandingRequest", e) }, e), await ve(e);
707
+ const s = t.agentExecutionContext.userRequest, n = kt(), o = t.agentExecutionContext.messages.slice(-11), i = await A({
708
+ promptText: await v(L, "initialAssessment"),
701
709
  modelTier: "advanced",
702
710
  temperature: 0,
703
711
  schema: mt,
704
- messages: i,
712
+ messages: o,
705
713
  inputVariables: { query: s, availableTemplates: n }
706
- }), a = o.matchedTemplates.filter(
714
+ }), a = i.matchedTemplates.filter(
707
715
  (c) => H(c.templateId)
708
716
  ), l = {
709
- ...o,
717
+ ...i,
710
718
  matchedTemplates: a
711
719
  }, [d, u] = a, m = !!d && d.confidence >= ht && (u === void 0 || d.confidence - u.confidence >= ft) ? d.templateId : null;
712
720
  return {
@@ -714,7 +722,7 @@ Description: ${e.description}`).join(`
714
722
  selectedTemplate: m,
715
723
  existingMatches: []
716
724
  };
717
- }, Lt = (t) => {
725
+ }, Dt = (t) => {
718
726
  const e = t.assessment?.assistantResponse ?? "";
719
727
  return {
720
728
  outputMessage: e,
@@ -722,33 +730,33 @@ Description: ${e.description}`).join(`
722
730
  status: "success"
723
731
  };
724
732
  }, Mt = (t, e) => {
725
- const { hitlResponse: s } = e.configurable, n = "selectTemplate", i = t.assessment?.matchedTemplates.filter(
733
+ const { hitlResponse: s } = e.configurable, n = "selectTemplate", o = t.assessment?.matchedTemplates.filter(
726
734
  (u) => H(u.templateId)
727
- ) ?? [], o = i.map((u) => `${u.templateDescription}`);
735
+ ) ?? [], i = o.map((u) => `${u.templateDescription}`);
728
736
  if (s?.agentId !== "solutionBuilder" || s.id !== n) {
729
737
  const u = {
730
738
  agentId: "solutionBuilder",
731
739
  id: n,
732
740
  kind: "singleSelection",
733
741
  message: b("selectTemplatePrompt", e),
734
- metadata: [...o]
742
+ metadata: [...i]
735
743
  };
736
744
  throw new ie(u);
737
745
  }
738
- const a = String(s.payload ?? ""), l = o.findIndex((u) => u === a);
746
+ const a = String(s.payload ?? ""), l = i.findIndex((u) => u === a);
739
747
  return {
740
- selectedTemplate: (l >= 0 ? i[l] : void 0)?.templateId ?? i[0]?.templateId ?? null
748
+ selectedTemplate: (l >= 0 ? o[l] : void 0)?.templateId ?? o[0]?.templateId ?? null
741
749
  };
742
- }, Rt = async (t, e) => {
743
- await v({ text: b("searchingExistingSolutions", e) }, e);
744
- const s = t.agentExecutionContext.userRequest, n = tt(t.agentExecutionContext.messages) || s, i = await ve(e);
745
- if (!i)
750
+ }, $t = async (t, e) => {
751
+ await x({ text: b("searchingExistingSolutions", e) }, e);
752
+ const s = t.agentExecutionContext.userRequest, n = tt(t.agentExecutionContext.messages) || s, o = await xe(e);
753
+ if (!o)
746
754
  return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
747
- if (!i.length)
755
+ if (!o.length)
748
756
  return { existingMatches: [] };
749
- const [o] = await Fe([n]), a = i.map((c) => ({
757
+ const [i] = await Fe([n]), a = o.map((c) => ({
750
758
  solution: c,
751
- score: Pe(o, c.embedding)
759
+ score: Pe(i, c.embedding)
752
760
  }));
753
761
  a.sort((c, g) => g.score - c.score);
754
762
  const l = a.slice(0, gt);
@@ -760,20 +768,20 @@ Description: ${c.description}`).join(`
760
768
 
761
769
  `), u = t.agentExecutionContext.messages.slice(-11);
762
770
  return { existingMatches: (await A({
763
- promptText: await x(D, "findExistingSolution"),
771
+ promptText: await v(L, "findExistingSolution"),
764
772
  modelTier: "fast",
765
773
  temperature: 0,
766
774
  schema: ut,
767
775
  messages: u,
768
776
  inputVariables: { query: s, candidates: d }
769
777
  })).matchedTitles.map((c) => l.find(({ solution: g }) => g.title === c)).filter((c) => c !== void 0) };
770
- }, $t = (t, e) => {
771
- const { existingMatches: s } = t, { hitlResponse: n } = e.configurable, i = `confirmExistingSolution:${s[0].solution.id}`;
772
- if (n?.agentId !== "solutionBuilder" || n.id !== i) {
778
+ }, Rt = (t, e) => {
779
+ const { existingMatches: s } = t, { hitlResponse: n } = e.configurable, o = `confirmExistingSolution:${s[0].solution.id}`;
780
+ if (n?.agentId !== "solutionBuilder" || n.id !== o) {
773
781
  s.length === 1 ? ce(s[0].solution.id) : le(s);
774
- const o = s.map((d) => `${d.solution.title}`).join(", "), a = b("existingSolutionMatch", e, { solutionMatch: o }), l = {
782
+ const i = s.map((d) => `${d.solution.title}`).join(", "), a = b("existingSolutionMatch", e, { solutionMatch: i }), l = {
775
783
  agentId: "solutionBuilder",
776
- id: i,
784
+ id: o,
777
785
  kind: "booleanChoice",
778
786
  message: a,
779
787
  metadata: []
@@ -782,42 +790,42 @@ Description: ${c.description}`).join(`
782
790
  }
783
791
  return {};
784
792
  }, we = async (t, e) => {
785
- await xe(e);
793
+ await ve(e);
786
794
  const { currentDesign: s } = t, n = t.agentExecutionContext.userRequest;
787
- await v({ text: b("creatingDesign", e) }, e);
788
- let i = P(t.selectedTemplate);
789
- if (i?.initialTemplate || (await V(e), i = P(t.selectedTemplate)), !i?.initialTemplate)
795
+ await x({ text: b("creatingDesign", e) }, e);
796
+ let o = P(t.selectedTemplate);
797
+ if (o?.initialTemplate || (await V(e), o = P(t.selectedTemplate)), !o?.initialTemplate)
790
798
  throw new Error("No hydrated templates are available for solution design.");
791
- const o = _(
792
- s ?? i.initialTemplate,
799
+ const i = _(
800
+ s ?? o.initialTemplate,
793
801
  {
794
- itemId: (s ?? i.initialTemplate)?.solution?.itemId ?? null,
795
- sourceBuildSolution: s?.sourceBuildSolution ?? i.initialTemplate.sourceBuildSolution,
796
- params: s?.params ?? i.initialTemplate.params ?? null
802
+ itemId: (s ?? o.initialTemplate)?.solution?.itemId ?? null,
803
+ sourceBuildSolution: s?.sourceBuildSolution ?? o.initialTemplate.sourceBuildSolution,
804
+ params: s?.params ?? o.initialTemplate.params ?? null
797
805
  }
798
806
  ), a = t.agentExecutionContext.messages.slice(-11), l = await A({
799
- promptText: await x(D, "designSolution"),
807
+ promptText: await v(L, "designSolution"),
800
808
  modelTier: "advanced",
801
809
  temperature: 0,
802
810
  schema: G,
803
811
  messages: a,
804
812
  inputVariables: {
805
- currentDesign: JSON.stringify(ae(o)),
806
- templateInstructions: i.instructions,
813
+ currentDesign: JSON.stringify(ae(i)),
814
+ templateInstructions: o.instructions,
807
815
  query: n
808
816
  }
809
817
  }), { response: d, featureLayer: u, ...h } = l, m = re(
810
818
  u,
811
- o.featureLayer
819
+ i.featureLayer
812
820
  ), c = _(
813
821
  { ...h, featureLayer: m },
814
822
  {
815
- itemId: o?.solution?.itemId,
816
- sourceBuildSolution: o.sourceBuildSolution,
823
+ itemId: i?.solution?.itemId,
824
+ sourceBuildSolution: i.sourceBuildSolution,
817
825
  templateId: t.selectedTemplate ?? null,
818
- params: o.params ?? null
826
+ params: i.params ?? null
819
827
  }
820
- ), g = new me(c, i.initialTemplate);
828
+ ), g = new me(c, o.initialTemplate);
821
829
  if (!g.isValid)
822
830
  return console.warn(
823
831
  "[SolutionBuilder] designSolution validation failed:",
@@ -848,19 +856,19 @@ Description: ${c.description}`).join(`
848
856
  const { currentDesign: s } = t;
849
857
  if (!s)
850
858
  return we(t, e);
851
- const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11);
852
- await v({ text: b("updatingDesign", e) }, e);
853
- const o = await A({
854
- promptText: await x(D, "updateDesign"),
859
+ const n = t.agentExecutionContext.userRequest, o = t.agentExecutionContext.messages.slice(-11);
860
+ await x({ text: b("updatingDesign", e) }, e);
861
+ const i = await A({
862
+ promptText: await v(L, "updateDesign"),
855
863
  modelTier: "advanced",
856
864
  temperature: 0,
857
865
  schema: dt,
858
- messages: i,
866
+ messages: o,
859
867
  inputVariables: {
860
868
  currentDesign: JSON.stringify(qe(s)),
861
869
  query: n
862
870
  }
863
- }), { response: a, patches: l } = o;
871
+ }), { response: a, patches: l } = i;
864
872
  if (!l || l.length === 0)
865
873
  return {
866
874
  outputMessage: a,
@@ -907,7 +915,7 @@ Description: ${c.description}`).join(`
907
915
  } catch (p) {
908
916
  console.warn(
909
917
  "[SolutionBuilder] updateDesign JSON patch failed:",
910
- { error: p, llmResponse: o, patches: h, patchTarget: m }
918
+ { error: p, llmResponse: i, patches: h, patchTarget: m }
911
919
  );
912
920
  const I = b("applyChangeFailed", e);
913
921
  return {
@@ -923,7 +931,7 @@ Description: ${c.description}`).join(`
923
931
  if (!g.success) {
924
932
  console.warn(
925
933
  "[SolutionBuilder] updateDesign schema validation failed:",
926
- { errors: g.error.issues, llmResponse: o, patchedDesign: c }
934
+ { errors: g.error.issues, llmResponse: i, patchedDesign: c }
927
935
  );
928
936
  const p = b("applyChangeFailed", e);
929
937
  return {
@@ -944,14 +952,14 @@ Description: ${c.description}`).join(`
944
952
  params: s.params ?? null
945
953
  }
946
954
  );
947
- let L = P(t.selectedTemplate);
948
- if (L?.initialTemplate || (await V(e), L = P(t.selectedTemplate)), !L?.initialTemplate)
955
+ let D = P(t.selectedTemplate);
956
+ if (D?.initialTemplate || (await V(e), D = P(t.selectedTemplate)), !D?.initialTemplate)
949
957
  throw new Error("No hydrated templates are available for solution design.");
950
- const W = new me(S, L.initialTemplate, !1);
958
+ const W = new me(S, D.initialTemplate, !1);
951
959
  if (!W.isValid)
952
960
  return console.warn(
953
961
  "[SolutionBuilder] updateDesign validation failed:",
954
- { issues: W.issues, llmResponse: o, patchedDesign: S }
962
+ { issues: W.issues, llmResponse: i, patchedDesign: S }
955
963
  ), {
956
964
  outputMessage: b("applyChangeFailed", e)
957
965
  };
@@ -959,7 +967,7 @@ Description: ${c.description}`).join(`
959
967
  if (!Y.ok) {
960
968
  console.warn(
961
969
  "[SolutionBuilder] updateDesign Esri JSON conversion failed:",
962
- { error: Y.error, llmResponse: o, design: S }
970
+ { error: Y.error, llmResponse: i, design: S }
963
971
  );
964
972
  const p = b("applyChangeFailed", e);
965
973
  return {
@@ -974,7 +982,7 @@ Description: ${c.description}`).join(`
974
982
  status: "success",
975
983
  currentDesign: S
976
984
  };
977
- }, Pt = (t) => t.currentDesign !== null ? "updateDesign" : "assessInitialRequest", Nt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidUseCaseExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Bt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", qt = () => new z(Et).addNode("syncCurrentDesignFromContext", At).addNode("assessInitialRequest", Dt).addNode("invalidUseCaseExit", Lt).addNode("selectTemplateHIL", Mt).addNode("findExistingSolutions", Rt).addNode("confirmContinueBuildingHIL", $t).addNode("designSolution", we).addNode("updateDesign", Ft).addEdge(O, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Pt, {
985
+ }, Pt = (t) => t.currentDesign !== null ? "updateDesign" : "assessInitialRequest", Nt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidUseCaseExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Bt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", qt = () => new z(Et).addNode("syncCurrentDesignFromContext", At).addNode("assessInitialRequest", Lt).addNode("invalidUseCaseExit", Dt).addNode("selectTemplateHIL", Mt).addNode("findExistingSolutions", $t).addNode("confirmContinueBuildingHIL", Rt).addNode("designSolution", we).addNode("updateDesign", Ft).addEdge(O, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Pt, {
978
986
  updateDesign: "updateDesign",
979
987
  assessInitialRequest: "assessInitialRequest"
980
988
  }).addConditionalEdges("assessInitialRequest", Nt, {
@@ -985,7 +993,7 @@ Description: ${c.description}`).join(`
985
993
  confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
986
994
  designSolution: "designSolution"
987
995
  }).addEdge("confirmContinueBuildingHIL", "designSolution").addEdge("designSolution", C).addEdge("updateDesign", C);
988
- await x(D, "description");
996
+ await v(L, "description");
989
997
  const Ut = M.object({
990
998
  tool: M.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
991
999
  confidence: M.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
@@ -1011,24 +1019,24 @@ const Ut = M.object({
1011
1019
  })
1012
1020
  }), zt = async (t, e) => {
1013
1021
  const s = N(e);
1014
- await v(
1022
+ await x(
1015
1023
  { text: s?.builderMessages.understandingRequest },
1016
1024
  e
1017
1025
  );
1018
- const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11), o = e?.configurable?.context?.solutionDesignJson;
1026
+ const n = t.agentExecutionContext.userRequest, o = t.agentExecutionContext.messages.slice(-11), i = e?.configurable?.context?.solutionDesignJson;
1019
1027
  let a = !1;
1020
- if (typeof o == "string" && o.trim())
1028
+ if (typeof i == "string" && i.trim())
1021
1029
  try {
1022
- a = JSON.parse(o).solution != null;
1030
+ a = JSON.parse(i).solution != null;
1023
1031
  } catch {
1024
1032
  a = !1;
1025
1033
  }
1026
- const l = await x(Q, "classifyIntent"), d = await A({
1034
+ const l = await v(Q, "classifyIntent"), d = await A({
1027
1035
  promptText: l,
1028
1036
  modelTier: "advanced",
1029
1037
  temperature: 0,
1030
1038
  schema: Ut,
1031
- messages: i,
1039
+ messages: o,
1032
1040
  inputVariables: { query: n, activeSolutionDesign: a }
1033
1041
  });
1034
1042
  return {
@@ -1042,17 +1050,17 @@ const Ut = M.object({
1042
1050
  const n = await qt().compile().invoke(t, e);
1043
1051
  return K(), n;
1044
1052
  }, Jt = async (t, e) => {
1045
- const s = N(e), n = t.agentExecutionContext.userRequest, i = t.intentRationale ?? "No rationale available.";
1046
- await v(
1053
+ const s = N(e), n = t.agentExecutionContext.userRequest, o = t.intentRationale ?? "No rationale available.";
1054
+ await x(
1047
1055
  { text: s?.executingSolutionsAssistantAgent },
1048
1056
  e
1049
1057
  );
1050
- const o = await x(Q, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await Ne({
1051
- promptText: o,
1058
+ const i = await v(Q, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await Ne({
1059
+ promptText: i,
1052
1060
  modelTier: "fast",
1053
1061
  temperature: 0,
1054
1062
  messages: a,
1055
- inputVariables: { query: n, rationale: i }
1063
+ inputVariables: { query: n, rationale: o }
1056
1064
  });
1057
1065
  return K(), {
1058
1066
  outputMessage: l,
@@ -1063,7 +1071,7 @@ const Ut = M.object({
1063
1071
  explorer: "routeToExplorer",
1064
1072
  builder: "routeToBuilder",
1065
1073
  other: "assistantResponse"
1066
- }).addEdge("routeToExplorer", C).addEdge("routeToBuilder", C).addEdge("assistantResponse", C), Vt = await x(Q, "description"), Qt = {
1074
+ }).addEdge("routeToExplorer", C).addEdge("routeToBuilder", C).addEdge("assistantResponse", C), Vt = await v(Q, "description"), Qt = {
1067
1075
  id: "solutionsAssistant",
1068
1076
  name: "Solutions Assistant Agent",
1069
1077
  description: Vt,
@@ -1076,14 +1084,14 @@ class Yt extends ke {
1076
1084
  aiAssistantsEnabled: !1,
1077
1085
  blockBetaApps: !0,
1078
1086
  colocateCompute: !1
1079
- }, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = _e({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._assistantRef = Re(), this._configContextConsumer = te({
1087
+ }, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = _e({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._assistantRef = $e(), this._configContextConsumer = te({
1080
1088
  context: Ae,
1081
1089
  subscribe: !0,
1082
1090
  callback: (e) => {
1083
1091
  e?.portalURL && (se.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1084
1092
  }
1085
1093
  }), this._builderDesignContextConsumer = te({
1086
- context: De,
1094
+ context: Le,
1087
1095
  subscribe: !0,
1088
1096
  callback: (e) => {
1089
1097
  e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
@@ -1106,8 +1114,8 @@ class Yt extends ke {
1106
1114
  }, this._checkURLOpenParameter = () => {
1107
1115
  this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
1108
1116
  }, this.listenOn(window, "arcgisFeedback", (e) => {
1109
- const s = e.detail, { agentPicked: n, taskAssigned: i, userMessage: o } = this._parseAgentPickedAndTask(s);
1110
- this._sendFeedback(s.content, o ?? i ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", n ?? "");
1117
+ const s = e.detail, { agentPicked: n, taskAssigned: o, userMessage: i } = this._parseAgentPickedAndTask(s);
1118
+ this._sendFeedback(s.content, i ?? o ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", n ?? "");
1111
1119
  });
1112
1120
  }
1113
1121
  static {
@@ -1151,16 +1159,16 @@ class Yt extends ke {
1151
1159
  this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
1152
1160
  }} scale=m slot=header-actions-end></calcite-action><calcite-tooltip placement=bottom reference-element=newChatButton><span>${this._translations.tooltips.newConversation}</span></calcite-tooltip>${!this._isMobile && T`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.toggleSolutionBuilder}</span></calcite-tooltip>` || ""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage ?? ee} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
1153
1161
  console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0;
1154
- const n = Date.now(), i = Me(n), o = s.detail || "Unknown";
1162
+ const n = Date.now(), o = Me(n), i = s.detail || "Unknown";
1155
1163
  this._telemetry?.logEvent({
1156
- category: Le.ASSISTANT,
1164
+ category: De.ASSISTANT,
1157
1165
  action: "Chat",
1158
- dimensions: [o],
1159
- metrics: [i]
1166
+ dimensions: [i],
1167
+ metrics: [o]
1160
1168
  }), this.assistantProcessing.emit(!0);
1161
1169
  }} @arcgisFeedback=${(s) => {
1162
1170
  s.detail;
1163
- }} ${$e(this._assistantRef)}><arcgis-assistant-agent .agent=${Qt} .context=${{
1171
+ }} ${Re(this._assistantRef)}><arcgis-assistant-agent .agent=${Qt} .context=${{
1164
1172
  token: this._configContextConsumer.value?.userSession?.token,
1165
1173
  configContext: this._configContextConsumer.value,
1166
1174
  convoId: this._conversationId,
@@ -1181,9 +1189,9 @@ class Yt extends ke {
1181
1189
  this.closeAssistant.emit(!0);
1182
1190
  }} slot=header-actions-end .text=${this._translations.tooltips.close}></calcite-action><calcite-tooltip placement=bottom reference-element=closeAssistantButton><span>${this._translations.tooltips.close}</span></calcite-tooltip></calcite-panel>`;
1183
1191
  }
1184
- _sendFeedback(e, s, n, i) {
1185
- 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")}`;
1186
- window.open(o, "_blank");
1192
+ _sendFeedback(e, s, n, o) {
1193
+ const i = `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: o }))}&field:version=${encodeURIComponent("v2")}`;
1194
+ window.open(i, "_blank");
1187
1195
  }
1188
1196
  async _loadUserFirstName() {
1189
1197
  try {