@fluxo-dev/shell-reporting 26.2.1 → 26.2.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.
Files changed (2) hide show
  1. package/index.esm.js +1297 -1195
  2. package/package.json +4 -4
package/index.esm.js CHANGED
@@ -274,7 +274,7 @@ var $String$5 = String;
274
274
  var $TypeError$k = TypeError;
275
275
 
276
276
  // `Assert: Type(argument) is Object`
277
- var anObject$m = function (argument) {
277
+ var anObject$n = function (argument) {
278
278
  if (isObject$a(argument)) return argument;
279
279
  throw new $TypeError$k($String$5(argument) + ' is not an object');
280
280
  };
@@ -380,19 +380,19 @@ var tryToString$4 = tryToString$5;
380
380
  var $TypeError$j = TypeError;
381
381
 
382
382
  // `Assert: IsCallable(argument) is true`
383
- var aCallable$h = function (argument) {
383
+ var aCallable$i = function (argument) {
384
384
  if (isCallable$m(argument)) return argument;
385
385
  throw new $TypeError$j(tryToString$4(argument) + ' is not a function');
386
386
  };
387
387
 
388
- var aCallable$g = aCallable$h;
388
+ var aCallable$h = aCallable$i;
389
389
  var isNullOrUndefined$3 = isNullOrUndefined$5;
390
390
 
391
391
  // `GetMethod` abstract operation
392
392
  // https://tc39.es/ecma262/#sec-getmethod
393
393
  var getMethod$5 = function (V, P) {
394
394
  var func = V[P];
395
- return isNullOrUndefined$3(func) ? undefined : aCallable$g(func);
395
+ return isNullOrUndefined$3(func) ? undefined : aCallable$h(func);
396
396
  };
397
397
 
398
398
  var call$m = functionCall;
@@ -450,7 +450,7 @@ var toPropertyKey$2 = function (argument) {
450
450
  var DESCRIPTORS$d = descriptors;
451
451
  var IE8_DOM_DEFINE$1 = ie8DomDefine;
452
452
  var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
453
- var anObject$l = anObject$m;
453
+ var anObject$m = anObject$n;
454
454
  var toPropertyKey$1 = toPropertyKey$2;
455
455
 
456
456
  var $TypeError$g = TypeError;
@@ -465,9 +465,9 @@ var WRITABLE = 'writable';
465
465
  // `Object.defineProperty` method
466
466
  // https://tc39.es/ecma262/#sec-object.defineproperty
467
467
  objectDefineProperty.f = DESCRIPTORS$d ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
468
- anObject$l(O);
468
+ anObject$m(O);
469
469
  P = toPropertyKey$1(P);
470
- anObject$l(Attributes);
470
+ anObject$m(Attributes);
471
471
  if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
472
472
  var current = $getOwnPropertyDescriptor$1(O, P);
473
473
  if (current && current[WRITABLE]) {
@@ -480,9 +480,9 @@ objectDefineProperty.f = DESCRIPTORS$d ? V8_PROTOTYPE_DEFINE_BUG$1 ? function de
480
480
  }
481
481
  } return $defineProperty(O, P, Attributes);
482
482
  } : $defineProperty : function defineProperty(O, P, Attributes) {
483
- anObject$l(O);
483
+ anObject$m(O);
484
484
  P = toPropertyKey$1(P);
485
- anObject$l(Attributes);
485
+ anObject$m(Attributes);
486
486
  if (IE8_DOM_DEFINE$1) try {
487
487
  return $defineProperty(O, P, Attributes);
488
488
  } catch (error) { /* empty */ }
@@ -625,7 +625,7 @@ var objectKeys$2 = Object.keys || function keys(O) {
625
625
  var DESCRIPTORS$c = descriptors;
626
626
  var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
627
627
  var definePropertyModule$4 = objectDefineProperty;
628
- var anObject$k = anObject$m;
628
+ var anObject$l = anObject$n;
629
629
  var toIndexedObject$2 = toIndexedObject$5;
630
630
  var objectKeys$1 = objectKeys$2;
631
631
 
@@ -633,7 +633,7 @@ var objectKeys$1 = objectKeys$2;
633
633
  // https://tc39.es/ecma262/#sec-object.defineproperties
634
634
  // eslint-disable-next-line es/no-object-defineproperties -- safe
635
635
  objectDefineProperties.f = DESCRIPTORS$c && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
636
- anObject$k(O);
636
+ anObject$l(O);
637
637
  var props = toIndexedObject$2(Properties);
638
638
  var keys = objectKeys$1(Properties);
639
639
  var length = keys.length;
@@ -657,7 +657,7 @@ var sharedKey$3 = function (key) {
657
657
  };
658
658
 
659
659
  /* global ActiveXObject -- old IE, WSH */
660
- var anObject$j = anObject$m;
660
+ var anObject$k = anObject$n;
661
661
  var definePropertiesModule = objectDefineProperties;
662
662
  var enumBugKeys$1 = enumBugKeys$3;
663
663
  var hiddenKeys$2 = hiddenKeys$4;
@@ -731,7 +731,7 @@ hiddenKeys$2[IE_PROTO$1] = true;
731
731
  var objectCreate = Object.create || function create(O, Properties) {
732
732
  var result;
733
733
  if (O !== null) {
734
- EmptyConstructor[PROTOTYPE] = anObject$j(O);
734
+ EmptyConstructor[PROTOTYPE] = anObject$k(O);
735
735
  result = new EmptyConstructor();
736
736
  EmptyConstructor[PROTOTYPE] = null;
737
737
  // add "__proto__" for Object.getPrototypeOf polyfill
@@ -1044,13 +1044,13 @@ var getBuiltIn$7 = getBuiltIn$a;
1044
1044
  var uncurryThis$j = functionUncurryThis;
1045
1045
  var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1046
1046
  var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
1047
- var anObject$i = anObject$m;
1047
+ var anObject$j = anObject$n;
1048
1048
 
1049
1049
  var concat$2 = uncurryThis$j([].concat);
1050
1050
 
1051
1051
  // all object keys, includes non-enumerable and symbols
1052
1052
  var ownKeys$1 = getBuiltIn$7('Reflect', 'ownKeys') || function ownKeys(it) {
1053
- var keys = getOwnPropertyNamesModule.f(anObject$i(it));
1053
+ var keys = getOwnPropertyNamesModule.f(anObject$j(it));
1054
1054
  var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
1055
1055
  return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
1056
1056
  };
@@ -1257,12 +1257,12 @@ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUME
1257
1257
  };
1258
1258
 
1259
1259
  var uncurryThis$i = functionUncurryThis;
1260
- var aCallable$f = aCallable$h;
1260
+ var aCallable$g = aCallable$i;
1261
1261
 
1262
1262
  var functionUncurryThisAccessor = function (object, key, method) {
1263
1263
  try {
1264
1264
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1265
- return uncurryThis$i(aCallable$f(Object.getOwnPropertyDescriptor(object, key)[method]));
1265
+ return uncurryThis$i(aCallable$g(Object.getOwnPropertyDescriptor(object, key)[method]));
1266
1266
  } catch (error) { /* empty */ }
1267
1267
  };
1268
1268
 
@@ -1311,7 +1311,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
1311
1311
  };
1312
1312
  }() : undefined);
1313
1313
 
1314
- var $$w = _export;
1314
+ var $$x = _export;
1315
1315
  var call$j = functionCall;
1316
1316
  var FunctionName = functionName;
1317
1317
  var isCallable$d = isCallable$q;
@@ -1399,7 +1399,7 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
1399
1399
  if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1400
1400
  defineBuiltIn$6(IterablePrototype, KEY, methods[KEY]);
1401
1401
  }
