@milaboratories/pl-model-common 1.15.2 → 1.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import { Branded } from '../branding';
2
+ import { z } from 'zod';
2
3
  /** Handle of locally downloaded blob. This handle is issued only after the
3
4
  * blob's content is downloaded locally, and ready for quick access. */
4
5
  export type LocalBlobHandle = Branded<string, 'LocalBlobHandle'>;
@@ -14,12 +15,19 @@ export interface BlobHandleAndSize<H extends LocalBlobHandle | RemoteBlobHandle
14
15
  readonly size: number;
15
16
  }
16
17
  /** Range in bytes, from should be less or equal than to. */
17
- export type RangeBytes = {
18
+ export declare const RangeBytes: z.ZodObject<{
18
19
  /** Included left border. */
19
- from: number;
20
+ from: z.ZodNumber;
20
21
  /** Excluded right border. */
22
+ to: z.ZodNumber;
23
+ }, "strip", z.ZodTypeAny, {
24
+ from: number;
25
+ to: number;
26
+ }, {
27
+ from: number;
21
28
  to: number;
22
- };
29
+ }>;
30
+ export type RangeBytes = z.infer<typeof RangeBytes>;
23
31
  export declare function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined;
24
32
  export declare function validateRangeBytes(range: RangeBytes, errMsg: string): void;
25
33
  /** Being configured inside the output structure provides information about
@@ -1 +1 @@
1
- {"version":3,"file":"blob.d.ts","sourceRoot":"","sources":["../../src/drivers/blob.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;uEACuE;AACvE,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAEjE;qCACqC;AACrC,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAEnE;0DAC0D;AAC1D,MAAM,WAAW,iBAAiB,CAChC,CAAC,SAAS,eAAe,GAAG,gBAAgB,GAAK,eAAe,GAC9D,gBAAgB;IAEl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AAG,gBAAgB,GAAK,eAAe,GAC9D,gBAAgB;IAElB,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAEnB,0BAA0B;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,4DAA4D;AAC5D,eAAO,MAAM,UAAU;IACrB,4BAA4B;;IAE5B,6BAA6B;;;;;;;;EAE7B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAMnF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAInE;AAED;;;6BAG6B;AAC7B,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAAC;AAExE;;0DAE0D;AAC1D,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;AAE1E,uEAAuE;AACvE,MAAM,WAAW,UAAU;IACzB;;mCAE+B;IAC/B,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACjG"}
@@ -138,7 +138,10 @@ export type AxesId = AxisId[];
138
138
  export declare function getAxisId(spec: AxisSpec): AxisId;
139
139
  /** Extracts axes ids from axes spec array from column spec */
140
140
  export declare function getAxesId(spec: AxesSpec): AxesId;
141
- /** Canonicalizes axis id */
141
+ /**
142
+ * Canonicalizes axis id
143
+ * @deprecated Use {@link canonicalizeJson} instead to preserve type
144
+ */
142
145
  export declare function canonicalizeAxisId(id: AxisId): string;
143
146
  /** Returns whether "match" axis id is compatible with the "query" */
144
147
  export declare function matchAxisId(query: AxisId, target: AxisId): boolean;
