@mediapipe/tasks-retrieval 1.2.0-rc.20261023 → 1.2.0-rc.20261024
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/package.json +1 -1
- package/retrieval_bundle.cjs +1 -1
- package/retrieval_bundle.cjs.map +1 -1
- package/retrieval_bundle.js +1 -1
- package/retrieval_bundle.js.map +1 -1
- package/retrieval_bundle.mjs +1 -1
- package/retrieval_bundle.mjs.map +1 -1
- package/wasm/retrieval_wasm_internal.js +1 -1
- package/wasm/retrieval_wasm_internal.wasm +0 -0
- package/wasm/retrieval_wasm_module_internal.js +1 -1
- package/wasm/retrieval_wasm_module_internal.wasm +0 -0
- package/wasm/retrieval_wasm_nosimd_internal.js +1 -1
- package/wasm/retrieval_wasm_nosimd_internal.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediapipe/tasks-retrieval",
|
|
3
|
-
"version": "1.2.0-rc.
|
|
3
|
+
"version": "1.2.0-rc.20261024",
|
|
4
4
|
"description": "MediaPipe Retrieval Tasks. See the privacy notice at https://goo.gle/mediapipe-privacy.",
|
|
5
5
|
"main": "retrieval_bundle.cjs",
|
|
6
6
|
"browser": "retrieval_bundle.mjs",
|
package/retrieval_bundle.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t="undefined"!=typeof self?self:{};function e(e,r){t:{for(var n=["CLOSURE_FLAGS"],i=t,o=0;o<n.length;o++)if(null==(i=i[n[o]])){n=null;break t}n=i}return null!=(e=n&&n[e])?e:r}var r,n="undefined"!=typeof TextEncoder;function i(t){if(n)t=(r||=new TextEncoder).encode(t);else{let r=0,n=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var e=t.charCodeAt(i);if(e<128)n[r++]=e;else{if(e<2048)n[r++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&i<t.length){let o=t.charCodeAt(++i);if(o>=56320&&o<=57343){e=1024*(e-55296)+o-56320+65536,n[r++]=e>>18|240,n[r++]=e>>12&63|128,n[r++]=e>>6&63|128,n[r++]=63&e|128;continue}i--}e=65533}n[r++]=e>>12|224,n[r++]=e>>6&63|128}n[r++]=63&e|128}}t=r===n.length?n:n.subarray(0,r)}return t}var o=e(610401301,!1),a=e(748402147,!0);function s(){var e=t.navigator;return e&&(e=e.userAgent)?e:""}var u,l=t.navigator;u=l&&l.userAgentData||null;var f={},c=null;function h(t){var e=t.length,r=3*e/4;r%3?r=Math.floor(r):-1!="=.".indexOf(t[e-1])&&(r=-1!="=.".indexOf(t[e-2])?r-2:r-1);var n=new Uint8Array(r),i=0;return function(t,e){function r(e){for(;n<t.length;){let e=t.charAt(n++),r=c[e];if(null!=r)return r;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}d();for(var n=0;;){let t=r(-1),n=r(0),i=r(64),o=r(64);if(64===o&&-1===t)break;e(t<<2|n>>4),64!=i&&(e(n<<4&240|i>>2),64!=o&&e(i<<6&192|o))}}(t,function(t){n[i++]=t}),i!==r?n.subarray(0,i):n}function d(){if(!c){c={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=t.concat(e[r].split(""));f[r]=n;for(let t=0;t<n.length;t++){let e=n[t];void 0===c[e]&&(c[e]=t)}}}}var p="undefined"!=typeof Uint8Array,y=!(!(!!o&&(!!u&&u.brands.length>0))&&(-1!=s().indexOf("Trident")||-1!=s().indexOf("MSIE")))&&"function"==typeof btoa,m=/[-_.]/g,g={"-":"+",_:"/",".":"="};function v(t){return g[t]||""}function b(t){if(!y)return h(t);t=m.test(t)?t.replace(m,v):t,t=atob(t);var e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}var w,A={},I=class{constructor(t,e){if(E(e),this.h=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};function E(t){if(t!==A)throw Error("illegal external caller")}function S(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}var x=void 0;function N(t){return S(t=Error(t),"warning"),t}function B(e,r){if(null!=e){var n=x??={},i=n[e]||0;i>=r||(n[e]=i+1,S(e=Error(),"incident"),function(e){t.setTimeout(()=>{throw e},0)}(e))}}function _(){return"function"==typeof BigInt}var C="function"==typeof Symbol&&"symbol"==typeof Symbol();function T(t,e,r=!1){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?r&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e}var j,O=T("jas",void 0,!0),F=T(void 0,"1oa"),U=T(void 0,"0ubsb"),k=T(void 0,"0actk"),M=T("m_m","na",!0),R={ca:{value:0,configurable:!0,writable:!0,enumerable:!1}},P=Object.defineProperties,D=C?O:"ca",L=[];function z(t,e){C||D in t||P(t,R),t[D]|=e}function G(t,e){C||D in t||P(t,R),t[D]=e}G(L,7),j=Object.freeze(L);var $={};function H(t,e){return void 0===e?t.h!==W&&!!(2&t.l[D]):!!(2&e)&&t.h!==W}var W={};function J(t){return t.ma=!0,t}var V=J(t=>"number"==typeof t),q=J(t=>"string"==typeof t),K=J(t=>"boolean"==typeof t),X="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0);function Z(t){var e=t;if(q(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(V(e)&&!Number.isSafeInteger(e))throw Error(String(e));return X?BigInt(t):t=K(t)?t?"1":"0":q(t)?t.trim()||"0":String(t)}var Y=J(t=>X?t>=tt&&t<=rt:"-"===t[0]?nt(t,Q):nt(t,et)),Q=Number.MIN_SAFE_INTEGER.toString(),tt=X?BigInt(Number.MIN_SAFE_INTEGER):void 0,et=Number.MAX_SAFE_INTEGER.toString(),rt=X?BigInt(Number.MAX_SAFE_INTEGER):void 0;function nt(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let r=0;r<t.length;r++){let n=t[r],i=e[r];if(n>i)return!1;if(n<i)return!0}}var it,ot=0,at=0;function st(t){var e=t>>>0;ot=e,at=(t-e)/4294967296>>>0}function ut(t){if(t<0){st(-t);let[e,r]=pt(ot,at);ot=e>>>0,at=r>>>0}else st(t)}function lt(t,e){var r=4294967296*e+(t>>>0);return Number.isSafeInteger(r)?r:ft(t,e)}function ft(t,e){if(t>>>=0,(e>>>=0)<=2097151)var r=""+(4294967296*e+t);else _()?r=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(r=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),r+=8147497*e,e*=2,t>=1e7&&(r+=t/1e7>>>0,t%=1e7),r>=1e7&&(e+=r/1e7>>>0,r%=1e7),r=e+ct(r)+ct(t));return r}function ct(t){return t=String(t),"0000000".slice(t.length)+t}function ht(){var t=ot,e=at;if(2147483648&e)if(_())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{let[r,n]=pt(t,e);t="-"+ft(r,n)}else t=ft(t,e);return t}function dt(t){if(t.length<16)ut(Number(t));else if(_())t=BigInt(t),ot=Number(t&BigInt(4294967295))>>>0,at=Number(t>>BigInt(32)&BigInt(4294967295));else{let e=+("-"===t[0]);at=ot=0;let r=t.length;for(let n=e,i=(r-e)%6+e;i<=r;n=i,i+=6){let e=Number(t.slice(n,i));at*=1e6,(ot=1e6*ot+e)>=4294967296&&(at+=Math.trunc(ot/4294967296),at>>>=0,ot>>>=0)}if(e){let[t,e]=pt(ot,at);ot=t,at=e}}}function pt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}var yt="function"==typeof BigInt?BigInt.asIntN:void 0,mt="function"==typeof BigInt?BigInt.asUintN:void 0,gt=Number.isSafeInteger,vt=Number.isFinite,bt=Math.trunc;function wt(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}var At,It,Et,St=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function xt(t){switch(typeof t){case"bigint":return!0;case"number":return vt(t);case"string":return St.test(t);default:return!1}}function Nt(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return vt(t)?0|t:void 0}function Bt(t){var e=t.length;return("-"===t[0]?e<20||20===e&&t<="-9223372036854775808":e<19||19===e&&t<="9223372036854775807")?t:(dt(t),ht())}function _t(t){if("-"===t[0])var e=!1;else e=(e=t.length)<20||20===e&&t<="18446744073709551615";return e?t:(dt(t),ft(ot,at))}function Ct(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(yt(64,t));if(xt(t)){if("string"===e)return e=bt(Number(t)),gt(e)?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=Bt(t)),t;if("number"===e)return function(t){if(t=bt(t),!gt(t)){ut(t);var e=ot,r=at;(t=2147483648&r)&&(r=~r>>>0,0==(e=1+~e>>>0)&&(r=r+1>>>0)),t="number"==typeof(e=lt(e,r))?t?-e:e:t?"-"+e:e}return t}(t)}}function Tt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(mt(64,t));if(xt(t)){if("string"===e)return e=bt(Number(t)),gt(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=_t(t)),t;if("number"===e)return function(t){return(t=bt(t))>=0&>(t)||(ut(t),t=lt(ot,at)),t}(t)}}function jt(t){if(null==t||"string"==typeof t||t instanceof I)return t}function Ot(t){return null==t||"string"==typeof t?t:void 0}function Ft(t){return t}function Ut(t,e,r,n){var i=void 0!==n;n=!!n;var o=[],a=t.length,s=4294967295,u=!1,l=!!(64&e),f=l?128&e?0:-1:void 0;if(!(1&e)){var c=a&&t[a-1];null!=c&&"object"==typeof c&&c.constructor===Object?s=--a:c=void 0,!l||128&e||i||(u=!0,s=(At??Ft)(s-f,f,t,c,void 0)+f)}for(e=void 0,i=0;i<a;i++){let a=t[i];if(null!=a&&null!=(a=r(a,n)))if(l&&i>=s){let t=i-f;(e??={})[t]=a}else o[i]=a}if(c)for(let i in c){if(null==(t=c[i])||null==(t=r(t,n)))continue;let u;a=+i,l&&!Number.isNaN(a)&&(u=a+f)<s?o[u]=t:(e??={})[i]=t}return e&&(u?o.push(e):o[s]=e),o}function kt(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return Y(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var e=0|t[D];return 0===t.length&&1&e?void 0:Ut(t,e,kt)}if(null!=t&&t[M]===$)return Mt(t);if(t instanceof I){if(null==(e=t.h))t="";else if("string"==typeof e)t=e;else{if(y){for(var r="",n=0,i=e.length-10240;n<i;)r+=String.fromCharCode.apply(null,e.subarray(n,n+=10240));r+=String.fromCharCode.apply(null,n?e.subarray(n):e),e=btoa(r)}else{void 0===r&&(r=0),d(),r=f[r],n=Array(Math.floor(e.length/3)),i=r[64]||"";let t=0,l=0;for(;t<e.length-2;t+=3){var o=e[t],a=e[t+1],s=e[t+2],u=r[o>>2];o=r[(3&o)<<4|a>>4],a=r[(15&a)<<2|s>>6],s=r[63&s],n[l++]=u+o+a+s}switch(u=0,s=i,e.length-t){case 2:s=r[(15&(u=e[t+1]))<<2]||i;case 1:e=e[t],n[l]=r[e>>2]+r[(3&e)<<4|u>>4]+s+i}e=n.join("")}t=t.h=e}return t}return}return t}function Mt(t){return Ut(t=t.l,0|t[D],kt)}function Rt(t,e,r,n=0){if(null==t){var i=32;r?(t=[r],i|=128):t=[],e&&(i=-16760833&i|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(i=0|t[D],a&&1&i)throw Error("rfarr");if(2048&i&&!(2&i)&&function(){if(a)throw Error("carr");B(k,5)}(),256&i)throw Error("farr");if(64&i)return(i|n)!==i&&G(t,i|n),t;if(r&&(i|=128,r!==t[0]))throw Error("mid");t:{i|=64;var o=(r=t).length;if(o){var s=o-1;let t=r[s];if(null!=t&&"object"==typeof t&&t.constructor===Object){if((s-=e=128&i?0:-1)>=1024)throw Error("pvtlmt");for(var u in t)(o=+u)<s&&(r[o+e]=t[u],delete t[u]);i=-16760833&i|(1023&s)<<14;break t}}if(e){if((u=Math.max(e,o-(128&i?0:-1)))>1024)throw Error("spvt");i=-16760833&i|(1023&u)<<14}}}return G(t,64|i|n),t}function Pt(t,e){if("object"!=typeof t)return t;if(Array.isArray(t)){var r=0|t[D];return 0===t.length&&1&r?t=void 0:2&r||(!e||4096&r||16&r?t=Dt(t,r,!1,e&&!(16&r)):(z(t,34),4&r&&Object.freeze(t))),t}if(null!=t&&t[M]===$){let n=0|(r=t.l)[D];return H(t,n)||(2&n?e=!0:32&n&&!(4096&n)?(G(r,2|n),t.h=W,e=!0):e=!1,e?(t=new t.constructor(r)).j=W:t=Dt(r,n)),t}return t instanceof I?t:void 0}function Dt(t,e,r,n){return n??=!!(34&e),t=Ut(t,e,Pt,n),n=32,r&&(n|=2),G(t,e=16769217&e|n),t}function Lt(t){if(t.h!==W)return!1;var e=t.l;return z(e=Dt(e,0|e[D]),2048),t.l=e,t.h=void 0,t.j=void 0,!0}function zt(t){if(!Lt(t)&&H(t,0|t.l[D]))throw Error()}function Gt(t,e){void 0===e&&(e=0|t[D]),32&e&&!(4096&e)&&G(t,4096|e)}function $t(t,e,r){if(-1===e)return null;var n=e+(r?0:-1),i=t.length-1;if(!(i<1+(r?0:-1))){if(n>=i)if(null!=(t=t[i])&&"object"==typeof t&&t.constructor===Object)e=t[e];else{if(n!==i)return;e=t}else e=t[n];return e}}function Ht(t,e,r){zt(t);var n=t.l;return Wt(n,0|n[D],e,r),t}function Wt(t,e,r,n,i){var o=r+(i?0:-1),a=t.length-1;if(a>=1+(i?0:-1)&&o>=a){let i=t[a];if(null!=i&&"object"==typeof i&&i.constructor===Object)return i[r]=n,e}return o<=a?(t[o]=n,e):(void 0!==n&&(r>=(a=(e??=0|t[D])>>14&1023||536870912)?null!=n&&(t[a+(i?0:-1)]={[r]:n}):t[o]=n),e)}function Jt(t,e,r){return t=$t(t,e,r),Array.isArray(t)?t:j}function Vt(t,e){return 2&e&&(t|=2),1|t}function qt(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function Kt(t){if(C)return t[F]??(t[F]=new Map);if(F in t)return t[F];var e=new Map;return Object.defineProperty(t,F,{value:e}),e}function Xt(t,e,r,n){var i=t.get(n);if(null!=i)return i;i=0;for(let t=0;t<n.length;t++){let o=n[t];null!=$t(e,o)&&(0!==i&&(r=Wt(e,r,i)),i=o)}return t.set(n,i),i}function Zt(t){return null==t&&(t=void 0),t}function Yt(t,e,r){return Ht(t,e,r=Zt(r)),r&&!H(r)&&Gt(t.l),t}function Qt(t,e,r){var n=vn;t:{var i=r=Zt(r);zt(t);let s=t.l;var o=0|s[D];if(null==i){var a=Kt(s);if(Xt(a,s,o,n)!==e)break t;a.set(n,0)}else{let t=Kt(a=s),r=Xt(t,a,o,n);r!==e&&(r&&(o=Wt(a,o,r)),t.set(n,e))}Wt(s,o,e,i)}return r&&!H(r)&&Gt(t.l),t}function te(t,e){return-273&(2&e?2|t:-3&t)}function ee(t,e){var r=ln;zt(t);var n=t.l,i=n,o=0|n[D],a=H(t,o)?1:2;2===a&&Lt(t)&&(o=0|(i=t.l)[D]);var s=Jt(i,8),u=s===j?7:0|s[D],l=Vt(u,o);if(t=!(4&l)){var f=o;let t=!!(2&l);t&&(f|=2);let e=!t,n=!0,i=0,a=0;for(;i<s.length;i++){var c=s[i],h=r,d=f;if(null==c||c[M]!==$)if(Array.isArray(c)){let t,e=0|c[D];t=e|32&d,t|=2&d,t!==e&&G(c,t),c=new h(c)}else c=void 0;c instanceof r&&(t||(h=H(c),e&&=!h,n&&=h),s[a++]=c)}a<i&&(s.length=a),l|=4,l=n?-4097&l:4096|l,l=e?8|l:-9&l}l!==u&&(G(s,l),2&l&&Object.freeze(s)),l=u=l,(f=qt(u))&&2===a&&(s=Array.prototype.slice.call(s),l=0,u=te(u,o),o=Wt(i,o,8,s),f=!1),f||(1===a||4===a&&(2&u||!(16&u)&&32&o)?((u|=!s.length||t&&!(4096&u)||32&o&&!(4096&u||16&u)?2:256)!==l&&G(s,u),Object.freeze(s)):u!==l&&G(s,u)),2&u||!(4096&u||16&u)||Gt(i,o),a=s,e=null!=e?e:new r,a.push(e),t=r=a===j?7:0|a[D],(e=H(e))?(r&=-9,1===a.length&&(r&=-4097)):r|=4096,r!==t&&G(a,r),e||Gt(n)}function re(t,e,r){return Ht(t,e,null==r?r:function(t){if(!xt(t))throw N("int64");switch(typeof t){case"string":var e=bt(Number(t));return gt(e)?t=Z(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=_()?Z(yt(64,BigInt(t))):Z(Bt(t))),t;case"bigint":return Z(yt(64,t));default:return gt(t)||(t=bt(t),gt(t)?t=String(t):(ut(t),t=ht())),Z(t)}}(r))}function ne(t,e,r){return Ht(t,e,null==r?r:function(t){if(!xt(t))throw N("uint64");switch(typeof t){case"string":var e=bt(Number(t));return gt(e)&&e>=0?t=Z(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=_()?Z(mt(64,BigInt(t))):Z(_t(t))),t;case"bigint":return Z(mt(64,t));default:return t>=0&>(t)||((t=bt(t))>=0&>(t)?t=String(t):(ut(t),t=ft(ot,at))),Z(t)}}(r))}function ie(t,e,r){if(null!=r&&"string"!=typeof r)throw Error();return Ht(t,e,r)}function oe(t,e,r){if(null!=r){if(!vt(r))throw N("enum");r|=0}return Ht(t,e,r)}var ae=class{constructor(t,e,r){if(this.buffer=t,r&&!e)throw Error()}};function se(t){if("string"==typeof t)return new ae(b(t),!0);if(Array.isArray(t))return new ae(new Uint8Array(t),!0);if(t.constructor===Uint8Array)return new ae(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new ae(t,!1);if(t.constructor===I){E(A);var e=t.h;return e=(null==(e=null==e||p&&null!=e&&e instanceof Uint8Array?e:"string"==typeof e?b(e):null)?e:t.h=e)||new Uint8Array(0),new ae(e,!0,t)}if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new ae(t,!1);throw Error()}function ue(t){return new ce(4294967295&t,Math.floor(t/4294967296))}function le(t){return t?/^\d+$/.test(t)?(dt(t),new ce(ot,at)):null:fe||=new ce(0,0)}var fe,ce=class{constructor(t,e){this.i=t>>>0,this.h=e>>>0}};function he(t){return new Ie(4294967295&t,Math.floor(t/4294967296))}function de(t){return t?/^-?\d+$/.test(t)?(dt(t),new Ie(ot,at)):null:pe||=new Ie(0,0)}var pe,ye,me,ge,ve,be,we,Ae,Ie=class{constructor(t,e){this.i=t>>>0,this.h=e>>>0}};function Ee(t,e,r){return"undefined"!=typeof BigInt64Array?(we||(we=new BigInt64Array(1),Ae=new Uint32Array(we.buffer),we[0]=BigInt(1),be=1===Ae[0]),we[0]=t,new e(Ae[t=be?0:1],Ae[1-t])):(ve||(ye=BigInt(Number.MIN_SAFE_INTEGER),me=BigInt(Number.MAX_SAFE_INTEGER),ge=BigInt(4294967295),ve=BigInt(32)),t>=ye&&t<=me?r(Number(t)):(t=BigInt.asUintN(64,t),new e(Number(t&ge),Number(t>>ve))))}function Se(t,e,r){for(;r>0||e>127;)t.h.push(127&e|128),e=(e>>>7|r<<25)>>>0,r>>>=7;t.h.push(e)}function xe(t,e){for(;e>127;)t.h.push(127&e|128),e>>>=7;t.h.push(e)}function Ne(t,e){if(e>=0)xe(t,e);else{for(let r=0;r<9;r++)t.h.push(127&e|128),e>>=7;t.h.push(1)}}function Be(t,e){dt(e),function(t){var e=at>>31;t(ot<<1^e,(at<<1|ot>>>31)^e)}((e,r)=>{Se(t,e>>>0,r>>>0)})}function _e(t,e){t.h.push(e>>>0&255),t.h.push(e>>>8&255),t.h.push(e>>>16&255),t.h.push(e>>>24&255)}var Ce=class{constructor(){this.h=[]}length(){return this.h.length}end(){var t=this.h;return this.h=[],t}};function Te(t,e){0!==e.length&&(t.j.push(e),t.i+=e.length)}function je(t,e,r){xe(t.h,8*e+r)}function Oe(t,e){return je(t,e,2),e=t.h.end(),Te(t,e),e.push(t.i),e}function Fe(t,e){var r=e.pop();for(r=t.i+t.h.length()-r;r>127;)e.push(127&r|128),r>>>=7,t.i++;e.push(r),t.i++}function Ue(t,e,r){if(null!=r)switch(je(t,e,0),typeof r){case"number":t=t.h,ut(r),Se(t,ot,at);break;case"bigint":r=Ee(r,Ie,he),Se(t.h,r.i,r.h);break;default:r=de(r),Se(t.h,r.i,r.h)}}function ke(t,e,r){je(t,e,2),xe(t.h,r.length),Te(t,t.h.end()),Te(t,r)}var Me=class{constructor(){this.j=[],this.i=0,this.h=new Ce}};function Re(t){if("string"==typeof t)de(t)}function Pe(){var t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var De=Pe(),Le=Pe(),ze=Pe(),Ge=Pe(),$e=Pe(),He=Pe(),We=Pe(),Je=Pe(),Ve=Pe(),qe=Pe(),Ke=Pe(),Xe=Pe(),Ze=class{constructor(t,e){this.l=Rt(t,e,void 0,2048)}toJSON(){return Mt(this)}};Ze.prototype[M]=$,Ze.prototype.toString=function(){return this.l.toString()};var Ye=class{constructor(t,e){this.M=t,t=De,this.h=!!t&&e===t||!1}};function Qe(t,e,r,n,i){null!=(e=sr(e,n))&&(r=Oe(t,r),i(e,t),Fe(t,r))}var tr,er,rr=new Ye(Qe,De),nr=new Ye(Qe,De),ir=Symbol(),or=Symbol();function ar(t){var e=ur,r=lr,n=t[ir];if(n)return n;(n={}).ka=t,n.P=function(t){switch(typeof t){case"boolean":return It||=[0,void 0,!0];case"number":return t>0?void 0:0===t?Et||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(t[0]);var i=t[1],o=1;i&&i.constructor===Object&&(n.X=i,"function"==typeof(i=t[++o])&&(n.da=!0,tr??=i,er??=t[o+1],i=t[o+=2]));for(var a={};i&&Array.isArray(i)&&i.length&&"number"==typeof i[0]&&i[0]>0;){for(var s=0;s<i.length;s++)a[i[s]]=i;i=t[++o]}for(s=1;void 0!==i;){let f;"number"==typeof i&&(s+=i,i=t[++o]);var u=void 0;if(i instanceof Ye?f=i:(f=rr,o--),f?.h){i=t[++o],u=t;var l=o;"function"==typeof i&&(i=i(),u[l]=i),u=i}for(l=s+1,"number"==typeof(i=t[++o])&&i<0&&(l-=i,i=t[++o]);s<l;s++){let t=a[s];u?r(n,s,f,u,t):e(n,s,f,t)}}return t[ir]=n}function sr(t,e){return t instanceof Ze?t.l:Array.isArray(t)?Rt(t,e[0],e[1]):void 0}function ur(t,e,r){t[e]=r.M}function lr(t,e,r,n){var i,o,a=r.M;t[e]=(t,e,r)=>a(t,e,r,o||=ar(n).P,i||=fr(n))}function fr(t){var e=t[or];if(!e){let r=ar(t);e=(t,e)=>cr(t,e,r),t[or]=e}return e}function cr(t,e,r){!function(t,e,r){var n,i=128&e?0:-1,o=t.length;(n=!!o)&&(n=null!=(n=t[o-1])&&"object"==typeof n&&n.constructor===Object);var a=o+(n?-1:0);for(e=128&e?1:0;e<a;e++)r(e-i,t[e]);if(n){t=t[o-1];for(let e in t)!isNaN(e)&&r(+e,t[e])}}(t,0|t[D],(t,n)=>{if(null!=n){var i=function(t,e){var r=t[e];if(r)return r;if((r=t.X)&&(r=r[e])){var n=(r=Array.isArray(r)?r[0]instanceof Ye?r:[nr,r]:[r,void 0])[0].M;if(r=r[1]){let e=fr(r),i=ar(r).P;r=t.da?er(i,e):(t,r,o)=>n(t,r,o,i,e)}else r=n;return t[e]=r}}(r,t);i?i(e,n,t):t<500||B(U,3)}})}function hr(t,e,r){if(Array.isArray(e)){var n=0|e[D];if(4&n)return e;for(var i=0,o=0;i<e.length;i++){let r=t(e[i]);null!=r&&(e[o++]=r)}return o<i&&(e.length=o),t=1|n,r&&(t=-1537&t|4),t!==n&&G(e,t),r&&2&t&&Object.freeze(e),e}}var dr=(t,e)=>{var r=new Me;cr(t.l,r,ar(e)),Te(r,r.h.end()),t=new Uint8Array(r.i);var n=(e=r.j).length,i=0;for(let r=0;r<n;r++){let n=e[r];t.set(n,i),i+=n.length}return r.j=[t],t};function pr(t,e){return new Ye(t,e)}function yr(t,e){return new Ye(t,e)}function mr(t,e,r){null!=(e=Ct(e))&&(Re(e),Ue(t,r,e))}function gr(t,e,r){null!=(e=Nt(e))&&null!=e&&(je(t,r,0),Ne(t.h,e))}function vr(t,e,r){null!=(e=Ot(e))&&ke(t,r,i(e))}function br(t,e,r,n,i){null!=(e=sr(e,n))&&(r=Oe(t,r),i(e,t),Fe(t,r))}function wr(t,e,r){null!=(e=jt(e))&&ke(t,r,se(e).buffer)}function Ar(t,e,r){null!=(e=Nt(e))&&(e=parseInt(e,10),je(t,r,0),Ne(t.h,e))}var Ir,Er=pr(function(t,e,r){null!=(e=wt(e))&&(je(t,r,1),t=t.h,(r=it||=new DataView(new ArrayBuffer(8))).setFloat64(0,+e,!0),ot=r.getUint32(0,!0),at=r.getUint32(4,!0),_e(t,ot),_e(t,at))},qe),Sr=pr(function(t,e,r){null!=(e=wt(e))&&(je(t,r,5),t=t.h,(r=it||=new DataView(new ArrayBuffer(8))).setFloat32(0,+e,!0),at=0,_e(t,ot=r.getUint32(0,!0)))},Ve),xr=pr(mr,He),Nr=pr(mr,He),Br=yr(function(t,e,r){if(null!=(e=hr(Ct,e,!1)))for(let n=0;n<e.length;n++)Ue(t,r,e[n])},He),_r=pr(function(t,e,r){if(null!=(e=Tt(e))){if("string"==typeof e)le(e);if(null!=e)switch(je(t,r,0),typeof e){case"number":t=t.h,ut(e),Se(t,ot,at);break;case"bigint":r=Ee(e,ce,ue),Se(t.h,r.i,r.h);break;default:r=le(e),Se(t.h,r.i,r.h)}}},We),Cr=pr(gr,Ge),Tr=yr(function(t,e,r){if(null!=(e=hr(Nt,e,!0)))for(let a=0;a<e.length;a++){var n=t,i=r,o=e[a];null!=o&&(je(n,i,0),Ne(n.h,o))}},Ge),jr=yr(function(t,e,r){if(null!=(e=hr(Nt,e,!0))&&e.length){r=Oe(t,r);for(let r=0;r<e.length;r++)Ne(t.h,e[r]);Fe(t,r)}},Ge),Or=pr(function(t,e,r){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(je(t,r,0),t.h.h.push(e?1:0))},Le),Fr=pr(vr,ze),Ur=yr(function(t,e,r){if(null!=(e=hr(Ot,e,!0)))for(let s=0;s<e.length;s++){var n=t,o=r,a=e[s];null!=a&&ke(n,o,i(a))}},ze),kr=function(t,e,r=De){return new Ye(e,r)}(0,function(t,e,r,n,i){if(Array.isArray(e)){for(let o=0;o<e.length;o++)br(t,e[o],r,n,i);1&(t=0|e[D])||G(e,1|t)}}),Mr=new Ye(br,De),Rr=pr(wr,Ke),Pr=yr(function(t,e,r){if(null!=(e=hr(jt,e,!1)))for(let a=0;a<e.length;a++){var n=t,i=r,o=e[a];null!=o&&ke(n,i,se(o).buffer)}},Ke),Dr=pr(function(t,e,r){e=function(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return vt(t)?t>>>0:void 0}(e),null!=e&&null!=e&&(je(t,r,0),xe(t.h,e))},$e),Lr=pr(Ar,Xe),zr=pr(Ar,Xe),Gr=pr(function(t,e,r){if(null!=(e=Ct(e))&&(Re(e),null!=e))switch(je(t,r,0),typeof e){case"number":t=t.h,e=(r=e)<0,st(r=2*Math.abs(r)),r=ot;let n=at;e&&(0==r?0==n?n=r=4294967295:(n--,r=4294967295):r--),Se(t,ot=r,at=n);break;case"bigint":t=t.h,e=e<<BigInt(1)^e>>BigInt(63),ot=Number(BigInt.asUintN(32,e)),at=Number(BigInt.asUintN(32,e>>BigInt(32))),Se(t,ot,at);break;default:Be(t.h,e)}},Je),$r=[0,Rr,Pr,Or,Fr],Hr=[0,pr(vr,ze),[0,zr,[0,pr(mr,He),pr(gr,Ge)],zr,-1,[0,Lr],zr,-1],pr(wr,Ke)],Wr=[0,1,[0,12,Cr,10,Or],[0,7,[0,Cr,-1]]],Jr=globalThis.trustedTypes;var Vr=class{constructor(t){this.h=t}toString(){return this.h+""}};function qr(t){var e;return void 0===Ir&&(Ir=function(){var t=null;if(!Jr)return t;try{let e=t=>t;t=Jr.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}()),t=(e=Ir)?e.createScriptURL(t):t,new Vr(t)}function Kr(t,...e){if(0===e.length)return qr(t[0]);var r=t[0];for(let n=0;n<e.length;n++)r+=encodeURIComponent(e[n])+t[n+1];return qr(r)}function Xr(t,e){if(t.floatEmbedding&&e.floatEmbedding)return Yr(t.floatEmbedding,e.floatEmbedding);if(t.quantizedEmbedding&&e.quantizedEmbedding)return Yr(Zr(t.quantizedEmbedding),Zr(e.quantizedEmbedding));throw Error("Cannot compute cosine similarity between quantized and float embeddings.")}function Zr(t){return Array.from(t,t=>t>127?t-256:t)}function Yr(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);var r=0,n=0,i=0;for(let o=0;o<t.length;o++)r+=t[o]*e[o],n+=t[o]*t[o],i+=e[o]*e[o];if(n<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*i)}function Qr(t){!t.h&&t.i.length>0&&(t.h=!0,t.i.shift()())}async function tn(t,e){return new Promise((r,n)=>{t.i.push(()=>{e().then(r,n).finally(()=>{t.h=!1,Qr(t)})}),Qr(t)})}var en,rn=class{constructor(){this.h=!1,this.i=[]}},nn=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function on(t){if(t)return!0;if(void 0===en)try{await WebAssembly.instantiate(nn),en=!0}catch{en=!1}return en}async function an(t,e,r){return{wasmLoaderPath:`${e}/${t}_${r=`wasm${r?"_module":""}${await on(r)?"":"_nosimd"}_internal`}.js`,wasmBinaryPath:`${e}/${t}_${r}.wasm`}}var sn=class{};function un(t){return oe(new ln,1,t)}sn.forVisionTasks=function(t,e=!1){return an("vision",t??Kr``,e)},sn.forLiteRtLmTextTasks=function(t,e=!1){return an("litertlm_text",t??Kr``,e)},sn.forTextTasks=function(t,e=!1){return an("text",t??Kr``,e)},sn.forRetrievalTasks=function(t,e=!1){return an("retrieval",t??Kr``,e)},sn.forGenAiTasks=function(t,e=!1){return an("genai",t??Kr``,e)},sn.forDecisionTasks=function(t,e=!1){return an("decision",t??Kr``,e)},sn.forAudioTasks=function(t,e=!1){return an("audio",t??Kr``,e)},sn.isSimdSupported=function(t=!1){return on(t)};var ln=class extends Ze{constructor(t){super(t)}},fn=class extends Ze{constructor(t){super(t)}},cn=[0,Lr,2,_r,-2,Nr,kr,[0,Lr,Nr]],hn=class extends Ze{constructor(t){super(t)}},dn=class extends Ze{constructor(t){super(t)}};function pn(t,e){return oe(t,1,e)}function yn(t,e){return oe(t,2,e)}var mn,gn=class extends Ze{constructor(t){super(t)}},vn=[3,4,5,6,7],bn=class extends Ze{constructor(t){super(t)}},wn=class extends Ze{constructor(t){super(t)}};wn.prototype.i=(mn=[0,[0,Lr,Fr,-3,Lr],[0,vn,Lr,-1,Mr,[0,Lr,Fr,_r],Mr,cn,Mr,[0,1,cn],Mr,[0,Lr],Mr,[0,Lr,Fr,_r]]],function(){return dr(this,mn)});var An=class{constructor(){this.h="undefined"!=typeof AbortController}async send(t,e,r){var n=this.h?new AbortController:void 0,i=n&&t.O>0?setTimeout(()=>{n.abort()},t.O):void 0;try{let i=await fetch(t.url,{method:t.ga,headers:{...t.fa},...t.body&&{body:t.body},...t.withCredentials&&{credentials:"include"},signal:t.O&&n?n.signal:null});200===i.status?e?.(await i.text()):r?.(i.status)}catch(t){if("AbortError"===t?.name)r?.(408);else r?.(400)}finally{clearTimeout(i)}}},In=class extends Ze{constructor(t){super(t,37)}},En=[-4,{},Wr,Lr,Hr],Sn=[0,Fr,Lr,1,Fr,-1,Lr,1,Lr,1,Nr],xn=[0,Lr,Fr,-2],Nn=[0,Fr,Lr],Bn=[0,Fr,Lr],_n=[0,Or,-3],Cn=[0,Lr,Fr,-1,Nr,Cr,-1,Fr,-5,kr,[0,Fr,-4],-1,Or,[0,Or,-3],Lr];var Tn=class extends Ze{constructor(t){super(t,19)}},jn=function(t){return e=>dr(e,t)}([-19,{},[0,Lr,1,[0,Fr,-6,Nr,Cr,Fr,-1,Nr],1,[0,Fr,1,Fr,-5],Fr,-1,[0,Lr,Fr,-8],[0,Fr,-3],[0,Fr,Lr,Fr,-2],[0,Fr,-1,Lr,Fr,-1,Lr,Fr,-1,[0,kr,[0,Fr,-1],Or,Fr,-5],[0,Lr,Or,Cr,-2]],Nr,[0,Fr,-3,Nr,Cr,Fr,-1],[0,Lr,Fr,-1],[0,Fr,-9],[0,Fr,-6,Lr,Fr,1,Fr,Or,Lr,-1,Or,Fr,-2,Lr,Fr,Lr,Fr,Cr,-1],1,[0,Lr],1,[0,Fr,-4],1,Sn,[0,[1,2,3,4,5,6],Mr,Sn,Mr,Nn,Mr,Bn,Mr,[0,Lr],Mr,Cn,Mr,xn],Nn,Bn,Cn,[0,[0,Lr,Fr,-1,Nr,Cr,-1,Fr,-4,kr,[0,Fr,-4],-1,1,_n],[0,Lr,Fr,-1,Nr,Cr,-1,Fr,-4,_n]],xn,[0,Fr,[0,Cr,-3,Lr],Lr,-2,[0,Cr,-1],Or],4,[0,Fr,Lr,Fr,-1,Nr,Lr,Fr,-1,Lr,Cr,-1]],Lr,kr,[-37,{},xr,Fr,kr,[0,Fr,-1],Rr,1,Rr,[0,Ur,-1,Tr,Br,-1],Fr,[0,Cr,Fr,-1],Or,Cr,Nr,Fr,-1,Gr,$r,xr,Rr,Lr,Tr,Nr,-1,[0,Lr,-1],Fr,Or,Fr,jr,Fr,-1,Er,1,Er,En,Or,[0,Lr,[0,Sr,Cr,-2],[0,Sr]],[0,Lr,Nr]],xr,Pr,Fr,-1,xr,Lr,-1,[0,Or,-1,Lr,Or],[0,Nr,-1,Fr],[0,xr,Or,Nr],Nr,1,Dr,1,En]),On=class{constructor(t){this.i=[],this.m=new An,this.j=t??"",this.h=setInterval(()=>{this.flush()},6e4)}close(){void 0!==this.h&&(clearInterval(this.h),this.h=void 0),this.flush()}flush(t,e){if(this.error)e?.("net-send-failed");else if(0===this.i.length)t?.();else{var r=this.i;this.i=[],r=function(t){var e=new Tn;{zt(e=oe(e,2,1786));let l=e.l,f=0|l[D];if(null==t)Wt(l,f,3);else{var r=t===j?7:0|t[D],n=r,i=qt(r),o=i||Object.isFrozen(t),a=!0,s=!0;for(let e=0;e<t.length;e++){var u=t[e];i||(u=H(u),a&&=!u,s&&=u)}i||(r=a?13:5,r=s?-4097&r:4096|r),o&&r===n||(t=Array.prototype.slice.call(t),n=0,r=te(r,f)),r!==n&&G(t,r),f=Wt(l,f,3,t),2&r||!(4096&r||16&r)||Gt(l,f)}}return e}(r),r=jn(r),this.m.send({url:"https://odml.pa.googleapis.com/v1/log",ga:"POST",O:1e4,body:r,la:2,fa:{"Content-Type":"application/x-protobuf","x-goog-api-key":this.j},withCredentials:!1},()=>{t?.()},t=>{this.error=Error(`Logging failed with HTTP error: ${t}`),this.i=[],void 0!==this.h&&(clearInterval(this.h),this.h=void 0),e?.("net-send-failed",t)})}}};class Fn{constructor(){this.I=this.B=this.G=this.A=this.D=this.F=this.C=0}}function Un(t,e){var r=new wn;if(r=Yt(r,1,t.S),r=Yt(r,2,e),e=new In,null!=(r=r.i()))if("string"==typeof r)r=r?new I(r,A):w||=new I(null,A);else if(r.constructor!==I){if(!(p&&null!=r&&r instanceof Uint8Array))throw Error();r=r.length?new I(new Uint8Array(r),A):w||=new I(null,A)}e=Ht(e,6,r),(t=t.H).error||t.i.push(e)}function kn(t){var e=new dn;e=ne(e=oe(e,1,10),3,performance.now()-t.R),Un(t,e=Qt(yn(pn(new gn,t.v),0),3,e)),t.m=performance.now()}function Mn(t,e){++t.h.F,t.i.set(e,performance.now())}function Rn(t,e){var r={C:e.C-t.j.C,F:e.F-t.j.F,D:e.D-t.j.D,A:e.A-t.j.A,G:e.G-t.j.G,B:e.B,I:e.I},n=yn(pn(new gn,t.v),1);Un(t,n=Qt(n,4,r=Dn(r))),t.j=e}function Pn(t,e){var r=t.i.get(e);if(void 0!==r&&(t.i.delete(e),e=performance.now()-r,++t.h.D,t.h.G+=e,t.h.B=Math.max(t.h.B,e),t.u=Math.max(t.u,e),performance.now()>t.m+3e4)){for(let[n,i]of t.i.entries())e=n,i<r&&(t.h.A++,t.i.delete(e));r={...t.h,I:performance.now()-t.m},t.h.B=0,t.m=performance.now(),Rn(t,r)}}function Dn(t){var e=new fn;if(e=ne(e=re(e=oe(e,1,10),7,t.A),5,t.B),e=ne(e,6,t.I),t.D>0&&ne(e,4,t.G/t.D),0!==t.C){var r=un(3);ee(e,r=re(r,2,t.C))}return 0!==t.F&&ee(e,t=re(r=un(4),2,t.F)),e}function Ln(t){var e={...t.h,A:t.h.A+t.i.size,B:t.u,I:performance.now()-t.R};Rn(t,e);var r=new hn;r=Yt(r,2,e=Dn(e)),Un(t,r=Qt(e=yn(pn(new gn,t.v),2),5,r))}var zn=class{constructor(t,e){this.R=performance.now(),this.m=performance.now(),this.i=new Map,this.u=0,this.h=new Fn,this.j=new Fn,this.H=new On(e),this.v=function(t){switch(t){case"AudioClassifier":return 4;case"AudioEmbedder":return 5;case"TextClassifier":return 6;case"TextEmbedder":return 7;case"GestureRecognizer":return 8;case"HandDetector":return 9;case"HandLandmarker":return 10;case"ImageClassifier":return 11;case"ImageEmbedder":return 12;case"ImageSegmenter":return 13;case"ObjectDetector":return 14;case"FaceDetector":return 15;case"FaceLandmarker":return 16;case"InteractiveSegmenter":case"InteractiveSegmenterLegacy":return 18;case"HolisticLandmarker":return 20;case"LlmInference":return 21;case"LanguageDetector":return 22;case"PoseLandmarker":return 23;case"UniversalEmbedder":return 28;case"SemanticRetriever":return 29;case"DecisionMaker":return 30;case"TextSummarizer":return 26;case"TextProofreader":return 27;case"AudioTranscriber":return 31;case"TextToSpeech":return 32;default:return 0}}(t),t=new bn,"undefined"==typeof navigator?e=0:(e=navigator.userAgent,e=/Android/i.test(e)?1:/iPhone|iPad|iPod/i.test(e)?2:/Windows/i.test(e)?5:/Macintosh/i.test(e)?4:/Linux/i.test(e)?3:0),t=ie(t=oe(t,1,e),2,""),t=ie(t,3,""),t=ie(t,4,"1.2.0"),t=ie(t,5,""),this.S=oe(t,6,function(){var t=globalThis.__HOST_ENVIRONMENT__;if("string"==typeof t)switch(t){case"ANDROID":return 1;case"IOS":return 2;case"PYTHON":return 3;case"WEB":break;case"FLUTTER":return 5;case"FLUTTER_WEB":return 6;default:return 0}return 4}())}close(){var t=this.H;"function"==typeof t.close?t.close():t.flush()}};function Gn(t){var e=atob("QUl6YVN5QS1XbGdRNjczMWpZSThjWGhKNEFxZjhuX3J1UmNLMzJZ");return new zn(t,e)}async function $n(t){if("function"!=typeof importScripts){let e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise((t,r)=>{e.addEventListener("load",()=>{t()},!1),e.addEventListener("error",t=>{r(t)},!1),document.body.appendChild(e)})}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;{let e=self.import;e?await e(t.toString()):await import(t.toString())}}}var Hn=async(t,e,r,n)=>{if(e&&await $n(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(r&&(await $n(r),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&n&&((e=self.Module).locateFile=n.locateFile,n.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=n.mainScriptUrlOrBlob)),n=await self.ModuleFactory(self.Module||n),self.ModuleFactory=self.Module=void 0,new t(n,null)},Wn={CHARACTER:0,WORD:1};function Jn(t,e){if(t<=0)throw Error("Chunk size must be positive.");if(e<0||e>=t)throw Error("Chunk overlap must be non-negative and less than chunk size.")}function Vn(t,e,r,n="CHARACTER"){Jn(e,r),t.j=e,t.i=r,t.mode=n}var qn=class{constructor(t){this.j=512,this.i=100,this.mode="CHARACTER",this.h=t}chunk(t){if(!t||0===t.trim().length)return[];if(!this.h||"function"!=typeof this.h.defaultTextChunker_nativeChunkText)throw Error("DefaultTextChunker Wasm module is not initialized.");return(t=this.h.defaultTextChunker_nativeChunkText(t,this.j,this.i,Wn[this.mode]??0))?Array.from(t):[]}};function Kn(t){return{...t,content:t.content?t.content.map(t=>"imageBytes"in t?{...t,imageBytes:new Uint8Array(t.imageBytes)}:"audioData"in t?{...t,audioData:new Float32Array(t.audioData)}:{...t}):[],embeddings:t.embeddings?new Float32Array(t.embeddings):new Float32Array(0),metadata:t.metadata?{...t.metadata}:{},...t.childIds?{childIds:[...t.childIds]}:{}}}qn.prototype.chunk=qn.prototype.chunk,qn.createFromModule=function(t,e=512,r=100,n="CHARACTER"){return Jn(e,r),Vn(t=new qn(t),e,r,n),t},qn.create=async function(t,e=512,r=100,n="CHARACTER"){Jn(e,r);var i=await Hn(qn,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:e=>e.endsWith(".wasm")?t.wasmBinaryPath.toString():e});return Vn(i,e,r,n),i};var Xn=class{constructor(){this.h=new Map}upsert(t){for(let e of t)this.h.set(e.id,Kn(e))}delete(t){var e=new Set(t);for(let r of t)if(t=this.h.get(r),t?.childIds)for(let r of t.childIds)e.add(r);for(let t of e)this.h.delete(t)}deleteByMetadata(t){var e=Object.keys(t);if(0!==e.length){var r=[];for(let n of this.h.values())n.parentId||n.metadata&&e.every(e=>n.metadata[e]===t[e])&&r.push(n.id);r.length>0&&this.delete(r)}}search(t,e,r){if(e<=0)throw Error(`'topK' must be greater than 0, got ${e}.`);var n=r?Object.keys(r):[];t=Array.from(t);var i=[];for(let e of this.h.values()){if(r&&n.length>0){if(!e.metadata)continue;if(!n.every(t=>e.metadata?.[t]===r[t]))continue}if(e.embeddings&&0!==e.embeddings.length)try{let r=Xr({floatEmbedding:t,headIndex:0,headName:""},{floatEmbedding:Array.from(e.embeddings),headIndex:0,headName:""});i.push({ea:e,score:r})}catch{}}return i.sort((t,e)=>e.score-t.score),i.slice(0,e).map(t=>Kn(t.ea))}get(t){var e=[];for(let r of t)(t=this.h.get(r))&&e.push(Kn(t));return e}getAllRecordIds(){var t=[];for(let[e,r]of this.h.entries()){let n=e;r.parentId||t.push(n)}return t}deleteAll(){this.h.clear()}close(){this.h.clear()}};Xn.prototype.close=Xn.prototype.close,Xn.prototype.deleteAll=Xn.prototype.deleteAll,Xn.prototype.getAllRecordIds=Xn.prototype.getAllRecordIds,Xn.prototype.get=Xn.prototype.get,Xn.prototype.search=Xn.prototype.search,Xn.prototype.deleteByMetadata=Xn.prototype.deleteByMetadata,Xn.prototype.delete=Xn.prototype.delete,Xn.prototype.upsert=Xn.prototype.upsert;var Zn=class{constructor(){this.h=[]}T(t){return this.h.push(t),this}N(){return[...this.h]}ja(t){return this.j=t,this}o(){return this.j}ia(t){return this.i=t,this}L(){return this.i}};function Yn(t){if(t.i)throw Error("SemanticRetriever has already been closed.")}Zn.prototype.textChunker=Zn.prototype.L,Zn.prototype.setTextChunker=Zn.prototype.ia,Zn.prototype.vectorStore=Zn.prototype.o,Zn.prototype.setVectorStore=Zn.prototype.ja,Zn.prototype.providers=Zn.prototype.N,Zn.prototype.addProvider=Zn.prototype.T;var Qn=class{constructor(t,e,r){this.m=t,this.o=e,this.L=r,this.i=!1,this.j=0,this.h=Gn("SemanticRetriever"),kn(this.h)}async embedContent(t){for(let e of this.m.N()){let r=await e.embedContent(t);if(null!=r)return r instanceof Float32Array?r:new Float32Array(r)}throw Error("No embedding provider found that can embed this content.")}async aa(t,e,r){return Yn(this),this.K(t,[{text:e}],r)}async K(t,e,r){Yn(this),await this.o.delete([t]);var n=[],i=0;if(1===e.length&&"text"in e[0]&&"string"==typeof e[0].text){var o=await this.L.chunk(e[0].text);if(o.length>1){let r=[];for(let e of o)o=`${t}_chunk_${i++}`,r.push(o),n.push({id:o,J:[{text:e}],parentId:t});n.push({id:t,J:e,childIds:r})}else n.push({id:t,J:e})}else n.push({id:t,J:e});t=[];for(let e of n)n=void 0!==e.childIds&&e.childIds.length>0?new Float32Array(0):await this.embedContent(e.J),t.push({id:e.id,content:[...e.J],embeddings:n,metadata:r||{},parentId:e.parentId,childIds:e.childIds});await this.o.upsert(t)}async ba(t,e,r){return Yn(this),this.K(t,[{imageBytes:e}],r)}async Z(t,e,r){return Yn(this),this.K(t,[{audioData:e}],r)}async ha(t,e={}){Yn(this);var{limit:r=5,metadataFilter:n}=e;if(r<=0)throw Error(`'limit' must be greater than 0, got ${r}.`);e=this.j++;var i=this.h;++i.h.C,i.i.set(e,performance.now()),t=await this.embedContent("string"==typeof t?[{text:t}]:t),i=await this.o.search(t,3*r,n);var o=new Set;for(var a of i)a.parentId&&o.add(a.parentId);if(a=new Map,o.size>0)for(var s of o=await this.o.get(Array.from(o)))a.set(s.id,s);for(var u of(s=[],o=new Set,i))u.parentId?o.has(u.parentId)||(o.add(u.parentId),(i=a.get(u.parentId))&&s.push({id:i.id,content:i.content,embeddings:u.embeddings,metadata:i.metadata,parentId:i.parentId,childIds:i.childIds})):o.has(u.id)||(o.add(u.id),s.push(u));u=[],t=Array.from(t);for(let e of s){if(s=0,e.embeddings&&e.embeddings.length>0)try{s=Xr({floatEmbedding:t,headIndex:0,headName:""},{floatEmbedding:Array.from(e.embeddings),headIndex:0,headName:""})}catch{s=0}if(u.push({id:e.id,content:e.content?[...e.content]:[],metadata:e.metadata?{...e.metadata}:{},score:s}),u.length>=r)break}return Pn(this.h,e),u}async delete(t){Yn(this),"string"==typeof t?await this.o.delete([t]):Array.isArray(t)?await this.o.delete(t):await this.o.deleteByMetadata(t)}async getAllRecordIds(){Yn(this);var t=await this.o.getAllRecordIds();return Array.from(new Set(t))}async deleteAll(){Yn(this),await this.o.deleteAll()}close(){if(!this.i){this.i=!0,Ln(this.h),this.h.close();try{this.o.close()}catch{}}}};async function ti(t,e){var r=e.baseOptions.device;r||=await ei();var n=await Hn(ii,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:e=>e.endsWith(".wasm")?t.wasmBinaryPath.toString():e});return r&&(n.h.preinitializedWebGPUDevice=r),await async function(t,e,r){t.i=Gn("UniversalEmbedder");var n=!1!==e.l2Normalize,i=e.baseOptions.modelAssetPath?e.baseOptions.modelAssetPath.toString():"";if((r=r||e.baseOptions.device||t.h.preinitializedWebGPUDevice)||(r=await ei()),t.h.preinitializedWebGPUDevice=r,e.baseOptions.modelAssetBuffer){i=e.baseOptions.modelAssetBuffer instanceof Uint8Array?e.baseOptions.modelAssetBuffer:await async function(t){for(var e=[],r=0;;){let{done:n,value:i}=await t.read();if(n)break;e.push(i),r+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(r),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}(e.baseOptions.modelAssetBuffer);var o=`/${r=`universal_embedder_model_${++oi}.litertlm`}`;try{t.h.FS_unlink?.(o)}catch{}t.h.FS_createDataFile("/",r,i,!0,!1,!1),t.v=o,i=t.v}if(!i)throw Error("No model asset path or buffer provided.");r=e.maxInputLength??0,o=e.visionTokensPerImage??0,e=function(t){if(void 0===t)return 0;switch(t){case"FLOAT32":return 1;case"FLOAT16":return 2;case"INT16":return 3;case"INT8":return 4;default:throw Error(`Unsupported activation data type: ${t}`)}}(e.activationDataType);try{t.j=await t.h.createUniversalEmbedder(i,n,r,o,e),kn(t.i)}catch(e){throw ri(t),e}}(n,e,r),n}async function ei(){if("undefined"==typeof navigator||!navigator.gpu)throw Error("WebGPU is not supported on this platform.");var t=await navigator.gpu.requestAdapter({powerPreference:"high-performance"});if(!t)throw Error("No appropriate WebGPU adapter found.");var e=[];if(t.features.has("subgroups")&&e.push("subgroups"),t.features.has("shader-f16")&&e.push("shader-f16"),!(e=await t.requestDevice({requiredFeatures:e})).adapterInfo&&t.info)try{Object.defineProperty(e,"adapterInfo",{value:t.info,writable:!0,configurable:!0})}catch{}return e}function ri(t){if(t.v){try{t.h.FS_unlink?.(t.v)}catch{}t.v=void 0}}function ni(t){if(t.H||0===t.j)throw Error("UniversalEmbedder has already been closed.")}Qn.prototype.close=Qn.prototype.close,Qn.prototype.deleteAll=Qn.prototype.deleteAll,Qn.prototype.getAllRecordIds=Qn.prototype.getAllRecordIds,Qn.prototype.delete=Qn.prototype.delete,Qn.prototype.retrieve=Qn.prototype.ha,Qn.prototype.insertAudio=Qn.prototype.Z,Qn.prototype.insertImage=Qn.prototype.ba,Qn.prototype.insertContent=Qn.prototype.K,Qn.prototype.insertDocument=Qn.prototype.aa,Qn.createFromComponents=async function(t){if(!t||0===t.N().length)throw Error("At least one EmbeddingProvider must be registered in SemanticRetrieverComponents.");var e=t.o();if(!e)throw Error("VectorStore must be provided in SemanticRetrieverComponents.");var r=t.L();if(!r)throw Error("TextChunker must be provided in SemanticRetrieverComponents.");return new Qn(t,e,r)};var ii=class{constructor(t){this.H=!1,this.j=0,this.u=new rn,this.m=0,this.h=t}async W(t){return tn(this.u,async()=>{ni(this);var e=this.m++;Mn(this.i,e);var r=await this.h.universalEmbedder_embedText(this.j,t);return Pn(this.i,e),{embeddings:[{floatEmbedding:r?Array.from(r):[],headIndex:0,headName:"default"}]}})}async V(t){return tn(this.u,async()=>{ni(this);var e=this.m++;Mn(this.i,e);var r=await this.h.universalEmbedder_embedImage(this.j,t);return Pn(this.i,e),{embeddings:[{floatEmbedding:r?Array.from(r):[],headIndex:0,headName:"default"}]}})}async U(t){return tn(this.u,async()=>{ni(this);var e=this.m++;Mn(this.i,e);var r=await this.h.universalEmbedder_embedAudio(this.j,t);return Pn(this.i,e),{embeddings:[{floatEmbedding:r?Array.from(r):[],headIndex:0,headName:"default"}]}})}async embedContent(t){if(ni(this),!Array.isArray(t))throw Error("Content must be an array of ContentParts.");return tn(this.u,async()=>{ni(this);var e=this.h.universalEmbedder_createContentBuilder();try{for(let r of t)if("text"in r&&"string"==typeof r.text)this.h.universalEmbedder_builderAddText(e,r.text);else if("imageBytes"in r&&(r.imageBytes instanceof Uint8Array||"string"==typeof r.imageBytes))this.h.universalEmbedder_builderAddImage(e,r.imageBytes);else{if(!("audioData"in r)||!(r.audioData instanceof Float32Array||Array.isArray(r.audioData)))throw Error(`Unsupported or invalid ContentPart: ${JSON.stringify(r)}`);this.h.universalEmbedder_builderAddAudio(e,r.audioData)}let r=this.m++;Mn(this.i,r);let n=await this.h.universalEmbedder_executeEmbedContent(this.j,e);return Pn(this.i,r),{embeddings:[{floatEmbedding:n?Array.from(n):[],headIndex:0,headName:"default"}]}}finally{this.h.universalEmbedder_freeContentBuilder(e)}})}Y(){return{embedContent:async t=>(await this.embedContent(t))?.embeddings?.[0]?.floatEmbedding??null}}close(){this.H||(this.H=!0,Ln(this.i),this.i.close(),0!==this.j&&(this.h.universalEmbedder_close(this.j),this.j=0),ri(this))}};ii.prototype.close=ii.prototype.close,ii.prototype.getProvider=ii.prototype.Y,ii.cosineSimilarity=function(t,e){return Xr(t,e)},ii.prototype.embedContent=ii.prototype.embedContent,ii.prototype.embedAudio=ii.prototype.U,ii.prototype.embedImage=ii.prototype.V,ii.prototype.embedText=ii.prototype.W,ii.createFromModelPath=function(t,e){return ti(t,{baseOptions:{modelAssetPath:e.toString()}})},ii.createFromModelBuffer=function(t,e){return ti(t,{baseOptions:{modelAssetBuffer:e}})},ii.createWebGpuDevice=ei,ii.createFromOptions=ti;var oi=0;exports.DefaultTextChunker=qn,exports.FilesetResolver=sn,exports.MemoryVectorStore=Xn,exports.SemanticRetriever=Qn,exports.SemanticRetrieverComponents=Zn,exports.UniversalEmbedder=ii;
|
|
1
|
+
"use strict";var t="undefined"!=typeof self?self:{};function e(e,r){t:{for(var n=["CLOSURE_FLAGS"],i=t,o=0;o<n.length;o++)if(null==(i=i[n[o]])){n=null;break t}n=i}return null!=(e=n&&n[e])?e:r}var r,n="undefined"!=typeof TextEncoder;function i(t){if(n)t=(r||=new TextEncoder).encode(t);else{let r=0,n=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var e=t.charCodeAt(i);if(e<128)n[r++]=e;else{if(e<2048)n[r++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&i<t.length){let o=t.charCodeAt(++i);if(o>=56320&&o<=57343){e=1024*(e-55296)+o-56320+65536,n[r++]=e>>18|240,n[r++]=e>>12&63|128,n[r++]=e>>6&63|128,n[r++]=63&e|128;continue}i--}e=65533}n[r++]=e>>12|224,n[r++]=e>>6&63|128}n[r++]=63&e|128}}t=r===n.length?n:n.subarray(0,r)}return t}var o=e(610401301,!1),a=e(748402147,!0);function s(){var e=t.navigator;return e&&(e=e.userAgent)?e:""}var u,l=t.navigator;u=l&&l.userAgentData||null;var f={},c=null;function h(t){var e=t.length,r=3*e/4;r%3?r=Math.floor(r):-1!="=.".indexOf(t[e-1])&&(r=-1!="=.".indexOf(t[e-2])?r-2:r-1);var n=new Uint8Array(r),i=0;return function(t,e){function r(e){for(;n<t.length;){let e=t.charAt(n++),r=c[e];if(null!=r)return r;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}d();for(var n=0;;){let t=r(-1),n=r(0),i=r(64),o=r(64);if(64===o&&-1===t)break;e(t<<2|n>>4),64!=i&&(e(n<<4&240|i>>2),64!=o&&e(i<<6&192|o))}}(t,function(t){n[i++]=t}),i!==r?n.subarray(0,i):n}function d(){if(!c){c={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=t.concat(e[r].split(""));f[r]=n;for(let t=0;t<n.length;t++){let e=n[t];void 0===c[e]&&(c[e]=t)}}}}var p="undefined"!=typeof Uint8Array,y=!(!(!!o&&(!!u&&u.brands.length>0))&&(-1!=s().indexOf("Trident")||-1!=s().indexOf("MSIE")))&&"function"==typeof btoa,m=/[-_.]/g,g={"-":"+",_:"/",".":"="};function v(t){return g[t]||""}function b(t){if(!y)return h(t);t=m.test(t)?t.replace(m,v):t,t=atob(t);var e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}var w,A={},I=class{constructor(t,e){if(E(e),this.h=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};function E(t){if(t!==A)throw Error("illegal external caller")}function S(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}var x=void 0;function N(t){return S(t=Error(t),"warning"),t}function B(e,r){if(null!=e){var n=x??={},i=n[e]||0;i>=r||(n[e]=i+1,S(e=Error(),"incident"),function(e){t.setTimeout(()=>{throw e},0)}(e))}}function _(){return"function"==typeof BigInt}var C="function"==typeof Symbol&&"symbol"==typeof Symbol();function T(t,e,r=!1){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?r&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e}var j,O=T("jas",void 0,!0),F=T(void 0,"1oa"),U=T(void 0,"0ubsb"),k=T(void 0,"0actk"),M=T("m_m","na",!0),R={ca:{value:0,configurable:!0,writable:!0,enumerable:!1}},P=Object.defineProperties,D=C?O:"ca",L=[];function z(t,e){C||D in t||P(t,R),t[D]|=e}function G(t,e){C||D in t||P(t,R),t[D]=e}function $(t,e){return 2&e&&(t|=2),1|t}G(L,7),j=Object.freeze(L);var H={};function W(t,e){return void 0===e?t.h!==J&&!!(2&t.l[D]):!!(2&e)&&t.h!==J}var J={};function V(t){return t.ma=!0,t}var q=V(t=>"number"==typeof t),K=V(t=>"string"==typeof t),X=V(t=>"boolean"==typeof t),Z="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0);function Y(t){var e=t;if(K(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(q(e)&&!Number.isSafeInteger(e))throw Error(String(e));return Z?BigInt(t):t=X(t)?t?"1":"0":K(t)?t.trim()||"0":String(t)}var Q=V(t=>Z?t>=et&&t<=nt:"-"===t[0]?it(t,tt):it(t,rt)),tt=Number.MIN_SAFE_INTEGER.toString(),et=Z?BigInt(Number.MIN_SAFE_INTEGER):void 0,rt=Number.MAX_SAFE_INTEGER.toString(),nt=Z?BigInt(Number.MAX_SAFE_INTEGER):void 0;function it(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let r=0;r<t.length;r++){let n=t[r],i=e[r];if(n>i)return!1;if(n<i)return!0}}var ot,at=0,st=0;function ut(t){var e=t>>>0;at=e,st=(t-e)/4294967296>>>0}function lt(t){if(t<0){ut(-t);let[e,r]=yt(at,st);at=e>>>0,st=r>>>0}else ut(t)}function ft(t,e){var r=4294967296*e+(t>>>0);return Number.isSafeInteger(r)?r:ct(t,e)}function ct(t,e){if(t>>>=0,(e>>>=0)<=2097151)var r=""+(4294967296*e+t);else _()?r=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(r=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),r+=8147497*e,e*=2,t>=1e7&&(r+=t/1e7>>>0,t%=1e7),r>=1e7&&(e+=r/1e7>>>0,r%=1e7),r=e+ht(r)+ht(t));return r}function ht(t){return t=String(t),"0000000".slice(t.length)+t}function dt(){var t=at,e=st;if(2147483648&e)if(_())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{let[r,n]=yt(t,e);t="-"+ct(r,n)}else t=ct(t,e);return t}function pt(t){if(t.length<16)lt(Number(t));else if(_())t=BigInt(t),at=Number(t&BigInt(4294967295))>>>0,st=Number(t>>BigInt(32)&BigInt(4294967295));else{let e=+("-"===t[0]);st=at=0;let r=t.length;for(let n=e,i=(r-e)%6+e;i<=r;n=i,i+=6){let e=Number(t.slice(n,i));st*=1e6,(at=1e6*at+e)>=4294967296&&(st+=Math.trunc(at/4294967296),st>>>=0,at>>>=0)}if(e){let[t,e]=yt(at,st);at=t,st=e}}}function yt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}var mt="function"==typeof BigInt?BigInt.asIntN:void 0,gt="function"==typeof BigInt?BigInt.asUintN:void 0,vt=Number.isSafeInteger,bt=Number.isFinite,wt=Math.trunc;function At(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}var It,Et,St,xt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Nt(t){switch(typeof t){case"bigint":return!0;case"number":return bt(t);case"string":return xt.test(t);default:return!1}}function Bt(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return bt(t)?0|t:void 0}function _t(t){var e=t.length;return("-"===t[0]?e<20||20===e&&t<="-9223372036854775808":e<19||19===e&&t<="9223372036854775807")?t:(pt(t),dt())}function Ct(t){if("-"===t[0])var e=!1;else e=(e=t.length)<20||20===e&&t<="18446744073709551615";return e?t:(pt(t),ct(at,st))}function Tt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(mt(64,t));if(Nt(t)){if("string"===e)return e=wt(Number(t)),vt(e)?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=_t(t)),t;if("number"===e)return function(t){if(t=wt(t),!vt(t)){lt(t);var e=at,r=st;(t=2147483648&r)&&(r=~r>>>0,0==(e=1+~e>>>0)&&(r=r+1>>>0)),t="number"==typeof(e=ft(e,r))?t?-e:e:t?"-"+e:e}return t}(t)}}function jt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(gt(64,t));if(Nt(t)){if("string"===e)return e=wt(Number(t)),vt(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=Ct(t)),t;if("number"===e)return function(t){return(t=wt(t))>=0&&vt(t)||(lt(t),t=ft(at,st)),t}(t)}}function Ot(t){if(null==t||"string"==typeof t||t instanceof I)return t}function Ft(t){return null==t||"string"==typeof t?t:void 0}function Ut(t){return t}function kt(t,e,r,n){var i=void 0!==n;n=!!n;var o=[],a=t.length,s=4294967295,u=!1,l=!!(64&e),f=l?128&e?0:-1:void 0;if(!(1&e)){var c=a&&t[a-1];null!=c&&"object"==typeof c&&c.constructor===Object?s=--a:c=void 0,!l||128&e||i||(u=!0,s=(It??Ut)(s-f,f,t,c,void 0)+f)}for(e=void 0,i=0;i<a;i++){let a=t[i];if(null!=a&&null!=(a=r(a,n)))if(l&&i>=s){let t=i-f;(e??={})[t]=a}else o[i]=a}if(c)for(let i in c){if(null==(t=c[i])||null==(t=r(t,n)))continue;let u;a=+i,l&&!Number.isNaN(a)&&(u=a+f)<s?o[u]=t:(e??={})[i]=t}return e&&(u?o.push(e):o[s]=e),o}function Mt(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return Q(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var e=0|t[D];return 0===t.length&&1&e?void 0:kt(t,e,Mt)}if(null!=t&&t[M]===H)return Rt(t);if(t instanceof I){if(null==(e=t.h))t="";else if("string"==typeof e)t=e;else{if(y){for(var r="",n=0,i=e.length-10240;n<i;)r+=String.fromCharCode.apply(null,e.subarray(n,n+=10240));r+=String.fromCharCode.apply(null,n?e.subarray(n):e),e=btoa(r)}else{void 0===r&&(r=0),d(),r=f[r],n=Array(Math.floor(e.length/3)),i=r[64]||"";let t=0,l=0;for(;t<e.length-2;t+=3){var o=e[t],a=e[t+1],s=e[t+2],u=r[o>>2];o=r[(3&o)<<4|a>>4],a=r[(15&a)<<2|s>>6],s=r[63&s],n[l++]=u+o+a+s}switch(u=0,s=i,e.length-t){case 2:s=r[(15&(u=e[t+1]))<<2]||i;case 1:e=e[t],n[l]=r[e>>2]+r[(3&e)<<4|u>>4]+s+i}e=n.join("")}t=t.h=e}return t}return}return t}function Rt(t){return kt(t=t.l,0|t[D],Mt)}function Pt(t,e,r,n=0){if(null==t){var i=32;r?(t=[r],i|=128):t=[],e&&(i=-16760833&i|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(i=0|t[D],a&&1&i)throw Error("rfarr");if(2048&i&&!(2&i)&&function(){if(a)throw Error("carr");B(k,5)}(),256&i)throw Error("farr");if(64&i)return(i|n)!==i&&G(t,i|n),t;if(r&&(i|=128,r!==t[0]))throw Error("mid");t:{i|=64;var o=(r=t).length;if(o){var s=o-1;let t=r[s];if(null!=t&&"object"==typeof t&&t.constructor===Object){if((s-=e=128&i?0:-1)>=1024)throw Error("pvtlmt");for(var u in t)(o=+u)<s&&(r[o+e]=t[u],delete t[u]);i=-16760833&i|(1023&s)<<14;break t}}if(e){if((u=Math.max(e,o-(128&i?0:-1)))>1024)throw Error("spvt");i=-16760833&i|(1023&u)<<14}}}return G(t,64|i|n),t}function Dt(t,e){if("object"!=typeof t)return t;if(Array.isArray(t)){var r=0|t[D];return 0===t.length&&1&r?t=void 0:2&r||(!e||4096&r||16&r?t=Lt(t,r,!1,e&&!(16&r)):(z(t,34),4&r&&Object.freeze(t))),t}if(null!=t&&t[M]===H){let n=0|(r=t.l)[D];return W(t,n)||(2&n?e=!0:32&n&&!(4096&n)?(G(r,2|n),t.h=J,e=!0):e=!1,e?(t=new t.constructor(r)).j=J:t=Lt(r,n)),t}return t instanceof I?t:void 0}function Lt(t,e,r,n){return n??=!!(34&e),t=kt(t,e,Dt,n),n=32,r&&(n|=2),G(t,e=16769217&e|n),t}function zt(t){if(t.h!==J)return!1;var e=t.l;return z(e=Lt(e,0|e[D]),2048),t.l=e,t.h=void 0,t.j=void 0,!0}function Gt(t){if(!zt(t)&&W(t,0|t.l[D]))throw Error()}function $t(t,e){void 0===e&&(e=0|t[D]),32&e&&!(4096&e)&&G(t,4096|e)}function Ht(t,e,r){if(-1===e)return null;var n=e+(r?0:-1),i=t.length-1;if(!(i<1+(r?0:-1))){if(n>=i)if(null!=(t=t[i])&&"object"==typeof t&&t.constructor===Object)e=t[e];else{if(n!==i)return;e=t}else e=t[n];return e}}function Wt(t,e,r){Gt(t);var n=t.l;return Jt(n,0|n[D],e,r),t}function Jt(t,e,r,n,i){var o=r+(i?0:-1),a=t.length-1;if(a>=1+(i?0:-1)&&o>=a){let i=t[a];if(null!=i&&"object"==typeof i&&i.constructor===Object)return i[r]=n,e}return o<=a?(t[o]=n,e):(void 0!==n&&(r>=(a=(e??=0|t[D])>>14&1023||536870912)?null!=n&&(t[a+(i?0:-1)]={[r]:n}):t[o]=n),e)}function Vt(t,e,r){return t=Ht(t,e,r),Array.isArray(t)?t:j}function qt(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function Kt(t){if(C)return t[F]??(t[F]=new Map);if(F in t)return t[F];var e=new Map;return Object.defineProperty(t,F,{value:e}),e}function Xt(t,e,r,n){var i=t.get(n);if(null!=i)return i;i=0;for(let t=0;t<n.length;t++){let o=n[t];null!=Ht(e,o)&&(0!==i&&(r=Jt(e,r,i)),i=o)}return t.set(n,i),i}function Zt(t){return null==t&&(t=void 0),t}function Yt(t,e,r){return Wt(t,e,r=Zt(r)),r&&!W(r)&&$t(t.l),t}function Qt(t,e,r){var n=vn;t:{var i=r=Zt(r);Gt(t);let s=t.l;var o=0|s[D];if(null==i){var a=Kt(s);if(Xt(a,s,o,n)!==e)break t;a.set(n,0)}else{let t=Kt(a=s),r=Xt(t,a,o,n);r!==e&&(r&&(o=Jt(a,o,r)),t.set(n,e))}Jt(s,o,e,i)}return r&&!W(r)&&$t(t.l),t}function te(t,e){return-273&(2&e?2|t:-3&t)}function ee(t,e){var r=ln;Gt(t);var n=t.l,i=n,o=0|n[D],a=(t?W(t,o):2&o)?1:2;2===a&&t&&zt(t)&&(o=0|(i=t.l)[D]);var s=Vt(i,8),u=s===j?7:0|s[D],l=$(u,o);if(t=!(4&l)){var f=o;let t=!!(2&l);t&&(f|=2);let e=!t,n=!0,i=0,a=0;for(;i<s.length;i++){var c=s[i],h=r,d=f;if(null==c||c[M]!==H)if(Array.isArray(c)){let t,e=0|c[D];t=e|32&d,t|=2&d,t!==e&&G(c,t),c=new h(c)}else c=void 0;c instanceof r&&(t||(h=W(c),e&&=!h,n&&=h),s[a++]=c)}a<i&&(s.length=a),l|=4,l=n?-4097&l:4096|l,l=e?8|l:-9&l}l!==u&&(G(s,l),2&l&&Object.freeze(s)),l=u=l,(f=qt(u))&&2===a&&(s=Array.prototype.slice.call(s),l=0,u=te(u,o),o=Jt(i,o,8,s),f=!1),f||(1===a||4===a&&(2&u||!(16&u)&&32&o)?((u|=!s.length||t&&!(4096&u)||32&o&&!(4096&u||16&u)?2:256)!==l&&G(s,u),Object.freeze(s)):u!==l&&G(s,u)),2&u||!(4096&u||16&u)||$t(i,o),a=s,e=null!=e?e:new r,a.push(e),t=r=a===j?7:0|a[D],(e=W(e))?(r&=-9,1===a.length&&(r&=-4097)):r|=4096,r!==t&&G(a,r),e||$t(n)}function re(t,e,r){return Wt(t,e,null==r?r:function(t){if(!Nt(t))throw N("int64");switch(typeof t){case"string":var e=wt(Number(t));return vt(e)?t=Y(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=_()?Y(mt(64,BigInt(t))):Y(_t(t))),t;case"bigint":return Y(mt(64,t));default:return vt(t)||(t=wt(t),vt(t)?t=String(t):(lt(t),t=dt())),Y(t)}}(r))}function ne(t,e,r){return Wt(t,e,null==r?r:function(t){if(!Nt(t))throw N("uint64");switch(typeof t){case"string":var e=wt(Number(t));return vt(e)&&e>=0?t=Y(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=_()?Y(gt(64,BigInt(t))):Y(Ct(t))),t;case"bigint":return Y(gt(64,t));default:return t>=0&&vt(t)||((t=wt(t))>=0&&vt(t)?t=String(t):(lt(t),t=ct(at,st))),Y(t)}}(r))}function ie(t,e,r){if(null!=r&&"string"!=typeof r)throw Error();return Wt(t,e,r)}function oe(t,e,r){if(null!=r){if(!bt(r))throw N("enum");r|=0}return Wt(t,e,r)}var ae=class{constructor(t,e,r){if(this.buffer=t,r&&!e)throw Error()}};function se(t){if("string"==typeof t)return new ae(b(t),!0);if(Array.isArray(t))return new ae(new Uint8Array(t),!0);if(t.constructor===Uint8Array)return new ae(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new ae(t,!1);if(t.constructor===I){E(A);var e=t.h;return e=(null==(e=null==e||p&&null!=e&&e instanceof Uint8Array?e:"string"==typeof e?b(e):null)?e:t.h=e)||new Uint8Array(0),new ae(e,!0,t)}if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new ae(t,!1);throw Error()}function ue(t){return new ce(4294967295&t,Math.floor(t/4294967296))}function le(t){return t?/^\d+$/.test(t)?(pt(t),new ce(at,st)):null:fe||=new ce(0,0)}var fe,ce=class{constructor(t,e){this.i=t>>>0,this.h=e>>>0}};function he(t){return new Ie(4294967295&t,Math.floor(t/4294967296))}function de(t){return t?/^-?\d+$/.test(t)?(pt(t),new Ie(at,st)):null:pe||=new Ie(0,0)}var pe,ye,me,ge,ve,be,we,Ae,Ie=class{constructor(t,e){this.i=t>>>0,this.h=e>>>0}};function Ee(t,e,r){return"undefined"!=typeof BigInt64Array?(we||(we=new BigInt64Array(1),Ae=new Uint32Array(we.buffer),we[0]=BigInt(1),be=1===Ae[0]),we[0]=t,new e(Ae[t=be?0:1],Ae[1-t])):(ve||(ye=BigInt(Number.MIN_SAFE_INTEGER),me=BigInt(Number.MAX_SAFE_INTEGER),ge=BigInt(4294967295),ve=BigInt(32)),t>=ye&&t<=me?r(Number(t)):(t=BigInt.asUintN(64,t),new e(Number(t&ge),Number(t>>ve))))}function Se(t,e,r){for(;r>0||e>127;)t.h.push(127&e|128),e=(e>>>7|r<<25)>>>0,r>>>=7;t.h.push(e)}function xe(t,e){for(;e>127;)t.h.push(127&e|128),e>>>=7;t.h.push(e)}function Ne(t,e){if(e>=0)xe(t,e);else{for(let r=0;r<9;r++)t.h.push(127&e|128),e>>=7;t.h.push(1)}}function Be(t,e){pt(e),function(t){var e=st>>31;t(at<<1^e,(st<<1|at>>>31)^e)}((e,r)=>{Se(t,e>>>0,r>>>0)})}function _e(t,e){t.h.push(e>>>0&255),t.h.push(e>>>8&255),t.h.push(e>>>16&255),t.h.push(e>>>24&255)}var Ce=class{constructor(){this.h=[]}length(){return this.h.length}end(){var t=this.h;return this.h=[],t}};function Te(t,e){0!==e.length&&(t.j.push(e),t.i+=e.length)}function je(t,e,r){xe(t.h,8*e+r)}function Oe(t,e){return je(t,e,2),e=t.h.end(),Te(t,e),e.push(t.i),e}function Fe(t,e){var r=e.pop();for(r=t.i+t.h.length()-r;r>127;)e.push(127&r|128),r>>>=7,t.i++;e.push(r),t.i++}function Ue(t,e,r){if(null!=r)switch(je(t,e,0),typeof r){case"number":t=t.h,lt(r),Se(t,at,st);break;case"bigint":r=Ee(r,Ie,he),Se(t.h,r.i,r.h);break;default:r=de(r),Se(t.h,r.i,r.h)}}function ke(t,e,r){je(t,e,2),xe(t.h,r.length),Te(t,t.h.end()),Te(t,r)}var Me=class{constructor(){this.j=[],this.i=0,this.h=new Ce}};function Re(t){if("string"==typeof t)de(t)}function Pe(){var t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var De=Pe(),Le=Pe(),ze=Pe(),Ge=Pe(),$e=Pe(),He=Pe(),We=Pe(),Je=Pe(),Ve=Pe(),qe=Pe(),Ke=Pe(),Xe=Pe(),Ze=class{constructor(t,e){this.l=Pt(t,e,void 0,2048)}toJSON(){return Rt(this)}};Ze.prototype[M]=H,Ze.prototype.toString=function(){return this.l.toString()};var Ye=class{constructor(t,e){this.M=t,t=De,this.h=!!t&&e===t||!1}};function Qe(t,e,r,n,i){null!=(e=sr(e,n))&&(r=Oe(t,r),i(e,t),Fe(t,r))}var tr,er,rr=new Ye(Qe,De),nr=new Ye(Qe,De),ir=Symbol(),or=Symbol();function ar(t){var e=ur,r=lr,n=t[ir];if(n)return n;(n={}).ka=t,n.P=function(t){switch(typeof t){case"boolean":return Et||=[0,void 0,!0];case"number":return t>0?void 0:0===t?St||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(t[0]);var i=t[1],o=1;i&&i.constructor===Object&&(n.X=i,"function"==typeof(i=t[++o])&&(n.da=!0,tr??=i,er??=t[o+1],i=t[o+=2]));for(var a={};i&&Array.isArray(i)&&i.length&&"number"==typeof i[0]&&i[0]>0;){for(var s=0;s<i.length;s++)a[i[s]]=i;i=t[++o]}for(s=1;void 0!==i;){let f;"number"==typeof i&&(s+=i,i=t[++o]);var u=void 0;if(i instanceof Ye?f=i:(f=rr,o--),f?.h){i=t[++o],u=t;var l=o;"function"==typeof i&&(i=i(),u[l]=i),u=i}for(l=s+1,"number"==typeof(i=t[++o])&&i<0&&(l-=i,i=t[++o]);s<l;s++){let t=a[s];u?r(n,s,f,u,t):e(n,s,f,t)}}return t[ir]=n}function sr(t,e){return t instanceof Ze?t.l:Array.isArray(t)?Pt(t,e[0],e[1]):void 0}function ur(t,e,r){t[e]=r.M}function lr(t,e,r,n){var i,o,a=r.M;t[e]=(t,e,r)=>a(t,e,r,o||=ar(n).P,i||=fr(n))}function fr(t){var e=t[or];if(!e){let r=ar(t);e=(t,e)=>cr(t,e,r),t[or]=e}return e}function cr(t,e,r){!function(t,e,r){var n,i=128&e?0:-1,o=t.length;(n=!!o)&&(n=null!=(n=t[o-1])&&"object"==typeof n&&n.constructor===Object);var a=o+(n?-1:0);for(e=128&e?1:0;e<a;e++)r(e-i,t[e]);if(n){t=t[o-1];for(let e in t)!isNaN(e)&&r(+e,t[e])}}(t,0|t[D],(t,n)=>{if(null!=n){var i=function(t,e){var r=t[e];if(r)return r;if((r=t.X)&&(r=r[e])){var n=(r=Array.isArray(r)?r[0]instanceof Ye?r:[nr,r]:[r,void 0])[0].M;if(r=r[1]){let e=fr(r),i=ar(r).P;r=t.da?er(i,e):(t,r,o)=>n(t,r,o,i,e)}else r=n;return t[e]=r}}(r,t);i?i(e,n,t):t<500||B(U,3)}})}function hr(t,e,r){if(Array.isArray(e)){var n=0|e[D];if(4&n)return e;for(var i=0,o=0;i<e.length;i++){let r=t(e[i]);null!=r&&(e[o++]=r)}return o<i&&(e.length=o),t=1|n,r&&(t=-1537&t|4),t!==n&&G(e,t),r&&2&t&&Object.freeze(e),e}}var dr=(t,e)=>{var r=new Me;cr(t.l,r,ar(e)),Te(r,r.h.end()),t=new Uint8Array(r.i);var n=(e=r.j).length,i=0;for(let r=0;r<n;r++){let n=e[r];t.set(n,i),i+=n.length}return r.j=[t],t};function pr(t,e){return new Ye(t,e)}function yr(t,e){return new Ye(t,e)}function mr(t,e,r){null!=(e=Tt(e))&&(Re(e),Ue(t,r,e))}function gr(t,e,r){null!=(e=Bt(e))&&null!=e&&(je(t,r,0),Ne(t.h,e))}function vr(t,e,r){null!=(e=Ft(e))&&ke(t,r,i(e))}function br(t,e,r,n,i){null!=(e=sr(e,n))&&(r=Oe(t,r),i(e,t),Fe(t,r))}function wr(t,e,r){null!=(e=Ot(e))&&ke(t,r,se(e).buffer)}function Ar(t,e,r){null!=(e=Bt(e))&&(e=parseInt(e,10),je(t,r,0),Ne(t.h,e))}var Ir,Er=pr(function(t,e,r){null!=(e=At(e))&&(je(t,r,1),t=t.h,(r=ot||=new DataView(new ArrayBuffer(8))).setFloat64(0,+e,!0),at=r.getUint32(0,!0),st=r.getUint32(4,!0),_e(t,at),_e(t,st))},qe),Sr=pr(function(t,e,r){null!=(e=At(e))&&(je(t,r,5),t=t.h,(r=ot||=new DataView(new ArrayBuffer(8))).setFloat32(0,+e,!0),st=0,_e(t,at=r.getUint32(0,!0)))},Ve),xr=pr(mr,He),Nr=pr(mr,He),Br=yr(function(t,e,r){if(null!=(e=hr(Tt,e,!1)))for(let n=0;n<e.length;n++)Ue(t,r,e[n])},He),_r=pr(function(t,e,r){if(null!=(e=jt(e))){if("string"==typeof e)le(e);if(null!=e)switch(je(t,r,0),typeof e){case"number":t=t.h,lt(e),Se(t,at,st);break;case"bigint":r=Ee(e,ce,ue),Se(t.h,r.i,r.h);break;default:r=le(e),Se(t.h,r.i,r.h)}}},We),Cr=pr(gr,Ge),Tr=yr(function(t,e,r){if(null!=(e=hr(Bt,e,!0)))for(let a=0;a<e.length;a++){var n=t,i=r,o=e[a];null!=o&&(je(n,i,0),Ne(n.h,o))}},Ge),jr=yr(function(t,e,r){if(null!=(e=hr(Bt,e,!0))&&e.length){r=Oe(t,r);for(let r=0;r<e.length;r++)Ne(t.h,e[r]);Fe(t,r)}},Ge),Or=pr(function(t,e,r){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(je(t,r,0),t.h.h.push(e?1:0))},Le),Fr=pr(vr,ze),Ur=yr(function(t,e,r){if(null!=(e=hr(Ft,e,!0)))for(let s=0;s<e.length;s++){var n=t,o=r,a=e[s];null!=a&&ke(n,o,i(a))}},ze),kr=function(t,e,r=De){return new Ye(e,r)}(0,function(t,e,r,n,i){if(Array.isArray(e)){for(let o=0;o<e.length;o++)br(t,e[o],r,n,i);1&(t=0|e[D])||G(e,1|t)}}),Mr=new Ye(br,De),Rr=pr(wr,Ke),Pr=yr(function(t,e,r){if(null!=(e=hr(Ot,e,!1)))for(let a=0;a<e.length;a++){var n=t,i=r,o=e[a];null!=o&&ke(n,i,se(o).buffer)}},Ke),Dr=pr(function(t,e,r){e=function(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return bt(t)?t>>>0:void 0}(e),null!=e&&null!=e&&(je(t,r,0),xe(t.h,e))},$e),Lr=pr(Ar,Xe),zr=pr(Ar,Xe),Gr=pr(function(t,e,r){if(null!=(e=Tt(e))&&(Re(e),null!=e))switch(je(t,r,0),typeof e){case"number":t=t.h,e=(r=e)<0,ut(r=2*Math.abs(r)),r=at;let n=st;e&&(0==r?0==n?n=r=4294967295:(n--,r=4294967295):r--),Se(t,at=r,st=n);break;case"bigint":t=t.h,e=e<<BigInt(1)^e>>BigInt(63),at=Number(BigInt.asUintN(32,e)),st=Number(BigInt.asUintN(32,e>>BigInt(32))),Se(t,at,st);break;default:Be(t.h,e)}},Je),$r=[0,Rr,Pr,Or,Fr],Hr=[0,pr(vr,ze),[0,zr,[0,pr(mr,He),pr(gr,Ge)],zr,-1,[0,Lr],zr,-1],pr(wr,Ke)],Wr=[0,1,[0,12,Cr,10,Or],[0,7,[0,Cr,-1]]],Jr=globalThis.trustedTypes;var Vr=class{constructor(t){this.h=t}toString(){return this.h+""}};function qr(t){var e;return void 0===Ir&&(Ir=function(){var t=null;if(!Jr)return t;try{let e=t=>t;t=Jr.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}()),t=(e=Ir)?e.createScriptURL(t):t,new Vr(t)}function Kr(t,...e){if(0===e.length)return qr(t[0]);var r=t[0];for(let n=0;n<e.length;n++)r+=encodeURIComponent(e[n])+t[n+1];return qr(r)}function Xr(t,e){if(t.floatEmbedding&&e.floatEmbedding)return Yr(t.floatEmbedding,e.floatEmbedding);if(t.quantizedEmbedding&&e.quantizedEmbedding)return Yr(Zr(t.quantizedEmbedding),Zr(e.quantizedEmbedding));throw Error("Cannot compute cosine similarity between quantized and float embeddings.")}function Zr(t){return Array.from(t,t=>t>127?t-256:t)}function Yr(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);var r=0,n=0,i=0;for(let o=0;o<t.length;o++)r+=t[o]*e[o],n+=t[o]*t[o],i+=e[o]*e[o];if(n<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*i)}function Qr(t){!t.h&&t.i.length>0&&(t.h=!0,t.i.shift()())}async function tn(t,e){return new Promise((r,n)=>{t.i.push(()=>{e().then(r,n).finally(()=>{t.h=!1,Qr(t)})}),Qr(t)})}var en,rn=class{constructor(){this.h=!1,this.i=[]}},nn=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function on(t){if(t)return!0;if(void 0===en)try{await WebAssembly.instantiate(nn),en=!0}catch{en=!1}return en}async function an(t,e,r){return{wasmLoaderPath:`${e}/${t}_${r=`wasm${r?"_module":""}${await on(r)?"":"_nosimd"}_internal`}.js`,wasmBinaryPath:`${e}/${t}_${r}.wasm`}}var sn=class{};function un(t){return oe(new ln,1,t)}sn.forVisionTasks=function(t,e=!1){return an("vision",t??Kr``,e)},sn.forLiteRtLmTextTasks=function(t,e=!1){return an("litertlm_text",t??Kr``,e)},sn.forTextTasks=function(t,e=!1){return an("text",t??Kr``,e)},sn.forRetrievalTasks=function(t,e=!1){return an("retrieval",t??Kr``,e)},sn.forGenAiTasks=function(t,e=!1){return an("genai",t??Kr``,e)},sn.forDecisionTasks=function(t,e=!1){return an("decision",t??Kr``,e)},sn.forAudioTasks=function(t,e=!1){return an("audio",t??Kr``,e)},sn.isSimdSupported=function(t=!1){return on(t)};var ln=class extends Ze{constructor(t){super(t)}},fn=class extends Ze{constructor(t){super(t)}},cn=[0,Lr,2,_r,-2,Nr,kr,[0,Lr,Nr]],hn=class extends Ze{constructor(t){super(t)}},dn=class extends Ze{constructor(t){super(t)}};function pn(t,e){return oe(t,1,e)}function yn(t,e){return oe(t,2,e)}var mn,gn=class extends Ze{constructor(t){super(t)}},vn=[3,4,5,6,7],bn=class extends Ze{constructor(t){super(t)}},wn=class extends Ze{constructor(t){super(t)}};wn.prototype.i=(mn=[0,[0,Lr,Fr,-3,Lr],[0,vn,Lr,-1,Mr,[0,Lr,Fr,_r],Mr,cn,Mr,[0,1,cn],Mr,[0,Lr],Mr,[0,Lr,Fr,_r]]],function(){return dr(this,mn)});var An=class{constructor(){this.h="undefined"!=typeof AbortController}async send(t,e,r){var n=this.h?new AbortController:void 0,i=n&&t.O>0?setTimeout(()=>{n.abort()},t.O):void 0;try{let i=await fetch(t.url,{method:t.ga,headers:{...t.fa},...t.body&&{body:t.body},...t.withCredentials&&{credentials:"include"},signal:t.O&&n?n.signal:null});200===i.status?e?.(await i.text()):r?.(i.status)}catch(t){if("AbortError"===t?.name)r?.(408);else r?.(400)}finally{clearTimeout(i)}}},In=class extends Ze{constructor(t){super(t,37)}},En=[-4,{},Wr,Lr,Hr],Sn=[0,Fr,Lr,1,Fr,-1,Lr,1,Lr,1,Nr],xn=[0,Lr,Fr,-2],Nn=[0,Fr,Lr],Bn=[0,Fr,Lr],_n=[0,Or,-3],Cn=[0,Lr,Fr,-1,Nr,Cr,-1,Fr,-5,kr,[0,Fr,-4],-1,Or,[0,Or,-3],Lr];var Tn=class extends Ze{constructor(t){super(t,19)}},jn=function(t){return e=>dr(e,t)}([-19,{},[0,Lr,1,[0,Fr,-6,Nr,Cr,Fr,-1,Nr],1,[0,Fr,1,Fr,-5],Fr,-1,[0,Lr,Fr,-8],[0,Fr,-3],[0,Fr,Lr,Fr,-2],[0,Fr,-1,Lr,Fr,-1,Lr,Fr,-1,[0,kr,[0,Fr,-1],Or,Fr,-5],[0,Lr,Or,Cr,-2]],Nr,[0,Fr,-3,Nr,Cr,Fr,-1],[0,Lr,Fr,-1],[0,Fr,-9],[0,Fr,-6,Lr,Fr,1,Fr,Or,Lr,-1,Or,Fr,-2,Lr,Fr,Lr,Fr,Cr,-1],1,[0,Lr],1,[0,Fr,-4],1,Sn,[0,[1,2,3,4,5,6],Mr,Sn,Mr,Nn,Mr,Bn,Mr,[0,Lr],Mr,Cn,Mr,xn],Nn,Bn,Cn,[0,[0,Lr,Fr,-1,Nr,Cr,-1,Fr,-4,kr,[0,Fr,-4],-1,1,_n],[0,Lr,Fr,-1,Nr,Cr,-1,Fr,-4,_n]],xn,[0,Fr,[0,Cr,-3,Lr],Lr,-2,[0,Cr,-1],Or],4,[0,Fr,Lr,Fr,-1,Nr,Lr,Fr,-1,Lr,Cr,-1]],Lr,kr,[-37,{},xr,Fr,kr,[0,Fr,-1],Rr,1,Rr,[0,Ur,-1,Tr,Br,-1],Fr,[0,Cr,Fr,-1],Or,Cr,Nr,Fr,-1,Gr,$r,xr,Rr,Lr,Tr,Nr,-1,[0,Lr,-1],Fr,Or,Fr,jr,Fr,-1,Er,1,Er,En,Or,[0,Lr,[0,Sr,Cr,-2],[0,Sr]],[0,Lr,Nr]],xr,Pr,Fr,-1,xr,Lr,-1,[0,Or,-1,Lr,Or],[0,Nr,-1,Fr],[0,xr,Or,Nr],Nr,1,Dr,1,En]),On=class{constructor(t){this.i=[],this.m=new An,this.j=t??"",this.h=setInterval(()=>{this.flush()},6e4)}close(){void 0!==this.h&&(clearInterval(this.h),this.h=void 0),this.flush()}flush(t,e){if(this.error)e?.("net-send-failed");else if(0===this.i.length)t?.();else{var r=this.i;this.i=[],r=function(t){var e=new Tn;Gt(e=oe(e,2,1786));var r=e.l,n=0|r[D];if(null==t)Jt(r,n,3);else{var i=t===j?7:0|t[D],o=i,a=qt(i),s=a||Object.isFrozen(t),u=!0,l=!0;for(let e=0;e<t.length;e++){var f=t[e];a||(f=W(f),u&&=!f,l&&=f)}a||(i=u?13:5,i=l?-4097&i:4096|i),s&&i===o||(t=Array.prototype.slice.call(t),o=0,i=te(i,n)),i!==o&&G(t,i),n=Jt(r,n,3,t),2&i||!(4096&i||16&i)||$t(r,n)}return e}(r),r=jn(r),this.m.send({url:"https://odml.pa.googleapis.com/v1/log",ga:"POST",O:1e4,body:r,la:2,fa:{"Content-Type":"application/x-protobuf","x-goog-api-key":this.j},withCredentials:!1},()=>{t?.()},t=>{this.error=Error(`Logging failed with HTTP error: ${t}`),this.i=[],void 0!==this.h&&(clearInterval(this.h),this.h=void 0),e?.("net-send-failed",t)})}}};class Fn{constructor(){this.I=this.B=this.G=this.A=this.D=this.F=this.C=0}}function Un(t,e){var r=new wn;if(r=Yt(r,1,t.S),r=Yt(r,2,e),e=new In,null!=(r=r.i()))if("string"==typeof r)r=r?new I(r,A):w||=new I(null,A);else if(!(r instanceof I)){if(!(p&&null!=r&&r instanceof Uint8Array))throw Error();r=r.length?new I(new Uint8Array(r),A):w||=new I(null,A)}e=Wt(e,6,r),(t=t.H).error||t.i.push(e)}function kn(t){var e=new dn;e=ne(e=oe(e,1,10),3,performance.now()-t.R),Un(t,e=Qt(yn(pn(new gn,t.v),0),3,e)),t.m=performance.now()}function Mn(t,e){++t.h.F,t.i.set(e,performance.now())}function Rn(t,e){var r={C:e.C-t.j.C,F:e.F-t.j.F,D:e.D-t.j.D,A:e.A-t.j.A,G:e.G-t.j.G,B:e.B,I:e.I},n=yn(pn(new gn,t.v),1);Un(t,n=Qt(n,4,r=Dn(r))),t.j=e}function Pn(t,e){var r=t.i.get(e);if(void 0!==r&&(t.i.delete(e),e=performance.now()-r,++t.h.D,t.h.G+=e,t.h.B=Math.max(t.h.B,e),t.u=Math.max(t.u,e),performance.now()>t.m+3e4)){for(let[n,i]of t.i.entries())e=n,i<r&&(t.h.A++,t.i.delete(e));r={...t.h,I:performance.now()-t.m},t.h.B=0,t.m=performance.now(),Rn(t,r)}}function Dn(t){var e=new fn;if(e=ne(e=re(e=oe(e,1,10),7,t.A),5,t.B),e=ne(e,6,t.I),t.D>0&&ne(e,4,t.G/t.D),0!==t.C){var r=un(3);ee(e,r=re(r,2,t.C))}return 0!==t.F&&ee(e,t=re(r=un(4),2,t.F)),e}function Ln(t){var e={...t.h,A:t.h.A+t.i.size,B:t.u,I:performance.now()-t.R};Rn(t,e);var r=new hn;r=Yt(r,2,e=Dn(e)),Un(t,r=Qt(e=yn(pn(new gn,t.v),2),5,r))}var zn=class{constructor(t,e){this.R=performance.now(),this.m=performance.now(),this.i=new Map,this.u=0,this.h=new Fn,this.j=new Fn,this.H=new On(e),this.v=function(t){switch(t){case"AudioClassifier":return 4;case"AudioEmbedder":return 5;case"TextClassifier":return 6;case"TextEmbedder":return 7;case"GestureRecognizer":return 8;case"HandDetector":return 9;case"HandLandmarker":return 10;case"ImageClassifier":return 11;case"ImageEmbedder":return 12;case"ImageSegmenter":return 13;case"ObjectDetector":return 14;case"FaceDetector":return 15;case"FaceLandmarker":return 16;case"InteractiveSegmenter":case"InteractiveSegmenterLegacy":return 18;case"HolisticLandmarker":return 20;case"LlmInference":return 21;case"LanguageDetector":return 22;case"PoseLandmarker":return 23;case"UniversalEmbedder":return 28;case"SemanticRetriever":return 29;case"DecisionMaker":return 30;case"TextSummarizer":return 26;case"TextProofreader":return 27;case"AudioTranscriber":return 31;case"TextToSpeech":return 32;default:return 0}}(t),t=new bn,"undefined"==typeof navigator?e=0:(e=navigator.userAgent,e=/Android/i.test(e)?1:/iPhone|iPad|iPod/i.test(e)?2:/Windows/i.test(e)?5:/Macintosh/i.test(e)?4:/Linux/i.test(e)?3:0),t=ie(t=oe(t,1,e),2,""),t=ie(t,3,""),t=ie(t,4,"1.2.0"),t=ie(t,5,""),this.S=oe(t,6,function(){var t=globalThis.__HOST_ENVIRONMENT__;if("string"==typeof t)switch(t){case"ANDROID":return 1;case"IOS":return 2;case"PYTHON":return 3;case"WEB":break;case"FLUTTER":return 5;case"FLUTTER_WEB":return 6;default:return 0}return 4}())}close(){var t=this.H;"function"==typeof t.close?t.close():t.flush()}};function Gn(t){var e=atob("QUl6YVN5QS1XbGdRNjczMWpZSThjWGhKNEFxZjhuX3J1UmNLMzJZ");return new zn(t,e)}async function $n(t){if("function"!=typeof importScripts){let e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise((t,r)=>{e.addEventListener("load",()=>{t()},!1),e.addEventListener("error",t=>{r(t)},!1),document.body.appendChild(e)})}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;{let e=self.import;e?await e(t.toString()):await import(t.toString())}}}var Hn=async(t,e,r,n)=>{if(e&&await $n(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(r&&(await $n(r),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&n&&((e=self.Module).locateFile=n.locateFile,n.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=n.mainScriptUrlOrBlob)),n=await self.ModuleFactory(self.Module||n),self.ModuleFactory=self.Module=void 0,new t(n,null)},Wn={CHARACTER:0,WORD:1};function Jn(t,e){if(t<=0)throw Error("Chunk size must be positive.");if(e<0||e>=t)throw Error("Chunk overlap must be non-negative and less than chunk size.")}function Vn(t,e,r,n="CHARACTER"){Jn(e,r),t.j=e,t.i=r,t.mode=n}var qn=class{constructor(t){this.j=512,this.i=100,this.mode="CHARACTER",this.h=t}chunk(t){if(!t||0===t.trim().length)return[];if(!this.h||"function"!=typeof this.h.defaultTextChunker_nativeChunkText)throw Error("DefaultTextChunker Wasm module is not initialized.");return(t=this.h.defaultTextChunker_nativeChunkText(t,this.j,this.i,Wn[this.mode]??0))?Array.from(t):[]}};function Kn(t){return{...t,content:t.content?t.content.map(t=>"imageBytes"in t?{...t,imageBytes:new Uint8Array(t.imageBytes)}:"audioData"in t?{...t,audioData:new Float32Array(t.audioData)}:{...t}):[],embeddings:t.embeddings?new Float32Array(t.embeddings):new Float32Array(0),metadata:t.metadata?{...t.metadata}:{},...t.childIds?{childIds:[...t.childIds]}:{}}}qn.prototype.chunk=qn.prototype.chunk,qn.createFromModule=function(t,e=512,r=100,n="CHARACTER"){return Jn(e,r),Vn(t=new qn(t),e,r,n),t},qn.create=async function(t,e=512,r=100,n="CHARACTER"){Jn(e,r);var i=await Hn(qn,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:e=>e.endsWith(".wasm")?t.wasmBinaryPath.toString():e});return Vn(i,e,r,n),i};var Xn=class{constructor(){this.h=new Map}upsert(t){for(let e of t)this.h.set(e.id,Kn(e))}delete(t){var e=new Set(t);for(let r of t)if(t=this.h.get(r),t?.childIds)for(let r of t.childIds)e.add(r);for(let t of e)this.h.delete(t)}deleteByMetadata(t){var e=Object.keys(t);if(0!==e.length){var r=[];for(let n of this.h.values())n.parentId||n.metadata&&e.every(e=>n.metadata[e]===t[e])&&r.push(n.id);r.length>0&&this.delete(r)}}search(t,e,r){if(e<=0)throw Error(`'topK' must be greater than 0, got ${e}.`);var n=r?Object.keys(r):[];t=Array.from(t);var i=[];for(let e of this.h.values()){if(r&&n.length>0){if(!e.metadata)continue;if(!n.every(t=>e.metadata?.[t]===r[t]))continue}if(e.embeddings&&0!==e.embeddings.length)try{let r=Xr({floatEmbedding:t,headIndex:0,headName:""},{floatEmbedding:Array.from(e.embeddings),headIndex:0,headName:""});i.push({ea:e,score:r})}catch{}}return i.sort((t,e)=>e.score-t.score),i.slice(0,e).map(t=>Kn(t.ea))}get(t){var e=[];for(let r of t)(t=this.h.get(r))&&e.push(Kn(t));return e}getAllRecordIds(){var t=[];for(let[e,r]of this.h.entries()){let n=e;r.parentId||t.push(n)}return t}deleteAll(){this.h.clear()}close(){this.h.clear()}};Xn.prototype.close=Xn.prototype.close,Xn.prototype.deleteAll=Xn.prototype.deleteAll,Xn.prototype.getAllRecordIds=Xn.prototype.getAllRecordIds,Xn.prototype.get=Xn.prototype.get,Xn.prototype.search=Xn.prototype.search,Xn.prototype.deleteByMetadata=Xn.prototype.deleteByMetadata,Xn.prototype.delete=Xn.prototype.delete,Xn.prototype.upsert=Xn.prototype.upsert;var Zn=class{constructor(){this.h=[]}T(t){return this.h.push(t),this}N(){return[...this.h]}ja(t){return this.j=t,this}o(){return this.j}ia(t){return this.i=t,this}L(){return this.i}};function Yn(t){if(t.i)throw Error("SemanticRetriever has already been closed.")}Zn.prototype.textChunker=Zn.prototype.L,Zn.prototype.setTextChunker=Zn.prototype.ia,Zn.prototype.vectorStore=Zn.prototype.o,Zn.prototype.setVectorStore=Zn.prototype.ja,Zn.prototype.providers=Zn.prototype.N,Zn.prototype.addProvider=Zn.prototype.T;var Qn=class{constructor(t,e,r){this.m=t,this.o=e,this.L=r,this.i=!1,this.j=0,this.h=Gn("SemanticRetriever"),kn(this.h)}async embedContent(t){for(let e of this.m.N()){let r=await e.embedContent(t);if(null!=r)return r instanceof Float32Array?r:new Float32Array(r)}throw Error("No embedding provider found that can embed this content.")}async aa(t,e,r){return Yn(this),this.K(t,[{text:e}],r)}async K(t,e,r){Yn(this),await this.o.delete([t]);var n=[],i=0;if(1===e.length&&"text"in e[0]&&"string"==typeof e[0].text){var o=await this.L.chunk(e[0].text);if(o.length>1){let r=[];for(let e of o)o=`${t}_chunk_${i++}`,r.push(o),n.push({id:o,J:[{text:e}],parentId:t});n.push({id:t,J:e,childIds:r})}else n.push({id:t,J:e})}else n.push({id:t,J:e});t=[];for(let e of n)n=void 0!==e.childIds&&e.childIds.length>0?new Float32Array(0):await this.embedContent(e.J),t.push({id:e.id,content:[...e.J],embeddings:n,metadata:r||{},parentId:e.parentId,childIds:e.childIds});await this.o.upsert(t)}async ba(t,e,r){return Yn(this),this.K(t,[{imageBytes:e}],r)}async Z(t,e,r){return Yn(this),this.K(t,[{audioData:e}],r)}async ha(t,e={}){Yn(this);var{limit:r=5,metadataFilter:n}=e;if(r<=0)throw Error(`'limit' must be greater than 0, got ${r}.`);e=this.j++;var i=this.h;++i.h.C,i.i.set(e,performance.now()),t=await this.embedContent("string"==typeof t?[{text:t}]:t),i=await this.o.search(t,3*r,n);var o=new Set;for(var a of i)a.parentId&&o.add(a.parentId);if(a=new Map,o.size>0)for(var s of o=await this.o.get(Array.from(o)))a.set(s.id,s);for(var u of(s=[],o=new Set,i))u.parentId?o.has(u.parentId)||(o.add(u.parentId),(i=a.get(u.parentId))&&s.push({id:i.id,content:i.content,embeddings:u.embeddings,metadata:i.metadata,parentId:i.parentId,childIds:i.childIds})):o.has(u.id)||(o.add(u.id),s.push(u));u=[],t=Array.from(t);for(let e of s){if(s=0,e.embeddings&&e.embeddings.length>0)try{s=Xr({floatEmbedding:t,headIndex:0,headName:""},{floatEmbedding:Array.from(e.embeddings),headIndex:0,headName:""})}catch{s=0}if(u.push({id:e.id,content:e.content?[...e.content]:[],metadata:e.metadata?{...e.metadata}:{},score:s}),u.length>=r)break}return Pn(this.h,e),u}async delete(t){Yn(this),"string"==typeof t?await this.o.delete([t]):Array.isArray(t)?await this.o.delete(t):await this.o.deleteByMetadata(t)}async getAllRecordIds(){Yn(this);var t=await this.o.getAllRecordIds();return Array.from(new Set(t))}async deleteAll(){Yn(this),await this.o.deleteAll()}close(){if(!this.i){this.i=!0,Ln(this.h),this.h.close();try{this.o.close()}catch{}}}};async function ti(t,e){var r=e.baseOptions.device;r||=await ei();var n=await Hn(ii,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:e=>e.endsWith(".wasm")?t.wasmBinaryPath.toString():e});return r&&(n.h.preinitializedWebGPUDevice=r),await async function(t,e,r){t.i=Gn("UniversalEmbedder");var n=!1!==e.l2Normalize,i=e.baseOptions.modelAssetPath?e.baseOptions.modelAssetPath.toString():"";if((r=r||e.baseOptions.device||t.h.preinitializedWebGPUDevice)||(r=await ei()),t.h.preinitializedWebGPUDevice=r,e.baseOptions.modelAssetBuffer){i=e.baseOptions.modelAssetBuffer instanceof Uint8Array?e.baseOptions.modelAssetBuffer:await async function(t){for(var e=[],r=0;;){let{done:n,value:i}=await t.read();if(n)break;e.push(i),r+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(r),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}(e.baseOptions.modelAssetBuffer);var o=`/${r=`universal_embedder_model_${++oi}.litertlm`}`;try{t.h.FS_unlink?.(o)}catch{}t.h.FS_createDataFile("/",r,i,!0,!1,!1),t.v=o,i=t.v}if(!i)throw Error("No model asset path or buffer provided.");r=e.maxInputLength??0,o=e.visionTokensPerImage??0,e=function(t){if(void 0===t)return 0;switch(t){case"FLOAT32":return 1;case"FLOAT16":return 2;case"INT16":return 3;case"INT8":return 4;default:throw Error(`Unsupported activation data type: ${t}`)}}(e.activationDataType);try{t.j=await t.h.createUniversalEmbedder(i,n,r,o,e),kn(t.i)}catch(e){throw ri(t),e}}(n,e,r),n}async function ei(){if("undefined"==typeof navigator||!navigator.gpu)throw Error("WebGPU is not supported on this platform.");var t=await navigator.gpu.requestAdapter({powerPreference:"high-performance"});if(!t)throw Error("No appropriate WebGPU adapter found.");var e=[];if(t.features.has("subgroups")&&e.push("subgroups"),t.features.has("shader-f16")&&e.push("shader-f16"),!(e=await t.requestDevice({requiredFeatures:e})).adapterInfo&&t.info)try{Object.defineProperty(e,"adapterInfo",{value:t.info,writable:!0,configurable:!0})}catch{}return e}function ri(t){if(t.v){try{t.h.FS_unlink?.(t.v)}catch{}t.v=void 0}}function ni(t){if(t.H||0===t.j)throw Error("UniversalEmbedder has already been closed.")}Qn.prototype.close=Qn.prototype.close,Qn.prototype.deleteAll=Qn.prototype.deleteAll,Qn.prototype.getAllRecordIds=Qn.prototype.getAllRecordIds,Qn.prototype.delete=Qn.prototype.delete,Qn.prototype.retrieve=Qn.prototype.ha,Qn.prototype.insertAudio=Qn.prototype.Z,Qn.prototype.insertImage=Qn.prototype.ba,Qn.prototype.insertContent=Qn.prototype.K,Qn.prototype.insertDocument=Qn.prototype.aa,Qn.createFromComponents=async function(t){if(!t||0===t.N().length)throw Error("At least one EmbeddingProvider must be registered in SemanticRetrieverComponents.");var e=t.o();if(!e)throw Error("VectorStore must be provided in SemanticRetrieverComponents.");var r=t.L();if(!r)throw Error("TextChunker must be provided in SemanticRetrieverComponents.");return new Qn(t,e,r)};var ii=class{constructor(t){this.H=!1,this.j=0,this.u=new rn,this.m=0,this.h=t}async W(t){return tn(this.u,async()=>{ni(this);var e=this.m++;Mn(this.i,e);var r=await this.h.universalEmbedder_embedText(this.j,t);return Pn(this.i,e),{embeddings:[{floatEmbedding:r?Array.from(r):[],headIndex:0,headName:"default"}]}})}async V(t){return tn(this.u,async()=>{ni(this);var e=this.m++;Mn(this.i,e);var r=await this.h.universalEmbedder_embedImage(this.j,t);return Pn(this.i,e),{embeddings:[{floatEmbedding:r?Array.from(r):[],headIndex:0,headName:"default"}]}})}async U(t){return tn(this.u,async()=>{ni(this);var e=this.m++;Mn(this.i,e);var r=await this.h.universalEmbedder_embedAudio(this.j,t);return Pn(this.i,e),{embeddings:[{floatEmbedding:r?Array.from(r):[],headIndex:0,headName:"default"}]}})}async embedContent(t){if(ni(this),!Array.isArray(t))throw Error("Content must be an array of ContentParts.");return tn(this.u,async()=>{ni(this);var e=this.h.universalEmbedder_createContentBuilder();try{for(let r of t)if("text"in r&&"string"==typeof r.text)this.h.universalEmbedder_builderAddText(e,r.text);else if("imageBytes"in r&&(r.imageBytes instanceof Uint8Array||"string"==typeof r.imageBytes))this.h.universalEmbedder_builderAddImage(e,r.imageBytes);else{if(!("audioData"in r)||!(r.audioData instanceof Float32Array||Array.isArray(r.audioData)))throw Error(`Unsupported or invalid ContentPart: ${JSON.stringify(r)}`);this.h.universalEmbedder_builderAddAudio(e,r.audioData)}let r=this.m++;Mn(this.i,r);let n=await this.h.universalEmbedder_executeEmbedContent(this.j,e);return Pn(this.i,r),{embeddings:[{floatEmbedding:n?Array.from(n):[],headIndex:0,headName:"default"}]}}finally{this.h.universalEmbedder_freeContentBuilder(e)}})}Y(){return{embedContent:async t=>(await this.embedContent(t))?.embeddings?.[0]?.floatEmbedding??null}}close(){this.H||(this.H=!0,Ln(this.i),this.i.close(),0!==this.j&&(this.h.universalEmbedder_close(this.j),this.j=0),ri(this))}};ii.prototype.close=ii.prototype.close,ii.prototype.getProvider=ii.prototype.Y,ii.cosineSimilarity=function(t,e){return Xr(t,e)},ii.prototype.embedContent=ii.prototype.embedContent,ii.prototype.embedAudio=ii.prototype.U,ii.prototype.embedImage=ii.prototype.V,ii.prototype.embedText=ii.prototype.W,ii.createFromModelPath=function(t,e){return ti(t,{baseOptions:{modelAssetPath:e.toString()}})},ii.createFromModelBuffer=function(t,e){return ti(t,{baseOptions:{modelAssetBuffer:e}})},ii.createWebGpuDevice=ei,ii.createFromOptions=ti;var oi=0;exports.DefaultTextChunker=qn,exports.FilesetResolver=sn,exports.MemoryVectorStore=Xn,exports.SemanticRetriever=Qn,exports.SemanticRetrieverComponents=Zn,exports.UniversalEmbedder=ii;
|
|
2
2
|
//# sourceMappingURL=retrieval_bundle_cjs.js.map
|