qcobjects 2.5.104-beta → 2.5.106-beta

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.
@@ -107,11 +107,53 @@ var init_platform = __esm({
107
107
  }
108
108
  });
109
109
 
110
+ // src/make_global.ts
111
+ var __make_global__;
112
+ var init_make_global = __esm({
113
+ "src/make_global.ts"() {
114
+ "use strict";
115
+ init_platform();
116
+ init_top();
117
+ __make_global__ = /* @__PURE__ */ __name(function(f) {
118
+ if (typeof f !== "undefined") {
119
+ if (isBrowser) {
120
+ try {
121
+ _top[f.name] = f;
122
+ window[f.name] = f;
123
+ } catch (e) {
124
+ throw Error(`An error ocurred: ${e}`);
125
+ }
126
+ } else if (typeof global !== "undefined") {
127
+ if (!Object.hasOwn(global, f.name)) {
128
+ global[f.name] = f;
129
+ }
130
+ }
131
+ }
132
+ }, "__make_global__");
133
+ }
134
+ });
135
+
136
+ // src/Export.ts
137
+ var Export;
138
+ var init_Export = __esm({
139
+ "src/Export.ts"() {
140
+ "use strict";
141
+ init_make_global();
142
+ Export = /* @__PURE__ */ __name(function(f) {
143
+ return __make_global__(f);
144
+ }, "Export");
145
+ Export.prototype.toString = function() {
146
+ return "Export(function or symbol) { [QCObjects native code] }";
147
+ };
148
+ }
149
+ });
150
+
110
151
  // src/Logger.ts
111
152
  var Logger, logger;
