UI for Zipcoin Blue

wtf.js 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /**
  2. * @license
  3. * Copyright Google Inc. All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. (function (global, factory) {
  9. typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
  10. typeof define === 'function' && define.amd ? define(factory) :
  11. (factory());
  12. }(this, (function () { 'use strict';
  13. /**
  14. * @license
  15. * Copyright Google Inc. All Rights Reserved.
  16. *
  17. * Use of this source code is governed by an MIT-style license that can be
  18. * found in the LICENSE file at https://angular.io/license
  19. */
  20. /**
  21. * @fileoverview
  22. * @suppress {missingRequire}
  23. */
  24. (function (global) {
  25. // Detect and setup WTF.
  26. var wtfTrace = null;
  27. var wtfEvents = null;
  28. var wtfEnabled = (function () {
  29. var wtf = global['wtf'];
  30. if (wtf) {
  31. wtfTrace = wtf.trace;
  32. if (wtfTrace) {
  33. wtfEvents = wtfTrace.events;
  34. return true;
  35. }
  36. }
  37. return false;
  38. })();
  39. var WtfZoneSpec = /** @class */ (function () {
  40. function WtfZoneSpec() {
  41. this.name = 'WTF';
  42. }
  43. WtfZoneSpec.prototype.onFork = function (parentZoneDelegate, currentZone, targetZone, zoneSpec) {
  44. var retValue = parentZoneDelegate.fork(targetZone, zoneSpec);
  45. WtfZoneSpec.forkInstance(zonePathName(targetZone), retValue.name);
  46. return retValue;
  47. };
  48. WtfZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
  49. var scope = WtfZoneSpec.invokeScope[source];
  50. if (!scope) {
  51. scope = WtfZoneSpec.invokeScope[source] =
  52. wtfEvents.createScope("Zone:invoke:" + source + "(ascii zone)");
  53. }
  54. return wtfTrace.leaveScope(scope(zonePathName(targetZone)), parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source));
  55. };
  56. WtfZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
  57. return parentZoneDelegate.handleError(targetZone, error);
  58. };
  59. WtfZoneSpec.prototype.onScheduleTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  60. var key = task.type + ':' + task.source;
  61. var instance = WtfZoneSpec.scheduleInstance[key];
  62. if (!instance) {
  63. instance = WtfZoneSpec.scheduleInstance[key] =
  64. wtfEvents.createInstance("Zone:schedule:" + key + "(ascii zone, any data)");
  65. }
  66. var retValue = parentZoneDelegate.scheduleTask(targetZone, task);
  67. instance(zonePathName(targetZone), shallowObj(task.data, 2));
  68. return retValue;
  69. };
  70. WtfZoneSpec.prototype.onInvokeTask = function (parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
  71. var source = task.source;
  72. var scope = WtfZoneSpec.invokeTaskScope[source];
  73. if (!scope) {
  74. scope = WtfZoneSpec.invokeTaskScope[source] =
  75. wtfEvents.createScope("Zone:invokeTask:" + source + "(ascii zone)");
  76. }
  77. return wtfTrace.leaveScope(scope(zonePathName(targetZone)), parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs));
  78. };
  79. WtfZoneSpec.prototype.onCancelTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  80. var key = task.source;
  81. var instance = WtfZoneSpec.cancelInstance[key];
  82. if (!instance) {
  83. instance = WtfZoneSpec.cancelInstance[key] =
  84. wtfEvents.createInstance("Zone:cancel:" + key + "(ascii zone, any options)");
  85. }
  86. var retValue = parentZoneDelegate.cancelTask(targetZone, task);
  87. instance(zonePathName(targetZone), shallowObj(task.data, 2));
  88. return retValue;
  89. };
  90. WtfZoneSpec.forkInstance = wtfEnabled && wtfEvents.createInstance('Zone:fork(ascii zone, ascii newZone)');
  91. WtfZoneSpec.scheduleInstance = {};
  92. WtfZoneSpec.cancelInstance = {};
  93. WtfZoneSpec.invokeScope = {};
  94. WtfZoneSpec.invokeTaskScope = {};
  95. return WtfZoneSpec;
  96. }());
  97. function shallowObj(obj, depth) {
  98. if (!depth)
  99. return null;
  100. var out = {};
  101. for (var key in obj) {
  102. if (obj.hasOwnProperty(key)) {
  103. var value = obj[key];
  104. switch (typeof value) {
  105. case 'object':
  106. var name_1 = value && value.constructor && value.constructor.name;
  107. value = name_1 == Object.name ? shallowObj(value, depth - 1) : name_1;
  108. break;
  109. case 'function':
  110. value = value.name || undefined;
  111. break;
  112. }
  113. out[key] = value;
  114. }
  115. }
  116. return out;
  117. }
  118. function zonePathName(zone) {
  119. var name = zone.name;
  120. zone = zone.parent;
  121. while (zone != null) {
  122. name = zone.name + '::' + name;
  123. zone = zone.parent;
  124. }
  125. return name;
  126. }
  127. Zone['wtfZoneSpec'] = !wtfEnabled ? null : new WtfZoneSpec();
  128. })(typeof window === 'object' && window || typeof self === 'object' && self || global);
  129. })));