1
0

chunk-DESKY23Y.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957
  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_vue@3.2.47/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_vue@3.2.47/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.5_three@0.150.1_vue@3.2.47/node_modules/@tresjs/core/dist/tres.js
  391. var he = ref({ uuid: MathUtils.generateUUID() });
  392. var we = (e) => void Object.assign(he.value, e);
  393. var Qe = ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(Qe || {});
  394. var Ze = 45;
  395. var _;
  396. function N() {
  397. const { state: e, setState: t, aspectRatio: o } = D();
  398. function a(i = "Perspective", c) {
  399. var u, f, m;
  400. if (i === "Perspective") {
  401. const { near: d, far: P, fov: g } = c || {
  402. near: 0.1,
  403. far: 1e3,
  404. fov: Ze
  405. };
  406. _ = new PerspectiveCamera(g, ((u = e.aspectRatio) == null ? void 0 : u.value) || window.innerWidth / window.innerHeight, d, P), (f = e.cameras) == null || f.push(_);
  407. } else {
  408. const { left: d, right: P, top: g, bottom: R, near: w, far: p } = c || {
  409. left: -100,
  410. right: 100,
  411. top: 100,
  412. bottom: -100,
  413. near: 0.1,
  414. far: 1e3
  415. };
  416. _ = new OrthographicCamera(d, P, g, R, w, p), (m = e.cameras) == null || m.push(_);
  417. }
  418. return e.camera = _, t("camera", e.camera), _;
  419. }
  420. function n() {
  421. var i;
  422. e.camera instanceof PerspectiveCamera && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (i = e.camera) == null || i.updateProjectionMatrix();
  423. }
  424. function r(i) {
  425. var c;
  426. (c = e.cameras) == null || c.push(i), i instanceof PerspectiveCamera && e.aspectRatio && (i.aspect = e.aspectRatio.value), i.updateProjectionMatrix(), t("camera", i);
  427. }
  428. function s() {
  429. e.cameras = [];
  430. }
  431. return watchEffect(() => {
  432. o != null && o.value && n();
  433. }), {
  434. activeCamera: toRef(e, "camera"),
  435. createCamera: a,
  436. updateCamera: n,
  437. pushCamera: r,
  438. clearCameras: s
  439. };
  440. }
  441. var be = createEventHook();
  442. var ye = createEventHook();
  443. var K = createEventHook();
  444. var j = new Clock();
  445. var G = 0;
  446. var V = 0;
  447. var { pause: et, resume: tt, isActive: at } = useRafFn(
  448. () => {
  449. be.trigger({ delta: G, elapsed: V, clock: j }), ye.trigger({ delta: G, elapsed: V, clock: j }), K.trigger({ delta: G, elapsed: V, clock: j });
  450. },
  451. { immediate: false }
  452. );
  453. K.on(() => {
  454. G = j.getDelta(), V = j.getElapsedTime();
  455. });
  456. function Me() {
  457. return {
  458. onBeforeLoop: be.on,
  459. onLoop: ye.on,
  460. onAfterLoop: K.on,
  461. pause: et,
  462. resume: tt,
  463. isActive: at
  464. };
  465. }
  466. function nt(e) {
  467. return e instanceof Color ? e : Array.isArray(e) ? new Color(...e) : new Color(e);
  468. }
  469. var $ = {
  470. realistic: {
  471. outputEncoding: sRGBEncoding,
  472. toneMapping: ACESFilmicToneMapping,
  473. toneMappingExposure: 3,
  474. shadowMap: {
  475. enabled: true,
  476. type: PCFSoftShadowMap
  477. }
  478. }
  479. };
  480. var xe = (e, t) => {
  481. for (const o of Object.keys(t))
  482. t[o] instanceof Object && Object.assign(t[o], xe(e[o], t[o]));
  483. return Object.assign(e || {}, t), e;
  484. };
  485. var rt = "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 ot = it(rt);
  487. function z(e) {
  488. return e.replace(/-([a-z])/g, (t, o) => o.toUpperCase());
  489. }
  490. function it(e, t) {
  491. const o = /* @__PURE__ */ Object.create(null), a = e.split(",");
  492. for (let n = 0; n < a.length; n++)
  493. o[a[n]] = true;
  494. return t ? (n) => !!o[n.toLowerCase()] : (n) => !!o[n];
  495. }
  496. function st(e) {
  497. var Z, ee;
  498. const t = shallowRef(), o = ref(false), {
  499. alpha: a = true,
  500. antialias: n = true,
  501. depth: r,
  502. logarithmicDepthBuffer: s,
  503. failIfMajorPerformanceCaveat: i,
  504. precision: c,
  505. premultipliedAlpha: u,
  506. stencil: f,
  507. shadows: m = false,
  508. shadowMapType: d = PCFShadowMap,
  509. physicallyCorrectLights: P = false,
  510. useLegacyLights: g = false,
  511. outputEncoding: R = LinearEncoding,
  512. toneMapping: w = NoToneMapping,
  513. toneMappingExposure: p = 1,
  514. context: x = void 0,
  515. powerPreference: b = "default",
  516. preserveDrawingBuffer: y = false,
  517. clearColor: M,
  518. windowSize: E = false,
  519. preset: L = void 0
  520. } = toRefs(e), { state: h2, setState: T } = D(), { width: C, height: O } = resolveUnref(E) == true || resolveUnref(E) === "" || resolveUnref(E) === "true" ? useWindowSize() : useElementSize(h2.container), { logError: B, logWarning: Pe } = I(), { pixelRatio: J } = useDevicePixelRatio(), { pause: Re, resume: Le } = Me(), U = computed(() => C.value / O.value);
  521. !resolveUnref(E) && ((ee = (Z = h2.container) == null ? void 0 : Z.value) == null ? void 0 : ee.offsetHeight) === 0 && Pe(`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 X = () => {
  524. t.value && (t.value.setSize(C.value, O.value), t.value.setPixelRatio(Math.min(J.value, 2)));
  525. }, Q = () => {
  526. if (!t.value)
  527. return;
  528. const A = resolveUnref(L);
  529. if (A) {
  530. A in $ || B("Renderer Preset must be one of these: " + Object.keys($).join(", ")), xe(t.value, $[A]);
  531. return;
  532. }
  533. t.value.shadowMap.enabled = resolveUnref(m), t.value.shadowMap.type = resolveUnref(d), t.value.toneMapping = resolveUnref(w) || NoToneMapping, t.value.toneMappingExposure = resolveUnref(p), t.value.outputEncoding = resolveUnref(R) || LinearEncoding, M != null && M.value && t.value.setClearColor(nt(resolveUnref(M))), t.value.useLegacyLights = resolveUnref(g);
  534. }, Te = () => {
  535. const A = unrefElement(h2.canvas);
  536. A && (t.value = new WebGLRenderer({
  537. canvas: A,
  538. alpha: resolveUnref(a),
  539. antialias: resolveUnref(n),
  540. context: resolveUnref(x),
  541. depth: resolveUnref(r),
  542. failIfMajorPerformanceCaveat: resolveUnref(i),
  543. logarithmicDepthBuffer: resolveUnref(s),
  544. powerPreference: resolveUnref(b),
  545. precision: resolveUnref(c),
  546. stencil: resolveUnref(f),
  547. preserveDrawingBuffer: resolveUnref(y),
  548. premultipliedAlpha: resolveUnref(u)
  549. }), T("renderer", t.value), T("clock", new Clock()), T("aspectRatio", U), Q(), X(), Le(), o.value = true);
  550. }, Ae = () => {
  551. t.value && (t.value.dispose(), t.value = void 0, o.value = false, Re());
  552. };
  553. return watch([U, J], X), watch(
  554. [m, d, R, g, w, p, M],
  555. Q
  556. ), watch(
  557. () => [h2.canvas, h2.container],
  558. () => {
  559. unrefElement(h2.canvas) && unrefElement(h2.container) && Te();
  560. },
  561. { immediate: true, deep: true }
  562. ), {
  563. renderer: t,
  564. isReady: o,
  565. dispose: Ae,
  566. aspectRatio: U
  567. };
  568. }
  569. var Ee = (e) => !!e && e.constructor === Array;
  570. function ct(e) {
  571. const t = { nodes: {}, materials: {} };
  572. return e && e.traverse((o) => {
  573. o.name && (t.nodes[o.name] = o), o.material && !t.materials[o.material.name] && (t.materials[o.material.name] = o.material);
  574. }), t;
  575. }
  576. async function Et(e, t, o, a, n) {
  577. const { logError: r } = I(), s = new e();
  578. n && n(s), o && o(s);
  579. const c = (Array.isArray(t) ? t : [t]).map(
  580. (u) => new Promise((f, m) => {
  581. s.load(
  582. u,
  583. (d) => {
  584. d.scene && Object.assign(d, ct(d.scene)), f(d);
  585. },
  586. a,
  587. (d) => m(r("[useLoader] - Failed to load resource", d))
  588. );
  589. })
  590. );
  591. return Ee(t) ? await Promise.all(c) : await c[0];
  592. }
  593. async function Ct(e) {
  594. const t = new LoadingManager(), o = new TextureLoader(t), a = (n) => new Promise((r, s) => {
  595. o.load(
  596. n,
  597. (i) => r(i),
  598. () => null,
  599. () => {
  600. s(new Error("[useTextures] - Failed to load texture"));
  601. }
  602. );
  603. });
  604. if (Ee(e)) {
  605. const n = await Promise.all(e.map((r) => a(r)));
  606. return e.length > 1 ? n : n[0];
  607. } else {
  608. const {
  609. map: n,
  610. displacementMap: r,
  611. normalMap: s,
  612. roughnessMap: i,
  613. metalnessMap: c,
  614. aoMap: u,
  615. alphaMap: f,
  616. matcap: m
  617. } = e;
  618. return {
  619. map: n ? await a(n) : null,
  620. displacementMap: r ? await a(r) : null,
  621. normalMap: s ? await a(s) : null,
  622. roughnessMap: i ? await a(i) : null,
  623. metalnessMap: c ? await a(c) : null,
  624. aoMap: u ? await a(u) : null,
  625. alphaMap: f ? await a(f) : null,
  626. matcap: m ? await a(m) : null
  627. };
  628. }
  629. }
  630. var v = ["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 ut() {
  632. const e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, o = Math.random() * 4294967295 | 0, a = Math.random() * 4294967295 | 0;
  633. return (v[e & 255] + v[e >> 8 & 255] + v[e >> 16 & 255] + v[e >> 24 & 255] + "-" + v[t & 255] + v[t >> 8 & 255] + "-" + v[t >> 16 & 15 | 64] + v[t >> 24 & 255] + "-" + v[o & 63 | 128] + v[o >> 8 & 255] + "-" + v[o >> 16 & 255] + v[o >> 24 & 255] + v[a & 255] + v[a >> 8 & 255] + v[a >> 16 & 255] + v[a >> 24 & 255]).toLowerCase();
  634. }
  635. var Ce = Symbol();
  636. function ft() {
  637. const e = shallowReactive({
  638. uuid: ut(),
  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 o(n, r) {
  649. e[n] = r;
  650. }
  651. const a = {
  652. state: e,
  653. ...toRefs(e),
  654. getState: t,
  655. setState: o
  656. };
  657. return provide(Ce, a), a;
  658. }
  659. var D = () => inject(Ce, {
  660. state: shallowReactive({
  661. camera: void 0,
  662. cameras: [],
  663. scene: void 0,
  664. renderer: void 0
  665. })
  666. });
  667. function lt() {
  668. var s;
  669. const e = shallowRef(new Raycaster()), t = ref(new Vector2()), o = ref(null), { setState: a, state: n } = D();
  670. a("raycaster", e.value), a("pointer", t), a("currentInstance", o);
  671. function r(i) {
  672. t.value.x = i.clientX / window.innerWidth * 2 - 1, t.value.y = -(i.clientY / window.innerHeight) * 2 + 1;
  673. }
  674. return (s = n == null ? void 0 : n.renderer) == null || s.domElement.addEventListener("pointermove", r), onUnmounted(() => {
  675. var i;
  676. (i = n == null ? void 0 : n.renderer) == null || i.domElement.removeEventListener("pointermove", r);
  677. }), {
  678. raycaster: e,
  679. pointer: t
  680. };
  681. }
  682. var Pt = true;
  683. var re = "[TresJS ▲ ■ ●] ";
  684. function I() {
  685. function e(a, n) {
  686. console.error(`${re} ${a}`, n || "");
  687. }
  688. function t(a) {
  689. console.warn(`${re} ${a}`);
  690. }
  691. function o(a, n) {
  692. }
  693. return {
  694. logError: e,
  695. logWarning: t,
  696. logMessage: o
  697. };
  698. }
  699. function Rt() {
  700. const { logWarning: e } = I();
  701. function t(a, n, r) {
  702. let s = null;
  703. return a.traverse((i) => {
  704. i[n] === r && (s = i);
  705. }), s || e(`Child with ${n} '${r}' not found.`), s;
  706. }
  707. function o(a, n) {
  708. return t(a, "name", n);
  709. }
  710. return {
  711. seek: t,
  712. seekByName: o
  713. };
  714. }
  715. var dt = /^on[^a-z]/;
  716. var pt = (e) => dt.test(e);
  717. var oe = null;
  718. var ie = {
  719. GEOMETRY_VIA_PROP: "tres__geometryViaProp",
  720. MATERIAL_VIA_PROP: "tres__materialViaProp"
  721. };
  722. var { logError: se } = I();
  723. var mt = {
  724. createElement(e, t, o, a) {
  725. var c, u;
  726. if (a || (a = {}), a.args || (a.args = []), e === "template" || ot(e))
  727. return null;
  728. let n = e.replace("Tres", ""), r;
  729. if (e === "primitive") {
  730. (a == null ? void 0 : a.object) === void 0 && se("Tres primitives need a prop 'object'");
  731. const f = a.object;
  732. n = f.type, r = Object.assign(f, { type: n, attach: a.attach, primitive: true });
  733. } else {
  734. const f = he.value[n];
  735. f || se(`${n} is not defined on the THREE namespace. Use extend to add it to the catalog.`), r = Object.assign(new f(...a.args), { type: n, attach: a.attach });
  736. }
  737. if (r.isCamera) {
  738. a != null && a.position || r.position.set(3, 3, 3), a != null && a.lookAt || r.lookAt(0, 0, 0);
  739. const { pushCamera: f } = N();
  740. f(r);
  741. }
  742. (a == null ? void 0 : a.attach) === void 0 && (r.isMaterial ? r.attach = "material" : r.isBufferGeometry && (r.attach = "geometry"));
  743. const { GEOMETRY_VIA_PROP: s, MATERIAL_VIA_PROP: i } = ie;
  744. return r.isObject3D && ((c = a == null ? void 0 : a.material) != null && c.isMaterial && (r.userData[i] = true), (u = a == null ? void 0 : a.geometry) != null && u.isBufferGeometry && (r.userData[s] = true)), r.events = {}, r;
  745. },
  746. insert(e, t) {
  747. var o, a;
  748. if (((e == null ? void 0 : e.__vnode.type) === "TresGroup" || (e == null ? void 0 : e.__vnode.type) === "TresObject3D") && t === null && !((a = (o = e == null ? void 0 : e.__vnode) == null ? void 0 : o.ctx) != null && a.asyncResolved)) {
  749. oe = e;
  750. return;
  751. }
  752. t || (t = oe), e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" })) : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
  753. },
  754. remove(e) {
  755. var t, o;
  756. if (e) {
  757. if (e.isObject3D) {
  758. const a = e, n = (r) => {
  759. var c, u;
  760. const { GEOMETRY_VIA_PROP: s, MATERIAL_VIA_PROP: i } = ie;
  761. r.userData[i] || (c = r.material) == null || c.dispose(), r.userData[s] || (u = r.geometry) == null || u.dispose();
  762. };
  763. a.traverse((r) => n(r)), n(a);
  764. }
  765. (t = e.removeFromParent) == null || t.call(e), (o = e.dispose) == null || o.call(e);
  766. }
  767. },
  768. patchProp(e, t, o, a) {
  769. if (e) {
  770. let n = e, r = t, s = z(r), i = n == null ? void 0 : n[s];
  771. if (n.type === "BufferGeometry") {
  772. n.setAttribute(
  773. z(r),
  774. new BufferAttribute(...a)
  775. );
  776. return;
  777. }
  778. if (r.includes("-") && i === void 0) {
  779. const u = r.split("-");
  780. i = u.reduce((f, m) => f[z(m)], n), r = u.pop(), s = r.toLowerCase(), i != null && i.set || (n = u.reduce((f, m) => f[z(m)], n));
  781. }
  782. pt(r) && (e.events[r] = a);
  783. let c = a;
  784. if (c === "" && (c = true), isFunction(i)) {
  785. Array.isArray(c) ? e[s](...c) : e[s](c);
  786. return;
  787. }
  788. !(i != null && i.set) && !isFunction(i) ? n[s] = c : i.constructor === c.constructor && (i != null && i.copy) ? i == null || i.copy(c) : Array.isArray(c) ? i.set(...c) : !i.isColor && i.setScalar ? i.setScalar(c) : i.set(c);
  789. }
  790. },
  791. parentNode(e) {
  792. return (e == null ? void 0 : e.parent) || null;
  793. },
  794. createText: () => void 0,
  795. createComment: () => void 0,
  796. setText: () => void 0,
  797. setElementText: () => void 0,
  798. nextSibling: () => void 0,
  799. querySelector: () => void 0,
  800. setScopeId: () => void 0,
  801. cloneNode: () => void 0,
  802. insertStaticContent: () => void 0
  803. };
  804. var { createApp: vt } = createRenderer(mt);
  805. var gt = (e) => {
  806. const t = vt(o);
  807. function o() {
  808. return e && e.default ? e.default() : [];
  809. }
  810. return t;
  811. };
  812. we(three_module_exports);
  813. var { logWarning: ht } = I();
  814. var wt = defineComponent({
  815. name: "TresScene",
  816. props: [
  817. "shadows",
  818. "shadowMapType",
  819. "physicallyCorrectLights",
  820. "useLegacyLights",
  821. "outputEncoding",
  822. "toneMapping",
  823. "toneMappingExposure",
  824. "context",
  825. "powerPreference",
  826. "preserveDrawingBuffer",
  827. "clearColor",
  828. "windowSize",
  829. "preset"
  830. ],
  831. setup(e, { slots: t, expose: o }) {
  832. e.physicallyCorrectLights === true && ht("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
  833. const a = ref(), n = ref(), r = new Scene(), { setState: s } = D();
  834. s("scene", r), s("canvas", n), s("container", a);
  835. const { pushCamera: i } = N();
  836. i(new PerspectiveCamera()), onMounted(() => {
  837. c();
  838. }), onUnmounted(() => {
  839. s("renderer", null);
  840. });
  841. function c() {
  842. const { renderer: m } = st(e), { activeCamera: d } = N(), { onLoop: P } = Me(), { raycaster: g, pointer: R } = lt();
  843. let w = null, p = null;
  844. watchEffect(() => {
  845. d.value && g.value.setFromCamera(R.value, d.value);
  846. }), P(() => {
  847. var x, b, y, M, E, L, h2, T, C, O;
  848. if (d.value && ((x = m.value) == null || x.render(r, d.value)), g.value) {
  849. const B = g.value.intersectObjects(r.children);
  850. B.length > 0 ? (p = B[0], w === null && ((M = (y = (b = p.object) == null ? void 0 : b.events) == null ? void 0 : y.onPointerEnter) == null || M.call(y, p)), (h2 = (L = (E = p.object) == null ? void 0 : E.events) == null ? void 0 : L.onPointerMove) == null || h2.call(L, p)) : w !== null && ((O = (C = (T = p == null ? void 0 : p.object) == null ? void 0 : T.events) == null ? void 0 : C.onPointerLeave) == null || O.call(C, w), p = null), w = p;
  851. }
  852. }), useEventListener(n.value, "click", () => {
  853. var x, b, y;
  854. p !== null && ((y = (b = (x = p.object) == null ? void 0 : x.events) == null ? void 0 : b.onClick) == null || y.call(b, p));
  855. });
  856. }
  857. let u;
  858. function f() {
  859. u = gt(t), u.provide("useTres", D()), u.provide("extend", we), u.mount(r);
  860. }
  861. return f(), o({
  862. scene: r
  863. }), () => h(
  864. h(
  865. "div",
  866. {
  867. ref: a,
  868. "data-scene": r.uuid,
  869. key: r.uuid,
  870. style: {
  871. position: "relative",
  872. width: "100%",
  873. height: "100%",
  874. pointerEvents: "auto",
  875. touchAction: "none"
  876. }
  877. },
  878. [
  879. h(
  880. "div",
  881. {
  882. style: {
  883. width: "100%",
  884. height: "100%"
  885. }
  886. },
  887. [
  888. h("canvas", {
  889. ref: n,
  890. "data-scene": r.uuid,
  891. style: {
  892. display: "block",
  893. width: "100%",
  894. height: "100%",
  895. position: e.windowSize ? "fixed" : "absolute",
  896. top: 0,
  897. left: 0
  898. }
  899. })
  900. ]
  901. )
  902. ]
  903. )
  904. );
  905. }
  906. });
  907. var bt = defineComponent({
  908. name: "TresCanvas",
  909. props: [
  910. "shadows",
  911. "shadowMapType",
  912. "physicallyCorrectLights",
  913. "useLegacyLights",
  914. "outputEncoding",
  915. "toneMapping",
  916. "toneMappingExposure",
  917. "context",
  918. "powerPreference",
  919. "preserveDrawingBuffer",
  920. "clearColor",
  921. "windowSize",
  922. "preset"
  923. ],
  924. setup(e, { slots: t, expose: o }) {
  925. const a = ft();
  926. return o(a), () => h(wt, e, t);
  927. }
  928. });
  929. var Lt = {
  930. install(e) {
  931. e.component("TresCanvas", bt);
  932. }
  933. };
  934. export {
  935. he,
  936. we,
  937. Qe,
  938. N,
  939. Me,
  940. st,
  941. ct,
  942. Et,
  943. Ct,
  944. ft,
  945. D,
  946. lt,
  947. Pt,
  948. I,
  949. Rt,
  950. bt,
  951. Lt
  952. };
  953. //# sourceMappingURL=chunk-DESKY23Y.js.map