1402
- } else $$w({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1402
+ } else $$x({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1403
1403
  }
1404
1404
 
1405
1405
  // define iterator
@@ -1955,13 +1955,13 @@ var objectAssign = !$assign || fails$i(function () {
1955
1955
  } return T;
1956
1956
  } : $assign;
1957
1957
 
1958
- var $$v = _export;
1958
+ var $$w = _export;
1959
1959
  var assign = objectAssign;
1960
1960
 
1961
1961
  // `Object.assign` method
1962
1962
  // https://tc39.es/ecma262/#sec-object.assign
1963
1963
  // eslint-disable-next-line es/no-object-assign -- required for testing
1964
- $$v({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1964
+ $$w({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1965
1965
  assign: assign
1966
1966
  });
1967
1967
 
@@ -2013,12 +2013,12 @@ var toString$9 = function (argument) {
2013
2013
  return $String$1(argument);
2014
2014
  };
2015
2015
 
2016
- var anObject$h = anObject$m;
2016
+ var anObject$i = anObject$n;
2017
2017
 
2018
2018
  // `RegExp.prototype.flags` getter implementation
2019
2019
  // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
2020
2020
  var regexpFlags$1 = function () {
2021
- var that = anObject$h(this);
2021
+ var that = anObject$i(this);
2022
2022
  var result = '';
2023
2023
  if (that.hasIndices) result += 'd';
2024
2024
  if (that.global) result += 'g';
@@ -2046,7 +2046,7 @@ var regexpGetFlags = function (R) {
2046
2046
 
2047
2047
  var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
2048
2048
  var defineBuiltIn$5 = defineBuiltIn$9;
2049
- var anObject$g = anObject$m;
2049
+ var anObject$h = anObject$n;
2050
2050
  var $toString = toString$9;
2051
2051
  var fails$h = fails$t;
2052
2052
  var getRegExpFlags = regexpGetFlags;
@@ -2063,7 +2063,7 @@ var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && nativeToString.name !== TO_STRING
2063
2063
  // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
2064
2064
  if (NOT_GENERIC || INCORRECT_NAME) {
2065
2065
  defineBuiltIn$5(RegExpPrototype$1, TO_STRING, function toString() {
2066
- var R = anObject$g(this);
2066
+ var R = anObject$h(this);
2067
2067
  var pattern = $toString(R.source);
2068
2068
  var flags = $toString(getRegExpFlags(R));
2069
2069
  return '/' + pattern + '/' + flags;
@@ -2097,10 +2097,10 @@ var createProperty$1 = function (object, key, value) {
2097
2097
  else object[key] = value;
2098
2098
  };
2099
2099
 
2100
- var $$u = _export;
2100
+ var $$v = _export;
2101
2101
  var global$d = global$o;
2102
2102
  var anInstance$1 = anInstance$2;
2103
- var anObject$f = anObject$m;
2103
+ var anObject$g = anObject$n;
2104
2104
  var isCallable$b = isCallable$q;
2105
2105
  var getPrototypeOf = objectGetPrototypeOf;
2106
2106
  var defineBuiltInAccessor$2 = defineBuiltInAccessor$3;
@@ -2137,7 +2137,7 @@ var defineIteratorPrototypeAccessor = function (key, value) {
2137
2137
  return value;
2138
2138
  },
2139
2139
  set: function (replacement) {
2140
- anObject$f(this);
2140
+ anObject$g(this);
2141
2141
  if (this === IteratorPrototype$1) throw new $TypeError$d("You can't redefine this property");
2142
2142
  if (hasOwn$2(this, key)) this[key] = replacement;
2143
2143
  else createProperty(this, key, replacement);
@@ -2156,7 +2156,7 @@ IteratorConstructor.prototype = IteratorPrototype$1;
2156
2156
 
2157
2157
  // `Iterator` constructor
2158
2158
  // https://github.com/tc39/proposal-iterator-helpers
2159
- $$u({ global: true, constructor: true, forced: FORCED$4 }, {
2159
+ $$v({ global: true, constructor: true, forced: FORCED$4 }, {
2160
2160
  Iterator: IteratorConstructor
2161
2161
  });
2162
2162
 
@@ -2171,14 +2171,14 @@ var functionUncurryThisClause = function (fn) {
2171
2171
  };
2172
2172
 
2173
2173
  var uncurryThis$f = functionUncurryThisClause;
2174
- var aCallable$e = aCallable$h;
2174
+ var aCallable$f = aCallable$i;
2175
2175
  var NATIVE_BIND$1 = functionBindNative;
2176
2176
 
2177
2177
  var bind$4 = uncurryThis$f(uncurryThis$f.bind);
2178
2178
 
2179
2179
  // optional / simple context binding
2180
2180
  var functionBindContext = function (fn, that) {
2181
- aCallable$e(fn);
2181
+ aCallable$f(fn);
2182
2182
  return that === undefined ? fn : NATIVE_BIND$1 ? bind$4(fn, that) : function (/* ...args */) {
2183
2183
  return fn.apply(that, arguments);
2184
2184
  };
@@ -2210,8 +2210,8 @@ var getIteratorMethod$2 = function (it) {
2210
2210
  };
2211
2211
 
2212
2212
  var call$g = functionCall;
2213
- var aCallable$d = aCallable$h;
2214
- var anObject$e = anObject$m;
2213
+ var aCallable$e = aCallable$i;
2214
+ var anObject$f = anObject$n;
2215
2215
  var tryToString$3 = tryToString$5;
2216
2216
  var getIteratorMethod$1 = getIteratorMethod$2;
2217
2217
 
@@ -2219,17 +2219,17 @@ var $TypeError$c = TypeError;
2219
2219
 
2220
2220
  var getIterator$1 = function (argument, usingIterator) {
2221
2221
  var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
2222
- if (aCallable$d(iteratorMethod)) return anObject$e(call$g(iteratorMethod, argument));
2222
+ if (aCallable$e(iteratorMethod)) return anObject$f(call$g(iteratorMethod, argument));
2223
2223
  throw new $TypeError$c(tryToString$3(argument) + ' is not iterable');
2224
2224
  };
2225
2225
 
2226
2226
  var call$f = functionCall;
2227
- var anObject$d = anObject$m;
2227
+ var anObject$e = anObject$n;
2228
2228
  var getMethod$2 = getMethod$5;
2229
2229
 
2230
2230
  var iteratorClose$5 = function (iterator, kind, value) {
2231
2231
  var innerResult, innerError;
2232
- anObject$d(iterator);
2232
+ anObject$e(iterator);
2233
2233
  try {
2234
2234
  innerResult = getMethod$2(iterator, 'return');
2235
2235
  if (!innerResult) {
@@ -2243,13 +2243,13 @@ var iteratorClose$5 = function (iterator, kind, value) {
2243
2243
  }
2244
2244
  if (kind === 'throw') throw value;
2245
2245
  if (innerError) throw innerResult;
2246
- anObject$d(innerResult);
2246
+ anObject$e(innerResult);
2247
2247
  return value;
2248
2248
  };
2249
2249
 
2250
2250
  var bind$3 = functionBindContext;
2251
2251
  var call$e = functionCall;
2252
- var anObject$c = anObject$m;
2252
+ var anObject$d = anObject$n;
2253
2253
  var tryToString$2 = tryToString$5;
2254
2254
  var isArrayIteratorMethod = isArrayIteratorMethod$1;
2255
2255
  var lengthOfArrayLike$3 = lengthOfArrayLike$5;
@@ -2267,7 +2267,7 @@ var Result = function (stopped, result) {
2267
2267
 
2268
2268
  var ResultPrototype = Result.prototype;
2269
2269
 
2270
- var iterate$8 = function (iterable, unboundFunction, options) {
2270
+ var iterate$9 = function (iterable, unboundFunction, options) {
2271
2271
  var that = options && options.that;
2272
2272
  var AS_ENTRIES = !!(options && options.AS_ENTRIES);
2273
2273
  var IS_RECORD = !!(options && options.IS_RECORD);
@@ -2283,7 +2283,7 @@ var iterate$8 = function (iterable, unboundFunction, options) {
2283
2283
 
2284
2284
  var callFn = function (value) {
2285
2285
  if (AS_ENTRIES) {
2286
- anObject$c(value);
2286
+ anObject$d(value);
2287
2287
  return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
2288
2288
  } return INTERRUPTED ? fn(value, stop) : fn(value);
2289
2289
  };
@@ -2318,7 +2318,7 @@ var iterate$8 = function (iterable, unboundFunction, options) {
2318
2318
 
2319
2319
  // `GetIteratorDirect(obj)` abstract operation
2320
2320
  // https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect
2321
- var getIteratorDirect$7 = function (obj) {
2321
+ var getIteratorDirect$8 = function (obj) {
2322
2322
  return {
2323
2323
  iterator: obj,
2324
2324
  next: obj.next,
@@ -2326,21 +2326,21 @@ var getIteratorDirect$7 = function (obj) {
2326
2326
  };
2327
2327
  };
2328
2328
 
2329
- var $$t = _export;
2330
- var iterate$7 = iterate$8;
2331
- var aCallable$c = aCallable$h;
2332
- var anObject$b = anObject$m;
2333
- var getIteratorDirect$6 = getIteratorDirect$7;
2329
+ var $$u = _export;
2330
+ var iterate$8 = iterate$9;
2331
+ var aCallable$d = aCallable$i;
2332
+ var anObject$c = anObject$n;
2333
+ var getIteratorDirect$7 = getIteratorDirect$8;
2334
2334
 
2335
2335
  // `Iterator.prototype.forEach` method
2336
2336
  // https://github.com/tc39/proposal-iterator-helpers
2337
- $$t({ target: 'Iterator', proto: true, real: true }, {
2337
+ $$u({ target: 'Iterator', proto: true, real: true }, {
2338
2338
  forEach: function forEach(fn) {
2339
- anObject$b(this);
2340
- aCallable$c(fn);
2341
- var record = getIteratorDirect$6(this);
2339
+ anObject$c(this);
2340
+ aCallable$d(fn);
2341
+ var record = getIteratorDirect$7(this);
2342
2342
  var counter = 0;
2343
- iterate$7(record, function (value) {
2343
+ iterate$8(record, function (value) {
2344
2344
  fn(value, counter++);
2345
2345
  }, { IS_RECORD: true });
2346
2346
  }
@@ -2429,28 +2429,28 @@ var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) {
2429
2429
  return IteratorProxy;
2430
2430
  };
2431
2431
 
2432
- var anObject$a = anObject$m;
2432
+ var anObject$b = anObject$n;
2433
2433
  var iteratorClose$2 = iteratorClose$5;
2434
2434
 
2435
2435
  // call something on iterator step with safe closing on error
2436
2436
  var callWithSafeIterationClosing$2 = function (iterator, fn, value, ENTRIES) {
2437
2437
  try {
2438
- return ENTRIES ? fn(anObject$a(value)[0], value[1]) : fn(value);
2438
+ return ENTRIES ? fn(anObject$b(value)[0], value[1]) : fn(value);
2439
2439
  } catch (error) {
2440
2440
  iteratorClose$2(iterator, 'throw', error);
2441
2441
  }
2442
2442
  };
2443
2443
 
2444
2444
  var call$c = functionCall;
2445
- var aCallable$b = aCallable$h;
2446
- var anObject$9 = anObject$m;
2447
- var getIteratorDirect$5 = getIteratorDirect$7;
2445
+ var aCallable$c = aCallable$i;
2446
+ var anObject$a = anObject$n;
2447
+ var getIteratorDirect$6 = getIteratorDirect$8;
2448
2448
  var createIteratorProxy$1 = iteratorCreateProxy;
2449
2449
  var callWithSafeIterationClosing$1 = callWithSafeIterationClosing$2;
2450
2450
 
2451
2451
  var IteratorProxy$1 = createIteratorProxy$1(function () {
2452
2452
  var iterator = this.iterator;
2453
- var result = anObject$9(call$c(this.next, iterator));
2453
+ var result = anObject$a(call$c(this.next, iterator));
2454
2454
  var done = this.done = !!result.done;
2455
2455
  if (!done) return callWithSafeIterationClosing$1(iterator, this.mapper, [result.value, this.counter++], true);
2456
2456
  });
@@ -2458,38 +2458,38 @@ var IteratorProxy$1 = createIteratorProxy$1(function () {
2458
2458
  // `Iterator.prototype.map` method
2459
2459
  // https://github.com/tc39/proposal-iterator-helpers
2460
2460
  var iteratorMap = function map(mapper) {
2461
- anObject$9(this);
2462
- aCallable$b(mapper);
2463
- return new IteratorProxy$1(getIteratorDirect$5(this), {
2461
+ anObject$a(this);
2462
+ aCallable$c(mapper);
2463
+ return new IteratorProxy$1(getIteratorDirect$6(this), {
2464
2464
  mapper: mapper
2465
2465
  });
2466
2466
  };
2467
2467
 
2468
- var $$s = _export;
2468
+ var $$t = _export;
2469
2469
  var map = iteratorMap;
2470
2470
  var IS_PURE$1 = isPure;
2471
2471
 
2472
2472
  // `Iterator.prototype.map` method
2473
2473
  // https://github.com/tc39/proposal-iterator-helpers
2474
- $$s({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
2474
+ $$t({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
2475
2475
  map: map
2476
2476
  });
2477
2477
 
2478
- var $$r = _export;
2479
- var iterate$6 = iterate$8;
2480
- var aCallable$a = aCallable$h;
2481
- var anObject$8 = anObject$m;
2482
- var getIteratorDirect$4 = getIteratorDirect$7;
2478
+ var $$s = _export;
2479
+ var iterate$7 = iterate$9;
2480
+ var aCallable$b = aCallable$i;
2481
+ var anObject$9 = anObject$n;
2482
+ var getIteratorDirect$5 = getIteratorDirect$8;
2483
2483
 
2484
2484
  // `Iterator.prototype.find` method
2485
2485
  // https://github.com/tc39/proposal-iterator-helpers
2486
- $$r({ target: 'Iterator', proto: true, real: true }, {
2486
+ $$s({ target: 'Iterator', proto: true, real: true }, {
2487
2487
  find: function find(predicate) {
2488
- anObject$8(this);
2489
- aCallable$a(predicate);
2490
- var record = getIteratorDirect$4(this);
2488
+ anObject$9(this);
2489
+ aCallable$b(predicate);
2490
+ var record = getIteratorDirect$5(this);
2491
2491
  var counter = 0;
2492
- return iterate$6(record, function (value, stop) {
2492
+ return iterate$7(record, function (value, stop) {
2493
2493
  if (predicate(value, counter++)) return stop(value);
2494
2494
  }, { IS_RECORD: true, INTERRUPTED: true }).result;
2495
2495
  }
@@ -2819,7 +2819,7 @@ var aConstructor$1 = function (argument) {
2819
2819
  throw new $TypeError$a(tryToString$1(argument) + ' is not a constructor');
2820
2820
  };
2821
2821
 
2822
- var anObject$7 = anObject$m;
2822
+ var anObject$8 = anObject$n;
2823
2823
  var aConstructor = aConstructor$1;
2824
2824
  var isNullOrUndefined$1 = isNullOrUndefined$5;
2825
2825
  var wellKnownSymbol$6 = wellKnownSymbol$k;
@@ -2829,9 +2829,9 @@ var SPECIES$2 = wellKnownSymbol$6('species');
2829
2829
  // `SpeciesConstructor` abstract operation
2830
2830
  // https://tc39.es/ecma262/#sec-speciesconstructor
2831
2831
  var speciesConstructor$2 = function (O, defaultConstructor) {
2832
- var C = anObject$7(O).constructor;
2832
+ var C = anObject$8(O).constructor;
2833
2833
  var S;
2834
- return C === undefined || isNullOrUndefined$1(S = anObject$7(C)[SPECIES$2]) ? defaultConstructor : aConstructor(S);
2834
+ return C === undefined || isNullOrUndefined$1(S = anObject$8(C)[SPECIES$2]) ? defaultConstructor : aConstructor(S);
2835
2835
  };
2836
2836
 
2837
2837
  var NATIVE_BIND = functionBindNative;
@@ -3177,7 +3177,7 @@ var promiseConstructorDetection = {
3177
3177
 
3178
3178
  var newPromiseCapability$2 = {};
3179
3179
 
3180
- var aCallable$9 = aCallable$h;
3180
+ var aCallable$a = aCallable$i;
3181
3181
 
3182
3182
  var $TypeError$8 = TypeError;
3183
3183
 
@@ -3188,8 +3188,8 @@ var PromiseCapability = function (C) {
3188
3188
  resolve = $$resolve;
3189
3189
  reject = $$reject;
3190
3190
  });
3191
- this.resolve = aCallable$9(resolve);
3192
- this.reject = aCallable$9(reject);
3191
+ this.resolve = aCallable$a(resolve);
3192
+ this.reject = aCallable$a(reject);
3193
3193
  };
3194
3194
 
3195
3195
  // `NewPromiseCapability` abstract operation
@@ -3198,7 +3198,7 @@ newPromiseCapability$2.f = function (C) {
3198
3198
  return new PromiseCapability(C);
3199
3199
  };
3200
3200
 
3201
- var $$q = _export;
3201
+ var $$r = _export;
3202
3202
  var IS_NODE$1 = engineIsNode;
3203
3203
  var global$6 = global$o;
3204
3204
  var call$a = functionCall;
@@ -3206,7 +3206,7 @@ var defineBuiltIn$3 = defineBuiltIn$9;
3206
3206
  var setPrototypeOf = objectSetPrototypeOf;
3207
3207
  var setToStringTag = setToStringTag$4;
3208
3208
  var setSpecies = setSpecies$1;
3209
- var aCallable$8 = aCallable$h;
3209
+ var aCallable$9 = aCallable$i;
3210
3210
  var isCallable$7 = isCallable$q;
3211
3211
  var isObject$2 = isObject$b;
3212
3212
  var anInstance = anInstance$2;
@@ -3396,7 +3396,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
3396
3396
  // 25.4.3.1 Promise(executor)
3397
3397
  PromiseConstructor = function Promise(executor) {
3398
3398
  anInstance(this, PromisePrototype);
3399
- aCallable$8(executor);
3399
+ aCallable$9(executor);
3400
3400
  call$a(Internal, this);
3401
3401
  var state = getInternalPromiseState(this);
3402
3402
  try {
@@ -3478,7 +3478,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
3478
3478
  }
3479
3479
  }
3480
3480
 
3481
- $$q({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
3481
+ $$r({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
3482
3482
  Promise: PromiseConstructor
3483
3483
  });
3484
3484
 
@@ -3534,28 +3534,28 @@ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCor
3534
3534
  NativePromiseConstructor$2.all(iterable).then(undefined, function () { /* empty */ });
3535
3535
  });
3536
3536
 
3537
- var $$p = _export;
3537
+ var $$q = _export;
3538
3538
  var call$9 = functionCall;
3539
- var aCallable$7 = aCallable$h;
3539
+ var aCallable$8 = aCallable$i;
3540
3540
  var newPromiseCapabilityModule$2 = newPromiseCapability$2;
3541
3541
  var perform$1 = perform$3;
3542
- var iterate$5 = iterate$8;
3542
+ var iterate$6 = iterate$9;
3543
3543
  var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
3544
3544
 
3545
3545
  // `Promise.all` method
3546
3546
  // https://tc39.es/ecma262/#sec-promise.all
3547
- $$p({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
3547
+ $$q({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
3548
3548
  all: function all(iterable) {
3549
3549
  var C = this;
3550
3550
  var capability = newPromiseCapabilityModule$2.f(C);
3551
3551
  var resolve = capability.resolve;
3552
3552
  var reject = capability.reject;
3553
3553
  var result = perform$1(function () {
3554
- var $promiseResolve = aCallable$7(C.resolve);
3554
+ var $promiseResolve = aCallable$8(C.resolve);
3555
3555
  var values = [];
3556
3556
  var counter = 0;
3557
3557
  var remaining = 1;
3558
- iterate$5(iterable, function (promise) {
3558
+ iterate$6(iterable, function (promise) {
3559
3559
  var index = counter++;
3560
3560
  var alreadyCalled = false;
3561
3561
  remaining++;
@@ -3573,7 +3573,7 @@ $$p({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
3573
3573
  }
3574
3574
  });
3575
3575
 
3576
- var $$o = _export;
3576
+ var $$p = _export;
3577
3577
  var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
3578
3578
  var NativePromiseConstructor$1 = promiseNativeConstructor;
3579
3579
  var getBuiltIn$4 = getBuiltIn$a;
@@ -3584,7 +3584,7 @@ var NativePromisePrototype$1 = NativePromiseConstructor$1 && NativePromiseConstr
3584
3584
 
3585
3585
  // `Promise.prototype.catch` method
3586
3586
  // https://tc39.es/ecma262/#sec-promise.prototype.catch
3587
- $$o({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
3587
+ $$p({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
3588
3588
  'catch': function (onRejected) {
3589
3589
  return this.then(undefined, onRejected);
3590
3590
  }
@@ -3598,24 +3598,24 @@ if (isCallable$6(NativePromiseConstructor$1)) {
3598
3598
  }
3599
3599
  }
3600
3600
 
3601
- var $$n = _export;
3601
+ var $$o = _export;
3602
3602
  var call$8 = functionCall;
3603
- var aCallable$6 = aCallable$h;
3603
+ var aCallable$7 = aCallable$i;
3604
3604
  var newPromiseCapabilityModule$1 = newPromiseCapability$2;
3605
3605
  var perform = perform$3;
3606
- var iterate$4 = iterate$8;
3606
+ var iterate$5 = iterate$9;
3607
3607
  var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
3608
3608
 
3609
3609
  // `Promise.race` method
3610
3610
  // https://tc39.es/ecma262/#sec-promise.race
3611
- $$n({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
3611
+ $$o({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
3612
3612
  race: function race(iterable) {
3613
3613
  var C = this;
3614
3614
  var capability = newPromiseCapabilityModule$1.f(C);
3615
3615
  var reject = capability.reject;
3616
3616
  var result = perform(function () {
3617
- var $promiseResolve = aCallable$6(C.resolve);
3618
- iterate$4(iterable, function (promise) {
3617
+ var $promiseResolve = aCallable$7(C.resolve);
3618
+ iterate$5(iterable, function (promise) {
3619
3619
  call$8($promiseResolve, C, promise).then(capability.resolve, reject);
3620
3620
  });
3621
3621
  });
@@ -3624,13 +3624,13 @@ $$n({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
3624
3624
  }
3625
3625
  });
3626
3626
 
3627
- var $$m = _export;
3627
+ var $$n = _export;
3628
3628
  var newPromiseCapabilityModule = newPromiseCapability$2;
3629
3629
  var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
3630
3630
 
3631
3631
  // `Promise.reject` method
3632
3632
  // https://tc39.es/ecma262/#sec-promise.reject
3633
- $$m({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
3633
+ $$n({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
3634
3634
  reject: function reject(r) {
3635
3635
  var capability = newPromiseCapabilityModule.f(this);
3636
3636
  var capabilityReject = capability.reject;
@@ -3639,12 +3639,12 @@ $$m({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
3639
3639
  }
3640
3640
  });
3641
3641
 
3642
- var anObject$6 = anObject$m;
3642
+ var anObject$7 = anObject$n;
3643
3643
  var isObject$1 = isObject$b;
3644
3644
  var newPromiseCapability = newPromiseCapability$2;
3645
3645
 
3646
3646
  var promiseResolve$2 = function (C, x) {
3647
- anObject$6(C);
3647
+ anObject$7(C);
3648
3648
  if (isObject$1(x) && x.constructor === C) return x;
3649
3649
  var promiseCapability = newPromiseCapability.f(C);
3650
3650
  var resolve = promiseCapability.resolve;
@@ -3652,7 +3652,7 @@ var promiseResolve$2 = function (C, x) {
3652
3652
  return promiseCapability.promise;
3653
3653
  };
3654
3654
 
3655
- var $$l = _export;
3655
+ var $$m = _export;
3656
3656
  var getBuiltIn$3 = getBuiltIn$a;
3657
3657
  var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
3658
3658
  var promiseResolve$1 = promiseResolve$2;
@@ -3661,7 +3661,7 @@ getBuiltIn$3('Promise');
3661
3661
 
3662
3662
  // `Promise.resolve` method
3663
3663
  // https://tc39.es/ecma262/#sec-promise.resolve
3664
- $$l({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
3664
+ $$m({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
3665
3665
  resolve: function resolve(x) {
3666
3666
  return promiseResolve$1(this, x);
3667
3667
  }
@@ -3835,12 +3835,12 @@ if (PATCH) {
3835
3835
 
3836
3836
  var regexpExec$2 = patchedExec;
3837
3837
 
3838
- var $$k = _export;
3838
+ var $$l = _export;
3839
3839
  var exec$2 = regexpExec$2;
3840
3840
 
3841
3841
  // `RegExp.prototype.exec` method
3842
3842
  // https://tc39.es/ecma262/#sec-regexp.prototype.exec
3843
- $$k({ target: 'RegExp', proto: true, forced: /./.exec !== exec$2 }, {
3843
+ $$l({ target: 'RegExp', proto: true, forced: /./.exec !== exec$2 }, {
3844
3844
  exec: exec$2
3845
3845
  });
3846
3846
 
@@ -4009,7 +4009,7 @@ var getSubstitution$1 = function (matched, str, position, captures, namedCapture
4009
4009
  };
4010
4010
 
4011
4011
  var call$5 = functionCall;
4012
- var anObject$5 = anObject$m;
4012
+ var anObject$6 = anObject$n;
4013
4013
  var isCallable$5 = isCallable$q;
4014
4014
  var classof$3 = classofRaw$2;
4015
4015
  var regexpExec = regexpExec$2;
@@ -4022,7 +4022,7 @@ var regexpExecAbstract = function (R, S) {
4022
4022
  var exec = R.exec;
4023
4023
  if (isCallable$5(exec)) {
4024
4024
  var result = call$5(exec, R, S);
4025
- if (result !== null) anObject$5(result);
4025
+ if (result !== null) anObject$6(result);
4026
4026
  return result;
4027
4027
  }
4028
4028
  if (classof$3(R) === 'RegExp') return call$5(regexpExec, R, S);
@@ -4034,7 +4034,7 @@ var call$4 = functionCall;
4034
4034
  var uncurryThis$9 = functionUncurryThis;
4035
4035
  var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
4036
4036
  var fails$9 = fails$t;
4037
- var anObject$4 = anObject$m;
4037
+ var anObject$5 = anObject$n;
4038
4038
  var isCallable$4 = isCallable$q;
4039
4039
  var isNullOrUndefined = isNullOrUndefined$5;
4040
4040
  var toIntegerOrInfinity$1 = toIntegerOrInfinity$5;
@@ -4102,7 +4102,7 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
4102
4102
  // `RegExp.prototype[@@replace]` method
4103
4103
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
4104
4104
  function (string, replaceValue) {
4105
- var rx = anObject$4(this);
4105
+ var rx = anObject$5(this);
4106
4106
  var S = toString$6(string);
4107
4107
 
4108
4108
  if (
@@ -4213,12 +4213,35 @@ const ReportDesigner = props => {
4213
4213
  const [designerLoaded, setDesignerLoaded] = useState(false);
4214
4214
  const designerInstanceRef = useRef(null);
4215
4215
  const shellSessionContext = useContext(ShellSessionContext);
4216
+ const [showCloseConfirmModal, setShowCloseConfirmModal] = useState(false);
4216
4217
  // Use reportId from props if available, otherwise use id from params
4217
4218
  const effectiveReportId = (_a = props.reportId) !== null && _a !== void 0 ? _a : id ? +id : undefined;
4218
4219
  const requestOptions = {
4219
4220
  host: FluxoClientSys.Instance.clientConfig.fluxoInstanceUrl.replace('/api', ''),
4220
4221
  getDesignerModelAction: "/DXXRD/GetDesignerModel"
4221
4222
  };
4223
+ // Verifica se ci sono modifiche non salvate controllando lo stato del pulsante "Salva"
4224
+ const hasUnsavedChanges = useCallback(() => {
4225
+ const saveButton = document.querySelector('.dxrd-image-save');
4226
+ if (!saveButton) return false;
4227
+ const menuItem = saveButton.closest('.dxrd-menu-item');
4228
+ return menuItem ? !menuItem.classList.contains('dxrd-disabled-button') : false;
4229
+ }, []);
4230
+ // Gestisce la richiesta di chiusura del designer
4231
+ const requestClose = useCallback(() => {
4232
+ var _a;
4233
+ if (props.mode === 'designer' && hasUnsavedChanges()) {
4234
+ setShowCloseConfirmModal(true);
4235
+ return;
4236
+ }
4237
+ (_a = props.onBack) === null || _a === void 0 ? void 0 : _a.call(props);
4238
+ }, [props, hasUnsavedChanges]);
4239
+ // Conferma la chiusura senza salvare
4240
+ const confirmClose = useCallback(() => {
4241
+ var _a;
4242
+ setShowCloseConfirmModal(false);
4243
+ (_a = props.onBack) === null || _a === void 0 ? void 0 : _a.call(props);
4244
+ }, [props]);
4222
4245
  useEffect(() => {
4223
4246
  if (props.mode === 'designer') {
4224
4247
  shellSessionContext.enterFocusMode();
@@ -4314,43 +4337,67 @@ const ReportDesigner = props => {
4314
4337
  })]
4315
4338
  });
4316
4339
  }
4317
- return jsxs(Box, {
4318
- pos: 'relative',
4319
- children: [jsx(LoadingOverlay, {
4320
- visible: !designerLoaded
4321
- }), props.showBackButton && jsx(Group, {
4322
- px: "sm",
4323
- h: 48,
4324
- justify: "space-between",
4325
- style: {
4326
- borderBottom: '1px solid var(--mantine-color-gray-3)'
4327
- },
4328
- children: jsxs(Group, {
4329
- gap: 8,
4330
- children: [jsx(ActionIcon, {
4331
- variant: "subtle",
4332
- color: "gray",
4333
- onClick: () => {
4334
- var _a;
4335
- return (_a = props.onBack) === null || _a === void 0 ? void 0 : _a.call(props);
4336
- },
4337
- children: jsx(IconArrowLeft, {
4338
- size: 18
4339
- })
4340
- }), jsx(Text, {
4340
+ return jsxs(Fragment, {
4341
+ children: [jsxs(Box, {
4342
+ pos: 'relative',
4343
+ children: [jsx(LoadingOverlay, {
4344
+ visible: !designerLoaded
4345
+ }), props.showBackButton && jsx(Group, {
4346
+ px: "sm",
4347
+ h: 48,
4348
+ justify: "space-between",
4349
+ style: {
4350
+ borderBottom: '1px solid var(--mantine-color-gray-3)'
4351
+ },
4352
+ children: jsxs(Group, {
4353
+ gap: 8,
4354
+ children: [jsx(ActionIcon, {
4355
+ variant: "subtle",
4356
+ color: "gray",
4357
+ onClick: requestClose,
4358
+ children: jsx(IconArrowLeft, {
4359
+ size: 18
4360
+ })
4361
+ }), jsx(Text, {
4362
+ size: "sm",
4363
+ fw: 500,
4364
+ children: "Torna ai report"
4365
+ })]
4366
+ })
4367
+ }), jsx("div", {
4368
+ style: {
4369
+ width: "100%",
4370
+ height: props.showBackButton ? "calc(100vh - 234px)" : "calc(100vh - 48px)"
4371
+ },
4372
+ children: jsx("div", {
4373
+ ref: designerRef
4374
+ })
4375
+ })]
4376
+ }), jsx(Modal, {
4377
+ opened: showCloseConfirmModal,
4378
+ onClose: () => setShowCloseConfirmModal(false),
4379
+ title: "Modifiche non salvate",
4380
+ size: "md",
4381
+ centered: true,
4382
+ children: jsxs(Stack, {
4383
+ gap: "lg",
4384
+ children: [jsx(Text, {
4341
4385
  size: "sm",
4342
- fw: 500,
4343
- children: "Torna ai report"
4386
+ c: "dimmed",
4387
+ children: "Sono presenti modifiche non salvate. Se esci ora, le modifiche correnti andranno perse."
4388
+ }), jsxs(Group, {
4389
+ justify: "flex-end",
4390
+ children: [jsx(Button, {
4391
+ variant: "default",
4392
+ onClick: () => setShowCloseConfirmModal(false),
4393
+ children: "Annulla"
4394
+ }), jsx(Button, {
4395
+ color: "red",
4396
+ onClick: confirmClose,
4397
+ children: "Esci senza salvare"
4398
+ })]
4344
4399
  })]
4345
4400
  })
4346
- }), jsx("div", {
4347
- style: {
4348
- width: "100%",
4349
- height: props.showBackButton ? "calc(100vh - 234px)" : "calc(100vh - 48px)"
4350
- },
4351
- children: jsx("div", {
4352
- ref: designerRef
4353
- })
4354
4401
  })]
4355
4402
  });
4356
4403
  };
@@ -4406,7 +4453,7 @@ function ReportButton(props) {
4406
4453
  });
4407
4454
  }
4408
4455
 
4409
- var $$j = _export;
4456
+ var $$k = _export;
4410
4457
  var $includes = arrayIncludes.includes;
4411
4458
  var fails$8 = fails$t;
4412
4459
  var addToUnscopables = addToUnscopables$2;
@@ -4419,7 +4466,7 @@ var BROKEN_ON_SPARSE = fails$8(function () {
4419
4466
 
4420
4467
  // `Array.prototype.includes` method
4421
4468
  // https://tc39.es/ecma262/#sec-array.prototype.includes
4422
- $$j({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
4469
+ $$k({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
4423
4470
  includes: function includes(el /* , fromIndex = 0 */) {
4424
4471
  return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
4425
4472
  }
@@ -4428,7 +4475,7 @@ $$j({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
4428
4475
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
4429
4476
  addToUnscopables('includes');
4430
4477
 
4431
- var $$i = _export;
4478
+ var $$j = _export;
4432
4479
  var NativePromiseConstructor = promiseNativeConstructor;
4433
4480
  var fails$7 = fails$t;
4434
4481
  var getBuiltIn$2 = getBuiltIn$a;
@@ -4447,7 +4494,7 @@ var NON_GENERIC = !!NativePromiseConstructor && fails$7(function () {
4447
4494
 
4448
4495
  // `Promise.prototype.finally` method
4449
4496
  // https://tc39.es/ecma262/#sec-promise.prototype.finally
4450
- $$i({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
4497
+ $$j({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
4451
4498
  'finally': function (onFinally) {
4452
4499
  var C = speciesConstructor(this, getBuiltIn$2('Promise'));
4453
4500
  var isFunction = isCallable$3(onFinally);
@@ -4509,7 +4556,7 @@ var correctIsRegexpLogic = function (METHOD_NAME) {
4509
4556
  } return false;
4510
4557
  };
4511
4558
 
4512
- var $$h = _export;
4559
+ var $$i = _export;
4513
4560
  var uncurryThis$8 = functionUncurryThis;
4514
4561
  var notARegExp = notARegexp;
4515
4562
  var requireObjectCoercible$1 = requireObjectCoercible$7;
@@ -4520,7 +4567,7 @@ var stringIndexOf = uncurryThis$8(''.indexOf);
4520
4567
 
4521
4568
  // `String.prototype.includes` method
4522
4569
  // https://tc39.es/ecma262/#sec-string.prototype.includes
4523
- $$h({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
4570
+ $$i({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
4524
4571
  includes: function includes(searchString /* , position = 0 */) {
4525
4572
  return !!~stringIndexOf(
4526
4573
  toString$5(requireObjectCoercible$1(this)),
@@ -4575,23 +4622,23 @@ var stringTrimForced = function (METHOD_NAME) {
4575
4622
  });
4576
4623
  };
4577
4624
 
4578
- var $$g = _export;
4625
+ var $$h = _export;
4579
4626
  var $trim = stringTrim.trim;
4580
4627
  var forcedStringTrimMethod = stringTrimForced;
4581
4628
 
4582
4629
  // `String.prototype.trim` method
4583
4630
  // https://tc39.es/ecma262/#sec-string.prototype.trim
4584
- $$g({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
4631
+ $$h({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
4585
4632
  trim: function trim() {
4586
4633
  return $trim(this);
4587
4634
  }
4588
4635
  });
4589
4636
 
4590
- var $$f = _export;
4637
+ var $$g = _export;
4591
4638
  var call$3 = functionCall;
4592
- var aCallable$5 = aCallable$h;
4593
- var anObject$3 = anObject$m;
4594
- var getIteratorDirect$3 = getIteratorDirect$7;
4639
+ var aCallable$6 = aCallable$i;
4640
+ var anObject$4 = anObject$n;
4641
+ var getIteratorDirect$4 = getIteratorDirect$8;
4595
4642
  var createIteratorProxy = iteratorCreateProxy;
4596
4643
  var callWithSafeIterationClosing = callWithSafeIterationClosing$2;
4597
4644
  var IS_PURE = isPure;
@@ -4602,7 +4649,7 @@ var IteratorProxy = createIteratorProxy(function () {
4602
4649
  var next = this.next;
4603
4650
  var result, done, value;
4604
4651
  while (true) {
4605
- result = anObject$3(call$3(next, iterator));
4652
+ result = anObject$4(call$3(next, iterator));
4606
4653
  done = this.done = !!result.done;
4607
4654
  if (done) return;
4608
4655
  value = result.value;
@@ -4612,11 +4659,11 @@ var IteratorProxy = createIteratorProxy(function () {
4612
4659
 
4613
4660
  // `Iterator.prototype.filter` method
4614
4661
  // https://github.com/tc39/proposal-iterator-helpers
4615
- $$f({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
4662
+ $$g({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
4616
4663
  filter: function filter(predicate) {
4617
- anObject$3(this);
4618
- aCallable$5(predicate);
4619
- return new IteratorProxy(getIteratorDirect$3(this), {
4664
+ anObject$4(this);
4665
+ aCallable$6(predicate);
4666
+ return new IteratorProxy(getIteratorDirect$4(this), {
4620
4667
  predicate: predicate
4621
4668
  });
4622
4669
  }
@@ -4756,32 +4803,6 @@ function ReportsManager(props) {
4756
4803
  setSelectedCategoryKey(`${firstCategory.scope}-${firstCategory.packageName}-${firstCategory.namespace}-${firstCategory.reportTypeId}`);
4757
4804
  }
4758
4805
  }, [reportsList, selectedCategoryKey]);
4759
- // Intercetta la navigazione nel router (back button del browser)
4760
- useEffect(() => {
4761
- if (!reportEditorState.show) return;
4762
- const handlePopState = () => {
4763
- var _a, _b;
4764
- if (!isClosingRef.current) {
4765
- const confirmExit = window.confirm('Sei sicuro di voler uscire dall\'editor? Le modifiche non salvate andranno perse.');
4766
- if (!confirmExit) {
4767
- window.history.pushState(null, '', window.location.href);
4768
- } else {
4769
- setReportEditorState({
4770
- show: false,
4771
- reportId: undefined
4772
- });
4773
- (_b = (_a = props.shellPageRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.openSidebar();
4774
- refresh();
4775
- }
4776
- }
4777
- };
4778
- // Aggiungi uno stato alla history per intercettare il back button
4779
- window.history.pushState(null, '', window.location.href);
4780
- window.addEventListener('popstate', handlePopState);
4781
- return () => {
4782
- window.removeEventListener('popstate', handlePopState);
4783
- };
4784
- }, [reportEditorState.show, props.shellPageRef]);
4785
4806
  const refresh = () => {
4786
4807
  FluxoClientSys.Instance.reporting.getReportsList().then(res => {
4787
4808
  setReportsList(res);
@@ -4844,20 +4865,17 @@ function ReportsManager(props) {
4844
4865
  };
4845
4866
  const handleCloseReportEditor = useCallback(() => {
4846
4867
  var _a, _b;
4847
- const confirmClose = window.confirm('Sei sicuro di voler chiudere l\'editor? Le modifiche non salvate andranno perse.');
4848
- if (confirmClose) {
4849
- isClosingRef.current = true;
4850
- setReportEditorState({
4851
- show: false,
4852
- reportId: undefined
4853
- });
4854
- (_b = (_a = props.shellPageRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.openSidebar();
4855
- refresh();
4856
- // Reset del flag dopo un breve delay
4857
- setTimeout(() => {
4858
- isClosingRef.current = false;
4859
- }, 100);
4860
- }
4868
+ isClosingRef.current = true;
4869
+ setReportEditorState({
4870
+ show: false,
4871
+ reportId: undefined
4872
+ });
4873
+ (_b = (_a = props.shellPageRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.openSidebar();
4874
+ refresh();
4875
+ // Reset del flag dopo un breve delay
4876
+ setTimeout(() => {
4877
+ isClosingRef.current = false;
4878
+ }, 100);
4861
4879
  }, [props.shellPageRef]);
4862
4880
  const deleteReport = () => {
4863
4881
  if (!(selectedReport === null || selectedReport === void 0 ? void 0 : selectedReport.id)) return;
@@ -5188,21 +5206,21 @@ function ReportsManager(props) {
5188
5206
  });
5189
5207
  }
5190
5208
 
5191
- var $$e = _export;
5192
- var iterate$3 = iterate$8;
5193
- var aCallable$4 = aCallable$h;
5194
- var anObject$2 = anObject$m;
5195
- var getIteratorDirect$2 = getIteratorDirect$7;
5209
+ var $$f = _export;
5210
+ var iterate$4 = iterate$9;
5211
+ var aCallable$5 = aCallable$i;
5212
+ var anObject$3 = anObject$n;
5213
+ var getIteratorDirect$3 = getIteratorDirect$8;
5196
5214
 
5197
5215
  // `Iterator.prototype.every` method
5198
5216
  // https://github.com/tc39/proposal-iterator-helpers
5199
- $$e({ target: 'Iterator', proto: true, real: true }, {
5217
+ $$f({ target: 'Iterator', proto: true, real: true }, {
5200
5218
  every: function every(predicate) {
5201
- anObject$2(this);
5202
- aCallable$4(predicate);
5203
- var record = getIteratorDirect$2(this);
5219
+ anObject$3(this);
5220
+ aCallable$5(predicate);
5221
+ var record = getIteratorDirect$3(this);
5204
5222
  var counter = 0;
5205
- return !iterate$3(record, function (value, stop) {
5223
+ return !iterate$4(record, function (value, stop) {
5206
5224
  if (!predicate(value, counter++)) return stop();
5207
5225
  }, { IS_RECORD: true, INTERRUPTED: true }).stopped;
5208
5226
  }
@@ -5763,7 +5781,7 @@ var doesNotExceedSafeInteger$1 = function (it) {
5763
5781
  return it;
5764
5782
  };
5765
5783
 
5766
- var $$d = _export;
5784
+ var $$e = _export;
5767
5785
  var toObject$2 = toObject$7;
5768
5786
  var lengthOfArrayLike$2 = lengthOfArrayLike$5;
5769
5787
  var setArrayLength = arraySetLength;
@@ -5789,7 +5807,7 @@ var FORCED$3 = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
5789
5807
 
5790
5808
  // `Array.prototype.push` method
5791
5809
  // https://tc39.es/ecma262/#sec-array.prototype.push
5792
- $$d({ target: 'Array', proto: true, arity: 1, forced: FORCED$3 }, {
5810
+ $$e({ target: 'Array', proto: true, arity: 1, forced: FORCED$3 }, {
5793
5811
  // eslint-disable-next-line no-unused-vars -- required for `.length`
5794
5812
  push: function push(item) {
5795
5813
  var O = toObject$2(this);
@@ -5805,7 +5823,7 @@ $$d({ target: 'Array', proto: true, arity: 1, forced: FORCED$3 }, {
5805
5823
  }
5806
5824
  });
5807
5825
 
5808
- var aCallable$3 = aCallable$h;
5826
+ var aCallable$4 = aCallable$i;
5809
5827
  var toObject$1 = toObject$7;
5810
5828
  var IndexedObject = indexedObject;
5811
5829
  var lengthOfArrayLike$1 = lengthOfArrayLike$5;
@@ -5820,7 +5838,7 @@ var createMethod = function (IS_RIGHT) {
5820
5838
  var O = toObject$1(that);
5821
5839
  var self = IndexedObject(O);
5822
5840
  var length = lengthOfArrayLike$1(O);
5823
- aCallable$3(callbackfn);
5841
+ aCallable$4(callbackfn);
5824
5842
  if (length === 0 && argumentsLength < 2) throw new $TypeError$3(REDUCE_EMPTY);
5825
5843
  var index = IS_RIGHT ? length - 1 : 0;
5826
5844
  var i = IS_RIGHT ? -1 : 1;
@@ -5857,7 +5875,7 @@ var arrayMethodIsStrict$2 = function (METHOD_NAME, argument) {
5857
5875
  });
5858
5876
  };
5859
5877
 
5860
- var $$c = _export;
5878
+ var $$d = _export;
5861
5879
  var $reduce = arrayReduce.left;
5862
5880
  var arrayMethodIsStrict$1 = arrayMethodIsStrict$2;
5863
5881
  var CHROME_VERSION = engineV8Version;
@@ -5870,7 +5888,7 @@ var FORCED$2 = CHROME_BUG || !arrayMethodIsStrict$1('reduce');
5870
5888
 
5871
5889
  // `Array.prototype.reduce` method
5872
5890
  // https://tc39.es/ecma262/#sec-array.prototype.reduce
5873
- $$c({ target: 'Array', proto: true, forced: FORCED$2 }, {
5891
+ $$d({ target: 'Array', proto: true, forced: FORCED$2 }, {
5874
5892
  reduce: function reduce(callbackfn /* , initialValue */) {
5875
5893
  var length = arguments.length;
5876
5894
  return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
@@ -5907,7 +5925,7 @@ var getJsonReplacerFunction = function (replacer) {
5907
5925
  };
5908
5926
  };
5909
5927
 
5910
- var $$b = _export;
5928
+ var $$c = _export;
5911
5929
  var getBuiltIn$1 = getBuiltIn$a;
5912
5930
  var apply = functionApply;
5913
5931
  var call$2 = functionCall;
@@ -5970,7 +5988,7 @@ var fixIllFormed = function (match, offset, string) {
5970
5988
  if ($stringify) {
5971
5989
  // `JSON.stringify` method
5972
5990
  // https://tc39.es/ecma262/#sec-json.stringify
5973
- $$b({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
5991
+ $$c({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
5974
5992
  // eslint-disable-next-line no-unused-vars -- required for `.length`
5975
5993
  stringify: function stringify(it, replacer, space) {
5976
5994
  var args = arraySlice$1(arguments);
@@ -5980,25 +5998,25 @@ if ($stringify) {
5980
5998
  });
5981
5999
  }
5982
6000
 
5983
- var $$a = _export;
5984
- var iterate$2 = iterate$8;
5985
- var aCallable$2 = aCallable$h;
5986
- var anObject$1 = anObject$m;
5987
- var getIteratorDirect$1 = getIteratorDirect$7;
6001
+ var $$b = _export;
6002
+ var iterate$3 = iterate$9;
6003
+ var aCallable$3 = aCallable$i;
6004
+ var anObject$2 = anObject$n;
6005
+ var getIteratorDirect$2 = getIteratorDirect$8;
5988
6006
 
5989
6007
  var $TypeError$2 = TypeError;
5990
6008
 
5991
6009
  // `Iterator.prototype.reduce` method
5992
6010
  // https://github.com/tc39/proposal-iterator-helpers
5993
- $$a({ target: 'Iterator', proto: true, real: true }, {
6011
+ $$b({ target: 'Iterator', proto: true, real: true }, {
5994
6012
  reduce: function reduce(reducer /* , initialValue */) {
5995
- anObject$1(this);
5996
- aCallable$2(reducer);
5997
- var record = getIteratorDirect$1(this);
6013
+ anObject$2(this);
6014
+ aCallable$3(reducer);
6015
+ var record = getIteratorDirect$2(this);
5998
6016
  var noInitial = arguments.length < 2;
5999
6017
  var accumulator = noInitial ? undefined : arguments[1];
6000
6018
  var counter = 0;
6001
- iterate$2(record, function (value) {
6019
+ iterate$3(record, function (value) {
6002
6020
  if (noInitial) {
6003
6021
  noInitial = false;
6004
6022
  accumulator = value;
@@ -6012,242 +6030,673 @@ $$a({ target: 'Iterator', proto: true, real: true }, {
6012
6030
  }
6013
6031
  });
6014
6032
 
6015
- /** Valore speciale usato per indicare "stampa dal browser (anteprima)" */
6016
- const CLIENT_PRINTER_VALUE = "client-printer";
6017
- // ─────────────────────────────────────────────
6018
- // Preview placeholder del documento selezionato
6019
- // ─────────────────────────────────────────────
6020
- function ReportPreviewPanel({
6021
- report,
6022
- reportUrl
6023
- }) {
6024
- var _a;
6025
- const [previewBase64, setPreviewBase64] = useState(null);
6026
- const [loadingPreview, setLoadingPreview] = useState(false);
6027
- const [previewError, setPreviewError] = useState(false);
6028
- useEffect(() => {
6029
- if (!reportUrl) {
6030
- setPreviewBase64(null);
6031
- setPreviewError(false);
6032
- return;
6033
- }
6034
- setLoadingPreview(true);
6035
- setPreviewError(false);
6036
- setPreviewBase64(null);
6037
- FluxoClientSys.Instance.reporting.preview(reportUrl).then(base64 => {
6038
- setLoadingPreview(false);
6039
- if (!base64 || base64.trim() === '') {
6040
- setPreviewError(true);
6041
- return;
6042
- }
6043
- setPreviewBase64(base64);
6044
- }).catch(() => {
6045
- setPreviewError(true);
6046
- setLoadingPreview(false);
6047
- showNotification({
6048
- title: 'Errore anteprima',
6049
- message: 'Impossibile generare l\'anteprima del formato selezionato.',
6050
- color: 'red'
6051
- });
6052
- });
6053
- }, [reportUrl]);
6054
- const hasReport = !!report;
6055
- const showImage = !!previewBase64 && !loadingPreview;
6056
- return jsx(Box, {
6057
- style: {
6058
- background: 'var(--mantine-color-gray-1)',
6059
- border: '1px solid var(--mantine-color-gray-3)',
6060
- borderRadius: 'var(--mantine-radius-md)',
6061
- padding: '12px',
6062
- height: 269,
6063
- display: 'flex',
6064
- flexDirection: 'column',
6065
- gap: 8
6066
- },
6067
- children: jsxs(Box, {
6068
- style: {
6069
- flex: 1,
6070
- position: 'relative',
6071
- display: 'flex',
6072
- alignItems: 'center',
6073
- justifyContent: 'center',
6074
- overflow: 'hidden',
6075
- minHeight: 0
6076
- },
6077
- children: [showImage ? jsx(Paper, {
6078
- shadow: "md",
6079
- style: {
6080
- height: '100%',
6081
- lineHeight: 0,
6082
- overflow: 'hidden'
6083
- },
6084
- children: jsx("img", {
6085
- src: `data:image/jpeg;base64,${previewBase64}`,
6086
- alt: (_a = report === null || report === void 0 ? void 0 : report.displayName) !== null && _a !== void 0 ? _a : 'Anteprima report',
6087
- style: {
6088
- height: '100%',
6089
- width: 'auto',
6090
- display: 'block'
6091
- }
6092
- })
6093
- }) : (/* ── Placeholder documento A4 ── */
6094
- jsxs(Paper, {
6095
- shadow: hasReport && !previewError ? 'md' : 'xs',
6096
- style: {
6097
- height: '100%',
6098
- width: 'auto',
6099
- aspectRatio: '210 / 297',
6100
- padding: '5% 6%',
6101
- display: 'flex',
6102
- flexDirection: 'column',
6103
- gap: '2%',
6104
- overflow: 'hidden',
6105
- opacity: hasReport ? 1 : 0.4,
6106
- transition: 'opacity 0.25s ease, box-shadow 0.25s ease'
6107
- },
6108
- children: [jsxs(Box, {
6109
- style: {
6110
- height: '7%',
6111
- borderRadius: 3,
6112
- background: hasReport && !previewError ? 'linear-gradient(90deg, var(--mantine-color-blue-6), var(--mantine-color-blue-4))' : 'var(--mantine-color-gray-4)',
6113
- marginBottom: '2%',
6114
- display: 'flex',
6115
- alignItems: 'center',
6116
- paddingLeft: '4%',
6117
- gap: '2%',
6118
- flexShrink: 0
6119
- },
6120
- children: [jsx(Box, {
6121
- style: {
6122
- width: '6%',
6123
- aspectRatio: '1',
6124
- borderRadius: '50%',
6125
- background: 'rgba(255,255,255,0.85)'
6126
- }
6127
- }), jsx(Box, {
6128
- style: {
6129
- width: '6%',
6130
- aspectRatio: '1',
6131
- borderRadius: '50%',
6132
- background: 'rgba(255,255,255,0.5)'
6133
- }
6134
- }), jsx(Box, {
6135
- style: {
6136
- width: '20%',
6137
- height: '35%',
6138
- borderRadius: 2,
6139
- background: 'rgba(255,255,255,0.65)',
6140
- marginLeft: '3%'
6141
- }
6142
- })]
6143
- }), jsx(Box, {
6144
- style: {
6145
- height: '3%',
6146
- borderRadius: 2,
6147
- background: 'var(--mantine-color-gray-7)',
6148
- width: '62%'
6149
- }
6150
- }), jsx(Box, {
6151
- style: {
6152
- height: '2%',
6153
- borderRadius: 2,
6154
- background: 'var(--mantine-color-gray-4)',
6155
- width: '38%',
6156
- marginBottom: '1%'
6157
- }
6158
- }), jsx(Box, {
6159
- style: {
6160
- height: 1,
6161
- background: 'var(--mantine-color-gray-3)',
6162
- flexShrink: 0
6163
- }
6164
- }), [88, 72, 100, 58, 82, 66].map((w, i) => jsx(Box, {
6165
- style: {
6166
- height: '1.8%',
6167
- borderRadius: 2,
6168
- background: 'var(--mantine-color-gray-3)',
6169
- width: `${w}%`,
6170
- flexShrink: 0
6171
- }
6172
- }, i)), jsx(Box, {
6173
- style: {
6174
- height: 1,
6175
- background: 'var(--mantine-color-gray-3)',
6176
- margin: '1% 0',
6177
- flexShrink: 0
6178
- }
6179
- }), jsx(Box, {
6180
- style: {
6181
- display: 'grid',
6182
- gridTemplateColumns: '1.2fr 1fr 0.8fr',
6183
- gap: '1%',
6184
- flexShrink: 0
6185
- },
6186
- children: Array.from({
6187
- length: 12
6188
- }).map((_, i) => jsx(Box, {
6189
- style: {
6190
- height: '1.8%',
6191
- minHeight: 4,
6192
- borderRadius: 1,
6193
- background: i < 3 ? 'var(--mantine-color-gray-5)' : 'var(--mantine-color-gray-2)'
6194
- }
6195
- }, i))
6196
- }), jsx(Box, {
6197
- style: {
6198
- height: 1,
6199
- background: 'var(--mantine-color-gray-3)',
6200
- margin: '1% 0',
6201
- flexShrink: 0
6202
- }
6203
- }), [78, 62, 90].map((w, i) => jsx(Box, {
6204
- style: {
6205
- height: '1.8%',
6206
- borderRadius: 2,
6207
- background: 'var(--mantine-color-gray-3)',
6208
- width: `${w}%`,
6209
- flexShrink: 0
6210
- }
6211
- }, i)), jsx(Box, {
6212
- style: {
6213
- flex: 1
6214
- }
6215
- }), jsx(Box, {
6216
- style: {
6217
- height: 1,
6218
- background: 'var(--mantine-color-gray-3)',
6219
- flexShrink: 0
6220
- }
6221
- }), jsx(Box, {
6222
- style: {
6223
- height: '1.8%',
6224
- borderRadius: 2,
6225
- background: 'var(--mantine-color-gray-3)',
6226
- width: '28%',
6227
- alignSelf: 'center',
6228
- flexShrink: 0
6229
- }
6230
- })]
6231
- })), loadingPreview && jsx(Box, {
6232
- style: {
6233
- position: 'absolute',
6234
- inset: 0,
6235
- display: 'flex',
6236
- alignItems: 'center',
6237
- justifyContent: 'center',
6238
- background: 'rgba(255, 255, 255, 0.65)',
6239
- borderRadius: 'var(--mantine-radius-sm)',
6240
- backdropFilter: 'blur(2px)'
6241
- },
6242
- children: jsx(Loader, {
6243
- size: "sm"
6244
- })
6245
- }), previewError && !loadingPreview && jsx(Box, {
6246
- style: {
6247
- position: 'absolute',
6248
- inset: 0,
6249
- display: 'flex',
6250
- alignItems: 'center',
6033
+ var $$a = _export;
6034
+ var iterate$2 = iterate$9;
6035
+ var aCallable$2 = aCallable$i;
6036
+ var anObject$1 = anObject$n;
6037
+ var getIteratorDirect$1 = getIteratorDirect$8;
6038
+
6039
+ // `Iterator.prototype.some` method
6040
+ // https://github.com/tc39/proposal-iterator-helpers
6041
+ $$a({ target: 'Iterator', proto: true, real: true }, {
6042
+ some: function some(predicate) {
6043
+ anObject$1(this);
6044
+ aCallable$2(predicate);
6045
+ var record = getIteratorDirect$1(this);
6046
+ var counter = 0;
6047
+ return iterate$2(record, function (value, stop) {
6048
+ if (predicate(value, counter++)) return stop();
6049
+ }, { IS_RECORD: true, INTERRUPTED: true }).stopped;
6050
+ }
6051
+ });
6052
+
6053
+ var uncurryThis$4 = functionUncurryThis;
6054
+
6055
+ // eslint-disable-next-line es/no-set -- safe
6056
+ var SetPrototype$1 = Set.prototype;
6057
+
6058
+ var setHelpers = {
6059
+ // eslint-disable-next-line es/no-set -- safe
6060
+ Set: Set,
6061
+ add: uncurryThis$4(SetPrototype$1.add),
6062
+ has: uncurryThis$4(SetPrototype$1.has),
6063
+ remove: uncurryThis$4(SetPrototype$1['delete']),
6064
+ proto: SetPrototype$1
6065
+ };
6066
+
6067
+ var has$5 = setHelpers.has;
6068
+
6069
+ // Perform ? RequireInternalSlot(M, [[SetData]])
6070
+ var aSet$7 = function (it) {
6071
+ has$5(it);
6072
+ return it;
6073
+ };
6074
+
6075
+ var call$1 = functionCall;
6076
+
6077
+ var iterateSimple$7 = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) {
6078
+ var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator;
6079
+ var next = record.next;
6080
+ var step, result;
6081
+ while (!(step = call$1(next, iterator)).done) {
6082
+ result = fn(step.value);
6083
+ if (result !== undefined) return result;
6084
+ }
6085
+ };
6086
+
6087
+ var uncurryThis$3 = functionUncurryThis;
6088
+ var iterateSimple$6 = iterateSimple$7;
6089
+ var SetHelpers$5 = setHelpers;
6090
+
6091
+ var Set$3 = SetHelpers$5.Set;
6092
+ var SetPrototype = SetHelpers$5.proto;
6093
+ var forEach = uncurryThis$3(SetPrototype.forEach);
6094
+ var keys = uncurryThis$3(SetPrototype.keys);
6095
+ var next = keys(new Set$3()).next;
6096
+
6097
+ var setIterate = function (set, fn, interruptible) {
6098
+ return interruptible ? iterateSimple$6({ iterator: keys(set), next: next }, fn) : forEach(set, fn);
6099
+ };
6100
+
6101
+ var SetHelpers$4 = setHelpers;
6102
+ var iterate$1 = setIterate;
6103
+
6104
+ var Set$2 = SetHelpers$4.Set;
6105
+ var add$3 = SetHelpers$4.add;
6106
+
6107
+ var setClone = function (set) {
6108
+ var result = new Set$2();
6109
+ iterate$1(set, function (it) {
6110
+ add$3(result, it);
6111
+ });
6112
+ return result;
6113
+ };
6114
+
6115
+ var uncurryThisAccessor = functionUncurryThisAccessor;
6116
+ var SetHelpers$3 = setHelpers;
6117
+
6118
+ var setSize = uncurryThisAccessor(SetHelpers$3.proto, 'size', 'get') || function (set) {
6119
+ return set.size;
6120
+ };
6121
+
6122
+ var aCallable$1 = aCallable$i;
6123
+ var anObject = anObject$n;
6124
+ var call = functionCall;
6125
+ var toIntegerOrInfinity = toIntegerOrInfinity$5;
6126
+ var getIteratorDirect = getIteratorDirect$8;
6127
+
6128
+ var INVALID_SIZE = 'Invalid size';
6129
+ var $RangeError = RangeError;
6130
+ var $TypeError$1 = TypeError;
6131
+ var max = Math.max;
6132
+
6133
+ var SetRecord = function (set, intSize) {
6134
+ this.set = set;
6135
+ this.size = max(intSize, 0);
6136
+ this.has = aCallable$1(set.has);
6137
+ this.keys = aCallable$1(set.keys);
6138
+ };
6139
+
6140
+ SetRecord.prototype = {
6141
+ getIterator: function () {
6142
+ return getIteratorDirect(anObject(call(this.keys, this.set)));
6143
+ },
6144
+ includes: function (it) {
6145
+ return call(this.has, this.set, it);
6146
+ }
6147
+ };
6148
+
6149
+ // `GetSetRecord` abstract operation
6150
+ // https://tc39.es/proposal-set-methods/#sec-getsetrecord
6151
+ var getSetRecord$7 = function (obj) {
6152
+ anObject(obj);
6153
+ var numSize = +obj.size;
6154
+ // NOTE: If size is undefined, then numSize will be NaN
6155
+ // eslint-disable-next-line no-self-compare -- NaN check
6156
+ if (numSize !== numSize) throw new $TypeError$1(INVALID_SIZE);
6157
+ var intSize = toIntegerOrInfinity(numSize);
6158
+ if (intSize < 0) throw new $RangeError(INVALID_SIZE);
6159
+ return new SetRecord(obj, intSize);
6160
+ };
6161
+
6162
+ var aSet$6 = aSet$7;
6163
+ var SetHelpers$2 = setHelpers;
6164
+ var clone$2 = setClone;
6165
+ var size$4 = setSize;
6166
+ var getSetRecord$6 = getSetRecord$7;
6167
+ var iterateSet$2 = setIterate;
6168
+ var iterateSimple$5 = iterateSimple$7;
6169
+
6170
+ var has$4 = SetHelpers$2.has;
6171
+ var remove$1 = SetHelpers$2.remove;
6172
+
6173
+ // `Set.prototype.difference` method
6174
+ // https://github.com/tc39/proposal-set-methods
6175
+ var setDifference = function difference(other) {
6176
+ var O = aSet$6(this);
6177
+ var otherRec = getSetRecord$6(other);
6178
+ var result = clone$2(O);
6179
+ if (size$4(O) <= otherRec.size) iterateSet$2(O, function (e) {
6180
+ if (otherRec.includes(e)) remove$1(result, e);
6181
+ });
6182
+ else iterateSimple$5(otherRec.getIterator(), function (e) {
6183
+ if (has$4(O, e)) remove$1(result, e);
6184
+ });
6185
+ return result;
6186
+ };
6187
+
6188
+ var getBuiltIn = getBuiltIn$a;
6189
+
6190
+ var createSetLike = function (size) {
6191
+ return {
6192
+ size: size,
6193
+ has: function () {
6194
+ return false;
6195
+ },
6196
+ keys: function () {
6197
+ return {
6198
+ next: function () {
6199
+ return { done: true };
6200
+ }
6201
+ };
6202
+ }
6203
+ };
6204
+ };
6205
+
6206
+ var setMethodAcceptSetLike$7 = function (name) {
6207
+ var Set = getBuiltIn('Set');
6208
+ try {
6209
+ new Set()[name](createSetLike(0));
6210
+ try {
6211
+ // late spec change, early WebKit ~ Safari 17.0 beta implementation does not pass it
6212
+ // https://github.com/tc39/proposal-set-methods/pull/88
6213
+ new Set()[name](createSetLike(-1));
6214
+ return false;
6215
+ } catch (error2) {
6216
+ return true;
6217
+ }
6218
+ } catch (error) {
6219
+ return false;
6220
+ }
6221
+ };
6222
+
6223
+ var $$9 = _export;
6224
+ var difference = setDifference;
6225
+ var setMethodAcceptSetLike$6 = setMethodAcceptSetLike$7;
6226
+
6227
+ // `Set.prototype.difference` method
6228
+ // https://github.com/tc39/proposal-set-methods
6229
+ $$9({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike$6('difference') }, {
6230
+ difference: difference
6231
+ });
6232
+
6233
+ var aSet$5 = aSet$7;
6234
+ var SetHelpers$1 = setHelpers;
6235
+ var size$3 = setSize;
6236
+ var getSetRecord$5 = getSetRecord$7;
6237
+ var iterateSet$1 = setIterate;
6238
+ var iterateSimple$4 = iterateSimple$7;
6239
+
6240
+ var Set$1 = SetHelpers$1.Set;
6241
+ var add$2 = SetHelpers$1.add;
6242
+ var has$3 = SetHelpers$1.has;
6243
+
6244
+ // `Set.prototype.intersection` method
6245
+ // https://github.com/tc39/proposal-set-methods
6246
+ var setIntersection = function intersection(other) {
6247
+ var O = aSet$5(this);
6248
+ var otherRec = getSetRecord$5(other);
6249
+ var result = new Set$1();
6250
+
6251
+ if (size$3(O) > otherRec.size) {
6252
+ iterateSimple$4(otherRec.getIterator(), function (e) {
6253
+ if (has$3(O, e)) add$2(result, e);
6254
+ });
6255
+ } else {
6256
+ iterateSet$1(O, function (e) {
6257
+ if (otherRec.includes(e)) add$2(result, e);
6258
+ });
6259
+ }
6260
+
6261
+ return result;
6262
+ };
6263
+
6264
+ var $$8 = _export;
6265
+ var fails$2 = fails$t;
6266
+ var intersection = setIntersection;
6267
+ var setMethodAcceptSetLike$5 = setMethodAcceptSetLike$7;
6268
+
6269
+ var INCORRECT = !setMethodAcceptSetLike$5('intersection') || fails$2(function () {
6270
+ // eslint-disable-next-line es/no-array-from, es/no-set -- testing
6271
+ return String(Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2])))) !== '3,2';
6272
+ });
6273
+
6274
+ // `Set.prototype.intersection` method
6275
+ // https://github.com/tc39/proposal-set-methods
6276
+ $$8({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
6277
+ intersection: intersection
6278
+ });
6279
+
6280
+ var aSet$4 = aSet$7;
6281
+ var has$2 = setHelpers.has;
6282
+ var size$2 = setSize;
6283
+ var getSetRecord$4 = getSetRecord$7;
6284
+ var iterateSet = setIterate;
6285
+ var iterateSimple$3 = iterateSimple$7;
6286
+ var iteratorClose$1 = iteratorClose$5;
6287
+
6288
+ // `Set.prototype.isDisjointFrom` method
6289
+ // https://tc39.github.io/proposal-set-methods/#Set.prototype.isDisjointFrom
6290
+ var setIsDisjointFrom = function isDisjointFrom(other) {
6291
+ var O = aSet$4(this);
6292
+ var otherRec = getSetRecord$4(other);
6293
+ if (size$2(O) <= otherRec.size) return iterateSet(O, function (e) {
6294
+ if (otherRec.includes(e)) return false;
6295
+ }, true) !== false;
6296
+ var iterator = otherRec.getIterator();
6297
+ return iterateSimple$3(iterator, function (e) {
6298
+ if (has$2(O, e)) return iteratorClose$1(iterator, 'normal', false);
6299
+ }) !== false;
6300
+ };
6301
+
6302
+ var $$7 = _export;
6303
+ var isDisjointFrom = setIsDisjointFrom;
6304
+ var setMethodAcceptSetLike$4 = setMethodAcceptSetLike$7;
6305
+
6306
+ // `Set.prototype.isDisjointFrom` method
6307
+ // https://github.com/tc39/proposal-set-methods
6308
+ $$7({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike$4('isDisjointFrom') }, {
6309
+ isDisjointFrom: isDisjointFrom
6310
+ });
6311
+
6312
+ var aSet$3 = aSet$7;
6313
+ var size$1 = setSize;
6314
+ var iterate = setIterate;
6315
+ var getSetRecord$3 = getSetRecord$7;
6316
+
6317
+ // `Set.prototype.isSubsetOf` method
6318
+ // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSubsetOf
6319
+ var setIsSubsetOf = function isSubsetOf(other) {
6320
+ var O = aSet$3(this);
6321
+ var otherRec = getSetRecord$3(other);
6322
+ if (size$1(O) > otherRec.size) return false;
6323
+ return iterate(O, function (e) {
6324
+ if (!otherRec.includes(e)) return false;
6325
+ }, true) !== false;
6326
+ };
6327
+
6328
+ var $$6 = _export;
6329
+ var isSubsetOf = setIsSubsetOf;
6330
+ var setMethodAcceptSetLike$3 = setMethodAcceptSetLike$7;
6331
+
6332
+ // `Set.prototype.isSubsetOf` method
6333
+ // https://github.com/tc39/proposal-set-methods
6334
+ $$6({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike$3('isSubsetOf') }, {
6335
+ isSubsetOf: isSubsetOf
6336
+ });
6337
+
6338
+ var aSet$2 = aSet$7;
6339
+ var has$1 = setHelpers.has;
6340
+ var size = setSize;
6341
+ var getSetRecord$2 = getSetRecord$7;
6342
+ var iterateSimple$2 = iterateSimple$7;
6343
+ var iteratorClose = iteratorClose$5;
6344
+
6345
+ // `Set.prototype.isSupersetOf` method
6346
+ // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSupersetOf
6347
+ var setIsSupersetOf = function isSupersetOf(other) {
6348
+ var O = aSet$2(this);
6349
+ var otherRec = getSetRecord$2(other);
6350
+ if (size(O) < otherRec.size) return false;
6351
+ var iterator = otherRec.getIterator();
6352
+ return iterateSimple$2(iterator, function (e) {
6353
+ if (!has$1(O, e)) return iteratorClose(iterator, 'normal', false);
6354
+ }) !== false;
6355
+ };
6356
+
6357
+ var $$5 = _export;
6358
+ var isSupersetOf = setIsSupersetOf;
6359
+ var setMethodAcceptSetLike$2 = setMethodAcceptSetLike$7;
6360
+
6361
+ // `Set.prototype.isSupersetOf` method
6362
+ // https://github.com/tc39/proposal-set-methods
6363
+ $$5({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike$2('isSupersetOf') }, {
6364
+ isSupersetOf: isSupersetOf
6365
+ });
6366
+
6367
+ var aSet$1 = aSet$7;
6368
+ var SetHelpers = setHelpers;
6369
+ var clone$1 = setClone;
6370
+ var getSetRecord$1 = getSetRecord$7;
6371
+ var iterateSimple$1 = iterateSimple$7;
6372
+
6373
+ var add$1 = SetHelpers.add;
6374
+ var has = SetHelpers.has;
6375
+ var remove = SetHelpers.remove;
6376
+
6377
+ // `Set.prototype.symmetricDifference` method
6378
+ // https://github.com/tc39/proposal-set-methods
6379
+ var setSymmetricDifference = function symmetricDifference(other) {
6380
+ var O = aSet$1(this);
6381
+ var keysIter = getSetRecord$1(other).getIterator();
6382
+ var result = clone$1(O);
6383
+ iterateSimple$1(keysIter, function (e) {
6384
+ if (has(O, e)) remove(result, e);
6385
+ else add$1(result, e);
6386
+ });
6387
+ return result;
6388
+ };
6389
+
6390
+ var $$4 = _export;
6391
+ var symmetricDifference = setSymmetricDifference;
6392
+ var setMethodAcceptSetLike$1 = setMethodAcceptSetLike$7;
6393
+
6394
+ // `Set.prototype.symmetricDifference` method
6395
+ // https://github.com/tc39/proposal-set-methods
6396
+ $$4({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike$1('symmetricDifference') }, {
6397
+ symmetricDifference: symmetricDifference
6398
+ });
6399
+
6400
+ var aSet = aSet$7;
6401
+ var add = setHelpers.add;
6402
+ var clone = setClone;
6403
+ var getSetRecord = getSetRecord$7;
6404
+ var iterateSimple = iterateSimple$7;
6405
+
6406
+ // `Set.prototype.union` method
6407
+ // https://github.com/tc39/proposal-set-methods
6408
+ var setUnion = function union(other) {
6409
+ var O = aSet(this);
6410
+ var keysIter = getSetRecord(other).getIterator();
6411
+ var result = clone(O);
6412
+ iterateSimple(keysIter, function (it) {
6413
+ add(result, it);
6414
+ });
6415
+ return result;
6416
+ };
6417
+
6418
+ var $$3 = _export;
6419
+ var union = setUnion;
6420
+ var setMethodAcceptSetLike = setMethodAcceptSetLike$7;
6421
+
6422
+ // `Set.prototype.union` method
6423
+ // https://github.com/tc39/proposal-set-methods
6424
+ $$3({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('union') }, {
6425
+ union: union
6426
+ });
6427
+
6428
+ /** Valore speciale usato per indicare "stampa dal browser (anteprima)" */
6429
+ const CLIENT_PRINTER_VALUE = 'client-printer';
6430
+ // ─────────────────────────────────────────────
6431
+ // Preview placeholder del documento selezionato
6432
+ // ─────────────────────────────────────────────
6433
+ function ReportPreviewPanel({
6434
+ report,
6435
+ reportUrl,
6436
+ missingRequiredParams
6437
+ }) {
6438
+ var _a;
6439
+ const [previewBase64, setPreviewBase64] = useState(null);
6440
+ const [loadingPreview, setLoadingPreview] = useState(false);
6441
+ const [previewError, setPreviewError] = useState(false);
6442
+ useEffect(() => {
6443
+ if (!reportUrl) {
6444
+ setPreviewBase64(null);
6445
+ setPreviewError(false);
6446
+ return;
6447
+ }
6448
+ setLoadingPreview(true);
6449
+ setPreviewError(false);
6450
+ setPreviewBase64(null);
6451
+ FluxoClientSys.Instance.reporting.preview(reportUrl).then(base64 => {
6452
+ setLoadingPreview(false);
6453
+ if (!base64 || base64.trim() === '') {
6454
+ setPreviewError(true);
6455
+ return;
6456
+ }
6457
+ setPreviewBase64(base64);
6458
+ }).catch(() => {
6459
+ setPreviewError(true);
6460
+ setLoadingPreview(false);
6461
+ showNotification({
6462
+ title: 'Errore anteprima',
6463
+ message: "Impossibile generare l'anteprima del formato selezionato.",
6464
+ color: 'red'
6465
+ });
6466
+ });
6467
+ }, [reportUrl]);
6468
+ const hasReport = !!report;
6469
+ const showImage = !!previewBase64 && !loadingPreview;
6470
+ return jsx(Box, {
6471
+ style: {
6472
+ background: 'var(--mantine-color-gray-1)',
6473
+ border: '1px solid var(--mantine-color-gray-3)',
6474
+ borderRadius: 'var(--mantine-radius-md)',
6475
+ padding: '12px',
6476
+ flex: 1,
6477
+ minHeight: 0,
6478
+ display: 'flex',
6479
+ flexDirection: 'column',
6480
+ gap: 8
6481
+ },
6482
+ children: jsxs(Box, {
6483
+ style: {
6484
+ flex: 1,
6485
+ position: 'relative',
6486
+ overflow: 'hidden',
6487
+ minHeight: 0
6488
+ },
6489
+ children: [showImage && jsx(Paper, {
6490
+ shadow: "md",
6491
+ style: {
6492
+ position: 'absolute',
6493
+ inset: 0,
6494
+ overflow: 'hidden',
6495
+ lineHeight: 0,
6496
+ display: 'flex',
6497
+ alignItems: 'center',
6498
+ justifyContent: 'center',
6499
+ background: 'transparent'
6500
+ },
6501
+ children: jsx("img", {
6502
+ src: `data:image/jpeg;base64,${previewBase64}`,
6503
+ alt: (_a = report === null || report === void 0 ? void 0 : report.displayName) !== null && _a !== void 0 ? _a : 'Anteprima report',
6504
+ style: {
6505
+ maxWidth: '100%',
6506
+ maxHeight: '100%',
6507
+ width: 'auto',
6508
+ height: 'auto',
6509
+ display: 'block'
6510
+ }
6511
+ })
6512
+ }), !showImage && jsx(Box, {
6513
+ style: {
6514
+ position: 'absolute',
6515
+ inset: 0,
6516
+ display: 'flex',
6517
+ alignItems: 'center',
6518
+ justifyContent: 'center'
6519
+ },
6520
+ children: jsxs(Paper, {
6521
+ shadow: hasReport && !previewError ? 'md' : 'xs',
6522
+ style: {
6523
+ height: '100%',
6524
+ width: 'auto',
6525
+ aspectRatio: '210 / 297',
6526
+ padding: '5% 6%',
6527
+ display: 'flex',
6528
+ flexDirection: 'column',
6529
+ gap: '2%',
6530
+ overflow: 'hidden',
6531
+ opacity: hasReport ? 1 : 0.4,
6532
+ transition: 'opacity 0.25s ease, box-shadow 0.25s ease'
6533
+ },
6534
+ children: [jsxs(Box, {
6535
+ style: {
6536
+ height: '7%',
6537
+ borderRadius: 3,
6538
+ background: hasReport && !previewError ? 'linear-gradient(90deg, var(--mantine-color-blue-6), var(--mantine-color-blue-4))' : 'var(--mantine-color-gray-4)',
6539
+ marginBottom: '2%',
6540
+ display: 'flex',
6541
+ alignItems: 'center',
6542
+ paddingLeft: '4%',
6543
+ gap: '2%',
6544
+ flexShrink: 0
6545
+ },
6546
+ children: [jsx(Box, {
6547
+ style: {
6548
+ width: '6%',
6549
+ aspectRatio: '1',
6550
+ borderRadius: '50%',
6551
+ background: 'rgba(255,255,255,0.85)'
6552
+ }
6553
+ }), jsx(Box, {
6554
+ style: {
6555
+ width: '6%',
6556
+ aspectRatio: '1',
6557
+ borderRadius: '50%',
6558
+ background: 'rgba(255,255,255,0.5)'
6559
+ }
6560
+ }), jsx(Box, {
6561
+ style: {
6562
+ width: '20%',
6563
+ height: '35%',
6564
+ borderRadius: 2,
6565
+ background: 'rgba(255,255,255,0.65)',
6566
+ marginLeft: '3%'
6567
+ }
6568
+ })]
6569
+ }), jsx(Box, {
6570
+ style: {
6571
+ height: '3%',
6572
+ borderRadius: 2,
6573
+ background: 'var(--mantine-color-gray-7)',
6574
+ width: '62%'
6575
+ }
6576
+ }), jsx(Box, {
6577
+ style: {
6578
+ height: '2%',
6579
+ borderRadius: 2,
6580
+ background: 'var(--mantine-color-gray-4)',
6581
+ width: '38%',
6582
+ marginBottom: '1%'
6583
+ }
6584
+ }), jsx(Box, {
6585
+ style: {
6586
+ height: 1,
6587
+ background: 'var(--mantine-color-gray-3)',
6588
+ flexShrink: 0
6589
+ }
6590
+ }), [88, 72, 100, 58, 82, 66].map((w, i) => jsx(Box, {
6591
+ style: {
6592
+ height: '1.8%',
6593
+ borderRadius: 2,
6594
+ background: 'var(--mantine-color-gray-3)',
6595
+ width: `${w}%`,
6596
+ flexShrink: 0
6597
+ }
6598
+ }, i)), jsx(Box, {
6599
+ style: {
6600
+ height: 1,
6601
+ background: 'var(--mantine-color-gray-3)',
6602
+ margin: '1% 0',
6603
+ flexShrink: 0
6604
+ }
6605
+ }), jsx(Box, {
6606
+ style: {
6607
+ display: 'grid',
6608
+ gridTemplateColumns: '1.2fr 1fr 0.8fr',
6609
+ gap: '1%',
6610
+ flexShrink: 0
6611
+ },
6612
+ children: Array.from({
6613
+ length: 12
6614
+ }).map((_, i) => jsx(Box, {
6615
+ style: {
6616
+ height: '1.8%',
6617
+ minHeight: 4,
6618
+ borderRadius: 1,
6619
+ background: i < 3 ? 'var(--mantine-color-gray-5)' : 'var(--mantine-color-gray-2)'
6620
+ }
6621
+ }, i))
6622
+ }), jsx(Box, {
6623
+ style: {
6624
+ height: 1,
6625
+ background: 'var(--mantine-color-gray-3)',
6626
+ margin: '1% 0',
6627
+ flexShrink: 0
6628
+ }
6629
+ }), [78, 62, 90].map((w, i) => jsx(Box, {
6630
+ style: {
6631
+ height: '1.8%',
6632
+ borderRadius: 2,
6633
+ background: 'var(--mantine-color-gray-3)',
6634
+ width: `${w}%`,
6635
+ flexShrink: 0
6636
+ }
6637
+ }, i)), jsx(Box, {
6638
+ style: {
6639
+ flex: 1
6640
+ }
6641
+ }), jsx(Box, {
6642
+ style: {
6643
+ height: 1,
6644
+ background: 'var(--mantine-color-gray-3)',
6645
+ flexShrink: 0
6646
+ }
6647
+ }), jsx(Box, {
6648
+ style: {
6649
+ height: '1.8%',
6650
+ borderRadius: 2,
6651
+ background: 'var(--mantine-color-gray-3)',
6652
+ width: '28%',
6653
+ alignSelf: 'center',
6654
+ flexShrink: 0
6655
+ }
6656
+ })]
6657
+ })
6658
+ }), loadingPreview && jsx(Box, {
6659
+ style: {
6660
+ position: 'absolute',
6661
+ inset: 0,
6662
+ display: 'flex',
6663
+ alignItems: 'center',
6664
+ justifyContent: 'center',
6665
+ background: 'rgba(255, 255, 255, 0.65)',
6666
+ borderRadius: 'var(--mantine-radius-sm)',
6667
+ backdropFilter: 'blur(2px)'
6668
+ },
6669
+ children: jsx(Loader, {
6670
+ size: "sm"
6671
+ })
6672
+ }), missingRequiredParams && !loadingPreview && jsx(Box, {
6673
+ style: {
6674
+ position: 'absolute',
6675
+ inset: 0,
6676
+ display: 'flex',
6677
+ alignItems: 'center',
6678
+ justifyContent: 'center',
6679
+ borderRadius: 'var(--mantine-radius-sm)'
6680
+ },
6681
+ children: jsxs(Text, {
6682
+ size: "xs",
6683
+ c: "blue",
6684
+ fw: 500,
6685
+ ta: "center",
6686
+ style: {
6687
+ background: 'rgba(255,255,255,0.88)',
6688
+ backdropFilter: 'blur(3px)',
6689
+ borderRadius: 6,
6690
+ padding: '6px 12px'
6691
+ },
6692
+ children: ["Compila i parametri obbligatori", jsx("br", {}), "per vedere l'anteprima"]
6693
+ })
6694
+ }), previewError && !loadingPreview && !missingRequiredParams && jsx(Box, {
6695
+ style: {
6696
+ position: 'absolute',
6697
+ inset: 0,
6698
+ display: 'flex',
6699
+ alignItems: 'center',
6251
6700
  justifyContent: 'center',
6252
6701
  borderRadius: 'var(--mantine-radius-sm)'
6253
6702
  },
@@ -6289,6 +6738,7 @@ function PrintButtonConfiguration(props) {
6289
6738
  const [onPrinting, setOnPrinting] = useState(false);
6290
6739
  // URL usato per la preview del formato (aggiornato solo al cambio del report selezionato)
6291
6740
  const [previewReportUrl, setPreviewReportUrl] = useState(null);
6741
+ const previewDebounceRef = useRef(null);
6292
6742
  // FullType identifier
6293
6743
  const reportType = `${props.reportScope}.${props.reportPackageName}.${props.reportNamespace}.${props.reportId}`;
6294
6744
  // Serializza i parametri iniziali come JSON per il body della request
@@ -6374,15 +6824,26 @@ function PrintButtonConfiguration(props) {
6374
6824
  const params = Object.keys(values).map(key => values[key] !== undefined && values[key] !== null ? `${key}=${values[key]}` : null).filter(Boolean).join('&');
6375
6825
  setFiltersValue(params);
6376
6826
  }, [values]);
6377
- // Aggiorna l'URL di preview quando cambia il report selezionato
6827
+ // Aggiorna l'URL di preview quando cambia il report selezionato o i parametri,
6828
+ // con debounce per evitare richieste eccessive durante la digitazione.
6829
+ // Non fa la richiesta se mancano parametri obbligatori.
6378
6830
  useEffect(() => {
6379
- if (selectedReportId) {
6380
- setPreviewReportUrl(`${selectedReportId}?${filtersValue !== null && filtersValue !== void 0 ? filtersValue : ''}`);
6381
- } else {
6831
+ if (previewDebounceRef.current) {
6832
+ clearTimeout(previewDebounceRef.current);
6833
+ }
6834
+ if (!selectedReportId || !checkIfAllRequiredParametersAreSet()) {
6382
6835
  setPreviewReportUrl(null);
6836
+ return;
6383
6837
  }
6838
+ previewDebounceRef.current = setTimeout(() => {
6839
+ setPreviewReportUrl(`${selectedReportId}?${filtersValue !== null && filtersValue !== void 0 ? filtersValue : ''}`);
6840
+ }, 600);
6841
+ return () => {
6842
+ if (previewDebounceRef.current) clearTimeout(previewDebounceRef.current);
6843
+ };
6844
+ // checkIfAllRequiredParametersAreSet è stabile grazie a useCallback
6384
6845
  // eslint-disable-next-line react-hooks/exhaustive-deps
6385
- }, [selectedReportId]);
6846
+ }, [selectedReportId, filtersValue]);
6386
6847
  const checkIfAllRequiredParametersAreSet = useCallback(() => {
6387
6848
  if (!parametersSchema) return true;
6388
6849
  return parametersSchema.parameters.every(p => p.isRequired ? values[p.key] !== undefined && values[p.key] !== null : true);
@@ -6456,6 +6917,13 @@ function PrintButtonConfiguration(props) {
6456
6917
  // ──────────────────── Computed ────────────────────
6457
6918
  const isLoading = !printOptionsLoaded || !parametersSchemaLoaded;
6458
6919
  const canSubmit = !!selectedReportId && checkIfAllRequiredParametersAreSet() && !onPrinting;
6920
+ const missingRequiredParams = parametersSchemaLoaded && !!selectedReportId && !checkIfAllRequiredParametersAreSet();
6921
+ // Determina se mostrare il FiltersPanel: se ci sono parametri nello schema che non sono negli initialParameters
6922
+ const shouldShowFiltersPanel = parametersSchema && parametersSchema.parametersCount > 0 && (() => {
6923
+ var _a, _b;
6924
+ const initialKeys = new Set((_b = (_a = props.initialParameters) === null || _a === void 0 ? void 0 : _a.map(p => p.key)) !== null && _b !== void 0 ? _b : []);
6925
+ return parametersSchema.parameters.some(p => !initialKeys.has(p.key));
6926
+ })();
6459
6927
  const reportSelectItems = ((_a = printOptions === null || printOptions === void 0 ? void 0 : printOptions.availableReports) !== null && _a !== void 0 ? _a : []).map(r => ({
6460
6928
  value: r.reportId.toString(),
6461
6929
  label: r.displayName
@@ -6554,7 +7022,7 @@ function PrintButtonConfiguration(props) {
6554
7022
  gap: "md",
6555
7023
  children: [jsxs(Grid, {
6556
7024
  gutter: "lg",
6557
- align: "flex-start",
7025
+ align: "stretch",
6558
7026
  children: [jsx(Grid.Col, {
6559
7027
  span: 6,
6560
7028
  children: jsxs(Stack, {
@@ -6566,7 +7034,7 @@ function PrintButtonConfiguration(props) {
6566
7034
  value: selectedReportId,
6567
7035
  onChange: setSelectedReportId,
6568
7036
  disabled: onPrinting || !printOptions.canUseOtherReport || onlyOneReport
6569
- }), parametersSchema && parametersSchema.parametersCount > 0 && (!props.initialParameters || parametersSchema.parametersCount > props.initialParameters.length) && jsxs("div", {
7037
+ }), shouldShowFiltersPanel && jsxs("div", {
6570
7038
  children: [jsx(Box, {
6571
7039
  pt: 8,
6572
7040
  pb: 8,
@@ -6586,7 +7054,11 @@ function PrintButtonConfiguration(props) {
6586
7054
  }), jsx(FiltersPanel, {
6587
7055
  initialParameters: props.initialParameters,
6588
7056
  parametersSchema: parametersSchema,
6589
- onFiltersChange: parameters => setValues(parameters),
7057
+ onFiltersChange: parameters => {
7058
+ // Merge con i parametri iniziali per non perderli
7059
+ const merged = Object.assign(Object.assign({}, values), parameters);
7060
+ setValues(merged);
7061
+ },
6590
7062
  useParametersSchema: true
6591
7063
  })]
6592
7064
  }), !props.onlyPreviewMode && printOptions.canPrint && jsxs(Fragment, {
@@ -6642,6 +7114,10 @@ function PrintButtonConfiguration(props) {
6642
7114
  })
6643
7115
  }), jsxs(Grid.Col, {
6644
7116
  span: 6,
7117
+ style: {
7118
+ display: 'flex',
7119
+ flexDirection: 'column'
7120
+ },
6645
7121
  children: [jsx(Text, {
6646
7122
  size: "xs",
6647
7123
  fw: 500,
@@ -6654,7 +7130,8 @@ function PrintButtonConfiguration(props) {
6654
7130
  children: "Anteprima formato"
6655
7131
  }), jsx(ReportPreviewPanel, {
6656
7132
  report: selectedReport,
6657
- reportUrl: previewReportUrl
7133
+ reportUrl: previewReportUrl,
7134
+ missingRequiredParams: missingRequiredParams
6658
7135
  })]
6659
7136
  })]
6660
7137
  }), jsx(Divider, {}), jsxs(Group, {
@@ -6748,10 +7225,10 @@ function PrintButton(props) {
6748
7225
  });
6749
7226
  }
6750
7227
 
6751
- var $$9 = _export;
7228
+ var $$2 = _export;
6752
7229
  var DESCRIPTORS = descriptors;
6753
7230
  var global$2 = global$o;
6754
- var uncurryThis$4 = functionUncurryThis;
7231
+ var uncurryThis$2 = functionUncurryThis;
6755
7232
  var hasOwn = hasOwnProperty_1;
6756
7233
  var isCallable = isCallable$q;
6757
7234
  var isPrototypeOf = objectIsPrototypeOf;
@@ -6783,11 +7260,11 @@ if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototy
6783
7260
  SymbolPrototype.constructor = SymbolWrapper;
6784
7261
 
6785
7262
  var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)';
6786
- var thisSymbolValue = uncurryThis$4(SymbolPrototype.valueOf);
6787
- var symbolDescriptiveString = uncurryThis$4(SymbolPrototype.toString);
7263
+ var thisSymbolValue = uncurryThis$2(SymbolPrototype.valueOf);
7264
+ var symbolDescriptiveString = uncurryThis$2(SymbolPrototype.toString);
6788
7265
  var regexp = /^Symbol\((.*)\)[^)]+$/;
6789
- var replace = uncurryThis$4(''.replace);
6790
- var stringSlice = uncurryThis$4(''.slice);
7266
+ var replace = uncurryThis$2(''.replace);
7267
+ var stringSlice = uncurryThis$2(''.slice);
6791
7268
 
6792
7269
  defineBuiltInAccessor(SymbolPrototype, 'description', {
6793
7270
  configurable: true,
@@ -6800,17 +7277,17 @@ if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototy
6800
7277
  }
6801
7278
  });
6802
7279
 
6803
- $$9({ global: true, constructor: true, forced: true }, {
7280
+ $$2({ global: true, constructor: true, forced: true }, {
6804
7281
  Symbol: SymbolWrapper
6805
7282
  });
6806
7283
  }
6807
7284
 
6808
7285
  var tryToString = tryToString$5;
6809
7286
 
6810
- var $TypeError$1 = TypeError;
7287
+ var $TypeError = TypeError;
6811
7288
 
6812
7289
  var deletePropertyOrThrow$1 = function (O, P) {
6813
- if (!delete O[P]) throw new $TypeError$1('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
7290
+ if (!delete O[P]) throw new $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
6814
7291
  };
6815
7292
 
6816
7293
  var arraySlice = arraySlice$3;
@@ -6871,14 +7348,14 @@ var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
6871
7348
 
6872
7349
  var engineWebkitVersion = !!webkit && +webkit[1];
6873
7350
 
6874
- var $$8 = _export;
6875
- var uncurryThis$3 = functionUncurryThis;
6876
- var aCallable$1 = aCallable$h;
7351
+ var $$1 = _export;
7352
+ var uncurryThis$1 = functionUncurryThis;
7353
+ var aCallable = aCallable$i;
6877
7354
  var toObject = toObject$7;
6878
7355
  var lengthOfArrayLike = lengthOfArrayLike$5;
6879
7356
  var deletePropertyOrThrow = deletePropertyOrThrow$1;
6880
7357
  var toString$1 = toString$9;
6881
- var fails$2 = fails$t;
7358
+ var fails$1 = fails$t;
6882
7359
  var internalSort = arraySort;
6883
7360
  var arrayMethodIsStrict = arrayMethodIsStrict$2;
6884
7361
  var FF = engineFfVersion;
@@ -6887,21 +7364,21 @@ var V8 = engineV8Version;
6887
7364
  var WEBKIT = engineWebkitVersion;
6888
7365
 
6889
7366
  var test = [];
6890
- var nativeSort = uncurryThis$3(test.sort);
6891
- var push = uncurryThis$3(test.push);
7367
+ var nativeSort = uncurryThis$1(test.sort);
7368
+ var push = uncurryThis$1(test.push);
6892
7369
 
6893
7370
  // IE8-
6894
- var FAILS_ON_UNDEFINED = fails$2(function () {
7371
+ var FAILS_ON_UNDEFINED = fails$1(function () {
6895
7372
  test.sort(undefined);
6896
7373
  });
6897
7374
  // V8 bug
6898
- var FAILS_ON_NULL = fails$2(function () {
7375
+ var FAILS_ON_NULL = fails$1(function () {
6899
7376
  test.sort(null);
6900
7377
  });
6901
7378
  // Old WebKit
6902
7379
  var STRICT_METHOD = arrayMethodIsStrict('sort');
6903
7380
 
6904
- var STABLE_SORT = !fails$2(function () {
7381
+ var STABLE_SORT = !fails$1(function () {
6905
7382
  // feature detection can be too slow, so check engines versions
6906
7383
  if (V8) return V8 < 70;
6907
7384
  if (FF && FF > 3) return;
@@ -6949,9 +7426,9 @@ var getSortCompare = function (comparefn) {
6949
7426
 
6950
7427
  // `Array.prototype.sort` method
6951
7428
  // https://tc39.es/ecma262/#sec-array.prototype.sort
6952
- $$8({ target: 'Array', proto: true, forced: FORCED$1 }, {
7429
+ $$1({ target: 'Array', proto: true, forced: FORCED$1 }, {
6953
7430
  sort: function sort(comparefn) {
6954
- if (comparefn !== undefined) aCallable$1(comparefn);
7431
+ if (comparefn !== undefined) aCallable(comparefn);
6955
7432
 
6956
7433
  var array = toObject(this);
6957
7434
 
@@ -6978,8 +7455,8 @@ $$8({ target: 'Array', proto: true, forced: FORCED$1 }, {
6978
7455
  });
6979
7456
 
6980
7457
  var global$1 = global$o;
6981
- var fails$1 = fails$t;
6982
- var uncurryThis$2 = functionUncurryThis;
7458
+ var fails = fails$t;
7459
+ var uncurryThis = functionUncurryThis;
6983
7460
  var toString = toString$9;
6984
7461
  var trim = stringTrim.trim;
6985
7462
  var whitespaces = whitespaces$3;
@@ -6988,10 +7465,10 @@ var $parseInt$1 = global$1.parseInt;
6988
7465
  var Symbol$1 = global$1.Symbol;
6989
7466
  var ITERATOR = Symbol$1 && Symbol$1.iterator;
6990
7467
  var hex = /^[+-]?0x/i;
6991
- var exec = uncurryThis$2(hex.exec);
7468
+ var exec = uncurryThis(hex.exec);
6992
7469
  var FORCED = $parseInt$1(whitespaces + '08') !== 8 || $parseInt$1(whitespaces + '0x16') !== 22
6993
7470
  // MS Edge 18- broken with boxed symbols
6994
- || (ITERATOR && !fails$1(function () { $parseInt$1(Object(ITERATOR)); }));
7471
+ || (ITERATOR && !fails(function () { $parseInt$1(Object(ITERATOR)); }));
6995
7472
 
6996
7473
  // `parseInt` method
6997
7474
  // https://tc39.es/ecma262/#sec-parseint-string-radix
@@ -7000,12 +7477,12 @@ var numberParseInt = FORCED ? function parseInt(string, radix) {
7000
7477
  return $parseInt$1(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
7001
7478
  } : $parseInt$1;
7002
7479
 
7003
- var $$7 = _export;
7480
+ var $ = _export;
7004
7481
  var $parseInt = numberParseInt;
7005
7482
 
7006
7483
  // `parseInt` method
7007
7484
  // https://tc39.es/ecma262/#sec-parseint-string-radix
7008
- $$7({ global: true, forced: parseInt !== $parseInt }, {
7485
+ $({ global: true, forced: parseInt !== $parseInt }, {
7009
7486
  parseInt: $parseInt
7010
7487
  });
7011
7488
 
@@ -7863,720 +8340,345 @@ function PrintRuleConditionEditor({
7863
8340
  if (!reportFullIdentifier.trim()) {
7864
8341
  setMetadata(null);
7865
8342
  onSupportsConditionsChange(false);
7866
- return;
7867
- }
7868
- setLoadingMetadata(true);
7869
- FluxoClientSys.Instance.reporting.getAvailableConditionFields(reportFullIdentifier).then(resp => {
7870
- setMetadata(resp);
7871
- onSupportsConditionsChange(resp.supportsConditions);
7872
- }).catch(() => {
7873
- showNotification({
7874
- title: 'Errore',
7875
- message: 'Impossibile caricare i metadati della condizione',
7876
- color: 'red'
7877
- });
7878
- setMetadata(null);
7879
- onSupportsConditionsChange(false);
7880
- }).finally(() => setLoadingMetadata(false));
7881
- }, [reportFullIdentifier, onSupportsConditionsChange]);
7882
- useEffect(() => {
7883
- var _a;
7884
- if (value !== lastEmittedRef.current) {
7885
- lastEmittedRef.current = value;
7886
- setRootGroup((_a = deserializeConditionTree(value)) !== null && _a !== void 0 ? _a : newGroup());
7887
- }
7888
- }, [value]);
7889
- const handleRootChange = useCallback(group => {
7890
- setRootGroup(group);
7891
- const serialized = serializeConditionTree(group);
7892
- lastEmittedRef.current = serialized;
7893
- onChange(serialized);
7894
- }, [onChange]);
7895
- if (!reportFullIdentifier.trim()) return null;
7896
- if (loadingMetadata) {
7897
- return jsxs(Group, {
7898
- gap: "xs",
7899
- children: [jsx(Loader, {
7900
- size: "xs"
7901
- }), jsx(Text, {
7902
- size: "sm",
7903
- c: "dimmed",
7904
- children: "Caricamento metadati condizione..."
7905
- })]
7906
- });
7907
- }
7908
- if (metadata && !metadata.supportsConditions) {
7909
- return jsx(Alert, {
7910
- color: "yellow",
7911
- title: "Condizione non disponibile",
7912
- icon: jsx(IconInfoCircle, {
7913
- size: 16
7914
- }),
7915
- children: "Questo tipo di report non supporta l'utilizzo di condizioni."
7916
- });
7917
- }
7918
- if (!metadata) return null;
7919
- const fieldOptions = metadata.availableFields.map(f => {
7920
- var _a;
7921
- return {
7922
- value: f.id,
7923
- label: f.displayName,
7924
- description: (_a = f.description) !== null && _a !== void 0 ? _a : null
7925
- };
7926
- });
7927
- const fieldMap = new Map(metadata.availableFields.map(f => [f.id, f]));
7928
- return jsxs(Stack, {
7929
- gap: "xs",
7930
- children: [jsx(Text, {
7931
- size: "sm",
7932
- fw: 500,
7933
- children: "Condizione (opzionale)"
7934
- }), jsx(GroupEditor, {
7935
- group: rootGroup,
7936
- depth: 0,
7937
- isRoot: true,
7938
- onChange: handleRootChange,
7939
- onRemove: () => {},
7940
- fieldOptions: fieldOptions,
7941
- fieldMap: fieldMap,
7942
- reportType: metadata.reportType,
7943
- disabled: disabled
7944
- })]
7945
- });
7946
- }
7947
-
7948
- function PrintRuleEdit(props) {
7949
- var _a, _b, _c, _d;
7950
- const [reportFullIdentifier, setReportFullIdentifier] = useState(((_a = props.rule) === null || _a === void 0 ? void 0 : _a.reportFullIdentifier) || '');
7951
- const isCategorySelected = reportFullIdentifier.trim().length > 0;
7952
- const [reportIds, setReportIds] = useState(props.rule ? props.rule.reports.map(r => r.id.toString()) : []);
7953
- const [virtualPrinterIds, setVirtualPrinterIds] = useState(props.rule ? props.rule.virtualPrinters.map(vp => vp.id.toString()) : []);
7954
- const [condition, setCondition] = useState(((_b = props.rule) === null || _b === void 0 ? void 0 : _b.condition) || '');
7955
- const [priority, setPriority] = useState(((_c = props.rule) === null || _c === void 0 ? void 0 : _c.priority) || 10);
7956
- const [description, setDescription] = useState(((_d = props.rule) === null || _d === void 0 ? void 0 : _d.description) || '');
7957
- const [loading, setLoading] = useState(false);
7958
- // Dati caricati dalle API
7959
- const [reportCategories, setReportCategories] = useState([]);
7960
- const [availableReports, setAvailableReports] = useState([]);
7961
- const [availablePrinters, setAvailablePrinters] = useState([]);
7962
- const [loadingCategories, setLoadingCategories] = useState(false);
7963
- const [loadingReports, setLoadingReports] = useState(false);
7964
- const [loadingPrinters, setLoadingPrinters] = useState(false);
7965
- const [supportsConditions, setSupportsConditions] = useState(false);
7966
- useEffect(() => {
7967
- loadReportCategories();
7968
- loadPrinters();
7969
- }, []);
7970
- useEffect(() => {
7971
- if (reportFullIdentifier.trim()) {
7972
- loadReports(reportFullIdentifier);
7973
- } else {
7974
- setAvailableReports([]);
7975
- setSupportsConditions(false);
7976
- }
7977
- }, [reportFullIdentifier]);
7978
- const loadReportCategories = () => {
7979
- setLoadingCategories(true);
7980
- FluxoClientSys.Instance.reporting.getReportsList().then(reportsList => {
7981
- setReportCategories(reportsList.map(category => ({
7982
- value: `${category.scope}.${category.packageName}.${category.namespace}.${category.reportTypeId}`,
7983
- label: `${category.name} (${category.reports.length})`
7984
- })));
7985
- }).catch(() => {
7986
- showNotification({
7987
- title: 'Errore',
7988
- message: 'Impossibile caricare le categorie di report',
7989
- color: 'red'
7990
- });
7991
- setReportCategories([]);
7992
- }).finally(() => {
7993
- setLoadingCategories(false);
7994
- });
7995
- };
7996
- const loadReports = fullIdentifier => {
7997
- setLoadingReports(true);
7998
- FluxoClientSys.Instance.reporting.getReportsList(fullIdentifier).then(reportsList => {
7999
- // Flatten tutti i report da tutte le categorie
8000
- const allReports = [];
8001
- reportsList.forEach(category => {
8002
- category.reports.forEach(report => {
8003
- allReports.push({
8004
- value: report.id.toString(),
8005
- label: `${report.name} (ID: ${report.id})`
8006
- });
8007
- });
8008
- });
8009
- setAvailableReports(allReports);
8010
- setLoadingReports(false);
8011
- }).catch(() => {
8012
- showNotification({
8013
- title: 'Errore',
8014
- message: 'Impossibile caricare la lista dei report',
8015
- color: 'red'
8016
- });
8017
- setAvailableReports([]);
8018
- setLoadingReports(false);
8019
- });
8020
- };
8021
- const loadPrinters = () => {
8022
- setLoadingPrinters(true);
8023
- FluxoClientSys.Instance.printing.GetPrintServerList().then(printServers => {
8024
- const groupedPrinters = printServers.map(server => ({
8025
- group: server.name || 'Print Server senza nome',
8026
- items: server.printers.map(printer => ({
8027
- value: printer.id.toString(),
8028
- label: `${printer.name} - ${server.name || 'Print Server senza nome'} (ID: ${printer.id})`
8029
- }))
8030
- })).filter(group => group.items.length > 0);
8031
- setAvailablePrinters(groupedPrinters);
8032
- setLoadingPrinters(false);
8033
- }).catch(() => {
8034
- showNotification({
8035
- title: 'Errore',
8036
- message: 'Impossibile caricare la lista delle stampanti',
8037
- color: 'red'
8038
- });
8039
- setAvailablePrinters([]);
8040
- setLoadingPrinters(false);
8041
- });
8042
- };
8043
- const handleSupportsConditionsChange = useCallback(value => {
8044
- setSupportsConditions(value);
8045
- }, []);
8046
- const handleSubmit = () => {
8047
- if (!reportFullIdentifier.trim()) {
8048
- showNotification({
8049
- title: 'Validazione',
8050
- message: 'La categoria report è obbligatoria',
8051
- color: 'yellow'
8052
- });
8053
- return;
8054
- }
8055
- if (reportIds.length === 0) {
8056
- showNotification({
8057
- title: 'Validazione',
8058
- message: 'Almeno un report è obbligatorio',
8059
- color: 'yellow'
8060
- });
8061
- return;
8062
- }
8063
- const command = {
8064
- reportFullIdentifier: reportFullIdentifier.trim(),
8065
- reportIds: reportIds.map(id => parseInt(id)),
8066
- virtualPrinterIds: virtualPrinterIds.length > 0 ? virtualPrinterIds.map(id => parseInt(id)) : undefined,
8067
- condition: supportsConditions ? condition.trim() || undefined : undefined,
8068
- priority,
8069
- description: description.trim() || undefined
8070
- };
8071
- setLoading(true);
8072
- if (props.mode === 'edit' && !props.rule) {
8073
- showNotification({
8074
- title: 'Errore',
8075
- message: 'Regola non disponibile per l\'aggiornamento',
8076
- color: 'red'
8077
- });
8078
- setLoading(false);
8079
- return;
8080
- }
8081
- let promise;
8082
- if (props.mode === 'create') {
8083
- promise = FluxoClientSys.Instance.reporting.createPrintRule(Object.assign(Object.assign({}, command), {
8084
- printProfileId: props.printProfileId
8085
- }));
8086
- } else {
8087
- const rule = props.rule;
8088
- if (!rule) {
8089
- showNotification({
8090
- title: 'Errore',
8091
- message: 'Regola non disponibile per l\'aggiornamento',
8092
- color: 'red'
8093
- });
8094
- setLoading(false);
8095
- return;
8096
- }
8097
- promise = FluxoClientSys.Instance.reporting.updatePrintRule(rule.id, command);
8343
+ return;
8098
8344
  }
8099
- promise.then(() => {
8100
- showNotification({
8101
- title: 'Successo',
8102
- message: props.mode === 'create' ? 'Regola creata con successo' : 'Regola aggiornata con successo',
8103
- color: 'green'
8104
- });
8105
- props.onSaved();
8345
+ setLoadingMetadata(true);
8346
+ FluxoClientSys.Instance.reporting.getAvailableConditionFields(reportFullIdentifier).then(resp => {
8347
+ setMetadata(resp);
8348
+ onSupportsConditionsChange(resp.supportsConditions);
8106
8349
  }).catch(() => {
8107
8350
  showNotification({
8108
8351
  title: 'Errore',
8109
- message: `Si è verificato un errore durante ${props.mode === 'create' ? 'la creazione' : 'l\'aggiornamento'} della regola`,
8352
+ message: 'Impossibile caricare i metadati della condizione',
8110
8353
  color: 'red'
8111
8354
  });
8112
- }).finally(() => {
8113
- setLoading(false);
8355
+ setMetadata(null);
8356
+ onSupportsConditionsChange(false);
8357
+ }).finally(() => setLoadingMetadata(false));
8358
+ }, [reportFullIdentifier, onSupportsConditionsChange]);
8359
+ useEffect(() => {
8360
+ var _a;
8361
+ if (value !== lastEmittedRef.current) {
8362
+ lastEmittedRef.current = value;
8363
+ setRootGroup((_a = deserializeConditionTree(value)) !== null && _a !== void 0 ? _a : newGroup());
8364
+ }
8365
+ }, [value]);
8366
+ const handleRootChange = useCallback(group => {
8367
+ setRootGroup(group);
8368
+ const serialized = serializeConditionTree(group);
8369
+ lastEmittedRef.current = serialized;
8370
+ onChange(serialized);
8371
+ }, [onChange]);
8372
+ if (!reportFullIdentifier.trim()) return null;
8373
+ if (loadingMetadata) {
8374
+ return jsxs(Group, {
8375
+ gap: "xs",
8376
+ children: [jsx(Loader, {
8377
+ size: "xs"
8378
+ }), jsx(Text, {
8379
+ size: "sm",
8380
+ c: "dimmed",
8381
+ children: "Caricamento metadati condizione..."
8382
+ })]
8114
8383
  });
8115
- };
8116
- return jsxs(Stack, {
8117
- gap: "md",
8118
- children: [jsx(Select, {
8119
- label: "Categoria Report",
8120
- placeholder: loadingCategories ? "Caricamento categorie..." : "Seleziona una categoria di report",
8121
- description: "Seleziona il tipo di report per cui creare la regola",
8122
- required: true,
8123
- value: reportFullIdentifier,
8124
- onChange: value => {
8125
- const nextValue = value || '';
8126
- setReportFullIdentifier(nextValue);
8127
- if (nextValue !== reportFullIdentifier) {
8128
- setReportIds([]);
8129
- }
8130
- },
8131
- data: reportCategories,
8132
- disabled: loading || props.mode === 'edit' || loadingCategories,
8133
- searchable: true,
8134
- leftSection: jsx(IconFolder, {
8384
+ }
8385
+ if (metadata && !metadata.supportsConditions) {
8386
+ return jsx(Alert, {
8387
+ color: "yellow",
8388
+ title: "Condizione non disponibile",
8389
+ icon: jsx(IconInfoCircle, {
8135
8390
  size: 16
8136
8391
  }),
8137
- nothingFoundMessage: "Nessuna categoria trovata",
8138
- error: !reportFullIdentifier.trim() && 'Campo obbligatorio'
8139
- }), jsx(Textarea, {
8140
- label: "Descrizione",
8141
- placeholder: "Descrizione della regola (opzionale)",
8142
- value: description,
8143
- onChange: e => setDescription(e.currentTarget.value),
8144
- disabled: loading || !isCategorySelected,
8145
- rows: 2
8146
- }), jsx(NumberInput, {
8147
- label: "Priorit\u00E0",
8148
- description: "Le regole con priorit\u00E0 pi\u00F9 alta vengono applicate per prime",
8149
- value: priority,
8150
- onChange: value => setPriority(typeof value === 'number' ? value : 10),
8151
- disabled: loading || !isCategorySelected,
8152
- min: 0,
8153
- max: 999
8154
- }), jsx(MultiSelect, {
8155
- label: "Report",
8156
- description: reportFullIdentifier.trim() ? "Seleziona uno o più report" : "Seleziona prima una categoria per caricare i report",
8157
- placeholder: loadingReports ? "Caricamento..." : "Seleziona report",
8158
- data: availableReports,
8159
- value: reportIds,
8160
- onChange: setReportIds,
8161
- disabled: loading || !isCategorySelected || loadingReports,
8162
- searchable: true,
8163
- nothingFoundMessage: "Nessun report trovato",
8164
- required: true,
8165
- error: isCategorySelected && reportIds.length === 0 ? 'Seleziona almeno un report' : undefined
8166
- }), jsx(MultiSelect, {
8167
- label: "Stampanti Virtuali (opzionale)",
8168
- description: "Seleziona le stampanti virtuali disponibili (lascia vuoto per tutte)",
8169
- placeholder: loadingPrinters ? "Caricamento..." : "Seleziona stampanti",
8170
- data: availablePrinters,
8171
- value: virtualPrinterIds,
8172
- onChange: setVirtualPrinterIds,
8173
- disabled: loading || !isCategorySelected || loadingPrinters,
8174
- searchable: true,
8175
- nothingFoundMessage: "Nessuna stampante trovata"
8176
- }), jsx(PrintRuleConditionEditor, {
8177
- reportFullIdentifier: reportFullIdentifier,
8178
- value: condition,
8179
- onChange: setCondition,
8180
- disabled: loading || !isCategorySelected,
8181
- onSupportsConditionsChange: handleSupportsConditionsChange
8182
- }), jsxs(Group, {
8183
- justify: "flex-end",
8184
- mt: "md",
8185
- children: [jsx(Button, {
8186
- variant: "default",
8187
- onClick: props.onCancel,
8188
- leftSection: jsx(IconX, {
8189
- size: 16
8190
- }),
8191
- disabled: loading,
8192
- children: "Annulla"
8193
- }), jsx(Button, {
8194
- onClick: handleSubmit,
8195
- leftSection: jsx(IconCheck, {
8196
- size: 16
8197
- }),
8198
- loading: loading,
8199
- disabled: !isCategorySelected || reportIds.length === 0,
8200
- children: props.mode === 'create' ? 'Crea regola' : 'Salva modifiche'
8201
- })]
8202
- })]
8203
- });
8204
- }
8205
-
8206
- var uncurryThis$1 = functionUncurryThis;
8207
-
8208
- // eslint-disable-next-line es/no-set -- safe
8209
- var SetPrototype$1 = Set.prototype;
8210
-
8211
- var setHelpers = {
8212
- // eslint-disable-next-line es/no-set -- safe
8213
- Set: Set,
8214
- add: uncurryThis$1(SetPrototype$1.add),
8215
- has: uncurryThis$1(SetPrototype$1.has),
8216
- remove: uncurryThis$1(SetPrototype$1['delete']),
8217
- proto: SetPrototype$1
8218
- };
8219
-
8220
- var has$5 = setHelpers.has;
8221
-
8222
- // Perform ? RequireInternalSlot(M, [[SetData]])
8223
- var aSet$7 = function (it) {
8224
- has$5(it);
8225
- return it;
8226
- };
8227
-
8228
- var call$1 = functionCall;
8229
-
8230
- var iterateSimple$7 = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) {
8231
- var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator;
8232
- var next = record.next;
8233
- var step, result;
8234
- while (!(step = call$1(next, iterator)).done) {
8235
- result = fn(step.value);
8236
- if (result !== undefined) return result;
8237
- }
8238
- };
8239
-
8240
- var uncurryThis = functionUncurryThis;
8241
- var iterateSimple$6 = iterateSimple$7;
8242
- var SetHelpers$5 = setHelpers;
8243
-
8244
- var Set$3 = SetHelpers$5.Set;
8245
- var SetPrototype = SetHelpers$5.proto;
8246
- var forEach = uncurryThis(SetPrototype.forEach);
8247
- var keys = uncurryThis(SetPrototype.keys);
8248
- var next = keys(new Set$3()).next;
8249
-
8250
- var setIterate = function (set, fn, interruptible) {
8251
- return interruptible ? iterateSimple$6({ iterator: keys(set), next: next }, fn) : forEach(set, fn);
8252
- };
8253
-
8254
- var SetHelpers$4 = setHelpers;
8255
- var iterate$1 = setIterate;
8256
-
8257
- var Set$2 = SetHelpers$4.Set;
8258
- var add$3 = SetHelpers$4.add;
8259
-
8260
- var setClone = function (set) {
8261
- var result = new Set$2();
8262
- iterate$1(set, function (it) {
8263
- add$3(result, it);
8264
- });
8265
- return result;
8266
- };
8267
-
8268
- var uncurryThisAccessor = functionUncurryThisAccessor;
8269
- var SetHelpers$3 = setHelpers;
8270
-
8271
- var setSize = uncurryThisAccessor(SetHelpers$3.proto, 'size', 'get') || function (set) {
8272
- return set.size;
8273
- };
8274
-
8275
- var aCallable = aCallable$h;
8276
- var anObject = anObject$m;
8277
- var call = functionCall;
8278
- var toIntegerOrInfinity = toIntegerOrInfinity$5;
8279
- var getIteratorDirect = getIteratorDirect$7;
8280
-
8281
- var INVALID_SIZE = 'Invalid size';
8282
- var $RangeError = RangeError;
8283
- var $TypeError = TypeError;
8284
- var max = Math.max;
8285
-
8286
- var SetRecord = function (set, intSize) {
8287
- this.set = set;
8288
- this.size = max(intSize, 0);
8289
- this.has = aCallable(set.has);
8290
- this.keys = aCallable(set.keys);
8291
- };
8292
-
8293
- SetRecord.prototype = {
8294
- getIterator: function () {
8295
- return getIteratorDirect(anObject(call(this.keys, this.set)));
8296
- },
8297
- includes: function (it) {
8298
- return call(this.has, this.set, it);
8299
- }
8300
- };
8301
-
8302
- // `GetSetRecord` abstract operation
8303
- // https://tc39.es/proposal-set-methods/#sec-getsetrecord
8304
- var getSetRecord$7 = function (obj) {
8305
- anObject(obj);
8306
- var numSize = +obj.size;
8307
- // NOTE: If size is undefined, then numSize will be NaN
8308
- // eslint-disable-next-line no-self-compare -- NaN check
8309
- if (numSize !== numSize) throw new $TypeError(INVALID_SIZE);
8310
- var intSize = toIntegerOrInfinity(numSize);
8311
- if (intSize < 0) throw new $RangeError(INVALID_SIZE);
8312
- return new SetRecord(obj, intSize);
8313
- };
8314
-
8315
- var aSet$6 = aSet$7;
8316
- var SetHelpers$2 = setHelpers;
8317
- var clone$2 = setClone;
8318
- var size$4 = setSize;
8319
- var getSetRecord$6 = getSetRecord$7;
8320
- var iterateSet$2 = setIterate;
8321
- var iterateSimple$5 = iterateSimple$7;
8322
-
8323
- var has$4 = SetHelpers$2.has;
8324
- var remove$1 = SetHelpers$2.remove;
8325
-
8326
- // `Set.prototype.difference` method
8327
- // https://github.com/tc39/proposal-set-methods
8328
- var setDifference = function difference(other) {
8329
- var O = aSet$6(this);
8330
- var otherRec = getSetRecord$6(other);
8331
- var result = clone$2(O);
8332
- if (size$4(O) <= otherRec.size) iterateSet$2(O, function (e) {
8333
- if (otherRec.includes(e)) remove$1(result, e);
8392
+ children: "Questo tipo di report non supporta l'utilizzo di condizioni."
8393
+ });
8394
+ }
8395
+ if (!metadata) return null;
8396
+ const fieldOptions = metadata.availableFields.map(f => {
8397
+ var _a;
8398
+ return {
8399
+ value: f.id,
8400
+ label: f.displayName,
8401
+ description: (_a = f.description) !== null && _a !== void 0 ? _a : null
8402
+ };
8334
8403
  });
8335
- else iterateSimple$5(otherRec.getIterator(), function (e) {
8336
- if (has$4(O, e)) remove$1(result, e);
8404
+ const fieldMap = new Map(metadata.availableFields.map(f => [f.id, f]));
8405
+ return jsxs(Stack, {
8406
+ gap: "xs",
8407
+ children: [jsx(Text, {
8408
+ size: "sm",
8409
+ fw: 500,
8410
+ children: "Condizione (opzionale)"
8411
+ }), jsx(GroupEditor, {
8412
+ group: rootGroup,
8413
+ depth: 0,
8414
+ isRoot: true,
8415
+ onChange: handleRootChange,
8416
+ onRemove: () => {},
8417
+ fieldOptions: fieldOptions,
8418
+ fieldMap: fieldMap,
8419
+ reportType: metadata.reportType,
8420
+ disabled: disabled
8421
+ })]
8337
8422
  });
8338
- return result;
8339
- };
8340
-
8341
- var getBuiltIn = getBuiltIn$a;
8423
+ }
8342
8424
 
8343
- var createSetLike = function (size) {
8344
- return {
8345
- size: size,
8346
- has: function () {
8347
- return false;
8348
- },
8349
- keys: function () {
8350
- return {
8351
- next: function () {
8352
- return { done: true };
8353
- }
8354
- };
8425
+ function PrintRuleEdit(props) {
8426
+ var _a, _b, _c, _d;
8427
+ const [reportFullIdentifier, setReportFullIdentifier] = useState(((_a = props.rule) === null || _a === void 0 ? void 0 : _a.reportFullIdentifier) || '');
8428
+ const isCategorySelected = reportFullIdentifier.trim().length > 0;
8429
+ const [reportIds, setReportIds] = useState(props.rule ? props.rule.reports.map(r => r.id.toString()) : []);
8430
+ const [virtualPrinterIds, setVirtualPrinterIds] = useState(props.rule ? props.rule.virtualPrinters.map(vp => vp.id.toString()) : []);
8431
+ const [condition, setCondition] = useState(((_b = props.rule) === null || _b === void 0 ? void 0 : _b.condition) || '');
8432
+ const [priority, setPriority] = useState(((_c = props.rule) === null || _c === void 0 ? void 0 : _c.priority) || 10);
8433
+ const [description, setDescription] = useState(((_d = props.rule) === null || _d === void 0 ? void 0 : _d.description) || '');
8434
+ const [loading, setLoading] = useState(false);
8435
+ // Dati caricati dalle API
8436
+ const [reportCategories, setReportCategories] = useState([]);
8437
+ const [availableReports, setAvailableReports] = useState([]);
8438
+ const [availablePrinters, setAvailablePrinters] = useState([]);
8439
+ const [loadingCategories, setLoadingCategories] = useState(false);
8440
+ const [loadingReports, setLoadingReports] = useState(false);
8441
+ const [loadingPrinters, setLoadingPrinters] = useState(false);
8442
+ const [supportsConditions, setSupportsConditions] = useState(false);
8443
+ useEffect(() => {
8444
+ loadReportCategories();
8445
+ loadPrinters();
8446
+ }, []);
8447
+ useEffect(() => {
8448
+ if (reportFullIdentifier.trim()) {
8449
+ loadReports(reportFullIdentifier);
8450
+ } else {
8451
+ setAvailableReports([]);
8452
+ setSupportsConditions(false);
8355
8453
  }
8454
+ }, [reportFullIdentifier]);
8455
+ const loadReportCategories = () => {
8456
+ setLoadingCategories(true);
8457
+ FluxoClientSys.Instance.reporting.getReportsList().then(reportsList => {
8458
+ setReportCategories(reportsList.map(category => ({
8459
+ value: `${category.scope}.${category.packageName}.${category.namespace}.${category.reportTypeId}`,
8460
+ label: `${category.name} (${category.reports.length})`
8461
+ })));
8462
+ }).catch(() => {
8463
+ showNotification({
8464
+ title: 'Errore',
8465
+ message: 'Impossibile caricare le categorie di report',
8466
+ color: 'red'
8467
+ });
8468
+ setReportCategories([]);
8469
+ }).finally(() => {
8470
+ setLoadingCategories(false);
8471
+ });
8356
8472
  };
8357
- };
8358
-
8359
- var setMethodAcceptSetLike$7 = function (name) {
8360
- var Set = getBuiltIn('Set');
8361
- try {
8362
- new Set()[name](createSetLike(0));
8363
- try {
8364
- // late spec change, early WebKit ~ Safari 17.0 beta implementation does not pass it
8365
- // https://github.com/tc39/proposal-set-methods/pull/88
8366
- new Set()[name](createSetLike(-1));
8367
- return false;
8368
- } catch (error2) {
8369
- return true;
8370
- }
8371
- } catch (error) {
8372
- return false;
8373
- }
8374
- };
8375
-
8376
- var $$6 = _export;
8377
- var difference = setDifference;
8378
- var setMethodAcceptSetLike$6 = setMethodAcceptSetLike$7;
8379
-
8380
- // `Set.prototype.difference` method
8381
- // https://github.com/tc39/proposal-set-methods
8382
- $$6({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike$6('difference') }, {
8383
- difference: difference
8384
- });
8385
-
8386
- var aSet$5 = aSet$7;
8387
- var SetHelpers$1 = setHelpers;
8388
- var size$3 = setSize;
8389
- var getSetRecord$5 = getSetRecord$7;
8390
- var iterateSet$1 = setIterate;
8391
- var iterateSimple$4 = iterateSimple$7;
8392
-
8393
- var Set$1 = SetHelpers$1.Set;
8394
- var add$2 = SetHelpers$1.add;
8395
- var has$3 = SetHelpers$1.has;
8396
-
8397
- // `Set.prototype.intersection` method
8398
- // https://github.com/tc39/proposal-set-methods
8399
- var setIntersection = function intersection(other) {
8400
- var O = aSet$5(this);
8401
- var otherRec = getSetRecord$5(other);
8402
- var result = new Set$1();
8403
-
8404
- if (size$3(O) > otherRec.size) {
8405
- iterateSimple$4(otherRec.getIterator(), function (e) {
8406
- if (has$3(O, e)) add$2(result, e);
8473
+ const loadReports = fullIdentifier => {
8474
+ setLoadingReports(true);
8475
+ FluxoClientSys.Instance.reporting.getReportsList(fullIdentifier).then(reportsList => {
8476
+ // Flatten tutti i report da tutte le categorie
8477
+ const allReports = [];
8478
+ reportsList.forEach(category => {
8479
+ category.reports.forEach(report => {
8480
+ allReports.push({
8481
+ value: report.id.toString(),
8482
+ label: `${report.name} (ID: ${report.id})`
8483
+ });
8484
+ });
8485
+ });
8486
+ setAvailableReports(allReports);
8487
+ setLoadingReports(false);
8488
+ }).catch(() => {
8489
+ showNotification({
8490
+ title: 'Errore',
8491
+ message: 'Impossibile caricare la lista dei report',
8492
+ color: 'red'
8493
+ });
8494
+ setAvailableReports([]);
8495
+ setLoadingReports(false);
8407
8496
  });
8408
- } else {
8409
- iterateSet$1(O, function (e) {
8410
- if (otherRec.includes(e)) add$2(result, e);
8497
+ };
8498
+ const loadPrinters = () => {
8499
+ setLoadingPrinters(true);
8500
+ FluxoClientSys.Instance.printing.GetPrintServerList().then(printServers => {
8501
+ const groupedPrinters = printServers.map(server => ({
8502
+ group: server.name || 'Print Server senza nome',
8503
+ items: server.printers.map(printer => ({
8504
+ value: printer.id.toString(),
8505
+ label: `${printer.name} - ${server.name || 'Print Server senza nome'} (ID: ${printer.id})`
8506
+ }))
8507
+ })).filter(group => group.items.length > 0);
8508
+ setAvailablePrinters(groupedPrinters);
8509
+ setLoadingPrinters(false);
8510
+ }).catch(() => {
8511
+ showNotification({
8512
+ title: 'Errore',
8513
+ message: 'Impossibile caricare la lista delle stampanti',
8514
+ color: 'red'
8515
+ });
8516
+ setAvailablePrinters([]);
8517
+ setLoadingPrinters(false);
8518
+ });
8519
+ };
8520
+ const handleSupportsConditionsChange = useCallback(value => {
8521
+ setSupportsConditions(value);
8522
+ }, []);
8523
+ const handleSubmit = () => {
8524
+ if (!reportFullIdentifier.trim()) {
8525
+ showNotification({
8526
+ title: 'Validazione',
8527
+ message: 'La categoria report è obbligatoria',
8528
+ color: 'yellow'
8529
+ });
8530
+ return;
8531
+ }
8532
+ if (reportIds.length === 0) {
8533
+ showNotification({
8534
+ title: 'Validazione',
8535
+ message: 'Almeno un report è obbligatorio',
8536
+ color: 'yellow'
8537
+ });
8538
+ return;
8539
+ }
8540
+ const command = {
8541
+ reportFullIdentifier: reportFullIdentifier.trim(),
8542
+ reportIds: reportIds.map(id => parseInt(id)),
8543
+ virtualPrinterIds: virtualPrinterIds.length > 0 ? virtualPrinterIds.map(id => parseInt(id)) : undefined,
8544
+ condition: supportsConditions ? condition.trim() || undefined : undefined,
8545
+ priority,
8546
+ description: description.trim() || undefined
8547
+ };
8548
+ setLoading(true);
8549
+ if (props.mode === 'edit' && !props.rule) {
8550
+ showNotification({
8551
+ title: 'Errore',
8552
+ message: 'Regola non disponibile per l\'aggiornamento',
8553
+ color: 'red'
8554
+ });
8555
+ setLoading(false);
8556
+ return;
8557
+ }
8558
+ let promise;
8559
+ if (props.mode === 'create') {
8560
+ promise = FluxoClientSys.Instance.reporting.createPrintRule(Object.assign(Object.assign({}, command), {
8561
+ printProfileId: props.printProfileId
8562
+ }));
8563
+ } else {
8564
+ const rule = props.rule;
8565
+ if (!rule) {
8566
+ showNotification({
8567
+ title: 'Errore',
8568
+ message: 'Regola non disponibile per l\'aggiornamento',
8569
+ color: 'red'
8570
+ });
8571
+ setLoading(false);
8572
+ return;
8573
+ }
8574
+ promise = FluxoClientSys.Instance.reporting.updatePrintRule(rule.id, command);
8575
+ }
8576
+ promise.then(() => {
8577
+ showNotification({
8578
+ title: 'Successo',
8579
+ message: props.mode === 'create' ? 'Regola creata con successo' : 'Regola aggiornata con successo',
8580
+ color: 'green'
8581
+ });
8582
+ props.onSaved();
8583
+ }).catch(() => {
8584
+ showNotification({
8585
+ title: 'Errore',
8586
+ message: `Si è verificato un errore durante ${props.mode === 'create' ? 'la creazione' : 'l\'aggiornamento'} della regola`,
8587
+ color: 'red'
8588
+ });
8589
+ }).finally(() => {
8590
+ setLoading(false);
8411
8591
  });
8412
- }
8413
-
8414
- return result;
8415
- };
8416
-
8417
- var $$5 = _export;
8418
- var fails = fails$t;
8419
- var intersection = setIntersection;
8420
- var setMethodAcceptSetLike$5 = setMethodAcceptSetLike$7;
8421
-
8422
- var INCORRECT = !setMethodAcceptSetLike$5('intersection') || fails(function () {
8423
- // eslint-disable-next-line es/no-array-from, es/no-set -- testing
8424
- return String(Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2])))) !== '3,2';
8425
- });
8426
-
8427
- // `Set.prototype.intersection` method
8428
- // https://github.com/tc39/proposal-set-methods
8429
- $$5({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
8430
- intersection: intersection
8431
- });
8432
-
8433
- var aSet$4 = aSet$7;
8434
- var has$2 = setHelpers.has;
8435
- var size$2 = setSize;
8436
- var getSetRecord$4 = getSetRecord$7;
8437
- var iterateSet = setIterate;
8438
- var iterateSimple$3 = iterateSimple$7;
8439
- var iteratorClose$1 = iteratorClose$5;
8440
-
8441
- // `Set.prototype.isDisjointFrom` method
8442
- // https://tc39.github.io/proposal-set-methods/#Set.prototype.isDisjointFrom
8443
- var setIsDisjointFrom = function isDisjointFrom(other) {
8444
- var O = aSet$4(this);
8445
- var otherRec = getSetRecord$4(other);
8446
- if (size$2(O) <= otherRec.size) return iterateSet(O, function (e) {
8447
- if (otherRec.includes(e)) return false;
8448
- }, true) !== false;
8449
- var iterator = otherRec.getIterator();
8450
- return iterateSimple$3(iterator, function (e) {
8451
- if (has$2(O, e)) return iteratorClose$1(iterator, 'normal', false);
8452
- }) !== false;
8453
- };
8454
-
8455
- var $$4 = _export;
8456
- var isDisjointFrom = setIsDisjointFrom;
8457
- var setMethodAcceptSetLike$4 = setMethodAcceptSetLike$7;
8458
-
8459
- // `Set.prototype.isDisjointFrom` method
8460
- // https://github.com/tc39/proposal-set-methods
8461
- $$4({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike$4('isDisjointFrom') }, {
8462
- isDisjointFrom: isDisjointFrom
8463
- });
8464
-
8465
- var aSet$3 = aSet$7;
8466
- var size$1 = setSize;
8467
- var iterate = setIterate;
8468
- var getSetRecord$3 = getSetRecord$7;
8469
-
8470
- // `Set.prototype.isSubsetOf` method
8471
- // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSubsetOf
8472
- var setIsSubsetOf = function isSubsetOf(other) {
8473
- var O = aSet$3(this);
8474
- var otherRec = getSetRecord$3(other);
8475
- if (size$1(O) > otherRec.size) return false;
8476
- return iterate(O, function (e) {
8477
- if (!otherRec.includes(e)) return false;
8478
- }, true) !== false;
8479
- };
8480
-
8481
- var $$3 = _export;
8482
- var isSubsetOf = setIsSubsetOf;
8483
- var setMethodAcceptSetLike$3 = setMethodAcceptSetLike$7;
8484
-
8485
- // `Set.prototype.isSubsetOf` method
8486
- // https://github.com/tc39/proposal-set-methods
8487
- $$3({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike$3('isSubsetOf') }, {
8488
- isSubsetOf: isSubsetOf
8489
- });
8490
-
8491
- var aSet$2 = aSet$7;
8492
- var has$1 = setHelpers.has;
8493
- var size = setSize;
8494
- var getSetRecord$2 = getSetRecord$7;
8495
- var iterateSimple$2 = iterateSimple$7;
8496
- var iteratorClose = iteratorClose$5;
8497
-
8498
- // `Set.prototype.isSupersetOf` method
8499
- // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSupersetOf
8500
- var setIsSupersetOf = function isSupersetOf(other) {
8501
- var O = aSet$2(this);
8502
- var otherRec = getSetRecord$2(other);
8503
- if (size(O) < otherRec.size) return false;
8504
- var iterator = otherRec.getIterator();
8505
- return iterateSimple$2(iterator, function (e) {
8506
- if (!has$1(O, e)) return iteratorClose(iterator, 'normal', false);
8507
- }) !== false;
8508
- };
8509
-
8510
- var $$2 = _export;
8511
- var isSupersetOf = setIsSupersetOf;
8512
- var setMethodAcceptSetLike$2 = setMethodAcceptSetLike$7;
8513
-
8514
- // `Set.prototype.isSupersetOf` method
8515
- // https://github.com/tc39/proposal-set-methods
8516
- $$2({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike$2('isSupersetOf') }, {
8517
- isSupersetOf: isSupersetOf
8518
- });
8519
-
8520
- var aSet$1 = aSet$7;
8521
- var SetHelpers = setHelpers;
8522
- var clone$1 = setClone;
8523
- var getSetRecord$1 = getSetRecord$7;
8524
- var iterateSimple$1 = iterateSimple$7;
8525
-
8526
- var add$1 = SetHelpers.add;
8527
- var has = SetHelpers.has;
8528
- var remove = SetHelpers.remove;
8529
-
8530
- // `Set.prototype.symmetricDifference` method
8531
- // https://github.com/tc39/proposal-set-methods
8532
- var setSymmetricDifference = function symmetricDifference(other) {
8533
- var O = aSet$1(this);
8534
- var keysIter = getSetRecord$1(other).getIterator();
8535
- var result = clone$1(O);
8536
- iterateSimple$1(keysIter, function (e) {
8537
- if (has(O, e)) remove(result, e);
8538
- else add$1(result, e);
8539
- });
8540
- return result;
8541
- };
8542
-
8543
- var $$1 = _export;
8544
- var symmetricDifference = setSymmetricDifference;
8545
- var setMethodAcceptSetLike$1 = setMethodAcceptSetLike$7;
8546
-
8547
- // `Set.prototype.symmetricDifference` method
8548
- // https://github.com/tc39/proposal-set-methods
8549
- $$1({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike$1('symmetricDifference') }, {
8550
- symmetricDifference: symmetricDifference
8551
- });
8552
-
8553
- var aSet = aSet$7;
8554
- var add = setHelpers.add;
8555
- var clone = setClone;
8556
- var getSetRecord = getSetRecord$7;
8557
- var iterateSimple = iterateSimple$7;
8558
-
8559
- // `Set.prototype.union` method
8560
- // https://github.com/tc39/proposal-set-methods
8561
- var setUnion = function union(other) {
8562
- var O = aSet(this);
8563
- var keysIter = getSetRecord(other).getIterator();
8564
- var result = clone(O);
8565
- iterateSimple(keysIter, function (it) {
8566
- add(result, it);
8592
+ };
8593
+ return jsxs(Stack, {
8594
+ gap: "md",
8595
+ children: [jsx(Select, {
8596
+ label: "Categoria Report",
8597
+ placeholder: loadingCategories ? "Caricamento categorie..." : "Seleziona una categoria di report",
8598
+ description: "Seleziona il tipo di report per cui creare la regola",
8599
+ required: true,
8600
+ value: reportFullIdentifier,
8601
+ onChange: value => {
8602
+ const nextValue = value || '';
8603
+ setReportFullIdentifier(nextValue);
8604
+ if (nextValue !== reportFullIdentifier) {
8605
+ setReportIds([]);
8606
+ }
8607
+ },
8608
+ data: reportCategories,
8609
+ disabled: loading || props.mode === 'edit' || loadingCategories,
8610
+ searchable: true,
8611
+ leftSection: jsx(IconFolder, {
8612
+ size: 16
8613
+ }),
8614
+ nothingFoundMessage: "Nessuna categoria trovata",
8615
+ error: !reportFullIdentifier.trim() && 'Campo obbligatorio'
8616
+ }), jsx(Textarea, {
8617
+ label: "Descrizione",
8618
+ placeholder: "Descrizione della regola (opzionale)",
8619
+ value: description,
8620
+ onChange: e => setDescription(e.currentTarget.value),
8621
+ disabled: loading || !isCategorySelected,
8622
+ rows: 2
8623
+ }), jsx(NumberInput, {
8624
+ label: "Priorit\u00E0",
8625
+ description: "Le regole con priorit\u00E0 pi\u00F9 alta vengono applicate per prime",
8626
+ value: priority,
8627
+ onChange: value => setPriority(typeof value === 'number' ? value : 10),
8628
+ disabled: loading || !isCategorySelected,
8629
+ min: 0,
8630
+ max: 999
8631
+ }), jsx(MultiSelect, {
8632
+ label: "Report",
8633
+ description: reportFullIdentifier.trim() ? "Seleziona uno o più report" : "Seleziona prima una categoria per caricare i report",
8634
+ placeholder: loadingReports ? "Caricamento..." : "Seleziona report",
8635
+ data: availableReports,
8636
+ value: reportIds,
8637
+ onChange: setReportIds,
8638
+ disabled: loading || !isCategorySelected || loadingReports,
8639
+ searchable: true,
8640
+ nothingFoundMessage: "Nessun report trovato",
8641
+ required: true,
8642
+ error: isCategorySelected && reportIds.length === 0 ? 'Seleziona almeno un report' : undefined
8643
+ }), jsx(MultiSelect, {
8644
+ label: "Stampanti Virtuali (opzionale)",
8645
+ description: "Seleziona le stampanti virtuali disponibili (lascia vuoto per tutte)",
8646
+ placeholder: loadingPrinters ? "Caricamento..." : "Seleziona stampanti",
8647
+ data: availablePrinters,
8648
+ value: virtualPrinterIds,
8649
+ onChange: setVirtualPrinterIds,
8650
+ disabled: loading || !isCategorySelected || loadingPrinters,
8651
+ searchable: true,
8652
+ nothingFoundMessage: "Nessuna stampante trovata"
8653
+ }), jsx(PrintRuleConditionEditor, {
8654
+ reportFullIdentifier: reportFullIdentifier,
8655
+ value: condition,
8656
+ onChange: setCondition,
8657
+ disabled: loading || !isCategorySelected,
8658
+ onSupportsConditionsChange: handleSupportsConditionsChange
8659
+ }), jsxs(Group, {
8660
+ justify: "flex-end",
8661
+ mt: "md",
8662
+ children: [jsx(Button, {
8663
+ variant: "default",
8664
+ onClick: props.onCancel,
8665
+ leftSection: jsx(IconX, {
8666
+ size: 16
8667
+ }),
8668
+ disabled: loading,
8669
+ children: "Annulla"
8670
+ }), jsx(Button, {
8671
+ onClick: handleSubmit,
8672
+ leftSection: jsx(IconCheck, {
8673
+ size: 16
8674
+ }),
8675
+ loading: loading,
8676
+ disabled: !isCategorySelected || reportIds.length === 0,
8677
+ children: props.mode === 'create' ? 'Crea regola' : 'Salva modifiche'
8678
+ })]
8679
+ })]
8567
8680
  });
8568
- return result;
8569
- };
8570
-
8571
- var $ = _export;
8572
- var union = setUnion;
8573
- var setMethodAcceptSetLike = setMethodAcceptSetLike$7;
8574
-
8575
- // `Set.prototype.union` method
8576
- // https://github.com/tc39/proposal-set-methods
8577
- $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('union') }, {
8578
- union: union
8579
- });
8681
+ }
8580
8682
 
8581
8683
  function getUserDisplayName(user) {
8582
8684
  var _a, _b, _c, _d, _e, _f, _g;