@arcgis/ai-components 5.1.0-next.11 → 5.1.0-next.12

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.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import c from"./5TCVCSD2.js";import b from"./XTVXT577.js";import{a as s,b as a}from"./WFEBJPQ4.js";import"./OJUEJ4RT.js";import"./WBSNYWJJ.js";import{v as e,z as r}from"./VG7GKLZR.js";import"./CFDTXKJ6.js";export default $arcgis.t(([,{d:i}])=>{var t=class extends e{constructor(){super(...arguments),this.agent=i}static{this.properties={referenceElement:1}}#t;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-query-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-layer-query-agent"),a(this)}};r("arcgis-assistant-layer-query-agent",t);return t},b,c)
2
+ import c from"./J6B7AZFR.js";import b from"./5XHJVBOQ.js";import{a as s,b as a}from"./WFEBJPQ4.js";import"./OJUEJ4RT.js";import"./WBSNYWJJ.js";import{v as e,z as r}from"./VG7GKLZR.js";import"./CFDTXKJ6.js";export default $arcgis.t(([,{d:i}])=>{var t=class extends e{constructor(){super(...arguments),this.agent=i}static{this.properties={referenceElement:1}}#t;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-query-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-layer-query-agent"),a(this)}};r("arcgis-assistant-layer-query-agent",t);return t},b,c)
@@ -0,0 +1,3 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import"./CFDTXKJ6.js";var o=`(function(){"use strict";const h=(r,s)=>{if(r.length!==s.length)throw new Error("Vectors must be the same length");let o=0,a=0,n=0;for(let e=0;e<r.length;++e){const i=r[e],c=s[e];o+=i*c,a+=i*i,n+=c*c}const l=Math.sqrt(a*n);if(l===0)return 0;const t=o/l;return Math.max(-1,Math.min(1,t))};let d=[];const g=new Map,u=12,p=10,b=r=>{d=r.layers.map(s=>({id:s.id,vector:s.vector})),console.log("Layer Vectorstore contents:",d)},f=r=>{g.clear();for(const s of r.layers){const o=s.fields.map(a=>({name:a.name,vector:a.vector}));g.set(s.id,o)}console.log("Field lookups initialized for layers:",g)};globalThis.addEventListener("message",r=>{(async()=>{const{type:s,webmapEmbeddings:o,layerIdForFieldsSearch:a=[],requestId:n,precomputedEmbedding:l}=r.data;switch(s){case"generateEmbeddings":{o&&(b(o),f(o)),globalThis.postMessage("completed");break}case"layerSearch":{if(d.length>0)try{const t=d.map(e=>({id:e.id,score:h(l,e.vector)})).sort((e,i)=>i.score-e.score).slice(0,p);globalThis.postMessage({requestId:n,results:t})}catch(t){globalThis.postMessage({requestId:n,results:[],error:t instanceof Error?t.message:"Calculation error"})}else globalThis.postMessage({requestId:n,results:[],error:"Layer embeddings not initialized"});break}case"fieldSearch":{if(a.length>0)try{const t=a.map(e=>{const i=g.get(e);if(!i)return{layerId:e,results:[]};const c=i.map(m=>({name:m.name,score:h(l,m.vector)})).sort((m,y)=>y.score-m.score).slice(0,u);return{layerId:e,results:c}});globalThis.postMessage({requestId:n,results:t})}catch(t){globalThis.postMessage({requestId:n,results:[],error:t instanceof Error?t.message:"Field search calculation error"})}break}default:console.warn("Unknown message type:",s)}})()})})();
3
+ `,r=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",o],{type:"text/javascript;charset=utf-8"});function a(t){let e;try{if(e=r&&(self.URL||self.webkitURL).createObjectURL(r),!e)throw"";let s=new Worker(e,{name:t?.name});return s.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),s}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(o),{name:t?.name})}}export{a as default};