@arcgis/ai-components 5.0.0-next.140 → 5.0.0-next.142
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.
- package/README.md +2 -2
- package/dist/cdn/{2WYLKFGP.js → 24JCMWKT.js} +2 -2
- package/dist/cdn/{FDJXRQUK.js → 4JD67FWH.js} +2 -2
- package/dist/cdn/{7QHFU3KO.js → 5FL7YQKB.js} +2 -2
- package/dist/cdn/{H3KORP5U.js → 66XCWCWM.js} +1 -1
- package/dist/cdn/{YLSYEE4Q.js → 6TRADBDX.js} +2 -2
- package/dist/cdn/{RBSKMLWF.js → AX3ZST6A.js} +2 -2
- package/dist/cdn/{25PBMZHS.js → AZXT5TQZ.js} +2 -2
- package/dist/cdn/{TAK5SQLW.js → BFVF7YNW.js} +2 -2
- package/dist/cdn/{WJVFWLIR.js → C7MRAIMT.js} +2 -2
- package/dist/cdn/{N3QH6TX7.js → CGJ7JDHZ.js} +2 -2
- package/dist/cdn/{LGW5HXAG.js → CKRH3D7E.js} +1 -1
- package/dist/cdn/{6C35AMCX.js → CKTQQHF5.js} +2 -2
- package/dist/cdn/{WH2GVTFQ.js → CSL4ICDD.js} +49 -32
- package/dist/cdn/{LYVHBLUQ.js → D7FVP573.js} +2 -2
- package/dist/cdn/{AAVZOXSC.js → DZTBEPPB.js} +2 -2
- package/dist/cdn/{N5EBFHDA.js → FOJAQIAN.js} +2 -2
- package/dist/cdn/{WQAFSEHQ.js → GOYCKSEC.js} +2 -2
- package/dist/cdn/{IXX5ULW6.js → H6MZ7SFC.js} +2 -2
- package/dist/cdn/{2Q7VQTLU.js → I5QITQB4.js} +2 -2
- package/dist/cdn/{ASN7ZWEH.js → IGC2ZG54.js} +3 -3
- package/dist/cdn/{VWVB7I6H.js → IPW732KX.js} +2 -2
- package/dist/cdn/{UNM6E7R2.js → JXZMU4IY.js} +2 -2
- package/dist/cdn/LTKZHX3O.js +43 -0
- package/dist/cdn/{AXRNMFPI.js → NJFAKO5H.js} +1 -1
- package/dist/cdn/{MTNAHLA4.js → NVDFU7VX.js} +2 -2
- package/dist/cdn/{2GEDY3GN.js → O7NVXQYW.js} +4 -4
- package/dist/cdn/{2IHKAUDX.js → OJYNONWN.js} +2 -2
- package/dist/cdn/{KSVU7VLD.js → ORREZ5IF.js} +2 -2
- package/dist/cdn/{AUYVELDF.js → OTDBA4XE.js} +2 -2
- package/dist/cdn/OZOKZDFZ.js +4 -0
- package/dist/cdn/{KNSCW6SS.js → PJLEYE2O.js} +2 -2
- package/dist/cdn/{PC6FKJYU.js → QAZKKZAI.js} +2 -2
- package/dist/cdn/{O2ASMWKU.js → RMHWRG4L.js} +2 -2
- package/dist/cdn/{56XBBDA6.js → RZJUO3P6.js} +2 -2
- package/dist/cdn/{XGRSVMCO.js → SXJFFROL.js} +2 -2
- package/dist/cdn/{4CWTGTNY.js → T24T4RIA.js} +2 -2
- package/dist/cdn/{SNPQLJY2.js → TBYAVPLA.js} +1 -1
- package/dist/cdn/{FWPGJBO5.js → TXLUBMGN.js} +2 -2
- package/dist/cdn/{WPLOP4RM.js → U4QZ35DS.js} +2 -2
- package/dist/cdn/VJKYCWAW.js +32 -0
- package/dist/cdn/{QSJZ4GJQ.js → WRLXN2BN.js} +2 -2
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/chunks/utils.js +1 -1
- package/dist/chunks/utils2.js +1 -1
- package/dist/components/arcgis-assistant/customElement.js +1 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat-card/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat-card-content/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-filter-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-query-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-shell/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/package.json +7 -7
- package/dist/cdn/5ZLN2JFL.js +0 -4
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# ArcGIS Maps SDK for JavaScript - AI Components
|
|
1
|
+
# ArcGIS Maps SDK for JavaScript - AI Components (beta)
|
|
2
2
|
|
|
3
3
|
**No Esri Technical Support included.**
|
|
4
4
|
|
|
5
|
-
The ArcGIS Maps SDK for JavaScript provides a suite of ready-to-use UI components that simplify the process of creating GIS web applications. This package contains
|
|
5
|
+
The ArcGIS Maps SDK for JavaScript provides a suite of ready-to-use UI components that simplify the process of creating GIS web applications. This package contains the `arcgis-assistant` and out-of-the-box agent components, which can be used to build AI assistants for web apps that provide end users with a natural language user interface for interacting with map data.
|
|
6
6
|
|
|
7
7
|
## License
|
|
8
8
|
|
|
@@ -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.
|
|
4
|
-
import{g as i,h as t,p as r,q as e,t as o}from"./
|
|
3
|
+
v5.0.0-next.142 */
|
|
4
|
+
import{g as i,h as t,p as r,q as e,t as o}from"./TBYAVPLA.js";import"./CKRH3D7E.js";var c=i`.assistant-chat-card-content__skeleton-block{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm);width:100%}.assistant-chat-card-content__skeleton-text{display:block;height:.95em;border-radius:6px;background:linear-gradient(90deg,color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent),color-mix(in srgb,var(--calcite-color-foreground-3) 85%,transparent),color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent));background-size:200% 100%;animation:assistant-chat-card-content-shimmer 1.2s ease-in-out infinite;width:85%}.assistant-chat-card-content__skeleton-text:last-child{width:70%}@keyframes assistant-chat-card-content-shimmer{0%{background-position:-150% 0}to{background-position:150% 0}}@media(prefers-reduced-motion){.assistant-chat-card-content__skeleton-text{animation:none}}.assistant-chat-card-content__text-container{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;gap:var(--calcite-spacing-sm);color:var(--calcite-color-text-1)}.assistant-chat-card-content__text-loading{font-style:italic;word-wrap:break-word;word-break:break-all;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical}.assistant-chat-card-content__error-notice{padding:var(--calcite-spacing-sm)}`,n="assistant-chat-card-content",a={textLoading:`${n}__text-loading`,skeletonBlock:`${n}__skeleton-block`,skeletonText:`${n}__skeleton-text`},s=class extends r{constructor(){super(...arguments),this.loading=!1,this.type="text"}static{this.properties={loading:5,type:1,content:1,loadingMessage:1}}static{this.styles=c}_renderText(){return t`<div class="assistant-chat-card-content__text-container"><div><span class=${e(this.loading?a.textLoading:void 0)}>${this.loading?this.loadingMessage:this.content}</span></div>${this.loading?t`<div class=${e(a.skeletonBlock)}><span class=${e(a.skeletonText)}></span><span class=${e(a.skeletonText)}></span></div>`:null}</div>`}_renderError(){return t`<calcite-notice class="assistant-chat-card-content__error-notice" open icon kind=warning width=auto><div slot=message>${this.content}</div></calcite-notice>`}render(){switch(this.type){case"text":return this._renderText();case"error":return this._renderError();default:return t`<p>Unsupported content type</p>`}}};o("arcgis-assistant-chat-card-content",s);export{s as ArcgisAssistantChatCardContent};
|
|
@@ -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.
|
|
4
|
-
import"./
|
|
3
|
+
v5.0.0-next.142 */
|
|
4
|
+
import"./CKRH3D7E.js";var e=`# ArcGIS Online Map Viewer \u2014 Smart Mapping Assistant
|
|
5
5
|
|
|
6
6
|
You are a Smart Mapping Assistant for 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.
|
|
4
|
-
import"./
|
|
3
|
+
v5.0.0-next.142 */
|
|
4
|
+
import"./CKRH3D7E.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.
|
|
3
|
+
v5.0.0-next.142 */
|
|
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.
|
|
4
|
-
import{b as a}from"./
|
|
3
|
+
v5.0.0-next.142 */
|
|
4
|
+
import{b as a}from"./ORREZ5IF.js";import"./NJFAKO5H.js";import"./66XCWCWM.js";import{p as s,t as e}from"./TBYAVPLA.js";import"./CKRH3D7E.js";var t=class extends s{static{this.properties={agent:0,context:0}}getContext(){return this.context}load(){a(this)}};e("arcgis-assistant-agent",t);export{t as ArcgisAssistantAgent};
|
|
@@ -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.
|
|
4
|
-
import"./
|
|
3
|
+
v5.0.0-next.142 */
|
|
4
|
+
import"./CKRH3D7E.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.
|
|
4
|
-
import d from"./
|
|
3
|
+
v5.0.0-next.142 */
|
|
4
|
+
import d from"./CSL4ICDD.js";import{a as i,b as e}from"./ORREZ5IF.js";import c from"./O7NVXQYW.js";import"./NJFAKO5H.js";import"./66XCWCWM.js";import{p as a,t as s}from"./TBYAVPLA.js";import b from"./CKTQQHF5.js";import"./IGC2ZG54.js";import"./CKRH3D7E.js";export default $arcgis.t(([,,{a:r}])=>{var t=class extends a{constructor(){super(...arguments),this.agent=r}static{this.properties={referenceElement:1}}#t;getContext(){if(!this.#t)throw new Error("arcgis-assistant-navigation-agent requires a mapView");return{mapView:this.#t}}async load(){this.#t=await i(this,"arcgis-assistant-navigation-agent"),e(this)}};s("arcgis-assistant-navigation-agent",t);return t},b,c,d)
|
|
@@ -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.
|
|
4
|
-
import{a as o}from"./
|
|
3
|
+
v5.0.0-next.142 */
|
|
4
|
+
import{a as o}from"./SXJFFROL.js";import"./66XCWCWM.js";import{g as a,h as t,k as e,p as n,t as l}from"./TBYAVPLA.js";import"./CKRH3D7E.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.
|
|
4
|
-
import d from"./
|
|
3
|
+
v5.0.0-next.142 */
|
|
4
|
+
import d from"./CSL4ICDD.js";import{a as r,b as e}from"./ORREZ5IF.js";import c from"./O7NVXQYW.js";import"./NJFAKO5H.js";import"./66XCWCWM.js";import{p as a,t as s}from"./TBYAVPLA.js";import b from"./CKTQQHF5.js";import"./IGC2ZG54.js";import"./CKRH3D7E.js";export default $arcgis.t(([,,{b:i}])=>{var t=class extends a{constructor(){super(...arguments),this.agent=i}static{this.properties={referenceElement:1}}#t;getContext(){if(!this.#t)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#t}}async load(){this.#t=await r(this,"arcgis-assistant-data-exploration-agent"),e(this)}};s("arcgis-assistant-data-exploration-agent",t);return t},b,c,d)
|
|
@@ -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.
|
|
4
|
-
import{ac as a}from"./
|
|
3
|
+
v5.0.0-next.142 */
|
|
4
|
+
import{ac as a}from"./IGC2ZG54.js";import"./CKRH3D7E.js";export{a as PromptTemplate};
|
|
@@ -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.
|
|
3
|
+
v5.0.0-next.142 */
|
|
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.
|
|
4
|
-
import{$ as Ge,$b as C,A as ke,B as Ee,Bb as U,C as M,D as Ae,E as Ie,F as $e,G as Ne,H as ze,Hb as B,I as Re,J as q,K,M as P,N as T,O as le,P as ue,Pb as pe,Q as w,Qb as me,R as Ue,S as Be,Sb as j,T as E,Tb as Q,U as y,Ub as X,V as A,W as De,X as He,Y as I,Z as $,Zb as d,_ as We,_b as Y,aa as x,ac as h,ba as N,bc as D,ca as Je,da as qe,ea as z,fa as g,ga as v,ha as Ke,ia as Qe,ja as V,ka as Xe,l as oe,la as Ye,ma as Ze,na as Le,oa as R,r as Me,s as Pe,t as Te,u as Ve,v as je,w as Ce,x as Oe,y as Fe,z as Se}from"./
|
|
3
|
+
v5.0.0-next.142 */
|
|
4
|
+
import{$ as Ge,$b as C,A as ke,B as Ee,Bb as U,C as M,D as Ae,E as Ie,F as $e,G as Ne,H as ze,Hb as B,I as Re,J as q,K,M as P,N as T,O as le,P as ue,Pb as pe,Q as w,Qb as me,R as Ue,S as Be,Sb as j,T as E,Tb as Q,U as y,Ub as X,V as A,W as De,X as He,Y as I,Z as $,Zb as d,_ as We,_b as Y,aa as x,ac as h,ba as N,bc as D,ca as Je,da as qe,ea as z,fa as g,ga as v,ha as Ke,ia as Qe,ja as V,ka as Xe,l as oe,la as Ye,ma as Ze,na as Le,oa as R,r as Me,s as Pe,t as Te,u as Ve,v as je,w as Ce,x as Oe,y as Fe,z as Se}from"./IGC2ZG54.js";import{b as _e}from"./CKRH3D7E.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(`
|