@arcgis/ai-components 5.2.0-next.0 → 5.2.0-next.10

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 (110) hide show
  1. package/dist/agent-utils/LLMAgent.js +22 -22
  2. package/dist/cdn/{DHOVCT6R.js → 2SJAOYZT.js} +1 -1
  3. package/dist/cdn/434TAA3J.js +2 -0
  4. package/dist/cdn/{AMP6IALT.js → 5W7S2RS4.js} +1 -1
  5. package/dist/cdn/64PJB5NU.js +2 -0
  6. package/dist/cdn/{OH64RMOR.js → 6AWNQHCO.js} +2 -2
  7. package/dist/cdn/BIV2IPHH.js +2 -0
  8. package/dist/cdn/CCY4TSBO.js +2 -0
  9. package/dist/cdn/{AO7BQHKC.js → CTSALWEP.js} +1 -1
  10. package/dist/cdn/{NAUXSHIE.js → D2N2NSRQ.js} +2 -2
  11. package/dist/cdn/{3PKJWIC3.js → D3TNNRP4.js} +1 -1
  12. package/dist/cdn/{H7422XUG.js → DOV5ZJ7M.js} +1 -1
  13. package/dist/cdn/EEUCKMU7.js +2 -0
  14. package/dist/cdn/EGHBXLNG.js +2 -0
  15. package/dist/cdn/{N2VQD46V.js → ETRWZ3MS.js} +31 -29
  16. package/dist/cdn/{QDO2AO53.js → EWI4V3GQ.js} +10 -10
  17. package/dist/cdn/{6MAINSY5.js → FL4W4VYN.js} +0 -1
  18. package/dist/cdn/GTLS44GI.js +2 -0
  19. package/dist/cdn/{SZOVY2QU.js → I6HNBTWY.js} +1 -1
  20. package/dist/cdn/JBHNHHWO.js +3 -0
  21. package/dist/cdn/{FX5JFRDL.js → JOFUPKIB.js} +1 -1
  22. package/dist/cdn/KUEOKIQR.js +2 -0
  23. package/dist/cdn/LKRAPK4A.js +165 -0
  24. package/dist/cdn/{6R6AY3D3.js → MODWHY3R.js} +2 -2
  25. package/dist/cdn/NXKKG5TK.js +2 -0
  26. package/dist/cdn/{2AXF774U.js → OBUZ7HBN.js} +1 -1
  27. package/dist/cdn/OIVRK7HT.js +2 -0
  28. package/dist/cdn/{HB5A5R2E.js → RUURNLTP.js} +1 -1
  29. package/dist/cdn/SWOXSJ62.js +2 -0
  30. package/dist/cdn/{LBVX2JYG.js → T537PKP4.js} +10 -7
  31. package/dist/cdn/{Y67XAMT4.js → TSZPHE7L.js} +2 -2
  32. package/dist/cdn/VAZNJSKA.js +16 -0
  33. package/dist/cdn/{V2P4AIGG.js → VMXLYWUK.js} +1 -1
  34. package/dist/cdn/{FB5DRKEB.js → VNQN5ZQO.js} +2 -2
  35. package/dist/cdn/WIDTPVSU.js +2 -0
  36. package/dist/cdn/{GM3QP65I.js → X2ZDYHCG.js} +18 -5
  37. package/dist/cdn/{P6OPJQMC.js → XER22VYQ.js} +1 -1
  38. package/dist/cdn/index.js +1 -1
  39. package/dist/cdn/main.css +1 -1
  40. package/dist/chunks/adapter.js +527 -522
  41. package/dist/chunks/arcgisKnowledgeGraph.js +3 -3
  42. package/dist/chunks/dataExplorationGraph.js +135 -119
  43. package/dist/chunks/data_explore_query_prompt.js +18 -5
  44. package/dist/chunks/generateLayerDescriptions.js +236 -209
  45. package/dist/chunks/helpGraph.js +4 -4
  46. package/dist/chunks/intent_prompt.js +0 -1
  47. package/dist/chunks/layerStylingGraph.js +10 -10
  48. package/dist/chunks/navigationGraph.js +27 -27
  49. package/dist/chunks/orchestrator.js +240 -201
  50. package/dist/chunks/slottableRequestUtils.js +3 -7
  51. package/dist/chunks/summarize_query_response_prompt.js +10 -7
  52. package/dist/components/arcgis-assistant/customElement.d.ts +15 -0
  53. package/dist/components/arcgis-assistant/customElement.js +227 -127
  54. package/dist/components/arcgis-assistant/index.js +2 -3
  55. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  56. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
  57. package/dist/components/arcgis-assistant-chat/customElement.js +7 -7
  58. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  59. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  60. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  61. package/dist/components/arcgis-assistant-interrupt/customElement.js +13 -9
  62. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  63. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  64. package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
  65. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  66. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  67. package/dist/components/arcgis-assistant-message/index.js +2 -0
  68. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  69. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  70. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  71. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  72. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  73. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
  74. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
  75. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  76. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  77. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  78. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +4 -1
  79. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  80. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  81. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  82. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
  83. package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
  84. package/dist/docs/api.json +1 -1
  85. package/dist/docs/docs.json +1 -1
  86. package/dist/docs/vscode.html-custom-data.json +1 -1
  87. package/dist/docs/web-types.json +1 -1
  88. package/dist/index.d.ts +4 -0
  89. package/dist/loader.js +6 -5
  90. package/dist/types/lumina.d.ts +10 -4
  91. package/dist/types/preact.d.ts +11 -4
  92. package/dist/types/react.d.ts +12 -4
  93. package/dist/types/stencil.d.ts +10 -4
  94. package/dist/utils/index.d.ts +85 -42
  95. package/dist/utils/index.js +22 -18
  96. package/package.json +7 -7
  97. package/dist/cdn/7BCR6TUO.js +0 -2
  98. package/dist/cdn/7GH7VSB2.js +0 -2
  99. package/dist/cdn/7PLV4QH6.js +0 -2
  100. package/dist/cdn/DDLZOMUY.js +0 -2
  101. package/dist/cdn/EF453FJ2.js +0 -3
  102. package/dist/cdn/METXWS7V.js +0 -166
  103. package/dist/cdn/MH5RPXHM.js +0 -2
  104. package/dist/cdn/NVI3I46B.js +0 -2
  105. package/dist/cdn/OAVEHGB6.js +0 -2
  106. package/dist/cdn/QR54T33D.js +0 -2
  107. package/dist/cdn/SXDLXCIM.js +0 -2
  108. package/dist/cdn/U3QQW6VA.js +0 -16
  109. package/dist/cdn/USMDJUFS.js +0 -2
  110. package/dist/cdn/Y333DGV6.js +0 -2
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{g as C,h as S,n as l,v as R,w as m,y}from"./OH64RMOR.js";import"./YIMNOUTF.js";export default $arcgis.t(([{when:k,watch:u},I,{property:d,subclass:f}])=>{var T=C`.button{--calcite-button-background-color: var(--calcite-color-transparent);--calcite-button-border-color: transparent;--calcite-button-icon-color: var(--calcite-color-text-3);--calcite-button-text-color: var(--calcite-color-text-3);flex:0 0 auto;position:relative}.button[data-state=disabled]{--calcite-button-icon-color: var(--calcite-color-text-3);opacity:var(--calcite-opacity-disabled)}.button[data-state=listening]{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand) 14%, var(--calcite-color-foreground-1) );--calcite-button-border-color: color-mix(in srgb, var(--calcite-color-brand) 24%, transparent);--calcite-button-icon-color: var(--calcite-color-brand);--calcite-button-text-color: var(--calcite-color-brand);box-shadow:var(--calcite-shadow-sm)}.button[data-state=listening]:hover{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand-hover, var(--calcite-color-brand)) 18%, var(--calcite-color-foreground-1) )}.button[data-state=listening]:active{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand) 24%, var(--calcite-color-foreground-1) )}.button[data-state=processing]{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand) 10%, var(--calcite-color-foreground-1) );--calcite-button-border-color: color-mix(in srgb, var(--calcite-color-brand) 20%, transparent);--calcite-button-icon-color: var(--calcite-color-brand);--calcite-button-text-color: var(--calcite-color-brand)}.button[data-state=error]{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-status-danger) 12%, var(--calcite-color-foreground-1) );--calcite-button-border-color: color-mix(in srgb, var(--calcite-color-status-danger) 24%, transparent);--calcite-button-icon-color: var(--calcite-color-status-danger);--calcite-button-text-color: var(--calcite-color-status-danger)}.button[data-state=listening]:after{content:"";position:absolute;inset:-4px;border:1px solid color-mix(in srgb,var(--calcite-color-brand) 40%,transparent);border-radius:inherit;opacity:0;pointer-events:none;transform:scale(.92);animation:assistant-speech-input-recording-pulse 1.8s ease-out infinite}@keyframes assistant-speech-input-recording-pulse{0%{opacity:.65;transform:scale(.92)}70%{opacity:0;transform:scale(1.16)}to{opacity:0;transform:scale(1.16)}}@media(prefers-reduced-motion){.button[data-state=listening]:after{animation:none}}`,x=Object.defineProperty,V=Object.getOwnPropertyDescriptor,p=(e,t,s,i)=>{for(var r=i>1?void 0:i?V(t,s):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(i?o(t,s,r):o(r))||r);return i&&r&&x(t,s,r),r},a=class extends I{constructor(e){super(e),this.state="idle",this.liveTranscript="",this.transcript="",this.errorCode=void 0}static isSupported(){return!1}};p([d()],a.prototype,"language",2);p([d({readOnly:!0})],a.prototype,"state",2);p([d({readOnly:!0})],a.prototype,"liveTranscript",2);p([d({readOnly:!0})],a.prototype,"transcript",2);p([d({readOnly:!0})],a.prototype,"errorCode",2);a=p([f("SpeechController")],a);var O=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg"];function h(e){return e.replace(/\s+/gu," ").trim()}var M=Object.defineProperty,D=Object.getOwnPropertyDescriptor,g=(e,t,s,i)=>{for(var r=i>1?void 0:i?D(t,s):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(i?o(t,s,r):o(r))||r);return i&&r&&M(t,s,r),r},c=class extends a{constructor(e){super(e),this._activeSessionId=null,this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._mediaStream=null,this._pendingChunkOperations=new Set,this._recordedChunks=[],this.handleRecording=null,this.chunkTimeSlice=3e3}get _mimeType(){return typeof window>"u"||typeof window.MediaRecorder?.isTypeSupported!="function"?"":O.find(e=>window.MediaRecorder.isTypeSupported(e))??""}initialize(){c.isSupported()&&this.addHandles(k(()=>!!this.errorCode,()=>{this._set("state","error")}))}destroy(){this._mediaRecorder&&(this._mediaRecorder.onstart=null,this._mediaRecorder.ondataavailable=null,this._mediaRecorder.onerror=null,this._mediaRecorder.onstop=null),this.cancel(),this._mediaRecorder=null}_queuePendingChunkOperation(e){this._pendingChunkOperations.add(e),e.finally(()=>{this._pendingChunkOperations.delete(e)})}async _awaitPendingChunkOperations(){this._pendingChunkOperations.size&&await Promise.allSettled(Array.from(this._pendingChunkOperations))}_onDataAvailable(e){let t=this._activeSessionId;t!=null&&this._queuePendingChunkOperation(this._processDataAvailable(e,t))}async _processDataAvailable(e,t){let s=e.data;if(!s.size||t!==this._activeSessionId)return;this._recordedChunks.push(s);let i=s.type||this._mediaRecorder?.mimeType||this._mimeType,r=this._mediaRecorderStopReason==="toggle"&&this._mediaRecorder?.state==="inactive";try{if(!this.handleRecording)return;let n=h(await this.handleRecording(s,i,this._mediaRecorderChunkIndex,r)??"");if(t!==this._activeSessionId)return;n&&this._set("liveTranscript",h(`${this.liveTranscript} ${n}`))}catch(n){if(t!==this._activeSessionId)return;this._failSession(n instanceof Error&&n.message==="transcription-unavailable"?"transcription-unavailable":"transcription-failed");return}!r&&t===this._activeSessionId&&(this._mediaRecorderChunkIndex+=1)}_failSession(e){let t=this._mediaRecorder;if(t){t.onstart=null,t.ondataavailable=null,t.onerror=null,t.onstop=null;try{t.state!=="inactive"&&t.stop()}catch{}}this._activeSessionId=null,this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._releaseMediaStream(),this._set("liveTranscript",""),this._set("transcript",""),this._set("errorCode",e)}_onError(){this._failSession("recording-failed")}_onStart(){this._set("state","listening")}_onStop(){this._handleStop()}_releaseMediaStream(){this._mediaStream?.getTracks().forEach(e=>e.stop()),this._mediaStream=null}async _handleStop(){let e=this._mediaRecorder,t=this._activeSessionId,s=this._mediaRecorderStopReason,i=e?.mimeType||this._recordedChunks.find(n=>!!n.type)?.type||"",r=[...this._recordedChunks];if(this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._releaseMediaStream(),s==="cancel"){this._activeSessionId===t&&(this._activeSessionId=null),this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("liveTranscript",""),this._set("transcript",""),this._set("state","idle"),this._set("errorCode",void 0);return}if(t==null){this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("state","idle"),this._set("errorCode",void 0);return}if(await this._awaitPendingChunkOperations(),t===this._activeSessionId){if(!(i?new Blob(r,{type:i}):new Blob(r)).size){this._activeSessionId===t&&(this._activeSessionId=null),this._mediaRecorderStopReason=null,this._recordedChunks=[],this._set("errorCode","recording-failed");return}this._set("state","processing"),this._set("transcript",h(`${this.transcript} ${this.liveTranscript}`)),this._set("liveTranscript",""),this._activeSessionId===t&&(this._activeSessionId=null),this._set("state","idle"),this._set("errorCode",void 0),this._mediaRecorderStopReason=null,this._recordedChunks=[]}}start(){if(!c.isSupported()){this._set("errorCode","not-supported");return}let e=Date.now();this._activeSessionId=e,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("liveTranscript",""),this._set("transcript",""),this._set("errorCode",void 0),navigator.mediaDevices.getUserMedia({audio:!0}).then(t=>{if(e!==this._activeSessionId){t.getTracks().forEach(r=>r.stop());return}let s=this._mimeType,i=s?new window.MediaRecorder(t,{mimeType:s}):new window.MediaRecorder(t);this._mediaStream=t,this._mediaRecorder=i,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._recordedChunks=[],i.ondataavailable=this._onDataAvailable.bind(this),i.onerror=this._onError.bind(this),i.onstart=this._onStart.bind(this),i.onstop=this._onStop.bind(this),this._mediaRecorder.start(this.chunkTimeSlice)}).catch(t=>{e===this._activeSessionId&&(this._activeSessionId=null,this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._releaseMediaStream(),t instanceof DOMException&&t.name==="NotAllowedError"?this._set("errorCode","not-allowed"):this._set("errorCode","recording-failed"))})}stop(){if(this._mediaRecorder){this._mediaRecorderStopReason="toggle";try{this._mediaRecorder.state!=="inactive"?this._mediaRecorder.stop():this._handleStop()}catch{}}}cancel(){let e=this._mediaRecorder;if(this._activeSessionId=null,this._mediaRecorderStopReason="cancel",this._mediaRecorderChunkIndex=0,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("liveTranscript",""),this._set("transcript",""),this._set("state","idle"),this._set("errorCode",void 0),!e){this._releaseMediaStream();return}try{if(e.state!=="inactive"){e.stop();return}}catch{}this._mediaRecorder=null,this._releaseMediaStream()}static isSupported(){return typeof window<"u"&&!!(window.MediaRecorder&&navigator.mediaDevices?.getUserMedia)}};g([d()],c.prototype,"_mimeType",1);g([d()],c.prototype,"handleRecording",2);g([d()],c.prototype,"chunkTimeSlice",2);c=g([f("MediaRecorderController")],c);var $=Object.getOwnPropertyDescriptor,E=(e,t,s,i)=>{for(var r=i>1?void 0:i?$(t,s):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=o(r)||r);return r};function w(){if(typeof window>"u")return null;let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}var _=class extends a{constructor(e){super(e),this._isCancelled=!1,this._recognition=null}initialize(){let e=w();if(!e)return;let t=new e;t.continuous=!0,t.interimResults=!0,this.language&&(t.lang=this.language),t.onstart=this._onStart.bind(this),t.onresult=this._onResult.bind(this),t.onerror=this._onError.bind(this),t.onend=this._onEnd.bind(this),t.onspeechend=this._onSpeechEnd.bind(this),this._recognition=t,this.addHandles(k(()=>!!this.errorCode,()=>{this._set("state","error")}))}destroy(){this._recognition&&(this._recognition.onstart=null,this._recognition.onresult=null,this._recognition.onerror=null,this._recognition.onend=null,this._recognition.onspeechend=null,this.cancel(),this._recognition=null)}_onStart(){this._isCancelled=!1,this._set("state","listening")}_onResult(e){let{finalTranscript:t,liveTranscript:s}=Array.from(e.results).reduce((i,r)=>(r.isFinal?i.finalTranscript+=r[0].transcript:i.liveTranscript+=r[0].transcript,i),{finalTranscript:"",liveTranscript:""});this._set("transcript",h(t)),this._set("liveTranscript",h(s))}_onError(e){if(e.error==="aborted"&&this._isCancelled){this._set("state","idle");return}let t="unhandled";switch(e.error){case"no-speech":t="no-speech";break;case"service-not-allowed":case"not-allowed":t="not-allowed";break;default:t="unhandled"}this._set("errorCode",t)}_onEnd(){let e=h(`${this.transcript} ${this.liveTranscript}`);if(this._set("liveTranscript",""),this._isCancelled){this._set("transcript",""),this._set("state","idle"),this._set("errorCode",void 0);return}this.errorCode?this._set("transcript",""):(this._set("transcript",e),this._set("state","idle")),this._set("errorCode",void 0)}_onSpeechEnd(){this._set("state","processing")}_reset(e=!1){this._isCancelled=e,this._set("liveTranscript",""),this._set("transcript",""),this._set("errorCode",void 0),this._set("state","idle")}start(){if(!this._recognition){this._set("errorCode","not-supported");return}this._reset(!1);try{this._recognition.start()}catch{this._set("errorCode","unhandled")}}stop(){if(this._recognition){this._set("state","processing");try{this._recognition.stop()}catch{}}}cancel(){if(this._recognition){this._reset(!0);try{this._recognition.abort()}catch{}}}static isSupported(){return!!w()}};_=E([f("WebSpeechController")],_);function b(e){let{baseValue:t,transcript:s}=e;if(!s)return t;let i=t.trim();return i?`${i} ${s}`:s}var v=class extends R{constructor(){super(...arguments),this.#t=null,this._resolvedMode="disabled",this.awaitingResponse=!1,this.inputValue="",this.mode="web-speech",this.arcgisVoiceInputDraftChange=l(),this.arcgisVoiceInputError=l(),this.arcgisVoiceInputInterimTranscription=l(),this.arcgisVoiceInputStart=l(),this.arcgisVoiceInputStop=l(),this.arcgisVoiceInputTranscription=l(),this.arcgisVoiceInputTranscriptionStreamChunk=l()}static{this.properties={_resolvedMode:16,_state:16,_errorCode:16,_liveTranscript:16,_transcript:16,_isButtonDisabled:16,_buttonLabel:16,awaitingResponse:5,inputValue:1,language:1,mode:1}}static{this.styles=T}#t;get _state(){return this._speechController?.state??"idle"}get _errorCode(){return this._speechController?.errorCode??null}get _liveTranscript(){return this._speechController?.liveTranscript??""}get _transcript(){return this._speechController?.transcript??""}get _isButtonDisabled(){return this._resolvedMode==="disabled"||this.awaitingResponse||this._state==="processing"}get _buttonLabel(){if(this.awaitingResponse)return"Voice input unavailable while assistant is responding";if(this._resolvedMode==="disabled")return"Voice input unavailable";switch(this._state){case"error":return this._errorCode==="not-allowed"?"Microphone permission denied. Retry voice input":"Retry voice input";case"listening":return"Stop voice input";case"processing":return"Processing voice input";default:return"Start voice input"}}clearDraftSession(){this.#t=null}loaded(){this.manager.onLifecycle(()=>[u(()=>[this.mode,this.language],()=>{this._configureController()},{initial:!0}),u(()=>this.awaitingResponse,t=>{t&&this._cancelActiveSession()},{initial:!0}),u(()=>this._liveTranscript,t=>{if(t){let s=h(`${this._transcript} ${t}`);this.arcgisVoiceInputInterimTranscription.emit({transcript:s}),this._applyVoiceInputTranscript(s)}}),u(()=>this._transcript,t=>{t&&(this.arcgisVoiceInputTranscription.emit({transcript:t}),this._applyVoiceInputTranscript(t,{final:!0}))}),u(()=>this._state,t=>{t==="error"&&this._errorCode&&this.arcgisVoiceInputError.emit({errorCode:this._errorCode})})])}disconnectedCallback(){super.disconnectedCallback(),this._destroySpeechController()}_configureController(){let t=this._resolveMode();this._destroySpeechController(),this._resolvedMode=t,t!=="disabled"&&(this._speechController=t==="web-speech"?new _({language:this.language}):new c({language:this.language,handleRecording:this._handleRecording.bind(this)}))}_destroySpeechController(){this._speechController?.cancel(),this._speechController?.destroy(),this._speechController=void 0}_emitDraftChange(t,s){this.arcgisVoiceInputDraftChange.emit({focusInput:s?.focusInput,value:t})}_startVoiceInputSession(){this.#t={baseValue:this.inputValue.trim(),phase:"listening",transcript:""}}_finishVoiceInputSession(){let t=this.#t;if(!t){this._emitDraftChange(this.inputValue.trim());return}let s={...t,phase:"stopped"},i=b(s);this.#t=s,this._emitDraftChange(i)}async _applyVoiceInputTranscript(t,s){let i=this.#t;if(!t||!i)return;if(i.phase==="stopped"){let o=b(i);if(this.inputValue.trim()!==o){this.clearDraftSession();return}}let r={...i,transcript:t},n=b(r);this.#t=r,this._emitDraftChange(n,{focusInput:s?.final&&r.phase==="stopped"})}async _handleToggle(){if(!(this._isButtonDisabled||!this._speechController)){if(this._state==="listening"){this._speechController.stop(),this._finishVoiceInputSession(),this.arcgisVoiceInputStop.emit();return}this._speechController.start(),this._startVoiceInputSession(),this.arcgisVoiceInputStart.emit()}}async _handleRecording(t,s,i,r){let n;return this.arcgisVoiceInputTranscriptionStreamChunk.emit({blob:t,chunkIndex:i,isFinal:r,mimeType:s,respondWithTranscript:o=>{n=o}}),n}_resolveMode(){return this.mode==="disabled"?"disabled":this.mode==="web-speech"&&_.isSupported()?"web-speech":c.isSupported()?"media-recorder":"disabled"}async _cancelActiveSession(){this._speechController&&this._resolvedMode!=="disabled"&&this._speechController.cancel(),this.clearDraftSession()}render(){return S`<calcite-button appearance=transparent class="button" data-mode=${this._resolvedMode??m} data-state=${(this._resolvedMode==="disabled"?"disabled":this._state)??m} .disabled=${this._isButtonDisabled} icon-start=microphone kind=neutral .label=${this._buttonLabel} .loading=${this._state==="processing"} round scale=m @click=${()=>{this._handleToggle()}}></calcite-button>`}};y("arcgis-assistant-speech-input",v);return v},"core/reactiveUtils","core/Accessor","core/accessorSupport/decorators")
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{g as o,h as i,v as p,y as a}from"./OH64RMOR.js";import"./YIMNOUTF.js";var n=o`:host{display:block}`,t=class extends p{static{this.properties={block:0}}static{this.styles=n}_renderSuggestedPrompts(s){if(s.type!=="suggested-prompts")return null;let r=s.data?.prompts,e=Array.isArray(r)?r.filter(l=>typeof l=="string"):[];return e.length?i`<arcgis-assistant-suggested-prompts .prompts=${e}></arcgis-assistant-suggested-prompts>`:null}_renderBlock(s){return s.type==="suggested-prompts"?this._renderSuggestedPrompts(s):null}render(){return this.block?this._renderBlock(this.block):null}};a("arcgis-assistant-message-block",t);export{t as ArcgisAssistantMessageBlock};
@@ -1,16 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import d from"./SZOVY2QU.js";import c from"./METXWS7V.js";import a from"./N2VQD46V.js";import{Fb as N,Q as k,a as V,b as E}from"./462JBSEV.js";import{a as D,c as O}from"./HB5A5R2E.js";import"./AMP6IALT.js";import"./OAVEHGB6.js";import{v as b,y as A}from"./OH64RMOR.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,,K,X,,,{f:o,k:z,m:T},{C:R,D:G,E:F,F:P,G:L,H:U,a:j,m:w,n:M,o:p,p:Q},I])=>{var Y=async(e,t)=>(await o({text:"Exiting Data Exploration agent"},t),e),Z=async(e,t)=>{await o({text:"Requesting LLM for layer filter results"},t);let a=await w("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:d,userTimezoneOffset:n}=F(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:n,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},s=await T({promptText:a,modelTier:"advanced",messages:e.dataExplorationMessages,inputVariables:i,tools:L}),r=[...e.dataExplorationMessages,s];if(!((s.tool_calls?.length??0)>0))return await o({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:r};let u=[...r,s],c=s.content.toString();return await I(s,t),{...e,dataExplorationMessages:u,outputMessage:c}},ee=async(e,t)=>{await o({text:"Requesting LLM for layer query results"},t);let a=await w("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:d,userTimezoneOffset:n}=F(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:n,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},s=await T({promptText:a,modelTier:"advanced",messages:e.dataExplorationMessages,inputVariables:i,tools:P}),r=s.content.toString();return await I(s,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,s],outputMessage:r,status:"success",summary:r?M(r):"Query executed."}},te=async(e,t)=>{try{await o({text:"Requesting LLM for summary on query results"},t);let a=await w("summarize_query_response_prompt"),d={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},n=await z({promptText:a,modelTier:"fast",messages:e.dataExplorationMessages,inputVariables:d}),i=typeof n=="string"?n:n.content,s=new k(i);await o({text:`Received response from LLM: ${i}`},t);let r=i;return{...e,outputMessage:r,status:"success",summary:r?M(r):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,s]}}catch(a){throw await o({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function ae(e,t){let a=await new j(L).invoke({messages:e.dataExplorationMessages},t);return await o({text:`Finished executing layer filter tool: ${a.messages.map(d=>d.content).join(", ")}`},t),{...e}}var se=10,re=["string","small-integer","integer"],ie=async(e,t,{includeSummaryStatistics:a=!0,includeUniqueValues:d=!0}={})=>{let n=null,i=null;try{if(t.type!=="geometry"&&t.type!=="oid"&&t.type!=="global-id"){a&&(n=await K({layer:e,field:t.name}));let s=t.domain?.type==="coded-value"?t.domain:null;d&&(re.includes(t.type)||s)&&(i=(await X({layer:e,field:t.name})).uniqueValueInfos.sort((r,u)=>u.count-r.count).slice(0,se),s&&(i=i.map(r=>({...r,value:s.getName(r.value)??r.value}))))}}catch(s){console.error(`Error fetching statistics for field ${t.name}:`,s)}return{summaryStatistics:n,uniqueValues:i}};function oe(e,t){return["string","small-integer","integer"].includes(e)||t==="coded-value"}async function ne(e,t,a,d=!0){let n=[],i=[],s=[];for(let r of e){let u=function(g){let l=t.get(g)?.layerItem;return l?[l.name&&`Name: ${l.name}`,l.title&&`Title: ${l.title}`,l.description&&`Description: ${l.description}`].filter(Boolean).join(" | "):g},{layerId:c,results:m}=r,f=a.map?.allLayers.find(g=>g.id===c),S=t.get(c)?.fieldRegistry;if(!S)continue;let h=n.find(g=>g.layerId===c);h||(h={layerId:c,layerSummary:u(c),fieldInfos:[]},n.push(h));for(let g of m){let l=S.get(g.name);if(!l)continue;let y=l.statistics,v=d&&!y?.summaryStatistics,q=oe(l.type,l.domain?.type)&&!y?.uniqueValues,$=v||q;if(s.push({layerId:c,fieldName:l.name,didFetchStatistics:$}),$){let J=ie(f,l,{includeSummaryStatistics:v,includeUniqueValues:q}).then(C=>{let x={summaryStatistics:y?.summaryStatistics??null,uniqueValues:y?.uniqueValues??null};v&&(x.summaryStatistics=C.summaryStatistics),q&&(x.uniqueValues=C.uniqueValues),S.set(l.name,{...l,statistics:x}),l.statistics=x});i.push(J)}h.fieldInfos.push(l)}}return await Promise.all(i),{layerFieldInfo:n,didFetchStatistics:i.length>0,fieldStatisticsFetchStatus:s}}var W=/\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;function le(e,t){return W.test(e)||W.test(t)}var de=async(e,t)=>{try{await o({text:"Preparing field information for vector search results"},t);let a=p(t,"layersAndFieldsRegistry"),{mapView:d}=G(t),{assignedTask:n,userRequest:i}=e.agentExecutionContext,s=le(n,i),{layerFieldInfo:r,didFetchStatistics:u,fieldStatisticsFetchStatus:c}=await ne(e.vectorSearchFieldResults,a,d,s);u?await o({text:"Statistics fetched"},t):await o({text:"Statistics skipped"},t);for(let m of c)await o({text:` - ${m.fieldName} - stats ${m.didFetchStatistics?"fetched":"skipped"}`},t);return await o({text:"Field information prepared"},t),{...e,layerFieldInfo:r}}catch(a){throw await o({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},B=.7,ce=10,ue=async(e,t)=>{try{await o({text:"Similarity search to find fields"},t);let a=p(t,"fieldSearch"),d=p(t,"layersAndFieldsRegistry"),n=p(t,"embeddingCache"),i=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:B,topResults:ce,embeddingCache:n}),s=i.map(({layerId:u,results:c})=>{let m=c.map(f=>` - ${f.name} (${f.score.toFixed(2)})`).join(`
3
- `);return`${d.get(u)?.layerItem.name??u}:
4
- ${m}`}).join(`
5
- `),r;return i.length>0?r=`Vector search completed. Matching layers and fields with scores:
6
- ${s}`:r=`No vector search results found for score over ${B}.`,await o({text:r},t),{...e,vectorSearchFieldResults:i}}catch(a){throw await o({text:`Error during vector search: ${a instanceof Error?a.message:String(a)}`},t),new Error(`Vector search failed: ${a instanceof Error?a.message:String(a)}`)}},me=.7,ge=async(e,t)=>{try{await o({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=p(t,"layerSearch"),d=p(t,"layersAndFieldsRegistry"),n=p(t,"embeddingCache"),i=await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:me,embeddingCache:n}),s=i.map(c=>c.id),r=i.map(({id:c,score:m})=>`${d.get(c)?.layerItem.name??c} (${m.toFixed(2)})`).join(`
7
- `),u;return s.length>0?u=`Vector search completed. Matching layers with scores:
8
- ${r}`:u="Vector search completed. No matching layers found.",await o({text:u},t),{...e,vectorSearchLayerIds:s}}catch(a){throw await o({text:`Error during vector search: ${a instanceof Error?a.message:String(a)}`},t),new Error(`Vector search failed: ${a instanceof Error?a.message:String(a)}`)}},pe=(e,t)=>Q(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Data Exploration Agent")(e,t),fe=()=>new N(R).addNode("requireDataExplorationServices",pe).addNode("vectorSearchLayers",ge).addNode("vectorSearchFields",ue).addNode("fieldStatistics",de).addNode("queryAgent",ee).addNode("queryTools",U).addNode("summarizeQueryResponseLLM",te).addNode("filterAgent",Z).addNode("filterTools",ae).addNode("earlyExit",Y).addEdge(V,"requireDataExplorationServices").addEdge("requireDataExplorationServices","vectorSearchLayers").addConditionalEdges("vectorSearchLayers",e=>e.vectorSearchLayerIds.length?"vectorSearchFields":"earlyExit").addConditionalEdges("vectorSearchFields",e=>e.vectorSearchFieldResults.length?"fieldStatistics":"earlyExit").addEdge("fieldStatistics","queryAgent").addConditionalEdges("queryAgent",e=>(e.dataExplorationMessages[e.dataExplorationMessages.length-1]?.tool_calls?.length??0)>0?"queryTools":"filterAgent").addConditionalEdges("queryTools",e=>e.queryResponse.length?"summarizeQueryResponseLLM":"filterAgent").addEdge("summarizeQueryResponseLLM","filterAgent").addConditionalEdges("filterAgent",e=>(e.dataExplorationMessages[e.dataExplorationMessages.length-1]?.tool_calls?.length??0)>0?"filterTools":E).addEdge("filterTools",E).addEdge("earlyExit",E),he=String.raw`- **data exploration** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. And/Or user wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
9
- The Data Exploration Agent will automatically zoom to the affected features for action taken by this agent. In this case, no need to call navigation tool separately.
10
- _Example: “Only show stations where Brand is Shell”_
11
- _Example: “Make Shell stations stand out on the map”_
12
- _Example: “Gray out all stations that aren’t Shell”_
13
- This also includes questions that ask which feature meets a given condition or where a particular feature in the data is located (e.g., “Where is the spring with the highest elevation?”). However, this agent does not handle addresses.
14
- _Example: “How many features are there?”_
15
- _Example: “What’s the average population?”_
16
- _Example: “Which values are in the status field?”_`,H={id:"dataExploration",name:"Data Exploration Agent",description:he,createGraph:fe,workspace:R};var _=class extends b{constructor(){super(...arguments),this.agent=H}static{this.properties={referenceElement:1}}#e;getContext(){if(!this.#e)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#e}}load(){this.#e=D(this,"arcgis-assistant-data-exploration-agent"),O(this)}};A("arcgis-assistant-data-exploration-agent",_);return _},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,c,d)
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as i,b as l}from"./7GH7VSB2.js";import{a as f}from"./MH5RPXHM.js";import"./OAVEHGB6.js";import{g as m,h as a,v as g,w as o,y as b}from"./OH64RMOR.js";import"./YIMNOUTF.js";var p=m`:host{display:block;container-type:inline-size}.container{display:flex;flex-direction:column;align-items:flex-start;gap:var(--calcite-spacing-sm);width:100%;text-align:left}.icon{padding:var(--calcite-spacing-sm);border-radius:var(--calcite-spacing-xl);background:var(--calcite-color-brand);color:var(--calcite-color-foreground-1)}.content-container{display:flex;flex:1;flex-direction:column;width:100%;gap:var(--calcite-spacing-md)}.content,.blocks{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm)}@container (min-width: 480px){.container{max-width:80%}}`;function h({message:s}){let e=new Map;if(!s)return e;let t=i(s.id);return e.set(t,{data:{message:s},name:"message",slotName:t}),s.blocks?.forEach((r,n)=>{let d=l(s.id,n);e.set(d,{data:{block:r,index:n,message:s},name:"block",slotName:d})}),e}var c=class extends g{constructor(){super(...arguments),this.arcgisSlottableRequest=f(this,["message"],h),this.feedbackEnabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.readAloudEnabled=!1,this.footerDisabled=!1}static{this.properties={feedbackEnabled:5,logEnabled:5,copyEnabled:5,readAloudEnabled:5,footerDisabled:5,message:0}}static{this.styles=p}_renderContent(){let e=this.message,t=e?.id;if(t)return a`<div class="content"><slot name=${i(t)??o}></slot>${e.blocks?.length?a`<div class="blocks">${e.blocks.map((r,n)=>a`<slot name=${l(t,n)??o}></slot>`)}</div>`:null}</div>`}_renderFooter(){return a`<arcgis-assistant-message-footer .message=${this.message} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled}></arcgis-assistant-message-footer>`}render(){return a`<div class="container"><slot name=icon><calcite-icon icon=effects class="icon" scale=s></calcite-icon></slot><div class="content-container"><slot name=content>${this._renderContent()}</slot>${this.footerDisabled?null:a`<slot name=footer>${this._renderFooter()}</slot>`}</div></div>`}};b("arcgis-assistant-message",c);export{c as ArcgisAssistantMessage};
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as l}from"./H7422XUG.js";import"./MH5RPXHM.js";import"./OAVEHGB6.js";import{h as e,n as s,v as a,y as c}from"./OH64RMOR.js";import"./YIMNOUTF.js";var i=class extends a{constructor(){super(...arguments),this.#t=[],this._messages=l({blocking:!0}),this.arcgisCancel=s(),this.arcgisSubmit=s()}static{this.properties={type:1,message:1,options:0}}#t;_renderInterruptOptions(){switch(this.type){case"single-select":return e`<calcite-list selection-mode=single-persist .label=${this._messages.optionsLabel} @calciteListChange=${t=>this.#t=t.target.selectedItems[0]?.value}>${this.options?.map(t=>e`<calcite-list-item .label=${t} .value=${t}></calcite-list-item>`)}</calcite-list>`;case"multi-select":return e`<calcite-list selection-mode=multiple .label=${this._messages.optionsLabel} @calciteListChange=${t=>this.#t=t.target.selectedItems.map(n=>n.value)}>${this.options?.map(t=>e`<calcite-list-item .label=${t} .value=${t}></calcite-list-item>`)}</calcite-list>`;case"boolean-choice":return null;case"text-input":return e`<calcite-input .label=${this._messages.enterTextLabel} @calciteInputInput=${t=>this.#t=t.target.value}></calcite-input>`}}render(){return e`<calcite-panel .description=${this.message}>${this._renderInterruptOptions()}<calcite-button slot=footer-end appearance=outline @click=${()=>this.arcgisCancel.emit()}>${this._messages.cancelButtonLabel}</calcite-button><calcite-button slot=footer-end appearance=solid @click=${()=>this.arcgisSubmit.emit(this.type==="boolean-choice"?!0:this.#t)}>${this._messages.submitButtonLabel}</calcite-button></calcite-panel>`}};c("arcgis-assistant-interrupt",i);export{i as ArcgisAssistantInterrupt};