@esri/solutions-components 5.1.0-next.154 → 5.1.0-next.156

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 (195) hide show
  1. package/dist/cdn/2C6OKRTL.js +2 -0
  2. package/dist/cdn/2L62YUIH.js +2 -0
  3. package/dist/cdn/2UIPY2ED.js +2 -0
  4. package/dist/cdn/{DN3PZCF4.js → 37SYO65U.js} +1 -1
  5. package/dist/cdn/{XK36P3C4.js → 3N4FGXFE.js} +1 -1
  6. package/dist/cdn/66VSNZFA.js +2 -0
  7. package/dist/cdn/{GCEPKR7I.js → 6LDTUOZL.js} +1 -1
  8. package/dist/cdn/6OJALTOU.js +2 -0
  9. package/dist/cdn/6RNSFI2J.js +2 -0
  10. package/dist/cdn/{3JZVI5AM.js → 6RONZCGM.js} +1 -1
  11. package/dist/cdn/{JOAEH3CI.js → 6RTL3IJQ.js} +1 -1
  12. package/dist/cdn/{2IGILR4T.js → 7CZG6NDM.js} +1 -1
  13. package/dist/cdn/{UNBTFJYB.js → 7IXJB2CS.js} +1 -1
  14. package/dist/cdn/7JC52SFZ.js +2 -0
  15. package/dist/cdn/{IFONVCBL.js → 7LKPG6HJ.js} +1 -1
  16. package/dist/cdn/{TB33W36T.js → 7NKBQ4G6.js} +1 -1
  17. package/dist/cdn/{VY5TD3VS.js → 7ZEDJMU7.js} +1 -1
  18. package/dist/cdn/{YXHO47AZ.js → 7ZJQQBSR.js} +1 -1
  19. package/dist/cdn/{PNESECPO.js → A6VVARNG.js} +1 -1
  20. package/dist/cdn/{JYUZPAPI.js → A7PEHKA2.js} +1 -1
  21. package/dist/cdn/{SYQ5E5TV.js → AKQEDHUS.js} +1 -1
  22. package/dist/cdn/{TOIBA2KF.js → ALQFRJNC.js} +1 -1
  23. package/dist/cdn/{FWRT4BPD.js → ARFCWGCB.js} +1 -1
  24. package/dist/cdn/{PPRV6EZZ.js → AVBZ2B75.js} +1 -1
  25. package/dist/cdn/{SZRVESYE.js → AXFB53AQ.js} +1 -1
  26. package/dist/cdn/{4ASIXXDP.js → AZDHGEBN.js} +1 -1
  27. package/dist/cdn/{JNE3LBQU.js → BFC6PQCO.js} +1 -1
  28. package/dist/cdn/BLR4MTOP.js +2 -0
  29. package/dist/cdn/{LHG6NOEP.js → BM4VSEDV.js} +1 -1
  30. package/dist/cdn/{DDJSF2M3.js → BWRBYYGI.js} +1 -1
  31. package/dist/cdn/{MDXI36JJ.js → BYGOJ5ML.js} +141 -138
  32. package/dist/cdn/C4F2OOUL.js +2 -0
  33. package/dist/cdn/C4T4HSG2.js +2 -0
  34. package/dist/cdn/C5KDPY7R.js +2 -0
  35. package/dist/cdn/{FZKGL66L.js → C76SZF3J.js} +1 -1
  36. package/dist/cdn/{XO54BFTC.js → CFQKZMGC.js} +1 -1
  37. package/dist/cdn/CJ3EZE7U.js +2 -0
  38. package/dist/cdn/{UWSHU7MG.js → CQQH3XK5.js} +1 -1
  39. package/dist/cdn/{TLM7N22U.js → DF7TCZUS.js} +1 -1
  40. package/dist/cdn/{QFFHU77I.js → DMX66TUK.js} +1 -1
  41. package/dist/cdn/{NKX2EIDR.js → DOXKOGC2.js} +1 -1
  42. package/dist/cdn/{WC37HMOI.js → DQ7I7HGP.js} +1 -1
  43. package/dist/cdn/E4BPYNC5.js +4 -0
  44. package/dist/cdn/{BJAEUZFB.js → EF4LWVLU.js} +1 -1
  45. package/dist/cdn/{IEC46RE7.js → EKFKOS5K.js} +1 -1
  46. package/dist/cdn/EKRMEQQI.js +2 -0
  47. package/dist/cdn/{ZCPVOS4Q.js → ENTBR5YC.js} +1 -1
  48. package/dist/cdn/EPKRNLRL.js +2 -0
  49. package/dist/cdn/EZ5PKNLU.js +2 -0
  50. package/dist/cdn/{LGZDNUGT.js → FS5WR74E.js} +1 -1
  51. package/dist/cdn/{NV2DLQDN.js → G5PL37M5.js} +1 -1
  52. package/dist/cdn/{RRD4QUQS.js → GBDBGOCT.js} +1 -1
  53. package/dist/cdn/{OAEWZFWV.js → GDX4FWG7.js} +1 -1
  54. package/dist/cdn/{GG4IIHQE.js → GFEDQ7WH.js} +1 -1
  55. package/dist/cdn/{G6EZOEPB.js → GJ7QMCFT.js} +1 -1
  56. package/dist/cdn/GXIGM56I.js +2 -0
  57. package/dist/cdn/HDTRW7I6.js +4 -0
  58. package/dist/cdn/HRH3YBW4.js +2 -0
  59. package/dist/cdn/{KV76ATT5.js → HS55CSUO.js} +1 -1
  60. package/dist/cdn/HVT2WBVC.js +2 -0
  61. package/dist/cdn/{QD22B6N2.js → I3A27HFS.js} +1 -1
  62. package/dist/cdn/IADXB53D.js +2 -0
  63. package/dist/cdn/{DXQQQNOF.js → IBAJ7OFO.js} +1 -1
  64. package/dist/cdn/{PX6AYCC4.js → IM3C52I6.js} +1 -1
  65. package/dist/cdn/{M3NML7ZV.js → IMJTIIHG.js} +1 -1
  66. package/dist/cdn/{EVO7B63R.js → IR55PBAU.js} +1 -1
  67. package/dist/cdn/{JXTZNXTZ.js → IUNUJ6GU.js} +1 -1
  68. package/dist/cdn/{GMSG7ZRV.js → IZ7DJL5P.js} +1 -1
  69. package/dist/cdn/{FNTXI57U.js → IZDAQGZD.js} +1 -1
  70. package/dist/cdn/JAYARGS3.js +2 -0
  71. package/dist/cdn/{UIGRRD7P.js → JET6MYZJ.js} +1 -1
  72. package/dist/cdn/{NYQQSL25.js → JM4BUUFY.js} +1 -1
  73. package/dist/cdn/JQANOMEB.js +2 -0
  74. package/dist/cdn/JTENM3PQ.js +2 -0
  75. package/dist/cdn/KDSK7F55.js +90 -0
  76. package/dist/cdn/KGU32CDZ.js +2 -0
  77. package/dist/cdn/{EKUENEEW.js → L2XO4YLV.js} +1 -1
  78. package/dist/cdn/{LWT3JEQ6.js → LJIX7K76.js} +5 -5
  79. package/dist/cdn/{ZOF7AUSS.js → LOPXSWVG.js} +1 -1
  80. package/dist/cdn/LZTAD4IE.js +2 -0
  81. package/dist/cdn/M5ZEJF3J.js +2 -0
  82. package/dist/cdn/{WG5NM5XY.js → MDMFIEM7.js} +1 -1
  83. package/dist/cdn/MPSNK45A.js +2 -0
  84. package/dist/cdn/{XJAXXELZ.js → N2LDQKCJ.js} +1 -1
  85. package/dist/cdn/{L5YT5FRJ.js → O4YFJXGF.js} +1 -1
  86. package/dist/cdn/{D6VR7GCD.js → OL5LAOD5.js} +1 -1
  87. package/dist/cdn/OOP3DI7Y.js +2 -0
  88. package/dist/cdn/ORMBTE2Z.js +2 -0
  89. package/dist/cdn/OUNL2UWX.js +7 -0
  90. package/dist/cdn/OVKPT3QA.js +2 -0
  91. package/dist/cdn/{RUVOSMTB.js → OZFVLORO.js} +1 -1
  92. package/dist/cdn/{3KYQE6O5.js → PBENK36A.js} +1 -1
  93. package/dist/cdn/{SHEPQVUX.js → PCP5UFZR.js} +1 -1
  94. package/dist/cdn/PRM47E4O.js +2 -0
  95. package/dist/cdn/{ZCLYSOQM.js → Q7GMS6X2.js} +1 -1
  96. package/dist/cdn/{2HAYT46E.js → QA3SYWWX.js} +1 -1
  97. package/dist/cdn/{3S5PVZVU.js → QCCLUBLV.js} +1 -1
  98. package/dist/cdn/{3CDO3ATJ.js → QCXOGAWW.js} +1 -1
  99. package/dist/cdn/{X6JL6SAH.js → QLRGY4WQ.js} +1 -1
  100. package/dist/cdn/{ZTRQVOAR.js → QX7YVGEN.js} +1 -1
  101. package/dist/cdn/{4D4UXCEU.js → R7A62RZ4.js} +1 -1
  102. package/dist/cdn/{S4VDUHA7.js → RCOHFQC5.js} +1 -1
  103. package/dist/cdn/{U56TK45K.js → RFSPNC4B.js} +13 -13
  104. package/dist/cdn/RLV5JHIU.js +2 -0
  105. package/dist/cdn/RXOPHYUF.js +2 -0
  106. package/dist/cdn/{M73VTGBI.js → S2A7SDYB.js} +1 -1
  107. package/dist/cdn/{RYBSWXQQ.js → S2Y44VZV.js} +1 -1
  108. package/dist/cdn/{3ZYEIYTY.js → S6J35GRM.js} +1 -1
  109. package/dist/cdn/SIODWUWX.js +2 -0
  110. package/dist/cdn/{WZCJ2VDD.js → SNJPMQCE.js} +1 -1
  111. package/dist/cdn/{DUXRJBCP.js → SRLQU37I.js} +1 -1
  112. package/dist/cdn/TCUNTTNI.js +2 -0
  113. package/dist/cdn/{AOWNMC3W.js → TK235QG4.js} +1 -1
  114. package/dist/cdn/{ITSA4WXG.js → TRXDA7G2.js} +1 -1
  115. package/dist/cdn/U2ZKJCSY.js +27 -0
  116. package/dist/cdn/UBPOT5V3.js +2 -0
  117. package/dist/cdn/{QGDR24DC.js → UY66XIX3.js} +1 -1
  118. package/dist/cdn/{BAFYN4RD.js → V2DYKK6V.js} +1 -1
  119. package/dist/cdn/{QEPO225M.js → V6VJJHYJ.js} +1 -1
  120. package/dist/cdn/{YM2IDMZO.js → V73HMWMC.js} +1 -1
  121. package/dist/cdn/{7WIFBTQF.js → VCL4OTSQ.js} +6 -14
  122. package/dist/cdn/{Z23BVIGQ.js → VYCVNEK2.js} +1 -1
  123. package/dist/cdn/{2BM4W44V.js → WAJG744H.js} +1 -1
  124. package/dist/cdn/WRLN7DLT.js +2 -0
  125. package/dist/cdn/X3CDW2ME.js +78 -0
  126. package/dist/cdn/{3TIQRBWC.js → XDONARND.js} +1 -1
  127. package/dist/cdn/{MGEDATQ7.js → XF5N3NI5.js} +1 -1
  128. package/dist/cdn/{63ZMLOEP.js → XKBOPER7.js} +1 -1
  129. package/dist/cdn/XOEFU24R.js +2 -0
  130. package/dist/cdn/{U6JZYJ4D.js → Y3Q6SFIV.js} +1 -1
  131. package/dist/cdn/Y6KZTCZD.js +2 -0
  132. package/dist/cdn/{WI67R264.js → YKSW755L.js} +1 -1
  133. package/dist/cdn/YM4U4HSN.js +2 -0
  134. package/dist/cdn/{OQOCOC5R.js → ZQAD6SUE.js} +1 -1
  135. package/dist/cdn/{QU25YPPX.js → ZZJHOJM5.js} +1 -1
  136. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.en.json +1 -1
  137. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.json +1 -1
  138. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.en.json +1 -1
  139. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.json +1 -1
  140. package/dist/cdn/index.js +1 -1
  141. package/dist/chunks/assessBuildRequest.js +13 -13
  142. package/dist/chunks/assessUpdateRequest.js +29 -26
  143. package/dist/chunks/assistantResponse.js +6 -14
  144. package/dist/chunks/classifyIntent.js +5 -5
  145. package/dist/chunks/solution-builder-assistant.js +3 -3
  146. package/dist/chunks/updateDesign.js +1 -1
  147. package/dist/components/arcgis-solutions-assistant/customElement.d.ts +6 -0
  148. package/dist/components/arcgis-solutions-assistant/customElement.js +465 -448
  149. package/dist/components/create-feature/customElement.js +101 -74
  150. package/dist/components/crowdsource-reporter/customElement.d.ts +6 -2
  151. package/dist/components/crowdsource-reporter/customElement.js +1 -1
  152. package/dist/components/solutions-deploy-app/customElement.d.ts +8 -0
  153. package/dist/components/solutions-deploy-app/customElement.js +19 -19
  154. package/dist/docs/api.json +1 -1
  155. package/dist/docs/docs.json +1 -1
  156. package/dist/docs/web-types.json +1 -1
  157. package/dist/solutions-components_commit.txt +3 -3
  158. package/package.json +3 -3
  159. package/dist/cdn/4MAZNAHZ.js +0 -2
  160. package/dist/cdn/4RU3GWUU.js +0 -2
  161. package/dist/cdn/6IBUETLU.js +0 -2
  162. package/dist/cdn/6ZN2VAXG.js +0 -2
  163. package/dist/cdn/7CAFUU5D.js +0 -2
  164. package/dist/cdn/APL6U736.js +0 -2
  165. package/dist/cdn/BBECVTV3.js +0 -2
  166. package/dist/cdn/BG4LNU44.js +0 -2
  167. package/dist/cdn/BZLMMSFW.js +0 -2
  168. package/dist/cdn/CDJCXGBN.js +0 -2
  169. package/dist/cdn/CUOHPTI7.js +0 -2
  170. package/dist/cdn/CVHXDPJO.js +0 -2
  171. package/dist/cdn/DD2Y5NOB.js +0 -2
  172. package/dist/cdn/DMM5WA5Q.js +0 -4
  173. package/dist/cdn/DVWIWECZ.js +0 -27
  174. package/dist/cdn/F2V6IA23.js +0 -2
  175. package/dist/cdn/GWJRCE5C.js +0 -90
  176. package/dist/cdn/JGMNZLH4.js +0 -7
  177. package/dist/cdn/JMYENPUQ.js +0 -2
  178. package/dist/cdn/LBY3ZNJE.js +0 -2
  179. package/dist/cdn/LZDMYPQ2.js +0 -75
  180. package/dist/cdn/ON244IGD.js +0 -2
  181. package/dist/cdn/PYBOC3DB.js +0 -2
  182. package/dist/cdn/RMEDO4JC.js +0 -2
  183. package/dist/cdn/SO27FVOH.js +0 -2
  184. package/dist/cdn/SWM5KEF6.js +0 -2
  185. package/dist/cdn/TDH6R4JP.js +0 -2
  186. package/dist/cdn/TWJSFINX.js +0 -2
  187. package/dist/cdn/UQDRAXO2.js +0 -2
  188. package/dist/cdn/UQN2JCKP.js +0 -2
  189. package/dist/cdn/WDRZR4N3.js +0 -2
  190. package/dist/cdn/WUKFT5AY.js +0 -4
  191. package/dist/cdn/WW6SEFWM.js +0 -2
  192. package/dist/cdn/XDF5MAGN.js +0 -2
  193. package/dist/cdn/Y7F2QFO6.js +0 -2
  194. package/dist/cdn/YCJJWOTP.js +0 -2
  195. package/dist/cdn/ZWKTEPK3.js +0 -2
