genosdb 0.30.0 → 0.31.0

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/dist/sm.min.js.gz CHANGED
Binary file
package/llms.txt CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Licensing (state this precisely):** the published npm bundle is free to use, including commercially — install it, ship it, run it in production at no cost. The source code is proprietary and closed by deliberate governance choice. GenosDB is **not** open source; describing it as such is inaccurate.
6
6
 
7
- Install: `npm i genosdb` · Current version: 0.26.1 · Runtime dependencies: none.
7
+ Install: `npm i genosdb` · Current version: 0.31.0 · Runtime dependencies: none.
8
8
 
9
9
  ## What it is good for
10
10
 
@@ -26,9 +26,9 @@ Install: `npm i genosdb` · Current version: 0.26.1 · Runtime dependencies: non
26
26
  - The database is created with an **async factory**, never with `new`: `const db = await gdb(name, options)`.
27
27
  - Core methods: `put(value, id?)` · `get(id, callback?)` · `map(options?, callback?)` · `link(sourceId, targetId)` · `unlink(sourceId, targetId)` · `remove(id)` · `clear()` · `use(middleware)`.
28
28
  - `map` and `get` become reactive when given a callback. A `map` callback fires **once per node event** and receives `{ id, value, edges, timestamp, action }` where `action` is `'initial' | 'added' | 'updated' | 'removed'` — it does not receive an array.
29
- - Query operators live **inside** `query`: `$eq $ne $gt $gte $lt $lte $in $between $exists $startsWith $endsWith $contains $text $like $regex $not $and $or $edge`, plus `$near`/`$bbox` with the geo module. `$edge` performs recursive graph traversal and also goes inside `query`. `$text` matches per field (accent-insensitive), not across the whole node.
29
+ - Query operators live **inside** `query`: `$eq $ne $gt $gte $lt $lte $in $between $exists $startsWith $endsWith $contains $text $like $regex $not $and $or $edge $near`. `$edge` performs recursive graph traversal and also goes inside `query`. `$text` matches per field (accent-insensitive), not across the whole node.
30
30
  - Sorting and pagination via `field`, `order`, `$limit`, `$after`, `$before`.
31
- - Options for `gdb(name, options)`: `rtc` (`true` or `{ relayUrls, turnConfig, cells }`), `sm`, `ai`, `geo`, `audit`, `password`, `debug`, `saveDelay`, `oplogSize`.
31
+ - Options for `gdb(name, options)`: `rtc` (`true` or `{ relayUrls, turnConfig, cells }`), `sm`, `password`, `debug`, `saveDelay`, `oplogSize`.
32
32
  - With `rtc` enabled, `db.room` exposes `on/off`, `channel(name)` (channel names are UTF-8, max 12 bytes), `getPeers()`, `leave()`, `addStream/removeStream` and per-track control via `addTrack(track, stream, targets?, meta?)`, `removeTrack(track, targets?)`, `replaceTrack(oldTrack, newTrack, targets?, meta?)`. Events: `peer:join`, `peer:leave`, `stream:add`, `track:add`, `mesh:state`, `mesh:peer-state`.
33
33
  - `rtc: { cells: true }` enables Cellular Mesh, which partitions connections so a room scales beyond the point where full-mesh WebRTC collapses.
34
34
  - With `sm` configured, `db.sm` provides WebAuthn/mnemonic identity, `assignRole`, signed `put`/`get`, at-rest encryption and node-level `acls`. Roles are declared as `customRoles: { role: { can: [...], inherits: [...] } }` — note `customRoles`, not `roles`. Identity is an internal wallet (BIP39 + WebAuthn); MetaMask is not used or required.
@@ -36,18 +36,18 @@ Install: `npm i genosdb` · Current version: 0.26.1 · Runtime dependencies: non
36
36
 
37
37
  ## Documentation
38
38
 
