@arcgis/ai-components 5.0.0-next.134 → 5.0.0-next.136

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 (64) hide show
  1. package/dist/cdn/{CGHOYBSP.js → 3TCMWTPD.js} +1 -1
  2. package/dist/cdn/{B3CBPMAE.js → 3UG5WTDE.js} +3 -3
  3. package/dist/cdn/{N2GUX6TE.js → 4LENP43C.js} +2 -2
  4. package/dist/cdn/{TW7MVMU3.js → 5B2EOTYQ.js} +2 -2
  5. package/dist/cdn/{QOQBL2ZP.js → 62ILUOJY.js} +2 -2
  6. package/dist/cdn/{EDVYV22K.js → 7DE5BVD5.js} +2 -2
  7. package/dist/cdn/{K4TH3BS4.js → 7U3ZJE74.js} +2 -2
  8. package/dist/cdn/{E2HMACO2.js → AA4MFJ3S.js} +2 -2
  9. package/dist/cdn/{SKS3G7F2.js → ALMVA7MQ.js} +2 -2
  10. package/dist/cdn/{ZVXWUZUH.js → AU4REOCQ.js} +3 -3
  11. package/dist/cdn/{JINQHP2K.js → AZNXA22U.js} +1 -1
  12. package/dist/cdn/{B6US7W4D.js → C367X64H.js} +2 -2
  13. package/dist/cdn/DI6CDXVQ.js +4 -0
  14. package/dist/cdn/{IRD6DO56.js → DR6U7IZT.js} +2 -2
  15. package/dist/cdn/{WHXIJIZ2.js → FJVWWC7W.js} +2 -2
  16. package/dist/cdn/{4KX47OIY.js → HYKMA4XQ.js} +2 -2
  17. package/dist/cdn/{QXQTSWME.js → IRGK3XH4.js} +1 -1
  18. package/dist/cdn/{GE5S7JUP.js → LC6VCY7C.js} +2 -2
  19. package/dist/cdn/{FVN3EMRP.js → MNIES7DU.js} +2 -2
  20. package/dist/cdn/{73U5QVW7.js → MOKHHOZ6.js} +4 -4
  21. package/dist/cdn/{JIVOCNU3.js → MUIAEICM.js} +2 -2
  22. package/dist/cdn/{U5FDX47E.js → NJU7DK4H.js} +2 -2
  23. package/dist/cdn/{F2ZCKVDM.js → NJXGFRUZ.js} +2 -2
  24. package/dist/cdn/{6OU24WKD.js → O7P4MUTM.js} +2 -2
  25. package/dist/cdn/{IOZANV7W.js → POCZKXEN.js} +2 -2
  26. package/dist/cdn/{WCDHMKXX.js → PWFMAIRB.js} +2 -2
  27. package/dist/cdn/{2SGFDAEY.js → QXKRKCDT.js} +1 -1
  28. package/dist/cdn/{TTICFYA5.js → R7METAZI.js} +2 -2
  29. package/dist/cdn/{3VFAPRYD.js → RCEHEWVV.js} +2 -2
  30. package/dist/cdn/{4OVLOQXC.js → S7FHBAYV.js} +2 -2
  31. package/dist/cdn/{BM5HBCMM.js → SZOB7EAQ.js} +2 -2
  32. package/dist/cdn/{PXFUXDHH.js → TPZHKIIX.js} +2 -2
  33. package/dist/cdn/{NWRUA6RD.js → UO6Y6VSM.js} +2 -2
  34. package/dist/cdn/{EPPE6NOO.js → VE7FAPV4.js} +2 -2
  35. package/dist/cdn/{L66SQDYK.js → VMQIQSRT.js} +2 -2
  36. package/dist/cdn/{BNCRA5SC.js → VXGAJ3X5.js} +2 -2
  37. package/dist/cdn/{W3S5QQYL.js → XIFAX2H6.js} +2 -2
  38. package/dist/cdn/{GTB7E7IK.js → XIYGDRGF.js} +2 -2
  39. package/dist/cdn/{6DPOGMLP.js → ZEVKT23V.js} +2 -2
  40. package/dist/cdn/index.js +2 -2
  41. package/dist/chunks/runtime.js +1 -1
  42. package/dist/chunks/useT9n.js +1 -1
  43. package/dist/chunks/utils.js +1 -1
  44. package/dist/chunks/utils2.js +1 -1
  45. package/dist/components/arcgis-assistant/customElement.js +1 -1
  46. package/dist/components/arcgis-assistant-agent/customElement.js +1 -1
  47. package/dist/components/arcgis-assistant-chat/customElement.js +1 -1
  48. package/dist/components/arcgis-assistant-chat-card/customElement.js +1 -1
  49. package/dist/components/arcgis-assistant-chat-card-content/customElement.js +1 -1
  50. package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
  51. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
  52. package/dist/components/arcgis-assistant-interrupt/customElement.js +1 -1
  53. package/dist/components/arcgis-assistant-layer-filter-agent/customElement.js +1 -1
  54. package/dist/components/arcgis-assistant-layer-query-agent/customElement.js +1 -1
  55. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
  56. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
  57. package/dist/components/arcgis-assistant-shell/customElement.js +1 -1
  58. package/dist/docs/api.json +2 -2
  59. package/dist/docs/docs.json +2 -2
  60. package/dist/docs/web-types.json +1 -1
  61. package/dist/index.js +1 -1
  62. package/dist/loader.js +1 -1
  63. package/package.json +6 -6
  64. package/dist/cdn/3MMHUDSF.js +0 -4
@@ -1,12 +1,12 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import a from"./73U5QVW7.js";import{Ba as _,F as O,I as H,M as j,Wa as n,Y as K}from"./B3CBPMAE.js";export default $arcgis.t(([tt,oe,Ne,rt,{addressToLocations:at},Re,V,U,ie,ne,Ae,qe,se,ke,{createRenderer:ot},{getSchemesByTag:it,getSchemes:nt},{getBackgroundColorTheme:Te},{createAgeRenderer:st,createContinuousRenderer:lt},{getSchemesByTag:le},{createContinuousRenderer:ct},{createRenderer:dt},{getSchemesByTag:ut},{createRenderer:mt},{getSchemesByTag:ht},{createRenderer:ft},{getSchemesByTag:gt},{createRenderer:yt},{getSchemesByTag:pt},{createAgeRenderer:wt,createContinuousRenderer:bt},{createRenderer:St},{getSchemesByTag:vt},{a:ge,b:ye,c:p,d:g,e:N,f:x,g:pe,h:G,i:W,j:we,k:R,l:A,m:m,n:E,o:Y,p:be,q:C}])=>{var ve=e=>Array.isArray(e)&&e.every(O),He=e=>typeof e=="object"&&e!=null&&"messages"in e&&ve(e.messages),Ke=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,L=class extends we{constructor(r,t){let{name:a,tags:o,handleToolErrors:i}=t??{};super({name:a,tags:o,func:(s,l)=>this.run(s,l)}),Object.defineProperty(this,"tools",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"handleToolErrors",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"trace",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.tools=r,this.handleToolErrors=i??this.handleToolErrors}async runTool(r,t){let a=this.tools.find(o=>o.name===r.name);try{if(a===void 0)throw new Error(`Tool "${r.name}" not found.`);let o=await a.invoke({...r,type:"tool_call"},t);return O(o)&&o.getType()==="tool"||W(o)?o:new H({status:"success",name:a.name,content:typeof o=="string"?o:JSON.stringify(o),tool_call_id:r.id})}catch(o){if(!this.handleToolErrors||ye(o))throw o;return new H({status:"error",content:`Error: ${o.message}
3
+ v5.0.0-next.136 */
4
+ import a from"./MOKHHOZ6.js";import{Ba as _,F as O,I as H,M as j,Wa as n,Y as K}from"./3UG5WTDE.js";export default $arcgis.t(([tt,oe,Ne,rt,{addressToLocations:at},Re,V,U,ie,ne,Ae,qe,se,ke,{createRenderer:ot},{getSchemesByTag:it,getSchemes:nt},{getBackgroundColorTheme:Te},{createAgeRenderer:st,createContinuousRenderer:lt},{getSchemesByTag:le},{createContinuousRenderer:ct},{createRenderer:dt},{getSchemesByTag:ut},{createRenderer:mt},{getSchemesByTag:ht},{createRenderer:ft},{getSchemesByTag:gt},{createRenderer:yt},{getSchemesByTag:pt},{createAgeRenderer:wt,createContinuousRenderer:bt},{createRenderer:St},{getSchemesByTag:vt},{a:ge,b:ye,c:p,d:g,e:N,f:x,g:pe,h:G,i:W,j:we,k:R,l:A,m:m,n:E,o:Y,p:be,q:C}])=>{var ve=e=>Array.isArray(e)&&e.every(O),He=e=>typeof e=="object"&&e!=null&&"messages"in e&&ve(e.messages),Ke=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,L=class extends we{constructor(r,t){let{name:a,tags:o,handleToolErrors:i}=t??{};super({name:a,tags:o,func:(s,l)=>this.run(s,l)}),Object.defineProperty(this,"tools",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"handleToolErrors",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"trace",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.tools=r,this.handleToolErrors=i??this.handleToolErrors}async runTool(r,t){let a=this.tools.find(o=>o.name===r.name);try{if(a===void 0)throw new Error(`Tool "${r.name}" not found.`);let o=await a.invoke({...r,type:"tool_call"},t);return O(o)&&o.getType()==="tool"||W(o)?o:new H({status:"success",name:a.name,content:typeof o=="string"?o:JSON.stringify(o),tool_call_id:r.id})}catch(o){if(!this.handleToolErrors||ye(o))throw o;return new H({status:"error",content:`Error: ${o.message}
5
5
  Please fix your mistakes.`,name:r.name,tool_call_id:r.id??""})}}async run(r,t){let a;if(Ke(r))a=[await this.runTool(r.lg_tool_call,t)];else{let s;if(ve(r))s=r;else if(He(r))s=r.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let l=new Set(s.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),d;for(let c=s.length-1;c>=0;c-=1){let u=s[c];if(u.getType()==="ai"){d=u;break}}if(d?.getType()!=="ai")throw new Error("ToolNode only accepts AIMessages as input.");a=await Promise.all(d.tool_calls?.filter(c=>c.id==null||!l.has(c.id)).map(c=>this.runTool(c,t))??[])}if(!a.some(W))return Array.isArray(r)?a:{messages:a};let o=[],i=null;for(let s of a)W(s)?s.graph===G.PARENT&&Array.isArray(s.goto)&&s.goto.every(l=>pe(l))?i?i.goto.push(...s.goto):i=new G({graph:G.PARENT,goto:s.goto}):o.push(s):o.push(Array.isArray(r)?[s]:{messages:[s]});return i&&o.push(i),o}};var Rn=g.Root({llmInputMessages:g({reducer:(e,r)=>A([],r),default:()=>[]})});var ze=g.Root({messages:g({reducer:A,default:()=>[]}),outputMessage:g({reducer:(e="",r)=>{let t=typeof r=="string"?r.trim():"";if(!t)return e;let a=e.trim();if(!a)return t;if(a===t)return e;let o=a.split(`
6
6
 
7
7
  `);return o[o.length-1]?.trim()===t?e:`${e}
8
8
 
9
- ${t}`},default:()=>""}),intent:g({reducer:(e,r)=>r}),vectorSearchLayerResults:g({reducer:(e,r)=>r,default:()=>[]}),vectorSearchFieldResults:g({reducer:(e,r)=>r})});async function Tt(e,r){let t="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer";console.log(`[goToAddress] Geocoding: ${e}`);let a=(await at(t,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!a?.extent)throw new Error(`Could not find location for: ${e}`);let{xmin:o,ymin:i,xmax:s,ymax:l,spatialReference:d}=a.extent,c=new Ne({xmin:o,ymin:i,xmax:s,ymax:l,spatialReference:d}),u=(o+s)/2,h=(i+l)/2,y=new oe({x:u,y:h,spatialReference:d}),f=new rt({style:"circle",color:"red",size:12}),w=new tt({geometry:y,symbol:f});return r.graphics.removeAll(),r.graphics.add(w),await r.goTo(c),`Successfully zoomed to: ${a.address}. Location coordinates: x=${u}, y=${h}, wkid=${d.wkid}`}var xt=["mapView"];function $(e){let r=e?.configurable?.context;if(!r||typeof r!="object")throw new Error("NavigationAgent context missing");let t=xt.filter(a=>!(a in r));if(t.length)throw new Error(`NavigationAgent context missing: ${t.join(", ")}`);return r}async function Et({address:e},r){let{mapView:t}=$(r);return await Tt(e,t)}var Lt=n.object({address:n.string().describe("The full address or place name to locate.")}),It=p(Et,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:Lt});async function $t(e,r){let t=r.map.bookmarks;if(!t||t.length===0)throw new Error("No bookmarks found in the map.");let a=t.find(i=>i.name===e);if(!a)throw new Error(`Bookmark with name "${e}" not found.`);let o=a.viewpoint;if(!o)throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);return await r.goTo(o),`Navigated to bookmark: ${e}`}async function Ft({bookmarkName:e},r){let{mapView:t}=$(r);return await Promise.resolve($t(e,t))}var _t=_.object({bookmarkName:_.string().describe("The name of the bookmark to navigate to.")}),Nt=p(Ft,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:_t});async function Rt(e,r,t){let a=t.map?.allLayers.find(i=>i.id===e);if(!a)return`Error: Layer with id ${e} not found`;let o=a.createQuery();o.where=r??"1=1";try{let{extent:i,count:s}=await a.queryExtent(o);if(s===0)return`No features found in ${a.title} matching: ${r}`;if(i)await t.goTo(i);else return`Error: Unable to determine extent for ${a.title}`;return`Successfully zoomed to ${s} feature(s) in ${a.title}`}catch(i){return console.error("Error in goToFeatures:",i),`Error: ${i instanceof Error?i.message:"Unknown error"}`}}async function At({layerId:e,where:r},t){let{mapView:a}=$(t);return await Rt(e,r,a)}var qt=_.object({layerId:_.string().describe("The layerId of the layer to zoom to."),where:_.string().describe("The sql-92 where clause used to query features to zoom to")}),kt=p(At,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:qt});async function zt(e){let r=new Ne({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await e.goTo(r),"Successfully zoomed to world extent"}async function Mt(e,r){let{mapView:t}=$(r);return await zt(t)}var Ct=_.object({}),jt=p(Mt,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Ct});async function Vt(e){let r=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(r)await e.goTo(r);else throw new Error("Initial extent is undefined");return"Successfully zoomed to home extent"}async function Ot(e,r){let{mapView:t}=$(r);return await Vt(t)}var Dt=n.object({}),Bt=p(Ot,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:Dt});async function Qt(e,r){await r.when();let t=r.map?.allLayers.find(o=>o.id===e);if(!t)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`),`Could not find layer for: ${e}`;console.log(`[goToLayer] Zooming to layer: ${t.title}`);let a=t.fullExtent;return a?(await r.goTo(a),t.visible=!0,`Successfully zoomed to: ${t.title??""}`):"Layer has no defined extent. Cannot zoom to layer."}async function Pt({layerId:e},r){let{mapView:t}=$(r);return await Qt(e,t)}var Gt=_.object({layerId:_.string().describe("The id of the layer to navigate to")}),Wt=p(Pt,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:Gt});async function Ut(e,r){return await r.goTo({scale:e}),`Successfully zoomed to: ${e}`}async function Jt({scale:e},r){let{mapView:t}=$(r);return await Ut(e,t)}var Zt=n.object({scale:n.number().describe("The map scale of the view to go to.")}),Ht=p(Jt,{name:"goToScale",description:"Go to the specified view scale.",schema:Zt});async function Kt(e,r,t){let a={target:new oe({longitude:e.longitude,latitude:e.latitude,spatialReference:{wkid:4326}})};return t?.zoom!==void 0&&(a.zoom=t.zoom),t?.scale!==void 0&&(a.scale=t.scale),await r.goTo(a),`Successfully navigated to: ${[`(${e.latitude}\xB0, ${e.longitude}\xB0)`,t?.zoom!==void 0?`zoom ${t.zoom}`:"",t?.scale!==void 0?`scale 1:${t.scale}`:""].filter(Boolean).join(", ")}`}async function Yt({center:e,zoom:r,scale:t},a){let{mapView:o}=$(a);return await Kt(e,o,{zoom:r,scale:t})}var Xt=n.object({center:n.object({longitude:n.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:n.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:n.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:n.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),er=p(Yt,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:Xt});async function tr(e,r){return await r.goTo({zoom:e}),`Successfully zoomed to: ${e}`}async function rr({zoom:e},r){let{mapView:t}=$(r);return await tr(e,t)}var ar=n.object({zoom:n.number().min(1).max(20).describe("The zoom level of the view to go to.")}),or=p(rr,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:ar}),ce=[It,Nt,kt,jt,Bt,Wt,Ht,er,or],xe=Object.assign({"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./B6US7W4D.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./K4TH3BS4.js").then(e=>e.default),"../agents/layerFilter/prompts/layer_filter_prompt.md":()=>import("./BM5HBCMM.js").then(e=>e.default),"../agents/layerQuery/prompts/data_query_prompt.md":()=>import("./IRD6DO56.js").then(e=>e.default),"../agents/layerQuery/prompts/summarize_query_response_prompt.md":()=>import("./SKS3G7F2.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./GTB7E7IK.js").then(e=>e.default),"../agents/linkChart/prompts/link_chart_intent_prompt.md":()=>import("./EDVYV22K.js").then(e=>e.default),"../agents/linkChart/prompts/link_chart_tool_prompt.md":()=>import("./JIVOCNU3.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./3VFAPRYD.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./U5FDX47E.js").then(e=>e.default)});async function q(e){let r=Object.entries(xe).find(([t])=>t.endsWith(`/${e}.md`));if(console.log(`entry for prompt "${e}":`,r),!r)throw new Error(`Prompt not found: ${e}
9
+ ${t}`},default:()=>""}),intent:g({reducer:(e,r)=>r}),vectorSearchLayerResults:g({reducer:(e,r)=>r,default:()=>[]}),vectorSearchFieldResults:g({reducer:(e,r)=>r})});async function Tt(e,r){let t="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer";console.log(`[goToAddress] Geocoding: ${e}`);let a=(await at(t,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!a?.extent)throw new Error(`Could not find location for: ${e}`);let{xmin:o,ymin:i,xmax:s,ymax:l,spatialReference:d}=a.extent,c=new Ne({xmin:o,ymin:i,xmax:s,ymax:l,spatialReference:d}),u=(o+s)/2,h=(i+l)/2,y=new oe({x:u,y:h,spatialReference:d}),f=new rt({style:"circle",color:"red",size:12}),w=new tt({geometry:y,symbol:f});return r.graphics.removeAll(),r.graphics.add(w),await r.goTo(c),`Successfully zoomed to: ${a.address}. Location coordinates: x=${u}, y=${h}, wkid=${d.wkid}`}var xt=["mapView"];function $(e){let r=e?.configurable?.context;if(!r||typeof r!="object")throw new Error("NavigationAgent context missing");let t=xt.filter(a=>!(a in r));if(t.length)throw new Error(`NavigationAgent context missing: ${t.join(", ")}`);return r}async function Et({address:e},r){let{mapView:t}=$(r);return await Tt(e,t)}var Lt=n.object({address:n.string().describe("The full address or place name to locate.")}),It=p(Et,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:Lt});async function $t(e,r){let t=r.map.bookmarks;if(!t||t.length===0)throw new Error("No bookmarks found in the map.");let a=t.find(i=>i.name===e);if(!a)throw new Error(`Bookmark with name "${e}" not found.`);let o=a.viewpoint;if(!o)throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);return await r.goTo(o),`Navigated to bookmark: ${e}`}async function Ft({bookmarkName:e},r){let{mapView:t}=$(r);return await Promise.resolve($t(e,t))}var _t=_.object({bookmarkName:_.string().describe("The name of the bookmark to navigate to.")}),Nt=p(Ft,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:_t});async function Rt(e,r,t){let a=t.map?.allLayers.find(i=>i.id===e);if(!a)return`Error: Layer with id ${e} not found`;let o=a.createQuery();o.where=r??"1=1";try{let{extent:i,count:s}=await a.queryExtent(o);if(s===0)return`No features found in ${a.title} matching: ${r}`;if(i)await t.goTo(i);else return`Error: Unable to determine extent for ${a.title}`;return`Successfully zoomed to ${s} feature(s) in ${a.title}`}catch(i){return console.error("Error in goToFeatures:",i),`Error: ${i instanceof Error?i.message:"Unknown error"}`}}async function At({layerId:e,where:r},t){let{mapView:a}=$(t);return await Rt(e,r,a)}var qt=_.object({layerId:_.string().describe("The layerId of the layer to zoom to."),where:_.string().describe("The sql-92 where clause used to query features to zoom to")}),kt=p(At,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:qt});async function zt(e){let r=new Ne({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await e.goTo(r),"Successfully zoomed to world extent"}async function Mt(e,r){let{mapView:t}=$(r);return await zt(t)}var Ct=_.object({}),jt=p(Mt,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Ct});async function Vt(e){let r=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(r)await e.goTo(r);else throw new Error("Initial extent is undefined");return"Successfully zoomed to home extent"}async function Ot(e,r){let{mapView:t}=$(r);return await Vt(t)}var Dt=n.object({}),Bt=p(Ot,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:Dt});async function Qt(e,r){await r.when();let t=r.map?.allLayers.find(o=>o.id===e);if(!t)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`),`Could not find layer for: ${e}`;console.log(`[goToLayer] Zooming to layer: ${t.title}`);let a=t.fullExtent;return a?(await r.goTo(a),t.visible=!0,`Successfully zoomed to: ${t.title??""}`):"Layer has no defined extent. Cannot zoom to layer."}async function Pt({layerId:e},r){let{mapView:t}=$(r);return await Qt(e,t)}var Gt=_.object({layerId:_.string().describe("The id of the layer to navigate to")}),Wt=p(Pt,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:Gt});async function Ut(e,r){return await r.goTo({scale:e}),`Successfully zoomed to: ${e}`}async function Jt({scale:e},r){let{mapView:t}=$(r);return await Ut(e,t)}var Zt=n.object({scale:n.number().describe("The map scale of the view to go to.")}),Ht=p(Jt,{name:"goToScale",description:"Go to the specified view scale.",schema:Zt});async function Kt(e,r,t){let a={target:new oe({longitude:e.longitude,latitude:e.latitude,spatialReference:{wkid:4326}})};return t?.zoom!==void 0&&(a.zoom=t.zoom),t?.scale!==void 0&&(a.scale=t.scale),await r.goTo(a),`Successfully navigated to: ${[`(${e.latitude}\xB0, ${e.longitude}\xB0)`,t?.zoom!==void 0?`zoom ${t.zoom}`:"",t?.scale!==void 0?`scale 1:${t.scale}`:""].filter(Boolean).join(", ")}`}async function Yt({center:e,zoom:r,scale:t},a){let{mapView:o}=$(a);return await Kt(e,o,{zoom:r,scale:t})}var Xt=n.object({center:n.object({longitude:n.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:n.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:n.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:n.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),er=p(Yt,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:Xt});async function tr(e,r){return await r.goTo({zoom:e}),`Successfully zoomed to: ${e}`}async function rr({zoom:e},r){let{mapView:t}=$(r);return await tr(e,t)}var ar=n.object({zoom:n.number().min(1).max(20).describe("The zoom level of the view to go to.")}),or=p(rr,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:ar}),ce=[It,Nt,kt,jt,Bt,Wt,Ht,er,or],xe=Object.assign({"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./C367X64H.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./7U3ZJE74.js").then(e=>e.default),"../agents/layerFilter/prompts/layer_filter_prompt.md":()=>import("./SZOB7EAQ.js").then(e=>e.default),"../agents/layerQuery/prompts/data_query_prompt.md":()=>import("./DR6U7IZT.js").then(e=>e.default),"../agents/layerQuery/prompts/summarize_query_response_prompt.md":()=>import("./ALMVA7MQ.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./XIYGDRGF.js").then(e=>e.default),"../agents/linkChart/prompts/link_chart_intent_prompt.md":()=>import("./7DE5BVD5.js").then(e=>e.default),"../agents/linkChart/prompts/link_chart_tool_prompt.md":()=>import("./MUIAEICM.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./RCEHEWVV.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./NJU7DK4H.js").then(e=>e.default)});async function q(e){let r=Object.entries(xe).find(([t])=>t.endsWith(`/${e}.md`));if(console.log(`entry for prompt "${e}":`,r),!r)throw new Error(`Prompt not found: ${e}
10
10
  Available prompts:
11
11
  ${Object.keys(xe).join(`
12
12
  `)}`);return await r[1]()}var ir=(e,r=3)=>e.filter(t=>t instanceof K).slice(-r),S=(e,r=3)=>{let t=e.map((o,i)=>o instanceof K?i:-1).filter(o=>o!==-1);if(t.length===0)return[];let a=t.length>r?t[t.length-r]:t[0];return e.slice(a)},F=(e,r=" ")=>ir(e).map(t=>t.content).join(r).trim();async function nr(e,r){let t=await q("navigation_tool_prompt"),{mapView:a}=$(r),o=a.map,i=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((w,v)=>`${v+1}. layerId=${w.id} | title=${w.title??""} | name=${w.name??""} | score=${w.score.toFixed(2)}`).join(`
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
3
+ v5.0.0-next.136 */
4
4
  var g=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports),n=(b,a)=>{for(var c in a)e(b,c,{get:a[c],enumerable:!0})},l=(b,a,c,f)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&e(b,d,{get:()=>a[d],enumerable:!(f=h(a,d))||f.enumerable});return b};var o=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?e(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b,o as c};
