UNPKG

@realsee/five

Version:

Realsee Renderer SDK

6,044 lines • 278 kB
/**
 * @license
 * @realsee/five
 * Generated: 10/28/2026
 * Version: 6.9.3
 * Terms:
 * Realsee SDK License Agreement
 * Update: July 28, 2021
 * THIS LICENSE AGREEMENT BETWEEN YOU AND 【BEIKE REALSEE TECHNOLOGY (HK) 
 * LIMITED】(“Realsee”) FORMS A LEGALLY BINDING CONTRACT BETWEEN YOU AND REALSEE IN 
 * RELATION TO YOUR USE OF THE SDK. This License Agreement accompanies the Realsee 
 * Software Development Kit(s) for the software and related explanatory materials 
 * (the "SDK") and includes any upgrades, modified versions, updates, additions, 
 * and copies of the SDK licensed to You by Realsee.
 * BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE 
 * THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THIS AGREEMENT. YOU ARE 
 * AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO 
 * THE TERMS AND CONDITIONS STATED BELOW.
 * This Agreement applies to Your use of the SDK in the country in which You 
 * legally install it (“Territory”) and is subject to the laws of such Territory 
 * and further subject to Section 12 below. Different terms, conditions, and 
 * limitations may apply to the use of the SDK in any additional countries.
 * 1. DEFINITIONS.
 * “Agreement” means this Realsee SDK License Agreement.
 * “Developer”, “You” and “Your” means the person(s) or entity acquiring or using 
 * the SDK or otherwise exercising rights under the terms of this Agreement.
 * “Documentation” means the technical or other specifications or documentation 
 * that Realsee may provide to You for use in connection with the SDK.
 * “Integrated Product” means any software, website, or on-line service developed 
 * by You based on or using the SDK (collectively, the “Integrated Product”).
 * “Intellectual Property” means any patents, patent rights, trademarks, service 
 * marks, registered and unregistered designs, applications for any of the 
 * foregoing, copyright, and any other similar protected rights in any country and 
 * to the extent recognised by any relevant jurisdiction as intellectual property, 
 * trade secrets, know-how and confidential information. Realsee reserves all 
 * rights not expressly granted to You.
 * “Realsee” means [Beike Realsee Technology (HK) Limited, a company incorporated 
 * and validly existing under the laws of Hong Kong].
 * “SDK” means the Realsee-proprietary Software Development Kits (SDK) provided 
 * hereunder, includes all development tools (including any compiler and debugger), 
 * application programming interfaces (“APIs”), libraries, binary utilities, header 
 * files, Documentation, content, data, code samples, and other materials provided 
 * to You in connection with this Agreement, whether delivered through a download, 
 * or any other media or form, and is licensed, not sold, to You by Realsee for use 
 * only under the terms of this Agreement. The terms of this Agreement will govern 
 * any updates provided by Realsee that replace and/or supplement the original SDK 
 * delivered to You, unless such update is accompanied by a separate license, in 
 * which case the terms of such license will govern.
 * 2. LICENSED USES AND RESTRICTIONS.
 * 2.1 Subject to the restrictions contained in this Section 2, Realsee grants to 
 * You during the term, a limited, non-exclusive, revocable, non-sublicensable, 
 * non-transferable license to install and use the SDK within the Territory only 
 * for the purpose of internal development.
 * 2.2 Restrictions. You acknowledge and agree that, You shall not, and shall 
 * ensure that Your affiliates, employees, agents, representatives, officers, 
 * representatives, and subcontractors do not (directly or indirectly):
 * 2.2.1 decompile, reverse engineer, disassemble or attempt to derive the source 
 * code of, those components of the SDK provided in object code form, or any part 
 * thereof;
 * 2.2.2 remove, alter, or obscure any copyright notice or other proprietary rights 
 * notice on any part of the SDK;
 * 2.2.3 sell, assign, pledge, rent, lease, lend, upload to or host on any website 
 * or server for use by any third party except You, redistribute, or sublicense the 
 * SDK (or any part thereof), or operate the SDK (or any part thereof) in the 
 * capacity of a service bureau or other hosted services provider, in whole or in 
 * part, nor may You enable others to do so;
 * 2.2.4 or alter, modify, customize or improve the SDK, or any part thereof;
 * 2.2.5 use the SDK (or any part thereof) for any illegal purpose, in any manner 
 * that is inconsistent with the terms of this Agreement, or to engage in any 
 * illegal activity;
 * 2.2.6 use the SDK (or any part thereof) in any manner that may damage the 
 * operation of Realsee’s products or services; or
 * 2.2.7 use the SDK or any information contained therein or otherwise provided by 
 * Realsee for the purpose of developing, or having developed, any product 
 * competitive with any Realsee product or service, as determined by Realsee in its 
 * sole discretion;
 * 2.2.8 include any portion of the SDK in Your Developer products.
 * 2.3 Realsee has the right to impose reasonable conditions such as a reasonable 
 * fee for use of the SDK in Integrated Product in the future.
 * 2.4 You may make a limited number of copies of the SDK to be used by Your 
 * employees or consultants as provided herein, and not for general business 
 * purposes, and such employees or consultants shall be subject to the obligations 
 * and restrictions in this Agreement.
 * 2.5 All licenses not expressly granted in this Agreement are reserved and no 
 * other licenses, immunity, or rights, express or implied, are granted by Realsee, 
 * by implication, estoppel, or otherwise.
 * 3. CONFIDENTIALITY.
 * The SDK and all source code, Documentation, specifications, engineering details, 
 * and related information pertaining to the SDK, whether in oral, written, 
 * graphic, or electronic form, are and shall remain the confidential and 
 * proprietary information of Realsee or its licensors (collectively, the 
 * “Confidential Information”). You shall (i) disclose Confidential Information to 
 * only those directors and employees (collectively, “Affiliates”) whose duties 
 * justify their need to know such information and who have been clearly informed 
 * of their obligation to maintain the confidential, proprietary, and/or trade 
 * secret status of such Confidential Information; and (ii) use Confidential 
 * Information solely in accordance with the license granted hereunder. In any 
 * event, You and Your Affiliates shall treat Confidential Information as strictly 
 * confidential and shall use the same care to prevent disclosure of such 
 * information as You use with respect to Your own similar confidential and/or 
 * proprietary information, which shall not be less than the care a reasonable 
 * person would use under similar circumstances. All Confidential Information, and 
 * any copies thereof, shall be returned promptly to Realsee upon request. You 
 * shall ensure that Your Affiliates comply with the provisions of this Section 3, 
 * and You shall be liable for any breach of this Section 3 resulting from the act 
 * or omission of any of Your Affiliates. You shall not disclose Confidential 
 * Information to any third party, including, without limitation, any of Your 
 * subcontractors.
 * 4. PROPRIETARY RIGHTS.
 * 4.1 As between You and Realsee, Realsee and/or its licensors retain ownership of 
 * all right, title, and interest in, to, and under the SDK, including, without 
 * limitation, all patents, copyrights, trade secrets, trademarks and other 
 * intellectual property and other proprietary rights therein, and reserve all 
 * rights not expressly granted to You.
 * 4.2 The items contained in the SDK are the intellectual property of Realsee and 
 * its licensors and are protected by PRC copyright and patent law, international 
 * treaty provisions and applicable laws of the country in which it is being used. 
 * You agree to protect all copyright and other ownership interests of Realsee 
 * and/or its licensors in all items in the SDK supplied under this License 
 * Agreement. You agree that all copies of the items in the SDK, reproduced for any 
 * reason by You, contain the same copyright notices, and other proprietary notices 
 * as appropriate, as appear on or in the original items delivered by Realsee in 
 * the SDK. Realsee and/or its licensors retain title and ownership of the items in 
 * the SDK, the media on which it is loaded, and all subsequent copies, regardless 
 * of the form or media in or on which the original and other copies may exist. 
 * Except as stated above, this Agreement does not grant You any rights to patents, 
 * copyrights, trade secrets, trademarks or any other rights in respect to the 
 * items in the SDK.
 * 5. TERM AND TERMINATION.
 * 5.1 This Agreement is effective until terminated. Realsee has the right to 
 * terminate this Agreement immediately, without judicial intervention, if You fail 
 * to comply with any term herein. Upon any such termination You must remove all 
 * full and partial copies of the items in the SDK from Your computer and 
 * discontinue the use of the items in the SDK.
 * 5.2 Realsee may at any time, terminate the Agreement with You if: (A) You have 
 * breached any provision of the Agreement; or (B) Realsee is required to do so by 
 * law; or (C) Realsee decides to no longer provide the SDK or certain parts of the 
 * SDK to users in the country in which You are resident or from which You use the 
 * service, or the provision of the SDK or certain SDK services to You by Realsee 
 * is, in Realsee's sole discretion, no longer legally or commercially viable.
 * 5.3 When the Agreement comes to an end, all of the legal rights, obligations and 
 * liabilities that You and Realsee have benefited from, been subject to (or which 
 * have accrued over time whilst the Agreement has been in force) or which are 
 * expressed to continue indefinitely, shall be unaffected by this cessation, and 
 * the provisions of Section 3, 4, 6, 7 and 8 shall continue to apply to such 
 * rights, obligations and liabilities indefinitely.
 * 6. DISCLAIMER OF WARRANTY.
 * YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE 
 * LAW, USE OF THE SDK (OR ANY PART THEREOF) IS AT YOUR SOLE RISK AND THAT THE 
 * ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS 
 * WITH YOU. REALSEE LICENSES THE SDK TO YOU ONLY ON AN "AS-IS" BASIS. REALSEE 
 * MAKES NO REPRESENTATION WITH RESPECT TO THE ADEQUACY OF ANY ITEMS IN THE SDK, 
 * WHETHER OR NOT USED BY YOU IN THE DEVELOPMENT OF INTEGRATED PRODUCT, FOR ANY 
 * PARTICULAR PURPOSE OR WITH RESPECT TO THEIR ADEQUACY TO PRODUCE ANY PARTICULAR 
 * RESULT. REALSEE AND ITS LICENSORS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING 
 * OUT OF THIS AGREEMENT OR FROM THE DISTRIBUTION OR USE OF INTEGRATED PRODUCT 
 * CONTAINING PORTIONS OF THE SDK. REALSEE AND ITS LICENSORS DISCLAIM ALL 
 * WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED 
 * CONDITIONS OR WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * OR NONINFRINGEMENT OF ANY THIRD PARTY RIGHT IN RESPECT OF THE ITEMS IN THE SDK 
 * OR ANY SERVICES RELATED TO THE SDK.
 * REALSEE IS UNDER NO OBLIGATION TO PROVIDE ANY SUPPORT UNDER THIS LICENSE 
 * AGREEMENT, INCLUDING UPGRADES OR FUTURE VERSIONS OF THE SDK OR ANY PORTIONS 
 * THEREOF, TO YOU, END USER OR TO ANY OTHER PARTY.
 * 7. LIMITATION OF LIABILITY.
 * TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL REALSEE OR ITS 
 * LICENSORS BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, OR 
 * CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, 
 * LOSS OF BUSINESS, REVENUE, OR PROFITS, LOSS OF OPPORTUNITY (WHETHER DIRECT OR 
 * INDIRECT), CORRUPTION OR LOSS OF DATA, LOSS OF REPUTATION OR SAVINGS, DOWNTIME, 
 * OR DAMAGE TO, LOSS OF OR REPLACEMENT OF DATA OR TRANSACTIONS, COST OF 
 * PROCUREMENT OF SUBSTITUTE SERVICES, BUSINESS INTERRUPTION, OR ANY OTHER 
 * COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY 
 * TO USE THE SDK (OR ANY PART THEREOF), ANY INTEGRATED PRODUCT, OR ANY THIRD PARTY 
 * SOFTWARE, APPLICATIONS, OR SERVICES IN CONJUNCTION WITH THE SDK (OR ANY PART 
 * THEREOF), HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT, 
 * OR OTHERWISE) AND EVEN IF REALSEE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
 * DAMAGES. IN NO EVENT WILL REALSEE’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES 
 * EXCEED ONE HUNDRED DOLLARS ($100.00). THE FOREGOING LIMITATIONS WILL APPLY EVEN 
 * IF THE ABOVE STATED REMEDY FAILS OF ITS ESSENTIAL PURPOSE. THE LIMITATIONS 
 * CONTAINED IN SECTIONS 6 AND THIS SECTION 7 ARE A FUNDAMENTAL PART OF THE BASIS 
 * OF REALSEE’S BARGAIN HEREUNDER, AND REALSEE WOULD NOT ENTER INTO THIS AGREEMENT 
 * OR PROVIDE YOU WITH ACCESS TO THE SDK ABSENT SUCH LIMITATIONS.
 * 8. INDEMNIFICATION.
 * To the extent permitted by applicable law, You agree to indemnify, defend and 
 * hold harmless Realsee, its affiliates and each of their directors, officers, 
 * employees, independent contractors, and agents (each a “Realsee Indemnified 
 * Party”) from any and all claims, losses, liabilities, damages, expenses, and 
 * costs (including without limitation attorneys’ fees and court costs) incurred by 
 * a Realsee Indemnified Party as a result of: (i) Your non-compliance with any 
 * terms of this Agreement; (ii) Your use of the SDK (or any part thereof); or 
 * (iii) Your use of any Integrated Product, including any claim that Integrated 
 * Product infringes the copyright, trademark, trade secret or other intellectual 
 * property right of a third party.
 * 9. ACKNOWLEDGEMENTS.
 * Portions of the SDK may utilize or include third party software and other 
 * copyrighted material. Acknowledgments, licensing terms, and disclaimers for such 
 * material are contained in Documentation for the SDK or may otherwise accompany 
 * such material, and Your use of such materials governed by their respective 
 * terms. In the event of conflict between the terms of this Agreement and an 
 * applicable open source or third party agreement, the open source or third party 
 * agreement will control solely with respect to the open source software or third 
 * party software. Moreover, You shall not subject any items (including not limited 
 * to source code, object code, and any software)  included in the SDK to any open 
 * source license.
 * 10. NON-BLOCKING OF REALSEE DEVELOPMENT.
 * You acknowledge that Realsee is currently developing or may develop technologies 
 * and products in the future that have or may have design and/or functionality 
 * similar to Integrated Product that You may develop based on Your license herein. 
 * Nothing in this Agreement shall impair, limit or curtail Realsee's right to 
 * continue with its development, maintenance and/or distribution of Realsee's 
 * technology or products.
 * 11. GENERAL.
 * 11.1 Export Control. You may not use or otherwise export or re-export the SDK 
 * (or any part thereof) except as authorized by United States law and the laws of 
 * the jurisdiction(s) in which the SDK (or any part thereof) was obtained. In 
 * particular, but without limitation, the SDK may not be exported or re-exported 
 * (i) into any U.S. embargoed countries or (ii) to anyone on the U.S. Treasury 
 * Department's list of Specially Designated Nationals or the U.S. Department of 
 * Commerce Denied Person's List or Entity List. By using the SDK (or any part 
 * thereof), You represent and warrant that You are not located in any such country 
 * or on any such list.
 * 11.2 Governing Law. This Agreement and the rights of the parties hereunder shall 
 * be governed by and construed in accordance with the laws of People’s Republic of 
 * China (for purpose of this Agreement, excluding Hong Kong, Taiwan, and Macau), 
 * without reference to its conflict of laws principles. Any dispute, controversy 
 * or claim arising from or in connection with this Agreement, or the breach, 
 * termination or invalidity thereof, shall be submitted to China International 
 * Economic and Trade Arbitration Commission (“CIETAC”) for arbitration in Beijing 
 * which shall be conducted in accordance with the CIETAC's arbitration rules in 
 * effect at the time of applying for arbitration. The arbitral award is final and 
 * binding upon both parties.
 * 11.3 Severability. If any provision of this Agreement is held by a court of 
 * competent jurisdiction to be unenforceable for any reason, the remaining 
 * provisions hereof will be unaffected and remain in full force and effect.
 * 11.4. Modifications. Realsee reserves the right, from time to time, with or 
 * without notice to You, to make revisions to this Agreement in our sole and 
 * absolute discretion.  The most current version of this Agreement will supersede 
 * all previous versions and shall be made available on the website where the SDK 
 * is made available, or by such other means as Realsee may determine in its 
 * discretion. Any modified versions of this Agreement hereto shall take effect 
 * from the time that it is made available. You shall be responsible for regularly 
 * checking for notice of any such modifications. You agree that Your continued use 
 * of the SDK constitutes Your agreement to the modified Agreement.
 * 11.5 Relationship of the Parties. This Agreement will not be construed as 
 * creating an agency, partnership, joint venture, fiduciary duty, or any other 
 * form of legal association between You and Realsee, and You will not represent to 
 * the contrary, whether expressly, by implication, appearance, or otherwise.
 * 11.6 Entire Agreement; Governing Language. This Agreement constitutes the entire 
 * agreement between You and Realsee with respect to the use of the SDK licensed 
 * hereunder and supersedes all prior understandings regarding such subject matter. 
 * No amendment to or modification of this Agreement will be binding unless in 
 * writing and signed by Realsee. You and Realsee hereto confirm that this 
 * Agreement and all related documents shall be drafted in English.
*/import { AnimationFrameLoop as e, Camera as t, PanoCircleMesh as n, Subscribe as r } from "@realsee/five";
import * as i from "three";
import { BufferAttribute as a, BufferGeometry as o, EventDispatcher as s, InstancedBufferAttribute as c, InstancedBufferGeometry as l, MOUSE as u, Matrix4 as d, Object3D as f, Quaternion as p, Spherical as m, TOUCH as h, Vector2 as g, Vector3 as _ } from "three";
import { BasePlugin as v } from "@realsee/five/plugins";
//#region build/plugins/utils/absoluteUrl.js
function y(e) {
	return /^https?:\/\/|^\/\//.test(e) || /^data:/.test(e);
}
function b(e, t) {
	return y(t) ? t : `${e}${t}`;
}
//#endregion
//#region build/plugins/BasePlugin/index.js
var x;
(function(e) {
	class t {
		constructor(e, t) {
			this.hooks = new r(), this.staticPrefix = "//vr-image-4.realsee-cdn.cn", this.five = e, t != null && t.staticPrefix && (this.staticPrefix = t.staticPrefix);
		}
		getCurrentState() {
			return this.state;
		}
		absoluteUrl(e) {
			return b(this.staticPrefix, e);
		}
	}
	e.Controller = t;
})(x || (x = {}));
//#endregion
//#region node_modules/tslib/tslib.es6.mjs
function S(e, t, n, r) {
	function i(e) {
		return e instanceof n ? e : new n(function(t) {
			t(e);
		});
	}
	return new (n || (n = Promise))(function(n, a) {
		function o(e) {
			try {
				c(r.next(e));
			} catch (e) {
				a(e);
			}
		}
		function s(e) {
			try {
				c(r.throw(e));
			} catch (e) {
				a(e);
			}
		}
		function c(e) {
			e.done ? n(e.value) : i(e.value).then(o, s);
		}
		c((r = r.apply(e, t || [])).next());
	});
}
//#endregion
//#region build/plugins/utils/loadImage.js
function C(e) {
	return new Promise((t, n) => {
		let r = new Image();
		r.onload = function() {
			r.onload = r.onerror = function() {}, t(r);
		}, r.onerror = function(e) {
			r.onload = r.onerror = function() {}, n(e);
		}, r.crossOrigin = "", r.src = e;
	});
}
//#endregion
//#region build/plugins/utils/now.js
var w = typeof performance < "u" && performance.timing !== void 0 ? performance.timing.navigationStart : Date.now(), T = typeof performance < "u" ? (() => w + performance.now()) : (() => Date.now());
//#endregion
//#region build/plugins/utils/motion.js
function E(e, t, n) {
	return e + (t - e) * n;
}
function D(e, t, n, r) {
	let i = (t * n + 2 * e) / Math.pow(n, 3), a = -(2 * t * n + 3 * e) / Math.pow(n, 2), o = t, s = e;
	return i * Math.pow(r, 3) + a * Math.pow(r, 2) + o * r + s;
}
function O(e, t, n, r) {
	let i = (t * n + 2 * e) / Math.pow(n, 3), a = -(2 * t * n + 3 * e) / Math.pow(n, 2), o = t;
	return 3 * i * Math.pow(r, 2) + 2 * a * r + o;
}
function ee(e, t, n, r) {
	let i = r[1] - r[0];
	return e = k(e, r), t = k(t, r), t - e > i / 2 ? E(e + i, t, n) : e - t > i / 2 ? E(e - i, t, n) : E(e, t, n);
}
function k(e, t) {
	let n = t[1] - t[0];
	return e < t[0] ? k(e + n, t) : e >= t[1] ? k(e - n, t) : e;
}
function te(e, t, n, r) {
	return r ? ee(e, t, n, r) : E(e, t, n);
}
var ne = class {
	constructor(e) {
		this.config = {}, this.progress = 1, this.ended = !0, this.value = {}, this.startTime = T(), this.startVelocity = 0, this.duration = 0, this.keyframes = [];
		for (let t in e) {
			let n = e[t];
			typeof n == "number" ? (this.value[t] = n, this.config[t] = { circle: !1 }) : (this.value[t] = n.value, this.config[t] = { circle: n.circle });
		}
		this.keyframes = [{
			progress: 0,
			value: Object.assign({}, this.value)
		}, {
			progress: 1,
			value: Object.assign({}, this.value)
		}];
	}
	getProgress(e) {
		let t = e - this.startTime;
		return t < 0 ? 0 : t >= this.duration ? 1 : 1 - D(1, this.startVelocity, this.duration, t);
	}
	getValue(e) {
		for (let t = 1; t < this.keyframes.length; t++) if (this.keyframes[t].progress > e) {
			let n = this.keyframes[t - 1], r = this.keyframes[t], i = {};
			for (let t in this.config) {
				let a = (e - n.progress) / (r.progress - n.progress);
				i[t] = te(n.value[t], r.value[t], a, this.config[t].circle);
			}
			return i;
		}
		return Object.assign({}, this.keyframes[this.keyframes.length - 1].value);
	}
	getProgressVelocity(e) {
		let t = e - this.startTime;
		return t >= this.duration ? 0 : O(1, this.startVelocity, this.duration, t);
	}
	update(e) {
		return this.ended ? !0 : (this.progress = Math.min(1, Math.max(0, this.progress, this.getProgress(e))), this.value = this.getValue(this.progress), this.ended = this.progress >= 1, this.ended && this.callbacks && (this.callbacks[0](), this.callbacks = void 0), this.ended);
	}
	getKeyFrameSegment(e) {
		let t = this.getProgress(e);
		for (let e = 1; e < this.keyframes.length; e++) if (this.keyframes[e].progress > t) return [this.keyframes[e - 1], this.keyframes[e]];
		return [this.keyframes[this.keyframes.length - 2], this.keyframes[this.keyframes.length - 1]];
	}
	getTargetKeyframe() {
		return this.keyframes[this.keyframes.length - 1];
	}
	set(e, t, n = 0, r) {
		var i;
		isNaN(t) && (t = 0), isNaN(n) && (n = 0), r = r == null ? T() : r;
		let a = this.getProgress(r), o = this.getValue(a), s = {};
		for (let t in this.config) s[t] = (i = e[t]) == null ? o[t] : i;
		let c = [{
			progress: 0,
			value: o
		}, {
			progress: 1,
			value: s
		}];
		return this.setKeyframes(c, t, n, r);
	}
	setKeyframes(e, t, n = 0, r) {
		if (e.length < 2) throw Error("keyframes invalid.");
		return isNaN(t) && (t = 0), isNaN(n) && (n = 0), this.callbacks && (this.callbacks[1](/* @__PURE__ */ Error("motion aborted.")), this.callbacks = void 0), new Promise((i, a) => {
			r = r == null ? T() : r, this.progress = 0, this.ended = !1, this.startTime = r, this.startVelocity = n, this.keyframes = e, this.duration = t, t === 0 ? (this.progress = 1, this.value = Object.assign({}, e[e.length - 1].value)) : this.value = Object.assign({}, e[0].value), this.callbacks = [i, a];
		});
	}
	dispose() {
		this.callbacks && (this.callbacks[1](/* @__PURE__ */ Error("motion dispose.")), this.callbacks = void 0);
	}
}, re = [
	{
		progress: 0,
		value: {
			scale: 0,
			opacity: 0,
			shadow: 2
		}
	},
	{
		progress: .2,
		value: {
			scale: .5,
			opacity: 1,
			shadow: 1
		}
	},
	{
		progress: .8,
		value: {
			scale: 2,
			opacity: 0,
			shadow: .5
		}
	},
	{
		progress: 1,
		value: {
			scale: 2,
			opacity: 0,
			shadow: .5
		}
	}
], ie = [
	{
		progress: 0,
		value: {
			scale: 0,
			opacity: 0,
			shadow: 2
		}
	},
	{
		progress: .2,
		value: {
			scale: .4,
			opacity: 1,
			shadow: 2
		}
	},
	{
		progress: .8,
		value: {
			scale: 1.6,
			opacity: .4,
			shadow: .5
		}
	},
	{
		progress: 1,
		value: {
			scale: 2,
			opacity: 0,
			shadow: .5
		}
	}
], ae = "\nvarying vec2 vUv;\nvoid main() {\n  vUv = uv;\n  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n", oe = "\nvarying vec2 vUv;\nuniform sampler2D map;\nuniform vec4 color;\n\nfloat colorGap(vec3 color1, vec3 color2) {\n  float gap = abs(color1.r - color2.r) + abs(color1.g - color2.g) + abs(color1.b - color2.b);\n  return gap;\n}\n\nvoid main() {\n  vec3 u_outlineColor = vec3(1.0, 0.0, 0.0);\n  vec4 image = texture2D(map, vUv);\n  vec2 invSize = 1.0 / vec2(2048, 1024);\n  if (colorGap(image.rgb, color.rgb) < 0.05 && colorGap(color.rgb, vec3(0.0, 0.0, 0.0)) > 0.1) {\n    gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n  }\n  else {\n    vec2 offsetX = vec2(1.0, 0.0);\n    vec2 offsetY = vec2(0.0, 1.0);\n    vec2 offsetXY = vec2(1.0, 1.0);\n    vec2 offsetYX = vec2(-1.0, 1.0);\n    float count = 0.0;\n    for (float i = -4.0; i <= 4.0; i++) {\n      vec4 c1 = texture2D(map, vUv + i * invSize * offsetX / 4.0);\n      vec4 c2 = texture2D(map, vUv + i * invSize * offsetY / 4.0);\n      vec4 c3 = texture2D(map, vUv + i * invSize * offsetXY / 4.0);\n      vec4 c4 = texture2D(map, vUv + i * invSize * offsetYX / 4.0);\n      if (colorGap(c1.rgb, color.rgb) < 0.05 && colorGap(c1.rgb, vec3(0.0, 0.0, 0.0)) > 0.1) {\n        count++;\n      }\n      if (colorGap(c2.rgb, color.rgb) < 0.05 && colorGap(c2.rgb, vec3(0.0, 0.0, 0.0)) > 0.1) {\n        count++;\n      }\n      if (colorGap(c3.rgb, color.rgb) < 0.05 && colorGap(c3.rgb, vec3(0.0, 0.0, 0.0)) > 0.1) {\n        count++;\n      }\n      if (colorGap(c4.rgb, color.rgb) < 0.05 && colorGap(c4.rgb, vec3(0.0, 0.0, 0.0)) > 0.1) {\n        count++;\n      }\n    }\n    if (count > 0.0) {\n      gl_FragColor = vec4(1.0, 1.0, 1.0, mix(0.0, 1.0, count / (4.0 * 8.0 + 1.0)));\n    }\n  }\n}\n", se = class extends x.Controller {
	get config() {
		return Object.assign({}, this._config);
	}
	updateState(e, t) {
		let n = this.state;
		this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
			state: this.state,
			prevState: n,
			userAction: t
		});
	}
	constructor(t, n) {
		super(t), this.canvas = document.createElement("canvas"), this.group = new i.Group(), this.wrapper = document.createElement("div"), this.style = document.createElement("style"), this.itemMaskMesh = (() => {
			let e = new i.Mesh(new i.SphereBufferGeometry(1, 60, 40), new i.ShaderMaterial({
				vertexShader: ae,
				fragmentShader: oe,
				uniforms: {
					map: { value: new i.Texture() },
					color: { value: new i.Vector4() }
				},
				depthWrite: !1,
				depthTest: !1,
				transparent: !0
			}));
			return e.renderOrder = -3, e.geometry.rotateY(-Math.PI / 2), e.geometry.scale(-1, 1, 1), e;
		})(), this.onFivePanoArrived = (e) => {
			this.state.mode === "mask" && this.loadPanoMask(e);
		}, this.onFiveWantsMoveToPano = (e) => {
			this.state.mode === "box" && this.select();
		}, this.loadPanoMask = (e) => S(this, void 0, void 0, function* () {
			var t;
			let { five: n, canvas: r, itemMaskMesh: a, data: o } = this, s = r.getContext("2d"), c = n.observers[e], l = (t = o == null ? void 0 : o.object_mask_list.find((e) => e.derived_id === String(c.derivedId))) == null ? void 0 : t.object_mask_url;
			if (!l) return;
			let u = yield C(l);
			r.width = u.width, r.height = u.height, s == null || s.drawImage(u, 0, 0, u.width, u.height), a.material.uniforms.map.value.image = u, a.material.uniforms.map.value.minFilter = i.LinearFilter, a.material.uniforms.map.value.needsUpdate = !0, a.position.copy(c.position), a.quaternion.copy(c.quaternion), n.scene.add(a), n.needsRender = !0;
		}), this.onFiveMouseMove = (e) => {
			var t;
			if (this.state.mode !== "mask" || this.five.state.mode !== "Panorama") return;
			let { five: n, itemMaskMesh: r } = this, a = n.observers[n.state.panoIndex], o = (t = e.pointers[0]) == null ? void 0 : t.raycaster;
			if (o) {
				let [e] = o.intersectObjects(this.group.children.filter((e) => e.userData.visible_viewpoint.includes(String(a.derivedId))), !0);
				e ? r.material.uniforms.color.value = e.object.userData.color : r.material.uniforms.color.value = new i.Vector4(0, 0, 0, 1);
			}
		}, this.onFiveTapGesture = (t) => {
			let { five: n } = this, r = n.observers[n.state.panoIndex];
			if (t) {
				let [i] = t.intersectObjects(this.group.children.filter((e) => e.userData.visible_viewpoint.includes(String(r.derivedId))), !0);
				if (i) {
					this.select(i.object.name), this.stopAnimation && this.stopAnimation(), this.tapPosition = i.point, this.changeTapScreenPosition();
					let t = new ne({
						opacity: 0,
						scale: 0,
						shadow: 2
					}), r = new ne({
						opacity: 0,
						scale: 0,
						shadow: 2
					});
					return t.setKeyframes(re, 1e3), r.setKeyframes(ie, 1e3), this.stopAnimation = e.shared.add((e, i, ...a) => {
						var o;
						let s = t.update(e), c = r.update(e);
						this.wrapper.firstChild.style.opacity = `${t.value.opacity}`, this.wrapper.firstChild.style.transform = `scale(${t.value.scale})`, this.wrapper.firstChild.style.boxShadow = `0 0 0 ${t.value.shadow}px #fff`, this.wrapper.lastChild.style.opacity = `${r.value.opacity}`, this.wrapper.lastChild.style.transform = `scale(${r.value.scale})`, this.wrapper.lastChild.style.boxShadow = `0 0 0 ${r.value.shadow}px #fff`, s && c && ((o = this.stopAnimation) == null || o.call(this), this.stopAnimation = void 0, n.getElement().parentElement.removeChild(this.wrapper));
					}, !1, 0, 10), n.getElement().parentElement.appendChild(this.wrapper), !1;
				}
			}
		}, this.changeTapScreenPosition = () => {
			if (!this.tapPosition) return;
			let e = this.tapPosition.clone().project(this.five.camera), t = (e.x + 1) / 2, n = -(e.y - 1) / 2;
			this.wrapper.style.opacity = e.z > 0 && e.z < 1 ? "1" : "0", this.wrapper.style.transform = `translate(${t * 100}%, ${n * 100}%)`;
		}, this.onFiveCameraUpdate = (e) => {
			this.changeTapScreenPosition();
		}, this.dispose = () => {
			this.disable();
		}, this.five = t;
		let r = {
			enabled: !0,
			visible: !0,
			mode: "box",
			selectedId: null,
			selectAll: !1
		};
		this.state = Object.assign(r, n == null ? void 0 : n.initialState);
		let a = Object.assign({}, n == null ? void 0 : n.config);
		this._config = a, this.group.rotateX(Math.PI), this.wrapper.className = "ItemMaskPlugin", this.wrapper.innerHTML = "<span class=\"ItemMaskPluginCircle\"></span><span class=\"ItemMaskPluginCircle\"></span>", this.style.innerHTML = "\n      .ItemMaskPlugin {\n        position: absolute;\n        top: 0;\n        right: 0;\n        bottom: 0;\n        left: 0;\n        pointer-events: none;\n      }\n      .ItemMaskPluginCircle {\n        position: absolute;\n        top: -10px;\n        left: -10px;\n        width: 20px;\n        height: 20px;\n        border-radius: 50%;\n        box-shadow: 0px 0px 0px 2px #fff;\n      }\n    ", this.state.enabled && this._enable({ userAction: !1 });
	}
	load(e) {
		return S(this, void 0, void 0, function* () {
			this.data = e;
			let t = e.data_list.map((e) => {
				let t = e.position.end.map((e) => Number(e)), n = e.position.start.map((e) => Number(e)), r = Math.abs(t[0] - n[0]), a = Math.abs(t[1] - n[1]), o = Math.abs(t[2] - n[2]), s = t[0] / 2 + n[0] / 2, c = t[1] / 2 + n[1] / 2, l = t[2] / 2 + n[2] / 2, u = new i.Vector3(s, c, l), d = new i.BoxBufferGeometry(r, a, o), f = new i.ShaderMaterial({
					vertexShader: "\n          varying vec2 vUv;\n          void main() {\n            vUv = uv;\n            gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n          }\n        ",
					fragmentShader: "\n          uniform sampler2D map;\n          uniform float opacity;\n          varying vec2 vUv;\n\n          void main() {\n            float alpha = 0.15;\n            float depth = 0.003;\n            if (vUv.x < depth || vUv.x > 1.0 - depth) {\n              alpha = mix(1.0, 0.25, abs(vUv.y - 0.5) * 2.0);\n            } else if (vUv.y < depth || vUv.y > 1.0 - depth) {\n              alpha = mix(1.0, 0.25, abs(vUv.x - 0.5) * 2.0);\n            }\n            if (gl_FrontFacing) {\n              gl_FragColor = vec4(1.0, 1.0, 1.0, alpha * opacity);\n            } else {\n              gl_FragColor = vec4(1.0, 1.0, 1.0, alpha / 4.0 * opacity);\n            }\n          }\n        ",
					side: i.DoubleSide,
					visible: this.state.selectedId === `${e.category_name}${e.index}`,
					uniforms: { opacity: { value: +(this.state.mode === "box") } },
					depthWrite: !1,
					depthTest: !1,
					transparent: !0
				}), p = new i.Mesh(d, f);
				return p.position.copy(u), p.name = `${e.category_name}${e.index}`, p.userData.color = new i.Vector4(...e.mask_color.map((e) => e / 255).reverse(), 1), p.userData.visible_viewpoint = Object.keys(e.visible_viewpoint), p;
			});
			this.group.add(...t);
		});
	}
	setState(e, t = {}) {
		let n = this.state, r = t.userAction === void 0 ? !0 : t.userAction;
		if (this.updateState(e, r), e.enabled !== void 0 && n.enabled !== e.enabled) {
			let t = { userAction: r };
			e.enabled ? this._enable(t) : this._disable(t);
		}
	}
	setMode(e) {
		this.updateState({ mode: e }, !1), e === "mask" ? (this.group.children.forEach((e) => {
			e.material.uniforms.opacity.value = 0;
		}), this.loadPanoMask(this.five.state.panoIndex)) : e === "box" && (this.itemMaskMesh.material.uniforms.color.value = new i.Vector4(0, 0, 0, 1), this.group.children.forEach((e) => {
			e.material.uniforms.opacity.value = 1;
		}), this.five.needsRender = !0);
	}
	select(e, t) {
		var n;
		this.updateState({ selectedId: e == null ? null : e }, (n = t == null ? void 0 : t.userAction) == null ? !1 : n), this.group.children.forEach((t) => {
			t.material.visible = this.state.selectAll || t.name === e;
		}), this.five.needsRender = !0;
	}
	selectAll(e = !0) {
		this.updateState({ selectAll: !!e }, !1), this.select();
	}
	_enable(e) {
		this.five.on("panoArrived", this.onFivePanoArrived), this.five.on("wantsMoveToPano", this.onFiveWantsMoveToPano), this.five.on("gesture.mousemove", this.onFiveMouseMove), this.five.on("wantsTapGesture", this.onFiveTapGesture), this.five.on("cameraUpdate", this.onFiveCameraUpdate), this.five.scene.add(this.group), document.head.appendChild(this.style);
	}
	_disable(e) {
		this.five.off("panoArrived", this.onFivePanoArrived), this.five.off("wantsMoveToPano", this.onFiveWantsMoveToPano), this.five.off("gesture.mousemove", this.onFiveMouseMove), this.five.off("wantsTapGesture", this.onFiveTapGesture), this.five.off("cameraUpdate", this.onFiveCameraUpdate), this.five.scene.remove(this.group), document.head.removeChild(this.style);
	}
	enable(e) {
		var t;
		if (this.state.enabled) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !0 }, n), this._enable({ userAction: n });
	}
	disable(e) {
		var t;
		if (this.state.enabled === !1) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !1 }, n), this._disable({ userAction: n });
	}
}, ce = (e, t) => new se(e, t), le = (function(e, t, n, r) {
	var i = [
		"",
		"webkit",
		"Moz",
		"MS",
		"ms",
		"o"
	], a = t.createElement ? t.createElement("div") : r, o = "function", s = Math.round, c = Math.abs, l = Date.now;
	function u(e, t, n) {
		return setTimeout(v(e, n), t);
	}
	function d(e, t, n) {
		return Array.isArray(e) ? (f(e, n[t], n), !0) : !1;
	}
	function f(e, t, n) {
		var i;
		if (e) if (e.forEach) e.forEach(t, n);
		else if (e.length !== r) for (i = 0; i < e.length;) t.call(n, e[i], i, e), i++;
		else for (i in e) e.hasOwnProperty(i) && t.call(n, e[i], i, e);
	}
	function p(t, n, r) {
		var i = "DEPRECATED METHOD: " + n + "\n" + r + " AT \n";
		return function() {
			var n = /* @__PURE__ */ Error("get-stack-trace"), r = n && n.stack ? n.stack.replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.<anonymous>\s*\(/gm, "{anonymous}()@") : "Unknown Stack Trace", a = e.console && (e.console.warn || e.console.log);
			return a && a.call(e.console, i, r), t.apply(this, arguments);
		};
	}
	var m = typeof Object.assign == "function" ? Object.assign : function(e) {
		if (e === r || e === null) throw TypeError("Cannot convert undefined or null to object");
		for (var t = Object(e), n = 1; n < arguments.length; n++) {
			var i = arguments[n];
			if (i !== r && i !== null) for (var a in i) i.hasOwnProperty(a) && (t[a] = i[a]);
		}
		return t;
	}, h = p(function(e, t, n) {
		for (var i = Object.keys(t), a = 0; a < i.length;) (!n || n && e[i[a]] === r) && (e[i[a]] = t[i[a]]), a++;
		return e;
	}, "extend", "Use `assign`."), g = p(function(e, t) {
		return h(e, t, !0);
	}, "merge", "Use `assign`.");
	function _(e, t, n) {
		var r = t.prototype, i = e.prototype = Object.create(r);
		i.constructor = e, i._super = r, n && m(i, n);
	}
	function v(e, t) {
		return function() {
			return e.apply(t, arguments);
		};
	}
	function y(e, t) {
		return typeof e == o ? e.apply(t && t[0] || r, t) : e;
	}
	function b(e, t) {
		return e === r ? t : e;
	}
	function x(e, t, n) {
		f(T(t), function(t) {
			e.addEventListener(t, n, !1);
		});
	}
	function S(e, t, n) {
		f(T(t), function(t) {
			e.removeEventListener(t, n, !1);
		});
	}
	function C(e, t) {
		for (; e;) {
			if (e == t) return !0;
			e = e.parentNode;
		}
		return !1;
	}
	function w(e, t) {
		return e.indexOf(t) > -1;
	}
	function T(e) {
		return e.trim().split(/\s+/g);
	}
	function E(e, t, n) {
		if (e.indexOf && !n) return e.indexOf(t);
		for (var r = 0; r < e.length;) {
			if (n && e[r][n] == t || !n && e[r] === t) return r;
			r++;
		}
		return -1;
	}
	function D(e) {
		return Array.prototype.slice.call(e, 0);
	}
	function O(e, t, n) {
		for (var r = [], i = [], a = 0; a < e.length;) {
			var o = t ? e[a][t] : e[a];
			E(i, o) < 0 && r.push(e[a]), i[a] = o, a++;
		}
		return n && (r = t ? r.sort(function(e, n) {
			return e[t] > n[t];
		}) : r.sort()), r;
	}
	function ee(e, t) {
		for (var n, a, o = t[0].toUpperCase() + t.slice(1), s = 0; s < i.length;) {
			if (n = i[s], a = n ? n + o : t, a in e) return a;
			s++;
		}
		return r;
	}
	var k = 1;
	function te() {
		return k++;
	}
	function ne(t) {
		var n = t.ownerDocument || t;
		return n.defaultView || n.parentWindow || e;
	}
	var re = /mobile|tablet|ip(ad|hone|od)|android/i, ie = "ontouchstart" in e, ae = ee(e, "PointerEvent") !== r, oe = ie && re.test(navigator.userAgent), se = "touch", ce = "pen", le = "mouse", A = "kinect", ue = 25, j = 1, M = 2, N = 4, P = 8, de = 1, F = 2, I = 4, L = 8, R = 16, z = F | I, B = L | R, V = z | B, H = ["x", "y"], fe = ["clientX", "clientY"];
	function U(e, t) {
		var n = this;
		this.manager = e, this.callback = t, this.element = e.element, this.target = e.options.inputTarget, this.domHandler = function(t) {
			y(e.options.enable, [e]) && n.handler(t);
		}, this.init();
	}
	U.prototype = {
		handler: function() {},
		init: function() {
			this.evEl && x(this.element, this.evEl, this.domHandler), this.evTarget && x(this.target, this.evTarget, this.domHandler), this.evWin && x(ne(this.element), this.evWin, this.domHandler);
		},
		destroy: function() {
			this.evEl && S(this.element, this.evEl, this.domHandler), this.evTarget && S(this.target, this.evTarget, this.domHandler), this.evWin && S(ne(this.element), this.evWin, this.domHandler);
		}
	};
	function pe(e) {
		var t;
		return t = e.options.inputClass || (ae ? Pe : oe ? He : ie ? Ke : ke), new t(e, me);
	}
	function me(e, t, n) {
		var r = n.pointers.length, i = n.changedPointers.length, a = t & j && r - i === 0, o = t & (N | P) && r - i === 0;
		n.isFirst = !!a, n.isFinal = !!o, a && (e.session = {}), n.eventType = t, he(e, n), e.emit("hammer.input", n), e.recognize(n), e.session.prevInput = n;
	}
	function he(e, t) {
		var n = e.session, r = t.pointers, i = r.length;
		n.firstInput || (n.firstInput = ve(t)), i > 1 && !n.firstMultiple ? n.firstMultiple = ve(t) : i === 1 && (n.firstMultiple = !1);
		var a = n.firstInput, o = n.firstMultiple, s = o ? o.center : a.center, u = t.center = ye(r);
		t.timeStamp = l(), t.deltaTime = t.timeStamp - a.timeStamp, t.angle = Ce(s, u), t.distance = Se(s, u), ge(n, t), t.offsetDirection = xe(t.deltaX, t.deltaY);
		var d = be(t.deltaTime, t.deltaX, t.deltaY);
		t.overallVelocityX = d.x, t.overallVelocityY = d.y, t.overallVelocity = c(d.x) > c(d.y) ? d.x : d.y, t.scale = o ? Te(o.pointers, r) : 1, t.rotation = o ? we(o.pointers, r) : 0, t.maxPointers = n.prevInput ? t.pointers.length > n.prevInput.maxPointers ? t.pointers.length : n.prevInput.maxPointers : t.pointers.length, _e(n, t);
		var f = e.element;
		C(t.srcEvent.target, f) && (f = t.srcEvent.target), t.target = f;
	}
	function ge(e, t) {
		var n = t.center, r = e.offsetDelta || {}, i = e.prevDelta || {}, a = e.prevInput || {};
		(t.eventType === j || a.eventType === N) && (i = e.prevDelta = {
			x: a.deltaX || 0,
			y: a.deltaY || 0
		}, r = e.offsetDelta = {
			x: n.x,
			y: n.y
		}), t.deltaX = i.x + (n.x - r.x), t.deltaY = i.y + (n.y - r.y);
	}
	function _e(e, t) {
		var n = e.lastInterval || t, i = t.timeStamp - n.timeStamp, a, o, s, l;
		if (t.eventType != P && (i > ue || n.velocity === r)) {
			var u = t.deltaX - n.deltaX, d = t.deltaY - n.deltaY, f = be(i, u, d);
			o = f.x, s = f.y, a = c(f.x) > c(f.y) ? f.x : f.y, l = xe(u, d), e.lastInterval = t;
		} else a = n.velocity, o = n.velocityX, s = n.velocityY, l = n.direction;
		t.velocity = a, t.velocityX = o, t.velocityY = s, t.direction = l;
	}
	function ve(e) {
		for (var t = [], n = 0; n < e.pointers.length;) t[n] = {
			clientX: s(e.pointers[n].clientX),
			clientY: s(e.pointers[n].clientY)
		}, n++;
		return {
			timeStamp: l(),
			pointers: t,
			center: ye(t),
			deltaX: e.deltaX,
			deltaY: e.deltaY
		};
	}
	function ye(e) {
		var t = e.length;
		if (t === 1) return {
			x: s(e[0].clientX),
			y: s(e[0].clientY)
		};
		for (var n = 0, r = 0, i = 0; i < t;) n += e[i].clientX, r += e[i].clientY, i++;
		return {
			x: s(n / t),
			y: s(r / t)
		};
	}
	function be(e, t, n) {
		return {
			x: t / e || 0,
			y: n / e || 0
		};
	}
	function xe(e, t) {
		return e === t ? de : c(e) >= c(t) ? e < 0 ? F : I : t < 0 ? L : R;
	}
	function Se(e, t, n) {
		n || (n = H);
		var r = t[n[0]] - e[n[0]], i = t[n[1]] - e[n[1]];
		return Math.sqrt(r * r + i * i);
	}
	function Ce(e, t, n) {
		n || (n = H);
		var r = t[n[0]] - e[n[0]], i = t[n[1]] - e[n[1]];
		return Math.atan2(i, r) * 180 / Math.PI;
	}
	function we(e, t) {
		return Ce(t[1], t[0], fe) + Ce(e[1], e[0], fe);
	}
	function Te(e, t) {
		return Se(t[0], t[1], fe) / Se(e[0], e[1], fe);
	}
	var Ee = {
		mousedown: j,
		mousemove: M,
		mouseup: N
	}, De = "mousedown", Oe = "mousemove mouseup";
	function ke() {
		this.evEl = De, this.evWin = Oe, this.pressed = !1, U.apply(this, arguments);
	}
	_(ke, U, { handler: function(e) {
		var t = Ee[e.type];
		t & j && (e.button === 0 || e.button === 2) && (this.pressed = !0), t & M && e.which !== 1 && (t = N), this.pressed && (t & N && (this.pressed = !1), this.callback(this.manager, t, {
			pointers: [e],
			changedPointers: [e],
			pointerType: le,
			srcEvent: e
		}));
	} });
	var Ae = {
		pointerdown: j,
		pointermove: M,
		pointerup: N,
		pointercancel: P,
		pointerout: P
	}, je = {
		2: se,
		3: ce,
		4: le,
		5: A
	}, Me = "pointerdown", Ne = "pointermove pointerup pointercancel";
	e.MSPointerEvent && !e.PointerEvent && (Me = "MSPointerDown", Ne = "MSPointerMove MSPointerUp MSPointerCancel");
	function Pe() {
		this.evEl = Me, this.evWin = Ne, U.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
	}
	_(Pe, U, { handler: function(e) {
		var t = this.store, n = !1, r = !1, i = Ae[e.type.toLowerCase().replace("ms", "")], a = je[e.pointerType] || e.pointerType, o = a == se, s = E(t, e.pointerId, "pointerId");
		i & j && (e.button === 0 || e.button === 2 || o) ? s < 0 && (t.push(e), s = t.length - 1) : i & (N | P) ? n = !0 : !o && e.buttons === 0 && (n = !0, r = !0, i = Ae.pointerup), !(s < 0) && (r || (t[s] = e), this.callback(this.manager, i, {
			pointers: t,
			changedPointers: [e],
			pointerType: a,
			srcEvent: t[s]
		}), n && t.splice(s, 1));
	} });
	var Fe = {
		touchstart: j,
		touchmove: M,
		touchend: N,
		touchcancel: P
	}, Ie = "touchstart", Le = "touchstart touchmove touchend touchcancel";
	function Re() {
		this.evTarget = Ie, this.evWin = Le, this.started = !1, U.apply(this, arguments);
	}
	_(Re, U, { handler: function(e) {
		var t = Fe[e.type];
		if (t === j && (this.started = !0), this.started) {
			var n = ze.call(this, e, t);
			t & (N | P) && n[0].length - n[1].length === 0 && (this.started = !1), this.callback(this.manager, t, {
				pointers: n[0],
				changedPointers: n[1],
				pointerType: se,
				srcEvent: e
			});
		}
	} });
	function ze(e, t) {
		var n = D(e.touches), r = D(e.changedTouches);
		return t & (N | P) && (n = O(n.concat(r), "identifier", !0)), [n, r];
	}
	var Be = {
		touchstart: j,
		touchmove: M,
		touchend: N,
		touchcancel: P
	}, Ve = "touchstart touchmove touchend touchcancel";
	function He() {
		this.evTarget = Ve, this.targetIds = {}, U.apply(this, arguments);
	}
	_(He, U, { handler: function(e) {
		var t = Be[e.type], n = Ue.call(this, e, t);
		n && this.callback(this.manager, t, {
			pointers: n[0],
			changedPointers: n[1],
			pointerType: se,
			srcEvent: e
		});
	} });
	function Ue(e, t) {
		var n = D(e.touches), r = this.targetIds;
		if (t & (j | M) && n.length === 1) return r[n[0].identifier] = !0, [n, n];
		var i, a, o = D(e.changedTouches), s = [], c = this.target;
		if (a = n.filter(function(e) {
			return C(e.target, c);
		}), t === j) for (i = 0; i < a.length;) r[a[i].identifier] = !0, i++;
		for (i = 0; i < o.length;) r[o[i].identifier] && s.push(o[i]), t & (N | P) && delete r[o[i].identifier], i++;
		if (s.length) return [O(a.concat(s), "identifier", !0), s];
	}
	var We = 2500, Ge = 25;
	function Ke() {
		U.apply(this, arguments);
		var e = v(this.handler, this);
		this.touch = new He(this.manager, e), this.mouse = new ke(this.manager, e), this.primaryTouch = null, this.lastTouches = [];
	}
	_(Ke, U, {
		handler: function(e, t, n) {
			var r = n.pointerType == se, i = n.pointerType == le;
			if (!(i && n.sourceCapabilities && n.sourceCapabilities.firesTouchEvents)) {
				if (r) qe.call(this, t, n);
				else if (i && Ye.call(this, n)) return;
				this.callback(e, t, n);
			}
		},
		destroy: function() {
			this.touch.destroy(), this.mouse.destroy();
		}
	});
	function qe(e, t) {
		e & j ? (this.primaryTouch = t.changedPointers[0].identifier, Je.call(this, t)) : e & (N | P) && Je.call(this, t);
	}
	function Je(e) {
		var t = e.changedPointers[0];
		if (t.identifier === this.primaryTouch) {
			var n = {
				x: t.clientX,
				y: t.clientY
			};
			this.lastTouches.push(n);
			var r = this.lastTouches;
			setTimeout(function() {
				var e = r.indexOf(n);
				e > -1 && r.splice(e, 1);
			}, We);
		}
	}
	function Ye(e) {
		for (var t = e.srcEvent.clientX, n = e.srcEvent.clientY, r = 0; r < this.lastTouches.length; r++) {
			var i = this.lastTouches[r], a = Math.abs(t - i.x), o = Math.abs(n - i.y);
			if (a <= Ge && o <= Ge) return !0;
		}
		return !1;
	}
	var Xe = a ? ee(a.style, "touchAction") : r, Ze = Xe !== r, Qe = "compute", $e = "auto", et = "manipulation", W = "none", tt = "pan-x", nt = "pan-y", rt = ot();
	function it(e, t) {
		this.manager = e, this.set(t);
	}
	it.prototype = {
		set: function(e) {
			e == Qe && (e = this.compute()), Ze && this.manager.element.style && rt[e] && (this.manager.element.style[Xe] = e), this.actions = e.toLowerCase().trim();
		},
		update: function() {
			this.set(this.manager.options.touchAction);
		},
		compute: function() {
			var e = [];
			return f(this.manager.recognizers, function(t) {
				y(t.options.enable, [t]) && (e = e.concat(t.getTouchAction()));
			}), at(e.join(" "));
		},
		preventDefaults: function(e) {
			var t = e.srcEvent, n = e.offsetDirection;
			if (this.manager.session.prevented) {
				t.preventDefault();
				return;
			}
			var r = this.actions, i = w(r, W) && !rt[W], a = w(r, nt) && !rt[nt], o = w(r, tt) && !rt[tt];
			if (i) {
				var s = e.pointers.length === 1, c = e.distance < 2, l = e.deltaTime < 250;
				if (s && c && l) return;
			}
			if (!(o && a) && (i || a && n & z || o && n & B)) return this.preventSrc(t);
		},
		preventSrc: function(e) {
			this.manager.session.prevented = !0, e.preventDefault();
		}
	};
	function at(e) {
		if (w(e, W)) return W;
		var t = w(e, tt), n = w(e, nt);
		return t && n ? W : t || n ? t ? tt : nt : w(e, et) ? et : $e;
	}
	function ot() {
		if (!Ze) return !1;
		var t = {}, n = e.CSS && e.CSS.supports;
		return [
			"auto",
			"manipulation",
			"pan-y",
			"pan-x",
			"pan-x pan-y",
			"none"
		].forEach(function(r) {
			t[r] = n ? e.CSS.supports("touch-action", r) : !0;
		}), t;
	}
	var G = 1, K = 2, q = 4, J = 8, Y = J, st = 16, X = 32;
	function Z(e) {
		this.options = m({}, this.defaults, e || {}), this.id = te(), this.manager = null, this.options.enable = b(this.options.enable, !0), this.state = G, this.simultaneous = {}, this.requireFail = [];
	}
	Z.prototype = {
		defaults: {},
		set: function(e) {
			return m(this.options, e), this.manager && this.manager.touchAction.update(), this;
		},
		recognizeWith: function(e) {
			if (d(e, "recognizeWith", this)) return this;
			var t = this.simultaneous;
			return e = ut(e, this), t[e.id] || (t[e.id] = e, e.recognizeWith(this)), this;
		},
		dropRecognizeWith: function(e) {
			return d(e, "dropRecognizeWith", this) ? this : (e = ut(e, this), delete this.simultaneous[e.id], this);
		},
		requireFailure: function(e) {
			if (d(e, "requireFailure", this)) return this;
			var t = this.requireFail;
			return e = ut(e, this), E(t, e) === -1 && (t.push(e), e.requireFailure(this)), this;
		},
		dropRequireFailure: function(e) {
			if (d(e, "dropRequireFailure", this)) return this;
			e = ut(e, this);
			var t = E(this.requireFail, e);
			return t > -1 && this.requireFail.splice(t, 1), this;
		},
		hasRequireFailures: function() {
			return this.requireFail.length > 0;
		},
		canRecognizeWith: function(e) {
			return !!this.simultaneous[e.id];
		},
		emit: function(e) {
			var t = this, n = this.state;
			function r(n) {
				t.manager.emit(n, e);
			}
			n < J && r(t.options.event + ct(n)), r(t.options.event), e.additionalEvent && r(e.additionalEvent), n >= J && r(t.options.event + ct(n));
		},
		tryEmit: function(e) {
			if (this.canEmit()) return this.emit(e);
			this.state = X;
		},
		canEmit: function() {
			for (var e = 0; e < this.requireFail.length;) {
				if (!(this.requireFail[e].state & (X | G))) return !1;
				e++;
			}
			return !0;
		},
		recognize: function(e) {
			var t = m({}, e);
			if (!y(this.options.enable, [this, t])) {
				this.reset(), this.state = X;
				return;
			}
			this.state & (Y | st | X) && (this.state = G), this.state = this.process(t), this.state & (K | q | J | st) && this.tryEmit(t);
		},
		process: function(e) {},
		getTouchAction: function() {},
		reset: function() {}
	};
	function ct(e) {
		return e & st ? "cancel" : e & J ? "end" : e & q ? "move" : e & K ? "start" : "";
	}
	function lt(e) {
		return e == R ? "down" : e == L ? "up" : e == F ? "left" : e == I ? "right" : "";
	}
	function ut(e, t) {
		var n = t.manager;
		return n ? n.get(e) : e;
	}
	function Q() {
		Z.apply(this, arguments);
	}
	_(Q, Z, {
		defaults: { pointers: 1 },
		attrTest: function(e) {
			var t = this.options.pointers;
			return t === 0 || e.pointers.length === t;
		},
		process: function(e) {
			var t = this.state, n = e.eventType, r = t & (K | q), i = this.attrTest(e);
			return r && (n & P || !i) ? t | st : r || i ? n & N ? t | J : t & K ? t | q : K : X;
		}
	});
	function dt() {
		Q.apply(this, arguments), this.pX = null, this.pY = null;
	}
	_(dt, Q, {
		defaults: {
			event: "pan",
			threshold: 10,
			pointers: 1,
			direction: V
		},
		getTouchAction: function() {
			var e = this.options.direction, t = [];
			return e & z && t.push(nt), e & B && t.push(tt), t;
		},
		directionTest: function(e) {
			var t = this.options, n = !0, r = e.distance, i = e.direction, a = e.deltaX, o = e.deltaY;
			return i & t.direction || (t.direction & z ? (i = a === 0 ? de : a < 0 ? F : I, n = a != this.pX, r = Math.abs(e.deltaX)) : (i = o === 0 ? de : o < 0 ? L : R, n = o != this.pY, r = Math.abs(e.deltaY))), e.direction = i, n && r > t.threshold && i & t.direction;
		},
		attrTest: function(e) {
			return Q.prototype.attrTest.call(this, e) && (this.state & K || !(this.state & K) && this.directionTest(e));
		},
		emit: function(e) {
			this.pX = e.deltaX, this.pY = e.deltaY;
			var t = lt(e.direction);
			t && (e.additionalEvent = this.options.event + t), this._super.emit.call(this, e);
		}
	});
	function ft() {
		Q.apply(this, arguments);
	}
	_(ft, Q, {
		defaults: {
			event: "pinch",
			threshold: 0,
			pointers: 2
		},
		getTouchAction: function() {
			return [W];
		},
		attrTest: function(e) {
			return this._super.attrTest.call(this, e) && (Math.abs(e.scale - 1) > this.options.threshold || this.state & K);
		},
		emit: function(e) {
			if (e.scale !== 1) {
				var t = e.scale < 1 ? "in" : "out";
				e.additionalEvent = this.options.event + t;
			}
			this._super.emit.call(this, e);
		}
	});
	function pt() {
		Z.apply(this, arguments), this._timer = null, this._input = null;
	}
	_(pt, Z, {
		defaults: {
			event: "press",
			pointers: 1,
			time: 251,
			threshold: 9
		},
		getTouchAction: function() {
			return [$e];
		},
		process: function(e) {
			var t = this.options, n = e.pointers.length === t.pointers, r = e.distance < t.threshold, i = e.deltaTime > t.time;
			if (this._input = e, !r || !n || e.eventType & (N | P) && !i) this.reset();
			else if (e.eventType & j) this.reset(), this._timer = u(function() {
				this.state = Y, this.tryEmit();
			}, t.time, this);
			else if (e.eventType & N) return Y;
			return X;
		},
		reset: function() {
			clearTimeout(this._timer);
		},
		emit: function(e) {
			this.state === Y && (e && e.eventType & N ? this.manager.emit(this.options.event + "up", e) : (this._input.timeStamp = l(), this.manager.emit(this.options.event, this._input)));
		}
	});
	function mt() {
		Q.apply(this, arguments);
	}
	_(mt, Q, {
		defaults: {
			event: "rotate",
			threshold: 0,
			pointers: 2
		},
		getTouchAction: function() {
			return [W];
		},
		attrTest: function(e) {
			return this._super.attrTest.call(this, e) && (Math.abs(e.rotation) > this.options.threshold || this.state & K);
		}
	});
	function ht() {
		Q.apply(this, arguments);
	}
	_(ht, Q, {
		defaults: {
			event: "swipe",
			threshold: 10,
			velocity: .3,
			direction: z | B,
			pointers: 1
		},
		getTouchAction: function() {
			return dt.prototype.getTouchAction.call(this);
		},
		attrTest: function(e) {
			var t = this.options.direction, n;
			return t & (z | B) ? n = e.overallVelocity : t & z ? n = e.overallVelocityX : t & B && (n = e.overallVelocityY), this._super.attrTest.call(this, e) && t & e.offsetDirection && e.distance > this.options.threshold && e.maxPointers == this.options.pointers && c(n) > this.options.velocity && e.eventType & N;
		},
		emit: function(e) {
			var t = lt(e.offsetDirection);
			t && this.manager.emit(this.options.event + t, e), this.manager.emit(this.options.event, e);
		}
	});
	function gt() {
		Z.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0;
	}
	_(gt, Z, {
		defaults: {
			event: "tap",
			pointers: 1,
			taps: 1,
			interval: 300,
			time: 250,
			threshold: 9,
			posThreshold: 10
		},
		getTouchAction: function() {
			return [et];
		},
		process: function(e) {
			var t = this.options, n = e.pointers.length === t.pointers, r = e.distance < t.threshold, i = e.deltaTime < t.time;
			if (this.reset(), e.eventType & j && this.count === 0) return this.failTimeout();
			if (r && i && n) {
				if (e.eventType != N) return this.failTimeout();
				var a = this.pTime ? e.timeStamp - this.pTime < t.interval : !0, o = !this.pCenter || Se(this.pCenter, e.center) < t.posThreshold;
				if (this.pTime = e.timeStamp, this.pCenter = e.center, !o || !a ? this.count = 1 : this.count += 1, this._input = e, this.count % t.taps === 0) return this.hasRequireFailures() ? (this._timer = u(function() {
					this.state = Y, this.tryEmit();
				}, t.interval, this), K) : Y;
			}
			return X;
		},
		failTimeout: function() {
			return this._timer = u(function() {
				this.state = X;
			}, this.options.interval, this), X;
		},
		reset: function() {
			clearTimeout(this._timer);
		},
		emit: function() {
			this.state == Y && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input));
		}
	});
	function _t(e, t) {
		return t = t || {}, t.recognizers = b(t.recognizers, _t.defaults.preset), new bt(e, t);
	}
	_t.VERSION = "2.0.7", _t.defaults = {
		domEvents: !1,
		touchAction: Qe,
		enable: !0,
		inputTarget: null,
		inputClass: null,
		preset: [
			[mt, { enable: !1 }],
			[
				ft,
				{ enable: !1 },
				["rotate"]
			],
			[ht, { direction: z }],
			[
				dt,
				{ direction: z },
				["swipe"]
			],
			[gt],
			[
				gt,
				{
					event: "doubletap",
					taps: 2
				},
				["tap"]
			],
			[pt]
		],
		cssProps: {
			userSelect: "none",
			touchSelect: "none",
			touchCallout: "none",
			contentZooming: "none",
			userDrag: "none",
			tapHighlightColor: "rgba(0,0,0,0)"
		}
	};
	var vt = 1, yt = 2;
	function bt(e, t) {
		this.options = m({}, _t.defaults, t || {}), this.options.inputTarget = this.options.inputTarget || e, this.handlers = {}, this.session = {}, this.recognizers = [], this.oldCssProps = {}, this.element = e, this.input = pe(this), this.touchAction = new it(this, this.options.touchAction), xt(this, !0), f(this.options.recognizers, function(e) {
			var t = this.add(new e[0](e[1]));
			e[2] && t.recognizeWith(e[2]), e[3] && t.requireFailure(e[3]);
		}, this);
	}
	bt.prototype = {
		set: function(e) {
			return m(this.options, e), e.touchAction && this.touchAction.update(), e.inputTarget && (this.input.destroy(), this.input.target = e.inputTarget, this.input.init()), this;
		},
		stop: function(e) {
			this.session.stopped = e ? yt : vt;
		},
		recognize: function(e) {
			var t = this.session;
			if (!t.stopped) {
				this.touchAction.preventDefaults(e);
				var n, r = this.recognizers, i = t.curRecognizer;
				(!i || i && i.state & Y) && (i = t.curRecognizer = null);
				for (var a = 0; a < r.length;) n = r[a], t.stopped !== yt && (!i || n == i || n.canRecognizeWith(i)) ? n.recognize(e) : n.reset(), !i && n.state & (K | q | J) && (i = t.curRecognizer = n), a++;
			}
		},
		get: function(e) {
			if (e instanceof Z) return e;
			for (var t = this.recognizers, n = 0; n < t.length; n++) if (t[n].options.event == e) return t[n];
			return null;
		},
		add: function(e) {
			if (d(e, "add", this)) return this;
			var t = this.get(e.options.event);
			return t && this.remove(t), this.recognizers.push(e), e.manager = this, this.touchAction.update(), e;
		},
		remove: function(e) {
			if (d(e, "remove", this)) return this;
			if (e = this.get(e), e) {
				var t = this.recognizers, n = E(t, e);
				n !== -1 && (t.splice(n, 1), this.touchAction.update());
			}
			return this;
		},
		on: function(e, t) {
			if (e !== r && t !== r) {
				var n = this.handlers;
				return f(T(e), function(e) {
					n[e] = n[e] || [], n[e].push(t);
				}), this;
			}
		},
		off: function(e, t) {
			if (e !== r) {
				var n = this.handlers;
				return f(T(e), function(e) {
					t ? n[e] && n[e].splice(E(n[e], t), 1) : delete n[e];
				}), this;
			}
		},
		emit: function(e, t) {
			this.options.domEvents && St(e, t);
			var n = this.handlers[e] && this.handlers[e].slice();
			if (!(!n || !n.length)) {
				t.type = e, t.preventDefault = function() {
					t.srcEvent.preventDefault();
				};
				for (var r = 0; r < n.length;) n[r](t), r++;
			}
		},
		destroy: function() {
			this.element && xt(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null;
		}
	};
	function xt(e, t) {
		var n = e.element;
		if (n.style) {
			var r;
			f(e.options.cssProps, function(i, a) {
				r = ee(n.style, a), t ? (e.oldCssProps[r] = n.style[r], n.style[r] = i) : n.style[r] = e.oldCssProps[r] || "";
			}), t || (e.oldCssProps = {});
		}
	}
	function St(e, n) {
		var r = t.createEvent("Event");
		r.initEvent(e, !0, !0), r.gesture = n, n.target.dispatchEvent(r);
	}
	return m(_t, {
		INPUT_START: j,
		INPUT_MOVE: M,
		INPUT_END: N,
		INPUT_CANCEL: P,
		STATE_POSSIBLE: G,
		STATE_BEGAN: K,
		STATE_CHANGED: q,
		STATE_ENDED: J,
		STATE_RECOGNIZED: Y,
		STATE_CANCELLED: st,
		STATE_FAILED: X,
		DIRECTION_NONE: de,
		DIRECTION_LEFT: F,
		DIRECTION_RIGHT: I,
		DIRECTION_UP: L,
		DIRECTION_DOWN: R,
		DIRECTION_HORIZONTAL: z,
		DIRECTION_VERTICAL: B,
		DIRECTION_ALL: V,
		Manager: bt,
		Input: U,
		TouchAction: it,
		TouchInput: He,
		MouseInput: ke,
		PointerEventInput: Pe,
		TouchMouseInput: Ke,
		SingleTouchInput: Re,
		Recognizer: Z,
		AttrRecognizer: Q,
		Tap: gt,
		Pan: dt,
		Swipe: ht,
		Pinch: ft,
		Rotate: mt,
		Press: pt,
		on: x,
		off: S,
		each: f,
		merge: g,
		extend: h,
		assign: m,
		inherit: _,
		bindFn: v,
		prefixed: ee
	}), _t;
})(typeof window < "u" ? window : {}, typeof document < "u" ? document : {}, "Hammer"), A = function(e, t) {
	t === void 0 && console.warn("THREE.OrbitControls: The second parameter \"domElement\" is now mandatory."), t === document && console.error("THREE.OrbitControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead."), this.object = e, this.domElement = t, this.enabled = !0, this.target = new _(), this.minDistance = 0, this.maxDistance = Infinity, this.minZoom = 0, this.maxZoom = Infinity, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -Infinity, this.maxAzimuthAngle = Infinity, this.enableDamping = !1, this.dampingFactor = .05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !1, this.keyPanSpeed = 7, this.autoRotate = !1, this.autoRotateSpeed = 2, this.enableKeys = !0, this.keys = {
		LEFT: 37,
		UP: 38,
		RIGHT: 39,
		BOTTOM: 40
	}, this.mouseButtons = {
		LEFT: u.ROTATE,
		MIDDLE: u.DOLLY,
		RIGHT: u.PAN
	}, this.touches = {
		ONE: h.ROTATE,
		TWO: h.DOLLY_PAN
	}, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.getPolarAngle = function() {
		return l.phi;
	}, this.getAzimuthalAngle = function() {
		return l.theta;
	}, this.saveState = function() {
		n.target0.copy(n.target), n.position0.copy(n.object.position), n.zoom0 = n.object.zoom;
	}, this.reset = function() {
		n.target.copy(n.target0), n.object.position.copy(n.position0), n.object.zoom = n.zoom0, n.object.updateProjectionMatrix(), n.dispatchEvent(r), n.update(), s = o.NONE;
	}, this.update = function() {
		var t = new _(), i = new p().setFromUnitVectors(e.up, new _(0, 1, 0)), a = i.clone().inverse(), u = new _(), m = new p();
		return function() {
			var e = n.object.position;
			return t.copy(e).sub(n.target), t.applyQuaternion(i), l.setFromVector3(t), n.autoRotate && s === o.NONE && te(ee()), n.enableDamping ? (l.theta += d.theta * n.dampingFactor, l.phi += d.phi * n.dampingFactor) : (l.theta += d.theta, l.phi += d.phi), l.theta = Math.max(n.minAzimuthAngle, Math.min(n.maxAzimuthAngle, l.theta)), l.phi = Math.max(n.minPolarAngle, Math.min(n.maxPolarAngle, l.phi)), l.makeSafe(), l.radius *= f, l.radius = Math.max(n.minDistance, Math.min(n.maxDistance, l.radius)), n.enableDamping === !0 ? n.target.addScaledVector(v, n.dampingFactor) : n.target.add(v), t.setFromSpherical(l), t.applyQuaternion(a), e.copy(n.target).add(t), n.object.lookAt(n.target), n.enableDamping === !0 ? (d.theta *= 1 - n.dampingFactor, d.phi *= 1 - n.dampingFactor, v.multiplyScalar(1 - n.dampingFactor)) : (d.set(0, 0, 0), v.set(0, 0, 0)), f = 1, y || u.distanceToSquared(n.object.position) > c || 8 * (1 - m.dot(n.object.quaternion)) > c ? (n.dispatchEvent(r), u.copy(n.object.position), m.copy(n.object.quaternion), y = !1, !0) : !1;
		};
	}(), this.dispose = function() {
		n.domElement.removeEventListener("contextmenu", be, !1), n.domElement.removeEventListener("mousedown", U, !1), n.domElement.removeEventListener("wheel", he, !1), n.domElement.removeEventListener("touchstart", _e, !1), n.domElement.removeEventListener("touchend", ye, !1), n.domElement.removeEventListener("touchmove", ve, !1), document.removeEventListener("mousemove", pe, !1), document.removeEventListener("mouseup", me, !1), n.domElement.removeEventListener("keydown", ge, !1);
	};
	var n = this, r = { type: "change" }, i = { type: "start" }, a = { type: "end" }, o = {
		NONE: -1,
		ROTATE: 0,
		DOLLY: 1,
		PAN: 2,
		TOUCH_ROTATE: 3,
		TOUCH_PAN: 4,
		TOUCH_DOLLY_PAN: 5,
		TOUCH_DOLLY_ROTATE: 6
	}, s = o.NONE, c = 1e-6, l = new m(), d = new m(), f = 1, v = new _(), y = !1, b = new g(), x = new g(), S = new g(), C = new g(), w = new g(), T = new g(), E = new g(), D = new g(), O = new g();
	function ee() {
		return 2 * Math.PI / 60 / 60 * n.autoRotateSpeed;
	}
	function k() {
		return Math.pow(.95, n.zoomSpeed);
	}
	function te(e) {
		d.theta -= e;
	}
	function ne(e) {
		d.phi -= e;
	}
	var re = function() {
		var e = new _();
		return function(t, n) {
			e.setFromMatrixColumn(n, 0), e.multiplyScalar(-t), v.add(e);
		};
	}(), ie = function() {
		var e = new _();
		return function(t, r) {
			n.screenSpacePanning === !0 ? e.setFromMatrixColumn(r, 1) : (e.setFromMatrixColumn(r, 0), e.crossVectors(n.object.up, e)), e.multiplyScalar(t), v.add(e);
		};
	}(), ae = function() {
		var e = new _();
		return function(t, r) {
			var i = n.domElement;
			if (n.object.isPerspectiveCamera) {
				var a = n.object.position;
				e.copy(a).sub(n.target);
				var o = e.length();
				o *= Math.tan(n.object.fov / 2 * Math.PI / 180), re(2 * t * o / i.clientHeight, n.object.matrix), ie(2 * r * o / i.clientHeight, n.object.matrix);
			} else n.object.isOrthographicCamera ? (re(t * (n.object.right - n.object.left) / n.object.zoom / i.clientWidth, n.object.matrix), ie(r * (n.object.top - n.object.bottom) / n.object.zoom / i.clientHeight, n.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), n.enablePan = !1);
		};
	}();
	function oe(e) {
		n.object.isPerspectiveCamera ? f /= e : n.object.isOrthographicCamera ? (n.object.zoom = Math.max(n.minZoom, Math.min(n.maxZoom, n.object.zoom * e)), n.object.updateProjectionMatrix(), y = !0) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), n.enableZoom = !1);
	}
	function se(e) {
		n.object.isPerspectiveCamera ? f *= e : n.object.isOrthographicCamera ? (n.object.zoom = Math.max(n.minZoom, Math.min(n.maxZoom, n.object.zoom / e)), n.object.updateProjectionMatrix(), y = !0) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), n.enableZoom = !1);
	}
	function ce(e) {
		b.set(e.clientX, e.clientY);
	}
	function le(e) {
		E.set(e.clientX, e.clientY);
	}
	function A(e) {
		C.set(e.clientX, e.clientY);
	}
	function ue(e) {
		x.set(e.clientX, e.clientY), S.subVectors(x, b).multiplyScalar(n.rotateSpeed);
		var t = n.domElement;
		te(2 * Math.PI * S.x / t.clientHeight), ne(2 * Math.PI * S.y / t.clientHeight), b.copy(x), n.update();
	}
	function j(e) {
		D.set(e.clientX, e.clientY), O.subVectors(D, E), O.y > 0 ? oe(k()) : O.y < 0 && se(k()), E.copy(D), n.update();
	}
	function M(e) {
		w.set(e.clientX, e.clientY), T.subVectors(w, C).multiplyScalar(n.panSpeed), ae(T.x, T.y), C.copy(w), n.update();
	}
	function N(e) {
		e.deltaY < 0 ? se(k()) : e.deltaY > 0 && oe(k()), n.update();
	}
	function P(e) {
		var t = !1;
		switch (e.keyCode) {
			case n.keys.UP:
				ae(0, n.keyPanSpeed), t = !0;
				break;
			case n.keys.BOTTOM:
				ae(0, -n.keyPanSpeed), t = !0;
				break;
			case n.keys.LEFT:
				ae(n.keyPanSpeed, 0), t = !0;
				break;
			case n.keys.RIGHT:
				ae(-n.keyPanSpeed, 0), t = !0;
				break;
		}
		t && (e.preventDefault(), n.update());
	}
	function de(e) {
		if (e.touches.length == 1) b.set(e.touches[0].pageX, e.touches[0].pageY);
		else {
			var t = .5 * (e.touches[0].pageX + e.touches[1].pageX), n = .5 * (e.touches[0].pageY + e.touches[1].pageY);
			b.set(t, n);
		}
	}
	function F(e) {
		if (e.touches.length == 1) C.set(e.touches[0].pageX, e.touches[0].pageY);
		else {
			var t = .5 * (e.touches[0].pageX + e.touches[1].pageX), n = .5 * (e.touches[0].pageY + e.touches[1].pageY);
			C.set(t, n);
		}
	}
	function I(e) {
		var t = e.touches[0].pageX - e.touches[1].pageX, n = e.touches[0].pageY - e.touches[1].pageY, r = Math.sqrt(t * t + n * n);
		E.set(0, r);
	}
	function L(e) {
		n.enableZoom && I(e), n.enablePan && F(e);
	}
	function R(e) {
		n.enableZoom && I(e), n.enableRotate && de(e);
	}
	function z(e) {
		if (e.touches.length == 1) x.set(e.touches[0].pageX, e.touches[0].pageY);
		else {
			var t = .5 * (e.touches[0].pageX + e.touches[1].pageX), r = .5 * (e.touches[0].pageY + e.touches[1].pageY);
			x.set(t, r);
		}
		S.subVectors(x, b).multiplyScalar(n.rotateSpeed);
		var i = n.domElement;
		te(2 * Math.PI * S.x / i.clientHeight), ne(2 * Math.PI * S.y / i.clientHeight), b.copy(x);
	}
	function B(e) {
		if (e.touches.length == 1) w.set(e.touches[0].pageX, e.touches[0].pageY);
		else {
			var t = .5 * (e.touches[0].pageX + e.touches[1].pageX), r = .5 * (e.touches[0].pageY + e.touches[1].pageY);
			w.set(t, r);
		}
		T.subVectors(w, C).multiplyScalar(n.panSpeed), ae(T.x, T.y), C.copy(w);
	}
	function V(e) {
		var t = e.touches[0].pageX - e.touches[1].pageX, r = e.touches[0].pageY - e.touches[1].pageY, i = Math.sqrt(t * t + r * r);
		D.set(0, i), O.set(0, Math.pow(D.y / E.y, n.zoomSpeed)), oe(O.y), E.copy(D);
	}
	function H(e) {
		n.enableZoom && V(e), n.enablePan && B(e);
	}
	function fe(e) {
		n.enableZoom && V(e), n.enableRotate && z(e);
	}
	function U(e) {
		if (n.enabled !== !1) {
			e.preventDefault(), n.domElement.focus ? n.domElement.focus() : window.focus();
			var t;
			switch (e.button) {
				case 0:
					t = n.mouseButtons.LEFT;
					break;
				case 1:
					t = n.mouseButtons.MIDDLE;
					break;
				case 2:
					t = n.mouseButtons.RIGHT;
					break;
				default: t = -1;
			}
			switch (t) {
				case u.DOLLY:
					if (n.enableZoom === !1) return;
					le(e), s = o.DOLLY;
					break;
				case u.ROTATE:
					if (e.ctrlKey || e.metaKey || e.shiftKey) {
						if (n.enablePan === !1) return;
						A(e), s = o.PAN;
					} else {
						if (n.enableRotate === !1) return;
						ce(e), s = o.ROTATE;
					}
					break;
				case u.PAN:
					if (e.ctrlKey || e.metaKey || e.shiftKey) {
						if (n.enableRotate === !1) return;
						ce(e), s = o.ROTATE;
					} else {
						if (n.enablePan === !1) return;
						A(e), s = o.PAN;
					}
					break;
				default: s = o.NONE;
			}
			s !== o.NONE && (document.addEventListener("mousemove", pe, !1), document.addEventListener("mouseup", me, !1), n.dispatchEvent(i));
		}
	}
	function pe(e) {
		if (n.enabled !== !1) switch (e.preventDefault(), s) {
			case o.ROTATE:
				if (n.enableRotate === !1) return;
				ue(e);
				break;
			case o.DOLLY:
				if (n.enableZoom === !1) return;
				j(e);
				break;
			case o.PAN:
				if (n.enablePan === !1) return;
				M(e);
				break;
		}
	}
	function me(e) {
		n.enabled !== !1 && (document.removeEventListener("mousemove", pe, !1), document.removeEventListener("mouseup", me, !1), n.dispatchEvent(a), s = o.NONE);
	}
	function he(e) {
		n.enabled === !1 || n.enableZoom === !1 || s !== o.NONE && s !== o.ROTATE || (e.preventDefault(), e.stopPropagation(), n.dispatchEvent(i), N(e), n.dispatchEvent(a));
	}
	function ge(e) {
		n.enabled === !1 || n.enableKeys === !1 || n.enablePan === !1 || P(e);
	}
	function _e(e) {
		if (n.enabled !== !1) {
			switch (e.preventDefault(), e.touches.length) {
				case 1:
					switch (n.touches.ONE) {
						case h.ROTATE:
							if (n.enableRotate === !1) return;
							de(e), s = o.TOUCH_ROTATE;
							break;
						case h.PAN:
							if (n.enablePan === !1) return;
							F(e), s = o.TOUCH_PAN;
							break;
						default: s = o.NONE;
					}
					break;
				case 2:
					switch (n.touches.TWO) {
						case h.DOLLY_PAN:
							if (n.enableZoom === !1 && n.enablePan === !1) return;
							L(e), s = o.TOUCH_DOLLY_PAN;
							break;
						case h.DOLLY_ROTATE:
							if (n.enableZoom === !1 && n.enableRotate === !1) return;
							R(e), s = o.TOUCH_DOLLY_ROTATE;
							break;
						default: s = o.NONE;
					}
					break;
				default: s = o.NONE;
			}
			s !== o.NONE && n.dispatchEvent(i);
		}
	}
	function ve(e) {
		if (n.enabled !== !1) switch (e.preventDefault(), e.stopPropagation(), s) {
			case o.TOUCH_ROTATE:
				if (n.enableRotate === !1) return;
				z(e), n.update();
				break;
			case o.TOUCH_PAN:
				if (n.enablePan === !1) return;
				B(e), n.update();
				break;
			case o.TOUCH_DOLLY_PAN:
				if (n.enableZoom === !1 && n.enablePan === !1) return;
				H(e), n.update();
				break;
			case o.TOUCH_DOLLY_ROTATE:
				if (n.enableZoom === !1 && n.enableRotate === !1) return;
				fe(e), n.update();
				break;
			default: s = o.NONE;
		}
	}
	function ye(e) {
		n.enabled !== !1 && (n.dispatchEvent(a), s = o.NONE);
	}
	function be(e) {
		n.enabled !== !1 && e.preventDefault();
	}
	n.domElement.addEventListener("contextmenu", be, !1), n.domElement.addEventListener("mousedown", U, !1), n.domElement.addEventListener("wheel", he, !1), n.domElement.addEventListener("touchstart", _e, !1), n.domElement.addEventListener("touchend", ye, !1), n.domElement.addEventListener("touchmove", ve, !1), n.domElement.addEventListener("keydown", ge, !1), n.domElement.tabIndex === -1 && (n.domElement.tabIndex = 0), this.update();
};
A.prototype = Object.create(s.prototype), A.prototype.constructor = A;
var ue = function(e, t) {
	A.call(this, e, t), this.mouseButtons.LEFT = u.PAN, this.mouseButtons.RIGHT = u.ROTATE, this.touches.ONE = h.PAN, this.touches.TWO = h.DOLLY_ROTATE;
};
ue.prototype = Object.create(s.prototype), ue.prototype.constructor = ue;
//#endregion
//#region build/plugins/thirdParty/CSS3DRenderer.js
var j = new _(), M = new p(), N = new _(), P = class extends f {
	constructor(e = document.createElement("div")) {
		super(), this.isCSS3DObject = !0, this.element = e, this.element.style.position = "absolute", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.addEventListener("removed", function() {
			this.traverse(function(e) {
				e.element && e.element instanceof Element && e.element.parentNode !== null && e.element.remove();
			});
		});
	}
	copy(e, t) {
		return super.copy(e, t), this.element = e.element.cloneNode(!0), this;
	}
}, de = class extends P {
	constructor(e) {
		super(e), this.isCSS3DSprite = !0, this.rotation2D = 0;
	}
	copy(e, t) {
		return super.copy(e, t), this.rotation2D = e.rotation2D, this;
	}
}, F = new d(), I = new d(), L = class {
	constructor(e = {}) {
		let t = this, n, r, i, a, o = {
			camera: { style: "" },
			objects: /* @__PURE__ */ new WeakMap()
		}, s = e.element === void 0 ? document.createElement("div") : e.element;
		s.style.overflow = "hidden", this.domElement = s;
		let c = document.createElement("div");
		c.style.transformOrigin = "0 0", c.style.pointerEvents = "none", s.appendChild(c);
		let l = document.createElement("div");
		l.style.transformStyle = "preserve-3d", c.appendChild(l), this.getSize = function() {
			return {
				width: n,
				height: r
			};
		};
		let u = !0, d = /* @__PURE__ */ new Set();
		this.markDirty = function() {
			u = !0;
		}, this.updateSpriteSet = function(e) {
			d.clear(), e.traverse(function(e) {
				e.isCSS3DSprite && d.add(e);
			});
		};
		function f(e, n, r) {
			if (e.visible === !1) return;
			let i = e.layers.test(r.layers) === !0, a = e.element;
			if (a.style.display = i === !0 ? "" : "none", i === !0) {
				e.onBeforeRender(t, n, r), F.copy(r.matrixWorldInverse), F.transpose(), e.rotation2D !== 0 && F.multiply(I.makeRotationZ(e.rotation2D)), e.matrixWorld.decompose(j, M, N), F.setPosition(j), F.scale(N), F.elements[3] = 0, F.elements[7] = 0, F.elements[11] = 0, F.elements[15] = 1;
				let i = h(F), s = o.objects.get(e);
				(s === void 0 || s.style !== i) && (a.style.transform = i, o.objects.set(e, { style: i })), a.parentNode !== l && l.appendChild(a), e.onAfterRender(t, n, r);
			}
		}
		this.render = function(e, t) {
			let n = t.projectionMatrix.elements[5] * a;
			e.autoUpdate === !0 && e.updateMatrixWorld(), t.parent === null && t.updateMatrixWorld();
			let r, s;
			t.isOrthographicCamera && (r = -(t.right + t.left) / 2, s = (t.top + t.bottom) / 2);
			let c = t.isOrthographicCamera ? "scale(" + n + ")translate(" + p(r) + "px," + p(s) + "px)" + m(t.matrixWorldInverse) : "translateZ(" + n + "px)" + m(t.matrixWorldInverse), h = (t.isPerspectiveCamera ? "perspective(" + n + "px) " : "") + c + " translate(" + i + "px," + a + "px)";
			if (o.camera.style !== h && (l.style.transform = h, o.camera.style = h), u) _(e, e, t, c), u = !1;
			else if (d.size > 0) for (let n of d) f(n, e, t);
		}, this.setSize = function(e, t) {
			n = e, r = t, i = n / 2, a = r / 2, s.style.width = e + "px", s.style.height = t + "px", c.style.width = e + "px", c.style.height = t + "px", l.style.width = e + "px", l.style.height = t + "px";
		};
		function p(e) {
			return Math.abs(e) < 1e-10 ? 0 : e;
		}
		function m(e) {
			let t = e.elements;
			return "matrix3d(" + p(t[0]) + "," + p(-t[1]) + "," + p(t[2]) + "," + p(t[3]) + "," + p(t[4]) + "," + p(-t[5]) + "," + p(t[6]) + "," + p(t[7]) + "," + p(t[8]) + "," + p(-t[9]) + "," + p(t[10]) + "," + p(t[11]) + "," + p(t[12]) + "," + p(-t[13]) + "," + p(t[14]) + "," + p(t[15]) + ")";
		}
		function h(e) {
			let t = e.elements;
			return `translate(-50%,-50%) matrix3d(${[
				t[0],
				t[1],
				t[2],
				t[3],
				-t[4],
				-t[5],
				-t[6],
				-t[7],
				t[8],
				t[9],
				t[10],
				t[11],
				t[12],
				t[13],
				t[14],
				t[15]
			].map((e) => Math.abs(e) < 1e-10 ? 0 : e).join(",")})`;
		}
		function g(e) {
			e.isCSS3DObject && (e.element.style.display = "none");
			for (let t = 0, n = e.children.length; t < n; t++) g(e.children[t]);
		}
		function _(e, n, r, i) {
			if (e.visible === !1) {
				g(e);
				return;
			}
			if (e.isCSS3DObject) {
				let i = e.layers.test(r.layers) === !0, a = e.element;
				if (a.style.display = i === !0 ? "" : "none", i === !0) {
					e.onBeforeRender(t, n, r);
					let i;
					e.isCSS3DSprite ? (F.copy(r.matrixWorldInverse), F.transpose(), e.rotation2D !== 0 && F.multiply(I.makeRotationZ(e.rotation2D)), e.matrixWorld.decompose(j, M, N), F.setPosition(j), F.scale(N), F.elements[3] = 0, F.elements[7] = 0, F.elements[11] = 0, F.elements[15] = 1, i = h(F)) : i = h(e.matrixWorld);
					let s = o.objects.get(e);
					if (s === void 0 || s.style !== i) {
						a.style.transform = i;
						let t = { style: i };
						o.objects.set(e, t);
					}
					a.parentNode !== l && l.appendChild(a), e.onAfterRender(t, n, r);
				}
			}
			for (let t = 0, a = e.children.length; t < a; t++) _(e.children[t], n, r, i);
		}
	}
};
//#endregion
//#region build/five/utils/calculateThreeMouse.js
function R(e, t, n) {
	let { top: r, left: a, width: o, height: s } = t.getBoundingClientRect();
	return n && (a += o * n.left, r += s * (1 - n.bottom - n.height), o *= n.width, s *= n.height), new i.Vector2((e.x - a) / o * 2 - 1, -(e.y - r) / s * 2 + 1);
}
//#endregion
//#region build/plugins/OrientationPlugin/RoundedBoxGeometry.js
var z = class extends i.BufferGeometry {
	constructor(e, t, n, r, a) {
		super(), this.type = "RoundedBoxGeometry", a = isNaN(a) ? 1 : Math.max(1, Math.floor(a)), e = isNaN(e) ? 1 : e, t = isNaN(t) ? 1 : t, n = isNaN(n) ? 1 : n, r = isNaN(r) ? .15 : r, r = Math.min(r, Math.min(e, Math.min(t, Math.min(n))) / 2);
		let o = e / 2 - r, s = t / 2 - r, c = n / 2 - r;
		this.parameters = {
			width: e,
			height: t,
			depth: n,
			radius: r,
			radiusSegments: a
		};
		let l = a + 1, u = l * a + 1 << 3, d = new i.BufferAttribute(new Float32Array(u * 3), 3), f = new i.BufferAttribute(new Float32Array(u * 3), 3), p = [], m = [];
		new i.Vector3();
		let h = new i.Vector3(), g = [], _ = [], v = [], y = l * a, b = l * a + 1;
		x(), C(), S(), w(), E(), T();
		function x() {
			let e = [
				new i.Vector3(1, 1, 1),
				new i.Vector3(1, 1, -1),
				new i.Vector3(-1, 1, -1),
				new i.Vector3(-1, 1, 1),
				new i.Vector3(1, -1, 1),
				new i.Vector3(1, -1, -1),
				new i.Vector3(-1, -1, -1),
				new i.Vector3(-1, -1, 1)
			];
			for (let e = 0; e < 8; e++) p.push([]), m.push([]);
			let t = Math.PI / 2, n = new i.Vector3(o, s, c);
			for (let e = 0; e <= a; e++) {
				let i = e / a * t, o = Math.cos(i), s = Math.sin(i);
				if (e == a) {
					h.set(0, 1, 0);
					let e = h.clone().multiplyScalar(r).add(n);
					p[0].push(e), g.push(e);
					let t = h.clone();
					m[0].push(t), _.push(t);
					continue;
				}
				for (let e = 0; e <= a; e++) {
					let i = e / a * t;
					h.x = o * Math.cos(i), h.y = s, h.z = o * Math.sin(i);
					let c = h.clone().multiplyScalar(r).add(n);
					p[0].push(c), g.push(c);
					let l = h.clone().normalize();
					m[0].push(l), _.push(l);
				}
			}
			for (let t = 1; t < 8; t++) for (let n = 0; n < p[0].length; n++) {
				let r = p[0][n].clone().multiply(e[t]);
				p[t].push(r), g.push(r);
				let i = m[0][n].clone().multiply(e[t]);
				m[t].push(i), _.push(i);
			}
		}
		function S() {
			let e = [
				!0,
				!1,
				!0,
				!1,
				!1,
				!0,
				!1,
				!0
			], t = l * (a - 1);
			for (let n = 0; n < 8; n++) {
				let r = b * n;
				for (let t = 0; t < a - 1; t++) {
					let i = t * l, o = (t + 1) * l;
					for (let t = 0; t < a; t++) {
						let a = t + 1, s = r + i + t, c = r + i + a, l = r + o + t, u = r + o + a;
						e[n] ? (v.push(s), v.push(l), v.push(c), v.push(c), v.push(l), v.push(u)) : (v.push(s), v.push(c), v.push(l), v.push(c), v.push(u), v.push(l));
					}
				}
				for (let i = 0; i < a; i++) {
					let a = r + t + i, o = r + t + i + 1, s = r + y;
					e[n] ? (v.push(a), v.push(s), v.push(o)) : (v.push(a), v.push(o), v.push(s));
				}
			}
		}
		function C() {
			let e = y, t = y + b, n = y + b * 2, r = y + b * 3;
			v.push(e), v.push(t), v.push(n), v.push(e), v.push(n), v.push(r), e = y + b * 4, t = y + b * 5, n = y + b * 6, r = y + b * 7, v.push(e), v.push(n), v.push(t), v.push(e), v.push(r), v.push(n), e = 0, t = b, n = b * 4, r = b * 5, v.push(e), v.push(n), v.push(t), v.push(t), v.push(n), v.push(r), e = b * 2, t = b * 3, n = b * 6, r = b * 7, v.push(e), v.push(n), v.push(t), v.push(t), v.push(n), v.push(r), e = a, t = a + b * 3, n = a + b * 4, r = a + b * 7, v.push(e), v.push(t), v.push(n), v.push(t), v.push(r), v.push(n), e = a + b, t = a + b * 2, n = a + b * 5, r = a + b * 6, v.push(e), v.push(n), v.push(t), v.push(t), v.push(n), v.push(r);
		}
		function w() {
			for (let e = 0; e < 4; e++) {
				let t = e * b, n = 4 * b + t, r = (e & 1) == 1;
				for (let e = 0; e < a; e++) {
					let i = e + 1, a = t + e, o = t + i, s = n + e, c = n + i;
					r ? (v.push(a), v.push(s), v.push(o), v.push(o), v.push(s), v.push(c)) : (v.push(a), v.push(o), v.push(s), v.push(o), v.push(c), v.push(s));
				}
			}
		}
		function T() {
			let e = [
				0,
				2,
				4,
				6
			], t = [
				1,
				3,
				5,
				7
			];
			for (let n = 0; n < 4; n++) {
				let r = b * e[n], i = b * t[n], o = 1 >= n;
				for (let e = 0; e < a; e++) {
					let t = e * l, n = (e + 1) * l, a = r + t, s = r + n, c = i + t, u = i + n;
					o ? (v.push(a), v.push(c), v.push(s), v.push(s), v.push(c), v.push(u)) : (v.push(a), v.push(s), v.push(c), v.push(s), v.push(u), v.push(c));
				}
			}
		}
		function E() {
			let e = a - 1, t = [
				0,
				1,
				4,
				5
			], n = [
				3,
				2,
				7,
				6
			], r = [
				0,
				1,
				1,
				0
			];
			for (let i = 0; i < 4; i++) {
				let o = t[i] * b, s = n[i] * b;
				for (let t = 0; t <= e; t++) {
					let n = o + a + t * l, c = o + (t == e ? b - 1 : a + (t + 1) * l), u = s + a + t * l, d = s + (t == e ? b - 1 : a + (t + 1) * l);
					r[i] ? (v.push(n), v.push(u), v.push(c), v.push(c), v.push(u), v.push(d)) : (v.push(n), v.push(c), v.push(u), v.push(c), v.push(d), v.push(u));
				}
			}
		}
		let D = 0;
		for (let e = 0; e < g.length; e++) d.setXYZ(D, g[e].x, g[e].y, g[e].z), f.setXYZ(D, _[e].x, _[e].y, _[e].z), D++;
		this.setIndex(new i.BufferAttribute(new Uint16Array(v), 1)), this.setAttribute("position", d), this.setAttribute("normal", f);
	}
};
//#endregion
//#region build/plugins/OrientationPlugin/Controller.js
function B(e, t) {
	return typeof e != "number" || typeof t != "number" ? !1 : Math.abs(e - t) < .001;
}
function V(e, t, n, r = (e) => e) {
	let i = r(n);
	return e * (1 - i) + t * i;
}
var H = Number((Math.PI / 2).toFixed(5));
function fe(e, t, n) {
	let r = new i.Shape();
	return r.moveTo(n, 0), r.lineTo(e - n, 0), r.absarc(e - n, n, n, -H, 0, !1), r.lineTo(e, t - n), r.absarc(e - n, t - n, n, 0, H, !1), r.lineTo(n, t), r.absarc(n, t - n, n, H, Math.PI, !1), r.lineTo(0, n), r.absarc(n, n, n, Math.PI, Math.PI * 1.5, !1), r;
}
var U = (e) => {
	let t = document.createElement("div");
	t.innerText = e;
	let n = new P(t);
	return n.name = e, n.scale.set(.3, .3, .3), t.style.pointerEvents = "none", t.style.backfaceVisibility = "hidden", n;
}, pe = (e) => {
	let t = new i.PlaneGeometry(5, 5), n = new i.MeshBasicMaterial({
		transparent: !0,
		opacity: 0
	}), r = new i.Mesh(t, n), a = document.createElement("div");
	a.innerText = e;
	let o = new P(a);
	return o.name = e, o.scale.set(.3, .3, .3), a.style.color = "#ffffff", a.style.opacity = "0.5", a.style.pointerEvents = "none", a.style.backfaceVisibility = "hidden", r.rotateX(-H), r.add(o), r;
}, me = class extends x.Controller {
	get config() {
		return Object.assign({}, this._config);
	}
	updateState(e, t) {
		let n = this.state;
		this.state = Object.assign(Object.assign({}, this.state), e), typeof e.arrowsVisible == "boolean" && this.handleArrowsVisible(e.arrowsVisible), this.hooks.emit("stateChange", {
			state: this.state,
			prevState: n,
			userAction: t
		});
	}
	constructor(e, n) {
		super(e), this.camera = new t(90), this.scene = new i.Scene(), this.renderer = new i.WebGLRenderer({
			antialias: !0,
			alpha: !0
		}), this.css3drenderer = new L(), this.ambientLight = new i.AmbientLight(16777215, .7), this.wrapper = document.createElement("div"), this.arrows = document.createElement("div"), this.arrowLeft = document.createElement("div"), this.arrowRight = document.createElement("div"), this.arrowFront = document.createElement("div"), this.arrowBack = document.createElement("div"), this.arrowTop = document.createElement("div"), this.arrowBottom = document.createElement("div"), this.spherical = null, this.dragging = !1, this.style = document.createElement("style"), this.directionalLight = new i.DirectionalLight(16777215, .2), this.box = new i.Mesh(new z(8, 8, 8, .5, 20), new i.MeshPhongMaterial({ color: 16777215 })), this.faces = new i.Group(), this.orient = ({ longitude: e, latitude: t }) => {
			this.dragging = !1, this.spherical = null, this.controls.enableDamping = !1, this.five.setState(Object.assign({ latitude: t }, e === void 0 ? {} : { longitude: e + this.config.fixedLongitude })), this.five.ready().then(() => {
				this.controls.enableDamping = !0, this.setState({ arrowsVisible: !0 });
			});
		}, this.onRenderFrame = () => {
			var e, t, n, r, i;
			if (this.renderer.render(this.scene, this.camera), this.css3drenderer.render(this.scene, this.camera), this.directionalLight.position.copy(this.camera.position), (e = this.controls) == null || e.update(), this.dragging) {
				this.camera.computePose(), this.updateByCamera();
				let { longitude: e, latitude: t } = this.camera.pose;
				this.five.setState({
					longitude: e,
					latitude: t
				}, !0), this.updateArrows({
					longitude: e,
					latitude: t
				});
			} else if (this.spherical && (!B(this.spherical.pi, (t = this.controls) == null ? void 0 : t.getPolarAngle()) || !B(this.spherical.theta, (n = this.controls) == null ? void 0 : n.getAzimuthalAngle()))) {
				this.spherical = {
					pi: (r = this.controls) == null ? void 0 : r.getPolarAngle(),
					theta: (i = this.controls) == null ? void 0 : i.getAzimuthalAngle()
				}, this.camera.computePose(), this.updateByCamera();
				let { longitude: e, latitude: t } = this.camera.pose;
				this.five.setState({
					longitude: e,
					latitude: t
				}, !0), this.updateArrows({
					longitude: e,
					latitude: t
				});
			} else this.spherical = null;
		}, this.onTapGesture = (e) => {
			let t = e.pointers[0].clientX, n = e.pointers[0].clientY, r = R({
				x: t,
				y: n
			}, this.wrapper), a = new i.Raycaster();
			a.setFromCamera(r, this.camera);
			let [o] = a.intersectObjects(this.faces.children, !1);
			if (o) {
				let { longitude: e, latitude: t } = o.object.userData;
				this.orient({
					longitude: e,
					latitude: t
				});
			}
		}, this.onFiveWantsGesture = () => {
			if (this.spherical) return !1;
		}, this.onFiveModeChange = (e) => {
			this.controls && (this.controls.maxPolarAngle = e === "Topview" ? 0 : H);
		}, this.onCameraUpdate = ({ state: e }) => {
			if (this.dragging || this.spherical) return;
			let { longitude: t, latitude: n } = e;
			this.camera.pose.longitude === t && this.camera.pose.latitude === n || (this.camera.setFromPose({
				longitude: t,
				latitude: n,
				distance: 20,
				offset: new i.Vector3(0, 0, 0)
			}), this.updateByCamera(), this.updateArrows({
				longitude: t,
				latitude: n
			}));
		}, this.onPanStart = (e) => {
			this.dragging = !0, this.spherical = {};
		}, this.onMouseMove = (e) => {
			if (this.dragging) return;
			let t = R({
				x: e.clientX,
				y: e.clientY
			}, this.wrapper), n = new i.Raycaster();
			n.setFromCamera(t, this.camera);
			let [r] = n.intersectObjects(this.faces.children, !1);
			this.faces.children.forEach((e) => {
				e.material.opacity = 0, e.children[0].element.style.color = "";
			}), r && (r.object.material.opacity = .3, r.object.children[0].element.style.color = "#336dff");
		}, this.onPanEnd = (e) => {
			this.dragging = !1, this.spherical = {
				pi: this.controls.getPolarAngle(),
				theta: this.controls.getAzimuthalAngle()
			};
		}, this.dispose = () => {
			this.disable();
		}, this.five = e;
		let r = {
			enabled: !1,
			visible: !0,
			arrowsVisible: !1
		};
		this.state = Object.assign(r, n == null ? void 0 : n.initialState);
		let a = Object.assign({
			fixedLongitude: 0,
			orthoView: !0
		}, n == null ? void 0 : n.config);
		this._config = a, this.state.enabled && this._enable({ userAction: !1 }), this.mc = new le.Manager(this.wrapper), this.mc.add(new le.Tap({ interval: 410 })), this.mc.add(new le.Pan({
			threshold: 10,
			pointers: 0
		})), this.camera.setFromPose({
			distance: 20,
			offset: new i.Vector3(0, 0, 0),
			longitude: e.camera.pose.latitude,
			latitude: e.camera.pose.latitude
		}), this.cylinder = new i.Mesh(new i.CylinderGeometry(13.2, 14, .01, 50, 1, !0), new i.ShaderMaterial({
			uniforms: {
				radiusTop: { value: 13.2 },
				radiusBottom: { value: 14 },
				opacity: { value: 1 }
			},
			vertexShader: "\n          varying vec3 pos;\n          varying mat4 vViewMatrix;\n          void main() {\n            pos = position;\n            vViewMatrix = viewMatrix;\n            gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n          }\n        ",
			fragmentShader: "\n          varying vec3 pos;\n          varying mat4 vViewMatrix;\n          uniform float radiusTop;\n          uniform float radiusBottom;\n          uniform float opacity;\n          void main() {\n            mat3 cameraRotationMatrix = mat3(vViewMatrix[0][0], vViewMatrix[1][0], vViewMatrix[2][0], vViewMatrix[0][1], vViewMatrix[1][1], vViewMatrix[2][1], vViewMatrix[0][2], vViewMatrix[1][2], vViewMatrix[2][2]);\n            vec3 cameraDirection = normalize(cameraRotationMatrix * vec3(0.0, 0.0, 1.0));\n            float dis = length(vec3(pos.x, 0, pos.z));\n            // if (dis < radiusTop + 0.05 || dis > radiusBottom - 0.05) {\n            //   gl_FragColor = vec4(1.0, 1.0, 1.0, 0.6 * opacity);\n            //   return;\n            // }\n            vec4 color1 = vec4(1.0, 1.0, 1.0, 0.05);\n            vec4 color2 = vec4(1.0, 1.0, 1.0, 0.3 * opacity);\n\n            float z = abs(pos.z) / radiusBottom;\n\n            vec4 color = mix(color1, color2, z);\n            gl_FragColor = color;\n          }\n        ",
			transparent: !0
		})), this.init();
	}
	appendTo(e) {
		if (!e) return;
		e.appendChild(this.wrapper);
		let { width: t, height: n } = this.wrapper.getBoundingClientRect();
		this.renderer.setSize(t, n), this.css3drenderer.setSize(t, n);
	}
	init() {
		this.renderer.setClearAlpha(0), this.renderer.domElement.style.outline = "none", this.initDom(), this.initFaces(), this.initControls(), this.initLights();
		let e = this.cylinder;
		e.position.y = -3;
		let t = pe("西");
		t.position.set(-19, 0, 0), e.add(t);
		let n = pe("东");
		n.position.set(19, 0, 0), e.add(n);
		let r = pe("北");
		r.position.set(0, 0, -19), e.add(r);
		let i = pe("南");
		i.position.set(0, 0, 19), e.add(i), this.updateByCamera(), this.scene.add(e, this.box, this.faces), this.scene.rotation.y = this.config.fixedLongitude;
	}
	initDom() {
		this.style.innerHTML = "\n      .OrientationPlugin .OrientationArrows {\n        position: absolute;\n        top: 0;\n        right: 0;\n        bottom: 0;\n        left: 0;\n        margin: auto;\n        pointer-events: none;\n        width: 70%;\n        height: 70%;\n        display: none;\n      }\n\n      .OrientationPlugin .active {\n        color: #0F1014;\n      }\n\n      .OrientationPlugin .OrientationArrow {\n        position: absolute;\n        pointer-events: auto;\n        --color: #fff;\n        color: var(--color);\n        display: flex;\n        justify-content: center;\n        align-items: center;\n        font-size: 12px;\n        line-height: 12px;\n        width: 20px;\n        height: 20px;\n        margin: auto;\n        user-select: none;\n        cursor: pointer;\n      }\n\n      .OrientationPlugin .disabled {\n        opacity: 0.2;\n        pointer-events: none;\n      }\n\n      .OrientationPlugin .OrientationArrow:active, .OrientationPlugin .OrientationArrow:hover {\n        --color: #336dff;\n      }\n\n      .OrientationPlugin .OrientationArrow::after {\n        content: '';\n        position: absolute;\n        width: 0;\n        height: 0;\n        margin: auto;\n        border-style: solid;\n      }\n\n      .OrientationPlugin .OrientationArrow:nth-child(1) {\n        top: 0;\n        right: 0;\n        left: 0;\n      }\n\n      .OrientationPlugin .OrientationArrow:nth-child(1)::after {\n        border-width: 5px 6px;\n        border-color: var(--color) transparent transparent transparent;\n        transform: translate(0, 15px);\n      }\n\n      .OrientationPlugin .OrientationArrow:nth-child(2) {\n        top: 0;\n        bottom: 0;\n        left: 0;\n      }\n\n      .OrientationPlugin .OrientationArrow:nth-child(2)::after {\n        border-width: 6px 5px;\n        border-color: transparent transparent transparent var(--color);\n        transform: translate(15px, 0);\n      }\n\n      .OrientationPlugin .OrientationArrow:nth-child(3) {\n        top: 0;\n        right: 0;\n        bottom: 0;\n      }\n      \n      .OrientationPlugin .OrientationArrow:nth-child(3)::after {\n        border-width: 6px 5px;\n        border-color: transparent var(--color) transparent transparent;\n        transform: translate(-15px, 0);\n      }\n\n      .OrientationPlugin .OrientationArrow:nth-child(4) {\n        bottom: 0;\n        right: 0;\n        left: 0;\n      }\n\n      .OrientationPlugin .OrientationArrow:nth-child(4)::after {\n        border-width: 5px 6px;\n        border-color: transparent transparent var(--color) transparent;\n        transform: translate(0, -15px);\n      }\n    ", this.wrapper.className = "OrientationPlugin", this.arrows.className = "OrientationArrows", this.wrapper.style.cssText = "position: relative; width: 100%; height: 100%", this.wrapper.appendChild(this.arrows), this.arrowLeft.className = this.arrowRight.className = this.arrowTop.className = this.arrowBack.className = this.arrowFront.className = "OrientationArrow", this.arrowBottom.className = "OrientationArrow disabled", this.arrowBack.innerText = "后", this.arrowFront.innerText = "前", this.arrowLeft.innerText = "左", this.arrowRight.innerText = "右", this.arrowTop.innerText = "上", this.arrowBottom.innerText = "下", this.css3drenderer.domElement.style.cssText = "position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;";
	}
	bindEvents() {
		this.five.on("renderFrame", this.onRenderFrame), this.five.on("camera.update", this.onCameraUpdate), this.five.on("wantsGesture", this.onFiveWantsGesture), this.five.on("modeChange", this.onFiveModeChange), this.mc.on("tap", this.onTapGesture), this.mc.on("panstart", this.onPanStart), this.mc.on("panend", this.onPanEnd), this.wrapper.addEventListener("mousemove", this.onMouseMove), this.arrowTop.onclick = () => this.orient({
			longitude: 0,
			latitude: H
		}), this.arrowLeft.onclick = () => this.orient({
			longitude: -H,
			latitude: 0
		}), this.arrowRight.onclick = () => this.orient({
			longitude: H,
			latitude: 0
		}), this.arrowFront.onclick = () => this.orient({
			longitude: 0,
			latitude: 0
		}), this.arrowBack.onclick = () => this.orient({
			longitude: Math.PI,
			latitude: 0
		});
	}
	unbindEvents() {
		this.five.off("renderFrame", this.onRenderFrame), this.five.off("camera.update", this.onCameraUpdate), this.five.off("wantsGesture", this.onFiveWantsGesture), this.five.off("modeChange", this.onFiveModeChange), this.mc.off("tap", this.onTapGesture), this.mc.off("panstart", this.onPanStart), this.mc.off("panend", this.onPanEnd), this.wrapper.removeEventListener("mousemove", this.onMouseMove), this.arrowTop.onclick = null, this.arrowLeft.onclick = null, this.arrowRight.onclick = null, this.arrowFront.onclick = null, this.arrowBack.onclick = null;
	}
	updateByCamera() {
		let e = V(.2, 1, this.camera.pose.latitude / Math.PI * 2, (e) => e * e), t = V(11, 13, this.camera.pose.latitude / Math.PI * 2, (e) => e * e), n = V(12, 15, this.camera.pose.latitude / Math.PI * 2, (e) => e * e), r = V(13, 19, this.camera.pose.latitude / Math.PI * 2, (e) => e * e), a = V(-.2, .5, this.camera.pose.latitude / Math.PI * 2, (e) => e * e);
		this.cylinder.geometry = new i.CylinderGeometry(t, n, .01, 50, 1, !0), this.cylinder.material.uniforms.radiusTop.value = t, this.cylinder.material.uniforms.radiusBottom.value = n, this.cylinder.material.needsUpdate = !0, this.cylinder.children.forEach((t) => {
			t.position.normalize().multiplyScalar(r), t.scale.set(e, e, e);
			let n = t.children[0];
			n && (n.element.style.opacity = a.toString());
		}), this.css3drenderer.markDirty();
	}
	updateArrows({ longitude: e, latitude: t }) {
		let n = H - t < .02;
		this.setState({ arrowsVisible: n });
	}
	handleArrowsVisible(e) {
		if (this.state.enabled) if (this.cylinder.material.uniforms.opacity.value = e ? .4 : 1, this.cylinder.material.needsUpdate = !0, e) {
			let { longitude: e, latitude: t } = this.five.getCurrentState();
			if (H - t < .03) this.five.state.mode === "Topview" || this.five.state.mode === "Mapview" ? (this.faces.getObjectByName("上").element.className = "active", this.arrows.innerHTML = "", this.arrows.appendChild(this.arrowBack), this.arrows.appendChild(this.arrowLeft), this.arrows.appendChild(this.arrowRight), this.arrows.appendChild(this.arrowFront), this.arrows.style.transform = `rotate(${(e - this.config.fixedLongitude) / Math.PI * 180}deg)`) : (this.arrows.innerHTML = "", this.faces.getObjectByName("上").element.className = "");
			else {
				switch (this.arrows.innerHTML = "", this.arrows.appendChild(this.arrowTop), this.config.orthoView && this.five.ready().then(() => {
					this.five.controller.cameraType = "orthographic", this.five.ready().then(() => this.five.controller.cameraMotion.ended = !1);
				}), !0) {
					case B(0, e - this.config.fixedLongitude):
						this.arrows.appendChild(this.arrowLeft), this.arrows.appendChild(this.arrowRight), this.arrows.appendChild(this.arrowBottom), this.faces.getObjectByName("前").element.className = "active";
						break;
					case B(H, e - this.config.fixedLongitude):
						this.arrows.appendChild(this.arrowFront), this.arrows.appendChild(this.arrowBack), this.arrows.appendChild(this.arrowBottom), this.faces.getObjectByName("右").element.className = "active";
						break;
					case B(Math.PI, e - this.config.fixedLongitude):
						this.arrows.appendChild(this.arrowRight), this.arrows.appendChild(this.arrowLeft), this.arrows.appendChild(this.arrowBottom), this.faces.getObjectByName("后").element.className = "active";
						break;
					default:
						this.arrows.appendChild(this.arrowBack), this.arrows.appendChild(this.arrowFront), this.arrows.appendChild(this.arrowBottom), this.faces.getObjectByName("左").element.className = "active";
						break;
				}
				this.arrows.style.transform = "";
			}
			this.arrows.style.display = "block";
		} else this.config.orthoView && (this.five.controller.cameraType = "auto", this.five.ready().then(() => this.five.controller.cameraMotion.ended = !1)), this.arrows.style.display = "none", this.faces.children.forEach((e) => {
			e.children[0].element.className = "";
		});
	}
	setState(e, t = {}) {
		let n = this.state, r = t.userAction === void 0 ? !0 : t.userAction;
		if (this.updateState(e, r), e.enabled !== void 0 && n.enabled !== e.enabled) {
			let t = { userAction: r };
			e.enabled ? this._enable(t) : this._disable(t);
		}
	}
	initLights() {
		this.directionalLight.target = this.box, this.scene.add(this.ambientLight, this.directionalLight);
	}
	initFaces() {
		let e = fe(7, 7, .5), t = new i.ShapeGeometry(e);
		t.translate(-3.5, -3.5, 0);
		let n = new i.Mesh(t, new i.MeshBasicMaterial({
			transparent: !0,
			color: 3370495,
			opacity: 0
		}));
		n.userData = {
			longitude: 0,
			latitude: 0
		}, n.position.z = 4.1, n.add(U("前"));
		let r = new i.Mesh(t, new i.MeshBasicMaterial({
			transparent: !0,
			color: 3370495,
			opacity: 0
		}));
		r.rotateY(Math.PI), r.position.z = -4.1, r.add(U("后")), r.userData = {
			longitude: Math.PI,
			latitude: 0
		};
		let a = new i.Mesh(t, new i.MeshBasicMaterial({
			transparent: !0,
			color: 3370495,
			opacity: 0
		}));
		a.rotateY(H), a.position.x = 4.1, a.add(U("右")), a.userData = {
			longitude: H,
			latitude: 0
		};
		let o = new i.Mesh(t, new i.MeshBasicMaterial({
			transparent: !0,
			color: 3370495,
			opacity: 0
		}));
		o.rotateY(-H), o.position.x = -4.1, o.add(U("左")), o.userData = {
			longitude: -H,
			latitude: 0
		};
		let s = new i.Mesh(t, new i.MeshBasicMaterial({
			transparent: !0,
			color: 3370495,
			opacity: 0
		}));
		s.rotateX(-H), s.position.y = 4.1, s.add(U("上")), s.userData = {
			longitude: 0,
			latitude: H
		}, this.faces.add(n, r, o, a, s);
	}
	initControls() {
		let e = this.controls = new A(this.camera, this.renderer.domElement);
		e.enableZoom = !1, e.enableDamping = !0, e.enablePan = !1, e.maxPolarAngle = H, e.dampingFactor = .15, e.rotateSpeed = .25;
	}
	load(e) {
		return S(this, void 0, void 0, function* () {});
	}
	_enable(e) {
		let { longitude: t, latitude: n } = this.five.getCurrentState();
		this.camera.setFromPose({
			longitude: t,
			latitude: n,
			distance: 20,
			offset: new i.Vector3(0, 0, 0)
		}), this.updateByCamera(), this.wrapper.appendChild(this.renderer.domElement), this.wrapper.appendChild(this.css3drenderer.domElement), this.bindEvents();
	}
	_disable(e) {
		this.wrapper.removeChild(this.renderer.domElement), this.wrapper.removeChild(this.css3drenderer.domElement), this.unbindEvents();
	}
	enable(e) {
		var t;
		if (this.state.enabled) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !0 }, n), this._enable({ userAction: n }), document.head.appendChild(this.style);
	}
	disable(e) {
		var t;
		if (this.state.enabled === !1) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !1 }, n), this._disable({ userAction: n }), document.head.removeChild(this.style);
	}
}, he = (e, t) => new me(e, t), ge = class extends v.Controller {
	constructor(e, t) {
		super(e), this.data = {}, this.pluginName = "BackgroundPlugin", this._onFiveCameraUpdate = (e) => {
			let t = (Math.PI / 2 - Math.max(e.latitude, 0)) / (Math.PI / 2), n = Math.max(.2 - t, 0) * 10;
			this.gradientBg && (this.gradientBg.style.transform = `translateY(-${(1 - t) * 50}%)`), this.groundBg && (this.groundBg.style.backgroundImage = `radial-gradient(circle, #2E303350 ${n * 100}%, transparent ${n * 120}%)`);
		}, this._addEventListener = () => {
			this.five.on("cameraUpdate", this._onFiveCameraUpdate);
		}, this._removeEventListener = () => {
			this.five.off("cameraUpdate", this._onFiveCameraUpdate);
		}, this.load = () => S(this, void 0, void 0, function* () {}), this.setState = (e, t = {}) => {}, this.enable = () => {
			var e;
			let t = (e = this.five.getElement()) == null ? void 0 : e.parentNode;
			if (!t) {
				this.five.ready().then(() => this.enable());
				return;
			}
			this.state.enabled || (this._onFiveCameraUpdate(this.five.getPose(), !1), this.gradientBg && t.appendChild(this.gradientBg), this.groundBg && t.appendChild(this.groundBg), this.style && document.head.appendChild(this.style), this._addEventListener(), this.hooks.emit("enable", { userAction: !0 }), this.state.enabled = !0);
		}, this.disable = (e = {}) => {
			var t, n, r, i;
			this.state.enabled && ((n = (t = this.gradientBg) == null ? void 0 : t.parentNode) == null || n.removeChild(this.gradientBg), (i = (r = this.groundBg) == null ? void 0 : r.parentNode) == null || i.removeChild(this.groundBg), this.style && document.head.removeChild(this.style), this._removeEventListener(), this.hooks.emit("disable", { userAction: !0 }), this.state.enabled = !1);
		}, this.dispose = () => {
			this._removeEventListener(), this.hooks.emit("disable", { userAction: !0 }), this.state.enabled = !1;
		}, this.state = { enabled: !1 }, !(typeof document > "u") && (this.gradientBg = document.createElement("div"), this.groundBg = document.createElement("div"), this.style = document.createElement("style"), this.gradientBg.className = "BackgroundPluginBg", this.groundBg.className = "BackgroundPluginGroundBg", this.style.innerHTML = "\n      .BackgroundPluginBg {\n        position: absolute;\n        top: 0;\n        right: 0;\n        left: 0;\n        height: 200%;\n        background: linear-gradient(#0A0B0D, #2E3033);\n        z-index: -1;\n        pointerEvents: none;\n      }\n      .BackgroundPluginGroundBg {\n        position: absolute;\n        top: 0;\n        right: 0;\n        left: 0;\n        bottom: 0;\n        background-image: radial-gradient(circle, #2E303350 0, transparent 0);\n        z-index: -1;\n        pointerEvents: none;\n      }\n    ", this.enable());
	}
}, _e = (e, t) => new ge(e, t);
//#endregion
//#region build/plugins/TrajectoryPlugin/Controller.js
new i.Matrix4().fromArray([
	1,
	0,
	0,
	0,
	0,
	0,
	1,
	0,
	0,
	-1,
	0,
	0,
	0,
	0,
	0,
	1
]);
var ve = class {
	constructor(e, t, n, r, i) {
		this.R = e, this.Q = t, this.A = n, this.B = r, this.C = i, this.cov = NaN, this.x = NaN;
	}
	filter(e, t = 0) {
		if (isNaN(this.x)) this.x = 1 / this.C * e, this.cov = 1 / this.C * this.Q * (1 / this.C);
		else {
			let n = this.A * this.x + this.B * t, r = this.A * this.cov * this.A + this.R, i = r * this.C * (1 / (this.C * r * this.C + this.Q));
			this.x = n + i * (e - this.C * n), this.cov = r - i * this.C * r;
		}
		return this.x;
	}
}, ye = class extends x.Controller {
	get config() {
		return Object.assign({}, this._config);
	}
	updateState(e, t) {
		let n = this.state;
		this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
			state: this.state,
			prevState: n,
			userAction: t
		});
	}
	constructor(e, t) {
		super(e), this.dispose = () => {
			this.disable();
		}, this.five = e;
		let n = {
			enabled: !0,
			visible: !0
		};
		this.state = Object.assign(n, t == null ? void 0 : t.initialState);
		let r = Object.assign({}, t == null ? void 0 : t.config);
		this._config = r, this.state.enabled && this._enable({ userAction: !1 }), this.cancelAnimation = null, this.skipStart = 0, this.skipEnd = 0, this.location = 0, this.totalDistance = 0, this.trajectory = null, this.currentKeyFrame = null, this.nextKeyframe = null, this.nextButOneKeyframe = null, this.keyframes = [], this.rate = this.config.rate || 1, this.virualCamera = this.five.camera.clone(), this.playingState = {
			keyframeIndex: null,
			progress: null
		}, this.timeArray = null, this.startTimestamp = null, this.playbackStartTime = null, this.playbackEndTime = null, Object.defineProperties(this, { currentDistance: {
			get() {
				return this._currentDistance;
			},
			set(e) {
				this._currentDistance = e;
			}
		} });
	}
	load(e) {
		return S(this, void 0, void 0, function* () {});
	}
	loadTrajectory(e) {
		this.trajectory = e, this.cancelAnimation && this.cancelAnimation(), this.cancelAnimation = null, this.keyframes = [], this.location = 0, this.totalDistance = 0, this.currentKeyFrame = null, this.nextKeyframe = null, this.nextButOneKeyframe = null, this.timeArray = null, this.startTimestamp = null, this.playbackStartTime = null, this.playbackEndTime = null, this.playingState.keyframeIndex = null, this.playingState.progress = null;
		let t = .01, n = .1, r = new ve(t, n, 1, 0, 1), a = new ve(t, n, 1, 0, 1), o = new ve(t, n, 1, 0, 1);
		if (this.trajectory && this.trajectory.content.loadState === "READY") {
			let t = this.trajectory.content.data.positionArray;
			this.timeArray = this.trajectory.content.data.timeArray;
			let n = new Float32Array(t.length / 3);
			for (let e = 0; e < n.length; e++) if (e === 0) n[e] = 0;
			else {
				let r = new i.Vector3(t[e - 3], t[e - 2], t[e - 1]);
				n[e] = new i.Vector3(t[e], t[e + 1], t[e + 2]).distanceTo(r) + n[e - 1];
			}
			this.totalDistance = n[n.length - 1];
			for (let s = 0; s < n.length; s++) {
				let c = new i.Vector3(0, 0, 0), l = 0;
				for (let e = s - 5; e < s + 6; e++) e >= 0 && e < n.length && (c.add(new i.Vector3(t[e * 3], t[e * 3 + 1], t[e * 3 + 2])), l++);
				c.divideScalar(l).applyMatrix4(e.transform);
				let u = r.filter(c.x), d = a.filter(c.y), f = o.filter(c.z), p = {
					position: new i.Vector3(u, d, f),
					location: n[s]
				};
				this.keyframes.push(p);
			}
		} else throw Error("trajectory content is not ready");
	}
	setPlayingState(e) {
		(e.keyframeIndex !== null || e.progress !== null) && (this.cancelAnimation && this.cancelAnimation(), this.playingState.keyframeIndex = e.keyframeIndex ? e.keyframeIndex : this.playingState.keyframeIndex, this.playingState.progress = e.progress ? e.progress : this.playingState.progress, this.play());
	}
	_enable(e) {}
	play() {
		let t = this.keyframes.length;
		if (t < 2) throw Error("keyframes length must be greater than 2");
		let n = {
			keyframeIndex: null,
			progress: null
		};
		this.playingState.keyframeIndex !== null && this.playingState.progress !== null ? (n.keyframeIndex = this.playingState.keyframeIndex, n.progress = this.playingState.progress) : this.playingState.keyframeIndex === null && this.playingState.progress === null && (this.playingState.keyframeIndex = this.skipStart, this.playingState.progress = 0, this.virualCamera.position.copy(this.keyframes[this.playingState.keyframeIndex].position.clone()), this.virualCamera.lookAt(this.keyframes[1].position.clone()), this.virualCamera.computePose(), this.five.setState(Object.assign({}, this.virualCamera.pose), !0));
		let r = this.playingState.keyframeIndex, a = 0;
		this.cancelAnimation = e.shared.add((e, o) => {
			if (r === t - 1 - this.skipEnd && this.cancelAnimation) {
				this.cancelAnimation();
				return;
			}
			this.currentKeyFrame = this.keyframes[r], this.nextKeyframe = this.keyframes[r + 1], r + 2 <= t - 1 ? this.nextButOneKeyframe = this.keyframes[r + 2] : this.nextButOneKeyframe = null;
			let s = this.currentKeyFrame.position.clone(), c = this.nextKeyframe.position.clone(), l = this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(), u = s.clone().add(l.clone().multiplyScalar(.01)), d = new i.Vector3();
			this.nextButOneKeyframe === null ? d.copy(l) : d = this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();
			let f = c.clone().add(d.clone().multiplyScalar(.01));
			a += o / 1e3 * this.rate;
			let p = a / s.distanceTo(c);
			p = p >= 1 ? 1 : p, n.keyframeIndex !== null && n.progress !== null && (p = n.progress, n.keyframeIndex = null, n.progress = null);
			let m = s.clone().lerp(c, p), h = u.clone().lerp(f, p);
			this.virualCamera.position.copy(m), this.virualCamera.lookAt(h), this.virualCamera.updateMatrixWorld(), this.virualCamera.updateMatrix(), this.virualCamera.computePose(), this.five.setState(Object.assign({}, this.virualCamera.pose), !0), this.location = this.keyframes[r].location + s.clone().distanceTo(m), p === 1 ? (a = 0, r++, this.playingState.keyframeIndex = r, this.playingState.progress = 0) : (this.playingState.keyframeIndex = r, this.playingState.progress = p);
		});
	}
	pause() {
		var e;
		if (this.cancelAnimation) {
			if (this.playingState.keyframeIndex !== null && this.playingState.keyframeIndex >= 0 && this.playingState.keyframeIndex < this.keyframes.length) {
				let t = this.playingState.keyframeIndex, n = (e = this.playingState.progress) == null ? 0 : e, r = this.keyframes[t], i = t + 1 < this.keyframes.length ? this.keyframes[t + 1] : r, a = r.position.clone(), o = i.position.clone(), s = a.clone().lerp(o, n), c = o.clone().sub(a).normalize(), l = s.clone().add(c.multiplyScalar(.01));
				this.virualCamera.position.copy(s), this.virualCamera.lookAt(l), this.virualCamera.updateMatrixWorld(), this.virualCamera.updateMatrix(), this.virualCamera.computePose(), this.five.setState(Object.assign({}, this.virualCamera.pose), !0);
			} else if (this.currentKeyFrame && this.nextKeyframe) {
				let e = this.currentKeyFrame.position.clone(), t = this.nextKeyframe.position.clone(), n = e.clone(), r = t.clone().sub(e).normalize(), i = n.clone().add(r.multiplyScalar(.01));
				this.virualCamera.position.copy(n), this.virualCamera.lookAt(i), this.virualCamera.updateMatrixWorld(), this.virualCamera.updateMatrix(), this.virualCamera.computePose(), this.five.setState(Object.assign({}, this.virualCamera.pose), !0);
			}
			this.cancelAnimation();
		}
		this.startTimestamp = null;
	}
	playByTimestamp() {
		var t;
		if (!this.trajectory || !this.timeArray || this.timeArray.length === 0) throw Error("Trajectory or timeArray is not available");
		let n = this.keyframes.length;
		if (n < 2) throw Error("keyframes length must be greater than 2");
		this.cancelAnimation && this.cancelAnimation();
		let r = this.skipStart, a = this.timeArray.length - 1 - this.skipEnd;
		if (r >= a || r < 0 || a >= this.timeArray.length) throw Error("Invalid skipStart or skipEnd values");
		this.playbackStartTime = this.timeArray[r], this.playbackEndTime = this.timeArray[a], this.playbackEndTime - this.playbackStartTime;
		let o, s = 0, c = null;
		if (this.playingState.keyframeIndex !== null && this.playingState.keyframeIndex >= r && this.playingState.keyframeIndex < n - this.skipEnd) {
			o = this.playingState.keyframeIndex, s = (t = this.playingState.progress) == null ? 0 : t;
			let e = this.timeArray[o];
			c = e + ((o + 1 < this.timeArray.length ? this.timeArray[o + 1] : e) - e) * s;
		} else o = this.skipStart, o >= n - 1 - this.skipEnd && (o = n - 1 - this.skipEnd - 1), o < 0 && (o = 0), c = null;
		let l = this.playbackStartTime;
		if (c !== null) {
			let e = c - l;
			this.startTimestamp = Date.now() - e / this.rate;
		} else this.startTimestamp = Date.now();
		if (s > 0 && o + 1 < n) {
			let e = this.keyframes[o].position.clone(), t = this.keyframes[o + 1].position.clone(), n = e.clone().lerp(t, s), r = t.clone().sub(e).normalize(), i = n.clone().add(r.multiplyScalar(.01));
			this.virualCamera.position.copy(n), this.virualCamera.lookAt(i);
		} else this.virualCamera.position.copy(this.keyframes[o].position.clone()), o + 1 < n && this.virualCamera.lookAt(this.keyframes[o + 1].position.clone());
		this.virualCamera.computePose(), this.five.setState(Object.assign({}, this.virualCamera.pose), !0), this.cancelAnimation = e.shared.add((e, t) => {
			if (!this.startTimestamp) return;
			let r = l + (Date.now() - this.startTimestamp) * this.rate;
			if (this.playbackEndTime && r >= this.playbackEndTime) {
				let e = n - 1 - this.skipEnd;
				if (e > 0 && e < n) {
					if (this.currentKeyFrame = this.keyframes[e - 1], this.nextKeyframe = this.keyframes[e], this.virualCamera.position.copy(this.nextKeyframe.position.clone()), e + 1 < n) this.virualCamera.lookAt(this.keyframes[e + 1].position.clone());
					else {
						let e = this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize();
						this.virualCamera.lookAt(this.nextKeyframe.position.clone().add(e.multiplyScalar(.01)));
					}
					this.virualCamera.computePose(), this.five.setState(Object.assign({}, this.virualCamera.pose), !0);
				}
				this.cancelAnimation && (this.cancelAnimation(), this.startTimestamp = null);
				return;
			}
			let a = this.findKeyFrameByTimestamp(r);
			if (a === void 0 || a >= n - 1 - this.skipEnd || (a !== o && (o = a), o >= n - 1 - this.skipEnd) || (this.currentKeyFrame = this.keyframes[o], this.nextKeyframe = this.keyframes[o + 1], o + 2 <= n - 1 ? this.nextButOneKeyframe = this.keyframes[o + 2] : this.nextButOneKeyframe = null, !this.timeArray)) return;
			let s = this.timeArray[o], c = this.timeArray[o + 1] - s, u = c > 0 ? (r - s) / c : 0, d = Math.max(0, Math.min(1, u)), f = this.currentKeyFrame.position.clone(), p = this.nextKeyframe.position.clone(), m = this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(), h = f.clone().add(m.clone().multiplyScalar(.01)), g = new i.Vector3();
			this.nextButOneKeyframe === null ? g.copy(m) : g = this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();
			let _ = p.clone().add(g.clone().multiplyScalar(.01)), v = f.clone().lerp(p, d), y = h.clone().lerp(_, d);
			this.virualCamera.position.copy(v), this.virualCamera.lookAt(y), this.virualCamera.updateMatrixWorld(), this.virualCamera.updateMatrix(), this.virualCamera.computePose(), this.five.setState(Object.assign({}, this.virualCamera.pose), !0), this.playingState.keyframeIndex = o, this.playingState.progress = d, this.location = this.keyframes[o].location + f.clone().distanceTo(v), this.playingState.keyframeIndex = o, this.playingState.progress = d;
		});
	}
	findKeyFrameByLocation(e) {
		if (this.keyframes.length === 0) return;
		let t = 0, n = this.keyframes.length - 1;
		for (; t <= n;) {
			let r = Math.floor((t + n) / 2);
			if (this.keyframes[r].location === e) return r;
			this.keyframes[r].location < e ? t = r + 1 : n = r - 1;
		}
		return {
			keyframeIndex: t - 1,
			progress: 0
		};
	}
	findKeyFrameByTimestamp(e) {
		if (!this.timeArray || this.timeArray.length === 0 || this.keyframes.length === 0) return;
		let t = 0, n = this.timeArray.length - 1, r = 0, i = Math.abs(this.timeArray[0] - e);
		for (; t <= n;) {
			let a = Math.floor((t + n) / 2), o = this.timeArray[a], s = Math.abs(o - e);
			if (s < i && (i = s, r = a), o === e) return a;
			o < e ? t = a + 1 : n = a - 1;
		}
		return r > 0 && Math.abs(this.timeArray[r - 1] - e) < i && --r, r < this.timeArray.length - 1 && Math.abs(this.timeArray[r + 1] - e) < i && (r += 1), r;
	}
	resetPlayingState() {
		this.playingState.keyframeIndex = null, this.playingState.progress = null;
	}
	getTotalTime() {
		if (!this.timeArray || this.timeArray.length === 0) return null;
		let e = this.skipStart, t = this.timeArray.length - 1 - this.skipEnd;
		if (e >= t || e < 0 || t >= this.timeArray.length) return null;
		let n = this.timeArray[e];
		return this.timeArray[t] - n;
	}
	setPlayingStateByTimestamp(t) {
		if (!this.trajectory || !this.timeArray || this.timeArray.length === 0) throw Error("Trajectory or timeArray is not available");
		let n = this.keyframes.length;
		if (t < 0 || t >= n) throw Error("Invalid keyframeIndex");
		this.cancelAnimation && this.cancelAnimation();
		let r = this.skipStart, a = this.timeArray.length - 1 - this.skipEnd;
		if (r >= a || r < 0 || a >= this.timeArray.length) throw Error("Invalid skipStart or skipEnd values");
		this.playbackStartTime = this.timeArray[r], this.playbackEndTime = this.timeArray[a];
		let o = this.timeArray[t] - this.playbackStartTime;
		if (this.startTimestamp = Date.now() - o / this.rate, this.playingState.keyframeIndex = t, this.playingState.progress = 0, this.virualCamera.position.copy(this.keyframes[t].position.clone()), t + 1 < n) this.virualCamera.lookAt(this.keyframes[t + 1].position.clone());
		else if (t > 0) {
			let e = this.keyframes[t].position.clone().sub(this.keyframes[t - 1].position.clone()).normalize();
			this.virualCamera.lookAt(this.keyframes[t].position.clone().add(e.multiplyScalar(.01)));
		}
		this.virualCamera.computePose(), this.five.setState(Object.assign({}, this.virualCamera.pose), !0);
		let s = this.playbackStartTime, c = t;
		this.cancelAnimation = e.shared.add((e, t) => {
			if (this.timeArray === null || this.timeArray.length === 0 || !this.startTimestamp) return;
			let r = s + (Date.now() - this.startTimestamp) * this.rate;
			if (this.playbackEndTime && r >= this.playbackEndTime) {
				let e = n - 1 - this.skipEnd;
				if (e > 0 && e < n) {
					if (this.currentKeyFrame = this.keyframes[e - 1], this.nextKeyframe = this.keyframes[e], this.virualCamera.position.copy(this.nextKeyframe.position.clone()), e + 1 < n) this.virualCamera.lookAt(this.keyframes[e + 1].position.clone());
					else {
						let e = this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize();
						this.virualCamera.lookAt(this.nextKeyframe.position.clone().add(e.multiplyScalar(.01)));
					}
					this.virualCamera.computePose(), this.five.setState(Object.assign({}, this.virualCamera.pose), !0);
				}
				this.cancelAnimation && (this.cancelAnimation(), this.startTimestamp = null);
				return;
			}
			let a = this.findKeyFrameByTimestamp(r);
			if (a === void 0 || a >= n - 1 - this.skipEnd || (a !== c && (c = a), c >= n - 1 - this.skipEnd)) return;
			this.currentKeyFrame = this.keyframes[c], this.nextKeyframe = this.keyframes[c + 1], c + 2 <= n - 1 ? this.nextButOneKeyframe = this.keyframes[c + 2] : this.nextButOneKeyframe = null;
			let o = this.currentKeyFrame.position.clone(), l = this.nextKeyframe.position.clone(), u = this.nextKeyframe.position.clone().sub(this.currentKeyFrame.position.clone()).normalize(), d = o.clone().add(u.clone().multiplyScalar(.01)), f = new i.Vector3();
			this.nextButOneKeyframe === null ? f.copy(u) : f = this.nextButOneKeyframe.position.clone().sub(this.nextKeyframe.position.clone()).normalize();
			let p = l.clone().add(f.clone().multiplyScalar(.01)), m = this.timeArray[c], h = this.timeArray[c + 1] - m, g = 0;
			if (h > 0) {
				let e = r - m;
				g = Math.max(0, Math.min(1, e / h));
			}
			let _ = g * g * (3 - 2 * g), v = o.clone().lerp(l, _), y = d.clone().lerp(p, _);
			this.virualCamera.position.copy(v), this.virualCamera.lookAt(y), this.virualCamera.computePose(), this.five.setState(Object.assign({}, this.virualCamera.pose), !0);
		});
	}
	_disable(e) {}
	enable(e) {
		var t;
		if (this.state.enabled) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !0 }, n), this._enable({ userAction: n });
	}
	disable(e) {
		var t;
		if (this.state.enabled === !1) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !1 }, n), this._disable({ userAction: n });
	}
}, be = (e, t) => new ye(e, t);
//#endregion
//#region build/plugins/utils/clamp.js
function xe(e, t, n) {
	return e < t ? t : e > n ? n : e;
}
//#endregion
//#region build/plugins/PanoAnimePlugin/Controller.js
var Se = "\nvarying vec2 vUv;\nvarying vec3 vPosition;\nvoid main() {\n  vUv = uv;\n  vPosition = position;\n  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n", Ce = "\nvarying vec2 vUv;\nuniform sampler2D map;\nuniform float progress;\nuniform float opacity;\nvarying vec3 vPosition;\n\nvoid main() {\n  vec3 white = vec3(1.0, 1.0, 1.0);\n  vec4 image = texture2D(map, vUv);\n  if (vUv.y > progress) {\n    discard;\n  }\n  gl_FragColor = vec4(white, 0.7 * (progress - vPosition.y));\n  if (progress == 1.0) {\n    gl_FragColor = gl_FragColor + vec4(image.rgb, image.a * (1.0 - vPosition.y));\n  }\n  gl_FragColor.a = gl_FragColor.a * opacity;\n}\n", we = [
	1,
	5,
	2,
	6,
	3,
	7,
	4,
	8,
	9,
	13,
	10,
	14,
	11,
	15,
	12,
	16
], Te = 512, Ee = 512, De = 128, Oe = class extends v.Controller {
	get config() {
		return Object.assign({}, this._config);
	}
	updateState(e, t) {
		let n = this.state;
		this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
			state: this.state,
			prevState: n,
			userAction: t
		});
	}
	updateConfig(e, t = {}) {
		var n;
		let r = this.config, i = Object.assign(Object.assign({}, r), e);
		this._config = i, this.hooks.emit("configChange", {
			prevConfig: r,
			config: i,
			userAction: (n = t.userAction) == null ? !0 : n
		});
	}
	constructor(e, t) {
		super(e), this.group = new i.Group(), this.mesh = (() => {
			let e = new i.CylinderGeometry(.12, .12, 1, 32, 1, !0);
			e.translate(0, .5, 0);
			let t = new i.ShaderMaterial({
				vertexShader: Se,
				fragmentShader: Ce,
				uniforms: {
					map: { value: new i.Texture() },
					progress: { value: 0 },
					opacity: { value: 0 }
				},
				transparent: !0,
				depthTest: !1
			});
			return new i.Mesh(e, t);
		})(), this.panoMesh = new n({ scale: 1.5 }), this.stop = () => {}, this.drawLine = (e, t) => {
			if (!this.ctx) return;
			let n = (() => {
				var t;
				return (Te / 16 | 0) * ((t = we[e]) == null ? 0 : t);
			})(), r = (1 - (t + e * 150) % 1200 / 1200) * (Ee + De), i = this.ctx.createLinearGradient(0, r - De, 0, r);
			i.addColorStop(0, "rgba(255,255,255,0)"), i.addColorStop(.5, "rgba(255,255,255,1)"), i.addColorStop(1, "rgba(255,255,255,0)"), this.ctx.fillStyle = i, this.ctx.fillRect(n, r - De, 3, De);
		}, this.anime = (e) => {
			if (!this.ctx || !this.startTime) return;
			this.ctx.clearRect(0, 0, Te, Ee);
			for (let t = 0; t < 16; t++) this.drawLine(t, e - this.startTime);
			let t = xe((e - this.startTime) / 1e3, 0, 1), n = xe((e - this.startTime) / 300, 0, this.config.maxOpacity);
			this.panoMesh.setOpacity(n), this.mesh.material.uniforms.progress.value = t, this.mesh.material.uniforms.opacity.value = n, this.mesh.material.uniforms.map.value.needsUpdate = !0, this.five.needsRender = !0;
		}, this.dispose = () => {
			this.disable();
		}, this.five = e;
		let r = {
			enabled: !1,
			visible: !0
		};
		this.state = Object.assign(r, t == null ? void 0 : t.initialState);
		let a = Object.assign(Object.assign({}, t == null ? void 0 : t.config), { maxOpacity: 1 });
		this._config = a, !(typeof document > "u") && (this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), this.canvas.width = Te, this.canvas.height = Ee, this.ctx.shadowColor = "rgba(255,255,255,0.5)", this.ctx.shadowBlur = 6, this.ctx.shadowOffsetX = 0, this.ctx.shadowOffsetY = 0, this.mesh.material.uniforms.map.value = new i.CanvasTexture(this.canvas), this.group.add(this.mesh), this.panoMesh.setProgress(1), this.panoMesh.setOpacity(0), this.group.add(this.panoMesh), this.state.enabled && this._enable({ userAction: !1 }));
	}
	load(e) {
		return S(this, void 0, void 0, function* () {});
	}
	_enable(t) {
		this.mesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition), this.panoMesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition), this.five.ready().then(() => {
			this.five.scene.add(this.group), this.stop = e.shared.add((e, t) => {
				this.startTime || (this.startTime = e), this.panoMesh.updateTime(e, t), this.anime(e);
			});
		});
	}
	_disable(e) {
		this.five.scene.remove(this.group), this.panoMesh.setOpacity(0), this.startTime = void 0, this.stop(), this.five.needsRender = !0;
	}
	enable(e) {
		var t;
		if (!this.ctx || this.state.enabled || !this.five.observers[this.five.state.panoIndex]) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !0 }, n), this._enable({ userAction: n });
	}
	disable(e) {
		var t;
		if (this.state.enabled === !1) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !1 }, n), this._disable({ userAction: n });
	}
	setState(e, t = {}) {
		let n = this.state, r = t.userAction === void 0 ? !0 : t.userAction;
		if (this.updateState(e, r), e.enabled !== void 0 && n.enabled !== e.enabled) {
			let t = { userAction: r };
			e.enabled ? this._enable(t) : this._disable(t);
		}
	}
}, ke = (e, t) => new Oe(e, t), Ae = class extends i.InstancedBufferGeometry {
	constructor() {
		super(), this.type = "LineSegmentsGeometry", this.setIndex([
			0,
			2,
			1,
			2,
			3,
			1,
			2,
			4,
			3,
			4,
			5,
			3,
			4,
			6,
			5,
			6,
			7,
			5
		]), this.setAttribute("position", new i.Float32BufferAttribute([
			-1,
			2,
			0,
			1,
			2,
			0,
			-1,
			1,
			0,
			1,
			1,
			0,
			-1,
			0,
			0,
			1,
			0,
			0,
			-1,
			-1,
			0,
			1,
			-1,
			0
		], 3)), this.setAttribute("uv", new i.Float32BufferAttribute([
			-1,
			2,
			1,
			2,
			-1,
			1,
			1,
			1,
			-1,
			-1,
			1,
			-1,
			-1,
			-2,
			1,
			-2
		], 2));
	}
	applyMatrix4(e) {
		let t = this.attributes.instanceStart, n = this.attributes.instanceEnd;
		return t !== void 0 && (t.applyMatrix4(e), n.applyMatrix4(e), t.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this;
	}
	setPositions(e) {
		let t;
		t = e instanceof Float32Array ? e : Array.isArray(e) ? new Float32Array(e) : new Float32Array();
		let n = new i.InstancedInterleavedBuffer(t, 6, 1);
		return this.setAttribute("instanceStart", new i.InterleavedBufferAttribute(n, 3, 0)), this.setAttribute("instanceEnd", new i.InterleavedBufferAttribute(n, 3, 3)), this.computeBoundingBox(), this.computeBoundingSphere(), this;
	}
	setColors(e) {
		let t;
		t = e instanceof Float32Array ? e : Array.isArray(e) ? new Float32Array(e) : new Float32Array();
		let n = new i.InstancedInterleavedBuffer(t, 6, 1);
		return this.setAttribute("instanceColorStart", new i.InterleavedBufferAttribute(n, 3, 0)), this.setAttribute("instanceColorEnd", new i.InterleavedBufferAttribute(n, 3, 3)), this;
	}
	fromWireframeGeometry(e) {
		return this.setPositions(e.attributes.position.array), this;
	}
	fromEdgesGeometry(e) {
		return this.setPositions(e.attributes.position.array), this;
	}
	fromMesh(e) {
		return this.fromWireframeGeometry(new i.WireframeGeometry(e.geometry)), this;
	}
	fromLineSegments(e) {
		var t = e.geometry;
		if (t instanceof i.Geometry) {
			let e = new i.BufferGeometry().fromGeometry(t);
			this.setPositions(e.attributes.position.array);
		} else t instanceof i.BufferGeometry && this.setPositions(t.attributes.position.array);
		return this;
	}
	computeBoundingBox() {
		this.boundingBox === null && (this.boundingBox = new i.Box3());
		let e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
		if (e !== void 0 && t !== void 0) {
			let n = new i.Box3();
			this.boundingBox.setFromBufferAttribute(e), n.setFromBufferAttribute(t), this.boundingBox.union(n);
		}
	}
	computeBoundingSphere() {
		this.boundingSphere === null && (this.boundingSphere = new i.Sphere()), this.boundingBox === null && this.computeBoundingBox();
		let e = this.attributes.instanceStart, t = this.attributes.instanceEnd;
		if (e !== void 0 && t !== void 0) {
			let n = this.boundingSphere.center;
			this.boundingBox.getCenter(n);
			let r = 0, a = new i.Vector3();
			for (let i = 0, o = e.count; i < o; i++) a.fromBufferAttribute(e, i), r = Math.max(r, n.distanceToSquared(a)), a.fromBufferAttribute(t, i), r = Math.max(r, n.distanceToSquared(a));
			this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this);
		}
	}
	toJSON() {}
};
Object.assign(Ae.prototype, { isLineSegmentsGeometry: !0 });
//#endregion
//#region build/plugins/DynamicPathLinePlugin/line2/LineMaterial.js
var je = {
	uniforms: i.UniformsUtils.merge([
		i.UniformsLib.common,
		i.UniformsLib.fog,
		{
			linewidth: { value: 1 },
			resolution: { value: new i.Vector2(1, 1) },
			dashScale: { value: 1 },
			dashSize: { value: 1 },
			gapSize: { value: 1 },
			opacity: { value: 1 },
			totalLength: { value: 1 },
			animationProgress: { value: 0 },
			time: { value: 0 },
			waveAmp: { value: .15 },
			waveFreq: { value: 5 },
			waveDir: { value: 2 },
			startOffset: { value: 0 },
			endOffset: { value: 0 },
			range: { value: .3 }
		}
	]),
	vertexShader: "\n    #include <common>\n    #include <color_pars_vertex>\n    #include <fog_pars_vertex>\n    #include <logdepthbuf_pars_vertex>\n    #include <clipping_planes_pars_vertex>\n\n    uniform float linewidth;\n    uniform vec2 resolution;\n    uniform float totalLength;\n    uniform float time;\n    uniform float waveAmp;\n    uniform float waveFreq;\n    uniform float waveDir;\n    uniform float startOffset;\n    uniform float endOffset;  // 新增\n\n    attribute vec3 instanceStart;\n    attribute vec3 instanceEnd;\n    attribute float distanceProgress;\n    attribute vec3 instanceColorStart;\n    attribute vec3 instanceColorEnd;\n    attribute float instanceDistanceStart;\n    attribute float instanceDistanceEnd;\n\n    varying vec2 vUv;\n    varying float vDistanceProgress;\n\n    #ifdef USE_DASH\n      uniform float dashScale;\n      varying float vLineDistance;\n    #endif\n\n    void trimSegment(const in vec4 start, inout vec4 end) {\n      float a = projectionMatrix[2][2];\n      float b = projectionMatrix[3][2];\n      float nearEstimate = -0.5 * b / a;\n      float alpha = (nearEstimate - start.z) / (end.z - start.z);\n      end.xyz = mix(start.xyz, end.xyz, alpha);\n    }\n\n    void main() {\n      #ifdef USE_COLOR\n        vColor.xyz = (position.y < 0.5) ? instanceColorStart : instanceColorEnd;\n      #endif\n\n      #ifdef USE_DASH\n        vLineDistance = (position.y < 0.5) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n      #endif\n\n      float aspect = resolution.x / resolution.y;\n      vUv = uv;\n\n      // camera space\n      vec4 start = modelViewMatrix * vec4(instanceStart, 1.0);\n      vec4 end = modelViewMatrix * vec4(instanceEnd, 1.0);\n\n      // ===== 波浪偏移逻辑 =====\n      if (waveDir > 0.5) { // 0 表示不波动\n        float adjustedDistanceStart = max(0.0, instanceDistanceStart - startOffset);\n        float adjustedDistanceEnd = max(0.0, instanceDistanceEnd - startOffset);\n        float adjustedTotalLength = totalLength - startOffset - endOffset;\n        adjustedTotalLength = max(0.01, adjustedTotalLength);\n        float phaseStart = adjustedDistanceStart / adjustedTotalLength;\n        float phaseEnd = adjustedDistanceEnd / adjustedTotalLength;\n        float waveStart = sin(phaseStart * waveFreq - time * 2.0) * waveAmp;\n        float waveEnd   = sin(phaseEnd * waveFreq - time * 2.0) * waveAmp;\n\n        if (abs(waveDir - 1.0) < 0.1) { // X 方向\n          start.x += waveStart;\n          end.x   += waveEnd;\n        } else if (abs(waveDir - 2.0) < 0.1) { // Y 方向\n          start.y += waveStart;\n          end.y   += waveEnd;\n        } else if (abs(waveDir - 3.0) < 0.1) { // Z 方向\n          start.z += waveStart;\n          end.z   += waveEnd;\n        }\n      }\n      // ======================\n\n      bool perspective = (projectionMatrix[2][3] == -1.0);\n      if (perspective) {\n        if (start.z < 0.0 && end.z >= 0.0) {\n          trimSegment(start, end);\n        } else if (end.z < 0.0 && start.z >= 0.0) {\n          trimSegment(end, start);\n        }\n      }\n\n      vec4 clipStart = projectionMatrix * start;\n      vec4 clipEnd = projectionMatrix * end;\n\n      vec2 ndcStart = clipStart.xy / clipStart.w;\n      vec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n      vec2 dir = ndcEnd - ndcStart;\n      dir.x *= aspect;\n      dir = normalize(dir);\n\n      vec2 offset = vec2(dir.y, -dir.x);\n      dir.x /= aspect;\n      offset.x /= aspect;\n\n      if (position.x < 0.0) offset *= -1.0;\n      if (position.y < 0.0) {\n        offset += -dir;\n      } else if (position.y > 1.0) {\n        offset += dir;\n      }\n\n      offset *= linewidth;\n      offset /= resolution.y;\n\n      vec4 clip = (position.y < 0.5) ? clipStart : clipEnd;\n      offset *= clip.w;\n      clip.xy += offset;\n      \n      gl_Position = clip;\n\n      float adjustedDistanceEnd = max(0.0, instanceDistanceEnd - startOffset);\n      float adjustedTotalLength = totalLength - startOffset - endOffset;\n      adjustedTotalLength = max(0.01, adjustedTotalLength);\n      vDistanceProgress = adjustedDistanceEnd / adjustedTotalLength;\n\n      #include <logdepthbuf_vertex>\n      #include <clipping_planes_vertex>\n      #include <fog_vertex>\n    }\n  ",
	fragmentShader: "\n    uniform vec3 diffuse;\n    uniform float opacity;\n    uniform float animationProgress;\n    uniform float range;\n    uniform float totalLength;\n    varying float vDistanceProgress;\n\n    #ifdef USE_DASH\n      uniform float dashSize;\n      uniform float gapSize;\n    #endif\n\n    varying float vLineDistance;\n    #include <common>\n    #include <color_pars_fragment>\n    #include <fog_pars_fragment>\n    #include <logdepthbuf_pars_fragment>\n    #include <clipping_planes_pars_fragment>\n    varying vec2 vUv;\n\n    void main() {\n      #include <clipping_planes_fragment>\n\n      #ifdef USE_DASH\n        if (vUv.y < -1.0 || vUv.y > 1.0) discard;\n        if (mod(vLineDistance, dashSize + gapSize) > dashSize) discard;\n      #endif\n\n      if (abs(vUv.y) > 1.0) {\n        float a = vUv.x;\n        float b = (vUv.y > 0.0) ? vUv.y - 1.0 : vUv.y + 1.0;\n        float len2 = a * a + b * b;\n        if (len2 > 1.0) discard;\n      }\n\n      vec4 diffuseColor = vec4(diffuse, 1.0);\n      #include <logdepthbuf_fragment>\n      #include <color_fragment>\n\n      gl_FragColor = vec4(diffuseColor.rgb, diffuseColor.a);\n\n      float alpha = 0.0;\n      float diff = (1.0 - 2.0 * range) * vDistanceProgress + range - animationProgress;\n      // 使用绝对值计算,在animationProgress前后range范围内过渡\n      if (abs(diff) < range) {\n        alpha = 1.0 - abs(diff) / range;\n      } else {\n        alpha = 0.0;\n      }\n\n      alpha = clamp(alpha, 0.0, 1.0);\n      gl_FragColor.a = alpha;\n\n      // 增加开头和结尾的渐变alpha遮罩,固定物理距离为 1 米\n      float startFadeLength = 1.0 / totalLength;\n      if (vDistanceProgress < startFadeLength) {\n        gl_FragColor.a *= vDistanceProgress / startFadeLength;\n      }\n      float endFadeStart = 1.0 - startFadeLength;\n      if (vDistanceProgress > endFadeStart) {\n        gl_FragColor.a *= (1.0 - vDistanceProgress) / startFadeLength;\n      }\n      gl_FragColor.a *= opacity;\n      #include <tonemapping_fragment>\n      #include <fog_fragment>\n      #include <premultiplied_alpha_fragment>\n    }\n  "
}, Me = class extends i.ShaderMaterial {
	constructor(e) {
		super({
			uniforms: i.UniformsUtils.clone(je.uniforms),
			vertexShader: je.vertexShader,
			fragmentShader: je.fragmentShader,
			clipping: !0
		}), this.type = "LineMaterial", this.dashed = !1, Object.defineProperties(this, {
			color: {
				enumerable: !0,
				get() {
					return this.uniforms.diffuse.value;
				},
				set(e) {
					this.uniforms.diffuse.value = e;
				}
			},
			linewidth: {
				enumerable: !0,
				get() {
					return this.uniforms.linewidth.value;
				},
				set(e) {
					this.uniforms.linewidth.value = e;
				}
			},
			dashScale: {
				enumerable: !0,
				get() {
					return this.uniforms.dashScale.value;
				},
				set(e) {
					this.uniforms.dashScale.value = e;
				}
			},
			dashSize: {
				enumerable: !0,
				get() {
					return this.uniforms.dashSize.value;
				},
				set(e) {
					this.uniforms.dashSize.value = e;
				}
			},
			gapSize: {
				enumerable: !0,
				get() {
					return this.uniforms.gapSize.value;
				},
				set(e) {
					this.uniforms.gapSize.value = e;
				}
			},
			opacity: {
				enumerable: !0,
				get() {
					return this.uniforms.opacity.value;
				},
				set(e) {
					this.uniforms.opacity.value = e;
				}
			},
			resolution: {
				enumerable: !0,
				get() {
					return this.uniforms.resolution.value;
				},
				set(e) {
					this.uniforms.resolution.value.copy(e);
				}
			},
			time: {
				enumerable: !0,
				get() {
					return this.uniforms.time.value;
				},
				set(e) {
					this.uniforms.time.value = e;
				}
			},
			waveAmp: {
				enumerable: !0,
				get() {
					return this.uniforms.waveAmp.value;
				},
				set(e) {
					this.uniforms.waveAmp.value = e;
				}
			},
			waveFreq: {
				enumerable: !0,
				get() {
					return this.uniforms.waveFreq.value;
				},
				set(e) {
					this.uniforms.waveFreq.value = e;
				}
			},
			waveDir: {
				enumerable: !0,
				get() {
					return this.uniforms.waveDir.value;
				},
				set(e) {
					this.uniforms.waveDir.value = e;
				}
			},
			startOffset: {
				enumerable: !0,
				get() {
					return this.uniforms.startOffset.value;
				},
				set(e) {
					this.uniforms.startOffset.value = e;
				}
			},
			endOffset: {
				enumerable: !0,
				get() {
					return this.uniforms.endOffset.value;
				},
				set(e) {
					this.uniforms.endOffset.value = e;
				}
			},
			range: {
				enumerable: !0,
				get() {
					return this.uniforms.range.value;
				},
				set(e) {
					this.uniforms.range.value = e;
				}
			},
			animationProgress: {
				enumerable: !0,
				get() {
					return this.uniforms.animationProgress.value;
				},
				set(e) {
					this.uniforms.animationProgress.value = e;
				}
			}
		}), this.setValues(e);
	}
};
Object.assign(Me.prototype, { isLineMaterial: !0 });
//#endregion
//#region build/plugins/DynamicPathLinePlugin/line2/LineSegments2.js
var Ne = class extends i.Mesh {
	constructor(e, t) {
		super(), this.type = "LineSegments2", this.geometry = e === void 0 ? new Ae() : e, this.material = t === void 0 ? new Me({ color: Math.random() * 16777215 }) : t;
	}
	computeLineDistances() {
		let e = this.geometry, t = e.attributes.instanceStart, n = e.attributes.instanceEnd, r = new Float32Array(2 * t.count), a = new i.Vector3(), o = new i.Vector3(), s = 0;
		for (let e = 0, r = t.count; e < r; e++) a.fromBufferAttribute(t, e), o.fromBufferAttribute(n, e), s += a.distanceTo(o);
		this.material.uniforms.totalLength.value = s;
		for (let e = 0, i = 0, s = t.count; e < s; e++, i += 2) {
			a.fromBufferAttribute(t, e), o.fromBufferAttribute(n, e);
			let s = a.distanceTo(o);
			r[i] = i === 0 ? 0 : r[i - 1], r[i + 1] = r[i] + s;
		}
		let c = new i.InstancedInterleavedBuffer(r, 2, 1);
		return e.setAttribute("instanceDistanceStart", new i.InterleavedBufferAttribute(c, 1, 0)), e.setAttribute("instanceDistanceEnd", new i.InterleavedBufferAttribute(c, 1, 1)), this;
	}
	raycast(e, t) {
		e.camera === null && console.error("LineSegments2: \"Raycaster.camera\" needs to be set in order to raycast against LineSegments2.");
		let n = e.ray, r = e.camera, a = r.projectionMatrix, o = this.geometry, s = this.material, c = s.resolution, l = s.linewidth, u = o.attributes.instanceStart, d = o.attributes.instanceEnd, f = new i.Vector4(), p = new i.Vector4(), m = new i.Vector4(), h = new i.Vector3(), g = new i.Matrix4(), _ = new i.Line3(), v = new i.Vector3();
		n.at(1, m), m.w = 1, m.applyMatrix4(r.matrixWorldInverse), m.applyMatrix4(a), m.multiplyScalar(1 / m.w), m.x *= c.x / 2, m.y *= c.y / 2, m.z = 0, h.copy(m);
		let y = this.matrixWorld;
		g.multiplyMatrices(r.matrixWorldInverse, y);
		for (var b = 0, x = u.count; b < x; b++) {
			f.fromBufferAttribute(u, b), p.fromBufferAttribute(d, b), f.w = 1, p.w = 1, f.applyMatrix4(g), p.applyMatrix4(g), f.applyMatrix4(a), p.applyMatrix4(a), f.multiplyScalar(1 / f.w), p.multiplyScalar(1 / p.w);
			var S = f.z < -1 && p.z < -1, C = f.z > 1 && p.z > 1;
			if (S || C) continue;
			f.x *= c.x / 2, f.y *= c.y / 2, p.x *= c.x / 2, p.y *= c.y / 2, _.start.copy(f), _.start.z = 0, _.end.copy(p), _.end.z = 0;
			let e = _.closestPointToPointParameter(h, !0);
			_.at(e, v);
			let r = i.MathUtils.lerp(f.z, p.z, e), o = r >= -1 && r <= 1;
			var w = h.distanceTo(v) < l * .5;
			if (o && w) {
				_.start.fromBufferAttribute(u, b), _.end.fromBufferAttribute(d, b), _.start.applyMatrix4(y), _.end.applyMatrix4(y);
				var T = new i.Vector3(), E = new i.Vector3();
				n.distanceSqToSegment(_.start, _.end, E, T), t.push({
					point: E,
					pointOnLine: T,
					distance: n.origin.distanceTo(E),
					object: this,
					faceIndex: b
				});
			}
		}
	}
};
Object.assign(Ne.prototype, { isLineSegments2: !0 });
//#endregion
//#region build/plugins/DynamicPathLinePlugin/line2/Line2.js
var Pe = class extends Ne {
	constructor(e, t) {
		super(e, t), this.type = "Line2";
	}
};
Object.assign(Pe.prototype, { isLine2: !0 });
//#endregion
//#region build/plugins/DynamicPathLinePlugin/line2/LineGeometry.js
var Fe = class extends Ae {
	constructor() {
		super(), this.type = "LineGeometry";
	}
	setPositions(e) {
		let t = e.length - 3, n = new Float32Array(2 * t);
		for (let r = 0; r < t; r += 3) n[2 * r] = e[r], n[2 * r + 1] = e[r + 1], n[2 * r + 2] = e[r + 2], n[2 * r + 3] = e[r + 3], n[2 * r + 4] = e[r + 4], n[2 * r + 5] = e[r + 5];
		return super.setPositions(n), this;
	}
	setColors(e) {
		let t = e.length - 3, n = new Float32Array(2 * t);
		for (let r = 0; r < t; r += 3) n[2 * r] = e[r], n[2 * r + 1] = e[r + 1], n[2 * r + 2] = e[r + 2], n[2 * r + 3] = e[r + 3], n[2 * r + 4] = e[r + 4], n[2 * r + 5] = e[r + 5];
		return super.setColors(n), this;
	}
	fromLine(e) {
		let t = e.geometry;
		if (t instanceof i.Geometry) {
			let e = new i.BufferGeometry().fromGeometry(t);
			this.setPositions(e.attributes.position.array);
		} else t instanceof i.BufferGeometry && this.setPositions(t.attributes.position.array);
		return this;
	}
	copy() {
		return this;
	}
};
Object.assign(Fe.prototype, { isLineGeometry: !0 });
//#endregion
//#region build/plugins/DynamicPathLinePlugin/Controller.js
var Ie = class extends v.Controller {
	get config() {
		return Object.assign({}, this._config);
	}
	updateState(e, t) {
		let n = this.state;
		this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
			state: this.state,
			prevState: n,
			userAction: t
		});
	}
	constructor(e, t) {
		super(e), this.paths = /* @__PURE__ */ new Map(), this.up = new i.Vector3(0, 1, 0);
		let n = {
			enabled: !0,
			visible: !0,
			playing: !1
		};
		this.state = Object.assign(n, t == null ? void 0 : t.initialState);
		let r = {
			lineCount: 6,
			spacing: .02,
			lineWidth: 2,
			color: 16777215,
			speed: 2,
			range: .3,
			waveAmp: .05,
			waveFreq: 20,
			particleCount: 50,
			maxDistance: .1,
			lineYOffset: .1,
			subMeshWidth: .3,
			subMeshColor: 65535,
			subMeshOpacity: .3,
			subMeshMaxOpacity: .5,
			subMeshSegmentInterval: 3,
			subMeshHighlightWidth: 1
		};
		this._config = Object.assign(Object.assign({}, r), t == null ? void 0 : t.config), t != null && t.paths && t.paths.length > 0 && t.paths.forEach((e) => {
			this.addPath(e);
		}), this.state.enabled && this._enable({ userAction: !1 });
	}
	load(e, t) {
		return S(this, void 0, void 0, function* () {
			this.clearAllPaths(), e.paths.forEach((e) => {
				var t, n;
				let r = e.points.map((e) => new i.Vector3(e.x, e.y, e.z));
				this.addPath({
					id: e.id,
					points: r,
					enabled: (t = e.enabled) == null ? !0 : t,
					visible: (n = e.visible) == null ? !0 : n,
					color: e.color,
					lineWidth: e.lineWidth,
					speed: e.speed
				});
			});
			let n = /* @__PURE__ */ new Map();
			this.paths.forEach((e, t) => {
				n.set(t, e.config);
			}), this.data = { paths: n }, this.hooks.emit("dataLoaded", this.data), t && this.setState(t);
		});
	}
	addPath(e) {
		var t, n, r, a, o, s, c, l;
		if (e.points.length < 2) return console.warn(`DynamicPathLinePlugin: 路径 ${e.id} 至少需要2个点`), !1;
		if (this.paths.has(e.id)) return console.warn(`DynamicPathLinePlugin: 路径 ${e.id} 已存在`), !1;
		let u = new i.CatmullRomCurve3(e.points), d = (t = e.subMeshColor) == null ? this._config.subMeshColor : t, f = (n = e.subMeshWidth) == null ? this._config.subMeshWidth : n, p = (r = e.subMeshOpacity) == null ? this._config.subMeshOpacity : r, m = (a = e.enableSubMesh) == null ? !0 : a, h = (o = e.speed) == null ? this._config.speed : o, g = (s = e.range) == null ? this._config.range : s, _ = this.createLines(e, u, g), { particles: v, particleGeometry: y, particleMaterial: b, particleInfos: x, particlePositions: S } = this.createParticles(), C = this.createSubMeshGeometry(e, u, f), w = u.getLength(), T = this.createSubMeshMaterial(d, p, w, g);
		T.uniforms.totalLength.value = w;
		let E = new i.Mesh(C, T);
		E.visible = m, this.five.scene.add(E);
		let D = {
			id: e.id,
			config: e,
			curve: u,
			lines: _,
			particles: v,
			particleGeometry: y,
			particleMaterial: b,
			particleInfos: x,
			particlePositions: S,
			enabled: (c = e.enabled) == null ? !0 : c,
			visible: (l = e.visible) == null ? !0 : l,
			startOffset: 0,
			endOffset: 0,
			lastAnimationProgress: 0,
			cycleStartTime: performance.now() / 1e3,
			isInitialAnimation: !0,
			isPathlineInitialAnimation: !0,
			subMeshUnfoldProgress: 0,
			subMeshUnfoldStarted: !1,
			subMeshUnfoldStartTime: 0,
			lastUpdateTime: performance.now() / 1e3,
			subMesh: E,
			subMeshGeometry: C,
			subMeshMaterial: T,
			subMeshColor: d,
			subMeshWidth: f,
			subMeshOpacity: p,
			speed: h,
			animationId: null,
			enableSubMesh: m,
			isPaused: !1,
			pausedProgress: 0,
			pausedTime: 0
		};
		this.paths.set(e.id, D);
		let O = this.data, ee = /* @__PURE__ */ new Map();
		return this.paths.forEach((e, t) => {
			ee.set(t, e.config);
		}), this.data = { paths: ee }, this.hooks.emit("dataChange", this.data, O), this.hooks.emit("pathAdd", e.id, e), this.state.playing && this.startPathAnimation(e.id), !0;
	}
	removePath(e) {
		let t = this.paths.get(e);
		if (!t) return console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`), !1;
		this.stopPathAnimation(e), this.disposePathResources(t), this.paths.delete(e);
		let n = this.data, r = /* @__PURE__ */ new Map();
		return this.paths.forEach((e, t) => {
			r.set(t, e.config);
		}), this.data = { paths: r }, this.hooks.emit("dataChange", this.data, n), this.hooks.emit("pathRemove", e), !0;
	}
	enablePath(e) {
		let t = this.paths.get(e);
		return t ? (t.enabled = !0, this.hooks.emit("pathEnable", e), !0) : (console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`), !1);
	}
	disablePath(e) {
		let t = this.paths.get(e);
		return t ? (t.enabled = !1, this.hooks.emit("pathDisable", e), !0) : (console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`), !1);
	}
	showPath(e) {
		let t = this.paths.get(e);
		return t ? (t.visible = !0, t.lines.forEach((e) => e.visible = !0), t.particles.visible = !0, t.subMesh.visible = !0, this.hooks.emit("pathShow", e), !0) : (console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`), !1);
	}
	hidePath(e) {
		let t = this.paths.get(e);
		return t ? (t.visible = !1, t.lines.forEach((e) => e.visible = !1), t.particles.visible = !1, t.subMesh.visible = !1, this.hooks.emit("pathHide", e), !0) : (console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`), !1);
	}
	getPathIds() {
		return Array.from(this.paths.keys());
	}
	getPathConfig(e) {
		let t = this.paths.get(e);
		return t ? Object.assign({}, t.config) : void 0;
	}
	clearAllPaths() {
		this.paths.forEach((e, t) => {
			this.stopPathAnimation(t), this.disposePathResources(e);
		}), this.paths.clear();
		let e = this.data, t = /* @__PURE__ */ new Map();
		this.paths.forEach((e, n) => {
			t.set(n, e.config);
		}), this.data = { paths: t }, this.hooks.emit("dataChange", this.data, e);
	}
	getPositions(e, t) {
		let n = [], r = [], i = 0, a = [];
		for (let n = 0; n <= t; n++) {
			let r = n / t, o = e.getPoint(r);
			a.push(o.clone()), n > 0 && (i += o.distanceTo(a[n - 1]));
		}
		let o = 0;
		for (let e = 0; e < t; e++) {
			e > 0 && (o += a[e].distanceTo(a[e - 1]));
			let t = o / i;
			n.push(a[e].x, a[e].y, a[e].z), r.push(t);
		}
		return {
			positions: n,
			distanceProgress: r
		};
	}
	createLines(e, t, n) {
		var r, a;
		let o = [], s = e.points.length * 40, { lineCount: c, spacing: l, waveAmp: u, waveFreq: d, lineYOffset: f } = this._config, p = (r = e.lineWidth) == null ? this._config.lineWidth : r, m = (a = e.color) == null ? this._config.color : a, h = n / t.getLength();
		for (let n = 0; n < c; n++) {
			let r = (n - (c - 1) / 2) * l, a = e.points.map((a, o) => {
				let s = o / (e.points.length - 1), c = t.getTangent(s).normalize(), l = new i.Vector3().crossVectors(this.up, c).normalize(), u = r * Math.abs((o - e.points.length / 2) / e.points.length - .5) * -1;
				return a.clone().addScaledVector(l, r + u).add(new i.Vector3(0, f + .02 * (n % 2 == 0), 0));
			}), g = new i.CatmullRomCurve3(a), { positions: _ } = this.getPositions(g, s), v = new Fe();
			v.setPositions(_);
			let y = new Me({
				color: m,
				linewidth: p * (n % 2 == 0 ? 1 : .5),
				transparent: !0,
				opacity: 1,
				depthWrite: !1
			});
			y.resolution.set(this.five.camera.resolution.x, this.five.camera.resolution.y), n === 0 ? y.waveDir = 1 : n === 1 ? y.waveDir = 2 : n === 2 ? y.waveDir = 0 : n === 3 ? y.waveDir = 3 : n === 4 && (y.waveDir = 1), y.waveAmp = u, y.waveFreq = d, Object.assign(y.uniforms, {
				time: { value: 0 },
				startOffset: { value: 0 },
				range: { value: h }
			});
			let b = new Pe(v, y);
			b.computeLineDistances(), o.push(b), this.five.scene.add(b);
		}
		return o;
	}
	createParticleMaterial() {
		return new i.ShaderMaterial({
			transparent: !0,
			blending: i.AdditiveBlending,
			depthWrite: !1,
			uniforms: { pointTexture: { value: new i.TextureLoader().load("https://threejs.org/examples/textures/sprites/circle.png") } },
			vertexShader: "\n        attribute float size;\n        varying vec2 vUv;\n        void main() {\n          vUv = uv;\n          vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n          gl_PointSize = size * (1.0 / -mvPosition.z);\n          gl_Position = projectionMatrix * mvPosition;\n        }\n      ",
			fragmentShader: "\n        uniform sampler2D pointTexture;\n        void main() {\n          gl_FragColor = texture2D(pointTexture, gl_PointCoord);\n          gl_FragColor.a *= 0.15;\n        }\n      "
		});
	}
	createParticles() {
		let { particleCount: e } = this._config, t = new Float32Array(e * 3), n = new i.BufferGeometry(), r = this.createParticleMaterial(), a = new i.Points(n, r), o = new Float32Array(e), s = [];
		for (let n = 0; n < e; n++) t[n * 3] = 9999, t[n * 3 + 1] = 9999, t[n * 3 + 2] = 9999, o[n] = i.MathUtils.randFloat(3, 9), s.push({
			velocity: new i.Vector3(),
			life: 3 + Math.random() * 2,
			age: 0,
			active: !1,
			alpha: 0,
			startPos: new i.Vector3()
		});
		return n.setAttribute("position", new i.BufferAttribute(t, 3)), n.setAttribute("size", new i.BufferAttribute(o, 1)), a.frustumCulled = !1, this.five.scene.add(a), {
			particles: a,
			particleGeometry: n,
			particleMaterial: r,
			particleInfos: s,
			particlePositions: t
		};
	}
	createSubMeshGeometry(e, t, n) {
		let r = e.points.length * 40, a = new i.BufferGeometry(), o = t.getPoints(r), s = [], c = [], l = [], u = [], d = 0, f = [0];
		for (let e = 1; e < o.length; e++) d += o[e].distanceTo(o[e - 1]), f.push(d);
		let p = d;
		for (let e = 0; e < o.length; e++) {
			let r = o[e], a = e / (o.length - 1), l = t.getTangent(a).normalize(), d = new i.Vector3().crossVectors(this.up, l).normalize(), m = n / 2, h = r.clone().addScaledVector(d, -m);
			s.push(h.x, h.y, h.z), c.push(0, f[e] / p), u.push(f[e] / p);
			let g = r.clone().addScaledVector(d, m);
			s.push(g.x, g.y, g.z), c.push(1, f[e] / p), u.push(f[e] / p);
		}
		for (let e = 0; e < o.length - 1; e++) {
			let t = e * 2;
			l.push(t, t + 1, t + 2), l.push(t + 1, t + 3, t + 2);
		}
		return a.setAttribute("position", new i.Float32BufferAttribute(s, 3)), a.setAttribute("uv", new i.Float32BufferAttribute(c, 2)), a.setAttribute("distanceProgress", new i.Float32BufferAttribute(u, 1)), a.setIndex(l), a.computeVertexNormals(), a;
	}
	createAlphaMapTexture(e, t, n, r, a) {
		let o = 1024;
		o * 1;
		let s = new Uint8Array(1024), c = 1 / e, l = t / (n / e) / 2;
		for (let e = 0; e < o; e++) {
			let t = e / o, n = (t - Math.floor(t / c) * c) / c, i = 0, u = n;
			if (u > .5 && (u = 1 - u), u < l) {
				let e = 1 - u / l;
				i = r + (a - r) * e;
			} else i = r;
			s[e] = Math.floor(i * 255);
		}
		let u = new i.DataTexture(s, o, 1, i.RedFormat);
		return u.needsUpdate = !0, u.wrapS = i.RepeatWrapping, u.wrapT = i.ClampToEdgeWrapping, u.minFilter = i.LinearFilter, u.magFilter = i.LinearFilter, u;
	}
	createSubMeshMaterial(e, t, n, r) {
		let { subMeshSegmentInterval: a, subMeshHighlightWidth: o, subMeshMaxOpacity: s } = this._config, c = Math.max(1, Math.round(n / a)), l = r / n, u = this.createAlphaMapTexture(c, o, n, t, s);
		return new i.ShaderMaterial({
			transparent: !0,
			side: i.BackSide,
			depthWrite: !1,
			uniforms: {
				baseColor: { value: new i.Color(e) },
				baseOpacity: { value: t },
				globalOpacity: { value: 1 },
				animationProgress: { value: 0 },
				range: { value: l },
				startOffset: { value: 0 },
				endOffset: { value: 0 },
				totalLength: { value: 1 },
				unfoldProgress: { value: 0 },
				alphaMap: { value: u }
			},
			vertexShader: "\n        attribute float distanceProgress;\n        varying vec2 vUv;\n        varying float vDistanceProgress;\n\n        void main() {\n          vUv = uv;\n          vDistanceProgress = distanceProgress;\n          gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n        }\n      ",
			fragmentShader: "\n        uniform vec3 baseColor;\n        uniform float baseOpacity;\n        uniform float globalOpacity;\n        uniform float animationProgress;\n        uniform float range;\n        uniform float startOffset;\n        uniform float endOffset;\n        uniform float totalLength;\n        uniform float unfoldProgress;\n        uniform sampler2D alphaMap;\n\n        varying vec2 vUv;\n        varying float vDistanceProgress;\n\n        void main() {\n          // 计算调整后的距离进度\n          float adjustedDistanceStart = max(0.0, startOffset);\n          float adjustedTotalLength = totalLength - startOffset - endOffset;\n          adjustedTotalLength = max(0.01, adjustedTotalLength);\n          float adjustedProgress = (vDistanceProgress * totalLength - adjustedDistanceStart) / adjustedTotalLength;\n\n          // 如果在裁剪范围外,丢弃片段\n          if (adjustedProgress < 0.0 || adjustedProgress > 1.0) {\n            discard;\n          }\n\n          // 展开效果:只显示已展开的部分\n          if (adjustedProgress > unfoldProgress) {\n            discard;\n          }\n\n          // 计算 UV 坐标用于采样 alphaMap\n          // u 坐标 = 当前位置 + 动画进度(形成移动效果)\n          float u = fract(adjustedProgress - animationProgress);\n          vec2 uv = vec2(u, 0.5);\n\n          // 从 alphaMap 采样透明度\n          float sampledAlpha = texture2D(alphaMap, uv).r;\n\n          // 展开前进头部的渐变遮罩,固定物理距离为 1 米\n          float unfoldFadeLength = 1.0 / totalLength;  // 1米 / 总长度 = 百分比\n          float distanceToUnfoldEdge = unfoldProgress - adjustedProgress;\n          if (distanceToUnfoldEdge < unfoldFadeLength && distanceToUnfoldEdge > 0.0) {\n            sampledAlpha *= distanceToUnfoldEdge / unfoldFadeLength;\n          }\n\n          // 增加开头和结尾的渐变 alpha 遮罩,固定物理距离为 1 米\n          float fadeLength = 1.0 / totalLength;  // 1米 / 总长度 = 百分比\n          if (adjustedProgress < fadeLength) {\n            sampledAlpha *= adjustedProgress / fadeLength;\n          }\n          float endFadeStart = 1.0 - fadeLength;\n          if (adjustedProgress > endFadeStart) {\n            sampledAlpha *= (1.0 - adjustedProgress) / fadeLength;\n          }\n\n          gl_FragColor = vec4(baseColor, sampledAlpha * globalOpacity);\n        }\n      "
		});
	}
	projectPointsToScreen(e, t) {
		let n = [], r = 0;
		for (let a = 0; a < e.length; a++) {
			let o = e[a];
			a > 0 && (r += o.distanceTo(e[a - 1]));
			let s = o.clone().project(t), c = s.x < -1 || s.x > 1 || s.y < -1 || s.y > 1 || s.z < -1 || s.z > 1;
			n.push({
				point: o.clone(),
				screenPos: new i.Vector2(s.x, s.y),
				distanceFromStart: r,
				isOffscreen: c
			});
		}
		return n;
	}
	findNearestOffscreenPoint(e) {
		let t = -1, n = 0, r = -1;
		for (let t = 0; t < e.length; t++) if (!e[t].isOffscreen) {
			r = t;
			break;
		}
		if (r === -1) return null;
		for (let i = r - 1; i >= 0; i--) if (e[i].isOffscreen) {
			t = i, n = e[i].distanceFromStart;
			break;
		}
		return t === -1 ? {
			index: 0,
			distance: 0
		} : {
			index: t,
			distance: n
		};
	}
	findFarestOffscreenPoint(e) {
		var t;
		let n = ((t = e[e.length - 1]) == null ? void 0 : t.distanceFromStart) || 0, r = -1;
		for (let t = e.length - 1; t >= 0; t--) if (!e[t].isOffscreen) {
			r = t;
			break;
		}
		if (r === -1) return null;
		let i = r + 1;
		return i < e.length && e[i].isOffscreen ? {
			index: i,
			distance: e[i].distanceFromStart,
			totalLength: n
		} : {
			index: e.length - 1,
			distance: n,
			totalLength: n
		};
	}
	updatePathAnimation(e) {
		var t, n;
		let r = this.paths.get(e);
		if (!r || !r.enabled) return;
		let a = performance.now() / 1e3, { particleCount: o, maxDistance: s } = this._config, c = ((t = r.lines[0]) == null ? void 0 : t.material.uniforms.totalLength.value) || 1, l = Math.max(.01, c - r.startOffset - r.endOffset), u = r.speed, d = (a - r.cycleStartTime) * u / l % 1;
		if (r.isInitialAnimation) {
			let e = d * l;
			if (r.enableSubMesh && e >= 1 && !r.subMeshUnfoldStarted && (r.subMeshUnfoldStarted = !0, r.subMeshUnfoldStartTime = a), r.enableSubMesh && r.subMeshUnfoldStarted && r.subMeshUnfoldProgress < 1 && !r.isPaused) {
				let e = (n = r.config.range) == null ? this._config.range : n, t = a - r.subMeshUnfoldStartTime;
				r.subMeshUnfoldProgress = Math.min(1, t * u / (l - 2 * e)), r.subMeshMaterial.uniforms.unfoldProgress.value = r.subMeshUnfoldProgress;
			}
			d < r.lastAnimationProgress && (r.isPathlineInitialAnimation = !1, (!r.enableSubMesh || r.subMeshUnfoldProgress >= 1) && (r.isInitialAnimation = !1));
		} else r.enableSubMesh && (r.subMeshMaterial.uniforms.unfoldProgress.value = 1);
		if (r.lastAnimationProgress = d, r.lastUpdateTime = a, r.isPathlineInitialAnimation && r.lines.forEach((e) => {
			e.material.uniforms.time.value = a, e.material.uniforms.animationProgress.value = d;
		}), r.isPathlineInitialAnimation) {
			let e = null, t = Infinity;
			if (r.lines.forEach((n) => {
				let r = n.geometry, a = r.attributes.instanceDistanceStart, o = r.attributes.instanceDistanceEnd, s = a.count;
				for (let c = 0; c < s; c++) {
					let s = a.getX(c) / n.material.uniforms.totalLength.value, l = o.getX(c) / n.material.uniforms.totalLength.value;
					if (d >= s && d <= l) {
						let n = (d - s) / (l - s), a = new i.Vector3().fromBufferAttribute(r.attributes.instanceStart, c), o = new i.Vector3().fromBufferAttribute(r.attributes.instanceEnd, c), u = new i.Vector3().lerpVectors(a, o, n), f = Math.abs(d - (s + l) / 2);
						f < t && (t = f, e = u);
					}
				}
			}), e) for (let t = 0; t < o; t++) {
				let n = r.particleInfos[t];
				!n.active && Math.random() < .05 && (n.active = !0, n.age = 0, n.life = 3 + Math.random() * 2, n.velocity.set((Math.random() - .5) * 1e-4, (Math.random() - .5) * 1e-4, (Math.random() - .5) * 1e-4), r.particlePositions[t * 3] = e.x, r.particlePositions[t * 3 + 1] = e.y, r.particlePositions[t * 3 + 2] = e.z, n.startPos.copy(e), n.alpha = 0);
			}
			for (let e = 0; e < o; e++) {
				let t = r.particleInfos[e];
				if (t.active) {
					t.age += .016;
					let n = r.particlePositions[e * 3] - t.startPos.x, i = r.particlePositions[e * 3 + 1] - t.startPos.y, a = r.particlePositions[e * 3 + 2] - t.startPos.z;
					(Math.sqrt(n * n + i * i + a * a) >= s || t.age >= t.life) && (t.active = !1, r.particlePositions[e * 3] = 9999, r.particlePositions[e * 3 + 1] = 9999, r.particlePositions[e * 3 + 2] = 9999, t.alpha = 0), t.velocity.x += (Math.random() - .5) * 1e-4, t.velocity.z += (Math.random() - .5) * 1e-4, t.velocity.y += 1e-4, t.velocity.multiplyScalar(.99), r.particlePositions[e * 3] += t.velocity.x, r.particlePositions[e * 3 + 1] += t.velocity.y, r.particlePositions[e * 3 + 2] += t.velocity.z;
					let o = t.age / t.life;
					o < .2 ? t.alpha = o / .2 : o > .8 ? t.alpha = (1 - o) / .2 : t.alpha = 1;
				}
			}
			r.particleGeometry.attributes.position.needsUpdate = !0, r.particleMaterial.opacity = .6;
		}
		r.enableSubMesh && (r.subMeshMaterial.uniforms.animationProgress.value = d), this.five.needsRender = !0;
	}
	startPathAnimation(t, n) {
		var r, i;
		let a = this.paths.get(t);
		if (!a) return console.warn(`DynamicPathLinePlugin: 路径 ${t} 不存在`), !1;
		if (a.animationId !== null) return !1;
		let o = (r = n == null ? void 0 : n.startPointIndex) == null ? 0 : r, s = (i = n == null ? void 0 : n.fromStart) == null ? !1 : i;
		if (!a.isPaused || s) {
			let e = 0, t = o;
			if (t > 0) {
				let n = a.config.points;
				t >= n.length && (console.warn(`DynamicPathLinePlugin: startPointIndex ${t} 超出范围,路径只有 ${n.length} 个点`), t = n.length - 1);
				for (let r = 0; r < t; r++) e += n[r].distanceTo(n[r + 1]);
			}
			a.startOffset = e, a.lines.forEach((t) => {
				t.material.uniforms.startOffset.value = e;
			}), a.enableSubMesh && (a.subMeshMaterial.uniforms.startOffset.value = e);
		}
		let c = performance.now() / 1e3;
		if (!s && a.isPaused && a.pausedProgress > 0) {
			let e = a.curve.getLength(), t = Math.max(.01, e - a.startOffset - a.endOffset), n = a.speed;
			a.cycleStartTime = c - a.pausedProgress * t / n, a.subMeshUnfoldStarted && a.subMeshUnfoldProgress < 1 && (a.subMeshUnfoldStartTime = c - (a.pausedTime - a.subMeshUnfoldStartTime)), a.isPaused = !1;
		} else a.cycleStartTime = c, a.isPaused = !1, a.pausedProgress = 0;
		return a.lastUpdateTime = c, this.highlightPath(t, !0), a.animationId = e.shared.add(() => {
			this.updatePathAnimation(t);
		}), !0;
	}
	stopPathAnimation(e, t = !1) {
		let n = this.paths.get(e);
		if (!n) return console.warn(`DynamicPathLinePlugin: 路径 ${e} 不存在`), !1;
		if (this.highlightPath(e, !1), n.animationId !== null) {
			if (t) {
				let e = performance.now() / 1e3, t = n.curve.getLength(), r = Math.max(.01, t - n.startOffset - n.endOffset), i = n.speed;
				n.pausedProgress = (e - n.cycleStartTime) * i / r % 1, n.pausedTime = e, n.isPaused = !0, n.subMeshUnfoldStarted && n.subMeshUnfoldProgress < 1 && (n.subMeshUnfoldStartTime = e - (e - n.subMeshUnfoldStartTime));
			} else n.isPaused = !1, n.pausedProgress = 0, n.pausedTime = 0;
			n.animationId(), n.animationId = null;
		}
		return !0;
	}
	_enable(e) {
		this.paths.size > 0 && this.state.playing && this.play();
	}
	_disable(e) {
		this.pause();
	}
	enable(e) {
		var t;
		if (this.state.enabled) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !0 }, n), this._enable({ userAction: n });
	}
	disable(e) {
		var t;
		if (this.state.enabled === !1) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !1 }, n), this._disable({ userAction: n });
	}
	show(e) {
		var t;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.paths.forEach((e) => {
			e.lines.forEach((e) => e.visible = !0), e.particles.visible = !0, e.subMesh.visible = !0;
		}), this.updateState({ visible: !0 }, n);
	}
	hide(e) {
		var t;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.paths.forEach((e) => {
			e.lines.forEach((e) => e.visible = !1), e.particles.visible = !1, e.subMesh.visible = !1;
		}), this.updateState({ visible: !1 }, n);
	}
	setState(e, t) {
		t == null || t.userAction, e.enabled !== void 0 && e.enabled !== this.state.enabled && (e.enabled ? this.enable(t) : this.disable(t)), e.visible !== void 0 && e.visible !== this.state.visible && (e.visible ? this.show(t) : this.hide(t));
	}
	play(e = !1) {
		this.paths.forEach((t, n) => {
			this.startPathAnimation(n, { fromStart: e });
		}), this.updateState({ playing: !0 }, !1), this.hooks.emit("animationStart");
	}
	pause() {
		this.paths.forEach((e, t) => {
			this.stopPathAnimation(t, !0);
		}), this.updateState({ playing: !1 }, !1), this.hooks.emit("animationStop");
	}
	reset() {
		this.paths.forEach((e, t) => {
			this.stopPathAnimation(t);
		}), this.paths.forEach((e) => {
			e.isInitialAnimation = !0, e.isPathlineInitialAnimation = !0, e.subMeshUnfoldProgress = 0, e.subMeshUnfoldStarted = !1, e.subMeshUnfoldStartTime = 0, e.lastAnimationProgress = 0, e.cycleStartTime = performance.now() / 1e3, e.lastUpdateTime = performance.now() / 1e3, e.startOffset = 0, e.endOffset = 0, e.isPaused = !1, e.pausedProgress = 0, e.pausedTime = 0, e.lines.forEach((e) => {
				e.visible = !0, e.material.uniforms.time.value = 0, e.material.uniforms.animationProgress.value = 0, e.material.uniforms.startOffset.value = 0, e.material.uniforms.endOffset.value = 0;
			}), e.particles.visible = !0;
			let t = this._config.particleCount;
			for (let n = 0; n < t; n++) {
				let t = e.particleInfos[n];
				t.active = !1, t.age = 0, t.alpha = 0, e.particlePositions[n * 3] = 9999, e.particlePositions[n * 3 + 1] = 9999, e.particlePositions[n * 3 + 2] = 9999;
			}
			e.particleGeometry.attributes.position.needsUpdate = !0, e.subMeshMaterial && (e.subMeshMaterial.uniforms.unfoldProgress.value = 0, e.subMeshMaterial.uniforms.animationProgress.value = 0, e.subMeshMaterial.uniforms.startOffset.value = 0, e.subMeshMaterial.uniforms.endOffset.value = 0);
		});
	}
	highlightPath(t, n) {
		let r = this.paths.get(t);
		if (!r) return;
		let i = r.lines, a = 0, o = e.shared.add((e, t) => {
			a = Math.min(1, a + t / 250), n ? (i.forEach((e) => {
				e.material.uniforms.opacity.value = .3 + a * .7;
			}), r.particleMaterial.opacity = .3 + a * .7, r.enableSubMesh && (r.subMeshMaterial.uniforms.globalOpacity.value = .3 + a * .7)) : (i.forEach((e) => {
				e.material.uniforms.opacity.value = 1 - a * .7;
			}), r.particleMaterial.opacity = .6 * (1 - a * .7), r.enableSubMesh && (r.subMeshMaterial.uniforms.globalOpacity.value = 1 - a * .7)), this.five.needsRender = !0, a === 1 && o();
		});
	}
	updateScreenProjection(e) {
		let t = (e) => {
			let t = this.projectPointsToScreen(e.config.points, this.five.camera), n = this.findNearestOffscreenPoint(t);
			n && (e.startOffset = n.distance);
			let r = this.findFarestOffscreenPoint(t);
			r && (e.endOffset = r.totalLength - r.distance), e.lines.forEach((t) => {
				t.material.uniforms.startOffset.value = e.startOffset, t.material.uniforms.endOffset.value = e.endOffset;
			}), e.subMeshMaterial.uniforms.startOffset.value = e.startOffset, e.subMeshMaterial.uniforms.endOffset.value = e.endOffset, e.cycleStartTime = performance.now() / 1e3, e.lastAnimationProgress = 0;
		};
		if (e) {
			let n = this.paths.get(e);
			n && t(n);
		} else this.paths.forEach((e) => {
			e.enabled && t(e);
		});
	}
	disposePathResources(e) {
		e.lines.forEach((e) => {
			this.five.scene.remove(e), e.geometry.dispose(), e.material.dispose();
		}), this.five.scene.remove(e.particles), e.particleGeometry.dispose(), e.particleMaterial.dispose(), this.five.scene.remove(e.subMesh), e.subMeshGeometry.dispose(), e.subMeshMaterial.dispose();
	}
	dispose() {
		this.pause(), this.clearAllPaths(), this.hooks.emit("dispose");
	}
}, Le = (e, t) => new Ie(e, t), Re = "#five-CSS3DPlugin {\n  position: absolute;\n  pointer-events: none;\n  user-select: none;\n  transform-origin: left top;\n}\n\n.five-CSS3DPlugin-X {\n  --timeout: 300ms;\n  transition: opacity ease-in-out var(--timeout);\n}\n\n.five-CSS3DPlugin-hidden {\n  opacity: 0;\n}\n\n#five-CSS3DPlugin .five-CSS3DPlugin-hidden * {\n  pointer-events: none;\n}";
//#endregion
//#region build/plugins/utils/uuid.js
function ze() {
	return ((1 + Math.random()) * parseInt("10000", 36) | 0).toString(36).substring(1);
}
function Be() {
	let e = ze() + ze().substr(0, 2) + Date.now().toString(36), t = e.length, n = "", r = Math.floor(Math.random() * Math.pow(2, t));
	for (let i = 0; i < t; i++) {
		let t = e[i];
		t >= "a" && t <= "z" && r >> i & 1 && (t = t.toUpperCase()), n += t;
	}
	return "u-" + n;
}
//#endregion
//#region build/plugins/CSS3DPlugin/Controller.js
var Ve = class extends x.Controller {
	updateState(e, t) {
		let n = this.state;
		this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
			state: this.state,
			prevState: n,
			userAction: t
		});
	}
	constructor(e, t) {
		super(e), this.scene = new i.Scene(), this.styleSheet = new CSSStyleSheet(), this.camera = new i.PerspectiveCamera(), this.cacheMap = /* @__PURE__ */ new WeakMap(), this.createCSS3DObject = ({ id: e = Be(), name: t, innerHTML: n, sprite: r, normal: a, position: o, scalar: s = .00216, visible: c = !0, timeout: l }) => {
			let u = document.createElement("div");
			u.className = "five-CSS3DPlugin-X", c || u.classList.add("five-CSS3DPlugin-hidden"), l && u.style.setProperty("--timeout", l + "ms"), u.innerHTML = n;
			let d = r ? new de(u) : new P(u);
			if (d.userData = {
				id: e,
				_visible: c,
				_timeout: l,
				get visible() {
					return this._visible;
				},
				set visible(e) {
					e ? u.classList.remove("five-CSS3DPlugin-hidden") : u.classList.add("five-CSS3DPlugin-hidden"), this._visible = e;
				},
				get timeout() {
					return this._timeout;
				},
				set timeout(e) {
					u.style.setProperty("--timeout", e + "ms"), this._timeout = e;
				}
			}, a) {
				let e = new i.Vector3(0, 0, 1), t = new i.Quaternion().setFromUnitVectors(e, a.clone().normalize());
				d.quaternion.copy(t);
			}
			return o && d.position.copy(o), s && d.scale.setScalar(s), t && (d.name = t), d;
		}, this.render = () => {
			this.camera.fov = this.five.camera.fov, this.camera.aspect = this.five.camera.aspect, this.camera.position.copy(this.five.camera.position), this.camera.rotation.copy(this.five.camera.rotation), this.camera.updateProjectionMatrix(), this.renderer.render(this.scene, this.camera);
		}, this.forceRender = () => {
			this.renderer.markDirty(), this.render();
		}, this._addEventListener = () => {
			this.five.on("render.prepare", this.render), this.appendToFiveContainer();
		}, this._removeEventListener = () => {
			var e;
			this.five.off("render.prepare", this.render), (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = void 0;
		}, this.dispose = () => {
			this.removeAll(), this._disable({ userAction: !1 });
		}, this.five = e, this.renderer = new L(), this.renderer.domElement.id = "five-CSS3DPlugin", this.styleSheet.replaceSync(Re), /Chrome/.test(navigator.userAgent) && !/Edge|Edg|OPR/.test(navigator.userAgent) && this.styleSheet.insertRule("#five-CSS3DPlugin * { transform-style: preserve-3d; }"), document && document.adoptedStyleSheets.push(this.styleSheet);
		let n = {
			enabled: !0,
			visible: !0
		};
		this.state = Object.assign(n, t == null ? void 0 : t.initialState), this.state.enabled ? this._enable({ userAction: !1 }) : this.styleSheet.disabled = !0;
	}
	load(e) {
		return S(this, void 0, void 0, function* () {});
	}
	appendToFiveContainer() {
		var e;
		if (!this.five.renderer) return;
		let t = this.five.getElement();
		if (!(t != null && t.parentElement)) return;
		let { x: n, y: r } = this.five.renderer.getSize(new i.Vector2());
		t.parentElement.appendChild(this.renderer.domElement), this.renderer.setSize(n * 2, r * 2), this.renderer.domElement.style.width = n * 2 + "px", this.renderer.domElement.style.height = r * 2 + "px", this.renderer.domElement.style.transform = "scale(0.5)", (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = new ResizeObserver(() => {
			var e;
			if (!this.five.renderer) return;
			let t = (e = this.five.getElement()) == null ? void 0 : e.getBoundingClientRect();
			if (!t) return;
			let { x: n, y: r, width: i, height: a } = t;
			this.renderer.setSize(i * 2, a * 2), this.renderer.domElement.style.left = n + "px", this.renderer.domElement.style.top = r + "px", this.renderer.domElement.style.width = i * 2 + "px", this.renderer.domElement.style.height = a * 2 + "px", this.render();
		}), this.resizeObserver.observe(t);
	}
	add(...e) {
		this.scene.add(...e), this.renderer.updateSpriteSet(this.scene), this.forceRender();
	}
	remove(e) {
		this.scene.remove(e), e.traverse((e) => {
			e instanceof P && e.element.remove();
		}), this.renderer.updateSpriteSet(this.scene), this.forceRender();
	}
	removeAll() {
		this.scene.remove(...this.scene.children), this.renderer.updateSpriteSet(this.scene), this.forceRender();
	}
	fadeInObjects(...e) {
		for (let t of e) t.userData.visible = !0;
		this.render();
	}
	fadeOutObjects(...e) {
		for (let t of e) t.userData.visible = !1;
		this.render();
	}
	_enable(e) {
		this.styleSheet.disabled = !1, this.updateState({ enabled: !0 }, e.userAction), this._addEventListener(), this.render();
	}
	_disable(e) {
		this.styleSheet.disabled = !0, this.updateState({ enabled: !1 }, e.userAction), this._removeEventListener();
	}
	enable(e) {
		var t;
		if (this.state.enabled) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this._enable({ userAction: n });
	}
	disable(e) {
		var t;
		if (this.state.enabled === !1) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this._disable({ userAction: n });
	}
	show(e) {
		this.renderer.domElement.style.display = "block", this.updateState({ visible: !0 }, !0), this.forceRender();
	}
	hide(e) {
		this.renderer.domElement.style.display = "none", this.updateState({ visible: !1 }, !0);
	}
}, He = (e, t) => new Ve(e, t), Ue = class extends f {
	constructor(e = document.createElement("div")) {
		super(), this.isCSS2DObject = !0, this.element = e, this.element.style.position = "absolute", this.element.style.userSelect = "none", this.element.setAttribute("draggable", !1), this.center = new g(.5, .5), this.addEventListener("removed", function() {
			this.traverse(function(e) {
				e.element && e.element instanceof Element && e.element.parentNode !== null && e.element.remove();
			});
		});
	}
	copy(e, t) {
		return super.copy(e, t), this.element = e.element.cloneNode(!0), this.center = e.center.clone(), this;
	}
}, We = new _(), Ge = new d(), Ke = new d(), qe = new _(), Je = new _(), Ye = class {
	constructor(e = {}) {
		let t = this, n, r, i, a, o = { objects: /* @__PURE__ */ new WeakMap() }, s = e.element === void 0 ? document.createElement("div") : e.element;
		s.style.overflow = "hidden", this.domElement = s, this.sortObjects = !0, this.getSize = function() {
			return {
				width: n,
				height: r
			};
		}, this.render = function(e, n) {
			e.autoUpdate === !0 && e.updateMatrixWorld(), n.parent === null && n.updateMatrixWorld(), Ge.copy(n.matrixWorldInverse), Ke.multiplyMatrices(n.projectionMatrix, Ge), l(e, e, n), t.sortObjects && f(e);
		}, this.setSize = function(e, t) {
			n = e, r = t, i = n / 2, a = r / 2, s.style.width = e + "px", s.style.height = t + "px";
		};
		function c(e) {
			e.isCSS2DObject && (e.element.style.display = "none");
			for (let t = 0, n = e.children.length; t < n; t++) c(e.children[t]);
		}
		function l(e, n, r) {
			if (e.visible === !1) {
				c(e);
				return;
			}
			if (e.isCSS2DObject) {
				We.setFromMatrixPosition(e.matrixWorld), We.applyMatrix4(Ke);
				let c = We.z >= -1 && We.z <= 1 && e.layers.test(r.layers) === !0, l = e.element;
				l.style.display = c === !0 ? "" : "none", c === !0 && (e.onBeforeRender(t, n, r), l.style.transform = "translate(" + -100 * e.center.x + "%," + -100 * e.center.y + "%)translate(" + (We.x * i + i) + "px," + (-We.y * a + a) + "px)", l.parentNode !== s && s.appendChild(l), e.onAfterRender(t, n, r));
				let d = { distanceToCameraSquared: u(r, e) };
				o.objects.set(e, d);
			}
			for (let t = 0, i = e.children.length; t < i; t++) l(e.children[t], n, r);
		}
		function u(e, t) {
			return qe.setFromMatrixPosition(e.matrixWorld), Je.setFromMatrixPosition(t.matrixWorld), qe.distanceToSquared(Je);
		}
		function d(e) {
			let t = [];
			return e.traverseVisible(function(e) {
				e.isCSS2DObject && t.push(e);
			}), t;
		}
		function f(e) {
			let t = d(e).sort(function(e, t) {
				return e.renderOrder === t.renderOrder ? o.objects.get(e).distanceToCameraSquared - o.objects.get(t).distanceToCameraSquared : t.renderOrder - e.renderOrder;
			}), n = t.length;
			for (let e = 0, r = t.length; e < r; e++) t[e].element.style.zIndex = n - e;
		}
	}
}, Xe = "#five-CSS2DPlugin {\n  position: absolute;\n  pointer-events: none;\n  user-select: none;\n  top: 0;\n  left: 0;\n}\n\n.five-CSS2DPlugin-X {\n  --timeout: 300ms;\n  transition: opacity ease-in-out var(--timeout);\n}\n\n.five-CSS2DPlugin-hidden {\n  opacity: 0;\n}\n\n#five-CSS2DPlugin .five-CSS2DPlugin-hidden * {\n  pointer-events: none;\n}\n", Ze = class extends x.Controller {
	updateState(e, t) {
		let n = this.state;
		this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
			state: this.state,
			prevState: n,
			userAction: t
		});
	}
	constructor(e, t) {
		super(e), this.scene = new i.Scene(), this.styleSheet = new CSSStyleSheet(), this.camera = new i.PerspectiveCamera(), this.createCSS2DObject = ({ id: e = Be(), name: t, innerHTML: n, center: r, position: i, visible: a = !0, timeout: o }) => {
			let s = document.createElement("div");
			s.className = "five-CSS2DPlugin-X", a || s.classList.add("five-CSS2DPlugin-hidden"), o && s.style.setProperty("--timeout", o + "ms"), s.innerHTML = n;
			let c = new Ue(s);
			return c.userData = {
				id: e,
				_visible: a,
				_timeout: o,
				get visible() {
					return this._visible;
				},
				set visible(e) {
					e ? s.classList.remove("five-CSS2DPlugin-hidden") : s.classList.add("five-CSS2DPlugin-hidden"), this._visible = e;
				},
				get timeout() {
					return this._timeout;
				},
				set timeout(e) {
					s.style.setProperty("--timeout", e + "ms"), this._timeout = e;
				}
			}, r && c.center.copy(r), i && c.position.copy(i), t && (c.name = t), c;
		}, this.render = () => {
			this.camera.fov = this.five.camera.fov, this.camera.aspect = this.five.camera.aspect, this.camera.position.copy(this.five.camera.position), this.camera.rotation.copy(this.five.camera.rotation), this.camera.updateProjectionMatrix(), this.renderer.render(this.scene, this.camera);
		}, this._addEventListener = () => {
			this.five.on("render.prepare", this.render), this.appendToFiveContainer();
		}, this._removeEventListener = () => {
			var e;
			this.five.off("render.prepare", this.render), (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = void 0;
		}, this.dispose = () => {
			this.removeAll(), this._disable({ userAction: !1 });
		}, this.five = e, this.renderer = new Ye(), this.renderer.domElement.id = "five-CSS2DPlugin", this.styleSheet.replaceSync(Xe), document && document.adoptedStyleSheets.push(this.styleSheet);
		let n = {
			enabled: !0,
			visible: !0
		};
		this.state = Object.assign(n, t == null ? void 0 : t.initialState), this.state.enabled ? this._enable({ userAction: !1 }) : this.styleSheet.disabled = !0;
	}
	load(e) {
		return S(this, void 0, void 0, function* () {});
	}
	appendToFiveContainer() {
		var e;
		if (!this.five.renderer) return;
		let t = this.five.getElement();
		if (!(t != null && t.parentElement)) return;
		let { x: n, y: r } = this.five.renderer.getSize(new i.Vector2());
		t.parentElement.appendChild(this.renderer.domElement), this.renderer.setSize(n, r), (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = new ResizeObserver(() => {
			var e;
			if (!this.five.renderer) return;
			let t = (e = this.five.getElement()) == null ? void 0 : e.getBoundingClientRect();
			if (!t) return;
			let { x: n, y: r, width: i, height: a } = t;
			this.renderer.setSize(i, a), this.renderer.domElement.style.left = n + "px", this.renderer.domElement.style.top = r + "px", this.render();
		}), this.resizeObserver.observe(t);
	}
	add(...e) {
		this.scene.add(...e), this.render();
	}
	remove(e) {
		this.scene.remove(e), e.traverse((e) => {
			e instanceof Ue && e.element.remove();
		}), this.render();
	}
	removeAll() {
		this.scene.remove(...this.scene.children), this.render();
	}
	fadeInObjects(...e) {
		for (let t of e) t.userData.visible = !0;
		this.render();
	}
	fadeOutObjects(...e) {
		for (let t of e) t.userData.visible = !1;
		this.render();
	}
	_enable(e) {
		this.styleSheet.disabled = !1, this.updateState({ enabled: !0 }, e.userAction), this._addEventListener(), this.render();
	}
	_disable(e) {
		this.styleSheet.disabled = !0, this.updateState({ enabled: !1 }, e.userAction), this._removeEventListener();
	}
	enable(e) {
		var t;
		if (this.state.enabled) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this._enable({ userAction: n });
	}
	disable(e) {
		var t;
		if (this.state.enabled === !1) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this._disable({ userAction: n });
	}
	show(e) {
		this.renderer.domElement.style.display = "block", this.updateState({ visible: !0 }, !0), this.render();
	}
	hide(e) {
		this.renderer.domElement.style.display = "none", this.updateState({ visible: !1 }, !0);
	}
}, Qe = (e, t) => new Ze(e, t);
//#endregion
//#region build/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.js
function $e(e, t, n) {
	if (n) {
		let r = new i.Vector3().subVectors(e.position, n).applyQuaternion(e.quaternion.clone().inverse()).applyQuaternion(t).add(n);
		e.position.copy(r);
	}
	e.quaternion.copy(t);
}
//#endregion
//#region build/five/utils/isNil.js
function et(e) {
	return e == null;
}
//#endregion
//#region build/plugins/Object3DHelperPlugin/Helper/BaseHelper.js
var W = class extends i.Object3D {
	removeChildren() {
		for (; this.children.length > 0;) this.remove(this.children[0]);
		return this;
	}
	add(...e) {
		let t = e.filter(Boolean);
		return t.length === 0 ? this : super.add(...t);
	}
	addIfNotExists(...e) {
		return e.forEach((e) => {
			this.children.includes(e) || this.add(e);
		}), this;
	}
	remove(...e) {
		if (e.length === 0) return this;
		let t = e.filter(Boolean);
		return super.remove(...t);
	}
	removeFromParent() {
		let e = this.parent;
		return e !== null && e.remove(this), this;
	}
	get helperObject() {
		return this;
	}
	constructor(e, t) {
		var n, r;
		super(), this.originObject3D = e, this.onRender = (n = t == null ? void 0 : t.onRender) == null ? (() => {}) : n, this.positionFrom = (r = t == null ? void 0 : t.positionFrom) == null ? "objectPosition" : r;
	}
	render() {
		this.onRender();
	}
	enable() {
		this.parent && (this.parent.children.includes(this) || this.parent.add(this));
	}
	disable() {
		this.removeFromParent();
	}
	show() {
		this.visible = !0, this.render();
	}
	hide() {
		this.visible = !1, this.render();
	}
	raycasterIntersectObject(e, t = []) {
		return e.intersectObject(this, !0, t);
	}
	initialPosition(e) {
		this.positionFrom === "objectPosition" ? this.position.copy(this.originObject3D.position) : this.positionFrom === "boundingBox" || this.positionFrom === "boundingSphere" ? this.position.copy(new i.Box3().expandByObject(this.originObject3D).getCenter(new i.Vector3())) : this.positionFrom instanceof _ ? this.position.copy(this.positionFrom) : this.positionFrom instanceof Function && this.position.copy(this.positionFrom(this.originObject3D)), e && this.position.add(e);
	}
	setScaleByCamera(e) {}
	initQuaternion(e) {
		if (this.quaternion.set(0, 0, 0, 1), e && (e.xAxis || e.yAxis || e.zAxis)) {
			let t = e.xAxis instanceof Function ? e.xAxis() : e.xAxis, n = e.yAxis instanceof Function ? e.yAxis() : e.yAxis, r = e.zAxis instanceof Function ? e.zAxis() : e.zAxis, a = t == null ? void 0 : t.clone(), o = n == null ? void 0 : n.clone(), s = r == null ? void 0 : r.clone();
			if (a && !o && !o) {
				let e = new i.Quaternion().setFromUnitVectors(new i.Vector3(1, 0, 0), a.normalize());
				this.applyQuaternion(e);
			}
			if (o && !a && !s) {
				let e = new i.Quaternion().setFromUnitVectors(new i.Vector3(0, 1, 0), o.normalize());
				this.applyQuaternion(e);
			}
			if (s && !a && !o) {
				let e = new i.Quaternion().setFromUnitVectors(new i.Vector3(0, 0, 1), s.normalize());
				this.applyQuaternion(e);
			}
			if ([
				a,
				o,
				s
			].filter((e) => !et(e)).length >= 2) {
				a || (a = new i.Vector3().crossVectors(o, s).normalize()), o || (o = new i.Vector3().crossVectors(a, s).normalize()), s || (s = new i.Vector3().crossVectors(a, o).normalize()), a.applyQuaternion(this.quaternion), o.applyQuaternion(this.quaternion), s.applyQuaternion(this.quaternion);
				let e = new i.Matrix4().makeBasis(a, o, s), t = new i.Quaternion().setFromRotationMatrix(e);
				this.quaternion.copy(t);
			}
		}
	}
	applyHelperScaleMatrix4(e, t) {
		this.scale.applyMatrix4(e);
	}
	setHelperQuaternion(e, t) {
		this.initQuaternion(), t ? $e(this, this.quaternion.clone().premultiply(e), t) : this.quaternion.premultiply(e);
	}
	applyHelperQuaternion(e, t) {
		if (t) {
			let n = new _().subVectors(this.position, t).applyQuaternion(e).add(t);
			this.position.copy(n);
		}
		this.applyQuaternion(e);
	}
	dispose() {
		this.removeFromParent();
	}
}, tt = class extends W {}, nt = class extends W {}, rt = class extends W {}, it = class extends i.Group {
	constructor(e) {
		super(), this.direction = e || "x";
	}
};
i.Line;
var at = class extends i.Mesh {
	constructor(e, t, n) {
		super(e, t), this.direction = n || "x";
	}
}, ot = {
	X: 16730698,
	Y: 54927,
	Z: 3368703
}, G = class {
	static get X() {
		return new i.Color(ot.X).convertSRGBToLinear().clone();
	}
	static get Y() {
		return new i.Color(ot.Y).convertSRGBToLinear().clone();
	}
	static get Z() {
		return new i.Color(ot.Z).convertSRGBToLinear().clone();
	}
}, K = {
	ROTATE_HELPER: 9992,
	MOVE_HELPER: 9993,
	SCALE_HELPER_LINE: 9994,
	SCALE_HELPER_SPHERE: 9995,
	MOVE_HELPER_ARROW: 10001,
	MOVE_HELPER_CENTER: 10002,
	DRAG_GUIDE_LINE: 10003,
	DRAG_FACE_PATCH: 10004
}, q = class extends it {
	constructor(e) {
		var t;
		super(e.direction), this.lineHeight = .5, this.arrowHeight = .1, this.name = "ArrowGroup";
		let n = new i.Color((t = e.color) == null ? 16214315 : t), r = () => new i.MeshBasicMaterial({
			color: n,
			transparent: !0,
			opacity: 1,
			depthTest: !1,
			depthWrite: !1
		}), a = new i.ConeGeometry(.04, this.arrowHeight, 32);
		this.arrow = new at(a, r(), e.direction), this.arrow.name = `arrow-${e.direction}`, this.arrow.renderOrder = K.MOVE_HELPER_ARROW;
		let o = new i.ConeGeometry(.04, this.arrowHeight, 32);
		this.arrowNeg = new at(o, r(), e.direction), this.arrowNeg.name = `arrow-neg-${e.direction}`, this.arrowNeg.renderOrder = K.MOVE_HELPER_ARROW;
		let s = .004, c = new i.CylinderGeometry(s, s, this.lineHeight, 32);
		this.line = new at(c, r(), e.direction), this.line.name = `line-${e.direction}`, this.line.renderOrder = K.MOVE_HELPER_ARROW, this.formatGeometries(), this.add(this.arrow, this.arrowNeg, this.line);
	}
	formatGeometries() {
		let e = this.lineHeight, t = this.arrowHeight;
		this.arrow.geometry.translate(0, e + t / 2, 0), this.arrowNeg.geometry.rotateZ(Math.PI), this.arrowNeg.geometry.translate(0, -(e + t / 2), 0), this.line.geometry.translate(0, e / 2, 0), this.direction === "x" ? (this.arrow.geometry.rotateX(Math.PI / 2), this.arrow.geometry.rotateY(Math.PI / 2), this.arrowNeg.geometry.rotateX(Math.PI / 2), this.arrowNeg.geometry.rotateY(Math.PI / 2), this.line.geometry.rotateX(Math.PI / 2), this.line.geometry.rotateY(Math.PI / 2)) : this.direction === "z" && (this.arrow.geometry.rotateX(Math.PI / 2), this.arrowNeg.geometry.rotateX(Math.PI / 2), this.line.geometry.rotateX(Math.PI / 2));
	}
}, J = class extends it {
	constructor(e) {
		var t, n;
		super("plane"), this.name = "CenterHandle", this.faceNormals = [
			new i.Vector3(1, 0, 0),
			new i.Vector3(-1, 0, 0),
			new i.Vector3(0, 1, 0),
			new i.Vector3(0, -1, 0),
			new i.Vector3(0, 0, 1),
			new i.Vector3(0, 0, -1)
		], this.baseColor = new i.Color((t = e == null ? void 0 : e.color) == null ? 16419862 : t);
		let r = (n = e == null ? void 0 : e.size) == null ? .05 : n, a = new i.Color(16755008).convertSRGBToLinear();
		this.faceMaterials = Array.from({ length: 6 }, () => new i.MeshBasicMaterial({
			color: a,
			transparent: !0,
			opacity: 1,
			depthTest: !1,
			depthWrite: !1,
			side: i.FrontSide
		}));
		let o = new i.BoxGeometry(r, r, r), s = new i.Mesh(o, this.faceMaterials);
		s.direction = "plane", s.renderOrder = K.MOVE_HELPER_CENTER, s.name = "center-plane-handle", this.cube = s, this.add(this.cube);
	}
	update(e) {
		let t = new i.Vector3().subVectors(e.position, this.cube.getWorldPosition(new i.Vector3())).normalize(), n = this.cube.getWorldQuaternion(new i.Quaternion()), r = this.faceNormals.map((e, r) => {
			let i = e.clone().applyQuaternion(n).dot(t);
			return {
				index: r,
				angle: Math.acos(Math.abs(i))
			};
		});
		r.sort((e, t) => e.angle - t.angle);
		let a = [
			new i.Color(16755008).convertSRGBToLinear(),
			new i.Color(16419862).convertSRGBToLinear(),
			new i.Color(13921032).convertSRGBToLinear()
		];
		r.forEach((e, t) => {
			let n = Math.floor(t / 2);
			this.faceMaterials[e.index].color.copy(a[n]);
		});
	}
}, Y = class extends it {
	constructor(e) {
		var t, n, r;
		super(e.direction), this.name = "PlaneHandle";
		let a = (t = e.size) == null ? .12 : t, o = (n = e.offset) == null ? .12 : n, s = new i.Color((r = e.color) == null ? 16776960 : r), c = new i.BoxGeometry(a, a, .005), l = new i.MeshBasicMaterial({
			color: s,
			transparent: !0,
			opacity: .4,
			depthTest: !1,
			depthWrite: !1,
			side: i.DoubleSide
		});
		switch (this.handle = new i.Mesh(c, l), this.handle.direction = e.direction, this.handle.renderOrder = K.MOVE_HELPER_ARROW, this.handle.name = `plane-handle-${e.direction}`, e.direction) {
			case "xy":
				this.handle.position.set(o, o, 0);
				break;
			case "xz":
				this.handle.position.set(o, 0, o), this.handle.rotation.x = -Math.PI / 2;
				break;
			case "yz":
				this.handle.position.set(0, o, o), this.handle.rotation.y = Math.PI / 2;
				break;
		}
		this.add(this.handle);
	}
};
//#endregion
//#region build/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.js
function st(e, t, n) {
	let r = e.position.distanceTo(t), i = e.fov, a = e.distance || 3, o = r / 3, s = i / 90, c = a / 3, l = o * s * c, u = (n == null ? void 0 : n.min) || .6, d = n == null ? void 0 : n.max;
	return u && l < u ? u : d && l > d ? d : l;
}
//#endregion
//#region build/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.js
function X(e) {
	let { latitude: t, longitude: n } = e, r = new i.Vector3();
	return Z - t < .03 ? r.set(0, 1, 0) : ct(0, n) ? r.set(0, 0, 1) : ct(Math.PI, n) ? r.set(0, 0, -1) : ct(Z, n) ? r.set(1, 0, 0) : r.set(-1, 0, 0), r;
}
var Z = Number((Math.PI / 2).toFixed(5));
function ct(e, t) {
	return typeof e != "number" || typeof t != "number" ? !1 : Math.abs(e - t) < .001;
}
//#endregion
//#region build/plugins/Object3DHelperPlugin/utils/tipsDom.js
function lt(e, t) {
	return ut(document.createElement(t == null ? "div" : t), e);
}
function ut(e, t) {
	if (!t) return e;
	for (let n in t) n && t[n] && (e.style[n] = t[n]);
	return e;
}
function Q(e) {
	let t = lt(Object.assign({
		position: "absolute",
		display: "block",
		borderRadius: "4px",
		paddingTop: "1px",
		paddingBottom: "1px",
		paddingLeft: "4px",
		paddingRight: "4px",
		pointerEvents: "none",
		userSelect: "none",
		zIndex: "99999",
		backgroundColor: "rgba(0,0,0,0.7)",
		fontSize: "12px",
		color: "#fff",
		letterSpacing: "0",
		lineHeight: "18px"
	}, e)), n = () => {
		t.style.display !== "block" && t.style.top && t.style.left && (t.style.display = "block");
	};
	return {
		element: t,
		show: n,
		hide: () => {
			t.style.display = "none", t.style.top = "", t.style.left = "";
		},
		setLeftTop: (e, r) => {
			t.style.left = e, t.style.top = r, n();
		}
	};
}
//#endregion
//#region build/plugins/Object3DHelperPlugin/Helper/MoveHelper.js
var dt = class extends tt {
	constructor(e, t) {
		super(e, t), this.name = "MoveHelper", (t == null ? void 0 : t.xArrowEnable) !== !1 && (this.xArrow = new q({
			direction: "x",
			color: G.X
		})), (t == null ? void 0 : t.yArrowEnable) !== !1 && (this.yArrow = new q({
			direction: "y",
			color: G.Y
		})), (t == null ? void 0 : t.zArrowEnable) !== !1 && (this.zArrow = new q({
			direction: "z",
			color: G.Z
		})), (t == null ? void 0 : t.centerHandleEnable) !== !1 && (this.centerHandle = new J()), (t == null ? void 0 : t.xyPlaneEnable) !== !1 && (this.xyPlane = new Y({
			direction: "xy",
			color: G.Z
		})), (t == null ? void 0 : t.xzPlaneEnable) !== !1 && (this.xzPlane = new Y({
			direction: "xz",
			color: G.Y
		})), (t == null ? void 0 : t.yzPlaneEnable) !== !1 && (this.yzPlane = new Y({
			direction: "yz",
			color: G.X
		})), t != null && t.container && (t == null ? void 0 : t.moveTipsEnable) !== !1 && (this.container = t.container, this.moveTips = Q({ display: "none" }), this.container.appendChild(this.moveTips.element)), this.add(...[
			this.xArrow,
			this.yArrow,
			this.zArrow,
			this.centerHandle,
			this.xyPlane,
			this.xzPlane,
			this.yzPlane
		].filter(Boolean));
	}
	update(e) {
		if (this.xArrow && (this.xArrow.visible = !0), this.yArrow && (this.yArrow.visible = !0), this.zArrow && (this.zArrow.visible = !0), this.centerHandle && this.centerHandle.update(e), e.type === "OrthographicCamera") {
			let t = new i.Vector3(1, 0, 0).applyQuaternion(this.quaternion), n = new i.Vector3(0, 1, 0).applyQuaternion(this.quaternion), r = new i.Vector3(0, 0, 1).applyQuaternion(this.quaternion), a = e.pose, o = X(a), s = .0872665;
			Math.abs(t.angleTo(o) - 0) < s || Math.abs(t.angleTo(o) - Math.PI) < s ? this.xArrow && (this.xArrow.visible = !1) : Math.abs(n.angleTo(o) - 0) < s || Math.abs(n.angleTo(o) - Math.PI) < s ? this.yArrow && (this.yArrow.visible = !1) : (Math.abs(r.angleTo(o) - 0) < s || Math.abs(r.angleTo(o) - Math.PI) < s) && this.zArrow && (this.zArrow.visible = !1);
		}
	}
	show() {
		var e;
		super.show(), this.xArrow && this.add(this.xArrow), this.yArrow && this.add(this.yArrow), this.zArrow && this.add(this.zArrow), this.centerHandle && this.add(this.centerHandle), this.xyPlane && this.add(this.xyPlane), this.xzPlane && this.add(this.xzPlane), this.yzPlane && this.add(this.yzPlane), (e = this.moveTips) == null || e.hide();
	}
	setScaleByCamera(e) {
		this.scale.setScalar(st(e, this.position));
	}
	showDraggingHelper(e) {
		this.xArrow && (e.includes("x") ? this.add(this.xArrow) : this.remove(this.xArrow)), this.yArrow && (e.includes("y") ? this.add(this.yArrow) : this.remove(this.yArrow)), this.zArrow && (e.includes("z") ? this.add(this.zArrow) : this.remove(this.zArrow)), this.centerHandle && (e.includes("plane") ? this.add(this.centerHandle) : this.remove(this.centerHandle)), this.xyPlane && (e.includes("xy") ? this.add(this.xyPlane) : this.remove(this.xyPlane)), this.xzPlane && (e.includes("xz") ? this.add(this.xzPlane) : this.remove(this.xzPlane)), this.yzPlane && (e.includes("yz") ? this.add(this.yzPlane) : this.remove(this.yzPlane));
	}
	dispose() {
		var e, t;
		this.remove(...[
			this.xArrow,
			this.yArrow,
			this.zArrow,
			this.centerHandle,
			this.xyPlane,
			this.xzPlane,
			this.yzPlane
		].filter(Boolean)), (t = (e = this.moveTips) == null ? void 0 : e.element) == null || t.remove(), super.dispose();
	}
}, ft = class extends rt {
	constructor(e, t) {
		super(e, t), this.name = "RotateHelper", this.children = [], (t == null ? void 0 : t.yzCircleEnable) !== !1 && (this.xCircle = new pt({
			direction: "x",
			color: G.X
		})), (t == null ? void 0 : t.xzCircleEnable) !== !1 && (this.yCircle = new pt({
			direction: "y",
			color: G.Y
		})), (t == null ? void 0 : t.xyCircleEnable) !== !1 && (this.zCircle = new pt({
			direction: "z",
			color: G.Z
		})), t != null && t.container && (t == null ? void 0 : t.angleTipsEnable) !== !1 && (this.container = t == null ? void 0 : t.container, this.angleTips = Q({ display: "none" }), this.container.appendChild(this.angleTips.element)), this.add(...[
			this.xCircle,
			this.yCircle,
			this.zCircle
		].filter(Boolean)), this.show();
	}
	hide() {
		this.children.forEach((e) => e.hide());
	}
	show() {
		var e;
		this.children.forEach((e) => e.showCircle()), (e = this.angleTips) == null || e.hide();
	}
	setScaleByCamera(e) {
		this.scale.setScalar(st(e, this.position));
	}
	update(e) {
		if (e.type === "OrthographicCamera") return;
		let t = this.helperObject.position.clone().sub(e.position).normalize(), n = new i.Vector3(1, 0, 0).applyQuaternion(this.quaternion), r = new i.Vector3(0, 1, 0).applyQuaternion(this.quaternion), a = new i.Vector3(0, 0, 1).applyQuaternion(this.quaternion), o = t.angleTo(n), s = t.angleTo(r), c = t.angleTo(a), l = Math.PI / 2, u = s >= l, d = c >= l, f = o >= l;
		if (this.xCircle) {
			let e = this.xCircle.circle.gapAngle;
			u && d ? this.xCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, e, Math.PI / 2 - e * 2) : u && !d ? this.xCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, Math.PI / 2 + e, Math.PI / 2 - e * 2) : !u && d ? this.xCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, Math.PI / 2 * 3 + e, Math.PI / 2 - e * 2) : !u && !d && (this.xCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, Math.PI + e, Math.PI / 2 - e * 2)), this.xCircle.angleSector && (this.xCircle.angleSector.offsetAngle = (e) => e, u && d || u && !d ? this.xCircle.angleSector.baseAxes = new i.Vector3(0, 0, 1) : !u && d ? (this.xCircle.angleSector.baseAxes = new i.Vector3(0, -1, 0), this.xCircle.angleSector.offsetAngle = (e) => e - Math.PI / 2) : !u && !d && (this.xCircle.angleSector.baseAxes = new i.Vector3(0, 0, -1), this.xCircle.angleSector.offsetAngle = (e) => e - Math.PI));
		}
		if (this.yCircle) {
			this.yCircle.angleSector.offsetAngle = (e) => e;
			let e = this.yCircle.circle.gapAngle;
			f && d ? this.yCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, e, Math.PI / 2 - e * 2) : f && !d ? this.yCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, Math.PI / 2 * 3 + e, Math.PI / 2 - e * 2) : !f && d ? this.yCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, Math.PI / 2 + e, Math.PI / 2 - e * 2) : !f && !d && (this.yCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, Math.PI + e, Math.PI / 2 - e * 2)), f && d ? this.yCircle.angleSector.baseAxes = new i.Vector3(1, 0, 0) : f && !d ? (this.yCircle.angleSector.baseAxes = new i.Vector3(0, 0, -1), this.yCircle.angleSector.offsetAngle = (e) => e - Math.PI / 2) : !f && d ? (this.yCircle.angleSector.baseAxes = new i.Vector3(0, 0, 1), this.yCircle.angleSector.offsetAngle = (e) => e + Math.PI / 2) : !f && !d && (this.yCircle.angleSector.baseAxes = new i.Vector3(-1, 0, 0), this.yCircle.angleSector.offsetAngle = (e) => e + Math.PI);
		}
		if (this.zCircle) {
			this.zCircle.angleSector.offsetAngle = (e) => e;
			let e = this.zCircle.circle.gapAngle;
			f && u ? this.zCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, e, Math.PI / 2 - e * 2) : f && !u ? this.zCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, Math.PI / 2 * 3 + e, Math.PI / 2 - e * 2) : !f && u ? this.zCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, Math.PI / 2 + e, Math.PI / 2 - e * 2) : !f && !u && (this.zCircle.circle.geometry = new i.RingGeometry(.3, .35, 20, 8, Math.PI + e, Math.PI / 2 - e * 2)), this.zCircle.angleSector && (f && u ? this.zCircle.angleSector.baseAxes = new i.Vector3(1, 0, 0) : f && !u ? (this.zCircle.angleSector.baseAxes = new i.Vector3(0, -1, 0), this.zCircle.angleSector.offsetAngle = (e) => e - Math.PI / 2) : !f && u ? (this.zCircle.angleSector.baseAxes = new i.Vector3(0, 1, 0), this.zCircle.angleSector.offsetAngle = (e) => e + Math.PI / 2) : !f && !u && (this.zCircle.angleSector.baseAxes = new i.Vector3(-1, 0, 0), this.zCircle.angleSector.offsetAngle = (e) => e + Math.PI));
		}
	}
	showDraggingHelper(e) {
		var t;
		this.hide(), this.children.filter((t) => e.includes(t.direction)).forEach((e) => e.showRing()), (t = this.angleTips) == null || t.show();
	}
	dispose() {
		var e, t;
		this.removeFromParent(), (t = (e = this.angleTips) == null ? void 0 : e.element) == null || t.remove();
	}
}, pt = class extends i.Group {
	constructor(e) {
		super(), this.direction = e.direction, this.circle = new mt(e), this.ring = new ht(e), this.angleSector = new gt(e), this.add(this.circle, this.ring, this.angleSector), this.direction === "y" ? this.rotation.x = Math.PI / 2 : this.direction === "x" && (this.rotation.y = -Math.PI / 2);
	}
	showCircle() {
		this.add(this.circle), this.remove(this.ring, this.angleSector);
	}
	showRing() {
		this.add(this.ring, this.angleSector), this.remove(this.circle);
	}
	hide() {
		this.remove(this.ring, this.angleSector, this.circle);
	}
}, mt = class extends i.Mesh {
	constructor(e) {
		var t;
		super(), this.gapAngle = .02, this.geometry = new i.RingGeometry(.3, .35, 20, 8, this.gapAngle, Math.PI / 2 - this.gapAngle * 2), this.material = new i.MeshBasicMaterial({
			opacity: .6,
			transparent: !0,
			color: (t = e.color) == null ? 16777215 : t,
			side: i.DoubleSide,
			depthTest: !1
		}), this.direction = e.direction, this.renderOrder = K.ROTATE_HELPER, this.geometry.name = `RotateHelperCircleGeometry-${this.direction}`;
	}
}, ht = class extends i.Group {
	constructor(e) {
		super(), this.direction = e.direction;
		let t = .015, n = Array(8).fill(null).map((e, n) => {
			let r = new i.RingGeometry(.3, .35, 20, 8, Math.PI / 4 * n + t, Math.PI / 4 - t * 2), a = new i.MeshBasicMaterial({
				opacity: 1,
				color: 16777215,
				depthTest: !1,
				depthWrite: !1,
				transparent: !0,
				side: i.DoubleSide
			}), o = new i.Mesh(r, a);
			return o.name = `AxesDashedRing-${this.direction}-${n}`, o;
		});
		this.add(...n);
	}
}, gt = class extends i.Mesh {
	constructor(e) {
		var t;
		switch (super(), this.offsetAngle = (e) => e, e.direction) {
			case "x":
				this.baseAxes = new i.Vector3(0, 0, 1);
				break;
			case "y":
				this.baseAxes = new i.Vector3(1, 0, 0);
				break;
			case "z":
				this.baseAxes = new i.Vector3(1, 0, 0);
				break;
		}
		this.geometry = new i.CircleGeometry(.3505, 48, 0, 1e-4), this.material = new i.MeshBasicMaterial({
			opacity: .4,
			color: (t = e.color) == null ? 16777215 : t,
			depthTest: !1,
			depthWrite: !1,
			transparent: !0,
			side: i.DoubleSide
		}), this.direction = e.direction, this.angleDirection = 1;
	}
	setClockwiseDirection() {
		this.angleDirection = -1;
	}
	setCounterClockwiseDirection() {
		this.angleDirection = 1;
	}
	toggleDirection() {
		this.angleDirection = this.angleDirection === 1 ? -1 : 1;
	}
	setBaseAxes(e) {
		this.baseAxes = e.clone().normalize();
	}
	getDirection() {
		return this.angleDirection === -1 ? "clockwise" : "counterclockwise";
	}
}, _t = class extends nt {
	constructor(e) {
		super(e), this.name = "BoundingBoxHelper", this.positionAttribute = new i.BufferAttribute(new Float32Array(24), 3), this.box = this.createBox(), this.outline = this.createOutline(), this.add(this.box, this.outline), this.update();
	}
	initQuaternion() {
		this.quaternion.copy(this.originObject3D.quaternion), this.scale.copy(this.originObject3D.scale);
	}
	setHelperQuaternion(e, t) {
		$e(this, e, t);
	}
	raycasterIntersectObject(e, t) {
		return e.intersectObject(this, !1, t);
	}
	raycast(e, t) {
		this.box.raycast(e, t);
	}
	update() {
		let e = new i.Box3(), t = new i.Matrix4().getInverse(this.originObject3D.matrixWorld), n = new i.Vector3();
		if (this.originObject3D.updateMatrixWorld(!0), this.originObject3D.traverse((r) => {
			let a = r.geometry;
			if (!a) return;
			r.updateMatrixWorld(!0);
			let o = new i.Matrix4().multiplyMatrices(t, r.matrixWorld);
			if (a.isBufferGeometry) {
				let t = a, r = t.attributes.position;
				if (r) for (let t = 0, i = r.count; t < i; t++) n.fromBufferAttribute(r, t).applyMatrix4(o), e.expandByPoint(n);
				let i = t.attributes.instanceStart, s = t.attributes.instanceEnd;
				if (i) for (let t = 0, r = i.count; t < r; t++) n.fromBufferAttribute(i, t).applyMatrix4(o), e.expandByPoint(n);
				if (s) for (let t = 0, r = s.count; t < r; t++) n.fromBufferAttribute(s, t).applyMatrix4(o), e.expandByPoint(n);
			} else if (a.vertices) {
				let t = a.vertices;
				for (let r of t) n.copy(r).applyMatrix4(o), e.expandByPoint(n);
			}
		}), e.isEmpty()) return;
		let { min: r, max: a } = e;
		this.positionAttribute.setXYZ(0, a.x, a.y, a.z), this.positionAttribute.setXYZ(1, r.x, a.y, a.z), this.positionAttribute.setXYZ(2, r.x, r.y, a.z), this.positionAttribute.setXYZ(3, a.x, r.y, a.z), this.positionAttribute.setXYZ(4, a.x, a.y, r.z), this.positionAttribute.setXYZ(5, r.x, a.y, r.z), this.positionAttribute.setXYZ(6, r.x, r.y, r.z), this.positionAttribute.setXYZ(7, a.x, r.y, r.z), this.positionAttribute.needsUpdate = !0;
	}
	createOutline() {
		let e = new Uint16Array([
			0,
			1,
			1,
			2,
			2,
			3,
			3,
			0,
			4,
			5,
			5,
			6,
			6,
			7,
			7,
			4,
			0,
			4,
			1,
			5,
			2,
			6,
			3,
			7
		]), t = new i.BufferGeometry();
		t.setIndex(new i.BufferAttribute(e, 1)), t.setAttribute("position", this.positionAttribute);
		let n = new i.LineBasicMaterial({
			color: 64767,
			linewidth: 1,
			opacity: 1,
			toneMapped: !1
		}), r = new i.LineSegments(t, n);
		return r.matrixAutoUpdate = !1, r;
	}
	createBox() {
		let e = new Uint16Array([
			0,
			1,
			2,
			0,
			2,
			3,
			0,
			3,
			7,
			0,
			7,
			4,
			0,
			4,
			5,
			0,
			5,
			1,
			6,
			1,
			5,
			6,
			2,
			1,
			6,
			5,
			4,
			6,
			4,
			7,
			6,
			3,
			2,
			6,
			7,
			3
		]), t = new i.BufferGeometry();
		t.setIndex(new i.BufferAttribute(e, 1)), t.setAttribute("position", this.positionAttribute);
		let n = new i.MeshBasicMaterial({
			color: 64767,
			opacity: .1,
			depthTest: !1,
			transparent: !0
		});
		return new i.Mesh(t, n);
	}
}, vt = /* @__PURE__ */ new Map();
function yt(e) {
	if (vt.has(e)) return vt.get(e).hooks;
	let t = new r(), n = null, i, a = () => {
		n = requestAnimationFrame(a);
		let r = e.projectionMatrix.toArray().join(",") + e.matrixWorld.toArray().join(",");
		r !== i && (i = r, t.emit("cameraUpdate"));
	};
	return a(), vt.set(e, {
		hooks: t,
		dispose: () => {
			vt.delete(e), cancelAnimationFrame(n);
		}
	}), t;
}
//#endregion
//#region build/plugins/Object3DHelperPlugin/Controllers/BaseController.js
function bt(e) {
	return arguments.length === 0 ? [] : Array.isArray(e) ? e : [e];
}
var xt = class {
	updateOtherControllers(e) {
		this.otherControllers = e;
	}
	getIsDragging() {
		return this.isDragging;
	}
	constructor(e, t) {
		var n, a, o;
		this.preventTapDefaultEvent = !1, this.disposers = [], this.isDragging = !1, this.enabled = !1, this.name = "BaseController", this.onWantsTapGesture = (e) => {
			if (this.getIntersectObject(e)) return !1;
		}, this.updateHelperScale = () => {
			"update" in this.helperObject3D && typeof this.helperObject3D.update == "function" && this.helperObject3D.update(this.camera), this.helperObject3D.setScaleByCamera(this.camera);
		}, this.getBox = () => (this.boundingBox || (this.boundingBox = new i.Box3().expandByObject(this.originObject3D)), this.boundingBox), this.hooks = (n = e.sharedHooks) == null ? new r() : n, this.internalHooks = (a = e.sharedInternalHooks) == null ? new r() : a, this.camera = e.camera, this.model = e.model, this.originObject3D = e.originObject3D, this.helperObject3D = e.helperObject3D, this.container = e.container, this.scene = e.scene, this.domEvents = e.domEvents, this.onRender = (o = e.onRender) == null ? (() => {}) : o, this.config = t == null ? {} : t, this.otherControllers = e.otherControllers, this.initialHelperPosition(), this.initialHelperQuaternion(), this.updateHelperScale(), this.cameraHooks = yt(this.camera), this.enable();
		let s = this.onSetOriginObjectScale.bind(this), c = this.onSetOriginObjectRotate.bind(this), l = this.onSetOriginObjectPosition.bind(this), u = this.onApplyOriginObjectScale.bind(this), d = this.onApplyOriginObjectRotate.bind(this), f = this.onApplyOriginObjectPosition.bind(this), p = this.initialHelperPosition.bind(this);
		this.cameraHooks.on("cameraUpdate", this.updateHelperScale), this.internalHooks.on("initialHelperPosition", p), this.internalHooks.on("setObjectScale", s), this.internalHooks.on("setObjectRotate", c), this.internalHooks.on("setObjectPosition", l), this.internalHooks.on("applyObjectPosition", f), this.internalHooks.on("applyObjectRotate", d), this.internalHooks.on("applyObjectScale", u), this.hooks.on("moveEnd", this.updateHelperScale), this.internalHooks.on("setObjectPosition", this.updateHelperScale), this.internalHooks.on("initialHelperPosition", this.updateHelperScale), this.disposers.push(() => {
			this.cameraHooks.off("cameraUpdate", this.updateHelperScale), this.internalHooks.off("initialHelperPosition", p), this.internalHooks.off("setObjectScale", s), this.internalHooks.off("setObjectRotate", c), this.internalHooks.off("setObjectPosition", l), this.internalHooks.off("applyObjectPosition", f), this.internalHooks.off("applyObjectRotate", d), this.internalHooks.off("applyObjectScale", u), this.hooks.off("moveEnd", this.updateHelperScale), this.internalHooks.off("setObjectPosition", this.updateHelperScale), this.internalHooks.off("initialHelperPosition", this.updateHelperScale);
		});
	}
	initialHelperPosition() {
		this.helperObject3D.initialPosition(this.calculateOffset(this.config.offset));
	}
	initialHelperQuaternion() {
		this.helperObject3D.initQuaternion(this.config);
	}
	enable() {
		this.enabled || (this.enabled = !0, this.scene.add(this.helperObject3D), this.helperObject3D.enable(), this.render());
	}
	disable() {
		this.enabled && (this.enabled = !1, this.helperObject3D.disable(), this.render());
	}
	show() {
		this.helperObject3D.show(), this.render();
	}
	hide() {
		this.helperObject3D.hide(), this.render();
	}
	dispose() {
		var e;
		(e = this.disposers) == null || e.forEach((e) => e == null ? void 0 : e()), this.helperObject3D.dispose(), this.render();
	}
	applyHelperMatrix4(e) {
		this.helperObject3D.applyMatrix4(e);
	}
	applyHelperQuaternion(e, t) {
		this.helperObject3D.applyHelperQuaternion(e, t);
	}
	applyHelperScaleMatrix4(e, t) {
		this.helperObject3D.applyHelperScaleMatrix4(e, t);
	}
	onWantsGesture(e, t, n) {
		if (this.isDragging) return !1;
	}
	onIntersectionOnModelUpdate(e) {}
	onApplyOriginObjectScale(e) {
		this.applyHelperScaleMatrix4(e.matrix, e.origin);
	}
	onApplyOriginObjectRotate(e) {
		let t = e.origin;
		if (t) {
			let n = new i.Vector3().subVectors(this.helperObject3D.position, t).applyQuaternion(e.quaternion).add(t);
			this.helperObject3D.position.copy(n);
		}
	}
	onApplyOriginObjectPosition(e) {
		this.applyHelperMatrix4(e.matrix);
	}
	onSetOriginObjectScale(e) {
		this.helperObject3D.scale.copy(e), this.updateOffsetByScale(e);
	}
	onSetOriginObjectRotate(e, t) {}
	onSetOriginObjectPosition(e) {
		this.helperObject3D.position.copy(e.clone().add(this.calculateOffset(this.config.offset)));
	}
	render() {
		this.onRender();
	}
	updateOffsetByScale(e) {
		if (this.boundingBox && this.config.offset) {
			let t = this.originObject3D.position, n = new i.Vector3().subVectors(this.boundingBox.max, t).multiply(e).add(t), r = new i.Vector3().subVectors(this.boundingBox.min, t).multiply(e).add(t), a = this.calculateOffset(this.config.offset, {
				min: r,
				max: n
			});
			this.helperObject3D.initialPosition(a);
		}
	}
	hoverListener(e, t = 16777215, n = 1) {
		let r = bt(e).filter((e) => !et(e)), a = [];
		for (let e of r) if (e.material || e instanceof i.Group) {
			let r = e instanceof i.Group ? e.children.filter((e) => e instanceof i.Mesh) : [e];
			r.forEach((e) => {
				var t, n, r, i;
				let a = e.material;
				Array.isArray(a) ? (e.__originalColor__ = (t = e.__originalColor__) == null ? a.map((e) => e.color.clone()) : t, e.__originalOpacity__ = (n = e.__originalOpacity__) == null ? a.map((e) => e.opacity) : n) : (e.__originalColor__ = (r = e.__originalColor__) == null ? a.color.clone() : r, e.__originalOpacity__ = (i = e.__originalOpacity__) == null ? a.opacity : i);
			});
			let o = () => {
				r.forEach((e) => {
					if (e.name === "ScaleHelperTransparentGroup") {
						if (e.children[0]) {
							let r = e.children[0].material;
							r.color.set(t), r.opacity = n;
						}
					} else {
						let r = e.material;
						Array.isArray(r) ? r.forEach((e) => {
							e.color.set(t), e.opacity = n;
						}) : (r.color.set(t), r.opacity = n);
					}
				}), this.render();
			}, s = () => {
				r.forEach((e) => {
					if (e.name === "ScaleHelperTransparentGroup") {
						if (e.children[0]) {
							let t = e.children[0].material;
							t.color.set(16776960), t.opacity = 1;
						}
					} else {
						let t = e.material;
						if (Array.isArray(t)) {
							let n = e.__originalColor__, r = e.__originalOpacity__;
							t.forEach((e, t) => {
								n && n[t] && e.color.copy(n[t]), r && r[t] !== void 0 && (e.opacity = r[t]);
							});
						} else t.color.copy(e.__originalColor__), t.opacity = e.__originalOpacity__;
					}
				}), this.render();
			}, c = (e) => {
				this.isDragging || o();
			}, l = (e) => {
				this.isDragging || s();
			};
			for (let e of r) this.domEvents.addEventListener(e, "mouseover", c), this.domEvents.addEventListener(e, "mouseout", l), this.hooks.on("moveStart", o), this.hooks.on("moveEnd", s), this.hooks.on("rotateEnd", s), this.hooks.on("scaleEnd", s), a.push(() => {
				this.domEvents.removeEventListener(e, "mouseover", c), this.domEvents.removeEventListener(e, "mouseout", l), this.hooks.off("moveStart", o), this.hooks.off("moveEnd", s), this.hooks.off("rotateEnd", s), this.hooks.off("scaleEnd", s);
			});
		}
		return () => a.forEach((e) => e == null ? void 0 : e());
	}
	getIntersectObject(e) {
		let t = this.camera.position, n = this.helperObject3D;
		if (!n) return;
		let r = this.helperObject3D.raycasterIntersectObject(e)[0];
		if (!r) return;
		let i = r;
		if (i.object = n, this.model.intersectRaycaster) {
			let n = this.model.intersectRaycaster(e)[0];
			if (n && n.point.distanceTo(t) < i.point.distanceTo(t)) return;
		}
		return i.object;
	}
	calculateOffset(e, t) {
		let n = new i.Vector3(0, 0, 0);
		if (!e) return n;
		let r = () => t || this.getBox();
		if (typeof e.x == "number") n.setX(e.x);
		else if (typeof e.x == "object") {
			let t = r();
			n.setX((t.max.x - t.min.x) * e.x.percents);
		}
		if (typeof e.y == "number") n.setY(e.y);
		else if (typeof e.y == "object") {
			let t = r();
			n.setY((t.max.y - t.min.y) * e.y.percents);
		}
		if (typeof e.z == "number") n.setZ(e.z);
		else if (typeof e.z == "object") {
			let t = r();
			n.setZ((t.max.z - t.min.z) * e.z.percents);
		}
		return n;
	}
};
//#endregion
//#region build/plugins/Object3DHelperPlugin/utils/solidGuide.js
function St(e, t) {
	let n = 10, r = 10, i = e.isPerspectiveCamera, a = e.isOrthographicCamera;
	if (i) {
		let i = e, a = i.position.distanceTo(t), o = i.fov * Math.PI / 180;
		r = 2 * Math.tan(o / 2) * a, n = r * i.aspect;
	} else if (a) {
		let t = e;
		n = Math.abs(t.right - t.left), r = Math.abs(t.top - t.bottom);
	}
	let o = Math.sqrt(n * n + r * r), s = o * .8, c = Math.min(n, r) * .25, l = o * 1.2;
	return Math.max(c, Math.min(s, l));
}
var Ct = class {
	constructor(e, t, n) {
		this.camera = e, this.container = t, this.defaults = Object.assign({}, n || {});
	}
	createSolidLine(e, t, n) {
		let r = Object.assign(Object.assign({
			color: 16777215,
			renderOrder: K.DRAG_GUIDE_LINE
		}, this.defaults), n || {}), a = t.clone().normalize(), o = this.computeInfiniteLineLength(e), s = e.clone().add(a.clone().multiplyScalar(-o)), c = e.clone().add(a.clone().multiplyScalar(o)), l = new Float32Array([
			s.x,
			s.y,
			s.z,
			c.x,
			c.y,
			c.z
		]), u = new i.BufferGeometry();
		u.setAttribute("position", new i.BufferAttribute(l, 3));
		let d = new i.LineBasicMaterial({
			color: r.color,
			depthTest: !1,
			depthWrite: !1,
			transparent: !0,
			opacity: .65
		}), f = new i.Line(u, d);
		return f.renderOrder = r.renderOrder, f;
	}
	updateSolidLine(e, t, n, r) {
		let a = n.clone().normalize(), o = this.computeInfiniteLineLength(t), s = t.clone().add(a.clone().multiplyScalar(-o)), c = t.clone().add(a.clone().multiplyScalar(o)), l = new Float32Array([
			s.x,
			s.y,
			s.z,
			c.x,
			c.y,
			c.z
		]), u = e.geometry, d = u.getAttribute("position");
		d && d.itemSize === 3 && d.array.length === l.length ? (d.array.set(l), d.needsUpdate = !0) : u.setAttribute("position", new i.BufferAttribute(l, 3)), (r == null ? void 0 : r.color) !== void 0 && e.material.color.setHex(r.color);
	}
	computeInfiniteLineLength(e) {
		return St(this.camera, e) * 10;
	}
	dispose(e) {
		if (!e) return;
		e.geometry.dispose();
		let t = e.material;
		Array.isArray(t) ? t.forEach((e) => e.dispose()) : t.dispose();
	}
	updateDefaults(e) {
		this.defaults = Object.assign(Object.assign({}, this.defaults), e);
	}
};
//#endregion
//#region build/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.js
function wt(e, t, n) {
	if (!t || !n || !e) return;
	let r = R(t, n);
	if (Math.abs(r.x) === 1 || Math.abs(r.y) === 1) return;
	let a = new i.Raycaster();
	return a.setFromCamera(r, e), a.params.Points && (a.params.Points.threshold = .1), a;
}
//#endregion
//#region build/plugins/Object3DHelperPlugin/Controllers/MoveController.js
function Tt(e) {
	let { raycaster: t, line: n, clampToLine: r = !0 } = e, a = new i.Plane().setFromNormalAndCoplanarPoint(t.ray.direction.clone().normalize(), new i.Vector3()), o = a.projectPoint(n.start, new i.Vector3()), s = a.projectPoint(n.end, new i.Vector3()), c = new i.Line3(o, s), l = c.closestPointToPoint(t.ray.origin, r, new i.Vector3()), u = l.distanceTo(s), d = l.distanceTo(o), f = c.distance();
	if (u > d && u > f) {
		let e = -l.distanceTo(o) / f, t = n.start.clone().sub(n.end).normalize();
		return n.start.clone().sub(t.clone().multiplyScalar(e * n.distance()));
	} else {
		let e = l.distanceTo(o) / f;
		return new i.Vector3().lerpVectors(n.start, n.end, e);
	}
}
var Et = class extends xt {
	get moveByMouseEnable() {
		return this._moveByMouse.enabled;
	}
	constructor(...e) {
		var t, n, r, a, o;
		super(...e), this.name = "MoveController", this.solidGuide = new Ct(this.camera, this.container, (n = (t = this.config) == null ? void 0 : t.solidGuide) == null ? {} : n), this._moveByMouse = { enabled: !1 }, this.dragStart = (e) => {
			if (this.moveByMouseEnable || this.isDragging) return;
			let t = e == null ? void 0 : e.intersect;
			if (!t) return this.dragEnd();
			let n = (t == null ? void 0 : t.object).direction;
			if (!n) return this.dragEnd();
			let r = new i.Vector3(1, 0, 0), a = new i.Vector3(0, 1, 0), o = new i.Vector3(0, 0, 1), s = (() => {
				switch (n) {
					case "x": return r;
					case "y": return a;
					case "z": return o;
					case "xy":
					case "xz":
					case "yz":
					case "plane": return;
				}
			})(), c = t.point.clone();
			if (n === "xy" || n === "xz" || n === "yz") {
				let e = (() => {
					switch (n) {
						case "xy": return o;
						case "xz": return a;
						case "yz": return r;
					}
				})(), t = new i.Plane().setFromNormalAndCoplanarPoint(e, c), s = c.clone();
				this.startInfo = {
					draggingDirection: n,
					startVectorProject: s,
					line: new i.Line3(s.clone(), s.clone()),
					plane: t
				};
			} else if (n === "plane") {
				let e = this.camera.position.clone(), t = c.clone(), r = t.clone().sub(e).normalize(), a = new i.Plane().setFromNormalAndCoplanarPoint(r, t), o = t.clone();
				this.startInfo = {
					draggingDirection: n,
					startVectorProject: o,
					line: new i.Line3(o.clone(), o.clone()),
					plane: a
				};
			} else {
				if (!s) return this.dragEnd();
				let e = new i.Line3(c.clone().sub(s.normalize()), c.clone().add(s.normalize()));
				this.startInfo = {
					draggingDirection: n,
					startVectorProject: c,
					line: e
				};
				try {
					let e = s.clone().normalize(), t = this.helperObject3D.getWorldPosition(new i.Vector3()), n = this.solidGuide.createSolidLine(t, e, {
						color: 16777215,
						renderOrder: K.DRAG_GUIDE_LINE
					});
					this.scene.add(n), this.dragGuideLine = n;
				} catch (e) {}
			}
			let l = (() => {
				switch (n) {
					case "plane": return [];
					case "xy": return [
						"x",
						"y",
						"xy"
					];
					case "xz": return [
						"x",
						"z",
						"xz"
					];
					case "yz": return [
						"y",
						"z",
						"yz"
					];
					default: return [n];
				}
			})();
			this.helperObject3D.showDraggingHelper(l), this.hooks.emit("moveStart", n), this.isDragging = !0, this.setTipsText(this.originObject3D.position), this.setTipsPosition(c);
		}, this.dragging = (e) => {
			if (!this.isDragging || !this.startInfo) return;
			let t = "touches" in e ? e.touches[0].clientX : e.x, n = "touches" in e ? e.touches[0].clientY : e.y, r = wt(this.camera, {
				x: t,
				y: n
			}, this.container);
			return r ? (this.move(r), !1) : this.dragEnd();
		}, this.dragEnd = () => {
			if (this.isDragging) {
				if (this.startInfo = void 0, this.isDragging = !1, this.dragGuideLine) {
					this.scene.remove(this.dragGuideLine), this.dragGuideLine.geometry.dispose();
					let e = this.dragGuideLine.material;
					Array.isArray(e) ? e.forEach((e) => e.dispose()) : e.dispose(), this.dragGuideLine = void 0;
				}
				this.helperObject3D.show(), this.hooks.emit("moveEnd");
			}
		};
		let s = this.helperObject3D;
		if (this.hoverListener([
			s.xArrow,
			s.yArrow,
			s.zArrow,
			(r = s.xyPlane) == null ? void 0 : r.handle,
			(a = s.xzPlane) == null ? void 0 : a.handle,
			(o = s.yzPlane) == null ? void 0 : o.handle
		]), s.centerHandle && s.centerHandle instanceof J) {
			let e = s.centerHandle, t = e.cube;
			this.domEvents.addEventListener(t, "mouseover", () => {
				this.isDragging || (Array.isArray(t.material) && t.material.forEach((e) => {
					e.color.set(16777215);
				}), this.render());
			}), this.domEvents.addEventListener(t, "mouseout", () => {
				this.isDragging || (e.update(this.camera), this.render());
			});
		}
		let c = this.show.bind(this), l = this.hide.bind(this), u = () => {
			this.helperObject3D.update(this.camera), this.isDragging && this.updateDragGuideLineScale(), this.render();
		};
		u(), this.domEvents.addEventListener(this.helperObject3D, "mousedown", this.dragStart), document.addEventListener("mousemove", this.dragging), document.addEventListener("mouseup", this.dragEnd), this.domEvents.addEventListener(this.helperObject3D, "touchstart", this.dragStart), document.addEventListener("touchmove", this.dragging), document.addEventListener("touchend", this.dragEnd), this.hooks.on("rotateStart", l), this.hooks.on("rotateEnd", c), this.hooks.on("scaleStart", l), this.hooks.on("scaleEnd", c), this.hooks.on("moveByMouseEnable", l), this.hooks.on("moveByMouseDisable", c), this.hooks.on("updateOtherHelpers", (e) => {
			this.helperObject3D.update(e.camera), this.render();
		}), this.cameraHooks.on("cameraUpdate", u), this.disposers.push(() => {
			this.domEvents.removeEventListener(this.helperObject3D, "mousedown", this.dragStart), document.removeEventListener("mousemove", this.dragging), document.removeEventListener("mouseup", this.dragEnd), this.domEvents.removeEventListener(this.helperObject3D, "touchstart", this.dragStart), document.removeEventListener("touchmove", this.dragging), document.removeEventListener("touchend", this.dragEnd), this.hooks.off("rotateStart", l), this.hooks.off("rotateEnd", c), this.hooks.off("scaleStart", l), this.hooks.off("scaleEnd", c), this.hooks.off("moveByMouseEnable", l), this.hooks.off("moveByMouseDisable", c), this.hooks.off("updateOtherHelpers"), this.cameraHooks.off("cameraUpdate", u);
		}), this.moveByMouseEnable && this.moveByMouse();
	}
	dispose() {
		var e;
		super.dispose(), (e = this.disposers) == null || e.forEach((e) => e == null ? void 0 : e());
	}
	moveByMouse(e) {
		this._moveByMouse = {
			enabled: !0,
			useFaceNormal: e == null ? void 0 : e.useFaceNormal
		}, this.preventTapDefaultEvent = !0;
		let t = this.handleMouseDown.bind(this), n = this.handleMouseUp.bind(this);
		this.hooks.emit("moveByMouseEnable"), setTimeout(() => {
			this.container.addEventListener("mousedown", t), this.container.addEventListener("mouseup", n);
		}), this.mousedownEventListenerDisposer = () => {
			this.container.removeEventListener("mousedown", t), this.container.removeEventListener("mouseup", n);
		};
	}
	disableMoveByMouse() {
		var e;
		this._moveByMouse = { enabled: !1 }, this.preventTapDefaultEvent = !1, this.hooks.emit("moveByMouseDisable"), (e = this.mousedownEventListenerDisposer) == null || e.call(this);
	}
	onIntersectionOnModelUpdate(e) {
		var t, n, r;
		if (!this.moveByMouseEnable) return;
		let { point: a, face: o } = e;
		if (!this.hooks.emit("wantToMove", a)) {
			if (this.originObject3D.position.copy(a), (this._moveByMouse.useFaceNormal === !0 || typeof this._moveByMouse.useFaceNormal == "object" && this._moveByMouse.useFaceNormal.enable !== !1) && o != null && o.normal) {
				let e = typeof this._moveByMouse.useFaceNormal == "object" && this._moveByMouse.useFaceNormal.alignmentVector ? this._moveByMouse.useFaceNormal.alignmentVector : {
					x: 0,
					y: 1,
					z: 0
				}, a = new i.Vector3((t = e.x) == null ? 0 : t, (n = e.y) == null ? 0 : n, (r = e.z) == null ? 0 : r), s = typeof this._moveByMouse.useFaceNormal == "object" && this._moveByMouse.useFaceNormal.fixedFaceNormal ? this._moveByMouse.useFaceNormal.fixedFaceNormal(o.normal) : o.normal;
				this.originObject3D.quaternion.setFromUnitVectors(a, s), this.internalHooks.emit("setObjectRotate", this.originObject3D.quaternion.clone(), new i.Vector3());
			}
			this.internalHooks.emit("setObjectPosition", a), this.hooks.emit("move", a);
		}
	}
	handleMouseDown(e) {
		let { x: t, y: n } = e;
		this.mouseInfo = {
			x: t,
			y: n,
			mouseDownTimestamp: Date.now()
		};
	}
	handleMouseUp(e) {
		if (!this.mouseInfo) return;
		let { x: t, y: n } = e;
		this.mouseInfo.x === t && this.mouseInfo.y === n && Date.now() - this.mouseInfo.mouseDownTimestamp < 500 && (this.disableMoveByMouse(), this.mouseInfo = void 0);
	}
	updateDragGuideLineScale() {
		if (!this.dragGuideLine || !this.startInfo) return;
		let { line: e } = this.startInfo, t = e.end.clone().sub(e.start).normalize();
		if (t.lengthSq() < 1e-6) return;
		let n = this.helperObject3D.getWorldPosition(new i.Vector3());
		this.solidGuide.updateSolidLine(this.dragGuideLine, n, t);
	}
	move(e) {
		if (!this.startInfo) return this.dragEnd();
		let { line: t, startVectorProject: n } = this.startInfo, r = this.originObject3D, a = this.startInfo.draggingDirection === "plane" || this.startInfo.draggingDirection === "xy" || this.startInfo.draggingDirection === "xz" || this.startInfo.draggingDirection === "yz", o;
		if (a) {
			let t = this.startInfo.plane;
			if (!t) return;
			let n = new i.Vector3(), r = t.normal.dot(e.ray.direction);
			if (Math.abs(r) < 1e-6) return;
			let a = -(t.normal.dot(e.ray.origin) + t.constant) / r;
			if (a < 0) return;
			n.copy(e.ray.origin.clone().add(e.ray.direction.clone().multiplyScalar(a))), o = n;
		} else o = Tt({
			raycaster: e,
			line: t,
			clampToLine: !1
		});
		let s = r.position.clone(), c = o.clone().sub(n), l = new i.Matrix4();
		l.setPosition(c);
		let u = r.position.clone().applyMatrix4(l);
		if (this.hooks.emit("wantToMove", u)) return;
		let d = u.clone();
		this.hooks.emit("moveBefore", d);
		let f = new i.Matrix4();
		f.setPosition(d.clone().sub(s)), r.position.copy(d), this.setTipsText(d), this.setTipsPosition(d), n.copy(o), this.internalHooks.emit("applyObjectPosition", { matrix: f }), this.hooks.emit("move", d);
	}
	setTipsText(e) {
		var t;
		let n = (t = this.helperObject3D.moveTips) == null ? void 0 : t.element;
		if (!n || !this.startInfo) return;
		let r = this.startInfo.draggingDirection, i = (e) => e.toFixed(3);
		switch (r) {
			case "x":
				n.innerText = `x: ${i(e.x)}`;
				break;
			case "y":
				n.innerText = `y: ${i(e.y)}`;
				break;
			case "z":
				n.innerText = `z: ${i(e.z)}`;
				break;
			case "xy":
				n.innerText = `x: ${i(e.x)}  y: ${i(e.y)}`;
				break;
			case "xz":
				n.innerText = `x: ${i(e.x)}  z: ${i(e.z)}`;
				break;
			case "yz":
				n.innerText = `y: ${i(e.y)}  z: ${i(e.z)}`;
				break;
			case "plane":
				n.innerText = `x: ${i(e.x)}  y: ${i(e.y)}  z: ${i(e.z)}`;
				break;
		}
	}
	setTipsPosition(e) {
		let t = this.helperObject3D.moveTips;
		if (!t) return;
		let { x: n, y: r, z: a } = this.helperObject3D.getWorldPosition(new i.Vector3()).clone().project(this.camera);
		if (a > 1) {
			t.hide();
			return;
		}
		let o = this.container.getBoundingClientRect(), s = (n + 1) / 2 * o.width, c = (-r + 1) / 2 * o.height;
		t.setLeftTop(s + "px", c + "px");
	}
}, Dt = class {
	constructor(e, t, n, r, i, a, o, s, c) {
		this.onFiveWantsTapGesture = (e) => {
			if (!this.helperController) return;
			if (this.helperController.preventTapDefaultEvent) return !1;
			let t = this.helperController.onWantsTapGesture(e);
			return this.five.needsRender = !0, t;
		}, this.onFiveWantsGesture = (...e) => {
			if (!this.helperController) return;
			let t = this.helperController.onWantsGesture(...e);
			return this.five.needsRender = !0, t;
		}, this.onFiveIntersectionOnModelUpdate = (...e) => {
			this.helperController && this.helperController.onIntersectionOnModelUpdate(...e);
		};
		let { camera: l, model: u, scene: d } = e, f = e.getElement();
		if (this.five = e, !l || !u || !f || !d) return;
		let p = c == null ? d : c, m = () => {
			e.needsRender = !0;
		};
		this.helperController = new n({
			camera: l,
			model: u,
			domEvents: t,
			originObject3D: r,
			helperObject3D: i,
			container: f,
			scene: p,
			onRender: m,
			sharedHooks: o,
			sharedInternalHooks: s
		}, a), e.on("wantsTapGesture", this.onFiveWantsTapGesture), e.on("wantsGesture", this.onFiveWantsGesture), e.on("intersectionOnModelUpdate", this.onFiveIntersectionOnModelUpdate);
	}
	dispose() {
		var e;
		this.five.off("wantsTapGesture", this.onFiveWantsTapGesture), this.five.off("wantsGesture", this.onFiveWantsGesture), this.five.off("intersectionOnModelUpdate", this.onFiveIntersectionOnModelUpdate), (e = this.helperController) == null || e.dispose();
	}
}, Ot = new i.Quaternion(), kt = class extends xt {
	get rotateCenter() {
		return this.helperObject3D.position.clone();
	}
	constructor(...e) {
		var t, n, r;
		super(...e), this.name = "RotateController", this.solidGuide = new Ct(this.camera, this.container), this.snapGuideLines = [];
		let i = this.helperObject3D;
		this.hoverListener([
			(t = i.xCircle) == null ? void 0 : t.circle,
			(n = i.yCircle) == null ? void 0 : n.circle,
			(r = i.zCircle) == null ? void 0 : r.circle
		].filter(Boolean));
		let a = this.dragStart.bind(this), o = this.dragging.bind(this), s = this.dragEnd.bind(this), c = this.show.bind(this), l = this.hide.bind(this), u = () => {
			this.helperObject3D.update(this.camera), this.render();
		};
		u(), this.domEvents.addEventListener(this.helperObject3D, "mousedown", a), document.addEventListener("mousemove", o), document.addEventListener("mouseup", s), this.domEvents.addEventListener(this.helperObject3D, "touchstart", a), document.addEventListener("touchmove", o), document.addEventListener("touchend", s), this.hooks.on("moveStart", l), this.hooks.on("moveEnd", c), this.hooks.on("scaleStart", l), this.hooks.on("scaleEnd", c), this.hooks.on("moveByMouseEnable", l), this.hooks.on("moveByMouseDisable", c), this.hooks.on("updateOtherHelpers", (e) => {
			this.helperObject3D.update(e.camera), this.render();
		}), this.cameraHooks.on("cameraUpdate", u), this.disposers.push(() => {
			this.domEvents.removeEventListener(this.helperObject3D, "mousedown", a), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", s), this.domEvents.removeEventListener(this.helperObject3D, "touchstart", a), document.removeEventListener("touchmove", o), document.removeEventListener("touchend", s), this.hooks.off("moveStart", l), this.hooks.off("moveEnd", c), this.hooks.off("scaleStart", l), this.hooks.off("scaleEnd", c), this.hooks.off("moveByMouseEnable", l), this.hooks.off("moveByMouseDisable", c), this.hooks.off("updateOtherHelpers"), this.cameraHooks.off("cameraUpdate", u);
		});
	}
	setRotateAngle(e) {
		let { x: t = 0, y: n = 0, z: r = 0 } = e, a = new i.Euler(i.MathUtils.degToRad(t), i.MathUtils.degToRad(n), i.MathUtils.degToRad(r)), o = new i.Quaternion().setFromEuler(a);
		if (this.hooks.emit("wantToRotate", o)) return;
		let { originObject3D: s, rotateCenter: c } = this;
		$e(s, o, c), this.internalHooks.emit("setObjectRotate", o, c), this.hooks.emit("rotate", o), this.render();
	}
	getEulerAngle(e, t) {
		let { originObject3D: n } = this, r = new i.Euler().setFromQuaternion(n.quaternion), a = {
			x: i.MathUtils.radToDeg(r.x),
			y: i.MathUtils.radToDeg(r.y),
			z: i.MathUtils.radToDeg(r.z)
		}, o = {
			x: e === "x" ? t : a.x,
			y: e === "y" ? t : a.y,
			z: e === "z" ? t : a.z
		}, s = new i.Euler(i.MathUtils.degToRad(o.x), i.MathUtils.degToRad(o.y), i.MathUtils.degToRad(o.z));
		return new i.Quaternion().setFromEuler(s);
	}
	onApplyOriginObjectRotate(e) {
		this.isDragging || super.onApplyOriginObjectRotate(e);
	}
	onApplyOriginObjectScale(e) {}
	dragStart(e) {
		if (this.isDragging) return;
		this.helperObject3D.update(this.camera);
		let t = e == null ? void 0 : e.intersect;
		if (!t) return this.dragEnd();
		let n = (t == null ? void 0 : t.object).direction;
		if (!n) return this.dragEnd();
		let r = t.point;
		this.setTipsAngle(0);
		let a = r.clone();
		a.y += .2, this.setTipsPosition(a);
		let o = new i.Quaternion(), s = n === "x" ? new i.Vector3(1, 0, 0) : n === "y" ? new i.Vector3(0, 1, 0) : n === "z" ? new i.Vector3(0, 0, 1) : new i.Vector3(0, 1, 0), c = new i.Plane().setFromNormalAndCoplanarPoint(s, r), l = c.projectPoint(r.clone(), new i.Vector3()).clone().sub(this.rotateCenter), u = this.getAngleHelper(n);
		if (!u) return this.dragEnd();
		let d = l.angleTo(u.baseAxes.clone().applyQuaternion(o)), f = u.offsetAngle(d);
		this.setAngleHelperStart(n, f), this.setAngleHelperLength(n, 0), this.startInfo = {
			direction: n,
			startVector: l,
			directionVector: s,
			plane: c,
			angleHelper: u,
			angle: 0,
			helperQuaternion: o.clone(),
			startQuaternion: this.originObject3D.quaternion.clone()
		}, Ot = new i.Quaternion(), this.helperObject3D.showDraggingHelper([n]), this.hooks.emit("rotateStart", n), this.isDragging = !0;
	}
	getMatrix() {
		var e, t;
		return (t = (e = this.originObject3D) == null ? void 0 : e.ext) == null ? void 0 : t.matrix;
	}
	getMatrixAngle(e, t) {
		let n;
		if (e && e.isMatrix4) {
			n = new i.Quaternion(), e.decompose(new i.Vector3(), n, new i.Vector3());
			let r = new i.Euler().setFromQuaternion(n);
			if (t === "x") return Math.round(i.MathUtils.radToDeg(r.z));
			if (t === "y") return Math.round(i.MathUtils.radToDeg(r.y));
			if (t === "z") return Math.round(i.MathUtils.radToDeg(r.x));
		}
	}
	parseAngleByDirection(e) {
		var t, n;
		let r = (n = (t = this.originObject3D) == null ? void 0 : t.ext) == null ? void 0 : n.matrix, a;
		if (r && r.isMatrix4) {
			a = new i.Quaternion(), r.decompose(new i.Vector3(), a, new i.Vector3());
			let t = new i.Euler().setFromQuaternion(a);
			if (e === "x") return Math.round(i.MathUtils.radToDeg(t.z));
			if (e === "y") return Math.round(i.MathUtils.radToDeg(t.y));
			if (e === "z") return Math.round(i.MathUtils.radToDeg(t.x));
		}
	}
	dragging(e) {
		if (!this.isDragging) return;
		let t = "touches" in e ? e.touches[0].clientX : e.x, n = "touches" in e ? e.touches[0].clientY : e.y, r = wt(this.camera, {
			x: t,
			y: n
		}, this.container);
		return r ? (this.rotate(r), !1) : this.dragEnd();
	}
	rotate(e) {
		if (!this.startInfo) return this.dragEnd();
		let { startVector: t, plane: n, angleHelper: r, direction: a, helperQuaternion: o } = this.startInfo, { originObject3D: s } = this, c = e.ray.intersectPlane(n, new i.Vector3());
		if (!c) return;
		let l = this.rotateCenter.clone(), u = n.projectPoint(c.clone(), new i.Vector3()).clone().sub(l), d = this.startInfo.directionVector.clone().normalize();
		u = u.clone().projectOnPlane(d).normalize().multiplyScalar(u.length());
		let f = new i.Quaternion().setFromUnitVectors(t.clone().normalize(), u.clone().normalize()), p = s.quaternion.clone().premultiply(f);
		if (t.angleTo(u) === 0 || this.hooks.emit("wantToRotate", p)) return;
		let m = new i.Euler().setFromQuaternion(new i.Quaternion().setFromUnitVectors(t.clone().normalize().applyQuaternion(o.clone().inverse()), u.clone().normalize().applyQuaternion(o.clone().inverse())), `${a.toUpperCase()}${"XZY".replace(a.toUpperCase(), "")}`)[a] * r.angleDirection, h = this.startInfo.angle, g = h + m, _ = Math.PI / 2, v = i.MathUtils.degToRad(5), y = i.MathUtils.degToRad(10), b = new i.Quaternion().setFromAxisAngle(d, g), x = this.startInfo.startQuaternion.clone().premultiply(b), S = this.extractAxisAngle(x, d), C = Math.round(S / _) * _, w = Math.abs(S - C);
		if (Math.abs(g) > y && w < v) {
			let e = C - S;
			g += e;
		}
		let T = g - h;
		this.startInfo.angle = g;
		let E = Math.abs(T) < 1e-6 && Math.abs(m) > 1e-6, D = this.snapGuideLines.length > 0;
		E && !D ? this.showSnapGuideLines(a, l) : !E && D && this.removeSnapGuideLines(), this.setAngleHelperLength(a, this.startInfo.angle), this.setTipsAngle(i.MathUtils.radToDeg(this.startInfo.angle));
		let O = new i.Quaternion().setFromAxisAngle(d, T);
		if (l) {
			let e = new i.Vector3().subVectors(s.position, l).applyQuaternion(O).add(l);
			s.position.copy(e);
		}
		s.applyQuaternion(O), Ot.premultiply(O), this.internalHooks.emit("applyObjectRotate", {
			quaternion: O,
			origin: l
		}), this.hooks.emit("rotate", s.quaternion), E || (this.startInfo.startVector = u);
	}
	dragEnd() {
		var e;
		this.isDragging && (this.removeSnapGuideLines(), (e = this.startInfo) != null && e.lineMeshes && this.startInfo.lineMeshes.forEach((e) => {
			this.scene.remove(e), e.geometry.dispose(), e.material instanceof i.Material && e.material.dispose();
		}), this.startInfo = void 0, this.isDragging = !1, this.helperObject3D.show(), this.updateOtherHelpers(), this.hooks.emit("rotateEnd"));
	}
	updateOtherHelpers() {
		this.hooks.emit("updateOtherHelpers", { camera: this.camera });
	}
	getAngleHelper(e) {
		var t, n, r;
		switch (e) {
			case "x": return (t = this.helperObject3D.xCircle) == null ? void 0 : t.angleSector;
			case "y": return (n = this.helperObject3D.yCircle) == null ? void 0 : n.angleSector;
			case "z": return (r = this.helperObject3D.zCircle) == null ? void 0 : r.angleSector;
		}
	}
	setAngleHelperStart(e, t) {
		let n = this.getAngleHelper(e);
		if (!n) {
			console.warn("angleHelper is undefined");
			return;
		}
		if (n instanceof i.Mesh && n.geometry instanceof i.CircleGeometry) {
			let { radius: e, segments: r, thetaLength: a } = n.geometry.parameters;
			n.geometry = new i.CircleGeometry(e, r, t, a);
		} else console.warn("only support THREE.CircleGeometry");
	}
	setAngleHelperLength(e, t) {
		let n = .001, r = e === "x" || e === "y" ? -t : t, a = r >= 0 ? Math.max(r, n) : Math.min(r, -n), o = this.getAngleHelper(e);
		if (o instanceof i.Mesh && o.geometry instanceof i.CircleGeometry) {
			let { radius: e, thetaStart: t } = o.geometry.parameters, n = Math.ceil(Math.abs(a) * (40 / (2 * Math.PI)));
			o.geometry = new i.CircleGeometry(e, n, t, a);
		} else console.warn("only support THREE.CircleGeometry");
	}
	setTipsAngle(e) {
		var t;
		let n = (t = this.helperObject3D.angleTips) == null ? void 0 : t.element;
		n && (n.innerText = `${e.toFixed(0)}°`);
	}
	setTipsPosition(e) {
		let t = this.helperObject3D.angleTips;
		if (!t) return;
		let { x: n, y: r, z: a } = this.helperObject3D.getWorldPosition(new i.Vector3()).clone().project(this.camera);
		if (a > 1) {
			t.hide();
			return;
		}
		let o = this.container.getBoundingClientRect(), s = (n + 1) / 2 * o.width, c = (-r + 1) / 2 * o.height;
		t.setLeftTop(s + "px", c + "px");
	}
	extractAxisAngle(e, t) {
		let n = t.clone().normalize(), r = e.x * n.x + e.y * n.y + e.z * n.z, i = e.w, a = 2 * Math.atan2(r, i);
		return Math.atan2(Math.sin(a), Math.cos(a));
	}
	showSnapGuideLines(e, t) {
		this.removeSnapGuideLines();
		let n = (() => {
			switch (e) {
				case "x": return [new i.Vector3(0, 1, 0), new i.Vector3(0, 0, 1)];
				case "y": return [new i.Vector3(1, 0, 0), new i.Vector3(0, 0, 1)];
				case "z": return [new i.Vector3(1, 0, 0), new i.Vector3(0, 1, 0)];
				default: return [];
			}
		})();
		for (let e of n) {
			let n = this.solidGuide.createSolidLine(t, e, {
				color: 16777215,
				renderOrder: K.DRAG_GUIDE_LINE
			});
			this.scene.add(n), this.snapGuideLines.push(n);
		}
		this.render();
	}
	removeSnapGuideLines() {
		for (let e of this.snapGuideLines) this.scene.remove(e), this.solidGuide.dispose(e);
		this.snapGuideLines = [];
	}
}, At = class extends xt {
	constructor(...e) {
		super(...e), this.name = "BoundingBoxController";
		let t = () => {
			this.syncWithObject(), this.render();
		};
		this.hooks.on("moveEnd", t), this.hooks.on("rotateEnd", t), this.hooks.on("scaleEnd", t), this.disposers.push(() => {
			this.hooks.off("moveEnd", t), this.hooks.off("rotateEnd", t), this.hooks.off("scaleEnd", t);
		});
	}
	onApplyOriginObjectRotate(e) {
		this.helperObject3D.applyHelperQuaternion(e.quaternion, e.origin);
	}
	onSetOriginObjectRotate(e, t) {
		this.helperObject3D.setHelperQuaternion(e, t);
	}
	syncWithObject() {
		this.helperObject3D.position.copy(this.originObject3D.position), this.helperObject3D.quaternion.copy(this.originObject3D.quaternion), this.helperObject3D.scale.copy(this.originObject3D.scale);
		let e = this.helperObject3D;
		e.update && e.update();
	}
};
//#endregion
//#region build/plugins/thirdParty/domevents.js
function $(e, t) {
	this._camera = e || null, this._domElement = t || document, this._raycaster = new i.Raycaster(), this._selected = null, this._boundObjs = {};
	var n = this;
	this._$onClick = function() {
		n._onClick.apply(n, arguments);
	}, this._$onDblClick = function() {
		n._onDblClick.apply(n, arguments);
	}, this._$onMouseMove = function() {
		n._onMouseMove.apply(n, arguments);
	}, this._$onMouseDown = function() {
		n._onMouseDown.apply(n, arguments);
	}, this._$onMouseUp = function() {
		n._onMouseUp.apply(n, arguments);
	}, this._$onTouchMove = function() {
		n._onTouchMove.apply(n, arguments);
	}, this._$onTouchStart = function() {
		n._onTouchStart.apply(n, arguments);
	}, this._$onTouchEnd = function() {
		n._onTouchEnd.apply(n, arguments);
	}, this._$onContextmenu = function() {
		n._onContextmenu.apply(n, arguments);
	}, this._domElement.addEventListener("click", this._$onClick, !1), this._domElement.addEventListener("dblclick", this._$onDblClick, !1), this._domElement.addEventListener("mousemove", this._$onMouseMove, !1), this._domElement.addEventListener("mousedown", this._$onMouseDown, !1), this._domElement.addEventListener("mouseup", this._$onMouseUp, !1), this._domElement.addEventListener("touchmove", this._$onTouchMove, !1), this._domElement.addEventListener("touchstart", this._$onTouchStart, !1), this._domElement.addEventListener("touchend", this._$onTouchEnd, !1), this._domElement.addEventListener("contextmenu", this._$onContextmenu, !1);
}
$.prototype.destroy = function() {
	this._domElement.removeEventListener("click", this._$onClick, !1), this._domElement.removeEventListener("dblclick", this._$onDblClick, !1), this._domElement.removeEventListener("mousemove", this._$onMouseMove, !1), this._domElement.removeEventListener("mousedown", this._$onMouseDown, !1), this._domElement.removeEventListener("mouseup", this._$onMouseUp, !1), this._domElement.removeEventListener("touchmove", this._$onTouchMove, !1), this._domElement.removeEventListener("touchstart", this._$onTouchStart, !1), this._domElement.removeEventListener("touchend", this._$onTouchEnd, !1), this._domElement.removeEventListener("contextmenu", this._$onContextmenu, !1);
}, $.eventNames = [
	"click",
	"dblclick",
	"mouseover",
	"mouseout",
	"mousemove",
	"mousedown",
	"mouseup",
	"contextmenu",
	"touchstart",
	"touchend"
], $.prototype._getRelativeMouseXY = function(e) {
	var t = e.target || e.srcElement;
	t.nodeType === 3 && (t = t.parentNode);
	var n = {
		x: 0,
		y: 0
	}, r = t, i = getComputedStyle(r, null);
	n.y += parseInt(i.getPropertyValue("padding-top"), 10), n.x += parseInt(i.getPropertyValue("padding-left"), 10);
	do
		n.x += r.offsetLeft, n.y += r.offsetTop, i = getComputedStyle(r, null), n.x += parseInt(i.getPropertyValue("border-left-width"), 10), n.y += parseInt(i.getPropertyValue("border-top-width"), 10);
	while (r = r.offsetParent);
	var a = {
		width: t === window ? window.innerWidth : t.offsetWidth,
		height: t === window ? window.innerHeight : t.offsetHeight
	};
	return {
		x: Number((e.pageX - n.x) / a.width) * 2 - 1,
		y: -((e.pageY - n.y) / a.height) * 2 + 1
	};
}, $.prototype._objectCtxInit = function(e) {
	e._3xDomEvent = {};
}, $.prototype._objectCtxDeinit = function(e) {
	delete e._3xDomEvent;
}, $.prototype._objectCtxIsInit = function(e) {
	return !!e._3xDomEvent;
}, $.prototype._objectCtxGet = function(e) {
	return e._3xDomEvent;
}, $.prototype.camera = function(e) {
	return e && (this._camera = e), this._camera;
}, $.prototype.bind = function(e, t, n, r) {
	console.assert($.eventNames.indexOf(t) !== -1, "not available events:" + t), this._objectCtxIsInit(e) || this._objectCtxInit(e);
	var i = this._objectCtxGet(e);
	i[t + "Handlers"] || (i[t + "Handlers"] = []), i[t + "Handlers"].push({
		callback: n,
		useCapture: r
	}), this._boundObjs[t] === void 0 && (this._boundObjs[t] = []), this._boundObjs[t].push(e);
}, $.prototype.addEventListener = $.prototype.bind, $.prototype.unbind = function(e, t, n, r) {
	console.assert($.eventNames.indexOf(t) !== -1, "not available events:" + t), this._objectCtxIsInit(e) || this._objectCtxInit(e);
	var i = this._objectCtxGet(e);
	i[t + "Handlers"] || (i[t + "Handlers"] = []);
	for (var a = i[t + "Handlers"], o = 0; o < a.length; o++) {
		var s = a[o];
		if (n == s.callback && r == s.useCapture) {
			a.splice(o, 1);
			break;
		}
	}
	var c = this._boundObjs[t].indexOf(e);
	this._boundObjs[t].splice(c, 1);
}, $.prototype.removeEventListener = $.prototype.unbind, $.prototype._bound = function(e, t) {
	var n = this._objectCtxGet(t);
	return n ? !!n[e + "Handlers"] : !1;
}, $.prototype._isObjectVisible = function(e) {
	for (var t = e; t;) {
		if (t.visible === !1) return !1;
		t = t.parent;
	}
	return !0;
}, $.prototype._filterVisibleObjects = function(e) {
	var t = this;
	return e.filter(function(e) {
		return t._isObjectVisible(e);
	});
}, $.prototype._onMove = function(e, t, n, r) {
	var a = this._boundObjs[e];
	if (!(a === void 0 || a.length === 0)) {
		var o = this._filterVisibleObjects(a);
		if (o.length !== 0) {
			var s = new i.Vector2();
			s.set(t, n), this._raycaster.setFromCamera(s, this._camera);
			var c = this._raycaster.intersectObjects(o), l = this;
			c = c.filter(function(e) {
				return l._isObjectVisible(e.object);
			}), c.sort(function(e, t) {
				var n = e.object.renderOrder || 0, r = t.object.renderOrder || 0;
				return n === r ? e.distance - t.distance : r - n;
			});
			var u = this._selected;
			if (c.length > 0) {
				var d, f, p, m = c[0], h = m.object;
				this._selected = h, p = this._bound("mousemove", h), u != h && (d = this._bound("mouseover", h), f = u && this._bound("mouseout", u));
			} else f = u && this._bound("mouseout", u), this._selected = null;
			p && this._notify("mousemove", h, r, m), d && this._notify("mouseover", h, r, m), f && this._notify("mouseout", u, r, m);
		}
	}
}, $.prototype._onEvent = function(e, t, n, r) {
	var a = this._boundObjs[e];
	if (!(a === void 0 || a.length === 0)) {
		var o = this._filterVisibleObjects(a);
		if (o.length !== 0) {
			var s = new i.Vector2();
			s.set(t, n), this._raycaster.setFromCamera(s, this._camera);
			var c = this._raycaster.intersectObjects(o, !0), l = this;
			if (c = c.filter(function(e) {
				return l._isObjectVisible(e.object);
			}), c.sort(function(e, t) {
				var n = e.object.renderOrder || 0, r = t.object.renderOrder || 0;
				return n === r ? e.distance - t.distance : r - n;
			}), c.length !== 0) {
				for (var u = c[0], d = u.object, f = this._objectCtxGet(d), p = d.parent; f === void 0 && p;) f = this._objectCtxGet(p), p = p.parent;
				f && this._notify(e, d, r, u);
			}
		}
	}
}, $.prototype._notify = function(e, t, n, r) {
	var i = this._objectCtxGet(t), a = i ? i[e + "Handlers"] : null;
	if (!i || !a || a.length === 0) {
		t.parent && this._notify(e, t.parent, n, r);
		return;
	}
	for (var a = i[e + "Handlers"], o = 0; o < a.length; o++) {
		var s = a[o], c = !0;
		s.callback({
			type: e,
			target: t,
			origDomEvent: n,
			intersect: r,
			stopPropagation: function() {
				c = !1;
			}
		}), c && s.useCapture === !1 && t.parent && this._notify(e, t.parent, n, r);
	}
}, $.prototype._onMouseDown = function(e) {
	return this._onMouseEvent("mousedown", e);
}, $.prototype._onMouseUp = function(e) {
	return this._onMouseEvent("mouseup", e);
}, $.prototype._onMouseEvent = function(e, t) {
	var n = this._getRelativeMouseXY(t);
	this._onEvent(e, n.x, n.y, t);
}, $.prototype._onMouseMove = function(e) {
	var t = this._getRelativeMouseXY(e);
	this._onMove("mousemove", t.x, t.y, e), this._onMove("mouseover", t.x, t.y, e), this._onMove("mouseout", t.x, t.y, e);
}, $.prototype._onClick = function(e) {
	this._onMouseEvent("click", e);
}, $.prototype._onDblClick = function(e) {
	this._onMouseEvent("dblclick", e);
}, $.prototype._onContextmenu = function(e) {
	this._onMouseEvent("contextmenu", e);
}, $.prototype._onTouchStart = function(e) {
	return this._onTouchEvent("touchstart", e);
}, $.prototype._onTouchEnd = function(e) {
	return this._onTouchEvent("touchend", e);
}, $.prototype._onTouchMove = function(e) {
	if (e.touches.length == 1) {
		var t = Number(e.touches[0].pageX / window.innerWidth) * 2 - 1, n = -(e.touches[0].pageY / window.innerHeight) * 2 + 1;
		this._onMove("mousemove", t, n, e), this._onMove("mouseover", t, n, e), this._onMove("mouseout", t, n, e);
	}
}, $.prototype._onTouchEvent = function(e, t) {
	var n = t.touches;
	if (n.length == 0 && (n = t.changedTouches), n.length == 1) {
		var r = Number(n[0].pageX / window.innerWidth) * 2 - 1, i = -(n[0].pageY / window.innerHeight) * 2 + 1;
		this._onEvent(e, r, i, t);
	}
};
//#endregion
//#region build/plugins/Object3DHelperPlugin/Controller.js
var jt = "Object3DHelperPlugin", Mt = jt, Nt = () => {
	console.error(`${Mt} is disposed`);
}, Pt = () => {
	console.warn(`${Mt} is disabled`);
}, Ft = () => {
	console.error(`${Mt} is disabled`);
}, It = class {
	constructor(e) {
		this.controllers = {}, this.state = {
			visible: !0,
			enabled: !0,
			disposed: !1
		}, this.hooks = new r(), e && this.addControllers(e), this.setState(this.state);
	}
	show(e) {
		this.setState({ visible: !0 }, e);
	}
	hide(e) {
		this.setState({ visible: !1 }, e);
	}
	enable(e) {
		this.setState({ enabled: !0 }, e);
	}
	disable(e) {
		this.setState({ enabled: !1 }, e);
	}
	dispose() {
		this.setState({ disposed: !0 });
	}
	setState(e, t) {
		if (this.state.disposed || !this.state.enabled && e.enabled !== !0 && e.disposed !== !0) return;
		let n = Object.assign({}, this.state);
		this.state = Object.assign(Object.assign({}, this.state), e), e.disposed !== void 0 && e.disposed !== n.disposed && e.disposed && this.handleDispose(), e.visible !== void 0 && this.handleVisible(e.visible), e.enabled !== void 0 && this.handleEnable(e.enabled), this.hooks.emit("stateChange", {
			state: this.state,
			prevState: n
		});
	}
	addControllers(e) {
		this.controllers = Object.assign(Object.assign({}, this.controllers), e), this.setState(this.state);
	}
	initialHelperMatrix() {
		this.everyControllerDo((e) => {
			e.initialHelperPosition(), e.initialHelperQuaternion();
		});
	}
	handleEnable(e, t = !0) {
		e ? (this.everyControllerDo((e) => e.enable()), this.hooks.emit("enable", { userAction: t })) : (this.everyControllerDo((e) => e.disable()), this.hooks.emit("disable", { userAction: t }));
	}
	handleVisible(e, t = !0) {
		e ? (this.everyControllerDo((e) => e.show()), this.state.enabled && this.hooks.emit("show", { userAction: t })) : (this.everyControllerDo((e) => e.hide()), this.state.enabled && this.hooks.emit("hide", { userAction: t }));
	}
	handleDispose() {
		Object.values(this.controllers).forEach((e) => {
			e == null || e.dispose();
		});
	}
	everyControllerDo(e) {
		Object.values(this.controllers).forEach((t) => {
			t && e(t);
		});
	}
}, Lt = class extends x.Controller {
	constructor(e) {
		super(e), this.name = jt, this.state = {
			visible: !0,
			enabled: !0,
			disposed: !1
		}, this.objectHelperMap = /* @__PURE__ */ new Map(), this.five = e;
	}
	show(e) {
		return S(this, void 0, void 0, function* () {
			this.setState({ visible: !0 }, e);
		});
	}
	hide(e) {
		return S(this, void 0, void 0, function* () {
			this.setState({ visible: !1 }, e);
		});
	}
	enable(e) {
		this.setState({ enabled: !0 }, e);
	}
	disable(e) {
		this.setState({ enabled: !1 }, e);
	}
	dispose() {
		this.setState({ disposed: !0 });
	}
	load(e) {
		return S(this, void 0, void 0, function* () {});
	}
	setState(e, t) {
		var n;
		if (this.state.disposed) return Nt();
		if (!this.state.enabled && e.enabled !== !0 && e.disposed !== !0) return Ft();
		let r = Object.assign({}, this.state);
		this.state = Object.assign(Object.assign({}, this.state), e), e.disposed !== void 0 && e.disposed !== r.disposed && e.disposed && this.handleDispose(), e.visible !== void 0 && e.visible !== r.visible && this.handleVisible(e.visible), e.enabled !== void 0 && e.enabled !== r.enabled && this.handleEnable(e.enabled), this.hooks.emit("stateChange", {
			state: this.state,
			prevState: r,
			userAction: (n = t == null ? void 0 : t.userAction) == null ? !0 : n
		});
	}
	getObject3DHelper(e) {
		return this.objectHelperMap.get(e);
	}
	addObject3DHelper(e, t = {}) {
		var n, a;
		if (!e) {
			console.error("Object3D is undefined");
			return;
		}
		if (this.objectHelperMap.has(e)) {
			console.warn(`Object3DHelperPlugin: object3D ${e.name} already has helper`);
			return;
		}
		let o = new It(), s = [], c = (n = this.five.getElement()) == null ? void 0 : n.parentElement;
		this.five.camera;
		let l = Object.assign(Object.assign({}, {
			moveHelper: !0,
			rotateHelper: !0,
			boundingBoxHelper: !1,
			moveHelperTips: !1,
			positionFrom: "objectPosition"
		}), t), { moveHelper: u, rotateHelper: d, boundingBoxHelper: f } = l, p = new i.Group();
		l.helperOffset && p.position.copy(l.helperOffset), this.five.scene.add(p);
		let m = o.hooks, h = new r(), g = new $(this.five.camera, this.five.getElement()), _ = (e) => {
			if (e) return typeof e == "boolean" ? e : e.enable;
		}, v = {};
		if (_(u)) {
			let t = Object.assign(Object.assign({}, this.getConfig(l.moveHelper)), l), n = new dt(e, Object.assign({
				container: c == null ? void 0 : c,
				moveTipsEnable: (a = l.moveHelperTips) == null ? !1 : a
			}, t)), r = new Dt(this.five, g, Et, e, n, t, m, h, p);
			v.moveController = r.helperController, s.push(() => r.dispose());
		}
		if (_(d)) {
			let t = Object.assign(Object.assign({}, this.getConfig(l.rotateHelper)), l), n = new ft(e, Object.assign({ container: c == null ? void 0 : c }, t)), r = new Dt(this.five, g, kt, e, n, t, m, h, p);
			v.rotateController = r.helperController, s.push(() => r.dispose());
		}
		if (_(f)) {
			let t = new _t(e), n = new Dt(this.five, g, At, e, t, void 0, m, h, p);
			v.boundingBoxController = n.helperController, s.push(() => n.dispose());
		}
		return Object.values(v).forEach((e) => {
			e && typeof e.updateOtherControllers == "function" && e.updateOtherControllers(v);
		}), o.addControllers(v), this.objectHelperMap.set(e, {
			helper: o,
			disposers: s,
			helperGroup: p
		}), o.controllers;
	}
	removeObject3DHelper(e) {
		if (!this.objectHelperMap.has(e)) return;
		let { helper: t, disposers: n, helperGroup: r } = this.objectHelperMap.get(e);
		this.objectHelperMap.delete(e), t.dispose(), n == null || n.forEach((e) => e == null ? void 0 : e()), r.parent && r.parent.remove(r);
	}
	handleEnable(e, t = !0) {
		e ? (this.everyHelperDo((e) => e.enable()), this.hooks.emit("enable", { userAction: t })) : (this.everyHelperDo((e) => e.disable()), this.hooks.emit("disable", { userAction: t })), this.state.enabled = e;
	}
	handleVisible(e, t = !0) {
		e ? (this.everyHelperDo((e) => e.show()), this.actionIfStateIsEnabled(() => this.hooks.emit("show", { userAction: t }))) : (this.everyHelperDo((e) => e.hide()), this.actionIfStateIsEnabled(() => this.hooks.emit("hide", { userAction: t }))), this.state.visible = e;
	}
	handleDispose() {
		this.objectHelperMap.forEach(({ helper: e, disposers: t, helperGroup: n }) => {
			e.dispose(), t == null || t.forEach((e) => e == null ? void 0 : e()), n.parent && n.parent.remove(n);
		}), this.objectHelperMap.clear();
	}
	everyHelperDo(e) {
		this.objectHelperMap.forEach(({ helper: t, disposers: n }) => {
			t && e(t, n);
		});
	}
	actionIfStateIsEnabled(e, t) {
		if (this.state.enabled) return e();
		t != null && t.warnLog && Pt();
	}
	getConfig(e) {
		if (e && typeof e != "boolean" && e.enable) return e;
	}
}, Rt = (e) => new Lt(e), zt = class {
	constructor(e, t, n, r, i) {
		this.R = e, this.Q = t, this.A = n, this.B = r, this.C = i, this.cov = NaN, this.x = NaN;
	}
	filter(e, t = 0) {
		if (isNaN(this.x)) this.x = 1 / this.C * e, this.cov = 1 / this.C * this.Q * (1 / this.C);
		else {
			let n = this.A * this.x + this.B * t, r = this.A * this.cov * this.A + this.R, i = r * this.C * (1 / (this.C * r * this.C + this.Q));
			this.x = n + i * (e - this.C * n), this.cov = r - i * this.C * r;
		}
		return this.x;
	}
}, Bt = class extends x.Controller {
	updateState(e, t) {
		let n = this.state;
		this.state = Object.assign(Object.assign({}, this.state), e), this.hooks.emit("stateChange", {
			state: this.state,
			prevState: n,
			userAction: t
		});
	}
	constructor(e, t) {
		var n, r, i;
		super(e), this.boundingAABB = null, this.cancelAnimation = null, this.boundsSet = !1, this.playing = !1, this.keyframes = [], this.five = e, this.state = {
			enabled: !0,
			visible: !0
		}, this.duration = (n = t == null ? void 0 : t.duration) == null ? 6e3 : n, this.curveHeight = (r = t == null ? void 0 : t.curveHeight) == null ? 1.5 : r, this.pointDuration = (i = t == null ? void 0 : t.pointDuration) == null ? 4e3 : i;
	}
	load() {
		return S(this, void 0, void 0, function* () {});
	}
	enable(e) {
		var t;
		if (this.state.enabled) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !0 }, n);
	}
	disable(e) {
		var t;
		if (this.state.enabled === !1) return;
		let n = (t = e == null ? void 0 : e.userAction) == null ? !0 : t;
		this.updateState({ enabled: !1 }, n);
	}
	dispose() {
		this.disable(), this.cancelAnimation && (this.cancelAnimation(), this.cancelAnimation = null);
		try {
			let e = this.findRenderMesh();
			if (e) {
				let t = e.material.uniforms;
				t.u_aggregationProgress.value = 1;
			}
		} catch (e) {}
	}
	extractKeyframes(e) {
		let t = [];
		if (!e.content.data) throw Error("轨迹数据未加载");
		let n = e.content.data.positionArray, r = n.length / 3, a = .01, o = .1, s = new zt(a, o, 1, 0, 1), c = new zt(a, o, 1, 0, 1), l = new zt(a, o, 1, 0, 1), u = new Float32Array(r);
		for (let e = 0; e < r; e++) if (e === 0) u[e] = 0;
		else {
			let t = new i.Vector3(n[(e - 1) * 3], n[(e - 1) * 3 + 1], n[(e - 1) * 3 + 2]);
			u[e] = new i.Vector3(n[e * 3], n[e * 3 + 1], n[e * 3 + 2]).distanceTo(t) + u[e - 1];
		}
		for (let a = 0; a < r; a++) {
			let o = new i.Vector3(0, 0, 0), d = 0;
			for (let e = a - 5; e < a + 6; e++) e >= 0 && e < r && (o.add(new i.Vector3(n[e * 3], n[e * 3 + 1], n[e * 3 + 2])), d++);
			o.divideScalar(d).applyMatrix4(e.transform);
			let f = s.filter(o.x), p = c.filter(o.y), m = l.filter(o.z);
			t.push({
				position: new i.Vector3(f, p, m),
				location: u[a]
			});
		}
		return t;
	}
	computeAABB2D(e) {
		let t = Infinity, n = -Infinity, r = Infinity, a = -Infinity;
		for (let i of e) i.position.x < t && (t = i.position.x), i.position.x > n && (n = i.position.x), i.position.z < r && (r = i.position.z), i.position.z > a && (a = i.position.z);
		return {
			min: new i.Vector2(t, r),
			max: new i.Vector2(n, a)
		};
	}
	findClosestKeyframeToRay(e, t) {
		let n = Infinity, r = t[0].position.clone(), a = new i.Vector3();
		for (let i of t) {
			e.closestPointToPoint(i.position, a);
			let t = a.distanceTo(i.position);
			t < n && (n = t, r = i.position.clone());
		}
		return r;
	}
	getCameraCurve() {
		return S(this, void 0, void 0, function* () {
			var t, n, r;
			let a = (r = (n = (t = this.five.model.viewLayers[0]) == null ? void 0 : t.scene) == null ? void 0 : n.trajectories) == null ? void 0 : r[0];
			if (!a) throw Error("未找到轨迹数据");
			a.visible = !0, yield new Promise((t) => {
				let n = e.shared.add(() => {
					a.content.loadState === "READY" && (n(), t(), a.visible = !1);
				});
			});
			let o = this.extractKeyframes(a);
			if (o.length < 2) throw Error("轨迹关键帧不足,至少需要2个关键帧");
			this.keyframes = o;
			let s = this.computeAABB2D(o);
			this.boundingAABB = s;
			let c = this.curveHeight, l = new i.Vector3((s.min.x + s.max.x) / 2, c, (s.min.y + s.max.y) / 2), u = (s.max.x - s.min.x) / 2, d = (s.max.y - s.min.y) / 2, f = Math.sqrt(u * u + d * d), p = (e) => {
				let t = new i.Vector3().subVectors(e, l);
				return t.length() < .001 && t.set(1, 0, 0), l.clone().add(t.normalize().multiplyScalar(f));
			}, m = new i.Vector3(o[0].position.x, c, o[0].position.z), h = p(m), g = new i.Vector3().subVectors(l, m).normalize(), _ = new i.Ray(m, g), v = new i.Vector3(-g.z, 0, g.x).normalize(), y = new i.Ray(l, v), b = this.findClosestKeyframeToRay(y, o), x = p(new i.Vector3(b.x, c, b.z)), S = this.findClosestKeyframeToRay(_, o), C = p(new i.Vector3(S.x, c, S.z));
			return new i.CatmullRomCurve3([
				h,
				x,
				C
			], !1, "centripetal", .5);
		});
	}
	isInitAnimationEnabled() {
		return this.five.modelScene.parameter.resolveValue("enableGaussianSplattingInitAnimation") === !0;
	}
	findRenderMesh() {
		let e = null;
		if (this.five.scene.traverse((t) => {
			e || t instanceof i.Mesh && t.material && t.material.uniforms && t.material.uniforms.u_aggregationProgress && (e = t);
		}), !e) throw Error("未找到 GaussianSplatting 渲染网格");
		return e;
	}
	setBounding(e, t, n) {
		let r = this.findRenderMesh();
		r.material.uniforms.u_aggregationBoundsMin.value.copy(e), r.material.uniforms.u_aggregationBoundsMax.value.copy(t), this.boundsSet = !0;
	}
	setBounds() {
		if (!this.boundingAABB) throw Error("请先调用 getCameraCurve 计算轨迹边界");
		let e = this.boundingAABB, t = this.findRenderMesh(), n = new i.Vector3(e.min.x, 0, e.min.y), r = new i.Vector3(e.max.x, 3, e.max.y);
		t.material.uniforms.u_aggregationBoundsMin.value.copy(n), t.material.uniforms.u_aggregationBoundsMax.value.copy(r), this.boundsSet = !0;
	}
	startAggregation() {
		if (!this.isInitAnimationEnabled()) {
			console.warn("[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过聚合动画");
			return;
		}
		if (!this.boundsSet) throw Error("请先调用 setBounds 设置聚合边界");
		let t = this.findRenderMesh().material.uniforms;
		t.u_aggregationProgress.value = 0, t.u_aggregationPointDuration.value = Math.min(this.pointDuration / this.duration, 1), this.five.needsRender = !0;
		let n = performance.now(), r = this.duration;
		this.cancelAnimation = e.shared.add(() => {
			let e = performance.now() - n, i = Math.min(e / r, 1), a = i * i * (3 - 2 * i);
			t.u_aggregationProgress.value = a, this.five.needsRender = !0, this.five.modelSceneNeedsRender = !0, i >= 1 && (t.u_aggregationProgress.value = 1, this.cancelAnimation && (this.cancelAnimation(), this.cancelAnimation = null));
		});
	}
	playEntrance() {
		return S(this, void 0, void 0, function* () {
			if (!this.isInitAnimationEnabled()) {
				console.warn("[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过入场动画");
				return;
			}
			if (!this.playing) {
				this.playing = !0;
				try {
					let n = yield this.getCameraCurve(), r = this.boundingAABB, a = new i.Vector3((r.min.x + r.max.x) / 2, this.curveHeight, (r.min.y + r.max.y) / 2), o = n.getPointAt(0), s = new t(90).copy(this.five.camera);
					s.position.copy(o), s.lookAt(a), s.computePose(0), this.five.setState(Object.assign({}, s.pose)), this.setBounds();
					let c = this.findRenderMesh().material.uniforms;
					c.u_aggregationProgress.value = 0, c.u_aggregationPointDuration.value = Math.min(this.pointDuration / this.duration, 1), this.five.needsRender = !0;
					let l = this.duration, u = performance.now();
					yield new Promise((t) => {
						this.cancelAnimation = e.shared.add(() => {
							let e = performance.now() - u, r = Math.min(e / l, 1), i = r * r * (3 - 2 * r);
							c.u_aggregationProgress.value = i, this.five.modelSceneNeedsRender = !0;
							let o = n.getPointAt(i);
							s.position.copy(o), s.lookAt(a), s.computePose(0), this.five.setState(Object.assign({}, s.pose)), this.five.needsRender = !0, r >= 1 && (c.u_aggregationProgress.value = 1, this.cancelAnimation && (this.cancelAnimation(), this.cancelAnimation = null), t());
						});
					});
				} finally {
					this.playing = !1;
				}
			}
		});
	}
}, Vt = (e, t) => new Bt(e, t), Ht = class extends l {
	constructor(e, t) {
		super(), this.prefabGeometry = e, this.copy(e), this.instanceCount = t, this.prefabCount = t;
	}
	createAttribute(e, t, n) {
		let r = new c(new Float32Array(this.prefabCount * t), t);
		if (this.setAttribute(e, r), n) {
			let e = [];
			for (let t = 0; t < this.prefabCount; t++) n(e, t, this.prefabCount), this.setPrefabData(r, t, e);
		}
		return r;
	}
	setPrefabData(e, t, n) {
		let r = typeof e == "string" ? this.attributes[e] : e, i = t * r.itemSize, a = r.array;
		for (let e = 0; e < r.itemSize; e++) a[i++] = n[e];
	}
}, Ut = class extends o {
	constructor(e, t) {
		super(), this.prefabGeometry = e, this.isPrefabBufferGeometry = e.isBufferGeometry, this.prefabCount = t, this.isPrefabBufferGeometry ? this.prefabVertexCount = e.attributes.position.count : this.prefabVertexCount = e.vertices.length, this.bufferIndices(), this.bufferPositions();
	}
	bufferIndices() {
		let e = [], t;
		if (this.isPrefabBufferGeometry) {
			let n = this.prefabGeometry;
			if (n.index) t = n.index.count, e = Array.from(n.index.array);
			else {
				t = this.prefabVertexCount;
				for (let n = 0; n < t; n++) e.push(n);
			}
		} else {
			let n = this.prefabGeometry, r = n.faces.length;
			t = r * 3;
			for (let t = 0; t < r; t++) {
				let r = n.faces[t];
				e.push(r.a, r.b, r.c);
			}
		}
		let n = new Uint32Array(this.prefabCount * t);
		this.setIndex(new a(n, 1));
		for (let r = 0; r < this.prefabCount; r++) for (let i = 0; i < t; i++) n[r * t + i] = e[i] + r * this.prefabVertexCount;
	}
	bufferPositions() {
		let e = this.createAttribute("position", 3).array;
		if (this.isPrefabBufferGeometry) {
			let t = this.prefabGeometry.attributes.position.array;
			for (let n = 0, r = 0; n < this.prefabCount; n++) for (let n = 0; n < this.prefabVertexCount; n++, r += 3) e[r] = t[n * 3], e[r + 1] = t[n * 3 + 1], e[r + 2] = t[n * 3 + 2];
		} else {
			let t = this.prefabGeometry;
			for (let n = 0, r = 0; n < this.prefabCount; n++) for (let n = 0; n < this.prefabVertexCount; n++, r += 3) {
				let i = t.vertices[n];
				e[r] = i.x, e[r + 1] = i.y, e[r + 2] = i.z;
			}
		}
	}
	bufferUvs() {
		let e = this.createAttribute("uv", 2).array;
		if (this.isPrefabBufferGeometry) {
			let t = this.prefabGeometry.attributes.uv.array;
			for (let n = 0, r = 0; n < this.prefabCount; n++) for (let n = 0; n < this.prefabVertexCount; n++, r += 2) e[r] = t[n * 2], e[r + 1] = t[n * 2 + 1];
		} else {
			let t = this.prefabGeometry, n = t.faces.length, r = [];
			for (let e = 0; e < n; e++) {
				let n = t.faces[e], i = t.faceVertexUvs[0][e];
				r[n.a] = i[0], r[n.b] = i[1], r[n.c] = i[2];
			}
			for (let t = 0, n = 0; t < this.prefabCount; t++) for (let t = 0; t < this.prefabVertexCount; t++, n += 2) {
				let i = r[t];
				e[n] = i.x, e[n + 1] = i.y;
			}
		}
	}
	bufferNormals() {
		let e = this.createAttribute("normal", 3).array;
		if (this.isPrefabBufferGeometry) {
			let t = this.prefabGeometry.attributes.normal.array;
			for (let n = 0, r = 0; n < this.prefabCount; n++) for (let n = 0; n < this.prefabVertexCount; n++, r += 3) e[r] = t[n * 3], e[r + 1] = t[n * 3 + 1], e[r + 2] = t[n * 3 + 2];
		} else {
			let t = this.prefabGeometry, n = t.faces.length, r = [];
			for (let e = 0; e < n; e++) {
				let n = t.faces[e];
				n.vertexNormals.length > 0 ? (r[n.a] = n.vertexNormals[0], r[n.b] = n.vertexNormals[1], r[n.c] = n.vertexNormals[2]) : (r[n.a] = n.normal, r[n.b] = n.normal, r[n.c] = n.normal);
			}
			for (let t = 0, n = 0; t < this.prefabCount; t++) for (let t = 0; t < this.prefabVertexCount; t++, n += 3) {
				let i = r[t];
				e[n] = i.x, e[n + 1] = i.y, e[n + 2] = i.z;
			}
		}
	}
	createAttribute(e, t, n) {
		let r = new a(new Float32Array(this.prefabCount * this.prefabVertexCount * t), t);
		if (this.setAttribute(e, r), n) {
			let e = [];
			for (let t = 0; t < this.prefabCount; t++) n(e, t, this.prefabCount), this.setPrefabData(r, t, e);
		}
		return r;
	}
	setPrefabData(e, t, n) {
		let r = typeof e == "string" ? this.attributes[e] : e, i = t * this.prefabVertexCount * r.itemSize, a = r.array;
		for (let e = 0; e < this.prefabVertexCount; e++) for (let e = 0; e < r.itemSize; e++) a[i++] = n[e];
	}
}, Wt = class extends o {
	constructor(e) {
		super(), this.pointCount = e, this.bufferPositions();
	}
	bufferPositions() {
		this.createAttribute("position", 3);
	}
	createAttribute(e, t, n) {
		let r = new a(new Float32Array(this.pointCount * t), t);
		if (this.setAttribute(e, r), n) {
			let e = [];
			for (let t = 0; t < this.pointCount; t++) n(e, t, this.pointCount), this.setPointData(r, t, e);
		}
		return r;
	}
	setPointData(e, t, n) {
		let r = typeof e == "string" ? this.attributes[e] : e, i = t * r.itemSize, a = r.array;
		for (let e = 0; e < r.itemSize; e++) a[i++] = n[e];
	}
};
//#endregion
//#region build/plugins/utils/math.js
function Gt(e) {
	let t = 0;
	for (let n = 1; n < e.length; n++) t += e[n].distanceTo(e[n - 1]);
	return t;
}
function Kt(e) {
	let t = 0;
	for (let n = 1; n < e.length; n++) t += e[n].distanceTo(e[n - 1]);
	return t;
}
//#endregion
export { _e as BackgroundPlugin, x as BasePlugin, Ue as CSS2DObject, Qe as CSS2DPlugin, Ye as CSS2DRenderer, P as CSS3DObject, He as CSS3DPlugin, L as CSS3DRenderer, de as CSS3DSprite, Le as DynamicPathLinePlugin, Vt as GaussianSplattingEntranceAnimationPlugin, Ht as InstancedPrefabBufferGeometry, ce as ItemMaskPlugin, Lt as Object3DHelperController, Rt as Object3DHelperPlugin, A as OrbitControls, he as OrientationPlugin, ke as PanoAnimePlugin, Wt as PointBufferGeometry, Ut as PrefabBufferGeometry, z as RoundedBoxGeometry, be as TrajectoryPlugin, Kt as calculatePath2DLength, Gt as calculatePath3DLength };