1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1321],{1321:function(e,t,s){s.d(t,{qL:function(){return J.qL},Xg:function(){return L},$P:function(){return J.$P}});var r=s(6680),n=s(2569),i=s(6354);function a(e,t){if("undefined"==typeof Convex||void 0===Convex.syscall)throw Error("The Convex database and auth objects are being used outside of a Convex backend. Did you mean to use `useQuery` or `useMutation` to call a Convex function?");return JSON.parse(Convex.syscall(e,JSON.stringify(t)))}async function o(e,t){let s;if("undefined"==typeof Convex||void 0===Convex.asyncSyscall)throw Error("The Convex database and auth objects are being used outside of a Convex backend. Did you mean to use `useQuery` or `useMutation` to call a Convex function?");try{s=await Convex.asyncSyscall(e,JSON.stringify(t))}catch(e){if(void 0!==e.data){let t=new n.P(e.message);throw t.data=(0,i.sq)(e.data),t}throw Error(e.message)}return JSON.parse(s)}var u=s(3e3),l=Object.defineProperty,d=(e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,c=(e,t,s)=>d(e,"symbol"!=typeof t?t+"":t,s);class h{constructor(){c(this,"_isExpression"),c(this,"_value")}}var m=Object.defineProperty,p=(e,t,s)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,y=(e,t,s)=>p(e,"symbol"!=typeof t?t+"":t,s);class f extends h{constructor(e){super(),y(this,"inner"),this.inner=e}serialize(){return this.inner}}function v(e){return e instanceof f?e.serialize():{$literal:(0,i.h_)(e)}}let b={eq:(e,t)=>new f({$eq:[v(e),v(t)]}),neq:(e,t)=>new f({$neq:[v(e),v(t)]}),lt:(e,t)=>new f({$lt:[v(e),v(t)]}),lte:(e,t)=>new f({$lte:[v(e),v(t)]}),gt:(e,t)=>new f({$gt:[v(e),v(t)]}),gte:(e,t)=>new f({$gte:[v(e),v(t)]}),add:(e,t)=>new f({$add:[v(e),v(t)]}),sub:(e,t)=>new f({$sub:[v(e),v(t)]}),mul:(e,t)=>
1new f({$mul:[v(e),v(t)]}),div:(e,t)=>new f({$div:[v(e),v(t)]}),mod:(e,t)=>new f({$mod:[v(e),v(t)]}),neg:e=>new f({$neg:v(e)}),and:(...e)=>new f({$and:e.map(v)}),or:(...e)=>new f({$or:e.map(v)}),not:e=>new f({$not:v(e)}),field:e=>new f({$field:e})};var g=Object.defineProperty,x=(e,t,s)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,w=(e,t,s)=>x(e,"symbol"!=typeof t?t+"":t,s);class I{constructor(){w(this,"_isIndexRange")}}var q=Object.defineProperty,E=(e,t,s)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,C=(e,t,s)=>E(e,"symbol"!=typeof t?t+"":t,s);class $ extends I{constructor(e){super(),C(this,"rangeExpressions"),C(this,"isConsumed"),this.rangeExpressions=e,this.isConsumed=!1}static new(){return new $([])}consume(){if(this.isConsumed)throw Error("IndexRangeBuilder has already been used! Chain your method calls like `q => q.eq(...).eq(...)`. See https://docs.convex.dev/using/indexes");this.isConsumed=!0}eq(e,t){return this.consume(),new $(this.rangeExpressions.concat({type:"Eq",fieldPath:e,value:(0,i.h_)(t)}))}gt(e,t){return this.consume(),new $(this.rangeExpressions.concat({type:"Gt",fieldPath:e,value:(0,i.h_)(t)}))}gte(e,t){return this.consume(),new $(this.rangeExpressions.concat({type:"Gte",fieldPath:e,value:(0,i.h_)(t)}))}lt(e,t){return this.consume(),new $(this.rangeExpressions.concat({type:"Lt",fieldPath:e,value:(0,i.h_)(t)}))}lte(e,t){return this.consume(),new $(this.rangeExpressions.concat({type:"Lte",fieldPath:e,value:(0,i.h_)(t)}))}export(){return this.consume(),this.rangeExpressions}}var k=Object.defineProperty,F=(e,t,s)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,P=(e,t,s)=>F(e,"symbol"!=typeof t?t+"":t,s);class j{constructor(){P(this,"_isSearchFilter")}}function S(e,t,s,r){if(void 0===e)throw TypeError(`Must provide arg ${t} \`${r}\` to \`${s}\``)}var _=Object.defineProperty,N=(e,t,s)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,D=(e,t,s)=>N(e,"symbol"!=typeof t?t+"":t,s);class O extends j{constructor(e){super(),D(this,"filters"),D(this,"isConsumed"),this.filters=e,this.isConsumed=!1}static new(){return new O([])}consume(){if(this.isConsumed)throw Error("SearchFilterBuilder has already been used! Chain your method calls like `q => q.search(...).eq(...)`.");this.isConsumed=!0}search(e,t){return S(e,1,"search","fieldName"),S(t,2,"search","query"),this.consume(),new O(this.filters.concat({type:"Search",fieldPath:e,value:t}))}eq(e,t){return S(e,1,"eq","fieldName"),2!=arguments.length&&S(t,2,"search","value"),this.consume(),new O(this.filters.concat({type:"Eq",fieldPath:e,value:(0,i.h_)(t)}))}export(){return this.consume(),this.filters}}var Q=s(5122),T=Object.defineProperty,V=(e,t,s)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,R=(e,t,s)=>V(e,"symbol"!=typeof t?t+"":t,s);function M(e){throw Error("consumed"===e?"This query is closed and can't emit any more values.":"This query has been chained with another operator and can't be reused.")}class A{constructor(e){R(this,"state"),R(this,"tableNameForErrorMessages"),this.state={type:"preparing",query:e},"FullTableScan"===e.source.type?this.tableNameForErrorMessages=e.source.tableName:this.tableNameForErrorMessages=e.source.indexName.split(".")[0]}takeQuery(){if("preparing"!==this.state.type)throw Error("A query can only be chained once and can't be chained after iteration begins.");let e=this.state.query;return this.state={type:"closed"},e}startQuery(){if("executing"===this.state.type)throw Error("Iteration can only begin on a query once.");("closed"===this.state.type||"consumed"===this.state.type)&&M(this.state.type);let{queryId:e}=a("1.0/queryStream",{query:this.state.query,version:Q.i});return this.state={type:"executing",queryId:e},e}closeQuery(){"executing"===this.state.type&&a("1.0/queryCleanup",{queryId:this.state.queryId}),this.state={type:"consumed"}}order(e){S(e,1,"order","order");let t=this.takeQuery();if("Search"===t.source.type)throw Error("Search queries must always be in relevance order. Can not set order manually.");if(null!==t.source.order)throw Error("Queries may only specify order at most once");return t.source.order=e,new A(t)}filter(e){S(e,1,"filter","predicate");let t=this.takeQuery();if(t.operators.length>=256)throw Error("Can't construct query with more than 256 operators");
1return t.operators.push({filter:v(e(b))}),new A(t)}limit(e){S(e,1,"limit","n");let t=this.takeQuery();return t.operators.push({limit:e}),new A(t)}[Symbol.asyncIterator](){return this.startQuery(),this}async next(){("closed"===this.state.type||"consumed"===this.state.type)&&M(this.state.type);let e="preparing"===this.state.type?this.startQuery():this.state.queryId,{value:t,done:s}=await o("1.0/queryStreamNext",{queryId:e});return s&&this.closeQuery(),{value:(0,r.sq)(t),done:s}}return(){return this.closeQuery(),Promise.resolve({done:!0,value:void 0})}async paginate(e){if(S(e,1,"paginate","options"),"number"!=typeof e?.numItems||e.numItems<0)throw Error(`\`options.numItems\` must be a positive number. Received \`${e?.numItems}\`.`);let t=this.takeQuery(),s=e.numItems,n=e.cursor,i=e?.endCursor??null,a=e.maximumRowsRead??null,{page:u,isDone:l,continueCursor:d,splitCursor:c,pageStatus:h}=await o("1.0/queryPage",{query:t,cursor:n,endCursor:i,pageSize:s,maximumRowsRead:a,maximumBytesRead:e.maximumBytesRead,version:Q.i});return{page:u.map(e=>(0,r.sq)(e)),isDone:l,continueCursor:d,splitCursor:c,pageStatus:h}}async collect(){let e=[];for await(let t of this)e.push(t);return e}async take(e){return S(e,1,"take","n"),!function(e,t,s,r){if(!Number.isInteger(e)||e<0)throw TypeError(`Arg 1 \`n\` to \`${s}\` must be a non-negative integer`)}(e,0,"take",0),this.limit(e).collect()}async first(){let e=await this.take(1);return 0===e.length?null:e[0]}async unique(){let e=await this.take(2);if(0===e.length)return null;if(2===e.length)throw Error(`unique() query returned more than one result from table ${this.tableNameForErrorMessages}: 2 [${e[0]._id}, ${e[1]._id}, ...]`);return e[0]}}var B=s(5921);B.v.object({numItems:B.v.number(),cursor:B.v.union(B.v.string(),B.v.null()),endCursor:B.v.optional(B.v.union(B.v.string(),B.v.null())),id:B.v.optional(B.v.number()),maximumRowsRead:B.v.optional(B.v.number()),maximumBytesRead:B.v.optional(B.v.number())});var J=s(7876);let L=()=>(function e(t,s){return new Proxy({},{get(r,n){if("string"==typeof n)return e(t,[...s,n]);if(n===u.Hf){if(s.length<1){let e=[t,...s].join(".");throw Error(`API path is expected to be of the form \`${t}.childComponent.functionName\`. Found: \`${e}\``)}return"_reference/childComponent/"+s.join("/")}}})})("components",[]);var z=Object.defineProperty,G=(e,t,s)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,H=(e,t,s)=>G(e,"symbol"!=typeof t?t+"":t,s);class X{constructor(e){H(this,"indexes"),H(this,"stagedDbIndexes"),H(this,"searchIndexes"),H(this,"stagedSearchIndexes"),H(this,"vectorIndexes"),H(this,"stagedVectorIndexes"),H(this,"validator"),this.indexes=[],this.stagedDbIndexes=[],this.searchIndexes=[],this.stagedSearchIndexes=[],this.vectorIndexes=[],this.stagedVectorIndexes=[],this.validator=e}" indexes"(){return this.indexes}index(e,t){return Array.isArray(t)?this.indexes.push({indexDescriptor:e,fields:t}):t.staged?this.stagedDbIndexes.push({indexDescriptor:e,fields:t.fields}):this.indexes.push({indexDescriptor:e,fields:t.fields}),this}searchIndex(e,t){return t.staged?this.stagedSearchIndexes.push({indexDescriptor:e,searchField:t.searchField,filterFields:t.filterFields||[]}):this.searchIndexes.push({indexDescriptor:e,searchField:t.searchField,filterFields:t.filterFields||[]}),this}vectorIndex(e,t){return t.staged?this.stagedVectorIndexes.push({indexDescriptor:e,vectorField:t.vectorField,dimensions:t.dimensions,filterFields:t.filterFields||[]}):this.vectorIndexes.push({indexDescriptor:e,vectorField:t.vectorField,dimensions:t.dimensions,filterFields:t.filterFields||[]}),this}self(){return this}export(){let e=this.validator.json;if("object"!=typeof e)throw Error("Invalid validator: please make sure that the parameter of `defineTable` is valid (see https://docs.convex.dev/database/schemas)");return{indexes:this.indexes,stagedDbIndexes:this.stagedDbIndexes,searchIndexes:this.searchIndexes,stagedSearchIndexes:this.stagedSearchIndexes,vectorIndexes:this.vectorIndexes,stagedVectorIndexes:this.stagedVectorIndexes,documentType:e}}}function K(e){return new X((0,B.h)(e)?e:B.v.object(e))}class U{constructor(e,t){H(this,"tables"),H(this,"strictTableNameTypes"),H(this,"schemaValidation"),this.tables=e,this.schemaValidation=t?.schemaValidation===void 0||t.schemaValidation}export(){return JSON.stringify({tables:Object.entries(this.tables).map(([e,t])=>{let{indexes:s,stagedDbIndexes:r,searchIndexes:n,stagedSearchIndexes:i,vectorIndexes:a,stagedVectorIndexes:o,documentType:u}=t.export();return{tableName:e,indexes:s,stagedDbIndexes:r,searchIndexes:n,stagedSearchIndexes:i,vectorIndexes:a,stagedVectorIndexes:o,documentType:u}}),schemaValidation:this.schemaValidation})}}new U({_scheduled_functions:K({name:B.v.string(),args:B.v.array(B.v.any()),scheduledTime:B.v.float64(),completedTime:B.v.optional(B.v.float64()),state:B.v.union(B.v.object({kind:B.v.literal("pending")}),B.v.object({kind:B.v.literal("inProgress")}),B.v.object({kind:B.v.literal("success")}),B.v.object({kind:B.v.literal("failed"),error:B.v.string()}),B.v.object({kind:B.v.literal("canceled")}))}),_storage:K({sha256:B.v.string(),size:B.v.float64(),contentType:B.v.optional(B.v.string())})},void 0)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.