{"version":3,"file":"converter.cjs","names":["distillFilterSpec","when","convertFilterUiToExpressionImpl"],"sources":["../../src/annotations/converter.ts"],"sourcesContent":["import { when } from \"@milaboratories/ptabler-expression-js\";\nimport { convertFilterUiToExpressionImpl } from \"../filters/converters/filterUiToExpressionImpl\";\nimport type { ExpressionSpec, FilterSpecUi } from \"./types\";\nimport { distillFilterSpec } from \"../filters/distill\";\n\nexport function convertFilterSpecsToExpressionSpecs(\n  annotationsUI: FilterSpecUi[],\n): ExpressionSpec[] {\n  const validAnnotationsUI = annotationsUI\n    .map((step) => ({\n      label: step.label,\n      filter: distillFilterSpec(step.filter),\n    }))\n    .filter(\n      (step): step is { label: string; filter: NonNullable<typeof step.filter> } =>\n        step.filter !== null,\n    );\n\n  return validAnnotationsUI.map((step): ExpressionSpec => ({\n    type: \"alias\",\n    name: step.label.trim(),\n    value: when(convertFilterUiToExpressionImpl(step.filter)).then(true).otherwise(false).toJSON(),\n  }));\n}\n"],"mappings":";;;;AAKA,SAAgB,oCACd,eACkB;CAWlB,OAV2B,cACxB,KAAK,UAAU;EACd,OAAO,KAAK;EACZ,QAAQA,gBAAAA,kBAAkB,KAAK,MAAM;CACvC,EAAE,CAAC,CACF,QACE,SACC,KAAK,WAAW,IAGE,CAAC,CAAC,KAAK,UAA0B;EACvD,MAAM;EACN,MAAM,KAAK,MAAM,KAAK;EACtB,QAAA,GAAOC,sCAAAA,KAAAA,CAAKC,iCAAAA,gCAAgC,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,OAAO;CAC/F,EAAE;AACJ"}