@arcgis/ai-components 5.2.0-next.72 → 5.2.0-next.74

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 (147) hide show
  1. package/dist/agent-utils/LLMAgent.d.ts +5 -2
  2. package/dist/agent-utils/LLMAgent.js +1 -1
  3. package/dist/agentic-workflow/jsonTypes.d.ts +8 -1
  4. package/dist/agentic-workflow/nodes/AgentNode.d.ts +2 -0
  5. package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
  6. package/dist/cdn/253R5CBD.js +2 -0
  7. package/dist/cdn/2VBPA27M.js +18 -0
  8. package/dist/cdn/{DWYODVWW.js → 323DHVYA.js} +5 -5
  9. package/dist/cdn/34O57OGV.js +2 -0
  10. package/dist/cdn/{FSMHR7GK.js → 4HDDRBIY.js} +1 -1
  11. package/dist/cdn/4MFEKBKL.js +11 -0
  12. package/dist/cdn/{Y5UFOH54.js → 4NJ2FF7H.js} +1 -1
  13. package/dist/cdn/4YXYLX4H.js +2 -0
  14. package/dist/cdn/5DVRVY4L.js +2 -0
  15. package/dist/cdn/5PJXNTLZ.js +2 -0
  16. package/dist/cdn/5R6QUF5B.js +2 -0
  17. package/dist/cdn/5RVELJU4.js +36 -0
  18. package/dist/cdn/5WLNL4HZ.js +2 -0
  19. package/dist/cdn/66SKMECC.js +2 -0
  20. package/dist/cdn/6CLF7KIK.js +2 -0
  21. package/dist/cdn/{S6ZAQRC6.js → 6KFMRBAA.js} +1 -1
  22. package/dist/cdn/77QFSIWW.js +5 -0
  23. package/dist/cdn/7E2QMWK6.js +2 -0
  24. package/dist/cdn/{HO2YDJI2.js → 7M6VKBTK.js} +1 -1
  25. package/dist/cdn/{HJG7QM2R.js → 7VAQUCBU.js} +1 -1
  26. package/dist/cdn/ACJTJLZN.js +2 -0
  27. package/dist/cdn/AI6DYOKR.js +181 -0
  28. package/dist/cdn/AT4XVTJR.js +44 -0
  29. package/dist/cdn/BS2PFNU4.js +2 -0
  30. package/dist/cdn/CCC6LBMY.js +2 -0
  31. package/dist/cdn/CGXQAB3A.js +2 -0
  32. package/dist/cdn/{M3MRIGDZ.js → CP5BVGJU.js} +1 -1
  33. package/dist/cdn/CWD37QFT.js +2 -0
  34. package/dist/cdn/DY36ATOA.js +2 -0
  35. package/dist/cdn/DYASSC7Z.js +2 -0
  36. package/dist/cdn/EAEQONP7.js +2 -0
  37. package/dist/cdn/EMLOVMD4.js +2 -0
  38. package/dist/cdn/EWLXNGKH.js +208 -0
  39. package/dist/cdn/FAR3DFFK.js +2 -0
  40. package/dist/cdn/FDOMMK2M.js +2 -0
  41. package/dist/cdn/GRHIFCQX.js +2 -0
  42. package/dist/cdn/{S3XUYAUX.js → HHFNQR6Z.js} +1 -1
  43. package/dist/cdn/{WQKNV6KK.js → HMUWQCXU.js} +1 -1
  44. package/dist/cdn/HZ5ARNAM.js +2 -0
  45. package/dist/cdn/I6PD2HSL.js +2 -0
  46. package/dist/cdn/IDUC4CPV.js +2 -0
  47. package/dist/cdn/IRNSIUBT.js +2 -0
  48. package/dist/cdn/{OYNIFMCJ.js → J6SZIQJA.js} +1 -1
  49. package/dist/cdn/K335IAIE.js +2 -0
  50. package/dist/cdn/K33MZ726.js +2 -0
  51. package/dist/cdn/KA3FF3ZO.js +2 -0
  52. package/dist/cdn/{DBHLKLKM.js → KPO4XX6J.js} +1 -1
  53. package/dist/cdn/{I4L45WQS.js → L7XTRDFM.js} +1 -1
  54. package/dist/cdn/LCFIADOZ.js +2 -0
  55. package/dist/cdn/MDM2K3U7.js +2 -0
  56. package/dist/cdn/MM33KJPF.js +2 -0
  57. package/dist/cdn/NIY32GK2.js +2 -0
  58. package/dist/cdn/{3ZPPYCNL.js → ONMNQBPO.js} +1 -1
  59. package/dist/cdn/ONQ6JSBJ.js +2 -0
  60. package/dist/cdn/{6QJFOL6M.js → OWTGH34K.js} +1 -1
  61. package/dist/cdn/{XPTCV6YV.js → PSYRZMX2.js} +1 -1
  62. package/dist/cdn/Q4IQUEZN.js +14 -0
  63. package/dist/cdn/QNNGPA3Q.js +2 -0
  64. package/dist/cdn/QRHZXLZN.js +2 -0
  65. package/dist/cdn/QVOMX3R6.js +2 -0
  66. package/dist/cdn/QZ3NQTNQ.js +2 -0
  67. package/dist/cdn/RADWN4ZP.js +2 -0
  68. package/dist/cdn/RU2T7GUX.js +2 -0
  69. package/dist/cdn/S6OYR4VI.js +156 -0
  70. package/dist/cdn/T2GJLEYV.js +2 -0
  71. package/dist/cdn/TKYI5QRL.js +2 -0
  72. package/dist/cdn/{5SFZS2RD.js → TQXLSW4A.js} +2 -2
  73. package/dist/cdn/{NJJYZP3R.js → U6FBRUM4.js} +1 -1
  74. package/dist/cdn/UIXX3XEN.js +2 -0
  75. package/dist/cdn/UPWAOZXQ.js +2 -0
  76. package/dist/cdn/{5SF6DEMO.js → VNJMTA6O.js} +1 -1
  77. package/dist/cdn/VOKXKU7M.js +56 -0
  78. package/dist/cdn/{33BF35AO.js → VYTYVWR6.js} +4 -4
  79. package/dist/cdn/WMZ24LWS.js +2 -0
  80. package/dist/cdn/{JYVBCHR6.js → WP7ORLSB.js} +1 -1
  81. package/dist/cdn/WS3T73IY.js +2 -0
  82. package/dist/cdn/{UZL6UVE4.js → ZLWWWTH4.js} +1 -1
  83. package/dist/cdn/{PAUIFUMO.js → ZQMBJ6MI.js} +1 -1
  84. package/dist/cdn/agent-utils/index.js +1 -1
  85. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
  86. package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
  87. package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
  88. package/dist/cdn/index.js +1 -1
  89. package/dist/chunks/adapter.js +938 -1938
  90. package/dist/chunks/adapter10.js +21 -0
  91. package/dist/chunks/adapter11.js +30 -0
  92. package/dist/chunks/adapter12.js +22 -0
  93. package/dist/chunks/adapter13.js +22 -0
  94. package/dist/chunks/adapter14.js +109 -0
  95. package/dist/chunks/adapter15.js +40 -0
  96. package/dist/chunks/adapter16.js +154 -0
  97. package/dist/chunks/adapter17.js +141 -0
  98. package/dist/chunks/adapter18.js +127 -0
  99. package/dist/chunks/adapter2.js +52 -0
  100. package/dist/chunks/adapter3.js +30 -0
  101. package/dist/chunks/adapter4.js +50 -0
  102. package/dist/chunks/adapter5.js +27 -0
  103. package/dist/chunks/adapter6.js +24 -0
  104. package/dist/chunks/adapter7.js +26 -0
  105. package/dist/chunks/adapter8.js +21 -0
  106. package/dist/chunks/adapter9.js +42 -0
  107. package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
  108. package/dist/chunks/dataExplorationGraph.js +30 -27
  109. package/dist/chunks/fetchAgentContext.js +13 -0
  110. package/dist/chunks/fetchService.js +10 -0
  111. package/dist/chunks/formatFeatureAttributes.js +132 -0
  112. package/dist/chunks/generateLayerDescriptions.js +145 -148
  113. package/dist/chunks/helpGraph.js +11 -9
  114. package/dist/chunks/layerStylingGraph.js +22 -21
  115. package/dist/chunks/mergeWhereClauses.js +15 -0
  116. package/dist/chunks/navigationGraph.js +68 -57
  117. package/dist/chunks/types.js +59 -0
  118. package/dist/components/arcgis-assistant-agent/customElement.js +404 -279
  119. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +15 -5
  120. package/dist/components/arcgis-assistant-help-agent/customElement.js +21 -5
  121. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -22
  122. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +22 -5
  123. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +13 -5
  124. package/dist/docs/api.json +1 -1
  125. package/dist/docs/docs.json +1 -1
  126. package/dist/docs/web-types.json +1 -1
  127. package/dist/types/stencil.d.ts +2 -2
  128. package/dist/utils/index.d.ts +4 -5
  129. package/dist/utils/index.js +19 -20
  130. package/package.json +8 -8
  131. package/dist/cdn/55M2HE4U.js +0 -2
  132. package/dist/cdn/5RZGG4F2.js +0 -2
  133. package/dist/cdn/BAB3MK4Y.js +0 -2
  134. package/dist/cdn/BMBV6Y2A.js +0 -2
  135. package/dist/cdn/D3RKQSWS.js +0 -2
  136. package/dist/cdn/E7KEOJZG.js +0 -208
  137. package/dist/cdn/IGQFAL3H.js +0 -2
  138. package/dist/cdn/LUY6V4TP.js +0 -181
  139. package/dist/cdn/NSXX2KYS.js +0 -2
  140. package/dist/cdn/OFRFP4BX.js +0 -2
  141. package/dist/cdn/OUFGJV3R.js +0 -2
  142. package/dist/cdn/RWM5T4XB.js +0 -180
  143. package/dist/cdn/SRFLL6ET.js +0 -2
  144. package/dist/cdn/WDOM6Z5O.js +0 -18
  145. package/dist/cdn/WZFC5HUX.js +0 -56
  146. package/dist/cdn/Z4XUJQ2I.js +0 -36
  147. package/dist/cdn/ZJEWP2ND.js +0 -44
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as d,b as S,c as v}from"./CP5BVGJU.js";import b from"./OWTGH34K.js";import{d as f,e as y}from"./ZLWWWTH4.js";import a from"./AT4XVTJR.js";import{c as u}from"./HHFNQR6Z.js";import{b as c}from"./VOKXKU7M.js";import{Y as g,y as l}from"./EWLXNGKH.js";export default $arcgis.t(([,,,{watch:T},,{property:m,subclass:_},{d:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(t,s,e,r)=>{for(var o=r>1?void 0:r?x(s,e):s,n=t.length-1,p;n>=0;n--)(p=t[n])&&(o=(r?p(s,e,o):p(o))||o);return r&&o&&k(s,e,o),o},i=class extends w{constructor(t){super(t),this.modelTier="default"}initialize(){this.addHandles(T(()=>[this.description,this.inputSchema,this.modelTier,this.name,this.outputSchema,this.prompt,this.tools],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let t=f(this.getSchemas());this._set("workspace",t);let s=this.id,e={[s]:this._invoke.bind(this)},r=[{from:s,decide:()=>{}}];this._set("createGraph",()=>y(e,r,t,{agent:this,entryNode:s,middlewares:this.middlewares}))}async _invoke(t,s){try{return this.outputSchema?await this._invokeStructured(t,s):await this._invokeUnstructured(t,s)}catch(e){if(l(e))throw e;let r=e instanceof Error?e.message:String(e);return d({outputMessage:r},"failed",r)}}async _invokeStructured(t,s){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let e=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:t.agentExecutionContext.messages},s);if(!("structuredResponse"in e)||e.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(e.structuredResponse,this.outputSchema,e.messages)}async _invokeUnstructured(t,s){let e=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares)}).invoke({messages:t.agentExecutionContext.messages},s)).messages,r=e.at(-1)?.content??"",o=typeof r=="string"?r:JSON.stringify(r),n=o.trim()||"LLMAgent completed.";return d({agentExecutionContext:{...t.agentExecutionContext,messages:e},outputMessage:o},"success",n)}async _getPromptWithInputVariables(t){let s=v(t,this.inputSchema);for(let{outputKey:e}of this.middlewares)e&&(s[String(e)]=t[e]);return await g.fromTemplate(this.prompt).format(s)}_getTools(){return this.tools?.map(t=>"getTool"in t?t.getTool():t)??[]}};a([m()],i.prototype,"prompt",2);a([m()],i.prototype,"tools",2);a([m()],i.prototype,"inputSchema",2);a([m()],i.prototype,"outputSchema",2);a([m()],i.prototype,"modelTier",2);i=a([_("LLMAgent")],i);return i},"identity/IdentityManager","portal/Portal","request","core/reactiveUtils","layers/FeatureLayer","core/accessorSupport/decorators",a,b)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ var s=(n,r)=>{let i=n?.configurable?.services?.[r];if(i==null)throw new Error(`${r} missing in config.configurable.services`);return i};export{s as a};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./5PJXNTLZ.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToBookmarkTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as p}from"./WZFC5HUX.js";function f(r,e,o){return{name:r,handler:async(a,t)=>{let n=async l=>{let u=await e.beforeAgent?.(l),w=u?{...l,state:{...l.state,...u}}:l,i=await t(w),d=await e.afterAgent?.({...w,result:i});return d?{...i,...d}:i};return e.wrapAgent?await e.wrapAgent(a,n):await n(a)},hooks:e,outputKey:o?.outputKey}}function M(r,e,o){return{name:r,handler:async(a,t)=>e.wrapToolCall?await e.wrapToolCall(a,t):await t(a),outputKey:o?.outputKey}}function y(r){return r.map(e=>s(e.name,e.hooks??{})).filter(e=>!!e)}function s(r,e){let{afterModel:o,beforeModel:a,wrapModelCall:t,wrapToolCall:n}=e;if(!(!o&&!a&&!t&&!n))return p({afterModel:o,beforeModel:a,name:r,wrapModelCall:t,wrapToolCall:n})}export{f as a,M as b,y as c};
2
+ import{a as p}from"./VOKXKU7M.js";function f(r,e,o){return{name:r,handler:async(a,t)=>{let n=async l=>{let u=await e.beforeAgent?.(l),w=u?{...l,state:{...l.state,...u}}:l,i=await t(w),d=await e.afterAgent?.({...w,result:i});return d?{...i,...d}:i};return e.wrapAgent?await e.wrapAgent(a,n):await n(a)},hooks:e,outputKey:o?.outputKey}}function M(r,e,o){return{name:r,handler:async(a,t)=>e.wrapToolCall?await e.wrapToolCall(a,t):await t(a),outputKey:o?.outputKey}}function y(r){return r.map(e=>s(e.name,e.hooks??{})).filter(e=>!!e)}function s(r,e){let{afterModel:o,beforeModel:a,wrapModelCall:t,wrapToolCall:n}=e;if(!(!o&&!a&&!t&&!n))return p({afterModel:o,beforeModel:a,name:r,wrapModelCall:t,wrapToolCall:n})}export{f as a,M as b,y as c};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./5SF6DEMO.js";import"./UZL6UVE4.js";import"./HO2YDJI2.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:l,subclass:w},{c:p,d:d}])=>{var y=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},h=(e,t,o,n)=>{for(var r=n>1?void 0:n?m(t,o):t,s=e.length-1,g;s>=0;s--)(g=e[s])&&(r=(n?g(t,o,r):g(r))||r);return n&&r&&y(t,o,r),r},k=(e,t,o)=>t.has(e)||f("Cannot "+o),b=(e,t,o)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),c=(e,t,o)=>(k(e,t,"access private method"),o),a,i,u=class extends d{constructor(e){super(e),b(this,a)}getAgents(){return c(this,a,i).call(this),[this.routerAgent,...Object.values(this.agentsMap)]}buildEdges(e){c(this,a,i).call(this);let t=p(this.routerAgent,0),o=new Map;for(let[n,[r]]of Object.entries(this.agentsMap).entries())o.set(r,p(e[n+1],n+1));return[{from:t,decide:n=>{let r=n[this.routerOutputKey];if(typeof r!="string"||!r)throw new Error("RouterWorkflow decideRoute could not determine next agent from state.");let s=o.get(r);if(!s)throw new Error(`RouterWorkflow decideRoute returned unknown agent: ${r}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`);return s}}]}getEntryNode(){return c(this,a,i).call(this),p(this.routerAgent,0)}isTerminalAgent(e,t){return t>0}validateAgents(e){c(this,a,i).call(this),super.validateAgents(e)}};a=new WeakSet;i=function(){if(!Object.keys(this.agentsMap).length)throw new Error("RouterWorkflow requires a non-empty agentsMap.")};h([l()],u.prototype,"agentsMap",2);h([l()],u.prototype,"routerAgent",2);h([l()],u.prototype,"routerOutputKey",2);u=h([w("RouterWorkflow")],u);return u},"core/accessorSupport/decorators",a)
2
+ import a from"./VNJMTA6O.js";import"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:l,subclass:w},{c:p,d:d}])=>{var y=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},h=(e,t,o,n)=>{for(var r=n>1?void 0:n?m(t,o):t,s=e.length-1,g;s>=0;s--)(g=e[s])&&(r=(n?g(t,o,r):g(r))||r);return n&&r&&y(t,o,r),r},k=(e,t,o)=>t.has(e)||f("Cannot "+o),b=(e,t,o)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),c=(e,t,o)=>(k(e,t,"access private method"),o),a,i,u=class extends d{constructor(e){super(e),b(this,a)}getAgents(){return c(this,a,i).call(this),[this.routerAgent,...Object.values(this.agentsMap)]}buildEdges(e){c(this,a,i).call(this);let t=p(this.routerAgent,0),o=new Map;for(let[n,[r]]of Object.entries(this.agentsMap).entries())o.set(r,p(e[n+1],n+1));return[{from:t,decide:n=>{let r=n[this.routerOutputKey];if(typeof r!="string"||!r)throw new Error("RouterWorkflow decideRoute could not determine next agent from state.");let s=o.get(r);if(!s)throw new Error(`RouterWorkflow decideRoute returned unknown agent: ${r}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`);return s}}]}getEntryNode(){return c(this,a,i).call(this),p(this.routerAgent,0)}isTerminalAgent(e,t){return t>0}validateAgents(e){c(this,a,i).call(this),super.validateAgents(e)}};a=new WeakSet;i=function(){if(!Object.keys(this.agentsMap).length)throw new Error("RouterWorkflow requires a non-empty agentsMap.")};h([l()],u.prototype,"agentsMap",2);h([l()],u.prototype,"routerAgent",2);h([l()],u.prototype,"routerOutputKey",2);u=h([w("RouterWorkflow")],u);return u},"core/accessorSupport/decorators",a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import c from"./4MFEKBKL.js";import b from"./CCC6LBMY.js";import"./34O57OGV.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./77QFSIWW.js";import"./FDOMMK2M.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as listLayerFieldsTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./LCFIADOZ.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([a])=>{return a},a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import v from"./5RVELJU4.js";import t from"./2VBPA27M.js";import s from"./VYTYVWR6.js";import r from"./TQXLSW4A.js";import q from"./323DHVYA.js";import p from"./ONMNQBPO.js";import o from"./S6OYR4VI.js";import n from"./LCFIADOZ.js";import"./QVOMX3R6.js";import m from"./T2GJLEYV.js";import l from"./Q4IQUEZN.js";import k from"./WS3T73IY.js";import j from"./4MFEKBKL.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import"./77QFSIWW.js";import"./FDOMMK2M.js";import f from"./4YXYLX4H.js";import"./5PJXNTLZ.js";import"./EAEQONP7.js";import e from"./RU2T7GUX.js";import"./DYASSC7Z.js";import"./DY36ATOA.js";import"./CGXQAB3A.js";import d from"./L7XTRDFM.js";import c from"./AT4XVTJR.js";import{e as g,f as h}from"./7M6VKBTK.js";import"./BS2PFNU4.js";import"./UIXX3XEN.js";import b from"./KA3FF3ZO.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./R74ZHFA6.js";import{a as y,b as u}from"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,,,{d:w,g:v,h:A,i:b,j:S,k:d,l:f,m:M,n:E,o:P,p:T,q:x,r:D},{a:p,b:V},,,,,,,,,,,L,k,W,R,O])=>{var U=async e=>{let a=e.allLayers.toArray(),o=[],r=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await x(t),s=await D(t,n);r.set(t.id,{layerItem:s,fieldRegistry:n})})();o.push(i)}return await Promise.all(o),r},q=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:o}=await z(a),r={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:b,model:S,dimensions:A,templates:{layer:d,field:f}},layers:o},t=M.safeParse(r);if(!t.success)throw console.error("Schema Mismatch:",t.error.format()),new Error("Webmap embedding generation failed validation.");return t.data},z=async e=>{let a=[],o=[];for(let[i,{fieldRegistry:n,layerItem:s}]of e.entries()){let l=H(d,{name:s.name,title:s.title,description:s.description});a.push(l);let m={id:i,name:s.name??"",title:s.title,description:s.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(f,{name:c.name,alias:c.alias,description:c.description});a.push(N),m.fields.push({name:c.name,alias:c.alias,description:c.description,vector:[]})}o.push(m)}let r=await p(a),t=0;return{layers:o.map(i=>(i.vector=r[t++],i.fields.forEach(n=>{n.vector=r[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(o,r)=>a[r]??""),F=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let o=0,r=0,t=0;for(let s=0;s<e.length;++s){let l=e[s],m=a[s];o+=l*m,r+=l*l,t+=m*m}let i=Math.sqrt(r*t);if(i===0)return 0;let n=o/i;return Math.max(-1,Math.min(1,n))},ee=E,ae=P,te=T,se=y,re=p,oe=F,ie=O,ne=L,me=R,ce=W,le=k,de=q,fe=()=>g(),pe=()=>h(),ge=async(e,a)=>await u(e,a),he=async({modelTier:e="default",config:a}={})=>await w({modelTier:e,config:a});return{ArcgisKnowledgeAgent:le,DataExplorationAgent:me,HelpAgent:ce,LayerStylingAgent:ne,NavigationAgent:ie,Orchestrator:V,cosineSimilarity:oe,createAgentRuntimeState:fe,createAgentRuntimeStateWithSharedState:pe,createChatModel:he,createWebmapEmbeddings:de,getEmbeddings:re,invokeStructuredPrompt:ae,invokeTextPrompt:ee,invokeToolPrompt:te,sendTraceMessage:se,sendUXSuggestion:ge}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k,l,m,n,o,p,q,r,s,t,v)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Bc as u}from"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([d,{property:a,subclass:h}])=>{var l=Object.defineProperty,m=Object.getOwnPropertyDescriptor,s=(e,t,n,r)=>{for(var o=r>1?void 0:r?m(t,n):t,c=e.length-1,p;c>=0;c--)(p=e[c])&&(o=(r?p(t,n,o):p(o))||o);return r&&o&&l(t,n,o),o},i=class extends d{constructor(e){super(e),this.resultMode="continue",this.middlewares=[]}getTool(){return u(this._executeWithMiddlewares.bind(this),{name:this.name,description:this.description,returnDirect:this.resultMode==="terminal",schema:this.inputSchema})}async _executeWithMiddlewares(e,t){let n=async r=>{let o=await this.execute(r.input,r.config);return this._validateOutput(o)};return await this.middlewares.reduceRight((r,o)=>async c=>await o.handler(c,r),n)({config:t,input:e,tool:this,toolCallId:f(t)})}_validateOutput(e){if(!this.outputSchema)return e;let t=this.outputSchema.safeParse(e);if(!t.success)throw new Error(`FunctionTool output schema validation failed: ${t.error.message}`);return t.data}};s([a()],i.prototype,"name",2);s([a()],i.prototype,"description",2);s([a()],i.prototype,"resultMode",2);s([a()],i.prototype,"inputSchema",2);s([a()],i.prototype,"outputSchema",2);s([a()],i.prototype,"middlewares",2);s([a()],i.prototype,"execute",2);i=s([h("FunctionTool")],i);function f(e){let t=e?.toolCall;return typeof t?.id=="string"?t.id:void 0}return i},"core/Accessor","core/accessorSupport/decorators")
2
+ import{Dc as u}from"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([d,{property:a,subclass:h}])=>{var l=Object.defineProperty,m=Object.getOwnPropertyDescriptor,s=(e,t,n,r)=>{for(var o=r>1?void 0:r?m(t,n):t,c=e.length-1,p;c>=0;c--)(p=e[c])&&(o=(r?p(t,n,o):p(o))||o);return r&&o&&l(t,n,o),o},i=class extends d{constructor(e){super(e),this.resultMode="continue",this.middlewares=[]}getTool(){return u(this._executeWithMiddlewares.bind(this),{name:this.name,description:this.description,returnDirect:this.resultMode==="terminal",schema:this.inputSchema})}async _executeWithMiddlewares(e,t){let n=async r=>{let o=await this.execute(r.input,r.config);return this._validateOutput(o)};return await this.middlewares.reduceRight((r,o)=>async c=>await o.handler(c,r),n)({config:t,input:e,tool:this,toolCallId:f(t)})}_validateOutput(e){if(!this.outputSchema)return e;let t=this.outputSchema.safeParse(e);if(!t.success)throw new Error(`FunctionTool output schema validation failed: ${t.error.message}`);return t.data}};s([a()],i.prototype,"name",2);s([a()],i.prototype,"description",2);s([a()],i.prototype,"resultMode",2);s([a()],i.prototype,"inputSchema",2);s([a()],i.prototype,"outputSchema",2);s([a()],i.prototype,"middlewares",2);s([a()],i.prototype,"execute",2);i=s([h("FunctionTool")],i);function f(e){let t=e?.toolCall;return typeof t?.id=="string"?t.id:void 0}return i},"core/Accessor","core/accessorSupport/decorators")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./RU2T7GUX.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([a])=>{return a},a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./QVOMX3R6.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToZoomTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./QNNGPA3Q.js";import{a as h}from"./ONQ6JSBJ.js";import{Dc as p}from"./AI6DYOKR.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([y,g,{c:b,d:u}])=>{var w=async(t,o,f,n,r,c)=>{let a=t.map?.allLayers.find(s=>s.id===o);if(!a)return{success:!1,error:`Layer '${o}' not found.`};let i=a.createQuery();i.where=f??"1=1",n&&(i.geometry=n,i.spatialRelationship="intersects",r&&(i.distance=r),c&&(i.units=c));try{let{extent:s,count:l}=await a.queryExtent(i);return!s||l===0?{success:!1,error:`No features found for filter (where: ${i.where}${n?", spatial filter used":""})`}:(await t.goTo(s),{success:!0})}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}},I=async(t,o,f,n,r,c)=>{let a=o.map?.allLayers.find(d=>d.id===t.layerId);if(!a)return`Could not find target layer with ID: ${t.layerId}`;let i;if(r){let d=await b(r,o);if("error"in d)return d.error;i=d.geometry}if(a.featureEffect=null,a.featureEffect=new y({filter:new g({...t.objectIds?.length?{objectIds:t.objectIds}:{where:t.where},geometry:i,spatialRelationship:"intersects",distance:r?.distance,units:r?.units}),includedEffect:f,excludedEffect:n}),a.visible=!0,c)return`Applied feature effects to "${a.title??t.layerId}" within current map extent.`;let s=t.objectIds?.length?`${a.objectIdField} IN (${t.objectIds.join(",")})`:t.where,l=await w(o,t.layerId,s,i,r?.distance,r?.units),m=a.title??t.layerId;return l.success?`Applied feature effects to target layer "${a.title??t.layerId}"${r&&"layerId"in r?` using geometry from layer "${r.layerId}"`:""}.`:`Applied filter to "${m}" but no features matched. ${l.error}`},x=async({targetLayer:t,geometryFilter:o,useCurrentExtent:f,includedEffect:n="drop-shadow(2px, 2px, 2px, gray)",excludedEffect:r="grayscale(100%) opacity(60%) blur(2px)"},c)=>{let{mapView:a}=h(c,["mapView"]);return await I(t,a,n,r,o,f)},v=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:u.optional().describe("The units for the distance buffer.")}),j=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:u.optional().describe("The units for the distance buffer.")}),E=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer on which to set a feature effect."),where:e.string().describe("The SQL-92 where clause representing the features to emphasize."),objectIds:e.array(e.number()).optional().describe("Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause.")}),geometryFilter:e.union([v,j]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),useCurrentExtent:e.boolean().optional().describe("Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."),includedEffect:e.string().default("drop-shadow(2px, 2px, 2px, gray)").describe("The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."),excludedEffect:e.string().default("grayscale(100%) opacity(60%) blur(2px)").describe("The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified.")}),F=p(x,{name:"setFeatureEffect",description:"Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",schema:E});return F},"layers/support/FeatureEffect","layers/support/FeatureFilter",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./5SF6DEMO.js";import a from"./6QJFOL6M.js";import{e as m}from"./UZL6UVE4.js";import"./HO2YDJI2.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:n,subclass:l},{watch:w},c])=>{var d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=(e,r,s,o)=>{for(var t=o>1?void 0:o?f(r,s):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,s,t):a(t))||t);return o&&t&&d(r,s,t),t},h=class extends c{constructor(e){super(e)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.workflow],()=>this.generate(),{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,...this.workflow.getAgents().flatMap(e=>e.getSchemas()),this.outputSchema].filter(Boolean)}generate(){let{workspace:e,createGraph:r}=this.workflow.generate();if(this._set("workspace",e),!this.middlewares?.length)this._set("createGraph",r);else{let s=this.id,o={[s]:async(i,a)=>await r().compile().invoke(i,a)},t=[{from:s,decide:()=>{}}];this._set("createGraph",()=>m(o,t,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}}};p([n()],h.prototype,"workflow",2);p([n()],h.prototype,"inputSchema",2);p([n()],h.prototype,"outputSchema",2);h=p([l("WorkflowAgent")],h);return h},"core/accessorSupport/decorators","core/reactiveUtils",a,b)
2
+ import b from"./VNJMTA6O.js";import a from"./OWTGH34K.js";import{e as m}from"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:n,subclass:l},{watch:w},c])=>{var d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=(e,r,s,o)=>{for(var t=o>1?void 0:o?f(r,s):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,s,t):a(t))||t);return o&&t&&d(r,s,t),t},h=class extends c{constructor(e){super(e)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.workflow],()=>this.generate(),{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,...this.workflow.getAgents().flatMap(e=>e.getSchemas()),this.outputSchema].filter(Boolean)}generate(){let{workspace:e,createGraph:r}=this.workflow.generate();if(this._set("workspace",e),!this.middlewares?.length)this._set("createGraph",r);else{let s=this.id,o={[s]:async(i,a)=>await r().compile().invoke(i,a)},t=[{from:s,decide:()=>{}}];this._set("createGraph",()=>m(o,t,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}}};p([n()],h.prototype,"workflow",2);p([n()],h.prototype,"inputSchema",2);p([n()],h.prototype,"outputSchema",2);h=p([l("WorkflowAgent")],h);return h},"core/accessorSupport/decorators","core/reactiveUtils",a,b)
@@ -1,3 +1,3 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./ZJEWP2ND.js";import{b as E}from"./R74ZHFA6.js";import{a as g}from"./HJG7QM2R.js";import{Wa as A,a as v,b as I,ca as S,y as R}from"./E7KEOJZG.js";import{ca as b,oa as C}from"./LUY6V4TP.js";export default $arcgis.t(([N,U,H,T,_,{a:k,b:D,c:f,e:$,f:M,m:W}])=>{var G=async e=>{let t=await z(),n=await k("default"),s=U.getDefault(),r=(await N.getCredential(`${s.url}/sharing`)).token,a={type:"generateEmbeddings",webmapEmbeddings:e,auth:{apiUrl:n,token:r}};return t.postMessage(a),await new Promise((i,c)=>{let o=u=>{u.data==="completed"&&(t.removeEventListener("message",o),i())},d=u=>{t.removeEventListener("message",o),c(u instanceof Error?u:new Error("Embeddings worker error"))};t.addEventListener("message",o),t.addEventListener("error",d,{once:!0})}),t},z=async()=>{{let e=(await import("./OKVLGJAG.js")).default;return new e}},Q=e=>{e.currentIntent="none"},B=async(e,t)=>{let n=f(t);if(e.agentExecutionContext.userRequest){let r=new C(e.agentExecutionContext.userRequest.trim());e.agentExecutionContext.messages=[...e.agentExecutionContext.messages,r],Q(e)}let s=n?.services.agentRegistry.list().map(r=>r.agent.id)??[];return await g({text:`Available agents: ${[...s].join(", ")}`},t),await g({text:"Analyzing user input"},t),e},J=async(e,t)=>(await g({text:"Exiting..."},t),e),q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),K=(e,t)=>{if(!q(e)){e!==void 0&&console.warn(`Agent "${t}" returned invalid sharedStatePatch. Ignoring it.`);return}let n={};for(let[s,r]of Object.entries(e)){if(!q(r)||!("value"in r)){console.warn(`Agent "${t}" returned invalid sharedStatePatch entry for key "${s}". Ignoring that entry.`);continue}n[s]={value:r.value}}return n},V=e=>{let{previousSharedState:t,patch:n,agentId:s}=e;if(!n)return t;let r=Date.now(),a={...t};for(let[i,c]of Object.entries(n))c?.value!==void 0&&(a[i]={value:c.value,meta:{updatedByAgentId:s,updatedAt:r}});return a},F=e=>typeof e!="string"?void 0:e.trim()||void 0,X=e=>{switch(e){case"failed":return"Agent failed without a summary.";case"unknown":return"Agent returned with unknown status.";case"success":return"Agent completed without a summary.";default:return"Agent completed without a summary."}},Y=(e,t)=>{let n=F(t?.outputMessage),s=F(t?.summary),r=t?.status,a=r==="success"||r==="failed"?r:"unknown";a==="unknown"&&console.warn(`Agent "${e}" returned missing/invalid status. Defaulting to "unknown".`);let i=K(t?.sharedStatePatch,e);return{outputMessage:n,summary:s??n??X(a),status:a,sharedStatePatch:i}},L=4e3,Z=async(e,t)=>{let n=f(t);if(t?.signal?.aborted)return await g({text:"Run cancelled; skipping agent execution"},t),{...e,currentIntent:"none",requiresFollowUp:!1};let{agentRegistry:s}=n?.services??{},r=s?.get(e.currentIntent);if(!r)return console.warn(`No agent found for intent: ${e.currentIntent}`),e;await g({text:`Executing registered agent: ${r.agent.name}`},t);let a={...t??{},configurable:{...n??{},agentId:r.agent.id,context:r.getContext?await r.getContext():void 0}},i;try{let d=await r.agent.createGraph().compile().invoke({agentExecutionContext:{...e.agentExecutionContext,messages:[...e.agentExecutionContext.messages],priorSteps:structuredClone(e.agentExecutionContext.priorSteps??[]),sharedState:structuredClone(e.agentExecutionContext.sharedState??{})}},a);i=Y(r.agent.name,d),await g({text:`Finished executing registered agent: ${r.agent.name}`},t)}catch(d){if(R(d)||t?.signal?.aborted||d instanceof Error&&d.name==="AbortError")throw d;let u=d instanceof Error?d.message:String(d);console.error(`Agent "${r.agent.name}" failed:`,d),await g({text:`Registered agent failed: ${r.agent.name}. ${u}`},t),i={status:"failed",outputMessage:`Agent execution failed: ${u}`,summary:`Agent execution failed: ${u}`}}let c=i.outputMessage,o=[...e.agentExecutionContext.messages];if(c){let d=c.length>L?`${c.slice(0,L-14)}
2
+ import a from"./AT4XVTJR.js";import{b as E}from"./R74ZHFA6.js";import{a as g}from"./7VAQUCBU.js";import{Ya as A,a as v,b as I,ea as S,y as R}from"./EWLXNGKH.js";import{ea as b,qa as C}from"./AI6DYOKR.js";export default $arcgis.t(([N,U,H,T,_,{a:k,b:D,c:f,e:$,f:M,m:W}])=>{var G=async e=>{let t=await z(),n=await k("default"),s=U.getDefault(),r=(await N.getCredential(`${s.url}/sharing`)).token,a={type:"generateEmbeddings",webmapEmbeddings:e,auth:{apiUrl:n,token:r}};return t.postMessage(a),await new Promise((i,c)=>{let o=u=>{u.data==="completed"&&(t.removeEventListener("message",o),i())},d=u=>{t.removeEventListener("message",o),c(u instanceof Error?u:new Error("Embeddings worker error"))};t.addEventListener("message",o),t.addEventListener("error",d,{once:!0})}),t},z=async()=>{{let e=(await import("./OKVLGJAG.js")).default;return new e}},Q=e=>{e.currentIntent="none"},B=async(e,t)=>{let n=f(t);if(e.agentExecutionContext.userRequest){let r=new C(e.agentExecutionContext.userRequest.trim());e.agentExecutionContext.messages=[...e.agentExecutionContext.messages,r],Q(e)}let s=n?.services.agentRegistry.list().map(r=>r.agent.id)??[];return await g({text:`Available agents: ${[...s].join(", ")}`},t),await g({text:"Analyzing user input"},t),e},J=async(e,t)=>(await g({text:"Exiting..."},t),e),q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),K=(e,t)=>{if(!q(e)){e!==void 0&&console.warn(`Agent "${t}" returned invalid sharedStatePatch. Ignoring it.`);return}let n={};for(let[s,r]of Object.entries(e)){if(!q(r)||!("value"in r)){console.warn(`Agent "${t}" returned invalid sharedStatePatch entry for key "${s}". Ignoring that entry.`);continue}n[s]={value:r.value}}return n},V=e=>{let{previousSharedState:t,patch:n,agentId:s}=e;if(!n)return t;let r=Date.now(),a={...t};for(let[i,c]of Object.entries(n))c?.value!==void 0&&(a[i]={value:c.value,meta:{updatedByAgentId:s,updatedAt:r}});return a},F=e=>typeof e!="string"?void 0:e.trim()||void 0,X=e=>{switch(e){case"failed":return"Agent failed without a summary.";case"unknown":return"Agent returned with unknown status.";case"success":return"Agent completed without a summary.";default:return"Agent completed without a summary."}},Y=(e,t)=>{let n=F(t?.outputMessage),s=F(t?.summary),r=t?.status,a=r==="success"||r==="failed"?r:"unknown";a==="unknown"&&console.warn(`Agent "${e}" returned missing/invalid status. Defaulting to "unknown".`);let i=K(t?.sharedStatePatch,e);return{outputMessage:n,summary:s??n??X(a),status:a,sharedStatePatch:i}},L=4e3,Z=async(e,t)=>{let n=f(t);if(t?.signal?.aborted)return await g({text:"Run cancelled; skipping agent execution"},t),{...e,currentIntent:"none",requiresFollowUp:!1};let{agentRegistry:s}=n?.services??{},r=s?.get(e.currentIntent);if(!r)return console.warn(`No agent found for intent: ${e.currentIntent}`),e;await g({text:`Executing registered agent: ${r.agent.name}`},t);let a={...t??{},configurable:{...n??{},agentId:r.agent.id,context:r.getContext?await r.getContext():void 0}},i;try{let d=await r.agent.createGraph().compile().invoke({agentExecutionContext:{...e.agentExecutionContext,messages:[...e.agentExecutionContext.messages],priorSteps:structuredClone(e.agentExecutionContext.priorSteps??[]),sharedState:structuredClone(e.agentExecutionContext.sharedState??{})}},a);i=Y(r.agent.name,d),await g({text:`Finished executing registered agent: ${r.agent.name}`},t)}catch(d){if(R(d)||t?.signal?.aborted||d instanceof Error&&d.name==="AbortError")throw d;let u=d instanceof Error?d.message:String(d);console.error(`Agent "${r.agent.name}" failed:`,d),await g({text:`Registered agent failed: ${r.agent.name}. ${u}`},t),i={status:"failed",outputMessage:`Agent execution failed: ${u}`,summary:`Agent execution failed: ${u}`}}let c=i.outputMessage,o=[...e.agentExecutionContext.messages];if(c){let d=c.length>L?`${c.slice(0,L-14)}
3
3
  [truncated]`:c;o.push(new b(d))}return{...e,stepCount:e.stepCount+1,lastExecutedAgent:r.agent.id,requiresFollowUp:i.status==="failed"?!0:e.requiresFollowUp,finalOutputMessage:c??"",agentExecutionContext:{...e.agentExecutionContext,messages:o,priorSteps:[...e.agentExecutionContext.priorSteps??[],{agentId:r.agent.id,assignedTask:e.agentExecutionContext.assignedTask,summary:i?.summary||"No summary provided.",status:i?.status||"unknown"}],sharedState:V({previousSharedState:e.agentExecutionContext.sharedState,patch:i.sharedStatePatch,agentId:r.agent.id})}}},ee=async(e,t)=>{if(e.routing.mode!=="direct")throw new Error("Direct agent assignment requires direct routing.");return await g({text:`Doing a direct route to agent: ${e.routing.agentId}`},t),{...e,currentIntent:e.routing.agentId,requiresFollowUp:!1,agentExecutionContext:{...e.agentExecutionContext,assignedTask:e.agentExecutionContext.userRequest}}},te=3,re=e=>e.routing.mode==="direct"?"assignDirectAgent":"intentLLM",ne=e=>e.routing.mode==="direct"||e.stepCount>=te||!e.requiresFollowUp?"exit":"intentLLM",se=()=>new A(D).addNode("ingestInput",B).addNode("assignDirectAgent",ee).addNode("intentLLM",M).addNode("executeRegisteredAgent",Z).addNode("exit",J).addEdge(v,"ingestInput").addConditionalEdges("ingestInput",re).addEdge("assignDirectAgent","executeRegisteredAgent").addConditionalEdges("intentLLM",e=>e.currentIntent==="none"||e.currentIntent===e.lastExecutedAgent?"exit":"executeRegisteredAgent").addConditionalEdges("executeRegisteredAgent",ne).addEdge("exit",I),w=class{constructor(){this.agentRegistry=new Map}register(t){let{agent:n}=t;if(this.agentRegistry.has(n.id))throw new Error(`Duplicate agent id: ${n.id}`);this.agentRegistry.set(n.id,t)}get(t){return this.agentRegistry.get(t)}list(){return[...this.agentRegistry.values()]}},x=class{constructor(t,n){this.graph=t,this.config={...n}}async waitForUser(){return await new Promise((t,n)=>{this.resolveWait=t,this.rejectWait=n})}handle(t,n){try{let s={agentId:t.agentId,id:t.id,payload:n},r=this.graph.streamEvents(null,{...this.config,configurable:{...this.config.configurable,hitlResponse:s},subgraphs:!0,version:"v2"});this.resolveWait?.(r)}catch(s){this.rejectWait?.(s)}finally{this.resolveWait=void 0,this.rejectWait=void 0}}cancel(){this.rejectWait&&(this.rejectWait(new Error("Request cancelled by user.")),this.resolveWait=void 0,this.rejectWait=void 0)}},ae=async e=>{try{return await(await $()).embedDocuments(e)}catch(t){throw console.error("Failed to generate embeddings:",t),t}},O=async(e,t)=>{let n=t.get(e);if(n)return n;let s=await ae([e]);return t.set(e,s[0]),s[0]};async function ie(e,t,n,s){let r=`req-${Date.now()}`,a={type:"layerSearch",precomputedEmbedding:s?await O(e,s):void 0,requestId:r,minScore:n};return await new Promise(i=>{let c=o=>{o.data.requestId===r&&i(o.data.results)};t.addEventListener("message",c,{once:!0}),t.postMessage(a)})}function oe(e){let{worker:t}=e;return{async searchLayers({text:n,minScore:s,embeddingCache:r}){return await ie(n,t,s,r)}}}var de=async({combinedQuery:e,layerIds:t,embeddingsWorker:n,minScore:s,topResults:r,embeddingCache:a})=>{let i=`req-${Date.now()}`,c=a?await O(e,a):void 0,o={type:"fieldSearch",layerIdForFieldsSearch:t,precomputedEmbedding:c,requestId:i,minScore:s,topResults:r};return await new Promise(d=>{let u=p=>{if(p.data.requestId!==i)return;let y=p.data.results.map(({layerId:l,results:m})=>({layerId:l,results:m}));d(y)};n.addEventListener("message",u,{once:!0}),n.postMessage(o)})};function ce(e){let{worker:t}=e;return{async searchFields({text:n,layerIds:s,minScore:r,topResults:a,embeddingCache:i}){return await de({combinedQuery:n,layerIds:s,embeddingsWorker:t,minScore:r,topResults:a,embeddingCache:i})}}}var ue=e=>{let t=W.safeParse(e);if(!t.success)throw new Error("Embeddings response validation failed. Regenerate embeddings.");return t.data},ge=(e,t)=>{let n=new Map,s=new Map;if(t.allLayers.forEach(r=>{r instanceof T&&s.set(r.id,r)}),e.length!==s.size)throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");for(let r of e){let a=s.get(r.id);if(!a)throw new Error(`Layer with ID ${r.id} not found in the original map during registry restoration. Regenerate embeddings.`);if(r.fields.length!==a.fields.length)throw new Error(`Field count mismatch for layer ID ${r.id} during registry restoration. Regenerate embeddings.`);let i={name:r.name,title:r.title,description:r.description},c=new Map;for(let o of r.fields){let d=a.fieldsIndex.get(o.name);if(!d)throw new Error(`Field with name ${o.name} not found in the original layer ${r.id} during registry restoration. Regenerate embeddings.`);c.set(o.name,{name:o.name,alias:a.getFieldAlias(o.name)??o.alias,description:o.description,type:d.type||"unknown",valueType:d.valueType||"unknown",domain:a.getFieldDomain(o.name)??void 0})}n.set(r.id,{layerItem:i,fieldRegistry:c})}return n},le=async e=>{try{return(await _(e,{responseType:"json"})).data}catch(t){throw new Error(`Failed to fetch data from ${e}: ${String(t)}`)}},he=async e=>{let t=e.map;if(!t?.portalItem)throw new Error("WebMap portal item is missing.");let{resources:n}=await t.portalItem.fetchResources(),s=n.find(a=>a.resource.path==="embeddings-v01.json");if(!s?.resource.url)throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");let r=await le(s.resource.url);return ue(r)},j=class e{constructor(){this.orchestratorReady=!1,this.chatHistory=[],this.priorSteps=[],this.sharedState={},this.agentRegistry=new w,this.activeRunId="",this.cancelledRunIds=new Set,this.streamEpoch=0}static async init(t){let n=new e;try{if(t.view?.map){await H.whenOnce(()=>t.view.ready);let s=await he(t.view),r=ge(s.layers,t.view.map);n.layersAndFieldsRegistry=r,n.embeddingsWorker=await G(s)}return t.agents?.forEach(s=>{n.agentRegistry.register(s)}),n.orchestratorReady=!0,n}catch(s){throw console.error("Orchestrator initialization failed:",s),s}}async*ask(t,n={}){if(!this.orchestratorReady)throw new Error("Orchestrator is not ready yet.");if(!this.agentRegistry.list().length)throw new Error("Orchestrator has no registered agents.");let s=this.createRequestAgentRegistry(n);if(!s.list().length)throw new Error("Orchestrator has no agents selected for this request.");if(++this.streamEpoch,!t.trim())return;let r=E();this.activeRunId=r,this.activeAbortController=new AbortController,this.graph||(this.graph=se().compile({checkpointer:new S}));let a=this.embeddingsWorker?oe({worker:this.embeddingsWorker}):void 0,i=this.embeddingsWorker?ce({worker:this.embeddingsWorker}):void 0,c=new Map,o=n.routing==="direct"?{mode:"direct",agentId:n.agentId}:{mode:"auto"},d={thread_id:r,hitlResponse:null,services:{layerSearch:a,fieldSearch:i,layersAndFieldsRegistry:this.layersAndFieldsRegistry,agentRegistry:s,embeddingCache:c}},u={version:"v2",streamMode:"custom",signal:this.activeAbortController.signal,configurable:d,subgraphs:!0},p=this.graph?.streamEvents({routing:o,agentExecutionContext:{userRequest:t,messages:this.chatHistory,priorSteps:this.priorSteps,sharedState:this.sharedState}},u),y=++this.streamEpoch;if(yield*this.pipeStream(p,y,r),this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}for(;;){if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}let m=(await this.graph.getState(u,{subgraphs:!0})).tasks.find(h=>h.interrupts.length>0)?.interrupts[0]?.value;if(!m)break;this.currentInterrupt=m,this.interruptHandler=new x(this.graph,u),yield{runId:r,timestamp:Date.now(),type:"interrupt",interrupt:m};try{let h=await this.interruptHandler.waitForUser(),P=++this.streamEpoch;yield*this.pipeStream(h,P,r)}catch(h){if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}if(h){yield{runId:r,timestamp:Date.now(),type:"error",error:{message:h?.message}};return}}}if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}let l=(await this.graph.getState(u,{subgraphs:!0})).values;if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}this.chatHistory=l.agentExecutionContext.messages.length?l.agentExecutionContext.messages:this.chatHistory,this.priorSteps=l.agentExecutionContext.priorSteps?.slice(-5)??[],this.sharedState=l.agentExecutionContext.sharedState??{},yield{runId:r,timestamp:Date.now(),type:"completed",result:{content:l.finalOutputMessage}}}newConversation(){this.chatHistory=[],this.priorSteps=[],this.sharedState={}}resumeInterrupt(t){if(!this.currentInterrupt||!this.interruptHandler)throw new Error("No pending interrupt to resume.");this.interruptHandler.handle(this.currentInterrupt,t)}cancelInterrupt(){this.interruptHandler&&this.interruptHandler.cancel()}cancel(){this.activeRunId&&(this.cancelledRunIds.add(this.activeRunId),this.activeAbortController?.abort(),++this.streamEpoch,this.interruptHandler?.cancel())}async*pipeStream(t,n,s){for await(let r of t){if(this.isRunCancelled(s)||n!==this.streamEpoch)break;r.event==="on_custom_event"&&r.name==="trace_message"?yield{runId:s,timestamp:Date.now(),type:"trace",data:r.data}:r.name==="graph_ux_suggestion"&&(yield{runId:s,timestamp:Date.now(),type:"ux-suggestion",suggestion:r.data})}}isRunCancelled(t){return this.cancelledRunIds.has(t)}createRequestAgentRegistry(t){let n=t.routing==="direct"?[t.agentId]:t.agentIds,s=n?n.map(a=>{let i=this.agentRegistry.get(a);if(!i)throw new Error(`Agent is not registered: ${a}`);return i}):this.agentRegistry.list(),r=new w;return s.forEach(a=>r.register(a)),r}dispose(){this.embeddingsWorker&&(this.embeddingsWorker.terminate(),this.embeddingsWorker=void 0),this.orchestratorReady=!1}};return{a:ae,b:j}},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request",a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as c}from"./ONQ6JSBJ.js";import{Dc as n}from"./AI6DYOKR.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([m])=>{async function r(t,a,o){let i={target:new m({longitude:t.longitude,latitude:t.latitude,spatialReference:{wkid:4326}})};return o?.zoom!==void 0&&(i.zoom=o.zoom),o?.scale!==void 0&&(i.scale=o.scale),await a.goTo(i),{text:`Successfully navigated to: ${[`(${t.latitude}\xB0, ${t.longitude}\xB0)`,o?.zoom!==void 0?`zoom ${o.zoom}`:"",o?.scale!==void 0?`scale 1:${o.scale}`:""].filter(Boolean).join(", ")}`}}async function s({center:t,zoom:a,scale:o},i){let{mapView:l}=c(i,["mapView"]);return await r(t,l,{zoom:a,scale:o})}var d=e.object({center:e.object({longitude:e.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:e.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:e.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:e.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),g=n(s,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:d});return g},"geometry/Point")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import p from"./5RVELJU4.js";import n from"./ONMNQBPO.js";import m from"./S6OYR4VI.js";import l from"./LCFIADOZ.js";import"./QVOMX3R6.js";import k from"./T2GJLEYV.js";import j from"./Q4IQUEZN.js";import h from"./WS3T73IY.js";import g from"./4MFEKBKL.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import{a as o,c as s}from"./V6HOUZPZ.js";import"./77QFSIWW.js";import"./FDOMMK2M.js";import e from"./4YXYLX4H.js";import"./5PJXNTLZ.js";import"./EAEQONP7.js";import d from"./RU2T7GUX.js";import"./DYASSC7Z.js";import"./DY36ATOA.js";import"./CGXQAB3A.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./BS2PFNU4.js";import"./UIXX3XEN.js";import b from"./KA3FF3ZO.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-navigation-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-navigation-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-navigation-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n,p)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./CGXQAB3A.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToScaleTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import n from"./TQXLSW4A.js";import m from"./S6OYR4VI.js";import l from"./LCFIADOZ.js";import"./QVOMX3R6.js";import k from"./T2GJLEYV.js";import j from"./Q4IQUEZN.js";import i from"./WS3T73IY.js";import h from"./4MFEKBKL.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import{c as s,d as p}from"./V6HOUZPZ.js";import"./77QFSIWW.js";import"./FDOMMK2M.js";import f from"./4YXYLX4H.js";import"./5PJXNTLZ.js";import"./EAEQONP7.js";import d from"./RU2T7GUX.js";import"./DYASSC7Z.js";import"./DY36ATOA.js";import"./CGXQAB3A.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./BS2PFNU4.js";import"./UIXX3XEN.js";import b from"./KA3FF3ZO.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as e,z as o}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,{fetchKnowledgeGraph:m},,,,,,,,,,,,,n])=>{var r=class extends e{constructor(){super(...arguments),this.agent=n}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#i;#r;#t;#e;get serviceUrl(){return this.#r}set serviceUrl(t){this.#r=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#i)return{...t,view:this.#i};if(this.#t)try{let i=await this.#t;return{...t,knowledgeGraph:i}}catch(i){console.error("Failed to load knowledge graph via service URL:",i)}if(!this.context?.knowledgeGraph&&!this.context?.view)throw new Error("arcgis-assistant-knowledge-agent requires either a knowledgeGraph or view in context, and neither were provided");return this.context}willUpdate(t){t.has("serviceUrl")&&this.serviceUrl?this.#t=m(this.serviceUrl):this.#t=void 0}load(){this.#i=p(this)??void 0,this.#e=s(this)}disconnectedCallback(){this.#e?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",r);return r},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,f,g,h,i,j,k,l,m,n)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as t}from"./HJG7QM2R.js";export default $arcgis.t(([])=>{var d=async(o,i)=>{let r=o.tool_calls??[];if(r.length===0){await t({text:`LLM did not request any tool calls: ${String(o?.content)}`},i);return}await Promise.all(r.map(async a=>await t({text:`LLM invoked ${a.name} tool with arguments: ${JSON.stringify(a.args,null,2)}`},i)))};return d},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer")
2
+ import{a as t}from"./7VAQUCBU.js";export default $arcgis.t(([])=>{var d=async(o,i)=>{let r=o.tool_calls??[];if(r.length===0){await t({text:`LLM did not request any tool calls: ${String(o?.content)}`},i);return}await Promise.all(r.map(async a=>await t({text:`LLM invoked ${a.name} tool with arguments: ${JSON.stringify(a.args,null,2)}`},i)))};return d},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ function i(o,e){let t=o?.configurable?.context;if(!t||typeof t!="object")throw new Error("Agent context missing");let n=e.filter(r=>!(r in t));if(n.length)throw new Error(`Agent context missing: ${n.join(", ")}`);return t}export{i as a};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{c}from"./UZL6UVE4.js";export default $arcgis.t(([l,{property:i,subclass:y},{watch:d}])=>{var w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,t=(s,a,p,o)=>{for(var r=o>1?void 0:o?g(a,p):a,h=s.length-1,n;h>=0;h--)(n=s[h])&&(r=(o?n(a,p,r):n(r))||r);return o&&r&&w(a,p,r),r},m=()=>{throw new Error("createGraph method not implemented.")},e=class extends l{constructor(){super(...arguments),this.description="",this.middlewares=[],this.createGraph=m,this.workspace=c()}initialize(){this.addHandles([d(()=>[this.name,this.description],()=>this.generate(),{initial:!0,sync:!0}),d(()=>this.createGraph,()=>this._compiledGraph=void 0)])}get id(){return this.name.replace(/\s+/gu,"-").toLowerCase()}get registration(){return{id:this.id,name:this.name,description:this.description,createGraph:this.createGraph,workspace:this.workspace}}async run(s={},a){return this.createGraph===m&&this.generate(),this._compiledGraph=this._compiledGraph??this.createGraph().compile(),await this._compiledGraph.invoke(s,a)}};t([i({readOnly:!0})],e.prototype,"id",1);t([i()],e.prototype,"name",2);t([i()],e.prototype,"description",2);t([i()],e.prototype,"middlewares",2);t([i({readOnly:!0})],e.prototype,"createGraph",2);t([i({readOnly:!0})],e.prototype,"workspace",2);t([i({readOnly:!0})],e.prototype,"registration",1);e=t([y("BaseAgent")],e);return e},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils")
2
+ import{c}from"./ZLWWWTH4.js";export default $arcgis.t(([l,{property:i,subclass:y},{watch:d}])=>{var w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,t=(s,a,p,o)=>{for(var r=o>1?void 0:o?g(a,p):a,h=s.length-1,n;h>=0;h--)(n=s[h])&&(r=(o?n(a,p,r):n(r))||r);return o&&r&&w(a,p,r),r},m=()=>{throw new Error("createGraph method not implemented.")},e=class extends l{constructor(){super(...arguments),this.description="",this.middlewares=[],this.createGraph=m,this.workspace=c()}initialize(){this.addHandles([d(()=>[this.name,this.description],()=>this.generate(),{initial:!0,sync:!0}),d(()=>this.createGraph,()=>this._compiledGraph=void 0)])}get id(){return this.name.replace(/\s+/gu,"-").toLowerCase()}get registration(){return{id:this.id,name:this.name,description:this.description,createGraph:this.createGraph,workspace:this.workspace}}async run(s={},a){return this.createGraph===m&&this.generate(),this._compiledGraph=this._compiledGraph??this.createGraph().compile(),await this._compiledGraph.invoke(s,a)}};t([i({readOnly:!0})],e.prototype,"id",1);t([i()],e.prototype,"name",2);t([i()],e.prototype,"description",2);t([i()],e.prototype,"middlewares",2);t([i({readOnly:!0})],e.prototype,"createGraph",2);t([i({readOnly:!0})],e.prototype,"workspace",2);t([i({readOnly:!0})],e.prototype,"registration",1);e=t([y("BaseAgent")],e);return e},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./5SF6DEMO.js";import"./UZL6UVE4.js";import"./HO2YDJI2.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:p},{c:d,d:u}])=>{var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,r,n,o)=>{for(var t=o>1?void 0:o?w(r,n):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,n,t):a(t))||t);return o&&t&&f(r,n,t),t},s=class extends u{constructor(e){super(e)}getAgents(){return this.agents}buildNodes(e){let r=super.buildNodes(e);return r[l]=()=>({}),r}buildEdges(e){let r=this.condition;if(!r)throw new Error("ConditionalWorkflow requires a condition.");let n=d(e[0],0),o=d(e[1],1);return[{from:l,decide:async(t,i)=>await Promise.resolve(r(t,i))?n:o}]}getEntryNode(){return l}isTerminalAgent(){return!0}validateAgents(e){if(super.validateAgents(e),e.length!==2)throw new Error(`ConditionalWorkflow requires exactly 2 agents; received ${e.length}.`)}};c([g()],s.prototype,"condition",2);c([g()],s.prototype,"agents",2);s=c([p("ConditionalWorkflow")],s);var l="__conditional_decide";return s},"core/accessorSupport/decorators",a)
2
+ import a from"./VNJMTA6O.js";import"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:p},{c:d,d:u}])=>{var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,r,n,o)=>{for(var t=o>1?void 0:o?w(r,n):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,n,t):a(t))||t);return o&&t&&f(r,n,t),t},s=class extends u{constructor(e){super(e)}getAgents(){return this.agents}buildNodes(e){let r=super.buildNodes(e);return r[l]=()=>({}),r}buildEdges(e){let r=this.condition;if(!r)throw new Error("ConditionalWorkflow requires a condition.");let n=d(e[0],0),o=d(e[1],1);return[{from:l,decide:async(t,i)=>await Promise.resolve(r(t,i))?n:o}]}getEntryNode(){return l}isTerminalAgent(){return!0}validateAgents(e){if(super.validateAgents(e),e.length!==2)throw new Error(`ConditionalWorkflow requires exactly 2 agents; received ${e.length}.`)}};c([g()],s.prototype,"condition",2);c([g()],s.prototype,"agents",2);s=c([p("ConditionalWorkflow")],s);var l="__conditional_decide";return s},"core/accessorSupport/decorators",a)
@@ -0,0 +1,14 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as q,b as T}from"./34O57OGV.js";import{a as N}from"./FDOMMK2M.js";import a from"./QNNGPA3Q.js";import{a as S}from"./ONQ6JSBJ.js";import{Dc as I}from"./AI6DYOKR.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([V,j,A,{a:F,b:b,c:L,d:v}])=>{var W=async p=>{let{targetLayer:r,fieldName:n,statisticType:l,mapView:a,layersAndFieldsRegistry:h,geometryFilter:t}=p,s=a.map?.allLayers.find(i=>i.id===r.layerId);if(!s)throw new Error(`Layer '${r.layerId}' not found.`);let O=await a.whenLayerView(s),o=h.get(r.layerId)?.fieldRegistry.get(n),E=o?.alias;if(!o)throw new Error(`Field '${n}' not found.`);let w,u;if(t){let i=await L(t,a);if("error"in i)throw new Error(i.error);if(!i.geometry)throw b(t)?new Error(`No features found matching: ${t.where}`):new Error("Failed to create geometry");if(b(t)){let g=a.map?.allLayers.find(f=>f.id===t.layerId);w={geometryLayerName:g?.title??g?.id,geometryLayerId:t.layerId,geometryWhere:t.where,distance:t.distance,units:t.units,applied:!0}}else F(t)&&(w={point:t.point,distance:t.distance,units:t.units,applied:!0});u=new A({geometry:i.geometry,distance:t.distance,units:t.units,spatialRelationship:"intersects"})}let y=q(O,[n],!1),c=null,m=null,x=10;if(o.type!=="geometry"&&o.type!=="oid"&&o.type!=="global-id")try{let i={layer:s,useFeaturesInView:y,view:y?a:void 0,field:n,sqlWhere:T(s.definitionExpression,r.where),...u&&{filter:u},outStatisticTypes:{include:[l]}};c=await V(i);let g=["string","small-integer","integer"],f=o.domain?.type==="coded-value"?o.domain:null;(g.includes(o.type)||f)&&(m=(await j({layer:s,useFeaturesInView:y,view:y?a:void 0,field:n,sqlWhere:T(s.definitionExpression,r.where),...u&&{filter:u}})).uniqueValueInfos.sort((d,R)=>R.count-d.count).slice(0,x)),m&&o.domain?.type==="coded-value"&&(m=m.map(d=>({...d,value:f?f.getName(d.value)??d.value:d.value})))}catch(i){console.error("Statistics error:",i)}return{tool:"getStatistics",layerName:s.title??r.layerId,summary:`${l} = ${typeof c?.[l]=="number"?c[l]:"N/A"}`,details:{fieldName:n,fieldAlias:E,statisticType:l,statistic:c?.[l]??null,summaryStatistics:c,uniqueValues:m,where:r.where,spatialFilterInfo:w}}};async function D({targetLayer:p,fieldName:r,statisticType:n,geometryFilter:l},a){let h=N(a,"layersAndFieldsRegistry"),{mapView:t}=S(a,["mapView"]),s=await W({targetLayer:p,fieldName:r,statisticType:n,mapView:t,layersAndFieldsRegistry:h,geometryFilter:l});return JSON.stringify(s,null,2)}var U=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:v.optional().describe("The units for the distance buffer.")}),C=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:v.optional().describe("The units for the distance buffer.")}),$=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer containing the field from which to get a value."),where:e.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")}),geometryFilter:e.union([U,C]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),fieldName:e.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),statisticType:e.enum(["avg","max","median","min","stddev","sum","variance","nullcount","count"]).describe("The statistic type to calculate.")}),K=I(D,{name:"getStatistics",description:`Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
3
+
4
+ USE THIS TOOL FOR:
5
+ - "What is the average/maximum/minimum/total [field]?" \u2014 aggregate computations
6
+ - "Most common/frequent value of [field]?" \u2014 frequency analysis
7
+ - Questions requiring a mathematical aggregation across many features
8
+
9
+ DO NOT USE FOR:
10
+ - "How many features match X?" \u2014 use queryFeatures instead (it returns totalCount)
11
+ - "Show / list / find features" \u2014 use queryFeatures instead
12
+ - Simple counts of features matching a condition \u2014 use queryFeatures instead
13
+
14
+ Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,schema:$});return K},"smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","layers/support/FeatureFilter",a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as f}from"./VXFQANGJ.js";export default $arcgis.t(([y,u])=>{var m=750;function c(e){return"point"in e&&e.point!==void 0}function d(e){return"layerId"in e&&e.layerId!==void 0}var w=async(e,a)=>{if(c(e)){let{point:r}=e;return{geometry:new y({x:r.x,y:r.y,spatialReference:r.spatialReference?{wkid:r.spatialReference.wkid}:a.spatialReference})}}if(d(e)){let r=a.map?.allLayers.find(t=>t.id===e.layerId);if(!r)return{error:`Could not find geometry layer with ID: ${e.layerId}`};let l=r.title??r.id,s=e.where?.trim()||"1=1";try{let t=await r.queryFeatures({where:s,returnGeometry:!0,outSpatialReference:a.spatialReference,num:m+1});if(!t.features.length)return{error:`No features found in geometry layer "${l}" with the specified where clause: ${s}`};if(t.features.length>m)return{error:`Geometry filter for layer "${l}" matched too many features (${t.features.length}+). Please narrow the geometry layer filter.`};let i=t.features.map(o=>o.geometry).filter(o=>!!o);if(!i.length)return{error:"No valid geometries found for the matched geometry layer features."};let n=i.length===1?i[0]:u.executeMany(i);return n?(n.spatialReference||(n.spatialReference=a.spatialReference),{geometry:n}):{error:"Failed to combine geometries from geometry layer."}}catch(t){return{error:`Failed to query geometry: ${String(t)}`}}}return{error:"Invalid geometry configuration provided"}},g=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],R=f.enum(g);return{a:c,b:d,c:w,d:R}},"geometry/Point","geometry/operators/unionOperator")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./BS2PFNU4.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as clearFiltersTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as m}from"./ONQ6JSBJ.js";import{Dc as i}from"./AI6DYOKR.js";import{a as t}from"./VXFQANGJ.js";async function r(o,e){return await e.goTo({zoom:o}),{text:`Successfully zoomed to: ${o}`}}async function a({zoom:o},e){let{mapView:n}=m(e,["mapView"]);return await r(o,n)}var c=t.object({zoom:t.number().min(1).max(20).describe("The zoom level of the view to go to.")}),p=i(a,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:c});export{p as a};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{b as D,c as M}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import d from"./FAR3DFFK.js";import"./CP5BVGJU.js";import b from"./OWTGH34K.js";import{a as R,b as F,e as W}from"./ZLWWWTH4.js";import a from"./AT4XVTJR.js";import{e as q}from"./7M6VKBTK.js";import{v as P,z as I}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./HHFNQR6Z.js";import"./VOKXKU7M.js";import{W as C,ka as v}from"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import{Dd as c}from"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([z,U,{property:n,subclass:l},O,N,,,,,,,L,$])=>{var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,y=(t,e,o,s)=>{for(var r=s>1?void 0:s?Y(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&X(e,o,r),r},p=class extends N{constructor(t){super(t)}static fromJSON(t){return new p({id:t.id,sourceAnchorId:t.source_anchor_id,sourceNodeId:t.source_node_id,targetAnchorId:t.target_anchor_id,targetNodeId:t.target_node_id})}};y([n()],p.prototype,"id",2);y([n()],p.prototype,"sourceAnchorId",2);y([n()],p.prototype,"sourceNodeId",2);y([n()],p.prototype,"targetAnchorId",2);y([n()],p.prototype,"targetNodeId",2);p=y([l("Edge")],p);var tt=Object.defineProperty,et=Object.getOwnPropertyDescriptor,S=(t,e,o,s)=>{for(var r=s>1?void 0:s?et(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&tt(e,o,r),r},m=class extends N{constructor(t){super(t)}async load(){return await Promise.resolve(this)}compile(t){return{runtimeNode:this.createRuntimeNode(),edges:t.outgoingEdges.map(e=>({from:this.id,to:e.targetNodeId}))}}static fromJSON(t){throw new Error("BaseNode is abstract and cannot be instantiated directly.")}};S([n()],m.prototype,"id",2);S([n()],m.prototype,"label",2);S([n()],m.prototype,"type",2);m=S([l("BaseNode")],m);var rt=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,E=(t,e,o,s)=>{for(var r=s>1?void 0:s?ot(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&rt(e,o,r),r},d=class extends N{constructor(t){super(t),this.messages=[]}static fromJSON(t){let e=d._normalizeMessages(t.messages);return new d({id:t.id,messages:e})}static _normalizeMessages(t){return Array.isArray(t)?t.filter(e=>typeof e.content=="string").map(e=>({content:e.content,role:e.role??"system"})):[]}};E([n()],d.prototype,"id",2);E([n()],d.prototype,"messages",2);d=E([l("Prompt")],d);function G(t){let e=new Set(t.required),o=Object.fromEntries(Object.entries(t.properties).map(([s,r])=>{let a=B(r);return[s,e.has(s)?a:a.optional()]}));return c.object(o)}function B(t){let e;switch(t.type){case"array":e=c.array(t.items?B(t.items):c.unknown());break;case"boolean":e=c.boolean();break;case"number":e=c.number();break;case"object":e=G({properties:t.properties??{},required:t.required});break;case"string":e=t.enum?.length?c.enum(t.enum):c.string();break}return t.description?e.describe(t.description):e}var st=new Map([["clear_filters",async()=>(await import("./QRHZXLZN.js")).clearFiltersTool],["reset_map",async()=>(await import("./RADWN4ZP.js")).resetMapTool],["set_feature_effect",async()=>(await import("./7E2QMWK6.js").then(m=>m.default.then(e=>({setFeatureEffectTool:e})))).setFeatureEffectTool],["list_layer_fields",async()=>(await import("./I6PD2HSL.js")).listLayerFieldsTool],["go_to_address",async()=>(await import("./5WLNL4HZ.js").then(m=>m.default.then(e=>({goToAddressTool:e})))).goToAddressTool],["go_to_bookmark",async()=>(await import("./GRHIFCQX.js")).goToBookmarkTool],["go_to_features",async()=>(await import("./WMZ24LWS.js")).goToFeaturesTool],["go_to_full_extent",async()=>(await import("./K335IAIE.js").then(m=>m.default.then(e=>({goToFullExtentTool:e})))).goToFullExtentTool],["go_to_home_extent",async()=>(await import("./TKYI5QRL.js")).goToHomeExtentTool],["go_to_layer",async()=>(await import("./5DVRVY4L.js")).goToLayerTool],["go_to_scale",async()=>(await import("./MM33KJPF.js")).goToScaleTool],["go_to_viewpoint",async()=>(await import("./IDUC4CPV.js").then(m=>m.default.then(e=>({goToViewpointTool:e})))).goToViewpointTool],["go_to_zoom",async()=>(await import("./K33MZ726.js")).goToZoomTool],["get_attribute",async()=>(await import("./5R6QUF5B.js").then(m=>m.default.then(e=>({getAttributeTool:e})))).getAttributeTool],["get_statistics",async()=>(await import("./66SKMECC.js").then(m=>m.default.then(e=>({getStatisticsTool:e})))).getStatisticsTool],["get_top_features",async()=>(await import("./CWD37QFT.js").then(m=>m.default.then(e=>({getTopFeaturesTool:e})))).getTopFeaturesTool],["query_features",async()=>(await import("./HZ5ARNAM.js").then(m=>m.default.then(e=>({queryFeaturesTool:e})))).queryFeaturesTool]]);async function at(t){let e=st.get(t);if(!e)throw new Error(`ArcGIS tool is not supported in the browser runtime: ${t}`);return await e()}var it=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,T=(t,e,o,s)=>{for(var r=s>1?void 0:s?nt(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&it(e,o,r),r},g=class extends N{constructor(t){super(t),this.type="arcgis-tool"}async createRuntimeTools(){if(!this.name)throw new Error("ArcgisTool name is required");return[await at(this.name)]}static fromJSON(t){return new g({name:t.name,requireApproval:t.require_approval})}};T([n()],g.prototype,"name",2);T([n()],g.prototype,"requireApproval",2);T([n()],g.prototype,"type",2);g=T([l("ArcgisTool")],g);var ct=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,H=t=>{throw TypeError(t)},b=(t,e,o,s)=>{for(var r=s>1?void 0:s?pt(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&ct(e,o,r),r},mt=(t,e,o)=>e.has(t)||H("Cannot "+o),dt=(t,e,o)=>e.has(t)?H("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,o),ut=(t,e,o)=>(mt(t,e,"access private method"),o),j,V,u=class extends m{constructor(t){super(t),dt(this,j),this.type="agent-node"}createRuntimeNode(){let t;return async(e,o)=>{t??=ut(this,j,V).call(this);let s=await(await t).run(e,o),r=this.outputSchema?.safeParse(s);if(r&&!r.success)throw r.error;let a=r?.data,i=a??s.outputMessage;return{agentExecutionContext:s.agentExecutionContext,...a?{}:{outputMessage:s.outputMessage},status:s.status,summary:s.summary,nodes:{[this.id]:{output:i}}}}}compile(t){let e=t.outgoingEdges[0]?.targetNodeId;return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:o=>o.status==="failed"?void 0:e}],schemas:[c.object({output:this.outputSchema??c.string()})]}}static fromJSON(t){let e=new u({id:t.id,label:t.label,type:"agent-node"});return t.prompt&&(typeof t.prompt=="string"?e.prompt=d.fromJSON({id:`prompt_${t.id}`,type:"plain_text",messages:[{content:t.prompt,role:"system"}]}):e.prompt=d.fromJSON(t.prompt)),t.structured_output&&(e.outputSchema=G(t.structured_output)),e.tools=t.tools?.filter(o=>o.type==="arcgis_tool").map(o=>g.fromJSON(o)),e}};j=new WeakSet;V=async function(){let t=this.prompt?.messages?.[0].content;if(!t?.trim())throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);let e=[];if(this.tools)for(let o of this.tools){let s=await o.createRuntimeTools();e.push(...s)}return new $({name:this.id,outputSchema:this.outputSchema,prompt:t,tools:e})};b([n()],u.prototype,"type",2);b([n()],u.prototype,"prompt",2);b([n()],u.prototype,"outputSchema",2);b([n()],u.prototype,"tools",2);u=b([l("AgentNode")],u);var lt=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,k=(t,e,o,s)=>{for(var r=s>1?void 0:s?gt(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&lt(e,o,r),r},h=class extends m{constructor(t){super(t),this.type="end-message-node"}createRuntimeNode(){return async t=>{let e=await C.fromTemplate(this.message,{templateFormat:"mustache"}).format(t);return{outputMessage:e,status:"success",summary:e}}}compile(t){return{runtimeNode:this.createRuntimeNode(),edges:[]}}static fromJSON(t){let e=new h({id:t.id,label:t.label,type:"end-message-node"});return e.message=t.message,e}};k([n()],h.prototype,"type",2);k([n()],h.prototype,"message",2);h=k([l("EndMessageNode")],h);var ht=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,Z=(t,e,o,s)=>{for(var r=s>1?void 0:s?ft(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&ht(e,o,r),r},w=class extends m{constructor(t){super(t),this.type="start-node"}createRuntimeNode(){return t=>({question:t.agentExecutionContext.userRequest})}static fromJSON(t){return new w({id:t.id,label:t.label,type:"start-node"})}};Z([n()],w.prototype,"type",2);w=Z([l("StartNode")],w);function yt(t){switch(t.type){case"agent_node":return u.fromJSON(t);case"end_message_node":return h.fromJSON(t);case"start_node":return w.fromJSON(t);default:throw new Error(`WebAgent node "${t.id}" uses unsupported type "${t.type}".`)}}function wt(t={}){let e=Object.keys(t);if(R(e),e.includes("nodes"))throw new Error("node state cannot define reserved field: nodes.");let o=F(t);return v.Root({...o,nodes:v({reducer:(s,r)=>({...s,...r}),default:()=>({})}),...q()})}function K(t){let e=new Set;for(let s of t)for(let r of Object.keys(s.shape??{}))r!=="nodes"&&e.add(r);let o=Object.fromEntries([...e].map(s=>[s,void 0]));return wt(o)}var A=class t{constructor(e,o,s){this.sourceJSON=e,this.edges=o,this.nodes=s,this._loaded=!1}static fromJSON(e){return new t(e,e.graph.edges.map(o=>p.fromJSON(o)),e.graph.nodes.map(o=>yt(o)))}async load(){return this._loadPromise??=Promise.all(this.nodes.map(async e=>await e.load())).then(()=>{this._loaded=!0}),await this._loadPromise,this}getSchemas(){let e=Object.fromEntries(this._getNodeCompilations().flatMap((o,s)=>{let r=this.nodes[s];return o.schemas?.map(a=>[r.id,a])??[]}));return[c.object({loopCounts:c.record(c.string(),c.number()).optional(),nodes:c.object(e).partial().optional(),question:c.string().optional()})]}generate(){this._assertLoaded(),this._nodeCompilations=void 0;let e=this._getNodeCompilations(),o=K(this.getSchemas()),s=this.nodes.find(i=>i.type==="start-node")?.id,r={},a=[];for(let[i,Q]of this.nodes.entries()){let _=e[i];_&&(_.runtimeNode&&(r[Q.id]=_.runtimeNode),a.push(..._.edges))}return{createGraph:()=>W(r,a,o,{entryNode:s}),workspace:o}}_assertLoaded(){if(!this._loaded)throw new Error("AgenticWorkflowRuntime must be loaded before it can generate a graph.")}_getNodeCompilations(){return this._assertLoaded(),this._nodeCompilations??=this.nodes.map(e=>e.compile({outgoingEdges:this.edges.filter(o=>o.sourceNodeId===e.id)}))}},bt=Object.defineProperty,_t=Object.getOwnPropertyDescriptor,x=(t,e,o,s)=>{for(var r=s>1?void 0:s?_t(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&bt(e,o,r),r},Ot=()=>{throw new Error("WebAgent must be loaded before it can run.")},f=class extends L{constructor(t){super(t)}async load(){if(this.portalItem){try{await this.portalItem.load()}catch(o){throw new O("web-agent:load-portal-item","Failed to load portal item",{error:o})}let e=await this.portalItem.fetchData();if(this.sourceJSON=e,!this.portalItem.title)throw new O("web-agent:missing-title","The portal item is missing a title")}if(!this.sourceJSON)throw new O("web-agent:missing-source-json","The source JSON is missing");if(!this.sourceJSON.description)throw new O("web-agent:missing-description","The source JSON is missing a description");let t=A.fromJSON(this.sourceJSON);return await t.load(),this._runtime=t,this.description=this.sourceJSON.description,this.name=this.portalItem?.title??`web-agent-${Date.now()}`,this.generate(),this}getSchemas(){return this._runtime?.getSchemas()??[]}generate(){if(!this._runtime){this._set("workspace",K([])),this._set("createGraph",Ot);return}let{createGraph:t,workspace:e}=this._runtime.generate();this._set("workspace",e),this._set("createGraph",t)}};x([n({type:z})],f.prototype,"portalItem",2);x([n()],f.prototype,"sourceJSON",2);f=x([l("WebAgent")],f);var J=class extends P{static{this.properties={agent:0,context:0,itemId:1,workflow:0}}#t;async getContext(){return D(this.context)?await this.context():this.context}async load(){let e;if(this.itemId){let o=U.getDefault();e=new f({portalItem:new z({id:this.itemId,portal:o})})}else this.workflow&&(e=new f({sourceJSON:this.workflow}));if(e&&(await e.load(),this.agent=e.registration),!this.agent)throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");this.#t=M(this)}disconnectedCallback(){this.#t?.unregister(this.agent.id),super.disconnectedCallback()}};I("arcgis-assistant-agent",J);return J},"portal/PortalItem","portal/Portal","core/accessorSupport/decorators","core/Error","core/Accessor","identity/IdentityManager","request","config","core/reactiveUtils","layers/FeatureLayer",a,b,d)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./UIXX3XEN.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as resetMapTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./ONQ6JSBJ.js";import{Dc as n}from"./AI6DYOKR.js";import{Dd as e}from"./MWYBF3F3.js";export default $arcgis.t(([m])=>{async function r(t){let o=new m({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await t.goTo(o),{text:"Successfully zoomed to world extent"}}async function s(t,o){let{mapView:i}=a(o,["mapView"]);return await r(i)}var c=e.object({}),u=n(s,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:c});return u},"geometry/Extent")