File size: 12,118 Bytes
e4f9cbe
1
2
import{S as he,i as _e,s as me,e as B,b as R,$ as H,h as P,D as Y,E as N,F as pe,Q as y,k as V,l as x,m as G,I as F,H as v,K as S,O as te,P as ae,a0 as ge,p as J}from"./index.224851d7.js";import{r as h,O as _,h as ye,i as W,j as Se,k as be,p as ve,l as Ee,e as g,f as j,a as b,m as Pe,T as we,w as Te}from"./taskMonitoringStore.8317b9f1.js";function X(t,e,a){const s=t.slice();return s[2]=e[a].width,s}function Ae(t){let e,a,s,n,r=[t[4],{style:a="width: "+t[2]+";"+t[4].style}],o={};for(let l=0;l<r.length;l+=1)o=N(o,r[l]);return{c(){e=V("p"),this.h()},l(l){e=x(l,"P",{style:!0}),G(e).forEach(P),this.h()},h(){F(e,o),v(e,"bx--skeleton__text",!0),v(e,"bx--skeleton__heading",t[0])},m(l,i){R(l,e,i),s||(n=[S(e,"click",t[12]),S(e,"mouseover",t[13]),S(e,"mouseenter",t[14]),S(e,"mouseleave",t[15])],s=!0)},p(l,i){F(e,o=te(r,[i&16&&l[4],i&20&&a!==(a="width: "+l[2]+";"+l[4].style)&&{style:a}])),v(e,"bx--skeleton__text",!0),v(e,"bx--skeleton__heading",l[0])},d(l){l&&P(e),s=!1,ae(n)}}}function Me(t){let e,a,s,n=t[3],r=[];for(let i=0;i<n.length;i+=1)r[i]=Z(X(t,n,i));let o=[t[4]],l={};for(let i=0;i<o.length;i+=1)l=N(l,o[i]);return{c(){e=V("div");for(let i=0;i<r.length;i+=1)r[i].c();this.h()},l(i){e=x(i,"DIV",{});var d=G(e);for(let u=0;u<r.length;u+=1)r[u].l(d);d.forEach(P),this.h()},h(){F(e,l)},m(i,d){R(i,e,d);for(let u=0;u<r.length;u+=1)r[u]&&r[u].m(e,null);a||(s=[S(e,"click",t[8]),S(e,"mouseover",t[9]),S(e,"mouseenter",t[10]),S(e,"mouseleave",t[11])],a=!0)},p(i,d){if(d&9){n=i[3];let u;for(u=0;u<n.length;u+=1){const p=X(i,n,u);r[u]?r[u].p(p,d):(r[u]=Z(p),r[u].c(),r[u].m(e,null))}for(;u<r.length;u+=1)r[u].d(1);r.length=n.length}F(e,l=te(o,[d&16&&i[4]]))},d(i){i&&P(e),ge(r,i),a=!1,ae(s)}}}function Z(t){let e;return{c(){e=V("p"),this.h()},l(a){e=x(a,"P",{style:!0}),G(e).forEach(P),this.h()},h(){J(e,"width",t[2]),v(e,"bx--skeleton__text",!0),v(e,"bx--skeleton__heading",t[0])},m(a,s){R(a,e,s)},p(a,s){s&8&&J(e,"width",a[2]),s&1&&v(e,"bx--skeleton__heading",a[0])},d(a){a&&P(e)}}}function ke(t){let e;function a(r,o){return r[1]?Me:Ae}let s=a(t),n=s(t);return{c(){n.c(),e=B()},l(r){n.l(r),e=B()},m(r,o){n.m(r,o),R(r,e,o)},p(r,[o]){s===(s=a(r))&&n?n.p(r,o):(n.d(1),n=s(r),n&&(n.c(),n.m(e.parentNode,e)))},i:H,o:H,d(r){n.d(r),r&&P(e)}}}function De(t,e,a){let s,n,r;const o=["lines","heading","paragraph","width"];let l=Y(e,o),{lines:i=3}=e,{heading:d=!1}=e,{paragraph:u=!1}=e,{width:p="100%"}=e;const Q=[.973,.153,.567];function k(c){y.call(this,t,c)}function D(c){y.call(this,t,c)}function ie(c){y.call(this,t,c)}function oe(c){y.call(this,t,c)}function le(c){y.call(this,t,c)}function ce(c){y.call(this,t,c)}function ue(c){y.call(this,t,c)}function de(c){y.call(this,t,c)}return t.$$set=c=>{e=N(N({},e),pe(c)),a(4,l=Y(e,o)),"lines"in c&&a(5,i=c.lines),"heading"in c&&a(0,d=c.heading),"paragraph"in c&&a(1,u=c.paragraph),"width"in c&&a(2,p=c.width)},t.$$.update=()=>{if(t.$$.dirty&4&&a(7,n=parseInt(p,10)),t.$$.dirty&4&&a(6,r=p.includes("px")),t.$$.dirty&238&&u)for(let c=0;c<i;c++){const U=r?n-75:0,fe=r?n:75,z=Math.floor(Q[c%3]*(fe-U+1))+U+"px";a(3,s=[...s,{width:r?z:`calc(${p} - ${z})`}])}},a(3,s=[]),[d,u,p,s,l,i,r,n,k,D,ie,oe,le,ce,ue,de]}class Oe extends he{constructor(e){super(),_e(this,e,De,ke,me,{lines:5,heading:0,paragraph:1,width:2})}}const Le=Oe;class C{static getSources(){return h(_,{method:"GET",url:"/api/v1/data_loaders/"})}static getSourceSchema(e){return h(_,{method:"GET",url:"/api/v1/data_loaders/{source_name}",path:{source_name:e},errors:{422:"Validation Error"}})}static load(e,a){return h(_,{method:"POST",url:"/api/v1/data_loaders/{source_name}/load",path:{source_name:e},body:a,mediaType:"application/json",errors:{422:"Validation Error"}})}}class m{static getDatasets(){return h(_,{method:"GET",url:"/api/v1/datasets/"})}static getManifest(e,a){return h(_,{method:"GET",url:"/api/v1/datasets/{namespace}/{dataset_name}",path:{namespace:e,dataset_name:a},errors:{422:"Validation Error"}})}static deleteDataset(e,a){return h(_,{method:"DELETE",url:"/api/v1/datasets/{namespace}/{dataset_name}",path:{namespace:e,dataset_name:a},errors:{422:"Validation Error"}})}static computeSignal(e,a,s){return h(_,{method:"POST",url:"/api/v1/datasets/{namespace}/{dataset_name}/compute_signal",path:{namespace:e,dataset_name:a},body:s,mediaType:"application/json",errors:{422:"Validation Error"}})}static deleteSignal(e,a,s){return h(_,{method:"DELETE",url:"/api/v1/datasets/{namespace}/{dataset_name}/delete_signal",path:{namespace:e,dataset_name:a},body:s,mediaType:"application/json",errors:{422:"Validation Error"}})}static getStats(e,a,s){return h(_,{method:"POST",url:"/api/v1/datasets/{namespace}/{dataset_name}/stats",path:{namespace:e,dataset_name:a},body:s,mediaType:"application/json",errors:{422:"Validation Error"}})}static selectRowsDownload(e,a,s){return h(_,{method:"GET",url:"/api/v1/datasets/{namespace}/{dataset_name}/select_rows_download",path:{namespace:e,dataset_name:a},query:{url_safe_options:s},errors:{422:"Validation Error"}})}static selectRows(e,a,s){return h(_,{method:"POST",url:"/api/v1/datasets/{namespace}/{dataset_name}/select_rows",path:{namespace:e,dataset_name:a},body:s,mediaType:"application/json",errors:{422:"Validation Error"}})}static selectRowsSchema(e,a,s){return h(_,{method:"POST",url:"/api/v1/datasets/{namespace}/{dataset_name}/select_rows_schema",path:{namespace:e,dataset_name:a},body:s,mediaType:"application/json",errors:{422:"Validation Error"}})}static selectGroups(e,a,s){return h(_,{method:"POST",url:"/api/v1/datasets/{namespace}/{dataset_name}/select_groups",path:{namespace:e,dataset_name:a},body:s,mediaType:"application/json",errors:{422:"Validation Error"}})}static getMedia(e,a,s,n){return h(_,{method:"GET",url:"/api/v1/datasets/{namespace}/{dataset_name}/media",path:{namespace:e,dataset_name:a},query:{item_id:s,leaf_path:n},errors:{422:"Validation Error"}})}}const I="*",Ve="__rowid__",E="__value__",xe={text:["string","string_span"],text_embedding:["embedding"],image:["binary"]};function Ge(t){return typeof t=="string"?t:t.map(e=>e.includes(".")?`"${e}"`:e).join(".")}function Ce(t){return t.dtype&&!["embedding","binary","string_span"].includes(t.dtype)}function Ke(t){return t.dtype&&!["embedding","binary"].includes(t.dtype)}function w(t){var a;return Array.isArray(t)?t:((a=t.match(/(?:"[^"]*"|[^.])+(?:\.+$)?/g))==null?void 0:a.map(s=>s.replace(/"/g,"")))||[]}function Ne(t,e){if(!t||!e||(t=w(t),e=w(e),t.length!==e.length))return!1;for(let a=0;a<t.length;a++)if(t[a]!==e[a])return!1;return!0}function Ue(t,e){return!t||!e||(t=w(t),e=w(e),t.length<e.length)?!1:Ne(t.slice(0,e.length),e)}function K(t,e){if(!t||!e||(t=w(t),e=w(e),t.length!==e.length))return!1;for(let a=0;a<t.length;a++)if(t[a]!==e[a]&&(t[a]!==e[a]&&t[a]!==I||t[a]===I&&!e[a].toString().match(/^\d+$/)))return!1;return!0}function ze(t){return(t==null?void 0:t.concept_name)!=null}function Be(t){return t==null?"N/A":typeof t=="number"?t.toLocaleString(void 0,{maximumFractionDigits:3}):t instanceof Blob?"blob":Array.isArray(t)?t.join(", "):typeof t=="object"?Object.keys(t).length===2&&t.start!=null&&t.end!=null?`(${t.start}, ${t.end})`:JSON.stringify(t):t.toString()}function He(t){return t.path!=null}const A="__path__",M="__field__";function Fe(t,e){if(t==null)throw Error("Item is null.");if(e.length===0)return t;const[a,...s]=e;return t[a]==null?null:Fe(t[a],s)}function se(t){const e=q(t,[]);return e.fields?{fields:e.fields,path:[]}:{fields:{},path:[]}}function re(t,e){const a=T(e),s=L(t,a,[]);if(Array.isArray(s))throw new Error("Expected row to have a single root node");if(!s)throw new Error("Expected row to have children");return s[E]=null,s[A]=[],s[M]=e,s}function T(t){return t==null?[]:[t,...Object.values(t.fields||{}).flatMap(T),...t.repeated_field?T(t.repeated_field):[]].filter(a=>a.path.length>0)}function Ye(t){return t==null?[]:T(t).filter(e=>e.dtype!=null)}function Je(t,e){return e==null?[]:(e?T(e):[]).filter(s=>s.dtype==t)}function O(t){let e;if(Array.isArray(t))e=[...t,...t.flatMap(O)];else{const{[E]:a,[A]:s,[M]:n,...r}=t,o=Object.values(r||{});e=[];for(const l of o)if(Array.isArray(l)){e=[...e,l];for(const i of l)e=[...e,i,...O(i)]}else e=[...e,l,...O(l)]}return e}function We(t,e){return T(t).find(s=>K(s.path,e))}function Xe(t,e){return O(t).filter(s=>K(e,ne.path(s)))}function $(t,e,a=!1){return Ie(e)&&(a=!0),e===t?a:e.fields!=null?Object.values(e.fields).some(s=>$(t,s,a)):e.repeated_field!=null?$(t,e.repeated_field,a):!1}function Ie(t){return t.signal!=null}const ne={path:t=>{if(!t)return;const e=t[A];if(e==null)throw Error(`Item does not have a path defined: ${JSON.stringify(t)}`);return e},value:(t,e)=>{if(t)return t[E]},field:t=>{if(t)return t[M]},dtype:t=>{const e=ne.field(t);return e==null?void 0:e.dtype}};function q(t,e){const{fields:a,repeated_field:s,...n}=t,r={...n,path:[]};if(a!=null){r.fields={};for(const[o,l]of Object.entries(a)){const i=q(l,[...e,o]);i.path=[...e,o],r.fields[o]=i}}if(s!=null){const o=q(s,[...e,I]);o.path=[...e,I],r.repeated_field=o}return r}function L(t,e,a){const s=e.find(r=>K(r.path,a));let n={};if(Array.isArray(t))return n=t.map((r,o)=>L(r,e,[...a,o.toString()])),n[E]=null,n[A]=a,n[M]=s,n;if(t!=null&&typeof t=="object"){const{[E]:r,...o}=t;n=Object.entries(o).reduce((l,[i,d])=>(l[i]=L(d,e,[...a,i]),l),{}),n[E]=r}else n[E]=t;return n[A]=a,n[M]=s,n}class Re extends ye{constructor(e,a){super(e,a)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e,a){super.setOptions({...e,behavior:W()},a)}getOptimisticResult(e){return e.behavior=W(),super.getOptimisticResult(e)}fetchNextPage({pageParam:e,...a}={}){return this.fetch({...a,meta:{fetchMore:{direction:"forward",pageParam:e}}})}fetchPreviousPage({pageParam:e,...a}={}){return this.fetch({...a,meta:{fetchMore:{direction:"backward",pageParam:e}}})}createResult(e,a){var s,n,r,o,l,i;const{state:d}=e,u=super.createResult(e,a),{isFetching:p,isRefetching:Q}=u,k=p&&((s=d.fetchMeta)==null||(n=s.fetchMore)==null?void 0:n.direction)==="forward",D=p&&((r=d.fetchMeta)==null||(o=r.fetchMore)==null?void 0:o.direction)==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Se(a,(l=d.data)==null?void 0:l.pages),hasPreviousPage:be(a,(i=d.data)==null?void 0:i.pages),isFetchingNextPage:k,isFetchingPreviousPage:D,isRefetching:Q&&!k&&!D}}}function je(t,e,a){const s=ve(t,e,a);return Ee(s,Re)}const f="datasets",ee=20,Ze=g(m.getDatasets,f),$e=g(m.getManifest,f,{}),et=g(m.getManifest,f,{select:t=>se(t.dataset_manifest.data_schema)}),tt=g(C.getSources,f),at=g(C.getSourceSchema,f,{select:t=>t}),st=j(C.load),rt=j(m.computeSignal,{onSuccess:t=>{b.invalidateQueries([we]),Te(t.task_id,()=>{b.invalidateQueries([f,"getManifest"]),b.invalidateQueries([f,"selectRowsSchema"]),b.invalidateQueries([f,"selectRows"])})}}),nt=j(m.deleteDataset,{onSuccess:()=>{b.invalidateQueries([f])}}),it=j(m.deleteSignal,{onSuccess:()=>{b.invalidateQueries([f,"getManifest"]),b.invalidateQueries([f,"selectRowsSchema"]),b.invalidateQueries([f,"selectRows"])}}),ot=g(m.getStats,f),lt=Pe(m.getStats,f);g(function(e,a,s,n){return m.selectRows(e,a,s).then(r=>({rows:r.rows.map(o=>re(o,n)),total_num_rows:r.total_num_rows}))},f);const ct=g(m.selectRowsSchema,f,{select:t=>({schema:se(t.data_schema),...t})}),ut=g(m.selectGroups,f),dt=(t,e,a,s)=>je({queryKey:[f,"selectRows",t,e,a],queryFn:({pageParam:n=0})=>m.selectRows(t,e,{...a,limit:a.limit||ee,offset:n*(a.limit||ee)}),select:n=>({...n,pages:n.pages.map(r=>({rows:r.rows.map(o=>re(o,s)),total_num_rows:r.total_num_rows}))}),getNextPageParam:(n,r)=>r.length,enabled:!!s});function ft(t){return t!=null}function ht(t,e){return`/concepts#!/${t}/${e}`}function _t(t,e){return`/datasets#!/${t}/${e}`}export{Ke as A,ot as B,ut as C,lt as D,ct as E,f as F,Ue as G,He as H,xe as I,tt as J,st as K,ne as L,at as M,I as P,Le as S,Ve as U,E as V,_t as a,T as b,ht as c,nt as d,w as e,Ye as f,Je as g,We as h,K as i,Be as j,ze as k,Xe as l,O as m,ft as n,Ie as o,Ne as p,Ze as q,rt as r,Ge as s,$e as t,et as u,Fe as v,dt as w,it as x,$ as y,Ce as z};