@arcgis/ai-components 5.2.0-next.38 → 5.2.0-next.39

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 (93) hide show
  1. package/dist/cdn/{E2JBQWHX.js → 37Q23IS4.js} +1 -1
  2. package/dist/cdn/{QA7IATZC.js → 3OH4DXSY.js} +1 -1
  3. package/dist/cdn/{5W7S2RS4.js → 3UEKINYC.js} +1 -1
  4. package/dist/cdn/{D36UDLAY.js → 3Y5INO72.js} +1 -1
  5. package/dist/cdn/{DEAYZ3MK.js → 4G5XCUE5.js} +1 -1
  6. package/dist/cdn/{SHFSDORL.js → 5SW5CPQT.js} +1 -1
  7. package/dist/cdn/{TIEV263K.js → 5VTVHDQ5.js} +1 -1
  8. package/dist/cdn/{YJ3QQXF6.js → 6G5DYYYU.js} +1 -1
  9. package/dist/cdn/{FDPJ5Y3M.js → 6JX2ACRF.js} +1 -1
  10. package/dist/cdn/{5SBLS4NW.js → 7YIRK2E3.js} +1 -1
  11. package/dist/cdn/{CAECQD75.js → A4JLOAOH.js} +1 -1
  12. package/dist/cdn/{P22UEKRX.js → AFKLWPPM.js} +1 -1
  13. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  14. package/dist/cdn/{Q7TL5Q5N.js → APFZY4PI.js} +1 -1
  15. package/dist/cdn/{NOJYPREL.js → B7YAMTIH.js} +1 -1
  16. package/dist/cdn/{DFF2LGQI.js → BF2IYMM6.js} +1 -1
  17. package/dist/cdn/{X7GE26KU.js → BL273EGZ.js} +1 -1
  18. package/dist/cdn/{RMLXVQZ5.js → BMGQJYTE.js} +1 -1
  19. package/dist/cdn/{XXIKORXX.js → BNJFXDJV.js} +1 -1
  20. package/dist/cdn/{QJJ6YSAC.js → BST5ZU46.js} +1 -1
  21. package/dist/cdn/{EJ2LRQVR.js → C7DSVDSP.js} +1 -1
  22. package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
  23. package/dist/cdn/{FNFJYOHX.js → D664PQPF.js} +1 -1
  24. package/dist/cdn/{JN744CAW.js → DMLRWHBA.js} +1 -1
  25. package/dist/cdn/{XHJTT7BG.js → E54QF5FR.js} +1 -1
  26. package/dist/cdn/{VAX3IAC3.js → EIPHHMWX.js} +2 -2
  27. package/dist/cdn/{2K3FTW7J.js → F3VYFN2Q.js} +1 -1
  28. package/dist/cdn/F5SUU35Z.js +2 -0
  29. package/dist/cdn/{IBKTXP76.js → FNBXR5WD.js} +1 -1
  30. package/dist/cdn/{I4A2LAZS.js → FQ5XLE4I.js} +1 -1
  31. package/dist/cdn/{NV2KTZTO.js → FY7YTXS4.js} +1 -1
  32. package/dist/cdn/{T537PKP4.js → FYZATVB3.js} +1 -1
  33. package/dist/cdn/{B7W5WD4R.js → GPVY5GM6.js} +1 -1
  34. package/dist/cdn/{E2HENO3T.js → GYVSHAUI.js} +1 -1
  35. package/dist/cdn/{32B6ZVYG.js → HBUW4KGU.js} +1 -1
  36. package/dist/cdn/{3X7JLPXS.js → HJG7QM2R.js} +1 -1
  37. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  38. package/dist/cdn/{ZMSJQB65.js → IHP25JWI.js} +1 -1
  39. package/dist/cdn/{LEPJUN3X.js → J6A4AS7E.js} +1 -1
  40. package/dist/cdn/{KTK4HNL2.js → JEBRN3EU.js} +1 -1
  41. package/dist/cdn/{FWU6DFIB.js → JEL5M7FA.js} +1 -1
  42. package/dist/cdn/{HW2FV2RU.js → JMODFBN6.js} +2 -2
  43. package/dist/cdn/{ZOSUDIJH.js → JVYPIWEU.js} +1 -1
  44. package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
  45. package/dist/cdn/{MU52B4SV.js → LUY6V4TP.js} +1 -1
  46. package/dist/cdn/{IB4WTK74.js → M2DEBF5S.js} +1 -1
  47. package/dist/cdn/{PA5W5PWE.js → M3MRIGDZ.js} +1 -1
  48. package/dist/cdn/{I5QIEV37.js → MHMBHWYX.js} +1 -1
  49. package/dist/cdn/{3RPE2QMJ.js → MMRRNKWJ.js} +1 -1
  50. package/dist/cdn/{27NEUQN3.js → MS5EA2KY.js} +1 -1
  51. package/dist/cdn/{ZEYIBYSF.js → MWYBF3F3.js} +1 -1
  52. package/dist/cdn/{MAV3DW27.js → NAKAZDJ7.js} +1 -1
  53. package/dist/cdn/{4I4MCV7V.js → NEV6OZN3.js} +1 -1
  54. package/dist/cdn/{WH6QQK6N.js → OGMMYFHR.js} +1 -1
  55. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  56. package/dist/cdn/{7GE723EX.js → OYNIFMCJ.js} +1 -1
  57. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  58. package/dist/cdn/{FK7ENS6I.js → PRN4OPLW.js} +1 -1
  59. package/dist/cdn/RLEHNAIA.js +2 -0
  60. package/dist/cdn/{XNITXZDU.js → SBP6WNDY.js} +1 -1
  61. package/dist/cdn/{TNMXWUXU.js → SDWWUWAF.js} +1 -1
  62. package/dist/cdn/{M3SWPT3M.js → SJR4IR57.js} +1 -1
  63. package/dist/cdn/{Y7KEZCVG.js → SKXDXIQO.js} +1 -1
  64. package/dist/cdn/{PSWI3MFB.js → SPVOBZAL.js} +1 -1
  65. package/dist/cdn/{BLKXZEPZ.js → SYEI4BB2.js} +1 -1
  66. package/dist/cdn/{53TGCGSX.js → TI7K3I3K.js} +1 -1
  67. package/dist/cdn/{W2IHPJ54.js → TPULIO6I.js} +1 -1
  68. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  69. package/dist/cdn/{RHM3WKYV.js → UK7PR2FE.js} +1 -1
  70. package/dist/cdn/UZLQALHY.js +2 -0
  71. package/dist/cdn/{W2JAKE2M.js → V6HOUZPZ.js} +1 -1
  72. package/dist/cdn/{3AXQTBIA.js → VAXH6RUQ.js} +1 -1
  73. package/dist/cdn/{WNS5ZUF5.js → VXFQANGJ.js} +1 -1
  74. package/dist/cdn/{RX45PCYB.js → WSGWTIAV.js} +1 -1
  75. package/dist/cdn/{TKSWXCCJ.js → XFL2VQFM.js} +1 -1
  76. package/dist/cdn/{GJHBXGNP.js → XNWCRFTJ.js} +1 -1
  77. package/dist/cdn/{ZPLFFLPF.js → YYSMCB4A.js} +1 -1
  78. package/dist/cdn/{I64KIZG3.js → ZB57WYHC.js} +1 -1
  79. package/dist/cdn/{ON5PWODA.js → ZQ7PGNWB.js} +1 -1
  80. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  81. package/dist/cdn/agent-utils/index.js +1 -1
  82. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
  83. package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
  84. package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
  85. package/dist/cdn/index.js +1 -1
  86. package/dist/docs/api.json +1 -1
  87. package/dist/docs/docs.json +1 -1
  88. package/dist/docs/web-types.json +1 -1
  89. package/package.json +4 -4
  90. package/dist/cdn/NXKKG5TK.js +0 -2
  91. package/dist/cdn/QSA4T3BU.js +0 -2
  92. package/dist/cdn/YIMNOUTF.js +0 -2
  93. /package/dist/cdn/{ADYIXCSG.js → R74ZHFA6.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./QA7IATZC.js";import{c as l}from"./XNITXZDU.js";import"./ON5PWODA.js";import"./MU52B4SV.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([{property:g,subclass:u},{d:w}])=>{var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,c=(o,r,n,s)=>{for(var e=s>1?void 0:s?m(r,n):r,a=o.length-1,t;a>=0;a--)(t=o[a])&&(e=(s?t(r,n,e):t(e))||e);return s&&e&&f(r,n,e),e},p=class extends w{constructor(o){super(o)}getAgents(){return this.workflow.getAgents()}generate(){let o=this.workflow.generate(),r=o.workspace,n=o.createGraph().compile(),{decideContinue:s}=this,e={[i]:async(t,d)=>await n.invoke(t,d)},a=[{from:i,decide:async(t,d)=>await Promise.resolve(s(t,d))?i:void 0}];return{workspace:r,createGraph:()=>l(e,a,r,{entryNode:i})}}buildEdges(){throw new Error("LoopWorkflow overrides generate(); buildEdges should not be called.")}getEntryNode(){return i}isTerminalAgent(){return!0}};c([g()],p.prototype,"workflow",2);c([g()],p.prototype,"decideContinue",2);p=c([u("LoopWorkflow")],p);var i="__loop_body";return p},"core/accessorSupport/decorators",a)
