1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- // node_modules/@arcgis/core/core/ObjectPool.js
- function t(t3) {
- return t3 && t3.release && typeof t3.release == "function";
- }
- function i(t3) {
- return t3 && t3.acquire && typeof t3.acquire == "function";
- }
- var e = class {
- constructor(t3, i2, e2, o2 = 1, s = 0) {
- if (this.ctor = t3, this.acquireFunction = i2, this.releaseFunction = e2, this.allocationSize = o2, this._pool = new Array(s), this._initialSize = s, this.ctor)
- for (let n = 0; n < s; n++)
- this._pool[n] = new this.ctor();
- this.allocationSize = Math.max(o2, 1);
- }
- destroy() {
- this.prune(0);
- }
- acquire(...t3) {
- let o2;
- if (e.test.disabled)
- o2 = new this.ctor();
- else {
- if (this._pool.length === 0) {
- const t4 = this.allocationSize;
- for (let i2 = 0; i2 < t4; i2++)
- this._pool[i2] = new this.ctor();
- }
- o2 = this._pool.pop();
- }
- return this.acquireFunction ? this.acquireFunction(o2, ...t3) : i(o2) && o2.acquire(...t3), o2;
- }
- release(i2) {
- i2 && !e.test.disabled && (this.releaseFunction ? this.releaseFunction(i2) : t(i2) && i2.release(), this._pool.push(i2));
- }
- prune(t3 = this._initialSize) {
- if (!(t3 >= this._pool.length)) {
- for (let i2 = t3; i2 < this._pool.length; ++i2) {
- const t4 = this._pool[i2];
- this._dispose(t4);
- }
- this._pool.length = t3;
- }
- }
- _dispose(t3) {
- t3.dispose && typeof t3.dispose == "function" && t3.dispose();
- }
- };
- e.test = { disabled: false };
- // node_modules/@arcgis/core/core/ArrayPool.js
- function r(e2) {
- e2.length = 0;
- }
- var t2 = class {
- constructor(t3 = 50, o2 = 50) {
- this._pool = new e(Array, void 0, r, o2, t3);
- }
- acquire() {
- return this._pool.acquire();
- }
- release(e2) {
- this._pool.release(e2);
- }
- prune() {
- this._pool.prune(0);
- }
- static acquire() {
- return o.acquire();
- }
- static release(e2) {
- return o.release(e2);
- }
- static prune() {
- o.prune();
- }
- };
- var o = new t2(100);
- export {
- e,
- t2 as t
- };
- //# sourceMappingURL=chunk-WSRBH7BF.js.map
|