chunk-ZAYNNKM4.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. import {
  2. computed,
  3. createRenderer,
  4. defineComponent,
  5. getCurrentInstance,
  6. getCurrentScope,
  7. h,
  8. inject,
  9. nextTick,
  10. onMounted,
  11. onScopeDispose,
  12. onUnmounted,
  13. provide,
  14. readonly,
  15. ref,
  16. shallowReactive,
  17. shallowRef,
  18. toRef,
  19. toRefs,
  20. unref,
  21. watch,
  22. watchEffect
  23. } from "./chunk-LZPJ5JBW.js";
  24. import {
  25. ACESFilmicToneMapping,
  26. BufferAttribute,
  27. Clock,
  28. Color,
  29. LinearEncoding,
  30. LoadingManager,
  31. MathUtils,
  32. NoToneMapping,
  33. OrthographicCamera,
  34. PCFShadowMap,
  35. PCFSoftShadowMap,
  36. PerspectiveCamera,
  37. Raycaster,
  38. Scene,
  39. TextureLoader,
  40. Vector2,
  41. WebGLRenderer,
  42. sRGBEncoding,
  43. three_module_exports
  44. } from "./chunk-4QXXOI63.js";
  45. // node_modules/.pnpm/@vueuse+shared@9.13.0/node_modules/@vueuse/shared/index.mjs
  46. var _a;
  47. var isClient = typeof window !== "undefined";
  48. var isFunction = (val) => typeof val === "function";
  49. var isString = (val) => typeof val === "string";
  50. var noop = () => {
  51. };
  52. var isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  53. function resolveUnref(r) {
  54. return typeof r === "function" ? r() : unref(r);
  55. }
  56. function identity(arg) {
  57. return arg;
  58. }
  59. function tryOnScopeDispose(fn) {
  60. if (getCurrentScope()) {
  61. onScopeDispose(fn);
  62. return true;
  63. }
  64. return false;
  65. }
  66. function createEventHook() {
  67. const fns = [];
  68. const off = (fn) => {
  69. const index = fns.indexOf(fn);
  70. if (index !== -1)
  71. fns.splice(index, 1);
  72. };
  73. const on = (fn) => {
  74. fns.push(fn);
  75. const offFn = () => off(fn);
  76. tryOnScopeDispose(offFn);
  77. return {
  78. off: offFn
  79. };
  80. };
  81. const trigger = (param) => {
  82. fns.forEach((fn) => fn(param));
  83. };
  84. return {
  85. on,
  86. off,
  87. trigger
  88. };
  89. }
  90. function tryOnMounted(fn, sync = true) {
  91. if (getCurrentInstance())
  92. onMounted(fn);
  93. else if (sync)
  94. fn();
  95. else
  96. nextTick(fn);
  97. }
  98. // node_modules/.pnpm/@vueuse+core@9.13.0/node_modules/@vueuse/core/index.mjs
  99. function unrefElement(elRef) {
  100. var _a2;
  101. const plain = resolveUnref(elRef);
  102. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  103. }
  104. var defaultWindow = isClient ? window : void 0;
  105. var defaultDocument = isClient ? window.document : void 0;
  106. var defaultNavigator = isClient ? window.navigator : void 0;
  107. var defaultLocation = isClient ? window.location : void 0;
  108. function useEventListener(...args) {
  109. let target;
  110. let events;
  111. let listeners;
  112. let options;
  113. if (isString(args[0]) || Array.isArray(args[0])) {
  114. [events, listeners, options] = args;
  115. target = defaultWindow;
  116. } else {
  117. [target, events, listeners, options] = args;
  118. }
  119. if (!target)
  120. return noop;
  121. if (!Array.isArray(events))
  122. events = [events];
  123. if (!Array.isArray(listeners))
  124. listeners = [listeners];
  125. const cleanups = [];
  126. const cleanup = () => {
  127. cleanups.forEach((fn) => fn());
  128. cleanups.length = 0;
  129. };
  130. const register = (el, event, listener, options2) => {
  131. el.addEventListener(event, listener, options2);
  132. return () => el.removeEventListener(event, listener, options2);
  133. };
  134. const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
  135. cleanup();
  136. if (!el)
  137. return;
  138. cleanups.push(...events.flatMap((event) => {
  139. return listeners.map((listener) => register(el, event, listener, options2));
  140. }));
  141. }, { immediate: true, flush: "post" });
  142. const stop = () => {
  143. stopWatch();
  144. cleanup();
  145. };
  146. tryOnScopeDispose(stop);
  147. return stop;
  148. }
  149. function useSupported(callback, sync = false) {
  150. const isSupported = ref();
  151. const update = () => isSupported.value = Boolean(callback());
  152. update();
  153. tryOnMounted(update, sync);
  154. return isSupported;
  155. }
  156. var _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  157. var globalKey = "__vueuse_ssr_handlers__";
  158. _global[globalKey] = _global[globalKey] || {};
  159. var handlers = _global[globalKey];
  160. function useDevicePixelRatio({
  161. window: window2 = defaultWindow
  162. } = {}) {
  163. const pixelRatio = ref(1);
  164. if (window2) {
  165. let observe = function() {
  166. pixelRatio.value = window2.devicePixelRatio;
  167. cleanup();
  168. media = window2.matchMedia(`(resolution: ${pixelRatio.value}dppx)`);
  169. media.addEventListener("change", observe, { once: true });
  170. }, cleanup = function() {
  171. media == null ? void 0 : media.removeEventListener("change", observe);
  172. };
  173. let media;
  174. observe();
  175. tryOnScopeDispose(cleanup);
  176. }
  177. return { pixelRatio };
  178. }
  179. var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
  180. var __hasOwnProp$g = Object.prototype.hasOwnProperty;
  181. var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
  182. var __objRest$2 = (source, exclude) => {
  183. var target = {};
  184. for (var prop in source)
  185. if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
  186. target[prop] = source[prop];
  187. if (source != null && __getOwnPropSymbols$g)
  188. for (var prop of __getOwnPropSymbols$g(source)) {
  189. if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
  190. target[prop] = source[prop];
  191. }
  192. return target;
  193. };
  194. function useResizeObserver(target, callback, options = {}) {
  195. const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  196. let observer;
  197. const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
  198. const cleanup = () => {
  199. if (observer) {
  200. observer.disconnect();
  201. observer = void 0;
  202. }
  203. };
  204. const stopWatch = watch(() => unrefElement(target), (el) => {
  205. cleanup();
  206. if (isSupported.value && window2 && el) {
  207. observer = new ResizeObserver(callback);
  208. observer.observe(el, observerOptions);
  209. }
  210. }, { immediate: true, flush: "post" });
  211. const stop = () => {
  212. cleanup();
  213. stopWatch();
  214. };
  215. tryOnScopeDispose(stop);
  216. return {
  217. isSupported,
  218. stop
  219. };
  220. }
  221. function useRafFn(fn, options = {}) {
  222. const {
  223. immediate = true,
  224. window: window2 = defaultWindow
  225. } = options;
  226. const isActive = ref(false);
  227. let previousFrameTimestamp = 0;
  228. let rafId = null;
  229. function loop(timestamp2) {
  230. if (!isActive.value || !window2)
  231. return;
  232. const delta = timestamp2 - previousFrameTimestamp;
  233. fn({ delta, timestamp: timestamp2 });
  234. previousFrameTimestamp = timestamp2;
  235. rafId = window2.requestAnimationFrame(loop);
  236. }
  237. function resume() {
  238. if (!isActive.value && window2) {
  239. isActive.value = true;
  240. rafId = window2.requestAnimationFrame(loop);
  241. }
  242. }
  243. function pause() {
  244. isActive.value = false;
  245. if (rafId != null && window2) {
  246. window2.cancelAnimationFrame(rafId);
  247. rafId = null;
  248. }
  249. }
  250. if (immediate)
  251. resume();
  252. tryOnScopeDispose(pause);
  253. return {
  254. isActive: readonly(isActive),
  255. pause,
  256. resume
  257. };
  258. }
  259. function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
  260. const { window: window2 = defaultWindow, box = "content-box" } = options;
  261. const isSVG = computed(() => {
  262. var _a2, _b;
  263. return (_b = (_a2 = unrefElement(target)) == null ? void 0 : _a2.namespaceURI) == null ? void 0 : _b.includes("svg");
  264. });
  265. const width = ref(initialSize.width);
  266. const height = ref(initialSize.height);
  267. useResizeObserver(target, ([entry]) => {
  268. const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
  269. if (window2 && isSVG.value) {
  270. const $elem = unrefElement(target);
  271. if ($elem) {
  272. const styles = window2.getComputedStyle($elem);
  273. width.value = parseFloat(styles.width);
  274. height.value = parseFloat(styles.height);
  275. }
  276. } else {
  277. if (boxSize) {
  278. const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
  279. width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
  280. height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
  281. } else {
  282. width.value = entry.contentRect.width;
  283. height.value = entry.contentRect.height;
  284. }
  285. }
  286. }, options);
  287. watch(() => unrefElement(target), (ele) => {
  288. width.value = ele ? initialSize.width : 0;
  289. height.value = ele ? initialSize.height : 0;
  290. });
  291. return {
  292. width,
  293. height
  294. };
  295. }
  296. var defaultState = {
  297. x: 0,
  298. y: 0,
  299. pointerId: 0,
  300. pressure: 0,
  301. tiltX: 0,
  302. tiltY: 0,
  303. width: 0,
  304. height: 0,
  305. twist: 0,
  306. pointerType: null
  307. };
  308. var keys = Object.keys(defaultState);
  309. var SwipeDirection;
  310. (function(SwipeDirection2) {
  311. SwipeDirection2["UP"] = "UP";
  312. SwipeDirection2["RIGHT"] = "RIGHT";
  313. SwipeDirection2["DOWN"] = "DOWN";
  314. SwipeDirection2["LEFT"] = "LEFT";
  315. SwipeDirection2["NONE"] = "NONE";
  316. })(SwipeDirection || (SwipeDirection = {}));
  317. var __defProp = Object.defineProperty;
  318. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  319. var __hasOwnProp = Object.prototype.hasOwnProperty;
  320. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  321. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  322. var __spreadValues = (a, b) => {
  323. for (var prop in b || (b = {}))
  324. if (__hasOwnProp.call(b, prop))
  325. __defNormalProp(a, prop, b[prop]);
  326. if (__getOwnPropSymbols)
  327. for (var prop of __getOwnPropSymbols(b)) {
  328. if (__propIsEnum.call(b, prop))
  329. __defNormalProp(a, prop, b[prop]);
  330. }
  331. return a;
  332. };
  333. var _TransitionPresets = {
  334. easeInSine: [0.12, 0, 0.39, 0],
  335. easeOutSine: [0.61, 1, 0.88, 1],
  336. easeInOutSine: [0.37, 0, 0.63, 1],
  337. easeInQuad: [0.11, 0, 0.5, 0],
  338. easeOutQuad: [0.5, 1, 0.89, 1],
  339. easeInOutQuad: [0.45, 0, 0.55, 1],
  340. easeInCubic: [0.32, 0, 0.67, 0],
  341. easeOutCubic: [0.33, 1, 0.68, 1],
  342. easeInOutCubic: [0.65, 0, 0.35, 1],
  343. easeInQuart: [0.5, 0, 0.75, 0],
  344. easeOutQuart: [0.25, 1, 0.5, 1],
  345. easeInOutQuart: [0.76, 0, 0.24, 1],
  346. easeInQuint: [0.64, 0, 0.78, 0],
  347. easeOutQuint: [0.22, 1, 0.36, 1],
  348. easeInOutQuint: [0.83, 0, 0.17, 1],
  349. easeInExpo: [0.7, 0, 0.84, 0],
  350. easeOutExpo: [0.16, 1, 0.3, 1],
  351. easeInOutExpo: [0.87, 0, 0.13, 1],
  352. easeInCirc: [0.55, 0, 1, 0.45],
  353. easeOutCirc: [0, 0.55, 0.45, 1],
  354. easeInOutCirc: [0.85, 0, 0.15, 1],
  355. easeInBack: [0.36, 0, 0.66, -0.56],
  356. easeOutBack: [0.34, 1.56, 0.64, 1],
  357. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  358. };
  359. var TransitionPresets = __spreadValues({
  360. linear: identity
  361. }, _TransitionPresets);
  362. function useWindowSize(options = {}) {
  363. const {
  364. window: window2 = defaultWindow,
  365. initialWidth = Infinity,
  366. initialHeight = Infinity,
  367. listenOrientation = true,
  368. includeScrollbar = true
  369. } = options;
  370. const width = ref(initialWidth);
  371. const height = ref(initialHeight);
  372. const update = () => {
  373. if (window2) {
  374. if (includeScrollbar) {
  375. width.value = window2.innerWidth;
  376. height.value = window2.innerHeight;
  377. } else {
  378. width.value = window2.document.documentElement.clientWidth;
  379. height.value = window2.document.documentElement.clientHeight;
  380. }
  381. }
  382. };
  383. update();
  384. tryOnMounted(update);
  385. useEventListener("resize", update, { passive: true });
  386. if (listenOrientation)
  387. useEventListener("orientationchange", update, { passive: true });
  388. return { width, height };
  389. }
  390. // node_modules/.pnpm/@tresjs+core@2.0.0-beta.2_three@0.150.1/node_modules/@tresjs/core/dist/tres.js
  391. var N = ref({ uuid: MathUtils.generateUUID() });
  392. var ve = (e) => void Object.assign(N.value, e);
  393. var Xe = ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(Xe || {});
  394. var Je = 45;
  395. var L;
  396. function q() {
  397. const { state: e, setState: t, aspectRatio: r } = k();
  398. function a(o = "Perspective", c) {
  399. var l, v, d;
  400. if (o === "Perspective") {
  401. const { near: f, far: M, fov: h2 } = c || {
  402. near: 0.1,
  403. far: 1e3,
  404. fov: Je
  405. };
  406. L = new PerspectiveCamera(h2, ((l = e.aspectRatio) == null ? void 0 : l.value) || window.innerWidth / window.innerHeight, f, M), (v = e.cameras) == null || v.push(L);
  407. } else {
  408. const { left: f, right: M, top: h2, bottom: C, near: g, far: p } = c || {
  409. left: -100,
  410. right: 100,
  411. top: 100,
  412. bottom: -100,
  413. near: 0.1,
  414. far: 1e3
  415. };
  416. L = new OrthographicCamera(f, M, h2, C, g, p), (d = e.cameras) == null || d.push(L);
  417. }
  418. return e.camera = L, t("camera", e.camera), L;
  419. }
  420. function n() {
  421. var o;
  422. e.camera instanceof PerspectiveCamera && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (o = e.camera) == null || o.updateProjectionMatrix();
  423. }
  424. function i(o) {
  425. var c;
  426. (c = e.cameras) == null || c.push(o), o instanceof PerspectiveCamera && e.aspectRatio && (o.aspect = e.aspectRatio.value), o.updateProjectionMatrix(), t("camera", o);
  427. }
  428. function s() {
  429. e.cameras = [];
  430. }
  431. return watchEffect(() => {
  432. r != null && r.value && n();
  433. }), {
  434. activeCamera: toRef(e, "camera"),
  435. createCamera: a,
  436. updateCamera: n,
  437. pushCamera: i,
  438. clearCameras: s
  439. };
  440. }
  441. var he = createEventHook();
  442. var ge = createEventHook();
  443. var Y = createEventHook();
  444. var R = new Clock();
  445. var D = 0;
  446. var W = 0;
  447. var { pause: Qe, resume: Ze, isActive: et } = useRafFn(
  448. () => {
  449. he.trigger({ delta: D, elapsed: W, clock: R }), ge.trigger({ delta: D, elapsed: W, clock: R }), Y.trigger({ delta: D, elapsed: W, clock: R });
  450. },
  451. { immediate: false }
  452. );
  453. Y.on(() => {
  454. D = R.getDelta(), W = R.getElapsedTime();
  455. });
  456. function we() {
  457. return {
  458. onBeforeLoop: he.on,
  459. onLoop: ge.on,
  460. onAfterLoop: Y.on,
  461. pause: Qe,
  462. resume: Ze,
  463. isActive: et
  464. };
  465. }
  466. function tt(e) {
  467. return e instanceof Color ? e : Array.isArray(e) ? new Color(...e) : new Color(e);
  468. }
  469. var G = {
  470. realistic: {
  471. outputEncoding: sRGBEncoding,
  472. toneMapping: ACESFilmicToneMapping,
  473. toneMappingExposure: 3,
  474. shadowMap: {
  475. enabled: true,
  476. type: PCFSoftShadowMap
  477. }
  478. }
  479. };
  480. var be = (e, t) => {
  481. for (const r of Object.keys(t))
  482. t[r] instanceof Object && Object.assign(t[r], be(e[r], t[r]));
  483. return Object.assign(e || {}, t), e;
  484. };
  485. var nt = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
  486. var at = rt(nt);
  487. function _(e) {
  488. return e.replace(/-([a-z])/g, (t, r) => r.toUpperCase());
  489. }
  490. function rt(e, t) {
  491. const r = /* @__PURE__ */ Object.create(null), a = e.split(",");
  492. for (let n = 0; n < a.length; n++)
  493. r[a[n]] = true;
  494. return t ? (n) => !!r[n.toLowerCase()] : (n) => !!r[n];
  495. }
  496. function ot(e) {
  497. var ee, te;
  498. const t = shallowRef(), r = ref(false), {
  499. alpha: a = true,
  500. antialias: n = true,
  501. depth: i,
  502. logarithmicDepthBuffer: s,
  503. failIfMajorPerformanceCaveat: o,
  504. precision: c,
  505. premultipliedAlpha: l,
  506. stencil: v,
  507. shadows: d = false,
  508. shadowMapType: f = PCFShadowMap,
  509. physicallyCorrectLights: M = false,
  510. useLegacyLights: h2 = false,
  511. outputEncoding: C = LinearEncoding,
  512. toneMapping: g = NoToneMapping,
  513. toneMappingExposure: p = 1,
  514. context: b = void 0,
  515. powerPreference: y = "default",
  516. preserveDrawingBuffer: O = false,
  517. clearColor: w,
  518. windowSize: T = false,
  519. preset: j = void 0
  520. } = toRefs(e), { state: x, setState: F } = k(), { width: K, height: X } = resolveUnref(T) ? useWindowSize() : useElementSize(x.container), { logError: Me, logWarning: Ce } = A(), { pixelRatio: J } = useDevicePixelRatio(), { pause: Ee, resume: Le } = we(), I = computed(() => K.value / X.value);
  521. !resolveUnref(T) && ((te = (ee = x.container) == null ? void 0 : ee.value) == null ? void 0 : te.offsetHeight) === 0 && Ce(`Oops... Seems like your canvas height is currently 0px, by default it takes the height of it's parent, so make sure it has some height with CSS.
  522. You could set windowSize=true to force the canvas to be the size of the window.`);
  523. const Q = () => {
  524. t.value && (t.value.setSize(K.value, X.value), t.value.setPixelRatio(Math.min(J.value, 2)));
  525. }, Z = () => {
  526. if (!t.value)
  527. return;
  528. const E = resolveUnref(j);
  529. if (E) {
  530. E in G || Me("Renderer Preset must be one of these: " + Object.keys(G).join(", ")), be(t.value, G[E]);
  531. return;
  532. }
  533. t.value.shadowMap.enabled = resolveUnref(d), t.value.shadowMap.type = resolveUnref(f), t.value.toneMapping = resolveUnref(g) || NoToneMapping, t.value.toneMappingExposure = resolveUnref(p), t.value.outputEncoding = resolveUnref(C) || LinearEncoding, w != null && w.value && t.value.setClearColor(tt(resolveUnref(w))), t.value.useLegacyLights = resolveUnref(h2);
  534. }, Se = () => {
  535. const E = unrefElement(x.canvas);
  536. E && (t.value = new WebGLRenderer({
  537. canvas: E,
  538. alpha: resolveUnref(a),
  539. antialias: resolveUnref(n),
  540. context: resolveUnref(b),
  541. depth: resolveUnref(i),
  542. failIfMajorPerformanceCaveat: resolveUnref(o),
  543. logarithmicDepthBuffer: resolveUnref(s),
  544. powerPreference: resolveUnref(y),
  545. precision: resolveUnref(c),
  546. stencil: resolveUnref(v),
  547. preserveDrawingBuffer: resolveUnref(O),
  548. premultipliedAlpha: resolveUnref(l)
  549. }), F("renderer", t.value), F("clock", new Clock()), F("aspectRatio", I), Z(), Q(), Le(), r.value = true);
  550. }, Te = () => {
  551. t.value && (t.value.dispose(), t.value = void 0, r.value = false, Ee());
  552. };
  553. return watch([I, J], Q), watch(
  554. [d, f, C, h2, g, p, w],
  555. Z
  556. ), watch(
  557. () => [x.canvas, x.container],
  558. () => {
  559. unrefElement(x.canvas) && unrefElement(x.container) && Se();
  560. },
  561. { immediate: true, deep: true }
  562. ), {
  563. renderer: t,
  564. isReady: r,
  565. dispose: Te,
  566. aspectRatio: I
  567. };
  568. }
  569. var ye = (e) => !!e && e.constructor === Array;
  570. function it(e) {
  571. const t = { nodes: {}, materials: {} };
  572. return e && e.traverse((r) => {
  573. r.name && (t.nodes[r.name] = r), r.material && !t.materials[r.material.name] && (t.materials[r.material.name] = r.material);
  574. }), t;
  575. }
  576. async function Mt(e, t, r, a, n) {
  577. const { logError: i } = A(), s = new e();
  578. n && n(s), r && r(s);
  579. const c = (Array.isArray(t) ? t : [t]).map(
  580. (l) => new Promise((v, d) => {
  581. s.load(
  582. l,
  583. (f) => {
  584. f.scene && Object.assign(f, it(f.scene)), v(f);
  585. },
  586. a,
  587. (f) => d(i("[useLoader] - Failed to load resource", f))
  588. );
  589. })
  590. );
  591. return ye(t) ? await Promise.all(c) : await c[0];
  592. }
  593. async function Ct(e) {
  594. const t = new LoadingManager(), r = new TextureLoader(t), a = (n) => new Promise((i, s) => {
  595. r.load(
  596. n,
  597. (o) => i(o),
  598. () => null,
  599. () => {
  600. s(new Error("[useTextures] - Failed to load texture"));
  601. }
  602. );
  603. });
  604. if (ye(e)) {
  605. const n = await Promise.all(e.map((i) => a(i)));
  606. return e.length > 1 ? n : n[0];
  607. } else {
  608. const {
  609. map: n,
  610. displacementMap: i,
  611. normalMap: s,
  612. roughnessMap: o,
  613. metalnessMap: c,
  614. aoMap: l,
  615. alphaMap: v,
  616. matcap: d
  617. } = e;
  618. return {
  619. map: n ? await a(n) : null,
  620. displacementMap: i ? await a(i) : null,
  621. normalMap: s ? await a(s) : null,
  622. roughnessMap: o ? await a(o) : null,
  623. metalnessMap: c ? await a(c) : null,
  624. aoMap: l ? await a(l) : null,
  625. alphaMap: v ? await a(v) : null,
  626. matcap: d ? await a(d) : null
  627. };
  628. }
  629. }
  630. var m = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
  631. function st() {
  632. const e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, r = Math.random() * 4294967295 | 0, a = Math.random() * 4294967295 | 0;
  633. return (m[e & 255] + m[e >> 8 & 255] + m[e >> 16 & 255] + m[e >> 24 & 255] + "-" + m[t & 255] + m[t >> 8 & 255] + "-" + m[t >> 16 & 15 | 64] + m[t >> 24 & 255] + "-" + m[r & 63 | 128] + m[r >> 8 & 255] + "-" + m[r >> 16 & 255] + m[r >> 24 & 255] + m[a & 255] + m[a >> 8 & 255] + m[a >> 16 & 255] + m[a >> 24 & 255]).toLowerCase();
  634. }
  635. var xe = Symbol();
  636. function ct() {
  637. const e = shallowReactive({
  638. uuid: st(),
  639. camera: void 0,
  640. cameras: [],
  641. scene: void 0,
  642. renderer: void 0,
  643. aspectRatio: computed(() => window.innerWidth / window.innerHeight)
  644. });
  645. function t(n) {
  646. return e[n];
  647. }
  648. function r(n, i) {
  649. e[n] = i;
  650. }
  651. const a = {
  652. state: e,
  653. ...toRefs(e),
  654. getState: t,
  655. setState: r
  656. };
  657. return provide(xe, a), a;
  658. }
  659. var k = () => inject(xe, {
  660. state: shallowReactive({
  661. camera: void 0,
  662. cameras: [],
  663. scene: void 0,
  664. renderer: void 0
  665. })
  666. });
  667. function ut() {
  668. var s;
  669. const e = shallowRef(new Raycaster()), t = ref(new Vector2()), r = ref(null), { setState: a, state: n } = k();
  670. a("raycaster", e.value), a("pointer", t), a("currentInstance", r);
  671. function i(o) {
  672. t.value.x = o.clientX / window.innerWidth * 2 - 1, t.value.y = -(o.clientY / window.innerHeight) * 2 + 1;
  673. }
  674. return (s = n == null ? void 0 : n.renderer) == null || s.domElement.addEventListener("pointermove", i), onUnmounted(() => {
  675. var o;
  676. (o = n == null ? void 0 : n.renderer) == null || o.domElement.removeEventListener("pointermove", i);
  677. }), {
  678. raycaster: e,
  679. pointer: t
  680. };
  681. }
  682. var Et = true;
  683. var oe = "[TresJS ▲ ■ ●] ";
  684. function A() {
  685. function e(a, n) {
  686. console.error(`${oe} ${a}`, n || "");
  687. }
  688. function t(a) {
  689. console.warn(`${oe} ${a}`);
  690. }
  691. function r(a, n) {
  692. }
  693. return {
  694. logError: e,
  695. logWarning: t,
  696. logMessage: r
  697. };
  698. }
  699. function Lt() {
  700. const { logWarning: e } = A();
  701. function t(a, n, i) {
  702. let s = null;
  703. return a.traverse((o) => {
  704. o[n] === i && (s = o);
  705. }), s || e(`Child with ${n} '${i}' not found.`), s;
  706. }
  707. function r(a, n) {
  708. return t(a, "name", n);
  709. }
  710. return {
  711. seek: t,
  712. seekByName: r
  713. };
  714. }
  715. var { logWarning: lt } = A();
  716. var ft = /^on[^a-z]/;
  717. var dt = (e) => ft.test(e);
  718. var z = null;
  719. var pt = {
  720. createElement(e, t, r, a) {
  721. if (e === "template" || at(e))
  722. return null;
  723. let n;
  724. if (a === null && (a = {}), a != null && a.args ? n = new N.value[e.replace("Tres", "")](...a.args) : n = new N.value[e.replace("Tres", "")](), n.isCamera) {
  725. (!(a != null && a.position) || a != null && a.position.every((s) => s == 0)) && lt(
  726. // eslint-disable-next-line max-len
  727. "Camera is positioned at the center of the scene [0,0,0], if this is not intentional try setting a position if your scene seems empty 🤗"
  728. );
  729. const { pushCamera: i } = q();
  730. i(n);
  731. }
  732. return (a == null ? void 0 : a.attach) === void 0 && (n.isMaterial ? n.attach = "material" : n.isBufferGeometry && (n.attach = "geometry")), n.events = {}, n;
  733. },
  734. insert(e, t, r) {
  735. if (z === null && t.isScene && (z = t), t === null && (t = z), t != null && t.isObject3D && (e != null && e.isObject3D)) {
  736. const a = r ? t.children.indexOf(r) : 0;
  737. e.parent = t, t.children.splice(a, 0, e), e.dispatchEvent({ type: "added" });
  738. } else
  739. typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
  740. },
  741. remove(e) {
  742. if (!e)
  743. return;
  744. const t = e.parentNode;
  745. t && t.removeChild(e);
  746. },
  747. patchProp(e, t, r, a) {
  748. if (e) {
  749. let n = e, i = t;
  750. const s = _(i);
  751. let o = n == null ? void 0 : n[s];
  752. if (e.parent || (e.parent = z), n.type === "BufferGeometry") {
  753. n.setAttribute(
  754. _(i),
  755. new BufferAttribute(...a)
  756. );
  757. return;
  758. }
  759. if (i.includes("-") && o === void 0) {
  760. const l = i.split("-");
  761. o = l.reduce((v, d) => v[_(d)], n), i = l.pop(), o != null && o.set || (n = l.reduce((v, d) => v[_(d)], n));
  762. }
  763. dt(i) && (e.events[i] = a);
  764. let c = a;
  765. if (c === "" && (c = true), isFunction(o)) {
  766. Array.isArray(c) ? e[s](...c) : e[s](c);
  767. return;
  768. }
  769. !(o != null && o.set) && !isFunction(o) ? n[s] = c : o.constructor === c.constructor && (o != null && o.copy) ? o == null || o.copy(c) : Array.isArray(c) ? o.set(...c) : !o.isColor && o.setScalar ? o.setScalar(c) : o.set(c);
  770. }
  771. },
  772. parentNode(e) {
  773. return (e == null ? void 0 : e.parent) || null;
  774. },
  775. createText: () => void 0,
  776. createComment: () => void 0,
  777. setText: () => void 0,
  778. setElementText: () => void 0,
  779. nextSibling: () => void 0,
  780. querySelector: () => void 0,
  781. setScopeId: () => void 0,
  782. cloneNode: () => void 0,
  783. insertStaticContent: () => void 0
  784. };
  785. var { createApp: mt } = createRenderer(pt);
  786. var vt = (e) => {
  787. const t = mt(r);
  788. function r() {
  789. return e && e.default ? e.default() : [];
  790. }
  791. return t;
  792. };
  793. ve(three_module_exports);
  794. var { logWarning: ht } = A();
  795. var gt = defineComponent({
  796. name: "TresScene",
  797. props: [
  798. "shadows",
  799. "shadowMapType",
  800. "physicallyCorrectLights",
  801. "useLegacyLights",
  802. "outputEncoding",
  803. "toneMapping",
  804. "toneMappingExposure",
  805. "context",
  806. "powerPreference",
  807. "preserveDrawingBuffer",
  808. "clearColor",
  809. "windowSize",
  810. "preset"
  811. ],
  812. setup(e, { slots: t, expose: r }) {
  813. e.physicallyCorrectLights === true && ht("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
  814. const a = ref(), n = ref(), i = new Scene(), { setState: s } = k();
  815. s("scene", i), s("canvas", n), s("container", a);
  816. const { pushCamera: o } = q();
  817. o(new PerspectiveCamera()), onMounted(() => {
  818. c();
  819. }), onUnmounted(() => {
  820. s("renderer", null);
  821. });
  822. function c() {
  823. const { renderer: d } = ot(e), { activeCamera: f } = q(), { onLoop: M } = we(), { raycaster: h2, pointer: C } = ut();
  824. let g = null, p = null;
  825. watchEffect(() => {
  826. f.value && h2.value.setFromCamera(C.value, f.value);
  827. }), M(() => {
  828. var b, y, O, w, T;
  829. if (f.value && ((b = d.value) == null || b.render(i, f.value)), h2.value) {
  830. const j = h2.value.intersectObjects(i.children);
  831. j.length > 0 ? (p = j[0], g === null && ((O = (y = p.object.events).onPointerEnter) == null || O.call(y, p))) : g !== null && ((T = p == null ? void 0 : (w = p.object.events).onPointerLeave) == null || T.call(w, g), p = null), g = p;
  832. }
  833. }), useEventListener(n.value, "click", () => {
  834. var b, y;
  835. p !== null && ((y = (b = p.object.events).onClick) == null || y.call(b, p));
  836. });
  837. }
  838. let l;
  839. function v() {
  840. l = vt(t), l.provide("useTres", k()), l.provide("extend", ve), l.mount(i);
  841. }
  842. return v(), r({
  843. scene: i
  844. }), () => h(
  845. h(
  846. "div",
  847. {
  848. ref: a,
  849. "data-scene": i.uuid,
  850. key: i.uuid,
  851. style: {
  852. position: "relative",
  853. width: "100%",
  854. height: "100%",
  855. pointerEvents: "auto",
  856. touchAction: "none"
  857. }
  858. },
  859. [
  860. h(
  861. "div",
  862. {
  863. style: {
  864. width: "100%",
  865. height: "100%"
  866. }
  867. },
  868. [
  869. h("canvas", {
  870. ref: n,
  871. "data-scene": i.uuid,
  872. style: {
  873. display: "block",
  874. width: "100%",
  875. height: "100%",
  876. position: e.windowSize ? "fixed" : "absolute",
  877. top: 0,
  878. left: 0
  879. }
  880. })
  881. ]
  882. )
  883. ]
  884. )
  885. );
  886. }
  887. });
  888. var wt = defineComponent({
  889. name: "TresCanvas",
  890. props: [
  891. "shadows",
  892. "shadowMapType",
  893. "physicallyCorrectLights",
  894. "useLegacyLights",
  895. "outputEncoding",
  896. "toneMapping",
  897. "toneMappingExposure",
  898. "context",
  899. "powerPreference",
  900. "preserveDrawingBuffer",
  901. "clearColor",
  902. "windowSize",
  903. "preset"
  904. ],
  905. setup(e, { slots: t, expose: r }) {
  906. const a = ct();
  907. return r(a), () => h(gt, e, t);
  908. }
  909. });
  910. var St = {
  911. install(e) {
  912. e.component("TresCanvas", wt);
  913. }
  914. };
  915. export {
  916. N,
  917. ve,
  918. Xe,
  919. q,
  920. we,
  921. ot,
  922. it,
  923. Mt,
  924. Ct,
  925. ct,
  926. k,
  927. ut,
  928. Et,
  929. A,
  930. Lt,
  931. wt,
  932. St
  933. };
  934. //# sourceMappingURL=chunk-ZAYNNKM4.js.map