chunk-B5O7N7PM.js 16 KB

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