112
153
  var init_Logger = __esm({
113
154
  "src/Logger.ts"() {
114
155
  "use strict";
156
+ init_Export();
115
157
  init_platform();
116
158
  Logger = class {
117
159
  static {
@@ -143,6 +185,7 @@ var init_Logger = __esm({
143
185
  }
144
186
  };
145
187
  logger = new Logger();
188
+ Export(logger);
146
189
  }
147
190
  });
148
191
 
@@ -165,13 +208,15 @@ var init_Cast = __esm({
165
208
  }
166
209
  return obj_dest;
167
210
  }, "_Cast");
168
- _CastProps = /* @__PURE__ */ __name(function(obj_source, obj_dest) {
211
+ _CastProps = /* @__PURE__ */ __name(function(obj_source, obj_dest, _ignoreError = true) {
169
212
  for (const v in obj_source) {
170
213
  if (typeof obj_source[v] !== "undefined" && typeof obj_source[v] !== "function") {
171
214
  try {
172
215
  obj_dest[v] = obj_source[v];
173
216
  } catch (e) {
174
- logger.debug(`An error ocurred: ${e}.`);
217
+ if (!_ignoreError) {
218
+ logger.debug(`An error ocurred: ${e}.`);
219
+ }
175
220
  }
176
221
  } else if (typeof obj_source[v] === "function") {
177
222
  try {
@@ -368,32 +413,6 @@ var init_introspection = __esm({
368
413
  }
369
414
  });
370
415
 
371
- // src/make_global.ts
372
- var __make_global__;
373
- var init_make_global = __esm({
374
- "src/make_global.ts"() {
375
- "use strict";
376
- init_platform();
377
- init_top();
378
- __make_global__ = /* @__PURE__ */ __name(function(f) {
379
- if (typeof f !== "undefined") {
380
- if (isBrowser) {
381
- try {
382
- _top[f.name] = f;
383
- window[f.name] = f;
384
- } catch (e) {
385
- throw Error(`An error ocurred: ${e}`);
386
- }
387
- } else if (typeof global !== "undefined") {
388
- if (!Object.hasOwn(global, f.name)) {
389
- global[f.name] = f;
390
- }
391
- }
392
- }
393
- }, "__make_global__");
394
- }
395
- });
396
-
397
416
  // src/RegisterClass.ts
398
417
  var __register_class__, RegisterClass;
399
418
  var init_RegisterClass = __esm({
@@ -1577,21 +1596,6 @@ var init_routings = __esm({
1577
1596
  }
1578
1597
  });
1579
1598
 
1580
- // src/Export.ts
1581
- var Export;
1582
- var init_Export = __esm({
1583
- "src/Export.ts"() {
1584
- "use strict";
1585
- init_make_global();
1586
- Export = /* @__PURE__ */ __name(function(f) {
1587
- return __make_global__(f);
1588
- }, "Export");
1589
- Export.prototype.toString = function() {
1590
- return "Export(function or symbol) { [QCObjects native code] }";
1591
- };
1592
- }
1593
- });
1594
-
1595
1599
  // src/asyncLoad.ts
1596
1600
  function asyncLoad(callback, args) {
1597
1601
  class AsyncCallback {
@@ -3454,57 +3458,316 @@ var init_ComponentFactory = __esm({
3454
3458
  }
3455
3459
  });
3456
3460
 
3457
- // src/top.ts
3458
- var _top, componentsStack, resetTop, buildComponentsStack, configService, setConfigService;
3459
- var init_top = __esm({
3460
- "src/top.ts"() {
3461
- "use strict";
3462
- init_ComponentFactory();
3463
- _top = typeof self !== "undefined" && self || typeof window !== "undefined" && window || typeof global !== "undefined" && global || void 0;
3464
- _top.lastCache = void 0;
3465
- componentsStack = [];
3466
- resetTop = /* @__PURE__ */ __name((_top_) => {
3467
- _top = _top_;
3468
- }, "resetTop");
3469
- buildComponentsStack = /* @__PURE__ */ __name(() => {
3470
- componentsStack = buildComponents(document);
3471
- }, "buildComponentsStack");
3472
- setConfigService = /* @__PURE__ */ __name((_configService) => {
3473
- _top.global.configService = _configService;
3474
- configService = _configService;
3475
- }, "setConfigService");
3476
- }
3477
- });
3478
-
3479
- // src/subelements.ts
3480
- var subelements;
3481
- var init_subelements = __esm({
3482
- "src/subelements.ts"() {
3461
+ // src/Service.ts
3462
+ var Service, JSONService, ConfigService;
3463
+ var init_Service = __esm({
3464
+ "src/Service.ts"() {
3483
3465
  "use strict";
3484
- subelements = /* @__PURE__ */ __name(function subelements2(query) {
3485
- const _self = this;
3486
- return [..._self.querySelectorAll(query)];
3487
- }, "subelements");
3466
+ init_basePath();
3467
+ init_Crypt();
3468
+ init_domain();
3469
+ init_InheritClass();
3470
+ init_Logger();
3471
+ init_Package();
3472
+ init_secretKey();
3473
+ init_CONFIG();
3474
+ Service = class extends InheritClass {
3475
+ static {
3476
+ __name(this, "Service");
3477
+ }
3478
+ options;
3479
+ withCredentials;
3480
+ useHTTP2;
3481
+ // eslint-disable-next-line no-unused-vars
3482
+ mockup({ request, service }) {
3483
+ throw new Error("Method not implemented.");
3484
+ }
3485
+ name;
3486
+ responseHeaders;
3487
+ // eslint-disable-next-line no-unused-vars
3488
+ local({ request, service }) {
3489
+ throw new Error("Method not implemented.");
3490
+ }
3491
+ kind = "rest";
3492
+ /* it can be rest, mockup, local */
3493
+ domain = _domain_;
3494
+ basePath = _basePath_;
3495
+ url = "";
3496
+ method = "GET";
3497
+ data = {};
3498
+ reload = false;
3499
+ cached = false;
3500
+ headers;
3501
+ template;
3502
+ // eslint-disable-next-line no-unused-vars
3503
+ done({ request, service }) {
3504
+ throw new Error("Method not implemented.");
3505
+ }
3506
+ // eslint-disable-next-line no-unused-vars
3507
+ fail(...args) {
3508
+ throw new Error("Method not implemented.");
3509
+ }
3510
+ set(name, value) {
3511
+ this[name] = value;
3512
+ }
3513
+ get(name, _default) {
3514
+ return this[name] || _default;
3515
+ }
3516
+ };
3517
+ JSONService = class extends Service {
3518
+ static {
3519
+ __name(this, "JSONService");
3520
+ }
3521
+ method = "GET";
3522
+ cached = false;
3523
+ headers = {
3524
+ "Content-Type": "application/json",
3525
+ "charset": "utf-8"
3526
+ };
3527
+ JSONresponse = void 0;
3528
+ done(result) {
3529
+ logger.debug("***** RECEIVED RESPONSE:");
3530
+ logger.debug(result.service.template);
3531
+ this.JSONresponse = JSON.parse(result.service.template);
3532
+ }
3533
+ };
3534
+ ConfigService = class extends JSONService {
3535
+ static {
3536
+ __name(this, "ConfigService");
3537
+ }
3538
+ method = "GET";
3539
+ cached = false;
3540
+ configFileName = "config.json";
3541
+ headers = {
3542
+ "Content-Type": "application/json",
3543
+ "charset": "utf-8"
3544
+ };
3545
+ configLoaded() {
3546
+ throw Error("Method not implemented.");
3547
+ }
3548
+ JSONresponse = void 0;
3549
+ done(result) {
3550
+ logger.debug("***** CONFIG LOADED:");
3551
+ logger.debug(result.service.template);
3552
+ this.JSONresponse = JSON.parse(result.service.template);
3553
+ if (Object.hasOwn(this.JSONresponse, "__encoded__")) {
3554
+ const decodedValue = _Crypt.decrypt(this.JSONresponse?.__encoded__, _secretKey);
3555
+ this.JSONresponse = JSON.parse(decodedValue);
3556
+ }
3557
+ const jsonResponse = this.JSONresponse;
3558
+ Object.keys(jsonResponse).map((k) => {
3559
+ CONFIG.set(k, jsonResponse[k]);
3560
+ return k;
3561
+ });
3562
+ this.configLoaded().catch((e) => {
3563
+ throw new Error(`An error ocurred: ${e}`);
3564
+ });
3565
+ }
3566
+ fail() {
3567
+ this.configLoaded().catch((e) => {
3568
+ throw new Error(`An error ocurred: ${e}`);
3569
+ });
3570
+ }
3571
+ constructor() {
3572
+ super();
3573
+ this.set("url", `${this.get("basePath")}${this.get("configFileName")}`);
3574
+ }
3575
+ };
3576
+ Package("com.qcobjects.api", [
3577
+ Service
3578
+ ]);
3579
+ Package("com.qcobjects.api.services", [
3580
+ JSONService
3581
+ ]);
3582
+ Package("com.qcobjects.api.config", [
3583
+ ConfigService
3584
+ ]);
3488
3585
  }
3489
3586
  });
3490
3587
 
3491
- // src/waitUntil.ts
3492
- var waitUntil;
3493
- var init_waitUntil = __esm({
3494
- "src/waitUntil.ts"() {
3588
+ // src/globalSettings.ts
3589
+ var GlobalSettings;
3590
+ var init_globalSettings = __esm({
3591
+ "src/globalSettings.ts"() {
3495
3592
  "use strict";
3593
+ init_CONFIG();
3594
+ init_InheritClass();
3496
3595
  init_Logger();
3497
- waitUntil = /* @__PURE__ */ __name(function(func, exp) {
3498
- const _waitUntil = /* @__PURE__ */ __name(function(func2, exp2) {
3499
- const maxWaitCycles = 2e3;
3500
- let _w = 0;
3501
- var _t = setInterval(function() {
3502
- if (exp2()) {
3503
- clearInterval(_t);
3504
- func2();
3505
- logger.debug("Ejecuting " + func2.name + " after wait");
3506
- } else {
3507
- if (_w < maxWaitCycles) {
3596
+ init_Package();
3597
+ init_platform();
3598
+ init_serviceLoader();
3599
+ init_top();
3600
+ init_Service();
3601
+ GlobalSettings = class _GlobalSettings extends InheritClass {
3602
+ static {
3603
+ __name(this, "GlobalSettings");
3604
+ }
3605
+ static __start__() {
3606
+ return _GlobalSettings.instance.__start__();
3607
+ }
3608
+ _GLOBAL = {};
3609
+ static _instance;
3610
+ static get instance() {
3611
+ if (typeof _GlobalSettings._instance === "undefined") {
3612
+ _GlobalSettings._instance = new _GlobalSettings();
3613
+ }
3614
+ return _GlobalSettings._instance;
3615
+ }
3616
+ _logger = new Logger();
3617
+ get logger() {
3618
+ return this._logger;
3619
+ }
3620
+ set logger(value) {
3621
+ this._logger = value;
3622
+ }
3623
+ set(name, value) {
3624
+ this._GLOBAL[name] = value;
3625
+ }
3626
+ get(name, _default) {
3627
+ let _value;
3628
+ if (typeof this._GLOBAL[name] !== "undefined") {
3629
+ _value = this._GLOBAL[name];
3630
+ } else if (typeof _default !== "undefined") {
3631
+ _value = _default;
3632
+ }
3633
+ return _value;
3634
+ }
3635
+ __start__() {
3636
+ const __load__serviceWorker = /* @__PURE__ */ __name(function() {
3637
+ let _promise;
3638
+ if (isBrowser) {
3639
+ _promise = new Promise(function(resolve, reject) {
3640
+ if ("serviceWorker" in navigator && typeof CONFIG.get("serviceWorkerURI") !== "undefined") {
3641
+ CONFIG.set("serviceWorkerScope", CONFIG.get("serviceWorkerScope") ? CONFIG.get("serviceWorkerScope") : "/");
3642
+ navigator.serviceWorker.register(CONFIG.get("serviceWorkerURI"), {
3643
+ scope: CONFIG.get("serviceWorkerScope")
3644
+ }).then(function(registration) {
3645
+ logger.debug("Service Worker Registered");
3646
+ resolve.call(_promise, registration);
3647
+ }, function(registration) {
3648
+ logger.debug("Error registering Service Worker");
3649
+ reject.call(_promise, registration);
3650
+ });
3651
+ navigator.serviceWorker.ready.then(function(registration) {
3652
+ logger.debug("Service Worker Ready");
3653
+ resolve.call(_promise, registration);
3654
+ }, function(registration) {
3655
+ logger.debug("Error loading Service Worker");
3656
+ reject.call(_promise, registration);
3657
+ });
3658
+ }
3659
+ });
3660
+ } else {
3661
+ _promise = Promise.resolve();
3662
+ }
3663
+ return _promise;
3664
+ }, "__load__serviceWorker");
3665
+ const _buildComponents = /* @__PURE__ */ __name(function() {
3666
+ return new Promise((resolve) => {
3667
+ if (isBrowser) {
3668
+ logger.debug("Starting to building components");
3669
+ try {
3670
+ buildComponentsStack();
3671
+ } catch (e) {
3672
+ throw Error(`Something went wrong trying to start components tree: ${e.message}`);
3673
+ }
3674
+ logger.debug("Initializing the service worker");
3675
+ __load__serviceWorker.call(_top).catch(function(e) {
3676
+ logger.debug(`error loading the service worker ${e}`);
3677
+ });
3678
+ }
3679
+ resolve();
3680
+ });
3681
+ }, "_buildComponents");
3682
+ return new Promise((resolve) => {
3683
+ logger.debug("Starting to load the config settings...");
3684
+ if (CONFIG.get("useConfigService", false)) {
3685
+ logger.debug("Loading settings using local configuration file...");
3686
+ setConfigService(new ConfigService());
3687
+ configService.configLoaded = _buildComponents;
3688
+ serviceLoader(configService)?.then((standardResponse) => {
3689
+ resolve(standardResponse);
3690
+ })?.catch((e) => {
3691
+ throw new Error(`An error ocurred while trying to load ${configService.url}: ${e}`);
3692
+ });
3693
+ } else {
3694
+ logger.debug("Starting to load the components...");
3695
+ _buildComponents.call(this).then(() => {
3696
+ resolve({});
3697
+ }).catch((e) => {
3698
+ throw new Error(`An error ocurred while trying to build the components stack. ${e}`);
3699
+ });
3700
+ }
3701
+ });
3702
+ }
3703
+ };
3704
+ Package("com.qcobjects", [
3705
+ GlobalSettings
3706
+ ]);
3707
+ }
3708
+ });
3709
+
3710
+ // src/top.ts
3711
+ var _top, componentsStack, resetTop, buildComponentsStack, configService, setConfigService, set, get;
3712
+ var init_top = __esm({
3713
+ "src/top.ts"() {
3714
+ "use strict";
3715
+ init_ComponentFactory();
3716
+ init_Cast();
3717
+ init_globalSettings();
3718
+ _top = typeof module !== "undefined" && typeof module.exports !== "undefined" && module.exports || typeof global !== "undefined" && global || typeof globalThis !== "undefined" && globalThis || typeof window !== "undefined" && window || typeof self !== "undefined" && self || void 0;
3719
+ _top.lastCache = void 0;
3720
+ componentsStack = [];
3721
+ resetTop = /* @__PURE__ */ __name(() => {
3722
+ const globalSettings = GlobalSettings.instance;
3723
+ _top = _CastProps(globalSettings, _top, true);
3724
+ }, "resetTop");
3725
+ buildComponentsStack = /* @__PURE__ */ __name(() => {
3726
+ componentsStack = buildComponents(document);
3727
+ }, "buildComponentsStack");
3728
+ setConfigService = /* @__PURE__ */ __name((_configService) => {
3729
+ _top.global.configService = _configService;
3730
+ configService = _configService;
3731
+ }, "setConfigService");
3732
+ set = /* @__PURE__ */ __name((name, value) => {
3733
+ _top[name] = value;
3734
+ }, "set");
3735
+ get = /* @__PURE__ */ __name((name, _defaultValue) => {
3736
+ return _top[name] || _defaultValue;
3737
+ }, "get");
3738
+ resetTop();
3739
+ }
3740
+ });
3741
+
3742
+ // src/subelements.ts
3743
+ var subelements;
3744
+ var init_subelements = __esm({
3745
+ "src/subelements.ts"() {
3746
+ "use strict";
3747
+ subelements = /* @__PURE__ */ __name(function subelements2(query) {
3748
+ const _self = this;
3749
+ return [..._self.querySelectorAll(query)];
3750
+ }, "subelements");
3751
+ }
3752
+ });
3753
+
3754
+ // src/waitUntil.ts
3755
+ var waitUntil;
3756
+ var init_waitUntil = __esm({
3757
+ "src/waitUntil.ts"() {
3758
+ "use strict";
3759
+ init_Logger();
3760
+ waitUntil = /* @__PURE__ */ __name(function(func, exp) {
3761
+ const _waitUntil = /* @__PURE__ */ __name(function(func2, exp2) {
3762
+ const maxWaitCycles = 2e3;
3763
+ let _w = 0;
3764
+ var _t = setInterval(function() {
3765
+ if (exp2()) {
3766
+ clearInterval(_t);
3767
+ func2();
3768
+ logger.debug("Ejecuting " + func2.name + " after wait");
3769
+ } else {
3770
+ if (_w < maxWaitCycles) {
3508
3771
  _w += 1;
3509
3772
  logger.debug("WAIT UNTIL " + func2.name + " is true, " + _w.toString() + " cycles");
3510
3773
  } else {
@@ -4175,248 +4438,6 @@ var init_Import = __esm({
4175
4438
  }
4176
4439
  });
4177
4440
 
4178
- // src/Service.ts
4179
- var Service, JSONService, ConfigService;
4180
- var init_Service = __esm({
4181
- "src/Service.ts"() {
4182
- "use strict";
4183
- init_basePath();
4184
- init_Crypt();
4185
- init_domain();
4186
- init_InheritClass();
4187
- init_Logger();
4188
- init_Package();
4189
- init_secretKey();
4190
- init_CONFIG();
4191
- Service = class extends InheritClass {
4192
- static {
4193
- __name(this, "Service");
4194
- }
4195
- options;
4196
- withCredentials;
4197
- useHTTP2;
4198
- // eslint-disable-next-line no-unused-vars
4199
- mockup({ request, service }) {
4200
- throw new Error("Method not implemented.");
4201
- }
4202
- name;
4203
- responseHeaders;
4204
- // eslint-disable-next-line no-unused-vars
4205
- local({ request, service }) {
4206
- throw new Error("Method not implemented.");
4207
- }
4208
- kind = "rest";
4209
- /* it can be rest, mockup, local */
4210
- domain = _domain_;
4211
- basePath = _basePath_;
4212
- url = "";
4213
- method = "GET";
4214
- data = {};
4215
- reload = false;
4216
- cached = false;
4217
- headers;
4218
- template;
4219
- // eslint-disable-next-line no-unused-vars
4220
- done({ request, service }) {
4221
- throw new Error("Method not implemented.");
4222
- }
4223
- // eslint-disable-next-line no-unused-vars
4224
- fail(...args) {
4225
- throw new Error("Method not implemented.");
4226
- }
4227
- set(name, value) {
4228
- this[name] = value;
4229
- }
4230
- get(name, _default) {
4231
- return this[name] || _default;
4232
- }
4233
- };
4234
- JSONService = class extends Service {
4235
- static {
4236
- __name(this, "JSONService");
4237
- }
4238
- method = "GET";
4239
- cached = false;
4240
- headers = {
4241
- "Content-Type": "application/json",
4242
- "charset": "utf-8"
4243
- };
4244
- JSONresponse = void 0;
4245
- done(result) {
4246
- logger.debug("***** RECEIVED RESPONSE:");
4247
- logger.debug(result.service.template);
4248
- this.JSONresponse = JSON.parse(result.service.template);
4249
- }
4250
- };
4251
- ConfigService = class extends JSONService {
4252
- static {
4253
- __name(this, "ConfigService");
4254
- }
4255
- method = "GET";
4256
- cached = false;
4257
- configFileName = "config.json";
4258
- headers = {
4259
- "Content-Type": "application/json",
4260
- "charset": "utf-8"
4261
- };
4262
- configLoaded() {
4263
- throw Error("Method not implemented.");
4264
- }
4265
- JSONresponse = void 0;
4266
- done(result) {
4267
- logger.debug("***** CONFIG LOADED:");
4268
- logger.debug(result.service.template);
4269
- this.JSONresponse = JSON.parse(result.service.template);
4270
- if (Object.hasOwn(this.JSONresponse, "__encoded__")) {
4271
- const decodedValue = _Crypt.decrypt(this.JSONresponse?.__encoded__, _secretKey);
4272
- this.JSONresponse = JSON.parse(decodedValue);
4273
- }
4274
- const jsonResponse = this.JSONresponse;
4275
- Object.keys(jsonResponse).map((k) => {
4276
- CONFIG.set(k, jsonResponse[k]);
4277
- return k;
4278
- });
4279
- this.configLoaded().catch((e) => {
4280
- throw new Error(`An error ocurred: ${e}`);
4281
- });
4282
- }
4283
- fail() {
4284
- this.configLoaded().catch((e) => {
4285
- throw new Error(`An error ocurred: ${e}`);
4286
- });
4287
- }
4288
- constructor() {
4289
- super();
4290
- this.set("url", `${this.get("basePath")}${this.get("configFileName")}`);
4291
- }
4292
- };
4293
- Package("com.qcobjects.api", [
4294
- Service
4295
- ]);
4296
- Package("com.qcobjects.api.services", [
4297
- JSONService
4298
- ]);
4299
- Package("com.qcobjects.api.config", [
4300
- ConfigService
4301
- ]);
4302
- }
4303
- });
4304
-
4305
- // src/globalSettings.ts
4306
- var GlobalSettings;
4307
- var init_globalSettings = __esm({
4308
- "src/globalSettings.ts"() {
4309
- "use strict";
4310
- init_CONFIG();
4311
- init_InheritClass();
4312
- init_Logger();
4313
- init_Package();
4314
- init_platform();
4315
- init_serviceLoader();
4316
- init_top();
4317
- init_Service();
4318
- GlobalSettings = class _GlobalSettings extends InheritClass {
4319
- static {
4320
- __name(this, "GlobalSettings");
4321
- }
4322
- static __start__() {
4323
- return _GlobalSettings.instance.__start__();
4324
- }
4325
- _GLOBAL = {};
4326
- static _instance;
4327
- static get instance() {
4328
- if (typeof _GlobalSettings._instance === "undefined") {
4329
- _GlobalSettings._instance = new _GlobalSettings();
4330
- }
4331
- return _GlobalSettings._instance;
4332
- }
4333
- set(name, value) {
4334
- this._GLOBAL[name] = value;
4335
- }
4336
- get(name, _default) {
4337
- let _value;
4338
- if (typeof this._GLOBAL[name] !== "undefined") {
4339
- _value = this._GLOBAL[name];
4340
- } else if (typeof _default !== "undefined") {
4341
- _value = _default;
4342
- }
4343
- return _value;
4344
- }
4345
- __start__() {
4346
- const __load__serviceWorker = /* @__PURE__ */ __name(function() {
4347
- let _promise;
4348
- if (isBrowser) {
4349
- _promise = new Promise(function(resolve, reject) {
4350
- if ("serviceWorker" in navigator && typeof CONFIG.get("serviceWorkerURI") !== "undefined") {
4351
- CONFIG.set("serviceWorkerScope", CONFIG.get("serviceWorkerScope") ? CONFIG.get("serviceWorkerScope") : "/");
4352
- navigator.serviceWorker.register(CONFIG.get("serviceWorkerURI"), {
4353
- scope: CONFIG.get("serviceWorkerScope")
4354
- }).then(function(registration) {
4355
- logger.debug("Service Worker Registered");
4356
- resolve.call(_promise, registration);
4357
- }, function(registration) {
4358
- logger.debug("Error registering Service Worker");
4359
- reject.call(_promise, registration);
4360
- });
4361
- navigator.serviceWorker.ready.then(function(registration) {
4362
- logger.debug("Service Worker Ready");
4363
- resolve.call(_promise, registration);
4364
- }, function(registration) {
4365
- logger.debug("Error loading Service Worker");
4366
- reject.call(_promise, registration);
4367
- });
4368
- }
4369
- });
4370
- } else {
4371
- _promise = Promise.resolve();
4372
- }
4373
- return _promise;
4374
- }, "__load__serviceWorker");
4375
- const _buildComponents = /* @__PURE__ */ __name(function() {
4376
- return new Promise((resolve) => {
4377
- if (isBrowser) {
4378
- logger.debug("Starting to building components");
4379
- try {
4380
- buildComponentsStack();
4381
- } catch (e) {
4382
- throw Error(`Something went wrong trying to start components tree: ${e.message}`);
4383
- }
4384
- logger.debug("Initializing the service worker");
4385
- __load__serviceWorker.call(_top).catch(function(e) {
4386
- logger.debug(`error loading the service worker ${e}`);
4387
- });
4388
- }
4389
- resolve();
4390
- });
4391
- }, "_buildComponents");
4392
- return new Promise((resolve) => {
4393
- logger.debug("Starting to load the config settings...");
4394
- if (CONFIG.get("useConfigService", false)) {
4395
- logger.debug("Loading settings using local configuration file...");
4396
- setConfigService(new ConfigService());
4397
- configService.configLoaded = _buildComponents;
4398
- serviceLoader(configService)?.then((standardResponse) => {
4399
- resolve(standardResponse);
4400
- })?.catch((e) => {
4401
- throw new Error(`An error ocurred while trying to load ${configService.url}: ${e}`);
4402
- });
4403
- } else {
4404
- logger.debug("Starting to load the components...");
4405
- _buildComponents.call(this).then(() => {
4406
- resolve({});
4407
- }).catch((e) => {
4408
- throw new Error(`An error ocurred while trying to build the components stack. ${e}`);
4409
- });
4410
- }
4411
- });
4412
- }
4413
- };
4414
- Package("com.qcobjects", [
4415
- GlobalSettings
4416
- ]);
4417
- }
4418
- });
4419
-
4420
4441
  // src/loadSDK.ts
4421
4442
  function loadSDK() {
4422
4443
  if (CONFIG.get("useSDK")) {
@@ -4485,6 +4506,7 @@ var init_loadSDK = __esm({
4485
4506
  var require_MainProcess = __commonJS({
4486
4507
  "src/MainProcess.ts"() {
4487
4508
  "use strict";
4509
+ init_top();
4488
4510
  init_asyncLoad();
4489
4511
  init_captureFalseTouch();
4490
4512
  init_Cast();
@@ -4511,7 +4533,6 @@ var require_MainProcess = __commonJS({
4511
4533
  init_Ready();
4512
4534
  init_serviceLoader();
4513
4535
  init_Tag();
4514
- init_top();
4515
4536
  init_Processor();
4516
4537
  init_is_a();
4517
4538
  init_getType();
@@ -4523,6 +4544,7 @@ var require_MainProcess = __commonJS({
4523
4544
  init_subelements();
4524
4545
  init_globalSettings();
4525
4546
  init_loadSDK();
4547
+ init_range();
4526
4548
  (/* @__PURE__ */ __name(function __qcobjects__(_top2) {
4527
4549
  if (typeof Object.defineProperty !== "undefined" && typeof _top2 !== "undefined") {
4528
4550
  try {
@@ -4541,8 +4563,6 @@ var require_MainProcess = __commonJS({
4541
4563
  }
4542
4564
  if (typeof _top2.__qcobjects__.loaded === "undefined") {
4543
4565
  _top2.__qcobjects__.loaded = true;
4544
- const global2 = _top2;
4545
- _top2.global = global2;
4546
4566
  if (isBrowser) {
4547
4567
  Element.prototype.subelements = subelements;
4548
4568
  Document.prototype.subelements = subelements;
@@ -4553,7 +4573,6 @@ var require_MainProcess = __commonJS({
4553
4573
  }
4554
4574
  logger.debugEnabled = false;
4555
4575
  logger.infoEnabled = true;
4556
- _top2.logger = logger;
4557
4576
  if (isBrowser) {
4558
4577
  Element.prototype.find = function(tag) {
4559
4578
  const _self = this;
@@ -4620,7 +4639,7 @@ var require_MainProcess = __commonJS({
4620
4639
  document.addEventListener("deviceready", _Ready, captureFalseTouch);
4621
4640
  }
4622
4641
  } else {
4623
- global2.onload = _Ready;
4642
+ global.onload = _Ready;
4624
4643
  }
4625
4644
  if (isBrowser) {
4626
4645
  window.addEventListener("popstate", function(popStateEvent) {
@@ -4766,7 +4785,7 @@ var require_MainProcess = __commonJS({
4766
4785
  _protected_code_(Array.prototype.matrix3d);
4767
4786
  String.prototype.list = function() {
4768
4787
  const __instance = this;
4769
- return _top2.range(0, __instance.length - 1).map(function(i) {
4788
+ return range(0, __instance.length - 1).map(function(i) {
4770
4789
  return __instance[i];
4771
4790
  });
4772
4791
  };
@@ -4790,7 +4809,6 @@ var require_MainProcess = __commonJS({
4790
4809
  Export(isBrowser);
4791
4810
  Export(_methods_);
4792
4811
  Export(GlobalSettings);
4793
- resetTop(_CastProps(New(GlobalSettings), _top2));
4794
4812
  (function(_top3) {
4795
4813
  Object.defineProperty(_top3, "PackagesNameList", {
4796
4814
  // eslint-disable-next-line no-unused-vars
@@ -4871,7 +4889,7 @@ var require_MainProcess = __commonJS({
4871
4889
  Class("GLOBAL", _QC_CLASSES.global);
4872
4890
  Export(ClassFactory("GLOBAL"));
4873
4891
  }
4874
- Export(global2);
4892
+ Export(global);
4875
4893
  loadSDK_default();
4876
4894
  })(_top2);
4877
4895
  if (isBrowser) {
@@ -6390,6 +6408,7 @@ var getDocumentLayout = /* @__PURE__ */ __name(function() {
6390
6408
  init_mathFunctions();
6391
6409
  init_top();
6392
6410
  init_make_global();
6411
+ init_top();
6393
6412
  var QCObjects = __toESM(require_MainProcess());
6394
6413
  export {
6395
6414
  ArrayCollection,
@@ -6462,6 +6481,7 @@ export {
6462
6481
  captureFalseTouch,
6463
6482
  componentLoader,
6464
6483
  findPackageNodePath,
6484
+ get,
6465
6485
  getDocumentLayout,
6466
6486
  _top as global,
6467
6487
  isBrowser,
@@ -6475,6 +6495,7 @@ export {
6475
6495
  ready,
6476
6496
  resetTop,
6477
6497
  serviceLoader,
6498
+ set,
6478
6499
  setDefaultProcessors,
6479
6500
  shortCode,
6480
6501
  subelements,