2
+ import a from"./3OH4DXSY.js";import{c as l}from"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:u},{d:w}])=>{var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,c=(o,r,n,s)=>{for(var e=s>1?void 0:s?m(r,n):r,a=o.length-1,t;a>=0;a--)(t=o[a])&&(e=(s?t(r,n,e):t(e))||e);return s&&e&&f(r,n,e),e},p=class extends w{constructor(o){super(o)}getAgents(){return this.workflow.getAgents()}generate(){let o=this.workflow.generate(),r=o.workspace,n=o.createGraph().compile(),{decideContinue:s}=this,e={[i]:async(t,d)=>await n.invoke(t,d)},a=[{from:i,decide:async(t,d)=>await Promise.resolve(s(t,d))?i:void 0}];return{workspace:r,createGraph:()=>l(e,a,r,{entryNode:i})}}buildEdges(){throw new Error("LoopWorkflow overrides generate(); buildEdges should not be called.")}getEntryNode(){return i}isTerminalAgent(){return!0}};c([g()],p.prototype,"workflow",2);c([g()],p.prototype,"decideContinue",2);p=c([u("LoopWorkflow")],p);var i="__loop_body";return p},"core/accessorSupport/decorators",a)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var e=`## Task: Summarize Geographic Features
2
+ import"./UZLQALHY.js";var e=`## Task: Summarize Geographic Features
3
3
 
4
4
  You are given features from ArcGIS Feature layer for multiple layers:
5
5
  {queryResponse}
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./RHM3WKYV.js";import b from"./VAX3IAC3.js";import a from"./HW2FV2RU.js";import{a as i}from"./3X7JLPXS.js";import{Va as S,a as u,b as p,s as f}from"./ON5PWODA.js";export default $arcgis.t(([,,,,,,{r:x},{A:_,B:h,a:w,m:E,o:y,p:I,q:L,r:v,s:F,t:$,u:C,v:N,w:R,x:T,y:b,z:A},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await i({text:"Similarity search to find fields"},t);let e=y(t,"fieldSearch"),n=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let g=c.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
2
+ import c from"./UK7PR2FE.js";import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as i}from"./HJG7QM2R.js";import{Va as S,a as u,b as p,s as f}from"./ZQ7PGNWB.js";export default $arcgis.t(([,,,,,,{r:x},{A:_,B:h,a:w,m:E,o:y,p:I,q:L,r:v,s:F,t:$,u:C,v:N,w:R,x:T,y:b,z:A},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await i({text:"Similarity search to find fields"},t);let e=y(t,"fieldSearch"),n=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let g=c.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
3
3
  `);return`${n.get(d)?.layerItem.name??d}:
4
4
  ${g}`}).join(`
5
5
  `),l;return r.length>0?l=`Vector search completed. Matching layers and fields with scores:
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{b as r}from"./QSA4T3BU.js";import{A as o}from"./MAV3DW27.js";var s=r(o);export{s as a};
2
+ import{b as r}from"./F5SUU35Z.js";import{A as o}from"./NAKAZDJ7.js";var s=r(o);export{s as a};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./VAX3IAC3.js";import a from"./HW2FV2RU.js";import{a as m}from"./3X7JLPXS.js";import{Va as $,a as k,b as E}from"./ON5PWODA.js";import{a as f}from"./WNS5ZUF5.js";export default $arcgis.t(([,,,,,,{q:N,r:T},{a:b,b:v,c:x,d:C,e:F,f:R,g:L,h:_,i:I,j:M,k:Z,l:A,m:S,n:q,o:p,p:j}])=>{var w=[C,F,R,L,_,I,M,Z,A];async function G(e,t){let a=await S("navigation_tool_prompt"),{mapView:r}=x(t),c=r.map.bookmarks?.map(h=>h.name).filter(Boolean)??[],s=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((h,z)=>`${z+1}. layerId=${h.id} | title=${h.title??""} | name=${h.name??""} | score=${h.score.toFixed(2)}`).join(`
2
+ import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as m}from"./HJG7QM2R.js";import{Va as $,a as k,b as E}from"./ZQ7PGNWB.js";import{a as f}from"./VXFQANGJ.js";export default $arcgis.t(([,,,,,,{q:N,r:T},{a:b,b:v,c:x,d:C,e:F,f:R,g:L,h:_,i:I,j:M,k:Z,l:A,m:S,n:q,o:p,p:j}])=>{var w=[C,F,R,L,_,I,M,Z,A];async function G(e,t){let a=await S("navigation_tool_prompt"),{mapView:r}=x(t),c=r.map.bookmarks?.map(h=>h.name).filter(Boolean)??[],s=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((h,z)=>`${z+1}. layerId=${h.id} | title=${h.title??""} | name=${h.name??""} | score=${h.score.toFixed(2)}`).join(`
3
3
  `):"",l=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",i=e.intent==="goToBookmark"&&c.length?`Available bookmarks:
4
4
  ${c.map(h=>`- ${h}`).join(`
5
5
  `)}`:"",o=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Wa as i}from"./MU52B4SV.js";async function n(a,t,e){if(e===void 0)throw new Error(["Unable to dispatch a custom event without a parent run id.",'"dispatchCustomEvent" can only be called from within an existing run (e.g.,',"inside a tool or a RunnableLambda).",`
2
+ import{Wa as i}from"./LUY6V4TP.js";async function n(a,t,e){if(e===void 0)throw new Error(["Unable to dispatch a custom event without a parent run id.",'"dispatchCustomEvent" can only be called from within an existing run (e.g.,',"inside a tool or a RunnableLambda).",`
3
3
 
4
4
  If you continue to see this error, please import from "@langchain/core/callbacks/dispatch/web"`,"and explicitly pass in a config parameter.",`
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var e=`# ArcGIS Online Map Viewer \u2014 Smart Mapping Assistant
2
+ import"./UZLQALHY.js";var e=`# ArcGIS Online Map Viewer \u2014 Smart Mapping Assistant
3
3
 
4
4
  You are a Smart Mapping Assistant for ArcGIS Online Map Viewer.
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var e=`# ArcGIS Knowledge Graph Cypher Rules
2
+ import"./UZLQALHY.js";var e=`# ArcGIS Knowledge Graph Cypher Rules
3
3
 
4
4
  ## GOAL
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var e=`## Membership Bind Parameters
2
+ import"./UZLQALHY.js";var e=`## Membership Bind Parameters
3
3
 
4
4
  The current link chart contains a subset of entities and relationships from the database. Their membership is available to Cypher queries as lists of string identifiers through these bind parameters:
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var e=`## Navigation Agent - Tool Intent Classifier
2
+ import"./UZLQALHY.js";var e=`## Navigation Agent - Tool Intent Classifier
3
3
 
4
4
  You are an assistant that classifies the assigned task intent for navigation agent.
5
5
 
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as o}from"./E2HENO3T.js";import"./QSA4T3BU.js";import"./NXKKG5TK.js";import{g as a,h as e,n as i,v as c,z as n}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./YIMNOUTF.js";var r=a`.actions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs)}`,t=class extends c{constructor(){super(...arguments),this._messages=o({blocking:!0}),this.feedbackEnabled=!1,this.arcgisFeedback=i()}static{this.properties={feedbackEnabled:5,message:0}}static{this.styles=r}_handleFeedback(s){this.message&&(this.message.feedback=this.message.feedback?.positive===s?void 0:{positive:s},this.arcgisFeedback.emit(this.message),this.requestUpdate())}_getFeedback(){return this.message?.feedback?.positive}_renderThumbsUpButton(){return e`<calcite-action id=action-thumbs-up icon=thumbs-up scale=s .active=${this._getFeedback()===!0} @click=${()=>this._handleFeedback(!0)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-up overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsUpLabel}</span></calcite-tooltip>`}_renderThumbsDownButton(){return e`<calcite-action id=action-thumbs-down icon=thumbs-down scale=s .active=${this._getFeedback()===!1} @click=${()=>this._handleFeedback(!1)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-down overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsDownLabel}</span></calcite-tooltip>`}render(){return this.feedbackEnabled&&!this.message?.error?e`<div class="actions">${this._renderThumbsUpButton()}${this._renderThumbsDownButton()}</div>`:null}};n("arcgis-assistant-message-feedback",t);export{t as ArcgisAssistantMessageFeedback};
2
+ import{a as o}from"./GYVSHAUI.js";import"./F5SUU35Z.js";import"./RLEHNAIA.js";import{g as a,h as e,n as i,v as c,z as n}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var r=a`.actions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs)}`,t=class extends c{constructor(){super(...arguments),this._messages=o({blocking:!0}),this.feedbackEnabled=!1,this.arcgisFeedback=i()}static{this.properties={feedbackEnabled:5,message:0}}static{this.styles=r}_handleFeedback(s){this.message&&(this.message.feedback=this.message.feedback?.positive===s?void 0:{positive:s},this.arcgisFeedback.emit(this.message),this.requestUpdate())}_getFeedback(){return this.message?.feedback?.positive}_renderThumbsUpButton(){return e`<calcite-action id=action-thumbs-up icon=thumbs-up scale=s .active=${this._getFeedback()===!0} @click=${()=>this._handleFeedback(!0)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-up overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsUpLabel}</span></calcite-tooltip>`}_renderThumbsDownButton(){return e`<calcite-action id=action-thumbs-down icon=thumbs-down scale=s .active=${this._getFeedback()===!1} @click=${()=>this._handleFeedback(!1)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-down overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsDownLabel}</span></calcite-tooltip>`}render(){return this.feedbackEnabled&&!this.message?.error?e`<div class="actions">${this._renderThumbsUpButton()}${this._renderThumbsDownButton()}</div>`:null}};n("arcgis-assistant-message-feedback",t);export{t as ArcgisAssistantMessageFeedback};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{b as Go}from"./ADYIXCSG.js";import{a as rt}from"./3X7JLPXS.js";import{b as Ai,c as Ii,d as bi}from"./BLKXZEPZ.js";import{K as pi,L as mi,M as Bs,N as Fn,O as Dt,P as Bn,Q as di,R as fi,T as hi,U as _i,V as qs,W as gi,X as qn,Y as Wn,Z as yi,ha as re}from"./ON5PWODA.js";import{Ab as li,C as Un,D as Dn,E as Us,Sb as E,U as Ds,V as Qo,X as ei,Xb as Ut,ca as ae,da as Ls,fa as jt,fc as ci,ga as Ks,ha as ti,kb as ns,la as ri,o as Xo,ob as Kn,p as pe,pa as si,pb as ai,qb as ui,sb as os,tc as Fs,ua as Ln,v as Yo,w as js,xa as ni,yc as Ws}from"./MU52B4SV.js";import{a as ue}from"./WNS5ZUF5.js";import{$ as ii,Dd as x,j as oi}from"./ZEYIBYSF.js";export default $arcgis.t(([Yu,Zp,Vp])=>{function is(t,e){return t.lc_error_code=e,t.message=`${t.message}
2
+ import{b as Go}from"./R74ZHFA6.js";import{a as rt}from"./HJG7QM2R.js";import{b as Ai,c as Ii,d as bi}from"./SYEI4BB2.js";import{K as pi,L as mi,M as Bs,N as Fn,O as Dt,P as Bn,Q as di,R as fi,T as hi,U as _i,V as qs,W as gi,X as qn,Y as Wn,Z as yi,ha as re}from"./ZQ7PGNWB.js";import{Ab as li,C as Un,D as Dn,E as Us,Sb as E,U as Ds,V as Qo,X as ei,Xb as Ut,ca as ae,da as Ls,fa as jt,fc as ci,ga as Ks,ha as ti,kb as ns,la as ri,o as Xo,ob as Kn,p as pe,pa as si,pb as ai,qb as ui,sb as os,tc as Fs,ua as Ln,v as Yo,w as js,xa as ni,yc as Ws}from"./LUY6V4TP.js";import{a as ue}from"./VXFQANGJ.js";import{$ as ii,Dd as x,j as oi}from"./MWYBF3F3.js";export default $arcgis.t(([Yu,Zp,Vp])=>{function is(t,e){return t.lc_error_code=e,t.message=`${t.message}
3
3
 
4
4
  Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/
5
5
  `,t}function k(t,e,r,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function d(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}var Hn=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return Hn=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,s=>(+s^r()&15>>+s/4).toString(16))};function as(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var us=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var P=class extends Error{},U=class t extends P{constructor(e,r,s,n){super(`${t.makeMessage(e,r,s)}`),this.status=e,this.headers=n,this.requestID=n?.get("x-request-id"),this.error=r;let o=r;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,r,s){let n=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):s;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,r,s,n){if(!e||!n)return new Le({message:s,cause:us(r)});let o=r?.error;return e===400?new Lt(e,o,s,n):e===401?new Kt(e,o,s,n):e===403?new Ft(e,o,s,n):e===404?new Bt(e,o,s,n):e===409?new qt(e,o,s,n):e===422?new Wt(e,o,s,n):e===429?new Ht(e,o,s,n):e>=500?new Zt(e,o,s,n):new t(e,o,s,n)}},D=class extends U{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Le=class extends U{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Ae=class extends Le{constructor({message:e}={}){super({message:e??"Request timed out."})}},Lt=class extends U{},Kt=class extends U{},Ft=class extends U{},Bt=class extends U{},qt=class extends U{},Wt=class extends U{},Ht=class extends U{},Zt=class extends U{},Vt=class extends P{constructor(){super("Could not parse response content as the length limit was reached")}},Jt=class extends P{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Ie=class extends Error{constructor(e){super(e)}},st=class extends U{constructor(e,r,s){let n="OAuth2 authentication error",o;if(r&&typeof r=="object"){let i=r;o=i.error;let a=i.error_description;a&&typeof a=="string"?n=a:o&&(n=o)}super(e,r,n,s),this.error_code=o}},ls=class extends P{constructor(e,r,s){super(e),this.provider=r,this.cause=s}};var ll=/^[a-z][a-z0-9+.-]*:/i,xi=t=>ll.test(t),Y=t=>(Y=Array.isArray,Y(t)),Zn=Y;function Hs(t){return typeof t!="object"?{}:t??{}}function Vn(t){if(!t)return!0;for(let e in t)return!1;return!0}function wi(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function cs(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Pi=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new P(`${t} must be an integer`);if(e<0)throw new P(`${t} must be a positive integer`);return e};var Oi=t=>{try{return JSON.parse(t)}catch{return}};var be=t=>new Promise(e=>setTimeout(e,t));var Ke="6.45.0";var Ci=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function cl(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var pl=()=>{let t=cl();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":vi(Deno.build.os),"X-Stainless-Arch":ki(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":vi(globalThis.process.platform??"unknown"),"X-Stainless-Arch":ki(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=ml();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function ml(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let s=r.exec(navigator.userAgent);if(s){let n=s[1]||0,o=s[2]||0,i=s[3]||0;return{browser:e,version:`${n}.${o}.${i}`}}}return null}var ki=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",vi=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Ti,Ri=()=>Ti??(Ti=pl());function Zs(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Jn(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function Vs(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Jn({start(){},async pull(r){let{done:s,value:n}=await e.next();s?r.close():r.enqueue(n)},async cancel(){await e.return?.()}})}function Gn(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Xn(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var Si=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var Yn="RFC3986",Qn=t=>String(t),eo={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:Qn},$i="RFC1738";var Js=(t,e)=>(Js=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Js(t,e)),xe=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var to=1024,Mi=(t,e,r,s,n)=>{if(t.length===0)return t;let o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let i="";for(let a=0;a<o.length;a+=to){let c=o.length>=to?o.slice(a,a+to):o,u=[];for(let f=0;f<c.length;++f){let h=c.charCodeAt(f);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||n===$i&&(h===40||h===41)){u[u.length]=c.charAt(f);continue}if(h<128){u[u.length]=xe[h];continue}if(h<2048){u[u.length]=xe[192|h>>6]+xe[128|h&63];continue}if(h<55296||h>=57344){u[u.length]=xe[224|h>>12]+xe[128|h>>6&63]+xe[128|h&63];continue}f+=1,h=65536+((h&1023)<<10|c.charCodeAt(f)&1023),u[u.length]=xe[240|h>>18]+xe[128|h>>12&63]+xe[128|h>>6&63]+xe[128|h&63]}i+=u.join("")}return i};function Ni(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function ro(t,e){if(Y(t)){let r=[];for(let s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)}var ji={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Ui=function(t,e){Array.prototype.push.apply(t,Y(e)?e:[e])},zi,W={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Mi,encodeValuesOnly:!1,format:Yn,formatter:Qn,indices:!1,serializeDate(t){return(zi??(zi=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function fl(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var so={};function Di(t,e,r,s,n,o,i,a,c,u,f,h,y,A,I,b,_,m){let g=t,O=m,R=0,N=!1;for(;(O=O.get(so))!==void 0&&!N;){let F=O.get(t);if(R+=1,typeof F<"u"){if(F===R)throw new RangeError("Cyclic object value");N=!0}typeof O.get(so)>"u"&&(R=0)}if(typeof u=="function"?g=u(e,g):g instanceof Date?g=y?.(g):r==="comma"&&Y(g)&&(g=ro(g,function(F){return F instanceof Date?y?.(F):F})),g===null){if(o)return c&&!b?c(e,W.encoder,_,"key",A):e;g=""}if(fl(g)||Ni(g)){if(c){let F=b?e:c(e,W.encoder,_,"key",A);return[I?.(F)+"="+I?.(c(g,W.encoder,_,"value",A))]}return[I?.(e)+"="+I?.(String(g))]}let z=[];if(typeof g>"u")return z;let j;if(r==="comma"&&Y(g))b&&c&&(g=ro(g,c)),j=[{value:g.length>0?g.join(",")||null:void 0}];else if(Y(u))j=u;else{let F=Object.keys(g);j=f?F.sort(f):F}let L=a?String(e).replace(/\./g,"%2E"):String(e),X=s&&Y(g)&&g.length===1?L+"[]":L;if(n&&Y(g)&&g.length===0)return X+"[]";for(let F=0;F<j.length;++F){let q=j[F],Vo=typeof q=="object"&&typeof q.value<"u"?q.value:g[q];if(i&&Vo===null)continue;let jn=h&&a?q.replace(/\./g,"%2E"):q,al=Y(g)?typeof r=="function"?r(X,jn):X:X+(h?"."+jn:"["+jn+"]");m.set(t,R);let Jo=new WeakMap;Jo.set(so,m),Ui(z,Di(Vo,al,r,s,n,o,i,a,r==="comma"&&b&&Y(g)?null:c,u,f,h,y,A,I,b,_,Jo))}return z}function hl(t=W){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||W.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=Yn;if(typeof t.format<"u"){if(!Js(eo,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let s=eo[r],n=W.filter;(typeof t.filter=="function"||Y(t.filter))&&(n=t.filter);let o;if(t.arrayFormat&&t.arrayFormat in ji?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=W.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let i=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:W.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:W.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:W.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:W.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?W.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:W.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:W.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:W.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:W.encodeValuesOnly,filter:n,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:W.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:W.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:W.strictNullHandling}}function Li(t,e={}){let r=t,s=hl(e),n,o;typeof s.filter=="function"?(o=s.filter,r=o("",r)):Y(s.filter)&&(o=s.filter,n=o);let i=[];if(typeof r!="object"||r===null)return"";let a=ji[s.arrayFormat],c=a==="comma"&&s.commaRoundTrip;n||(n=Object.keys(r)),s.sort&&n.sort(s.sort);let u=new WeakMap;for(let y=0;y<n.length;++y){let A=n[y];s.skipNulls&&r[A]===null||Ui(i,Di(r[A],A,a,c,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,u))}let f=i.join(s.delimiter),h=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),f.length>0?h+f:""}function Ki(t){return Li(t,{arrayFormat:"brackets"})}function qi(t){let e=0;for(let n of t)e+=n.length;let r=new Uint8Array(e),s=0;for(let n of t)r.set(n,s),s+=n.length;return r}var Fi;function Gt(t){let e;return(Fi??(e=new globalThis.TextEncoder,Fi=e.encode.bind(e)))(t)}var Bi;function no(t){let e;return(Bi??(e=new globalThis.TextDecoder,Bi=e.decode.bind(e)))(t)}var se,ne,nt=class{constructor(){se.set(this,void 0),ne.set(this,void 0),k(this,se,new Uint8Array,"f"),k(this,ne,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Gt(e):e;k(this,se,qi([d(this,se,"f"),r]),"f");let s=[],n;for(;(n=gl(d(this,se,"f"),d(this,ne,"f")))!=null;){if(n.carriage&&d(this,ne,"f")==null){k(this,ne,n.index,"f");continue}if(d(this,ne,"f")!=null&&(n.index!==d(this,ne,"f")+1||n.carriage)){s.push(no(d(this,se,"f").subarray(0,d(this,ne,"f")-1))),k(this,se,d(this,se,"f").subarray(d(this,ne,"f")),"f"),k(this,ne,null,"f");continue}let o=d(this,ne,"f")!==null?n.preceding-1:n.preceding,i=no(d(this,se,"f").subarray(0,o));s.push(i),k(this,se,d(this,se,"f").subarray(n.index),"f"),k(this,ne,null,"f")}return s}flush(){return d(this,se,"f").length?this.decode(`
@@ -36,7 +36,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
36
36
 
37
37
  `);return n[n.length-1]?.trim()===r?t:`${t}
38
38
 
39
- ${r}`},sl=()=>({userRequest:"",assignedTask:"",messages:[],priorSteps:[],sharedState:{}}),Yp=()=>({agentExecutionContext:re({reducer:tl,default:sl}),outputMessage:re({reducer:rl,default:()=>""}),summary:re({reducer:ss,default:()=>""}),status:re({reducer:ss})}),DC=()=>({...Yp(),sharedStatePatch:re({reducer:ss})}),LC=re.Root({agentExecutionContext:re({default:sl,reducer:tl}),currentIntent:re({default:()=>"none",reducer:ss}),lastExecutedAgent:re({default:()=>"",reducer:ss}),requiresFollowUp:re({default:()=>!0,reducer:ss}),stepCount:re({default:()=>0,reducer:(t,e)=>e??t+1}),finalOutputMessage:re({default:()=>"",reducer:rl})}),Qp=t=>{if(!t||typeof t!="object"||!("services"in t))return!1;let e=t.services;return!!e&&typeof e=="object"&&"agentRegistry"in e},em=t=>{let e=t?.configurable;return Qp(e)?e:void 0},tm=(t,e,r)=>{let s=t[e];return s?typeof s=="function"?s():Promise.resolve(s):new Promise((n,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},Ho=async t=>(await tm(Object.assign({"./field_descriptions_prompt.md":()=>import("./ZTBA5PM7.js"),"./intent_prompt.md":()=>import("./X7GE26KU.js"),"./layer_descriptions_prompt.md":()=>import("./7RCQFLPP.js")}),`./${t}.md`,2)).default,rm=async t=>{let{agent:e,messages:r,config:s}=t;return{structuredResponse:(await e.invoke({messages:r},s)).structuredResponse}},sm=t=>typeof t=="string"&&t.length>0?t:void 0,nm=()=>Go(),om=t=>typeof t!="string"||t.trim().length===0?"MapsSDK":`MapsSDK - ${t.trim()}`,im=t=>{let e=t?.configurable;return{conversationId:sm(e?.thread_id),abortSignal:t?.signal,requestId:nm(),requestSource:om(Vp.applicationName)}},nl=async({config:t})=>{let e=Yu.getDefault(),r=(await Zp.getCredential(`${e.url}/sharing`))?.token;return async(s,n)=>{let{conversationId:o,abortSignal:i,requestId:a,requestSource:c}=im(t),u=new Headers(n?.headers);u.delete("Authorization"),u.delete("api-key"),r&&r.length>0&&(u.set("X-Esri-Authorization",`Bearer ${r}`),u.set("X-Esri-Request-Source",c)),o&&o.length>0&&u.set("X-Esri-Conversation-Id",o),a.length>0&&u.set("X-Esri-Request-Id",a);let f=i&&n?.signal?AbortSignal.any([i,n.signal]):n?.signal??i;return await fetch(s,{...n,headers:u,signal:f})}},zs=async(t={})=>{let{modelTier:e="default",temperature:r=0,config:s}=t,n=Qu[e],o=await Gp(e);return new Mn({modelName:n,apiKey:"dummy-key",...e!=="default"&&{temperature:r},configuration:{baseURL:o,fetch:await nl({config:s})}})},KC=async(t={})=>{let{tier:e="default",config:r}=t,s=Wo[e],n=await Xp(e);return new Nn({modelName:s,apiKey:"dummy-key",configuration:{baseURL:n,fetch:await nl({config:r})},batchSize:2048,maxConcurrency:10})},am=x.object({id:x.string().min(1),name:x.string().min(1),description:x.string().min(1)});x.array(am);var Gu=t=>JSON.stringify(t,null,2),um=t=>{let e=t.map(s=>s.id),r=x.enum(e);return x.object({intent:r.nullable(),assignedTask:x.string().nullable(),requiresFollowUp:x.boolean()})},FC=async(t,e)=>{let r=em(e);if(e?.signal?.aborted)return await rt({text:"Run cancelled; skipping intent routing"},e),{...t,currentIntent:"none",finalOutputMessage:"Operation cancelled.",requiresFollowUp:!1};try{await rt({text:"Asking LLM to route to an agent"},e);let s=r.services.agentRegistry?.list()??[],n=s.map(({agent:b})=>({id:b.id,name:b.name,description:b.description}));if(!n.length)return await rt({text:"No agents registered; skipping intent detection"},e),{...t,currentIntent:"none",finalOutputMessage:"No agents registered; skipping intent detection."};let o=await Ho("intent_prompt"),i=Gu(n),a=um(n),c={registeredAgents:i,priorSteps:Gu(t.agentExecutionContext.priorSteps),userRequest:t.agentExecutionContext.userRequest},u=await qn.fromTemplate(o).format(c),f=Ai({model:await zs({modelTier:"fast",config:e}),tools:[],systemPrompt:u,responseFormat:a,middleware:[Ii({model:await zs({modelTier:"fast",config:e}),trigger:{tokens:4e3},keep:{messages:6}}),bi({runLimit:2})]}),{structuredResponse:h}=await rm({agent:f,messages:t.agentExecutionContext.messages,config:e}),y=a.parse(h??{intent:null,assignedTask:null,requiresFollowUp:!1}),A=y.intent??"none",I={...t,currentIntent:A,requiresFollowUp:y.requiresFollowUp,agentExecutionContext:{...t.agentExecutionContext,assignedTask:y.assignedTask??""}};if(A==="none"){let b=`I could not find an agent that can handle that request. I have access to the following agents: ${s.map(({agent:_})=>_.name).join(", ")}.
39
+ ${r}`},sl=()=>({userRequest:"",assignedTask:"",messages:[],priorSteps:[],sharedState:{}}),Yp=()=>({agentExecutionContext:re({reducer:tl,default:sl}),outputMessage:re({reducer:rl,default:()=>""}),summary:re({reducer:ss,default:()=>""}),status:re({reducer:ss})}),DC=()=>({...Yp(),sharedStatePatch:re({reducer:ss})}),LC=re.Root({agentExecutionContext:re({default:sl,reducer:tl}),currentIntent:re({default:()=>"none",reducer:ss}),lastExecutedAgent:re({default:()=>"",reducer:ss}),requiresFollowUp:re({default:()=>!0,reducer:ss}),stepCount:re({default:()=>0,reducer:(t,e)=>e??t+1}),finalOutputMessage:re({default:()=>"",reducer:rl})}),Qp=t=>{if(!t||typeof t!="object"||!("services"in t))return!1;let e=t.services;return!!e&&typeof e=="object"&&"agentRegistry"in e},em=t=>{let e=t?.configurable;return Qp(e)?e:void 0},tm=(t,e,r)=>{let s=t[e];return s?typeof s=="function"?s():Promise.resolve(s):new Promise((n,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},Ho=async t=>(await tm(Object.assign({"./field_descriptions_prompt.md":()=>import("./ZU2FHVNK.js"),"./intent_prompt.md":()=>import("./BL273EGZ.js"),"./layer_descriptions_prompt.md":()=>import("./LK7ZIQW6.js")}),`./${t}.md`,2)).default,rm=async t=>{let{agent:e,messages:r,config:s}=t;return{structuredResponse:(await e.invoke({messages:r},s)).structuredResponse}},sm=t=>typeof t=="string"&&t.length>0?t:void 0,nm=()=>Go(),om=t=>typeof t!="string"||t.trim().length===0?"MapsSDK":`MapsSDK - ${t.trim()}`,im=t=>{let e=t?.configurable;return{conversationId:sm(e?.thread_id),abortSignal:t?.signal,requestId:nm(),requestSource:om(Vp.applicationName)}},nl=async({config:t})=>{let e=Yu.getDefault(),r=(await Zp.getCredential(`${e.url}/sharing`))?.token;return async(s,n)=>{let{conversationId:o,abortSignal:i,requestId:a,requestSource:c}=im(t),u=new Headers(n?.headers);u.delete("Authorization"),u.delete("api-key"),r&&r.length>0&&(u.set("X-Esri-Authorization",`Bearer ${r}`),u.set("X-Esri-Request-Source",c)),o&&o.length>0&&u.set("X-Esri-Conversation-Id",o),a.length>0&&u.set("X-Esri-Request-Id",a);let f=i&&n?.signal?AbortSignal.any([i,n.signal]):n?.signal??i;return await fetch(s,{...n,headers:u,signal:f})}},zs=async(t={})=>{let{modelTier:e="default",temperature:r=0,config:s}=t,n=Qu[e],o=await Gp(e);return new Mn({modelName:n,apiKey:"dummy-key",...e!=="default"&&{temperature:r},configuration:{baseURL:o,fetch:await nl({config:s})}})},KC=async(t={})=>{let{tier:e="default",config:r}=t,s=Wo[e],n=await Xp(e);return new Nn({modelName:s,apiKey:"dummy-key",configuration:{baseURL:n,fetch:await nl({config:r})},batchSize:2048,maxConcurrency:10})},am=x.object({id:x.string().min(1),name:x.string().min(1),description:x.string().min(1)});x.array(am);var Gu=t=>JSON.stringify(t,null,2),um=t=>{let e=t.map(s=>s.id),r=x.enum(e);return x.object({intent:r.nullable(),assignedTask:x.string().nullable(),requiresFollowUp:x.boolean()})},FC=async(t,e)=>{let r=em(e);if(e?.signal?.aborted)return await rt({text:"Run cancelled; skipping intent routing"},e),{...t,currentIntent:"none",finalOutputMessage:"Operation cancelled.",requiresFollowUp:!1};try{await rt({text:"Asking LLM to route to an agent"},e);let s=r.services.agentRegistry?.list()??[],n=s.map(({agent:b})=>({id:b.id,name:b.name,description:b.description}));if(!n.length)return await rt({text:"No agents registered; skipping intent detection"},e),{...t,currentIntent:"none",finalOutputMessage:"No agents registered; skipping intent detection."};let o=await Ho("intent_prompt"),i=Gu(n),a=um(n),c={registeredAgents:i,priorSteps:Gu(t.agentExecutionContext.priorSteps),userRequest:t.agentExecutionContext.userRequest},u=await qn.fromTemplate(o).format(c),f=Ai({model:await zs({modelTier:"fast",config:e}),tools:[],systemPrompt:u,responseFormat:a,middleware:[Ii({model:await zs({modelTier:"fast",config:e}),trigger:{tokens:4e3},keep:{messages:6}}),bi({runLimit:2})]}),{structuredResponse:h}=await rm({agent:f,messages:t.agentExecutionContext.messages,config:e}),y=a.parse(h??{intent:null,assignedTask:null,requiresFollowUp:!1}),A=y.intent??"none",I={...t,currentIntent:A,requiresFollowUp:y.requiresFollowUp,agentExecutionContext:{...t.agentExecutionContext,assignedTask:y.assignedTask??""}};if(A==="none"){let b=`I could not find an agent that can handle that request. I have access to the following agents: ${s.map(({agent:_})=>_.name).join(", ")}.
40
40
 
41
41
  Please ask a question that can be answered by one of these agents.`;return await rt({text:"LLM did not identify a clear intent."},e),{...t,currentIntent:A,requiresFollowUp:!1,finalOutputMessage:b,agentExecutionContext:{...t.agentExecutionContext,assignedTask:"",messages:[...t.agentExecutionContext.messages,new ae(b)],priorSteps:[...t.agentExecutionContext.priorSteps??[],{agentId:"no-intent-router",assignedTask:t.agentExecutionContext.userRequest,summary:"No matching agent found; asked user to rephrase.",status:"failed"}]}}}return await rt({text:`Agent picked: ${A}
42
42
  Task Assigned: ${y.assignedTask??""}
@@ -1,2 +1,2 @@
1
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,x as m,z as y}from"./MAV3DW27.js";import"./ADYIXCSG.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")
2
+ import{g as C,h as S,n as l,v as R,x as m,z as y}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.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,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var e=`This Feature Layer is part of a Feature Service. The Feature Layer contains various fields, each with its own name, type, and description.
2
+ import"./UZLQALHY.js";var e=`This Feature Layer is part of a Feature Service. The Feature Layer contains various fields, each with its own name, type, and description.
3
3
  The Feature Layer is a collection of geographic features that represent real-world entities. Each feature in the layer has attributes that provide additional information about the feature. The layer may include point, line, or polygon geometries, depending on the type of data it represents.
4
4
  The geometry type for this layer is {layerGeometryType}.
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{$ as Ca,Dd as Oa,d as dt,e as Aa,j as Ln,k as ka,m as Bo,n as Fo,o as Ia,u as $e,w as Ho,x as Go}from"./ZEYIBYSF.js";import{a as Kt,b as vp,c as jn}from"./YIMNOUTF.js";var Al=Kt((BE,As)=>{"use strict";var km=Object.prototype.hasOwnProperty,Ie="~";function fn(){}Object.create&&(fn.prototype=Object.create(null),new fn().__proto__||(Ie=!1));function Im(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function Tl(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var a=new Im(r,n||e,i),s=Ie?Ie+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],a]:e._events[s].push(a):(e._events[s]=a,e._eventsCount++),e}function pi(e,t){--e._eventsCount===0?e._events=new fn:delete e._events[t]}function xe(){this._events=new fn,this._eventsCount=0}xe.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)km.call(r,n)&&t.push(Ie?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};xe.prototype.listeners=function(t){var r=Ie?Ie+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,s=new Array(a);i<a;i++)s[i]=n[i].fn;return s};xe.prototype.listenerCount=function(t){var r=Ie?Ie+t:t,n=this._events[r];return n?n.fn?1:n.length:0};xe.prototype.emit=function(t,r,n,i,a,s){var o=Ie?Ie+t:t;if(!this._events[o])return!1;var c=this._events[o],u=arguments.length,l,d;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,a),!0;case 6:return c.fn.call(c.context,r,n,i,a,s),!0}for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c.fn.apply(c.context,l)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(t,c[d].fn,void 0,!0),u){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,r);break;case 3:c[d].fn.call(c[d].context,r,n);break;case 4:c[d].fn.call(c[d].context,r,n,i);break;default:if(!l)for(p=1,l=new Array(u-1);p<u;p++)l[p-1]=arguments[p];c[d].fn.apply(c[d].context,l)}}return!0};xe.prototype.on=function(t,r,n){return Tl(this,t,r,n,!1)};xe.prototype.once=function(t,r,n){return Tl(this,t,r,n,!0)};xe.prototype.removeListener=function(t,r,n,i){var a=Ie?Ie+t:t;if(!this._events[a])return this;if(!r)return pi(this,a),this;var s=this._events[a];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&pi(this,a);else{for(var o=0,c=[],u=s.length;o<u;o++)(s[o].fn!==r||i&&!s[o].once||n&&s[o].context!==n)&&c.push(s[o]);c.length?this._events[a]=c.length===1?c[0]:c:pi(this,a)}return this};xe.prototype.removeAllListeners=function(t){var r;return t?(r=Ie?Ie+t:t,this._events[r]&&pi(this,r)):(this._events=new fn,this._eventsCount=0),this};xe.prototype.off=xe.prototype.removeListener;xe.prototype.addListener=xe.prototype.on;xe.prefixed=Ie;xe.EventEmitter=xe;typeof As<"u"&&(As.exports=xe)});var Il=Kt((FE,kl)=>{"use strict";kl.exports=(e,t)=>(t=t||(()=>{}),e.then(r=>new Promise(n=>{n(t())}).then(()=>r),r=>new Promise(n=>{n(t())}).then(()=>{throw r})))});var Ol=Kt((HE,mi)=>{"use strict";var Cm=Il(),hi=class extends Error{constructor(t){super(t),this.name="TimeoutError"}},Cl=(e,t,r)=>new Promise((n,i)=>{if(typeof t!="number"||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0){n(e);return}let a=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){i(c)}return}let s=typeof r=="string"?r:`Promise timed out after ${t} milliseconds`,o=r instanceof Error?r:new hi(s);typeof e.cancel=="function"&&e.cancel(),i(o)},t);Cm(e.then(n,i),()=>{clearTimeout(a)})});mi.exports=Cl;mi.exports.default=Cl;mi.exports.TimeoutError=hi});var Rl=Kt(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});function Om(e,t,r){let n=0,i=e.length;for(;i>0;){let a=i/2|0,s=n+a;r(e[s],t)<=0?(n=++s,i-=a+1):i=a}return n}ks.default=Om});var Nl=Kt(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});var Rm=Rl(),Is=class{constructor(){this._queue=[]}enqueue(t,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:t};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let i=Rm.default(this._queue,n,(a,s)=>s.priority-a.priority);this._queue.splice(i,0,n)}dequeue(){let t=this._queue.shift();return t?.run}filter(t){return this._queue.filter(r=>r.priority===t.priority).map(r=>r.run)}get size(){return this._queue.length}};Cs.default=Is});var _i=Kt(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});var Nm=Al(),$l=Ol(),$m=Nl(),gi=()=>{},Pm=new $l.TimeoutError,Os=class extends Nm{constructor(t){var r,n,i,a;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=gi,this._resolveIdle=gi,t=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:$m.default},t),!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=t.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(a=(i=t.interval)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""}\` (${typeof t.interval})`);this._carryoverConcurrencyCount=t.carryoverConcurrencyCount,this._isIntervalIgnored=t.intervalCap===1/0||t.interval===0,this._intervalCap=t.intervalCap,this._interval=t.interval,this._queue=new t.queueClass,this._queueClass=t.queueClass,this.concurrency=t.concurrency,this._timeout=t.timeout,this._throwOnTimeout=t.throwOnTimeout===!0,this._isPaused=t.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=gi,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=gi,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let t=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-t;if(r<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let t=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),t&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this._concurrency=t,this._processQueue()}async add(t,r={}){return new Promise((n,i)=>{let a=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?t():$l.default(Promise.resolve(t()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&i(Pm)});n(await s)}catch(s){i(s)}this._next()};this._queue.enqueue(a,r),this._tryToStartAnother(),this.emit("add")})}async addAll(t,r){return Promise.all(t.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(t=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),t()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(t=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),t()}})}get size(){return this._queue.size}sizeBy(t){return this._queue.filter(t).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(t){this._timeout=t}};Rs.default=Os});var dp=Kt(pa=>{"use strict";pa.byteLength=hw;pa.toByteArray=gw;pa.fromByteArray=ww;var St=[],Xe=[],pw=typeof Uint8Array<"u"?Uint8Array:Array,ko="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ir=0,up=ko.length;Ir<up;++Ir)St[Ir]=ko[Ir],Xe[ko.charCodeAt(Ir)]=Ir;var Ir,up;Xe[45]=62;Xe[95]=63;function lp(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function hw(e){var t=lp(e),r=t[0],n=t[1];return(r+n)*3/4-n}function mw(e,t,r){return(t+r)*3/4-r}function gw(e){var t,r=lp(e),n=r[0],i=r[1],a=new pw(mw(e,n,i)),s=0,o=i>0?n-4:n,c;for(c=0;c<o;c+=4)t=Xe[e.charCodeAt(c)]<<18|Xe[e.charCodeAt(c+1)]<<12|Xe[e.charCodeAt(c+2)]<<6|Xe[e.charCodeAt(c+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=t&255;return i===2&&(t=Xe[e.charCodeAt(c)]<<2|Xe[e.charCodeAt(c+1)]>>4,a[s++]=t&255),i===1&&(t=Xe[e.charCodeAt(c)]<<10|Xe[e.charCodeAt(c+1)]<<4|Xe[e.charCodeAt(c+2)]>>2,a[s++]=t>>8&255,a[s++]=t&255),a}function _w(e){return St[e>>18&63]+St[e>>12&63]+St[e>>6&63]+St[e&63]}function yw(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(_w(n));return i.join("")}function ww(e){for(var t,r=e.length,n=r%3,i=[],a=16383,s=0,o=r-n;s<o;s+=a)i.push(yw(e,s,s+a>o?o:s+a));return n===1?(t=e[r-1],i.push(St[t>>2]+St[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(St[t>>10]+St[t>>4&63]+St[t<<2&63]+"=")),i.join("")}});var Vo=Object.defineProperty,L=(e,t)=>{let r={};for(var n in e)Vo(r,n,{get:e[n],enumerable:!0});return t||Vo(r,Symbol.toStringTag,{value:"Module"}),r};var xp=/([A-Z]+)([A-Z][a-z0-9]+)/g,Ep=/([a-z0-9])([A-Z])/g,Zo=/[-_\s]+/g;function Sp(e){return e.replace(xp,"$1_$2").replace(Ep,"$1_$2").replace(Zo,"_").toLowerCase()}function Tp(e){let t=e.trim();return/[-_\s]/.test(t)?t.replace(Zo,"_").toLowerCase().replace(/_+([a-z0-9])/g,(r,n)=>n.toUpperCase()):t}function qo(e,t){return t?.[e]||Sp(e)}function Dw(e,t){return t?.[e]||Tp(e)}function Wo(e,t,r){let n={};for(let i in e)Object.hasOwn(e,i)&&(n[t(i,r)]=e[i]);return n}var Ko="__lc_escaped__";function Ap(e){return"lc"in e||Object.keys(e).length===1&&"__lc_escaped__"in e}function kp(e){return{[Ko]:e}}function Ip(e){return Object.keys(e).length===1&&"__lc_escaped__"in e}function Cp(e){return e!==null&&typeof e=="object"&&"lc_serializable"in e&&typeof e.toJSON=="function"}function Op(e){let t;return e!==null&&typeof e=="object"?"lc_id"in e&&Array.isArray(e.lc_id)?t=e.lc_id:t=[e.constructor?.name??"Object"]:t=[typeof e],{lc:1,type:"not_implemented",id:t}}function Dn(e,t=new WeakSet){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){if(t.has(e))return Op(e);if(Cp(e))return e;t.add(e);let r=e;if(Ap(r))return t.delete(e),kp(r);let n={};for(let[i,a]of Object.entries(r))n[i]=Dn(a,t);return t.delete(e),n}return Array.isArray(e)?e.map(r=>Dn(r,t)):e}function Jo(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let t=e;if(Ip(t))return t[Ko];let r={};for(let[n,i]of Object.entries(t))r[n]=Jo(i);return r}return Array.isArray(e)?e.map(t=>Jo(t)):e}var Gw=L({Serializable:()=>ft,get_lc_unique_name:()=>Un});function Yo(e){return Array.isArray(e)?[...e]:{...e}}function Rp(e,t){let r=Yo(e);for(let[n,i]of Object.entries(t)){let[a,...s]=n.split(".").reverse(),o=r;for(let c of s.reverse()){if(o[c]===void 0)break;o[c]=Yo(o[c]),o=o[c]}o[a]!==void 0&&(o[a]={lc:1,type:"secret",id:[i]})}return r}function Un(e){let t=Object.getPrototypeOf(e);return typeof e.lc_name=="function"&&(typeof t.lc_name!="function"||e.lc_name()!==t.lc_name())?e.lc_name():e.name}var ft=class Xo{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Un(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(t,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(t||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=t??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof Xo||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let t={},r={},n=Object.keys(this.lc_kwargs).reduce((o,c)=>(o[c]=c in this?this[c]:this.lc_kwargs[c],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(t,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));Object.keys(r).forEach(o=>{let c=this,u=n,[l,...d]=o.split(".").reverse();for(let f of d.reverse()){if(!(f in c)||c[f]===void 0)return;(!(f in u)||u[f]===void 0)&&(typeof c[f]=="object"&&c[f]!=null?u[f]={}:Array.isArray(c[f])&&(u[f]=[])),c=c[f],u=u[f]}l in c&&c[l]!==void 0&&(u[l]=u[l]||c[l])});let i={},a=new WeakSet;a.add(this);for(let[o,c]of Object.entries(n))i[o]=Dn(c,a);let s=Wo(Object.keys(r).length?Rp(i,r):i,qo,t);return{lc:1,type:"constructor",id:this.lc_id,kwargs:s}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function Rt(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"&&"source_type"in e&&(e.source_type==="url"||e.source_type==="base64"||e.source_type==="text"||e.source_type==="id")}function Qo(e){return Rt(e)&&e.source_type==="url"&&"url"in e&&typeof e.url=="string"}function ec(e){return Rt(e)&&e.source_type==="base64"&&"data"in e&&typeof e.data=="string"}function Zw(e){return Rt(e)&&e.source_type==="text"&&"text"in e&&typeof e.text=="string"}function tc(e){return Rt(e)&&e.source_type==="id"&&"id"in e&&typeof e.id=="string"}function qw(e){if(Rt(e)){if(e.source_type==="url")return{type:"image_url",image_url:{url:e.url}};if(e.source_type==="base64"){if(!e.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${e.mime_type};base64,${e.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function Ww(e){let t=e.split(";")[0].split("/");if(t.length!==2)throw new Error(`Invalid mime type: "${e}" - does not match type/subtype format.`);let r=t[0].trim(),n=t[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${e}" - type or subtype is empty.`);let i={};for(let a of e.split(";").slice(1)){let s=a.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${e}".`);let o=s[0].trim(),c=s[1].trim();if(o==="")throw new Error(`Invalid parameter syntax in mime type: "${e}".`);i[o]=c}return{type:r,subtype:n,parameters:i}}function Ra({dataUrl:e,asTypedArray:t=!1}){let r=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let i=t?Uint8Array.from(atob(r[2]),a=>a.charCodeAt(0)):r[2];return{mime_type:n,data:i}}}function Jw(e,t){if(e.type==="text"){if(!t.fromStandardTextBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardTextBlock\` method.`);return t.fromStandardTextBlock(e)}if(e.type==="image"){if(!t.fromStandardImageBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardImageBlock\` method.`);return t.fromStandardImageBlock(e)}if(e.type==="audio"){if(!t.fromStandardAudioBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardAudioBlock\` method.`);return t.fromStandardAudioBlock(e)}if(e.type==="file"){if(!t.fromStandardFileBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardFileBlock\` method.`);return t.fromStandardFileBlock(e)}throw new Error(`Unable to convert content block type '${e.type}' to provider-specific format: not recognized.`)}function T(e,t){return $(e)&&e.type===t}function $(e){return typeof e=="object"&&e!==null}function de(e){return Array.isArray(e)}function g(e){return typeof e=="string"}function De(e){return typeof e=="number"}function zn(e){return e instanceof Uint8Array}function Na(e){try{return JSON.parse(e)}catch{return}}var Ue=e=>e();function Np(e){if(e.type==="char_location"&&g(e.document_title)&&De(e.start_char_index)&&De(e.end_char_index)&&g(e.cited_text)){let{document_title:t,start_char_index:r,end_char_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"char",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="page_location"&&g(e.document_title)&&De(e.start_page_number)&&De(e.end_page_number)&&g(e.cited_text)){let{document_title:t,start_page_number:r,end_page_number:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"page",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="content_block_location"&&g(e.document_title)&&De(e.start_block_index)&&De(e.end_block_index)&&g(e.cited_text)){let{document_title:t,start_block_index:r,end_block_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"block",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="web_search_result_location"&&g(e.url)&&g(e.title)&&g(e.encrypted_index)&&g(e.cited_text)){let{url:t,title:r,encrypted_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"url",url:t,title:r,startIndex:Number(n),endIndex:Number(n),citedText:i}}if(e.type==="search_result_location"&&g(e.source)&&g(e.title)&&De(e.start_block_index)&&De(e.end_block_index)&&g(e.cited_text)){let{source:t,title:r,start_block_index:n,end_block_index:i,cited_text:a,...s}=e;return{...s,type:"citation",source:"search",url:t,title:r??void 0,startIndex:n,endIndex:i,citedText:a}}}function nc(e){if(T(e,"document")&&$(e.source)&&"type"in e.source){if(e.source.type==="base64"&&g(e.source.media_type)&&g(e.source.data))return{type:"file",mimeType:e.source.media_type,data:e.source.data};if(e.source.type==="url"&&g(e.source.url))return{type:"file",url:e.source.url};if(e.source.type==="file"&&g(e.source.file_id))return{type:"file",fileId:e.source.file_id};if(e.source.type==="text"&&g(e.source.data))return{type:"file",mimeType:String(e.source.media_type??"text/plain"),data:e.source.data}}else if(T(e,"image")&&$(e.source)&&"type"in e.source){if(e.source.type==="base64"&&g(e.source.media_type)&&g(e.source.data))return{type:"image",mimeType:e.source.media_type,data:e.source.data};if(e.source.type==="url"&&g(e.source.url))return{type:"image",url:e.source.url};if(e.source.type==="file"&&g(e.source.file_id))return{type:"image",fileId:e.source.file_id}}}function ic(e){function*t(){for(let r of e){let n=nc(r);n?yield n:yield r}}return Array.from(t())}function rc(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(T(n,"text")&&g(n.text)){let{text:i,citations:a,...s}=n;if(de(a)&&a.length){let o=a.reduce((c,u)=>{let l=Np(u);return l?[...c,l]:c},[]);yield{...s,type:"text",text:i,annotations:o};continue}else{yield{...s,type:"text",text:i};continue}}else if(T(n,"thinking")&&g(n.thinking)){let{thinking:i,signature:a,...s}=n;yield{...s,type:"reasoning",reasoning:i,signature:a};continue}else if(T(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(T(n,"tool_use")&&g(n.name)&&g(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(T(n,"input_json_delta")){if($p(e)&&e.tool_call_chunks?.length){let i=e.tool_call_chunks[0];yield{type:"tool_call_chunk",id:i.id,name:i.name,args:i.args,index:i.index};continue}}else if(T(n,"server_tool_use")&&g(n.name)&&g(n.id)){let{name:i,id:a}=n;if(i==="web_search"){yield{id:a,type:"server_tool_call",name:"web_search",args:{query:Ue(()=>{if(typeof n.input=="string")return n.input;if($(n.input)&&g(n.input.query))return n.input.query;if(g(n.partial_json)){let s=Na(n.partial_json);if(s?.query)return s.query}return""})}};continue}else if(n.name==="code_execution"){yield{id:a,type:"server_tool_call",name:"code_execution",args:{code:Ue(()=>{if(typeof n.input=="string")return n.input;if($(n.input)&&g(n.input.code))return n.input.code;if(g(n.partial_json)){let s=Na(n.partial_json);if(s?.code)return s.code}return""})}};continue}}else if(T(n,"web_search_tool_result")&&g(n.tool_use_id)&&de(n.content)){let{content:i,tool_use_id:a}=n;yield{type:"server_tool_call_result",name:"web_search",toolCallId:a,status:"success",output:{urls:i.reduce((s,o)=>T(o,"web_search_result")?[...s,o.url]:s,[])}};continue}else if(T(n,"code_execution_tool_result")&&g(n.tool_use_id)&&$(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(T(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(T(n,"mcp_tool_result")&&g(n.tool_use_id)&&$(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(T(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(T(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(T(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let i=nc(n);if(i){yield i;continue}}yield{type:"non_standard",value:n}}}return Array.from(t())}var ac={translateContent:rc,translateContentChunk:rc};function $p(e){return typeof e?._getType=="function"&&typeof e.concat=="function"&&e._getType()==="ai"}function Pp(e){return Qo(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:ec(e)?{type:e.type,mimeType:e.mime_type??"application/octet-stream",data:e.data,metadata:e.metadata}:tc(e)?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e}function sc(e){return e.map(Pp)}function oc(e){return!!(T(e,"image_url")&&$(e.image_url)||T(e,"input_audio")&&$(e.input_audio)||T(e,"file")&&$(e.file))}function cc(e){if(T(e,"image_url")&&$(e.image_url)&&g(e.image_url.url)){let t=Ra({dataUrl:e.image_url.url});return t?{type:"image",mimeType:t.mime_type,data:t.data}:{type:"image",url:e.image_url.url}}else{if(T(e,"input_audio")&&$(e.input_audio)&&g(e.input_audio.data)&&g(e.input_audio.format))return{type:"audio",data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};if(T(e,"file")&&$(e.file)&&g(e.file.data)){let t=Ra({dataUrl:e.file.data});if(t)return{type:"file",data:t.data,mimeType:t.mime_type};if(g(e.file.file_id))return{type:"file",fileId:e.file.file_id}}}return e}function Mp(e){let t=[];typeof e.content=="string"?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...Bn(e.content));for(let r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}function jp(e){let t=[];typeof e.content=="string"?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...Bn(e.content));for(let r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}function Bn(e){let t=[];for(let r of e)oc(r)?t.push(cc(r)):t.push(r);return t}function Lp(e){if(e.type==="url_citation"){let{url:t,title:r,start_index:n,end_index:i}=e;return{type:"citation",url:t,title:r,startIndex:n,endIndex:i}}if(e.type==="file_citation"){let{file_id:t,filename:r,index:n}=e;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:t}}return e}function uc(e){function*t(){$(e.additional_kwargs?.reasoning)&&de(e.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:e.additional_kwargs.reasoning.summary.reduce((n,i)=>$(i)&&g(i.text)?`${n}${i.text}`:n,"")});let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r)if(T(n,"text")){let{text:i,annotations:a,phase:s,extras:o,...c}=n,u=$(o)?{...o}:{};g(s)&&(u.phase=s);let l=Object.keys(u).length>0?{extras:u}:{};Array.isArray(a)?yield{...c,...l,type:"text",text:String(i),annotations:a.map(Lp)}:yield{...c,...l,type:"text",text:String(i)}}for(let n of e.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if($(e.additional_kwargs)&&de(e.additional_kwargs.tool_outputs))for(let n of e.additional_kwargs.tool_outputs){if(T(n,"web_search_call")){let i={};if($(n.action)&&g(n.action.query)&&(i.query=n.action.query),yield{id:n.id,type:"server_tool_call",name:"web_search",args:i},n.status==="completed"||n.status==="failed"){let a={};$(n.action)&&(a.action=n.action),yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:a}}continue}else if(T(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{queries:de(n.queries)?n.queries:[]}},(n.status==="completed"||n.status==="failed")&&(yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:de(n.results)?{results:n.results}:{}});continue}else if(T(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(T(n,"code_interpreter_call")){if(g(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),de(n.outputs)){let i=Ue(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let a of n.outputs)if(T(a,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:i??0,stderr:[0,void 0].includes(i)?void 0:String(a.logs),stdout:[0,void 0].includes(i)?String(a.logs):void 0}};continue}}continue}else if(T(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(T(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(T(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(T(n,"tool_search_call")){let i={};$(n.arguments)&&Object.assign(i,n.arguments);let a={};g(n.execution)&&(a.execution=n.execution),g(n.status)&&(a.status=n.status),g(n.call_id)&&(a.call_id=n.call_id),yield{id:g(n.id)?n.id:"",type:"server_tool_call",name:"tool_search",args:i,...Object.keys(a).length>0?{extras:a}:{}};continue}else if(T(n,"tool_search_output")){let i={name:"tool_search"};g(n.execution)&&(i.execution=n.execution),yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":n.status==="failed"?"error":"success",output:{tools:de(n.tools)?n.tools:[]},extras:i};continue}else if(T(n,"image_generation_call")){g(n.result)&&(yield{type:"image",mimeType:"image/png",data:n.result,id:g(n.id)?n.id:void 0,metadata:{status:g(n.status)?n.status:void 0}}),yield{type:"non_standard",value:n};continue}$(n)&&(yield{type:"non_standard",value:n})}}return Array.from(t())}function Dp(e){function*t(){yield*uc(e);for(let r of e.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(t())}var lc={translateContent:e=>typeof e.content=="string"?Mp(e):uc(e),translateContentChunk:e=>typeof e.content=="string"?jp(e):Dp(e)};function dc(e){return typeof e=="object"&&e!==null&&"type"in e&&"content"in e&&(typeof e.content=="string"||Array.isArray(e.content))}function fc(e,t="pretty"){return t==="pretty"?Up(e):JSON.stringify(e)}function Up(e){let t=[],r=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),i="=".repeat(n),a=r.length%2===0?i:`${i}=`;if(t.push(`${i}${r}${a}`),e.type==="ai"){let s=e;if(s.tool_calls&&s.tool_calls.length>0){t.push("Tool Calls:");for(let o of s.tool_calls){t.push(` ${o.name} (${o.id})`),t.push(` Call ID: ${o.id}`),t.push(" Args:");for(let[c,u]of Object.entries(o.args))t.push(` ${c}: ${typeof u=="object"?JSON.stringify(u):u}`)}}}if(e.type==="tool"){let s=e;s.name&&t.push(`Name: ${s.name}`)}return typeof e.content=="string"&&e.content.trim()&&(t.length>1&&t.push(""),t.push(e.content)),t.join(`
2
+ import{$ as Ca,Dd as Oa,d as dt,e as Aa,j as Ln,k as ka,m as Bo,n as Fo,o as Ia,u as $e,w as Ho,x as Go}from"./MWYBF3F3.js";import{a as Kt,b as vp,c as jn}from"./UZLQALHY.js";var Al=Kt((BE,As)=>{"use strict";var km=Object.prototype.hasOwnProperty,Ie="~";function fn(){}Object.create&&(fn.prototype=Object.create(null),new fn().__proto__||(Ie=!1));function Im(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function Tl(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var a=new Im(r,n||e,i),s=Ie?Ie+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],a]:e._events[s].push(a):(e._events[s]=a,e._eventsCount++),e}function pi(e,t){--e._eventsCount===0?e._events=new fn:delete e._events[t]}function xe(){this._events=new fn,this._eventsCount=0}xe.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)km.call(r,n)&&t.push(Ie?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};xe.prototype.listeners=function(t){var r=Ie?Ie+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,s=new Array(a);i<a;i++)s[i]=n[i].fn;return s};xe.prototype.listenerCount=function(t){var r=Ie?Ie+t:t,n=this._events[r];return n?n.fn?1:n.length:0};xe.prototype.emit=function(t,r,n,i,a,s){var o=Ie?Ie+t:t;if(!this._events[o])return!1;var c=this._events[o],u=arguments.length,l,d;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,a),!0;case 6:return c.fn.call(c.context,r,n,i,a,s),!0}for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c.fn.apply(c.context,l)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(t,c[d].fn,void 0,!0),u){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,r);break;case 3:c[d].fn.call(c[d].context,r,n);break;case 4:c[d].fn.call(c[d].context,r,n,i);break;default:if(!l)for(p=1,l=new Array(u-1);p<u;p++)l[p-1]=arguments[p];c[d].fn.apply(c[d].context,l)}}return!0};xe.prototype.on=function(t,r,n){return Tl(this,t,r,n,!1)};xe.prototype.once=function(t,r,n){return Tl(this,t,r,n,!0)};xe.prototype.removeListener=function(t,r,n,i){var a=Ie?Ie+t:t;if(!this._events[a])return this;if(!r)return pi(this,a),this;var s=this._events[a];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&pi(this,a);else{for(var o=0,c=[],u=s.length;o<u;o++)(s[o].fn!==r||i&&!s[o].once||n&&s[o].context!==n)&&c.push(s[o]);c.length?this._events[a]=c.length===1?c[0]:c:pi(this,a)}return this};xe.prototype.removeAllListeners=function(t){var r;return t?(r=Ie?Ie+t:t,this._events[r]&&pi(this,r)):(this._events=new fn,this._eventsCount=0),this};xe.prototype.off=xe.prototype.removeListener;xe.prototype.addListener=xe.prototype.on;xe.prefixed=Ie;xe.EventEmitter=xe;typeof As<"u"&&(As.exports=xe)});var Il=Kt((FE,kl)=>{"use strict";kl.exports=(e,t)=>(t=t||(()=>{}),e.then(r=>new Promise(n=>{n(t())}).then(()=>r),r=>new Promise(n=>{n(t())}).then(()=>{throw r})))});var Ol=Kt((HE,mi)=>{"use strict";var Cm=Il(),hi=class extends Error{constructor(t){super(t),this.name="TimeoutError"}},Cl=(e,t,r)=>new Promise((n,i)=>{if(typeof t!="number"||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0){n(e);return}let a=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){i(c)}return}let s=typeof r=="string"?r:`Promise timed out after ${t} milliseconds`,o=r instanceof Error?r:new hi(s);typeof e.cancel=="function"&&e.cancel(),i(o)},t);Cm(e.then(n,i),()=>{clearTimeout(a)})});mi.exports=Cl;mi.exports.default=Cl;mi.exports.TimeoutError=hi});var Rl=Kt(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});function Om(e,t,r){let n=0,i=e.length;for(;i>0;){let a=i/2|0,s=n+a;r(e[s],t)<=0?(n=++s,i-=a+1):i=a}return n}ks.default=Om});var Nl=Kt(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});var Rm=Rl(),Is=class{constructor(){this._queue=[]}enqueue(t,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:t};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let i=Rm.default(this._queue,n,(a,s)=>s.priority-a.priority);this._queue.splice(i,0,n)}dequeue(){let t=this._queue.shift();return t?.run}filter(t){return this._queue.filter(r=>r.priority===t.priority).map(r=>r.run)}get size(){return this._queue.length}};Cs.default=Is});var _i=Kt(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});var Nm=Al(),$l=Ol(),$m=Nl(),gi=()=>{},Pm=new $l.TimeoutError,Os=class extends Nm{constructor(t){var r,n,i,a;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=gi,this._resolveIdle=gi,t=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:$m.default},t),!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=t.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(a=(i=t.interval)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""}\` (${typeof t.interval})`);this._carryoverConcurrencyCount=t.carryoverConcurrencyCount,this._isIntervalIgnored=t.intervalCap===1/0||t.interval===0,this._intervalCap=t.intervalCap,this._interval=t.interval,this._queue=new t.queueClass,this._queueClass=t.queueClass,this.concurrency=t.concurrency,this._timeout=t.timeout,this._throwOnTimeout=t.throwOnTimeout===!0,this._isPaused=t.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=gi,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=gi,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let t=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-t;if(r<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let t=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),t&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this._concurrency=t,this._processQueue()}async add(t,r={}){return new Promise((n,i)=>{let a=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?t():$l.default(Promise.resolve(t()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&i(Pm)});n(await s)}catch(s){i(s)}this._next()};this._queue.enqueue(a,r),this._tryToStartAnother(),this.emit("add")})}async addAll(t,r){return Promise.all(t.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(t=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),t()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(t=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),t()}})}get size(){return this._queue.size}sizeBy(t){return this._queue.filter(t).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(t){this._timeout=t}};Rs.default=Os});var dp=Kt(pa=>{"use strict";pa.byteLength=hw;pa.toByteArray=gw;pa.fromByteArray=ww;var St=[],Xe=[],pw=typeof Uint8Array<"u"?Uint8Array:Array,ko="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ir=0,up=ko.length;Ir<up;++Ir)St[Ir]=ko[Ir],Xe[ko.charCodeAt(Ir)]=Ir;var Ir,up;Xe[45]=62;Xe[95]=63;function lp(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function hw(e){var t=lp(e),r=t[0],n=t[1];return(r+n)*3/4-n}function mw(e,t,r){return(t+r)*3/4-r}function gw(e){var t,r=lp(e),n=r[0],i=r[1],a=new pw(mw(e,n,i)),s=0,o=i>0?n-4:n,c;for(c=0;c<o;c+=4)t=Xe[e.charCodeAt(c)]<<18|Xe[e.charCodeAt(c+1)]<<12|Xe[e.charCodeAt(c+2)]<<6|Xe[e.charCodeAt(c+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=t&255;return i===2&&(t=Xe[e.charCodeAt(c)]<<2|Xe[e.charCodeAt(c+1)]>>4,a[s++]=t&255),i===1&&(t=Xe[e.charCodeAt(c)]<<10|Xe[e.charCodeAt(c+1)]<<4|Xe[e.charCodeAt(c+2)]>>2,a[s++]=t>>8&255,a[s++]=t&255),a}function _w(e){return St[e>>18&63]+St[e>>12&63]+St[e>>6&63]+St[e&63]}function yw(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(_w(n));return i.join("")}function ww(e){for(var t,r=e.length,n=r%3,i=[],a=16383,s=0,o=r-n;s<o;s+=a)i.push(yw(e,s,s+a>o?o:s+a));return n===1?(t=e[r-1],i.push(St[t>>2]+St[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(St[t>>10]+St[t>>4&63]+St[t<<2&63]+"=")),i.join("")}});var Vo=Object.defineProperty,L=(e,t)=>{let r={};for(var n in e)Vo(r,n,{get:e[n],enumerable:!0});return t||Vo(r,Symbol.toStringTag,{value:"Module"}),r};var xp=/([A-Z]+)([A-Z][a-z0-9]+)/g,Ep=/([a-z0-9])([A-Z])/g,Zo=/[-_\s]+/g;function Sp(e){return e.replace(xp,"$1_$2").replace(Ep,"$1_$2").replace(Zo,"_").toLowerCase()}function Tp(e){let t=e.trim();return/[-_\s]/.test(t)?t.replace(Zo,"_").toLowerCase().replace(/_+([a-z0-9])/g,(r,n)=>n.toUpperCase()):t}function qo(e,t){return t?.[e]||Sp(e)}function Dw(e,t){return t?.[e]||Tp(e)}function Wo(e,t,r){let n={};for(let i in e)Object.hasOwn(e,i)&&(n[t(i,r)]=e[i]);return n}var Ko="__lc_escaped__";function Ap(e){return"lc"in e||Object.keys(e).length===1&&"__lc_escaped__"in e}function kp(e){return{[Ko]:e}}function Ip(e){return Object.keys(e).length===1&&"__lc_escaped__"in e}function Cp(e){return e!==null&&typeof e=="object"&&"lc_serializable"in e&&typeof e.toJSON=="function"}function Op(e){let t;return e!==null&&typeof e=="object"?"lc_id"in e&&Array.isArray(e.lc_id)?t=e.lc_id:t=[e.constructor?.name??"Object"]:t=[typeof e],{lc:1,type:"not_implemented",id:t}}function Dn(e,t=new WeakSet){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){if(t.has(e))return Op(e);if(Cp(e))return e;t.add(e);let r=e;if(Ap(r))return t.delete(e),kp(r);let n={};for(let[i,a]of Object.entries(r))n[i]=Dn(a,t);return t.delete(e),n}return Array.isArray(e)?e.map(r=>Dn(r,t)):e}function Jo(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let t=e;if(Ip(t))return t[Ko];let r={};for(let[n,i]of Object.entries(t))r[n]=Jo(i);return r}return Array.isArray(e)?e.map(t=>Jo(t)):e}var Gw=L({Serializable:()=>ft,get_lc_unique_name:()=>Un});function Yo(e){return Array.isArray(e)?[...e]:{...e}}function Rp(e,t){let r=Yo(e);for(let[n,i]of Object.entries(t)){let[a,...s]=n.split(".").reverse(),o=r;for(let c of s.reverse()){if(o[c]===void 0)break;o[c]=Yo(o[c]),o=o[c]}o[a]!==void 0&&(o[a]={lc:1,type:"secret",id:[i]})}return r}function Un(e){let t=Object.getPrototypeOf(e);return typeof e.lc_name=="function"&&(typeof t.lc_name!="function"||e.lc_name()!==t.lc_name())?e.lc_name():e.name}var ft=class Xo{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Un(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(t,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(t||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=t??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof Xo||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let t={},r={},n=Object.keys(this.lc_kwargs).reduce((o,c)=>(o[c]=c in this?this[c]:this.lc_kwargs[c],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(t,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));Object.keys(r).forEach(o=>{let c=this,u=n,[l,...d]=o.split(".").reverse();for(let f of d.reverse()){if(!(f in c)||c[f]===void 0)return;(!(f in u)||u[f]===void 0)&&(typeof c[f]=="object"&&c[f]!=null?u[f]={}:Array.isArray(c[f])&&(u[f]=[])),c=c[f],u=u[f]}l in c&&c[l]!==void 0&&(u[l]=u[l]||c[l])});let i={},a=new WeakSet;a.add(this);for(let[o,c]of Object.entries(n))i[o]=Dn(c,a);let s=Wo(Object.keys(r).length?Rp(i,r):i,qo,t);return{lc:1,type:"constructor",id:this.lc_id,kwargs:s}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function Rt(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"&&"source_type"in e&&(e.source_type==="url"||e.source_type==="base64"||e.source_type==="text"||e.source_type==="id")}function Qo(e){return Rt(e)&&e.source_type==="url"&&"url"in e&&typeof e.url=="string"}function ec(e){return Rt(e)&&e.source_type==="base64"&&"data"in e&&typeof e.data=="string"}function Zw(e){return Rt(e)&&e.source_type==="text"&&"text"in e&&typeof e.text=="string"}function tc(e){return Rt(e)&&e.source_type==="id"&&"id"in e&&typeof e.id=="string"}function qw(e){if(Rt(e)){if(e.source_type==="url")return{type:"image_url",image_url:{url:e.url}};if(e.source_type==="base64"){if(!e.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${e.mime_type};base64,${e.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function Ww(e){let t=e.split(";")[0].split("/");if(t.length!==2)throw new Error(`Invalid mime type: "${e}" - does not match type/subtype format.`);let r=t[0].trim(),n=t[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${e}" - type or subtype is empty.`);let i={};for(let a of e.split(";").slice(1)){let s=a.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${e}".`);let o=s[0].trim(),c=s[1].trim();if(o==="")throw new Error(`Invalid parameter syntax in mime type: "${e}".`);i[o]=c}return{type:r,subtype:n,parameters:i}}function Ra({dataUrl:e,asTypedArray:t=!1}){let r=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let i=t?Uint8Array.from(atob(r[2]),a=>a.charCodeAt(0)):r[2];return{mime_type:n,data:i}}}function Jw(e,t){if(e.type==="text"){if(!t.fromStandardTextBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardTextBlock\` method.`);return t.fromStandardTextBlock(e)}if(e.type==="image"){if(!t.fromStandardImageBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardImageBlock\` method.`);return t.fromStandardImageBlock(e)}if(e.type==="audio"){if(!t.fromStandardAudioBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardAudioBlock\` method.`);return t.fromStandardAudioBlock(e)}if(e.type==="file"){if(!t.fromStandardFileBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardFileBlock\` method.`);return t.fromStandardFileBlock(e)}throw new Error(`Unable to convert content block type '${e.type}' to provider-specific format: not recognized.`)}function T(e,t){return $(e)&&e.type===t}function $(e){return typeof e=="object"&&e!==null}function de(e){return Array.isArray(e)}function g(e){return typeof e=="string"}function De(e){return typeof e=="number"}function zn(e){return e instanceof Uint8Array}function Na(e){try{return JSON.parse(e)}catch{return}}var Ue=e=>e();function Np(e){if(e.type==="char_location"&&g(e.document_title)&&De(e.start_char_index)&&De(e.end_char_index)&&g(e.cited_text)){let{document_title:t,start_char_index:r,end_char_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"char",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="page_location"&&g(e.document_title)&&De(e.start_page_number)&&De(e.end_page_number)&&g(e.cited_text)){let{document_title:t,start_page_number:r,end_page_number:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"page",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="content_block_location"&&g(e.document_title)&&De(e.start_block_index)&&De(e.end_block_index)&&g(e.cited_text)){let{document_title:t,start_block_index:r,end_block_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"block",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="web_search_result_location"&&g(e.url)&&g(e.title)&&g(e.encrypted_index)&&g(e.cited_text)){let{url:t,title:r,encrypted_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"url",url:t,title:r,startIndex:Number(n),endIndex:Number(n),citedText:i}}if(e.type==="search_result_location"&&g(e.source)&&g(e.title)&&De(e.start_block_index)&&De(e.end_block_index)&&g(e.cited_text)){let{source:t,title:r,start_block_index:n,end_block_index:i,cited_text:a,...s}=e;return{...s,type:"citation",source:"search",url:t,title:r??void 0,startIndex:n,endIndex:i,citedText:a}}}function nc(e){if(T(e,"document")&&$(e.source)&&"type"in e.source){if(e.source.type==="base64"&&g(e.source.media_type)&&g(e.source.data))return{type:"file",mimeType:e.source.media_type,data:e.source.data};if(e.source.type==="url"&&g(e.source.url))return{type:"file",url:e.source.url};if(e.source.type==="file"&&g(e.source.file_id))return{type:"file",fileId:e.source.file_id};if(e.source.type==="text"&&g(e.source.data))return{type:"file",mimeType:String(e.source.media_type??"text/plain"),data:e.source.data}}else if(T(e,"image")&&$(e.source)&&"type"in e.source){if(e.source.type==="base64"&&g(e.source.media_type)&&g(e.source.data))return{type:"image",mimeType:e.source.media_type,data:e.source.data};if(e.source.type==="url"&&g(e.source.url))return{type:"image",url:e.source.url};if(e.source.type==="file"&&g(e.source.file_id))return{type:"image",fileId:e.source.file_id}}}function ic(e){function*t(){for(let r of e){let n=nc(r);n?yield n:yield r}}return Array.from(t())}function rc(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(T(n,"text")&&g(n.text)){let{text:i,citations:a,...s}=n;if(de(a)&&a.length){let o=a.reduce((c,u)=>{let l=Np(u);return l?[...c,l]:c},[]);yield{...s,type:"text",text:i,annotations:o};continue}else{yield{...s,type:"text",text:i};continue}}else if(T(n,"thinking")&&g(n.thinking)){let{thinking:i,signature:a,...s}=n;yield{...s,type:"reasoning",reasoning:i,signature:a};continue}else if(T(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(T(n,"tool_use")&&g(n.name)&&g(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(T(n,"input_json_delta")){if($p(e)&&e.tool_call_chunks?.length){let i=e.tool_call_chunks[0];yield{type:"tool_call_chunk",id:i.id,name:i.name,args:i.args,index:i.index};continue}}else if(T(n,"server_tool_use")&&g(n.name)&&g(n.id)){let{name:i,id:a}=n;if(i==="web_search"){yield{id:a,type:"server_tool_call",name:"web_search",args:{query:Ue(()=>{if(typeof n.input=="string")return n.input;if($(n.input)&&g(n.input.query))return n.input.query;if(g(n.partial_json)){let s=Na(n.partial_json);if(s?.query)return s.query}return""})}};continue}else if(n.name==="code_execution"){yield{id:a,type:"server_tool_call",name:"code_execution",args:{code:Ue(()=>{if(typeof n.input=="string")return n.input;if($(n.input)&&g(n.input.code))return n.input.code;if(g(n.partial_json)){let s=Na(n.partial_json);if(s?.code)return s.code}return""})}};continue}}else if(T(n,"web_search_tool_result")&&g(n.tool_use_id)&&de(n.content)){let{content:i,tool_use_id:a}=n;yield{type:"server_tool_call_result",name:"web_search",toolCallId:a,status:"success",output:{urls:i.reduce((s,o)=>T(o,"web_search_result")?[...s,o.url]:s,[])}};continue}else if(T(n,"code_execution_tool_result")&&g(n.tool_use_id)&&$(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(T(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(T(n,"mcp_tool_result")&&g(n.tool_use_id)&&$(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(T(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(T(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(T(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let i=nc(n);if(i){yield i;continue}}yield{type:"non_standard",value:n}}}return Array.from(t())}var ac={translateContent:rc,translateContentChunk:rc};function $p(e){return typeof e?._getType=="function"&&typeof e.concat=="function"&&e._getType()==="ai"}function Pp(e){return Qo(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:ec(e)?{type:e.type,mimeType:e.mime_type??"application/octet-stream",data:e.data,metadata:e.metadata}:tc(e)?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e}function sc(e){return e.map(Pp)}function oc(e){return!!(T(e,"image_url")&&$(e.image_url)||T(e,"input_audio")&&$(e.input_audio)||T(e,"file")&&$(e.file))}function cc(e){if(T(e,"image_url")&&$(e.image_url)&&g(e.image_url.url)){let t=Ra({dataUrl:e.image_url.url});return t?{type:"image",mimeType:t.mime_type,data:t.data}:{type:"image",url:e.image_url.url}}else{if(T(e,"input_audio")&&$(e.input_audio)&&g(e.input_audio.data)&&g(e.input_audio.format))return{type:"audio",data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};if(T(e,"file")&&$(e.file)&&g(e.file.data)){let t=Ra({dataUrl:e.file.data});if(t)return{type:"file",data:t.data,mimeType:t.mime_type};if(g(e.file.file_id))return{type:"file",fileId:e.file.file_id}}}return e}function Mp(e){let t=[];typeof e.content=="string"?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...Bn(e.content));for(let r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}function jp(e){let t=[];typeof e.content=="string"?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...Bn(e.content));for(let r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}function Bn(e){let t=[];for(let r of e)oc(r)?t.push(cc(r)):t.push(r);return t}function Lp(e){if(e.type==="url_citation"){let{url:t,title:r,start_index:n,end_index:i}=e;return{type:"citation",url:t,title:r,startIndex:n,endIndex:i}}if(e.type==="file_citation"){let{file_id:t,filename:r,index:n}=e;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:t}}return e}function uc(e){function*t(){$(e.additional_kwargs?.reasoning)&&de(e.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:e.additional_kwargs.reasoning.summary.reduce((n,i)=>$(i)&&g(i.text)?`${n}${i.text}`:n,"")});let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r)if(T(n,"text")){let{text:i,annotations:a,phase:s,extras:o,...c}=n,u=$(o)?{...o}:{};g(s)&&(u.phase=s);let l=Object.keys(u).length>0?{extras:u}:{};Array.isArray(a)?yield{...c,...l,type:"text",text:String(i),annotations:a.map(Lp)}:yield{...c,...l,type:"text",text:String(i)}}for(let n of e.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if($(e.additional_kwargs)&&de(e.additional_kwargs.tool_outputs))for(let n of e.additional_kwargs.tool_outputs){if(T(n,"web_search_call")){let i={};if($(n.action)&&g(n.action.query)&&(i.query=n.action.query),yield{id:n.id,type:"server_tool_call",name:"web_search",args:i},n.status==="completed"||n.status==="failed"){let a={};$(n.action)&&(a.action=n.action),yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:a}}continue}else if(T(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{queries:de(n.queries)?n.queries:[]}},(n.status==="completed"||n.status==="failed")&&(yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:de(n.results)?{results:n.results}:{}});continue}else if(T(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(T(n,"code_interpreter_call")){if(g(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),de(n.outputs)){let i=Ue(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let a of n.outputs)if(T(a,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:i??0,stderr:[0,void 0].includes(i)?void 0:String(a.logs),stdout:[0,void 0].includes(i)?String(a.logs):void 0}};continue}}continue}else if(T(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(T(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(T(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(T(n,"tool_search_call")){let i={};$(n.arguments)&&Object.assign(i,n.arguments);let a={};g(n.execution)&&(a.execution=n.execution),g(n.status)&&(a.status=n.status),g(n.call_id)&&(a.call_id=n.call_id),yield{id:g(n.id)?n.id:"",type:"server_tool_call",name:"tool_search",args:i,...Object.keys(a).length>0?{extras:a}:{}};continue}else if(T(n,"tool_search_output")){let i={name:"tool_search"};g(n.execution)&&(i.execution=n.execution),yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":n.status==="failed"?"error":"success",output:{tools:de(n.tools)?n.tools:[]},extras:i};continue}else if(T(n,"image_generation_call")){g(n.result)&&(yield{type:"image",mimeType:"image/png",data:n.result,id:g(n.id)?n.id:void 0,metadata:{status:g(n.status)?n.status:void 0}}),yield{type:"non_standard",value:n};continue}$(n)&&(yield{type:"non_standard",value:n})}}return Array.from(t())}function Dp(e){function*t(){yield*uc(e);for(let r of e.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(t())}var lc={translateContent:e=>typeof e.content=="string"?Mp(e):uc(e),translateContentChunk:e=>typeof e.content=="string"?jp(e):Dp(e)};function dc(e){return typeof e=="object"&&e!==null&&"type"in e&&"content"in e&&(typeof e.content=="string"||Array.isArray(e.content))}function fc(e,t="pretty"){return t==="pretty"?Up(e):JSON.stringify(e)}function Up(e){let t=[],r=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),i="=".repeat(n),a=r.length%2===0?i:`${i}=`;if(t.push(`${i}${r}${a}`),e.type==="ai"){let s=e;if(s.tool_calls&&s.tool_calls.length>0){t.push("Tool Calls:");for(let o of s.tool_calls){t.push(` ${o.name} (${o.id})`),t.push(` Call ID: ${o.id}`),t.push(" Args:");for(let[c,u]of Object.entries(o.args))t.push(` ${c}: ${typeof u=="object"?JSON.stringify(u):u}`)}}}if(e.type==="tool"){let s=e;s.name&&t.push(`Name: ${s.name}`)}return typeof e.content=="string"&&e.content.trim()&&(t.length>1&&t.push(""),t.push(e.content)),t.join(`
3
3
  `)}var $a=Symbol.for("langchain.message");function pc(e){return Array.isArray(e)?e:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e==null?[]:[e]}function Pe(e,t){if(typeof e=="string")return e===""?t:typeof t=="string"?e+t:Array.isArray(t)&&t.length===0?e:Array.isArray(t)&&t.some(r=>Rt(r))?[{type:"text",source_type:"text",text:e},...t]:[{type:"text",text:e},...t];if(Array.isArray(t)){let r=pc(e);return Cr(r,t)??[...r,...t]}else return t===""?e:Array.isArray(e)&&e.some(r=>Rt(r))?[...e,{type:"file",source_type:"text",text:t}]:[...pc(e),{type:"text",text:t}]}function _c(e,t){return e==="error"||t==="error"?"error":"success"}function zp(e,t){function r(n,i){if(typeof n!="object"||n===null||n===void 0)return n;if(i>=t)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(s=>r(s,i+1));let a={};for(let s of Object.keys(n))a[s]=r(n[s],i+1);return a}return JSON.stringify(r(e,0),null,2)}var ke=class extends ft{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[$a]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(e){let t=typeof e=="string"||Array.isArray(e)?{content:e}:e;t.additional_kwargs||(t.additional_kwargs={}),t.response_metadata||(t.response_metadata={}),super(t),this.name=t.name,t.content===void 0&&t.contentBlocks!==void 0?(this.content=t.contentBlocks,this.response_metadata={output_version:"v1",...t.response_metadata}):t.content!==void 0?(this.content=t.content??[],this.response_metadata=t.response_metadata):(this.content=[],this.response_metadata=t.response_metadata),this.additional_kwargs=t.additional_kwargs,this.id=t.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(e=>typeof e=="string"?e:e.type==="text"?e.text:"").join(""):""}get contentBlocks(){let e=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[sc,Bn,ic].reduce((t,r)=>r(t),e)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(e){return typeof e=="object"&&e!==null&&$a in e&&e[$a]===!0&&dc(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let t=zp(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${t}`}toFormattedString(e="pretty"){return fc(this,e)}};function mb(e){return Array.isArray(e)&&e.every(t=>typeof t.index=="number")}var Bp=["index","created","timestamp"];function ce(e,t,r){let n=r?.ignoreKeys??Bp;if(e==null&&t==null)return;if(e==null||t==null)return e??t;let i={...e};for(let[a,s]of Object.entries(t))if(i[a]==null)i[a]=s;else{if(s==null)continue;if(typeof i[a]!=typeof s||Array.isArray(i[a])!==Array.isArray(s))throw new Error(`field[${a}] already exists in the message chunk, but with a different type.`);if(typeof i[a]=="string"){if(a==="type")continue;if(["id","name","output_version","model_provider"].includes(a))s&&(i[a]=s);else{if(n.includes(a))continue;i[a]+=s}}else if(typeof i[a]=="number"){if(n.includes(a))continue;i[a]=i[a]+s}else if(typeof i[a]=="object"&&!Array.isArray(i[a]))i[a]=ce(i[a],s,r);else if(Array.isArray(i[a]))i[a]=Cr(i[a],s,r);else{if(i[a]===s)continue;console.warn(`field[${a}] already exists in this message chunk and value has unsupported type.`)}}return i}function Fp(e){return typeof e=="number"||typeof e=="string"}function hc(e){return typeof e!="object"||e===null||!("index"in e)?!1:Fp(e.index)}function mc(e){if(typeof e!="object"||e===null||!("id"in e))return!1;let t=e.id;return t!=null&&t!==""}function gc(e){return e.endsWith("_delta")?e.slice(0,-6):e}function Hp(e,t){return typeof e!="object"||e===null||typeof t!="object"||t===null||!("type"in e)||!("type"in t)?!1:typeof e.type=="string"&&typeof t.type=="string"&&gc(e.type)!==gc(t.type)}function Gp(e,t){let r=hc(t),n=mc(t);return!r&&!n?-1:e.findIndex(i=>{let a=hc(i),s=mc(i);return r&&a?i.index!==t.index||Hp(i,t)?!1:s&&n?i.id===t.id:!0:!r&&!a&&n&&s?i.id===t.id:!1})}function Cr(e,t,r){if(!(e==null&&t==null)){if(e==null||t==null)return e||t;{let n=[...e];for(let i of t){let a=Gp(n,i);if(a!==-1)n[a]=ce(n[a],i,r);else{if(typeof i=="object"&&i!==null&&"text"in i&&i.text==="")continue;n.push(i)}}return n}}}function yc(e,t,r){if(!(e==null&&t==null)){if(e==null||t==null)return e??t;if(typeof e!=typeof t)throw new Error(`Cannot merge objects of different types.
4
4
  Left ${typeof e}
5
5
  Right ${typeof t}`);if(typeof e=="string"&&typeof t=="string")return e+t;if(Array.isArray(e)&&Array.isArray(t))return Cr(e,t,r);if(typeof e=="object"&&typeof t=="object")return ce(e,t,r);if(e===t)return e;throw new Error(`Can not merge objects of different types.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a,b as c,c as o}from"./RX45PCYB.js";import"./PBTINZTK.js";import{g as e,h as t,v as i,z as s}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./YIMNOUTF.js";var l=e`.container{color:var(--calcite-color-text-1)}.content>*{margin:0}.content>*+*{margin-block-start:var(--calcite-spacing-sm)}.content :is(ol,ul){padding-inline-start:var(--calcite-spacing-lg)}.content>calcite-table{display:block;max-width:100%}.content pre{background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-sm);border-radius:var(--calcite-border-radius);color:var(--calcite-color-text-1);direction:ltr;max-width:100%;overflow:auto}.content pre code{display:block;white-space:pre;font-family:var(--calcite-code-family)}.part{animation:part-reveal calc(3 * var(--calcite-animation-timing)) ease-out}@keyframes part-reveal{0%{opacity:0;transform:translateY(var(--calcite-size-fixed-xxs))}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.part{animation:none}}`,r=class extends i{static{this.properties={content:1,parts:0}}static{this.styles=l}render(){return t`<div class="container"><div class="content">${this.parts?.map(n=>t`<span class="part">${a(o(n))}</span>`)??a(c(this.content))}</div></div>`}};s("arcgis-assistant-message-text",r);export{r as ArcgisAssistantMessageText};
2
+ import{a,b as c,c as o}from"./WSGWTIAV.js";import"./PBTINZTK.js";import{g as e,h as t,v as i,z as s}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var l=e`.container{color:var(--calcite-color-text-1)}.content>*{margin:0}.content>*+*{margin-block-start:var(--calcite-spacing-sm)}.content :is(ol,ul){padding-inline-start:var(--calcite-spacing-lg)}.content>calcite-table{display:block;max-width:100%}.content pre{background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-sm);border-radius:var(--calcite-border-radius);color:var(--calcite-color-text-1);direction:ltr;max-width:100%;overflow:auto}.content pre code{display:block;white-space:pre;font-family:var(--calcite-code-family)}.part{animation:part-reveal calc(3 * var(--calcite-animation-timing)) ease-out}@keyframes part-reveal{0%{opacity:0;transform:translateY(var(--calcite-size-fixed-xxs))}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.part{animation:none}}`,r=class extends i{static{this.properties={content:1,parts:0}}static{this.styles=l}render(){return t`<div class="container"><div class="content">${this.parts?.map(n=>t`<span class="part">${a(o(n))}</span>`)??a(c(this.content))}</div></div>`}};s("arcgis-assistant-message-text",r);export{r as ArcgisAssistantMessageText};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ca as c}from"./MU52B4SV.js";function f(e,s,t){return{...e,status:s,summary:t}}function g(e){let s=Object.entries(e).filter(([t,n])=>t!=="agentExecutionContext"&&t!=="outputMessage"&&t!=="summary"&&t!=="status"&&n!==void 0);if(s.length!==0)try{return JSON.stringify(Object.fromEntries(s),null,2)}catch{return}}function m(e,s,t=[]){let n=s.safeParse(e);if(n.success){let u={...n.data},r=g(u),a=r??"LLMAgent produced structured output.",o=r??u.outputMessage,i={...u,...o?{outputMessage:o}:{},agentExecutionContext:{messages:[...t,new c(typeof o=="string"&&o.trim()?o:a)]}};return f(i,"success",a)}else throw new Error(`LLMAgent output schema validation failed: ${n.error.message}`)}function l(e,s){let t={outputMessage:e.outputMessage};if(s){let n=s.shape,u=e;for(let r of Object.keys(n??{}))r in e&&(t[r]=u[r])}return t}export{f as a,m as b,l as c};
2
+ import{ca as c}from"./LUY6V4TP.js";function f(e,s,t){return{...e,status:s,summary:t}}function g(e){let s=Object.entries(e).filter(([t,n])=>t!=="agentExecutionContext"&&t!=="outputMessage"&&t!=="summary"&&t!=="status"&&n!==void 0);if(s.length!==0)try{return JSON.stringify(Object.fromEntries(s),null,2)}catch{return}}function m(e,s,t=[]){let n=s.safeParse(e);if(n.success){let u={...n.data},r=g(u),a=r??"LLMAgent produced structured output.",o=r??u.outputMessage,i={...u,...o?{outputMessage:o}:{},agentExecutionContext:{messages:[...t,new c(typeof o=="string"&&o.trim()?o:a)]}};return f(i,"success",a)}else throw new Error(`LLMAgent output schema validation failed: ${n.error.message}`)}function l(e,s){let t={outputMessage:e.outputMessage};if(s){let n=s.shape,u=e;for(let r of Object.keys(n??{}))r in e&&(t[r]=u[r])}return t}export{f as a,m as b,l as c};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./QA7IATZC.js";import a from"./3RPE2QMJ.js";import{c as m}from"./XNITXZDU.js";import"./ON5PWODA.js";import"./MU52B4SV.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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"./3OH4DXSY.js";import a from"./MMRRNKWJ.js";import{c as m}from"./SBP6WNDY.js";import"./ZQ7PGNWB.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)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as c}from"./XNITXZDU.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{a as c}from"./SBP6WNDY.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{b as i,c as a}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as s,z as e}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./YIMNOUTF.js";var t=class extends s{static{this.properties={agent:0,context:0}}#t;async getContext(){return i(this.context)?await this.context():this.context}load(){this.#t=a(this)}disconnectedCallback(){this.#t?.unregister(this.agent.id),super.disconnectedCallback()}};e("arcgis-assistant-agent",t);export{t as ArcgisAssistantAgent};
2
+ import{b as i,c as a}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as s,z as e}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var t=class extends s{static{this.properties={agent:0,context:0}}#t;async getContext(){return i(this.context)?await this.context():this.context}load(){this.#t=a(this)}disconnectedCallback(){this.#t?.unregister(this.agent.id),super.disconnectedCallback()}};e("arcgis-assistant-agent",t);export{t as ArcgisAssistantAgent};