@platforma-sdk/model 1.30.0 → 1.30.3
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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/render/api.d.ts +1 -1
- package/dist/render/api.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/render/api.ts +5 -5
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Qe=Object.defineProperty;var Ze=(t,e,n)=>e in t?Qe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var E=(t,e,n)=>Ze(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@milaboratories/pl-model-common"),we=require("canonicalize"),K=require("zod"),be=require("@milaboratories/pl-error-like");class Ce extends Error{constructor(e,n){super(`${e.length}${n?"+":""} errors, first error: `+e[0].message),this.errors=e,this.moreErrors=n}}function Ie(t){if(!t.ok)throw new Ce(t.errors,t.moreErrors);return t.value}function et(t){return new Proxy(t,{get(e,n){return Ie(e[n])}})}function S(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null?q(t):t}function $(t){return{type:"GetFromCtx",variable:t}}function tt(t){return{type:"Isolate",cfg:t}}const nt=$("$args"),rt=$("$it"),it=$("$prod"),st=$("$staging"),ot=$("$ui");function q(t){return{type:"Immediate",value:t}}function fe(t){const e={};for(const[n,r]of Object.entries(t))e[n]=S(r);return{type:"MakeObject",template:e}}function at(...t){const e=[];for(const n of t)e.push(S(n));return{type:"MakeArray",template:e}}function H(t,e){return{type:"GetJsonField",source:S(t),field:S(e)}}function lt(t,e,n="$it"){return{type:"MapRecordValues",source:t,mapping:e,itVar:n}}function ut(t,e,n="$it"){return{type:"MapArrayValues",source:t,mapping:e,itVar:n}}function ct(t){return{type:"Flatten",source:t}}function dt(t){return{type:"IsEmpty",arg:t}}function pt(t){return{type:"Not",operand:t}}function ft(t,e){return{type:"And",operand1:t,operand2:e}}function ht(t,e){return{type:"Or",operand1:t,operand2:e}}function gt(t,e){return{type:"GetResourceField",source:S(t),field:S(e)}}function mt(){return function(t){return{type:"GetResourceValueAsJson",source:S(t)}}}function yt(t,e,n="$it"){return{type:"MapResourceFields",source:t,mapping:e,itVar:n}}function bt(t){return{type:"GetBlobContent",source:S(t)}}function vt(t){return{type:"GetBlobContentAsString",source:S(t)}}function At(){return function(t){return{type:"GetBlobContentAsJson",source:S(t)}}}function Pt(t){return{type:"GetDownloadedBlobContent",source:S(t)}}function wt(t){return{type:"GetOnDemandBlobContent",source:S(t)}}function Ct(t,e){return{type:"ExtractArchiveAndGetURL",format:e,source:S(t)}}function It(t){return{type:"GetImportProgress",source:S(t)}}function St(t,e){return{type:"GetLastLogs",source:S(t),lines:e}}function xt(t,e){return{type:"GetProgressLog",source:S(t),patternToSearch:e}}function _t(t,e){return{type:"GetProgressLogWithInfo",source:S(t),patternToSearch:e}}function Tt(t){return{type:"GetLogHandle",source:S(t)}}function Lt(){return typeof globalThis.getPlatforma<"u"||typeof globalThis.platforma<"u"}function Se(t){if(t&&typeof globalThis.getPlatforma=="function")return globalThis.getPlatforma(t);if(typeof globalThis.platforma<"u")return globalThis.platforma;throw new Error("Can't get platforma instance.")}function Et(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx}function y(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx;throw new Error("Not in config rendering context")}function W(t,e){const n=Et();if(n===void 0)return!1;if(t in n.callbackRegistry)throw new Error(`Callback with key ${t} already registered.`);return n.callbackRegistry[t]=e,!0}const le=new Map;function Ot(t,e){t in y().callbackRegistry||(y().callbackRegistry[t]=n=>{for(const r of le.get(t))r(n)},le.set(t,[])),le.get(t).push(e)}class x{constructor(e,n=r=>r){E(this,"isResolved",!1);E(this,"resolvedValue");this.handle=e,this.postProcess=n,Ot(e,r=>{this.resolvedValue=n(r),this.isResolved=!0})}map(e){return new x(this.handle,n=>e(this.postProcess(n)))}mapDefined(e){return new x(this.handle,n=>{const r=this.postProcess(n);return r?e(r):void 0})}toJSON(){return this.isResolved?this.resolvedValue:{__awaited_futures__:[this.handle]}}}function re(t,e){return t===void 0?void 0:e(t)}class T{constructor(e,n){this.handle=e,this.resolvePath=n}resolve(...e){const n=e.map(r=>({assertFieldType:"Input",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveOutput(...e){const n=e.map(r=>({assertFieldType:"Output",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveInput(...e){const n=e.map(r=>({assertFieldType:"Input",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveAny(...e){return this.resolveWithCommon({},...e)}resolveWithCommon(e,...n){const r=[...this.resolvePath,...n.map(i=>typeof i=="string"?i:i.field)];return re(y().resolveWithCommon(this.handle,e,...n),i=>new T(i,r))}get resourceType(){return y().getResourceType(this.handle)}getInputsLocked(){return y().getInputsLocked(this.handle)}getOutputsLocked(){return y().getOutputsLocked(this.handle)}getIsReadyOrError(){return y().getIsReadyOrError(this.handle)}getIsFinal(){return y().getIsFinal(this.handle)}getError(){const e=[...this.resolvePath,"error"];return re(y().getError(this.handle),n=>new T(n,e))}listInputFields(){return y().listInputFields(this.handle)}listOutputFields(){return y().listOutputFields(this.handle)}listDynamicFields(){return y().listDynamicFields(this.handle)}getKeyValueBase64(e){return y().getKeyValueBase64(this.handle,e)}getKeyValueAsString(e){return y().getKeyValueAsString(this.handle,e)}getKeyValueAsJson(e){const n=this.getKeyValueAsString(e);if(n==null)throw new Error("Resource has no content.");return JSON.parse(n)}getDataBase64(){return y().getDataBase64(this.handle)}getDataAsString(){return y().getDataAsString(this.handle)}getDataAsJson(){const e=this.getDataAsString();if(e==null)throw new Error("Resource has no content.");return JSON.parse(e)}getPColumns(e=!1,n=""){const r=this.parsePObjectCollection(e,n);return r===void 0?void 0:Object.entries(r).map(([,s])=>{if(!u.isPColumn(s))throw new Error(`not a PColumn (kind = ${s.spec.kind})`);return s})}parsePObjectCollection(e=!1,n=""){const r=y().parsePObjectCollection(this.handle,e,n,...this.resolvePath);if(r===void 0)return;const i={};for(const[s,o]of Object.entries(r)){const a=[...this.resolvePath,s];i[s]=u.mapPObjectData(o,l=>new T(l,a))}return i}getFileContentAsBase64(){return new x(y().getBlobContentAsBase64(this.handle))}getFileContentAsString(){return new x(y().getBlobContentAsString(this.handle))}getFileContentAsJson(){return new x(y().getBlobContentAsString(this.handle)).mapDefined(e=>JSON.parse(e))}getBlobContentAsBase64(){return this.getFileContentAsBase64()}getBlobContentAsString(){return this.getFileContentAsString()}getFileHandle(){return new x(y().getDownloadedBlobContentHandle(this.handle))}getDownloadedBlobHandle(){return this.getFileHandle()}getRemoteFileHandle(){return new x(y().getOnDemandBlobContentHandle(this.handle))}getOnDemandBlobHandle(){return this.getRemoteFileHandle()}extractArchiveAndGetURL(e){return new x(y().extractArchiveAndGetURL(this.handle,e))}getImportProgress(){return new x(y().getImportProgress(this.handle))}getLastLogs(e){return new x(y().getLastLogs(this.handle,e))}getProgressLog(e){return new x(y().getProgressLog(this.handle,e))}getProgressLogWithInfo(e){return new x(y().getProgressLogWithInfo(this.handle,e))}getLogHandle(){return new x(y().getLogHandle(this.handle))}allFieldsResolved(e="Input"){switch(e){case"Input":return this.getInputsLocked()&&this.listInputFields().every(n=>this.resolve({field:n,assertFieldType:"Input"})!==void 0);case"Output":return this.getOutputsLocked()&&this.listOutputFields().every(n=>this.resolve({field:n,assertFieldType:"Output"})!==void 0)}}mapFields(e,n){const{fieldType:r,requireLocked:i,skipUnresolved:s}={fieldType:"Input",requireLocked:!0,skipUnresolved:!1,...n},o=e;if(i&&(r==="Input"&&!this.getInputsLocked()||r==="Output"&&!this.getOutputsLocked()))return;let l=(r==="Input"?this.listInputFields():r==="Output"?this.listOutputFields():this.listDynamicFields()).map(c=>[c,this.resolve({field:c,assertFieldType:r})]);return s&&(l=l.filter(c=>c[1]!==void 0)),l.map(([c,b])=>o(c,b))}}const xe="staging",_e="main",Rt={explicitColumnsSupport:!0,inlineColumnsSupport:!0,activeArgs:!0};function Te(t){return typeof t=="object"&&t!==null&&"__awaited_futures__"in t}function ce(t,e,n){if(e.has(n))return;if(e.add(n),typeof n==="object")if(Te(n))n.__awaited_futures__.forEach(i=>t.add(i));else if(Array.isArray(n))for(const i of n)ce(t,e,i);else for(const[,i]of Object.entries(n))i!==n&&ce(t,e,i)}function Dt(t){const e=new Set;return ce(e,new Set,t),e}const Ft=Object.freeze(Object.defineProperty({__proto__:null,GlobalCfgRenderCtxFeatureFlags:Rt,MainAccessorName:_e,StagingAccessorName:xe,getAllFutureAwaits:Dt,isFutureAwait:Te},Symbol.toStringTag,{value:"Module"})),Le="pl7.app/label",Ee="pl7.app/trace",Oe=K.z.object({type:K.z.string(),importance:K.z.number().optional(),id:K.z.string().optional(),label:K.z.string()}),Re=K.z.array(Oe),kt=.001,jt="__LABEL__",ve="__LABEL__@1";function he(t,e,n={}){const r=new Map,i=new Map,s=t.map(h=>{var ee,O;const g=e(h);let f,I,d;"spec"in g&&typeof g.spec=="object"?(f=g.spec,I=g.prefixTrace,d=g.suffixTrace):f=g;const v=(ee=f.annotations)==null?void 0:ee[Le],m=(O=f.annotations)==null?void 0:O[Ee],A=(m?Re.safeParse(JSON.parse(m)).data:void 0)??[],w=[...I??[],...A,...d??[]];if(v){const L={label:v,type:jt,importance:-2};n.addLabelAsSuffix?w.push(L):w.splice(0,0,L)}const R=[],U=new Map;for(let L=w.length-1;L>=0;--L){const{type:k}=w[L],oe=w[L].importance??0,B=(U.get(k)??0)+1;U.set(k,B);const C=`${k}@${B}`;i.set(C,(i.get(C)??0)+1),r.set(C,Math.max(r.get(C)??Number.NEGATIVE_INFINITY,oe-(w.length-L)*kt)),R.push({...w[L],fullType:C,occurenceIndex:B})}return R.reverse(),{value:h,spec:f,label:v,fullTrace:R}}),o=[],a=[],l=[...r];l.sort(([,h],[,g])=>g-h);for(const[h]of l)h.endsWith("@1")||i.get(h)===t.length?o.push(h):a.push(h);const c=h=>{const g=[];for(let f=0;f<s.length;f++){const I=s[f],d=I.fullTrace.filter(A=>h.has(A.fullType));if(d.length===0)return;const v=d.map(A=>A.label),m=n.separator??" / ";g.push({label:v.join(m),value:I.value})}return g};if(o.length===0){if(a.length!==0)throw new Error("Assertion error.");const h=c(new Set(ve));if(h===void 0)throw new Error("Assertion error.");return h}let b=0,P=0;for(;b<o.length;){const h=new Set;n.includeNativeLabel&&h.add(ve);for(let f=0;f<b;++f)h.add(o[f]);h.add(o[P]);const g=c(h);if(g!==void 0&&new Set(g.map(f=>f.label)).size===t.length)return g;P++,P>=o.length&&(b++,P=b)}const p=c(new Set([...o,...a]));if(p===void 0)throw new Error("Assertion error.");return p}const Z="PColumnData/",Y=Z+"ResourceMap",X=Z+"Partitioned/ResourceMap",N=Z+"JsonPartitioned",F=Z+"BinaryPartitioned",De=Z+"Partitioned/",Q=De+"JsonPartitioned",J=De+"BinaryPartitioned";function Fe(t,e,n,r=[],i){if(t===void 0)return!1;switch(t.resourceType.name){case Y:{let s=t.getInputsLocked();for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"}),l=[...r,...JSON.parse(o)],c=a===void 0?void 0:e(a);c===void 0&&(s=!1),(c!==void 0||i)&&n.push({key:l,value:c})}return s}case X:{let s=t.getInputsLocked();for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"});if(a===void 0)s=!1;else{const l=[...r,...JSON.parse(o)],c=Fe(a,e,n,l,i);s=s&&c}}return s}default:throw new Error(`Unknown resource type: ${t.resourceType.name}`)}}function Vt(t,e,n=!1){const r=[];return{isComplete:Fe(t,e,r,[],n),data:r}}const de=t=>{if(t.endsWith(".index"))return{baseKey:t.substring(0,t.length-6),type:"index"};if(t.endsWith(".values"))return{baseKey:t.substring(0,t.length-7),type:"values"};throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`)};function ke(t){if(!t)return;const e=t.resourceType.name,n=t.getDataAsJson(),r=[];let i=0;switch(e){case Y:i=n.keyLength;break;case X:i=n.partitionKeyLength+n.keyLength;break;case N:case F:i=n.partitionKeyLength;break;case J:case Q:i=n.superPartitionKeyLength+n.partitionKeyLength;break}switch(e){case Y:case N:case F:for(let s of t.listInputFields()){e===F&&(s=de(s).baseKey);const o=[...JSON.parse(s)];r.push(o)}break;case X:case J:case Q:for(const s of t.listInputFields()){const o=[...JSON.parse(s)],a=t.resolve({field:s,assertFieldType:"Input"});if(a!==void 0)for(let l of a.listInputFields()){e===J&&(l=de(l).baseKey);const c=[...o,...JSON.parse(l)];r.push(c)}}break}return{data:r,keyLength:i}}function Kt(t){if(t.type!=="JsonPartitioned"&&t.type!=="BinaryPartitioned")throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${t.type}`);const{parts:e,partitionKeyLength:n}=t,r=[];for(let i=0;i<n;++i)r.push(new Set);for(const i of e){const s=i.key;if(s.length!==n)throw new Error(`Key length (${s.length}) does not match partition length (${n}) for key: ${JSON.stringify(s)}`);for(let o=0;o<n;++o)r[o].add(s[o])}return r.map(i=>Array.from(i.values()))}function je(t){if(t===void 0)return;if(u.isDataInfoEntries(t))return Kt(t);const e=ke(t);if(!e)return;const{data:n,keyLength:r}=e,i=[];for(let s=0;s<r;++s)i.push(new Set);for(const s of n){if(s.length!==r)throw new Error("key length does not match partition length");for(let o=0;o<r;++o)i[o].add(s[o])}return i.map(s=>Array.from(s.values()))}function ie(t,e=[]){if(t===void 0||!t.getIsReadyOrError())return;const n=t.resourceType.name,r=t.getDataAsJson();if(e.length>0&&(n===Q||n===J))throw new Error(`Unexpected nested super-partitioned resource: ${n}`);switch(n){case Y:case X:throw new Error(`Only data columns are supported, got: ${n}`);case N:{if(typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${n}`);const i=[];for(const s of t.listInputFields()){const o=t.resolve({field:s,assertFieldType:"Input"});if(o===void 0)return;const a=[...e,...JSON.parse(s)];i.push({key:a,value:o})}return{type:"JsonPartitioned",partitionKeyLength:r.partitionKeyLength,parts:i}}case F:{if(typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${n}`);const i=[],s=new Map;for(const o of t.listInputFields()){const a=de(o),l=t.resolve({field:o,assertFieldType:"Input"});if(l===void 0)return;let c=s.get(a.baseKey);c||(c={},s.set(a.baseKey,c)),a.type==="index"?c.index=l:c.values=l}for(const[o,a]of s.entries()){if(!a.index||!a.values)return;const l=[...e,...JSON.parse(o)];i.push({key:l,value:{index:a.index,values:a.values}})}return{type:"BinaryPartitioned",partitionKeyLength:r.partitionKeyLength,parts:i}}case Q:{if(typeof(r==null?void 0:r.superPartitionKeyLength)!="number"||typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n}`);const i=r.superPartitionKeyLength+r.partitionKeyLength,s=[];for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"});if(a===void 0)return;if(a.resourceType.name!==N)throw new Error(`Expected ${N} inside ${n}, but got ${a.resourceType.name}`);const l=ie(a,JSON.parse(o));if(l===void 0)return;if(l.type!=="JsonPartitioned")throw new Error(`Unexpected inner result type for ${n}: ${l.type}`);s.push(...l.parts)}return{type:"JsonPartitioned",partitionKeyLength:i,parts:s}}case J:{if(typeof(r==null?void 0:r.superPartitionKeyLength)!="number"||typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n}`);const i=r.superPartitionKeyLength+r.partitionKeyLength,s=[];for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"});if(a===void 0)return;if(a.resourceType.name!==F)throw new Error(`Expected ${F} inside ${n}, but got ${a.resourceType.name}`);const l=ie(a,JSON.parse(o));if(l===void 0)return;if(l.type!=="BinaryPartitioned")throw new Error(`Unexpected inner result type for ${n}: ${l.type}`);s.push(...l.parts)}return{type:"BinaryPartitioned",partitionKeyLength:i,parts:s}}default:throw new Error(`Unknown resource type: ${n}`)}}function Ve(t){if(t!==void 0){if(u.isDataInfoEntries(t))return t;if(u.isDataInfo(t))return u.dataInfoToEntries(t);if(t instanceof T)return ie(t);throw new Error(`Unexpected input type: ${typeof t}`)}}function Ke(t,e){const n=[...e].sort((s,o)=>o[0]-s[0]);if(t.type==="JsonPartitioned"||t.type==="BinaryPartitioned"){const{partitionKeyLength:s}=t;for(const[o]of e)if(o>=s)throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s}`)}else if(t.type==="Json"){const{keyLength:s}=t;for(const[o]of e)if(o>=s)throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s}`)}const r=s=>{for(const[o,a]of n)if(s[o]!==a)return!1;return!0},i=s=>{const o=[...s];for(const[a]of n)o.splice(a,1);return o};switch(t.type){case"Json":{const s=t.data.filter(o=>r(o.key)).map(o=>({key:i(o.key),value:o.value}));return{type:"Json",keyLength:t.keyLength-e.length,data:s}}case"JsonPartitioned":{const s=t.parts.filter(o=>r(o.key)).map(o=>({key:i(o.key),value:o.value}));return{type:"JsonPartitioned",partitionKeyLength:t.partitionKeyLength-e.length,parts:s}}case"BinaryPartitioned":{const s=t.parts.filter(o=>r(o.key)).map(o=>({key:i(o.key),value:o.value}));return{type:"BinaryPartitioned",partitionKeyLength:t.partitionKeyLength-e.length,parts:s}}}}class Nt{constructor(e){this.columns=e}selectColumns(e){const n=typeof e=="function"?e:u.selectorsToPredicate(e);return this.columns.filter(r=>n(r.spec))}}function Jt(t){if(t)return t.map(e=>({type:`split:${u.canonicalizeAxisId(e.axisId)}`,label:e.label,importance:1e6}))}function $t(t){if(t)return t.map(e=>[e.axisIdx,e.value])}function Ut(t,e){if(!e||e.length===0)return t;const n=[...e].sort((r,i)=>r[0]-i[0]);return we({id:t,axisFilters:n})}function Bt(t){if(!t||typeof t!="object")return!1;const e=t,n=e.domain&&typeof e.domain=="object"&&Object.values(e.domain).some(i=>typeof i=="object"&&i!==null&&"anchor"in i),r=e.axes&&Array.isArray(e.axes)&&e.axes.some(i=>typeof i=="object"&&i!==null&&"anchor"in i);return!!e.domainAnchor||n||r}function Mt(t){if(typeof t!="object"||!("axes"in t)||t.axes===void 0)return[];const e=t.axes.map((n,r)=>typeof n=="object"&&"split"in n&&n.split===!0?r:-1).filter(n=>n!==-1);if(e.length>0&&t.partialAxesMatch!==void 0)throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");return e.sort((n,r)=>n-r),e}class se{constructor(){E(this,"defaultProviderStore",[]);E(this,"providers",[new Nt(this.defaultProviderStore)]);E(this,"axisLabelProviders",[])}addColumnProvider(e){return this.providers.push(e),this}addAxisLabelProvider(e){return this.axisLabelProviders.push(e),this}addColumns(e){return this.defaultProviderStore.push(...e),this}addColumn(e){return this.defaultProviderStore.push(e),this}findLabels(e){for(const n of this.axisLabelProviders){const r=n.findLabels(e);if(r)return r}}getUniversalEntries(e,n){const{anchorCtx:r,labelOps:i,dontWaitAllData:s=!1,overrideLabelAnnotation:o=!1}=n??{},a={...o&&(i==null?void 0:i.includeNativeLabel)!==!1?{includeNativeLabel:!0}:{},...i??{}},l=typeof e=="function"?[e]:Array.isArray(e)?e:[e],c=[];for(const p of l){const h=Bt(p);let g;if(h){if(!r)throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");g=u.resolveAnchors(r.anchors,p,n)}else g=p;const f=new Set,I=[];for(const m of this.providers){const A=m.selectColumns(g);for(const w of A){if(f.has(w.id))throw new Error(`Duplicate column id ${w.id} in provider ${m.constructor.name}`);f.add(w.id),I.push(w)}}if(I.length===0)continue;const d=Mt(p),v=d.length>0;for(const m of I){if(!u.isPColumnSpec(m.spec))continue;const A=m.spec;if(v){const w=Ve(m.data);if(!w){if(s)continue;return}if(!u.isPartitionedDataInfoEntries(w))throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${w.type} for column ${m.id}`);const R=je(w),U=d[d.length-1];if(U>=w.partitionKeyLength)throw new Error(`Not enough partition keys (${w.partitionKeyLength}) for requested split axes (max index ${U}) in column ${A.name}`);const ee=d.map(C=>this.findLabels(u.getAxisId(A.axesSpec[C]))),O=[],L=(C,M)=>{if(M>=d.length){if(O.push([...C]),O.length>1e4)throw new Error("Too many key combinations, aborting.");return}const D=d[M];if(D>=R.length)throw new Error(`Axis index ${D} out of bounds for unique keys array (length ${R.length}) during split key generation for column ${m.id}`);const j=R[D];if(!j||j.length===0){O.length=0;return}for(const te of j)C.push(te),L(C,M+1),C.pop()};if(L([],0),O.length===0)continue;const k=[...A.axesSpec],oe=d.map(C=>C);for(let C=d.length-1;C>=0;C--)k.splice(d[C],1);const B={...A,axesSpec:k};for(const C of O){const M=C.map((D,j)=>{const te=oe[j],Ye=u.getAxisId(A.axesSpec[te]),ae=ee[j],Xe=(ae==null?void 0:ae[D])??String(D);return{axisIdx:te,axisId:Ye,value:D,label:Xe}});c.push({type:"split",originalColumn:m,spec:A,adjustedSpec:B,dataEntries:w,axisFilters:M})}}else c.push({type:"direct",originalColumn:m,spec:A,adjustedSpec:A})}}if(c.length===0)return[];const b=he(c,p=>({spec:p.spec,suffixTrace:p.type==="split"?Jt(p.axisFilters):void 0}),a),P=[];for(const{value:p,label:h}of b){const{originalColumn:g,spec:f}=p,I=p.type==="split"?p.axisFilters:void 0,d=$t(I);let v;r?v=r.deriveS(f,d):v=Ut(g.id,d);let m={...p.adjustedSpec};o&&(m={...m,annotations:{...m.annotations??{},"pl7.app/label":h}}),P.push({id:v,spec:m,data:()=>p.type==="split"?u.entriesToDataInfo(Ke(p.dataEntries,d)):p.originalColumn.data,label:h})}return P}getColumns(e,n){const r=this.getUniversalEntries(e,{overrideLabelAnnotation:!0,...n??{}});if(!r)return;const i=[];for(const s of r){const o=s.data();if(!o){if(n!=null&&n.dontWaitAllData)continue;return}i.push({id:s.id,spec:s.spec,data:o})}return i}}function ue(t,e){if(t===void 0)return e===void 0;if(e===void 0)return!0;for(const n in e)if(t[n]!==e[n])return!1;return!0}function Ae(t){return u.mapPObjectData(t,e=>e instanceof T?e.handle:u.isDataInfo(e)?u.mapDataInfo(e,n=>n.handle):e)}class Ne{constructor(){E(this,"ctx",y())}calculateOptions(e){return this.ctx.calculateOptions(e)}getOptions(e,n){const r=typeof e=="function"?e:u.selectorsToPredicate(e),i=this.getSpecs().entries.filter(a=>r(a.obj));let s={},o=!1;return typeof n<"u"&&(typeof n=="function"?s=n:typeof n=="object"&&("includeNativeLabel"in n||"separator"in n||"addLabelAsSuffix"in n?s=n:(n=n,s=n.label??{},o=n.requireEnrichments??!1))),typeof s=="object"?he(i,a=>a.obj,s??{}).map(({value:{ref:a},label:l})=>({ref:u.withEnrichments(a,o),label:l})):i.map(({ref:a,obj:l})=>({ref:u.withEnrichments(a,o),label:s(l,a)}))}resolveAnchorCtx(e){if(e instanceof u.AnchoredIdDeriver)return e;const n={};for(const[r,i]of Object.entries(e))if(u.isPlRef(i)){const s=this.getPColumnSpecByRef(i);if(!s)return;n[r]=s}else n[r]=i;return new u.AnchoredIdDeriver(n)}getAnchoredPColumns(e,n,r){const i=this.resolveAnchorCtx(e);if(i)return new se().addColumnProvider(this).addAxisLabelProvider(this).getColumns(n,{...r,anchorCtx:i})}getCanonicalOptions(e,n,r){const i=this.resolveAnchorCtx(e);if(!i)return;const s=new se().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(n,{...r,anchorCtx:i});if(s)return s.map(o=>({value:o.id,label:o.label}))}getDataFromResultPool(){return this.getData()}getData(){const e=this.ctx.getDataFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:new T(n.obj.data,[n.ref.blockId,n.ref.name])}}))}}getDataWithErrorsFromResultPool(){return this.getDataWithErrors()}getDataWithErrors(){const e=this.ctx.getDataWithErrorsFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:u.mapValueInVOE(n.obj.data,r=>new T(r,[n.ref.blockId,n.ref.name]))}}))}}getSpecsFromResultPool(){return this.getSpecs()}getSpecs(){return this.ctx.getSpecsFromResultPool()}getDataByRef(e){var r;if(typeof this.ctx.getDataFromResultPoolByRef>"u")return(r=this.getData().entries.find(i=>i.ref.blockId===e.blockId&&i.ref.name===e.name))==null?void 0:r.obj;const n=this.ctx.getDataFromResultPoolByRef(e.blockId,e.name);if(n)return u.mapPObjectData(n,i=>new T(i,[e.blockId,e.name]))}getPColumnByRef(e){const n=this.getDataByRef(e);if(n)return u.ensurePColumn(n)}getPColumnSpecByRef(e){const n=this.getSpecByRef(e);if(n){if(!u.isPColumnSpec(n))throw new Error(`not a PColumn spec (kind = ${n.kind})`);return n}}getSpecByRef(e){return this.ctx.getSpecFromResultPoolByRef(e.blockId,e.name)}findDataWithCompatibleSpec(e){const n=[];e:for(const r of this.getData().entries){if(!u.isPColumnSpec(r.obj.spec))continue;const i=r.obj.spec;if(e.name===i.name&&e.valueType===i.valueType&&e.axesSpec.length===i.axesSpec.length&&ue(e.domain,i.domain)){for(let s=0;s<e.axesSpec.length;++s){const o=e.axesSpec[s],a=i.axesSpec[s];if(o.name!==a.name||o.type!==a.type||!ue(o.domain,a.domain))continue e}n.push(r.obj)}}return n}findLabels(e){const n=this.getData();for(const r of n.entries){if(!u.isPColumn(r.obj))continue;const i=r.obj.spec;if(i.name==="pl7.app/label"&&i.axesSpec.length===1&&i.axesSpec[0].name===e.name&&i.axesSpec[0].type===e.type&&ue(e.domain,i.axesSpec[0].domain)){if(r.obj.data.resourceType.name!=="PColumnData/Json")throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);return Object.fromEntries(Object.entries(r.obj.data.getDataAsJson().data).map(o=>[JSON.parse(o[0])[0],o[1]]))}}}selectColumns(e){const n=typeof e=="function"?e:u.selectorsToPredicate(e);return this.getSpecs().entries.filter(({obj:i})=>u.isPColumnSpec(i)?n(i):!1).map(({ref:i,obj:s})=>{const o=s;let a=null;const l=this;return{id:we(i),spec:o,get data(){var c;return a!==null||(a=(c=l.getPColumnByRef(i))==null?void 0:c.data),a}}})}findLabelsForColumnAxis(e,n){var s;const r=this.findLabels(e.axesSpec[n]);if(!r)return;const i=(s=e.annotations)==null?void 0:s["pl7.app/axisKeys/"+n];if(i!==void 0){const o=JSON.parse(i);return Object.fromEntries(o.map(a=>[a,r[a]??"Unlabelled"]))}else return r}}class G{constructor(){E(this,"ctx");E(this,"args");E(this,"uiState");E(this,"_activeArgsCache");E(this,"resultPool",new Ne);this.ctx=y(),this.args=JSON.parse(this.ctx.args),this.uiState=this.ctx.uiState!==void 0?JSON.parse(this.ctx.uiState):{}}get activeArgs(){return this._activeArgsCache===void 0&&(this._activeArgsCache={v:this.ctx.activeArgs?JSON.parse(this.ctx.activeArgs):void 0}),this._activeArgsCache.v}getNamedAccessor(e){return re(this.ctx.getAccessorHandleByName(e),n=>new T(n,[e]))}get prerun(){return this.getNamedAccessor(xe)}get outputs(){return this.getNamedAccessor(_e)}findLabels(e){return this.resultPool.findLabels(e)}verifyInlineAndExplicitColumnsSupport(e){var i;const n=e.some(s=>!(s.data instanceof T)||u.isDataInfo(s.data)),r=((i=this.ctx.featureFlags)==null?void 0:i.inlineColumnsSupport)===!0;if(n&&!r)throw Error("Inline or explicit columns not supported")}createPFrame(e){return this.verifyInlineAndExplicitColumnsSupport(e),this.ctx.createPFrame(e.map(n=>Ae(n)))}createPTable(e){let n;return"columns"in e?n={src:{type:"full",entries:e.columns.map(r=>({type:"column",column:r}))},filters:e.filters??[],sorting:e.sorting??[]}:n=e,this.verifyInlineAndExplicitColumnsSupport(u.extractAllColumns(n.src)),this.ctx.createPTable(u.mapPTableDef(n,r=>Ae(r)))}getBlockLabel(e){return this.ctx.getBlockLabel(e)}getCurrentUnstableMarker(){return this.ctx.getCurrentUnstableMarker()}}const z="1.30.0";function Je(t){return t.__renderLambda===!0}function ne(t){if(t!==void 0)return Je(t)?t.handle:t}function V(t){if(t!==void 0)return typeof t=="string"?{__renderLambda:!0,handle:t,retentive:!1}:t}function Wt(t){if(t.v3!==void 0){const{initialArgs:e,initialUiState:n,inputsValid:r,outputs:i,renderingMode:s,sdkVersion:o,sections:a,title:l,enrichmentTargets:c}=t.v3,{code:b}=t;return{initialArgs:e,initialUiState:n,inputsValid:r,outputs:i,renderingMode:s,sdkVersion:o,sections:a,title:l,code:b,enrichmentTargets:c}}else if(t.inputsValid!==void 0){const{sdkVersion:e,renderingMode:n,outputs:r,inputsValid:i,sections:s,initialArgs:o,code:a}=t,l=Object.keys(t);if(e===void 0||n===void 0||r===void 0||i===void 0||s===void 0||o===void 0)throw new Error(`Malformed config v2. SDK version ${e}; Fields = ${l.join(", ")}`);return{sdkVersion:e,renderingMode:n,initialArgs:o,outputs:Object.fromEntries(Object.entries(r).map(([c,b])=>[c,V(b)])),inputsValid:V(i),sections:V(s),initialUiState:void 0,code:a}}else if(t.renderingMode!==void 0){const{sdkVersion:e,canRun:n,renderingMode:r,outputs:i,sections:s,initialArgs:o,code:a}=t,l=Object.keys(t);if(r===void 0||i===void 0||n===void 0||s===void 0||o===void 0)throw new Error(`Malformed config v1. SDK version ${e}; Fields = ${l.join(", ")}`);return{sdkVersion:e??"unknown",renderingMode:r,initialArgs:o,outputs:Object.fromEntries(Object.entries(i).map(([c,b])=>[c,V(b)])),inputsValid:V(n),sections:V(s),initialUiState:void 0,code:a}}else{const{sdkVersion:e}=t,n=Object.keys(t);throw new Error(`Config format not supported: SDK = ${e}; Fields = ${n.join(", ")}`)}}class _{constructor(e,n,r,i,s,o,a,l){this._renderingMode=e,this._initialArgs=n,this._initialUiState=r,this._outputs=i,this._inputsValid=s,this._sections=o,this._title=a,this._enrichmentTargets=l}static create(e="Heavy"){return new _(e,void 0,{},{},q(!0),q([]),void 0,void 0)}output(e,n,r={}){if(typeof n=="function"){const i=`output#${e}`;return W(i,()=>n(new G)),new _(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:{__renderLambda:!0,handle:i,...r}},this._inputsValid,this._sections,this._title,this._enrichmentTargets)}else return new _(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:n},this._inputsValid,this._sections,this._title,this._enrichmentTargets)}retentiveOutput(e,n){return this.output(e,n,{retentive:!0})}argsValid(e){return typeof e=="function"?(W("inputsValid",()=>e(new G)),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,{__renderLambda:!0,handle:"inputsValid"},this._sections,this._title,this._enrichmentTargets)):new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,e,this._sections,this._title,this._enrichmentTargets)}sections(e){return Array.isArray(e)?this.sections(q(e)):typeof e=="function"?(W("sections",()=>e(new G)),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,{__renderLambda:!0,handle:"sections"},this._title,this._enrichmentTargets)):new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,e,this._title,this._enrichmentTargets)}title(e){return W("title",()=>e(new G)),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,{__renderLambda:!0,handle:"title"},this._enrichmentTargets)}initialArgs(e){return new _(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets)}withArgs(e){return new _(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets)}withUiState(e){return new _(this._renderingMode,this._initialArgs,e,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets)}enriches(e){return W("enrichmentTargets",e),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,{__renderLambda:!0,handle:"enrichmentTargets"})}done(){if(this._initialArgs===void 0)throw new Error("Initial arguments not set.");const e={v3:{sdkVersion:z,renderingMode:this._renderingMode,initialArgs:this._initialArgs,initialUiState:this._initialUiState,inputsValid:this._inputsValid,sections:this._sections,title:this._title,outputs:this._outputs,enrichmentTargets:this._enrichmentTargets},sdkVersion:z,renderingMode:this._renderingMode,initialArgs:this._initialArgs,inputsValid:ne(this._inputsValid),sections:ne(this._sections),outputs:Object.fromEntries(Object.entries(this._outputs).map(([n,r])=>[n,ne(r)]))};return Lt()?Se({sdkVersion:z}):{config:e}}}function Gt(t){const e=t.type;switch(e){case"axis":return u.canonicalizeJson(t);case"column":return u.canonicalizeJson(t);default:throw Error(`unsupported column type: ${e}`)}}function $e(t){return JSON.parse(t)}function qt(t){return t.axesSpec.length===1&&t.name==="pl7.app/label"}function ge(t){return new se().addAxisLabelProvider(t).addColumnProvider(t).getColumns({name:"pl7.app/label",axes:[{}]},{dontWaitAllData:!0})}function me(t,e){const n=(i,s)=>{let o=i.toString();if(s)for(const a in s)o+=a,o+=s[a];return o},r=new Map;for(const i of t)for(const s of i.spec.axesSpec){const o=u.getAxisId(s);for(const a of e){const l=a.spec.axesSpec[0],c=u.getAxisId(a.spec.axesSpec[0]);if(u.matchAxisId(o,c)){const b=Object.keys(o.domain??{}).length,P=Object.keys(c.domain??{}).length;if(b>P){const p=n(a.id,o.domain);r.set(p,{id:p,spec:{...a.spec,axesSpec:[{...o,annotations:l.annotations}]},data:a.data})}else r.set(n(a.id),a)}}}return[...r.values()]}function ye(t){const e=i=>Array.isArray(i),n=i=>i instanceof T,r=i=>typeof i=="object"&&"type"in i;return t.map(i=>i.data).every(i=>{if(e(i))return!0;if(n(i))return i.getIsReadyOrError();if(r(i))switch(i.type){case"Json":return!0;case"JsonPartitioned":return Object.values(i.parts).every(o=>o.getIsReadyOrError());case"BinaryPartitioned":return Object.values(i.parts).every(o=>o.index.getIsReadyOrError()&&o.values.getIsReadyOrError())}else throw Error(`unsupported column data type: ${i}`)})}function Ue(t,e,n,r,i,s){let o=t;const a=[];if(s){o=[];for(const l of t)s(l.spec)?o.push(l):a.push(l)}return a.push(...e),{src:{type:"outer",primary:{type:n,entries:o.map(l=>({type:"column",column:l}))},secondary:a.map(l=>({type:"column",column:l}))},filters:r,sorting:i}}function zt(t,e,n,r){var c,b;Array.isArray(r)&&(r={filters:r});const i=(r==null?void 0:r.coreJoinType)??"full",s=[...(r==null?void 0:r.filters)??[],...((c=n==null?void 0:n.pTableParams)==null?void 0:c.filters)??[]],o=((b=n==null?void 0:n.pTableParams)==null?void 0:b.sorting)??[],a=ge(t.resultPool);if(!a)return;const l=me(e.map(u.getColumnIdAndSpec),a);if(ye([...e,...l]))return t.createPTable(Ue(e,l,i,s,o,r==null?void 0:r.coreColumnPredicate))}function Be(t){var e;return((e=t.annotations)==null?void 0:e["pl7.app/table/visibility"])==="optional"}function Ht(t,e,n,r,i){var f,I;const s=(i==null?void 0:i.coreJoinType)??"full",o=[...(i==null?void 0:i.filters)??[],...((f=r==null?void 0:r.pTableParams)==null?void 0:f.filters)??[]],a=((I=r==null?void 0:r.pTableParams)==null?void 0:I.sorting)??[],l=e.find(d=>n(d.spec));if(!l)return;const c=ge(t.resultPool);if(!c)return;const b=new Set((()=>{var v,m;if(s==="inner")return[];const d=(m=(v=r==null?void 0:r.gridState.columnVisibility)==null?void 0:v.hiddenColIds)==null?void 0:m.map($e).filter(A=>A.type==="column").map(A=>A.id);return d||e.filter(A=>Be(A.spec)).map(A=>A.id)})());b.delete(l.id),[...o.map(d=>d.column),...a.map(d=>d.column)].filter(d=>d.type==="column").map(d=>b.delete(d.id));const P=e.filter(d=>!b.has(d.id)),p=me(P.map(u.getColumnIdAndSpec),c),h=[...l.spec.axesSpec.map(d=>({type:"axis",id:u.getAxisId(d),spec:d})),...[...e,...p].map(d=>({type:"column",id:d.id,spec:d.spec}))];if(!ye([...P,...p]))return;const g=t.createPTable(Ue(e,p,s,o,a,i==null?void 0:i.coreColumnPredicate));return{tableSpec:h,tableHandle:g}}function Yt(t,e,n){const r=t.resultPool.findLabels(e);return{axis:e,options:n.map(i=>({value:i,label:(r==null?void 0:r[i])??i.toString()})),defaultValue:n[0]}}const Xt=(t,e)=>{let n=t.toString();return e==null||e.forEach(r=>{if(r)for(const[i,s]of Object.entries(r))n+=i,n+=s}),n};function Qt(t){if(!t.length)return[];let e=[[]];return t.forEach(n=>{const r=[];n.forEach(i=>{r.push(...e.map(s=>[...s,i]))}),e=r}),e}function Zt(t,e){const n=t.spec.axesSpec.map(u.getAxisId);return e.spec.axesSpec.map(u.getAxisId).every(i=>n.some(s=>u.matchAxisId(s,i)&&u.matchAxisId(i,s)))}function Me(t,e){const n=t.spec.axesSpec.map(u.getAxisId);return e.spec.axesSpec.map(u.getAxisId).every(i=>n.some(s=>u.matchAxisId(s,i)))}const We="pl7.app/graph/isVirtual",pe="pl7.app/label";function Pe(t,e){const n=t.spec.axesSpec.map(u.getAxisId),r=e.spec.axesSpec.map(u.getAxisId);if(Zt(t,e))return[];if(!Me(t,e))return[];const o=r.map(P=>n.filter(p=>u.matchAxisId(p,P))),a=Qt(o),l=new Set,c=new Set,b=a.map(P=>{const p=new Set;return P.map((h,g)=>{const f=e.spec.axesSpec[g].domain,I=h.domain;return Object.entries(I??{}).forEach(([d,v])=>{if((f==null?void 0:f[d])===void 0){const m=JSON.stringify([d,v]);p.add(m),l.add(m)}}),{...h,annotations:e.spec.axesSpec[g].annotations}}),p});return[...l].forEach(P=>{b.some(p=>!p.has(P))&&c.add(P)}),a.map((P,p)=>{var d;const h=Xt(e.id,P.map(v=>v.domain)),g=((d=e.spec.annotations)==null?void 0:d[pe])??"",f=[...b[p]].filter(v=>c.has(v)).sort().map(v=>{var m;return(m=JSON.parse(v))==null?void 0:m[1]}).join(" / "),I={...e.spec.annotations,[We]:"true"};return(g||f)&&(I[pe]=g&&f?g+" / "+f:g+f),{id:h,spec:{...e.spec,axesSpec:P.map((v,m)=>({...v,annotations:e.spec.axesSpec[m].annotations})),annotations:I},data:e.data}})}function Ge(t){const e=[];for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){const i=t[n],s=t[r];e.push(...Pe(i,s),...Pe(s,i))}return e}function qe(t,e){const n=new Set,r=new Map;t.forEach(s=>{n.add(s.id),r.set(u.canonicalizeJson(u.getPColumnSpecId(s.spec)),s)});const i=new Map;for(const s of e){if(n.has(s.id))continue;const o=u.canonicalizeJson(u.getPColumnSpecId(s.spec));if(!r.has(o)){for(const a of r.values())if(Me(a,s)){i.set(o,s);break}}}return[...r.values(),...i.values()]}const en=["Int","Long","Float","Double","String","Bytes"];function tn(t,e){if(e===void 0)return;const n=t.resultPool.getData().entries.map(s=>s.obj).filter(u.isPColumn).filter(s=>en.includes(s.spec.valueType)),r=qe(e,n),i=[...r,...Ge(r)];if(!i.some(s=>s.data instanceof T&&!s.data.getIsReadyOrError()))return t.createPFrame(i)}class nn{constructor(e){this.handle=e}async findColumns(e){return await platforma.pFrameDriver.findColumns(this.handle,e)}async getColumnSpec(e){return await platforma.pFrameDriver.getColumnSpec(this.handle,e)}async listColumns(){return await platforma.pFrameDriver.listColumns(this.handle)}async calculateTableData(e){return await platforma.pFrameDriver.calculateTableData(this.handle,e)}async getUniqueValues(e){return await platforma.pFrameDriver.getUniqueValues(this.handle,e)}}function ze(t){return fe({__isRef:!0,blockId:H(t,"blockId"),name:H(t,"name")})}function rn(t){return fe({ref:ze(H(t,"ref")),label:H(t,"label")})}const sn={sdkVersion:z};function He(){return Se({sdkVersion:z})}function on(t){try{return He()}catch{return t}}function an(t){if(typeof globalThis.getEnvironmentValue=="function")return globalThis.getEnvironmentValue(t)}exports.Args=nt;exports.BlockModel=_;exports.CurrentSdkInfo=sn;exports.FutureRef=x;exports.IS_VIRTUAL_COLUMN=We;exports.It=rt;exports.JsRenderInternal=Ft;exports.LABEL_ANNOTATION=pe;exports.MainOutputs=it;exports.OutputError=Ce;exports.PAnnotationLabel=Le;exports.PAnnotationTrace=Ee;exports.PColumnCollection=se;exports.PFrameImpl=nn;exports.RT_BINARY_PARTITIONED=F;exports.RT_BINARY_SUPER_PARTITIONED=J;exports.RT_JSON_PARTITIONED=N;exports.RT_JSON_SUPER_PARTITIONED=Q;exports.RT_RESOURCE_MAP=Y;exports.RT_RESOURCE_MAP_PARTITIONED=X;exports.RenderCtx=G;exports.ResultPool=Ne;exports.StagingOutputs=st;exports.Trace=Re;exports.TraceEntry=Oe;exports.TreeNodeAccessor=T;exports.UiState=ot;exports.allColumnsComputed=ye;exports.and=ft;exports.convertOrParsePColumnData=Ve;exports.createPFrameForGraphs=tn;exports.createPlDataTable=zt;exports.createPlDataTableSheet=Yt;exports.createPlDataTableV2=Ht;exports.deriveLabels=he;exports.downgradeCfgOrLambda=ne;exports.enrichColumnsWithCompatible=qe;exports.extractArchiveAndGetURL=Ct;exports.extractConfig=Wt;exports.filterDataInfoEntries=Ke;exports.flatten=ct;exports.fromPlOption=rn;exports.fromPlRef=ze;exports.getAdditionalColumns=Ge;exports.getAllLabelColumns=ge;exports.getBlobContent=bt;exports.getBlobContentAsJson=At;exports.getBlobContentAsString=vt;exports.getDownloadedBlobContent=Pt;exports.getEnvironmentValue=an;exports.getFromCfg=$;exports.getImmediate=q;exports.getImportProgress=It;exports.getJsonField=H;exports.getLastLogs=St;exports.getLogHandle=Tt;exports.getMatchingLabelColumns=me;exports.getOnDemandBlobContent=wt;exports.getPartitionKeysList=ke;exports.getPlatformaOrDefault=on;exports.getProgressLog=xt;exports.getProgressLogWithInfo=_t;exports.getRawPlatformaInstance=He;exports.getResourceField=gt;exports.getResourceValueAsJson=mt;exports.getUniquePartitionKeys=je;exports.ifDef=re;exports.isColumnOptional=Be;exports.isConfigLambda=Je;exports.isEmpty=dt;exports.isLabelColumn=qt;exports.isolate=tt;exports.makeArray=at;exports.makeObject=fe;exports.mapArrayValues=ut;exports.mapRecordValues=lt;exports.mapResourceFields=yt;exports.not=pt;exports.or=ht;exports.parsePColumnData=ie;exports.parsePTableColumnId=$e;exports.parseResourceMap=Vt;exports.readOutput=Ie;exports.stringifyPTableColumnId=Gt;exports.wrapOutputs=et;Object.keys(u).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>u[t]})});Object.keys(be).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>be[t]})});
|
|
1
|
+
"use strict";var Qe=Object.defineProperty;var Ze=(t,e,n)=>e in t?Qe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var E=(t,e,n)=>Ze(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@milaboratories/pl-model-common"),we=require("canonicalize"),K=require("zod"),be=require("@milaboratories/pl-error-like");class Ce extends Error{constructor(e,n){super(`${e.length}${n?"+":""} errors, first error: `+e[0].message),this.errors=e,this.moreErrors=n}}function Ie(t){if(!t.ok)throw new Ce(t.errors,t.moreErrors);return t.value}function et(t){return new Proxy(t,{get(e,n){return Ie(e[n])}})}function S(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null?z(t):t}function $(t){return{type:"GetFromCtx",variable:t}}function tt(t){return{type:"Isolate",cfg:t}}const nt=$("$args"),rt=$("$it"),it=$("$prod"),st=$("$staging"),ot=$("$ui");function z(t){return{type:"Immediate",value:t}}function fe(t){const e={};for(const[n,r]of Object.entries(t))e[n]=S(r);return{type:"MakeObject",template:e}}function at(...t){const e=[];for(const n of t)e.push(S(n));return{type:"MakeArray",template:e}}function q(t,e){return{type:"GetJsonField",source:S(t),field:S(e)}}function lt(t,e,n="$it"){return{type:"MapRecordValues",source:t,mapping:e,itVar:n}}function ut(t,e,n="$it"){return{type:"MapArrayValues",source:t,mapping:e,itVar:n}}function ct(t){return{type:"Flatten",source:t}}function dt(t){return{type:"IsEmpty",arg:t}}function pt(t){return{type:"Not",operand:t}}function ft(t,e){return{type:"And",operand1:t,operand2:e}}function ht(t,e){return{type:"Or",operand1:t,operand2:e}}function gt(t,e){return{type:"GetResourceField",source:S(t),field:S(e)}}function mt(){return function(t){return{type:"GetResourceValueAsJson",source:S(t)}}}function yt(t,e,n="$it"){return{type:"MapResourceFields",source:t,mapping:e,itVar:n}}function bt(t){return{type:"GetBlobContent",source:S(t)}}function vt(t){return{type:"GetBlobContentAsString",source:S(t)}}function At(){return function(t){return{type:"GetBlobContentAsJson",source:S(t)}}}function Pt(t){return{type:"GetDownloadedBlobContent",source:S(t)}}function wt(t){return{type:"GetOnDemandBlobContent",source:S(t)}}function Ct(t,e){return{type:"ExtractArchiveAndGetURL",format:e,source:S(t)}}function It(t){return{type:"GetImportProgress",source:S(t)}}function St(t,e){return{type:"GetLastLogs",source:S(t),lines:e}}function xt(t,e){return{type:"GetProgressLog",source:S(t),patternToSearch:e}}function _t(t,e){return{type:"GetProgressLogWithInfo",source:S(t),patternToSearch:e}}function Tt(t){return{type:"GetLogHandle",source:S(t)}}function Lt(){return typeof globalThis.getPlatforma<"u"||typeof globalThis.platforma<"u"}function Se(t){if(t&&typeof globalThis.getPlatforma=="function")return globalThis.getPlatforma(t);if(typeof globalThis.platforma<"u")return globalThis.platforma;throw new Error("Can't get platforma instance.")}function Et(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx}function y(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx;throw new Error("Not in config rendering context")}function W(t,e){const n=Et();if(n===void 0)return!1;if(t in n.callbackRegistry)throw new Error(`Callback with key ${t} already registered.`);return n.callbackRegistry[t]=e,!0}const le=new Map;function Ot(t,e){t in y().callbackRegistry||(y().callbackRegistry[t]=n=>{for(const r of le.get(t))r(n)},le.set(t,[])),le.get(t).push(e)}class x{constructor(e,n=r=>r){E(this,"isResolved",!1);E(this,"resolvedValue");this.handle=e,this.postProcess=n,Ot(e,r=>{this.resolvedValue=n(r),this.isResolved=!0})}map(e){return new x(this.handle,n=>e(this.postProcess(n)))}mapDefined(e){return new x(this.handle,n=>{const r=this.postProcess(n);return r?e(r):void 0})}toJSON(){return this.isResolved?this.resolvedValue:{__awaited_futures__:[this.handle]}}}function re(t,e){return t===void 0?void 0:e(t)}class T{constructor(e,n){this.handle=e,this.resolvePath=n}resolve(...e){const n=e.map(r=>({assertFieldType:"Input",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveOutput(...e){const n=e.map(r=>({assertFieldType:"Output",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveInput(...e){const n=e.map(r=>({assertFieldType:"Input",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveAny(...e){return this.resolveWithCommon({},...e)}resolveWithCommon(e,...n){const r=[...this.resolvePath,...n.map(i=>typeof i=="string"?i:i.field)];return re(y().resolveWithCommon(this.handle,e,...n),i=>new T(i,r))}get resourceType(){return y().getResourceType(this.handle)}getInputsLocked(){return y().getInputsLocked(this.handle)}getOutputsLocked(){return y().getOutputsLocked(this.handle)}getIsReadyOrError(){return y().getIsReadyOrError(this.handle)}getIsFinal(){return y().getIsFinal(this.handle)}getError(){const e=[...this.resolvePath,"error"];return re(y().getError(this.handle),n=>new T(n,e))}listInputFields(){return y().listInputFields(this.handle)}listOutputFields(){return y().listOutputFields(this.handle)}listDynamicFields(){return y().listDynamicFields(this.handle)}getKeyValueBase64(e){return y().getKeyValueBase64(this.handle,e)}getKeyValueAsString(e){return y().getKeyValueAsString(this.handle,e)}getKeyValueAsJson(e){const n=this.getKeyValueAsString(e);if(n==null)throw new Error("Resource has no content.");return JSON.parse(n)}getDataBase64(){return y().getDataBase64(this.handle)}getDataAsString(){return y().getDataAsString(this.handle)}getDataAsJson(){const e=this.getDataAsString();if(e==null)throw new Error("Resource has no content.");return JSON.parse(e)}getPColumns(e=!1,n=""){const r=this.parsePObjectCollection(e,n);return r===void 0?void 0:Object.entries(r).map(([,s])=>{if(!u.isPColumn(s))throw new Error(`not a PColumn (kind = ${s.spec.kind})`);return s})}parsePObjectCollection(e=!1,n=""){const r=y().parsePObjectCollection(this.handle,e,n,...this.resolvePath);if(r===void 0)return;const i={};for(const[s,o]of Object.entries(r)){const a=[...this.resolvePath,s];i[s]=u.mapPObjectData(o,l=>new T(l,a))}return i}getFileContentAsBase64(){return new x(y().getBlobContentAsBase64(this.handle))}getFileContentAsString(){return new x(y().getBlobContentAsString(this.handle))}getFileContentAsJson(){return new x(y().getBlobContentAsString(this.handle)).mapDefined(e=>JSON.parse(e))}getBlobContentAsBase64(){return this.getFileContentAsBase64()}getBlobContentAsString(){return this.getFileContentAsString()}getFileHandle(){return new x(y().getDownloadedBlobContentHandle(this.handle))}getDownloadedBlobHandle(){return this.getFileHandle()}getRemoteFileHandle(){return new x(y().getOnDemandBlobContentHandle(this.handle))}getOnDemandBlobHandle(){return this.getRemoteFileHandle()}extractArchiveAndGetURL(e){return new x(y().extractArchiveAndGetURL(this.handle,e))}getImportProgress(){return new x(y().getImportProgress(this.handle))}getLastLogs(e){return new x(y().getLastLogs(this.handle,e))}getProgressLog(e){return new x(y().getProgressLog(this.handle,e))}getProgressLogWithInfo(e){return new x(y().getProgressLogWithInfo(this.handle,e))}getLogHandle(){return new x(y().getLogHandle(this.handle))}allFieldsResolved(e="Input"){switch(e){case"Input":return this.getInputsLocked()&&this.listInputFields().every(n=>this.resolve({field:n,assertFieldType:"Input"})!==void 0);case"Output":return this.getOutputsLocked()&&this.listOutputFields().every(n=>this.resolve({field:n,assertFieldType:"Output"})!==void 0)}}mapFields(e,n){const{fieldType:r,requireLocked:i,skipUnresolved:s}={fieldType:"Input",requireLocked:!0,skipUnresolved:!1,...n},o=e;if(i&&(r==="Input"&&!this.getInputsLocked()||r==="Output"&&!this.getOutputsLocked()))return;let l=(r==="Input"?this.listInputFields():r==="Output"?this.listOutputFields():this.listDynamicFields()).map(c=>[c,this.resolve({field:c,assertFieldType:r})]);return s&&(l=l.filter(c=>c[1]!==void 0)),l.map(([c,b])=>o(c,b))}}const xe="staging",_e="main",Rt={explicitColumnsSupport:!0,inlineColumnsSupport:!0,activeArgs:!0};function Te(t){return typeof t=="object"&&t!==null&&"__awaited_futures__"in t}function ce(t,e,n){if(e.has(n))return;if(e.add(n),typeof n==="object")if(Te(n))n.__awaited_futures__.forEach(i=>t.add(i));else if(Array.isArray(n))for(const i of n)ce(t,e,i);else for(const[,i]of Object.entries(n))i!==n&&ce(t,e,i)}function Dt(t){const e=new Set;return ce(e,new Set,t),e}const Ft=Object.freeze(Object.defineProperty({__proto__:null,GlobalCfgRenderCtxFeatureFlags:Rt,MainAccessorName:_e,StagingAccessorName:xe,getAllFutureAwaits:Dt,isFutureAwait:Te},Symbol.toStringTag,{value:"Module"})),Le="pl7.app/label",Ee="pl7.app/trace",Oe=K.z.object({type:K.z.string(),importance:K.z.number().optional(),id:K.z.string().optional(),label:K.z.string()}),Re=K.z.array(Oe),kt=.001,jt="__LABEL__",ve="__LABEL__@1";function he(t,e,n={}){const r=new Map,i=new Map,s=t.map(h=>{var ee,O;const g=e(h);let f,I,d;"spec"in g&&typeof g.spec=="object"?(f=g.spec,I=g.prefixTrace,d=g.suffixTrace):f=g;const v=(ee=f.annotations)==null?void 0:ee[Le],m=(O=f.annotations)==null?void 0:O[Ee],A=(m?Re.safeParse(JSON.parse(m)).data:void 0)??[],w=[...I??[],...A,...d??[]];if(v){const L={label:v,type:jt,importance:-2};n.addLabelAsSuffix?w.push(L):w.splice(0,0,L)}const R=[],U=new Map;for(let L=w.length-1;L>=0;--L){const{type:k}=w[L],oe=w[L].importance??0,B=(U.get(k)??0)+1;U.set(k,B);const C=`${k}@${B}`;i.set(C,(i.get(C)??0)+1),r.set(C,Math.max(r.get(C)??Number.NEGATIVE_INFINITY,oe-(w.length-L)*kt)),R.push({...w[L],fullType:C,occurenceIndex:B})}return R.reverse(),{value:h,spec:f,label:v,fullTrace:R}}),o=[],a=[],l=[...r];l.sort(([,h],[,g])=>g-h);for(const[h]of l)h.endsWith("@1")||i.get(h)===t.length?o.push(h):a.push(h);const c=h=>{const g=[];for(let f=0;f<s.length;f++){const I=s[f],d=I.fullTrace.filter(A=>h.has(A.fullType));if(d.length===0)return;const v=d.map(A=>A.label),m=n.separator??" / ";g.push({label:v.join(m),value:I.value})}return g};if(o.length===0){if(a.length!==0)throw new Error("Assertion error.");const h=c(new Set(ve));if(h===void 0)throw new Error("Assertion error.");return h}let b=0,P=0;for(;b<o.length;){const h=new Set;n.includeNativeLabel&&h.add(ve);for(let f=0;f<b;++f)h.add(o[f]);h.add(o[P]);const g=c(h);if(g!==void 0&&new Set(g.map(f=>f.label)).size===t.length)return g;P++,P>=o.length&&(b++,P=b)}const p=c(new Set([...o,...a]));if(p===void 0)throw new Error("Assertion error.");return p}const Z="PColumnData/",Y=Z+"ResourceMap",X=Z+"Partitioned/ResourceMap",N=Z+"JsonPartitioned",F=Z+"BinaryPartitioned",De=Z+"Partitioned/",Q=De+"JsonPartitioned",J=De+"BinaryPartitioned";function Fe(t,e,n,r=[],i){if(t===void 0)return!1;switch(t.resourceType.name){case Y:{let s=t.getInputsLocked();for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"}),l=[...r,...JSON.parse(o)],c=a===void 0?void 0:e(a);c===void 0&&(s=!1),(c!==void 0||i)&&n.push({key:l,value:c})}return s}case X:{let s=t.getInputsLocked();for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"});if(a===void 0)s=!1;else{const l=[...r,...JSON.parse(o)],c=Fe(a,e,n,l,i);s=s&&c}}return s}default:throw new Error(`Unknown resource type: ${t.resourceType.name}`)}}function Vt(t,e,n=!1){const r=[];return{isComplete:Fe(t,e,r,[],n),data:r}}const de=t=>{if(t.endsWith(".index"))return{baseKey:t.substring(0,t.length-6),type:"index"};if(t.endsWith(".values"))return{baseKey:t.substring(0,t.length-7),type:"values"};throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`)};function ke(t){if(!t)return;const e=t.resourceType.name,n=t.getDataAsJson(),r=[];let i=0;switch(e){case Y:i=n.keyLength;break;case X:i=n.partitionKeyLength+n.keyLength;break;case N:case F:i=n.partitionKeyLength;break;case J:case Q:i=n.superPartitionKeyLength+n.partitionKeyLength;break}switch(e){case Y:case N:case F:for(let s of t.listInputFields()){e===F&&(s=de(s).baseKey);const o=[...JSON.parse(s)];r.push(o)}break;case X:case J:case Q:for(const s of t.listInputFields()){const o=[...JSON.parse(s)],a=t.resolve({field:s,assertFieldType:"Input"});if(a!==void 0)for(let l of a.listInputFields()){e===J&&(l=de(l).baseKey);const c=[...o,...JSON.parse(l)];r.push(c)}}break}return{data:r,keyLength:i}}function Kt(t){if(t.type!=="JsonPartitioned"&&t.type!=="BinaryPartitioned")throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${t.type}`);const{parts:e,partitionKeyLength:n}=t,r=[];for(let i=0;i<n;++i)r.push(new Set);for(const i of e){const s=i.key;if(s.length!==n)throw new Error(`Key length (${s.length}) does not match partition length (${n}) for key: ${JSON.stringify(s)}`);for(let o=0;o<n;++o)r[o].add(s[o])}return r.map(i=>Array.from(i.values()))}function je(t){if(t===void 0)return;if(u.isDataInfoEntries(t))return Kt(t);const e=ke(t);if(!e)return;const{data:n,keyLength:r}=e,i=[];for(let s=0;s<r;++s)i.push(new Set);for(const s of n){if(s.length!==r)throw new Error("key length does not match partition length");for(let o=0;o<r;++o)i[o].add(s[o])}return i.map(s=>Array.from(s.values()))}function ie(t,e=[]){if(t===void 0||!t.getIsReadyOrError())return;const n=t.resourceType.name,r=t.getDataAsJson();if(e.length>0&&(n===Q||n===J))throw new Error(`Unexpected nested super-partitioned resource: ${n}`);switch(n){case Y:case X:throw new Error(`Only data columns are supported, got: ${n}`);case N:{if(typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${n}`);const i=[];for(const s of t.listInputFields()){const o=t.resolve({field:s,assertFieldType:"Input"});if(o===void 0)return;const a=[...e,...JSON.parse(s)];i.push({key:a,value:o})}return{type:"JsonPartitioned",partitionKeyLength:r.partitionKeyLength,parts:i}}case F:{if(typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${n}`);const i=[],s=new Map;for(const o of t.listInputFields()){const a=de(o),l=t.resolve({field:o,assertFieldType:"Input"});if(l===void 0)return;let c=s.get(a.baseKey);c||(c={},s.set(a.baseKey,c)),a.type==="index"?c.index=l:c.values=l}for(const[o,a]of s.entries()){if(!a.index||!a.values)return;const l=[...e,...JSON.parse(o)];i.push({key:l,value:{index:a.index,values:a.values}})}return{type:"BinaryPartitioned",partitionKeyLength:r.partitionKeyLength,parts:i}}case Q:{if(typeof(r==null?void 0:r.superPartitionKeyLength)!="number"||typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n}`);const i=r.superPartitionKeyLength+r.partitionKeyLength,s=[];for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"});if(a===void 0)return;if(a.resourceType.name!==N)throw new Error(`Expected ${N} inside ${n}, but got ${a.resourceType.name}`);const l=ie(a,JSON.parse(o));if(l===void 0)return;if(l.type!=="JsonPartitioned")throw new Error(`Unexpected inner result type for ${n}: ${l.type}`);s.push(...l.parts)}return{type:"JsonPartitioned",partitionKeyLength:i,parts:s}}case J:{if(typeof(r==null?void 0:r.superPartitionKeyLength)!="number"||typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n}`);const i=r.superPartitionKeyLength+r.partitionKeyLength,s=[];for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"});if(a===void 0)return;if(a.resourceType.name!==F)throw new Error(`Expected ${F} inside ${n}, but got ${a.resourceType.name}`);const l=ie(a,JSON.parse(o));if(l===void 0)return;if(l.type!=="BinaryPartitioned")throw new Error(`Unexpected inner result type for ${n}: ${l.type}`);s.push(...l.parts)}return{type:"BinaryPartitioned",partitionKeyLength:i,parts:s}}default:throw new Error(`Unknown resource type: ${n}`)}}function Ve(t){if(t!==void 0){if(u.isDataInfoEntries(t))return t;if(u.isDataInfo(t))return u.dataInfoToEntries(t);if(t instanceof T)return ie(t);throw new Error(`Unexpected input type: ${typeof t}`)}}function Ke(t,e){const n=[...e].sort((s,o)=>o[0]-s[0]);if(t.type==="JsonPartitioned"||t.type==="BinaryPartitioned"){const{partitionKeyLength:s}=t;for(const[o]of e)if(o>=s)throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s}`)}else if(t.type==="Json"){const{keyLength:s}=t;for(const[o]of e)if(o>=s)throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s}`)}const r=s=>{for(const[o,a]of n)if(s[o]!==a)return!1;return!0},i=s=>{const o=[...s];for(const[a]of n)o.splice(a,1);return o};switch(t.type){case"Json":{const s=t.data.filter(o=>r(o.key)).map(o=>({key:i(o.key),value:o.value}));return{type:"Json",keyLength:t.keyLength-e.length,data:s}}case"JsonPartitioned":{const s=t.parts.filter(o=>r(o.key)).map(o=>({key:i(o.key),value:o.value}));return{type:"JsonPartitioned",partitionKeyLength:t.partitionKeyLength-e.length,parts:s}}case"BinaryPartitioned":{const s=t.parts.filter(o=>r(o.key)).map(o=>({key:i(o.key),value:o.value}));return{type:"BinaryPartitioned",partitionKeyLength:t.partitionKeyLength-e.length,parts:s}}}}class Nt{constructor(e){this.columns=e}selectColumns(e){const n=typeof e=="function"?e:u.selectorsToPredicate(e);return this.columns.filter(r=>n(r.spec))}}function Jt(t){if(t)return t.map(e=>({type:`split:${u.canonicalizeAxisId(e.axisId)}`,label:e.label,importance:1e6}))}function $t(t){if(t)return t.map(e=>[e.axisIdx,e.value])}function Ut(t,e){if(!e||e.length===0)return t;const n=[...e].sort((r,i)=>r[0]-i[0]);return we({id:t,axisFilters:n})}function Bt(t){if(!t||typeof t!="object")return!1;const e=t,n=e.domain&&typeof e.domain=="object"&&Object.values(e.domain).some(i=>typeof i=="object"&&i!==null&&"anchor"in i),r=e.axes&&Array.isArray(e.axes)&&e.axes.some(i=>typeof i=="object"&&i!==null&&"anchor"in i);return!!e.domainAnchor||n||r}function Mt(t){if(typeof t!="object"||!("axes"in t)||t.axes===void 0)return[];const e=t.axes.map((n,r)=>typeof n=="object"&&"split"in n&&n.split===!0?r:-1).filter(n=>n!==-1);if(e.length>0&&t.partialAxesMatch!==void 0)throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");return e.sort((n,r)=>n-r),e}class se{constructor(){E(this,"defaultProviderStore",[]);E(this,"providers",[new Nt(this.defaultProviderStore)]);E(this,"axisLabelProviders",[])}addColumnProvider(e){return this.providers.push(e),this}addAxisLabelProvider(e){return this.axisLabelProviders.push(e),this}addColumns(e){return this.defaultProviderStore.push(...e),this}addColumn(e){return this.defaultProviderStore.push(e),this}findLabels(e){for(const n of this.axisLabelProviders){const r=n.findLabels(e);if(r)return r}}getUniversalEntries(e,n){const{anchorCtx:r,labelOps:i,dontWaitAllData:s=!1,overrideLabelAnnotation:o=!1}=n??{},a={...o&&(i==null?void 0:i.includeNativeLabel)!==!1?{includeNativeLabel:!0}:{},...i??{}},l=typeof e=="function"?[e]:Array.isArray(e)?e:[e],c=[];for(const p of l){const h=Bt(p);let g;if(h){if(!r)throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");g=u.resolveAnchors(r.anchors,p,n)}else g=p;const f=new Set,I=[];for(const m of this.providers){const A=m.selectColumns(g);for(const w of A){if(f.has(w.id))throw new Error(`Duplicate column id ${w.id} in provider ${m.constructor.name}`);f.add(w.id),I.push(w)}}if(I.length===0)continue;const d=Mt(p),v=d.length>0;for(const m of I){if(!u.isPColumnSpec(m.spec))continue;const A=m.spec;if(v){const w=Ve(m.data);if(!w){if(s)continue;return}if(!u.isPartitionedDataInfoEntries(w))throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${w.type} for column ${m.id}`);const R=je(w),U=d[d.length-1];if(U>=w.partitionKeyLength)throw new Error(`Not enough partition keys (${w.partitionKeyLength}) for requested split axes (max index ${U}) in column ${A.name}`);const ee=d.map(C=>this.findLabels(u.getAxisId(A.axesSpec[C]))),O=[],L=(C,M)=>{if(M>=d.length){if(O.push([...C]),O.length>1e4)throw new Error("Too many key combinations, aborting.");return}const D=d[M];if(D>=R.length)throw new Error(`Axis index ${D} out of bounds for unique keys array (length ${R.length}) during split key generation for column ${m.id}`);const j=R[D];if(!j||j.length===0){O.length=0;return}for(const te of j)C.push(te),L(C,M+1),C.pop()};if(L([],0),O.length===0)continue;const k=[...A.axesSpec],oe=d.map(C=>C);for(let C=d.length-1;C>=0;C--)k.splice(d[C],1);const B={...A,axesSpec:k};for(const C of O){const M=C.map((D,j)=>{const te=oe[j],Ye=u.getAxisId(A.axesSpec[te]),ae=ee[j],Xe=(ae==null?void 0:ae[D])??String(D);return{axisIdx:te,axisId:Ye,value:D,label:Xe}});c.push({type:"split",originalColumn:m,spec:A,adjustedSpec:B,dataEntries:w,axisFilters:M})}}else c.push({type:"direct",originalColumn:m,spec:A,adjustedSpec:A})}}if(c.length===0)return[];const b=he(c,p=>({spec:p.spec,suffixTrace:p.type==="split"?Jt(p.axisFilters):void 0}),a),P=[];for(const{value:p,label:h}of b){const{originalColumn:g,spec:f}=p,I=p.type==="split"?p.axisFilters:void 0,d=$t(I);let v;r?v=r.deriveS(f,d):v=Ut(g.id,d);let m={...p.adjustedSpec};o&&(m={...m,annotations:{...m.annotations??{},"pl7.app/label":h}}),P.push({id:v,spec:m,data:()=>p.type==="split"?u.entriesToDataInfo(Ke(p.dataEntries,d)):p.originalColumn.data,label:h})}return P}getColumns(e,n){const r=this.getUniversalEntries(e,{overrideLabelAnnotation:!0,...n??{}});if(!r)return;const i=[];for(const s of r){const o=s.data();if(!o){if(n!=null&&n.dontWaitAllData)continue;return}i.push({id:s.id,spec:s.spec,data:o})}return i}}function ue(t,e){if(t===void 0)return e===void 0;if(e===void 0)return!0;for(const n in e)if(t[n]!==e[n])return!1;return!0}function Ae(t){return u.mapPObjectData(t,e=>e instanceof T?e.handle:u.isDataInfo(e)?u.mapDataInfo(e,n=>n.handle):e)}class Ne{constructor(){E(this,"ctx",y())}calculateOptions(e){return this.ctx.calculateOptions(e)}getOptions(e,n){const r=typeof e=="function"?e:u.selectorsToPredicate(e),i=this.getSpecs().entries.filter(a=>r(a.obj));let s={},o=!1;return typeof n<"u"&&(typeof n=="function"?s=n:typeof n=="object"&&("includeNativeLabel"in n||"separator"in n||"addLabelAsSuffix"in n?s=n:(n=n,s=n.label??{},o=n.refsWithEnrichments??!1))),typeof s=="object"?he(i,a=>a.obj,s??{}).map(({value:{ref:a},label:l})=>({ref:u.withEnrichments(a,o),label:l})):i.map(({ref:a,obj:l})=>({ref:u.withEnrichments(a,o),label:s(l,a)}))}resolveAnchorCtx(e){if(e instanceof u.AnchoredIdDeriver)return e;const n={};for(const[r,i]of Object.entries(e))if(u.isPlRef(i)){const s=this.getPColumnSpecByRef(i);if(!s)return;n[r]=s}else n[r]=i;return new u.AnchoredIdDeriver(n)}getAnchoredPColumns(e,n,r){const i=this.resolveAnchorCtx(e);if(i)return new se().addColumnProvider(this).addAxisLabelProvider(this).getColumns(n,{...r,anchorCtx:i})}getCanonicalOptions(e,n,r){const i=this.resolveAnchorCtx(e);if(!i)return;const s=new se().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(n,{...r,anchorCtx:i});if(s)return s.map(o=>({value:o.id,label:o.label}))}getDataFromResultPool(){return this.getData()}getData(){const e=this.ctx.getDataFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:new T(n.obj.data,[n.ref.blockId,n.ref.name])}}))}}getDataWithErrorsFromResultPool(){return this.getDataWithErrors()}getDataWithErrors(){const e=this.ctx.getDataWithErrorsFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:u.mapValueInVOE(n.obj.data,r=>new T(r,[n.ref.blockId,n.ref.name]))}}))}}getSpecsFromResultPool(){return this.getSpecs()}getSpecs(){return this.ctx.getSpecsFromResultPool()}getDataByRef(e){var r;if(typeof this.ctx.getDataFromResultPoolByRef>"u")return(r=this.getData().entries.find(i=>i.ref.blockId===e.blockId&&i.ref.name===e.name))==null?void 0:r.obj;const n=this.ctx.getDataFromResultPoolByRef(e.blockId,e.name);if(n)return u.mapPObjectData(n,i=>new T(i,[e.blockId,e.name]))}getPColumnByRef(e){const n=this.getDataByRef(e);if(n)return u.ensurePColumn(n)}getPColumnSpecByRef(e){const n=this.getSpecByRef(e);if(n){if(!u.isPColumnSpec(n))throw new Error(`not a PColumn spec (kind = ${n.kind})`);return n}}getSpecByRef(e){return this.ctx.getSpecFromResultPoolByRef(e.blockId,e.name)}findDataWithCompatibleSpec(e){const n=[];e:for(const r of this.getData().entries){if(!u.isPColumnSpec(r.obj.spec))continue;const i=r.obj.spec;if(e.name===i.name&&e.valueType===i.valueType&&e.axesSpec.length===i.axesSpec.length&&ue(e.domain,i.domain)){for(let s=0;s<e.axesSpec.length;++s){const o=e.axesSpec[s],a=i.axesSpec[s];if(o.name!==a.name||o.type!==a.type||!ue(o.domain,a.domain))continue e}n.push(r.obj)}}return n}findLabels(e){const n=this.getData();for(const r of n.entries){if(!u.isPColumn(r.obj))continue;const i=r.obj.spec;if(i.name==="pl7.app/label"&&i.axesSpec.length===1&&i.axesSpec[0].name===e.name&&i.axesSpec[0].type===e.type&&ue(e.domain,i.axesSpec[0].domain)){if(r.obj.data.resourceType.name!=="PColumnData/Json")throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);return Object.fromEntries(Object.entries(r.obj.data.getDataAsJson().data).map(o=>[JSON.parse(o[0])[0],o[1]]))}}}selectColumns(e){const n=typeof e=="function"?e:u.selectorsToPredicate(e);return this.getSpecs().entries.filter(({obj:i})=>u.isPColumnSpec(i)?n(i):!1).map(({ref:i,obj:s})=>{const o=s;let a=null;const l=this;return{id:we(i),spec:o,get data(){var c;return a!==null||(a=(c=l.getPColumnByRef(i))==null?void 0:c.data),a}}})}findLabelsForColumnAxis(e,n){var s;const r=this.findLabels(e.axesSpec[n]);if(!r)return;const i=(s=e.annotations)==null?void 0:s["pl7.app/axisKeys/"+n];if(i!==void 0){const o=JSON.parse(i);return Object.fromEntries(o.map(a=>[a,r[a]??"Unlabelled"]))}else return r}}class G{constructor(){E(this,"ctx");E(this,"args");E(this,"uiState");E(this,"_activeArgsCache");E(this,"resultPool",new Ne);this.ctx=y(),this.args=JSON.parse(this.ctx.args),this.uiState=this.ctx.uiState!==void 0?JSON.parse(this.ctx.uiState):{}}get activeArgs(){return this._activeArgsCache===void 0&&(this._activeArgsCache={v:this.ctx.activeArgs?JSON.parse(this.ctx.activeArgs):void 0}),this._activeArgsCache.v}getNamedAccessor(e){return re(this.ctx.getAccessorHandleByName(e),n=>new T(n,[e]))}get prerun(){return this.getNamedAccessor(xe)}get outputs(){return this.getNamedAccessor(_e)}findLabels(e){return this.resultPool.findLabels(e)}verifyInlineAndExplicitColumnsSupport(e){var i;const n=e.some(s=>!(s.data instanceof T)||u.isDataInfo(s.data)),r=((i=this.ctx.featureFlags)==null?void 0:i.inlineColumnsSupport)===!0;if(n&&!r)throw Error("Inline or explicit columns not supported")}createPFrame(e){return this.verifyInlineAndExplicitColumnsSupport(e),this.ctx.createPFrame(e.map(n=>Ae(n)))}createPTable(e){let n;return"columns"in e?n={src:{type:"full",entries:e.columns.map(r=>({type:"column",column:r}))},filters:e.filters??[],sorting:e.sorting??[]}:n=e,this.verifyInlineAndExplicitColumnsSupport(u.extractAllColumns(n.src)),this.ctx.createPTable(u.mapPTableDef(n,r=>Ae(r)))}getBlockLabel(e){return this.ctx.getBlockLabel(e)}getCurrentUnstableMarker(){return this.ctx.getCurrentUnstableMarker()}}const H="1.30.3";function Je(t){return t.__renderLambda===!0}function ne(t){if(t!==void 0)return Je(t)?t.handle:t}function V(t){if(t!==void 0)return typeof t=="string"?{__renderLambda:!0,handle:t,retentive:!1}:t}function Wt(t){if(t.v3!==void 0){const{initialArgs:e,initialUiState:n,inputsValid:r,outputs:i,renderingMode:s,sdkVersion:o,sections:a,title:l,enrichmentTargets:c}=t.v3,{code:b}=t;return{initialArgs:e,initialUiState:n,inputsValid:r,outputs:i,renderingMode:s,sdkVersion:o,sections:a,title:l,code:b,enrichmentTargets:c}}else if(t.inputsValid!==void 0){const{sdkVersion:e,renderingMode:n,outputs:r,inputsValid:i,sections:s,initialArgs:o,code:a}=t,l=Object.keys(t);if(e===void 0||n===void 0||r===void 0||i===void 0||s===void 0||o===void 0)throw new Error(`Malformed config v2. SDK version ${e}; Fields = ${l.join(", ")}`);return{sdkVersion:e,renderingMode:n,initialArgs:o,outputs:Object.fromEntries(Object.entries(r).map(([c,b])=>[c,V(b)])),inputsValid:V(i),sections:V(s),initialUiState:void 0,code:a}}else if(t.renderingMode!==void 0){const{sdkVersion:e,canRun:n,renderingMode:r,outputs:i,sections:s,initialArgs:o,code:a}=t,l=Object.keys(t);if(r===void 0||i===void 0||n===void 0||s===void 0||o===void 0)throw new Error(`Malformed config v1. SDK version ${e}; Fields = ${l.join(", ")}`);return{sdkVersion:e??"unknown",renderingMode:r,initialArgs:o,outputs:Object.fromEntries(Object.entries(i).map(([c,b])=>[c,V(b)])),inputsValid:V(n),sections:V(s),initialUiState:void 0,code:a}}else{const{sdkVersion:e}=t,n=Object.keys(t);throw new Error(`Config format not supported: SDK = ${e}; Fields = ${n.join(", ")}`)}}class _{constructor(e,n,r,i,s,o,a,l){this._renderingMode=e,this._initialArgs=n,this._initialUiState=r,this._outputs=i,this._inputsValid=s,this._sections=o,this._title=a,this._enrichmentTargets=l}static create(e="Heavy"){return new _(e,void 0,{},{},z(!0),z([]),void 0,void 0)}output(e,n,r={}){if(typeof n=="function"){const i=`output#${e}`;return W(i,()=>n(new G)),new _(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:{__renderLambda:!0,handle:i,...r}},this._inputsValid,this._sections,this._title,this._enrichmentTargets)}else return new _(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:n},this._inputsValid,this._sections,this._title,this._enrichmentTargets)}retentiveOutput(e,n){return this.output(e,n,{retentive:!0})}argsValid(e){return typeof e=="function"?(W("inputsValid",()=>e(new G)),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,{__renderLambda:!0,handle:"inputsValid"},this._sections,this._title,this._enrichmentTargets)):new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,e,this._sections,this._title,this._enrichmentTargets)}sections(e){return Array.isArray(e)?this.sections(z(e)):typeof e=="function"?(W("sections",()=>e(new G)),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,{__renderLambda:!0,handle:"sections"},this._title,this._enrichmentTargets)):new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,e,this._title,this._enrichmentTargets)}title(e){return W("title",()=>e(new G)),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,{__renderLambda:!0,handle:"title"},this._enrichmentTargets)}initialArgs(e){return new _(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets)}withArgs(e){return new _(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets)}withUiState(e){return new _(this._renderingMode,this._initialArgs,e,this._outputs,this._inputsValid,this._sections,this._title,this._enrichmentTargets)}enriches(e){return W("enrichmentTargets",e),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title,{__renderLambda:!0,handle:"enrichmentTargets"})}done(){if(this._initialArgs===void 0)throw new Error("Initial arguments not set.");const e={v3:{sdkVersion:H,renderingMode:this._renderingMode,initialArgs:this._initialArgs,initialUiState:this._initialUiState,inputsValid:this._inputsValid,sections:this._sections,title:this._title,outputs:this._outputs,enrichmentTargets:this._enrichmentTargets},sdkVersion:H,renderingMode:this._renderingMode,initialArgs:this._initialArgs,inputsValid:ne(this._inputsValid),sections:ne(this._sections),outputs:Object.fromEntries(Object.entries(this._outputs).map(([n,r])=>[n,ne(r)]))};return Lt()?Se({sdkVersion:H}):{config:e}}}function Gt(t){const e=t.type;switch(e){case"axis":return u.canonicalizeJson(t);case"column":return u.canonicalizeJson(t);default:throw Error(`unsupported column type: ${e}`)}}function $e(t){return JSON.parse(t)}function zt(t){return t.axesSpec.length===1&&t.name==="pl7.app/label"}function ge(t){return new se().addAxisLabelProvider(t).addColumnProvider(t).getColumns({name:"pl7.app/label",axes:[{}]},{dontWaitAllData:!0})}function me(t,e){const n=(i,s)=>{let o=i.toString();if(s)for(const a in s)o+=a,o+=s[a];return o},r=new Map;for(const i of t)for(const s of i.spec.axesSpec){const o=u.getAxisId(s);for(const a of e){const l=a.spec.axesSpec[0],c=u.getAxisId(a.spec.axesSpec[0]);if(u.matchAxisId(o,c)){const b=Object.keys(o.domain??{}).length,P=Object.keys(c.domain??{}).length;if(b>P){const p=n(a.id,o.domain);r.set(p,{id:p,spec:{...a.spec,axesSpec:[{...o,annotations:l.annotations}]},data:a.data})}else r.set(n(a.id),a)}}}return[...r.values()]}function ye(t){const e=i=>Array.isArray(i),n=i=>i instanceof T,r=i=>typeof i=="object"&&"type"in i;return t.map(i=>i.data).every(i=>{if(e(i))return!0;if(n(i))return i.getIsReadyOrError();if(r(i))switch(i.type){case"Json":return!0;case"JsonPartitioned":return Object.values(i.parts).every(o=>o.getIsReadyOrError());case"BinaryPartitioned":return Object.values(i.parts).every(o=>o.index.getIsReadyOrError()&&o.values.getIsReadyOrError())}else throw Error(`unsupported column data type: ${i}`)})}function Ue(t,e,n,r,i,s){let o=t;const a=[];if(s){o=[];for(const l of t)s(l.spec)?o.push(l):a.push(l)}return a.push(...e),{src:{type:"outer",primary:{type:n,entries:o.map(l=>({type:"column",column:l}))},secondary:a.map(l=>({type:"column",column:l}))},filters:r,sorting:i}}function Ht(t,e,n,r){var c,b;Array.isArray(r)&&(r={filters:r});const i=(r==null?void 0:r.coreJoinType)??"full",s=[...(r==null?void 0:r.filters)??[],...((c=n==null?void 0:n.pTableParams)==null?void 0:c.filters)??[]],o=((b=n==null?void 0:n.pTableParams)==null?void 0:b.sorting)??[],a=ge(t.resultPool);if(!a)return;const l=me(e.map(u.getColumnIdAndSpec),a);if(ye([...e,...l]))return t.createPTable(Ue(e,l,i,s,o,r==null?void 0:r.coreColumnPredicate))}function Be(t){var e;return((e=t.annotations)==null?void 0:e["pl7.app/table/visibility"])==="optional"}function qt(t,e,n,r,i){var f,I;const s=(i==null?void 0:i.coreJoinType)??"full",o=[...(i==null?void 0:i.filters)??[],...((f=r==null?void 0:r.pTableParams)==null?void 0:f.filters)??[]],a=((I=r==null?void 0:r.pTableParams)==null?void 0:I.sorting)??[],l=e.find(d=>n(d.spec));if(!l)return;const c=ge(t.resultPool);if(!c)return;const b=new Set((()=>{var v,m;if(s==="inner")return[];const d=(m=(v=r==null?void 0:r.gridState.columnVisibility)==null?void 0:v.hiddenColIds)==null?void 0:m.map($e).filter(A=>A.type==="column").map(A=>A.id);return d||e.filter(A=>Be(A.spec)).map(A=>A.id)})());b.delete(l.id),[...o.map(d=>d.column),...a.map(d=>d.column)].filter(d=>d.type==="column").map(d=>b.delete(d.id));const P=e.filter(d=>!b.has(d.id)),p=me(P.map(u.getColumnIdAndSpec),c),h=[...l.spec.axesSpec.map(d=>({type:"axis",id:u.getAxisId(d),spec:d})),...[...e,...p].map(d=>({type:"column",id:d.id,spec:d.spec}))];if(!ye([...P,...p]))return;const g=t.createPTable(Ue(e,p,s,o,a,i==null?void 0:i.coreColumnPredicate));return{tableSpec:h,tableHandle:g}}function Yt(t,e,n){const r=t.resultPool.findLabels(e);return{axis:e,options:n.map(i=>({value:i,label:(r==null?void 0:r[i])??i.toString()})),defaultValue:n[0]}}const Xt=(t,e)=>{let n=t.toString();return e==null||e.forEach(r=>{if(r)for(const[i,s]of Object.entries(r))n+=i,n+=s}),n};function Qt(t){if(!t.length)return[];let e=[[]];return t.forEach(n=>{const r=[];n.forEach(i=>{r.push(...e.map(s=>[...s,i]))}),e=r}),e}function Zt(t,e){const n=t.spec.axesSpec.map(u.getAxisId);return e.spec.axesSpec.map(u.getAxisId).every(i=>n.some(s=>u.matchAxisId(s,i)&&u.matchAxisId(i,s)))}function Me(t,e){const n=t.spec.axesSpec.map(u.getAxisId);return e.spec.axesSpec.map(u.getAxisId).every(i=>n.some(s=>u.matchAxisId(s,i)))}const We="pl7.app/graph/isVirtual",pe="pl7.app/label";function Pe(t,e){const n=t.spec.axesSpec.map(u.getAxisId),r=e.spec.axesSpec.map(u.getAxisId);if(Zt(t,e))return[];if(!Me(t,e))return[];const o=r.map(P=>n.filter(p=>u.matchAxisId(p,P))),a=Qt(o),l=new Set,c=new Set,b=a.map(P=>{const p=new Set;return P.map((h,g)=>{const f=e.spec.axesSpec[g].domain,I=h.domain;return Object.entries(I??{}).forEach(([d,v])=>{if((f==null?void 0:f[d])===void 0){const m=JSON.stringify([d,v]);p.add(m),l.add(m)}}),{...h,annotations:e.spec.axesSpec[g].annotations}}),p});return[...l].forEach(P=>{b.some(p=>!p.has(P))&&c.add(P)}),a.map((P,p)=>{var d;const h=Xt(e.id,P.map(v=>v.domain)),g=((d=e.spec.annotations)==null?void 0:d[pe])??"",f=[...b[p]].filter(v=>c.has(v)).sort().map(v=>{var m;return(m=JSON.parse(v))==null?void 0:m[1]}).join(" / "),I={...e.spec.annotations,[We]:"true"};return(g||f)&&(I[pe]=g&&f?g+" / "+f:g+f),{id:h,spec:{...e.spec,axesSpec:P.map((v,m)=>({...v,annotations:e.spec.axesSpec[m].annotations})),annotations:I},data:e.data}})}function Ge(t){const e=[];for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){const i=t[n],s=t[r];e.push(...Pe(i,s),...Pe(s,i))}return e}function ze(t,e){const n=new Set,r=new Map;t.forEach(s=>{n.add(s.id),r.set(u.canonicalizeJson(u.getPColumnSpecId(s.spec)),s)});const i=new Map;for(const s of e){if(n.has(s.id))continue;const o=u.canonicalizeJson(u.getPColumnSpecId(s.spec));if(!r.has(o)){for(const a of r.values())if(Me(a,s)){i.set(o,s);break}}}return[...r.values(),...i.values()]}const en=["Int","Long","Float","Double","String","Bytes"];function tn(t,e){if(e===void 0)return;const n=t.resultPool.getData().entries.map(s=>s.obj).filter(u.isPColumn).filter(s=>en.includes(s.spec.valueType)),r=ze(e,n),i=[...r,...Ge(r)];if(!i.some(s=>s.data instanceof T&&!s.data.getIsReadyOrError()))return t.createPFrame(i)}class nn{constructor(e){this.handle=e}async findColumns(e){return await platforma.pFrameDriver.findColumns(this.handle,e)}async getColumnSpec(e){return await platforma.pFrameDriver.getColumnSpec(this.handle,e)}async listColumns(){return await platforma.pFrameDriver.listColumns(this.handle)}async calculateTableData(e){return await platforma.pFrameDriver.calculateTableData(this.handle,e)}async getUniqueValues(e){return await platforma.pFrameDriver.getUniqueValues(this.handle,e)}}function He(t){return fe({__isRef:!0,blockId:q(t,"blockId"),name:q(t,"name")})}function rn(t){return fe({ref:He(q(t,"ref")),label:q(t,"label")})}const sn={sdkVersion:H};function qe(){return Se({sdkVersion:H})}function on(t){try{return qe()}catch{return t}}function an(t){if(typeof globalThis.getEnvironmentValue=="function")return globalThis.getEnvironmentValue(t)}exports.Args=nt;exports.BlockModel=_;exports.CurrentSdkInfo=sn;exports.FutureRef=x;exports.IS_VIRTUAL_COLUMN=We;exports.It=rt;exports.JsRenderInternal=Ft;exports.LABEL_ANNOTATION=pe;exports.MainOutputs=it;exports.OutputError=Ce;exports.PAnnotationLabel=Le;exports.PAnnotationTrace=Ee;exports.PColumnCollection=se;exports.PFrameImpl=nn;exports.RT_BINARY_PARTITIONED=F;exports.RT_BINARY_SUPER_PARTITIONED=J;exports.RT_JSON_PARTITIONED=N;exports.RT_JSON_SUPER_PARTITIONED=Q;exports.RT_RESOURCE_MAP=Y;exports.RT_RESOURCE_MAP_PARTITIONED=X;exports.RenderCtx=G;exports.ResultPool=Ne;exports.StagingOutputs=st;exports.Trace=Re;exports.TraceEntry=Oe;exports.TreeNodeAccessor=T;exports.UiState=ot;exports.allColumnsComputed=ye;exports.and=ft;exports.convertOrParsePColumnData=Ve;exports.createPFrameForGraphs=tn;exports.createPlDataTable=Ht;exports.createPlDataTableSheet=Yt;exports.createPlDataTableV2=qt;exports.deriveLabels=he;exports.downgradeCfgOrLambda=ne;exports.enrichColumnsWithCompatible=ze;exports.extractArchiveAndGetURL=Ct;exports.extractConfig=Wt;exports.filterDataInfoEntries=Ke;exports.flatten=ct;exports.fromPlOption=rn;exports.fromPlRef=He;exports.getAdditionalColumns=Ge;exports.getAllLabelColumns=ge;exports.getBlobContent=bt;exports.getBlobContentAsJson=At;exports.getBlobContentAsString=vt;exports.getDownloadedBlobContent=Pt;exports.getEnvironmentValue=an;exports.getFromCfg=$;exports.getImmediate=z;exports.getImportProgress=It;exports.getJsonField=q;exports.getLastLogs=St;exports.getLogHandle=Tt;exports.getMatchingLabelColumns=me;exports.getOnDemandBlobContent=wt;exports.getPartitionKeysList=ke;exports.getPlatformaOrDefault=on;exports.getProgressLog=xt;exports.getProgressLogWithInfo=_t;exports.getRawPlatformaInstance=qe;exports.getResourceField=gt;exports.getResourceValueAsJson=mt;exports.getUniquePartitionKeys=je;exports.ifDef=re;exports.isColumnOptional=Be;exports.isConfigLambda=Je;exports.isEmpty=dt;exports.isLabelColumn=zt;exports.isolate=tt;exports.makeArray=at;exports.makeObject=fe;exports.mapArrayValues=ut;exports.mapRecordValues=lt;exports.mapResourceFields=yt;exports.not=pt;exports.or=ht;exports.parsePColumnData=ie;exports.parsePTableColumnId=$e;exports.parseResourceMap=Vt;exports.readOutput=Ie;exports.stringifyPTableColumnId=Gt;exports.wrapOutputs=et;Object.keys(u).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>u[t]})});Object.keys(be).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>be[t]})});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|