@gudhub/core 1.1.66 → 1.1.67

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.
@@ -9,7 +9,7 @@ export default class AppsTemplateService {
9
9
  }
10
10
  }
11
11
 
12
- createAppsFromTemplate(pack, maxNumberOfInsstalledItems, progressCallback) {
12
+ createAppsFromTemplate(pack, maxNumberOfInsstalledItems, progressCallback, installFromMaster) {
13
13
  const self = this;
14
14
  return new Promise(resolve => {
15
15
  const stepsCount = pack.apps.length * 6;
@@ -21,7 +21,7 @@ export default class AppsTemplateService {
21
21
  percent: currentStep * stepPercents,
22
22
  status
23
23
  }) : null;
24
- }).then(success => {
24
+ }, installFromMaster).then(success => {
25
25
  self.createItems(success, maxNumberOfInsstalledItems, (status) => {
26
26
  if (typeof status === 'string') {
27
27
  currentStep += 1;
@@ -36,41 +36,53 @@ export default class AppsTemplateService {
36
36
  }) : null;
37
37
  resolve();
38
38
  }
39
- })
39
+ }, installFromMaster)
40
40
  })
41
41
  });
42
42
  }
43
43
 
44
- createItems(create_apps, maxNumberOfInsstalledItems, callback) {
45
- return new Promise(resolve => {
44
+ createItems(create_apps, maxNumberOfInsstalledItems, callback, installFromMaster) {
45
+ return new Promise(async (resolve) => {
46
46
  const MAX_NUMBER_OF_INSTALLED_ITEMS = maxNumberOfInsstalledItems ? maxNumberOfInsstalledItems : 100000;
47
47
  const self = this;
48
48
  let createsItems = [];
49
49
  let promises = [];
50
50
 
51
+ const { accesstoken } = await self.gudhub.req.axiosRequest({
52
+ method: 'POST',
53
+ url: 'https://gudhub.com/GudHub_Test/auth/login',
54
+ form: {
55
+ auth_key: '3HMOtCbC0M/1/1e4y4Uxo/Kh/aFN4V5LG2//5ixx7TZyiUfMb7IHAAHCj9PsLrOSDrZuuWkbX4BIX23f51H+eA=='
56
+ }
57
+ });
58
+
51
59
  create_apps.forEach(app => {
52
- promises.push(new Promise(app_resolve => {
53
- self.gudhub.getApp(self._searchOldAppId(app.app_id, self.appsConnectingMap.apps)).then(result_app => {
54
- callback ? callback.call(this, `GET APP: ${result_app.app_name} (Items steps)`) : null;
55
- let source_app = JSON.parse(JSON.stringify(result_app));
56
- let items = source_app.items_list.map(item => {
57
- return {
58
- index_number: item.index_number,
59
- item_id: 0,
60
- fields: []
61
- }
62
- }).filter((item, index) => index <= MAX_NUMBER_OF_INSTALLED_ITEMS);
63
- self.gudhub.addNewItems(app.app_id, items).then(items => {
64
- callback ? callback.call(this, `ADD NEW ITEMS: ${result_app.app_name} (Items steps)`) : null;
60
+ promises.push(new Promise(async (app_resolve) => {
61
+ let result_app;
62
+ if(installFromMaster) {
63
+ result_app = await self.gudhub.req.axiosRequest({ url: `https://gudhub.com/GudHub_Test/api/app/get?token=${accesstoken}&app_id=${self._searchOldAppId(app.app_id, self.appsConnectingMap.apps)}`, method: 'GET' });
64
+ } else {
65
+ result_app = await self.gudhub.getApp(self._searchOldAppId(app.app_id, self.appsConnectingMap.apps));
66
+ }
67
+ callback ? callback.call(this, `GET APP: ${result_app.app_name} (Items steps)`) : null;
68
+ let source_app = JSON.parse(JSON.stringify(result_app));
69
+ let items = source_app.items_list.map(item => {
70
+ return {
71
+ index_number: item.index_number,
72
+ item_id: 0,
73
+ fields: []
74
+ }
75
+ }).filter((item, index) => index <= MAX_NUMBER_OF_INSTALLED_ITEMS);
76
+ self.gudhub.addNewItems(app.app_id, items).then(items => {
77
+ callback ? callback.call(this, `ADD NEW ITEMS: ${result_app.app_name} (Items steps)`) : null;
65
78
 
66
- app.items_list = items;
67
- self._updateMap(app.items_list, source_app.items_list);
68
- self._addFieldValue(source_app.items_list, app.items_list, self.appsConnectingMap);
79
+ app.items_list = items;
80
+ self._updateMap(app.items_list, source_app.items_list);
81
+ self._addFieldValue(source_app.items_list, app.items_list, self.appsConnectingMap);
69
82
 
70
- createsItems.push(app);
83
+ createsItems.push(app);
71
84
 
72
- app_resolve();
73
- });
85
+ app_resolve();
74
86
  });
75
87
  }));
76
88
  });
@@ -282,7 +294,7 @@ export default class AppsTemplateService {
282
294
  return findId;
283
295
  }
284
296
 
285
- createApps(pack, callback) {
297
+ createApps(pack, callback, installFromMaster) {
286
298
  const self = this;
287
299
 
288
300
  let progress = {
@@ -290,53 +302,67 @@ export default class AppsTemplateService {
290
302
  apps: []
291
303
  }
292
304
 
293
- return new Promise(resolve => {
305
+ return new Promise(async (resolve) => {
294
306
  let source_apps = {};
295
307
  let created_apps = [];
296
308
  let updated_apps = [];
297
309
 
298
- pack.apps.forEach(app_id => {
299
- self.gudhub.getApp(app_id).then(result_app => {
300
- callback ? callback.call(this, `GET APP: ${result_app.app_name} (App steps)`) : null;
301
- let source_app = JSON.parse(JSON.stringify(result_app));
302
- source_apps[source_app.app_id] = source_app;
303
- progress.apps.push(source_app.icon);
304
-
305
- let appTemplate = self.prepareAppTemplate(source_app);
306
- appTemplate.app_name = appTemplate.app_name + ' New';
307
- appTemplate.privacy = 1;
308
- if(pack.data_to_change) {
309
- if(pack.data_to_change.name) {
310
- appTemplate.app_name = pack.data_to_change.name;
311
- }
312
- if(pack.data_to_change.icon) {
313
- appTemplate.icon = pack.data_to_change.icon;
314
- }
310
+ const { accesstoken } = await self.gudhub.req.axiosRequest({
311
+ method: 'POST',
312
+ url: 'https://gudhub.com/GudHub_Test/auth/login',
313
+ form: {
314
+ auth_key: '3HMOtCbC0M/1/1e4y4Uxo/Kh/aFN4V5LG2//5ixx7TZyiUfMb7IHAAHCj9PsLrOSDrZuuWkbX4BIX23f51H+eA=='
315
+ }
316
+ });
317
+
318
+ for(const app_id of pack.apps) {
319
+ let result_app;
320
+
321
+ if(installFromMaster) {
322
+ result_app = await self.gudhub.req.axiosRequest({ url: `https://gudhub.com/GudHub_Test/api/app/get?token=${accesstoken}&app_id=${app_id}`, method: 'GET' });
323
+ } else {
324
+ result_app = await self.gudhub.getApp(app_id);
325
+ }
326
+
327
+ callback ? callback.call(this, `GET APP: ${result_app.app_name} (App steps)`) : null;
328
+ let source_app = JSON.parse(JSON.stringify(result_app));
329
+ source_apps[source_app.app_id] = source_app;
330
+ progress.apps.push(source_app.icon);
331
+
332
+ let appTemplate = self.prepareAppTemplate(source_app);
333
+ appTemplate.app_name = appTemplate.app_name + ' New';
334
+ appTemplate.privacy = 1;
335
+ if(pack.data_to_change) {
336
+ if(pack.data_to_change.name) {
337
+ appTemplate.app_name = pack.data_to_change.name;
338
+ }
339
+ if(pack.data_to_change.icon) {
340
+ appTemplate.icon = pack.data_to_change.icon;
315
341
  }
316
- self.resetViewsIds(appTemplate);
342
+ }
343
+ self.resetViewsIds(appTemplate);
317
344
 
318
- self.gudhub.createNewApp(appTemplate).then(created_app => {
319
- callback ? callback.call(this, `CREATE NEW APP: ${result_app.app_name} (App steps)`) : null;
320
- created_apps.push(created_app);
321
- self.mapApp(source_app, created_app, self.appsConnectingMap);
345
+ self.gudhub.createNewApp(appTemplate).then(created_app => {
346
+ callback ? callback.call(this, `CREATE NEW APP: ${result_app.app_name} (App steps)`) : null;
347
+ created_apps.push(created_app);
348
+ self.mapApp(source_app, created_app, self.appsConnectingMap);
322
349
 
323
- if (pack.apps.length == created_apps.length) {
324
- self.connectApps(created_apps, self.appsConnectingMap, source_apps);
350
+ if (pack.apps.length == created_apps.length) {
351
+ self.connectApps(created_apps, self.appsConnectingMap, source_apps);
325
352
 
326
- created_apps.forEach(created_app => {
327
- self.gudhub.updateApp(created_app).then(updated_app => {
328
- callback ? callback.call(this, `UPDATE APP: ${result_app.app_name} (App steps)`) : null;
329
- updated_apps.push(updated_app);
353
+ created_apps.forEach(created_app => {
354
+ self.gudhub.updateApp(created_app).then(updated_app => {
355
+ callback ? callback.call(this, `UPDATE APP: ${result_app.app_name} (App steps)`) : null;
356
+ updated_apps.push(updated_app);
330
357
 
331
- if (pack.apps.length == updated_apps.length) {
332
- resolve(updated_apps);
333
- }
334
- })
358
+ if (pack.apps.length == updated_apps.length) {
359
+ resolve(updated_apps);
360
+ }
335
361
  })
336
- }
337
- });
338
- })
339
- })
362
+ })
363
+ }
364
+ });
365
+ }
340
366
  });
341
367
  }
342
368
 
@@ -180,8 +180,8 @@ export class Utils {
180
180
  return this.FileHelper.fileInstallerHelper(appId, items, elementId);
181
181
  }
182
182
 
183
- createAppsFromTemplate(pack, maxNumberOfInsstalledItems, progressCallback) {
184
- return this.AppsTemplateService.createAppsFromTemplate(pack, maxNumberOfInsstalledItems, progressCallback);
183
+ createAppsFromTemplate(pack, maxNumberOfInsstalledItems, progressCallback, installFromMaster) {
184
+ return this.AppsTemplateService.createAppsFromTemplate(pack, maxNumberOfInsstalledItems, progressCallback, installFromMaster);
185
185
  }
186
186
 
187
187
  createApps(pack) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gudhub/core",
3
- "version": "1.1.66",
3
+ "version": "1.1.67",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -171,7 +171,7 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
171
171
  },{}],"nKaW":[function(require,module,exports) {
172
172
  "use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function r(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function e(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach(function(r){f(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function n(t){return u(t)||a(t)||o(t)||i()}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(t,r){if(t){if("string"==typeof t)return c(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?c(t,r):void 0}}function a(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function u(t){if(Array.isArray(t))return c(t)}function c(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function s(){s=function(){return r};var r={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(N){f=function(t,r,e){return t[r]=e}}function l(t,r,e,n){var o=r&&r.prototype instanceof d?r:d,a=Object.create(o.prototype),u=new E(n||[]);return i(a,"_invoke",{value:O(t,e,u)}),a}function p(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(N){return{type:"throw",arg:N}}}r.wrap=l;var h={};function d(){}function y(){}function v(){}var b={};f(b,a,function(){return this});var m=Object.getPrototypeOf,g=m&&m(m(S([])));g&&g!==e&&n.call(g,a)&&(b=g);var w=v.prototype=d.prototype=Object.create(b);function _(t){["next","throw","return"].forEach(function(r){f(t,r,function(t){return this._invoke(r,t)})})}function x(r,e){var o;i(this,"_invoke",{value:function(i,a){function u(){return new e(function(o,u){!function i(o,a,u,c){var s=p(r[o],r,a);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==t(l)&&n.call(l,"__await")?e.resolve(l.__await).then(function(t){i("next",t,u,c)},function(t){i("throw",t,u,c)}):e.resolve(l).then(function(t){f.value=t,u(f)},function(t){return i("throw",t,u,c)})}c(s.arg)}(i,a,o,u)})}return o=o?o.then(u,u):u()}})}function O(t,r,e){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return P()}for(e.method=i,e.arg=o;;){var a=e.delegate;if(a){var u=j(a,e);if(u){if(u===h)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var c=p(t,r,e);if("normal"===c.type){if(n=e.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n="completed",e.method="throw",e.arg=c.arg)}}}function j(t,r){var e=r.method,n=t.iterator[e];if(void 0===n)return r.delegate=null,"throw"===e&&t.iterator.return&&(r.method="return",r.arg=void 0,j(t,r),"throw"===r.method)||"return"!==e&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+e+"' method")),h;var i=p(n,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,h;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function k(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function L(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,i=function r(){for(;++e<t.length;)if(n.call(t,e))return r.value=t[e],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:P}}function P(){return{value:void 0,done:!0}}return y.prototype=v,i(w,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:y,configurable:!0}),y.displayName=f(v,c,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===y||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,f(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},r.awrap=function(t){return{__await:t}},_(x.prototype),f(x.prototype,u,function(){return this}),r.AsyncIterator=x,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var a=new x(l(t,e,n,i),o);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},_(w),f(w,c,"Generator"),f(w,a,function(){return this}),f(w,"toString",function(){return"[object Generator]"}),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=S,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function e(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=r,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),h},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),L(e),h}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var i=n.arg;L(e)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:S(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),h}},r}function f(t,r,e){return(r=l(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function l(r){var e=p(r,"string");return"symbol"===t(e)?e:String(e)}function p(r,e){if("object"!==t(r)||null===r)return r;var n=r[Symbol.toPrimitive];if(void 0!==n){var i=n.call(r,e||"default");if("object"!==t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}function h(t,r,e,n,i,o,a){try{var u=t[o](a),c=u.value}catch(s){return void e(s)}u.done?r(c):Promise.resolve(c).then(n,i)}function d(t){return function(){var r=this,e=arguments;return new Promise(function(n,i){var o=t.apply(r,e);function a(t){h(o,n,i,a,u,"next",t)}function u(t){h(o,n,i,a,u,"throw",t)}a(void 0)})}}function y(t,r,i,o,a){function u(t,r,e){return c.apply(this,arguments)}function c(){return(c=d(s().mark(function t(r,e,n){var i;return s().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=null,"array"!==r.type){t.next=13;break}if(!Number(r.is_static)){t.next=10;break}return t.t0=Array,t.next=6,v(r.childs,e,n);case 6:t.t1=t.sent,i=new t.t0(t.t1),t.next=13;break;case 10:return t.next=12,l(r,e,n);case 12:i=t.sent;case 13:if("object"!==r.type){t.next=23;break}if(!Number(r.current_item)){t.next=20;break}return t.next=17,h(r,e);case 17:i=t.sent,t.next=23;break;case 20:return t.next=22,v(r.childs,e,n);case 22:i=t.sent;case 23:if("property"!==r.type){t.next=27;break}return t.next=26,m(r,e,n);case 26:i=t.sent;case 27:return t.abrupt("return",f({},r.property_name,i));case 28:case"end":return t.stop()}},t)}))).apply(this,arguments)}function l(t,r,e){return p.apply(this,arguments)}function p(){return(p=d(s().mark(function t(r,e,o){var a,u,c,f,l;return s().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i.gudhub.getApp(Number(r.app_id));case 2:return a=t.sent,t.next=5,x(r.filter,a.items_list,o,e);case 5:return u=t.sent,r.isSortable&&r.field_id_to_sort&&""!==r.field_id_to_sort&&(c=u.flatMap(function(t){var e=t.fields.find(function(t){return t.field_id==r.field_id_to_sort});return e&&""!=e.field_value?t:[]}),f=u.filter(function(t){if(!c.includes(t))return t}),c=c.sort(function(t,e){return"desc"==r.sortType?e.fields.find(function(t){return t.field_id==r.field_id_to_sort}).field_value-t.fields.find(function(t){return t.field_id==r.field_id_to_sort}).field_value:t.fields.find(function(t){return t.field_id==r.field_id_to_sort}).field_value-e.fields.find(function(t){return t.field_id==r.field_id_to_sort}).field_value}),u=[].concat(n(c),n(f))),l=u.map(function(){var t=d(s().mark(function t(e){return s().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",v(r.childs,e,a.app_id));case 1:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}()),t.abrupt("return",Promise.all(l));case 9:case"end":return t.stop()}},t)}))).apply(this,arguments)}function h(t,r){return y.apply(this,arguments)}function y(){return(y=d(s().mark(function t(r,e){var n,o;return s().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i.gudhub.getApp(r.app_id);case 2:return n=t.sent,o=n.items_list||[],t.abrupt("return",v(r.childs,e||o[0],n.app_id));case 5:case"end":return t.stop()}},t)}))).apply(this,arguments)}function v(t,r,e){return b.apply(this,arguments)}function b(){return(b=d(s().mark(function t(r,n,i){var o,a;return s().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.map(function(){var t=d(s().mark(function t(r){return s().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",u(r,n,i));case 1:case"end":return t.stop()}},t)}));return function(r){return t.apply(this,arguments)}}());case 2:return o=t.sent,t.next=5,Promise.all(o);case 5:return a=t.sent,t.abrupt("return",a.reduce(function(t,r){return e(e({},t),r)},{}));case 7:case"end":return t.stop()}},t)}))).apply(this,arguments)}function m(t,r,e){return g.apply(this,arguments)}function g(){return(g=d(s().mark(function t(r,e,o){var a,u,c,f,l;return s().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=r.property_type,t.next="static"===t.t0?3:"variable"===t.t0?4:"field_id"===t.t0?9:"function"===t.t0?10:(t.t0,20);break;case 3:return t.abrupt("return",r.static_field_value);case 4:t.t1=r.variable_type,t.next="app_id"===t.t1?7:(t.t1,8);break;case 7:return t.abrupt("return",o);case 8:return t.abrupt("return","".concat(o,".").concat(e.item_id));case 9:return t.abrupt("return",r.field_id);case 10:if("function"!=typeof r.function){t.next=15;break}return a=r.function.apply(r,[e,o,i.gudhub].concat(n(r.args))),t.abrupt("return",a);case 15:return u=new Function("item, appId, gudhub","return (async "+r.function+")(item, appId, gudhub)"),t.next=18,u(e,o,i.gudhub);case 18:return c=t.sent,t.abrupt("return",c);case 20:if(r.field_id||!r.name_space){t.next=24;break}return t.next=23,i.gudhub.getFieldIdByNameSpace(o,r.name_space);case 23:r.field_id=t.sent;case 24:if(!Boolean(Number(r.interpretation))){t.next=31;break}return t.next=27,i.gudhub.getInterpretationById(Number(o),Number(e.item_id),Number(r.field_id),"value");case 27:return f=t.sent,t.abrupt("return",f);case 31:return t.next=33,i.gudhub.getFieldValue(Number(o),Number(e.item_id),Number(r.field_id));case 33:return l=t.sent,t.abrupt("return",l);case 35:case"end":return t.stop()}},t)}))).apply(this,arguments)}function w(t,r,e,n,i){return _.apply(this,arguments)}function _(){return(_=d(s().mark(function t(r,e,a,u,c){var f;return s().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i.gudhub.prefilter(JSON.parse(JSON.stringify(r)),e,a,u,o);case 2:return f=t.sent,t.abrupt("return",i.gudhub.filter(c,[].concat(n(f),n(r))));case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}function x(){return O.apply(this,arguments)}function O(){return(O=d(s().mark(function t(){var r,e,i,o,a=arguments;return s().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=a.length>0&&void 0!==a[0]?a[0]:[],e=a.length>1&&void 0!==a[1]?a[1]:[],i=a.length>2&&void 0!==a[2]?a[2]:"",o=a.length>3&&void 0!==a[3]?a[3]:{},t.abrupt("return",r.length?w(r,i,i,o.item_id,e):n(e));case 5:case"end":return t.stop()}},t)}))).apply(this,arguments)}return u(t,r,a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.compiler=y;
173
173
  },{}],"zqOZ":[function(require,module,exports) {
174
- "use strict";function e(e,n){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=t(e))||n&&e&&"number"==typeof e.length){i&&(e=i);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return c=e.done,e},e:function(e){u=!0,a=e},f:function(){try{c||null==i.return||i.return()}finally{if(u)throw a}}}}function t(e,t){if(e){if("string"==typeof e)return n(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function i(){i=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},c=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(I){f=function(e,t,n){return e[t]=n}}function s(e,t,n,i){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),c=new k(i||[]);return r(a,"_invoke",{value:x(e,n,c)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(I){return{type:"throw",arg:I}}}e.wrap=s;var d={};function h(){}function _(){}function v(){}var m={};f(m,c,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(L([])));g&&g!==t&&n.call(g,c)&&(m=g);var w=v.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach(function(t){f(e,t,function(e){return this._invoke(t,e)})})}function E(e,t){var i;r(this,"_invoke",{value:function(r,o){function c(){return new t(function(i,c){!function i(r,o,c,u){var l=p(e[r],e,o);if("throw"!==l.type){var f=l.arg,s=f.value;return s&&"object"==a(s)&&n.call(s,"__await")?t.resolve(s.__await).then(function(e){i("next",e,c,u)},function(e){i("throw",e,c,u)}):t.resolve(s).then(function(e){f.value=e,c(f)},function(e){return i("throw",e,c,u)})}u(l.arg)}(r,o,i,c)})}return i=i?i.then(c,c):c()}})}function x(e,t,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return j()}for(n.method=r,n.arg=o;;){var a=n.delegate;if(a){var c=O(a,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var u=p(e,t,n);if("normal"===u.type){if(i=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i="completed",n.method="throw",n.arg=u.arg)}}}function O(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,O(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var r=p(i,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function L(e){if(e){var t=e[c];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,r=function t(){for(;++i<e.length;)if(n.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:j}}function j(){return{value:void 0,done:!0}}return _.prototype=v,r(w,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:_,configurable:!0}),_.displayName=f(v,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===_||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,f(e,l,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},b(E.prototype),f(E.prototype,u,function(){return this}),e.AsyncIterator=E,e.async=function(t,n,i,r,o){void 0===o&&(o=Promise);var a=new E(s(t,n,i,r),o);return e.isGeneratorFunction(n)?a:a.next().then(function(e){return e.done?e.value:a.next()})},b(w),f(w,l,"Generator"),f(w,c,function(){return this}),f(w,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},e.values=L,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(n,i){return a.type="throw",a.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;A(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function r(e,t,n,i,r,o,a){try{var c=e[o](a),u=c.value}catch(l){return void n(l)}c.done?t(u):Promise.resolve(u).then(i,r)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(i,o){var a=e.apply(t,n);function c(e){r(a,i,o,c,u,"next",e)}function u(e){r(a,i,o,c,u,"throw",e)}c(void 0)})}}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,f(i.key),i)}}function l(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e){var t=s(e,"string");return"symbol"===a(t)?t:String(t)}function s(e,t){if("object"!==a(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==a(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var p=function(){function t(e){c(this,t),this.gudhub=e,this.appsConnectingMap={apps:[],fields:[],items:[],views:[]}}return l(t,[{key:"createAppsFromTemplate",value:function(e,t,n){var i=this,r=this;return new Promise(function(o){var c=100/(6*e.apps.length),u=0;r.createApps(e,function(e){u+=1,n&&n.call(i,{percent:u*c,status:e})}).then(function(e){r.createItems(e,t,function(e){"string"==typeof e?(u+=1,n&&n.call(i,{percent:u*c,status:e})):"object"===a(e)&&(n&&n.call(i,{status:"Done",apps:e}),o())})})})}},{key:"createItems",value:function(e,t,n){var i=this;return new Promise(function(r){var o=t||1e5,a=i,c=[],u=[];e.forEach(function(e){u.push(new Promise(function(t){a.gudhub.getApp(a._searchOldAppId(e.app_id,a.appsConnectingMap.apps)).then(function(r){n&&n.call(i,"GET APP: ".concat(r.app_name," (Items steps)"));var u=JSON.parse(JSON.stringify(r)),l=u.items_list.map(function(e){return{index_number:e.index_number,item_id:0,fields:[]}}).filter(function(e,t){return t<=o});a.gudhub.addNewItems(e.app_id,l).then(function(o){n&&n.call(i,"ADD NEW ITEMS: ".concat(r.app_name," (Items steps)")),e.items_list=o,a._updateMap(e.items_list,u.items_list),a._addFieldValue(u.items_list,e.items_list,a.appsConnectingMap),c.push(e),t()})})}))}),Promise.all(u).then(function(){c.forEach(function(e){e.items_list.forEach(function(e){e.fields.forEach(function(e){a.appsConnectingMap.fields.forEach(function(t){e.field_id===t.old_field_id&&(e.field_id=t.new_field_id,e.element_id=t.new_field_id)})})})}),a.deleteField(c),a.replaceValue(c,a.appsConnectingMap).then(function(){var e=[];c.forEach(function(t){e.push(new Promise(function(e){var r=t.items_list.map(function(e){return e.fields.forEach(function(e){delete e.data_id}),e});a.gudhub.updateItems(t.app_id,r).then(function(){n&&n.call(i,"REPLACE VALUE: ".concat(t.app_name," (Items steps)")),e()})}))}),Promise.all(e).then(function(){n.call(i,c),r()})})})})}},{key:"deleteField",value:function(e){e.forEach(function(e){e.items_list.forEach(function(t){t.fields=t.fields.filter(function(t){return e.field_list.findIndex(function(e){return e.field_id==t.field_id})>-1})})})}},{key:"replaceValue",value:function(e,t){var n=this;return new Promise(function(){var r=o(i().mark(function r(o){var a,c;return i().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:a=[],c=n,e.forEach(function(e){e.field_list.forEach(function(n){"item_ref"===n.data_type&&c._replaceValueItemRef(e,n,t),a.push(new Promise(function(t){c.gudhub.ghconstructor.getInstance(n.data_type).then(function(i){return void 0===i?(console.log("ERROR WHILE GETTING INSTANCE OF ",n.data_type),void t({type:n.data_type})):"file"==i.getTemplate().constructor?c.gudhub.util.fileInstallerHelper(e.app_id,e.items_list,n.field_id).then(function(e){t(e)}):void("document"==i.getTemplate().constructor?c.documentInstallerHelper(e.app_id,e.items_list,n.field_id).then(function(e){t(i)}):t(i))})}))})}),a.length>0?Promise.all(a).then(function(e){o(e)}):o(result);case 4:case"end":return i.stop()}},r)}));return function(e){return r.apply(this,arguments)}}())}},{key:"documentInstallerHelper",value:function(t,n,r){var a=this;return new Promise(function(){var c=o(i().mark(function o(c){var u,l,f,s,p,d,h;return i().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:u=e(n),i.prev=1,u.s();case 3:if((l=u.n()).done){i.next=18;break}if(f=l.value,s=f.item_id,!((p=f.fields.find(function(e){return e.element_id===r}))&&p.field_value&&p.field_value.length>0)){i.next=16;break}return i.next=10,a.gudhub.getDocument({_id:p.field_value});case 10:if(!(d=i.sent)||!d.data){i.next=16;break}return i.next=14,a.gudhub.createDocument({app_id:t,item_id:s,element_id:r,data:d.data});case 14:h=i.sent,p.field_value=h._id;case 16:i.next=3;break;case 18:i.next=23;break;case 20:i.prev=20,i.t0=i.catch(1),u.e(i.t0);case 23:return i.prev=23,u.f(),i.finish(23);case 26:c();case 27:case"end":return i.stop()}},o,null,[[1,20,23,26]])}));return function(e){return c.apply(this,arguments)}}())}},{key:"_replaceValueItemRef",value:function(e,t,n){e.items_list.forEach(function(e){e.fields.forEach(function(e){if(e.field_id===t.field_id&&e.field_value){var i=e.field_value.split(",");i.forEach(function(e,t){var r=e.split(".");n.apps.forEach(function(e){r[0]==e.old_app_id&&(r[0]=e.new_app_id)}),n.items.forEach(function(e){r[1]==e.old_item_id&&(r[1]=e.new_item_id)}),i[t]=r.join(".")}),e.field_value=i.join(",")}})})}},{key:"_addFieldValue",value:function(e,t,n){t.forEach(function(t){n.items.forEach(function(n){t.item_id===n.new_item_id&&e.forEach(function(e){n.old_item_id===e.item_id&&(t.fields=e.fields)})})})}},{key:"_updateMap",value:function(e,t){var n=this;t.forEach(function(t){e.forEach(function(e){t.index_number===e.index_number&&n.appsConnectingMap.items.push({old_item_id:t.item_id,new_item_id:e.item_id})})})}},{key:"_searchOldAppId",value:function(e,t){var n=0;return t.forEach(function(t){t.new_app_id===e&&(n=t.old_app_id)}),n}},{key:"createApps",value:function(e,t){var n=this,i=this,r={step_size:100/(3*e.apps.length),apps:[]};return new Promise(function(o){var a={},c=[],u=[];e.apps.forEach(function(l){i.gudhub.getApp(l).then(function(l){t&&t.call(n,"GET APP: ".concat(l.app_name," (App steps)"));var f=JSON.parse(JSON.stringify(l));a[f.app_id]=f,r.apps.push(f.icon);var s=i.prepareAppTemplate(f);s.app_name=s.app_name+" New",s.privacy=1,e.data_to_change&&(e.data_to_change.name&&(s.app_name=e.data_to_change.name),e.data_to_change.icon&&(s.icon=e.data_to_change.icon)),i.resetViewsIds(s),i.gudhub.createNewApp(s).then(function(r){t&&t.call(n,"CREATE NEW APP: ".concat(l.app_name," (App steps)")),c.push(r),i.mapApp(f,r,i.appsConnectingMap),e.apps.length==c.length&&(i.connectApps(c,i.appsConnectingMap,a),c.forEach(function(r){i.gudhub.updateApp(r).then(function(i){t&&t.call(n,"UPDATE APP: ".concat(l.app_name," (App steps)")),u.push(i),e.apps.length==u.length&&o(u)})}))})})})})}},{key:"mapApp",value:function(e,t,n){n.apps.push({old_app_id:e.app_id,new_app_id:t.app_id,old_view_init:e.view_init,new_view_init:t.view_init}),e.field_list.forEach(function(e){t.field_list.forEach(function(t){e.name_space==t.name_space&&n.fields.push({name_space:e.name_space,old_field_id:e.field_id,new_field_id:t.field_id})})}),e.views_list.forEach(function(e){t.views_list.forEach(function(t){e.name==t.name&&n.views.push({name:e.name,old_view_id:e.view_id,new_view_id:t.view_id})})})}},{key:"crawling",value:function(e,t){var n=null===e?[]:Object.keys(e),i=this;n.length>0&&n.forEach(function(n){var r=e[n];void 0!==r&&"string"!=typeof e&&(t(n,r,e),i.crawling(r,t))})}},{key:"resetViewsIds",value:function(e){e.view_init=0,this.crawling(e.views_list,function(e,t,n){"view_id"!=e&&"container_id"!=e||(n[e]=0)})}},{key:"connectApps",value:function(e,t,n){var i=this;return e.forEach(function(e){t.apps.forEach(function(n){e.view_init===n.new_view_init&&t.views.forEach(function(t){n.old_view_init===t.old_view_id&&(e.view_init=t.new_view_id)})}),i.crawling(e.field_list,function(r,o,a){if(-1!==r.indexOf("field_id")||-1!==r.indexOf("FieldId")||-1!==r.indexOf("destination_field")){var c=String(o).split(","),u=[];t.fields.forEach(function(e){c.forEach(function(t){t==e.old_field_id&&u.push(e.new_field_id)})}),u.length&&(a[r]=u.join(","))}if(-1==r.indexOf("app_id")&&-1==r.indexOf("AppId")&&-1==r.indexOf("destination_app")||t.apps.forEach(function(e){o==e.old_app_id&&(a[r]=e.new_app_id)}),-1!==r.indexOf("view_id")&&t.views.forEach(function(e){o==e.old_view_id&&(a[r]=e.new_view_id)}),-1!==r.indexOf("src")&&isFinite(o)){var l=t.apps.find(function(t){return t.new_app_id===e.app_id}).old_app_id,f=i.findPath(n[l].views_list,"container_id",o);a[r]="".concat(i.getValueByPath(e.views_list,f,"container_id"))}})}),e}},{key:"getValueByPath",value:function(e,t,n){var i=e;return t.split(".").forEach(function(e){i=i[e]}),i[n]}},{key:"findPath",value:function(e,t,n){var i=!1,r=!1,o=[];return this.crawling(e,function(e,c,u){r&&o.reverse().forEach(function(e){r&&(e.delete=!0,e.parent===u&&(r=!1,(o=o.filter(function(e){return!e.delete})).reverse()))}),i||("object"===a(u[e])&&o.push({prop:e,parent:u}),c==n&&t===e?i=!0:Object.keys(u).pop()===e&&"object"!==a(u[e])&&(r=!0))}),o.map(function(e){return e.prop}).join(".")}},{key:"prepareAppTemplate",value:function(e){var t=JSON.parse(JSON.stringify(e));return this.crawling(t.views_list,function(e,t,n){"element_id"==e&&(n.element_id=-Number(t),n.create_element=-Number(t))}),t.field_list.forEach(function(e){e.create_field=-Number(e.field_id),e.element_id=-Number(e.field_id),e.field_id=-Number(e.field_id),e.field_value=""}),t.items_list=[],delete t.app_id,delete t.icon.id,delete t.group_id,delete t.trash,delete t.last_update,delete t.file_list,t}}]),t}();exports.default=p;
174
+ "use strict";function e(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=t(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return c=e.done,e},e:function(e){u=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw a}}}}function t(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(){r=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},c=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(S){f=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var o=t&&t.prototype instanceof h?t:h,a=Object.create(o.prototype),c=new P(r||[]);return i(a,"_invoke",{value:E(e,n,c)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(S){return{type:"throw",arg:S}}}e.wrap=l;var d={};function h(){}function _(){}function v(){}var m={};f(m,c,function(){return this});var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&n.call(g,c)&&(m=g);var w=v.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach(function(t){f(e,t,function(e){return this._invoke(t,e)})})}function x(e,t){var r;i(this,"_invoke",{value:function(i,o){function c(){return new t(function(r,c){!function r(i,o,c,u){var s=p(e[i],e,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==a(l)&&n.call(l,"__await")?t.resolve(l.__await).then(function(e){r("next",e,c,u)},function(e){r("throw",e,c,u)}):t.resolve(l).then(function(e){f.value=e,c(f)},function(e){return r("throw",e,c,u)})}u(s.arg)}(i,o,r,c)})}return r=r?r.then(c,c):c()}})}function E(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return L()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function k(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=p(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function I(e){if(e){var t=e[c];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return _.prototype=v,i(w,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:_,configurable:!0}),_.displayName=f(v,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===_||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,f(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},b(x.prototype),f(x.prototype,u,function(){return this}),e.AsyncIterator=x,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new x(l(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then(function(e){return e.done?e.value:a.next()})},b(w),f(w,s,"Generator"),f(w,c,function(){return this}),f(w,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=I,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:I(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function i(e,t,n,r,i,o,a){try{var c=e[o](a),u=c.value}catch(s){return void n(s)}c.done?t(u):Promise.resolve(u).then(r,i)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function c(e){i(a,r,o,c,u,"next",e)}function u(e){i(a,r,o,c,u,"throw",e)}c(void 0)})}}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function s(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e){var t=l(e,"string");return"symbol"===a(t)?t:String(t)}function l(e,t){if("object"!==a(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var p=function(){function t(e){c(this,t),this.gudhub=e,this.appsConnectingMap={apps:[],fields:[],items:[],views:[]}}return s(t,[{key:"createAppsFromTemplate",value:function(e,t,n,r){var i=this,o=this;return new Promise(function(c){var u=100/(6*e.apps.length),s=0;o.createApps(e,function(e){s+=1,n&&n.call(i,{percent:s*u,status:e})},r).then(function(e){o.createItems(e,t,function(e){"string"==typeof e?(s+=1,n&&n.call(i,{percent:s*u,status:e})):"object"===a(e)&&(n&&n.call(i,{status:"Done",apps:e}),c())},r)})})}},{key:"createItems",value:function(e,t,n,i){var a=this;return new Promise(function(){var c=o(r().mark(function c(u){var s,f,l,p,d,h;return r().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return s=t||1e5,f=a,l=[],p=[],c.next=6,f.gudhub.req.axiosRequest({method:"POST",url:"https://gudhub.com/GudHub_Test/auth/login",form:{auth_key:"3HMOtCbC0M/1/1e4y4Uxo/Kh/aFN4V5LG2//5ixx7TZyiUfMb7IHAAHCj9PsLrOSDrZuuWkbX4BIX23f51H+eA=="}});case 6:d=c.sent,h=d.accesstoken,e.forEach(function(e){p.push(new Promise(function(){var t=o(r().mark(function t(o){var c,u,p;return r().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!i){t.next=6;break}return t.next=3,f.gudhub.req.axiosRequest({url:"https://gudhub.com/GudHub_Test/api/app/get?token=".concat(h,"&app_id=").concat(f._searchOldAppId(e.app_id,f.appsConnectingMap.apps)),method:"GET"});case 3:c=t.sent,t.next=9;break;case 6:return t.next=8,f.gudhub.getApp(f._searchOldAppId(e.app_id,f.appsConnectingMap.apps));case 8:c=t.sent;case 9:n&&n.call(a,"GET APP: ".concat(c.app_name," (Items steps)")),u=JSON.parse(JSON.stringify(c)),p=u.items_list.map(function(e){return{index_number:e.index_number,item_id:0,fields:[]}}).filter(function(e,t){return t<=s}),f.gudhub.addNewItems(e.app_id,p).then(function(t){n&&n.call(a,"ADD NEW ITEMS: ".concat(c.app_name," (Items steps)")),e.items_list=t,f._updateMap(e.items_list,u.items_list),f._addFieldValue(u.items_list,e.items_list,f.appsConnectingMap),l.push(e),o()});case 13:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()))}),Promise.all(p).then(function(){l.forEach(function(e){e.items_list.forEach(function(e){e.fields.forEach(function(e){f.appsConnectingMap.fields.forEach(function(t){e.field_id===t.old_field_id&&(e.field_id=t.new_field_id,e.element_id=t.new_field_id)})})})}),f.deleteField(l),f.replaceValue(l,f.appsConnectingMap).then(function(){var e=[];l.forEach(function(t){e.push(new Promise(function(e){var r=t.items_list.map(function(e){return e.fields.forEach(function(e){delete e.data_id}),e});f.gudhub.updateItems(t.app_id,r).then(function(){n&&n.call(a,"REPLACE VALUE: ".concat(t.app_name," (Items steps)")),e()})}))}),Promise.all(e).then(function(){n.call(a,l),u()})})});case 10:case"end":return c.stop()}},c)}));return function(e){return c.apply(this,arguments)}}())}},{key:"deleteField",value:function(e){e.forEach(function(e){e.items_list.forEach(function(t){t.fields=t.fields.filter(function(t){return e.field_list.findIndex(function(e){return e.field_id==t.field_id})>-1})})})}},{key:"replaceValue",value:function(e,t){var n=this;return new Promise(function(){var i=o(r().mark(function i(o){var a,c;return r().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:a=[],c=n,e.forEach(function(e){e.field_list.forEach(function(n){"item_ref"===n.data_type&&c._replaceValueItemRef(e,n,t),a.push(new Promise(function(t){c.gudhub.ghconstructor.getInstance(n.data_type).then(function(r){return void 0===r?(console.log("ERROR WHILE GETTING INSTANCE OF ",n.data_type),void t({type:n.data_type})):"file"==r.getTemplate().constructor?c.gudhub.util.fileInstallerHelper(e.app_id,e.items_list,n.field_id).then(function(e){t(e)}):void("document"==r.getTemplate().constructor?c.documentInstallerHelper(e.app_id,e.items_list,n.field_id).then(function(e){t(r)}):t(r))})}))})}),a.length>0?Promise.all(a).then(function(e){o(e)}):o(result);case 4:case"end":return r.stop()}},i)}));return function(e){return i.apply(this,arguments)}}())}},{key:"documentInstallerHelper",value:function(t,n,i){var a=this;return new Promise(function(){var c=o(r().mark(function o(c){var u,s,f,l,p,d,h;return r().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:u=e(n),r.prev=1,u.s();case 3:if((s=u.n()).done){r.next=18;break}if(f=s.value,l=f.item_id,!((p=f.fields.find(function(e){return e.element_id===i}))&&p.field_value&&p.field_value.length>0)){r.next=16;break}return r.next=10,a.gudhub.getDocument({_id:p.field_value});case 10:if(!(d=r.sent)||!d.data){r.next=16;break}return r.next=14,a.gudhub.createDocument({app_id:t,item_id:l,element_id:i,data:d.data});case 14:h=r.sent,p.field_value=h._id;case 16:r.next=3;break;case 18:r.next=23;break;case 20:r.prev=20,r.t0=r.catch(1),u.e(r.t0);case 23:return r.prev=23,u.f(),r.finish(23);case 26:c();case 27:case"end":return r.stop()}},o,null,[[1,20,23,26]])}));return function(e){return c.apply(this,arguments)}}())}},{key:"_replaceValueItemRef",value:function(e,t,n){e.items_list.forEach(function(e){e.fields.forEach(function(e){if(e.field_id===t.field_id&&e.field_value){var r=e.field_value.split(",");r.forEach(function(e,t){var i=e.split(".");n.apps.forEach(function(e){i[0]==e.old_app_id&&(i[0]=e.new_app_id)}),n.items.forEach(function(e){i[1]==e.old_item_id&&(i[1]=e.new_item_id)}),r[t]=i.join(".")}),e.field_value=r.join(",")}})})}},{key:"_addFieldValue",value:function(e,t,n){t.forEach(function(t){n.items.forEach(function(n){t.item_id===n.new_item_id&&e.forEach(function(e){n.old_item_id===e.item_id&&(t.fields=e.fields)})})})}},{key:"_updateMap",value:function(e,t){var n=this;t.forEach(function(t){e.forEach(function(e){t.index_number===e.index_number&&n.appsConnectingMap.items.push({old_item_id:t.item_id,new_item_id:e.item_id})})})}},{key:"_searchOldAppId",value:function(e,t){var n=0;return t.forEach(function(t){t.new_app_id===e&&(n=t.old_app_id)}),n}},{key:"createApps",value:function(t,n,i){var a=this,c=this,u={step_size:100/(3*t.apps.length),apps:[]};return new Promise(function(){var s=o(r().mark(function o(s){var f,l,p,d,h,_,v,m;return r().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return f={},l=[],p=[],o.next=5,c.gudhub.req.axiosRequest({method:"POST",url:"https://gudhub.com/GudHub_Test/auth/login",form:{auth_key:"3HMOtCbC0M/1/1e4y4Uxo/Kh/aFN4V5LG2//5ixx7TZyiUfMb7IHAAHCj9PsLrOSDrZuuWkbX4BIX23f51H+eA=="}});case 5:d=o.sent,h=d.accesstoken,_=e(t.apps),o.prev=8,m=r().mark(function e(){var o,d,_,m;return r().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=v.value,!i){e.next=7;break}return e.next=4,c.gudhub.req.axiosRequest({url:"https://gudhub.com/GudHub_Test/api/app/get?token=".concat(h,"&app_id=").concat(o),method:"GET"});case 4:d=e.sent,e.next=10;break;case 7:return e.next=9,c.gudhub.getApp(o);case 9:d=e.sent;case 10:n&&n.call(a,"GET APP: ".concat(d.app_name," (App steps)")),_=JSON.parse(JSON.stringify(d)),f[_.app_id]=_,u.apps.push(_.icon),(m=c.prepareAppTemplate(_)).app_name=m.app_name+" New",m.privacy=1,t.data_to_change&&(t.data_to_change.name&&(m.app_name=t.data_to_change.name),t.data_to_change.icon&&(m.icon=t.data_to_change.icon)),c.resetViewsIds(m),c.gudhub.createNewApp(m).then(function(e){n&&n.call(a,"CREATE NEW APP: ".concat(d.app_name," (App steps)")),l.push(e),c.mapApp(_,e,c.appsConnectingMap),t.apps.length==l.length&&(c.connectApps(l,c.appsConnectingMap,f),l.forEach(function(e){c.gudhub.updateApp(e).then(function(e){n&&n.call(a,"UPDATE APP: ".concat(d.app_name," (App steps)")),p.push(e),t.apps.length==p.length&&s(p)})}))});case 20:case"end":return e.stop()}},e)}),_.s();case 11:if((v=_.n()).done){o.next=15;break}return o.delegateYield(m(),"t0",13);case 13:o.next=11;break;case 15:o.next=20;break;case 17:o.prev=17,o.t1=o.catch(8),_.e(o.t1);case 20:return o.prev=20,_.f(),o.finish(20);case 23:case"end":return o.stop()}},o,null,[[8,17,20,23]])}));return function(e){return s.apply(this,arguments)}}())}},{key:"mapApp",value:function(e,t,n){n.apps.push({old_app_id:e.app_id,new_app_id:t.app_id,old_view_init:e.view_init,new_view_init:t.view_init}),e.field_list.forEach(function(e){t.field_list.forEach(function(t){e.name_space==t.name_space&&n.fields.push({name_space:e.name_space,old_field_id:e.field_id,new_field_id:t.field_id})})}),e.views_list.forEach(function(e){t.views_list.forEach(function(t){e.name==t.name&&n.views.push({name:e.name,old_view_id:e.view_id,new_view_id:t.view_id})})})}},{key:"crawling",value:function(e,t){var n=null===e?[]:Object.keys(e),r=this;n.length>0&&n.forEach(function(n){var i=e[n];void 0!==i&&"string"!=typeof e&&(t(n,i,e),r.crawling(i,t))})}},{key:"resetViewsIds",value:function(e){e.view_init=0,this.crawling(e.views_list,function(e,t,n){"view_id"!=e&&"container_id"!=e||(n[e]=0)})}},{key:"connectApps",value:function(e,t,n){var r=this;return e.forEach(function(e){t.apps.forEach(function(n){e.view_init===n.new_view_init&&t.views.forEach(function(t){n.old_view_init===t.old_view_id&&(e.view_init=t.new_view_id)})}),r.crawling(e.field_list,function(i,o,a){if(-1!==i.indexOf("field_id")||-1!==i.indexOf("FieldId")||-1!==i.indexOf("destination_field")){var c=String(o).split(","),u=[];t.fields.forEach(function(e){c.forEach(function(t){t==e.old_field_id&&u.push(e.new_field_id)})}),u.length&&(a[i]=u.join(","))}if(-1==i.indexOf("app_id")&&-1==i.indexOf("AppId")&&-1==i.indexOf("destination_app")||t.apps.forEach(function(e){o==e.old_app_id&&(a[i]=e.new_app_id)}),-1!==i.indexOf("view_id")&&t.views.forEach(function(e){o==e.old_view_id&&(a[i]=e.new_view_id)}),-1!==i.indexOf("src")&&isFinite(o)){var s=t.apps.find(function(t){return t.new_app_id===e.app_id}).old_app_id,f=r.findPath(n[s].views_list,"container_id",o);a[i]="".concat(r.getValueByPath(e.views_list,f,"container_id"))}})}),e}},{key:"getValueByPath",value:function(e,t,n){var r=e;return t.split(".").forEach(function(e){r=r[e]}),r[n]}},{key:"findPath",value:function(e,t,n){var r=!1,i=!1,o=[];return this.crawling(e,function(e,c,u){i&&o.reverse().forEach(function(e){i&&(e.delete=!0,e.parent===u&&(i=!1,(o=o.filter(function(e){return!e.delete})).reverse()))}),r||("object"===a(u[e])&&o.push({prop:e,parent:u}),c==n&&t===e?r=!0:Object.keys(u).pop()===e&&"object"!==a(u[e])&&(i=!0))}),o.map(function(e){return e.prop}).join(".")}},{key:"prepareAppTemplate",value:function(e){var t=JSON.parse(JSON.stringify(e));return this.crawling(t.views_list,function(e,t,n){"element_id"==e&&(n.element_id=-Number(t),n.create_element=-Number(t))}),t.field_list.forEach(function(e){e.create_field=-Number(e.field_id),e.element_id=-Number(e.field_id),e.field_id=-Number(e.field_id),e.field_value=""}),t.items_list=[],delete t.app_id,delete t.icon.id,delete t.group_id,delete t.trash,delete t.last_update,delete t.file_list,t}}]),t}();exports.default=p;
175
175
  },{}],"E7yc":[function(require,module,exports) {
176
176
  "use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e){return o(e)||i(e)||r(e)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function i(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function o(e){if(Array.isArray(e))return u(e)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function a(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(t){var n=s(t,"string");return"symbol"===e(n)?n:String(n)}function s(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,n||"default");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileHelper=void 0;var p=function(){function e(t){l(this,e),this.gudhub=t}return a(e,[{key:"fileInstallerHelper",value:function(e,n,r){var i=this;return new Promise(function(o){var u=[[]],l=Promise.resolve(),f=[];n.forEach(function(t){var n=t.item_id,i=t.fields.find(function(e){return e.element_id===r});i&&i.field_value&&i.field_value.split(".").forEach(function(t){var i={source:t,destination:{app_id:e,item_id:n,element_id:r}};10!==u[u.length-1].length?u[u.length-1].push(i):u.push([i])})}),u.forEach(function(e){l=l.then(function(){return i.gudhub.duplicateFile(e)}).then(function(e){f=[].concat(t(f),t(e))})}),l.then(function(){n.forEach(function(e){var t=e.item_id,n=e.fields.find(function(e){return e.element_id===r});n&&n.field_value&&(n.field_value="",f.forEach(function(e){e.item_id===t&&(n.field_value=n.field_value.split(",").filter(function(e){return e}).concat(e.file_id).join(","))}))}),o()})})}}]),e}();exports.FileHelper=p;
177
177
  },{}],"AefJ":[function(require,module,exports) {
@@ -179,7 +179,7 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
179
179
  },{}],"ndUf":[function(require,module,exports) {
180
180
  "use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function r(){r=function(){return e};var e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(A){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof y?r:y,a=Object.create(o.prototype),c=new _(n||[]);return i(a,"_invoke",{value:E(t,e,c)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(A){return{type:"throw",arg:A}}}e.wrap=s;var p={};function y(){}function v(){}function d(){}var m={};l(m,c,function(){return this});var g=Object.getPrototypeOf,b=g&&g(g(k([])));b&&b!==n&&o.call(b,c)&&(m=b);var w=d.prototype=y.prototype=Object.create(m);function x(t){["next","throw","return"].forEach(function(r){l(t,r,function(t){return this._invoke(r,t)})})}function L(r,e){var n;i(this,"_invoke",{value:function(i,a){function c(){return new e(function(n,c){!function n(i,a,c,u){var f=h(r[i],r,a);if("throw"!==f.type){var l=f.arg,s=l.value;return s&&"object"==t(s)&&o.call(s,"__await")?e.resolve(s.__await).then(function(t){n("next",t,c,u)},function(t){n("throw",t,c,u)}):e.resolve(s).then(function(t){l.value=t,c(l)},function(t){return n("throw",t,c,u)})}u(f.arg)}(i,a,n,c)})}return n=n?n.then(c,c):c()}})}function E(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return P()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=j(a,e);if(c){if(c===p)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=h(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}function j(t,r){var e=r.method,n=t.iterator[e];if(void 0===n)return r.delegate=null,"throw"===e&&t.iterator.return&&(r.method="return",r.arg=void 0,j(t,r),"throw"===r.method)||"return"!==e&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var o=h(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function S(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function k(t){if(t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,n=function r(){for(;++e<t.length;)if(o.call(t,e))return r.value=t[e],r.done=!1,r;return r.value=void 0,r.done=!0,r};return n.next=n}}return{next:P}}function P(){return{value:void 0,done:!0}}return v.prototype=d,i(w,"constructor",{value:d,configurable:!0}),i(d,"constructor",{value:v,configurable:!0}),v.displayName=l(d,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,l(t,f,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},x(L.prototype),l(L.prototype,u,function(){return this}),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},x(w),l(w,f,"Generator"),l(w,c,function(){return this}),l(w,"toString",function(){return"[object Generator]"}),e.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=k,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function e(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),p},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),S(e),p}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;S(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:k(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),p}},e}function e(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=n(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return c=t.done,t},e:function(t){u=!0,a=t},f:function(){try{c||null==e.return||e.return()}finally{if(u)throw a}}}}function n(t,r){if(t){if("string"==typeof t)return o(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?o(t,r):void 0}}function o(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function i(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(f){return void e(f)}c.done?r(u):Promise.resolve(u).then(n,o)}function a(t){return function(){var r=this,e=arguments;return new Promise(function(n,o){var a=t.apply(r,e);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)})}}function c(t){return u.apply(this,arguments)}function u(){return(u=a(r().mark(function t(n){var o,i,a,u,l;return r().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(n);case 2:o=!0,i=e(n),t.prev=4,i.s();case 6:if((a=i.n()).done){t.next=19;break}return u=a.value,t.next=10,f(u);case 10:if("pending"!==(l=t.sent).state){t.next=14;break}return o=!1,t.abrupt("break",19);case 14:if("rejected"!==l.state){t.next=17;break}throw l.reason;case 17:t.next=6;break;case 19:t.next=24;break;case 21:t.prev=21,t.t0=t.catch(4),i.e(t.t0);case 24:return t.prev=24,i.f(),t.finish(24);case 27:if(!o){t.next=29;break}return t.abrupt("return",!0);case 29:return t.abrupt("return",c(n));case 30:case"end":return t.stop()}},t,null,[[4,21,24,27]])}))).apply(this,arguments)}function f(t){var r={state:"pending"};return Promise.race([t,r]).then(function(t){return t===r?t:{state:"resolved",value:t}},function(t){return{state:"rejected",reason:t}})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.dynamicPromiseAll=c;
181
181
  },{}],"mWlG":[function(require,module,exports) {
182
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Utils=void 0;var e=require("./filter/filterPreparation.js"),t=w(require("./filter/filter.js")),r=require("./json_to_items/json_to_items.js"),n=require("./merge_compare_items/merge_compare_items.js"),i=require("./filter/group.js"),o=require("./filter/utils.js"),a=w(require("./populate_items/populate_items.js")),u=require("./get_date/get_date.js"),c=require("./merge_objects/merge_objects.js"),s=require("./merge_chunks/merge_chunks.js"),l=require("./nested_list/nested_list.js"),f=w(require("./MergeFields/MergeFields.js")),p=w(require("./ItemsSelection/ItemsSelection.js")),h=require("./compare_items_lists_worker/compare_items_lists.worker.js"),m=require("./json_constructor/json_constructor.js"),v=w(require("./AppsTemplateService/AppsTemplateService.js")),y=require("./FIleHelper/FileHelper.js"),d=require("./compareObjects/compareObjects.js"),g=require("./dynamicPromiseAll/dynamicPromiseAll.js");function w(e){return e&&e.__esModule?e:{default:e}}function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(){j=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(F){c=function(e,t,r){return e[t]=r}}function s(e,t,r,i){var o=t&&t.prototype instanceof p?t:p,a=Object.create(o.prototype),u=new x(i||[]);return n(a,"_invoke",{value:_(e,r,u)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(F){return{type:"throw",arg:F}}}e.wrap=s;var f={};function p(){}function h(){}function m(){}var v={};c(v,o,function(){return this});var y=Object.getPrototypeOf,d=y&&y(y(E([])));d&&d!==t&&r.call(d,o)&&(v=d);var g=m.prototype=p.prototype=Object.create(v);function w(e){["next","throw","return"].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function k(e,t){var i;n(this,"_invoke",{value:function(n,o){function a(){return new t(function(i,a){!function n(i,o,a,u){var c=l(e[i],e,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==b(f)&&r.call(f,"__await")?t.resolve(f.__await).then(function(e){n("next",e,a,u)},function(e){n("throw",e,a,u)}):t.resolve(f).then(function(e){s.value=e,a(s)},function(e){return n("throw",e,a,u)})}u(c.arg)}(n,o,i,a)})}return i=i?i.then(a,a):a()}})}function _(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var u=L(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function L(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,L(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=m,n(g,"constructor",{value:m,configurable:!0}),n(m,"constructor",{value:h,configurable:!0}),h.displayName=c(m,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},w(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new k(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},w(g),c(g,u,"Generator"),c(g,o,function(){return this}),c(g,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=E,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function k(e){return I(e)||S(e)||L(e)||_()}function _(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function L(e,t){if(e){if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(e,t):void 0}}function S(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e){if(Array.isArray(e))return x(e)}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function E(e,t,r,n,i,o,a){try{var u=e[o](a),c=u.value}catch(s){return void r(s)}u.done?t(c):Promise.resolve(c).then(n,i)}function O(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){E(o,n,i,a,u,"next",e)}function u(e){E(o,n,i,a,u,"throw",e)}a(void 0)})}}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,P(n.key),n)}}function T(e,t,r){return t&&A(e.prototype,t),r&&A(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function P(e){var t=q(e,"string");return"symbol"===b(t)?t:String(t)}function q(e,t){if("object"!==b(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var N=function(){function w(e){F(this,w),this.gudhub=e,this.MergeFields=new f.default(e),this.ItemsSelection=new p.default(e),this.AppsTemplateService=new v.default(e),this.FileHelper=new y.FileHelper(e)}return T(w,[{key:"prefilter",value:function(t,r,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return(0,e.filterPreparation)(t,r,n,i,this.gudhub.storage,this.gudhub.pipeService,o)}},{key:"filter",value:function(e,r){return(0,t.default)(e,r)}},{key:"group",value:function(e,t){return(0,i.group)(e,t)}},{key:"getFilteredItems",value:function(){var e=O(j().mark(function e(){var t,r,n,i,a,u,c,s,l,f,p,h=arguments;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]?h[0]:[],r=h.length>1&&void 0!==h[1]?h[1]:[],n=h.length>2?h[2]:void 0,i=h.length>3?h[3]:void 0,a=h.length>4?h[4]:void 0,u=h.length>5&&void 0!==h[5]?h[5]:"",c=h.length>6?h[6]:void 0,s=h.length>7?h[7]:void 0,e.next=10,this.prefilter(r,n,i,a);case 10:return l=e.sent,f=this.filter(t,[].concat(k(r),k(l))),p=this.group(u,f),e.abrupt("return",p.filter(function(e){return!c||1===(0,o.searchValue)([e],c).length}).filter(function(e){return!s||1===(0,o.searchValue)([e],s).length}));case 14:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"jsonToItems",value:function(e,t){return(0,r.jsonToItems)(e,t)}},{key:"getDate",value:function(e){return(0,u.getDate)(e)}},{key:"checkRecurringDate",value:function(e,t){return(0,u.checkRecurringDate)(e,t)}},{key:"populateItems",value:function(e,t,r){return(0,a.default)(e,t,r)}},{key:"populateWithDate",value:function(e,t){return(0,u.populateWithDate)(e,t)}},{key:"populateWithItemRef",value:function(e,t,r,i,o,a){return(0,n.populateWithItemRef)(e,t,r,i,o,a)}},{key:"compareItems",value:function(e,t,r){return(0,n.compareItems)(e,t,r)}},{key:"mergeItems",value:function(e,t,r){return(0,n.mergeItems)(e,t,r)}},{key:"mergeObjects",value:function(e,t,r){return(0,c.mergeObjects)(e,t,r)}},{key:"makeNestedList",value:function(e,t,r,n,i){return(0,l.makeNestedList)(e,t,r,n,i)}},{key:"mergeChunks",value:function(e){return(0,s.mergeChunks)(e)}},{key:"mergeFieldLists",value:function(e,t){return this.MergeFields.mergeFieldLists(e,t)}},{key:"createFieldsListToView",value:function(e,t){return this.MergeFields.createFieldsListToView(e,t)}},{key:"createFieldsListToViewWithDataType",value:function(e,t){return this.MergeFields.createFieldsListToViewWithDataType(e,t)}},{key:"selectItems",value:function(e,t){return this.ItemsSelection.selectItems(e,t)}},{key:"getSelectedItems",value:function(e){return this.ItemsSelection.getSelectedItems(e)}},{key:"clearSelectedItems",value:function(e){return this.ItemsSelection.clearSelectedItems(e)}},{key:"isItemSelected",value:function(e,t){return this.ItemsSelection.isItemSelected(e,t)}},{key:"jsonConstructor",value:function(e,t,r,n){return(0,m.compiler)(e,t,this,r,n)}},{key:"fileInstallerHelper",value:function(e,t,r){return this.FileHelper.fileInstallerHelper(e,t,r)}},{key:"createAppsFromTemplate",value:function(e,t,r){return this.AppsTemplateService.createAppsFromTemplate(e,t,r)}},{key:"createApps",value:function(e){return this.AppsTemplateService.createApps(e)}},{key:"createItems",value:function(e,t){return this.AppsTemplateService.createItems(e,t)}},{key:"compareObjects",value:function(e,t){return(0,d.compareObjects)(e,t)}},{key:"compareAppsItemsLists",value:function(e,t,r){var n=new Blob([(0,h.compare_items_lists_Worker)()],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.worker.postMessage({items_list1:e,items_list2:t}),this.worker.addEventListener("message",function(e){var t=e.data.diff;r(t)})}},{key:"dynamicPromiseAll",value:function(e){return(0,g.dynamicPromiseAll)(e)}}]),w}();exports.Utils=N;
182
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Utils=void 0;var e=require("./filter/filterPreparation.js"),t=w(require("./filter/filter.js")),r=require("./json_to_items/json_to_items.js"),n=require("./merge_compare_items/merge_compare_items.js"),i=require("./filter/group.js"),o=require("./filter/utils.js"),a=w(require("./populate_items/populate_items.js")),u=require("./get_date/get_date.js"),c=require("./merge_objects/merge_objects.js"),s=require("./merge_chunks/merge_chunks.js"),l=require("./nested_list/nested_list.js"),f=w(require("./MergeFields/MergeFields.js")),p=w(require("./ItemsSelection/ItemsSelection.js")),h=require("./compare_items_lists_worker/compare_items_lists.worker.js"),m=require("./json_constructor/json_constructor.js"),v=w(require("./AppsTemplateService/AppsTemplateService.js")),y=require("./FIleHelper/FileHelper.js"),d=require("./compareObjects/compareObjects.js"),g=require("./dynamicPromiseAll/dynamicPromiseAll.js");function w(e){return e&&e.__esModule?e:{default:e}}function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(){j=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(F){c=function(e,t,r){return e[t]=r}}function s(e,t,r,i){var o=t&&t.prototype instanceof p?t:p,a=Object.create(o.prototype),u=new x(i||[]);return n(a,"_invoke",{value:_(e,r,u)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(F){return{type:"throw",arg:F}}}e.wrap=s;var f={};function p(){}function h(){}function m(){}var v={};c(v,o,function(){return this});var y=Object.getPrototypeOf,d=y&&y(y(E([])));d&&d!==t&&r.call(d,o)&&(v=d);var g=m.prototype=p.prototype=Object.create(v);function w(e){["next","throw","return"].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function k(e,t){var i;n(this,"_invoke",{value:function(n,o){function a(){return new t(function(i,a){!function n(i,o,a,u){var c=l(e[i],e,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==b(f)&&r.call(f,"__await")?t.resolve(f.__await).then(function(e){n("next",e,a,u)},function(e){n("throw",e,a,u)}):t.resolve(f).then(function(e){s.value=e,a(s)},function(e){return n("throw",e,a,u)})}u(c.arg)}(n,o,i,a)})}return i=i?i.then(a,a):a()}})}function _(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var u=L(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function L(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,L(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=m,n(g,"constructor",{value:m,configurable:!0}),n(m,"constructor",{value:h,configurable:!0}),h.displayName=c(m,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},w(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new k(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},w(g),c(g,u,"Generator"),c(g,o,function(){return this}),c(g,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=E,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function k(e){return I(e)||S(e)||L(e)||_()}function _(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function L(e,t){if(e){if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(e,t):void 0}}function S(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e){if(Array.isArray(e))return x(e)}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function E(e,t,r,n,i,o,a){try{var u=e[o](a),c=u.value}catch(s){return void r(s)}u.done?t(c):Promise.resolve(c).then(n,i)}function O(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){E(o,n,i,a,u,"next",e)}function u(e){E(o,n,i,a,u,"throw",e)}a(void 0)})}}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,P(n.key),n)}}function T(e,t,r){return t&&A(e.prototype,t),r&&A(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function P(e){var t=q(e,"string");return"symbol"===b(t)?t:String(t)}function q(e,t){if("object"!==b(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var N=function(){function w(e){F(this,w),this.gudhub=e,this.MergeFields=new f.default(e),this.ItemsSelection=new p.default(e),this.AppsTemplateService=new v.default(e),this.FileHelper=new y.FileHelper(e)}return T(w,[{key:"prefilter",value:function(t,r,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return(0,e.filterPreparation)(t,r,n,i,this.gudhub.storage,this.gudhub.pipeService,o)}},{key:"filter",value:function(e,r){return(0,t.default)(e,r)}},{key:"group",value:function(e,t){return(0,i.group)(e,t)}},{key:"getFilteredItems",value:function(){var e=O(j().mark(function e(){var t,r,n,i,a,u,c,s,l,f,p,h=arguments;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]?h[0]:[],r=h.length>1&&void 0!==h[1]?h[1]:[],n=h.length>2?h[2]:void 0,i=h.length>3?h[3]:void 0,a=h.length>4?h[4]:void 0,u=h.length>5&&void 0!==h[5]?h[5]:"",c=h.length>6?h[6]:void 0,s=h.length>7?h[7]:void 0,e.next=10,this.prefilter(r,n,i,a);case 10:return l=e.sent,f=this.filter(t,[].concat(k(r),k(l))),p=this.group(u,f),e.abrupt("return",p.filter(function(e){return!c||1===(0,o.searchValue)([e],c).length}).filter(function(e){return!s||1===(0,o.searchValue)([e],s).length}));case 14:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"jsonToItems",value:function(e,t){return(0,r.jsonToItems)(e,t)}},{key:"getDate",value:function(e){return(0,u.getDate)(e)}},{key:"checkRecurringDate",value:function(e,t){return(0,u.checkRecurringDate)(e,t)}},{key:"populateItems",value:function(e,t,r){return(0,a.default)(e,t,r)}},{key:"populateWithDate",value:function(e,t){return(0,u.populateWithDate)(e,t)}},{key:"populateWithItemRef",value:function(e,t,r,i,o,a){return(0,n.populateWithItemRef)(e,t,r,i,o,a)}},{key:"compareItems",value:function(e,t,r){return(0,n.compareItems)(e,t,r)}},{key:"mergeItems",value:function(e,t,r){return(0,n.mergeItems)(e,t,r)}},{key:"mergeObjects",value:function(e,t,r){return(0,c.mergeObjects)(e,t,r)}},{key:"makeNestedList",value:function(e,t,r,n,i){return(0,l.makeNestedList)(e,t,r,n,i)}},{key:"mergeChunks",value:function(e){return(0,s.mergeChunks)(e)}},{key:"mergeFieldLists",value:function(e,t){return this.MergeFields.mergeFieldLists(e,t)}},{key:"createFieldsListToView",value:function(e,t){return this.MergeFields.createFieldsListToView(e,t)}},{key:"createFieldsListToViewWithDataType",value:function(e,t){return this.MergeFields.createFieldsListToViewWithDataType(e,t)}},{key:"selectItems",value:function(e,t){return this.ItemsSelection.selectItems(e,t)}},{key:"getSelectedItems",value:function(e){return this.ItemsSelection.getSelectedItems(e)}},{key:"clearSelectedItems",value:function(e){return this.ItemsSelection.clearSelectedItems(e)}},{key:"isItemSelected",value:function(e,t){return this.ItemsSelection.isItemSelected(e,t)}},{key:"jsonConstructor",value:function(e,t,r,n){return(0,m.compiler)(e,t,this,r,n)}},{key:"fileInstallerHelper",value:function(e,t,r){return this.FileHelper.fileInstallerHelper(e,t,r)}},{key:"createAppsFromTemplate",value:function(e,t,r,n){return this.AppsTemplateService.createAppsFromTemplate(e,t,r,n)}},{key:"createApps",value:function(e){return this.AppsTemplateService.createApps(e)}},{key:"createItems",value:function(e,t){return this.AppsTemplateService.createItems(e,t)}},{key:"compareObjects",value:function(e,t){return(0,d.compareObjects)(e,t)}},{key:"compareAppsItemsLists",value:function(e,t,r){var n=new Blob([(0,h.compare_items_lists_Worker)()],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.worker.postMessage({items_list1:e,items_list2:t}),this.worker.addEventListener("message",function(e){var t=e.data.diff;r(t)})}},{key:"dynamicPromiseAll",value:function(e){return(0,g.dynamicPromiseAll)(e)}}]),w}();exports.Utils=N;
183
183
  },{"./filter/filterPreparation.js":"DvAj","./filter/filter.js":"mbGN","./json_to_items/json_to_items.js":"UCDv","./merge_compare_items/merge_compare_items.js":"xDLX","./filter/group.js":"VgUi","./filter/utils.js":"zsiC","./populate_items/populate_items.js":"EzAv","./get_date/get_date.js":"VzfS","./merge_objects/merge_objects.js":"EE1j","./merge_chunks/merge_chunks.js":"AMYJ","./nested_list/nested_list.js":"S7Iy","./MergeFields/MergeFields.js":"vno1","./ItemsSelection/ItemsSelection.js":"DfIi","./compare_items_lists_worker/compare_items_lists.worker.js":"xR4c","./json_constructor/json_constructor.js":"nKaW","./AppsTemplateService/AppsTemplateService.js":"zqOZ","./FIleHelper/FileHelper.js":"E7yc","./compareObjects/compareObjects.js":"AefJ","./dynamicPromiseAll/dynamicPromiseAll.js":"ndUf"}],"rK64":[function(require,module,exports) {
184
184
  "use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(){e=function(){return r};var r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(P){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,a=Object.create(o.prototype),u=new O(n||[]);return i(a,"_invoke",{value:L(t,r,u)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(P){return{type:"throw",arg:P}}}r.wrap=h;var p={};function v(){}function y(){}function d(){}var g={};f(g,u,function(){return this});var m=Object.getPrototypeOf,w=m&&m(m(_([])));w&&w!==n&&o.call(w,u)&&(g=w);var b=d.prototype=v.prototype=Object.create(g);function x(t){["next","throw","return"].forEach(function(e){f(t,e,function(t){return this._invoke(e,t)})})}function k(e,r){var n;i(this,"_invoke",{value:function(i,a){function u(){return new r(function(n,u){!function n(i,a,u,s){var c=l(e[i],e,a);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==t(h)&&o.call(h,"__await")?r.resolve(h.__await).then(function(t){n("next",t,u,s)},function(t){n("throw",t,u,s)}):r.resolve(h).then(function(t){f.value=t,u(f)},function(t){return n("throw",t,u,s)})}s(c.arg)}(i,a,n,u)})}return n=n?n.then(u,u):u()}})}function L(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=S(a,r);if(u){if(u===p)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function S(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,S(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,p;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function U(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function _(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(o.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:j}}function j(){return{value:void 0,done:!0}}return y.prototype=d,i(b,"constructor",{value:d,configurable:!0}),i(d,"constructor",{value:y,configurable:!0}),y.displayName=f(d,c,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,f(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},r.awrap=function(t){return{__await:t}},x(k.prototype),f(k.prototype,s,function(){return this}),r.AsyncIterator=k,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new k(h(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},x(b),f(b,c,"Generator"),f(b,u,function(){return this}),f(b,"toString",function(){return"[object Generator]"}),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=_,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(U),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=o.call(i,"catchLoc"),s=o.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),U(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;U(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},r}function r(t,e,r,n,o,i,a){try{var u=t[i](a),s=u.value}catch(c){return void r(c)}u.done?e(s):Promise.resolve(s).then(n,o)}function n(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var a=t.apply(e,n);function u(t){r(a,o,i,u,s,"next",t)}function s(t){r(a,o,i,u,s,"throw",t)}u(void 0)})}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function a(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(e){var r=s(e,"string");return"symbol"===t(r)?r:String(r)}function s(e,r){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Auth=void 0;var c=function(){function t(e,r){o(this,t),this.req=e,this.storage=r}return a(t,[{key:"login",value:function(){var t=n(e().mark(function t(){var r,n,o,i,a=arguments;return e().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=a.length>0&&void 0!==a[0]?a[0]:{},n=r.username,o=r.password,t.next=3,this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/login"),form:{username:n,password:o}});case 3:return i=t.sent,this.storage.updateUser(i),t.abrupt("return",i);case 6:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"logout",value:function(t){return this.req.post({url:"/auth/logout",form:{token:t}})}},{key:"signup",value:function(t){return this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/singup"),form:{user:JSON.stringify(t)}})}},{key:"getUsersList",value:function(t){return this.req.get({url:"/auth/userlist",params:{keyword:t}})}},{key:"updateUserApi",value:function(t){return this.req.post({url:"/auth/updateuser",form:{user:JSON.stringify(t)}})}},{key:"updateToken",value:function(t){return this.req.axiosRequest({method:"POST",url:"".concat(this.req.root,"/auth/login"),form:{auth_key:t}})}},{key:"avatarUploadApi",value:function(t){return this.req.post({url:"/auth/avatar-upload",form:{image:t}})}},{key:"getUserByIdApi",value:function(t){return this.req.get({url:"/auth/getuserbyid",params:{id:t}})}},{key:"getVersion",value:function(){return this.req.get({url:"/version"})}},{key:"getUserFromStorage",value:function(t){return this.storage.getUsersList().find(function(e){return e.user_id==t})}},{key:"saveUserToStorage",value:function(t){var e=this.storage.getUsersList(),r=e.find(function(e){return e.user_id==t.user_id});return r||(e.push(t),t)}},{key:"getUserById",value:function(){var t=n(e().mark(function t(r){var n,o;return e().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.getUserFromStorage(r)){t.next=9;break}return t.next=4,this.getUserByIdApi(r);case 4:if(o=t.sent){t.next=7;break}return t.abrupt("return",null);case 7:(n=this.getUserFromStorage(r))||(this.saveUserToStorage(o),n=o);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"getToken",value:function(){var t=n(e().mark(function t(){var r,n,o,i;return e().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=new Date(this.storage.getUser().expirydate),n=new Date,o=this.storage.getUser().accesstoken,!(r<n)&&o){t.next=9;break}return t.next=6,this.updateToken(this.storage.getUser().auth_key);case 6:i=t.sent,this.storage.updateUser(i),o=i.accesstoken;case 9:return t.abrupt("return",o);case 10:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"updateUser",value:function(){var t=n(e().mark(function t(r){var n;return e().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.updateUserApi(r);case 2:return n=t.sent,this.storage.updateUser(n),t.abrupt("return",n);case 5:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"updateAvatar",value:function(){var t=n(e().mark(function t(r){var n;return e().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.avatarUploadApi(r);case 2:return n=t.sent,this.storage.updateUser(n),t.abrupt("return",n);case 5:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}]),t}();exports.Auth=c;
185
185
  },{}],"UV2u":[function(require,module,exports) {