SceneLayerSnappingSourceWorker-ZCIBJJSJ.js 23 KB

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