@@ -1,7 +1,7 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import"./JINQHP2K.js";var e=`# ArcGIS Online Map Viewer \u2014 Layer Filter Tool Calling Assistant
3
+ v5.0.0-next.136 */
4
+ import"./AZNXA22U.js";var e=`# ArcGIS Online Map Viewer \u2014 Layer Filter Tool Calling Assistant
5
5
 
6
6
  You are an assistant that helps generate layer filter expressions for **ArcGIS Online Map Viewer** by selecting and calling the appropriate tool.
7
7
 
@@ -0,0 +1,4 @@
1
+ /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
+ v5.0.0-next.136 */
4
+ import a from"./O7P4MUTM.js";import"./3UG5WTDE.js";import"./AZNXA22U.js";export default $arcgis.t(([{m:a,n:b}])=>{return{FewShotChatMessagePromptTemplate:b,FewShotPromptTemplate:a}},a)
@@ -1,7 +1,7 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import"./JINQHP2K.js";var e=`# ArcGIS JavaScript SDK FeatureLayerView Query Assistant
3
+ v5.0.0-next.136 */
4
+ import"./AZNXA22U.js";var e=`# ArcGIS JavaScript SDK FeatureLayerView Query Assistant
5
5
 
6
6
  You are a GIS assistant that generates query parameters for the ArcGIS JavaScript SDK FeatureLayerView \`queryFeatures()\` method.
7
7
 
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import{a as o}from"./GE5S7JUP.js";import"./QXQTSWME.js";import{g as a,h as t,k as e,p as n,t as l}from"./CGHOYBSP.js";import"./JINQHP2K.js";var r=a`.assistant-shell__footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.assistant-shell__content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative}.assistant-shell__suggested-prompts-container{position:absolute;bottom:0;display:flex;justify-content:center;width:100%}.assistant-shell__suggested-prompts{padding:var(--calcite-spacing-md)}.assistant-shell__suggested-prompt{max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-style:normal}`,i=class extends n{constructor(){super(...arguments),this._messages=o({blocking:!0}),this.description="",this.loading=!1,this.entryMessageClosed=!1,this.awaitingResponse=!1,this.suggestedPrompts=[],this.inputValue="",this.arcgisCancel=e(),this.arcgisSubmit=e()}static{this.properties={heading:1,description:1,loading:5,entryMessage:1,entryMessageClosed:5,awaitingResponse:5,suggestedPrompts:0,inputValue:1,status:1}}static{this.styles=r}_renderSuggestedPrompts(){return this.suggestedPrompts?.length?t`<div class="assistant-shell__suggested-prompts-container"><calcite-chip-group class="assistant-shell__suggested-prompts" .label=${this._messages.suggestedPromptsLabel??"suggested prompts"} selection-mode=single-persist @calciteChipGroupSelect=${s=>this.inputValue=s.target.selectedItems[0]?.value??""}>${this.suggestedPrompts.map(s=>t`<calcite-chip closable .value=${s} .label=${s} appearance=outline-fill kind=brand><div class="assistant-shell__suggested-prompt">${s}</div></calcite-chip>`)}</calcite-chip-group></div>`:null}render(){return t`<calcite-panel .loading=${this.loading} .heading=${this.heading??this._messages.shellHeading} .description=${this.description}><slot slot=header-actions-end name=header-actions-end></slot><div class="assistant-shell__content-container"><slot></slot>${this._renderSuggestedPrompts()}</div><div class="assistant-shell__footer-container" slot=footer><slot name=entry-message>${this.entryMessageClosed?null:t`<calcite-notice slot=entry-message .open=${!this.entryMessageClosed} kind=info closable icon width=full><div slot=message>${this.entryMessage??this._messages.shellEntryMessage}</div></calcite-notice>`}</slot><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse} .arcgisSubmit=${this.arcgisSubmit} .arcgisCancel=${this.arcgisCancel} .inputValue=${this.inputValue} .status=${this.status}><slot name=entry-actions-start slot=entry-actions-start></slot></arcgis-assistant-chat-entry><slot name=footer-content></slot></div></calcite-panel>`}};l("arcgis-assistant-shell",i);export{i as ArcgisAssistantShell};
3
+ v5.0.0-next.136 */
4
+ import{a as o}from"./LC6VCY7C.js";import"./IRGK3XH4.js";import{g as a,h as t,k as e,p as n,t as l}from"./3TCMWTPD.js";import"./AZNXA22U.js";var r=a`.assistant-shell__footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.assistant-shell__content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative}.assistant-shell__suggested-prompts-container{position:absolute;bottom:0;display:flex;justify-content:center;width:100%}.assistant-shell__suggested-prompts{padding:var(--calcite-spacing-md)}.assistant-shell__suggested-prompt{max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-style:normal}`,i=class extends n{constructor(){super(...arguments),this._messages=o({blocking:!0}),this.description="",this.loading=!1,this.entryMessageClosed=!1,this.awaitingResponse=!1,this.suggestedPrompts=[],this.inputValue="",this.arcgisCancel=e(),this.arcgisSubmit=e()}static{this.properties={heading:1,description:1,loading:5,entryMessage:1,entryMessageClosed:5,awaitingResponse:5,suggestedPrompts:0,inputValue:1,status:1}}static{this.styles=r}_renderSuggestedPrompts(){return this.suggestedPrompts?.length?t`<div class="assistant-shell__suggested-prompts-container"><calcite-chip-group class="assistant-shell__suggested-prompts" .label=${this._messages.suggestedPromptsLabel??"suggested prompts"} selection-mode=single-persist @calciteChipGroupSelect=${s=>this.inputValue=s.target.selectedItems[0]?.value??""}>${this.suggestedPrompts.map(s=>t`<calcite-chip closable .value=${s} .label=${s} appearance=outline-fill kind=brand><div class="assistant-shell__suggested-prompt">${s}</div></calcite-chip>`)}</calcite-chip-group></div>`:null}render(){return t`<calcite-panel .loading=${this.loading} .heading=${this.heading??this._messages.shellHeading} .description=${this.description}><slot slot=header-actions-end name=header-actions-end></slot><div class="assistant-shell__content-container"><slot></slot>${this._renderSuggestedPrompts()}</div><div class="assistant-shell__footer-container" slot=footer><slot name=entry-message>${this.entryMessageClosed?null:t`<calcite-notice slot=entry-message .open=${!this.entryMessageClosed} kind=info closable icon width=full><div slot=message>${this.entryMessage??this._messages.shellEntryMessage}</div></calcite-notice>`}</slot><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse} .arcgisSubmit=${this.arcgisSubmit} .arcgisCancel=${this.arcgisCancel} .inputValue=${this.inputValue} .status=${this.status}><slot name=entry-actions-start slot=entry-actions-start></slot></arcgis-assistant-chat-entry><slot name=footer-content></slot></div></calcite-panel>`}};l("arcgis-assistant-shell",i);export{i as ArcgisAssistantShell};
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import{a as s}from"./2SGFDAEY.js";import{b as o}from"./QXQTSWME.js";function i(e,t){let n=s(e.referenceElement);if(n)return n;let r=o(e.el,"arcgis-assistant"),a=s(r?.referenceElement);if(a)return a;throw new Error(`${t}: Reference element not found`)}async function m(e,t){let n=i(e,t);await n.componentOnReady();let r=n.view;if(!r)throw new Error(`${t}: Reference element does not have a view`);return await r.when(),r}function g(e){let t=o(e.el,"arcgis-assistant");if(t===void 0)throw new Error("arcgis-assistant-agent must be used within an arcgis-assistant element");t.register({agent:e.agent,getContext:()=>e.getContext?.()??e.context??{}})}export{m as a,g as b};
3
+ v5.0.0-next.136 */
4
+ import{a as s}from"./QXKRKCDT.js";import{b as o}from"./IRGK3XH4.js";function i(e,t){let n=s(e.referenceElement);if(n)return n;let r=o(e.el,"arcgis-assistant"),a=s(r?.referenceElement);if(a)return a;throw new Error(`${t}: Reference element not found`)}async function m(e,t){let n=i(e,t);await n.componentOnReady();let r=n.view;if(!r)throw new Error(`${t}: Reference element does not have a view`);return await r.when(),r}function g(e){let t=o(e.el,"arcgis-assistant");if(t===void 0)throw new Error("arcgis-assistant-agent must be used within an arcgis-assistant element");t.register({agent:e.agent,getContext:()=>e.getContext?.()??e.context??{}})}export{m as a,g as b};
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
3
+ v5.0.0-next.136 */
4
4
  var a=(n,t)=>{let e=n;for(;e;){if(e===t)return!0;if(!e.parentNode)return!1;e.parentNode instanceof ShadowRoot?e=e.parentNode.host:e=e.parentNode}return!1},f=(n,t,e)=>{let s=l(t).subscribe;return s(o=>{o.some(r=>a(n,r.target))&&e()})},c={},l=n=>{let t=n.join(","),e=c[t];if(e!==void 0)return e;let s=new Set,o=new MutationObserver(r=>s.forEach(u=>u(r)));globalThis.document&&o.observe(document.documentElement,{attributes:!0,attributeFilter:n,subtree:!0});let i={subscribe:r=>(s.add(r),()=>{s.delete(r),s.size===0&&(o.disconnect(),c[t]=void 0)})};return c[t]=i,i},d=(n,t)=>{let e=n;for(;e;){let s=e.closest?.(t);if(s)return s;let o=e.getRootNode?.();if(o===globalThis.document)return;e=o.host}};var h=(n,t,e)=>d(n,`[${t}]`)?.getAttribute(t)??e;export{f as a,d as b,h as c};
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import{a as $,c as k}from"./QXQTSWME.js";import{a as C,b as L,c as m,d as f,e as P,f as O,i as g,j as v,l as w,u as N}from"./CGHOYBSP.js";var _=t=>(...s)=>{let o=f(),e=new t(...s),r=e.exports;m(o.at(-1));let n=e.component.manager;n.W(e,r),e.watchExports(n.W.bind(n,e)),P(e);let a=[e.component,...o].reverse();return v(a,i=>i===void 0?void 0:j(e,i,r),r)},j=(t,{host:s,key:o,isReactive:e},r)=>{let n=s,a=n[o]!==t.exports,i=n[o]!==r,c=r!==t.exports;if(a&&!i&&c&&(n[o]=t.exports),s===t.component){if(e){let l=t.component.manager;i&&l.W(t,n[o]),t.onUpdate(u=>{if(u.has(o)){let x=n[o];x!==t.exports&&l.W(t,x)}})}t.O=e?void 0:o}let d=t.component.constructor.elementProperties.get(o)?.readOnly;t.watchExports(()=>{n[o]!==t.exports&&(d?O(()=>{n[o]=t.exports}):n[o]=t.exports)})};var z="ar,bg,bs,ca,cs,da,de,el,en,es,et,fi,fr,he,hr,hu,id,it,ja,ko,lt,lv,nl,nb,no,pl,pt-BR,pt-PT,ro,ru,sk,sl,sr,sv,th,tr,uk,vi,zh-CN,zh-HK,zh-TW".split(","),M=new Set(z),h="en",U={pt:"pt-PT",nb:"no",nn:"no",zh:"zh-CN"},F=async(t,s,o="")=>{let e=`${s}/${o}`,r=`${e}${t}.json`;return b[r]??(b[r]=A(t,e)),await b[r]},b={},A=async(t,s)=>{let o=`${s}${t}.json`;try{let e=await fetch(o);if(e.ok)return await e.json()}catch(e){return g("error","intl",`An unknown error occurred while fetching localization strings at ${o}`,{detail:{error:e}}),{}}return t===h?{}:await A(h,s)},y=t=>{let s=k(t,"lang",globalThis.navigator?.language||h);return{lang:s,t9nLocale:T(s)}},T=t=>{let[s,o]=t.split("-"),e=s.toLowerCase(),r=e;return o&&(r=`${e}-${o.toUpperCase()}`),r=U[r]??r,M.has(r)?r:o?T(e):h},D=(t,s,o,e)=>{let r,n=()=>K(t,s(),e).then(a=>{(r?.lang!==a.lang||r.t9nLocale!==a.t9nLocale||r.t9nStrings!==a.t9nStrings)&&o(a),r=a}).catch(a=>{g("error","intl","Error updating component locale state",{detail:{error:a}})});return queueMicrotask(n),$(t,["lang"],n)},K=async(t,s,o=t.localName.split("-").slice(1).join("-"))=>{let{lang:e,t9nLocale:r}=y(t),n=`${s}/${o}/t9n`,i=o===null?{}:await F(r,n,"messages.");return{lang:e,t9nLocale:r,t9nStrings:i}};var W=t=>I(void 0,t);var E=class extends w{constructor(s,o){super(s);let e=this.exports;try{L(this.component);let r=o(this.component,this),n=this.exports!==e;if(C(r)){n||this.setProvisionalExports(r);let a=r.then(i=>{this.exports=i,super.catchUpLifecycle()}).catch(i=>{this.P.reject(i)});this.onLoad(async()=>await a)}else(!n||r!==void 0)&&(this.exports=r),queueMicrotask(()=>super.catchUpLifecycle())}catch(r){this.P.reject(r)}}catchUpLifecycle(){}},I=_(E);var S=t=>(s={})=>W((o,e)=>{let r=y(o.el),n={_lang:r.lang,_t9nLocale:r.t9nLocale,_loading:!0},a=o;e.onLifecycle(()=>D(o.el,()=>t("./assets"),({t9nLocale:c,t9nStrings:p,lang:d})=>{let l={...p,_lang:d,_t9nLocale:c,_loading:!1};e.exports=l;let u=p.componentLabel;typeof u=="string"&&"label"in o&&o.label==null&&(o.label??=u),i(a.messageOverrides)},s.name));let i=c=>{let p=e.exports,d=p._original??p,l=V(d,c);c&&(l._original=d),e.exports=l};return"messageOverrides"in a&&e.onUpdate(c=>{c.has("messageOverrides")&&i(a.messageOverrides)}),s.blocking?(e.setProvisionalExports(n,!1),e.ready):n}),V=(t,s)=>{if(!s)return t;let o={...t};return Object.entries(s).forEach(([e,r])=>{t[e]!==void 0&&(typeof r=="object"?o[e]=V(t[e],r):o[e]=r??t[e])}),o};var ct=S(N);export{ct as a};
3
+ v5.0.0-next.136 */
4
+ import{a as $,c as k}from"./IRGK3XH4.js";import{a as C,b as L,c as m,d as f,e as P,f as O,i as g,j as v,l as w,u as N}from"./3TCMWTPD.js";var _=t=>(...s)=>{let o=f(),e=new t(...s),r=e.exports;m(o.at(-1));let n=e.component.manager;n.W(e,r),e.watchExports(n.W.bind(n,e)),P(e);let a=[e.component,...o].reverse();return v(a,i=>i===void 0?void 0:j(e,i,r),r)},j=(t,{host:s,key:o,isReactive:e},r)=>{let n=s,a=n[o]!==t.exports,i=n[o]!==r,c=r!==t.exports;if(a&&!i&&c&&(n[o]=t.exports),s===t.component){if(e){let l=t.component.manager;i&&l.W(t,n[o]),t.onUpdate(u=>{if(u.has(o)){let x=n[o];x!==t.exports&&l.W(t,x)}})}t.O=e?void 0:o}let d=t.component.constructor.elementProperties.get(o)?.readOnly;t.watchExports(()=>{n[o]!==t.exports&&(d?O(()=>{n[o]=t.exports}):n[o]=t.exports)})};var z="ar,bg,bs,ca,cs,da,de,el,en,es,et,fi,fr,he,hr,hu,id,it,ja,ko,lt,lv,nl,nb,no,pl,pt-BR,pt-PT,ro,ru,sk,sl,sr,sv,th,tr,uk,vi,zh-CN,zh-HK,zh-TW".split(","),M=new Set(z),h="en",U={pt:"pt-PT",nb:"no",nn:"no",zh:"zh-CN"},F=async(t,s,o="")=>{let e=`${s}/${o}`,r=`${e}${t}.json`;return b[r]??(b[r]=A(t,e)),await b[r]},b={},A=async(t,s)=>{let o=`${s}${t}.json`;try{let e=await fetch(o);if(e.ok)return await e.json()}catch(e){return g("error","intl",`An unknown error occurred while fetching localization strings at ${o}`,{detail:{error:e}}),{}}return t===h?{}:await A(h,s)},y=t=>{let s=k(t,"lang",globalThis.navigator?.language||h);return{lang:s,t9nLocale:T(s)}},T=t=>{let[s,o]=t.split("-"),e=s.toLowerCase(),r=e;return o&&(r=`${e}-${o.toUpperCase()}`),r=U[r]??r,M.has(r)?r:o?T(e):h},D=(t,s,o,e)=>{let r,n=()=>K(t,s(),e).then(a=>{(r?.lang!==a.lang||r.t9nLocale!==a.t9nLocale||r.t9nStrings!==a.t9nStrings)&&o(a),r=a}).catch(a=>{g("error","intl","Error updating component locale state",{detail:{error:a}})});return queueMicrotask(n),$(t,["lang"],n)},K=async(t,s,o=t.localName.split("-").slice(1).join("-"))=>{let{lang:e,t9nLocale:r}=y(t),n=`${s}/${o}/t9n`,i=o===null?{}:await F(r,n,"messages.");return{lang:e,t9nLocale:r,t9nStrings:i}};var W=t=>I(void 0,t);var E=class extends w{constructor(s,o){super(s);let e=this.exports;try{L(this.component);let r=o(this.component,this),n=this.exports!==e;if(C(r)){n||this.setProvisionalExports(r);let a=r.then(i=>{this.exports=i,super.catchUpLifecycle()}).catch(i=>{this.P.reject(i)});this.onLoad(async()=>await a)}else(!n||r!==void 0)&&(this.exports=r),queueMicrotask(()=>super.catchUpLifecycle())}catch(r){this.P.reject(r)}}catchUpLifecycle(){}},I=_(E);var S=t=>(s={})=>W((o,e)=>{let r=y(o.el),n={_lang:r.lang,_t9nLocale:r.t9nLocale,_loading:!0},a=o;e.onLifecycle(()=>D(o.el,()=>t("./assets"),({t9nLocale:c,t9nStrings:p,lang:d})=>{let l={...p,_lang:d,_t9nLocale:c,_loading:!1};e.exports=l;let u=p.componentLabel;typeof u=="string"&&"label"in o&&o.label==null&&(o.label??=u),i(a.messageOverrides)},s.name));let i=c=>{let p=e.exports,d=p._original??p,l=V(d,c);c&&(l._original=d),e.exports=l};return"messageOverrides"in a&&e.onUpdate(c=>{c.has("messageOverrides")&&i(a.messageOverrides)}),s.blocking?(e.setProvisionalExports(n,!1),e.ready):n}),V=(t,s)=>{if(!s)return t;let o={...t};return Object.entries(s).forEach(([e,r])=>{t[e]!==void 0&&(typeof r=="object"?o[e]=V(t[e],r):o[e]=r??t[e])}),o};var ct=S(N);export{ct as a};
@@ -1,6 +1,6 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import{a as b}from"./GE5S7JUP.js";import c from"./73U5QVW7.js";import{a as f}from"./2SGFDAEY.js";import"./QXQTSWME.js";import{g as y,h,n as g,o as u,p as v,t as _}from"./CGHOYBSP.js";import a from"./6OU24WKD.js";import"./B3CBPMAE.js";import"./JINQHP2K.js";export default $arcgis.t(([E,{whenOnce:k,watch:L,when:S},O,P,{property:c,subclass:C},,{r:w}])=>{var H=y`:host{height:100%}`,M=Object.defineProperty,x=Object.getOwnPropertyDescriptor,n=(l,t,e,r)=>{for(var s=r>1?void 0:r?x(t,e):t,a=l.length-1,o;a>=0;a--)(o=l[a])&&(s=(r?o(t,e,s):o(s))||s);return r&&s&&M(t,e,s),s},i=class extends P{constructor(l){super(l),this.view=null,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await k(()=>!this.view.updating),this._set("orchestrator",await w.init({agents:[...this.agents],portal:this.portal,view:this.view??void 0})),this.addHandles([L(()=>[this.view,this.agents],()=>void this._initialize())])}async*ask(l,t){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let e="";try{let r=this.orchestrator.ask(l);for await(let s of r){if(t?.aborted){yield{type:"cancelled"};break}switch(s.type){case"trace":{this._set("processingStep",s.data.text),e+=`${s.data.text}
3
+ v5.0.0-next.136 */
4
+ import{a as b}from"./LC6VCY7C.js";import c from"./MOKHHOZ6.js";import{a as f}from"./QXKRKCDT.js";import"./IRGK3XH4.js";import{g as y,h,n as g,o as u,p as v,t as _}from"./3TCMWTPD.js";import a from"./O7P4MUTM.js";import"./3UG5WTDE.js";import"./AZNXA22U.js";export default $arcgis.t(([E,{whenOnce:k,watch:L,when:S},O,P,{property:c,subclass:C},,{r:w}])=>{var H=y`:host{height:100%}`,M=Object.defineProperty,x=Object.getOwnPropertyDescriptor,n=(l,t,e,r)=>{for(var s=r>1?void 0:r?x(t,e):t,a=l.length-1,o;a>=0;a--)(o=l[a])&&(s=(r?o(t,e,s):o(s))||s);return r&&s&&M(t,e,s),s},i=class extends P{constructor(l){super(l),this.view=null,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await k(()=>!this.view.updating),this._set("orchestrator",await w.init({agents:[...this.agents],portal:this.portal,view:this.view??void 0})),this.addHandles([L(()=>[this.view,this.agents],()=>void this._initialize())])}async*ask(l,t){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let e="";try{let r=this.orchestrator.ask(l);for await(let s of r){if(t?.aborted){yield{type:"cancelled"};break}switch(s.type){case"trace":{this._set("processingStep",s.data.text),e+=`${s.data.text}
5
5
 
6
6
  `;break}case"completed":{if(!s.result.content.length){yield{type:"completed",error:"Could not process the request.",log:e};return}let a=s.result.content;this._set("processingStep",""),yield{type:"completed",response:a,log:e};return}case"interrupt":{console.log("Orchestrator interrupt:",s);let{kind:a,message:o,metadata:m}=s.interrupt,p=Array.isArray(m)?[...m]:[],$=(()=>{switch(a){case"booleanChoice":return{type:"boolean-choice",message:o,options:p};case"singleSelection":return{type:"single-select",message:o,options:p};case"multipleSelection":return{type:"multi-select",message:o,options:p};case"textInput":return{type:"text-input",message:o};default:return{type:a,message:o,options:p}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:$};break}case"cancelled":{yield{type:"cancelled"};return}default:{console.warn("Unknown event type:",s);break}}}}catch(r){console.warn("Error during message processing:",r),yield{type:"completed",error:"An error occurred during message processing.",log:e};return}finally{this._set("processing",!1)}}};n([c({readOnly:!0})],i.prototype,"orchestrator",2);n([c()],i.prototype,"agents",2);n([c()],i.prototype,"portal",2);n([c()],i.prototype,"view",2);n([c({readOnly:!0})],i.prototype,"loading",2);n([c({readOnly:!0})],i.prototype,"processing",2);n([c({readOnly:!0})],i.prototype,"processingStep",2);i=n([C("OrchestratorController")],i);var d=class extends v{constructor(){super(...arguments),this._messages=b({blocking:!0}),this.#e=g(),this.#s=g(),this.#t=null,this.#r=null,this.#a=new Map,this.#i=t=>{t.stopPropagation(),this.orchestrator?.cancelInterrupt(),this._interrupt=null},this.#o=t=>{t.stopPropagation();let e=t.detail;this.orchestrator?.resumeInterrupt(e),this._interrupt=null},this.#n=t=>{t.stopPropagation(),this.suggestedPrompts=[];let e=t.detail;this.#h(e)},this.#l=t=>{if(t.stopPropagation(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this.#r?.abort()},this._interrupt=null,this._chatHistory=new E([]),this._error=null,this.referenceElement=null,this.portal=new O,this.suggestedPrompts=[]}static{this.properties={_interrupt:16,_chatHistory:16,_error:16,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,portal:0,suggestedPrompts:0}}static{this.styles=H}#e;#s;#t;#r;#a;#i;#o;#n;#l;get orchestrator(){return this.#t?.orchestrator}register(t){this.#a.set(t.agent.id,t)}load(){this.manager.onLifecycle(()=>()=>{this.#r?.abort(),this._interrupt=null,this._chatHistory.removeAll(),this._error=null})}loaded(){this.manager.onLifecycle(()=>{this.#e.value?.addEventListener("arcgisSubmit",this.#n),this.#e.value?.addEventListener("arcgisCancel",this.#l);let t=S(()=>!!this._interrupt&&!!this.#s.value,()=>{let e=this.#s.value;e.removeEventListener("arcgisSubmit",this.#o),e.removeEventListener("arcgisCancel",this.#i),e.addEventListener("arcgisSubmit",this.#o,{once:!0}),e.addEventListener("arcgisCancel",this.#i,{once:!0})});return queueMicrotask(()=>void this.#c()),()=>{t.remove(),this.#s.value?.removeEventListener("arcgisSubmit",this.#o),this.#s.value?.removeEventListener("arcgisCancel",this.#i),this.#e.value?.removeEventListener("arcgisSubmit",this.#n),this.#e.value?.removeEventListener("arcgisCancel",this.#l),this.#t?.destroy(),this.#t=null}})}async#c(){try{let t=f(this.referenceElement);await t?.componentOnReady();let e=[...this.#a.values()];this.#t=new i({agents:e,portal:this.portal,view:t?.view}),await this.#t.load()}catch(t){console.warn(t),this._error="Error initializing orchestrator."}}async#h(t){let e=t.trim();if(!e||(this._chatHistory.push({type:"prompt",content:e}),!this.#t))return;this.#r=new AbortController;let r=this.#t.ask(e,this.#r.signal);for await(let s of r)switch(s.type){case"completed":this._chatHistory.push({type:"response",content:s.response,log:s.log,error:s.error});break;case"interrupt":this._interrupt=s.payload;break;case"cancelled":this._chatHistory.push({type:"response",error:"Request cancelled."});break}}render(){return h`<arcgis-assistant-shell .loading=${this.#t?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} .entryMessage=${this.entryMessage} .entryMessageClosed=${this._chatHistory.length>0} .awaitingResponse=${this.#t?.processing} .suggestedPrompts=${this.suggestedPrompts} .status=${this.#t?.processing?"working":this._error?"error":"ready"} ${u(this.#e)}>${this._error?h`<calcite-notice slot=entry-message open kind=danger icon width=full><div slot=message>${this._error}</div></calcite-notice>`:null}${this._interrupt?h`<arcgis-assistant-interrupt slot=entry-message .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${u(this.#s)}></arcgis-assistant-interrupt>`:null}<arcgis-assistant-chat .loading=${this.#t?.processing} .loadingMessage=${this.#t?.processingStep||""} .messages=${this._chatHistory} .user=${this.portal?.user?.fullName||this.portal?.user?.username}><slot></slot></arcgis-assistant-chat><slot name=header-actions-end slot=header-actions-end></slot>${this.entryMessage?null:h`<slot name=entry-message slot=entry-message></slot>`}<slot name=entry-actions-start slot=entry-actions-start></slot><slot name=footer-content slot=footer-content></slot></arcgis-assistant-shell>`}};_("arcgis-assistant",d);return d},"core/Collection","core/reactiveUtils","portal/Portal","core/Accessor","core/accessorSupport/decorators",a,c)
@@ -1,7 +1,7 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import a from"./6OU24WKD.js";import{$a as zm,Aa as B,Ab as bf,Ba as ie,Bb as yf,Ca as sf,Cb as Qe,Da as on,Db as hi,Ea as ot,Eb as Dt,F as ye,Fa as lr,Fb as _f,G as Xn,Ga as Fe,Gb as wf,H as Bh,Ha as ct,Hb as Ne,I as nc,Ia as fe,Ib as fi,J as zh,Ja as Yn,Jb as vf,K as ai,Ka as oc,Kb as xf,La as Zt,Lb as kf,M as ue,Ma as af,Mb as Af,N as Yt,Na as of,O as sc,Oa as cn,Ob as Sf,P as Rt,Pa as ui,Pb as Ym,Q as ic,Qa as dt,Qb as Zm,R as Wh,Ra as cf,Rb as Qm,Sa as un,Sb as eg,Ta as uf,Tb as tg,Ua as lf,Ub as rg,V as Kh,Va as hf,Vb as ng,Wa as ut,Wb as sg,Xa as ff,Xb as ig,Y as it,Ya as pf,Yb as ag,Z as Vh,Za as cc,Zb as og,_a as Zn,_b as mc,a as Ch,ab as lt,b as Ih,bb as uc,c as Nh,ca as ac,cb as Qn,d as Rh,db as Wm,e as jh,eb as es,f as Xt,fa as jt,fb as Mt,g as Mh,ga as oi,gb as Km,h as $h,ha as Gh,hb as lc,i as ri,ib as Vm,j as Dh,jb as Gm,k as ni,ka as Hh,kb as Hm,l as si,la as qh,lb as $t,m as ii,ma as He,mb as li,n as Qo,na as Jh,nb as hc,o as Lh,oa as ci,ob as ts,p as Uh,pa as Xh,pb as qm,qa as Yh,qb as Jm,ra as Pr,rb as fc,s as Fh,sa as Zh,sb as Xm,t as ec,ta as Qh,tb as Ae,u as tc,ua as ef,ub as df,v as rc,va as tf,vb as mf,wa as rf,wb as pc,xa as an,xb as gf,ya as at,yb as J,za as nf,zb as hr}from"./B3CBPMAE.js";import{a as Fm,b as te,c as Bm}from"./JINQHP2K.js";export default $arcgis.t(([Md,ih,jy,{a:Of,b:cg,c:ug,d:lg,e:hg,f:fg,g:pg,h:dg,i:mg,j:gg,k:dc,l:Tr,m:bg,n:yg}])=>{var Vf=Fm(Pi=>{"use strict";Pi.byteLength=zg;Pi.toByteArray=Kg;Pi.fromByteArray=Hg;var Lt=[],ht=[],Bg=typeof Uint8Array<"u"?Uint8Array:Array,$c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ir=0,Wf=$c.length;Ir<Wf;++Ir)Lt[Ir]=$c[Ir],ht[$c.charCodeAt(Ir)]=Ir;var Ir,Wf;ht[45]=62;ht[95]=63;function Kf(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function zg(r){var e=Kf(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Wg(r,e,t){return(e+t)*3/4-t}function Kg(r){var e,t=Kf(r),n=t[0],s=t[1],i=new Bg(Wg(r,n,s)),a=0,o=s>0?n-4:n,c;for(c=0;c<o;c+=4)e=ht[r.charCodeAt(c)]<<18|ht[r.charCodeAt(c+1)]<<12|ht[r.charCodeAt(c+2)]<<6|ht[r.charCodeAt(c+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return s===2&&(e=ht[r.charCodeAt(c)]<<2|ht[r.charCodeAt(c+1)]>>4,i[a++]=e&255),s===1&&(e=ht[r.charCodeAt(c)]<<10|ht[r.charCodeAt(c+1)]<<4|ht[r.charCodeAt(c+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function Vg(r){return Lt[r>>18&63]+Lt[r>>12&63]+Lt[r>>6&63]+Lt[r&63]}function Gg(r,e,t){for(var n,s=[],i=e;i<t;i+=3)n=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(r[i+2]&255),s.push(Vg(n));return s.join("")}function Hg(r){for(var e,t=r.length,n=t%3,s=[],i=16383,a=0,o=t-n;a<o;a+=i)s.push(Gg(r,a,a+i>o?o:a+i));return n===1?(e=r[t-1],s.push(Lt[e>>2]+Lt[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],s.push(Lt[e>>10]+Lt[e>>4&63]+Lt[e<<2&63]+"=")),s.join("")}});var Qt=class extends Error{constructor(e,t){let n=e??"";t?.lc_error_code&&(n=`${n}
3
+ v5.0.0-next.136 */
4
+ import a from"./O7P4MUTM.js";import{$a as zm,Aa as B,Ab as bf,Ba as ie,Bb as yf,Ca as sf,Cb as Qe,Da as on,Db as hi,Ea as ot,Eb as Dt,F as ye,Fa as lr,Fb as _f,G as Xn,Ga as Fe,Gb as wf,H as Bh,Ha as ct,Hb as Ne,I as nc,Ia as fe,Ib as fi,J as zh,Ja as Yn,Jb as vf,K as ai,Ka as oc,Kb as xf,La as Zt,Lb as kf,M as ue,Ma as af,Mb as Af,N as Yt,Na as of,O as sc,Oa as cn,Ob as Sf,P as Rt,Pa as ui,Pb as Ym,Q as ic,Qa as dt,Qb as Zm,R as Wh,Ra as cf,Rb as Qm,Sa as un,Sb as eg,Ta as uf,Tb as tg,Ua as lf,Ub as rg,V as Kh,Va as hf,Vb as ng,Wa as ut,Wb as sg,Xa as ff,Xb as ig,Y as it,Ya as pf,Yb as ag,Z as Vh,Za as cc,Zb as og,_a as Zn,_b as mc,a as Ch,ab as lt,b as Ih,bb as uc,c as Nh,ca as ac,cb as Qn,d as Rh,db as Wm,e as jh,eb as es,f as Xt,fa as jt,fb as Mt,g as Mh,ga as oi,gb as Km,h as $h,ha as Gh,hb as lc,i as ri,ib as Vm,j as Dh,jb as Gm,k as ni,ka as Hh,kb as Hm,l as si,la as qh,lb as $t,m as ii,ma as He,mb as li,n as Qo,na as Jh,nb as hc,o as Lh,oa as ci,ob as ts,p as Uh,pa as Xh,pb as qm,qa as Yh,qb as Jm,ra as Pr,rb as fc,s as Fh,sa as Zh,sb as Xm,t as ec,ta as Qh,tb as Ae,u as tc,ua as ef,ub as df,v as rc,va as tf,vb as mf,wa as rf,wb as pc,xa as an,xb as gf,ya as at,yb as J,za as nf,zb as hr}from"./3UG5WTDE.js";import{a as Fm,b as te,c as Bm}from"./AZNXA22U.js";export default $arcgis.t(([Md,ih,jy,{a:Of,b:cg,c:ug,d:lg,e:hg,f:fg,g:pg,h:dg,i:mg,j:gg,k:dc,l:Tr,m:bg,n:yg}])=>{var Vf=Fm(Pi=>{"use strict";Pi.byteLength=zg;Pi.toByteArray=Kg;Pi.fromByteArray=Hg;var Lt=[],ht=[],Bg=typeof Uint8Array<"u"?Uint8Array:Array,$c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ir=0,Wf=$c.length;Ir<Wf;++Ir)Lt[Ir]=$c[Ir],ht[$c.charCodeAt(Ir)]=Ir;var Ir,Wf;ht[45]=62;ht[95]=63;function Kf(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function zg(r){var e=Kf(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Wg(r,e,t){return(e+t)*3/4-t}function Kg(r){var e,t=Kf(r),n=t[0],s=t[1],i=new Bg(Wg(r,n,s)),a=0,o=s>0?n-4:n,c;for(c=0;c<o;c+=4)e=ht[r.charCodeAt(c)]<<18|ht[r.charCodeAt(c+1)]<<12|ht[r.charCodeAt(c+2)]<<6|ht[r.charCodeAt(c+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return s===2&&(e=ht[r.charCodeAt(c)]<<2|ht[r.charCodeAt(c+1)]>>4,i[a++]=e&255),s===1&&(e=ht[r.charCodeAt(c)]<<10|ht[r.charCodeAt(c+1)]<<4|ht[r.charCodeAt(c+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function Vg(r){return Lt[r>>18&63]+Lt[r>>12&63]+Lt[r>>6&63]+Lt[r&63]}function Gg(r,e,t){for(var n,s=[],i=e;i<t;i+=3)n=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(r[i+2]&255),s.push(Vg(n));return s.join("")}function Hg(r){for(var e,t=r.length,n=t%3,s=[],i=16383,a=0,o=t-n;a<o;a+=i)s.push(Gg(r,a,a+i>o?o:a+i));return n===1?(e=r[t-1],s.push(Lt[e>>2]+Lt[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],s.push(Lt[e>>10]+Lt[e>>4&63]+Lt[e<<2&63]+"=")),s.join("")}});var Qt=class extends Error{constructor(e,t){let n=e??"";t?.lc_error_code&&(n=`${n}
5
5
 
6
6
  Troubleshooting URL: https://langchain-ai.github.io/langgraphjs/troubleshooting/errors/${t.lc_error_code}/
7
7
  `),super(n),Object.defineProperty(this,"lc_error_code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.lc_error_code=t?.lc_error_code}},pi=class extends Qt{get is_bubble_up(){return!0}},di=class extends Qt{constructor(e,t){super(e,t),this.name="GraphRecursionError"}static get unminifiable_name(){return"GraphRecursionError"}},ln=class extends Qt{constructor(e,t){super(e,t),this.name="GraphValueError"}static get unminifiable_name(){return"GraphValueError"}},fr=class extends pi{constructor(e,t){super(JSON.stringify(e,null,2),t),Object.defineProperty(this,"interrupts",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="GraphInterrupt",this.interrupts=e??[]}static get unminifiable_name(){return"GraphInterrupt"}},rs=class extends fr{constructor(e,t){super([{value:e}],t),this.name="NodeInterrupt"}static get unminifiable_name(){return"NodeInterrupt"}},ns=class extends pi{constructor(e){super(),Object.defineProperty(this,"command",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="ParentCommand",this.command=e}static get unminifiable_name(){return"ParentCommand"}};function Ef(r){return r!==void 0&&r.name===ns.unminifiable_name}function hn(r){return r!==void 0&&r.is_bubble_up===!0}function pr(r){return r!==void 0&&[fr.unminifiable_name,rs.unminifiable_name].includes(r.name)}var ss=class extends Qt{constructor(e,t){super(e,t),this.name="EmptyInputError"}static get unminifiable_name(){return"EmptyInputError"}},re=class extends Qt{constructor(e,t){super(e,t),this.name="EmptyChannelError"}static get unminifiable_name(){return"EmptyChannelError"}},q=class extends Qt{constructor(e,t){super(e,t),this.name="InvalidUpdateError"}static get unminifiable_name(){return"InvalidUpdateError"}};var mi=class extends Qt{constructor(e,t){super(e,t),this.name="UnreachableNodeError"}static get unminifiable_name(){return"UnreachableNodeError"}};var Pf=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function _g(r){return typeof r=="string"&&Pf.test(r)}var Tf=_g;function wg(r){if(!Tf(r))throw TypeError("Invalid UUID");var e,t=new Uint8Array(16);return t[0]=(e=parseInt(r.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t[4]=(e=parseInt(r.slice(9,13),16))>>>8,t[5]=e&255,t[6]=(e=parseInt(r.slice(14,18),16))>>>8,t[7]=e&255,t[8]=(e=parseInt(r.slice(19,23),16))>>>8,t[9]=e&255,t[10]=(e=parseInt(r.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=e&255,t}var gi=wg;var Se=[];for(bi=0;bi<256;++bi)Se.push((bi+256).toString(16).slice(1));var bi;function dr(r,e=0){return(Se[r[e+0]]+Se[r[e+1]]+Se[r[e+2]]+Se[r[e+3]]+"-"+Se[r[e+4]]+Se[r[e+5]]+"-"+Se[r[e+6]]+Se[r[e+7]]+"-"+Se[r[e+8]]+Se[r[e+9]]+"-"+Se[r[e+10]]+Se[r[e+11]]+Se[r[e+12]]+Se[r[e+13]]+Se[r[e+14]]+Se[r[e+15]]).toLowerCase()}var yi,vg=new Uint8Array(16);function gc(){if(!yi&&(yi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yi(vg)}var bc,_i,yc=0,_c=0;function xg(r,e,t){var n=e&&t||0,s=e||new Array(16);r=r||{};var i=r.node,a=r.clockseq;if(r._v6||(i||(i=bc),a==null&&(a=_i)),i==null||a==null){var o=r.random||(r.rng||gc)();i==null&&(i=[o[0],o[1],o[2],o[3],o[4],o[5]],!bc&&!r._v6&&(i[0]|=1,bc=i)),a==null&&(a=(o[6]<<8|o[7])&16383,_i===void 0&&!r._v6&&(_i=a))}var c=r.msecs!==void 0?r.msecs:Date.now(),u=r.nsecs!==void 0?r.nsecs:_c+1,l=c-yc+(u-_c)/1e4;if(l<0&&r.clockseq===void 0&&(a=a+1&16383),(l<0||c>yc)&&r.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");yc=c,_c=u,_i=a,c+=122192928e5;var h=((c&268435455)*1e4+u)%4294967296;s[n++]=h>>>24&255,s[n++]=h>>>16&255,s[n++]=h>>>8&255,s[n++]=h&255;var p=c/4294967296*1e4&268435455;s[n++]=p>>>8&255,s[n++]=p&255,s[n++]=p>>>24&15|16,s[n++]=p>>>16&255,s[n++]=a>>>8|128,s[n++]=a&255;for(var f=0;f<6;++f)s[n+f]=i[f];return e||dr(s)}var Cf=xg;function wc(r){var e=typeof r=="string"?gi(r):r,t=Og(e);return typeof r=="string"?dr(t):t}function Og(r,e=!1){return Uint8Array.of((r[6]&15)<<4|r[7]>>4&15,(r[7]&15)<<4|(r[4]&240)>>4,(r[4]&15)<<4|(r[5]&240)>>4,(r[5]&15)<<4|(r[0]&240)>>4,(r[0]&15)<<4|(r[1]&240)>>4,(r[1]&15)<<4|(r[2]&240)>>4,96|r[2]&15,r[3],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}function kg(r){r=unescape(encodeURIComponent(r));for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t));return e}var Ag="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Sg="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function vc(r,e,t){function n(s,i,a,o){var c;if(typeof s=="string"&&(s=kg(s)),typeof i=="string"&&(i=gi(i)),((c=i)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+s.length);if(u.set(i),u.set(s,i.length),u=t(u),u[6]=u[6]&15|e,u[8]=u[8]&63|128,a){o=o||0;for(var l=0;l<16;++l)a[o+l]=u[l];return a}return dr(u)}try{n.name=r}catch{}return n.DNS=Ag,n.URL=Sg,n}function Eg(r,e,t,n){switch(r){case 0:return e&t^~e&n;case 1:return e^t^n;case 2:return e&t^e&n^t&n;case 3:return e^t^n}}function xc(r,e){return r<<e|r>>>32-e}function Pg(r){var e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var s=0;s<n.length;++s)r.push(n.charCodeAt(s))}else Array.isArray(r)||(r=Array.prototype.slice.call(r));r.push(128);for(var i=r.length/4+2,a=Math.ceil(i/16),o=new Array(a),c=0;c<a;++c){for(var u=new Uint32Array(16),l=0;l<16;++l)u[l]=r[c*64+l*4]<<24|r[c*64+l*4+1]<<16|r[c*64+l*4+2]<<8|r[c*64+l*4+3];o[c]=u}o[a-1][14]=(r.length-1)*8/Math.pow(2,32),o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(r.length-1)*8&4294967295;for(var h=0;h<a;++h){for(var p=new Uint32Array(80),f=0;f<16;++f)p[f]=o[h][f];for(var m=16;m<80;++m)p[m]=xc(p[m-3]^p[m-8]^p[m-14]^p[m-16],1);for(var y=t[0],_=t[1],k=t[2],x=t[3],A=t[4],P=0;P<80;++P){var C=Math.floor(P/20),M=xc(y,5)+Eg(C,_,k,x)+A+e[C]+p[P]>>>0;A=x,x=k,k=xc(_,30)>>>0,_=y,y=M}t[0]=t[0]+y>>>0,t[1]=t[1]+_>>>0,t[2]=t[2]+k>>>0,t[3]=t[3]+x>>>0,t[4]=t[4]+A>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,t[0]&255,t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,t[1]&255,t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,t[2]&255,t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,t[3]&255,t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,t[4]&255]}var If=Pg;var Tg=vc("v5",80,If),Oc=Tg;function Nf(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,n)}return t}function Rf(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Nf(Object(t),!0).forEach(function(n){Cg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Nf(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Cg(r,e,t){return(e=Ig(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ig(r){var e=Ng(r,"string");return typeof e=="symbol"?e:e+""}function Ng(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function wi(r={},e,t=0){var n=Cf(Rf(Rf({},r),{},{_v6:!0}),new Uint8Array(16));if(n=wc(n),e){for(var s=0;s<16;s++)e[t+s]=n[s];return e}return dr(n)}function vi(r){return wi({clockseq:r})}function mr(r,e){let t=e.replace(/-/g,"").match(/.{2}/g).map(n=>parseInt(n,16));return Oc(r,new Uint8Array(t))}var xi="__pregel_tasks",jf="__error__",fn="__scheduled__",Mf="__interrupt__",$f="__resume__";var Df=[];var Wu={};te(Wu,{agents:()=>Lf,caches:()=>Ac,callbacks__base:()=>Yh,callbacks__manager:()=>nf,callbacks__promises:()=>rf,chat_history:()=>Ec,documents:()=>Tc,embeddings:()=>Cc,example_selectors:()=>Mc,language_models__base:()=>Fc,language_models__chat_models:()=>Wc,language_models__llms:()=>Kc,load__serializable:()=>Mh,memory:()=>Gc,messages:()=>Of,output_parsers:()=>iu,outputs:()=>cf,prompt_values:()=>Sf,prompts:()=>cu,retrievers:()=>uu,runnables:()=>Hc,stores:()=>hu,tools:()=>pu,tracers__base:()=>Zh,tracers__console:()=>Qh,tracers__initialize:()=>mu,tracers__log_stream:()=>of,tracers__run_collector:()=>bu,tracers__tracer_langchain:()=>tf,tracers__tracer_langchain_v1:()=>du,utils__async_caller:()=>uf,utils__chunk_array:()=>yu,utils__env:()=>Jh,utils__function_calling:()=>wu,utils__hash:()=>kc,utils__json_patch:()=>tu,utils__json_schema:()=>mf,utils__math:()=>xu,utils__stream:()=>af,utils__testing:()=>Bu,utils__tiktoken:()=>Uc,utils__types:()=>zu,vectorstores:()=>ku});var Lf={};var Ac={};te(Ac,{BaseCache:()=>Ai,InMemoryCache:()=>is,deserializeStoredGeneration:()=>$g,getCacheKey:()=>Bf,serializeGeneration:()=>Dg});var kc={};te(kc,{insecureHash:()=>Oi,sha256:()=>Ff});var Rg=typeof window=="object"?window:{},z="0123456789abcdef".split(""),jg=[-2147483648,8388608,32768,128],mt=[24,16,8,0];var _e=[];function gt(r){r?(_e[0]=_e[16]=_e[1]=_e[2]=_e[3]=_e[4]=_e[5]=_e[6]=_e[7]=_e[8]=_e[9]=_e[10]=_e[11]=_e[12]=_e[13]=_e[14]=_e[15]=0,this.blocks=_e):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}gt.prototype.update=function(r){if(!this.finalized){var e=typeof r!="string";e&&r.constructor===Rg.ArrayBuffer&&(r=new Uint8Array(r));for(var t,n=0,s,i=r.length||0,a=this.blocks;n<i;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)for(s=this.start;n<i&&s<64;++n)a[s>>2]|=r[n]<<mt[s++&3];else for(s=this.start;n<i&&s<64;++n)t=r.charCodeAt(n),t<128?a[s>>2]|=t<<mt[s++&3]:t<2048?(a[s>>2]|=(192|t>>6)<<mt[s++&3],a[s>>2]|=(128|t&63)<<mt[s++&3]):t<55296||t>=57344?(a[s>>2]|=(224|t>>12)<<mt[s++&3],a[s>>2]|=(128|t>>6&63)<<mt[s++&3],a[s>>2]|=(128|t&63)<<mt[s++&3]):(t=65536+((t&1023)<<10|r.charCodeAt(++n)&1023),a[s>>2]|=(240|t>>18)<<mt[s++&3],a[s>>2]|=(128|t>>12&63)<<mt[s++&3],a[s>>2]|=(128|t>>6&63)<<mt[s++&3],a[s>>2]|=(128|t&63)<<mt[s++&3]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=a[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};gt.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var r=this.blocks,e=this.lastByteIndex;r[16]=this.block,r[e>>2]|=jg[e&3],this.block=r[16],e>=56&&(this.hashed||this.hash(),r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),r[14]=this.hBytes<<3|this.bytes>>>29,r[15]=this.bytes<<3,this.hash()}};gt.prototype.hash=function(){var r=this.h0,e=this.h1,t=this.h2,n=this.h3,s=this.h4,i,a,o,c=this.blocks;for(a=16;a<80;++a)o=c[a-3]^c[a-8]^c[a-14]^c[a-16],c[a]=o<<1|o>>>31;for(a=0;a<20;a+=5)i=e&t|~e&n,o=r<<5|r>>>27,s=o+i+s+1518500249+c[a]<<0,e=e<<30|e>>>2,i=r&e|~r&t,o=s<<5|s>>>27,n=o+i+n+1518500249+c[a+1]<<0,r=r<<30|r>>>2,i=s&r|~s&e,o=n<<5|n>>>27,t=o+i+t+1518500249+c[a+2]<<0,s=s<<30|s>>>2,i=n&s|~n&r,o=t<<5|t>>>27,e=o+i+e+1518500249+c[a+3]<<0,n=n<<30|n>>>2,i=t&n|~t&s,o=e<<5|e>>>27,r=o+i+r+1518500249+c[a+4]<<0,t=t<<30|t>>>2;for(;a<40;a+=5)i=e^t^n,o=r<<5|r>>>27,s=o+i+s+1859775393+c[a]<<0,e=e<<30|e>>>2,i=r^e^t,o=s<<5|s>>>27,n=o+i+n+1859775393+c[a+1]<<0,r=r<<30|r>>>2,i=s^r^e,o=n<<5|n>>>27,t=o+i+t+1859775393+c[a+2]<<0,s=s<<30|s>>>2,i=n^s^r,o=t<<5|t>>>27,e=o+i+e+1859775393+c[a+3]<<0,n=n<<30|n>>>2,i=t^n^s,o=e<<5|e>>>27,r=o+i+r+1859775393+c[a+4]<<0,t=t<<30|t>>>2;for(;a<60;a+=5)i=e&t|e&n|t&n,o=r<<5|r>>>27,s=o+i+s-1894007588+c[a]<<0,e=e<<30|e>>>2,i=r&e|r&t|e&t,o=s<<5|s>>>27,n=o+i+n-1894007588+c[a+1]<<0,r=r<<30|r>>>2,i=s&r|s&e|r&e,o=n<<5|n>>>27,t=o+i+t-1894007588+c[a+2]<<0,s=s<<30|s>>>2,i=n&s|n&r|s&r,o=t<<5|t>>>27,e=o+i+e-1894007588+c[a+3]<<0,n=n<<30|n>>>2,i=t&n|t&s|n&s,o=e<<5|e>>>27,r=o+i+r-1894007588+c[a+4]<<0,t=t<<30|t>>>2;for(;a<80;a+=5)i=e^t^n,o=r<<5|r>>>27,s=o+i+s-899497514+c[a]<<0,e=e<<30|e>>>2,i=r^e^t,o=s<<5|s>>>27,n=o+i+n-899497514+c[a+1]<<0,r=r<<30|r>>>2,i=s^r^e,o=n<<5|n>>>27,t=o+i+t-899497514+c[a+2]<<0,s=s<<30|s>>>2,i=n^s^r,o=t<<5|t>>>27,e=o+i+e-899497514+c[a+3]<<0,n=n<<30|n>>>2,i=t^n^s,o=e<<5|e>>>27,r=o+i+r-899497514+c[a+4]<<0,t=t<<30|t>>>2;this.h0=this.h0+r<<0,this.h1=this.h1+e<<0,this.h2=this.h2+t<<0,this.h3=this.h3+n<<0,this.h4=this.h4+s<<0};gt.prototype.hex=function(){this.finalize();var r=this.h0,e=this.h1,t=this.h2,n=this.h3,s=this.h4;return z[r>>28&15]+z[r>>24&15]+z[r>>20&15]+z[r>>16&15]+z[r>>12&15]+z[r>>8&15]+z[r>>4&15]+z[r&15]+z[e>>28&15]+z[e>>24&15]+z[e>>20&15]+z[e>>16&15]+z[e>>12&15]+z[e>>8&15]+z[e>>4&15]+z[e&15]+z[t>>28&15]+z[t>>24&15]+z[t>>20&15]+z[t>>16&15]+z[t>>12&15]+z[t>>8&15]+z[t>>4&15]+z[t&15]+z[n>>28&15]+z[n>>24&15]+z[n>>20&15]+z[n>>16&15]+z[n>>12&15]+z[n>>8&15]+z[n>>4&15]+z[n&15]+z[s>>28&15]+z[s>>24&15]+z[s>>20&15]+z[s>>16&15]+z[s>>12&15]+z[s>>8&15]+z[s>>4&15]+z[s&15]};gt.prototype.toString=gt.prototype.hex;gt.prototype.digest=function(){this.finalize();var r=this.h0,e=this.h1,t=this.h2,n=this.h3,s=this.h4;return[r>>24&255,r>>16&255,r>>8&255,r&255,e>>24&255,e>>16&255,e>>8&255,e&255,t>>24&255,t>>16&255,t>>8&255,t&255,n>>24&255,n>>16&255,n>>8&255,n&255,s>>24&255,s>>16&255,s>>8&255,s&255]};gt.prototype.array=gt.prototype.digest;gt.prototype.arrayBuffer=function(){this.finalize();var r=new ArrayBuffer(20),e=new DataView(r);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),r};var Uf=!1,Oi=r=>(Uf||(console.warn(["The default method for hashing keys is insecure and will be replaced in a future version,","but hasn't been replaced yet as to not break existing caches. It's recommended that you use","a more secure hashing algorithm to avoid cache poisoning.","","See this page for more information:","|","\u2514> https://js.langchain.com/docs/troubleshooting/warnings/insecure-cache-algorithm"].join(`
@@ -95,8 +95,8 @@ Or, if you are calling this from a custom tool, ensure you're using the "tool" h
95
95
  |`,`
96
96
  \u2514-> https://js.langchain.com/docs/how_to/custom_tools#tool-function`,`
97
97
  `].join(" "));let n=await lr(t),s=n?.getParentRunId();n!==void 0&&s!==void 0&&await n.handleCustomEvent?.(r,e,s)}function Na(r,e){if(r.function===void 0)return;let t;if(e?.partial)try{t=ii(r.function.arguments??"{}")}catch{return}else try{t=JSON.parse(r.function.arguments)}catch(s){throw new Je([`Function "${r.function.name}" arguments:`,"",r.function.arguments,"","are not valid JSON.",`Error: ${s.message}`].join(`
98
- `))}let n={name:r.function.name,args:t,type:"tool_call"};return e?.returnId&&(n.id=r.id),n}function Xp(r){if(r.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:r.id,type:"function",function:{name:r.name,arguments:JSON.stringify(r.args)}}}function Ra(r,e){return{name:r.function?.name,args:r.function?.arguments,id:r.id,error:e,type:"invalid_tool_call"}}var Ol=class extends er{static lc_name(){return"JsonOutputToolsParser"}constructor(e){super(e),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.returnId=e?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(e){return await this.parsePartialResult(e,!1)}async parsePartialResult(e,t=!0){let n=e[0].message,s;if(Yt(n)&&n.tool_calls?.length?s=n.tool_calls.map(a=>{let{id:o,...c}=a;return this.returnId?{id:o,...c}:c}):n.additional_kwargs.tool_calls!==void 0&&(s=JSON.parse(JSON.stringify(n.additional_kwargs.tool_calls)).map(o=>Na(o,{returnId:this.returnId,partial:t}))),!s)return[];let i=[];for(let a of s)if(a!==void 0){let o={type:a.name,args:a.args,id:a.id};i.push(o)}return i}},Is=class extends Ol{static lc_name(){return"JsonOutputKeyToolsParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let t=await uc(this.zodSchema,e);if(t.success)return t.data;throw new Je(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(t.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let n=(await super.parsePartialResult(e)).filter(i=>i.type===this.keyName),s=n;if(n.length)return this.returnId||(s=n.map(i=>i.args)),this.returnSingle?s[0]:s}async parseResult(e){let n=(await super.parsePartialResult(e,!1)).filter(a=>a.type===this.keyName),s=n;return n.length?(this.returnId||(s=n.map(a=>a.args)),this.returnSingle?this._validateResult(s[0]):await Promise.all(s.map(a=>this._validateResult(a)))):void 0}};var $d={"gpt-4.1":{deploymentName:"gpt-4.1",apiVersion:"2024-10-21",pathSegment:"models/gpt-4.1/openai/deployments/gpt-4.1/chat/completions"},"gpt-4.1-mini":{deploymentName:"gpt-4.1-mini",apiVersion:"2024-10-21",pathSegment:"models/gpt-4.1-mini/openai/deployments/gpt-4.1-mini/chat/completions"},"text-embedding-ada-002":{deploymentName:"text-embedding-ada-002",apiVersion:"2024-10-21",pathSegment:"models/text-embedding-ada-002/openai/deployments/text-embedding-ada-002/embeddings"}},Dd={default:"gpt-4.1",fast:"gpt-4.1-mini"},My={default:"text-embedding-ada-002"},Ld=(r,e)=>{let t=$d[e];return`${r}/${t.pathSegment}?api-version=${t.apiVersion}`};function Ud(){let r=ih.getDefault().helperServices;if(!r?.aiUtilityServices?.url)throw new Error("AI Utility Service URL is not defined in the portal's helper services.");return r.aiUtilityServices.url}function $y(r="default"){return Ld(Ud(),Dd[r])}function Dy(r="default"){return Ld(Ud(),My[r])}var Ly=async r=>{let e=await Uy(),t=Dy("default"),n=ih.getDefault(),s=(await Md.getCredential(`${n.url}/sharing`)).token,i={type:"generateEmbeddings",layersAndFieldsRegistry:r,auth:{apiUrl:t,token:s}};return e.postMessage(i),await new Promise((a,o)=>{let c=l=>{l.data==="completed"&&(e.removeEventListener("message",c),a())},u=l=>{e.removeEventListener("message",c),o(l instanceof Error?l:new Error("Embeddings worker error"))};e.addEventListener("message",c),e.addEventListener("error",u,{once:!0})}),e},Uy=async()=>{let r=(await import("./IOZANV7W.js")).default;return new r},Yp=(r,e)=>e,Fy=ft.Root({userInput:ft(),messages:ft({reducer:xr,default:()=>[]}),pendingIntents:ft({default:()=>[],reducer:Yp}),currentIntent:ft({default:()=>"none",reducer:Yp})}),ur=async(r,e)=>{await xl("trace_message",r,e)},MT=async(r,e)=>{await xl("graph_ux_suggestion",r,e)},By=r=>{r.currentIntent="none",r.pendingIntents=[]},zy=async(r,e)=>{if(r.userInput){let n=new it(r.userInput.trim());r.messages=[...r.messages,n],By(r)}let t=e?.configurable?.services.agentRegistry.list().map(n=>n.agent.id)??[];return await ur({text:`Available agents: ${[...t].join(", ")}`},e),await ur({text:"Analyzing user input"},e),r},Wy=async(r,e)=>(await ur({text:"Exiting..."},e),r),Ky=r=>{if(r.pendingIntents.length===0)return{...r,currentIntent:"none"};let[e,...t]=r.pendingIntents;return{...r,currentIntent:e,pendingIntents:t}},Zp=4e3,Vy=async(r,e)=>{let t=e?.configurable,{agentRegistry:n}=t.services,s=n?.get(r.currentIntent);if(!s)return console.warn(`No agent found for intent: ${r.currentIntent}`),r;await ur({text:`Executing registered agent: ${s.agent.name}`},e);let i={...e??{},configurable:{...t??{},agentId:s.agent.id,context:s.getContext?await s.getContext():void 0}},a=await s.agent.createGraph().compile().invoke({messages:[...r.messages]},i);await ur({text:`Finished executing registered agent: ${s.agent.name}`},e);let o=typeof a?.outputMessage=="string"?a.outputMessage.trim():"";if(!o)return r;let c=o.length>Zp?`${o.slice(0,Zp-14)}
99
- [truncated]`:o;return{...r,messages:[...r.messages,new ue(c)]}},Gy=(r,e,t)=>{let n=r[e];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((s,i)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==t?". Note that variables only represent file names one level deep.":""))))})},ah=async r=>(await Gy(Object.assign({"./field_descriptions_prompt.md":()=>import("./4OVLOQXC.js"),"./intent_prompt.md":()=>import("./F2ZCKVDM.js"),"./layer_descriptions_prompt.md":()=>import("./TW7MVMU3.js")}),`./${r}.md`,2)).default,Hy=(r,e=3)=>r.filter(t=>t instanceof it).slice(-e),qy=r=>{let e=-1;for(let t=r.length-1;t>=0;t--)if(r[t]instanceof it){e=t;break}return e===-1?"":r.slice(e+1).filter(t=>t instanceof ue).map(t=>t.content).join(`
98
+ `))}let n={name:r.function.name,args:t,type:"tool_call"};return e?.returnId&&(n.id=r.id),n}function Xp(r){if(r.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:r.id,type:"function",function:{name:r.name,arguments:JSON.stringify(r.args)}}}function Ra(r,e){return{name:r.function?.name,args:r.function?.arguments,id:r.id,error:e,type:"invalid_tool_call"}}var Ol=class extends er{static lc_name(){return"JsonOutputToolsParser"}constructor(e){super(e),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.returnId=e?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(e){return await this.parsePartialResult(e,!1)}async parsePartialResult(e,t=!0){let n=e[0].message,s;if(Yt(n)&&n.tool_calls?.length?s=n.tool_calls.map(a=>{let{id:o,...c}=a;return this.returnId?{id:o,...c}:c}):n.additional_kwargs.tool_calls!==void 0&&(s=JSON.parse(JSON.stringify(n.additional_kwargs.tool_calls)).map(o=>Na(o,{returnId:this.returnId,partial:t}))),!s)return[];let i=[];for(let a of s)if(a!==void 0){let o={type:a.name,args:a.args,id:a.id};i.push(o)}return i}},Is=class extends Ol{static lc_name(){return"JsonOutputKeyToolsParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let t=await uc(this.zodSchema,e);if(t.success)return t.data;throw new Je(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(t.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let n=(await super.parsePartialResult(e)).filter(i=>i.type===this.keyName),s=n;if(n.length)return this.returnId||(s=n.map(i=>i.args)),this.returnSingle?s[0]:s}async parseResult(e){let n=(await super.parsePartialResult(e,!1)).filter(a=>a.type===this.keyName),s=n;return n.length?(this.returnId||(s=n.map(a=>a.args)),this.returnSingle?this._validateResult(s[0]):await Promise.all(s.map(a=>this._validateResult(a)))):void 0}};var $d={"gpt-4.1":{deploymentName:"gpt-4.1",apiVersion:"2024-10-21",pathSegment:"models/gpt-4.1/openai/deployments/gpt-4.1/chat/completions"},"gpt-4.1-mini":{deploymentName:"gpt-4.1-mini",apiVersion:"2024-10-21",pathSegment:"models/gpt-4.1-mini/openai/deployments/gpt-4.1-mini/chat/completions"},"text-embedding-ada-002":{deploymentName:"text-embedding-ada-002",apiVersion:"2024-10-21",pathSegment:"models/text-embedding-ada-002/openai/deployments/text-embedding-ada-002/embeddings"}},Dd={default:"gpt-4.1",fast:"gpt-4.1-mini"},My={default:"text-embedding-ada-002"},Ld=(r,e)=>{let t=$d[e];return`${r}/${t.pathSegment}?api-version=${t.apiVersion}`};function Ud(){let r=ih.getDefault().helperServices;if(!r?.aiUtilityServices?.url)throw new Error("AI Utility Service URL is not defined in the portal's helper services.");return r.aiUtilityServices.url}function $y(r="default"){return Ld(Ud(),Dd[r])}function Dy(r="default"){return Ld(Ud(),My[r])}var Ly=async r=>{let e=await Uy(),t=Dy("default"),n=ih.getDefault(),s=(await Md.getCredential(`${n.url}/sharing`)).token,i={type:"generateEmbeddings",layersAndFieldsRegistry:r,auth:{apiUrl:t,token:s}};return e.postMessage(i),await new Promise((a,o)=>{let c=l=>{l.data==="completed"&&(e.removeEventListener("message",c),a())},u=l=>{e.removeEventListener("message",c),o(l instanceof Error?l:new Error("Embeddings worker error"))};e.addEventListener("message",c),e.addEventListener("error",u,{once:!0})}),e},Uy=async()=>{let r=(await import("./POCZKXEN.js")).default;return new r},Yp=(r,e)=>e,Fy=ft.Root({userInput:ft(),messages:ft({reducer:xr,default:()=>[]}),pendingIntents:ft({default:()=>[],reducer:Yp}),currentIntent:ft({default:()=>"none",reducer:Yp})}),ur=async(r,e)=>{await xl("trace_message",r,e)},MT=async(r,e)=>{await xl("graph_ux_suggestion",r,e)},By=r=>{r.currentIntent="none",r.pendingIntents=[]},zy=async(r,e)=>{if(r.userInput){let n=new it(r.userInput.trim());r.messages=[...r.messages,n],By(r)}let t=e?.configurable?.services.agentRegistry.list().map(n=>n.agent.id)??[];return await ur({text:`Available agents: ${[...t].join(", ")}`},e),await ur({text:"Analyzing user input"},e),r},Wy=async(r,e)=>(await ur({text:"Exiting..."},e),r),Ky=r=>{if(r.pendingIntents.length===0)return{...r,currentIntent:"none"};let[e,...t]=r.pendingIntents;return{...r,currentIntent:e,pendingIntents:t}},Zp=4e3,Vy=async(r,e)=>{let t=e?.configurable,{agentRegistry:n}=t.services,s=n?.get(r.currentIntent);if(!s)return console.warn(`No agent found for intent: ${r.currentIntent}`),r;await ur({text:`Executing registered agent: ${s.agent.name}`},e);let i={...e??{},configurable:{...t??{},agentId:s.agent.id,context:s.getContext?await s.getContext():void 0}},a=await s.agent.createGraph().compile().invoke({messages:[...r.messages]},i);await ur({text:`Finished executing registered agent: ${s.agent.name}`},e);let o=typeof a?.outputMessage=="string"?a.outputMessage.trim():"";if(!o)return r;let c=o.length>Zp?`${o.slice(0,Zp-14)}
99
+ [truncated]`:o;return{...r,messages:[...r.messages,new ue(c)]}},Gy=(r,e,t)=>{let n=r[e];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((s,i)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==t?". Note that variables only represent file names one level deep.":""))))})},ah=async r=>(await Gy(Object.assign({"./field_descriptions_prompt.md":()=>import("./S7FHBAYV.js"),"./intent_prompt.md":()=>import("./NJXGFRUZ.js"),"./layer_descriptions_prompt.md":()=>import("./5B2EOTYQ.js")}),`./${r}.md`,2)).default,Hy=(r,e=3)=>r.filter(t=>t instanceof it).slice(-e),qy=r=>{let e=-1;for(let t=r.length-1;t>=0;t--)if(r[t]instanceof it){e=t;break}return e===-1?"":r.slice(e+1).filter(t=>t instanceof ue).map(t=>t.content).join(`
100
100
  `)};function U(r,e,t,n,s){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}function v(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}var Fd=function(){let{crypto:r}=globalThis;if(r?.randomUUID)return Fd=r.randomUUID.bind(r),r.randomUUID();let e=new Uint8Array(1),t=r?()=>r.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^t()&15>>+n/4).toString(16))};function Nl(r){return typeof r=="object"&&r!==null&&("name"in r&&r.name==="AbortError"||"message"in r&&String(r.message).includes("FetchRequestCanceledException"))}var Rl=r=>{if(r instanceof Error)return r;if(typeof r=="object"&&r!==null){try{if(Object.prototype.toString.call(r)==="[object Error]"){let e=new Error(r.message,r.cause?{cause:r.cause}:{});return r.stack&&(e.stack=r.stack),r.cause&&!e.cause&&(e.cause=r.cause),r.name&&(e.name=r.name),e}}catch{}try{return new Error(JSON.stringify(r))}catch{}}return new Error(r)},j=class extends Error{},Ue=class r extends j{constructor(e,t,n,s){super(`${r.makeMessage(e,t,n)}`),this.status=e,this.headers=s,this.requestID=s?.get("x-request-id"),this.error=t;let i=t;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,t,n){let s=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&s?`${e} ${s}`:e?`${e} status code (no body)`:s||"(no status code or body)"}static generate(e,t,n,s){if(!e||!s)return new Bn({message:n,cause:Rl(t)});let i=t?.error;return e===400?new Qa(e,i,n,s):e===401?new eo(e,i,n,s):e===403?new to(e,i,n,s):e===404?new ro(e,i,n,s):e===409?new no(e,i,n,s):e===422?new so(e,i,n,s):e===429?new io(e,i,n,s):e>=500?new ao(e,i,n,s):new r(e,i,n,s)}},Ve=class extends Ue{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Bn=class extends Ue{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},zn=class extends Bn{constructor({message:e}={}){super({message:e??"Request timed out."})}},Qa=class extends Ue{},eo=class extends Ue{},to=class extends Ue{},ro=class extends Ue{},no=class extends Ue{},so=class extends Ue{},io=class extends Ue{},ao=class extends Ue{},oo=class extends j{constructor(){super("Could not parse response content as the length limit was reached")}},co=class extends j{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Xr=class extends Error{constructor(e){super(e)}},Jy=/^[a-z][a-z0-9+.-]*:/i,Xy=r=>Jy.test(r),Ze=r=>(Ze=Array.isArray,Ze(r)),Qp=Ze;function Yy(r){return typeof r!="object"?{}:r??{}}function Zy(r){if(!r)return!0;for(let e in r)return!1;return!0}function Qy(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Wa(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)}var e_=(r,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new j(`${r} must be an integer`);if(e<0)throw new j(`${r} must be a positive integer`);return e},t_=r=>{try{return JSON.parse(r)}catch{return}},ei=r=>new Promise(e=>setTimeout(e,r)),Dn="5.12.2",r_=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function n_(){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 s_=()=>{let r=n_();if(r==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Dn,"X-Stainless-OS":td(Deno.build.os),"X-Stainless-Arch":ed(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":Dn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(r==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Dn,"X-Stainless-OS":td(globalThis.process.platform??"unknown"),"X-Stainless-Arch":ed(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=i_();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Dn,"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":Dn,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function i_(){if(typeof navigator>"u"||!navigator)return null;let r=[{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:t}of r){let n=t.exec(navigator.userAgent);if(n){let s=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${s}.${i}.${a}`}}}return null}var ed=r=>r==="x32"?"x32":r==="x86_64"||r==="x64"?"x64":r==="arm"?"arm":r==="aarch64"||r==="arm64"?"arm64":r?`other:${r}`:"unknown",td=r=>(r=r.toLowerCase(),r.includes("ios")?"iOS":r==="android"?"Android":r==="darwin"?"MacOS":r==="win32"?"Windows":r==="freebsd"?"FreeBSD":r==="openbsd"?"OpenBSD":r==="linux"?"Linux":r?`Other:${r}`:"Unknown"),rd,a_=()=>rd??(rd=s_());function o_(){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 Bd(...r){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(...r)}function zd(r){let e=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator]();return Bd({start(){},async pull(t){let{done:n,value:s}=await e.next();n?t.close():t.enqueue(s)},async cancel(){await e.return?.()}})}function Wd(r){if(r[Symbol.asyncIterator])return r;let e=r.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function c_(r){if(r===null||typeof r!="object")return;if(r[Symbol.asyncIterator]){await r[Symbol.asyncIterator]().return?.();return}let e=r.getReader(),t=e.cancel();e.releaseLock(),await t}var u_=({headers:r,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)}),Kd="RFC3986",Vd=r=>String(r),nd={RFC1738:r=>String(r).replace(/%20/g,"+"),RFC3986:Vd},l_="RFC1738",jl=(r,e)=>(jl=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),jl(r,e)),Ht=(()=>{let r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})(),kl=1024,h_=(r,e,t,n,s)=>{if(r.length===0)return r;let i=r;if(typeof r=="symbol"?i=Symbol.prototype.toString.call(r):typeof r!="string"&&(i=String(r)),t==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(o){return"%26%23"+parseInt(o.slice(2),16)+"%3B"});let a="";for(let o=0;o<i.length;o+=kl){let c=i.length>=kl?i.slice(o,o+kl):i,u=[];for(let l=0;l<c.length;++l){let h=c.charCodeAt(l);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||s===l_&&(h===40||h===41)){u[u.length]=c.charAt(l);continue}if(h<128){u[u.length]=Ht[h];continue}if(h<2048){u[u.length]=Ht[192|h>>6]+Ht[128|h&63];continue}if(h<55296||h>=57344){u[u.length]=Ht[224|h>>12]+Ht[128|h>>6&63]+Ht[128|h&63];continue}l+=1,h=65536+((h&1023)<<10|c.charCodeAt(l)&1023),u[u.length]=Ht[240|h>>18]+Ht[128|h>>12&63]+Ht[128|h>>6&63]+Ht[128|h&63]}a+=u.join("")}return a};function f_(r){return!r||typeof r!="object"?!1:!!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r))}function sd(r,e){if(Ze(r)){let t=[];for(let n=0;n<r.length;n+=1)t.push(e(r[n]));return t}return e(r)}var Gd={brackets(r){return String(r)+"[]"},comma:"comma",indices(r,e){return String(r)+"["+e+"]"},repeat(r){return String(r)}},Hd=function(r,e){Array.prototype.push.apply(r,Ze(e)?e:[e])},id,be={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:h_,encodeValuesOnly:!1,format:Kd,formatter:Vd,indices:!1,serializeDate(r){return(id??(id=Function.prototype.call.bind(Date.prototype.toISOString)))(r)},skipNulls:!1,strictNullHandling:!1};function p_(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||typeof r=="symbol"||typeof r=="bigint"}var Al={};function qd(r,e,t,n,s,i,a,o,c,u,l,h,p,f,m,y,_,k){let x=r,A=k,P=0,C=!1;for(;(A=A.get(Al))!==void 0&&!C;){let I=A.get(r);if(P+=1,typeof I<"u"){if(I===P)throw new RangeError("Cyclic object value");C=!0}typeof A.get(Al)>"u"&&(P=0)}if(typeof u=="function"?x=u(e,x):x instanceof Date?x=p?.(x):t==="comma"&&Ze(x)&&(x=sd(x,function(I){return I instanceof Date?p?.(I):I})),x===null){if(i)return c&&!y?c(e,be.encoder,_,"key",f):e;x=""}if(p_(x)||f_(x)){if(c){let I=y?e:c(e,be.encoder,_,"key",f);return[m?.(I)+"="+m?.(c(x,be.encoder,_,"value",f))]}return[m?.(e)+"="+m?.(String(x))]}let M=[];if(typeof x>"u")return M;let $;if(t==="comma"&&Ze(x))y&&c&&(x=sd(x,c)),$=[{value:x.length>0?x.join(",")||null:void 0}];else if(Ze(u))$=u;else{let I=Object.keys(x);$=l?I.sort(l):I}let b=o?String(e).replace(/\./g,"%2E"):String(e),N=n&&Ze(x)&&x.length===1?b+"[]":b;if(s&&Ze(x)&&x.length===0)return N+"[]";for(let I=0;I<$.length;++I){let E=$[I],H=typeof E=="object"&&typeof E.value<"u"?E.value:x[E];if(a&&H===null)continue;let se=h&&o?E.replace(/\./g,"%2E"):E,ce=Ze(x)?typeof t=="function"?t(N,se):N:N+(h?"."+se:"["+se+"]");k.set(r,P);let Nt=new WeakMap;Nt.set(Al,k),Hd(M,qd(H,ce,t,n,s,i,a,o,t==="comma"&&y&&Ze(x)?null:c,u,l,h,p,f,m,y,_,Nt))}return M}function d_(r=be){if(typeof r.allowEmptyArrays<"u"&&typeof r.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof r.encodeDotInKeys<"u"&&typeof r.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(r.encoder!==null&&typeof r.encoder<"u"&&typeof r.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=r.charset||be.charset;if(typeof r.charset<"u"&&r.charset!=="utf-8"&&r.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=Kd;if(typeof r.format<"u"){if(!jl(nd,r.format))throw new TypeError("Unknown format option provided.");t=r.format}let n=nd[t],s=be.filter;(typeof r.filter=="function"||Ze(r.filter))&&(s=r.filter);let i;if(r.arrayFormat&&r.arrayFormat in Gd?i=r.arrayFormat:"indices"in r?i=r.indices?"indices":"repeat":i=be.arrayFormat,"commaRoundTrip"in r&&typeof r.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof r.allowDots>"u"?r.encodeDotInKeys?!0:be.allowDots:!!r.allowDots;return{addQueryPrefix:typeof r.addQueryPrefix=="boolean"?r.addQueryPrefix:be.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof r.allowEmptyArrays=="boolean"?!!r.allowEmptyArrays:be.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof r.charsetSentinel=="boolean"?r.charsetSentinel:be.charsetSentinel,commaRoundTrip:!!r.commaRoundTrip,delimiter:typeof r.delimiter>"u"?be.delimiter:r.delimiter,encode:typeof r.encode=="boolean"?r.encode:be.encode,encodeDotInKeys:typeof r.encodeDotInKeys=="boolean"?r.encodeDotInKeys:be.encodeDotInKeys,encoder:typeof r.encoder=="function"?r.encoder:be.encoder,encodeValuesOnly:typeof r.encodeValuesOnly=="boolean"?r.encodeValuesOnly:be.encodeValuesOnly,filter:s,format:t,formatter:n,serializeDate:typeof r.serializeDate=="function"?r.serializeDate:be.serializeDate,skipNulls:typeof r.skipNulls=="boolean"?r.skipNulls:be.skipNulls,sort:typeof r.sort=="function"?r.sort:null,strictNullHandling:typeof r.strictNullHandling=="boolean"?r.strictNullHandling:be.strictNullHandling}}function m_(r,e={}){let t=r,n=d_(e),s,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):Ze(n.filter)&&(i=n.filter,s=i);let a=[];if(typeof t!="object"||t===null)return"";let o=Gd[n.arrayFormat],c=o==="comma"&&n.commaRoundTrip;s||(s=Object.keys(t)),n.sort&&s.sort(n.sort);let u=new WeakMap;for(let p=0;p<s.length;++p){let f=s[p];n.skipNulls&&t[f]===null||Hd(a,qd(t[f],f,o,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,u))}let l=a.join(n.delimiter),h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),l.length>0?h+l:""}function g_(r){let e=0;for(let s of r)e+=s.length;let t=new Uint8Array(e),n=0;for(let s of r)t.set(s,n),n+=s.length;return t}var ad;function oh(r){let e;return(ad??(e=new globalThis.TextEncoder,ad=e.encode.bind(e)))(r)}var od;function cd(r){let e;return(od??(e=new globalThis.TextDecoder,od=e.decode.bind(e)))(r)}var tt,rt,Wn=class{constructor(){tt.set(this,void 0),rt.set(this,void 0),U(this,tt,new Uint8Array),U(this,rt,null)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?oh(e):e;U(this,tt,g_([v(this,tt,"f"),t]));let n=[],s;for(;(s=b_(v(this,tt,"f"),v(this,rt,"f")))!=null;){if(s.carriage&&v(this,rt,"f")==null){U(this,rt,s.index);continue}if(v(this,rt,"f")!=null&&(s.index!==v(this,rt,"f")+1||s.carriage)){n.push(cd(v(this,tt,"f").subarray(0,v(this,rt,"f")-1))),U(this,tt,v(this,tt,"f").subarray(v(this,rt,"f"))),U(this,rt,null);continue}let i=v(this,rt,"f")!==null?s.preceding-1:s.preceding,a=cd(v(this,tt,"f").subarray(0,i));n.push(a),U(this,tt,v(this,tt,"f").subarray(s.index)),U(this,rt,null)}return n}flush(){return v(this,tt,"f").length?this.decode(`
101
101
  `):[]}};tt=new WeakMap,rt=new WeakMap;Wn.NEWLINE_CHARS=new Set([`
102
102
  `,"\r"]);Wn.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function b_(r,e){for(let t=e??0;t<r.length;t++){if(r[t]===10)return{preceding:t,index:t+1,carriage:!1};if(r[t]===13)return{preceding:t,index:t+1,carriage:!0}}return null}function y_(r){for(let e=0;e<r.length-1;e++){if(r[e]===10&&r[e+1]===10||r[e]===13&&r[e+1]===13)return e+2;if(r[e]===13&&r[e+1]===10&&e+3<r.length&&r[e+2]===13&&r[e+3]===10)return e+4}return-1}var uo={off:0,error:200,warn:300,info:400,debug:500},ud=(r,e,t)=>{if(r){if(Qy(uo,r))return r;Ce(t).warn(`${e} was set to ${JSON.stringify(r)}, expected one of ${JSON.stringify(Object.keys(uo))}`)}};function Rs(){}function ja(r,e,t){return!e||uo[r]>uo[t]?Rs:e[r].bind(e)}var __={error:Rs,warn:Rs,info:Rs,debug:Rs},ld=new WeakMap;function Ce(r){let e=r.logger,t=r.logLevel??"off";if(!e)return __;let n=ld.get(e);if(n&&n[0]===t)return n[1];let s={error:ja("error",e,t),warn:ja("warn",e,t),info:ja("info",e,t),debug:ja("debug",e,t)};return ld.set(e,[t,s]),s}var qr=r=>(r.options&&(r.options={...r.options},delete r.options.headers),r.headers&&(r.headers=Object.fromEntries((r.headers instanceof Headers?[...r.headers]:Object.entries(r.headers)).map(([e,t])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":t]))),"retryOfRequestLogID"in r&&(r.retryOfRequestLogID&&(r.retryOf=r.retryOfRequestLogID),delete r.retryOfRequestLogID),r),Ns,en=class r{constructor(e,t,n){this.iterator=e,Ns.set(this,void 0),this.controller=t,U(this,Ns,n)}static fromSSEResponse(e,t,n){let s=!1,i=n?Ce(n):console;async function*a(){if(s)throw new j("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let o=!1;try{for await(let c of w_(e,t))if(!o){if(c.data.startsWith("[DONE]")){o=!0;continue}if(c.event===null||!c.event.startsWith("thread.")){let u;try{u=JSON.parse(c.data)}catch(l){throw i.error("Could not parse message into JSON:",c.data),i.error("From chunk:",c.raw),l}if(u&&u.error)throw new Ue(void 0,u.error,void 0,e.headers);yield u}else{let u;try{u=JSON.parse(c.data)}catch(l){throw console.error("Could not parse message into JSON:",c.data),console.error("From chunk:",c.raw),l}if(c.event=="error")throw new Ue(void 0,u.error,u.message,void 0);yield{event:c.event,data:u}}}o=!0}catch(c){if(Nl(c))return;throw c}finally{o||t.abort()}}return new r(a,t,n)}static fromReadableStream(e,t,n){let s=!1;async function*i(){let o=new Wn,c=Wd(e);for await(let u of c)for(let l of o.decode(u))yield l;for(let u of o.flush())yield u}async function*a(){if(s)throw new j("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let o=!1;try{for await(let c of i())o||c&&(yield JSON.parse(c));o=!0}catch(c){if(Nl(c))return;throw c}finally{o||t.abort()}}return new r(a,t,n)}[(Ns=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],n=this.iterator(),s=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),t.push(a)}return i.shift()}});return[new r(()=>s(e),this.controller,v(this,Ns,"f")),new r(()=>s(t),this.controller,v(this,Ns,"f"))]}toReadableStream(){let e=this,t;return Bd({async start(){t=e[Symbol.asyncIterator]()},async pull(n){try{let{value:s,done:i}=await t.next();if(i)return n.close();let a=oh(JSON.stringify(s)+`
@@ -1,7 +1,7 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import"./JINQHP2K.js";var t=`# LinkChart Tool Instructions
3
+ v5.0.0-next.136 */
4
+ import"./AZNXA22U.js";var t=`# LinkChart Tool Instructions
5
5
 
6
6
  CRITICAL: You are FORBIDDEN from making multiple tool calls. You MUST make exactly ONE tool call.
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import"./JINQHP2K.js";var e=`# Navigation Tool Instructions
3
+ v5.0.0-next.136 */
4
+ import"./AZNXA22U.js";var e=`# Navigation Tool Instructions
5
5
 
6
6
  CRITICAL: You are FORBIDDEN from making multiple tool calls. You MUST make exactly ONE tool call.
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import"./JINQHP2K.js";var e=`## GIS Feature Layer Intent Classifier
3
+ v5.0.0-next.136 */
4
+ import"./AZNXA22U.js";var e=`## GIS Feature Layer Intent Classifier
5
5
 
6
6
  You are an assistant that classifies user intent in ArcGIS Online Map Viewer.
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.134 */
4
- import{$ as qe,A as Ie,B as $e,C as Ne,D as ze,E as Re,Eb as B,F as q,G as K,I as P,J as T,K as le,L as ue,M as w,Mb as pe,N as Ue,Nb as me,O as Be,P as E,Pb as j,Q as y,Qb as Q,R as A,Rb as X,S as De,T as He,U as I,V as $,W as We,Wb as d,X as Ge,Xb as Y,Y as x,Yb as C,Z as N,Zb as h,_ as Je,_b as D,aa as z,ba as g,ca as v,da as Ke,ea as Qe,fa as V,ga as Xe,h as oe,ha as Ye,ia as Ze,ja as Le,ka as R,n as Me,o as Pe,p as Te,q as Ve,r as je,s as Ce,t as Oe,u as Fe,v as Se,w as ke,x as Ee,y as M,yb as U,z as Ae}from"./B3CBPMAE.js";import{b as _e}from"./JINQHP2K.js";export default $arcgis.t(_=>{var it={};_e(it,{AIMessage:()=>w,AIMessageChunk:()=>E,BaseMessage:()=>M,BaseMessageChunk:()=>ze,ChatMessage:()=>y,ChatMessageChunk:()=>A,FunctionMessage:()=>I,FunctionMessageChunk:()=>$,HumanMessage:()=>x,HumanMessageChunk:()=>N,RemoveMessage:()=>z,SystemMessage:()=>g,SystemMessageChunk:()=>v,ToolMessage:()=>P,ToolMessageChunk:()=>T,_isMessageFieldWithRole:()=>Re,_mergeDicts:()=>Ie,_mergeLists:()=>$e,_mergeObj:()=>Ne,_mergeStatus:()=>Ee,coerceMessageLikeToMessage:()=>V,convertToChunk:()=>R,convertToOpenAIImageBlock:()=>Ce,convertToProviderContentBlock:()=>Se,defaultTextSplitter:()=>de,filterMessages:()=>et,getBufferString:()=>Xe,isAIMessage:()=>Ue,isAIMessageChunk:()=>Be,isBase64ContentBlock:()=>Te,isBaseMessage:()=>q,isBaseMessageChunk:()=>K,isChatMessage:()=>De,isChatMessageChunk:()=>He,isDataContentBlock:()=>Me,isFunctionMessage:()=>We,isFunctionMessageChunk:()=>Ge,isHumanMessage:()=>Je,isHumanMessageChunk:()=>qe,isIDContentBlock:()=>je,isOpenAIToolCallArray:()=>Ae,isPlainTextContentBlock:()=>Ve,isSystemMessage:()=>Ke,isSystemMessageChunk:()=>Qe,isToolMessage:()=>le,isToolMessageChunk:()=>ue,isURLContentBlock:()=>Pe,mapChatMessagesToStoredMessages:()=>Le,mapStoredMessageToChatMessage:()=>Ye,mapStoredMessagesToChatMessages:()=>Ze,mergeContent:()=>ke,mergeMessageRuns:()=>tt,parseBase64DataUrl:()=>Fe,parseMimeType:()=>Oe,trimMessages:()=>rt});var H=(i,e)=>{let t=[...new Set(e?.map(r=>{if(typeof r=="string")return r;let s=new r({});if(!("getType"in s)||typeof s.getType!="function")throw new Error("Invalid type provided.");return s.getType()}))],a=i.getType();return t.some(r=>r===a)};function et(i,e){return Array.isArray(i)?ce(i,e):B.from(t=>ce(t,i))}function ce(i,e={}){let{includeNames:t,excludeNames:a,includeTypes:r,excludeTypes:s,includeIds:o,excludeIds:n}=e,u=[];for(let l of i)if(!(a&&l.name&&a.includes(l.name))){{if(s&&H(l,s))continue;if(n&&l.id&&n.includes(l.id))continue}r||o||t?(t&&l.name&&t.some(p=>p===l.name)||r&&H(l,r)||o&&l.id&&o.some(p=>p===l.id))&&u.push(l):u.push(l)}return u}function tt(i){return Array.isArray(i)?fe(i):B.from(fe)}function fe(i){if(!i.length)return[];let e=[];for(let t of i){let a=t,r=e.pop();if(!r)e.push(a);else if(a.getType()==="tool"||a.getType()!==r.getType())e.push(r,a);else{let s=R(r),o=R(a),n=s.concat(o);typeof s.content=="string"&&typeof o.content=="string"&&(n.content=`${s.content}
3
+ v5.0.0-next.136 */
4
+ import{$ as qe,A as Ie,B as $e,C as Ne,D as ze,E as Re,Eb as B,F as q,G as K,I as P,J as T,K as le,L as ue,M as w,Mb as pe,N as Ue,Nb as me,O as Be,P as E,Pb as j,Q as y,Qb as Q,R as A,Rb as X,S as De,T as He,U as I,V as $,W as We,Wb as d,X as Ge,Xb as Y,Y as x,Yb as C,Z as N,Zb as h,_ as Je,_b as D,aa as z,ba as g,ca as v,da as Ke,ea as Qe,fa as V,ga as Xe,h as oe,ha as Ye,ia as Ze,ja as Le,ka as R,n as Me,o as Pe,p as Te,q as Ve,r as je,s as Ce,t as Oe,u as Fe,v as Se,w as ke,x as Ee,y as M,yb as U,z as Ae}from"./3UG5WTDE.js";import{b as _e}from"./AZNXA22U.js";export default $arcgis.t(_=>{var it={};_e(it,{AIMessage:()=>w,AIMessageChunk:()=>E,BaseMessage:()=>M,BaseMessageChunk:()=>ze,ChatMessage:()=>y,ChatMessageChunk:()=>A,FunctionMessage:()=>I,FunctionMessageChunk:()=>$,HumanMessage:()=>x,HumanMessageChunk:()=>N,RemoveMessage:()=>z,SystemMessage:()=>g,SystemMessageChunk:()=>v,ToolMessage:()=>P,ToolMessageChunk:()=>T,_isMessageFieldWithRole:()=>Re,_mergeDicts:()=>Ie,_mergeLists:()=>$e,_mergeObj:()=>Ne,_mergeStatus:()=>Ee,coerceMessageLikeToMessage:()=>V,convertToChunk:()=>R,convertToOpenAIImageBlock:()=>Ce,convertToProviderContentBlock:()=>Se,defaultTextSplitter:()=>de,filterMessages:()=>et,getBufferString:()=>Xe,isAIMessage:()=>Ue,isAIMessageChunk:()=>Be,isBase64ContentBlock:()=>Te,isBaseMessage:()=>q,isBaseMessageChunk:()=>K,isChatMessage:()=>De,isChatMessageChunk:()=>He,isDataContentBlock:()=>Me,isFunctionMessage:()=>We,isFunctionMessageChunk:()=>Ge,isHumanMessage:()=>Je,isHumanMessageChunk:()=>qe,isIDContentBlock:()=>je,isOpenAIToolCallArray:()=>Ae,isPlainTextContentBlock:()=>Ve,isSystemMessage:()=>Ke,isSystemMessageChunk:()=>Qe,isToolMessage:()=>le,isToolMessageChunk:()=>ue,isURLContentBlock:()=>Pe,mapChatMessagesToStoredMessages:()=>Le,mapStoredMessageToChatMessage:()=>Ye,mapStoredMessagesToChatMessages:()=>Ze,mergeContent:()=>ke,mergeMessageRuns:()=>tt,parseBase64DataUrl:()=>Fe,parseMimeType:()=>Oe,trimMessages:()=>rt});var H=(i,e)=>{let t=[...new Set(e?.map(r=>{if(typeof r=="string")return r;let s=new r({});if(!("getType"in s)||typeof s.getType!="function")throw new Error("Invalid type provided.");return s.getType()}))],a=i.getType();return t.some(r=>r===a)};function et(i,e){return Array.isArray(i)?ce(i,e):B.from(t=>ce(t,i))}function ce(i,e={}){let{includeNames:t,excludeNames:a,includeTypes:r,excludeTypes:s,includeIds:o,excludeIds:n}=e,u=[];for(let l of i)if(!(a&&l.name&&a.includes(l.name))){{if(s&&H(l,s))continue;if(n&&l.id&&n.includes(l.id))continue}r||o||t?(t&&l.name&&t.some(p=>p===l.name)||r&&H(l,r)||o&&l.id&&o.some(p=>p===l.id))&&u.push(l):u.push(l)}return u}function tt(i){return Array.isArray(i)?fe(i):B.from(fe)}function fe(i){if(!i.length)return[];let e=[];for(let t of i){let a=t,r=e.pop();if(!r)e.push(a);else if(a.getType()==="tool"||a.getType()!==r.getType())e.push(r,a);else{let s=R(r),o=R(a),n=s.concat(o);typeof s.content=="string"&&typeof o.content=="string"&&(n.content=`${s.content}
5
5
  ${o.content}`),e.push(st(n))}}return e}function rt(i,e){if(Array.isArray(i)){let t=i;if(!e)throw new Error("Options parameter is required when providing messages.");return he(t,e)}else{let t=i;return B.from(a=>he(a,t)).withConfig({runName:"trim_messages"})}}async function he(i,e){let{maxTokens:t,tokenCounter:a,strategy:r="last",allowPartial:s=!1,endOn:o,startOn:n,includeSystem:u=!1,textSplitter:l}=e;if(n&&r==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(u&&r==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let p;"getNumTokens"in a?p=async m=>(await Promise.all(m.map(b=>a.getNumTokens(b.content)))).reduce((b,J)=>b+J,0):p=async m=>a(m);let c=de;if(l&&("splitText"in l?c=l.splitText:c=async m=>l(m)),r==="first")return ge(i,{maxTokens:t,tokenCounter:p,textSplitter:c,partialStrategy:s?"first":void 0,endOn:o});if(r==="last")return at(i,{maxTokens:t,tokenCounter:p,textSplitter:c,allowPartial:s,includeSystem:u,startOn:n,endOn:o});throw new Error(`Unrecognized strategy: '${r}'. Must be one of 'first' or 'last'.`)}async function ge(i,e){let{maxTokens:t,tokenCounter:a,textSplitter:r,partialStrategy:s,endOn:o}=e,n=[...i],u=0;for(let l=0;l<n.length;l+=1){let p=l>0?n.slice(0,-l):n;if(await a(p)<=t){u=n.length-l;break}}if(u<n.length&&s){let l=!1;if(Array.isArray(n[u].content)){let p=n[u];if(typeof p.content=="string")throw new Error("Expected content to be an array.");let c=p.content.length,m=s==="last"?[...p.content].reverse():p.content;for(let f=1;f<=c;f+=1){let b=s==="first"?m.slice(0,f):m.slice(-f),J=Object.fromEntries(Object.entries(p).filter(([ne])=>ne!=="type"&&!ne.startsWith("lc_"))),ve=Z(p.getType(),{...J,content:b}),ie=[...n.slice(0,u),ve];if(await a(ie)<=t)n=ie,u+=1,l=!0;else break}l&&s==="last"&&(p.content=[...m].reverse())}if(!l){let p=n[u],c;if(Array.isArray(p.content)&&p.content.some(m=>typeof m=="string"||m.type==="text")?c=p.content.find(f=>f.type==="text"&&f.text)?.text:typeof p.content=="string"&&(c=p.content),c){let m=await r(c),f=m.length;s==="last"&&m.reverse();for(let b=0;b<f-1;b+=1)if(m.pop(),p.content=m.join(""),await a([...n.slice(0,u),p])<=t){s==="last"&&(p.content=[...m].reverse().join("")),n=[...n.slice(0,u),p],u+=1;break}}}}if(o){let l=Array.isArray(o)?o:[o];for(;u>0&&!H(n[u-1],l);)u-=1}return n.slice(0,u)}async function at(i,e){let{allowPartial:t=!1,includeSystem:a=!1,endOn:r,startOn:s,...o}=e,n=i.map(p=>{let c=Object.fromEntries(Object.entries(p).filter(([m])=>m!=="type"&&!m.startsWith("lc_")));return Z(p.getType(),c,K(p))});if(r){let p=Array.isArray(r)?r:[r];for(;n.length>0&&!H(n[n.length-1],p);)n=n.slice(0,-1)}let u=a&&n[0]?.getType()==="system",l=u?n.slice(0,1).concat(n.slice(1).reverse()):n.reverse();return l=await ge(l,{...o,partialStrategy:t?"last":void 0,endOn:s}),u?[l[0],...l.slice(1).reverse()]:l.reverse()}var be={human:{message:x,messageChunk:N},ai:{message:w,messageChunk:E},system:{message:g,messageChunk:v},developer:{message:g,messageChunk:v},tool:{message:P,messageChunk:T},function:{message:I,messageChunk:$},generic:{message:y,messageChunk:A},remove:{message:z,messageChunk:z}};function Z(i,e,t){let a,r;switch(i){case"human":t?a=new N(e):r=new x(e);break;case"ai":if(t){let s={...e};"tool_calls"in s&&(s={...s,tool_call_chunks:s.tool_calls?.map(o=>({...o,type:"tool_call_chunk",index:void 0,args:JSON.stringify(o.args)}))}),a=new E(s)}else r=new w(e);break;case"system":t?a=new v(e):r=new g(e);break;case"developer":t?a=new v({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):r=new g({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)t?a=new T(e):r=new P(e);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(t)a=new $(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");r=new I(e)}break;case"generic":if("role"in e)t?a=new A(e):r=new y(e);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${i}`)}if(t&&a)return a;if(r)return r;throw new Error(`Unrecognized message type ${i}`)}function st(i){let e=i.getType(),t,a=Object.fromEntries(Object.entries(i).filter(([r])=>!["type","tool_call_chunks"].includes(r)&&!r.startsWith("lc_")));if(e in be&&(t=Z(e,a)),!t)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(be)}`);return t}function de(i){let e=i.split(`
6
6
  `);return Promise.resolve([...e.slice(0,-1).map(t=>`${t}
7
7
  `),e[e.length-1]])}var _=class i extends D{static lc_name(){return"ImagePromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","image"]}),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"additionalContentFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e.template,this.templateFormat=e.templateFormat??this.templateFormat,this.validateTemplate=e.validateTemplate??this.validateTemplate,this.additionalContentFields=e.additionalContentFields,this.validateTemplate){let t=this.inputVariables;this.partialVariables&&(t=t.concat(Object.keys(this.partialVariables))),C([{type:"image_url",image_url:this.template}],this.templateFormat,t)}}_getPromptType(){return"prompt"}async partial(e){let t=this.inputVariables.filter(s=>!(s in e)),a={...this.partialVariables??{},...e},r={...this,inputVariables:t,partialVariables:a};return new i(r)}async format(e){let t={};for(let[o,n]of Object.entries(this.template))typeof n=="string"?t[o]=d(n,this.templateFormat,e):t[o]=n;let a=e.url||t.url,r=e.detail||t.detail;if(!a)throw new Error("Must provide either an image URL.");if(typeof a!="string")throw new Error("url must be a string.");let s={url:a};return r&&(s.detail=r),s}async formatPromptValue(e){let t=await this.format(e);return new me(t)}};var O=class extends U{static lc_name(){return"DictPromptTemplate"}constructor(e){let t=e.templateFormat??"f-string",a=L(e.template,t);super({inputVariables:a,...e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","dict"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e.template,this.templateFormat=t,this.inputVariables=a}async format(e){return ee(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}};function L(i,e){let t=[];for(let a of Object.values(i))if(typeof a=="string")Y(a,e).forEach(r=>{r.type==="variable"&&t.push(r.name)});else if(Array.isArray(a))for(let r of a)typeof r=="string"?Y(r,e).forEach(s=>{s.type==="variable"&&t.push(s.name)}):typeof r=="object"&&t.push(...L(r,e));else typeof a=="object"&&a!==null&&t.push(...L(a,e));return Array.from(new Set(t))}function ee(i,e,t){let a={};for(let[r,s]of Object.entries(i))if(typeof s=="string")a[r]=d(s,t,e);else if(Array.isArray(s)){let o=[];for(let n of s)typeof n=="string"?o.push(d(n,t,e)):typeof n=="object"&&o.push(ee(n,e,t));a[r]=o}else typeof s=="object"&&s!==null?a[r]=ee(s,e,t):a[r]=s;return a}var F=class extends U{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","chat"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}async invoke(e,t){return this._callWithConfig(a=>this.formatMessages(a),e,{...t,runType:"prompt"})}},W=class extends F{static lc_name(){return"MessagesPlaceholder"}constructor(e){typeof e=="string"&&(e={variableName:e}),super(e),Object.defineProperty(this,"variableName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"optional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.variableName=e.variableName,this.optional=e.optional??!1}get inputVariables(){return[this.variableName]}async formatMessages(e){let t=e[this.variableName];if(this.optional&&!t)return[];if(!t){let r=new Error(`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages as an input value. Received: undefined`);throw r.name="InputFormatError",r}let a;try{Array.isArray(t)?a=t.map(V):a=[V(t)]}catch(r){let s=typeof t=="string"?t:JSON.stringify(t,null,2),o=new Error([`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages or coerceable values as input.`,`Received value: ${s}`,`Additional message: ${r.message}`].join(`