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

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/{PEFKT7JJ.js → 2SGFDAEY.js} +1 -1
  2. package/dist/cdn/3MMHUDSF.js +4 -0
  3. package/dist/cdn/{UC4HPCM3.js → 3VFAPRYD.js} +2 -2
  4. package/dist/cdn/{FORRN75L.js → 4KX47OIY.js} +2 -2
  5. package/dist/cdn/{W4LEGPD2.js → 4OVLOQXC.js} +2 -2
  6. package/dist/cdn/{AD7WB3RO.js → 6DPOGMLP.js} +2 -2
  7. package/dist/cdn/{ZQEX3TGK.js → 6OU24WKD.js} +2 -2
  8. package/dist/cdn/{WOP5ENGJ.js → 73U5QVW7.js} +4 -4
  9. package/dist/cdn/{LILVLE37.js → B3CBPMAE.js} +3 -3
  10. package/dist/cdn/{TCNLHL43.js → B6US7W4D.js} +2 -2
  11. package/dist/cdn/{Q3MKHRXI.js → BM5HBCMM.js} +2 -2
  12. package/dist/cdn/{KMV7W5OL.js → BNCRA5SC.js} +2 -2
  13. package/dist/cdn/{YXLN5DSL.js → CGHOYBSP.js} +1 -1
  14. package/dist/cdn/{2OKOKVH3.js → E2HMACO2.js} +2 -2
  15. package/dist/cdn/{MXHQFIP3.js → EDVYV22K.js} +2 -2
  16. package/dist/cdn/{7QPPUNQ3.js → EPPE6NOO.js} +2 -2
  17. package/dist/cdn/{GRXZ64LO.js → F2ZCKVDM.js} +2 -2
  18. package/dist/cdn/{N4CYINOF.js → FVN3EMRP.js} +2 -2
  19. package/dist/cdn/{2KGO3SIH.js → GE5S7JUP.js} +2 -2
  20. package/dist/cdn/{PA2KCYKL.js → GTB7E7IK.js} +2 -2
  21. package/dist/cdn/{J62NTCLN.js → IOZANV7W.js} +2 -2
  22. package/dist/cdn/{GZUY3255.js → IRD6DO56.js} +2 -2
  23. package/dist/cdn/{46CNQJRX.js → JINQHP2K.js} +1 -1
  24. package/dist/cdn/{USJ5YVZN.js → JIVOCNU3.js} +2 -2
  25. package/dist/cdn/{ID5STKZH.js → K4TH3BS4.js} +2 -2
  26. package/dist/cdn/{QIU4T2DV.js → L66SQDYK.js} +2 -2
  27. package/dist/cdn/{G7XEFTIR.js → N2GUX6TE.js} +2 -2
  28. package/dist/cdn/{Q34AELDL.js → NWRUA6RD.js} +2 -2
  29. package/dist/cdn/{EJW7PCMD.js → PXFUXDHH.js} +2 -2
  30. package/dist/cdn/{CGGGHCIN.js → QOQBL2ZP.js} +2 -2
  31. package/dist/cdn/{UIUJKONY.js → QXQTSWME.js} +1 -1
  32. package/dist/cdn/{A3UHOE4Q.js → SKS3G7F2.js} +2 -2
  33. package/dist/cdn/{BCCDWQP4.js → TTICFYA5.js} +2 -2
  34. package/dist/cdn/{FYKWTA6C.js → TW7MVMU3.js} +2 -2
  35. package/dist/cdn/{ASKBAWPQ.js → U5FDX47E.js} +2 -2
  36. package/dist/cdn/{AB32PU6M.js → W3S5QQYL.js} +2 -2
  37. package/dist/cdn/{NR6PK4OK.js → WCDHMKXX.js} +2 -2
  38. package/dist/cdn/{CF42OIDB.js → WHXIJIZ2.js} +2 -2
  39. package/dist/cdn/{A7BGJLHS.js → ZVXWUZUH.js} +3 -3
  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/HPGCDT6I.js +0 -4