@@ -1 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Q,GAAG,MAAM,CAOhD;AAED,8DAA8D;AAC9D,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAErD;AAYD,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAElE"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var G=Object.defineProperty;var Q=(n,e,t)=>e in n?G(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var p=(n,e,t)=>Q(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("canonicalize"),m=require("zod");function Y(n,e){if(!(n==null||e==null))return{from:n,to:e}}function Z(n,e){if(n.from<0||n.to<0||n.from>=n.to)throw new Error(`${e}: invalid bytes range: ${n}`)}function nn(n){return n!==void 0&&n.startsWith("log+live://log/")}function x(n){throw new Error("Unexpected object: "+n)}const C="upload://upload/",V="index://index/";function J(n){return n.startsWith(C)}function O(n){return n.startsWith(V)}function D(n){if(O(n)){const e=n.slice(V.length);return JSON.parse(decodeURIComponent(e)).path}else if(J(n)){const e=n.slice(C.length);return JSON.parse(decodeURIComponent(e)).localPath}x(n)}function en(n){return n.replace(/^.*[\\/]/,"")}function tn(n){return en(D(n))}function rn(n){if(!n||typeof n!="object")return!1;const e=n;if(!("type"in e))return!1;switch(e.type){case"Json":return typeof e.keyLength=="number"&&e.data!==void 0&&typeof e.data=="object";case"JsonPartitioned":return typeof e.partitionKeyLength=="number"&&e.parts!==void 0&&typeof e.parts=="object";case"BinaryPartitioned":return typeof e.partitionKeyLength=="number"&&e.parts!==void 0&&typeof e.parts=="object";default:return!1}}function on(n,e){if(n!==void 0)switch(n.type){case"Json":return n;case"JsonPartitioned":{const t={};for(const[r,o]of Object.entries(n.parts))t[r]=e(o);return{...n,parts:t}}case"BinaryPartitioned":{const t={};for(const[r,o]of Object.entries(n.parts))t[r]={index:e(o.index),values:e(o.values)};return{...n,parts:t}}}}function L(n){if(!n||typeof n!="object")return!1;const e=n;if(!("type"in e))return!1;switch(e.type){case"Json":return typeof e.keyLength=="number"&&Array.isArray(e.data);case"JsonPartitioned":return typeof e.partitionKeyLength=="number"&&Array.isArray(e.parts);case"BinaryPartitioned":return typeof e.partitionKeyLength=="number"&&Array.isArray(e.parts);default:return!1}}function an(n){return L(n)?n.type==="JsonPartitioned"||n.type==="BinaryPartitioned":!1}function sn(n){switch(n.type){case"Json":{const e=Object.entries(n.data).map(([t,r])=>({key:JSON.parse(t),value:r}));return{type:"Json",keyLength:n.keyLength,data:e}}case"JsonPartitioned":{const e=Object.entries(n.parts).map(([t,r])=>({key:JSON.parse(t),value:r}));return{type:"JsonPartitioned",partitionKeyLength:n.partitionKeyLength,parts:e}}case"BinaryPartitioned":{const e=Object.entries(n.parts).map(([t,r])=>({key:JSON.parse(t),value:r}));return{type:"BinaryPartitioned",partitionKeyLength:n.partitionKeyLength,parts:e}}}}function un(n){switch(n.type){case"Json":{const e={};for(const t of n.data)e[JSON.stringify(t.key)]=t.value;return{type:"Json",keyLength:n.keyLength,data:e}}case"JsonPartitioned":{const e={};for(const t of n.parts)e[JSON.stringify(t.key)]=t.value;return{type:"JsonPartitioned",partitionKeyLength:n.partitionKeyLength,parts:e}}case"BinaryPartitioned":{const e={};for(const t of n.parts)e[JSON.stringify(t.key)]=t.value;return{type:"BinaryPartitioned",partitionKeyLength:n.partitionKeyLength,parts:e}}}}function cn(n,e){if(n!==void 0)switch(n.type){case"Json":return n;case"JsonPartitioned":{const t=n.parts.map(r=>({key:r.key,value:e(r.value)}));return{...n,parts:t}}case"BinaryPartitioned":{const t=n.parts.map(r=>({key:r.key,value:{index:e(r.value.index),values:e(r.value.values)}}));return{...n,parts:t}}}}const $=-2147483648,P=-9007199254740991n,fn=NaN,dn=NaN,B=null,F=null;function g(n,e){switch(e){case"Int":return n===$;case"Long":return n===Number(P)||n===P;case"Float":return Number.isNaN(n);case"Double":return Number.isNaN(n);case"String":return n===B;case"Bytes":return n===F;default:throw Error(`unsupported data type: ${e}`)}}function ln(n){if(!v(n))throw new Error(`Expected not-NA PValue, got ${n}`);return n}function v(n,e){if(!e)return typeof n=="string"||typeof n=="number"&&isFinite(n)||typeof n=="bigint";if(g(n,e))return!1;switch(e){case"Int":return typeof n=="number";case"Long":return typeof n=="number"||typeof n=="bigint";case"Float":return typeof n=="number";case"Double":return typeof n=="number";case"String":return typeof n=="string";case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${e}`)}}function R(n,e){if(!e)return n===null||typeof n=="string"||typeof n=="number"||typeof n=="bigint";if(g(n,e))return!0;switch(e){case"Int":return typeof n=="number";case"Long":return typeof n=="number"||typeof n=="bigint";case"Float":return typeof n=="number";case"Double":return typeof n=="number";case"String":return typeof n=="string";case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${e}`)}}function mn(n){if(n===null||typeof n=="string"||typeof n=="number")return n;if(typeof n=="bigint")return{bigint:n.toString()};throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`)}function j(n,e){if(n===null||typeof n=="string"||typeof n=="number"||typeof n=="bigint"){if(e&&!g(n,e)&&!R(n,e))throw new Error(`Unexpected value type, got ${typeof n}, expected ${e}`);return n}if(typeof n=="object"&&n!==null&&"bigint"in n&&typeof n.bigint=="string"){if(e&&e!=="Long")throw new Error(`Unexpected value type, got serialized bigint, expected ${e}`);return BigInt(n.bigint)}throw new Error(`Unsupported type ${typeof n} (value ${n}).`)}function pn(n){if(n=T(n),n===null)throw new Error("Value is null");return n}function T(n){if(n=j(n),n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"){if(!isFinite(n))throw new Error(`Value is not finite (${n})`);return n}if(typeof n=="bigint")return Number(n);throw new Error(`Unexpected value type: ${typeof n}`)}function U(n,e){const t=Math.floor(e/8),r=1<<7-e%8;return(n[t]&r)>0}const K={type:"absent"},_=null;function yn(n){return typeof n=="object"&&n!==null&&n.type==="absent"}function hn(n,e,t={}){if(U(n.absent,e))return t.absent===void 0?K:t.absent;const r=n.data[e],o=n.type;if(g(r,o))return t.na===void 0?_:t.na;switch(o){case"Int":return r;case"Long":return Number(r);case"Float":return r;case"Double":return r;case"String":return r;case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${o}`)}}function gn(n){return{kind:n.kind,valueType:n.valueType,name:n.name,domain:n.domain,parentAxes:n.parentAxes,axesId:N(n.axesSpec)}}function bn(n){return{columnId:n.id,spec:n.spec}}function l(n){const{type:e,name:t,domain:r}=n;return{type:e,name:t,...r&&{domain:r}}}function N(n){return n.map(l)}function Pn(n){return h(l(n))}function wn(n,e){if(n===void 0)return e===void 0;if(e===void 0)return!0;for(const t in e)if(n[t]!==e[t])return!1;return!0}function H(n,e){return n.name===e.name&&wn(n.domain,e.domain)}function An(n,e){return{...n,src:y(n.src,e)}}function y(n,e){switch(n.type){case"column":return{type:"column",column:e(n.column)};case"slicedColumn":return{type:"slicedColumn",column:e(n.column),newId:n.newId,axisFilters:n.axisFilters};case"inlineColumn":return n;case"inner":case"full":return{type:n.type,entries:n.entries.map(t=>y(t,e))};case"outer":return{type:"outer",primary:y(n.primary,e),secondary:n.secondary.map(t=>y(t,e))};default:x(n)}}function M(n){return h(n)}function xn(n){return JSON.parse(n)}function S(n){return h(l(n))}function E(n,e){return JSON.stringify([n,e])}class Nn{constructor(e){p(this,"domains",new Map);p(this,"axes",new Map);p(this,"domainPacks",[]);p(this,"domainPackToAnchor",new Map);this.anchors=e;const t=Object.entries(e);t.sort((r,o)=>r[0].localeCompare(o[0]));for(const[r,o]of t){for(let a=0;a<o.axesSpec.length;a++){const s=o.axesSpec[a],i=S(s);this.axes.set(i,{anchor:r,idx:a})}if(o.domain!==void 0){const a=Object.entries(o.domain);a.sort((s,i)=>s[0].localeCompare(i[0])),this.domainPackToAnchor.set(JSON.stringify(a),r),this.domainPacks.push(a.map(([s])=>s));for(const[s,i]of a){const u=E(s,i);this.domains.set(u,r)}}}}derive(e,t){const r={name:e.name,axes:[]};let o;if(e.domain!==void 0)n:for(const s of this.domainPacks){const i=[];for(const c of s){const d=e.domain[c];if(d!==void 0)i.push([c,d]);else break n}const u=this.domainPackToAnchor.get(JSON.stringify(i));if(u!==void 0){r.domainAnchor=u,o=new Set(s);break}}for(const[s,i]of Object.entries(e.domain??{})){if(o!==void 0&&o.has(s))continue;const u=E(s,i),c=this.domains.get(u);r.domain??(r.domain={}),r.domain[s]=c?{anchor:c}:i}if(r.axes=e.axesSpec.map(s=>{const i=S(s),u=this.axes.get(i);return u===void 0?l(s):u}),!t||t.length===0)return r;const a=[];for(const s of t){const[i,u]=s;if(typeof i=="number"){if(i<0||i>=e.axesSpec.length)throw new Error(`Axis index ${i} is out of bounds (0-${e.axesSpec.length-1})`);a.push([i,u])}else{const c=e.axesSpec.findIndex(d=>d.name===i);if(c===-1)throw new Error(`Axis with name "${i}" not found in the column specification`);a.push([c,u])}}return a.sort((s,i)=>s[0]-i[0]),{source:r,axisFilters:a}}deriveS(e,t){return M(this.derive(e,t))}}function kn(n,e,t){const r={...e},o=(t==null?void 0:t.ignoreMissingDomains)??!1;if(r.domainAnchor!==void 0){const a=n[r.domainAnchor];if(!a)throw new Error(`Anchor "${r.domainAnchor}" not found`);const s=a.domain||{};r.domain={...s,...r.domain},delete r.domainAnchor}if(r.domain){const a={};for(const[s,i]of Object.entries(r.domain))if(typeof i=="string")a[s]=i;else{const u=n[i.anchor];if(!u)throw new Error(`Anchor "${i.anchor}" not found for domain key "${s}"`);if(!u.domain||u.domain[s]===void 0){if(!o)throw new Error(`Domain key "${s}" not found in anchor "${i.anchor}"`);continue}a[s]=u.domain[s]}r.domain=a}return r.axes&&(r.axes=r.axes.map(a=>In(n,a))),r}function In(n,e){if(!Sn(e))return e;const t=e.anchor,r=n[t];if(!r)throw new Error(`Anchor "${t}" not found for axis reference`);if("idx"in e){if(e.idx<0||e.idx>=r.axesSpec.length)throw new Error(`Axis index ${e.idx} out of bounds for anchor "${t}"`);return r.axesSpec[e.idx]}else if("name"in e){const o=r.axesSpec.filter(a=>a.name===e.name);if(o.length>1)throw new Error(`Multiple axes with name "${e.name}" found in anchor "${t}"`);if(o.length===0)throw new Error(`Axis with name "${e.name}" not found in anchor "${t}"`);return o[0]}else if("id"in e){const o=r.axesSpec.filter(a=>H(e.id,l(a)));if(o.length>1)throw new Error(`Multiple matching axes found for matcher in anchor "${t}"`);if(o.length===0)throw new Error(`No matching axis found for matcher in anchor "${t}"`);return o[0]}throw new Error("Unsupported axis reference type")}function Sn(n){return typeof n=="object"&&"anchor"in n}function En(n){return typeof n=="object"&&n!==null&&"source"in n&&"axisFilters"in n}function f(n){return n.kind==="PColumn"}function z(n){return f(n.spec)}function Cn(n){return f(n.obj)}function Vn(n){return f(n.obj.spec)}function Jn(n){if(!z(n))throw new Error(`not a PColumn (kind = ${n.spec.kind})`);return n}function On(n,e){return n===void 0?void 0:{...n,data:e(n.data)}}function Dn(n){const e=new Map,t=r=>{switch(r.type){case"column":e.set(r.column.id,r.column);return;case"slicedColumn":e.set(r.column.id,r.column);return;case"inlineColumn":return;case"full":case"inner":for(const o of r.entries)t(o);return;case"outer":t(r.primary);for(const o of r.secondary)t(o);return;default:x(r)}};return t(n),[...e.values()]}function Ln(n){throw new Error("Unexpected object: "+n)}function b(n,e){switch(n.type){case"and":for(const t of n.operands)if(!b(t,e))return!1;return!0;case"or":for(const t of n.operands)if(b(t,e))return!0;return!1;case"not":return!b(n.operand,e);case"name":return f(e)&&e.name===n.name;case"name_pattern":return f(e)&&!!e.name.match(n.pattern);case"annotation":return f(e)&&e.annotations!==void 0&&e.annotations[n.annotation]===n.value;case"annotation_pattern":return f(e)&&e.annotations!==void 0&&e.annotations[n.annotation]!==void 0&&!!e.annotations[n.annotation].match(n.pattern);case"has_axes":return f(e)&&n.axes.every(t=>e.axesSpec.some(r=>(t.type===void 0||t.type===r.type)&&(t.name===void 0||t.name===r.name)&&(t.domain===void 0||Object.keys(t.domain).length===0||r.domain!==void 0&&Object.entries(t.domain).every(([o,a])=>r.domain[o]===a))));default:Ln(n)}}function w(n,e){if(n.name!==void 0&&n.name!==e.name)return!1;if(n.type!==void 0){if(Array.isArray(n.type)){if(!n.type.includes(e.type))return!1}else if(n.type!==e.type)return!1}if(n.domain!==void 0){const t=e.domain||{};for(const[r,o]of Object.entries(n.domain))if(t[r]!==o)return!1}return!0}function A(n,e){if(e.name!==void 0&&n.name!==e.name||e.namePattern!==void 0&&!new RegExp(e.namePattern).test(n.name))return!1;if(e.type!==void 0){if(Array.isArray(e.type)){if(!e.type.includes(n.valueType))return!1}else if(e.type!==n.valueType)return!1}if(e.domain!==void 0){const t=n.domain||{};for(const[r,o]of Object.entries(e.domain))if(t[r]!==o)return!1}if(e.axes!==void 0){const t=n.axesSpec.map(l);if(e.partialAxesMatch){for(const r of e.axes)if(!t.some(o=>w(r,o)))return!1}else{if(t.length!==e.axes.length)return!1;for(let r=0;r<e.axes.length;r++)if(!w(e.axes[r],t[r]))return!1}}if(e.annotations!==void 0){const t=n.annotations||{};for(const[r,o]of Object.entries(e.annotations))if(t[r]!==o)return!1}if(e.annotationPatterns!==void 0){const t=n.annotations||{};for(const[r,o]of Object.entries(e.annotationPatterns)){const a=t[r];if(a===void 0||!new RegExp(o).test(a))return!1}}return!0}function $n(n){return Array.isArray(n)?e=>n.some(t=>f(e)&&A(e,t)):e=>f(e)&&A(e,n)}function Bn(n){const e={kind:n.kind,name:n.name};return n.domain!==void 0&&(e.domain=n.domain),f(n)&&(e.axesSpec=N(n.axesSpec)),h(e)}const Fn={href:"/"},vn=m.z.object({__isRef:m.z.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:m.z.string().describe("Upstream block id"),name:m.z.string().describe("Name of the output provided to the upstream block's output context"),requireEnrichments:m.z.literal(!0).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").readonly();function Rn(n){return typeof n=="object"&&n!==null&&"__isRef"in n&&n.__isRef===!0&&"blockId"in n&&"name"in n}function jn(n,e,t=!1){return t?{__isRef:!0,blockId:n,name:e,requireEnrichments:!0}:{__isRef:!0,blockId:n,name:e}}function Tn(n,e=!0){if(e)return{...n,requireEnrichments:!0};{const{requireEnrichments:t,...r}=n;return r}}function Un(n,e,t=!1){return n.blockId===e.blockId&&n.name===e.name&&(t||n.requireEnrichments===e.requireEnrichments)}function Kn(n,e){return n.ok?{ok:!0,value:e(n.value)}:n}function _n(n){if(n instanceof Int8Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray)return new DataView(n.buffer,n.byteOffset,n.byteLength);if(n instanceof ArrayBuffer)return new DataView(n);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")}const Hn="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",Mn="0123456789ABCDEFGHIJKLMNOPQRSTUV",zn="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function q(n,e,t){t=t||{};let r,o;switch(e){case"RFC3548":case"RFC4648":r=Hn,o=!0;break;case"RFC4648-HEX":r=Mn,o=!0;break;case"Crockford":r=zn,o=!1;break;default:throw new Error("Unknown base32 variant: "+String(e))}const a=t.padding!==void 0?t.padding:o,s=_n(n);let i=0,u=0,c="";for(let d=0;d<s.byteLength;d++)for(u=u<<8|s.getUint8(d),i+=8;i>=5;)c+=r[u>>>i-5&31],i-=5;if(i>0&&(c+=r[u<<5-i&31]),a)for(;c.length%8!==0;)c+="=";return c}const k=15,W=24,I=m.z.string().length(W).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");function qn(){const n=new Uint8Array(k);return crypto.getRandomValues(n),I.parse(q(n,"RFC4648"))}function X(n){if(n.length!==k)throw new Error(`Wrong number of bytes: ${n.length}`);return I.parse(q(n,"RFC4648"))}async function Wn(n){const e=new TextEncoder,t=await crypto.subtle.digest("SHA-256",e.encode(n));return X(new Uint8Array(t.slice(0,15)))}function Xn(n){return JSON.stringify(n)}function Gn(n){return h(n)}function Qn(n){return JSON.parse(n)}exports.AnchoredIdDeriver=Nn;exports.DefaultNavigationState=Fn;exports.PTableAbsent=K;exports.PTableNA=_;exports.PValueBytesNA=F;exports.PValueDoubleNA=dn;exports.PValueFloatNA=fn;exports.PValueIntNA=$;exports.PValueLongNA=P;exports.PValueStringNA=B;exports.PlId=I;exports.PlIdBytes=k;exports.PlIdLength=W;exports.PlRef=vn;exports.canonicalizeAxisId=Pn;exports.canonicalizeJson=Gn;exports.createPlRef=jn;exports.dataInfoToEntries=sn;exports.deriveNativeId=Bn;exports.digestPlId=Wn;exports.ensureNotNAPValue=ln;exports.ensurePColumn=Jn;exports.entriesToDataInfo=un;exports.executePSpecPredicate=b;exports.extractAllColumns=Dn;exports.getAxesId=N;exports.getAxisId=l;exports.getColumnIdAndSpec=bn;exports.getFileNameFromHandle=tn;exports.getFilePathFromHandle=D;exports.getPColumnSpecId=gn;exports.isDataInfo=rn;exports.isDataInfoEntries=L;exports.isFilteredPColumn=En;exports.isImportFileHandleIndex=O;exports.isImportFileHandleUpload=J;exports.isLiveLog=nn;exports.isNotNAPValue=v;exports.isPColumn=z;exports.isPColumnResult=Vn;exports.isPColumnSpec=f;exports.isPColumnSpecResult=Cn;exports.isPTableAbsent=yn;exports.isPValue=R;exports.isPartitionedDataInfoEntries=an;exports.isPlRef=Rn;exports.isValueAbsent=U;exports.isValueNA=g;exports.mapDataInfo=on;exports.mapDataInfoEntries=cn;exports.mapJoinEntry=y;exports.mapPObjectData=On;exports.mapPTableDef=An;exports.mapValueInVOE=Kn;exports.matchAxis=w;exports.matchAxisId=H;exports.matchPColumn=A;exports.newRangeBytesOpt=Y;exports.pTableValue=hn;exports.pValueToStringOrNumber=pn;exports.pValueToStringOrNumberOrNull=T;exports.parseColumnId=xn;exports.parseJson=Qn;exports.plId=X;exports.plRefsEqual=Un;exports.resolveAnchors=kn;exports.safeConvertToPValue=j;exports.selectorsToPredicate=$n;exports.stringifyColumnId=M;exports.stringifyJson=Xn;exports.toJsonSafePValue=mn;exports.uniquePlId=qn;exports.validateRangeBytes=Z;exports.withEnrichments=Tn;
1
+ "use strict";var G=Object.defineProperty;var Q=(n,e,t)=>e in n?G(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var p=(n,e,t)=>Q(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("zod"),h=require("canonicalize"),Y=d.z.object({from:d.z.number(),to:d.z.number()});function Z(n,e){if(!(n==null||e==null))return{from:n,to:e}}function nn(n,e){if(n.from<0||n.to<0||n.from>=n.to)throw new Error(`${e}: invalid bytes range: ${n}`)}function en(n){return n!==void 0&&n.startsWith("log+live://log/")}function x(n){throw new Error("Unexpected object: "+n)}const C="upload://upload/",V="index://index/";function O(n){return n.startsWith(C)}function J(n){return n.startsWith(V)}function D(n){if(J(n)){const e=n.slice(V.length);return JSON.parse(decodeURIComponent(e)).path}else if(O(n)){const e=n.slice(C.length);return JSON.parse(decodeURIComponent(e)).localPath}x(n)}function tn(n){return n.replace(/^.*[\\/]/,"")}function rn(n){return tn(D(n))}function on(n){if(!n||typeof n!="object")return!1;const e=n;if(!("type"in e))return!1;switch(e.type){case"Json":return typeof e.keyLength=="number"&&e.data!==void 0&&typeof e.data=="object";case"JsonPartitioned":return typeof e.partitionKeyLength=="number"&&e.parts!==void 0&&typeof e.parts=="object";case"BinaryPartitioned":return typeof e.partitionKeyLength=="number"&&e.parts!==void 0&&typeof e.parts=="object";default:return!1}}function an(n,e){if(n!==void 0)switch(n.type){case"Json":return n;case"JsonPartitioned":{const t={};for(const[r,o]of Object.entries(n.parts))t[r]=e(o);return{...n,parts:t}}case"BinaryPartitioned":{const t={};for(const[r,o]of Object.entries(n.parts))t[r]={index:e(o.index),values:e(o.values)};return{...n,parts:t}}}}function B(n){if(!n||typeof n!="object")return!1;const e=n;if(!("type"in e))return!1;switch(e.type){case"Json":return typeof e.keyLength=="number"&&Array.isArray(e.data);case"JsonPartitioned":return typeof e.partitionKeyLength=="number"&&Array.isArray(e.parts);case"BinaryPartitioned":return typeof e.partitionKeyLength=="number"&&Array.isArray(e.parts);default:return!1}}function sn(n){return B(n)?n.type==="JsonPartitioned"||n.type==="BinaryPartitioned":!1}function un(n){switch(n.type){case"Json":{const e=Object.entries(n.data).map(([t,r])=>({key:JSON.parse(t),value:r}));return{type:"Json",keyLength:n.keyLength,data:e}}case"JsonPartitioned":{const e=Object.entries(n.parts).map(([t,r])=>({key:JSON.parse(t),value:r}));return{type:"JsonPartitioned",partitionKeyLength:n.partitionKeyLength,parts:e}}case"BinaryPartitioned":{const e=Object.entries(n.parts).map(([t,r])=>({key:JSON.parse(t),value:r}));return{type:"BinaryPartitioned",partitionKeyLength:n.partitionKeyLength,parts:e}}}}function cn(n){switch(n.type){case"Json":{const e={};for(const t of n.data)e[JSON.stringify(t.key)]=t.value;return{type:"Json",keyLength:n.keyLength,data:e}}case"JsonPartitioned":{const e={};for(const t of n.parts)e[JSON.stringify(t.key)]=t.value;return{type:"JsonPartitioned",partitionKeyLength:n.partitionKeyLength,parts:e}}case"BinaryPartitioned":{const e={};for(const t of n.parts)e[JSON.stringify(t.key)]=t.value;return{type:"BinaryPartitioned",partitionKeyLength:n.partitionKeyLength,parts:e}}}}function fn(n,e){if(n!==void 0)switch(n.type){case"Json":return n;case"JsonPartitioned":{const t=n.parts.map(r=>({key:r.key,value:e(r.value)}));return{...n,parts:t}}case"BinaryPartitioned":{const t=n.parts.map(r=>({key:r.key,value:{index:e(r.value.index),values:e(r.value.values)}}));return{...n,parts:t}}}}const L=-2147483648,P=-9007199254740991n,dn=NaN,ln=NaN,$=null,F=null;function g(n,e){switch(e){case"Int":return n===L;case"Long":return n===Number(P)||n===P;case"Float":return Number.isNaN(n);case"Double":return Number.isNaN(n);case"String":return n===$;case"Bytes":return n===F;default:throw Error(`unsupported data type: ${e}`)}}function mn(n){if(!j(n))throw new Error(`Expected not-NA PValue, got ${n}`);return n}function j(n,e){if(!e)return typeof n=="string"||typeof n=="number"&&isFinite(n)||typeof n=="bigint";if(g(n,e))return!1;switch(e){case"Int":return typeof n=="number";case"Long":return typeof n=="number"||typeof n=="bigint";case"Float":return typeof n=="number";case"Double":return typeof n=="number";case"String":return typeof n=="string";case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${e}`)}}function R(n,e){if(!e)return n===null||typeof n=="string"||typeof n=="number"||typeof n=="bigint";if(g(n,e))return!0;switch(e){case"Int":return typeof n=="number";case"Long":return typeof n=="number"||typeof n=="bigint";case"Float":return typeof n=="number";case"Double":return typeof n=="number";case"String":return typeof n=="string";case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${e}`)}}function pn(n){if(n===null||typeof n=="string"||typeof n=="number")return n;if(typeof n=="bigint")return{bigint:n.toString()};throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`)}function v(n,e){if(n===null||typeof n=="string"||typeof n=="number"||typeof n=="bigint"){if(e&&!g(n,e)&&!R(n,e))throw new Error(`Unexpected value type, got ${typeof n}, expected ${e}`);return n}if(typeof n=="object"&&n!==null&&"bigint"in n&&typeof n.bigint=="string"){if(e&&e!=="Long")throw new Error(`Unexpected value type, got serialized bigint, expected ${e}`);return BigInt(n.bigint)}throw new Error(`Unsupported type ${typeof n} (value ${n}).`)}function yn(n){if(n=T(n),n===null)throw new Error("Value is null");return n}function T(n){if(n=v(n),n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"){if(!isFinite(n))throw new Error(`Value is not finite (${n})`);return n}if(typeof n=="bigint")return Number(n);throw new Error(`Unexpected value type: ${typeof n}`)}function U(n,e){const t=Math.floor(e/8),r=1<<7-e%8;return(n[t]&r)>0}const K={type:"absent"},_=null;function hn(n){return typeof n=="object"&&n!==null&&n.type==="absent"}function gn(n,e,t={}){if(U(n.absent,e))return t.absent===void 0?K:t.absent;const r=n.data[e],o=n.type;if(g(r,o))return t.na===void 0?_:t.na;switch(o){case"Int":return r;case"Long":return Number(r);case"Float":return r;case"Double":return r;case"String":return r;case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${o}`)}}function bn(n){return{kind:n.kind,valueType:n.valueType,name:n.name,domain:n.domain,parentAxes:n.parentAxes,axesId:N(n.axesSpec)}}function Pn(n){return{columnId:n.id,spec:n.spec}}function m(n){const{type:e,name:t,domain:r}=n,o={type:e,name:t};return r&&Object.entries(r).length>0&&Object.assign(o,{domain:r}),o}function N(n){return n.map(m)}function wn(n){return h(m(n))}function An(n,e){if(n===void 0)return e===void 0;if(e===void 0)return!0;for(const t in e)if(n[t]!==e[t])return!1;return!0}function z(n,e){return n.name===e.name&&An(n.domain,e.domain)}function xn(n,e){return{...n,src:y(n.src,e)}}function y(n,e){switch(n.type){case"column":return{type:"column",column:e(n.column)};case"slicedColumn":return{type:"slicedColumn",column:e(n.column),newId:n.newId,axisFilters:n.axisFilters};case"inlineColumn":return n;case"inner":case"full":return{type:n.type,entries:n.entries.map(t=>y(t,e))};case"outer":return{type:"outer",primary:y(n.primary,e),secondary:n.secondary.map(t=>y(t,e))};default:x(n)}}function H(n){return h(n)}function Nn(n){return JSON.parse(n)}function S(n){return h(m(n))}function E(n,e){return JSON.stringify([n,e])}class kn{constructor(e){p(this,"domains",new Map);p(this,"axes",new Map);p(this,"domainPacks",[]);p(this,"domainPackToAnchor",new Map);this.anchors=e;const t=Object.entries(e);t.sort((r,o)=>r[0].localeCompare(o[0]));for(const[r,o]of t){for(let a=0;a<o.axesSpec.length;a++){const s=o.axesSpec[a],i=S(s);this.axes.set(i,{anchor:r,idx:a})}if(o.domain!==void 0){const a=Object.entries(o.domain);a.sort((s,i)=>s[0].localeCompare(i[0])),this.domainPackToAnchor.set(JSON.stringify(a),r),this.domainPacks.push(a.map(([s])=>s));for(const[s,i]of a){const u=E(s,i);this.domains.set(u,r)}}}}derive(e,t){const r={name:e.name,axes:[]};let o;if(e.domain!==void 0)n:for(const s of this.domainPacks){const i=[];for(const c of s){const l=e.domain[c];if(l!==void 0)i.push([c,l]);else break n}const u=this.domainPackToAnchor.get(JSON.stringify(i));if(u!==void 0){r.domainAnchor=u,o=new Set(s);break}}for(const[s,i]of Object.entries(e.domain??{})){if(o!==void 0&&o.has(s))continue;const u=E(s,i),c=this.domains.get(u);r.domain??(r.domain={}),r.domain[s]=c?{anchor:c}:i}if(r.axes=e.axesSpec.map(s=>{const i=S(s),u=this.axes.get(i);return u===void 0?m(s):u}),!t||t.length===0)return r;const a=[];for(const s of t){const[i,u]=s;if(typeof i=="number"){if(i<0||i>=e.axesSpec.length)throw new Error(`Axis index ${i} is out of bounds (0-${e.axesSpec.length-1})`);a.push([i,u])}else{const c=e.axesSpec.findIndex(l=>l.name===i);if(c===-1)throw new Error(`Axis with name "${i}" not found in the column specification`);a.push([c,u])}}return a.sort((s,i)=>s[0]-i[0]),{source:r,axisFilters:a}}deriveS(e,t){return H(this.derive(e,t))}}function In(n,e,t){const r={...e},o=(t==null?void 0:t.ignoreMissingDomains)??!1;if(r.domainAnchor!==void 0){const a=n[r.domainAnchor];if(!a)throw new Error(`Anchor "${r.domainAnchor}" not found`);const s=a.domain||{};r.domain={...s,...r.domain},delete r.domainAnchor}if(r.domain){const a={};for(const[s,i]of Object.entries(r.domain))if(typeof i=="string")a[s]=i;else{const u=n[i.anchor];if(!u)throw new Error(`Anchor "${i.anchor}" not found for domain key "${s}"`);if(!u.domain||u.domain[s]===void 0){if(!o)throw new Error(`Domain key "${s}" not found in anchor "${i.anchor}"`);continue}a[s]=u.domain[s]}r.domain=a}return r.axes&&(r.axes=r.axes.map(a=>Sn(n,a))),r}function Sn(n,e){if(!En(e))return e;const t=e.anchor,r=n[t];if(!r)throw new Error(`Anchor "${t}" not found for axis reference`);if("idx"in e){if(e.idx<0||e.idx>=r.axesSpec.length)throw new Error(`Axis index ${e.idx} out of bounds for anchor "${t}"`);return r.axesSpec[e.idx]}else if("name"in e){const o=r.axesSpec.filter(a=>a.name===e.name);if(o.length>1)throw new Error(`Multiple axes with name "${e.name}" found in anchor "${t}"`);if(o.length===0)throw new Error(`Axis with name "${e.name}" not found in anchor "${t}"`);return o[0]}else if("id"in e){const o=r.axesSpec.filter(a=>z(e.id,m(a)));if(o.length>1)throw new Error(`Multiple matching axes found for matcher in anchor "${t}"`);if(o.length===0)throw new Error(`No matching axis found for matcher in anchor "${t}"`);return o[0]}throw new Error("Unsupported axis reference type")}function En(n){return typeof n=="object"&&"anchor"in n}function Cn(n){return typeof n=="object"&&n!==null&&"source"in n&&"axisFilters"in n}function f(n){return n.kind==="PColumn"}function M(n){return f(n.spec)}function Vn(n){return f(n.obj)}function On(n){return f(n.obj.spec)}function Jn(n){if(!M(n))throw new Error(`not a PColumn (kind = ${n.spec.kind})`);return n}function Dn(n,e){return n===void 0?void 0:{...n,data:e(n.data)}}function Bn(n){const e=new Map,t=r=>{switch(r.type){case"column":e.set(r.column.id,r.column);return;case"slicedColumn":e.set(r.column.id,r.column);return;case"inlineColumn":return;case"full":case"inner":for(const o of r.entries)t(o);return;case"outer":t(r.primary);for(const o of r.secondary)t(o);return;default:x(r)}};return t(n),[...e.values()]}function Ln(n){throw new Error("Unexpected object: "+n)}function b(n,e){switch(n.type){case"and":for(const t of n.operands)if(!b(t,e))return!1;return!0;case"or":for(const t of n.operands)if(b(t,e))return!0;return!1;case"not":return!b(n.operand,e);case"name":return f(e)&&e.name===n.name;case"name_pattern":return f(e)&&!!e.name.match(n.pattern);case"annotation":return f(e)&&e.annotations!==void 0&&e.annotations[n.annotation]===n.value;case"annotation_pattern":return f(e)&&e.annotations!==void 0&&e.annotations[n.annotation]!==void 0&&!!e.annotations[n.annotation].match(n.pattern);case"has_axes":return f(e)&&n.axes.every(t=>e.axesSpec.some(r=>(t.type===void 0||t.type===r.type)&&(t.name===void 0||t.name===r.name)&&(t.domain===void 0||Object.keys(t.domain).length===0||r.domain!==void 0&&Object.entries(t.domain).every(([o,a])=>r.domain[o]===a))));default:Ln(n)}}function w(n,e){if(n.name!==void 0&&n.name!==e.name)return!1;if(n.type!==void 0){if(Array.isArray(n.type)){if(!n.type.includes(e.type))return!1}else if(n.type!==e.type)return!1}if(n.domain!==void 0){const t=e.domain||{};for(const[r,o]of Object.entries(n.domain))if(t[r]!==o)return!1}return!0}function A(n,e){if(e.name!==void 0&&n.name!==e.name||e.namePattern!==void 0&&!new RegExp(e.namePattern).test(n.name))return!1;if(e.type!==void 0){if(Array.isArray(e.type)){if(!e.type.includes(n.valueType))return!1}else if(e.type!==n.valueType)return!1}if(e.domain!==void 0){const t=n.domain||{};for(const[r,o]of Object.entries(e.domain))if(t[r]!==o)return!1}if(e.axes!==void 0){const t=n.axesSpec.map(m);if(e.partialAxesMatch){for(const r of e.axes)if(!t.some(o=>w(r,o)))return!1}else{if(t.length!==e.axes.length)return!1;for(let r=0;r<e.axes.length;r++)if(!w(e.axes[r],t[r]))return!1}}if(e.annotations!==void 0){const t=n.annotations||{};for(const[r,o]of Object.entries(e.annotations))if(t[r]!==o)return!1}if(e.annotationPatterns!==void 0){const t=n.annotations||{};for(const[r,o]of Object.entries(e.annotationPatterns)){const a=t[r];if(a===void 0||!new RegExp(o).test(a))return!1}}return!0}function $n(n){return Array.isArray(n)?e=>n.some(t=>f(e)&&A(e,t)):e=>f(e)&&A(e,n)}function Fn(n){const e={kind:n.kind,name:n.name};return n.domain!==void 0&&(e.domain=n.domain),f(n)&&(e.axesSpec=N(n.axesSpec)),h(e)}const jn={href:"/"},Rn=d.z.object({__isRef:d.z.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:d.z.string().describe("Upstream block id"),name:d.z.string().describe("Name of the output provided to the upstream block's output context"),requireEnrichments:d.z.literal(!0).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").readonly();function vn(n){return typeof n=="object"&&n!==null&&"__isRef"in n&&n.__isRef===!0&&"blockId"in n&&"name"in n}function Tn(n,e,t=!1){return t?{__isRef:!0,blockId:n,name:e,requireEnrichments:!0}:{__isRef:!0,blockId:n,name:e}}function Un(n,e=!0){if(e)return{...n,requireEnrichments:!0};{const{requireEnrichments:t,...r}=n;return r}}function Kn(n,e,t=!1){return n.blockId===e.blockId&&n.name===e.name&&(t||n.requireEnrichments===e.requireEnrichments)}function _n(n,e){return n.ok?{ok:!0,value:e(n.value)}:n}function zn(n){if(n instanceof Int8Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray)return new DataView(n.buffer,n.byteOffset,n.byteLength);if(n instanceof ArrayBuffer)return new DataView(n);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")}const Hn="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",Mn="0123456789ABCDEFGHIJKLMNOPQRSTUV",qn="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function q(n,e,t){t=t||{};let r,o;switch(e){case"RFC3548":case"RFC4648":r=Hn,o=!0;break;case"RFC4648-HEX":r=Mn,o=!0;break;case"Crockford":r=qn,o=!1;break;default:throw new Error("Unknown base32 variant: "+String(e))}const a=t.padding!==void 0?t.padding:o,s=zn(n);let i=0,u=0,c="";for(let l=0;l<s.byteLength;l++)for(u=u<<8|s.getUint8(l),i+=8;i>=5;)c+=r[u>>>i-5&31],i-=5;if(i>0&&(c+=r[u<<5-i&31]),a)for(;c.length%8!==0;)c+="=";return c}const k=15,W=24,I=d.z.string().length(W).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");function Wn(){const n=new Uint8Array(k);return crypto.getRandomValues(n),I.parse(q(n,"RFC4648"))}function X(n){if(n.length!==k)throw new Error(`Wrong number of bytes: ${n.length}`);return I.parse(q(n,"RFC4648"))}async function Xn(n){const e=new TextEncoder,t=await crypto.subtle.digest("SHA-256",e.encode(n));return X(new Uint8Array(t.slice(0,15)))}function Gn(n){return JSON.stringify(n)}function Qn(n){return h(n)}function Yn(n){return JSON.parse(n)}exports.AnchoredIdDeriver=kn;exports.DefaultNavigationState=jn;exports.PTableAbsent=K;exports.PTableNA=_;exports.PValueBytesNA=F;exports.PValueDoubleNA=ln;exports.PValueFloatNA=dn;exports.PValueIntNA=L;exports.PValueLongNA=P;exports.PValueStringNA=$;exports.PlId=I;exports.PlIdBytes=k;exports.PlIdLength=W;exports.PlRef=Rn;exports.RangeBytes=Y;exports.canonicalizeAxisId=wn;exports.canonicalizeJson=Qn;exports.createPlRef=Tn;exports.dataInfoToEntries=un;exports.deriveNativeId=Fn;exports.digestPlId=Xn;exports.ensureNotNAPValue=mn;exports.ensurePColumn=Jn;exports.entriesToDataInfo=cn;exports.executePSpecPredicate=b;exports.extractAllColumns=Bn;exports.getAxesId=N;exports.getAxisId=m;exports.getColumnIdAndSpec=Pn;exports.getFileNameFromHandle=rn;exports.getFilePathFromHandle=D;exports.getPColumnSpecId=bn;exports.isDataInfo=on;exports.isDataInfoEntries=B;exports.isFilteredPColumn=Cn;exports.isImportFileHandleIndex=J;exports.isImportFileHandleUpload=O;exports.isLiveLog=en;exports.isNotNAPValue=j;exports.isPColumn=M;exports.isPColumnResult=On;exports.isPColumnSpec=f;exports.isPColumnSpecResult=Vn;exports.isPTableAbsent=hn;exports.isPValue=R;exports.isPartitionedDataInfoEntries=sn;exports.isPlRef=vn;exports.isValueAbsent=U;exports.isValueNA=g;exports.mapDataInfo=an;exports.mapDataInfoEntries=fn;exports.mapJoinEntry=y;exports.mapPObjectData=Dn;exports.mapPTableDef=xn;exports.mapValueInVOE=_n;exports.matchAxis=w;exports.matchAxisId=z;exports.matchPColumn=A;exports.newRangeBytesOpt=Z;exports.pTableValue=gn;exports.pValueToStringOrNumber=yn;exports.pValueToStringOrNumberOrNull=T;exports.parseColumnId=Nn;exports.parseJson=Yn;exports.plId=X;exports.plRefsEqual=Kn;exports.resolveAnchors=In;exports.safeConvertToPValue=v;exports.selectorsToPredicate=$n;exports.stringifyColumnId=H;exports.stringifyJson=Gn;exports.toJsonSafePValue=pn;exports.uniquePlId=Wn;exports.validateRangeBytes=nn;exports.withEnrichments=Un;
2
2
  //# sourceMappingURL=index.js.map