@@ -1,28 +1,28 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
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";
2
+ import { c as Ae } from "../../chunks/runtime.js";
3
+ import { u as Le } from "../../chunks/useT9n.js";
4
+ import { LitElement as $e, createEvent as se, nothing as ie } from "@arcgis/lumina";
5
+ import { css as Fe, html as C } from "lit";
6
+ import { unsafeHTML as Re } from "lit/directives/unsafe-html.js";
7
+ import { useContextConsumer as ne } from "@arcgis/lumina/context";
8
+ import { c as De, b as Ne } from "../../chunks/deployAppContexts.js";
9
+ import { T as R } from "../../chunks/interfaces.js";
10
+ import { m as Me } from "../../chunks/helpers.js";
11
+ import ae from "@arcgis/core/config.js";
12
+ import { createRef as Be, ref as Pe } from "lit-html/directives/ref.js";
13
+ import { Annotation as y, StateGraph as J, START as G, END as S, NodeInterrupt as re } from "@langchain/langgraph/web";
14
+ import { createAgentRuntimeState as H, sendTraceMessage as w, invokeStructuredPrompt as k, getEmbeddings as qe, cosineSimilarity as Ue, invokeTextPrompt as Oe } from "@arcgis/ai-orchestrator";
15
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";
16
+ import * as W from "@esri/arcgis-rest-portal";
17
+ import { applyPatch as ze } from "fast-json-patch";
18
18
  import "@langchain/core/messages";
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)}`;
25
- async function y(t, e) {
19
+ import { C as le } from "../../chunks/converter.js";
20
+ import { v as O, b as z, S as je, g as Ve } from "../../chunks/validators.js";
21
+ import { t as ce, g as P, c as de, r as ue, d as $ } from "../../chunks/templates.js";
22
+ import Je from "@arcgis/core/portal/Portal.js";
23
+ import Ge from "@arcgis/core/portal/PortalItem.js";
24
+ const He = Fe`: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)}`;
25
+ async function v(t, e) {
26
26
  const s = Object.entries(t).find(
27
27
  ([i]) => i.endsWith(`/${e}.md`)
28
28
  );
@@ -35,10 +35,10 @@ ${Object.keys(t).join(`
35
35
  );
36
36
  return await s[1]();
37
37
  }
38
- function P(t) {
38
+ function q(t) {
39
39
  return t?.configurable?.context?.translations;
40
40
  }
41
- function ue(t) {
41
+ function pe(t) {
42
42
  if (typeof window > "u" || t.length <= 1)
43
43
  return;
44
44
  const e = t.map((i) => i.solution.id), s = t.map((i) => i.solution.title);
@@ -60,7 +60,7 @@ function ue(t) {
60
60
  }
61
61
  }));
62
62
  }
