SceneLayerSnappingSourceWorker-B4FQTD4Q.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. import {
  2. b,
  3. j,
  4. v
  5. } from "./chunk-VKMM7VW7.js";
  6. import {
  7. c
  8. } from "./chunk-QHWZYJGI.js";
  9. import "./chunk-X4WJNVEM.js";
  10. import {
  11. N,
  12. R,
  13. T,
  14. V,
  15. _,
  16. d,
  17. k,
  18. p as p2,
  19. s
  20. } from "./chunk-ZNJHHCMJ.js";
  21. import {
  22. m
  23. } from "./chunk-4GSC3BUA.js";
  24. import "./chunk-AGGGC2FA.js";
  25. import "./chunk-RUM3DXFX.js";
  26. import "./chunk-7LRVL5YB.js";
  27. import "./chunk-4OM3EX6P.js";
  28. import "./chunk-X6GHUY4U.js";
  29. import "./chunk-3OFVLRSL.js";
  30. import "./chunk-44FMXGSC.js";
  31. import "./chunk-XFDO4CMR.js";
  32. import "./chunk-GHN7C53L.js";
  33. import "./chunk-HIELTLML.js";
  34. import {
  35. q as q2
  36. } from "./chunk-OQSZOHTF.js";
  37. import "./chunk-Y7BZ6TKQ.js";
  38. import "./chunk-VEJPYAE4.js";
  39. import "./chunk-4GGDRIJK.js";
  40. import "./chunk-PZ7XDUL6.js";
  41. import "./chunk-ULSPZIPE.js";
  42. import "./chunk-UMUHMVL4.js";
  43. import "./chunk-FZSI6IGI.js";
  44. import "./chunk-K7B6OWCU.js";
  45. import "./chunk-E3G7BRZB.js";
  46. import "./chunk-OKUFE7TO.js";
  47. import "./chunk-JKFWEHNK.js";
  48. import "./chunk-P24XEEHY.js";
  49. import "./chunk-WOXHUQGM.js";
  50. import "./chunk-FMPQIGFA.js";
  51. import "./chunk-EDHROVWI.js";
  52. import "./chunk-3IRT3YKJ.js";
  53. import "./chunk-SAJAEMIJ.js";
  54. import "./chunk-OJ2HHY2O.js";
  55. import "./chunk-PT62335L.js";
  56. import {
  57. r as r4
  58. } from "./chunk-C7742RNZ.js";
  59. import "./chunk-FNA5GLRW.js";
  60. import "./chunk-MCWCB5IY.js";
  61. import "./chunk-CRGY2SDS.js";
  62. import "./chunk-4T5ZGMEN.js";
  63. import "./chunk-CZBRZ6SU.js";
  64. import "./chunk-VGWC3IKZ.js";
  65. import "./chunk-2H5MD622.js";
  66. import "./chunk-3RSFVUKZ.js";
  67. import "./chunk-X4SA4ELJ.js";
  68. import "./chunk-5N7JLUJJ.js";
  69. import "./chunk-ZLNEXZAN.js";
  70. import "./chunk-ZYRIJWLX.js";
  71. import "./chunk-RYY6632W.js";
  72. import {
  73. A,
  74. g,
  75. p,
  76. q,
  77. r as r3,
  78. u,
  79. x
  80. } from "./chunk-DW42UVIT.js";
  81. import "./chunk-YAEIHDJH.js";
  82. import {
  83. n as n2,
  84. r as r2,
  85. t as t2
  86. } from "./chunk-TJNOJH33.js";
  87. import "./chunk-OSHI574D.js";
  88. import "./chunk-ETGAZ7LF.js";
  89. import "./chunk-75U5LM2V.js";
  90. import "./chunk-RMDDCMKS.js";
  91. import "./chunk-VCH45Q2I.js";
  92. import "./chunk-GSSTTHIT.js";
  93. import "./chunk-HZRKBTHJ.js";
  94. import "./chunk-DVUG3KID.js";
  95. import "./chunk-FWSQEIAR.js";
  96. import "./chunk-VEGAOVMY.js";
  97. import "./chunk-6T6G6LCQ.js";
  98. import "./chunk-YEJL5NEF.js";
  99. import "./chunk-PQFTYGF5.js";
  100. import {
  101. e,
  102. l,
  103. n5 as n
  104. } from "./chunk-2Z2TG5CU.js";
  105. import "./chunk-6KZ2LTDA.js";
  106. import {
  107. e as e2
  108. } from "./chunk-U2XHEJM7.js";
  109. import "./chunk-SQOPWYIT.js";
  110. import {
  111. f
  112. } from "./chunk-V6P2MAQQ.js";
  113. import "./chunk-E5O6P5I2.js";
  114. import "./chunk-SPWQ3AWG.js";
  115. import "./chunk-2TIUKVZN.js";
  116. import {
  117. i,
  118. r,
  119. t
  120. } from "./chunk-YXWMMD76.js";
  121. import "./chunk-S5KM4IGW.js";
  122. // node_modules/@arcgis/core/geometry/support/clipRay.js
  123. function s3(r6) {
  124. return r6 ? { ray: d(r6.ray), c0: r6.c0, c1: r6.c1 } : { ray: d(), c0: 0, c1: Number.MAX_VALUE };
  125. }
  126. var k3 = new s(() => s3());
  127. // node_modules/@arcgis/core/geometry/support/frustum.js
  128. function I() {
  129. return [n2(), n2(), n2(), n2(), n2(), n2(), n2(), n2()];
  130. }
  131. function i2(T3, _2) {
  132. for (let O2 = 0; O2 < v3.NUM; O2++) {
  133. const R4 = T3[O2];
  134. if (R4[0] * _2[0] + R4[1] * _2[1] + R4[2] * _2[2] + R4[3] >= _2[3])
  135. return false;
  136. }
  137. return true;
  138. }
  139. var U;
  140. var l2;
  141. !function(T3) {
  142. T3[T3.LEFT = 0] = "LEFT", T3[T3.RIGHT = 1] = "RIGHT", T3[T3.BOTTOM = 2] = "BOTTOM", T3[T3.TOP = 3] = "TOP", T3[T3.NEAR = 4] = "NEAR", T3[T3.FAR = 5] = "FAR";
  143. }(U || (U = {})), function(T3) {
  144. T3[T3.NEAR_BOTTOM_LEFT = 0] = "NEAR_BOTTOM_LEFT", T3[T3.NEAR_BOTTOM_RIGHT = 1] = "NEAR_BOTTOM_RIGHT", T3[T3.NEAR_TOP_RIGHT = 2] = "NEAR_TOP_RIGHT", T3[T3.NEAR_TOP_LEFT = 3] = "NEAR_TOP_LEFT", T3[T3.FAR_BOTTOM_LEFT = 4] = "FAR_BOTTOM_LEFT", T3[T3.FAR_BOTTOM_RIGHT = 5] = "FAR_BOTTOM_RIGHT", T3[T3.FAR_TOP_RIGHT = 6] = "FAR_TOP_RIGHT", T3[T3.FAR_TOP_LEFT = 7] = "FAR_TOP_LEFT";
  145. }(l2 || (l2 = {}));
  146. var k4 = { bottom: [l2.FAR_BOTTOM_RIGHT, l2.NEAR_BOTTOM_RIGHT, l2.NEAR_BOTTOM_LEFT, l2.FAR_BOTTOM_LEFT], near: [l2.NEAR_BOTTOM_LEFT, l2.NEAR_BOTTOM_RIGHT, l2.NEAR_TOP_RIGHT, l2.NEAR_TOP_LEFT], far: [l2.FAR_BOTTOM_RIGHT, l2.FAR_BOTTOM_LEFT, l2.FAR_TOP_LEFT, l2.FAR_TOP_RIGHT], right: [l2.NEAR_BOTTOM_RIGHT, l2.FAR_BOTTOM_RIGHT, l2.FAR_TOP_RIGHT, l2.NEAR_TOP_RIGHT], left: [l2.FAR_BOTTOM_LEFT, l2.NEAR_BOTTOM_LEFT, l2.NEAR_TOP_LEFT, l2.FAR_TOP_LEFT], top: [l2.FAR_TOP_LEFT, l2.NEAR_TOP_LEFT, l2.NEAR_TOP_RIGHT, l2.FAR_TOP_RIGHT] };
  147. var v3;
  148. var h2;
  149. !function(T3) {
  150. T3[T3.NUM = 6] = "NUM";
  151. }(v3 || (v3 = {})), function(T3) {
  152. T3[T3.NUM = 8] = "NUM";
  153. }(h2 || (h2 = {}));
  154. var g2 = [r4(-1, -1, -1, 1), r4(1, -1, -1, 1), r4(1, 1, -1, 1), r4(-1, 1, -1, 1), r4(-1, -1, 1, 1), r4(1, -1, 1, 1), r4(1, 1, 1, 1), r4(-1, 1, 1, 1)];
  155. var b2 = new s(s3);
  156. var y = I();
  157. // node_modules/@arcgis/core/views/3d/webgl-engine/lib/Octree.js
  158. var g3 = class {
  159. constructor(e3, t4) {
  160. this._objectToBoundingSphere = e3, this._maximumObjectsPerNode = 10, this._maximumDepth = 20, this._degenerateObjects = /* @__PURE__ */ new Set(), this._root = new O(), this._objectCount = 0, t4 && (void 0 !== t4.maximumObjectsPerNode && (this._maximumObjectsPerNode = t4.maximumObjectsPerNode), void 0 !== t4.maximumDepth && (this._maximumDepth = t4.maximumDepth));
  161. }
  162. get bounds() {
  163. return this._root.bounds;
  164. }
  165. get halfSize() {
  166. return this._root.halfSize;
  167. }
  168. get root() {
  169. return this._root.node;
  170. }
  171. get maximumObjectsPerNode() {
  172. return this._maximumObjectsPerNode;
  173. }
  174. get maximumDepth() {
  175. return this._maximumDepth;
  176. }
  177. get objectCount() {
  178. return this._objectCount;
  179. }
  180. destroy() {
  181. this._degenerateObjects.clear(), O.clearPool(), B[0] = null, w2.prune(), W.prune();
  182. }
  183. add(e3, t4 = e3.length) {
  184. this._objectCount += t4, this._grow(e3, t4);
  185. const n3 = O.acquire();
  186. for (let o2 = 0; o2 < t4; o2++) {
  187. const t5 = e3[o2];
  188. this._isDegenerate(t5) ? this._degenerateObjects.add(t5) : (n3.init(this._root), this._add(t5, n3));
  189. }
  190. O.release(n3);
  191. }
  192. remove(t4, n3 = null) {
  193. this._objectCount -= t4.length;
  194. const o2 = O.acquire();
  195. for (const r6 of t4) {
  196. const t5 = r(n3) ? n3 : _(this._objectToBoundingSphere(r6), C);
  197. z2(t5[3]) ? (o2.init(this._root), this._remove(r6, t5, o2)) : this._degenerateObjects.delete(r6);
  198. }
  199. O.release(o2), this._shrink();
  200. }
  201. update(e3, t4) {
  202. if (!z2(t4[3]) && this._isDegenerate(e3))
  203. return;
  204. const n3 = R3(e3);
  205. this.remove(n3, t4), this.add(n3);
  206. }
  207. forEachAlongRay(e3, t4, n3) {
  208. const o2 = p2(e3, t4);
  209. this._forEachNode(this._root, (e4) => {
  210. if (!this._intersectsNode(o2, e4))
  211. return false;
  212. const t5 = e4.node;
  213. return t5.terminals.forAll((e5) => {
  214. this._intersectsObject(o2, e5) && n3(e5);
  215. }), null !== t5.residents && t5.residents.forAll((e5) => {
  216. this._intersectsObject(o2, e5) && n3(e5);
  217. }), true;
  218. });
  219. }
  220. forEachAlongRayWithVerticalOffset(e3, t4, n3, o2) {
  221. const r6 = p2(e3, t4);
  222. this._forEachNode(this._root, (e4) => {
  223. if (!this._intersectsNodeWithOffset(r6, e4, o2))
  224. return false;
  225. const t5 = e4.node;
  226. return t5.terminals.forAll((e5) => {
  227. this._intersectsObjectWithOffset(r6, e5, o2) && n3(e5);
  228. }), null !== t5.residents && t5.residents.forAll((e5) => {
  229. this._intersectsObjectWithOffset(r6, e5, o2) && n3(e5);
  230. }), true;
  231. });
  232. }
  233. forEach(e3) {
  234. this._forEachNode(this._root, (t4) => {
  235. const n3 = t4.node;
  236. return n3.terminals.forAll(e3), null !== n3.residents && n3.residents.forAll(e3), true;
  237. }), this._degenerateObjects.forEach(e3);
  238. }
  239. forEachDegenerateObject(e3) {
  240. this._degenerateObjects.forEach(e3);
  241. }
  242. findClosest(e3, t4, n3, s4 = () => true, i3 = 1 / 0) {
  243. let h3 = 1 / 0, a2 = 1 / 0, d2 = null;
  244. const c3 = E(e3, t4), u3 = (o2) => {
  245. if (--i3, !s4(o2))
  246. return;
  247. const r6 = this._objectToBoundingSphere(o2);
  248. if (!i2(n3, r6))
  249. return;
  250. const c4 = M(e3, t4, k(r6)), u4 = c4 - r6[3], f3 = c4 + r6[3];
  251. u4 < h3 && (h3 = u4, a2 = f3, d2 = o2);
  252. };
  253. return this._forEachNodeDepthOrdered(this._root, (s5) => {
  254. if (i3 <= 0 || !i2(n3, s5.bounds))
  255. return false;
  256. g(F, c3, s5.halfSize), u(F, F, s5.bounds);
  257. if (M(e3, t4, F) > a2)
  258. return false;
  259. const h4 = s5.node;
  260. return h4.terminals.forAll((e4) => u3(e4)), null !== h4.residents && h4.residents.forAll((e4) => u3(e4)), true;
  261. }, e3, t4), d2;
  262. }
  263. forEachInDepthRange(e3, t4, n3, s4, i3, h3, a2) {
  264. let d2 = -1 / 0, c3 = 1 / 0;
  265. const u3 = { setRange: (e4) => {
  266. n3 === g3.DepthOrder.FRONT_TO_BACK ? (d2 = Math.max(d2, e4.near), c3 = Math.min(c3, e4.far)) : (d2 = Math.max(d2, -e4.far), c3 = Math.min(c3, -e4.near));
  267. } };
  268. u3.setRange(s4);
  269. const f3 = M(t4, n3, e3), m2 = E(t4, n3), p5 = E(t4, -n3), b3 = (e4) => {
  270. if (!a2(e4))
  271. return;
  272. const o2 = this._objectToBoundingSphere(e4), r6 = k(o2), s5 = M(t4, n3, r6) - f3, m3 = s5 - o2[3], p6 = s5 + o2[3];
  273. m3 > c3 || p6 < d2 || !i2(h3, o2) || i3(e4, u3);
  274. };
  275. this._forEachNodeDepthOrdered(this._root, (e4) => {
  276. if (!i2(h3, e4.bounds))
  277. return false;
  278. g(F, m2, e4.halfSize), u(F, F, e4.bounds);
  279. if (M(t4, n3, F) - f3 > c3)
  280. return false;
  281. g(F, p5, e4.halfSize), u(F, F, e4.bounds);
  282. if (M(t4, n3, F) - f3 < d2)
  283. return false;
  284. const s5 = e4.node;
  285. return s5.terminals.forAll((e5) => b3(e5)), null !== s5.residents && s5.residents.forAll((e5) => b3(e5)), true;
  286. }, t4, n3);
  287. }
  288. forEachNode(e3) {
  289. this._forEachNode(this._root, (t4) => e3(t4.node, t4.bounds, t4.halfSize));
  290. }
  291. forEachNeighbor(e3, t4) {
  292. const n3 = T(t4), o2 = k(t4), r6 = (t5) => {
  293. const r7 = this._objectToBoundingSphere(t5), i4 = T(r7), h4 = n3 + i4;
  294. return !(p(k(r7), o2) - h4 * h4 <= 0) || e3(t5);
  295. };
  296. let i3 = true;
  297. const h3 = (e4) => {
  298. i3 && (i3 = r6(e4));
  299. };
  300. this._forEachNode(this._root, (e4) => {
  301. const t5 = T(e4.bounds), r7 = n3 + t5;
  302. if (p(k(e4.bounds), o2) - r7 * r7 > 0)
  303. return false;
  304. const a2 = e4.node;
  305. return a2.terminals.forAll(h3), i3 && null !== a2.residents && a2.residents.forAll(h3), i3;
  306. }), i3 && this.forEachDegenerateObject(h3);
  307. }
  308. _intersectsNode(e3, t4) {
  309. return x2(t4.bounds, 2 * -t4.halfSize, k5), x2(t4.bounds, 2 * t4.halfSize, q3), c(e3.origin, e3.direction, k5, q3);
  310. }
  311. _intersectsNodeWithOffset(e3, t4, n3) {
  312. return x2(t4.bounds, 2 * -t4.halfSize, k5), x2(t4.bounds, 2 * t4.halfSize, q3), n3.applyToMinMax(k5, q3), c(e3.origin, e3.direction, k5, q3);
  313. }
  314. _intersectsObject(e3, t4) {
  315. const n3 = this._objectToBoundingSphere(t4);
  316. return !(n3[3] > 0) || V(n3, e3);
  317. }
  318. _intersectsObjectWithOffset(e3, t4, n3) {
  319. const o2 = this._objectToBoundingSphere(t4);
  320. return !(o2[3] > 0) || V(n3.applyToBoundingSphere(o2), e3);
  321. }
  322. _forEachNode(e3, t4) {
  323. let n3 = O.acquire().init(e3);
  324. const o2 = [n3];
  325. for (; 0 !== o2.length; ) {
  326. if (n3 = o2.pop(), t4(n3) && !n3.isLeaf())
  327. for (let e4 = 0; e4 < n3.node.children.length; e4++) {
  328. n3.node.children[e4] && o2.push(O.acquire().init(n3).advance(e4));
  329. }
  330. O.release(n3);
  331. }
  332. }
  333. _forEachNodeDepthOrdered(e3, t4, n3, o2 = g3.DepthOrder.FRONT_TO_BACK) {
  334. let r6 = O.acquire().init(e3);
  335. const s4 = [r6];
  336. for (T2(n3, o2, V2); 0 !== s4.length; ) {
  337. if (r6 = s4.pop(), t4(r6) && !r6.isLeaf())
  338. for (let e4 = 7; e4 >= 0; --e4) {
  339. const t5 = V2[e4];
  340. r6.node.children[t5] && s4.push(O.acquire().init(r6).advance(t5));
  341. }
  342. O.release(r6);
  343. }
  344. }
  345. _remove(e3, t4, n3) {
  346. w2.clear();
  347. const o2 = n3.advanceTo(t4, (e4, t5) => {
  348. w2.push(e4.node), w2.push(t5);
  349. }) ? n3.node.terminals : n3.node.residents;
  350. if (o2.removeUnordered(e3), 0 === o2.length)
  351. for (let r6 = w2.length - 2; r6 >= 0; r6 -= 2) {
  352. const e4 = w2.data[r6], t5 = w2.data[r6 + 1];
  353. if (!this._purge(e4, t5))
  354. break;
  355. }
  356. }
  357. _nodeIsEmpty(e3) {
  358. if (0 !== e3.terminals.length)
  359. return false;
  360. if (null !== e3.residents)
  361. return 0 === e3.residents.length;
  362. for (let t4 = 0; t4 < e3.children.length; t4++)
  363. if (e3.children[t4])
  364. return false;
  365. return true;
  366. }
  367. _purge(e3, t4) {
  368. return t4 >= 0 && (e3.children[t4] = null), !!this._nodeIsEmpty(e3) && (null === e3.residents && (e3.residents = new l({ shrink: true })), true);
  369. }
  370. _add(e3, t4) {
  371. t4.advanceTo(this._objectToBoundingSphere(e3)) ? t4.node.terminals.push(e3) : (t4.node.residents.push(e3), t4.node.residents.length > this._maximumObjectsPerNode && t4.depth < this._maximumDepth && this._split(t4));
  372. }
  373. _split(e3) {
  374. const t4 = e3.node.residents;
  375. e3.node.residents = null;
  376. for (let n3 = 0; n3 < t4.length; n3++) {
  377. const o2 = O.acquire().init(e3);
  378. this._add(t4.getItemAt(n3), o2), O.release(o2);
  379. }
  380. }
  381. _grow(e3, t4) {
  382. if (0 !== t4 && (N2(e3, t4, (e4) => this._objectToBoundingSphere(e4), I2), z2(I2[3]) && !this._fitsInsideTree(I2)))
  383. if (this._nodeIsEmpty(this._root.node))
  384. _(I2, this._root.bounds), this._root.halfSize = 1.25 * I2[3];
  385. else {
  386. const e4 = this._rootBoundsForRootAsSubNode(I2);
  387. this._placingRootViolatesMaxDepth(e4) ? this._rebuildTree(I2, e4) : this._growRootAsSubNode(e4), O.release(e4);
  388. }
  389. }
  390. _rebuildTree(e3, t4) {
  391. r3(P, t4.bounds), P[3] = t4.halfSize, N2([e3, P], 2, (e4) => e4, L);
  392. const n3 = O.acquire().init(this._root);
  393. this._root.initFrom(null, L, 1.25 * L[3]), this._forEachNode(n3, (e4) => (this.add(e4.node.terminals.data, e4.node.terminals.length), null !== e4.node.residents && this.add(e4.node.residents.data, e4.node.residents.length), true)), O.release(n3);
  394. }
  395. _placingRootViolatesMaxDepth(e3) {
  396. const t4 = Math.log(e3.halfSize / this._root.halfSize) * Math.LOG2E;
  397. let n3 = 0;
  398. return this._forEachNode(this._root, (e4) => (n3 = Math.max(n3, e4.depth), n3 + t4 <= this._maximumDepth)), n3 + t4 > this._maximumDepth;
  399. }
  400. _rootBoundsForRootAsSubNode(e3) {
  401. const t4 = e3[3], n3 = e3;
  402. let o2 = -1 / 0;
  403. const r6 = this._root.bounds, s4 = this._root.halfSize;
  404. for (let i3 = 0; i3 < 3; i3++) {
  405. const e4 = r6[i3] - s4 - (n3[i3] - t4), h3 = n3[i3] + t4 - (r6[i3] + s4), a2 = Math.max(0, Math.ceil(e4 / (2 * s4))), d2 = Math.max(0, Math.ceil(h3 / (2 * s4))) + 1, l3 = 2 ** Math.ceil(Math.log(a2 + d2) * Math.LOG2E);
  406. o2 = Math.max(o2, l3), K[i3].min = a2, K[i3].max = d2;
  407. }
  408. for (let i3 = 0; i3 < 3; i3++) {
  409. let e4 = K[i3].min, t5 = K[i3].max;
  410. const n4 = (o2 - (e4 + t5)) / 2;
  411. e4 += Math.ceil(n4), t5 += Math.floor(n4);
  412. const h3 = r6[i3] - s4 - e4 * s4 * 2;
  413. y2[i3] = h3 + (t5 + e4) * s4;
  414. }
  415. return y2[3] = o2 * s4 * v4, O.acquire().initFrom(null, y2, o2 * s4, 0);
  416. }
  417. _growRootAsSubNode(e3) {
  418. const t4 = this._root.node;
  419. r3(I2, this._root.bounds), I2[3] = this._root.halfSize, this._root.init(e3), e3.advanceTo(I2, null, true), e3.node.children = t4.children, e3.node.residents = t4.residents, e3.node.terminals = t4.terminals;
  420. }
  421. _shrink() {
  422. for (; ; ) {
  423. const e3 = this._findShrinkIndex();
  424. if (-1 === e3)
  425. break;
  426. this._root.advance(e3), this._root.depth = 0;
  427. }
  428. }
  429. _findShrinkIndex() {
  430. if (0 !== this._root.node.terminals.length || this._root.isLeaf())
  431. return -1;
  432. let e3 = null;
  433. const t4 = this._root.node.children;
  434. let n3 = 0, o2 = 0;
  435. for (; o2 < t4.length && null == e3; )
  436. n3 = o2++, e3 = t4[n3];
  437. for (; o2 < t4.length; )
  438. if (t4[o2++])
  439. return -1;
  440. return n3;
  441. }
  442. _isDegenerate(e3) {
  443. return !z2(this._objectToBoundingSphere(e3)[3]);
  444. }
  445. _fitsInsideTree(e3) {
  446. const t4 = this._root.bounds, n3 = this._root.halfSize;
  447. return e3[3] <= n3 && e3[0] >= t4[0] - n3 && e3[0] <= t4[0] + n3 && e3[1] >= t4[1] - n3 && e3[1] <= t4[1] + n3 && e3[2] >= t4[2] - n3 && e3[2] <= t4[2] + n3;
  448. }
  449. };
  450. var O = class {
  451. constructor() {
  452. this.bounds = R(), this.halfSize = 0, this.initFrom(null, null, 0, 0);
  453. }
  454. init(e3) {
  455. return this.initFrom(e3.node, e3.bounds, e3.halfSize, e3.depth);
  456. }
  457. initFrom(t4, n3, o2, r6 = this.depth) {
  458. return this.node = r(t4) ? t4 : O.createEmptyNode(), r(n3) && _(n3, this.bounds), this.halfSize = o2, this.depth = r6, this;
  459. }
  460. advance(e3) {
  461. let t4 = this.node.children[e3];
  462. t4 || (t4 = O.createEmptyNode(), this.node.children[e3] = t4), this.node = t4, this.halfSize /= 2, this.depth++;
  463. const n3 = A3[e3];
  464. return this.bounds[0] += n3[0] * this.halfSize, this.bounds[1] += n3[1] * this.halfSize, this.bounds[2] += n3[2] * this.halfSize, this.bounds[3] = this.halfSize * v4, this;
  465. }
  466. advanceTo(e3, t4, n3 = false) {
  467. for (; ; ) {
  468. if (this.isTerminalFor(e3))
  469. return t4 && t4(this, -1), true;
  470. if (this.isLeaf()) {
  471. if (!n3)
  472. return t4 && t4(this, -1), false;
  473. this.node.residents = null;
  474. }
  475. const o2 = this._childIndex(e3);
  476. t4 && t4(this, o2), this.advance(o2);
  477. }
  478. }
  479. isLeaf() {
  480. return null != this.node.residents;
  481. }
  482. isTerminalFor(e3) {
  483. return e3[3] > this.halfSize / 2;
  484. }
  485. _childIndex(e3) {
  486. const t4 = this.bounds;
  487. return (t4[0] < e3[0] ? 1 : 0) + (t4[1] < e3[1] ? 2 : 0) + (t4[2] < e3[2] ? 4 : 0);
  488. }
  489. static createEmptyNode() {
  490. return { children: [null, null, null, null, null, null, null, null], terminals: new l({ shrink: true }), residents: new l({ shrink: true }) };
  491. }
  492. static acquire() {
  493. return O._pool.acquire();
  494. }
  495. static release(e3) {
  496. O._pool.release(e3);
  497. }
  498. static clearPool() {
  499. O._pool.prune();
  500. }
  501. };
  502. function j4(e3, t4) {
  503. e3[0] = Math.min(e3[0], t4[0] - t4[3]), e3[1] = Math.min(e3[1], t4[1] - t4[3]), e3[2] = Math.min(e3[2], t4[2] - t4[3]);
  504. }
  505. function S(e3, t4) {
  506. e3[0] = Math.max(e3[0], t4[0] + t4[3]), e3[1] = Math.max(e3[1], t4[1] + t4[3]), e3[2] = Math.max(e3[2], t4[2] + t4[3]);
  507. }
  508. function x2(e3, t4, n3) {
  509. n3[0] = e3[0] + t4, n3[1] = e3[1] + t4, n3[2] = e3[2] + t4;
  510. }
  511. function N2(e3, t4, n3, o2) {
  512. if (1 === t4) {
  513. const t5 = n3(e3[0]);
  514. _(t5, o2);
  515. } else {
  516. k5[0] = 1 / 0, k5[1] = 1 / 0, k5[2] = 1 / 0, q3[0] = -1 / 0, q3[1] = -1 / 0, q3[2] = -1 / 0;
  517. for (let o3 = 0; o3 < t4; o3++) {
  518. const t5 = n3(e3[o3]);
  519. z2(t5[3]) && (j4(k5, t5), S(q3, t5));
  520. }
  521. A(o2, k5, q3, 0.5), o2[3] = Math.max(q3[0] - k5[0], q3[1] - k5[1], q3[2] - k5[2]) / 2;
  522. }
  523. }
  524. function T2(e3, t4, n3) {
  525. if (!W.length)
  526. for (let o2 = 0; o2 < 8; ++o2)
  527. W.push({ index: 0, distance: 0 });
  528. for (let o2 = 0; o2 < 8; ++o2) {
  529. const n4 = A3[o2];
  530. W.data[o2].index = o2, W.data[o2].distance = M(e3, t4, n4);
  531. }
  532. W.sort((e4, t5) => e4.distance - t5.distance);
  533. for (let o2 = 0; o2 < 8; ++o2)
  534. n3[o2] = W.data[o2].index;
  535. }
  536. function E(e3, t4) {
  537. let n3, o2 = 1 / 0;
  538. for (let r6 = 0; r6 < 8; ++r6) {
  539. const s4 = M(e3, t4, D2[r6]);
  540. s4 < o2 && (o2 = s4, n3 = D2[r6]);
  541. }
  542. return n3;
  543. }
  544. function M(e3, t4, n3) {
  545. return t4 * (e3[0] * n3[0] + e3[1] * n3[1] + e3[2] * n3[2]);
  546. }
  547. function z2(e3) {
  548. return !isNaN(e3) && e3 !== -1 / 0 && e3 !== 1 / 0 && e3 > 0;
  549. }
  550. O._pool = new e2(O), function(e3) {
  551. var t4;
  552. (t4 = e3.DepthOrder || (e3.DepthOrder = {}))[t4.FRONT_TO_BACK = 1] = "FRONT_TO_BACK", t4[t4.BACK_TO_FRONT = -1] = "BACK_TO_FRONT";
  553. }(g3 || (g3 = {}));
  554. var A3 = [r2(-1, -1, -1), r2(1, -1, -1), r2(-1, 1, -1), r2(1, 1, -1), r2(-1, -1, 1), r2(1, -1, 1), r2(-1, 1, 1), r2(1, 1, 1)];
  555. var D2 = [r2(-1, -1, -1), r2(-1, -1, 1), r2(-1, 1, -1), r2(-1, 1, 1), r2(1, -1, -1), r2(1, -1, 1), r2(1, 1, -1), r2(1, 1, 1)];
  556. var v4 = Math.sqrt(3);
  557. var B = [null];
  558. function R3(e3) {
  559. return B[0] = e3, B;
  560. }
  561. var y2 = R();
  562. var F = n2();
  563. var k5 = n2();
  564. var q3 = n2();
  565. var w2 = new l();
  566. var C = R();
  567. var I2 = R();
  568. var P = R();
  569. var L = R();
  570. var K = [{ min: 0, max: 0 }, { min: 0, max: 0 }, { min: 0, max: 0 }];
  571. var W = new l();
  572. var V2 = [0, 0, 0, 0, 0, 0, 0, 0];
  573. var G2 = g3;
  574. // node_modules/@arcgis/core/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js
  575. var t3 = 1e3;
  576. function a(t4, a2, e3) {
  577. const i3 = R(), m2 = k(i3);
  578. return q(m2, m2, t4, 0.5), q(m2, m2, a2, 0.5), i3[3] = x(m2, t4), u(m2, m2, e3), i3;
  579. }
  580. // node_modules/@arcgis/core/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js
  581. var j5 = class {
  582. constructor() {
  583. this._idToComponent = /* @__PURE__ */ new Map(), this._components = new G2((e3) => e3.bounds), this._edges = new G2((e3) => e3.bounds), this._tmpLineSegment = v(), this._tmpP1 = n2(), this._tmpP2 = n2(), this._tmpP3 = n2(), this.remoteClient = null;
  584. }
  585. async fetchCandidates(e3, t4) {
  586. await Promise.resolve(), f(t4), await this._ensureEdgeLocations(e3, t4);
  587. const s4 = [];
  588. return this._edges.forEachNeighbor((t5) => (this._addCandidates(e3, t5, s4), s4.length < t3), e3.bounds), { result: { candidates: s4 } };
  589. }
  590. async _ensureEdgeLocations(e3, o2) {
  591. const n3 = [];
  592. if (this._components.forEachNeighbor((e4) => {
  593. if (t(e4.info)) {
  594. const { id: t4, uid: s4 } = e4;
  595. n3.push({ id: t4, uid: s4 });
  596. }
  597. return true;
  598. }, e3.bounds), !n3.length)
  599. return;
  600. const i3 = { components: n3 }, r6 = await this.remoteClient.invoke("fetchAllEdgeLocations", i3, i(o2, {}));
  601. for (const t4 of r6.components)
  602. this._setFetchEdgeLocations(t4);
  603. }
  604. async add(e3) {
  605. const t4 = new E2(e3.id, e3.bounds);
  606. return this._idToComponent.set(t4.id, t4), this._components.add([t4]), { result: {} };
  607. }
  608. async remove(e3) {
  609. const t4 = this._idToComponent.get(e3.id);
  610. if (t4) {
  611. const e4 = [];
  612. this._edges.forEachNeighbor((s4) => (s4.component === t4 && e4.push(s4), true), t4.bounds), this._edges.remove(e4), this._components.remove([t4]), this._idToComponent.delete(t4.id);
  613. }
  614. return { result: {} };
  615. }
  616. _setFetchEdgeLocations(e3) {
  617. const s4 = this._idToComponent.get(e3.id);
  618. if (t(s4) || e3.uid !== s4.uid)
  619. return;
  620. const o2 = m.createView(e3.locations), n3 = new Array(o2.count), i3 = n2(), r6 = n2();
  621. for (let t4 = 0; t4 < o2.count; t4++) {
  622. o2.position0.getVec(t4, i3), o2.position1.getVec(t4, r6);
  623. const d2 = a(i3, r6, e3.origin), c4 = new C2(s4, t4, d2);
  624. n3[t4] = c4;
  625. }
  626. this._edges.add(n3);
  627. const { objectIds: c3, origin: a2 } = e3;
  628. s4.info = { locations: o2, objectIds: c3, origin: a2 };
  629. }
  630. _addCandidates(e3, t4, s4) {
  631. const { locations: o2, origin: n3, objectIds: r6 } = t4.component.info, d2 = o2.position0.getVec(t4.index, this._tmpP1), c3 = o2.position1.getVec(t4.index, this._tmpP2);
  632. u(d2, d2, n3), u(c3, c3, n3);
  633. const a2 = r6[o2.componentIndex.get(t4.index)];
  634. this._addEdgeCandidate(e3, a2, d2, c3, s4), this._addVertexCandidate(e3, a2, d2, s4), this._addVertexCandidate(e3, a2, c3, s4);
  635. }
  636. _addEdgeCandidate(e3, t4, s4, o2, n3) {
  637. if (!(e3.types & q2.EDGE))
  638. return;
  639. const i3 = k(e3.bounds), d2 = b(s4, o2, this._tmpLineSegment), a2 = j(d2, i3, this._tmpP3);
  640. if (!N(e3.bounds, a2))
  641. return null;
  642. n3.push({ type: "edge", objectId: t4, target: t2(a2), distance: x(i3, a2), start: t2(s4), end: t2(o2) });
  643. }
  644. _addVertexCandidate(e3, t4, s4, o2) {
  645. if (!(e3.types & q2.VERTEX))
  646. return;
  647. const n3 = k(e3.bounds);
  648. if (!N(e3.bounds, s4))
  649. return null;
  650. o2.push({ type: "vertex", objectId: t4, target: t2(s4), distance: x(n3, s4) });
  651. }
  652. };
  653. j5 = e([n("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")], j5);
  654. var y3 = j5;
  655. var E2 = class {
  656. constructor(e3, t4) {
  657. this.id = e3, this.bounds = t4, this.info = null, this.uid = ++E2.uid;
  658. }
  659. };
  660. E2.uid = 0;
  661. var C2 = class {
  662. constructor(e3, t4, s4) {
  663. this.component = e3, this.index = t4, this.bounds = s4;
  664. }
  665. };
  666. export {
  667. y3 as default
  668. };
  669. //# sourceMappingURL=SceneLayerSnappingSourceWorker-B4FQTD4Q.js.map