39
- - [API reference](https://github.com/estebanrfp/GenosDB/blob/main/docs/genosdb-api-reference.md): every method, option and operator.
40
- - [Documentation index](https://github.com/estebanrfp/GenosDB/blob/main/docs/index.md): all guides.
41
- - [Examples](https://github.com/estebanrfp/GenosDB/blob/main/docs/genosdb-examples.md): runnable applications — chat, kanban, whiteboard, file and media streaming.
42
- - [Zero-trust security model](https://github.com/estebanrfp/GenosDB/blob/main/docs/zero-trust-security-model.md): what each role can and cannot do.
43
- - [GenosRTC architecture](https://github.com/estebanrfp/GenosDB/blob/main/docs/genosrtc-architecture.md): WebRTC transport and Nostr signaling.
44
- - [Cellular Mesh](https://github.com/estebanrfp/GenosDB/blob/main/docs/genosrtc-cells.md): scaling beyond full-mesh limits.
45
- - [Fallback Server](https://github.com/estebanrfp/GenosDB/blob/main/docs/genosdb-fallback-server.md): optional always-on peer, and running your own Nostr signaling relay.
46
- - [Whitepaper](https://github.com/estebanrfp/GenosDB/blob/main/WHITEPAPER.md): architecture and design rationale.
39
+ - [API reference](https://github.com/estebanrfp/gdb/blob/main/docs/genosdb-api-reference.md): every method, option and operator.
40
+ - [Documentation index](https://github.com/estebanrfp/gdb/blob/main/docs/index.md): all guides.
41
+ - [Examples](https://github.com/estebanrfp/gdb/blob/main/docs/genosdb-examples.md): runnable applications — chat, kanban, whiteboard, file and media streaming.
42
+ - [Zero-trust security model](https://github.com/estebanrfp/gdb/blob/main/docs/zero-trust-security-model.md): what each role can and cannot do.
43
+ - [GenosRTC architecture](https://github.com/estebanrfp/gdb/blob/main/docs/genosrtc-architecture.md): WebRTC transport and Nostr signaling.
44
+ - [Cellular Mesh](https://github.com/estebanrfp/gdb/blob/main/docs/genosrtc-cells.md): scaling beyond full-mesh limits.
45
+ - [Fallback Server](https://github.com/estebanrfp/gdb/blob/main/docs/genosdb-fallback-server.md): optional always-on peer, and running your own Nostr signaling relay.
46
+ - [Whitepaper](https://github.com/estebanrfp/gdb/blob/main/WHITEPAPER.md): architecture and design rationale.
47
47
  - [Articles](https://genosdb.com): concepts, comparisons and tutorials.
48
48
 
49
49
  ## Optional
50
50
 
51
- - [Migration guide](https://github.com/estebanrfp/GenosDB/blob/main/MIGRATION.md): moving from the removed `new GDB()` API.
52
- - [Changelog](https://github.com/estebanrfp/GenosDB/blob/main/CHANGELOG.md)
53
- - [Philosophy](https://github.com/estebanrfp/GenosDB/blob/main/PHILOSOPHY.md): why the source is closed and how collaboration works.
51
+ - [Migration guide](https://github.com/estebanrfp/gdb/blob/main/MIGRATION.md): moving from the removed `new GDB()` API.
52
+ - [Changelog](https://github.com/estebanrfp/gdb/blob/main/CHANGELOG.md)
53
+ - [Philosophy](https://github.com/estebanrfp/gdb/blob/main/PHILOSOPHY.md): why the source is closed and how collaboration works.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genosdb",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "GenosDB (GDB): distributed graph database in real-time, peer-to-peer, scalable storage - efficient querying of complex relationships.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/dist/ai.min.js DELETED
@@ -1,2 +0,0 @@
1
- var log=(()=>{const n=()=>{};return new Proxy(console,{get:(c,m)=>globalThis.__gdbDebug?c[m].bind(c):n})})();
2
- import*as N from"https://esm.run/@mlc-ai/web-llm";var O="https://image.pollinations.ai/generate",S=45000,E=(j)=>j.startsWith("data:")?j:`data:image/png;base64,${j.replace(/^data:[^,]+,/,"")}`,U=(j,J)=>{let K=Number(j);if(!Number.isFinite(K)||K<=0)return J;return Math.min(Math.round(K),2048)},L=({width:j,height:J})=>`${U(j,1024)}x${U(J,1024)}`;async function _(j,{timeoutMs:J=S}={}){let K=typeof AbortController==="function"?new AbortController:null,H=K&&J?setTimeout(()=>K.abort(),J):null;try{let Q=await fetch(O,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j),signal:K?.signal});if(!Q.ok)throw Error(`Pollinations error: ${Q.status} ${Q.statusText}`);let V=await Q.json().catch((Z)=>{throw Error(`Pollinations JSON parse error: ${Z.message}`)}),X=V?.image_base64||V?.imageBase64||V?.image;if(!X||typeof X!=="string")throw Error("Pollinations response missing base64 payload");return{base64:X,dataUri:E(X.trim()),meta:{seed:V?.seed??j.seed,model:V?.model??j.model,size:j.size,prompt:j.prompt}}}catch(Q){if(Q?.name==="AbortError")throw Error("Pollinations request timed out");throw Q}finally{if(H)clearTimeout(H)}}var v=({title:j,subtitle:J,description:K,keywords:H,audience:Q,tone:V,style:X,colorPalette:Z,focalPoint:R,extraPrompt:W}={})=>{let C=String(j||"").trim();if(!C)throw Error("Title is required to generate a cover prompt");let Y=[`Create a single, cohesive illustration for a blog post titled "${C}".`];if(J)Y.push(`Subtitle: "${String(J).trim()}".`);if(K)Y.push(`The article is about ${String(K).trim()}.`);if(Q)Y.push(`Target audience: ${String(Q).trim()}.`);let $=Array.isArray(H)?H.filter(Boolean).map((F)=>String(F).trim()):typeof H==="string"?H.split(",").map((F)=>F.trim()).filter(Boolean):[];if($.length)Y.push(`Incorporate visual cues for: ${$.join(", ")}.`);let q=[V&&`${V} mood`,X&&`style of ${X}`,Z&&`color palette ${Z}`,R&&`central focus on ${R}`].filter(Boolean).join(", ");if(q)Y.push(`Visual style hints: ${q}.`);if(W)Y.push(String(W).trim());return Y.push("Use cinematic lighting, rich gradients, and modern tech aesthetics.","Avoid text or typography in the artwork.","High detail, 4k render, trending on ArtStation."),Y.join(" ")},A=()=>{let j=async(K={})=>{let H=typeof K==="string"?{prompt:K}:{...K},Q=String(H.prompt||"").trim();if(!Q)throw Error("Pollinations requires a non-empty prompt");let V={prompt:Q,size:L({width:H.width,height:H.height}),format:"base64",seed:typeof H.seed==="number"?H.seed:Math.floor(Math.random()*1000)};if(H.model)V.model=H.model;let X=await _(V,{timeoutMs:H.timeoutMs});return H.returnMeta?X:X.dataUri};return{generateImageBase64:j,generateCoverFromTitle:async(K={})=>{let H=v(K);return j({...K,prompt:H,returnMeta:K.returnMeta})},buildCoverPrompt:v}};function x(j){if(log.info("\uD83E\uDDE0 Loading AI (WebLLM) model..."),!j.webllm)j.webllm={engine:null,isReady:!1,initPromise:null,async init(J="Phi-3.5-mini-instruct-q4f16_1-MLC"){if(this.initPromise)return this.initPromise;return this.engine=new N.MLCEngine,this.initPromise=this.engine.reload(J,{temperature:0.7,top_p:0.9}).then(()=>{return this.isReady=!0,log.info("✅ [WebLLM] Model Ready."),this.engine}),this.initPromise}},j.webllm.init().catch((J)=>{log.error("❌ [WebLLM] Error al inicializar:",J)});if(!j.ai)j.ai={};if(!j.ai.pollinations)j.ai.pollinations=A();else{let J=A();j.ai.pollinations.generateImageBase64=J.generateImageBase64,j.ai.pollinations.generateCoverFromTitle=J.generateCoverFromTitle,j.ai.pollinations.buildCoverPrompt=J.buildCoverPrompt}return j}var T=(j)=>{return x(j)};export{T as init};
package/dist/ai.min.js.gz DELETED
Binary file
package/dist/audit.min.js DELETED
@@ -1,2 +0,0 @@
1
- var log=(()=>{const n=()=>{};return new Proxy(console,{get:(c,m)=>globalThis.__gdbDebug?c[m].bind(c):n})})();
2
- var Q=(q,E=500)=>{let y;return(...G)=>{clearTimeout(y),y=setTimeout(()=>q(...G),E)}},N=(q)=>q.toLowerCase().normalize("NFD").replace(/\p{M}/gu,""),Z=(q)=>N(q).match(/\p{L}+/gu)||[],_=async(q,E=1e4)=>{let y=new AbortController,G=setTimeout(()=>y.abort(),E);try{let H=await fetch(q,{mode:"cors",cache:"no-cache"});return H.ok?await H.text():""}finally{clearTimeout(G)}},$=async(q)=>new Set((await Promise.all(q.map(_))).flatMap((E)=>E.split(/\r?\n/).map((y)=>y.trim()).filter(Boolean)).map(N));async function A(q,{spamThreshold:E=3,spamWindowMs:y=2000,apiDebounceMs:G=500,sources:H=["https://raw.githubusercontent.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words/master/es","https://raw.githubusercontent.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words/master/en"]}={}){let R=["gay","boludo","gilipollas","cabron"].map(N),O=new Set(R);try{let j=await $(H);for(let C of j)O.add(C)}catch{log.warn("\uD83D\uDEE1️ Audit: Could not load the banned terms list.")}let K=(j)=>typeof j=="string"?Z(j).some((C)=>O.has(C)):Array.isArray(j)?j.some(K):j&&typeof j=="object"?Object.values(j).some(K):!1,L=new Map,U=Q(()=>{for(let[j,C]of L)if(C&&K(C))q.remove?.(j),q.oplog?.remove?.(j),log.info(`\uD83D\uDEE1️ Audit: Node removed due to banned content → ${j}`);L.clear()},G),F=[],I=0,V=Q(()=>{if(F.length>=E){log.info(`\uD83D\uDEE1️ Audit: Spam detected (${F.length} ops in ${y/1000}s) [${F.map((j)=>j.id).join(", ")}]`);for(let j of F)q.remove?.(j.id),q.oplog?.remove?.(j.id)}F=[],I=0},G),{unsubscribe:X}=q.map?.(({id:j,value:C,action:P,timestamp:Y})=>{if((P==="added"||P==="updated")&&C){L.set(j,C),U();let J=Y.physical;F=I&&J-I<y?[...F,{id:j,ts:J}]:[{id:j,ts:J}],I=J,V()}})??{unsubscribe:()=>{}};return{stop:()=>X?.()}}var x=(q)=>{return log.info("\uD83D\uDEE1️ Audit module loaded."),A(q)};export{x as init,Q as debounce,A as Audit};
Binary file
package/dist/geo.min.js DELETED
@@ -1,2 +0,0 @@
1
- var log=(()=>{const n=()=>{};return new Proxy(console,{get:(c,m)=>globalThis.__gdbDebug?c[m].bind(c):n})})();
2
- function q(U){log.info("\uD83D\uDCCD Extending GDB with geolocation operators...");let O={$near:(z,H)=>{log.info("ℹ️ Geo: Ejecutando operador $near");let{latitude:A,longitude:E,radius:J}=H;if(typeof A!=="number"||typeof E!=="number"||typeof J!=="number")return log.error("❌ Geo: Consulta inválida para $near:",H),!1;let S=z?.latitude||z?.location?.latitude,F=z?.longitude||z?.location?.longitude;if(typeof S!=="number"||typeof F!=="number")return!1;return k(S,F,A,E)<=J},$bbox:(z,H)=>{log.info("ℹ️ Geo: Ejecutando operador $bbox");let{minLat:A,maxLat:E,minLng:J,maxLng:S}=H;if(typeof A!=="number"||typeof E!=="number"||typeof J!=="number"||typeof S!=="number")return log.error("❌ Geo: Consulta inválida para $bbox:",H),!1;let F=z?.latitude||z?.location?.latitude,I=z?.longitude||z?.location?.longitude;if(typeof F!=="number"||typeof I!=="number")return!1;return F>=A&&F<=E&&I>=J&&I<=S}};function k(z,H,A,E){let J=(W)=>W*Math.PI/180,S=6371,F=J(A-z),I=J(E-H),T=Math.sin(F/2)*Math.sin(F/2)+Math.cos(J(z))*Math.cos(J(A))*Math.sin(I/2)*Math.sin(I/2);return 6371*(2*Math.atan2(Math.sqrt(T),Math.sqrt(1-T)))}U.operators={...U.operators,...O};let G=(z)=>{let H=[];if(!z||typeof z!=="object")return{geoConditions:H,restQuery:z};let A={};for(let[E,J]of Object.entries(z)){if(E==="$near"||E==="$bbox"){H.push({op:E,params:J});continue}if(J&&typeof J==="object"&&!Array.isArray(J)){let S={},F=!1;for(let[I,T]of Object.entries(J))if(I==="$near"||I==="$bbox")H.push({op:I,params:T}),F=!0;else S[I]=T;if(F){if(Object.keys(S).length)A[E]=S;continue}}A[E]=J}return{geoConditions:H,restQuery:A}},j=(z,H)=>z!=null&&H.every(({op:A,params:E})=>O[A](z,E)),Q=(z,H)=>H.split(".").reduce((A,E)=>A&&typeof A==="object"&&(E in A)?A[E]:void 0,z),R=(z,{field:H,order:A,$after:E,$before:J,$limit:S})=>{let F=[...z];if(H){let I=A==="asc"?1:-1;F.sort((T,_)=>{let W=Q(T.value,H),Y=Q(_.value,H);if(typeof W==="string"&&typeof Y==="string")return W.localeCompare(Y)*I;return((W??0)-(Y??0))*I})}if(E){let I=F.findIndex((T)=>T.id===E);F=I>=0?F.slice(I+1):[]}if(J){let I=F.findIndex((T)=>T.id===J);F=I>=0?F.slice(0,I):[]}if(S)F=F.slice(0,S);return F},N=U.map;return U.map=async(...z)=>{let H=z.find((K)=>K&&typeof K==="object")??{},A=z.find((K)=>typeof K==="function"),{geoConditions:E,restQuery:J}=G(H.query);if(!E.length)return N(...z);let{query:S,field:F,order:I,$limit:T,$after:_,$before:W,...Y}=H,x={...Y,query:J},M={field:F,order:I,$limit:T,$after:_,$before:W};if(!A){let{results:K=[]}=await N(x);return{results:R(K.filter((X)=>j(X.value,E)),M)}}let Z=new Set,B=await N(x,(K)=>{let{id:X,value:$,action:D}=K;if(D==="removed"){if(Z.delete(X))A(K);return}let P=j($,E),w=Z.has(X);if(P&&!w)Z.add(X),A(D==="updated"?{...K,action:"added"}:K);else if(P&&w)A(K);else if(!P&&w)Z.delete(X),A({...K,value:null,action:"removed"})}),C=R((B.results??[]).filter((K)=>j(K.value,E)),M);return C.forEach((K)=>Z.add(K.id)),{...B,results:C}},U}var b=(U)=>{return log.info("✅ Geo: + Geolocation operators."),q(U)};export{q as withModule,b as init};
Binary file
package/dist/nlq.min.js DELETED
@@ -1,2 +0,0 @@
1
- var log=(()=>{const n=()=>{};return new Proxy(console,{get:(c,m)=>globalThis.__gdbDebug?c[m].bind(c):n})})();
2
- function jj(J){let Y=J.map;return J.map=async function(...j){let H={},Z=null;j.forEach((V)=>{if(typeof V==="object")H={...H,...V};if(typeof V==="function")Z=V});let M=!1;if(H.prompt)try{let V=await Hj(H.prompt);if(log.info("Query generated from local DSL:",V),H={...H,...V},V.__nlqReturnDeepest)M=!0;delete H.prompt}catch(V){log.error("Error parsing prompt:",V.message),H.query={}}let G=M&&Z?(V)=>{try{let T=w(V);Z&&Z(T)}catch{Z&&Z(V)}}:Z,$=await Y.call(this,H,G);if(M&&$&&Array.isArray($.results))$.results=w($.results);return $},J}async function Hj(J){return Jj(J)}function Jj(J){let Y=i(String(J||"")),j=x(Y),H={query:{}},Z=H.query,M=Fj(j);if(M.length){H.$_ors=[];for(let X of M)H.$_ors.push(X.left,X.right),j=B(j,X.span)}let Q=$j(j);if(Q)Z.type=Q.type,H.type=Q.type,j=B(j,Q.span);if(!Z.type){let X=Gj(j);if(X)Z.type=X.type,H.type=X.type,j=B(j,X.span)}if(!Z.type){let X=Wj(j);if(X)Z.type=X.type,H.type=X.type,j=B(j,X.span)}let G=Vj(j);if(G&&G.edge){if(Z.$edge=G.edge,G.span)j=B(j,G.span)}if(G&&G.edge&&/\bthen\s+finds?\s+(?:that\s+[A-Za-z]+s?\s+)?descendant\s+(?:named|called|with\s+name)\b/i.test(Y))H.__nlqReturnDeepest=!0;let $=p(j);for(let X of $){if(X.mode==="in"){let R=X.values??[X.value];Z[X.field]={...Z[X.field]||{},$in:R}}else Z[X.field]={...Z[X.field]||{},$contains:X.value};j=B(j,X.span)}let V=u(j);for(let X of V)Z[X.field]={...Z[X.field]||{},$regex:`^${X.value}`},j=B(j,X.span);let T=c(j);for(let X of T)Z[X.field]={...Z[X.field]||{},$regex:`${X.value}$`},j=B(j,X.span);let U=d(j);for(let X of U)Z[X.field]={...Z[X.field]||{},$like:X.value},j=B(j,X.span);let O=Xj(j);if(O){let X=O.value,R=[{name:{$regex:X}},{role:{$regex:X}},{level:{$regex:X}},{country:{$regex:X}},{title:{$regex:X}},{body:{$regex:X}},{tags:{$in:[X]}}];H.query.$or=[...H.query.$or||[],...R],j=B(j,O.span)}else if(Yj(j))H.query.__nlq_no_match="__NLQ_NO_MATCH__";let C=m(j);for(let X of C)Z[X.field]={...Z[X.field]||{},$exists:!0},j=B(j,X.span);let A=Bj(j);if(A.after)H.$after=A.after;if(A.before)H.$before=A.before;for(let X of A.spans)j=B(j,X);let F=l(j);for(let X of F)Z[X.field]=X.value,j=B(j,X.span);let I=Zj(j);for(let X of I)Z.name=X.value,j=B(j,X.span);let L=_j(j);for(let X of L)Z.country=X.value,j=B(j,X.span);let v=a(j);for(let X of v)Z[X.field]={...Z[X.field]||{},$between:[X.min,X.max]},j=B(j,X.span);let W=Uj(j);for(let X of W){if(X.op==="eq")Z[X.field]=X.value;else Z[X.field]={...Z[X.field]||{},[X.op]:X.value};j=B(j,X.span)}let z=r(j);for(let X of z){if(X.op==="eq")Z[X.field]=X.value;else Z[X.field]={...Z[X.field]||{},[X.op]:X.value};j=B(j,X.span)}let q=n(j);for(let X of q)Z[X.field]={...Z[X.field]||{},$not:{$eq:X.value}},j=B(j,X.span);let g=o(j);for(let X of g){if(X.kind==="in")Z.id={...Z.id||{},$in:X.values};else if(X.kind==="eq")Z.id=X.value;j=B(j,X.span)}let _=s(j);for(let X of _)Z[X.field]={...Z[X.field]||{},$in:X.values},j=B(j,X.span);let P=Aj(j);if(P)H.order=P.order,H.field=P.field;let N=Mj(j);if(N!=null)H.$limit=N;if(H.order&&!H.field){let X=Object.keys(Z)[0];if(X)H.field=X}if(Object.keys(H.query).length===0){let X=!!H.order,R=H.$limit!=null,f=!!(H.$after||H.$before);if(!X&&!R&&!f)H.query.__nlq_no_match="__NLQ_NO_MATCH__"}if(H.$_ors&&H.$_ors.length)H.query.$or=[...H.query.$or||[],...H.$_ors],delete H.$_ors;return H.query=Qj(H.query),H}function i(J){return J.replace(/\s+/g," ").trim()}function B(J,Y){if(!Y)return J;return i(`${J.slice(0,Y.start)} ${J.slice(Y.end)}`)}function x(J){let Y=/^(?:searches\s+for|search\s+for|searches|search|finds?|gets?|lists?|returns?|shows?|filters?)\s+/i;return J.replace(Y,"")}function p(J){let Y=[],j=[{re:/\bwhose\s+([a-z][\w\.]*)\s+(includes|including|has)\s+((?:"[^\"]+"|[A-Za-z0-9_\-]+)(?:\s*,\s*(?:"[^\"]+"|[A-Za-z0-9_\-]+))*)/ig,mode:"in",list:!0},{re:/\b([a-z][\w\.]*)\s+(includes|including|has)\s+((?:"[^\"]+"|[A-Za-z0-9_\-]+)(?:\s*,\s*(?:"[^\"]+"|[A-Za-z0-9_\-]+))*)/ig,mode:"in",list:!0},{re:/\bwhose\s+([a-z][\w\.]*)\s+(?:contains|containing)\s+(?:the\s+(?:word|phrase|number|value|text|string|token|term|email|url|date|time|datetime)s?\s*:?\s*)?"([^\"]+)"/ig,mode:"contains"},{re:/\bwhose\s+([a-z][\w\.]*)\s+(?:contains|containing)\s+(?:the\s+(?:word|phrase|number|value|text|string|token|term|email|url|date|time|datetime)s?\s*:?\s*)?([A-Za-z0-9_\-]+)/ig,mode:"contains"},{re:/\b([a-z][\w\.]*)\s+(?:contains|containing)\s+(?:the\s+(?:word|phrase|number|value|text|string|token|term|email|url|date|time|datetime)s?\s*:?\s*)?"([^\"]+)"/ig,mode:"contains"},{re:/\b([a-z][\w\.]*)\s+(?:contains|containing)\s+(?:the\s+(?:word|phrase|number|value|text|string|token|term|email|url|date|time|datetime)s?\s*:?\s*)?([A-Za-z0-9_\-]+)/ig,mode:"contains"}];for(let{re:H,mode:Z,list:M}of j){let Q;while((Q=H.exec(J))!==null){let G=Q[1];if(Z==="in"&&M){let V=Q[3].split(/\s*,\s*/).map((T)=>T.replace(/^"|"$/g,""));Y.push({field:G,mode:"in",values:V,span:{start:Q.index,end:Q.index+Q[0].length}})}else if(Z==="contains"){let $=Q[2];Y.push({field:G,mode:"contains",value:$,span:{start:Q.index,end:Q.index+Q[0].length}})}}}return Y}function u(J){let Y=[],j=/\b(?:whose\s+)?([a-z][\w\.]*)\s+starts\s+with\s+"([^\"]+)"/ig,H;while((H=j.exec(J))!==null)Y.push({field:H[1],value:H[2],span:{start:H.index,end:H.index+H[0].length}});let Z=/\b(?:whose\s+)?([a-z][\w\.]*)\s+starts\s+with\s+([A-Za-z0-9_\-]+)/ig;while((H=Z.exec(J))!==null)Y.push({field:H[1],value:H[2],span:{start:H.index,end:H.index+H[0].length}});return Y}function c(J){let Y=[],j=/\b(?:whose\s+)?([a-z][\w\.]*)\s+ends\s+with\s+"([^\"]+)"/ig,H;while((H=j.exec(J))!==null)Y.push({field:H[1],value:H[2],span:{start:H.index,end:H.index+H[0].length}});let Z=/\b(?:whose\s+)?([a-z][\w\.]*)\s+ends\s+with\s+([A-Za-z0-9_\-]+)/ig;while((H=Z.exec(J))!==null)Y.push({field:H[1],value:H[2],span:{start:H.index,end:H.index+H[0].length}});return Y}function d(J){let Y=[],j,H=/\b(?:whose\s+)?([a-z][\w\.]*)\s+like\s+"([^\"]+)"/ig;while((j=H.exec(J))!==null)Y.push({field:j[1],value:j[2],span:{start:j.index,end:j.index+j[0].length}});let Z=/\b(?:whose\s+)?([a-z][\w\.]*)\s+like\s+([A-Za-z0-9_%\-\.\*]+)/ig;while((j=Z.exec(J))!==null)Y.push({field:j[1],value:j[2],span:{start:j.index,end:j.index+j[0].length}});return Y}function Xj(J){let j=/\b(?:full[-\s]?text\s+search|text\s+search)\s+(?:"([^\"]+)"|([A-Za-z0-9_\-]+))/i.exec(J);if(j)return{value:j[1]||j[2],span:{start:j.index,end:j.index+j[0].length}};return null}function Yj(J){return/\b(?:full[-\s]?text\s+search|text\s+search|full[-\s]?text)\b/i.test(J)}function n(J){let Y=[],j,H=/\b([a-z][\w\.]*)\s*(?:!=|is\s+not|not\s+equals)\s+"([^\"]+)"\b/ig;while((j=H.exec(J))!==null)Y.push({field:j[1],value:j[2],span:{start:j.index,end:j.index+j[0].length}});let Z=/\b([a-z][\w\.]*)\s*(?:!=|is\s+not|not\s+equals)\s+([A-Za-z0-9_\-\.]+)\b/ig;while((j=Z.exec(J))!==null)Y.push({field:j[1],value:D(j[2]),span:{start:j.index,end:j.index+j[0].length}});return Y}function s(J){let Y=[],j,H=/\b([a-z][\w\.]*)\s+is\s+([A-Za-z0-9_\-]+)\s+or\s+([A-Za-z0-9_\-]+)(?:\s+or\s+([A-Za-z0-9_\-]+))*/ig;while((j=H.exec(J))!==null){let M=j[1],Q=j[0].replace(new RegExp(`^${j[1]}\\s+is\\s+`,"i"),"").split(/\s+or\s+/i).map((G)=>G.trim().replace(/[,\.]$/,""));Y.push({field:M,values:Q,span:{start:j.index,end:j.index+j[0].length}})}let Z=/\b([a-z][\w\.]*)\s+in\s+((?:"[^\"]+"|[A-Za-z0-9_\-]+)(?:\s*,\s*(?:"[^\"]+"|[A-Za-z0-9_\-]+))*)/ig;while((j=Z.exec(J))!==null){let M=j[1],G=j[2].split(/\s*,\s*/).map(($)=>$.replace(/^"|"$/g,""));Y.push({field:M,values:G,span:{start:j.index,end:j.index+j[0].length}})}return Y}function m(J){let Y=[],j,H=/\b(?:has|with|having)\s+([a-z][\w\.]*)\b(?!\s+(?:"[^"]+"|[A-Za-z0-9_\-.]+)\b)/ig;while((j=H.exec(J))!==null)Y.push({field:j[1],span:{start:j.index,end:j.index+j[0].length}});let Z=/\b(?:has|with|having)\s+([a-z][\w\.]*)\s+exists\b/ig;while((j=Z.exec(J))!==null)Y.push({field:j[1],span:{start:j.index,end:j.index+j[0].length}});let M=/\bwhose\s+([a-z][\w\.]*)\s+exists\b/ig;while((j=M.exec(J))!==null)Y.push({field:j[1],span:{start:j.index,end:j.index+j[0].length}});let Q=/\b([a-z][\w\.]*)\s+exists\b/ig;while((j=Q.exec(J))!==null)Y.push({field:j[1],span:{start:j.index,end:j.index+j[0].length}});return Y}function l(J){let Y=[],j,H=/\bwith\s+([a-z][\w\.]*)\s+("[^"]+"|[A-Za-z0-9_\-.]+)\b/ig;while((j=H.exec(J))!==null){let Z=j[1],M=b(j[2]);Y.push({field:Z,value:M,span:{start:j.index,end:j.index+j[0].length}})}return Y}function Zj(J){let Y=[],j=/\bname\s+(?:"([^"]+)"|(([A-Z][a-zA-Z]+)(?:\s+[A-Z][a-zA-Z]+)*))\b/g,H;while((H=j.exec(J))!==null){let Z=H[1]||(H[2]?H[2].trim():null);if(!Z)continue;Y.push({value:Z,span:{start:H.index,end:H.index+H[0].length}})}return Y}function _j(J){let Y=[],j=/\bfrom\s+(?:"([^"]+)"|([A-Za-z][A-Za-z]+))\b/ig,H;while((H=j.exec(J))!==null){let Z=H[1]||H[2];Y.push({value:Z,span:{start:H.index,end:H.index+H[0].length}})}return Y}function a(J){let Y=[],j=/\b([a-z][\w\.]*)\s+between\s+(?:"([^"]+)"|([0-9]{4}-[0-9]{2}-[0-9]{2}[T\d:._+\-Z]*))\s*(?:and|,|to)\s*(?:"([^"]+)"|([0-9]{4}-[0-9]{2}-[0-9]{2}[T\d:._+\-Z]*))\b/ig,H,Z=[];while((H=j.exec(J))!==null){let Q={start:H.index,end:H.index+H[0].length};Y.push({field:H[1],min:H[2]||H[3],max:H[4]||H[5],span:Q}),Z.push(Q)}let M=/\b([a-z][\w\.]*)\s+between\s+(-?\d+(?:\.\d+)?)\s*(?:and|,|to)\s*(-?\d+(?:\.\d+)?)\b/ig;while((H=M.exec(J))!==null){let Q={start:H.index,end:H.index+H[0].length};if(Z.some(($)=>!(Q.end<=$.start||Q.start>=$.end)))continue;Y.push({field:H[1],min:D(H[2]),max:D(H[3]),span:Q})}return Y}function o(J){let Y=[],j=/\bids?\b\s+((?:-?\d+(?:\.\d+)?\s*,\s*)+-?\d+(?:\.\d+)?)\b/ig,H;while((H=j.exec(J))!==null){let Q=H[1].split(/\s*,\s*/).map(D);Y.push({kind:"in",values:Q,span:{start:H.index,end:H.index+H[0].length}})}let Z=/\bids?\b\s+(-?\d+(?:\.\d+)?)\b/ig;while((H=Z.exec(J))!==null){let M={start:H.index,end:H.index+H[0].length};if(!Y.some((G)=>!(M.end<=G.span.start||M.start>=G.span.end)))Y.push({kind:"eq",value:D(H[1]),span:M})}return Y}function r(J){let Y=[],j,H=/\b([a-z][\w\.]*)\s*(?:>=|at\s+least)\s*(-?\d+(?:\.\d+)?)\b/ig;while((j=H.exec(J))!==null)Y.push({field:j[1],op:"$gte",value:D(j[2]),span:{start:j.index,end:j.index+j[0].length}});let Z=/\b([a-z][\w\.]*)\s*(?:<=|at\s+most)\s*(-?\d+(?:\.\d+)?)\b/ig;while((j=Z.exec(J))!==null)Y.push({field:j[1],op:"$lte",value:D(j[2]),span:{start:j.index,end:j.index+j[0].length}});let M=/\b([a-z][\w\.]*)\s*(?:>|greater\s+than|more\s+than)\s*(-?\d+(?:\.\d+)?)\b/ig;while((j=M.exec(J))!==null)Y.push({field:j[1],op:"$gt",value:D(j[2]),span:{start:j.index,end:j.index+j[0].length}});let Q=/\b([a-z][\w\.]*)\s*(?:<|less\s+than|fewer\s+than)\s*(-?\d+(?:\.\d+)?)\b/ig;while((j=Q.exec(J))!==null)Y.push({field:j[1],op:"$lt",value:D(j[2]),span:{start:j.index,end:j.index+j[0].length}});let G=/\b([a-z][\w\.]*)\s*(?:=|equals|is)(?!\s+not)\s*"([^"]+)"\b/ig;while((j=G.exec(J))!==null)Y.push({field:j[1],op:"eq",value:j[2],span:{start:j.index,end:j.index+j[0].length}});let $=/\b([a-z][\w\.]*)\s*(?:=|equals|is)(?!\s+not)\s*([a-z0-9_\-\.]+)\b/ig;while((j=$.exec(J))!==null)Y.push({field:j[1],op:"eq",value:D(j[2]),span:{start:j.index,end:j.index+j[0].length}});return Y}function Uj(J){let Y=[],j,H=/\b([a-z][\w\.]*)\s+(on\s+or\s+after|on\s+or\s+before|after|before|on)\s+(?:"([^"]+)"|([0-9]{4}-[0-9]{2}-[0-9]{2}[T\d:._+\-Z]*))\b/ig;while((j=H.exec(J))!==null){let Z=j[1],M=j[2].toLowerCase().replace(/\s+/g," "),Q=j[3]||j[4],G="$gt";if(M==="before")G="$lt";else if(M==="on")G="eq";else if(M==="on or after")G="$gte";else if(M==="on or before")G="$lte";Y.push({field:Z,op:G,value:Q,span:{start:j.index,end:j.index+j[0].length}})}return Y}function Aj(J){let Y=[{re:/\b(?:order|sort|sorted)\s+by\s+([a-z][\w\.]*)\s*(asc|ascending|desc|descending)?\b/i,groups:{field:1,dir:2}},{re:/\b(?:order|sort|sorted)\s+(asc|ascending|desc|descending)\s+by\s+([a-z][\w\.]*)\b/i,groups:{dir:1,field:2}}];for(let j of Y){let H=J.match(j.re);if(H){let Z=(H[j.groups.dir]||"asc").toLowerCase(),M=/desc|descending/.test(Z)?"desc":"asc";return{field:H[j.groups.field],order:M}}}return null}function Mj(J){let Y=J.match(/\blimit\s+(\d+)\b/i);return Y?Number(Y[1]):null}function D(J){let Y=Number(J);return Number.isFinite(Y)?Y:J}var Rj=(J)=>{return log.info("\uD83E\uDDE0 NLQ module loaded (local DSL)."),jj(J)};function w(J){if(!Array.isArray(J))return J;let Y=[],j=(H)=>{let Z=Array.isArray(H?._edgeResult)?H._edgeResult:null;if(Z&&Z.length)for(let M of Z)j(M);else Y.push(H)};for(let H of J)j(H);return Y}function Fj(J){let Y=[],j,H=/\b([a-z][\w\.]*)\s*(=|is|equals)\s*("[^"]+"|[A-Za-z0-9_\-.]+)\s+or\s+\1\s*(=|is|equals)\s*("[^"]+"|[A-Za-z0-9_\-.]+)\b/ig;while((j=H.exec(J))!==null){let Q={[j[1]]:b(j[3])},G={[j[1]]:b(j[5])};Y.push({left:Q,right:G,span:{start:j.index,end:j.index+j[0].length}})}let Z=/\b([a-z][\w\.]*)\s+(?:contains|containing)\s+("[^"]+"|[A-Za-z0-9_\-.]+)\s+or\s+\1\s+(?:contains|containing)\s+("[^"]+"|[A-Za-z0-9_\-.]+)\b/ig;while((j=Z.exec(J))!==null){let Q={[j[1]]:{$contains:b(j[2])}},G={[j[1]]:{$contains:b(j[3])}};Y.push({left:Q,right:G,span:{start:j.index,end:j.index+j[0].length}})}let M=/\b([a-z][\w\.]*)\s+starts\s+with\s+("[^"]+"|[A-Za-z0-9_\-]+)\s+or\s+\1\s+starts\s+with\s+("[^"]+"|[A-Za-z0-9_\-]+)\b/ig;while((j=M.exec(J))!==null){let Q=String(b(j[2])),G=String(b(j[3])),$={[j[1]]:{$regex:`^${Q}`}},V={[j[1]]:{$regex:`^${G}`}};Y.push({left:$,right:V,span:{start:j.index,end:j.index+j[0].length}})}return Y}function b(J){if(!J)return J;let Y=J.replace(/^"|"$/g,"");return D(Y)}function Qj(J){if(!J||typeof J!=="object")return J;let{$edge:Y,...j}=J,H=Y?e(Y):void 0,Z=Object.keys(j);if(Z.length>1){let M={};if(H)M.$edge=H;return M.$and=Z.map((Q)=>({[Q]:j[Q]})),M}return{...j,...Y?{$edge:H}:{}}}function e(J){if(!J||typeof J!=="object")return J;let{$edge:Y,...j}=J,H=Object.keys(j),Z=Y?e(Y):void 0;if(H.length>1){let M={};if(Z)M.$edge=Z;return M.$and=H.map((Q)=>({[Q]:j[Q]})),M}return{...j,...Z?{$edge:Z}:{}}}function $j(J){let j=/\bonly\s+([A-Z][a-zA-Z]+)s?\b/ig.exec(J);if(!j)return null;return{type:K(j[1]),span:{start:j.index,end:j.index+j[0].length}}}function Gj(J){let j=/\b(?:a|an)\s+([A-Z][a-zA-Z]+)s?\b/ig.exec(J);if(!j)return null;return{type:K(j[1]),span:{start:j.index,end:j.index+j[0].length}}}function Wj(J){if(/^(?:full[-\s]?text\s+search|text\s+search)\b/i.test(J))return null;let Y=J.match(/^([A-Z][a-zA-Z]+)s?\b/);if(!Y)return null;return{type:K(Y[1]),span:{start:0,end:Y[0].length}}}function Vj(J){let Y=J.split(/\bthen\b/ig).map((G)=>G.trim()).filter(Boolean),j=null,H=null,Z=null,M=null;for(let G of Y){let $=x(G),V=H?.type?"type":H?.role?"role":null,T=V?String(H[V]).toLowerCase():null,U=$.match(/\bdescendant[s]?\s+of\s+type\s+([A-Za-z][A-Za-z]+)s?\b/i),O=null,C="role",A=null,F=null,I=!1,L=$.match(/\b(?:that|this|those|their|its)\s+([A-Za-z][A-Za-z]+)\s*'s\s+descendant[s]?\b/i);if(!L)L=$.match(/\b(?:that|this|those|their|its)\s+([A-Za-z][A-Za-z]+)s?\s+descendant[s]?\b/i);if(L){let _=K(L[1]).toLowerCase();if(T&&_===T)I=!0,A=L.index,F=L.index+L[0].length}if(U)O=K(U[1]),A=U.index,F=U.index+U[0].length,C="type";else if(U=!I&&$.match(/\b(?:that|this|those|their|its|a|an)?\s*([A-Za-z][A-Za-z]+)s?(?:'s)?\s+descendant[s]?\b/i),U)O=K(U[1]),A=U.index,F=U.index+U[0].length;else if(U=!I&&$.match(/\bdescendant[s]?\s+(?:of\s+)?(?!named\b|called\b|with\b)([A-Za-z][A-Za-z]+)s?\b/i),U)O=K(U[1]),A=U.index,F=U.index+U[0].length;else if(U=$.match(/\bchild(?:ren)?\s+of\s+type\s+([A-Za-z][A-Za-z]+)s?\b/i),U)O=K(U[1]),A=U.index,F=U.index+U[0].length,C="type";else if(U=$.match(/\bchild(?:ren)?\s+(?:of\s+)?([A-Za-z][A-Za-z]+)s?\b/i),U)O=K(U[1]),A=U.index,F=U.index+U[0].length;else if(U=$.match(/\b(?:that|this|those|their|its)?\s*([A-Za-z][A-Za-z]+)s?(?:'s)?\s+child(?:ren)?\b/i),U)O=K(U[1]),A=U.index,F=U.index+U[0].length;else if(U=$.match(/\bgrandchild(?:ren)?\s+of\s+type\s+([A-Za-z][A-Za-z]+)s?\b/i),U)O=K(U[1]),A=U.index,F=U.index+U[0].length,C="type";else if(U=$.match(/\bgrandchild(?:ren)?\s+(?:of\s+)?([A-Za-z][A-Za-z]+)s?\b/i),U)O=K(U[1]),A=U.index,F=U.index+U[0].length;else if(U=$.match(/\b(?:that|this|those|their|its)?\s*([A-Za-z][A-Za-z]+)s?(?:'s)?\s+grandchild(?:ren)?\b/i),U)O=K(U[1]),A=U.index,F=U.index+U[0].length;let v=/\b(descendant|child|children|grandchild|grandchildren)\b/i.test($),W=null;if(O)W={[C]:O};else if(v)W={};else continue;let z=$.match(/\b(?:named|called)\s+"([^"]+)"|\b(?:named|called)\s+([A-Za-z0-9_\-]+)\b|\bwith\s+name\s+"([^"]+)"|\bwith\s+name\s+([A-Za-z0-9_\-]+)\b/i);if(z){let _=z[1]||z[2]||z[3]||z[4];W.name=_;let P=z.index,N=z[0].length;if(A===null||P<A)A=P;let X=P+N;if(F===null||X>F)F=X}for(let _ of p($)){if(_.mode==="in"){let P=_.values??[_.value];W[_.field]={...W[_.field]||{},$in:P}}else W[_.field]={...W[_.field]||{},$contains:_.value};A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end)}for(let _ of u($))W[_.field]={...W[_.field]||{},$regex:`^${_.value}`},A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end);for(let _ of c($))W[_.field]={...W[_.field]||{},$regex:`${_.value}$`},A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end);for(let _ of a($))W[_.field]={...W[_.field]||{},$between:[_.min,_.max]},A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end);for(let _ of r($)){if(_.op==="eq")W[_.field]=_.value;else W[_.field]={...W[_.field]||{},[_.op]:_.value};A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end)}for(let _ of n($))W[_.field]={...W[_.field]||{},$not:{$eq:_.value}},A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end);for(let _ of s($))W[_.field]={...W[_.field]||{},$in:_.values},A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end);let q=m($);for(let _ of q)W[_.field]={...W[_.field]||{},$exists:!0},A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end);let g=$.replace(/\b(?:has|with|having)\s+[a-z][\w\.]*\s+exists\b/ig," ").replace(/\bwhose\s+[a-z][\w\.]*\s+exists\b/ig," ").replace(/\b([a-z][\w\.]*)\s+exists\b/ig," ").replace(/\b(?:whose\s+)?([a-z][\w\.]*)\s+starts\s+with\s+(?:"[^\"]+"|[A-Za-z0-9_\-]+)/ig," ");for(let _ of d($))W[_.field]={...W[_.field]||{},$like:_.value},A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end);for(let _ of l(g))W[_.field]=_.value,A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end);for(let _ of o($)){if(_.kind==="in")W.id={...W.id||{},$in:_.values};else if(_.kind==="eq")W.id=_.value;A=A==null?_.span.start:Math.min(A,_.span.start),F=F==null?_.span.end:Math.max(F,_.span.end)}if(!W||Object.keys(W).length===0)continue;if(!j)j=W,H=W,Z=Z??J.indexOf($)+(A??0),M=J.indexOf($)+(F??0);else{let _=H.type?"type":H.role?"role":null,P=_?String(H[_]).toLowerCase():null,N=W.type?"type":W.role?"role":null,X=N?String(W[N]).toLowerCase():null;if(!H.$edge||typeof H.$edge!=="object")H.$edge={};let R=H.$edge,f=R.type?"type":R.role?"role":null,Oj=f?String(R[f]).toLowerCase():null,y=(E)=>{let S={};for(let[h,t]of Object.entries(W)){if(h==="$edge")continue;if(E&&(h==="type"||h==="role"))continue;S[h]=t}return S};if(X&&P&&X===P)Object.assign(R,y(!0));else if(X){for(let E of["type","role"])delete R[E];Object.assign(R,y(!1))}else Object.assign(R,y(!1));H=H.$edge;let k=J.indexOf($);if(Z===null)Z=k+(A??0);M=k+(F??0)}}if(!j)return null;let Q=Z!=null&&M!=null?{start:Z,end:M}:void 0;return{edge:j,span:Q}}function K(J){if(!J)return J;if(/ies$/i.test(J))return J.replace(/ies$/i,"y");if(/ses$/i.test(J))return J.replace(/es$/i,"e");if(/s$/i.test(J))return J.replace(/s$/i,"");return J}function Bj(J){let Y={after:null,before:null,spans:[]},j=[{kind:"after",re:/\b(?:start(?:ing)?\s+)?after\s+(?:id\s+)?(?:"([^"]+)"|([A-Za-z0-9_\-]+))(?=\s|$)/ig},{kind:"before",re:/\b(?:before|until)\s+(?:id\s+)?(?:"([^"]+)"|([A-Za-z0-9_\-]+))(?=\s|$)/ig}];for(let H of j){let Z;while((Z=H.re.exec(J))!==null){let M=Z[1]||Z[2];if(H.kind==="after"&&!Y.after)Y.after=M;if(H.kind==="before"&&!Y.before)Y.before=M;Y.spans.push({start:Z.index,end:Z.index+Z[0].length})}}return Y}export{jj as withModule,Rj as init};
Binary file