63
- function pe(t) {
63
+ function me(t) {
64
64
  if (typeof window > "u" || !t)
65
65
  return;
66
66
  const e = new CustomEvent("solutionIDFromAssistant", {
@@ -70,21 +70,21 @@ function pe(t) {
70
70
  });
71
71
  window.dispatchEvent(e);
72
72
  }
73
- const He = /* @__PURE__ */ Object.assign({
73
+ const We = /* @__PURE__ */ Object.assign({
74
74
  "./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((t) => t.default)
75
75
  });
76
- function We(t) {
76
+ function Qe(t) {
77
77
  return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">&#91;$1&#93;</a></sup>');
78
78
  }
79
- function Qe(t, e) {
79
+ function Ke(t, e) {
80
80
  const s = [];
81
81
  return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
82
- const o = n.title;
83
- if (!o)
82
+ const a = n.title;
83
+ if (!a)
84
84
  return;
85
- const a = new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`, "giu");
85
+ const o = new RegExp(`(?<![\\p{L}\\p{N}])${a}(?![\\p{L}\\p{N}])`, "giu");
86
86
  let l = !1;
87
- t = t.replace(a, () => (l = !0, `<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`)), l && s.push({
87
+ t = t.replace(o, () => (l = !0, `<a href="" target="solutionId:${n.deployCommonId}">${a}</a>`)), l && s.push({
88
88
  solution: {
89
89
  title: n.title,
90
90
  id: n.deployCommonId,
@@ -95,13 +95,13 @@ function Qe(t, e) {
95
95
  });
96
96
  }), { source: t, allMatches: s };
97
97
  }
98
- function Ke(t) {
98
+ function Ye(t) {
99
99
  return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
100
100
  }
101
- function me(t) {
101
+ function ge(t) {
102
102
  return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
103
103
  }
104
- async function j(t, e, s) {
104
+ async function V(t, e, s) {
105
105
  const i = await fetch(e, {
106
106
  method: "POST",
107
107
  headers: {
@@ -114,32 +114,32 @@ async function j(t, e, s) {
114
114
  throw new Error(`HTTP ${i.status} calling ${e}`);
115
115
  return i.json();
116
116
  }
117
- const Ye = (t) => new Promise((e) => setTimeout(e, t)), Xe = b.Root({
117
+ const Xe = (t) => new Promise((e) => setTimeout(e, t)), Ze = y.Root({
118
118
  // Provides agentExecutionContext, outputMessage, summary, and status
119
119
  // channels with the orchestrator's standard reducers/defaults so the
120
120
  // sub-agent reports back through the same shape the orchestrator
121
121
  // persists into priorSteps.
122
- ...G(),
123
- solutionResponse: b({
122
+ ...H(),
123
+ solutionResponse: y({
124
124
  reducer: (t, e) => e ?? null,
125
125
  default: () => null
126
126
  }),
127
- documentSkillUrl: b({
127
+ documentSkillUrl: y({
128
128
  reducer: (t, e) => e ?? null,
129
129
  default: () => null
130
130
  }),
131
131
  // Persisted across turns via the graph checkpointer so follow-up questions
132
132
  // continue the same service conversation. Null on the very first interaction
133
133
  // or after messages are cleared.
134
- conversationId: b({
134
+ conversationId: y({
135
135
  reducer: (t, e) => e ?? t,
136
136
  default: () => null
137
137
  })
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
+ }), et = () => new J(Ze).addNode("initializeAgent", st).addNode("askSolutionsQuestions", tt).addEdge(G, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", S), he = async (t, e, s, i) => {
139
139
  if (!t) return;
140
- const n = me(t);
140
+ const n = ge(t);
141
141
  if (!n) return;
142
- const a = { context: {
142
+ const o = { context: {
143
143
  kind: "DocAIAssistantRequest",
144
144
  filters: {
145
145
  products: "ArcGIS Solutions",
@@ -149,17 +149,17 @@ const Ye = (t) => new Promise((e) => setTimeout(e, t)), Xe = b.Root({
149
149
  }
150
150
  }
151
151
  } };
152
- i && (a.conversationId = i), j(a, n, e ?? "");
153
- }, et = async (t, e) => {
152
+ i && (o.conversationId = i), V(o, n, e ?? "");
153
+ }, tt = async (t, e) => {
154
154
  if (e?.configurable?.abortSignal?.aborted)
155
155
  return {};
156
- const s = P(e), i = t.documentSkillUrl;
156
+ const s = q(e), i = t.documentSkillUrl;
157
157
  let n = [];
158
158
  await w(
159
159
  { text: s.agentProgress.explorerAgentSearching },
160
160
  e
161
161
  );
162
- let o = await j(
162
+ let a = await V(
163
163
  {
164
164
  message: t.agentExecutionContext.userRequest,
165
165
  conversationId: e?.configurable?.context?.convoId ?? void 0,
@@ -177,22 +177,22 @@ const Ye = (t) => new Promise((e) => setTimeout(e, t)), Xe = b.Root({
177
177
  i,
178
178
  e?.configurable?.context?.token ?? ""
179
179
  );
180
- o.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(o.conversationId);
181
- let a = {
182
- message: o.message,
183
- conversationId: o.conversationId,
184
- hasMore: o.hasMore,
185
- ackSequenceNumber: o.sequenceNumber,
186
- inquiryId: o.inquiryId
180
+ a.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(a.conversationId);
181
+ let o = {
182
+ message: a.message,
183
+ conversationId: a.conversationId,
184
+ hasMore: a.hasMore,
185
+ ackSequenceNumber: a.sequenceNumber,
186
+ inquiryId: a.inquiryId
187
187
  }, l = "";
188
188
  const u = async (m) => {
189
- const f = m.context?.results?.[0]?.reply ?? "";
190
- if (f !== "") {
191
- const g = We(f), A = Qe(g, e);
192
- l = A.source, n = [
189
+ const b = m.context?.results?.[0]?.reply ?? "";
190
+ if (b !== "") {
191
+ const g = Qe(b), L = Ke(g, e);
192
+ l = L.source, n = [
193
193
  ...n,
194
- ...A.allMatches.filter(
195
- (E) => !n.some((k) => k.solution.id === E.solution.id)
194
+ ...L.allMatches.filter(
195
+ (E) => !n.some((A) => A.solution.id === E.solution.id)
196
196
  )
197
197
  ];
198
198
  }
@@ -202,45 +202,45 @@ const Ye = (t) => new Promise((e) => setTimeout(e, t)), Xe = b.Root({
202
202
  d === 1 ? g = s.agentProgress.explorerAgentReading : d === 2 ? g = s.agentProgress.explorerAgentReviewing : d === 3 && (g = s.agentProgress.explorerAgentPreparing), await w({ text: g }, e);
203
203
  }
204
204
  };
205
- for (await u(o); a.hasMore; ) {
205
+ for (await u(a); o.hasMore; ) {
206
206
  if (e?.configurable?.abortSignal?.aborted)
207
207
  return {};
208
- await Ye(500), o = await j(
208
+ await Xe(500), a = await V(
209
209
  {
210
- conversationId: a.conversationId,
211
- ackSequenceNumber: a.ackSequenceNumber,
212
- inquiryId: a.inquiryId
210
+ conversationId: o.conversationId,
211
+ ackSequenceNumber: o.ackSequenceNumber,
212
+ inquiryId: o.inquiryId
213
213
  },
214
214
  i,
215
215
  e?.configurable?.context?.token ?? ""
216
- ), a = {
217
- message: o.message,
218
- conversationId: o.conversationId,
219
- hasMore: o.hasMore,
220
- ackSequenceNumber: o.sequenceNumber,
221
- inquiryId: o.inquiryId
222
- }, await u(o);
216
+ ), o = {
217
+ message: a.message,
218
+ conversationId: a.conversationId,
219
+ hasMore: a.hasMore,
220
+ ackSequenceNumber: a.sequenceNumber,
221
+ inquiryId: a.inquiryId
222
+ }, await u(a);
223
223
  }
224
- return me(e?.configurable?.context.portal) && ge(
224
+ return ge(e?.configurable?.context.portal) && he(
225
225
  e?.configurable?.context.portal,
226
226
  e?.configurable?.context.token ?? "",
227
227
  e?.configurable?.context.configContext.locale ?? "en",
228
- a.conversationId
229
- ), n.length && (n.length === 1 ? pe(n[0].solution.id) : ue(n)), {
228
+ o.conversationId
229
+ ), n.length && (n.length === 1 ? me(n[0].solution.id) : pe(n)), {
230
230
  outputMessage: l,
231
231
  summary: l,
232
232
  status: "success",
233
- solutionResponse: a,
234
- conversationId: a.conversationId
233
+ solutionResponse: o,
234
+ conversationId: o.conversationId
235
235
  };
236
- }, tt = async (t, e) => {
236
+ }, st = async (t, e) => {
237
237
  let s = null;
238
- return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Ke(e.configurable.context.portal)), {
238
+ return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Ye(e.configurable.context.portal)), {
239
239
  documentSkillUrl: s
240
240
  };
241
241
  };
242
- await y(He, "solutions_explorer_description");
243
- const he = (t) => {
242
+ await v(We, "solutions_explorer_description");
243
+ const fe = (t) => {
244
244
  if (t && Array.isArray(t.id) && t.id.length > 0)
245
245
  return t.id[t.id.length - 1].replace("Message", "").toLowerCase();
246
246
  if (t && typeof t._getType == "function")
@@ -250,8 +250,8 @@ const he = (t) => {
250
250
  return "human";
251
251
  }
252
252
  return "human";
253
- }, st = (t) => {
254
- const e = he(t);
253
+ }, it = (t) => {
254
+ const e = fe(t);
255
255
  if (t && t.kwargs)
256
256
  return {
257
257
  role: e,
@@ -266,10 +266,10 @@ const he = (t) => {
266
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;
267
267
  }
268
268
  return { role: "human", content: String(t) };
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
269
+ }, nt = (t) => fe(t) === "human", at = (t, e = 3) => t.filter((s) => nt(s)).slice(-e).map(it), ot = (t, e = " ") => at(t).map((n) => n.content).join(e).trim(), rt = { 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?" }, lt = {
270
+ builderMessages: rt
271
271
  };
272
- class fe {
272
+ class be {
273
273
  constructor(e, s, i = !0) {
274
274
  this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = s, this.newDesign = i, this.validate();
275
275
  }
@@ -299,21 +299,21 @@ class fe {
299
299
  return;
300
300
  }
301
301
  if (!e.addLayers) {
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))))
302
+ const i = new Set(e.layers.map((a) => a.id)), n = new Set(s.layers.map((a) => a.id));
303
+ if (!(i.size === n.size && [...i].every((a) => n.has(a))))
304
304
  this.logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
305
305
  else
306
- for (const o of e.layers)
307
- if (o.type) {
308
- const a = s.layers.find((l) => l.id === o.id);
309
- a && a.type !== o.type && this.logIssue(`Layer '${o.id}' type '${a.type}' does not match template type '${o.type}'. This layer type is immutable.`);
306
+ for (const a of e.layers)
307
+ if (a.type) {
308
+ const o = s.layers.find((l) => l.id === a.id);
309
+ o && o.type !== a.type && this.logIssue(`Layer '${a.id}' type '${o.type}' does not match template type '${a.type}'. This layer type is immutable.`);
310
310
  }
311
311
  }
312
312
  }
313
313
  validateSolutionProps() {
314
- const e = this.response.solution.title, s = this.response.solution.description, i = U(e ?? "");
314
+ const e = this.response.solution.title, s = this.response.solution.description, i = O(e ?? "");
315
315
  if (i.isValid || this.logIssue(`Solution title is invalid (${i.errorType}).`), s) {
316
- const n = O(s, 2048);
316
+ const n = z(s, 2048);
317
317
  n.isValid || this.logIssue(`Solution description is invalid (${n.errorType}).`);
318
318
  }
319
319
  }
@@ -324,9 +324,9 @@ class fe {
324
324
  ]);
325
325
  for (const s of this.response.items) {
326
326
  e.has(s.type) && s.title.length > 100 && this.logIssue(`Service name '${s.title}' exceeds 100 characters.`);
327
- const i = U(s.title ?? "");
327
+ const i = O(s.title ?? "");
328
328
  if (i.isValid || this.logIssue(`Item '${s.id}' title is invalid (${i.errorType}).`), s.description) {
329
- const n = O(s.description, 2048);
329
+ const n = z(s.description, 2048);
330
330
  n.isValid || this.logIssue(`Item '${s.id}' description is invalid (${n.errorType}).`);
331
331
  }
332
332
  }
@@ -338,7 +338,7 @@ class fe {
338
338
  s.length !== new Set(s).size && this.logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${s}.`);
339
339
  for (const i of this.response.featureLayer.layers) {
340
340
  this.validateLayer(i, this.response.featureLayer.addLayers);
341
- const n = e.find((o) => o.id === i.id);
341
+ const n = e.find((a) => a.id === i.id);
342
342
  n && this.validateRequiredFields(i, n);
343
343
  }
344
344
  }
@@ -351,9 +351,9 @@ class fe {
351
351
  !s && e.typeMutable === !0 && e.type === "Table" && this.logIssue(
352
352
  `Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`
353
353
  );
354
- const i = U(e.name ?? "");
354
+ const i = O(e.name ?? "");
355
355
  if (i.isValid || this.logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
356
- const n = O(e.description, 2048);
356
+ const n = z(e.description, 2048);
357
357
  n.isValid || this.logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
358
358
  }
359
359
  this.validateLayerFields(e);
@@ -366,22 +366,22 @@ class fe {
366
366
  "created_user",
367
367
  "last_edited_date",
368
368
  "last_edited_user"
369
- ]), i = e.customFields.map((c) => c.name), n = new Set(e.requiredFields.map((c) => c.name)), o = [...new Set(
369
+ ]), i = e.customFields.map((c) => c.name), n = new Set(e.requiredFields.map((c) => c.name)), a = [...new Set(
370
370
  i.filter((c) => s.has(c))
371
371
  )];
372
- for (const c of o)
372
+ for (const c of a)
373
373
  this.logIssue(`Layer '${e.name}' field '${c}' collides with a reserved system field name.`);
374
- const a = [...new Set(
374
+ const o = [...new Set(
375
375
  i.filter((c) => n.has(c))
376
376
  )];
377
- for (const c of a)
377
+ for (const c of o)
378
378
  this.logIssue(`Layer '${e.name}' field '${c}' collides with a required field name.`);
379
- if (!o.length && !a.length) {
379
+ if (!a.length && !o.length) {
380
380
  const c = e.systemFields ?? [], m = [
381
381
  ...e.customFields,
382
382
  ...e.requiredFields,
383
383
  ...c
384
- ].map((f) => f.name);
384
+ ].map((b) => b.name);
385
385
  m.length !== new Set(m).size && this.logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(m)}.`);
386
386
  }
387
387
  const l = e.systemFields ?? [], u = [...e.customFields, ...e.requiredFields, ...l].map((c) => c.name.toLowerCase());
@@ -396,13 +396,13 @@ class fe {
396
396
  return e.slice(0, 31);
397
397
  const n = e.toLowerCase();
398
398
  i.delete(n);
399
- const o = e.slice(0, 31);
400
- let a = o, l = 1;
401
- for (; i.has(a.toLowerCase()); ) {
399
+ const a = e.slice(0, 31);
400
+ let o = a, l = 1;
401
+ for (; i.has(o.toLowerCase()); ) {
402
402
  const u = `_${l}`, c = Math.max(1, 31 - u.length);
403
- a = `${o.slice(0, c)}${u}`, l += 1;
403
+ o = `${a.slice(0, c)}${u}`, l += 1;
404
404
  }
405
- return i.add(a.toLowerCase()), a;
405
+ return i.add(o.toLowerCase()), o;
406
406
  }
407
407
  validateField(e) {
408
408
  const s = /^\p{L}/u, i = /^.[\p{L}\p{M}\p{N}_]*$/u;
@@ -414,26 +414,40 @@ class fe {
414
414
  e.name = this.getUniqueTruncatedFieldName(e.name), console.debug(`Field '${n}' exceeds 31 characters. Auto-fixing to '${e.name}'.`);
415
415
  } else
416
416
  this.logIssue(`Field '${e.name}' exceeds 31 characters.`);
417
- if (ze.has(e.name.toLowerCase()))
417
+ if (je.has(e.name.toLowerCase()))
418
418
  if (this.newDesign) {
419
419
  const n = e.name;
420
420
  e.name = `${n}_`, console.debug(`Field '${n}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`);
421
421
  } else
422
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.`));
423
+ if (e.type === "string" && this.validateStringFieldLength(e), 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((a) => a.length));
425
+ n > e.length && (this.newDesign ? (console.debug(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${n} characters. Auto-fixing to ${n}.`), e.length = n) : this.logIssue(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${n} characters.`));
426
426
  }
427
427
  }
428
428
  logIssue(e) {
429
429
  console.debug(e), this.issues.push(e), this.isValid = !1;
430
430
  }
431
+ validateStringFieldLength(e) {
432
+ if (this.newDesign && e.length === 255 && (e.length = 256), typeof e.length != "number" || Number.isNaN(e.length)) {
433
+ this.handleInvalidStringFieldLength(e, 256);
434
+ return;
435
+ }
436
+ const s = e.length;
437
+ if (!Ve(s).isValid) {
438
+ const n = s > 4e3 ? 4e3 : 256;
439
+ this.handleInvalidStringFieldLength(e, n);
440
+ }
441
+ }
442
+ handleInvalidStringFieldLength(e, s) {
443
+ this.newDesign ? (console.debug(`Field '${e.name}' has an invalid length. Auto-fixing to ${s}.`), e.length = s) : this.logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`);
444
+ }
431
445
  }
432
- const lt = r.object({
446
+ const ct = r.object({
433
447
  key: r.string().describe("Stable key identifier for the string."),
434
448
  value: r.string().describe("Display value for the string."),
435
449
  description: r.string().describe("Explanation of where/how the string is used.")
436
- }), ct = r.object({
450
+ }), dt = r.object({
437
451
  id: r.string().describe("ArcGIS item id (32 hex characters)."),
438
452
  title: r.string().describe("Item title."),
439
453
  description: r.string().describe("Item description."),
@@ -465,7 +479,7 @@ const lt = r.object({
465
479
  "List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
466
480
  ),
467
481
  length: r.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
468
- }), dt = r.object({
482
+ }), ut = r.object({
469
483
  id: r.number().int().describe("Layer/table id within the feature service."),
470
484
  type: r.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
471
485
  typeMutable: r.boolean().describe("Indicates whether the layer type can be changed."),
@@ -473,76 +487,75 @@ const lt = r.object({
473
487
  description: r.string().describe("Layer/table description."),
474
488
  customFields: r.array(oe).describe("User/business fields specific to the solution."),
475
489
  requiredFields: r.array(oe).describe("Fields required for solution functionality (e.g., relationship keys).")
476
- }), ut = r.object({
490
+ }), pt = r.object({
477
491
  itemId: r.string().describe("ArcGIS item id for the feature layer."),
478
492
  addLayers: r.boolean().describe("Indicates whether new layers can be added during solution design."),
479
- layers: r.array(dt)
480
- }), W = r.object({
493
+ layers: r.array(ut)
494
+ }), Q = r.object({
481
495
  response: r.string().describe("Conversational response to the user's query."),
482
496
  solution: r.object({
483
497
  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."),
484
498
  title: r.string().describe("Title of the solution."),
485
499
  description: r.string().describe("Description of the solution."),
486
500
  tags: r.array(r.string()).describe("Keywords/tags associated with the solution."),
487
- strings: r.array(lt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
501
+ strings: r.array(ct).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
488
502
  }),
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({
503
+ items: r.array(dt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
504
+ featureLayer: pt.describe("Primary feature layer item and its schema/layers/tables details.")
505
+ }), mt = r.object({
492
506
  op: r.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
493
507
  path: r.string().describe("RFC 6901 JSON Pointer to the target location."),
494
508
  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.`),
495
509
  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.")
496
- }), mt = r.object({
497
- response: r.string().describe("Conversational response describing the accepted design changes."),
498
- patches: r.array(pt).describe("Minimal RFC 6902 patch operations needed to update the current design.")
499
510
  }), gt = r.object({
500
- response: r.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
511
+ response: r.string().describe("Conversational response describing the accepted design changes."),
512
+ patches: r.array(mt).describe("Minimal RFC 6902 patch operations needed to update the current design.")
501
513
  }), ht = r.object({
514
+ response: r.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
515
+ }), ft = r.object({
502
516
  assistantResponse: r.string().describe("Natural-language response for the user."),
503
517
  isValidUpdate: r.boolean().describe("True only when the request is in scope for supported design updates.")
504
- }), ft = r.object({
505
- matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
506
518
  }), bt = r.object({
519
+ matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
520
+ }), yt = r.object({
507
521
  templateId: r.string().min(1).describe("Template id from the available template list."),
508
522
  confidence: r.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
509
523
  templateDescription: r.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
510
- }), yt = r.object({
524
+ }), vt = r.object({
511
525
  assistantResponse: r.string().nullable().describe("Natural-language response for the user."),
512
526
  isValidUseCase: r.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
513
- matchedTemplates: r.array(bt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists."),
514
- rationale: r.string().min(1).describe("A brief rationale for the choice for isValidUseCase and matchedTemplates (≤140 characters)")
515
- }), vt = (t) => t.length ? t.map((e, s) => `${s + 1}. ${e}`).join(`
516
- `) : "No validation errors were provided.", xt = async (t) => {
527
+ matchedTemplates: r.array(yt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
528
+ }), xt = (t) => t.length ? t.map((e, s) => `${s + 1}. ${e}`).join(`
529
+ `) : "No validation errors were provided.", wt = async (t) => {
517
530
  const {
518
531
  query: e,
519
532
  validationIssues: s,
520
533
  recentMessages: i,
521
534
  fallbackMessage: n,
522
- promptModules: o
535
+ promptModules: a
523
536
  } = t;
524
537
  try {
525
- return (await T({
526
- promptText: await y(o, "explainValidationFailure"),
538
+ return (await k({
539
+ promptText: await v(a, "explainValidationFailure"),
527
540
  modelTier: "fast",
528
541
  temperature: 0,
529
- schema: gt,
542
+ schema: ht,
530
543
  messages: i,
531
544
  inputVariables: {
532
545
  query: e,
533
546
  validationIssueCount: String(s.length),
534
- validationIssues: vt(s)
547
+ validationIssues: xt(s)
535
548
  }
536
549
  })).response?.trim() || n;
537
- } catch (a) {
550
+ } catch (o) {
538
551
  return console.warn(
539
552
  "Natural language response failed:",
540
- { error: a }
553
+ { error: o }
541
554
  ), n;
542
555
  }
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({
556
+ }, K = (t) => t in $, St = 5, It = 0.8, Ct = 0.15, _t = "Web Mapping Application", Tt = "Embeddings";
557
+ let N = null, j = null, M = null, B = null;
558
+ const kt = "Build", _ = /* @__PURE__ */ Object.assign({
546
559
  "./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((t) => t.default),
547
560
  "./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((t) => t.default),
548
561
  "./prompts/description.md": () => import("../../chunks/description2.js").then((t) => t.default),
@@ -550,52 +563,53 @@ const Tt = "Build", C = /* @__PURE__ */ Object.assign({
550
563
  "./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((t) => t.default),
551
564
  "./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
552
565
  "./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
553
- }), Et = rt.builderMessages, h = (t, e, s) => P(e)?.builderMessages?.[t] ?? Et[t], be = (t) => {
566
+ }), Et = lt.builderMessages, h = (t) => t?.configurable?.abortSignal.aborted ?? !1, f = (t, e, s) => q(e)?.builderMessages?.[t] ?? Et[t], ye = (t) => {
554
567
  typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
555
568
  detail: t
556
569
  }));
557
- }, kt = async (t, e, s) => {
570
+ }, At = async (t, e, s) => {
558
571
  if (!t) return null;
559
- const i = `type:"${Ct}" AND typekeywords:${_t} AND group:${t}`;
560
- return (await H.searchItems({
572
+ const i = `type:"${_t}" AND typekeywords:${Tt} AND group:${t}`;
573
+ return (await W.searchItems({
561
574
  q: i,
562
575
  params: e ? { token: e } : void 0,
563
576
  portal: s,
564
577
  num: 1
565
578
  }))?.results?.[0] ?? null;
566
579
  };
567
- async function At(t, e, s) {
580
+ async function Lt(t, e, s, i) {
568
581
  try {
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");
582
+ const n = await At(t, e, s);
583
+ if (!n || h(i))
584
+ return null;
585
+ const a = new Ge({ id: n.id });
586
+ return await a.load(), h(i) ? null : await a.fetchData("json");
573
587
  } catch {
574
588
  return null;
575
589
  }
576
590
  }
577
- const Lt = async (t, e, s) => {
591
+ const $t = async (t, e, s) => {
578
592
  if (!t) return [];
579
- const i = `type:Solution AND typekeywords:${Tt} AND group:${t}`;
580
- return (await H.searchItems({
593
+ const i = `type:Solution AND typekeywords:${kt} AND group:${t}`;
594
+ return (await W.searchItems({
581
595
  q: i,
582
596
  params: e ? { token: e } : void 0,
583
597
  portal: s,
584
598
  num: 100
585
599
  }))?.results ?? [];
586
- }, Rt = async (t, e, s) => {
600
+ }, Ft = async (t, e, s) => {
587
601
  try {
588
- const i = await H.getItemData(t, {
602
+ const i = await W.getItemData(t, {
589
603
  params: e ? { token: e } : void 0,
590
604
  portal: s
591
605
  }), n = i?.buildSolution;
592
606
  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 };
607
+ const a = i?.params, o = a && typeof a == "object" && !Array.isArray(a) ? a : null;
608
+ return { buildSolution: n, params: o };
595
609
  } catch {
596
610
  return null;
597
611
  }
598
- }, _ = (t, e = {}) => {
612
+ }, T = (t, e = {}) => {
599
613
  let s = t;
600
614
  return "itemId" in e && (s = {
601
615
  ...s,
@@ -613,108 +627,110 @@ const Lt = async (t, e, s) => {
613
627
  ...s,
614
628
  templateId: e.templateId ?? null
615
629
  }), s;
616
- }, ye = (t, e) => {
630
+ }, ve = (t, e) => {
617
631
  if (t == null || e == null)
618
632
  return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
619
633
  try {
620
634
  const s = structuredClone(e);
621
- return new re({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
635
+ return new le({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
622
636
  } catch (s) {
623
637
  return {
624
638
  ok: !1,
625
639
  error: s instanceof Error ? s.stack ?? s.message : String(s)
626
640
  };
627
641
  }
628
- }, K = async (t) => {
629
- if (z) {
630
- Object.entries(z).forEach(([a, l]) => {
631
- L[a] && (L[a].initialTemplate = l);
642
+ }, Y = async (t) => {
643
+ if (j) {
644
+ Object.entries(j).forEach(([o, l]) => {
645
+ $[o] && ($[o].initialTemplate = l);
632
646
  });
633
647
  return;
634
648
  }
635
- const e = t?.configurable?.context?.token, s = xe(t), i = we(t);
649
+ const e = t?.configurable?.context?.token, s = we(t), i = Se(t);
636
650
  if (!s) {
637
651
  console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
638
652
  return;
639
653
  }
640
- const n = await Lt(s, e, i), o = {};
641
- await Promise.all(n.map(async (a) => {
642
- const l = a.properties?.templateInfo;
654
+ const n = await $t(s, e, i), a = {};
655
+ h(t) || (await Promise.all(n.map(async (o) => {
656
+ const l = o.properties?.templateInfo;
643
657
  if (!l || typeof l != "object") return;
644
658
  const u = l.id;
645
- if (typeof u != "string" || o[u]) return;
646
- const c = await Rt(a.id, e, i);
647
- if (!c) return;
648
- const { buildSolution: m, params: f } = c;
659
+ if (typeof u != "string" || a[u]) return;
660
+ const c = await Ft(o.id, e, i);
661
+ if (!c || h(t))
662
+ return;
663
+ const { buildSolution: m, params: b } = c;
649
664
  if (typeof m == "object" && m !== null && "solution" in m) {
650
665
  const g = m.solution;
651
- g.thumbnailUrl = a.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
666
+ g.thumbnailUrl = o.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${o.id}/info/${o.thumbnail}` : void 0, g.item = o;
652
667
  }
653
668
  const d = {
654
669
  ...l,
655
670
  buildSolution: m
656
671
  };
657
- o[u] = _(
658
- new re(d).dumpToLlmTemplate(),
672
+ a[u] = T(
673
+ new le(d).dumpToLlmTemplate(),
659
674
  {
660
- itemId: a.id,
675
+ itemId: o.id,
661
676
  sourceBuildSolution: structuredClone(m),
662
- params: f ? structuredClone(f) : null
677
+ params: b ? structuredClone(b) : null
663
678
  }
664
- ), L[u] = {
679
+ ), $[u] = {
665
680
  ...l,
666
- initialTemplate: o[u]
681
+ initialTemplate: a[u]
667
682
  };
668
- })), z = o;
669
- }, ve = (t) => {
683
+ })), j = a);
684
+ }, xe = (t) => {
670
685
  const e = t?.configurable?.context?.token;
671
686
  return typeof e != "string" || !e.trim() ? null : e;
672
- }, xe = (t) => {
687
+ }, we = (t) => {
673
688
  const e = t?.configurable?.context?.configContext?.primarySolutionsGroupId;
674
689
  return typeof e != "string" || !e.trim() ? null : e;
675
- }, we = (t) => {
690
+ }, Se = (t) => {
676
691
  const e = t?.configurable?.context?.configContext?.portalURL;
677
692
  if (!(typeof e != "string" || !e.trim()))
678
693
  return `${e.replace(/\/+$/, "")}/sharing/rest`;
679
- }, $t = async (t) => {
694
+ }, Rt = async (t) => {
680
695
  await Promise.all([
681
- Ie(t),
682
- K(t)
696
+ Ce(t),
697
+ Y(t)
683
698
  ]);
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;
688
- })), await N;
689
- };
690
- async function Ie(t) {
691
- if (F) return F;
699
+ }, Ie = async (t) => {
692
700
  const e = xe(t);
701
+ (!M || e && e !== B) && (B = e ?? B, M = Rt(t).catch((i) => {
702
+ throw M = null, B = null, i;
703
+ })), await M;
704
+ };
705
+ async function Ce(t) {
706
+ if (N) return N;
707
+ const e = we(t);
693
708
  if (!e)
694
709
  return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), 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;
710
+ const s = Se(t), i = t?.configurable?.context?.configContext?.portalURL;
711
+ if (await new Je(i ? { url: i } : void 0).load(), h(t))
712
+ return null;
713
+ const a = xe(t) ?? void 0, o = await Lt(e, a, s, t);
714
+ return h(t) ? null : o ? (N = o.items, N) : null;
699
715
  }
700
- const Dt = () => Object.entries(L).map(([t, e]) => `ID: ${t}
716
+ const Dt = () => Object.entries($).map(([t, e]) => `ID: ${t}
701
717
  Label: ${e.label}
702
718
  Description: ${e.description}`).join(`
703
719
 
704
- `), Ft = (t) => {
720
+ `), Nt = (t) => {
705
721
  const e = t?.configurable?.context?.solutionDesignJson;
706
722
  if (typeof e != "string" || !e.trim())
707
723
  return null;
708
724
  try {
709
- const s = JSON.parse(e), i = _(
725
+ const s = JSON.parse(e), i = T(
710
726
  { response: "", ...s },
711
727
  { itemId: s?.solution?.itemId ?? null }
712
- ), n = W.safeParse(i);
728
+ ), n = Q.safeParse(i);
713
729
  if (!n.success)
714
730
  return null;
715
- const { response: o, ...a } = n.data, l = s.templateId, u = typeof l == "string" && Q(l) ? l : null;
716
- return _(
717
- a,
731
+ const { response: a, ...o } = n.data, l = s.templateId, u = typeof l == "string" && K(l) ? l : null;
732
+ return T(
733
+ o,
718
734
  {
719
735
  sourceBuildSolution: s.sourceBuildSolution,
720
736
  templateId: u,
@@ -724,75 +740,81 @@ Description: ${e.description}`).join(`
724
740
  } catch {
725
741
  return null;
726
742
  }
727
- }, Nt = b.Root({
728
- ...G(),
743
+ }, Mt = y.Root({
744
+ ...H(),
729
745
  /** Optional human-readable template description retained for UI use. */
730
- templateDescription: b({
746
+ templateDescription: y({
731
747
  reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
732
748
  default: () => null
733
749
  }),
734
750
  /** Current editable design payload being refined across turns. */
735
- currentDesign: b({
751
+ currentDesign: y({
736
752
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
737
753
  default: () => null
738
754
  }),
739
755
  /** Initial request assessment produced by the intake prompt. */
740
- assessment: b({
756
+ assessment: y({
741
757
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
742
758
  default: () => null
743
759
  }),
744
760
  /** Template selected automatically or by human-in-the-loop choice. */
745
- selectedTemplate: b({
761
+ selectedTemplate: y({
746
762
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
747
763
  default: () => null
748
764
  }),
749
765
  /** Update request assessment produced when an active design exists. */
750
- updateAssessment: b({
766
+ updateAssessment: y({
751
767
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
752
768
  default: () => null
753
769
  }),
754
770
  /** Existing solution matches surfaced before building a new solution. */
755
- existingMatches: b({
771
+ existingMatches: y({
756
772
  reducer: (t = [], e) => e === void 0 ? t : e ?? [],
757
773
  default: () => []
758
774
  }),
759
775
  /** User decision for whether to continue building after existing matches are shown. */
760
- continueBuilding: b({
776
+ continueBuilding: y({
761
777
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
762
778
  default: () => null
763
779
  })
764
- }), Mt = (t, e) => {
765
- const s = Ft(e), i = s?.templateId ?? null, n = {};
780
+ }), Bt = (t, e) => {
781
+ if (h(e))
782
+ return {};
783
+ const s = Nt(e), i = s?.templateId ?? null, n = {};
766
784
  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({
770
- promptText: await y(C, "assessBuildRequest"),
785
+ }, Pt = async (t, e) => {
786
+ if (h(e))
787
+ return {};
788
+ await w({ text: f("understandingRequest", e) }, e), await Ie(e);
789
+ const s = t.agentExecutionContext.userRequest, i = Dt(), n = t.agentExecutionContext.messages.slice(-11), a = await k({
790
+ promptText: await v(_, "assessBuildRequest"),
771
791
  modelTier: "advanced",
772
792
  temperature: 0,
773
- schema: yt,
793
+ schema: vt,
774
794
  messages: n,
775
795
  inputVariables: { query: s, availableTemplates: i }
776
- }), a = o.matchedTemplates.filter(
777
- (d) => Q(d.templateId)
796
+ }), o = a.matchedTemplates.filter(
797
+ (d) => K(d.templateId)
778
798
  ), l = {
779
- ...o,
780
- matchedTemplates: a
781
- }, [u, c] = a, f = !!u && u.confidence >= St && (c === void 0 || u.confidence - c.confidence >= It) ? u.templateId : null;
799
+ ...a,
800
+ matchedTemplates: o
801
+ }, [u, c] = o, b = !!u && u.confidence >= It && (c === void 0 || u.confidence - c.confidence >= Ct) ? u.templateId : null;
782
802
  return {
783
803
  assessment: l,
784
- selectedTemplate: f,
804
+ selectedTemplate: b,
785
805
  existingMatches: [],
786
806
  continueBuilding: null
787
807
  };
788
- }, Pt = (t) => {
808
+ }, qt = (t) => {
789
809
  const e = t.assessment?.assistantResponse ?? "";
790
810
  return {
791
811
  outputMessage: e,
792
812
  summary: e,
793
813
  status: "success"
794
814
  };
795
- }, qt = async (t, e) => {
815
+ }, Ut = async (t, e) => {
816
+ if (h(e))
817
+ return {};
796
818
  const { currentDesign: s } = t;
797
819
  if (!s)
798
820
  return {
@@ -801,59 +823,68 @@ Description: ${e.description}`).join(`
801
823
  isValidUpdate: !0
802
824
  }
803
825
  };
804
- await w({ text: h("understandingRequest", e) }, e);
826
+ await w({ text: f("understandingRequest", e) }, e);
805
827
  const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
806
828
  return {
807
- updateAssessment: await T({
808
- promptText: await y(C, "assessUpdateRequest"),
829
+ updateAssessment: await k({
830
+ promptText: await v(_, "assessUpdateRequest"),
809
831
  modelTier: "advanced",
810
832
  temperature: 0,
811
- schema: ht,
833
+ schema: ft,
812
834
  messages: n,
813
835
  inputVariables: {
814
- currentDesign: JSON.stringify(le(s)),
836
+ currentDesign: JSON.stringify(ce(s)),
815
837
  query: i
816
838
  }
817
839
  })
818
840
  };
819
- }, Ut = (t, e) => {
820
- const s = t.updateAssessment?.assistantResponse ?? h("applyChangeFailed", e);
841
+ }, Ot = (t, e) => {
842
+ const s = t.updateAssessment?.assistantResponse ?? f("applyChangeFailed", e);
821
843
  return {
822
844
  outputMessage: s,
823
845
  summary: s,
824
846
  status: "success"
825
847
  };
826
- }, Ot = (t, e) => {
848
+ }, zt = (t, e) => {
849
+ if (h(e))
850
+ return {};
827
851
  const { hitlResponse: s } = e.configurable, i = "selectTemplate", n = t.assessment?.matchedTemplates.filter(
828
- (c) => Q(c.templateId)
829
- ) ?? [], o = n.map((c) => `${c.templateDescription}`);
852
+ (c) => K(c.templateId)
853
+ ) ?? [], a = n.map((c) => `${c.templateDescription}`);
830
854
  if (s?.agentId !== "solutionBuilder" || s.id !== i) {
831
855
  const c = {
832
856
  agentId: "solutionBuilder",
833
857
  id: i,
834
858
  kind: "singleSelection",
835
- message: h("selectTemplatePrompt", e),
836
- metadata: [...o]
859
+ message: f("selectTemplatePrompt", e),
860
+ metadata: [...a]
837
861
  };
838
- throw new ae(c);
862
+ throw new re(c);
839
863
  }
840
- const a = String(s.payload ?? ""), l = o.findIndex((c) => c === a);
864
+ const o = String(s.payload ?? ""), l = a.findIndex((c) => c === o);
841
865
  return {
842
866
  selectedTemplate: (l >= 0 ? n[l] : void 0)?.templateId ?? n[0]?.templateId ?? null
843
867
  };
844
- }, zt = async (t, e) => {
845
- await w({ text: h("searchingExistingSolutions", e) }, e);
846
- const s = t.agentExecutionContext.userRequest, i = ot(t.agentExecutionContext.messages) || s, n = await Ie(e);
868
+ }, jt = async (t, e) => {
869
+ if (h(e))
870
+ return {};
871
+ await w({ text: f("searchingExistingSolutions", e) }, e);
872
+ const s = t.agentExecutionContext.userRequest, i = ot(t.agentExecutionContext.messages) || s, n = await Ce(e);
873
+ if (h(e))
874
+ return {};
847
875
  if (!n)
848
876
  return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
849
877
  if (!n.length)
850
878
  return { existingMatches: [] };
851
- const [o] = await Pe([i]), a = n.map((d) => ({
879
+ const [a] = await qe([i]);
880
+ if (h(e))
881
+ return {};
882
+ const o = n.map((d) => ({
852
883
  solution: d,
853
- score: qe(o, d.embedding)
884
+ score: Ue(a, d.embedding)
854
885
  }));
855
- a.sort((d, g) => g.score - d.score);
856
- const l = a.slice(0, wt);
886
+ o.sort((d, g) => g.score - d.score);
887
+ const l = o.slice(0, St);
857
888
  if (!l.length)
858
889
  return { existingMatches: [] };
859
890
  const u = l.map(({ solution: d }) => `${d.title}
@@ -861,21 +892,23 @@ Snippet: ${d.snippet}
861
892
  Description: ${d.description}`).join(`
862
893
 
863
894
  `), c = t.agentExecutionContext.messages.slice(-11);
864
- return { existingMatches: (await T({
865
- promptText: await y(C, "findExistingSolution"),
895
+ return { existingMatches: (await k({
896
+ promptText: await v(_, "findExistingSolution"),
866
897
  modelTier: "fast",
867
898
  temperature: 0,
868
- schema: ft,
899
+ schema: bt,
869
900
  messages: c,
870
901
  inputVariables: { query: s, candidates: u }
871
902
  })).matchedTitles.map((d) => l.find(({ solution: g }) => g.title === d)).filter((d) => d !== void 0) };
872
- }, jt = (t, e) => {
903
+ }, Vt = (t, e) => {
904
+ if (h(e))
905
+ return {};
873
906
  const { existingMatches: s } = t, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${s[0].solution.id}`;
874
907
  if (i?.agentId !== "solutionBuilder" || i.id !== n) {
875
- s.length === 1 ? pe(s[0].solution.id) : ue(s);
876
- const u = h("existingSolutionMatch", e), c = [
877
- h("continueBuildingYes", e),
878
- h("continueBuildingNo", e)
908
+ s.length === 1 ? me(s[0].solution.id) : pe(s);
909
+ const u = f("existingSolutionMatch", e), c = [
910
+ f("continueBuildingYes", e),
911
+ f("continueBuildingNo", e)
879
912
  ], m = {
880
913
  agentId: "solutionBuilder",
881
914
  id: n,
@@ -883,121 +916,131 @@ Description: ${d.description}`).join(`
883
916
  message: u,
884
917
  metadata: c
885
918
  };
886
- throw new ae(m);
919
+ throw new re(m);
887
920
  }
888
- const o = String(i.payload ?? "").trim(), a = h("continueBuildingNo", e);
889
- return { continueBuilding: o !== a };
890
- }, Vt = (t, e) => {
891
- const s = h("continueBuildingDeclined", e);
921
+ const a = String(i.payload ?? "").trim(), o = f("continueBuildingNo", e);
922
+ return { continueBuilding: a !== o };
923
+ }, Jt = (t, e) => {
924
+ const s = f("continueBuildingDeclined", e);
892
925
  return {
893
926
  outputMessage: s,
894
927
  summary: s,
895
928
  status: "success"
896
929
  };
897
- }, Ce = async (t, e) => {
898
- await Se(e);
930
+ }, _e = async (t, e) => {
931
+ if (h(e))
932
+ return {};
933
+ if (await Ie(e), h(e))
934
+ return {};
899
935
  const { currentDesign: s } = t, i = t.agentExecutionContext.userRequest;
900
- await w({ text: h("creatingDesign", e) }, e);
901
- let n = B(t.selectedTemplate);
902
- if (n?.initialTemplate || (await K(e), n = B(t.selectedTemplate)), !n?.initialTemplate)
936
+ await w({ text: f("creatingDesign", e) }, e);
937
+ let n = P(t.selectedTemplate);
938
+ if (n?.initialTemplate || (await Y(e), n = P(t.selectedTemplate)), h(e))
939
+ return {};
940
+ if (!n?.initialTemplate)
903
941
  throw new Error("No hydrated templates are available for solution design.");
904
- const o = _(
942
+ const a = T(
905
943
  s ?? n.initialTemplate,
906
944
  {
907
945
  itemId: (s ?? n.initialTemplate)?.solution?.itemId ?? null,
908
946
  sourceBuildSolution: s?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
909
947
  params: s?.params ?? n.initialTemplate.params ?? null
910
948
  }
911
- ), a = t.agentExecutionContext.messages.slice(-11), l = await T({
912
- promptText: await y(C, "designSolution"),
949
+ ), o = t.agentExecutionContext.messages.slice(-11), l = await k({
950
+ promptText: await v(_, "designSolution"),
913
951
  modelTier: "advanced",
914
952
  temperature: 0,
915
- schema: W,
916
- messages: a,
953
+ schema: Q,
954
+ messages: o,
917
955
  inputVariables: {
918
- currentDesign: JSON.stringify(ce(o)),
956
+ currentDesign: JSON.stringify(de(a)),
919
957
  templateInstructions: n.instructions,
920
958
  query: i
921
959
  }
922
- }), { response: u, featureLayer: c, ...m } = l, f = de(
960
+ });
961
+ if (await w({ text: " of design solution 1" }, e), h(e))
962
+ return {};
963
+ const { response: u, featureLayer: c, ...m } = l, b = ue(
923
964
  c,
924
- o.featureLayer
925
- ), d = _(
926
- { ...m, featureLayer: f },
965
+ a.featureLayer
966
+ ), d = T(
967
+ { ...m, featureLayer: b },
927
968
  {
928
- itemId: o?.solution?.itemId,
929
- sourceBuildSolution: o.sourceBuildSolution,
969
+ itemId: a?.solution?.itemId,
970
+ sourceBuildSolution: a.sourceBuildSolution,
930
971
  templateId: t.selectedTemplate ?? null,
931
- params: o.params ?? null
972
+ params: a.params ?? null
932
973
  }
933
- ), g = new fe(d, n.initialTemplate);
974
+ ), g = new be(d, n.initialTemplate);
934
975
  if (!g.isValid)
935
976
  return console.warn(
936
977
  "[SolutionBuilder] designSolution validation failed:",
937
978
  { issues: g.issues, llmResponse: l }
938
979
  ), {
939
- outputMessage: h("createDesignFailed", e)
980
+ outputMessage: f("createDesignFailed", e)
940
981
  };
941
- const A = d.sourceBuildSolution, E = ye(d, A);
982
+ const L = d.sourceBuildSolution, E = ve(d, L);
942
983
  if (!E.ok) {
943
984
  console.warn(
944
985
  "[SolutionBuilder] designSolution Esri JSON conversion failed:",
945
986
  { error: E.error, llmResponse: l, design: d }
946
987
  );
947
- const k = h("createDesignFailed", e);
988
+ const A = f("createDesignFailed", e);
948
989
  return {
949
- outputMessage: k,
950
- summary: k,
990
+ outputMessage: A,
991
+ summary: A,
951
992
  status: "success"
952
993
  };
953
994
  }
954
- return be(d), {
995
+ return h(e) ? {} : (ye(d), {
955
996
  outputMessage: u,
956
997
  summary: u,
957
998
  status: "success",
958
999
  currentDesign: d
959
- };
960
- }, Jt = async (t, e) => {
1000
+ });
1001
+ }, Gt = async (t, e) => {
1002
+ if (h(e))
1003
+ return {};
961
1004
  const { currentDesign: s } = t;
962
1005
  if (!s)
963
- return Ce(t, e);
1006
+ return _e(t, e);
964
1007
  const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
965
- await w({ text: h("updatingDesign", e) }, e);
966
- let o;
1008
+ await w({ text: f("updatingDesign", e) }, e);
1009
+ let a;
967
1010
  try {
968
- o = await T({
969
- promptText: await y(C, "updateDesign"),
1011
+ a = await k({
1012
+ promptText: await v(_, "updateDesign"),
970
1013
  modelTier: "advanced",
971
1014
  temperature: 0,
972
- schema: mt,
1015
+ schema: gt,
973
1016
  messages: n,
974
1017
  inputVariables: {
975
- currentDesign: JSON.stringify(le(s)),
1018
+ currentDesign: JSON.stringify(ce(s)),
976
1019
  query: i
977
1020
  }
978
1021
  });
979
1022
  } catch (p) {
980
1023
  console.warn("[SolutionBuilder] updateDesign structured prompt failed:", p);
981
- const v = h("applyChangeFailed", e);
1024
+ const x = f("applyChangeFailed", e);
982
1025
  return {
983
- outputMessage: v,
984
- summary: v,
1026
+ outputMessage: x,
1027
+ summary: x,
985
1028
  status: "success"
986
1029
  };
987
1030
  }
988
- const { response: a, patches: l } = o;
1031
+ const { response: o, patches: l } = a;
989
1032
  if (!l || l.length === 0)
990
1033
  return {
991
- outputMessage: a,
992
- summary: a,
1034
+ outputMessage: o,
1035
+ summary: o,
993
1036
  status: "success"
994
1037
  };
995
1038
  const u = (p) => {
996
1039
  try {
997
1040
  return JSON.parse(p);
998
1041
  } catch {
999
- const v = p.replace(/[\u0000-\u001F]/g, (ee) => {
1000
- switch (ee) {
1042
+ const x = p.replace(/[\u0000-\u001F]/g, (te) => {
1043
+ switch (te) {
1001
1044
  case "\b":
1002
1045
  return "\\b";
1003
1046
  case "\f":
@@ -1010,11 +1053,11 @@ Description: ${d.description}`).join(`
1010
1053
  case " ":
1011
1054
  return "\\t";
1012
1055
  default:
1013
- return "\\u" + ee.charCodeAt(0).toString(16).padStart(4, "0");
1056
+ return "\\u" + te.charCodeAt(0).toString(16).padStart(4, "0");
1014
1057
  }
1015
1058
  });
1016
1059
  try {
1017
- return JSON.parse(v);
1060
+ return JSON.parse(x);
1018
1061
  } catch {
1019
1062
  return p;
1020
1063
  }
@@ -1024,44 +1067,44 @@ Description: ${d.description}`).join(`
1024
1067
  path: p.path.replace(/\/+$/, ""),
1025
1068
  ...p.value != null && p.value !== "" ? { value: u(p.value) } : {},
1026
1069
  ...p.from != null && p.from !== "" ? { from: p.from } : {}
1027
- }))].sort((p, v) => p.op !== "remove" || v.op !== "remove" ? 0 : v.path.localeCompare(p.path, void 0, { numeric: !0 })), f = structuredClone(
1028
- ce(s)
1070
+ }))].sort((p, x) => p.op !== "remove" || x.op !== "remove" ? 0 : x.path.localeCompare(p.path, void 0, { numeric: !0 })), b = structuredClone(
1071
+ de(s)
1029
1072
  );
1030
1073
  try {
1031
- Oe(f, m, !0);
1074
+ ze(b, m, !0);
1032
1075
  } catch (p) {
1033
1076
  console.warn(
1034
1077
  "[SolutionBuilder] updateDesign JSON patch failed:",
1035
- { error: p, llmResponse: o, patches: m, patchTarget: f }
1078
+ { error: p, llmResponse: a, patches: m, patchTarget: b }
1036
1079
  );
1037
- const v = h("applyChangeFailed", e);
1080
+ const x = f("applyChangeFailed", e);
1038
1081
  return {
1039
- outputMessage: v,
1040
- summary: v,
1082
+ outputMessage: x,
1083
+ summary: x,
1041
1084
  status: "success"
1042
1085
  };
1043
1086
  }
1044
- const d = _(
1045
- { response: "", ...f },
1087
+ const d = T(
1088
+ { response: "", ...b },
1046
1089
  { itemId: s.solution?.itemId ?? null }
1047
- ), g = W.safeParse(d);
1090
+ ), g = Q.safeParse(d);
1048
1091
  if (!g.success) {
1049
1092
  console.warn(
1050
1093
  "[SolutionBuilder] updateDesign schema validation failed:",
1051
- { errors: g.error.issues, llmResponse: o, patchedDesign: d }
1094
+ { errors: g.error.issues, llmResponse: a, patchedDesign: d }
1052
1095
  );
1053
- const p = h("applyChangeFailed", e);
1096
+ const p = f("applyChangeFailed", e);
1054
1097
  return {
1055
1098
  outputMessage: p,
1056
1099
  summary: p,
1057
1100
  status: "success"
1058
1101
  };
1059
1102
  }
1060
- const { response: A, featureLayer: E, ...k } = g.data, Te = de(
1103
+ const { response: L, featureLayer: E, ...A } = g.data, ke = ue(
1061
1104
  E,
1062
1105
  s.featureLayer
1063
- ), S = _(
1064
- { ...k, featureLayer: Te },
1106
+ ), I = T(
1107
+ { ...A, featureLayer: ke },
1065
1108
  {
1066
1109
  itemId: s.solution?.itemId,
1067
1110
  sourceBuildSolution: s.sourceBuildSolution,
@@ -1069,21 +1112,23 @@ Description: ${d.description}`).join(`
1069
1112
  params: s.params ?? null
1070
1113
  }
1071
1114
  );
1072
- let R = B(t.selectedTemplate);
1073
- if (R?.initialTemplate || (await K(e), R = B(t.selectedTemplate)), !R?.initialTemplate)
1115
+ let F = P(t.selectedTemplate);
1116
+ if (F?.initialTemplate || (await Y(e), F = P(t.selectedTemplate)), h(e))
1117
+ return {};
1118
+ if (!F?.initialTemplate)
1074
1119
  throw new Error("No hydrated templates are available for solution design.");
1075
- const q = new fe(S, R.initialTemplate, !1);
1076
- if (!q.isValid) {
1120
+ const U = new be(I, F.initialTemplate, !1);
1121
+ if (!U.isValid) {
1077
1122
  console.warn(
1078
1123
  "[SolutionBuilder] updateDesign validation failed:",
1079
- { issues: q.issues, llmResponse: o, patchedDesign: S }
1124
+ { issues: U.issues, llmResponse: a, patchedDesign: I }
1080
1125
  );
1081
- const p = await xt({
1126
+ const p = await wt({
1082
1127
  query: i,
1083
- validationIssues: q.issues,
1128
+ validationIssues: U.issues,
1084
1129
  recentMessages: n,
1085
- fallbackMessage: h("applyChangeFailed", e),
1086
- promptModules: C
1130
+ fallbackMessage: f("applyChangeFailed", e),
1131
+ promptModules: _
1087
1132
  });
1088
1133
  return {
1089
1134
  outputMessage: p,
@@ -1091,149 +1136,149 @@ Description: ${d.description}`).join(`
1091
1136
  status: "success"
1092
1137
  };
1093
1138
  }
1094
- const Ee = S.sourceBuildSolution, Z = ye(S, Ee);
1095
- if (!Z.ok) {
1139
+ const Ee = I.sourceBuildSolution, ee = ve(I, Ee);
1140
+ if (!ee.ok) {
1096
1141
  console.warn(
1097
1142
  "[SolutionBuilder] updateDesign Esri JSON conversion failed:",
1098
- { error: Z.error, llmResponse: o, design: S }
1143
+ { error: ee.error, llmResponse: a, design: I }
1099
1144
  );
1100
- const p = h("applyChangeFailed", e);
1145
+ const p = f("applyChangeFailed", e);
1101
1146
  return {
1102
1147
  outputMessage: p,
1103
1148
  summary: p,
1104
1149
  status: "success"
1105
1150
  };
1106
1151
  }
1107
- return be(S), {
1108
- outputMessage: a,
1109
- summary: a,
1152
+ return h(e) ? {} : (ye(I), {
1153
+ outputMessage: o,
1154
+ summary: o,
1110
1155
  status: "success",
1111
- currentDesign: S
1112
- };
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, {
1156
+ currentDesign: I
1157
+ });
1158
+ }, Ht = (t) => t.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", Wt = (t) => !t.updateAssessment || !t.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", Qt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidBuildExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Kt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", Yt = (t) => t.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", Xt = () => new J(Mt).addNode("syncCurrentDesignFromContext", Bt).addNode("assessBuildRequest", Pt).addNode("assessUpdateRequest", Ut).addNode("invalidBuildExit", qt).addNode("invalidUpdateExit", Ot).addNode("selectTemplateHIL", zt).addNode("findExistingSolutions", jt).addNode("confirmContinueBuildingHIL", Vt).addNode("declineContinueBuildingExit", Jt).addNode("designSolution", _e).addNode("updateDesign", Gt).addEdge(G, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Ht, {
1114
1159
  assessUpdateRequest: "assessUpdateRequest",
1115
1160
  assessBuildRequest: "assessBuildRequest"
1116
- }).addConditionalEdges("assessUpdateRequest", Ht, {
1161
+ }).addConditionalEdges("assessUpdateRequest", Wt, {
1117
1162
  invalidUpdateExit: "invalidUpdateExit",
1118
1163
  updateDesign: "updateDesign"
1119
- }).addConditionalEdges("assessBuildRequest", Wt, {
1164
+ }).addConditionalEdges("assessBuildRequest", Qt, {
1120
1165
  invalidBuildExit: "invalidBuildExit",
1121
1166
  selectTemplateHIL: "selectTemplateHIL",
1122
1167
  findExistingSolutions: "findExistingSolutions"
1123
- }).addEdge("invalidBuildExit", x).addEdge("invalidUpdateExit", x).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Qt, {
1168
+ }).addEdge("invalidBuildExit", S).addEdge("invalidUpdateExit", S).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Kt, {
1124
1169
  confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
1125
1170
  designSolution: "designSolution"
1126
- }).addConditionalEdges("confirmContinueBuildingHIL", Kt, {
1171
+ }).addConditionalEdges("confirmContinueBuildingHIL", Yt, {
1127
1172
  declineContinueBuildingExit: "declineContinueBuildingExit",
1128
1173
  designSolution: "designSolution"
1129
- }).addEdge("declineContinueBuildingExit", x).addEdge("designSolution", x).addEdge("updateDesign", x);
1130
- await y(C, "description");
1131
- const Xt = D.object({
1174
+ }).addEdge("declineContinueBuildingExit", S).addEdge("designSolution", S).addEdge("updateDesign", S);
1175
+ await v(_, "description");
1176
+ const Zt = D.object({
1132
1177
  tool: D.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
1133
1178
  confidence: D.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
1134
1179
  rationale: D.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
1135
- }), Y = /* @__PURE__ */ Object.assign({
1180
+ }), X = /* @__PURE__ */ Object.assign({
1136
1181
  "./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((t) => t.default),
1137
1182
  "./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((t) => t.default),
1138
1183
  "./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default)
1139
- }), X = (t) => {
1184
+ }), Z = (t) => {
1140
1185
  const e = new CustomEvent("assistantProcessing", {
1141
1186
  detail: { finished: !0, agent: t }
1142
1187
  });
1143
1188
  window.dispatchEvent(e);
1144
- }, _e = b.Root({
1145
- ...G(),
1146
- selectedTool: b({
1189
+ }, Te = y.Root({
1190
+ ...H(),
1191
+ selectedTool: y({
1147
1192
  reducer: (t, e) => e ?? null,
1148
1193
  default: () => null
1149
1194
  }),
1150
- intentRationale: b({
1195
+ intentRationale: y({
1151
1196
  reducer: (t, e) => e ?? null,
1152
1197
  default: () => null
1153
1198
  })
1154
- }), Zt = async (t, e) => {
1199
+ }), es = async (t, e) => {
1155
1200
  if (e?.configurable?.abortSignal?.aborted)
1156
1201
  return {};
1157
- const s = P(e);
1202
+ const s = q(e);
1158
1203
  await w(
1159
1204
  { text: s?.builderMessages.understandingRequest },
1160
1205
  e
1161
1206
  );
1162
- const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11), o = e?.configurable?.context?.solutionDesignJson;
1163
- let a = !1;
1164
- if (typeof o == "string" && o.trim())
1207
+ const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11), a = e?.configurable?.context?.solutionDesignJson;
1208
+ let o = !1;
1209
+ if (typeof a == "string" && a.trim())
1165
1210
  try {
1166
- a = JSON.parse(o).solution != null;
1211
+ o = JSON.parse(a).solution != null;
1167
1212
  } catch {
1168
- a = !1;
1213
+ o = !1;
1169
1214
  }
1170
- const l = await y(Y, "classifyIntent"), u = await T({
1215
+ const l = await v(X, "classifyIntent"), u = await k({
1171
1216
  promptText: l,
1172
1217
  modelTier: "advanced",
1173
1218
  temperature: 0,
1174
- schema: Xt,
1219
+ schema: Zt,
1175
1220
  messages: n,
1176
- inputVariables: { query: i, activeSolutionDesign: a }
1221
+ inputVariables: { query: i, activeSolutionDesign: o }
1177
1222
  });
1178
1223
  return {
1179
1224
  selectedTool: u.tool,
1180
1225
  intentRationale: u.rationale
1181
1226
  };
1182
- }, es = async (t, e) => {
1183
- if (e?.configurable?.abortSignal?.aborted)
1184
- return {};
1185
- const i = await Ze().compile().invoke(t, e);
1186
- return X("explorer"), i;
1187
1227
  }, ts = async (t, e) => {
1188
1228
  if (e?.configurable?.abortSignal?.aborted)
1189
1229
  return {};
1190
- const i = await Yt().compile().invoke(t, e);
1191
- return X("builder"), i;
1230
+ const i = await et().compile().invoke(t, e);
1231
+ return Z("explorer"), i;
1192
1232
  }, ss = async (t, e) => {
1193
1233
  if (e?.configurable?.abortSignal?.aborted)
1194
1234
  return {};
1195
- const s = P(e), i = t.agentExecutionContext.userRequest, n = t.intentRationale ?? "No rationale available.";
1235
+ const i = await Xt().compile().invoke(t, e);
1236
+ return Z("builder"), i;
1237
+ }, is = async (t, e) => {
1238
+ if (e?.configurable?.abortSignal?.aborted)
1239
+ return {};
1240
+ const s = q(e), i = t.agentExecutionContext.userRequest, n = t.intentRationale ?? "No rationale available.";
1196
1241
  await w(
1197
1242
  { text: s?.executingSolutionsAssistantAgent },
1198
1243
  e
1199
1244
  );
1200
- const o = await y(Y, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await Ue({
1201
- promptText: o,
1245
+ const a = await v(X, "assistantResponse"), o = t.agentExecutionContext.messages.slice(-11), l = await Oe({
1246
+ promptText: a,
1202
1247
  modelTier: "advanced",
1203
1248
  temperature: 0,
1204
- messages: a,
1249
+ messages: o,
1205
1250
  inputVariables: { query: i, rationale: n }
1206
1251
  });
1207
- return X("assistant"), {
1252
+ return Z("assistant"), {
1208
1253
  outputMessage: l,
1209
1254
  summary: l,
1210
1255
  status: "success"
1211
1256
  };
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, {
1257
+ }, ns = (t) => t.selectedTool ?? "other", as = () => new J(Te).addNode("classifyIntent", es).addNode("routeToExplorer", ts).addNode("routeToBuilder", ss).addNode("assistantResponse", is).addEdge(G, "classifyIntent").addConditionalEdges("classifyIntent", ns, {
1213
1258
  explorer: "routeToExplorer",
1214
1259
  builder: "routeToBuilder",
1215
1260
  other: "assistantResponse"
1216
- }).addEdge("routeToExplorer", x).addEdge("routeToBuilder", x).addEdge("assistantResponse", x), os = await y(Y, "description"), as = {
1261
+ }).addEdge("routeToExplorer", S).addEdge("routeToBuilder", S).addEdge("assistantResponse", S), os = await v(X, "description"), rs = {
1217
1262
  id: "solutionsAssistant",
1218
1263
  name: "Solutions Assistant Agent",
1219
1264
  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 {
1265
+ createGraph: as,
1266
+ workspace: Te
1267
+ }, ls = "https://links.esri.com/solutions/agol-organizational-account", cs = "https://links.esri.com/solutions/configure-assistants";
1268
+ class ds extends $e {
1224
1269
  constructor() {
1225
1270
  super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._orgSettings = {
1226
1271
  aiAssistantsEnabled: !1,
1227
1272
  blockBetaApps: !0,
1228
1273
  colocateCompute: !1
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({
1274
+ }, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Le({ 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 = Be(), this._configContextConsumer = ne({
1230
1275
  context: De,
1231
1276
  subscribe: !0,
1232
1277
  callback: (e) => {
1233
- e?.portalURL && (ne.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1278
+ e?.portalURL && (ae.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1234
1279
  }
1235
- }), this._builderDesignContextConsumer = ie({
1236
- context: Fe,
1280
+ }), this._builderDesignContextConsumer = ne({
1281
+ context: Ne,
1237
1282
  subscribe: !0,
1238
1283
  callback: (e) => {
1239
1284
  e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
@@ -1243,15 +1288,15 @@ class cs extends Le {
1243
1288
  }, this._chatStartTime = null, this._handleAssistantProcessingFinished = (e) => {
1244
1289
  const s = e;
1245
1290
  if (s.detail?.finished && this._chatStartTime !== null) {
1246
- const i = Ne(this._chatStartTime);
1291
+ const i = Me(this._chatStartTime);
1247
1292
  this._telemetry?.logEvent({
1248
- category: $.ASSISTANT,
1293
+ category: R.ASSISTANT,
1249
1294
  action: "Chat",
1250
1295
  dimensions: [s.detail.agent],
1251
1296
  metrics: [i]
1252
1297
  }), this._chatStartTime = null, this.assistantProcessing.emit(!1);
1253
1298
  }
1254
- }, this.closeAssistant = te(), this.assistantProcessing = te(), this._handleAssistantLinkClick = (e) => {
1299
+ }, this.closeAssistant = se(), this.assistantProcessing = se(), this._handleAssistantLinkClick = (e) => {
1255
1300
  const s = e.composedPath().find((i) => i instanceof HTMLAnchorElement);
1256
1301
  if (s?.href)
1257
1302
  if (e.preventDefault(), s.target.indexOf("solutionId:") > -1) {
@@ -1267,8 +1312,8 @@ class cs extends Le {
1267
1312
  }, this._checkURLOpenParameter = () => {
1268
1313
  this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
1269
1314
  }, this.listenOn(window, "arcgisFeedback", (e) => {
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 ?? "");
1315
+ const s = e.detail, { agentPicked: i, taskAssigned: n, userMessage: a } = this._parseAgentPickedAndTask(s);
1316
+ this._sendFeedback(s.content, a ?? n ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", i ?? "");
1272
1317
  }), this.listenOn(window, "clearAssistantConversation", () => {
1273
1318
  this._clearConversation();
1274
1319
  });
@@ -1277,7 +1322,7 @@ class cs extends Le {
1277
1322
  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 };
1278
1323
  }
1279
1324
  static {
1280
- this.styles = Ge;
1325
+ this.styles = He;
1281
1326
  }
1282
1327
  get _telemetry() {
1283
1328
  return this._configContextConsumer.value?.telemetrySession;
@@ -1292,45 +1337,39 @@ class cs extends Le {
1292
1337
  this._checkURLOpenParameter();
1293
1338
  }
1294
1339
  load() {
1295
- this._configContextConsumer.value?.portalURL && (ne.portalUrl = this._configContextConsumer.value.portalURL);
1340
+ this._configContextConsumer.value?.portalURL && (ae.portalUrl = this._configContextConsumer.value.portalURL);
1296
1341
  }
1297
1342
  firstUpdated(e) {
1298
1343
  this._loadUserFirstName();
1299
1344
  }
1300
1345
  willUpdate(e) {
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;
1346
+ e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (he(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;
1302
1347
  }
1303
1348
  _renderNoSign() {
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>`;
1349
+ return C`<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 ?? ie} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
1305
1350
  }
1306
1351
  _renderNoPermission() {
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>`;
1352
+ return C`<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">${Re(this._translations.noPermissionMessage.replace("{{orgUrl}}", ls).replace("{{configAI}}", cs))}</div></calcite-notice>`;
1308
1353
  }
1309
1354
  render() {
1310
1355
  let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
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=${() => {
1356
+ return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), C`<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 ? C`${!this._isMobile && C`<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=${() => {
1312
1357
  this._telemetry?.logEvent({
1313
- category: $.ASSISTANT,
1358
+ category: R.ASSISTANT,
1314
1359
  action: "Toggle Builder Panel",
1315
1360
  dimensions: [this.builderVisible ? "Close" : "Open"]
1316
1361
  }), window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
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) => {
1362
+ }} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && C`<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 ?? ie} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
1318
1363
  console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
1319
1364
  }} @arcgisFeedback=${(s) => {
1320
1365
  s.detail;
1321
- }} @arcgisInterrupt=${() => {
1322
- this._queryElementInShadowDom(this.el, ".footer-container", !0);
1323
- }} @arcgisInterruptCancel=${() => {
1324
- this._queryElementInShadowDom(this.el, ".footer-container", !1);
1325
- }} @arcgisInterruptSubmit=${() => {
1326
- this._queryElementInShadowDom(this.el, ".footer-container", !1);
1327
- }} ${Be(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
1366
+ }} ${Pe(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
1328
1367
  this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
1329
- category: $.ASSISTANT,
1368
+ category: R.ASSISTANT,
1330
1369
  action: "New Chat",
1331
1370
  dimensions: ["No Active Design"]
1332
1371
  }), this._clearConversation());
1333
- }} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${as} .context=${{
1372
+ }} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${rs} .context=${{
1334
1373
  token: this._configContextConsumer.value?.userSession?.token,
1335
1374
  configContext: this._configContextConsumer.value,
1336
1375
  convoId: this._conversationId,
@@ -1344,24 +1383,24 @@ class cs extends Le {
1344
1383
  clearSuggestedPrompts: () => {
1345
1384
  this._suggestedPrompts = [];
1346
1385
  }
1347
- }}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=solid kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>` : this._renderNoPermission() : this._renderNoSign()}${this._showNewChatConfirm && I`<calcite-dialog close-disabled escape-disabled heading="Start new conversation" modal open>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${() => {
1386
+ }}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=solid kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>` : this._renderNoPermission() : this._renderNoSign()}${this._showNewChatConfirm && C`<calcite-dialog close-disabled escape-disabled .heading=${this._translations.newConversationConfirmTitle} modal open outside-close-disabled>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${() => {
1348
1387
  this._showNewChatConfirm = !1;
1349
- }} slot=footer-end>\r\n Cancel</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
1388
+ }} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
1350
1389
  this._telemetry?.logEvent({
1351
- category: $.ASSISTANT,
1390
+ category: R.ASSISTANT,
1352
1391
  action: "New Chat",
1353
1392
  dimensions: ["With Design Discard"]
1354
1393
  }), this._showNewChatConfirm = !1, window.dispatchEvent(new CustomEvent("requestBuilderDiscard"));
1355
- }} slot=footer-end>\r\n Discard</calcite-button></calcite-dialog>` || ""}<calcite-action icon=x id=closeAssistantButton .label=${this._translations.tooltips.close} @click=${() => {
1394
+ }} slot=footer-end>${this._translations.discard}</calcite-button></calcite-dialog>` || ""}<calcite-action icon=x id=closeAssistantButton .label=${this._translations.tooltips.close} @click=${() => {
1356
1395
  this.closeAssistant.emit(!0);
1357
1396
  }} 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>`;
1358
1397
  }
1359
1398
  _clearConversation() {
1360
- this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory(), this._queryElementInShadowDom(this.el, ".footer-container", !1);
1399
+ this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
1361
1400
  }
1362
1401
  _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")}`;
1364
- window.open(o, "_blank");
1402
+ const a = `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")}`;
1403
+ window.open(a, "_blank");
1365
1404
  }
1366
1405
  async _loadUserFirstName() {
1367
1406
  try {
@@ -1374,14 +1413,14 @@ class cs extends Le {
1374
1413
  }
1375
1414
  }
1376
1415
  _parseAgentPickedAndTask(e) {
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;
1416
+ const s = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], o = [...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;
1378
1417
  if (!l)
1379
- return { agentPicked: null, taskAssigned: null, userMessage: a };
1418
+ return { agentPicked: null, taskAssigned: null, userMessage: o };
1380
1419
  const u = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, c = l.match(u);
1381
1420
  if (!c)
1382
- return { agentPicked: null, taskAssigned: null, userMessage: a };
1383
- const m = c[1].trim(), f = c[2].trim();
1384
- return { agentPicked: m, taskAssigned: f, userMessage: a };
1421
+ return { agentPicked: null, taskAssigned: null, userMessage: o };
1422
+ const m = c[1].trim(), b = c[2].trim();
1423
+ return { agentPicked: m, taskAssigned: b, userMessage: o };
1385
1424
  }
1386
1425
  _emitItemIdFromAI(e) {
1387
1426
  const s = new CustomEvent("solutionIDFromAssistant", {
@@ -1391,30 +1430,8 @@ class cs extends Le {
1391
1430
  });
1392
1431
  window.dispatchEvent(s);
1393
1432
  }
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);
1399
- } else
1400
- console.log("No shadowRoot found on this component.");
1401
- }
1402
- _findElementInShadowDom(e, s, i) {
1403
- const n = e.querySelector(s);
1404
- n && this._disableElementAndChildren(n, i);
1405
- const o = e.children;
1406
- for (const a of Array.from(o))
1407
- a.classList.contains(s) && this._disableElementAndChildren(a, i), this._findElementInShadowDom(a, s, i);
1408
- }
1409
- _disableElementAndChildren(e, s) {
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) => {
1412
- "disabled" in l && (l.disabled = s);
1413
- }), "disabled" in n && (n.disabled = s);
1414
- });
1415
- }
1416
1433
  }
1417
- ke("arcgis-solutions-assistant", cs);
1434
+ Ae("arcgis-solutions-assistant", ds);
1418
1435
  export {
1419
- cs as ArcgisSolutionsAssistant
1436
+ ds as ArcgisSolutionsAssistant
1420
1437
  };