nuxeo-development-framework 6.1.4 → 6.1.5

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,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/material/dialog'), require('@angular/router'), require('@ngx-translate/core'), require('rxjs/operators'), require('rxjs'), require('@angular/animations'), require('ngx-toastr'), require('crypto-js'), require('@angular/cdk/bidi'), require('@angular/common/http'), require('keycloak-angular'), require('ngx-cookie-service'), require('@angular/cdk/coercion'), require('@angular/material/icon'), require('@angular/material/progress-spinner'), require('@angular/material/tooltip'), require('lodash-es'), require('lodash'), require('moment'), require('lodash/omit'), require('lodash/assign'), require('lodash/cloneDeep'), require('@angular/platform-browser'), require('moment-es6'), require('moment-hijri'), require('ngx-infinite-scroll'), require('@angular/material/list'), require('@angular/material/menu'), require('angular-ng-autocomplete'), require('@angular/material/core'), require('@angular/cdk/clipboard'), require('ts-cacheable'), require('@ng-select/ng-select'), require('@angular/material/form-field'), require('@angular/material/chips'), require('@angular/material/expansion'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/datepicker'), require('@angular/material/input'), require('@angular/material/radio'), require('@angular/material/slide-toggle'), require('@busacca/ng-pick-datetime'), require('@mat-datetimepicker/core'), require('angular-formio'), require('ngx-treeview'), require('@ng-bootstrap/ng-bootstrap'), require('formiojs'), require('lodash/find'), require('lodash/isEqual'), require('@swimlane/ngx-datatable'), require('@angular/material/button-toggle'), require('@angular/cdk/collections'), require('@angular/cdk/drag-drop'), require('@angular/material/autocomplete'), require('ngx-mask'), require('moment/moment'), require('string-hash'), require('@angular/cdk/layout'), require('dwt'), require('@angular/material/progress-bar'), require('chart.js/auto'), require('chartjs-adapter-moment'), require('devextreme-angular'), require('file-saver'), require('devextreme-angular/ui/nested'), require('@pdftron/webviewer'), require('@angular/material/tabs'), require('@angular/material/divider'), require('@angular/common/locales/ar'), require('@angular/common/locales/en'), require('@rxweb/reactive-form-validators'), require('rete-angular-plugin'), require('rete'), require('rete-area-plugin'), require('rete-auto-arrange-plugin'), require('rete-connection-plugin'), require('rete-connection-reroute-plugin'), require('rete-readonly-plugin'), require('rete-minimap-plugin'), require('d3-shape'), require('rete-connection-path-plugin'), require('rete-render-utils'), require('@angular/material/badge'), require('@angular/material/toolbar'), require('@kurkle/color'), require('ngx-markdown'), require('@angular/cdk/accordion'), require('lodash/flatMap'), require('@angular/material/bottom-sheet')) :
3
- typeof define === 'function' && define.amd ? define('nuxeo-development-framework', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/material/dialog', '@angular/router', '@ngx-translate/core', 'rxjs/operators', 'rxjs', '@angular/animations', 'ngx-toastr', 'crypto-js', '@angular/cdk/bidi', '@angular/common/http', 'keycloak-angular', 'ngx-cookie-service', '@angular/cdk/coercion', '@angular/material/icon', '@angular/material/progress-spinner', '@angular/material/tooltip', 'lodash-es', 'lodash', 'moment', 'lodash/omit', 'lodash/assign', 'lodash/cloneDeep', '@angular/platform-browser', 'moment-es6', 'moment-hijri', 'ngx-infinite-scroll', '@angular/material/list', '@angular/material/menu', 'angular-ng-autocomplete', '@angular/material/core', '@angular/cdk/clipboard', 'ts-cacheable', '@ng-select/ng-select', '@angular/material/form-field', '@angular/material/chips', '@angular/material/expansion', '@angular/material/button', '@angular/material/checkbox', '@angular/material/datepicker', '@angular/material/input', '@angular/material/radio', '@angular/material/slide-toggle', '@busacca/ng-pick-datetime', '@mat-datetimepicker/core', 'angular-formio', 'ngx-treeview', '@ng-bootstrap/ng-bootstrap', 'formiojs', 'lodash/find', 'lodash/isEqual', '@swimlane/ngx-datatable', '@angular/material/button-toggle', '@angular/cdk/collections', '@angular/cdk/drag-drop', '@angular/material/autocomplete', 'ngx-mask', 'moment/moment', 'string-hash', '@angular/cdk/layout', 'dwt', '@angular/material/progress-bar', 'chart.js/auto', 'chartjs-adapter-moment', 'devextreme-angular', 'file-saver', 'devextreme-angular/ui/nested', '@pdftron/webviewer', '@angular/material/tabs', '@angular/material/divider', '@angular/common/locales/ar', '@angular/common/locales/en', '@rxweb/reactive-form-validators', 'rete-angular-plugin', 'rete', 'rete-area-plugin', 'rete-auto-arrange-plugin', 'rete-connection-plugin', 'rete-connection-reroute-plugin', 'rete-readonly-plugin', 'rete-minimap-plugin', 'd3-shape', 'rete-connection-path-plugin', 'rete-render-utils', '@angular/material/badge', '@angular/material/toolbar', '@kurkle/color', 'ngx-markdown', '@angular/cdk/accordion', 'lodash/flatMap', '@angular/material/bottom-sheet'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["nuxeo-development-framework"] = {}, global.ng.core, global.ng.common, global.ng.forms, global.ng.material.dialog, global.ng.router, global.i1, global.rxjs.operators, global.rxjs, global.ng.animations, global.i1$1, global.CryptoJS, global.ng.cdk.bidi, global.ng.common.http, global.i2$1, global.i3, global.ng.cdk.coercion, global.ng.material.icon, global.ng.material.progressSpinner, global.ng.material.tooltip, global.lodashEs, global._, global.moment$6, global._omit, global._assign, global._cloneDeep, global.ng.platformBrowser, global.moment$7, global.moment_, global.i7$1, global.ng.material.list, global.ng.material.menu, global.i6$1, global.ng.material.core, global.ng.cdk.clipboard, global.tsCacheable, global.i5, global.ng.material.formField, global.ng.material.chips, global.ng.material.expansion, global.ng.material.button, global.ng.material.checkbox, global.ng.material.datepicker, global.ng.material.input, global.ng.material.radio, global.ng.material.slideToggle, global.i6$3, global.core, global.i3$2, global.i1$9, global.i1$8, global.formiojs, global._find, global._isEqual, global.i4$2, global.ng.material.buttonToggle, global.ng.cdk.collections, global.ng.cdk.dragDrop, global.ng.material.autocomplete, global.i5$4, global.moment$8, global.stringHash, global.ng.cdk.layout, global.Dynamsoft, global.ng.material.progressBar, global.Chart, null, global.i4$4, global.FileSaver, global.i5$6, global.WebViewer, global.ng.material.tabs, global.ng.material.divider, global.ng.common.locales.ar, global.ng.common.locales.en, global.reactiveFormValidators, global.i2$7, global.rete, global.reteAreaPlugin, global.reteAutoArrangePlugin, global.reteConnectionPlugin, global.reteConnectionReroutePlugin, global.reteReadonlyPlugin, global.reteMinimapPlugin, global.d3Shape, global.reteConnectionPathPlugin, global.reteRenderUtils, global.ng.material.badge, global.ng.material.toolbar, global.colorLib, global.i2$8, global.ng.cdk.accordion, global._flatMap, global.ng.material.bottomSheet));
5
- })(this, (function (exports, i0, i4, i2, i1$4, i1$3, i1, operators, rxjs, animations, i1$1, CryptoJS, i4$1, i1$2, i2$1, i3, coercion, i2$2, i6, i7, lodashEs, _, moment$6, _omit, _assign, _cloneDeep, i1$5, moment$7, moment_, i7$1, i2$3, i3$1, i6$1, i2$4, i1$6, tsCacheable, i5, i1$7, i7$2, i6$2, i1$b, i5$1, i2$6, i5$2, i2$5, i1$a, i6$3, core, i3$2, i1$9, i1$8, formiojs, _find, _isEqual, i4$2, i1$c, collections, i7$3, i5$3, i5$4, moment$8, stringHash, i5$5, Dynamsoft, i4$3, Chart, chartjsAdapterMoment, i4$4, FileSaver, i5$6, WebViewer, i1$d, i9, localeAr, localeEn, reactiveFormValidators, i2$7, rete, reteAreaPlugin, reteAutoArrangePlugin, reteConnectionPlugin, reteConnectionReroutePlugin, reteReadonlyPlugin, reteMinimapPlugin, d3Shape, reteConnectionPathPlugin, reteRenderUtils, i7$4, toolbar, colorLib, i2$8, i6$4, _flatMap, i1$e) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/material/dialog'), require('@angular/router'), require('@ngx-translate/core'), require('rxjs/operators'), require('rxjs'), require('@angular/animations'), require('ngx-toastr'), require('crypto-js'), require('@angular/cdk/bidi'), require('@angular/common/http'), require('keycloak-angular'), require('ngx-cookie-service'), require('@angular/cdk/coercion'), require('@angular/material/icon'), require('@angular/material/progress-spinner'), require('@angular/material/tooltip'), require('lodash-es'), require('lodash'), require('moment'), require('lodash/omit'), require('lodash/assign'), require('lodash/cloneDeep'), require('@angular/platform-browser'), require('moment-es6'), require('moment-hijri'), require('ngx-infinite-scroll'), require('@angular/material/list'), require('@angular/material/menu'), require('angular-ng-autocomplete'), require('@angular/material/core'), require('@angular/cdk/clipboard'), require('ts-cacheable'), require('@ng-select/ng-select'), require('@angular/material/form-field'), require('@angular/material/chips'), require('@angular/material/expansion'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/datepicker'), require('@angular/material/input'), require('@angular/material/radio'), require('@angular/material/slide-toggle'), require('@busacca/ng-pick-datetime'), require('@mat-datetimepicker/core'), require('angular-formio'), require('ngx-treeview'), require('@ng-bootstrap/ng-bootstrap'), require('formiojs'), require('lodash/find'), require('lodash/isEqual'), require('@swimlane/ngx-datatable'), require('@angular/material/button-toggle'), require('@angular/cdk/collections'), require('@angular/cdk/drag-drop'), require('@angular/material/autocomplete'), require('string-hash'), require('ngx-mask'), require('moment/moment'), require('@angular/cdk/layout'), require('dwt'), require('@angular/material/progress-bar'), require('chart.js/auto'), require('chartjs-adapter-moment'), require('devextreme-angular'), require('file-saver'), require('devextreme-angular/ui/nested'), require('@pdftron/webviewer'), require('@angular/material/tabs'), require('@angular/material/divider'), require('@angular/common/locales/ar'), require('@angular/common/locales/en'), require('@rxweb/reactive-form-validators'), require('rete-angular-plugin'), require('rete'), require('rete-area-plugin'), require('rete-auto-arrange-plugin'), require('rete-connection-plugin'), require('rete-connection-reroute-plugin'), require('rete-readonly-plugin'), require('rete-minimap-plugin'), require('d3-shape'), require('rete-connection-path-plugin'), require('rete-render-utils'), require('@angular/material/badge'), require('@angular/material/toolbar'), require('@kurkle/color'), require('ngx-markdown'), require('@angular/cdk/accordion'), require('lodash/flatMap'), require('@angular/material/bottom-sheet')) :
3
+ typeof define === 'function' && define.amd ? define('nuxeo-development-framework', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/material/dialog', '@angular/router', '@ngx-translate/core', 'rxjs/operators', 'rxjs', '@angular/animations', 'ngx-toastr', 'crypto-js', '@angular/cdk/bidi', '@angular/common/http', 'keycloak-angular', 'ngx-cookie-service', '@angular/cdk/coercion', '@angular/material/icon', '@angular/material/progress-spinner', '@angular/material/tooltip', 'lodash-es', 'lodash', 'moment', 'lodash/omit', 'lodash/assign', 'lodash/cloneDeep', '@angular/platform-browser', 'moment-es6', 'moment-hijri', 'ngx-infinite-scroll', '@angular/material/list', '@angular/material/menu', 'angular-ng-autocomplete', '@angular/material/core', '@angular/cdk/clipboard', 'ts-cacheable', '@ng-select/ng-select', '@angular/material/form-field', '@angular/material/chips', '@angular/material/expansion', '@angular/material/button', '@angular/material/checkbox', '@angular/material/datepicker', '@angular/material/input', '@angular/material/radio', '@angular/material/slide-toggle', '@busacca/ng-pick-datetime', '@mat-datetimepicker/core', 'angular-formio', 'ngx-treeview', '@ng-bootstrap/ng-bootstrap', 'formiojs', 'lodash/find', 'lodash/isEqual', '@swimlane/ngx-datatable', '@angular/material/button-toggle', '@angular/cdk/collections', '@angular/cdk/drag-drop', '@angular/material/autocomplete', 'string-hash', 'ngx-mask', 'moment/moment', '@angular/cdk/layout', 'dwt', '@angular/material/progress-bar', 'chart.js/auto', 'chartjs-adapter-moment', 'devextreme-angular', 'file-saver', 'devextreme-angular/ui/nested', '@pdftron/webviewer', '@angular/material/tabs', '@angular/material/divider', '@angular/common/locales/ar', '@angular/common/locales/en', '@rxweb/reactive-form-validators', 'rete-angular-plugin', 'rete', 'rete-area-plugin', 'rete-auto-arrange-plugin', 'rete-connection-plugin', 'rete-connection-reroute-plugin', 'rete-readonly-plugin', 'rete-minimap-plugin', 'd3-shape', 'rete-connection-path-plugin', 'rete-render-utils', '@angular/material/badge', '@angular/material/toolbar', '@kurkle/color', 'ngx-markdown', '@angular/cdk/accordion', 'lodash/flatMap', '@angular/material/bottom-sheet'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["nuxeo-development-framework"] = {}, global.ng.core, global.ng.common, global.ng.forms, global.ng.material.dialog, global.ng.router, global.i1, global.rxjs.operators, global.rxjs, global.ng.animations, global.i1$1, global.CryptoJS, global.ng.cdk.bidi, global.ng.common.http, global.i2$1, global.i3, global.ng.cdk.coercion, global.ng.material.icon, global.ng.material.progressSpinner, global.ng.material.tooltip, global.lodashEs, global._, global.moment$6, global._omit, global._assign, global._cloneDeep, global.ng.platformBrowser, global.moment$7, global.moment_, global.i7$1, global.ng.material.list, global.ng.material.menu, global.i6$1, global.ng.material.core, global.ng.cdk.clipboard, global.tsCacheable, global.i5, global.ng.material.formField, global.ng.material.chips, global.ng.material.expansion, global.ng.material.button, global.ng.material.checkbox, global.ng.material.datepicker, global.ng.material.input, global.ng.material.radio, global.ng.material.slideToggle, global.i6$3, global.core, global.i3$2, global.i1$9, global.i1$8, global.formiojs, global._find, global._isEqual, global.i4$2, global.ng.material.buttonToggle, global.ng.cdk.collections, global.ng.cdk.dragDrop, global.ng.material.autocomplete, global.stringHash, global.i5$4, global.moment$8, global.ng.cdk.layout, global.Dynamsoft, global.ng.material.progressBar, global.Chart, null, global.i4$4, global.FileSaver, global.i5$6, global.WebViewer, global.ng.material.tabs, global.ng.material.divider, global.ng.common.locales.ar, global.ng.common.locales.en, global.reactiveFormValidators, global.i2$7, global.rete, global.reteAreaPlugin, global.reteAutoArrangePlugin, global.reteConnectionPlugin, global.reteConnectionReroutePlugin, global.reteReadonlyPlugin, global.reteMinimapPlugin, global.d3Shape, global.reteConnectionPathPlugin, global.reteRenderUtils, global.ng.material.badge, global.ng.material.toolbar, global.colorLib, global.i2$8, global.ng.cdk.accordion, global._flatMap, global.ng.material.bottomSheet));
5
+ })(this, (function (exports, i0, i4, i2, i1$4, i1$3, i1, operators, rxjs, animations, i1$1, CryptoJS, i4$1, i1$2, i2$1, i3, coercion, i2$2, i6, i7, lodashEs, _, moment$6, _omit, _assign, _cloneDeep, i1$5, moment$7, moment_, i7$1, i2$3, i3$1, i6$1, i2$4, i1$6, tsCacheable, i5, i1$7, i7$2, i6$2, i1$b, i5$1, i2$6, i5$2, i2$5, i1$a, i6$3, core, i3$2, i1$9, i1$8, formiojs, _find, _isEqual, i4$2, i1$c, collections, i7$3, i5$3, stringHash, i5$4, moment$8, i5$5, Dynamsoft, i4$3, Chart, chartjsAdapterMoment, i4$4, FileSaver, i5$6, WebViewer, i1$d, i9, localeAr, localeEn, reactiveFormValidators, i2$7, rete, reteAreaPlugin, reteAutoArrangePlugin, reteConnectionPlugin, reteConnectionReroutePlugin, reteReadonlyPlugin, reteMinimapPlugin, d3Shape, reteConnectionPathPlugin, reteRenderUtils, i7$4, toolbar, colorLib, i2$8, i6$4, _flatMap, i1$e) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -76,9 +76,9 @@
76
76
  var i1__namespace$b = /*#__PURE__*/_interopNamespace(i1$c);
77
77
  var i7__namespace$3 = /*#__PURE__*/_interopNamespace(i7$3);
78
78
  var i5__namespace$3 = /*#__PURE__*/_interopNamespace(i5$3);
79
+ var stringHash__default = /*#__PURE__*/_interopDefaultLegacy(stringHash);
79
80
  var i5__namespace$4 = /*#__PURE__*/_interopNamespace(i5$4);
80
81
  var moment__namespace$1 = /*#__PURE__*/_interopNamespace(moment$8);
81
- var stringHash__default = /*#__PURE__*/_interopDefaultLegacy(stringHash);
82
82
  var i5__namespace$5 = /*#__PURE__*/_interopNamespace(i5$5);
83
83
  var Dynamsoft__default = /*#__PURE__*/_interopDefaultLegacy(Dynamsoft);
84
84
  var i4__namespace$3 = /*#__PURE__*/_interopNamespace(i4$3);
@@ -16260,6 +16260,7 @@
16260
16260
  en: ___default["default"].get(item, config === null || config === void 0 ? void 0 : config.bindLabel.en),
16261
16261
  }
16262
16262
  : null,
16263
+ labelTemplate: config === null || config === void 0 ? void 0 : config.labelTemplate,
16263
16264
  };
