chunk-ROWZMUVJ.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. import {
  2. u
  3. } from "./chunk-NE3ESGA6.js";
  4. import {
  5. f,
  6. h,
  7. l
  8. } from "./chunk-YIS6BAC3.js";
  9. import {
  10. d,
  11. e,
  12. e3 as e2,
  13. n2 as n,
  14. n5 as n2,
  15. n6 as n3,
  16. y3 as y
  17. } from "./chunk-Y3WMVFTW.js";
  18. import {
  19. $,
  20. k,
  21. m,
  22. p
  23. } from "./chunk-ULGDPLM2.js";
  24. import {
  25. s
  26. } from "./chunk-EMJ4ZSM2.js";
  27. import {
  28. a2 as a,
  29. c,
  30. r,
  31. t
  32. } from "./chunk-GZT4BVFP.js";
  33. // node_modules/@arcgis/core/layers/support/PromiseQueue.js
  34. var i = class extends y {
  35. constructor() {
  36. super(...arguments), this._tasks = new Array(), this.running = false;
  37. }
  38. get length() {
  39. return this._tasks.length;
  40. }
  41. destroy() {
  42. this.cancelAll();
  43. }
  44. runTask(s2) {
  45. for (; !s2.done && this._process(s2); )
  46. s2.madeProgress();
  47. }
  48. push(s2, r2, t3) {
  49. return this.running = true, new Promise((e3, o) => this._tasks.push(new a2(e3, o, s2, r2, t3)));
  50. }
  51. unshift(s2, r2, t3) {
  52. return this.running = true, new Promise((e3, o) => this._tasks.unshift(new a2(e3, o, s2, r2, t3)));
  53. }
  54. _process(s2) {
  55. if (this._tasks.length === 0)
  56. return false;
  57. const r2 = this._tasks.shift();
  58. try {
  59. const c2 = p(r2.signal);
  60. if (c2 && !r2.abortCallback)
  61. r2.reject(m());
  62. else {
  63. const t3 = c2 ? r2.abortCallback(m()) : r2.callback(s2);
  64. k(t3) ? t3.then(r2.resolve, r2.reject) : r2.resolve(t3);
  65. }
  66. } catch (c2) {
  67. r2.reject(c2);
  68. }
  69. return this.running = this._tasks.length > 0, true;
  70. }
  71. cancelAll() {
  72. const s2 = m();
  73. for (const r2 of this._tasks)
  74. if (r2.abortCallback) {
  75. const t3 = r2.abortCallback(s2);
  76. r2.resolve(t3);
  77. } else
  78. r2.reject(s2);
  79. this._tasks.length = 0, this.running = false;
  80. }
  81. };
  82. e([d()], i.prototype, "running", void 0), i = e([n("esri.layers.support.PromiseQueue")], i);
  83. var a2 = class {
  84. constructor(s2, r2, t3, e3, o) {
  85. this.resolve = s2, this.reject = r2, this.callback = t3, this.signal = e3, this.abortCallback = o;
  86. }
  87. };
  88. // node_modules/@arcgis/core/views/support/debugFlags.js
  89. var t2 = class extends y {
  90. constructor() {
  91. super(...arguments), this.SCHEDULER_LOG_SLOW_TASKS = false, this.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES = false;
  92. }
  93. };
  94. e([d()], t2.prototype, "SCHEDULER_LOG_SLOW_TASKS", void 0), e([d()], t2.prototype, "FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES", void 0), t2 = e([n("esri.views.support.DebugFlags")], t2);
  95. var p2 = new t2();
  96. // node_modules/@arcgis/core/views/support/Scheduler.js
  97. var f2 = s.getLogger("esri.views.support.Scheduler");
  98. var L;
  99. !function(e3) {
  100. e3.RESOURCE_CONTROLLER = "schedule", e3.SLIDE = "slide", e3.STREAM_DATA_LOADER = "stream loader", e3.ELEVATION_QUERY = "elevation query", e3.TERRAIN_SURFACE = "terrain", e3.SURFACE_GEOMETRY_UPDATES = "surface geometry updates", e3.GRAPHICS_CORE = "Graphics3D", e3.I3S_CONTROLLER = "I3S", e3.POINT_CLOUD_LAYER = "point cloud", e3.FEATURE_TILE_FETCHER = "feature fetcher", e3.OVERLAY = "overlay", e3.STAGE = "stage", e3.GRAPHICS_DECONFLICTOR = "graphics deconflictor", e3.FILTER_VISIBILITY = "Graphics3D filter visibility", e3.SCALE_VISIBILITY = "Graphics3D scale visibility", e3.FRUSTUM_VISIBILITY = "Graphics3D frustum visibility", e3.POINT_OF_INTEREST_FREQUENT = "POI frequent", e3.POINT_OF_INTEREST_INFREQUENT = "POI infrequent", e3.LABELER = "labeler", e3.FEATURE_QUERY_ENGINE = "feature query", e3.FEATURE_TILE_TREE = "feature tile tree", e3.FEATURE_TILE_TREE_ACTIVE = "fast feature tile tree", e3.ELEVATION_ALIGNMENT = "elevation alignment", e3.TEXT_TEXTURE_ATLAS = "text texture atlas", e3.TEXTURE_UNLOAD = "texture unload", e3.LINE_OF_SIGHT_TOOL = "line of sight tool", e3.LINE_OF_SIGHT_TOOL_INTERACTIVE = "interactive line of sight tool", e3.ELEVATION_PROFILE = "elevation profile", e3.SNAPPING = "snapping", e3.SHADOW_ACCUMULATOR = "shadow accumulator", e3.CLOUDS_GENERATOR = "cloud generator", e3[e3.TEST_PRIO = 1] = "TEST_PRIO";
  101. }(L || (L = {}));
  102. var S = 0;
  103. var b = new Map([[L.RESOURCE_CONTROLLER, S], [L.SLIDE, S], [L.STREAM_DATA_LOADER, S], [L.ELEVATION_QUERY, S], [L.TERRAIN_SURFACE, 1], [L.SURFACE_GEOMETRY_UPDATES, 1], [L.GRAPHICS_CORE, 2], [L.I3S_CONTROLLER, 2], [L.POINT_CLOUD_LAYER, 2], [L.FEATURE_TILE_FETCHER, 2], [L.OVERLAY, 4], [L.STAGE, 4], [L.GRAPHICS_DECONFLICTOR, 4], [L.FILTER_VISIBILITY, 4], [L.SCALE_VISIBILITY, 4], [L.FRUSTUM_VISIBILITY, 4], [L.POINT_OF_INTEREST_FREQUENT, 6], [L.POINT_OF_INTEREST_INFREQUENT, 30], [L.LABELER, 8], [L.FEATURE_QUERY_ENGINE, 8], [L.FEATURE_TILE_TREE, 16], [L.FEATURE_TILE_TREE_ACTIVE, S], [L.ELEVATION_ALIGNMENT, 12], [L.TEXT_TEXTURE_ATLAS, 12], [L.CLOUDS_GENERATOR, 12], [L.TEXTURE_UNLOAD, 12], [L.LINE_OF_SIGHT_TOOL, 16], [L.LINE_OF_SIGHT_TOOL_INTERACTIVE, S], [L.SNAPPING, S], [L.SHADOW_ACCUMULATOR, 30]]);
  104. function k2(e3) {
  105. return b.has(e3) ? b.get(e3) : typeof e3 == "number" ? e3 : 1;
  106. }
  107. var N;
  108. !function(e3) {
  109. e3[e3.ANIMATING = 0] = "ANIMATING", e3[e3.INTERACTING = 1] = "INTERACTING", e3[e3.IDLE = 2] = "IDLE";
  110. }(N || (N = {}));
  111. var O = n3(6.5);
  112. var U = n3(1);
  113. var P = n3(30);
  114. var y2 = n3(1e3 / 30);
  115. var C = n3(100);
  116. var F = 0.9;
  117. var D;
  118. var G;
  119. !function(r2) {
  120. let _ = class extends y {
  121. constructor() {
  122. super(), this.updating = true, this._microTaskQueued = false, this.performanceInfo = { total: new e2("total"), tasks: new Map() }, this._frameTaskTimes = new Map(), this._budget = new l2(), this._state = N.INTERACTING, this._tasks = new n2(), this._runQueue = new n2(), this._load = 0, this._idleStateCallbacks = new n2(), this._idleUpdatesStartFired = false, this._maxReschedule = B, this._forceTask = false, this._debug = false, this._debugHandle = l(() => p2.SCHEDULER_LOG_SLOW_TASKS, (e4) => this._debug = e4, h);
  123. for (const s2 of Object.keys(L))
  124. this.performanceInfo.tasks.set(L[s2], new e2(L[s2]));
  125. let e3;
  126. const t3 = this;
  127. this._test = { get state() {
  128. return c(e3, t3._state);
  129. }, set state(t4) {
  130. e3 = t4;
  131. }, FRAME_SAFETY_BUDGET: O, INTERACTING_BUDGET: y2, IDLE_BUDGET: C, get availableBudget() {
  132. return t3._budget.budget;
  133. }, usedBudget: 0, getBudget: () => t3._budget, setBudget: (e4) => t3._budget = e4, updateTask: (e4) => this._updateTask(e4), getState: (e4) => this._getState(e4), getRuntime: (e4) => this._getRuntime(e4), frameTaskTimes: this._frameTaskTimes, resetRuntimes: () => this._resetRuntimes(), getRunning: () => this._getRunning() };
  134. }
  135. destroy() {
  136. this._tasks.toArray().forEach((e3) => e3.remove()), this._tasks.clear(), a(this._debugHandle), this._microTaskQueued = false, this.updating = false;
  137. }
  138. activate() {
  139. this._budget.done || this._microTaskQueued || (this._microTaskQueued = true, queueMicrotask(() => {
  140. this._microTaskQueued && (this._microTaskQueued = false, this._budget.done || (this._maxReschedule = B, this._schedule(), this.frame()));
  141. }));
  142. }
  143. registerTask(e3, t3) {
  144. const s2 = k2(e3), r3 = new d2(this, e3, t3, s2);
  145. return this._tasks.push(r3), this.performanceInfo.tasks.has(e3) || this.performanceInfo.tasks.set(e3, new e2(e3)), r3;
  146. }
  147. registerIdleStateCallbacks(e3, t3) {
  148. const s2 = { idleBegin: e3, idleEnd: t3 };
  149. this._idleStateCallbacks.push(s2), this.state === N.IDLE && this._idleUpdatesStartFired && s2.idleBegin();
  150. const r3 = this;
  151. return { remove: () => this._removeIdleStateCallbacks(s2), set idleBegin(e4) {
  152. r3._idleUpdatesStartFired && (s2.idleEnd(), r3._state === N.IDLE && e4()), s2.idleBegin = e4;
  153. }, set idleEnd(e4) {
  154. s2.idleEnd = e4;
  155. } };
  156. }
  157. get load() {
  158. return this._load;
  159. }
  160. set state(e3) {
  161. this._state !== e3 && (this._state = e3, this.state !== N.IDLE && this._idleUpdatesStartFired && (this._idleUpdatesStartFired = false, this._idleStateCallbacks.forAll((e4) => e4.idleEnd())));
  162. }
  163. get state() {
  164. return t(this._test.state) ? this._state : this._test.state;
  165. }
  166. updateBudget(e3) {
  167. this._test.usedBudget = 0;
  168. let t3 = O, s2 = e3.frameDuration, r3 = U;
  169. switch (this.state) {
  170. case N.IDLE:
  171. t3 = n3(0), s2 = n3(Math.max(C, e3.frameDuration)), r3 = P;
  172. break;
  173. case N.INTERACTING:
  174. s2 = n3(Math.max(y2, e3.frameDuration));
  175. case N.ANIMATING:
  176. }
  177. return s2 = n3(s2 - e3.elapsedFrameTime - t3), this.state !== N.IDLE && s2 < U && !this._forceTask ? (this._forceTask = true, false) : (s2 = n3(Math.max(s2, r3)), this._budget.reset(s2, this.state), this._maxReschedule = B, this._updateLoad(), this._schedule());
  178. }
  179. frame() {
  180. switch (this._forceTask = false, this._microTaskQueued = false, this.state) {
  181. case N.IDLE:
  182. this._idleUpdatesStartFired || (this._idleUpdatesStartFired = true, this._idleStateCallbacks.forAll((e3) => e3.idleBegin())), this._runIdle();
  183. break;
  184. case N.INTERACTING:
  185. this._runInteracting();
  186. break;
  187. default:
  188. this._runAnimating();
  189. }
  190. this._test.usedBudget = this._budget.elapsed;
  191. }
  192. stopFrame() {
  193. this._budget.reset(n3(0), this._state), this._budget.madeProgress();
  194. }
  195. _removeIdleStateCallbacks(e3) {
  196. this._idleUpdatesStartFired && e3.idleEnd(), this._idleStateCallbacks.removeUnordered(e3);
  197. }
  198. removeTask(e3) {
  199. this._tasks.removeUnordered(e3), this._runQueue.removeUnordered(e3);
  200. }
  201. _updateTask(e3) {
  202. this._tasks.forAll((t3) => {
  203. t3.name === e3 && t3.setPriority(e3);
  204. });
  205. }
  206. _getState(e3) {
  207. if (this._runQueue.some((t4) => t4.name === e3))
  208. return G.SCHEDULED;
  209. let t3 = G.IDLE;
  210. return this._tasks.forAll((s2) => {
  211. s2.name === e3 && s2.needsUpdate && (s2.schedulePriority <= 1 ? t3 = G.READY : t3 !== G.READY && (t3 = G.WAITING));
  212. }), t3;
  213. }
  214. _getRuntime(e3) {
  215. let t3 = 0;
  216. return this._tasks.forAll((s2) => {
  217. s2.name === e3 && (t3 += s2.runtime);
  218. }), t3;
  219. }
  220. _resetRuntimes() {
  221. this._tasks.forAll((e3) => e3.runtime = 0);
  222. }
  223. _getRunning() {
  224. const e3 = new Map();
  225. if (this._tasks.forAll((t4) => {
  226. t4.needsUpdate && e3.set(t4.name, (e3.get(t4.name) || 0) + 1);
  227. }), e3.size === 0)
  228. return null;
  229. let t3 = "";
  230. return e3.forEach((e4, s2) => {
  231. t3 += e4 > 1 ? ` ${e4}x ${s2}` : ` ${s2}`;
  232. }), t3;
  233. }
  234. _runIdle() {
  235. this._run();
  236. }
  237. _runInteracting() {
  238. this._run();
  239. }
  240. _runAnimating() {
  241. this._run();
  242. }
  243. _updateLoad() {
  244. const e3 = this._tasks.reduce((e4, t3) => t3.needsUpdate ? ++e4 : e4, 0);
  245. this._load = this._load * F + e3 * (1 - F);
  246. }
  247. _schedule() {
  248. if (this._maxReschedule <= 0)
  249. return false;
  250. for (this._runQueue.filterInPlace((e3) => !!e3.needsUpdate || (e3.schedulePriority = e3.basePriority, false)), this._tasks.forAll((e3) => {
  251. e3.basePriority === S && e3.needsUpdate && !this._runQueue.includes(e3) && this._runQueue.unshift(e3);
  252. }); this._runQueue.length === 0; ) {
  253. let e3 = false, t3 = 0;
  254. if (this._tasks.forAll((s2) => {
  255. if (s2.needsUpdate && s2.schedulePriority !== 0 && s2.basePriority !== S)
  256. if (e3 = true, t3 = Math.max(t3, s2.basePriority), s2.schedulePriority === 1)
  257. s2.schedulePriority = 0, this._runQueue.push(s2);
  258. else
  259. --s2.schedulePriority;
  260. }), !e3)
  261. return this.updating = false, false;
  262. this._maxReschedule === B && (this._maxReschedule = t3), --this._maxReschedule;
  263. }
  264. return this.updating = true, true;
  265. }
  266. _run() {
  267. const e3 = this._budget.now();
  268. this._startFrameTaskTimes();
  269. do {
  270. for (; this._runQueue.length > 0; ) {
  271. const s2 = this._budget.now(), r3 = this._runQueue.pop();
  272. this._budget.resetProgress();
  273. try {
  274. r3.task.runTask(this._budget);
  275. } catch (t3) {
  276. f2.error(`Exception in task "${r3.name}"`, t3);
  277. }
  278. r3.schedulePriority = r3.basePriority;
  279. const i2 = this._budget.now() - s2;
  280. if (r3.runtime += i2, this._frameTaskTimes.set(r3.priority, this._frameTaskTimes.get(r3.priority) + i2), this._debug && this._budget.elapsed > 2 * this._budget.budget && console.log("Task", r3.name, "used", this._budget.elapsed, "of max", this._budget.budget, "ms"), this._budget.remaining <= 0)
  281. return this.updating = this._tasks.some((e4) => e4.needsUpdate), void this._recordFrameTaskTimes(this._budget.now() - e3);
  282. }
  283. } while (this._schedule());
  284. this.updating = this._tasks.some((e4) => e4.needsUpdate), this._recordFrameTaskTimes(this._budget.now() - e3);
  285. }
  286. _startFrameTaskTimes() {
  287. for (const e3 of Object.keys(L))
  288. this._frameTaskTimes.set(L[e3], 0);
  289. }
  290. _recordFrameTaskTimes(e3) {
  291. this._frameTaskTimes.forEach((e4, t3) => this.performanceInfo.tasks.get(t3).record(e4)), this.performanceInfo.total.record(e3);
  292. }
  293. get test() {
  294. return this._test;
  295. }
  296. };
  297. e([d()], _.prototype, "updating", void 0), _ = e([n("esri.views.support.Scheduler")], _), r2.Scheduler = _;
  298. let d2 = class extends y {
  299. constructor(e3, t3, r3, i2) {
  300. super({}), this._scheduler = e3, this.name = t3, this._basePriority = i2, this.runtime = 0, this._queue = new i(), this._handles = new u(), this.schedulePriority = this._basePriority, this.task = r(r3) ? r3 : this._queue, this._handles.add(f(() => this.task.running, () => e3.activate()));
  301. }
  302. get updating() {
  303. return this._queue.running;
  304. }
  305. normalizeCtorArgs() {
  306. return {};
  307. }
  308. remove() {
  309. this.processQueue(w), this._scheduler.removeTask(this), this.schedule = Q.schedule, this.reschedule = Q.reschedule, this._handles.destroy();
  310. }
  311. get basePriority() {
  312. return this._basePriority;
  313. }
  314. setPriority(e3) {
  315. this.name = e3;
  316. const t3 = k2(e3);
  317. this._basePriority !== S && this.schedulePriority === 0 || (this.schedulePriority = t3), this._basePriority = t3;
  318. }
  319. get priority() {
  320. return this.name;
  321. }
  322. set priority(e3) {
  323. this.setPriority(e3);
  324. }
  325. get needsUpdate() {
  326. return this.updating || this.task.running;
  327. }
  328. schedule(e3, t3, s2) {
  329. return this._queue.push(e3, t3, s2);
  330. }
  331. reschedule(e3, t3, s2) {
  332. return this._queue.unshift(e3, t3, s2);
  333. }
  334. processQueue(e3) {
  335. this._queue.runTask(e3);
  336. }
  337. };
  338. e([d({ constructOnly: true })], d2.prototype, "task", void 0), e([d({ readOnly: true })], d2.prototype, "updating", null), d2 = e([n("esri.views.support.SchedulerTask")], d2);
  339. class l2 {
  340. constructor() {
  341. this._begin = typeof performance != "undefined" ? performance.now() : 0, this._budget = 0, this._state = N.IDLE, this._didWork = false, this._enabled = true;
  342. }
  343. run(e3) {
  344. return !this.done && (e3() === true && (this._didWork = true), true);
  345. }
  346. get done() {
  347. return this._didWork && this.elapsed >= this._budget && this._enabled;
  348. }
  349. get budget() {
  350. return this._budget;
  351. }
  352. madeProgress() {
  353. this._didWork = true;
  354. }
  355. get state() {
  356. return this._state;
  357. }
  358. get enabled() {
  359. return this._enabled;
  360. }
  361. set enabled(e3) {
  362. this._enabled = e3;
  363. }
  364. reset(e3, t3) {
  365. this._begin = this.now(), this._budget = e3, this._state = t3, this._didWork = false;
  366. }
  367. get remaining() {
  368. return Math.max(this._budget - this.elapsed, 0);
  369. }
  370. now() {
  371. return performance.now();
  372. }
  373. get elapsed() {
  374. return performance.now() - this._begin;
  375. }
  376. resetProgress() {
  377. this._didWork = false;
  378. }
  379. get hasProgressed() {
  380. return this._didWork;
  381. }
  382. }
  383. r2.Budget = l2;
  384. }(D || (D = {})), function(e3) {
  385. e3.SCHEDULED = "s", e3.READY = "r", e3.WAITING = "w", e3.IDLE = "i";
  386. }(G || (G = {}));
  387. var w = (() => {
  388. const e3 = new D.Budget();
  389. return e3.enabled = false, e3;
  390. })();
  391. var v = class {
  392. remove() {
  393. }
  394. processQueue() {
  395. }
  396. schedule(e3, t3, s2) {
  397. try {
  398. if (p(t3)) {
  399. const e4 = m();
  400. return s2 ? Promise.resolve(s2(e4)) : Promise.reject(e4);
  401. }
  402. return $(e3(w));
  403. } catch (r2) {
  404. return Promise.reject(r2);
  405. }
  406. }
  407. reschedule(e3, t3, s2) {
  408. return this.schedule(e3, t3, s2);
  409. }
  410. };
  411. var Q = new v();
  412. var B = Number.MAX_SAFE_INTEGER;
  413. export {
  414. L,
  415. w,
  416. Q
  417. };
  418. //# sourceMappingURL=chunk-ROWZMUVJ.js.map