@@ -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.133 */
3
+ v5.0.0-next.134 */
4
4
  function n(e){return e?typeof e=="string"?document.querySelector(e):e:null}export{n as a};
@@ -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.134 */
4
+ import a from"./6OU24WKD.js";import"./B3CBPMAE.js";import"./JINQHP2K.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.133 */
4
- import"./46CNQJRX.js";var e=`## Navigation Agent - Tool Intent Classifier
3
+ v5.0.0-next.134 */
4
+ import"./JINQHP2K.js";var e=`## Navigation Agent - Tool Intent Classifier
5
5
 
6
6
  You are an assistant that classifies user intent for navigation agent.
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.133 */
4
- import{a as s}from"./PEFKT7JJ.js";import{b as o}from"./UIUJKONY.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.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};
@@ -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.133 */
4
- import"./46CNQJRX.js";var e=`You are a knowledgeable GIS expert.
3
+ v5.0.0-next.134 */
4
+ import"./JINQHP2K.js";var e=`You are a knowledgeable GIS expert.
5
5
 
6
6
  You are given a Feature Service description and title.
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.133 */
4
- import{a as u}from"./2KGO3SIH.js";import"./UIUJKONY.js";import{g as i,h as s,k as a,n as r,o as n,p as c,r as o,t as l}from"./YXLN5DSL.js";import"./46CNQJRX.js";export default $arcgis.t(([{watch:h}])=>{var d=i`.assistant-chat-entry__input-container{display:flex;flex-direction:column}.assistant-chat-entry__footer-start{display:flex;gap:var(--calcite-spacing-md);flex-wrap:wrap;align-items:center}.assistant-chat-entry__footer-end{display:flex;gap:var(--calcite-spacing-md);align-items:center}.assistant-chat-entry__status-indicator{width:9px;height:9px;border-radius:100%;background-color:var(--calcite-color-status-success)}.assistant-chat-entry__status-indicator[data-status=working]{background-color:var(--calcite-color-status-warning)}.assistant-chat-entry__status-indicator[data-status=error]{background-color:var(--calcite-color-status-danger)}.assistant-chat-entry__status-text{text-transform:capitalize}`,e=class extends c{constructor(){super(...arguments),this.#t=r(),this._messages=u({blocking:!0}),this.enterKeySubmits=!0,this.awaitingResponse=!1,this.inputValue="",this.arcgisCancel=a(),this.arcgisSubmit=a()}static{this.properties={enterKeySubmits:5,entryPlaceholder:1,awaitingResponse:5,inputValue:1,status:1}}static{this.styles=d}#t;loaded(){this.manager.onLifecycle(()=>[h(()=>this.inputValue,t=>{this.#t.value&&(this.#t.value.value=t)},{initial:!0})])}async _submitMessage(){if(this.awaitingResponse){this.arcgisCancel.emit();return}let t=this.#t.value?.value.trim();t&&(this.arcgisSubmit.emit(t),this.#t.value&&(this.#t.value.value="",await this.#t.value.setFocus()))}render(){return s`<div class="assistant-chat-entry__input-container"><calcite-text-area .value=${this.#t.value?.value} .placeholder=${this.entryPlaceholder??this._messages.entryPlaceholder} @keydown=${async t=>{t.key==="Enter"&&!t.shiftKey&&this.enterKeySubmits&&(t.preventDefault(),await this._submitMessage())}} ${n(this.#t)}><div slot=footer-start class="assistant-chat-entry__footer-start"><slot name=entry-actions-start></slot></div><div slot=footer-end class="assistant-chat-entry__footer-end">${this.status?s`<div id=tooltip-status class="assistant-chat-entry__status-indicator" data-status=${this.status??o}></div><calcite-tooltip reference-element=tooltip-status offset-distance=12><span class="assistant-chat-entry__status-text">${this.status}</span></calcite-tooltip>`:null}<calcite-button .iconStart=${this.awaitingResponse?"circle-stop":"send"} slot=footer-end round @click=${()=>void this._submitMessage()}>${this.awaitingResponse?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></div></calcite-text-area></div>`}};l("arcgis-assistant-chat-entry",e);return e},"core/reactiveUtils")
3
+ v5.0.0-next.134 */
4
+ import{a as u}from"./GE5S7JUP.js";import"./QXQTSWME.js";import{g as i,h as s,k as a,n as r,o as n,p as c,r as o,t as l}from"./CGHOYBSP.js";import"./JINQHP2K.js";export default $arcgis.t(([{watch:h}])=>{var d=i`.assistant-chat-entry__input-container{display:flex;flex-direction:column}.assistant-chat-entry__footer-start{display:flex;gap:var(--calcite-spacing-md);flex-wrap:wrap;align-items:center}.assistant-chat-entry__footer-end{display:flex;gap:var(--calcite-spacing-md);align-items:center}.assistant-chat-entry__status-indicator{width:9px;height:9px;border-radius:100%;background-color:var(--calcite-color-status-success)}.assistant-chat-entry__status-indicator[data-status=working]{background-color:var(--calcite-color-status-warning)}.assistant-chat-entry__status-indicator[data-status=error]{background-color:var(--calcite-color-status-danger)}.assistant-chat-entry__status-text{text-transform:capitalize}`,e=class extends c{constructor(){super(...arguments),this.#t=r(),this._messages=u({blocking:!0}),this.enterKeySubmits=!0,this.awaitingResponse=!1,this.inputValue="",this.arcgisCancel=a(),this.arcgisSubmit=a()}static{this.properties={enterKeySubmits:5,entryPlaceholder:1,awaitingResponse:5,inputValue:1,status:1}}static{this.styles=d}#t;loaded(){this.manager.onLifecycle(()=>[h(()=>this.inputValue,t=>{this.#t.value&&(this.#t.value.value=t)},{initial:!0})])}async _submitMessage(){if(this.awaitingResponse){this.arcgisCancel.emit();return}let t=this.#t.value?.value.trim();t&&(this.arcgisSubmit.emit(t),this.#t.value&&(this.#t.value.value="",await this.#t.value.setFocus()))}render(){return s`<div class="assistant-chat-entry__input-container"><calcite-text-area .value=${this.#t.value?.value} .placeholder=${this.entryPlaceholder??this._messages.entryPlaceholder} @keydown=${async t=>{t.key==="Enter"&&!t.shiftKey&&this.enterKeySubmits&&(t.preventDefault(),await this._submitMessage())}} ${n(this.#t)}><div slot=footer-start class="assistant-chat-entry__footer-start"><slot name=entry-actions-start></slot></div><div slot=footer-end class="assistant-chat-entry__footer-end">${this.status?s`<div id=tooltip-status class="assistant-chat-entry__status-indicator" data-status=${this.status??o}></div><calcite-tooltip reference-element=tooltip-status offset-distance=12><span class="assistant-chat-entry__status-text">${this.status}</span></calcite-tooltip>`:null}<calcite-button .iconStart=${this.awaitingResponse?"circle-stop":"send"} slot=footer-end round @click=${()=>void this._submitMessage()}>${this.awaitingResponse?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></div></calcite-text-area></div>`}};l("arcgis-assistant-chat-entry",e);return e},"core/reactiveUtils")
@@ -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.133 */
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"./LILVLE37.js";import{b as _e}from"./46CNQJRX.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.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}
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(`
@@ -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.133 */
4
- import a from"./ZQEX3TGK.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"./LILVLE37.js";import{a as Fm,b as te,c as Bm}from"./46CNQJRX.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.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}
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("./J62NTCLN.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("./W4LEGPD2.js"),"./intent_prompt.md":()=>import("./GRXZ64LO.js"),"./layer_descriptions_prompt.md":()=>import("./FYKWTA6C.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("./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(`
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)+`