16264
16265
  if (config === null || config === void 0 ? void 0 : config.tooltip) {
16265
16266
  var _a = config === null || config === void 0 ? void 0 : config.tooltip, properties = _a.properties, tooltipConfig = __rest(_a, ["properties"]);
@@ -16411,6 +16412,384 @@
16411
16412
  }]
16412
16413
  }], ctorParameters: function () { return [{ type: i1__namespace.TranslateService }]; } });
16413
16414
 
16415
+ /**
16416
+ * Creates a secure context for function evaluation that prevents access to the window object.
16417
+ * @returns {Record<string, any>} A secure context object with safe properties.
16418
+ */
16419
+ function createSecureContext() {
16420
+ // Create a secure context with only safe properties
16421
+ return {
16422
+ // Add any safe globals here that should be accessible
16423
+ console: {
16424
+ log: console.log,
16425
+ warn: console.warn,
16426
+ error: console.error
16427
+ },
16428
+ // Add other safe objects/functions as needed
16429
+ Math: Math,
16430
+ Date: Date,
16431
+ Number: Number,
16432
+ String: String,
16433
+ Boolean: Boolean,
16434
+ Array: Array,
16435
+ Object: Object,
16436
+ JSON: JSON,
16437
+ // Prevent access to window
16438
+ window: undefined,
16439
+ self: undefined,
16440
+ globalThis: undefined,
16441
+ _: ___default["default"] // Include lodash if needed, but ensure it's used safely
16442
+ };
16443
+ }
16444
+ /**
16445
+ * A utility class for evaluating expressions, interpolating strings, and working with templates.
16446
+ * This class provides static methods for dynamic evaluation of code, string interpolation,
16447
+ * and template processing with caching capabilities.
16448
+ */
16449
+ var Evaluator = /** @class */ (function () {
16450
+ function Evaluator() {
16451
+ }
16452
+ /**
16453
+ * Creates a function from a string or returns the function if already provided.
16454
+ * Uses a secure context to prevent access to the window object by default.
16455
+ * @param {string|Function} func - The function or string to convert to a function.
16456
+ * @param {...any} params - The parameters to pass to the function.
16457
+ * @param {EvaluatorOptions} [options={}] - Optional configuration for the evaluation.
16458
+ * @returns {Function} - The resulting function.
16459
+ */
16460
+ Evaluator.evaluator = function (func) {
16461
+ var params = [];
16462
+ for (var _i = 1; _i < arguments.length; _i++) {
16463
+ params[_i - 1] = arguments[_i];
16464
+ }
16465
+ // Extract options if the last parameter is an options object
16466
+ var options = {};
16467
+ if (params.length > 0 &&
16468
+ params[params.length - 1] &&
16469
+ typeof params[params.length - 1] === 'object' &&
16470
+ 'securityMode' in params[params.length - 1]) {
16471
+ options = params.pop();
16472
+ }
16473
+ if (typeof func === 'function') {
16474
+ return func;
16475
+ }
16476
+ if (typeof params[0] === 'object') {
16477
+ params = _.keys(params[0]);
16478
+ }
16479
+ // Check if we should use secure mode (default) or unsafe mode
16480
+ var securityMode = options.securityMode || 'secure';
16481
+ if (securityMode === 'unsafe') {
16482
+ // In unsafe mode, create a function with access to all globals
16483
+ return new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], __read(params)), [func])))();
16484
+ }
16485
+ var sandbox = createSecureContext();
16486
+ var sandboxKeys = Object.keys(sandbox);
16487
+ var sandboxAssignments = sandboxKeys.map(function (key) { return "const " + key + " = sandbox." + key + ";"; }).join('');
16488
+ var wrapper = new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], __read(params)), ['sandbox', "" + sandboxAssignments + func])))();
16489
+ return function () {
16490
+ var args = [];
16491
+ for (var _i = 0; _i < arguments.length; _i++) {
16492
+ args[_i] = arguments[_i];
16493
+ }
16494
+ return wrapper.apply(void 0, __spreadArray(__spreadArray([], __read(args)), [sandbox]));
16495
+ };
16496
+ };
16497
+ /**
16498
+ * Replaces template expressions in a string with values from data.
16499
+ * Supports function calls within templates and fallback values using || syntax.
16500
+ * By default, ensures evaluation happens in a secure context to prevent access to window object.
16501
+ * @param {string} rawTemplate - The template string containing expressions to interpolate.
16502
+ * @param {Record<string, any>} data - The data object containing values to use for interpolation.
16503
+ * @param {EvaluatorOptions} [options={}] - Optional configuration for the interpolation process.
16504
+ * @returns {string} - The interpolated string with all expressions replaced with actual values.
16505
+ */
16506
+ Evaluator.interpolateString = function (rawTemplate, data, options) {
16507
+ if (options === void 0) { options = {}; }
16508
+ if (!rawTemplate) {
16509
+ return '';
16510
+ }
16511
+ if (typeof rawTemplate !== 'string') {
16512
+ return rawTemplate.toString();
16513
+ }
16514
+ // Check if we should use secure mode (default) or unsafe mode
16515
+ var securityMode = options.securityMode || 'secure';
16516
+ // Create a secure data object if needed
16517
+ var secureData = securityMode === 'unsafe'
16518
+ ? data
16519
+ : Object.assign(Object.assign(Object.assign({}, createSecureContext()), data), {
16520
+ // Ensure these remain undefined
16521
+ window: undefined, self: undefined, globalThis: undefined
16522
+ });
16523
+ return rawTemplate.replace(/({{\s*(.*?)\s*}})/g, function (match, $1, expression) {
16524
+ if (expression.indexOf('(') !== -1) {
16525
+ return expression.replace(/([^(]+)\(([^)]+)\s*\);?/, function (_$1, fnName, argsStr) {
16526
+ fnName = _.trim(fnName);
16527
+ var func = _.get(secureData, fnName);
16528
+ if (func) {
16529
+ if (argsStr) {
16530
+ var args = argsStr.split(',').map(function (arg) {
16531
+ var trimmed = _.trim(arg);
16532
+ if (/^['"]/.test(trimmed))
16533
+ return trimmed.slice(1, -1);
16534
+ return _.get(secureData, trimmed);
16535
+ });
16536
+ return Evaluator.evaluate(func, args, '', false, secureData, options);
16537
+ }
16538
+ return Evaluator.evaluate(func, [], '', false, secureData, options);
16539
+ }
16540
+ return '';
16541
+ });
16542
+ }
16543
+ else {
16544
+ var dataPath = expression;
16545
+ if (expression.indexOf('?') !== -1) {
16546
+ dataPath = expression.replace(/\?\./g, '.');
16547
+ }
16548
+ var parts = dataPath.split('||').map(function (item) { return item.trim(); });
16549
+ var value = '';
16550
+ var path = '';
16551
+ for (var i = 0; i < parts.length; i++) {
16552
+ path = parts[i];
16553
+ if (___default["default"].has(secureData, path)) {
16554
+ value = ___default["default"].get(secureData, path);
16555
+ break;
16556
+ }
16557
+ }
16558
+ if (options.data) {
16559
+ _.set(options.data, path, value);
16560
+ }
16561
+ return value;
16562
+ }
16563
+ });
16564
+ };
16565
+ /**
16566
+ * Performs an evaluation using the evaluation context of this component.
16567
+ * By default, ensures evaluation happens in a secure context to prevent access to window object.
16568
+ * @param {string|Function|object} func - The function or string to evaluate.
16569
+ * @param {object} args - The arguments to pass to the evaluation.
16570
+ * @param {string} ret - The name of the variable within the evaluation context to return.
16571
+ * @param {boolean} interpolate - Determines if it should replace all {{ }} token references with actual data.
16572
+ * @param {object} context - - The evaluation context.
16573
+ * @param {EvaluatorOptions } options - The options to pass to the evaluation.
16574
+ * @returns {*} - The result of the evaluation.
16575
+ */
16576
+ Evaluator.evaluate = function (func, args, ret, interpolate, context, options) {
16577
+ if (args === void 0) { args = {}; }
16578
+ if (ret === void 0) { ret = 'show'; }
16579
+ if (interpolate === void 0) { interpolate = false; }
16580
+ if (context === void 0) { context = {}; }
16581
+ if (options === void 0) { options = {}; }
16582
+ var returnVal = null;
16583
+ var field = args.field ? args.field : { key: 'unknown' };
16584
+ var fieldKey = field.key;
16585
+ if (typeof func === 'string') {
16586
+ if (ret) {
16587
+ func = "var " + ret + ";" + func + ";return " + ret;
16588
+ }
16589
+ if (interpolate) {
16590
+ func = Evaluator.interpolate(func, args, options);
16591
+ }
16592
+ try {
16593
+ // Pass the security mode option to the evaluator
16594
+ var evaluatorOptions = { securityMode: options.securityMode || 'secure' };
16595
+ func = Evaluator.evaluator(func, args, context, evaluatorOptions);
16596
+ args = Array.isArray(args) ? args : _.values(args);
16597
+ }
16598
+ catch (err) {
16599
+ console.warn("An error occured within the custom function for " + fieldKey, err);
16600
+ returnVal = null;
16601
+ func = false;
16602
+ }
16603
+ }
16604
+ if (typeof func === 'function') {
16605
+ try {
16606
+ returnVal = Evaluator.execute(func, args, context, options);
16607
+ }
16608
+ catch (err) {
16609
+ returnVal = null;
16610
+ console.warn("An error occured within custom function for " + fieldKey, err);
16611
+ }
16612
+ }
16613
+ else if (func) {
16614
+ console.warn("Unknown function type for " + fieldKey);
16615
+ }
16616
+ return returnVal;
16617
+ };
16618
+ /**
16619
+ * Executes a function with provided arguments and context.
16620
+ * By default, ensures execution happens in a secure context to prevent access to window object.
16621
+ * @param {Function} func - The function to execute.
16622
+ * @param {any[]|Record<string, any>} args - The arguments to pass to the function, either as an array or object.
16623
+ * @param {Record<string, any>} [context={}] - The context (this) to use when executing the function.
16624
+ * @param {EvaluatorOptions} [options={}] - Optional configuration for the execution.
16625
+ * @returns {any} - The result of the function execution.
16626
+ */
16627
+ Evaluator.execute = function (func, args, context, options) {
16628
+ if (context === void 0) { context = {}; }
16629
+ if (options === void 0) { options = {}; }
16630
+ // Check if we should use secure mode (default) or unsafe mode
16631
+ var securityMode = options.securityMode || 'secure';
16632
+ if (securityMode === 'unsafe') {
16633
+ // In unsafe mode, execute with the original context
16634
+ return Array.isArray(args) ? func.apply(context, args) : func.call(context, args);
16635
+ }
16636
+ else {
16637
+ // In secure mode, create a secure context by merging the provided context with our secure context
16638
+ var secureContext = Object.assign(Object.assign(Object.assign({}, createSecureContext()), context), {
16639
+ // Ensure these remain undefined even if they were in the provided context
16640
+ window: undefined, self: undefined, globalThis: undefined
16641
+ });
16642
+ // Execute the function with the secure context
16643
+ return Array.isArray(args) ? func.apply(secureContext, args) : func.call(secureContext, args);
16644
+ }
16645
+ };
16646
+ /**
16647
+ * Creates a template function from a string with caching for performance.
16648
+ * By default, ensures the template function executes in a secure context.
16649
+ * @param {string} template - The template string to compile into a function.
16650
+ * @param {string} [hash] - Optional hash to use as cache key. If not provided, a hash will be generated from the template.
16651
+ * @param {EvaluatorOptions} [options={}] - Optional configuration for the template.
16652
+ * @returns {Function|undefined} - The compiled template function, or undefined if compilation fails.
16653
+ */
16654
+ Evaluator.template = function (template, hash, options) {
16655
+ if (options === void 0) { options = {}; }
16656
+ hash = hash || stringHash__default["default"](template).toString();
16657
+ // If hash contains options object, extract it
16658
+ if (typeof hash === 'object' && 'securityMode' in hash) {
16659
+ options = hash;
16660
+ hash = stringHash__default["default"](template).toString();
16661
+ }
16662
+ // Check if we have a cached version
16663
+ var cacheKey = hash + (options.securityMode || 'secure');
16664
+ if (Evaluator.cache[cacheKey]) {
16665
+ return Evaluator.cache[cacheKey];
16666
+ }
16667
+ try {
16668
+ template = template.replace(/ctx\./g, '');
16669
+ // Create the template function using lodash
16670
+ var templateFunc_1 = ___default["default"].template(template, Evaluator.templateSettings);
16671
+ // Check if we should use secure mode (default) or unsafe mode
16672
+ var securityMode = options.securityMode || 'secure';
16673
+ if (securityMode === 'unsafe') {
16674
+ // In unsafe mode, return the original template function
16675
+ return (Evaluator.cache[cacheKey] = templateFunc_1);
16676
+ }
16677
+ else {
16678
+ // In secure mode, wrap the template function to ensure it runs in a secure context
16679
+ var secureTemplateFunc = function (data) {
16680
+ // Create a secure context for the template
16681
+ var secureData = Object.assign(Object.assign(Object.assign({}, createSecureContext()), data), {
16682
+ // Ensure these remain undefined
16683
+ window: undefined, self: undefined, globalThis: undefined
16684
+ });
16685
+ return templateFunc_1(secureData);
16686
+ };
16687
+ // Cache and return the secure template function
16688
+ return (Evaluator.cache[cacheKey] = secureTemplateFunc);
16689
+ }
16690
+ }
16691
+ catch (err) {
16692
+ console.warn('Error while processing template', err, template);
16693
+ return undefined;
16694
+ }
16695
+ };
16696
+ /**
16697
+ * Interpolates a template with data, handling both function templates and string templates.
16698
+ * By default, ensures interpolation happens in a secure context to prevent access to window object.
16699
+ * @param {string|Function} rawTemplate - The template to interpolate, either as a string or a function.
16700
+ * @param {Record<string, any>} data - The data object to use for interpolation.
16701
+ * @param {EvaluatorOptions} options - Options for the interpolation process.
16702
+ * @returns {string|any} - The result of the interpolation, typically a string but could be any type depending on the template.
16703
+ */
16704
+ Evaluator.interpolate = function (rawTemplate, data, options) {
16705
+ if (options === void 0) { options = {}; }
16706
+ if (typeof rawTemplate === 'function') {
16707
+ try {
16708
+ // If the template is a function, execute it with the data
16709
+ // We can't directly secure a provided function, but we can use execute
16710
+ // to run it in a secure context if needed
16711
+ if (options.securityMode !== 'unsafe') {
16712
+ var secureData = Object.assign(Object.assign(Object.assign({}, createSecureContext()), data), { window: undefined, self: undefined, globalThis: undefined });
16713
+ return rawTemplate(secureData);
16714
+ }
16715
+ else {
16716
+ return rawTemplate(data);
16717
+ }
16718
+ }
16719
+ catch (err) {
16720
+ console.warn('Error interpolating template', err, data);
16721
+ return err.message;
16722
+ }
16723
+ }
16724
+ rawTemplate = String(rawTemplate);
16725
+ // Pass the security mode option to the template method
16726
+ var template = Evaluator.template(rawTemplate, undefined, options);
16727
+ if (typeof template === 'function') {
16728
+ try {
16729
+ return template(data);
16730
+ }
16731
+ catch (err) {
16732
+ console.warn('Error interpolating template', err, rawTemplate, data);
16733
+ return err.message;
16734
+ }
16735
+ }
16736
+ return template;
16737
+ };
16738
+ return Evaluator;
16739
+ }());
16740
+ /**
16741
+ * Cache for storing compiled template functions to improve performance.
16742
+ * Keys are string hashes of the template, values are the compiled functions.
16743
+ */
16744
+ Evaluator.cache = {};
16745
+ /**
16746
+ * Settings for template processing, defining regex patterns for different template operations.
16747
+ * - interpolate: Pattern for variable interpolation ({{ variable }})
16748
+ * - evaluate: Pattern for code evaluation ({% code %})
16749
+ * - escape: Pattern for HTML escaping ({{{ variable }}})
16750
+ */
16751
+ Evaluator.templateSettings = {
16752
+ interpolate: /{{([\s\S]+?)}}/g,
16753
+ evaluate: /\{%([\s\S]+?)%\}/g,
16754
+ escape: /\{\{\{([\s\S]+?)\}\}\}/g
16755
+ };
16756
+
16757
+ var EvaluatorLabelPipe = /** @class */ (function () {
16758
+ /**
16759
+ *
16760
+ */
16761
+ function EvaluatorLabelPipe(translate) {
16762
+ this.translate = translate;
16763
+ }
16764
+ EvaluatorLabelPipe.prototype.transform = function (option, language) {
16765
+ if (!option || !(option === null || option === void 0 ? void 0 : option.labelTemplate)) {
16766
+ return '';
16767
+ }
16768
+ try {
16769
+ var text = Evaluator.interpolate(option.labelTemplate, {
16770
+ language: language,
16771
+ option: option,
16772
+ moment: moment__namespace,
16773
+ translate: this.translate,
16774
+ value: option.value,
16775
+ });
16776
+ return text;
16777
+ }
16778
+ catch (error) {
16779
+ return option.label;
16780
+ }
16781
+ };
16782
+ return EvaluatorLabelPipe;
16783
+ }());
16784
+ EvaluatorLabelPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EvaluatorLabelPipe, deps: [{ token: i1__namespace.TranslateService }], target: i0__namespace.ɵɵFactoryTarget.Pipe });
16785
+ EvaluatorLabelPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EvaluatorLabelPipe, name: "evaluateLabel" });
16786
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EvaluatorLabelPipe, decorators: [{
16787
+ type: i0.Pipe,
16788
+ args: [{
16789
+ name: 'evaluateLabel',
16790
+ }]
16791
+ }], ctorParameters: function () { return [{ type: i1__namespace.TranslateService }]; } });
16792
+
16414
16793
  var LocalizedLabelPipe = /** @class */ (function () {
16415
16794
  /**
16416
16795
  *
@@ -16444,7 +16823,7 @@
16444
16823
  return FilterOptionTextComponent;
16445
16824
  }());
16446
16825
  FilterOptionTextComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FilterOptionTextComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
16447
- FilterOptionTextComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FilterOptionTextComponent, selector: "filter-option-text", inputs: { option: "option", showCount: "showCount", language: "language" }, host: { classAttribute: "fot" }, ngImport: i0__namespace, template: "<span class=\"fot__label\" [matTooltip]=\"option?.tooltip | optionTooltip: language\">\r\n\t{{ option | localizedLabel: language }}\r\n</span>\r\n\r\n<small class=\"fot__count\" *ngIf=\"showCount\">{{ option.count }}</small>\r\n", styles: [".fot{display:grid;grid-template-columns:1fr auto;align-items:center;grid-gap:.3rem;gap:.3rem;margin-inline:var(--fot-margin-inline, 0);font-size:var(--fot-font-size, .8rem);line-height:var(--fot-line-height, 1.3);width:var(--fot-width, 100%)}.fot__label{color:var(--fot-label-color, currentColor);white-space:var(--fot-label-white-space, pre-wrap);word-break:var(--fot-label-word-break, break-word);max-width:var(--fot-label-width, 100%)}.fot__count{color:var(--fot-count-color, var(--secondary, currentColor));background:var(--fot-count-background, #eee);border-radius:var(--fot-count-radius, 9px);padding:var(--fot-count-padding, .2rem .3rem);min-width:var(--fot-count-min-width, 1.8rem);text-align:center}\n"], directives: [{ type: i7__namespace.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltipPosition", "matTooltipDisabled", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { type: i4__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "optionTooltip": TooltipPipe, "localizedLabel": LocalizedLabelPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.None });
16826
+ FilterOptionTextComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FilterOptionTextComponent, selector: "filter-option-text", inputs: { option: "option", showCount: "showCount", language: "language" }, host: { classAttribute: "fot" }, ngImport: i0__namespace, template: "<span\r\n class=\"fot__label\"\r\n [matTooltip]=\"option?.tooltip | optionTooltip : language\"\r\n>\r\n {{\r\n option?.labelTemplate\r\n ? (option | evaluateLabel : language)\r\n : (option | localizedLabel : language)\r\n }}\r\n</span>\r\n\r\n<small class=\"fot__count\" *ngIf=\"showCount\">{{ option.count }}</small>\r\n", styles: [".fot{display:grid;grid-template-columns:1fr auto;align-items:center;grid-gap:.3rem;gap:.3rem;margin-inline:var(--fot-margin-inline, 0);font-size:var(--fot-font-size, .8rem);line-height:var(--fot-line-height, 1.3);width:var(--fot-width, 100%)}.fot__label{color:var(--fot-label-color, currentColor);white-space:var(--fot-label-white-space, pre-wrap);word-break:var(--fot-label-word-break, break-word);max-width:var(--fot-label-width, 100%)}.fot__count{color:var(--fot-count-color, var(--secondary, currentColor));background:var(--fot-count-background, #eee);border-radius:var(--fot-count-radius, 9px);padding:var(--fot-count-padding, .2rem .3rem);min-width:var(--fot-count-min-width, 1.8rem);text-align:center}\n"], directives: [{ type: i7__namespace.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltipPosition", "matTooltipDisabled", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { type: i4__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "optionTooltip": TooltipPipe, "evaluateLabel": EvaluatorLabelPipe, "localizedLabel": LocalizedLabelPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.None });
16448
16827
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FilterOptionTextComponent, decorators: [{
16449
16828
  type: i0.Component,
16450
16829
  args: [{
@@ -20468,348 +20847,6 @@
20468
20847
  type: i0.Input
20469
20848
  }] } });
20470
20849
 
20471
- /**
20472
- * Creates a secure context for function evaluation that prevents access to the window object.
20473
- * @returns {Record<string, any>} A secure context object with safe properties.
20474
- */
20475
- function createSecureContext() {
20476
- // Create a secure context with only safe properties
20477
- return {
20478
- // Add any safe globals here that should be accessible
20479
- console: {
20480
- log: console.log,
20481
- warn: console.warn,
20482
- error: console.error
20483
- },
20484
- // Add other safe objects/functions as needed
20485
- Math: Math,
20486
- Date: Date,
20487
- Number: Number,
20488
- String: String,
20489
- Boolean: Boolean,
20490
- Array: Array,
20491
- Object: Object,
20492
- JSON: JSON,
20493
- // Prevent access to window
20494
- window: undefined,
20495
- self: undefined,
20496
- globalThis: undefined,
20497
- _: ___default["default"] // Include lodash if needed, but ensure it's used safely
20498
- };
20499
- }
20500
- /**
20501
- * A utility class for evaluating expressions, interpolating strings, and working with templates.
20502
- * This class provides static methods for dynamic evaluation of code, string interpolation,
20503
- * and template processing with caching capabilities.
20504
- */
20505
- var Evaluator = /** @class */ (function () {
20506
- function Evaluator() {
20507
- }
20508
- /**
20509
- * Creates a function from a string or returns the function if already provided.
20510
- * Uses a secure context to prevent access to the window object by default.
20511
- * @param {string|Function} func - The function or string to convert to a function.
20512
- * @param {...any} params - The parameters to pass to the function.
20513
- * @param {EvaluatorOptions} [options={}] - Optional configuration for the evaluation.
20514
- * @returns {Function} - The resulting function.
20515
- */
20516
- Evaluator.evaluator = function (func) {
20517
- var params = [];
20518
- for (var _i = 1; _i < arguments.length; _i++) {
20519
- params[_i - 1] = arguments[_i];
20520
- }
20521
- // Extract options if the last parameter is an options object
20522
- var options = {};
20523
- if (params.length > 0 &&
20524
- params[params.length - 1] &&
20525
- typeof params[params.length - 1] === 'object' &&
20526
- 'securityMode' in params[params.length - 1]) {
20527
- options = params.pop();
20528
- }
20529
- if (typeof func === 'function') {
20530
- return func;
20531
- }
20532
- if (typeof params[0] === 'object') {
20533
- params = _.keys(params[0]);
20534
- }
20535
- // Check if we should use secure mode (default) or unsafe mode
20536
- var securityMode = options.securityMode || 'secure';
20537
- if (securityMode === 'unsafe') {
20538
- // In unsafe mode, create a function with access to all globals
20539
- return new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], __read(params)), [func])))();
20540
- }
20541
- var sandbox = createSecureContext();
20542
- var sandboxKeys = Object.keys(sandbox);
20543
- var sandboxAssignments = sandboxKeys.map(function (key) { return "const " + key + " = sandbox." + key + ";"; }).join('');
20544
- var wrapper = new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], __read(params)), ['sandbox', "" + sandboxAssignments + func])))();
20545
- return function () {
20546
- var args = [];
20547
- for (var _i = 0; _i < arguments.length; _i++) {
20548
- args[_i] = arguments[_i];
20549
- }
20550
- return wrapper.apply(void 0, __spreadArray(__spreadArray([], __read(args)), [sandbox]));
20551
- };
20552
- };
20553
- /**
20554
- * Replaces template expressions in a string with values from data.
20555
- * Supports function calls within templates and fallback values using || syntax.
20556
- * By default, ensures evaluation happens in a secure context to prevent access to window object.
20557
- * @param {string} rawTemplate - The template string containing expressions to interpolate.
20558
- * @param {Record<string, any>} data - The data object containing values to use for interpolation.
20559
- * @param {EvaluatorOptions} [options={}] - Optional configuration for the interpolation process.
20560
- * @returns {string} - The interpolated string with all expressions replaced with actual values.
20561
- */
20562
- Evaluator.interpolateString = function (rawTemplate, data, options) {
20563
- if (options === void 0) { options = {}; }
20564
- if (!rawTemplate) {
20565
- return '';
20566
- }
20567
- if (typeof rawTemplate !== 'string') {
20568
- return rawTemplate.toString();
20569
- }
20570
- // Check if we should use secure mode (default) or unsafe mode
20571
- var securityMode = options.securityMode || 'secure';
20572
- // Create a secure data object if needed
20573
- var secureData = securityMode === 'unsafe'
20574
- ? data
20575
- : Object.assign(Object.assign(Object.assign({}, createSecureContext()), data), {
20576
- // Ensure these remain undefined
20577
- window: undefined, self: undefined, globalThis: undefined
20578
- });
20579
- return rawTemplate.replace(/({{\s*(.*?)\s*}})/g, function (match, $1, expression) {
20580
- if (expression.indexOf('(') !== -1) {
20581
- return expression.replace(/([^(]+)\(([^)]+)\s*\);?/, function (_$1, fnName, argsStr) {
20582
- fnName = _.trim(fnName);
20583
- var func = _.get(secureData, fnName);
20584
- if (func) {
20585
- if (argsStr) {
20586
- var args = argsStr.split(',').map(function (arg) {
20587
- var trimmed = _.trim(arg);
20588
- if (/^['"]/.test(trimmed))
20589
- return trimmed.slice(1, -1);
20590
- return _.get(secureData, trimmed);
20591
- });
20592
- return Evaluator.evaluate(func, args, '', false, secureData, options);
20593
- }
20594
- return Evaluator.evaluate(func, [], '', false, secureData, options);
20595
- }
20596
- return '';
20597
- });
20598
- }
20599
- else {
20600
- var dataPath = expression;
20601
- if (expression.indexOf('?') !== -1) {
20602
- dataPath = expression.replace(/\?\./g, '.');
20603
- }
20604
- var parts = dataPath.split('||').map(function (item) { return item.trim(); });
20605
- var value = '';
20606
- var path = '';
20607
- for (var i = 0; i < parts.length; i++) {
20608
- path = parts[i];
20609
- if (___default["default"].has(secureData, path)) {
20610
- value = ___default["default"].get(secureData, path);
20611
- break;
20612
- }
20613
- }
20614
- if (options.data) {
20615
- _.set(options.data, path, value);
20616
- }
20617
- return value;
20618
- }
20619
- });
20620
- };
20621
- /**
20622
- * Performs an evaluation using the evaluation context of this component.
20623
- * By default, ensures evaluation happens in a secure context to prevent access to window object.
20624
- * @param {string|Function|object} func - The function or string to evaluate.
20625
- * @param {object} args - The arguments to pass to the evaluation.
20626
- * @param {string} ret - The name of the variable within the evaluation context to return.
20627
- * @param {boolean} interpolate - Determines if it should replace all {{ }} token references with actual data.
20628
- * @param {object} context - - The evaluation context.
20629
- * @param {EvaluatorOptions } options - The options to pass to the evaluation.
20630
- * @returns {*} - The result of the evaluation.
20631
- */
20632
- Evaluator.evaluate = function (func, args, ret, interpolate, context, options) {
20633
- if (args === void 0) { args = {}; }
20634
- if (ret === void 0) { ret = 'show'; }
20635
- if (interpolate === void 0) { interpolate = false; }
20636
- if (context === void 0) { context = {}; }
20637
- if (options === void 0) { options = {}; }
20638
- var returnVal = null;
20639
- var field = args.field ? args.field : { key: 'unknown' };
20640
- var fieldKey = field.key;
20641
- if (typeof func === 'string') {
20642
- if (ret) {
20643
- func = "var " + ret + ";" + func + ";return " + ret;
20644
- }
20645
- if (interpolate) {
20646
- func = Evaluator.interpolate(func, args, options);
20647
- }
20648
- try {
20649
- // Pass the security mode option to the evaluator
20650
- var evaluatorOptions = { securityMode: options.securityMode || 'secure' };
20651
- func = Evaluator.evaluator(func, args, context, evaluatorOptions);
20652
- args = Array.isArray(args) ? args : _.values(args);
20653
- }
20654
- catch (err) {
20655
- console.warn("An error occured within the custom function for " + fieldKey, err);
20656
- returnVal = null;
20657
- func = false;
20658
- }
20659
- }
20660
- if (typeof func === 'function') {
20661
- try {
20662
- returnVal = Evaluator.execute(func, args, context, options);
20663
- }
20664
- catch (err) {
20665
- returnVal = null;
20666
- console.warn("An error occured within custom function for " + fieldKey, err);
20667
- }
20668
- }
20669
- else if (func) {
20670
- console.warn("Unknown function type for " + fieldKey);
20671
- }
20672
- return returnVal;
20673
- };
20674
- /**
20675
- * Executes a function with provided arguments and context.
20676
- * By default, ensures execution happens in a secure context to prevent access to window object.
20677
- * @param {Function} func - The function to execute.
20678
- * @param {any[]|Record<string, any>} args - The arguments to pass to the function, either as an array or object.
20679
- * @param {Record<string, any>} [context={}] - The context (this) to use when executing the function.
20680
- * @param {EvaluatorOptions} [options={}] - Optional configuration for the execution.
20681
- * @returns {any} - The result of the function execution.
20682
- */
20683
- Evaluator.execute = function (func, args, context, options) {
20684
- if (context === void 0) { context = {}; }
20685
- if (options === void 0) { options = {}; }
20686
- // Check if we should use secure mode (default) or unsafe mode
20687
- var securityMode = options.securityMode || 'secure';
20688
- if (securityMode === 'unsafe') {
20689
- // In unsafe mode, execute with the original context
20690
- return Array.isArray(args) ? func.apply(context, args) : func.call(context, args);
20691
- }
20692
- else {
20693
- // In secure mode, create a secure context by merging the provided context with our secure context
20694
- var secureContext = Object.assign(Object.assign(Object.assign({}, createSecureContext()), context), {
20695
- // Ensure these remain undefined even if they were in the provided context
20696
- window: undefined, self: undefined, globalThis: undefined
20697
- });
20698
- // Execute the function with the secure context
20699
- return Array.isArray(args) ? func.apply(secureContext, args) : func.call(secureContext, args);
20700
- }
20701
- };
20702
- /**
20703
- * Creates a template function from a string with caching for performance.
20704
- * By default, ensures the template function executes in a secure context.
20705
- * @param {string} template - The template string to compile into a function.
20706
- * @param {string} [hash] - Optional hash to use as cache key. If not provided, a hash will be generated from the template.
20707
- * @param {EvaluatorOptions} [options={}] - Optional configuration for the template.
20708
- * @returns {Function|undefined} - The compiled template function, or undefined if compilation fails.
20709
- */
20710
- Evaluator.template = function (template, hash, options) {
20711
- if (options === void 0) { options = {}; }
20712
- hash = hash || stringHash__default["default"](template).toString();
20713
- // If hash contains options object, extract it
20714
- if (typeof hash === 'object' && 'securityMode' in hash) {
20715
- options = hash;
20716
- hash = stringHash__default["default"](template).toString();
20717
- }
20718
- // Check if we have a cached version
20719
- var cacheKey = hash + (options.securityMode || 'secure');
20720
- if (Evaluator.cache[cacheKey]) {
20721
- return Evaluator.cache[cacheKey];
20722
- }
20723
- try {
20724
- template = template.replace(/ctx\./g, '');
20725
- // Create the template function using lodash
20726
- var templateFunc_1 = ___default["default"].template(template, Evaluator.templateSettings);
20727
- // Check if we should use secure mode (default) or unsafe mode
20728
- var securityMode = options.securityMode || 'secure';
20729
- if (securityMode === 'unsafe') {
20730
- // In unsafe mode, return the original template function
20731
- return (Evaluator.cache[cacheKey] = templateFunc_1);
20732
- }
20733
- else {
20734
- // In secure mode, wrap the template function to ensure it runs in a secure context
20735
- var secureTemplateFunc = function (data) {
20736
- // Create a secure context for the template
20737
- var secureData = Object.assign(Object.assign(Object.assign({}, createSecureContext()), data), {
20738
- // Ensure these remain undefined
20739
- window: undefined, self: undefined, globalThis: undefined
20740
- });
20741
- return templateFunc_1(secureData);
20742
- };
20743
- // Cache and return the secure template function
20744
- return (Evaluator.cache[cacheKey] = secureTemplateFunc);
20745
- }
20746
- }
20747
- catch (err) {
20748
- console.warn('Error while processing template', err, template);
20749
- return undefined;
20750
- }
20751
- };
20752
- /**
20753
- * Interpolates a template with data, handling both function templates and string templates.
20754
- * By default, ensures interpolation happens in a secure context to prevent access to window object.
20755
- * @param {string|Function} rawTemplate - The template to interpolate, either as a string or a function.
20756
- * @param {Record<string, any>} data - The data object to use for interpolation.
20757
- * @param {EvaluatorOptions} options - Options for the interpolation process.
20758
- * @returns {string|any} - The result of the interpolation, typically a string but could be any type depending on the template.
20759
- */
20760
- Evaluator.interpolate = function (rawTemplate, data, options) {
20761
- if (options === void 0) { options = {}; }
20762
- if (typeof rawTemplate === 'function') {
20763
- try {
20764
- // If the template is a function, execute it with the data
20765
- // We can't directly secure a provided function, but we can use execute
20766
- // to run it in a secure context if needed
20767
- if (options.securityMode !== 'unsafe') {
20768
- var secureData = Object.assign(Object.assign(Object.assign({}, createSecureContext()), data), { window: undefined, self: undefined, globalThis: undefined });
20769
- return rawTemplate(secureData);
20770
- }
20771
- else {
20772
- return rawTemplate(data);
20773
- }
20774
- }
20775
- catch (err) {
20776
- console.warn('Error interpolating template', err, data);
20777
- return err.message;
20778
- }
20779
- }
20780
- rawTemplate = String(rawTemplate);
20781
- // Pass the security mode option to the template method
20782
- var template = Evaluator.template(rawTemplate, undefined, options);
20783
- if (typeof template === 'function') {
20784
- try {
20785
- return template(data);
20786
- }
20787
- catch (err) {
20788
- console.warn('Error interpolating template', err, rawTemplate, data);
20789
- return err.message;
20790
- }
20791
- }
20792
- return template;
20793
- };
20794
- return Evaluator;
20795
- }());
20796
- /**
20797
- * Cache for storing compiled template functions to improve performance.
20798
- * Keys are string hashes of the template, values are the compiled functions.
20799
- */
20800
- Evaluator.cache = {};
20801
- /**
20802
- * Settings for template processing, defining regex patterns for different template operations.
20803
- * - interpolate: Pattern for variable interpolation ({{ variable }})
20804
- * - evaluate: Pattern for code evaluation ({% code %})
20805
- * - escape: Pattern for HTML escaping ({{{ variable }}})
20806
- */
20807
- Evaluator.templateSettings = {
20808
- interpolate: /{{([\s\S]+?)}}/g,
20809
- evaluate: /\{%([\s\S]+?)%\}/g,
20810
- escape: /\{\{\{([\s\S]+?)\}\}\}/g
20811
- };
20812
-
20813
20850
  var NDF_EDITOR_TYPE = {
20814
20851
  REPORTS: 'report',
20815
20852
  TABLES: 'table'
@@ -21637,6 +21674,7 @@
21637
21674
  TooltipPipe,
21638
21675
  FiltersByRolesPipe,
21639
21676
  CheckConditionPipe$1,
21677
+ EvaluatorLabelPipe
21640
21678
  ];
21641
21679
  var NdfFiltersPanelModule = /** @class */ (function () {
21642
21680
  /**
@@ -21707,7 +21745,8 @@
21707
21745
  SortListPipe,
21708
21746
  TooltipPipe,
21709
21747
  FiltersByRolesPipe,
21710
- CheckConditionPipe$1, FilterOptionTextComponent,
21748
+ CheckConditionPipe$1,
21749
+ EvaluatorLabelPipe, FilterOptionTextComponent,
21711
21750
  FilterSearchInputComponent,
21712
21751
  FilterCollapseControlComponent,
21713
21752
  FieldHeaderComponent,
@@ -52350,6 +52389,7 @@
52350
52389
  exports.EmptyTemplateDirective = EmptyTemplateDirective;
52351
52390
  exports.EnvManager = EnvManager;
52352
52391
  exports.Evaluator = Evaluator;
52392
+ exports.EvaluatorLabelPipe = EvaluatorLabelPipe;
52353
52393
  exports.EvaluatorsService = EvaluatorsService;
52354
52394
  exports.ExtensionLoaderService = ExtensionLoaderService;
52355
52395
  exports.ExtensionService = ExtensionService;