@uptimizr/dashboard 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +76 -0
- package/out/404.html +1 -0
- package/out/__next.__PAGE__.txt +9 -0
- package/out/__next._full.txt +20 -0
- package/out/__next._head.txt +6 -0
- package/out/__next._index.txt +5 -0
- package/out/__next._tree.txt +4 -0
- package/out/_next/static/93W3szqylNKDg-afLRmVW/_buildManifest.js +11 -0
- package/out/_next/static/93W3szqylNKDg-afLRmVW/_clientMiddlewareManifest.js +1 -0
- package/out/_next/static/93W3szqylNKDg-afLRmVW/_ssgManifest.js +1 -0
- package/out/_next/static/chunks/0-2y-_oomza2l.js +87 -0
- package/out/_next/static/chunks/00k_j_r7bv_eb.js +266 -0
- package/out/_next/static/chunks/00zdau6mcqeae.js +1 -0
- package/out/_next/static/chunks/023axeoslq39i.js +1 -0
- package/out/_next/static/chunks/068j6934u8j16.js +1 -0
- package/out/_next/static/chunks/0_rf76jneiwal.js +176 -0
- package/out/_next/static/chunks/0aznt7717miff.js +1 -0
- package/out/_next/static/chunks/0cu-q5q3a7uf3.js +1 -0
- package/out/_next/static/chunks/0cz1d0mv5g_q7.js +1 -0
- package/out/_next/static/chunks/0dm32-jq30tg8.js +1 -0
- package/out/_next/static/chunks/0dn0yx0rn6mpf.js +1 -0
- package/out/_next/static/chunks/0flc7nppbmsl1.js +3 -0
- package/out/_next/static/chunks/0fskcfh9vbhtv.js +1 -0
- package/out/_next/static/chunks/0gv7mblzv3dl3.js +87 -0
- package/out/_next/static/chunks/0impkpmxx3ttp.js +1 -0
- package/out/_next/static/chunks/0jmn7u31w95ly.js +91 -0
- package/out/_next/static/chunks/0n8n481szj90g.js +1 -0
- package/out/_next/static/chunks/0o6ayai0s01js.js +1 -0
- package/out/_next/static/chunks/0rys92_73hdb0.js +22 -0
- package/out/_next/static/chunks/0tl_moiyi2txt.js +1 -0
- package/out/_next/static/chunks/0tx1j_ghpz7rc.css +3 -0
- package/out/_next/static/chunks/0ufbyo1x3qkmo.js +1 -0
- package/out/_next/static/chunks/0v82oqyoy9zol.js +1 -0
- package/out/_next/static/chunks/0wrm9jr-9bw0e.js +1893 -0
- package/out/_next/static/chunks/0wwcfw8i3j_zx.js +1 -0
- package/out/_next/static/chunks/0ys9-ozuluawt.js +1 -0
- package/out/_next/static/chunks/1-61zh4waha61.js +1 -0
- package/out/_next/static/chunks/10r_824wzt8hj.js +1 -0
- package/out/_next/static/chunks/112hws17nz665.js +7 -0
- package/out/_next/static/chunks/123xxske5c9na.js +1 -0
- package/out/_next/static/chunks/13isnf0--pmx1.js +1 -0
- package/out/_next/static/chunks/157d9euci08yu.js +1 -0
- package/out/_next/static/chunks/15s7425ffrec9.js +3 -0
- package/out/_next/static/chunks/163fa70v4mgxj.js +1 -0
- package/out/_next/static/chunks/17q0c2h5ui10r.js +4 -0
- package/out/_next/static/chunks/18u58lorfahxi.js +4 -0
- package/out/_next/static/chunks/1_aahautsz2v_.js +1 -0
- package/out/_next/static/chunks/1a9l89j7e6mqu.js +23 -0
- package/out/_next/static/chunks/1dsy2ngmfflis.js +123 -0
- package/out/_next/static/chunks/1flb8adpj6_2o.js +62 -0
- package/out/_next/static/chunks/1lsg-22yob8dx.js +1 -0
- package/out/_next/static/chunks/1nj82er7msdto.js +2 -0
- package/out/_next/static/chunks/1o1d0p-v1z8ty.js +1 -0
- package/out/_next/static/chunks/1pdep2_c530sg.js +1 -0
- package/out/_next/static/chunks/1thjncpj7u6pq.js +1 -0
- package/out/_next/static/chunks/1vdjn0pkoyypn.js +1 -0
- package/out/_next/static/chunks/1yehxf-fmeicg.js +1 -0
- package/out/_next/static/chunks/1zvc1tv--w8nn.js +1 -0
- package/out/_next/static/chunks/1zx2q-r32thv1.js +4 -0
- package/out/_next/static/chunks/2-sjjedfr0kfq.js +1 -0
- package/out/_next/static/chunks/21o42k82w4llc.js +1 -0
- package/out/_next/static/chunks/25b9x-li-tvk2.js +1 -0
- package/out/_next/static/chunks/2712627rfsmwn.js +1 -0
- package/out/_next/static/chunks/296w2ke-v5tbm.js +9 -0
- package/out/_next/static/chunks/29tfeb6amdkjb.js +23 -0
- package/out/_next/static/chunks/2a3spdq-m8drh.js +3 -0
- package/out/_next/static/chunks/2aelw3far6rii.js +1 -0
- package/out/_next/static/chunks/2aor7m-wbis85.js +1 -0
- package/out/_next/static/chunks/2cbmf9m7lqv6k.js +4 -0
- package/out/_next/static/chunks/2d09v5u7dfq0q.js +1 -0
- package/out/_next/static/chunks/2feca0xcipcyt.js +850 -0
- package/out/_next/static/chunks/2fh-_9b6tqhvb.js +1 -0
- package/out/_next/static/chunks/2g5gecypj0rqe.js +1 -0
- package/out/_next/static/chunks/2kazjq29jeamx.js +1109 -0
- package/out/_next/static/chunks/2p2vv6cc9i-3q.js +255 -0
- package/out/_next/static/chunks/2szdcpl41-kzv.js +1 -0
- package/out/_next/static/chunks/2tws5udjdcmh3.js +1 -0
- package/out/_next/static/chunks/2u6shh3oeycm-.js +1 -0
- package/out/_next/static/chunks/2unhhuv0arlcv.js +1 -0
- package/out/_next/static/chunks/2xwy0-qfho1iz.js +91 -0
- package/out/_next/static/chunks/2ycvtdd68gub7.js +1 -0
- package/out/_next/static/chunks/2yiy_l8bwiw2_.js +3 -0
- package/out/_next/static/chunks/2yph6f7khgqii.js +1 -0
- package/out/_next/static/chunks/3-shckrcpvbxu.js +1681 -0
- package/out/_next/static/chunks/30fq_t9e2_fv-.js +1 -0
- package/out/_next/static/chunks/30yzu213bqtq0.js +5 -0
- package/out/_next/static/chunks/310uz81hnnzsu.js +1 -0
- package/out/_next/static/chunks/3218lp8l0a5g_.js +1 -0
- package/out/_next/static/chunks/35h5n42wxwgzk.js +123 -0
- package/out/_next/static/chunks/37vzwr3ciejf1.js +1 -0
- package/out/_next/static/chunks/38fhw7fatsyvd.js +3 -0
- package/out/_next/static/chunks/3be6s4_kn9q-o.js +1 -0
- package/out/_next/static/chunks/3i3gbhccmhu7j.js +210 -0
- package/out/_next/static/chunks/3l1dr_qm_x5kp.js +1 -0
- package/out/_next/static/chunks/3mqy-84_ul3t2.js +1 -0
- package/out/_next/static/chunks/3nz-dh9d7cehk.js +1 -0
- package/out/_next/static/chunks/3pufs8g4ui943.js +1 -0
- package/out/_next/static/chunks/3sjq_xoi4rbyg.js +31 -0
- package/out/_next/static/chunks/3t06schbtqonl.js +1 -0
- package/out/_next/static/chunks/3v3-7fio3nw_t.js +1 -0
- package/out/_next/static/chunks/3v5ha25nxo43j.js +1 -0
- package/out/_next/static/chunks/3yfrsm8lfi6ls.js +22 -0
- package/out/_next/static/chunks/3zskk1hxu3-_o.js +1 -0
- package/out/_next/static/chunks/turbopack-2ropzf0axp1x9.js +1 -0
- package/out/_next/static/media/0c89a48fa5027cee-s.p.2cyn07wtgehh0.woff2 +0 -0
- package/out/_next/static/media/13bf9871fe164e7f-s.2f7nqdagzwx2-.woff2 +0 -0
- package/out/_next/static/media/28868e710e86be81-s.2eksvhm1z0jwa.woff2 +0 -0
- package/out/_next/static/media/32687112bd2dd8db-s.1gepa_7fcx9fm.woff2 +0 -0
- package/out/_next/static/media/3fe682a82f50d426-s.0vfdmo25voy_0.woff2 +0 -0
- package/out/_next/static/media/70bc3e132a0a741e-s.p.3t6q91iet4nsy.woff2 +0 -0
- package/out/_next/static/media/71b036adf157cdcf-s.0bp8oijd_gu96.woff2 +0 -0
- package/out/_next/static/media/89b21bb081cb7469-s.1fby2rem9ngyr.woff2 +0 -0
- package/out/_next/static/media/cc545e633e20c56d-s.176arc174-8zp.woff2 +0 -0
- package/out/_next/static/media/icon.08h29dad3pcxg.svg +4 -0
- package/out/_not-found/__next._full.txt +16 -0
- package/out/_not-found/__next._head.txt +6 -0
- package/out/_not-found/__next._index.txt +5 -0
- package/out/_not-found/__next._not-found.__PAGE__.txt +5 -0
- package/out/_not-found/__next._not-found.txt +5 -0
- package/out/_not-found/__next._tree.txt +2 -0
- package/out/_not-found.html +1 -0
- package/out/_not-found.txt +16 -0
- package/out/api/projects +1 -0
- package/out/icon.svg +4 -0
- package/out/index.html +1 -0
- package/out/index.txt +20 -0
- package/out/logo.svg +46 -0
- package/package.json +67 -0
- package/server/standalone.mjs +182 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,62238,42279,e=>{"use strict";let t=1/1.2;e.s(["ZOOM_IN_FACTOR",0,t,"ZOOM_OUT_FACTOR",0,1.2,"disableWheelZoom",0,function(e){e.inputs.removeByType("ArcRotateCameraMouseWheelInput")},"stepZoom",0,function(e,t){let n=e.lowerRadiusLimit??.01,s=e.upperRadiusLimit??1/0;e.radius=Math.min(s,Math.max(n,e.radius*t))}],62238);var n=e.i(29212);e.s(["ZoomButtons",0,function({onZoom:e}){let s="grid h-8 w-8 place-items-center rounded-md border border-edge bg-ink/80 text-lg leading-none text-fg backdrop-blur transition hover:bg-ink hover:text-white";return(0,n.jsxs)("div",{className:"absolute right-3 top-3 flex flex-col gap-1",children:[(0,n.jsx)("button",{type:"button","aria-label":"Zoom in",className:s,onClick:()=>e(t),children:"+"}),(0,n.jsx)("button",{type:"button","aria-label":"Zoom out",className:s,onClick:()=>e(1.2),children:"−"})]})}],42279)},59683,37660,e=>{"use strict";e.s(["attachMeshHover",0,function(e,t,n){let s=0,a=null,i=t=>{let i=t.offsetX,o=t.offsetY;s||(s=requestAnimationFrame(()=>{var t,l;let r;s=0;let c=e.pick(i,o,e=>e.isPickable&&e.isEnabled()),u=c?.pickedMesh?(t=c.pickedMesh,l=c.thinInstanceIndex??-1,(r=t.metadata)?l>=0&&r.hoverLabels?r.hoverLabels[l]??null:r.hoverLabel??null:null):null;u?n({label:u,x:i,y:o}):null!==a&&n(null),a=u}))},o=()=>{s&&(cancelAnimationFrame(s),s=0),null!==a&&(a=null,n(null))};return t.addEventListener("pointermove",i),t.addEventListener("pointerleave",o),()=>{t.removeEventListener("pointermove",i),t.removeEventListener("pointerleave",o),s&&cancelAnimationFrame(s)}}],59683);var t=e.i(29212),n=e.i(56054);e.s(["HeatLegend",0,function({title:e,lowLabel:s="low",highLabel:a="high",note:i}){return(0,t.jsxs)("div",{className:"pointer-events-none absolute bottom-3 left-3 rounded-md border border-edge bg-ink/80 px-3 py-2 text-fg backdrop-blur-sm",children:[(0,t.jsx)("div",{className:"mb-1 text-xs font-medium text-fg",children:e}),(0,t.jsx)("div",{className:"h-2 w-36 rounded-sm",style:{background:n.HEAT_GRADIENT}}),(0,t.jsxs)("div",{className:"mt-1 flex w-36 justify-between text-[10px] text-fg-muted",children:[(0,t.jsx)("span",{children:s}),(0,t.jsx)("span",{children:a})]}),i?(0,t.jsx)("div",{className:"mt-1 max-w-44 text-[10px] leading-tight text-fg-muted",children:i}):null]})}],37660)},24543,e=>{"use strict";var t=e.i(29212),n=e.i(94179);e.i(82665);var s=e.i(20880);let a="__other_sp__",i="__other_mesh__";function o(e){return`${e[0]}|${e[1]}|${e[2]}`}function l(e,t){return t<=1?0:1.4-e/(t-1)*2.8}var r=e.i(56054),c=e.i(62238),u=e.i(59683),h=e.i(37660),d=e.i(93425),m=e.i(42279);let f="__all__",b={maxStandpoints:6,maxMeshes:10,maxRibbons:70};function p(e,t){return`${e}|${t}`}function g({label:e,value:n,onChange:s,allLabel:a,options:i}){return(0,t.jsxs)("label",{className:"flex items-center gap-1.5 rounded-md border border-edge bg-ink/80 px-2 py-1 text-xs text-fg backdrop-blur",children:[(0,t.jsx)("span",{className:"font-medium text-fg-muted",children:e}),(0,t.jsxs)("select",{className:"max-w-[12rem] bg-transparent text-white outline-none",value:n,onChange:e=>s(e.target.value),children:[(0,t.jsx)("option",{value:f,children:a}),i.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))]})]})}function x({active:e,onClick:n,children:s,disabled:a=!1,title:i}){return(0,t.jsx)("button",{type:"button",onClick:n,disabled:a,title:i,className:`rounded px-2 py-0.5 font-medium transition ${a?"cursor-not-allowed text-fg-muted/40":e?"bg-amber text-ink":"text-fg-muted hover:text-fg"}`,children:s})}function v({standpoints:e,proxyMeshes:s,selectedKey:a,onSelect:i}){let o=(0,n.useRef)(null),l=(0,n.useMemo)(()=>e.filter(e=>e.origin),[e]),r=(0,n.useMemo)(()=>{let e=1/0,t=-1/0,n=1/0,a=-1/0,i=(s,i)=>{e=Math.min(e,s),t=Math.max(t,s),n=Math.min(n,i),a=Math.max(a,i)};for(let e of s)i(e.aabb[0],e.aabb[2]),i(e.aabb[3],e.aabb[5]);for(let e of l)i(e.origin[0],e.origin[2]);return Number.isFinite(e)?(t-e<.001&&(e-=1,t+=1),a-n<.001&&(n-=1,a+=1),{minX:e,maxX:t,minZ:n,maxZ:a}):{minX:-1,maxX:1,minZ:-1,maxZ:1}},[s,l]),c=(0,n.useMemo)(()=>{let e=Math.min(134/(r.maxX-r.minX),94/(r.maxZ-r.minZ));return(t,n)=>[8+(t-r.minX)*e,8+(n-r.minZ)*e]},[r]),u=(0,n.useMemo)(()=>l.reduce((e,t)=>Math.max(e,t.count),1),[l]);return(0,n.useEffect)(()=>{let e=o.current,t=e?.getContext("2d");if(!t)return;let n=window.devicePixelRatio||1;for(let a of(e.width=150*n,e.height=110*n,t.setTransform(n,0,0,n,0,0),t.clearRect(0,0,150,110),t.fillStyle="rgba(8,10,14,0.85)",t.fillRect(0,0,150,110),t.strokeStyle="rgba(120,140,170,0.35)",t.lineWidth=1,s)){let[e,n]=c(a.aabb[0],a.aabb[2]),[s,i]=c(a.aabb[3],a.aabb[5]);t.strokeRect(Math.min(e,s),Math.min(n,i),Math.abs(s-e),Math.abs(i-n))}for(let e of l){let[n,s]=c(e.origin[0],e.origin[2]),i=2+e.count/u*4,o=e.key===a;t.beginPath(),t.arc(n,s,i,0,2*Math.PI),t.fillStyle=o?"rgba(242,115,242,1)":"rgba(242,115,242,0.55)",t.fill(),o&&(t.beginPath(),t.arc(n,s,i+2.5,0,2*Math.PI),t.strokeStyle="rgba(255,255,255,0.9)",t.lineWidth=1.5,t.stroke())}},[s,l,c,u,a]),(0,t.jsxs)("div",{className:"absolute right-3 top-3 rounded-md border border-edge bg-ink/80 p-1 backdrop-blur",children:[(0,t.jsx)("div",{className:"px-1 pb-0.5 text-[10px] font-medium text-fg-muted",children:"Standpoints (top view)"}),(0,t.jsx)("canvas",{ref:o,className:"h-27.5 w-37.5 cursor-pointer rounded",onClick:e=>{let t=o.current;if(!t||0===l.length)return;let n=t.getBoundingClientRect(),s=(e.clientX-n.left)/n.width*150,a=(e.clientY-n.top)/n.height*110,r=null,u=1/0;for(let e of l){let[t,n]=c(e.origin[0],e.origin[2]),i=(t-s)**2+(n-a)**2;i<u&&(u=i,r=e)}r&&u<=196&&i(r.key)}})]})}e.s(["FlowSankey3D",0,function({links:k,gridSize:w,proxyMeshes:j=[],maxLinks:z=80,baseUrl:y,apiKey:M,flowQuery:$,hasFirstPerson:_=!1}){let I=(0,n.useRef)(null),C=(0,n.useRef)(null),[P,S]=(0,n.useState)("loading"),[A,B]=(0,n.useState)(null),[L,N]=(0,n.useState)(f),[E,q]=(0,n.useState)(f),[R,O]=(0,n.useState)(f),[Z,T]=(0,n.useState)("aggregate"),[F,V]=(0,n.useState)(null),[W,H]=(0,n.useState)("all"),[X,D]=(0,n.useState)(k),U=!!(y&&$),K=(0,n.useMemo)(()=>$?JSON.stringify($):"",[$]),G=(0,n.useRef)(!1);(0,n.useEffect)(()=>{!G.current&&_&&(H("first-person"),G.current=!0)},[_]),(0,n.useEffect)(()=>{_&&"viewer"===W&&H("first-person")},[_,W]),(0,n.useEffect)(()=>{U||D(k)},[k,U]),(0,n.useEffect)(()=>{if(!y||!$)return;let e=!1,t=new s.CollectorApi(y,M??""),n="all"===W?void 0:W;return t.flowHeatmap({...$,bins:w,limit:400,groupByOrigin:!0,cameraMode:n}).then(t=>{e||D(t)}).catch(()=>{e||D([])}),()=>{e=!0}},[y,M,K,W,w]);let Y=(0,n.useMemo)(()=>{let e=new Map;for(let t of X){if(!t.originVoxel)continue;let n=o(t.originVoxel),s=t.origin,a=e.get(n);a?(a.count+=t.count,s&&(a.ox+=s[0]*t.count,a.oy+=s[1]*t.count,a.oz+=s[2]*t.count,a.wsum+=t.count)):e.set(n,{key:n,voxel:t.originVoxel,count:t.count,ox:s?s[0]*t.count:0,oy:s?s[1]*t.count:0,oz:s?s[2]*t.count:0,wsum:s?t.count:0})}return[...e.values()].map(e=>({key:e.key,voxel:e.voxel,count:e.count,origin:e.wsum>0?[e.ox/e.wsum,e.oy/e.wsum,e.oz/e.wsum]:void 0})).sort((e,t)=>t.count-e.count)},[X]),J=Y.length>0,Q=(0,n.useMemo)(()=>R===f?null:Y.find(e=>e.key===R)??null,[Y,R]),ee=(0,n.useMemo)(()=>(function(e,t,n,s){let r=e.filter(e=>e.originVoxel);if(0===r.length)return{standpoints:[],gazes:[],meshes:[],ribbons:[],maxCount:1};let c=t.slice(0,Math.max(1,s.maxStandpoints)),u=new Set(c.map(e=>e.key)),h=e=>{let t=e.originVoxel?o(e.originVoxel):a;return u.has(t)?t:a},d=new Map;for(let e of r)d.set(e.mesh,(d.get(e.mesh)??0)+e.count);let m=new Set([...d.entries()].sort((e,t)=>t[1]-e[1]).slice(0,Math.max(1,s.maxMeshes)).map(([e])=>e)),f=e=>m.has(e)?e:i,b=new Map;for(let e of r){let t=h(e),n=f(e.mesh),s=`${t}|${e.azimuth_bin}|${e.elevation_bin}|${n}`,a=b.get(s);a?a.count+=e.count:b.set(s,{standpointId:t,gazeId:`${t}|${e.azimuth_bin}|${e.elevation_bin}`,meshId:n,azimuthBin:e.azimuth_bin,elevationBin:e.elevation_bin,count:e.count})}let p=[...b.values()].sort((e,t)=>t.count-e.count),g=p.slice(0,Math.max(1,s.maxRibbons)),x=p.slice(Math.max(1,s.maxRibbons));if(x.length>0){let e=new Map(g.map(e=>[`${e.standpointId}|${e.azimuthBin}|${e.elevationBin}|${i}`,e]));for(let t of x){let n=`${t.standpointId}|${t.azimuthBin}|${t.elevationBin}|${i}`,s=e.get(n);if(s)s.count+=t.count;else{let s={standpointId:t.standpointId,gazeId:t.gazeId,meshId:i,azimuthBin:t.azimuthBin,elevationBin:t.elevationBin,count:t.count};e.set(n,s),g.push(s)}}}let v=new Set(g.map(e=>e.standpointId)),k=new Set(g.map(e=>e.meshId)),w=[...c.filter(e=>v.has(e.key)).map(e=>e.key),...v.has(a)?[a]:[]],j=w.map((e,t)=>{let n=c.find(t=>t.key===e),s=g.filter(t=>t.standpointId===e).reduce((e,t)=>e+t.count,0);return{id:e,kind:"standpoint",pos:[-2.6,l(t,w.length),0],count:s,label:n?`[${n.voxel[0]}, ${n.voxel[1]}, ${n.voxel[2]}]`:"Other standpoints",isOther:e===a}}),z=new Map(j.map(e=>[e.id,e.pos[1]])),y=new Map;for(let e of g)y.set(e.meshId,(y.get(e.meshId)??0)+e.count);let M=[...k].sort((e,t)=>(y.get(t)??0)-(y.get(e)??0));M.sort((e,t)=>(e===i)-(t===i));let $=M.map((e,t)=>({id:e,kind:"mesh",pos:[2.6,l(t,M.length),0],count:y.get(e)??0,label:e===i?"Other meshes":e,isOther:e===i})),_=new Map;for(let e of g){let t=_.get(e.gazeId);t?t.count+=e.count:_.set(e.gazeId,{az:e.azimuthBin,el:e.elevationBin,sp:e.standpointId,count:e.count})}let I=[..._.entries()].map(([e,t])=>{let s=z.get(t.sp)??0,a=(t.az+.5)/n-.5;return{id:e,kind:"gaze",pos:[0,s+((t.el+.5)/n-.5)*.85,1.6*a],count:t.count,label:`(${t.az}, ${t.el})`,isOther:!1}}),C=g.reduce((e,t)=>Math.max(e,t.count),1);return{standpoints:j,gazes:I,meshes:$,ribbons:g,maxCount:C}})(X,Y,w,b),[X,Y,w]),et="twostage"===Z&&J;(0,n.useEffect)(()=>{"twostage"!==Z||J||T("aggregate")},[Z,J]);let en=(0,n.useMemo)(()=>{if(R!==f&&J)return X.filter(e=>e.originVoxel&&o(e.originVoxel)===R);if(!J)return X;let e=new Map;for(let t of X){let n=`${t.azimuth_bin}|${t.elevation_bin}|${t.mesh}`,s=e.get(n);s?s.count+=t.count:e.set(n,{azimuth_bin:t.azimuth_bin,elevation_bin:t.elevation_bin,mesh:t.mesh,count:t.count})}return[...e.values()]},[X,R,J]),es=(0,n.useMemo)(()=>[...en].sort((e,t)=>t.count-e.count).slice(0,Math.max(1,z)),[en,z]),ea=(0,n.useMemo)(()=>{let e=new Map;for(let t of es)e.set(t.mesh,(e.get(t.mesh)??0)+t.count);return[...e.entries()].sort((e,t)=>t[1]-e[1])},[es]),ei=(0,n.useMemo)(()=>{let e=new Map;for(let t of es){let n=p(t.azimuth_bin,t.elevation_bin),s=e.get(n);s?s.count+=t.count:e.set(n,{azimuthBin:t.azimuth_bin,elevationBin:t.elevation_bin,count:t.count})}return[...e.values()].sort((e,t)=>t.count-e.count)},[es]);(0,n.useEffect)(()=>{!et&&L!==f&&(ea.some(([e])=>e===L)||N(f))},[et,L,ea]),(0,n.useEffect)(()=>{!et&&E!==f&&(ei.some(e=>p(e.azimuthBin,e.elevationBin)===E)||q(f))},[et,E,ei]),(0,n.useEffect)(()=>{!et&&R!==f&&(Y.some(e=>e.key===R)||O(f))},[et,R,Y]),(0,n.useEffect)(()=>{N(f),q(f),O(f)},[Z]);let eo=(0,n.useMemo)(()=>et?ee.ribbons.filter(e=>{let t=R===f||e.standpointId===R,n=E===f||p(e.azimuthBin,e.elevationBin)===E,s=L===f||e.meshId===L;return t&&n&&s}).length:es.filter(e=>{let t=E===f||p(e.azimuth_bin,e.elevation_bin)===E,n=L===f||e.mesh===L;return t&&n}).length,[et,ee,es,L,E,R]),el=et?ee.ribbons.length:es.length,er=(0,n.useMemo)(()=>et?ee.standpoints.map(e=>({value:e.id,label:`${e.label} \xb7 ${e.count}`})):Y.slice(0,24).map(e=>({value:e.key,label:`[${e.voxel[0]}, ${e.voxel[1]}, ${e.voxel[2]}] \xb7 ${e.count}`})),[et,ee,Y]),ec=(0,n.useMemo)(()=>{if(et){let e=new Map;for(let t of ee.ribbons){let n=p(t.azimuthBin,t.elevationBin),s=e.get(n);s?s.count+=t.count:e.set(n,{az:t.azimuthBin,el:t.elevationBin,count:t.count})}return[...e.values()].sort((e,t)=>t.count-e.count).map(e=>({value:p(e.az,e.el),label:`(${e.az}, ${e.el}) \xb7 ${e.count}`}))}return ei.map(e=>({value:p(e.azimuthBin,e.elevationBin),label:`(${e.azimuthBin}, ${e.elevationBin}) \xb7 ${e.count}`}))},[et,ee,ei]),eu=(0,n.useMemo)(()=>et?ee.meshes.map(e=>({value:e.id,label:`${e.label} \xb7 ${e.count}`})):ea.map(([e,t])=>({value:e,label:`${e} \xb7 ${t}`})),[et,ee,ea]);return(0,n.useEffect)(()=>{let t=I.current;if(!t||et)return;if(0===es.length)return void S("empty");let n=!1,s=null;return S("loading"),B(null),(async()=>{try{let[{Engine:a},{Scene:i},{ArcRotateCamera:o},{HemisphericLight:l},{Vector3:h,Color3:d,Color4:m},{MeshBuilder:b},{StandardMaterial:g}]=await Promise.all([e.A(66022),e.A(48505),e.A(53976),e.A(42436),e.A(89370),e.A(67141),e.A(20693),e.A(96664)]);if(n)return;let x=new a(t,!0,{preserveDrawingBuffer:!1}),v=new i(x);v.clearColor=new m(.04,.05,.07,1);let k=new Map;for(let e of j)k.set(e.name,function(e){let t=e.aabb;return[(t[0]+t[3])/2,(t[1]+t[4])/2,(t[2]+t[5])/2]}(e));let z=new Map,y=ea.map(([e])=>e).filter(e=>!k.has(e));for(let e=0;e<y.length;e++){let t=y[e],n=function(e){let t=0;for(let n=0;n<e.length;n++)t=31*t+e.charCodeAt(n)|0;return Math.abs(t)}(t),s=e/Math.max(1,y.length)*Math.PI*2+n%100/100*.35;z.set(t,[2.2*Math.cos(s),-.35+(n%7-3)*.06,2.2*Math.sin(s)])}for(let[e,t]of k.entries())z.set(e,t);let M=0,$=0,_=0,I=0;for(let e of z.values())M+=e[0],$+=e[1],_+=e[2],I++;let P=new h(M/Math.max(1,I),$/Math.max(1,I),_/Math.max(1,I)),A=1.8;for(let e of z.values()){let t=e[0]-P.x,n=e[1]-P.y,s=e[2]-P.z;A=Math.max(A,Math.sqrt(t*t+n*n+s*s))}let B=.75*A+1,N=Math.max(1,A/1.8),q=es.reduce((e,t)=>Math.max(e,t.count),1),R=new g("flow-source-node",v);R.disableLighting=!0,R.emissiveColor=new d(.45,.75,1);let O=new g("flow-target-node",v);O.disableLighting=!0,O.emissiveColor=new d(1,.82,.42);let Z=new Set,T=new Set,F=e=>{let t=E===f||p(e.azimuth_bin,e.elevation_bin)===E,n=L===f||e.mesh===L;return t&&n},W=new Set,H=new Set;for(let e of es)F(e)&&(W.add(p(e.azimuth_bin,e.elevation_bin)),H.add(e.mesh));for(let e of es){let t=`${e.azimuth_bin}|${e.elevation_bin}`,n=z.get(e.mesh);if(!n)continue;let s=F(e),a=(e.azimuth_bin+.5)/w*Math.PI*2-Math.PI,i=(e.elevation_bin+.5)/w*Math.PI-Math.PI/2,o=Math.cos(i),l=o*Math.cos(a),c=Math.sin(i),u=o*Math.sin(a),m=new h(P.x+l*B,P.y+c*B,P.z+u*B),p=new h(n[0],n[1],n[2]);if(!Z.has(t)){let e=b.CreateSphere(`flow-src-${t}`,{diameter:.12*N,segments:6},v);e.position=m;let n=R.clone(`flow-src-mat-${t}`);n.alpha=W.has(t)||L===f&&E===f?1:.22,e.material=n,e.isPickable=!1,Z.add(t)}if(!T.has(e.mesh)){let t=b.CreateSphere(`flow-target-${e.mesh}`,{diameter:.2*N,segments:7},v);t.position=p;let n=O.clone(`flow-target-mat-${e.mesh}`);n.alpha=H.has(e.mesh)||L===f&&E===f?1:.22,t.material=n,t.isPickable=!0,t.metadata={hoverLabel:e.mesh},T.add(e.mesh)}let x=m.add(p).scale(.5),k=x.subtract(P),j=Math.sqrt(k.x*k.x+k.y*k.y+k.z*k.z),y=j>1e-6?k.x/j:0,M=j>1e-6?k.y/j:1,$=j>1e-6?k.z/j:0,_=(.35+e.count/q*.75)*N,I=new h(x.x+y*_,x.y+M*_+.12*N,x.z+$*_),C=[];for(let e=0;e<=18;e++){let t=e/18,n=1-t;C.push(new h(n*n*m.x+2*n*t*I.x+t*t*p.x,n*n*m.y+2*n*t*I.y+t*t*p.y,n*n*m.z+2*n*t*I.z+t*t*p.z))}let S=e.count/q,[A,V,X]=(0,r.heatRgb)(S),D=b.CreateTube(`flow-link-${e.mesh}-${t}`,{path:C,radius:(s?1:.4)*(.012+.04*S)*N,tessellation:8,cap:0,sideOrientation:0},v),U=new g(`flow-link-mat-${e.mesh}-${t}`,v);U.disableLighting=!0,U.emissiveColor=new d(A,V,X),U.alpha=s?.35+.65*S:.08,D.material=U,D.isPickable=!0,D.metadata={hoverLabel:e.mesh}}let X=new o("flow-cam",Math.PI/4,Math.PI/3,3.4*A,P,v);X.attachControl(t,!0),(0,c.disableWheelZoom)(X),C.current=X,new l("flow-light",new h(.3,1,.2),v);let D=b.CreateSphere("flow-source-dome",{diameter:2*B,segments:20},v);D.position=P;let U=new g("flow-source-dome-mat",v);U.wireframe=!0,U.disableLighting=!0,U.emissiveColor=new d(.16,.2,.28),U.alpha=.35,D.material=U,D.isPickable=!1;let K=Q?.origin;if(K){let e=new h(K[0],K[1],K[2]),t=b.CreateSphere("flow-standpoint",{diameter:.26*N,segments:10},v);t.position=e;let n=new g("flow-standpoint-mat",v);n.disableLighting=!0,n.emissiveColor=new d(.95,.45,.95),t.material=n,t.isPickable=!1;let s=b.CreateLines("flow-standpoint-stem",{points:[e,new h(e.x,P.y,e.z)]},v);s.color=new d(.95,.45,.95),s.isPickable=!1}x.runRenderLoop(()=>v.render());let G=()=>x.resize();window.addEventListener("resize",G);let Y=(0,u.attachMeshHover)(v,t,V);S("ready"),s=()=>{window.removeEventListener("resize",G),Y(),V(null),C.current=null,v.dispose(),x.dispose()}}catch(e){if(n)return;S("error"),B(e instanceof Error?e.message:"Failed to render flow links.")}})(),()=>{n=!0,s?.()}},[es,w,j,L,E,Q,et]),(0,n.useEffect)(()=>{let t=I.current;if(!t||!et)return;if(0===ee.ribbons.length)return void S("empty");let n=!1,s=null;return S("loading"),B(null),(async()=>{try{let[{Engine:a},{Scene:i},{ArcRotateCamera:o},{HemisphericLight:l},{Vector3:h,Color3:d,Color4:m},{MeshBuilder:b},{StandardMaterial:g}]=await Promise.all([e.A(66022),e.A(48505),e.A(53976),e.A(42436),e.A(89370),e.A(67141),e.A(20693),e.A(96664)]);if(n)return;let x=new a(t,!0,{preserveDrawingBuffer:!1}),v=new i(x);v.clearColor=new m(.04,.05,.07,1);let k=e=>{let t=R===f||e.standpointId===R,n=E===f||p(e.azimuthBin,e.elevationBin)===E,s=L===f||e.meshId===L;return t&&n&&s},w=R!==f||E!==f||L!==f,j=new Set;for(let e of ee.ribbons)k(e)&&(j.add(e.standpointId),j.add(e.gazeId),j.add(e.meshId));let z={standpoint:[.95,.45,.95],gaze:[.45,.75,1],mesh:[1,.82,.42]},y={standpoint:.26,gaze:.13,mesh:.22},M=[...ee.standpoints,...ee.gazes,...ee.meshes],$=new Map(M.map(e=>[e.id,e.pos])),_=new Map(M.map(e=>[e.id,e.label]));for(let e of M){let t=b.CreateSphere(`ts-node-${e.kind}-${e.id}`,{diameter:y[e.kind],segments:8},v);t.position=new h(e.pos[0],e.pos[1],e.pos[2]);let n=new g(`ts-node-mat-${e.kind}-${e.id}`,v);n.disableLighting=!0;let[s,a,i]=z[e.kind];n.emissiveColor=new d(s,a,i),n.alpha=!w||j.has(e.id)?1:.2,t.material=n,t.isPickable=!0,t.metadata={hoverLabel:e.label}}let I=(e,t,n)=>{let s=e[0],a=e[1],i=e[2],o=t[0],l=t[1],r=t[2],c=[(s+o)/2,(a+l)/2+n,(i+r)/2],u=[];for(let e=0;e<=12;e++){let t=e/12,n=1-t;u.push(new h(n*n*s+2*n*t*c[0]+t*t*o,n*n*a+2*n*t*c[1]+t*t*l,n*n*i+2*n*t*c[2]+t*t*r))}return u};for(let e of ee.ribbons){let t=$.get(e.standpointId),n=$.get(e.gazeId),s=$.get(e.meshId);if(!t||!n||!s)continue;let a=e.count/ee.maxCount,i=.18+.5*a,o=[...I(t,n,i),...I(n,s,i).slice(1)],l=k(e),[c,u,h]=(0,r.heatRgb)(a),m=b.CreateTube(`ts-link-${e.standpointId}-${e.gazeId}-${e.meshId}`,{path:o,radius:(l?1:.4)*(.012+.04*a),tessellation:8,cap:0,sideOrientation:0},v),f=new g(`ts-link-mat-${e.standpointId}-${e.gazeId}-${e.meshId}`,v);f.disableLighting=!0,f.emissiveColor=new d(c,u,h),f.alpha=l?.35+.65*a:w?.06:.18,m.material=f,m.isPickable=!0,m.metadata={hoverLabel:_.get(e.meshId)??e.meshId}}let P=new o("ts-cam",Math.PI/2,Math.PI/2.4,8.5,h.Zero(),v);P.attachControl(t,!0),(0,c.disableWheelZoom)(P),C.current=P,new l("ts-light",new h(.3,1,.2),v),x.runRenderLoop(()=>v.render());let A=()=>x.resize();window.addEventListener("resize",A);let B=(0,u.attachMeshHover)(v,t,V);S("ready"),s=()=>{window.removeEventListener("resize",A),B(),V(null),C.current=null,v.dispose(),x.dispose()}}catch(e){if(n)return;S("error"),B(e instanceof Error?e.message:"Failed to render flow links.")}})(),()=>{n=!0,s?.()}},[et,ee,R,E,L]),(0,t.jsx)(d.Panel,{title:"Flow Sankey (3D)",subtitle:"Direction-bin → mesh links (aggregate), or standpoint → gaze → mesh (two-stage)",help:(0,t.jsxs)(t.Fragment,{children:["Each ",(0,t.jsx)("strong",{children:"source"})," is a camera ",(0,t.jsx)("em",{children:"gaze-direction bin"})," — a cell on the sphere of where viewers were looking (grouped by azimuth/elevation). Each"," ",(0,t.jsx)("strong",{children:"target"})," is a ",(0,t.jsx)("em",{children:"mesh that was clicked"}),". A ribbon's thickness is how many clicks on that mesh happened while viewers looked from that direction, so you can see which viewpoints drive interaction with which objects. When the scene reports"," ",(0,t.jsx)("em",{children:"standpoints"}),'(where the viewer stood, §7.8), pick one to gate the flow to clicks made from that vantage — a pin marks it in the scene. "All standpoints" is the aggregate view. Switch to ',(0,t.jsx)("strong",{children:"Two-stage"})," for a three-column"," ",(0,t.jsx)("em",{children:"standpoint → gaze sector → mesh"}),'flow with a birdview minimap; the busiest standpoints/meshes are kept and the tail folds into an "Other" node.']}),children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("canvas",{ref:I,className:"aspect-video w-full rounded-lg border border-edge bg-ink"}),F?(0,t.jsx)("div",{className:"pointer-events-none absolute z-10 max-w-[16rem] truncate rounded border border-edge bg-ink/90 px-1.5 py-0.5 text-xs text-white shadow backdrop-blur",style:{left:F.x+12,top:F.y+12},children:F.label}):null,"ready"===P?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"absolute left-3 top-3 flex flex-wrap gap-2",children:[J?(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-edge bg-ink/80 p-0.5 text-xs backdrop-blur",children:[(0,t.jsx)(x,{active:!et,onClick:()=>T("aggregate"),children:"Aggregate"}),(0,t.jsx)(x,{active:et,onClick:()=>T("twostage"),children:"Two-stage"})]}):null,U?(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-edge bg-ink/80 p-0.5 text-xs backdrop-blur",children:[(0,t.jsx)(x,{active:"first-person"===W,onClick:()=>H("first-person"),children:"Walk"}),(0,t.jsx)(x,{active:"viewer"===W,onClick:()=>H("viewer"),disabled:_,title:_?"Orbit (viewer) flow isn't available for walkable scenes":void 0,children:"Orbit"}),(0,t.jsx)(x,{active:"all"===W,onClick:()=>H("all"),children:"All"})]}):null,J?(0,t.jsx)(g,{label:"Standpoint",value:R,onChange:O,allLabel:"All standpoints",options:er}):null,(0,t.jsx)(g,{label:et?"Gaze":"Source",value:E,onChange:q,allLabel:et?"All gaze sectors":"All sources",options:ec}),(0,t.jsx)(g,{label:"Mesh",value:L,onChange:N,allLabel:"All meshes",options:eu})]}),et?(0,t.jsx)(v,{standpoints:Y,proxyMeshes:j,selectedKey:R,onSelect:e=>O(t=>t===e?f:e)}):null,(0,t.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex max-w-[20rem] flex-col items-end gap-2",children:[U&&!_?(0,t.jsxs)("div",{className:"rounded-md border border-edge bg-ink/80 px-2 py-1 text-xs text-fg-muted backdrop-blur",children:["Orbit-dominated scene — viewer ",(0,t.jsx)("em",{children:"position"})," adds little here. Use the"," ",(0,t.jsx)("strong",{children:"View dome"})," (§7.5) above for where viewers looked."]}):null,(0,t.jsxs)("div",{className:"rounded-md border border-edge bg-ink/80 px-2 py-1 text-xs text-fg backdrop-blur",children:["Active links: ",eo,"/",el]})]}),(0,t.jsx)(m.ZoomButtons,{onZoom:e=>C.current&&(0,c.stepZoom)(C.current,e)}),(0,t.jsx)(h.HeatLegend,{title:"Flow volume",lowLabel:"fewer links",highLabel:"dominant links",note:et?"Three columns: standpoint → gaze sector → mesh. Top standpoints/meshes are kept; the tail folds into an “Other” node. Pick a standpoint (or click the minimap), gaze sector, or mesh to emphasize matching ribbons.":"Each arc aggregates clicks from one camera-direction bin to a mesh. Pick a source or mesh to emphasize matching links and dim the rest."})]}):(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-sm text-fg-muted",children:"loading"===P?"Rendering…":"empty"===P?"No aggregate flow links in range.":"error"===P?A??"Flow view unavailable.":null})]})})}],24543)},36471,e=>{e.n(e.i(24543))},66022,e=>{e.v(t=>Promise.all(["static/chunks/0ys9-ozuluawt.js","static/chunks/2ycvtdd68gub7.js","static/chunks/0v82oqyoy9zol.js","static/chunks/18u58lorfahxi.js","static/chunks/1nj82er7msdto.js","static/chunks/0ufbyo1x3qkmo.js","static/chunks/1yehxf-fmeicg.js"].map(t=>e.l(t))).then(()=>t(94080)))},48505,e=>{e.v(t=>Promise.all(["static/chunks/3v5ha25nxo43j.js","static/chunks/3v3-7fio3nw_t.js","static/chunks/0v82oqyoy9zol.js","static/chunks/3t06schbtqonl.js","static/chunks/1nj82er7msdto.js","static/chunks/3nz-dh9d7cehk.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/18u58lorfahxi.js","static/chunks/2u6shh3oeycm-.js"].map(t=>e.l(t))).then(()=>t(73073)))},53976,e=>{e.v(t=>Promise.all(["static/chunks/3v3-7fio3nw_t.js","static/chunks/10r_824wzt8hj.js","static/chunks/2aor7m-wbis85.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/0v82oqyoy9zol.js","static/chunks/25b9x-li-tvk2.js","static/chunks/2aelw3far6rii.js","static/chunks/0aznt7717miff.js","static/chunks/1_aahautsz2v_.js","static/chunks/1nj82er7msdto.js","static/chunks/3t06schbtqonl.js","static/chunks/18u58lorfahxi.js"].map(t=>e.l(t))).then(()=>t(18662)))},42436,e=>{e.v(t=>Promise.all(["static/chunks/37vzwr3ciejf1.js","static/chunks/157d9euci08yu.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/18u58lorfahxi.js","static/chunks/0v82oqyoy9zol.js"].map(t=>e.l(t))).then(()=>t(12847)))},89370,e=>{e.v(t=>Promise.all(["static/chunks/0dm32-jq30tg8.js","static/chunks/18u58lorfahxi.js","static/chunks/0v82oqyoy9zol.js"].map(t=>e.l(t))).then(()=>t(62566)))},67141,e=>{e.v(t=>Promise.all(["static/chunks/3v3-7fio3nw_t.js","static/chunks/0v82oqyoy9zol.js","static/chunks/3mqy-84_ul3t2.js","static/chunks/1_aahautsz2v_.js","static/chunks/3t06schbtqonl.js","static/chunks/1thjncpj7u6pq.js","static/chunks/10r_824wzt8hj.js","static/chunks/1vdjn0pkoyypn.js","static/chunks/1nj82er7msdto.js","static/chunks/0aznt7717miff.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/18u58lorfahxi.js","static/chunks/2aelw3far6rii.js","static/chunks/3nz-dh9d7cehk.js"].map(t=>e.l(t))).then(()=>t(97998)))},20693,e=>{e.v(t=>Promise.all(["static/chunks/1-61zh4waha61.js","static/chunks/3v3-7fio3nw_t.js","static/chunks/1zx2q-r32thv1.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/0v82oqyoy9zol.js","static/chunks/3nz-dh9d7cehk.js","static/chunks/2u6shh3oeycm-.js","static/chunks/18u58lorfahxi.js","static/chunks/1_aahautsz2v_.js","static/chunks/1nj82er7msdto.js","static/chunks/3t06schbtqonl.js"].map(t=>e.l(t))).then(()=>t(32550)))},96664,e=>{e.v(t=>Promise.all(["static/chunks/1o1d0p-v1z8ty.js","static/chunks/3v3-7fio3nw_t.js","static/chunks/0v82oqyoy9zol.js","static/chunks/3t06schbtqonl.js","static/chunks/3pufs8g4ui943.js","static/chunks/1nj82er7msdto.js","static/chunks/2-sjjedfr0kfq.js","static/chunks/18u58lorfahxi.js","static/chunks/2u6shh3oeycm-.js","static/chunks/3nz-dh9d7cehk.js"].map(t=>e.l(t))).then(()=>t(44981)))}]);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,76535,75017,8881,74596,28799,99904,41520,e=>{"use strict";var t,i,s,r,n,a,o,l,h,c,u,p,d,f,_,g,m,b,S,C,E,y,x,F,A,v,D,P,O,T,R,M,B,k,w,I,L,U,N,V,G,W,H,q,z,j,$,Z,K,Q,X,Y,J,ee,et,ei,es,er,en,ea,eo,el,eh,ec,eu,ep,ed,ef,e_,eg,em,eb,eS,eC,eE,ey,ex,eF,eA,ev,eD,eP,eO,eT,eR,eM,eB,ek,ew,eI,eL,eU,eN,eV,eG,eW,eH,eq,ez,ej,e$,eZ,eK,eQ,eX,eY,eJ,e0=e.i(99267),e1=e.i(13379),e2=e.i(12423),e3=e.i(64545);class e4{constructor(){this._valueCache={},this.vertexCompilationError=null,this.fragmentCompilationError=null,this.programLinkError=null,this.programValidationError=null,this._isDisposed=!1}get isAsync(){return this.isParallelCompiled}get isReady(){return!!this.program&&(!this.isParallelCompiled||this.engine._isRenderingStateCompiled(this))}_handlesSpectorRebuildCallback(e){e&&this.program&&e(this.program)}setEngine(e){this.engine=e}_fillEffectInformation(e,t,i,s,r,n,a,o){let l,h=this.engine;if(h.supportsUniformBuffers)for(let i in t)e.bindUniformBlock(i,t[i]);for(this.engine.getUniforms(this,i).forEach((e,t)=>{s[i[t]]=e}),this._uniforms=s,l=0;l<r.length;l++)null==e.getUniform(r[l])&&(r.splice(l,1),l--);for(let e of(r.forEach((e,t)=>{n[e]=t}),h.getAttributes(this,a)))o.push(e)}dispose(){this._uniforms={},this._isDisposed=!0}_cacheMatrix(e,t){let i=this._valueCache[e],s=t.updateFlag;return(void 0===i||i!==s)&&(this._valueCache[e]=s,!0)}_cacheFloat2(e,t,i){let s=this._valueCache[e];if(!s||2!==s.length)return s=[t,i],this._valueCache[e]=s,!0;let r=!1;return s[0]!==t&&(s[0]=t,r=!0),s[1]!==i&&(s[1]=i,r=!0),r}_cacheFloat3(e,t,i,s){let r=this._valueCache[e];if(!r||3!==r.length)return r=[t,i,s],this._valueCache[e]=r,!0;let n=!1;return r[0]!==t&&(r[0]=t,n=!0),r[1]!==i&&(r[1]=i,n=!0),r[2]!==s&&(r[2]=s,n=!0),n}_cacheFloat4(e,t,i,s,r){let n=this._valueCache[e];if(!n||4!==n.length)return n=[t,i,s,r],this._valueCache[e]=n,!0;let a=!1;return n[0]!==t&&(n[0]=t,a=!0),n[1]!==i&&(n[1]=i,a=!0),n[2]!==s&&(n[2]=s,a=!0),n[3]!==r&&(n[3]=r,a=!0),a}setInt(e,t){let i=this._valueCache[e];(void 0===i||i!==t)&&this.engine.setInt(this._uniforms[e],t)&&(this._valueCache[e]=t)}setInt2(e,t,i){this._cacheFloat2(e,t,i)&&!this.engine.setInt2(this._uniforms[e],t,i)&&(this._valueCache[e]=null)}setInt3(e,t,i,s){this._cacheFloat3(e,t,i,s)&&!this.engine.setInt3(this._uniforms[e],t,i,s)&&(this._valueCache[e]=null)}setInt4(e,t,i,s,r){this._cacheFloat4(e,t,i,s,r)&&!this.engine.setInt4(this._uniforms[e],t,i,s,r)&&(this._valueCache[e]=null)}setIntArray(e,t){this._valueCache[e]=null,this.engine.setIntArray(this._uniforms[e],t)}setIntArray2(e,t){this._valueCache[e]=null,this.engine.setIntArray2(this._uniforms[e],t)}setIntArray3(e,t){this._valueCache[e]=null,this.engine.setIntArray3(this._uniforms[e],t)}setIntArray4(e,t){this._valueCache[e]=null,this.engine.setIntArray4(this._uniforms[e],t)}setUInt(e,t){let i=this._valueCache[e];(void 0===i||i!==t)&&this.engine.setUInt(this._uniforms[e],t)&&(this._valueCache[e]=t)}setUInt2(e,t,i){this._cacheFloat2(e,t,i)&&!this.engine.setUInt2(this._uniforms[e],t,i)&&(this._valueCache[e]=null)}setUInt3(e,t,i,s){this._cacheFloat3(e,t,i,s)&&!this.engine.setUInt3(this._uniforms[e],t,i,s)&&(this._valueCache[e]=null)}setUInt4(e,t,i,s,r){this._cacheFloat4(e,t,i,s,r)&&!this.engine.setUInt4(this._uniforms[e],t,i,s,r)&&(this._valueCache[e]=null)}setUIntArray(e,t){this._valueCache[e]=null,this.engine.setUIntArray(this._uniforms[e],t)}setUIntArray2(e,t){this._valueCache[e]=null,this.engine.setUIntArray2(this._uniforms[e],t)}setUIntArray3(e,t){this._valueCache[e]=null,this.engine.setUIntArray3(this._uniforms[e],t)}setUIntArray4(e,t){this._valueCache[e]=null,this.engine.setUIntArray4(this._uniforms[e],t)}setArray(e,t){this._valueCache[e]=null,this.engine.setArray(this._uniforms[e],t)}setArray2(e,t){this._valueCache[e]=null,this.engine.setArray2(this._uniforms[e],t)}setArray3(e,t){this._valueCache[e]=null,this.engine.setArray3(this._uniforms[e],t)}setArray4(e,t){this._valueCache[e]=null,this.engine.setArray4(this._uniforms[e],t)}setMatrices(e,t){t&&(this._valueCache[e]=null,this.engine.setMatrices(this._uniforms[e],t))}setMatrix(e,t){this._cacheMatrix(e,t)&&!this.engine.setMatrices(this._uniforms[e],t.asArray())&&(this._valueCache[e]=null)}setMatrix3x3(e,t){this._valueCache[e]=null,this.engine.setMatrix3x3(this._uniforms[e],t)}setMatrix2x2(e,t){this._valueCache[e]=null,this.engine.setMatrix2x2(this._uniforms[e],t)}setFloat(e,t){let i=this._valueCache[e];(void 0===i||i!==t)&&this.engine.setFloat(this._uniforms[e],t)&&(this._valueCache[e]=t)}setVector2(e,t){this._cacheFloat2(e,t.x,t.y)&&!this.engine.setFloat2(this._uniforms[e],t.x,t.y)&&(this._valueCache[e]=null)}setFloat2(e,t,i){this._cacheFloat2(e,t,i)&&!this.engine.setFloat2(this._uniforms[e],t,i)&&(this._valueCache[e]=null)}setVector3(e,t){this._cacheFloat3(e,t.x,t.y,t.z)&&!this.engine.setFloat3(this._uniforms[e],t.x,t.y,t.z)&&(this._valueCache[e]=null)}setFloat3(e,t,i,s){this._cacheFloat3(e,t,i,s)&&!this.engine.setFloat3(this._uniforms[e],t,i,s)&&(this._valueCache[e]=null)}setVector4(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&!this.engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)&&(this._valueCache[e]=null)}setQuaternion(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&!this.engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)&&(this._valueCache[e]=null)}setFloat4(e,t,i,s,r){this._cacheFloat4(e,t,i,s,r)&&!this.engine.setFloat4(this._uniforms[e],t,i,s,r)&&(this._valueCache[e]=null)}setColor3(e,t){this._cacheFloat3(e,t.r,t.g,t.b)&&!this.engine.setFloat3(this._uniforms[e],t.r,t.g,t.b)&&(this._valueCache[e]=null)}setColor4(e,t,i){this._cacheFloat4(e,t.r,t.g,t.b,i)&&!this.engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,i)&&(this._valueCache[e]=null)}setDirectColor4(e,t){this._cacheFloat4(e,t.r,t.g,t.b,t.a)&&!this.engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,t.a)&&(this._valueCache[e]=null)}_getVertexShaderCode(){return this.vertexShader?this.engine._getShaderSource(this.vertexShader):null}_getFragmentShaderCode(){return this.fragmentShader?this.engine._getShaderSource(this.fragmentShader):null}}var e7=e.i(46712);let e5={};function e6(e,t,i=""){return i+(t?t+"\n":"")+e}function e8(e,t,i,s,r,n,a){return(a||e5.loadFile||e7.LoadFile)(e,t,i,s,r,n)}function e9(e,t,i,s){if(e){t?e.IS_NDC_HALF_ZRANGE="":delete e.IS_NDC_HALF_ZRANGE,i?e.USE_REVERSE_DEPTHBUFFER="":delete e.USE_REVERSE_DEPTHBUFFER,s?e.USE_EXACT_SRGB_CONVERSIONS="":delete e.USE_EXACT_SRGB_CONVERSIONS;return}{let e="";return t&&(e+="#define IS_NDC_HALF_ZRANGE"),i&&(e&&(e+="\n"),e+="#define USE_REVERSE_DEPTHBUFFER"),s&&(e&&(e+="\n"),e+="#define USE_EXACT_SRGB_CONVERSIONS"),e}}e.s(["EngineFunctionContext",0,e5,"_ConcatenateShader",0,e6,"_GetGlobalDefines",0,e9,"_LoadFile",0,e8,"allocateAndCopyTypedBuffer",0,function(e,t,i=!1,s){switch(e){case 3:{let e=new Int8Array(t);return s&&e.set(new Int8Array(s)),e}case 0:{let e=new Uint8Array(t);return s&&e.set(new Uint8Array(s)),e}case 4:{let e=new Int16Array("number"!=typeof t?t:i?t/2:t);return s&&e.set(new Int16Array(s)),e}case 5:case 8:case 9:case 10:case 2:{let e=new Uint16Array("number"!=typeof t?t:i?t/2:t);return s&&e.set(new Uint16Array(s)),e}case 6:{let e=new Int32Array("number"!=typeof t?t:i?t/4:t);return s&&e.set(new Int32Array(s)),e}case 7:case 11:case 12:case 13:case 14:case 15:{let e=new Uint32Array("number"!=typeof t?t:i?t/4:t);return s&&e.set(new Uint32Array(s)),e}case 1:{let e=new Float32Array("number"!=typeof t?t:i?t/4:t);return s&&e.set(new Float32Array(s)),e}}let r=new Uint8Array(t);return s&&r.set(new Uint8Array(s)),r}],75017);let te=new WeakMap,tt={_webGLVersion:2,cachedPipelines:{}};function ti(e){let t=te.get(e);if(!t){if(!e)return tt;t={_webGLVersion:e.TEXTURE_BINDING_3D?2:1,_context:e,parallelShaderCompile:e.getExtension("KHR_parallel_shader_compile")||void 0,cachedPipelines:{}},te.set(e,t)}return t}function ts(e,t,i,s,r,n){let a=ti(s);return n||(n=a._createShaderProgramInjection??tn),n(e,to(t,"vertex",s,a._contextWasLost),to(i,"fragment",s,a._contextWasLost),s,r,a.validateShaderPrograms)}function tr(e,t,i,s,r,n=null,a){var o,l,h,c,u,p,d,f,_,g,m,b;let S=ti(r);a||(a=S._createShaderProgramInjection??tn);let C=S._webGLVersion>1?"#version 300 es\n#define WEBGL2 \n":"";return a(e,(o=t,l="vertex",h=s,c=C,u=r,p=S._contextWasLost,to(e6(o,h,c),l,u,p)),(d=i,f="fragment",_=s,g=C,m=r,b=S._contextWasLost,to(e6(d,_,g),f,m,b)),r,n,S.validateShaderPrograms)}function tn(e,t,i,s,r=null,n){let a=s.createProgram();if(e.program=a,!a)throw Error("Unable to create program");return s.attachShader(a,t),s.attachShader(a,i),s.linkProgram(a),e.context=s,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||ta(e,s,n),a}function ta(e,t,i){let s=e.context,r=e.vertexShader,n=e.fragmentShader,a=e.program;if(!s.getProgramParameter(a,s.LINK_STATUS)){if(!t.getShaderParameter(r,t.COMPILE_STATUS)){let i=t.getShaderInfoLog(r);if(i)throw e.vertexCompilationError=i,Error("VERTEX SHADER "+i)}if(!t.getShaderParameter(n,t.COMPILE_STATUS)){let i=t.getShaderInfoLog(n);if(i)throw e.fragmentCompilationError=i,Error("FRAGMENT SHADER "+i)}let i=s.getProgramInfoLog(a);if(i)throw e.programLinkError=i,Error(i)}if(i&&(s.validateProgram(a),!s.getProgramParameter(a,s.VALIDATE_STATUS))){let t=s.getProgramInfoLog(a);if(t)throw e.programValidationError=t,Error(t)}s.deleteShader(r),s.deleteShader(n),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)}function to(e,t,i,s){let r=i.createShader("vertex"===t?i.VERTEX_SHADER:i.FRAGMENT_SHADER);if(!r){let e,r=i.NO_ERROR;for(;(e=i.getError())!==i.NO_ERROR;)r=e;throw Error(`Something went wrong while creating a gl ${t} shader object. gl error=${r}, gl isContextLost=${i.isContextLost()}, _contextWasLost=${s}`)}return i.shaderSource(r,e),i.compileShader(r),r}e.s(["_createShaderProgram",0,tn,"_executeWhenRenderingStateIsCompiled",0,function(e,t){if(!e.isParallelCompiled)return void t(e);let i=e.onCompiled;e.onCompiled=()=>{i?.(),t(e)}},"_finalizePipelineContext",0,ta,"_isRenderingStateCompiled",0,function(e,t,i){if(e._isDisposed)return!1;let s=ti(t);return!!(s&&s.parallelShaderCompile&&s.parallelShaderCompile.COMPLETION_STATUS_KHR&&e.program&&t.getProgramParameter(e.program,s.parallelShaderCompile.COMPLETION_STATUS_KHR))&&(ta(e,t,i),!0)},"_preparePipelineContext",0,function(e,t,i,s,r,n,a,o,l,h="",c,u,p){let d=ti(e.context);u||(u=d.createRawShaderProgramInjection??ts),p||(p=d.createShaderProgramInjection??tr),s?e.program=u(e,t,i,e.context,l):e.program=p(e,t,i,o,e.context,l),e.program.__SPECTOR_rebuildProgram=a,c()},"_setProgram",0,function(e,t){t.useProgram(e)},"createPipelineContext",0,function(e,t){let i=new e4,s=ti(e);return s.parallelShaderCompile&&!s.disableParallelShaderCompile&&(i.isParallelCompiled=!0),i.context=s._context,i},"createRawShaderProgram",0,ts,"createShaderProgram",0,tr,"deleteStateObject",0,function(e){te.delete(e)},"getStateObject",0,ti],8881);class tl{constructor(){this.children=[]}isValid(e){return!0}process(e,t,i){let s="";if(this.line){let i=this.line,r=t.processor;if(r){r.lineProcessor&&(i=r.lineProcessor(i,t.isFragment,t.processingContext));let s=t.processor?.attributeKeywordName??"attribute",n=t.isFragment&&t.processor?.varyingFragmentKeywordName?t.processor?.varyingFragmentKeywordName:!t.isFragment&&t.processor?.varyingVertexKeywordName?t.processor?.varyingVertexKeywordName:"varying";!t.isFragment&&r.attributeProcessor&&this.line.startsWith(s)?i=r.attributeProcessor(this.line,e,t.processingContext):r.varyingProcessor&&(r.varyingCheck?.(this.line,t.isFragment)||!r.varyingCheck&&this.line.startsWith(n))?i=r.varyingProcessor(this.line,t.isFragment,e,t.processingContext):r.uniformProcessor&&r.uniformRegexp&&r.uniformRegexp.test(this.line)?t.lookForClosingBracketForUniformBuffer||(i=r.uniformProcessor(this.line,t.isFragment,e,t.processingContext)):r.uniformBufferProcessor&&r.uniformBufferRegexp&&r.uniformBufferRegexp.test(this.line)?t.lookForClosingBracketForUniformBuffer||(i=r.uniformBufferProcessor(this.line,t.isFragment,t.processingContext),t.lookForClosingBracketForUniformBuffer=!0):r.textureProcessor&&r.textureRegexp&&r.textureRegexp.test(this.line)?i=r.textureProcessor(this.line,t.isFragment,e,t.processingContext):(r.uniformProcessor||r.uniformBufferProcessor)&&this.line.startsWith("uniform")&&!t.lookForClosingBracketForUniformBuffer&&(/uniform\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/.test(this.line)?r.uniformProcessor&&(i=r.uniformProcessor(this.line,t.isFragment,e,t.processingContext)):r.uniformBufferProcessor&&(i=r.uniformBufferProcessor(this.line,t.isFragment,t.processingContext),t.lookForClosingBracketForUniformBuffer=!0)),t.lookForClosingBracketForUniformBuffer&&-1!==this.line.indexOf("}")&&(t.lookForClosingBracketForUniformBuffer=!1,r.endOfUniformBufferProcessor&&(i=r.endOfUniformBufferProcessor(this.line,t.isFragment,t.processingContext)))}s+=i+"\n"}for(let r of this.children)s+=r.process(e,t,i);return this.additionalDefineKey&&(e[this.additionalDefineKey]=this.additionalDefineValue||"true",i[this.additionalDefineKey]=e[this.additionalDefineKey]),s}}class th{constructor(){this._lines=[]}get currentLine(){return this._lines[this.lineIndex]}get canRead(){return this.lineIndex<this._lines.length-1}set lines(e){for(let t of(this._lines.length=0,e)){if(!t||"\r"===t)continue;if("#"===t[0]){this._lines.push(t);continue}let e=t.trim();if(!e)continue;if(e.startsWith("//")){this._lines.push(t);continue}let i=e.indexOf(";");if(-1===i)this._lines.push(e);else if(i===e.length-1)e.length>1&&this._lines.push(e);else{let e=t.split(";");for(let t=0;t<e.length;t++){let i=e[t];i&&(i=i.trim())&&this._lines.push(i+(t!==e.length-1?";":""))}}}}}class tc extends tl{process(e,t,i){for(let s=0;s<this.children.length;s++){let r=this.children[s];if(r.isValid(e))return r.process(e,t,i)}return""}}class tu extends tl{isValid(e){return this.testExpression.isTrue(e)}}class tp{isTrue(e){return!0}static postfixToInfix(e){let t=[];for(let i of e)if(void 0===tp._OperatorPriority[i])t.push(i);else{let e=t[t.length-1],s=t[t.length-2];t.length-=2,t.push(`(${s}${i}${e})`)}return t[t.length-1]}static infixToPostfix(e){let t=tp._InfixToPostfixCache.get(e);if(t)return t.accessTime=Date.now(),t.result;if(!e.includes("&&")&&!e.includes("||")&&!e.includes(")")&&!e.includes("("))return[e];let i=[],s=-1,r=()=>{""!==(h=h.trim())&&(i.push(h),h="")},n=e=>{s<tp._Stack.length-1&&(tp._Stack[++s]=e)},a=()=>tp._Stack[s],o=()=>-1===s?"!!INVALID EXPRESSION!!":tp._Stack[s--],l=0,h="";for(;l<e.length;){let t=e.charAt(l),c=l<e.length-1?e.substring(l,2+l):"";if("("===t)h="",n(t);else if(")"===t){for(r();-1!==s&&"("!==a();)i.push(o());o()}else if(tp._OperatorPriority[c]>1){for(r();-1!==s&&tp._OperatorPriority[a()]>=tp._OperatorPriority[c];)i.push(o());n(c),l++}else h+=t;l++}for(r();-1!==s;)"("===a()?o():i.push(o());return tp._InfixToPostfixCache.size>=tp.InfixToPostfixCacheLimitSize&&tp.ClearCache(),tp._InfixToPostfixCache.set(e,{result:i,accessTime:Date.now()}),i}static ClearCache(){let e=Array.from(tp._InfixToPostfixCache.entries()).sort((e,t)=>e[1].accessTime-t[1].accessTime);for(let t=0;t<tp.InfixToPostfixCacheCleanupSize;t++)tp._InfixToPostfixCache.delete(e[t][0])}}tp.InfixToPostfixCacheLimitSize=5e4,tp.InfixToPostfixCacheCleanupSize=25e3,tp._InfixToPostfixCache=new Map,tp._OperatorPriority={")":0,"(":1,"||":2,"&&":3},tp._Stack=["","","","","","","","","","","","","","","","","","","",""];class td extends tp{constructor(e,t=!1){super(),this.define=e,this.not=t}isTrue(e){let t=void 0!==e[this.define];return this.not&&(t=!t),t}}class tf extends tp{isTrue(e){return this.leftOperand.isTrue(e)||this.rightOperand.isTrue(e)}}class t_ extends tp{isTrue(e){return this.leftOperand.isTrue(e)&&this.rightOperand.isTrue(e)}}class tg extends tp{constructor(e,t,i){super(),this.define=e,this.operand=t,this.testValue=i}toString(){return`${this.define} ${this.operand} ${this.testValue}`}isTrue(e){let t=!1,i=parseInt(void 0!=e[this.define]?e[this.define]:this.define),s=parseInt(void 0!=e[this.testValue]?e[this.testValue]:this.testValue);if(isNaN(i)||isNaN(s))return!1;switch(this.operand){case">":t=i>s;break;case"<":t=i<s;break;case"<=":t=i<=s;break;case">=":t=i>=s;break;case"==":t=i===s;break;case"!=":t=i!==s}return t}}let tm=/defined\s*?\((.+?)\)/g,tb=/defined\s*?\[(.+?)\]/g,tS=/#include\s?<(.+)>(\((.*)\))*(\[(.*)\])*/g,tC=/__decl__/,tE=/light\{X\}.(\w*)/g,ty=/\{X\}/g,tx=[],tF=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;function tA(e){e.processor&&e.processor.initializeShaders&&e.processor.initializeShaders(e.processingContext)}function tv(e,t,i,s){t.processor?.preProcessShaderCode&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),tM(e,t,e=>{t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?"fragment":"vertex",e,t.defines)),i(function(e,t,i){var s;let r,n,a=function(e,t){if(t.processor?.noPrecision)return e;let i=t.shouldUseHighPrecisionShader;return -1===e.indexOf("precision highp float")?e=i?"precision highp float;\n"+e:"precision mediump float;\n"+e:i||(e=e.replace("precision highp float","precision mediump float")),e}(e,t);if(!t.processor||0===t.processor.shaderLanguage&&-1!==a.indexOf("#version 3")&&(a=a.replace("#version 300 es",""),!t.processor.parseGLES3))return a;let o=t.defines,l=function(e,t){let i=e.defines,s={};for(let e of i){let t=e.replace("#define","").replace(";","").trim().split(" ");s[t[0]]=t.length>1?t[1]:""}return e.processor?.shaderLanguage===0&&(s.GL_ES="true"),s.__VERSION__=e.version,s[e.platformName]="true",e9(s,t?.isNDCHalfZRange,t?.useReverseDepthBuffer,t?.useExactSrgbConversions),s}(t,i);t.processor.preProcessor&&(a=t.processor.preProcessor(a,o,l,t.isFragment,t.processingContext));let h={};return s=a,r=new tl,(n=new th).lineIndex=-1,n.lines=s.split("\n"),tR(n,r,h),a=r.process(l,t,h),t.processor.postProcessor&&(a=t.processor.postProcessor(a,o,t.isFragment,t.processingContext,i?{drawBuffersExtensionDisabled:!i.getCaps().drawBuffersExtension}:{},l,h)),i?._features.needShaderCodeInlining&&(a=i.inlineShaderCode(a)),a}(e,t,s),e)})}function tD(e,t,i){return i.processor&&i.processor.finalizeShaders?i.processor.finalizeShaders(e,t,i.processingContext):{vertexCode:e,fragmentCode:t}}function tP(e){let t=/defined\((.+)\)/.exec(e);if(t&&t.length)return new td(t[1].trim(),"!"===e[0]);let i="",s=0;for(i of["==","!=",">=","<=","<",">"])if((s=e.indexOf(i))>-1)break;if(-1===s)return new td(e);let r=e.substring(0,s).trim(),n=e.substring(s+i.length).trim();return new tg(r,i,n)}function tO(e,t){let i=new tu,s=e.substring(0,t),r=e.substring(t);return r=r.substring(0,(r.indexOf("//")+1||r.length+1)-1).trim(),"#ifdef"===s?i.testExpression=new td(r):"#ifndef"===s?i.testExpression=new td(r,!0):i.testExpression=function(e){e=e.replace(tm,"defined[$1]");let t=tp.infixToPostfix(e),i=[];for(let e of t)if("||"!==e&&"&&"!==e)i.push(e);else if(i.length>=2){let t=i[i.length-1],s=i[i.length-2];i.length-=2;let r="&&"==e?new t_:new tf;"string"==typeof t&&(t=t.replace(tb,"defined($1)")),"string"==typeof s&&(s=s.replace(tb,"defined($1)")),r.leftOperand="string"==typeof s?tP(s):s,r.rightOperand="string"==typeof t?tP(t):t,i.push(r)}let s=i[i.length-1];return"string"==typeof s&&(s=s.replace(tb,"defined($1)")),"string"==typeof s?tP(s):s}(r),i}function tT(e,t,i,s){let r;for(;tR(e,i,s);){let n=(r=e.currentLine).substring(0,5).toLowerCase();if("#else"===n){let i=new tl;t.children.push(i),tR(e,i,s);return}if("#elif"===n){let e=tO(r,5);t.children.push(e),i=e}}}function tR(e,t,i){for(;e.canRead;){e.lineIndex++;let s=e.currentLine;if(s.indexOf("#")>=0){let r=tF.exec(s);if(r&&r.length){switch(r[0]){case"#ifdef":{let r=new tc;t.children.push(r);let n=tO(s,6);r.children.push(n),tT(e,r,n,i);break}case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":{let r=new tc;t.children.push(r);let n=tO(s,7);r.children.push(n),tT(e,r,n,i);break}case"#if":{let r=new tc,n=tO(s,3);t.children.push(r),r.children.push(n),tT(e,r,n,i)}}continue}}let r=new tl;if(r.line=s,t.children.push(r),"#"===s[0]&&"d"===s[1]){let e=s.replace(";","").split(" ");r.additionalDefineKey=e[1],3===e.length&&(r.additionalDefineValue=e[2])}}return!1}function tM(e,t,i){let s;for(tx.length=0;null!==(s=tS.exec(e));)tx.push(s);let r=[e],n=!1;for(let e of tx){let s=e[1];if(-1!==s.indexOf("__decl__")&&(s=s.replace(tC,""),t.supportsUniformBuffers&&(s=s.replace("Vertex","Ubo").replace("Fragment","Ubo")),s+="Declaration"),t.includesShadersStore[s]){let i=t.includesShadersStore[s];if(e[2]){let t=e[3].split(",");for(let e=0;e<t.length;e+=2){let s=RegExp(t[e],"g"),r=t[e+1];i=i.replace(s,r)}}if(e[4]){let s=e[5];if(-1!==s.indexOf("..")){let e=s.split(".."),r=parseInt(e[0]),n=parseInt(e[1]),a=i.slice(0);i="",isNaN(n)&&(n=t.indexParameters[e[1]]);for(let e=r;e<n;e++)t.supportsUniformBuffers||(a=a.replace(tE,(e,t)=>t+"{X}")),i+=a.replace(ty,e.toString())+"\n"}else t.supportsUniformBuffers||(i=i.replace(tE,(e,t)=>t+"{X}")),i=i.replace(ty,s)}let a=[];for(let t of r){let s=t.split(e[0]);for(let e=0;e<s.length-1;e++)a.push(s[e]),a.push(i);a.push(s[s.length-1])}r=a,n=n||i.indexOf("#include<")>=0||i.indexOf("#include <")>=0}else{let e=t.shadersRepository+"ShadersInclude/"+s+".fx";(0,e7.LoadFile)(e,e=>{t.includesShadersStore[s]=e,tM(r.join(""),t,i)});return}}tx.length=0;let a=r.join("");n?tM(a.toString(),t,i):i(a)}function tB(e,t){return ti(t).cachedPipelines[e]}function tk(e){let t=e._name,i=e.context;if(t&&i){let e=ti(i),s=e.cachedPipelines[t];s?.dispose(),delete e.cachedPipelines[t]}}function tw(e,t,i,s,r,n,a){let o,l,h=(0,e3.IsWindowObjectExist)()?n?.getHostDocument():null;o="string"==typeof t?t:"string"==typeof t.vertexSource?"source:"+t.vertexSource:"string"==typeof t.vertexElement?h?.getElementById(t.vertexElement)||t.vertexElement:t.vertex||t,l="string"==typeof t?t:"string"==typeof t.fragmentSource?"source:"+t.fragmentSource:"string"==typeof t.fragmentElement?h?.getElementById(t.fragmentElement)||t.fragmentElement:t.fragment||t;let c=[void 0,void 0],u=()=>{if(c[0]&&c[1]){let[o,l]=c;tA(e),tv(o,e,(o,h)=>{a&&(a._vertexSourceCodeBeforeMigration=h),i&&(o=i("vertex",o)),e.isFragment=!0,tv(l,e,(n,l)=>{var h,c,u,p;a&&(a._fragmentSourceCodeBeforeMigration=l),i&&(n=i("fragment",n));let d=tD(o,n,e);e=null;let f=(h=d.vertexCode,c=d.fragmentCode,u=t,p=r,u?{vertexSourceCode:(1===p?"//":"")+"#define SHADER_NAME vertex:"+(u.vertexElement||u.vertex||u.spectorName||u)+"\n"+h,fragmentSourceCode:(1===p?"//":"")+"#define SHADER_NAME fragment:"+(u.fragmentElement||u.fragment||u.spectorName||u)+"\n"+c}:{vertexSourceCode:h,fragmentSourceCode:c});s?.(f.vertexSourceCode,f.fragmentSourceCode)},n)},n)}};tI(o,"Vertex","",e=>{a&&(a._rawVertexSourceCode=e),c[0]=e,u()},r),tI(l,"Fragment","Pixel",e=>{a&&(a._rawFragmentSourceCode=e),c[1]=e,u()},r)}function tI(e,t,i,s,r,n){let a;if("u">typeof HTMLElement&&e instanceof HTMLElement)return void s((0,e3.GetDOMTextContent)(e));if("source:"===e.substring(0,7))return void s(e.substring(7));if("base64:"===e.substring(0,7))return void s(window.atob(e.substring(7)));let o=e2.ShaderStore.GetShadersStore(r);if(o[e+t+"Shader"])return void s(o[e+t+"Shader"]);if(i&&o[e+i+"Shader"])return void s(o[e+i+"Shader"]);if(a="."===e[0]||"/"===e[0]||e.indexOf("http")>-1?e:e2.ShaderStore.GetShadersRepository(r)+e,!(n=n||e8))throw Error("loadFileInjection is not defined");n(a+"."+t.toLowerCase()+".fx",s)}e7.LoadFile,e.s(["Finalize",0,tD,"Initialize",0,tA,"Process",0,tv,"ProcessIncludes",0,tM],74596);let tL=(e,t,i,s)=>{try{let r=e.context?ti(e.context):null;r&&(r.disableParallelShaderCompile=e.disableParallelCompilation);let n=e.existingPipelineContext||t(e.shaderProcessingContext);return n._name=e.name,e.name&&r&&(r.cachedPipelines[e.name]=n),i(n,e.vertex,e.fragment,!!e.createAsRaw,"","",e.rebuildRebind,e.defines,e.transformFeedbackVaryings,"",()=>{s(n,()=>{e.onRenderingStateCompiled?.(n)})}),n}catch(e){throw e1.Logger.Error("Error compiling effect"),e}};e.s(["_ProcessShaderCode",0,tw,"createAndPreparePipelineContext",0,tL,"getCachedPipeline",0,tB,"resetCachedPipeline",0,tk],28799);var tU=e.i(23240),tN=e.i(75405);class tV{static get ShadersRepository(){return e2.ShaderStore.ShadersRepository}static set ShadersRepository(e){e2.ShaderStore.ShadersRepository=e}get isDisposed(){return this._isDisposed}get onBindObservable(){return this._onBindObservable||(this._onBindObservable=new e0.Observable),this._onBindObservable}get shaderLanguage(){return this._shaderLanguage}constructor(e,t,i,s=null,r,n=null,a=null,o=null,l=null,h,c="",u=0,p){let d;this.defines="",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new e0.Observable,this.onErrorObservable=new e0.Observable,this._onBindObservable=null,this._isDisposed=!1,this._refCount=1,this._bonesComputationForcedToCPU=!1,this._uniformBuffersNames={},this._multiTarget=!1,this._samplers={},this._isReady=!1,this._compilationError="",this._allFallbacksProcessed=!1,this._uniforms={},this._key="",this._fallbacks=null,this._vertexSourceCodeOverride="",this._fragmentSourceCodeOverride="",this._transformFeedbackVaryings=null,this._disableParallelShaderCompilation=!1,this._pipelineContext=null,this._vertexSourceCode="",this._fragmentSourceCode="",this._vertexSourceCodeBeforeMigration="",this._fragmentSourceCodeBeforeMigration="",this._rawVertexSourceCode="",this._rawFragmentSourceCode="",this._processCodeAfterIncludes=void 0,this._processFinalCode=null,this._onReleaseEffectsObserver=null,this.name=e,this._key=c;const f=this._key.replace(/\r/g,"").replace(/\n/g,"|");if(t.attributes){if(this._engine=i,this._attributesNames=t.attributes,this._uniformsNames=t.uniformsNames.concat(t.samplers),this._samplerList=t.samplers.slice(),this.defines=t.defines,this.onError=t.onError,this.onCompiled=t.onCompiled,this._fallbacks=t.fallbacks,this._indexParameters=t.indexParameters,this._transformFeedbackVaryings=t.transformFeedbackVaryings||null,this._multiTarget=!!t.multiTarget,this._shaderLanguage=t.shaderLanguage??0,this._disableParallelShaderCompilation=!!t.disableParallelShaderCompilation,t.uniformBuffersNames){this._uniformBuffersNamesList=t.uniformBuffersNames.slice();for(let e=0;e<t.uniformBuffersNames.length;e++)this._uniformBuffersNames[t.uniformBuffersNames[e]]=e}this._processFinalCode=t.processFinalCode??null,this._processCodeAfterIncludes=t.processCodeAfterIncludes??void 0,p=t.extraInitializationsAsync,d=t.existingPipelineContext}else this._engine=r,this.defines=null==n?"":n,this._uniformsNames=i.concat(s),this._samplerList=s?s.slice():[],this._attributesNames=t,this._uniformBuffersNamesList=[],this._shaderLanguage=u,this.onError=l,this.onCompiled=o,this._indexParameters=h,this._fallbacks=a;"WEBGL2"===this._engine.shaderPlatformName&&(d=tB(f,this._engine._gl)??d),this._attributeLocationByName={},this.uniqueId=tV._UniqueIdSeed++,d?(this._pipelineContext=d,this._pipelineContext.setEngine(this._engine),this._onRenderingStateCompiled(this._pipelineContext),this._pipelineContext.program&&(this._pipelineContext.program.__SPECTOR_rebuildProgram=this._rebuildProgram.bind(this))):this._processShaderCodeAsync(null,!1,null,p).catch(e=>{let t=e?.message??String(e),i=Error(`Effect async shader preparation failed for "${String(this.name)}": ${t}`);e&&"string"==typeof e.stack&&(i.stack=`${i.message}
|
|
2
|
+
Caused by: ${e.stack}`),this._processCompilationErrors(i)}),this._onReleaseEffectsObserver=this._engine.onReleaseEffectsObservable.addOnce(()=>{this._onReleaseEffectsObserver=null,this.isDisposed||this.dispose(!0)})}async _processShaderCodeAsync(e=null,t=!1,i=null,s){s&&await s(),this._processingContext=i||this._engine._getShaderProcessingContext(this._shaderLanguage,!1),tw({defines:this.defines.split("\n"),indexParameters:this._indexParameters,isFragment:!1,shouldUseHighPrecisionShader:this._engine._shouldUseHighPrecisionShader,processor:e??this._engine._getShaderProcessor(this._shaderLanguage),supportsUniformBuffers:this._engine.supportsUniformBuffers,shadersRepository:e2.ShaderStore.GetShadersRepository(this._shaderLanguage),includesShadersStore:e2.ShaderStore.GetIncludesShadersStore(this._shaderLanguage),version:(100*this._engine.version).toString(),platformName:this._engine.shaderPlatformName,processingContext:this._processingContext,isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer,processCodeAfterIncludes:this._processCodeAfterIncludes},this.name,this._processFinalCode,(e,i)=>{this._vertexSourceCode=e,this._fragmentSourceCode=i,this._prepareEffect(t)},this._shaderLanguage,this._engine,this)}get key(){return this._key}isReady(){try{return this._isReadyInternal()}catch{return!1}}_isReadyInternal(){return!!this._engine.isDisposed||!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady}getEngine(){return this._engine}getPipelineContext(){return this._pipelineContext}getAttributesNames(){return this._attributesNames}getAttributeLocation(e){return this._attributes[e]}getAttributeLocationByName(e){return this._attributeLocationByName[e]}getAttributesCount(){return this._attributes.length}getUniformIndex(e){return this._uniformsNames.indexOf(e)}getUniform(e){return this._uniforms[e]}getSamplers(){return this._samplerList}getUniformNames(){return this._uniformsNames}getUniformBuffersNames(){return this._uniformBuffersNamesList}getIndexParameters(){return this._indexParameters}getCompilationError(){return this._compilationError}allFallbacksProcessed(){return this._allFallbacksProcessed}async whenCompiledAsync(){return await new Promise(e=>{this.executeWhenCompiled(e)})}executeWhenCompiled(e){this.isReady()?e(this):(this.onCompileObservable.add(t=>{e(t)}),(!this._pipelineContext||this._pipelineContext.isAsync)&&this._checkIsReady(null))}_checkIsReady(e){(0,tU._RetryWithInterval)(()=>this._isReadyInternal()||this._isDisposed,()=>{},t=>{this._processCompilationErrors(t,e)},16,12e4,!0,` - Effect: ${"string"==typeof this.name?this.name:this.key}`)}get vertexSourceCode(){return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._vertexSourceCodeOverride:this._pipelineContext?._getVertexShaderCode()??this._vertexSourceCode}get fragmentSourceCode(){return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._fragmentSourceCodeOverride:this._pipelineContext?._getFragmentShaderCode()??this._fragmentSourceCode}get vertexSourceCodeBeforeMigration(){return this._vertexSourceCodeBeforeMigration}get fragmentSourceCodeBeforeMigration(){return this._fragmentSourceCodeBeforeMigration}get rawVertexSourceCode(){return this._rawVertexSourceCode}get rawFragmentSourceCode(){return this._rawFragmentSourceCode}getPipelineGenerationOptions(){return{platformName:this._engine.shaderPlatformName,shaderLanguage:this._shaderLanguage,shaderNameOrContent:this.name,key:this._key,defines:this.defines.split("\n"),addGlobalDefines:!1,extendedProcessingOptions:{indexParameters:this._indexParameters,isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer,supportsUniformBuffers:this._engine.supportsUniformBuffers},extendedCreatePipelineOptions:{transformFeedbackVaryings:this._transformFeedbackVaryings,createAsRaw:!!(this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride)}}}_rebuildProgram(e,t,i,s){this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=(e,t)=>{s&&s(t)},this.onCompiled=()=>{let e=this.getEngine().scenes;if(e)for(let t=0;t<e.length;t++)e[t].markAllMaterialsAsDirty(127);this._pipelineContext._handlesSpectorRebuildCallback?.(i)},this._fallbacks=null,this._prepareEffect()}_onRenderingStateCompiled(e){if(this._pipelineContext=e,this._pipelineContext.setEngine(this._engine),this._attributes=[],this._pipelineContext._fillEffectInformation(this,this._uniformBuffersNames,this._uniformsNames,this._uniforms,this._samplerList,this._samplers,this._attributesNames,this._attributes),this._attributesNames)for(let e=0;e<this._attributesNames.length;e++){let t=this._attributesNames[e];this._attributeLocationByName[t]=this._attributes[e]}this._engine.bindSamplers(this),this._compilationError="",this._isReady=!0,this.onCompiled&&this.onCompiled(this),this.onCompileObservable.notifyObservers(this),this.onCompileObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh(),tV.AutomaticallyClearCodeCache&&this.clearCodeCache()}_prepareEffect(e=!1){let t=this._pipelineContext;this._isReady=!1;try{let i=!!(this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride),s=i?null:this.defines,r=i?this._vertexSourceCodeOverride:this._vertexSourceCode,n=i?this._fragmentSourceCodeOverride:this._fragmentSourceCode,a=this._engine;this._pipelineContext=tL({existingPipelineContext:e?t:null,vertex:r,fragment:n,context:"WEBGL2"===a.shaderPlatformName||"WEBGL1"===a.shaderPlatformName?a._gl:void 0,rebuildRebind:(e,t,i,s)=>this._rebuildProgram(e,t,i,s),defines:s,transformFeedbackVaryings:this._transformFeedbackVaryings,name:this._key.replace(/\r/g,"").replace(/\n/g,"|"),createAsRaw:i,disableParallelCompilation:this._disableParallelShaderCompilation,shaderProcessingContext:this._processingContext,onRenderingStateCompiled:i=>{t&&!e&&this._engine._deletePipelineContext(t),i&&this._onRenderingStateCompiled(i)}},this._engine.createPipelineContext.bind(this._engine),this._engine._preparePipelineContextAsync.bind(this._engine),this._engine._executeWhenRenderingStateIsCompiled.bind(this._engine)),this._pipelineContext.isAsync&&this._checkIsReady(t)}catch(e){this._processCompilationErrors(e,t)}}_getShaderCodeAndErrorLine(e,t,i){let s=null;if(t&&e){let r=t.match(i?/FRAGMENT SHADER ERROR: 0:(\d+?):/:/VERTEX SHADER ERROR: 0:(\d+?):/);if(r&&2===r.length){let t=parseInt(r[1]),n=e.split("\n",-1);n.length>=t&&(s=`Offending line [${t}] in ${i?"fragment":"vertex"} code: ${n[t-1]}`)}}return[e,s]}_processCompilationErrors(e,t=null){this._compilationError="string"==typeof e?.stack?e.stack:e?.message??String(e);let i=this._attributesNames,s=this._fallbacks;if(e1.Logger.Error("Unable to compile effect:"),e1.Logger.Error(`Uniforms: ${this._uniformsNames.join(" ")}`),e1.Logger.Error(`Attributes: ${i.join(" ")}`),e1.Logger.Error("Defines:\n"+this.defines),tV.LogShaderCodeOnCompilationError){let e,t=null,i=null;this._pipelineContext?._getVertexShaderCode()&&([e,t]=this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(),this._compilationError,!1),e&&(e1.Logger.Error("Vertex code:"),e1.Logger.Error(e))),this._pipelineContext?._getFragmentShaderCode()&&([e,i]=this._getShaderCodeAndErrorLine(this._pipelineContext?._getFragmentShaderCode(),this._compilationError,!0),e&&(e1.Logger.Error("Fragment code:"),e1.Logger.Error(e))),t&&e1.Logger.Error(t),i&&e1.Logger.Error(i)}e1.Logger.Error("Error: "+this._compilationError);let r=()=>{this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this),this._engine.onEffectErrorObservable.notifyObservers({effect:this,errors:this._compilationError})};t&&(this._pipelineContext=t,this._isReady=!0,r()),s?(this._pipelineContext=null,s.hasMoreFallbacks?(this._allFallbacksProcessed=!1,e1.Logger.Error("Trying next fallback."),this.defines=s.reduce(this.defines,this),this._prepareEffect()):(this._allFallbacksProcessed=!0,r(),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())):(this._allFallbacksProcessed=!0,t||r())}get isSupported(){return""===this._compilationError}_bindTexture(e,t){this._engine._bindTexture(this._samplers[e],t,e)}setTexture(e,t){this._engine.setTexture(this._samplers[e],this._uniforms[e],t,e)}setTextureArray(e,t){let i=e+"Ex";if(-1===this._samplerList.indexOf(i+"0")){let s=this._samplerList.indexOf(e);for(let e=1;e<t.length;e++){let t=i+(e-1).toString();this._samplerList.splice(s+e,0,t)}let r=0;for(let e of this._samplerList)this._samplers[e]=r,r+=1}this._engine.setTextureArray(this._samplers[e],this._uniforms[e],t,e)}bindUniformBuffer(e,t){let i=this._uniformBuffersNames[t];void 0===i||tV._BaseCache[i]===e&&this._engine._features.useUBOBindingCache||(tV._BaseCache[i]=e,this._engine.bindUniformBufferBase(e,i,t))}bindUniformBlock(e,t){this._engine.bindUniformBlock(this._pipelineContext,e,t)}setInt(e,t){return this._pipelineContext.setInt(e,t),this}setInt2(e,t,i){return this._pipelineContext.setInt2(e,t,i),this}setInt3(e,t,i,s){return this._pipelineContext.setInt3(e,t,i,s),this}setInt4(e,t,i,s,r){return this._pipelineContext.setInt4(e,t,i,s,r),this}setIntArray(e,t){return this._pipelineContext.setIntArray(e,t),this}setIntArray2(e,t){return this._pipelineContext.setIntArray2(e,t),this}setIntArray3(e,t){return this._pipelineContext.setIntArray3(e,t),this}setIntArray4(e,t){return this._pipelineContext.setIntArray4(e,t),this}setUInt(e,t){return this._pipelineContext.setUInt(e,t),this}setUInt2(e,t,i){return this._pipelineContext.setUInt2(e,t,i),this}setUInt3(e,t,i,s){return this._pipelineContext.setUInt3(e,t,i,s),this}setUInt4(e,t,i,s,r){return this._pipelineContext.setUInt4(e,t,i,s,r),this}setUIntArray(e,t){return this._pipelineContext.setUIntArray(e,t),this}setUIntArray2(e,t){return this._pipelineContext.setUIntArray2(e,t),this}setUIntArray3(e,t){return this._pipelineContext.setUIntArray3(e,t),this}setUIntArray4(e,t){return this._pipelineContext.setUIntArray4(e,t),this}setFloatArray(e,t){return this._pipelineContext.setArray(e,t),this}setFloatArray2(e,t){return this._pipelineContext.setArray2(e,t),this}setFloatArray3(e,t){return this._pipelineContext.setArray3(e,t),this}setFloatArray4(e,t){return this._pipelineContext.setArray4(e,t),this}setArray(e,t){return this._pipelineContext.setArray(e,t),this}setArray2(e,t){return this._pipelineContext.setArray2(e,t),this}setArray3(e,t){return this._pipelineContext.setArray3(e,t),this}setArray4(e,t){return this._pipelineContext.setArray4(e,t),this}setMatrices(e,t){return this._pipelineContext.setMatrices(e,t),this}setMatrix(e,t){return this._pipelineContext.setMatrix(e,t),this}setMatrix3x3(e,t){return this._pipelineContext.setMatrix3x3(e,t),this}setMatrix2x2(e,t){return this._pipelineContext.setMatrix2x2(e,t),this}setFloat(e,t){return this._pipelineContext.setFloat(e,t),this}setBool(e,t){return this._pipelineContext.setInt(e,+!!t),this}setVector2(e,t){return this._pipelineContext.setVector2(e,t),this}setFloat2(e,t,i){return this._pipelineContext.setFloat2(e,t,i),this}setVector3(e,t){return this._pipelineContext.setVector3(e,t),this}setFloat3(e,t,i,s){return this._pipelineContext.setFloat3(e,t,i,s),this}setVector4(e,t){return this._pipelineContext.setVector4(e,t),this}setQuaternion(e,t){return this._pipelineContext.setQuaternion(e,t),this}setFloat4(e,t,i,s,r){return this._pipelineContext.setFloat4(e,t,i,s,r),this}setColor3(e,t){return this._pipelineContext.setColor3(e,t),this}setColor4(e,t,i){return this._pipelineContext.setColor4(e,t,i),this}setDirectColor4(e,t){return this._pipelineContext.setDirectColor4(e,t),this}clearCodeCache(){this._vertexSourceCode="",this._fragmentSourceCode="",this._fragmentSourceCodeBeforeMigration="",this._vertexSourceCodeBeforeMigration=""}dispose(e=!1){if(e)this._refCount=0;else{if(tV.PersistentMode)return;this._refCount--}this._refCount>0||this._isDisposed||(this._onReleaseEffectsObserver&&(this._engine.onReleaseEffectsObservable.remove(this._onReleaseEffectsObserver),this._onReleaseEffectsObserver=null),this._pipelineContext&&tk(this._pipelineContext),this._engine._releaseEffect(this),this.clearCodeCache(),this._isDisposed=!0)}static RegisterShader(e,t,i,s=0){t&&(e2.ShaderStore.GetShadersStore(s)[`${e}PixelShader`]=t),i&&(e2.ShaderStore.GetShadersStore(s)[`${e}VertexShader`]=i)}static ResetCache(){tV._BaseCache={}}}tV.LogShaderCodeOnCompilationError=!0,tV.PersistentMode=!1,tV.AutomaticallyClearCodeCache=!1,tV._UniqueIdSeed=0,tV._BaseCache={},tV.ShadersStore=e2.ShaderStore.ShadersStore,tV.IncludesShadersStore=e2.ShaderStore.IncludesShadersStore,(t=tV.prototype).setDepthStencilTexture??(t.setDepthStencilTexture=(0,tN._MissingSideEffect)("Effect","setDepthStencilTexture")),(i=tV.prototype).setTextureFromPostProcess??(i.setTextureFromPostProcess=(0,tN._MissingSideEffect)("Effect","setTextureFromPostProcess")),(s=tV.prototype).setTextureFromPostProcessOutput??(s.setTextureFromPostProcessOutput=(0,tN._MissingSideEffect)("Effect","setTextureFromPostProcessOutput")),e.s(["Effect",0,tV],99904);var tG=e.i(81623),tW=e.i(86985),tH=e.i(36395);class tq{constructor(e=!0){this._isDepthTestDirty=!1,this._isDepthMaskDirty=!1,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1,e&&this.reset()}get isDirty(){return this._isDepthFuncDirty||this._isDepthTestDirty||this._isDepthMaskDirty||this._isCullFaceDirty||this._isCullDirty||this._isZOffsetDirty||this._isFrontFaceDirty}get zOffset(){return this._zOffset}set zOffset(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0)}get zOffsetUnits(){return this._zOffsetUnits}set zOffsetUnits(e){this._zOffsetUnits!==e&&(this._zOffsetUnits=e,this._isZOffsetDirty=!0)}get cullFace(){return this._cullFace}set cullFace(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0)}get cull(){return this._cull}set cull(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0)}get depthFunc(){return this._depthFunc}set depthFunc(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0)}get depthMask(){return this._depthMask}set depthMask(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0)}get depthTest(){return this._depthTest}set depthTest(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0)}get frontFace(){return this._frontFace}set frontFace(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0)}reset(){this._depthMask=!0,this._depthTest=!0,this._depthFunc=null,this._cullFace=null,this._cull=null,this._zOffset=0,this._zOffsetUnits=0,this._frontFace=null,this._isDepthTestDirty=!0,this._isDepthMaskDirty=!0,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!0,this._isFrontFaceDirty=!1}apply(e){this.isDirty&&(this._isCullDirty&&(this.cull?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this._isCullDirty=!1),this._isCullFaceDirty&&(e.cullFace(this.cullFace),this._isCullFaceDirty=!1),this._isDepthMaskDirty&&(e.depthMask(this.depthMask),this._isDepthMaskDirty=!1),this._isDepthTestDirty&&(this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this._isDepthTestDirty=!1),this._isDepthFuncDirty&&(e.depthFunc(this.depthFunc),this._isDepthFuncDirty=!1),this._isZOffsetDirty&&(this.zOffset||this.zOffsetUnits?(e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(this.zOffset,this.zOffsetUnits)):e.disable(e.POLYGON_OFFSET_FILL),this._isZOffsetDirty=!1),this._isFrontFaceDirty&&(e.frontFace(this.frontFace),this._isFrontFaceDirty=!1))}}class tz{get isDirty(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty}get func(){return this._func}set func(e){this._func!==e&&(this._func=e,this._isStencilFuncDirty=!0)}get backFunc(){return this._func}set backFunc(e){this._backFunc!==e&&(this._backFunc=e,this._isStencilFuncDirty=!0)}get funcRef(){return this._funcRef}set funcRef(e){this._funcRef!==e&&(this._funcRef=e,this._isStencilFuncDirty=!0)}get funcMask(){return this._funcMask}set funcMask(e){this._funcMask!==e&&(this._funcMask=e,this._isStencilFuncDirty=!0)}get opStencilFail(){return this._opStencilFail}set opStencilFail(e){this._opStencilFail!==e&&(this._opStencilFail=e,this._isStencilOpDirty=!0)}get opDepthFail(){return this._opDepthFail}set opDepthFail(e){this._opDepthFail!==e&&(this._opDepthFail=e,this._isStencilOpDirty=!0)}get opStencilDepthPass(){return this._opStencilDepthPass}set opStencilDepthPass(e){this._opStencilDepthPass!==e&&(this._opStencilDepthPass=e,this._isStencilOpDirty=!0)}get backOpStencilFail(){return this._backOpStencilFail}set backOpStencilFail(e){this._backOpStencilFail!==e&&(this._backOpStencilFail=e,this._isStencilOpDirty=!0)}get backOpDepthFail(){return this._backOpDepthFail}set backOpDepthFail(e){this._backOpDepthFail!==e&&(this._backOpDepthFail=e,this._isStencilOpDirty=!0)}get backOpStencilDepthPass(){return this._backOpStencilDepthPass}set backOpStencilDepthPass(e){this._backOpStencilDepthPass!==e&&(this._backOpStencilDepthPass=e,this._isStencilOpDirty=!0)}get mask(){return this._mask}set mask(e){this._mask!==e&&(this._mask=e,this._isStencilMaskDirty=!0)}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._isStencilTestDirty=!0)}constructor(e=!0){this._isStencilTestDirty=!1,this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.useStencilGlobalOnly=!1,e&&this.reset()}reset(){this.stencilMaterial=void 0,this.stencilGlobal?.reset(),this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0}apply(e){if(!e)return;let t=!this.useStencilGlobalOnly&&!!this.stencilMaterial?.enabled;this.enabled=t?this.stencilMaterial.enabled:this.stencilGlobal.enabled,this.func=t?this.stencilMaterial.func:this.stencilGlobal.func,this.backFunc=t?this.stencilMaterial.backFunc:this.stencilGlobal.backFunc,this.funcRef=t?this.stencilMaterial.funcRef:this.stencilGlobal.funcRef,this.funcMask=t?this.stencilMaterial.funcMask:this.stencilGlobal.funcMask,this.opStencilFail=t?this.stencilMaterial.opStencilFail:this.stencilGlobal.opStencilFail,this.opDepthFail=t?this.stencilMaterial.opDepthFail:this.stencilGlobal.opDepthFail,this.opStencilDepthPass=t?this.stencilMaterial.opStencilDepthPass:this.stencilGlobal.opStencilDepthPass,this.backOpStencilFail=t?this.stencilMaterial.backOpStencilFail:this.stencilGlobal.backOpStencilFail,this.backOpDepthFail=t?this.stencilMaterial.backOpDepthFail:this.stencilGlobal.backOpDepthFail,this.backOpStencilDepthPass=t?this.stencilMaterial.backOpStencilDepthPass:this.stencilGlobal.backOpStencilDepthPass,this.mask=t?this.stencilMaterial.mask:this.stencilGlobal.mask,this.isDirty&&(this._isStencilTestDirty&&(this.enabled?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.mask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFuncSeparate(e.FRONT,this.func,this.funcRef,this.funcMask),e.stencilFuncSeparate(e.BACK,this.backFunc,this.funcRef,this.funcMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOpSeparate(e.FRONT,this.opStencilFail,this.opDepthFail,this.opStencilDepthPass),e.stencilOpSeparate(e.BACK,this.backOpStencilFail,this.backOpDepthFail,this.backOpStencilDepthPass),this._isStencilOpDirty=!1))}}class tj{constructor(){this.reset()}reset(){this.enabled=!1,this.mask=255,this.funcRef=1,this.funcMask=255,this.func=tj.ALWAYS,this.opStencilFail=tj.KEEP,this.opDepthFail=tj.KEEP,this.opStencilDepthPass=tj.REPLACE,this.backFunc=tj.ALWAYS,this.backOpStencilFail=tj.KEEP,this.backOpDepthFail=tj.KEEP,this.backOpStencilDepthPass=tj.REPLACE}get stencilFunc(){return this.func}set stencilFunc(e){this.func=e}get stencilBackFunc(){return this.backFunc}set stencilBackFunc(e){this.backFunc=e}get stencilFuncRef(){return this.funcRef}set stencilFuncRef(e){this.funcRef=e}get stencilFuncMask(){return this.funcMask}set stencilFuncMask(e){this.funcMask=e}get stencilOpStencilFail(){return this.opStencilFail}set stencilOpStencilFail(e){this.opStencilFail=e}get stencilOpDepthFail(){return this.opDepthFail}set stencilOpDepthFail(e){this.opDepthFail=e}get stencilOpStencilDepthPass(){return this.opStencilDepthPass}set stencilOpStencilDepthPass(e){this.opStencilDepthPass=e}get stencilBackOpStencilFail(){return this.backOpStencilFail}set stencilBackOpStencilFail(e){this.backOpStencilFail=e}get stencilBackOpDepthFail(){return this.backOpDepthFail}set stencilBackOpDepthFail(e){this.backOpDepthFail=e}get stencilBackOpStencilDepthPass(){return this.backOpStencilDepthPass}set stencilBackOpStencilDepthPass(e){this.backOpStencilDepthPass=e}get stencilMask(){return this.mask}set stencilMask(e){this.mask=e}get stencilTest(){return this.enabled}set stencilTest(e){this.enabled=e}}tj.ALWAYS=519,tj.KEEP=7680,tj.REPLACE=7681;class t${constructor(e){this._supportBlendParametersPerTarget=e,this._blendFunctionParameters=Array(32),this._blendEquationParameters=Array(16),this._blendConstants=[,,,,],this._isBlendConstantsDirty=!1,this._alphaBlend=Array(8).fill(!1),this._numTargetEnabled=0,this._isAlphaBlendDirty=!1,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this.reset()}get isDirty(){return this._isAlphaBlendDirty||this._isBlendFunctionParametersDirty||this._isBlendEquationParametersDirty}get alphaBlend(){return this._numTargetEnabled>0}set alphaBlend(e){this.setAlphaBlend(e)}setAlphaBlend(e,t=0){this._alphaBlend[t]!==e&&(e?this._numTargetEnabled++:this._numTargetEnabled--,this._alphaBlend[t]=e,this._isAlphaBlendDirty=!0)}setAlphaBlendConstants(e,t,i,s){(this._blendConstants[0]!==e||this._blendConstants[1]!==t||this._blendConstants[2]!==i||this._blendConstants[3]!==s)&&(this._blendConstants[0]=e,this._blendConstants[1]=t,this._blendConstants[2]=i,this._blendConstants[3]=s,this._isBlendConstantsDirty=!0)}setAlphaBlendFunctionParameters(e,t,i,s,r=0){let n=4*r;(this._blendFunctionParameters[n+0]!==e||this._blendFunctionParameters[n+1]!==t||this._blendFunctionParameters[n+2]!==i||this._blendFunctionParameters[n+3]!==s)&&(this._blendFunctionParameters[n+0]=e,this._blendFunctionParameters[n+1]=t,this._blendFunctionParameters[n+2]=i,this._blendFunctionParameters[n+3]=s,this._isBlendFunctionParametersDirty=!0)}setAlphaEquationParameters(e,t,i=0){let s=2*i;(this._blendEquationParameters[s+0]!==e||this._blendEquationParameters[s+1]!==t)&&(this._blendEquationParameters[s+0]=e,this._blendEquationParameters[s+1]=t,this._isBlendEquationParametersDirty=!0)}reset(){this._alphaBlend.fill(!1),this._numTargetEnabled=0,this._blendFunctionParameters.fill(null),this._blendEquationParameters.fill(null),this._blendConstants[0]=null,this._blendConstants[1]=null,this._blendConstants[2]=null,this._blendConstants[3]=null,this._isAlphaBlendDirty=!0,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1}apply(e,t=1){if(this.isDirty){if(this._isBlendConstantsDirty&&(e.blendColor(this._blendConstants[0],this._blendConstants[1],this._blendConstants[2],this._blendConstants[3]),this._isBlendConstantsDirty=!1),1===t||!this._supportBlendParametersPerTarget){this._isAlphaBlendDirty&&(this._alphaBlend[0]?e.enable(e.BLEND):e.disable(e.BLEND),this._isAlphaBlendDirty=!1),this._isBlendFunctionParametersDirty&&(e.blendFuncSeparate(this._blendFunctionParameters[0],this._blendFunctionParameters[1],this._blendFunctionParameters[2],this._blendFunctionParameters[3]),this._isBlendFunctionParametersDirty=!1),this._isBlendEquationParametersDirty&&(e.blendEquationSeparate(this._blendEquationParameters[0],this._blendEquationParameters[1]),this._isBlendEquationParametersDirty=!1);return}if(this._isAlphaBlendDirty){for(let i=0;i<t;i++){let t=i<this._numTargetEnabled?i:0;this._alphaBlend[t]?e.enableIndexed(e.BLEND,i):e.disableIndexed(e.BLEND,i)}this._isAlphaBlendDirty=!1}if(this._isBlendFunctionParametersDirty){for(let i=0;i<t;i++){let t=i<this._numTargetEnabled?4*i:0;e.blendFuncSeparateIndexed(i,this._blendFunctionParameters[t+0],this._blendFunctionParameters[t+1],this._blendFunctionParameters[t+2],this._blendFunctionParameters[t+3])}this._isBlendFunctionParametersDirty=!1}if(this._isBlendEquationParametersDirty){for(let i=0;i<t;i++){let t=i<this._numTargetEnabled?2*i:0;e.blendEquationSeparateIndexed(i,this._blendEquationParameters[t+0],this._blendEquationParameters[t+1])}this._isBlendEquationParametersDirty=!1}}}setAlphaMode(e,t){let i=32774;switch(e){case 0:break;case 7:this.setAlphaBlendFunctionParameters(1,771,1,1,t);break;case 8:case 14:this.setAlphaBlendFunctionParameters(1,771,1,771,t);break;case 2:this.setAlphaBlendFunctionParameters(770,771,1,1,t);break;case 6:this.setAlphaBlendFunctionParameters(1,1,0,1,t);break;case 1:this.setAlphaBlendFunctionParameters(770,1,0,1,t);break;case 3:this.setAlphaBlendFunctionParameters(0,769,1,1,t);break;case 4:this.setAlphaBlendFunctionParameters(774,0,1,1,t);break;case 5:this.setAlphaBlendFunctionParameters(770,769,1,1,t);break;case 9:this.setAlphaBlendFunctionParameters(32769,32770,32771,32772,t);break;case 10:this.setAlphaBlendFunctionParameters(1,769,1,771,t);break;case 11:this.setAlphaBlendFunctionParameters(1,1,1,1,t);break;case 12:this.setAlphaBlendFunctionParameters(772,1,0,0,t);break;case 13:this.setAlphaBlendFunctionParameters(775,769,773,771,t);break;case 15:this.setAlphaBlendFunctionParameters(1,1,1,0,t);break;case 16:this.setAlphaBlendFunctionParameters(775,769,0,1,t);break;case 17:this.setAlphaBlendFunctionParameters(770,771,1,771,t);break;case 18:this.setAlphaBlendFunctionParameters(1,1,1,1,t),i=32775;break;case 19:this.setAlphaBlendFunctionParameters(1,1,1,1,t),i=32776;break;case 20:this.setAlphaBlendFunctionParameters(1,35065,0,1,t)}this.setAlphaEquationParameters(i,i,t)}}e.s(["AlphaState",0,t$],41520);var tZ=e.i(84201);function tK(e,t){if(t){let{requestAnimationFrame:i}=t;if("function"==typeof i)return i(e)}if((0,e3.IsWindowObjectExist)()){let{requestAnimationFrame:i}=t||window;if("function"==typeof i)return i(e)}else if("function"==typeof requestAnimationFrame)return requestAnimationFrame(e);return setTimeout(e,16)}class tQ{get frameId(){return this._frameId}get isWebGPU(){return this._isWebGPU}_getShaderProcessor(e){return this._shaderProcessor}_resetAlphaMode(){this._alphaMode.fill(-1),this._alphaEquation.fill(-1)}get shaderPlatformName(){return this._shaderPlatformName}_clearEmptyResources(){this._emptyTexture=null,this._emptyCubeTexture=null,this._emptyTexture3D=null,this._emptyTexture2DArray=null}get useReverseDepthBuffer(){return this._useReverseDepthBuffer}set useReverseDepthBuffer(e){e!==this._useReverseDepthBuffer&&(this._useReverseDepthBuffer=e,e?this._depthCullingState.depthFunc=518:this._depthCullingState.depthFunc=515)}setColorWrite(e){e!==this._colorWrite&&(this._colorWriteChanged=!0,this._colorWrite=e)}getColorWrite(){return this._colorWrite}get depthCullingState(){return this._depthCullingState}get alphaState(){return this._alphaState}get stencilState(){return this._stencilState}get stencilStateComposer(){return this._stencilStateComposer}_getGlobalDefines(e){if(e){this.isNDCHalfZRange?e.IS_NDC_HALF_ZRANGE="":delete e.IS_NDC_HALF_ZRANGE,this.useReverseDepthBuffer?e.USE_REVERSE_DEPTHBUFFER="":delete e.USE_REVERSE_DEPTHBUFFER,this.useExactSrgbConversions?e.USE_EXACT_SRGB_CONVERSIONS="":delete e.USE_EXACT_SRGB_CONVERSIONS;return}{let e="";return this.isNDCHalfZRange&&(e+="#define IS_NDC_HALF_ZRANGE"),this.useReverseDepthBuffer&&(e&&(e+="\n"),e+="#define USE_REVERSE_DEPTHBUFFER"),this.useExactSrgbConversions&&(e&&(e+="\n"),e+="#define USE_EXACT_SRGB_CONVERSIONS"),e}}_rebuildInternalTextures(){for(let e of this._internalTexturesCache.slice())e._rebuild()}_rebuildRenderTargetWrappers(){for(let e of this._renderTargetWrapperCache.slice())e.textures?.some(e=>15===e.source)||e._rebuild()}_rebuildEffects(){for(let e in this._compiledEffects){let t=this._compiledEffects[e];t._pipelineContext=null,t._prepareEffect()}tV.ResetCache()}_rebuildGraphicsResources(){this.wipeCaches(!0),this._rebuildEffects(),this._rebuildComputeEffects?.(),this._rebuildBuffers(),this._rebuildInternalTextures(),this._rebuildTextures(),this._rebuildRenderTargetWrappers(),this.wipeCaches(!0)}_flagContextRestored(){e1.Logger.Warn(this.name+" context successfully restored."),this.onContextRestoredObservable.notifyObservers(this),this._contextWasLost=!1}_restoreEngineAfterContextLost(e){setTimeout(()=>{this._clearEmptyResources();let t=this._depthCullingState.depthTest,i=this._depthCullingState.depthFunc,s=this._depthCullingState.depthMask,r=this._stencilState.stencilTest;e(),this._rebuildGraphicsResources(),this._depthCullingState.depthTest=t,this._depthCullingState.depthFunc=i,this._depthCullingState.depthMask=s,this._stencilState.stencilTest=r,this._flagContextRestored()},0)}get isDisposed(){return this._isDisposed}get snapshotRendering(){return!1}set snapshotRendering(e){}get snapshotRenderingMode(){return 0}set snapshotRenderingMode(e){}getClassName(){return"AbstractEngine"}get emptyTexture(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,5,!1,!1,1)),this._emptyTexture}get emptyTexture3D(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture3D}get emptyTexture2DArray(){return this._emptyTexture2DArray||(this._emptyTexture2DArray=this.createRawTexture2DArray(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture2DArray}get emptyCubeTexture(){if(!this._emptyCubeTexture){let e=new Uint8Array(4);this._emptyCubeTexture=this.createRawCubeTexture([e,e,e,e,e,e],1,5,0,!1,!1,1)}return this._emptyCubeTexture}get activeRenderLoops(){return this._activeRenderLoops}stopRenderLoop(e){if(!e){this._activeRenderLoops.length=0,this._cancelFrame();return}let t=this._activeRenderLoops.indexOf(e);t>=0&&(this._activeRenderLoops.splice(t,1),0==this._activeRenderLoops.length&&this._cancelFrame())}_cancelFrame(){if(this.customAnimationFrameRequester){if(0!==this._frameHandler){this._frameHandler=0;let{cancelAnimationFrame:e}=this.customAnimationFrameRequester;e&&e(this.customAnimationFrameRequester.requestID),delete this.customAnimationFrameRequester.requestID}return}if(0!==this._frameHandler){let e=this._frameHandler;if(this._frameHandler=0,(0,e3.IsWindowObjectExist)()){let{cancelAnimationFrame:t}=this.getHostWindow()||window;if("function"==typeof t)return t(e)}else if("function"==typeof cancelAnimationFrame)return cancelAnimationFrame(e);return clearTimeout(e)}}beginFrame(){this.onBeginFrameObservable.notifyObservers(this)}endFrame(){this._frameId++,this.onEndFrameObservable.notifyObservers(this)}get maxFPS(){return this._maxFPS}set maxFPS(e){if(this._maxFPS=e,void 0!==e){if(e<=0){this._minFrameTime=Number.MAX_VALUE;return}this._minFrameTime=1e3/e}}_isOverFrameTime(e){if(!e||void 0===this._maxFPS)return!1;let t=e-this._lastFrameTime;return this._lastFrameTime=e,this._renderAccumulator+=t,this._renderAccumulator<this._minFrameTime||(this._renderAccumulator-=this._minFrameTime,this._renderAccumulator>this._minFrameTime&&(this._renderAccumulator=this._minFrameTime),!1)}_processFrame(e){if(this._frameHandler=0,!this._contextWasLost&&!this._isOverFrameTime(e)){let e=!0;(this.isDisposed||!this.renderEvenInBackground&&this._windowIsBackground)&&(e=!1),e&&(this.beginFrame(),this.skipFrameRender||this._renderViews()||this._renderFrame(),this.endFrame())}}_renderLoop(e){this._processFrame(e),this._activeRenderLoops.length>0&&0===this._frameHandler&&this._queueNewFrameForRenderLoop()}_renderFrame(){for(let e=0;e<this._activeRenderLoops.length;e++)(0,this._activeRenderLoops[e])()}_renderViews(){return!1}_queueNewFrame(e,t){return tK(e,t)}_queueNewFrameForRenderLoop(){this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._boundRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow())}runRenderLoop(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),1===this._activeRenderLoops.length&&0===this._frameHandler&&this._queueNewFrameForRenderLoop())}getDepthBuffer(){return this._depthCullingState.depthTest}setDepthBuffer(e){this._depthCullingState.depthTest=e}setZOffset(e){this._depthCullingState.zOffset=this.useReverseDepthBuffer?-e:e}getZOffset(){let e=this._depthCullingState.zOffset;return this.useReverseDepthBuffer?-e:e}setZOffsetUnits(e){this._depthCullingState.zOffsetUnits=this.useReverseDepthBuffer?-e:e}getZOffsetUnits(){let e=this._depthCullingState.zOffsetUnits;return this.useReverseDepthBuffer?-e:e}getHostWindow(){return(0,e3.IsWindowObjectExist)()?this._renderingCanvas&&this._renderingCanvas.ownerDocument&&this._renderingCanvas.ownerDocument.defaultView?this._renderingCanvas.ownerDocument.defaultView:window:null}get compatibilityMode(){return this._compatibilityMode}set compatibilityMode(e){this._compatibilityMode=!0}_rebuildTextures(){for(let e of this.scenes)e._rebuildTextures();for(let e of this._virtualScenes)e._rebuildTextures()}_releaseRenderTargetWrapper(e){let t=this._renderTargetWrapperCache.indexOf(e);-1!==t&&this._renderTargetWrapperCache.splice(t,1)}get currentViewport(){return this._cachedViewport}setViewport(e,t,i){let s=t||this.getRenderWidth(),r=i||this.getRenderHeight(),n=e.x||0,a=e.y||0;this._cachedViewport=e,this._viewport(n*s,a*r,s*e.width,r*e.height)}createCanvasImage(){return document.createElement("img")}createCanvasPath2D(e){return new Path2D(e)}get description(){let e=this.name+this.version;return this._caps.parallelShaderCompile&&(e+=" - Parallel shader compilation"),e}_createTextureBase(e,t,i,s,r=3,n=null,a=null,o,l,h=null,c=null,u=null,p=null,d,f,_){let g="data:"===(e=e||"").substring(0,5),m="blob:"===e.substring(0,5),b=g&&-1!==e.indexOf(";base64,"),S=c||new tZ.InternalTexture(this,1);S!==c&&(S.label=e.substring(0,60));let C=e;!this._transformTextureUrl||b||c||h||(e=this._transformTextureUrl(e)),C!==e&&(S._originalUrl=C);let E=e.lastIndexOf("."),y=p||(E>-1?e.substring(E).toLowerCase():"");y.indexOf("?")>-1&&(y=y.split("?")[0]);let x=tQ.GetCompatibleTextureLoader(y,d);s&&s.addPendingData(S),S.url=e,S.generateMipMaps=!t,S.samplingMode=r,S.invertY=i,S._useSRGBBuffer=this._getUseSRGBBuffer(!!_,t),this._doNotHandleContextLost||(S._buffer=h);let F=null;n&&!c&&(F=S.onLoadedObservable.add(n)),c||this._internalTexturesCache.push(S);let A=(i,c)=>{s&&s.removePendingData(S),e===C?(F&&S.onLoadedObservable.remove(F),tG.EngineStore.UseFallbackTexture&&e!==tG.EngineStore.FallbackTexture&&this._createTextureBase(tG.EngineStore.FallbackTexture,t,S.invertY,s,r,null,a,o,l,h,S),i=(i||"Unknown error")+(tG.EngineStore.UseFallbackTexture?" - Fallback texture was used":""),S.onErrorObservable.notifyObservers({message:i,exception:c}),a&&a(i,c)):(e1.Logger.Warn(`Failed to load ${e}, falling back to ${C}`),this._createTextureBase(C,t,S.invertY,s,r,n,a,o,l,h,S,u,p,d,f,_))};if(x){let t=async e=>{(await x).loadData(e,S,(e,t,i,n,a,l)=>{l?A("TextureLoader failed to load data"):o(S,y,s,{width:e,height:t},S.invertY,!i,n,()=>(a(),!1),r)},f)};if(h){let e=async e=>{try{await t(e)}catch(e){A("Failed to parse texture data",e)}};h instanceof ArrayBuffer?e(new Uint8Array(h)):ArrayBuffer.isView(h)?e(h):a&&a("Unable to load: only ArrayBuffer or ArrayBufferView is supported",null)}else this._loadFile(e,async e=>{try{await t(new Uint8Array(e))}catch(e){A("Failed to parse texture data",e)}},void 0,s?s.offlineProvider:void 0,!0,(e,t)=>{A("Unable to load "+(e&&e.responseURL,t))})}else{let i=e=>{m&&!this._doNotHandleContextLost&&(S._buffer=e),o(S,y,s,e,S.invertY,t,!1,l,r)};!g||b?h&&("string"==typeof h.decoding||h.close)?i(h):(0,e7.LoadImage)(e||"",i,A,s?s.offlineProvider:null,d,S.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0,this):"string"==typeof h||h instanceof ArrayBuffer||ArrayBuffer.isView(h)||h instanceof Blob?(0,e7.LoadImage)(h,i,A,s?s.offlineProvider:null,d,S.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0,this):h&&i(h)}return S}_rebuildBuffers(){for(let e of this._uniformBuffers)e._rebuildAfterContextLost()}get _shouldUseHighPrecisionShader(){return!!(this._caps.highPrecisionShaderSupported&&this._highPrecisionShadersAllowed)}getHostDocument(){return this._renderingCanvas&&this._renderingCanvas.ownerDocument?this._renderingCanvas.ownerDocument:(0,e3.IsDocumentAvailable)()?document:null}getLoadedTexturesCache(){return this._internalTexturesCache}clearInternalTexturesCache(){this._internalTexturesCache.length=0}getCaps(){return this._caps}resetTextureCache(){for(let e in this._boundTexturesCache)Object.prototype.hasOwnProperty.call(this._boundTexturesCache,e)&&(this._boundTexturesCache[e]=null);this._currentTextureChannel=-1}get name(){return this._name}set name(e){this._name=e}static get NpmPackage(){return"babylonjs@9.13.0"}static get Version(){return"9.13.0"}getRenderingCanvas(){return this._renderingCanvas}getAudioContext(){return this._audioContext}getAudioDestination(){return this._audioDestination}setHardwareScalingLevel(e){this._hardwareScalingLevel=e,this.resize()}getHardwareScalingLevel(){return this._hardwareScalingLevel}get doNotHandleContextLost(){return this._doNotHandleContextLost}set doNotHandleContextLost(e){this._doNotHandleContextLost=e}get isStencilEnable(){return this._isStencilEnable}getCreationOptions(){return this._creationOptions}constructor(e,t,i){this._colorWrite=!0,this._colorWriteChanged=!0,this._depthCullingState=new tq,this._stencilStateComposer=new tz,this._stencilState=new tj,this._alphaState=new t$(!1),this._alphaMode=Array(8).fill(-1),this._alphaEquation=Array(8).fill(-1),this._activeRequests=[],this._badOS=!1,this._badDesktopOS=!1,this._compatibilityMode=!0,this._internalTexturesCache=[],this._currentRenderTarget=null,this._boundTexturesCache={},this._activeChannel=0,this._currentTextureChannel=-1,this._viewportCached={x:0,y:0,z:0,w:0},this._isWebGPU=!1,this._enableGPUDebugMarkers=!1,this.onCanvasBlurObservable=new e0.Observable,this.onCanvasFocusObservable=new e0.Observable,this.onNewSceneAddedObservable=new e0.Observable,this.onResizeObservable=new e0.Observable,this.onCanvasPointerOutObservable=new e0.Observable,this.onEffectErrorObservable=new e0.Observable,this.disablePerformanceMonitorInBackground=!1,this.disableVertexArrayObjects=!1,this._frameId=0,this.hostInformation={isMobile:!1},this.isFullscreen=!1,this.enableOfflineSupport=!1,this.disableManifestCheck=!1,this.disableContextMenu=!0,this.currentRenderPassId=0,this.isPointerLock=!1,this.postProcesses=[],this.canvasTabIndex=1,this._contextWasLost=!1,this._useReverseDepthBuffer=!1,this.isNDCHalfZRange=!1,this.hasOriginBottomLeft=!0,this._renderTargetWrapperCache=[],this._compiledEffects={},this._isDisposed=!1,this.scenes=[],this._virtualScenes=[],this.onBeforeTextureInitObservable=new e0.Observable,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this._frameHandler=0,this._activeRenderLoops=[],this.customAnimationFrameRequester=null,this._windowIsBackground=!1,this._boundRenderFunction=e=>this._renderLoop(e),this._lastFrameTime=0,this._renderAccumulator=0,this.skipFrameRender=!1,this.onBeforeShaderCompilationObservable=new e0.Observable,this.onAfterShaderCompilationObservable=new e0.Observable,this.onBeginFrameObservable=new e0.Observable,this.onEndFrameObservable=new e0.Observable,this._transformTextureUrl=null,this._uniformBuffers=[],this._storageBuffers=[],this._highPrecisionShadersAllowed=!0,this.onContextLostObservable=new e0.Observable,this.onContextRestoredObservable=new e0.Observable,this._name="",this.premultipliedAlpha=!0,this.adaptToDeviceRatio=!1,this._lastDevicePixelRatio=1,this._doNotHandleContextLost=!1,this.cullBackFaces=null,this._renderPassNames=["main"],this._fps=60,this._deltaTime=0,this._deterministicLockstep=!1,this._lockstepMaxSteps=4,this._timeStep=1/60,this.onDisposeObservable=new e0.Observable,this.onReleaseEffectsObservable=new e0.Observable,tG.EngineStore.Instances.push(this),this.startTime=tH.PrecisionDate.Now,this._stencilStateComposer.stencilGlobal=this._stencilState,tW.PerformanceConfigurator.SetMatrixPrecision(!!t.useLargeWorldRendering||!!t.useHighPrecisionMatrix),(0,e3.IsNavigatorAvailable)()&&navigator.userAgent&&(this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),t.antialias=e??t.antialias,t.deterministicLockstep=t.deterministicLockstep??!1,t.lockstepMaxSteps=t.lockstepMaxSteps??4,t.timeStep=t.timeStep??1/60,t.stencil=t.stencil??!0,this._audioContext=t.audioEngineOptions?.audioContext??null,this._audioDestination=t.audioEngineOptions?.audioDestination??null,this.premultipliedAlpha=t.premultipliedAlpha??!0,this._doNotHandleContextLost=!!t.doNotHandleContextLost,this._isStencilEnable=!!t.stencil,this.useExactSrgbConversions=t.useExactSrgbConversions??!1;const s=(0,e3.IsWindowObjectExist)()&&window.devicePixelRatio||1,r=t.limitDeviceRatio||s;i=i||t.adaptToDeviceRatio||!1,this.adaptToDeviceRatio=i,this._hardwareScalingLevel=i?1/Math.min(r,s):1,this._lastDevicePixelRatio=s,this._creationOptions=t}resize(e=!1){let t,i;if(this.adaptToDeviceRatio){let e=(0,e3.IsWindowObjectExist)()&&window.devicePixelRatio||1,t=this._lastDevicePixelRatio/e;this._lastDevicePixelRatio=e,this._hardwareScalingLevel*=t}if((0,e3.IsWindowObjectExist)()&&(0,e3.IsDocumentAvailable)())if(this._renderingCanvas){let e=this._renderingCanvas.getBoundingClientRect?.();t=this._renderingCanvas.clientWidth||e?.width||this._renderingCanvas.width*this._hardwareScalingLevel||100,i=this._renderingCanvas.clientHeight||e?.height||this._renderingCanvas.height*this._hardwareScalingLevel||100}else t=window.innerWidth,i=window.innerHeight;else t=this._renderingCanvas?this._renderingCanvas.width:100,i=this._renderingCanvas?this._renderingCanvas.height:100;this.setSize(t/this._hardwareScalingLevel,i/this._hardwareScalingLevel,e)}setSize(e,t,i=!1){if(!this._renderingCanvas||(e|=0,t|=0,!i&&this._renderingCanvas.width===e&&this._renderingCanvas.height===t))return!1;if(this._renderingCanvas.width=e,this._renderingCanvas.height=t,this.scenes){for(let e=0;e<this.scenes.length;e++){let t=this.scenes[e];for(let e=0;e<t.cameras.length;e++)t.cameras[e]._currentRenderId=0}this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this)}return!0}createRawTexture(e,t,i,s,r,n,a,o,l,h,c,u){throw(0,tN._WarnImport)("engine.rawTexture")}createRawCubeTexture(e,t,i,s,r,n,a,o){throw(0,tN._WarnImport)("engine.rawTexture")}createRawTexture3D(e,t,i,s,r,n,a,o,l,h,c){throw(0,tN._WarnImport)("engine.rawTexture")}createRawTexture2DArray(e,t,i,s,r,n,a,o,l,h,c,u){throw(0,tN._WarnImport)("engine.rawTexture")}_sharedInit(e){this._renderingCanvas=e}_setupMobileChecks(){navigator&&navigator.userAgent&&(this._checkForMobile=()=>{let e=navigator.userAgent;this.hostInformation.isMobile=-1!==e.indexOf("Mobile")||-1!==e.indexOf("Mac")&&(0,e3.IsDocumentAvailable)()&&"ontouchend"in document},this._checkForMobile(),(0,e3.IsWindowObjectExist)()&&window.addEventListener("resize",this._checkForMobile))}createVideoElement(e){return document.createElement("video")}_reportDrawCall(e=1){this._drawCalls?.addCount(e,!1)}getFps(){return this._fps}getDeltaTime(){return this._deltaTime}isDeterministicLockStep(){return this._deterministicLockstep}getLockstepMaxSteps(){return this._lockstepMaxSteps}getTimeStep(){return 1e3*this._timeStep}_createImageBitmapFromSource(e,t){throw Error("createImageBitmapFromSource is not implemented")}createImageBitmap(e,t){return createImageBitmap(e,t)}resizeImageBitmap(e,t,i){throw Error("resizeImageBitmap is not implemented")}getFontOffset(e){throw Error("getFontOffset is not implemented")}static _CreateCanvas(e,t){if("u"<typeof document)return new OffscreenCanvas(e,t);let i=document.createElement("canvas");return i.width=e,i.height=t,i}createCanvas(e,t){return tQ._CreateCanvas(e,t)}static _FileToolsLoadImage(e,t,i,s,r,n,a){return(0,e7.LoadImage)(e,t,i,s,r,n,a)}_loadFile(e,t,i,s,r,n){let a=e8(e,t,i,s,r,n);return this._activeRequests.push(a),a.onCompleteObservable.add(()=>{let e=this._activeRequests.indexOf(a);-1!==e&&this._activeRequests.splice(e,1)}),a}static _FileToolsLoadFile(e,t,i,s,r,n){return e5.loadFile?e5.loadFile(e,t,i,s,r,n):(0,e7.LoadFile)(e,t,i,s,r,n)}dispose(){for(this.releaseEffects(),this._isDisposed=!0,this.stopRenderLoop(),this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._renderingCanvas=null,this.onBeforeTextureInitObservable&&this.onBeforeTextureInitObservable.clear();this.postProcesses.length;)this.postProcesses[0].dispose();for(;this.scenes.length;)this.scenes[0].dispose();for(;this._virtualScenes.length;)this._virtualScenes[0].dispose();for(let e of(this.releaseComputeEffects?.(),tV.ResetCache(),this._activeRequests))e.abort();this._boundRenderFunction=null,this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onNewSceneAddedObservable.clear(),this.onEffectErrorObservable.clear(),(0,e3.IsWindowObjectExist)()&&window.removeEventListener("resize",this._checkForMobile);let e=tG.EngineStore.Instances.indexOf(this);e>=0&&tG.EngineStore.Instances.splice(e,1),tG.EngineStore.Instances.length||(tG.EngineStore.OnEnginesDisposedObservable.notifyObservers(this),tG.EngineStore.OnEnginesDisposedObservable.clear()),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear()}static DefaultLoadingScreenFactory(e){throw(0,tN._WarnImport)("LoadingScreen")}static MarkAllMaterialsAsDirty(e,t){for(let i=0;i<tG.EngineStore.Instances.length;i++){let s=tG.EngineStore.Instances[i];for(let i=0;i<s.scenes.length;i++)s.scenes[i].markAllMaterialsAsDirty(e,t)}}static GetCompatibleTextureLoader(e,t){return null}}tQ._RenderPassIdCounter=0,tQ._RescalePostProcessFactory=null,tQ.CollisionsEpsilon=.001,tQ.QueueNewFrame=tK,(r=tQ.prototype).setAlphaEquation??(r.setAlphaEquation=(0,tN._MissingSideEffect)("AbstractEngine","setAlphaEquation")),(n=tQ.prototype).createCubeTextureBase??(n.createCubeTextureBase=(0,tN._MissingSideEffect)("AbstractEngine","createCubeTextureBase")),(a=tQ.prototype).getInputElement??(a.getInputElement=(0,tN._MissingSideEffect)("AbstractEngine","getInputElement")),(o=tQ.prototype).getRenderingCanvasClientRect??(o.getRenderingCanvasClientRect=(0,tN._MissingSideEffect)("AbstractEngine","getRenderingCanvasClientRect")),(l=tQ.prototype).getInputElementClientRect??(l.getInputElementClientRect=(0,tN._MissingSideEffect)("AbstractEngine","getInputElementClientRect")),(h=tQ.prototype).getAspectRatio??(h.getAspectRatio=(0,tN._MissingSideEffect)("AbstractEngine","getAspectRatio")),(c=tQ.prototype).getScreenAspectRatio??(c.getScreenAspectRatio=(0,tN._MissingSideEffect)("AbstractEngine","getScreenAspectRatio")),(u=tQ.prototype).switchFullscreen??(u.switchFullscreen=(0,tN._MissingSideEffect)("AbstractEngine","switchFullscreen")),(p=tQ.prototype).enterFullscreen??(p.enterFullscreen=(0,tN._MissingSideEffect)("AbstractEngine","enterFullscreen")),(d=tQ.prototype).exitFullscreen??(d.exitFullscreen=(0,tN._MissingSideEffect)("AbstractEngine","exitFullscreen")),(f=tQ.prototype).displayLoadingUI??(f.displayLoadingUI=(0,tN._MissingSideEffect)("AbstractEngine","displayLoadingUI")),(_=tQ.prototype).hideLoadingUI??(_.hideLoadingUI=(0,tN._MissingSideEffect)("AbstractEngine","hideLoadingUI")),(g=tQ.prototype).createQuery??(g.createQuery=(0,tN._MissingSideEffect)("AbstractEngine","createQuery")),(m=tQ.prototype).deleteQuery??(m.deleteQuery=(0,tN._MissingSideEffect)("AbstractEngine","deleteQuery")),(b=tQ.prototype).isQueryResultAvailable??(b.isQueryResultAvailable=(0,tN._MissingSideEffect)("AbstractEngine","isQueryResultAvailable")),(S=tQ.prototype).getQueryResult??(S.getQueryResult=(0,tN._MissingSideEffect)("AbstractEngine","getQueryResult")),(C=tQ.prototype).beginOcclusionQuery??(C.beginOcclusionQuery=(0,tN._MissingSideEffect)("AbstractEngine","beginOcclusionQuery")),(E=tQ.prototype).endOcclusionQuery??(E.endOcclusionQuery=(0,tN._MissingSideEffect)("AbstractEngine","endOcclusionQuery")),(y=tQ.prototype).getRenderPassNames??(y.getRenderPassNames=(0,tN._MissingSideEffect)("AbstractEngine","getRenderPassNames")),(x=tQ.prototype).getCurrentRenderPassName??(x.getCurrentRenderPassName=(0,tN._MissingSideEffect)("AbstractEngine","getCurrentRenderPassName")),(F=tQ.prototype).createRenderPassId??(F.createRenderPassId=(0,tN._MissingSideEffect)("AbstractEngine","createRenderPassId")),(A=tQ.prototype).releaseRenderPassId??(A.releaseRenderPassId=(0,tN._MissingSideEffect)("AbstractEngine","releaseRenderPassId")),(v=tQ.prototype).getDepthFunction??(v.getDepthFunction=(0,tN._MissingSideEffect)("AbstractEngine","getDepthFunction")),(D=tQ.prototype).setDepthFunction??(D.setDepthFunction=(0,tN._MissingSideEffect)("AbstractEngine","setDepthFunction")),(P=tQ.prototype).setDepthFunctionToGreater??(P.setDepthFunctionToGreater=(0,tN._MissingSideEffect)("AbstractEngine","setDepthFunctionToGreater")),(O=tQ.prototype).setDepthFunctionToGreaterOrEqual??(O.setDepthFunctionToGreaterOrEqual=(0,tN._MissingSideEffect)("AbstractEngine","setDepthFunctionToGreaterOrEqual")),(T=tQ.prototype).setDepthFunctionToLess??(T.setDepthFunctionToLess=(0,tN._MissingSideEffect)("AbstractEngine","setDepthFunctionToLess")),(R=tQ.prototype).setDepthFunctionToLessOrEqual??(R.setDepthFunctionToLessOrEqual=(0,tN._MissingSideEffect)("AbstractEngine","setDepthFunctionToLessOrEqual")),(M=tQ.prototype).getDepthWrite??(M.getDepthWrite=(0,tN._MissingSideEffect)("AbstractEngine","getDepthWrite")),(B=tQ.prototype).setDepthWrite??(B.setDepthWrite=(0,tN._MissingSideEffect)("AbstractEngine","setDepthWrite")),(k=tQ.prototype).setAlphaConstants??(k.setAlphaConstants=(0,tN._MissingSideEffect)("AbstractEngine","setAlphaConstants")),(w=tQ.prototype).getAlphaMode??(w.getAlphaMode=(0,tN._MissingSideEffect)("AbstractEngine","getAlphaMode")),(I=tQ.prototype).getAlphaEquation??(I.getAlphaEquation=(0,tN._MissingSideEffect)("AbstractEngine","getAlphaEquation")),(L=tQ.prototype).getStencilOperationPass??(L.getStencilOperationPass=(0,tN._MissingSideEffect)("AbstractEngine","getStencilOperationPass")),(U=tQ.prototype).getStencilBackOperationPass??(U.getStencilBackOperationPass=(0,tN._MissingSideEffect)("AbstractEngine","getStencilBackOperationPass")),(N=tQ.prototype).getStencilBuffer??(N.getStencilBuffer=(0,tN._MissingSideEffect)("AbstractEngine","getStencilBuffer")),(V=tQ.prototype).setStencilBuffer??(V.setStencilBuffer=(0,tN._MissingSideEffect)("AbstractEngine","setStencilBuffer")),(G=tQ.prototype).getStencilMask??(G.getStencilMask=(0,tN._MissingSideEffect)("AbstractEngine","getStencilMask")),(W=tQ.prototype).setStencilMask??(W.setStencilMask=(0,tN._MissingSideEffect)("AbstractEngine","setStencilMask")),(H=tQ.prototype).getStencilFunction??(H.getStencilFunction=(0,tN._MissingSideEffect)("AbstractEngine","getStencilFunction")),(q=tQ.prototype).getStencilBackFunction??(q.getStencilBackFunction=(0,tN._MissingSideEffect)("AbstractEngine","getStencilBackFunction")),(z=tQ.prototype).getStencilFunctionReference??(z.getStencilFunctionReference=(0,tN._MissingSideEffect)("AbstractEngine","getStencilFunctionReference")),(j=tQ.prototype).getStencilFunctionMask??(j.getStencilFunctionMask=(0,tN._MissingSideEffect)("AbstractEngine","getStencilFunctionMask")),($=tQ.prototype).setStencilFunction??($.setStencilFunction=(0,tN._MissingSideEffect)("AbstractEngine","setStencilFunction")),(Z=tQ.prototype).setStencilBackFunction??(Z.setStencilBackFunction=(0,tN._MissingSideEffect)("AbstractEngine","setStencilBackFunction")),(K=tQ.prototype).setStencilFunctionReference??(K.setStencilFunctionReference=(0,tN._MissingSideEffect)("AbstractEngine","setStencilFunctionReference")),(Q=tQ.prototype).setStencilFunctionMask??(Q.setStencilFunctionMask=(0,tN._MissingSideEffect)("AbstractEngine","setStencilFunctionMask")),(X=tQ.prototype).getStencilOperationFail??(X.getStencilOperationFail=(0,tN._MissingSideEffect)("AbstractEngine","getStencilOperationFail")),(Y=tQ.prototype).getStencilBackOperationFail??(Y.getStencilBackOperationFail=(0,tN._MissingSideEffect)("AbstractEngine","getStencilBackOperationFail")),(J=tQ.prototype).getStencilOperationDepthFail??(J.getStencilOperationDepthFail=(0,tN._MissingSideEffect)("AbstractEngine","getStencilOperationDepthFail")),(ee=tQ.prototype).getStencilBackOperationDepthFail??(ee.getStencilBackOperationDepthFail=(0,tN._MissingSideEffect)("AbstractEngine","getStencilBackOperationDepthFail")),(et=tQ.prototype).setStencilOperationFail??(et.setStencilOperationFail=(0,tN._MissingSideEffect)("AbstractEngine","setStencilOperationFail")),(ei=tQ.prototype).setStencilBackOperationFail??(ei.setStencilBackOperationFail=(0,tN._MissingSideEffect)("AbstractEngine","setStencilBackOperationFail")),(es=tQ.prototype).setStencilOperationDepthFail??(es.setStencilOperationDepthFail=(0,tN._MissingSideEffect)("AbstractEngine","setStencilOperationDepthFail")),(er=tQ.prototype).setStencilBackOperationDepthFail??(er.setStencilBackOperationDepthFail=(0,tN._MissingSideEffect)("AbstractEngine","setStencilBackOperationDepthFail")),(en=tQ.prototype).setStencilOperationPass??(en.setStencilOperationPass=(0,tN._MissingSideEffect)("AbstractEngine","setStencilOperationPass")),(ea=tQ.prototype).setStencilBackOperationPass??(ea.setStencilBackOperationPass=(0,tN._MissingSideEffect)("AbstractEngine","setStencilBackOperationPass")),(eo=tQ.prototype).cacheStencilState??(eo.cacheStencilState=(0,tN._MissingSideEffect)("AbstractEngine","cacheStencilState")),(el=tQ.prototype).restoreStencilState??(el.restoreStencilState=(0,tN._MissingSideEffect)("AbstractEngine","restoreStencilState")),(eh=tQ.prototype).createDepthStencilTexture??(eh.createDepthStencilTexture=(0,tN._MissingSideEffect)("AbstractEngine","createDepthStencilTexture")),(ec=tQ.prototype).setCompressedTextureExclusions??(ec.setCompressedTextureExclusions=(0,tN._MissingSideEffect)("AbstractEngine","setCompressedTextureExclusions")),(eu=tQ.prototype).setTextureFormatToUse??(eu.setTextureFormatToUse=(0,tN._MissingSideEffect)("AbstractEngine","setTextureFormatToUse")),(ep=tQ.prototype).getGPUFrameTimeCounter??(ep.getGPUFrameTimeCounter=(0,tN._MissingSideEffect)("AbstractEngine","getGPUFrameTimeCounter")),(ed=tQ.prototype).captureGPUFrameTime??(ed.captureGPUFrameTime=(0,tN._MissingSideEffect)("AbstractEngine","captureGPUFrameTime")),(ef=tQ.prototype).registerView??(ef.registerView=(0,tN._MissingSideEffect)("AbstractEngine","registerView")),(e_=tQ.prototype).unRegisterView??(e_.unRegisterView=(0,tN._MissingSideEffect)("AbstractEngine","unRegisterView")),(eg=tQ.prototype).setAlphaMode??(eg.setAlphaMode=(0,tN._MissingSideEffect)("AbstractEngine","setAlphaMode")),(em=tQ.prototype).createComputeEffect??(em.createComputeEffect=(0,tN._MissingSideEffect)("AbstractEngine","createComputeEffect")),(eb=tQ.prototype).createComputePipelineContext??(eb.createComputePipelineContext=(0,tN._MissingSideEffect)("AbstractEngine","createComputePipelineContext")),(eS=tQ.prototype).createComputeContext??(eS.createComputeContext=(0,tN._MissingSideEffect)("AbstractEngine","createComputeContext")),(eC=tQ.prototype).computeDispatch??(eC.computeDispatch=(0,tN._MissingSideEffect)("AbstractEngine","computeDispatch")),(eE=tQ.prototype).computeDispatchIndirect??(eE.computeDispatchIndirect=(0,tN._MissingSideEffect)("AbstractEngine","computeDispatchIndirect")),(ey=tQ.prototype).areAllComputeEffectsReady??(ey.areAllComputeEffectsReady=(0,tN._MissingSideEffect)("AbstractEngine","areAllComputeEffectsReady")),(ex=tQ.prototype).releaseComputeEffects??(ex.releaseComputeEffects=(0,tN._MissingSideEffect)("AbstractEngine","releaseComputeEffects")),(eF=tQ.prototype).createCubeTexture??(eF.createCubeTexture=(0,tN._MissingSideEffect)("AbstractEngine","createCubeTexture")),(eA=tQ.prototype).generateMipMapsForCubemap??(eA.generateMipMapsForCubemap=(0,tN._MissingSideEffect)("AbstractEngine","generateMipMapsForCubemap")),(ev=tQ.prototype).updateDynamicIndexBuffer??(ev.updateDynamicIndexBuffer=(0,tN._MissingSideEffect)("AbstractEngine","updateDynamicIndexBuffer")),(eD=tQ.prototype).updateDynamicVertexBuffer??(eD.updateDynamicVertexBuffer=(0,tN._MissingSideEffect)("AbstractEngine","updateDynamicVertexBuffer")),(eP=tQ.prototype).createDynamicTexture??(eP.createDynamicTexture=(0,tN._MissingSideEffect)("AbstractEngine","createDynamicTexture")),(eO=tQ.prototype).updateDynamicTexture??(eO.updateDynamicTexture=(0,tN._MissingSideEffect)("AbstractEngine","updateDynamicTexture")),(eT=tQ.prototype).unBindMultiColorAttachmentFramebuffer??(eT.unBindMultiColorAttachmentFramebuffer=(0,tN._MissingSideEffect)("AbstractEngine","unBindMultiColorAttachmentFramebuffer")),(eR=tQ.prototype).createMultipleRenderTarget??(eR.createMultipleRenderTarget=(0,tN._MissingSideEffect)("AbstractEngine","createMultipleRenderTarget")),(eM=tQ.prototype).updateMultipleRenderTargetTextureSampleCount??(eM.updateMultipleRenderTargetTextureSampleCount=(0,tN._MissingSideEffect)("AbstractEngine","updateMultipleRenderTargetTextureSampleCount")),(eB=tQ.prototype).generateMipMapsMultiFramebuffer??(eB.generateMipMapsMultiFramebuffer=(0,tN._MissingSideEffect)("AbstractEngine","generateMipMapsMultiFramebuffer")),(ek=tQ.prototype).resolveMultiFramebuffer??(ek.resolveMultiFramebuffer=(0,tN._MissingSideEffect)("AbstractEngine","resolveMultiFramebuffer")),(ew=tQ.prototype).bindAttachments??(ew.bindAttachments=(0,tN._MissingSideEffect)("AbstractEngine","bindAttachments")),(eI=tQ.prototype).buildTextureLayout??(eI.buildTextureLayout=(0,tN._MissingSideEffect)("AbstractEngine","buildTextureLayout")),(eL=tQ.prototype).restoreSingleAttachment??(eL.restoreSingleAttachment=(0,tN._MissingSideEffect)("AbstractEngine","restoreSingleAttachment")),(eU=tQ.prototype).restoreSingleAttachmentForRenderTarget??(eU.restoreSingleAttachmentForRenderTarget=(0,tN._MissingSideEffect)("AbstractEngine","restoreSingleAttachmentForRenderTarget")),(eN=tQ.prototype).createPrefilteredCubeTexture??(eN.createPrefilteredCubeTexture=(0,tN._MissingSideEffect)("AbstractEngine","createPrefilteredCubeTexture")),(eV=tQ.prototype).updateRawTexture??(eV.updateRawTexture=(0,tN._MissingSideEffect)("AbstractEngine","updateRawTexture")),(eG=tQ.prototype).updateRawCubeTexture??(eG.updateRawCubeTexture=(0,tN._MissingSideEffect)("AbstractEngine","updateRawCubeTexture")),(eW=tQ.prototype).createRawCubeTextureFromUrl??(eW.createRawCubeTextureFromUrl=(0,tN._MissingSideEffect)("AbstractEngine","createRawCubeTextureFromUrl")),(eH=tQ.prototype).updateRawTexture3D??(eH.updateRawTexture3D=(0,tN._MissingSideEffect)("AbstractEngine","updateRawTexture3D")),(eq=tQ.prototype).updateRawTexture2DArray??(eq.updateRawTexture2DArray=(0,tN._MissingSideEffect)("AbstractEngine","updateRawTexture2DArray")),(ez=tQ.prototype).createRenderTargetTexture??(ez.createRenderTargetTexture=(0,tN._MissingSideEffect)("AbstractEngine","createRenderTargetTexture")),(ej=tQ.prototype).updateRenderTargetTextureSampleCount??(ej.updateRenderTargetTextureSampleCount=(0,tN._MissingSideEffect)("AbstractEngine","updateRenderTargetTextureSampleCount")),(e$=tQ.prototype).createRenderTargetCubeTexture??(e$.createRenderTargetCubeTexture=(0,tN._MissingSideEffect)("AbstractEngine","createRenderTargetCubeTexture")),(eZ=tQ.prototype).setDepthStencilTexture??(eZ.setDepthStencilTexture=(0,tN._MissingSideEffect)("AbstractEngine","setDepthStencilTexture")),(eK=tQ.prototype).updateVideoTexture??(eK.updateVideoTexture=(0,tN._MissingSideEffect)("AbstractEngine","updateVideoTexture")),(eQ=tQ.prototype).createRawCubeTexture??(eQ.createRawCubeTexture=(0,tN._MissingSideEffect)("AbstractEngine","createRawCubeTexture")),(eX=tQ.prototype).createEffectForParticles??(eX.createEffectForParticles=(0,tN._MissingSideEffect)("AbstractEngine","createEffectForParticles")),(eY=tQ.prototype).setTextureFromPostProcess??(eY.setTextureFromPostProcess=(0,tN._MissingSideEffect)("AbstractEngine","setTextureFromPostProcess")),(eJ=tQ.prototype).setTextureFromPostProcessOutput??(eJ.setTextureFromPostProcessOutput=(0,tN._MissingSideEffect)("AbstractEngine","setTextureFromPostProcessOutput")),Object.getOwnPropertyDescriptor(tQ.prototype,"loadingScreen")||Object.defineProperty(tQ.prototype,"loadingScreen",(0,tN._MissingSideEffectProperty)("AbstractEngine","loadingScreen")),Object.getOwnPropertyDescriptor(tQ.prototype,"loadingUIText")||Object.defineProperty(tQ.prototype,"loadingUIText",(0,tN._MissingSideEffectProperty)("AbstractEngine","loadingUIText")),Object.getOwnPropertyDescriptor(tQ.prototype,"loadingUIBackgroundColor")||Object.defineProperty(tQ.prototype,"loadingUIBackgroundColor",(0,tN._MissingSideEffectProperty)("AbstractEngine","loadingUIBackgroundColor")),Object.getOwnPropertyDescriptor(tQ.prototype,"inputElement")||Object.defineProperty(tQ.prototype,"inputElement",(0,tN._MissingSideEffectProperty)("AbstractEngine","inputElement")),Object.getOwnPropertyDescriptor(tQ.prototype,"activeView")||Object.defineProperty(tQ.prototype,"activeView",(0,tN._MissingSideEffectProperty)("AbstractEngine","activeView")),Object.getOwnPropertyDescriptor(tQ.prototype,"views")||Object.defineProperty(tQ.prototype,"views",(0,tN._MissingSideEffectProperty)("AbstractEngine","views")),e.s(["AbstractEngine",0,tQ],76535)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12423,t=>{"use strict";class e{static GetShadersRepository(t=0){return 0===t?e.ShadersRepository:e.ShadersRepositoryWGSL}static GetShadersStore(t=0){return 0===t?e.ShadersStore:e.ShadersStoreWGSL}static GetIncludesShadersStore(t=0){return 0===t?e.IncludesShadersStore:e.IncludesShadersStoreWGSL}}e.ShadersRepository="src/Shaders/",e.ShadersStore={},e.IncludesShadersStore={},e.ShadersRepositoryWGSL="src/ShadersWGSL/",e.ShadersStoreWGSL={},e.IncludesShadersStoreWGSL={},t.s(["ShaderStore",0,e])},49007,t=>{"use strict";t.s(["IntersectionInfo",0,class{constructor(t,e,i){this.bu=t,this.bv=e,this.distance=i,this.faceId=0,this.subMeshId=0,this._internalSubMeshId=0}}])},21222,t=>{"use strict";var e=t.i(96265);class i{}i.POINTERDOWN=1,i.POINTERUP=2,i.POINTERMOVE=4,i.POINTERWHEEL=8,i.POINTERPICK=16,i.POINTERTAP=32,i.POINTERDOUBLETAP=64;class r{constructor(t,e){this.type=t,this.event=e}}t.s(["PointerEventTypes",0,i,"PointerInfo",0,class extends r{get pickInfo(){return this._pickInfo||this._generatePickInfo(),this._pickInfo}constructor(t,e,i,r=null){super(t,e),this._pickInfo=i,this._inputManager=r}_generatePickInfo(){this._inputManager&&(this._pickInfo=this._inputManager._pickMove(this.event),this._inputManager._setRayOnPointerInfo(this._pickInfo,this.event),this._inputManager=null)}},"PointerInfoPre",0,class extends r{constructor(t,i,r,n){super(t,i),this.ray=null,this.originalPickingInfo=null,this.skipOnPointerObservable=!1,this.localPosition=new e.Vector2(r,n)}}])},36365,t=>{"use strict";class e{}e.KEYDOWN=1,e.KEYUP=2;class i{constructor(t,e){this.type=t,this.event=e}}t.s(["KeyboardEventTypes",0,e,"KeyboardInfo",0,i,"KeyboardInfoPre",0,class extends i{get skipOnPointerObservable(){return this.skipOnKeyboardObservable}set skipOnPointerObservable(t){this.skipOnKeyboardObservable=t}constructor(t,e){super(t,e),this.type=t,this.event=e,this.skipOnKeyboardObservable=!1}}])},76696,t=>{"use strict";var e,i;(i=e||(e={}))[i.PointerMove=0]="PointerMove",i[i.PointerDown=1]="PointerDown",i[i.PointerUp=2]="PointerUp";class r{}r.DOM_DELTA_PIXEL=0,r.DOM_DELTA_LINE=1,r.DOM_DELTA_PAGE=2,t.s(["EventConstants",0,r])},67359,t=>{"use strict";var e=t.i(36395);class i{get min(){return this._min}get max(){return this._max}get average(){return this._average}get lastSecAverage(){return this._lastSecAverage}get current(){return this._current}get total(){return this._totalAccumulated}get count(){return this._totalValueCount}constructor(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}fetchNewFrame(){this._totalValueCount++,this._current=0,this._lastSecValueCount++}addCount(t,e){i.Enabled&&(this._current+=t,e&&this._fetchResult())}beginMonitoring(){i.Enabled&&(this._startMonitoringTime=e.PrecisionDate.Now)}endMonitoring(t=!0){if(!i.Enabled)return;t&&this.fetchNewFrame();let r=e.PrecisionDate.Now;this._current=r-this._startMonitoringTime,t&&this._fetchResult()}endFrame(){this._fetchResult()}_fetchResult(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;let t=e.PrecisionDate.Now;t-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=t,this._lastSecAccumulated=0,this._lastSecValueCount=0)}}i.Enabled=!0,t.s(["PerfCounter",0,i])},44981,t=>{"use strict";var e=t.i(66749),i=t.i(59576),r=t.i(89030),n=t.i(96265),o=t.i(48657),s=t.i(49007),a=t.i(50107),c=t.i(81623),l=t.i(5785);let h={internalPickerForMesh:void 0};class u{constructor(t,e,i=Number.MAX_VALUE,n=r.Epsilon){this.origin=t,this.direction=e,this.length=i,this.epsilon=n}clone(){return new u(this.origin.clone(),this.direction.clone(),this.length)}intersectsBoxMinMax(t,e,i=0){let r,n,o,s,a=u._TmpVector3[0].copyFromFloats(t.x-i,t.y-i,t.z-i),c=u._TmpVector3[1].copyFromFloats(e.x+i,e.y+i,e.z+i),l=0,h=Number.MAX_VALUE;if(1e-7>Math.abs(this.direction.x)){if(this.origin.x<a.x||this.origin.x>c.x)return!1}else if(r=1/this.direction.x,n=(a.x-this.origin.x)*r,(o=(c.x-this.origin.x)*r)==-1/0&&(o=1/0),n>o&&(s=n,n=o,o=s),(l=Math.max(n,l))>(h=Math.min(o,h)))return!1;if(1e-7>Math.abs(this.direction.y)){if(this.origin.y<a.y||this.origin.y>c.y)return!1}else if(r=1/this.direction.y,n=(a.y-this.origin.y)*r,(o=(c.y-this.origin.y)*r)==-1/0&&(o=1/0),n>o&&(s=n,n=o,o=s),(l=Math.max(n,l))>(h=Math.min(o,h)))return!1;if(1e-7>Math.abs(this.direction.z)){if(this.origin.z<a.z||this.origin.z>c.z)return!1}else if(r=1/this.direction.z,n=(a.z-this.origin.z)*r,(o=(c.z-this.origin.z)*r)==-1/0&&(o=1/0),n>o&&(s=n,n=o,o=s),(l=Math.max(n,l))>(h=Math.min(o,h)))return!1;return!0}intersectsBox(t,e=0){return this.intersectsBoxMinMax(t.minimum,t.maximum,e)}intersectsSphere(t,e=0){let i=t.center.x-this.origin.x,r=t.center.y-this.origin.y,n=t.center.z-this.origin.z,o=i*i+r*r+n*n,s=t.radius+e,a=s*s;if(o<=a)return!0;let c=i*this.direction.x+r*this.direction.y+n*this.direction.z;return!(c<0)&&o-c*c<=a}intersectsTriangle(t,e,i){let r=u._TmpVector3[0],o=u._TmpVector3[1],a=u._TmpVector3[2],c=u._TmpVector3[3],l=u._TmpVector3[4];e.subtractToRef(t,r),i.subtractToRef(t,o),n.Vector3.CrossToRef(this.direction,o,a);let h=n.Vector3.Dot(r,a);if(0===h)return null;let f=1/h;this.origin.subtractToRef(t,c);let d=n.Vector3.Dot(c,a)*f;if(d<-this.epsilon||d>1+this.epsilon)return null;n.Vector3.CrossToRef(c,r,l);let m=n.Vector3.Dot(this.direction,l)*f;if(m<-this.epsilon||d+m>1+this.epsilon)return null;let y=n.Vector3.Dot(o,l)*f;return y>this.length||y<0?null:new s.IntersectionInfo(1-d-m,d,y)}intersectsPlane(t){let e,i=n.Vector3.Dot(t.normal,this.direction);if(999999997475243e-21>Math.abs(i))return null;{let r=n.Vector3.Dot(t.normal,this.origin);if((e=(-t.d-r)/i)<0)if(e<-999999997475243e-21)return null;else return 0;return e}}intersectsAxis(t,e=0){switch(t){case"y":{let t=(this.origin.y-e)/this.direction.y;if(t>0)return null;return new n.Vector3(this.origin.x+-(this.direction.x*t),e,this.origin.z+-(this.direction.z*t))}case"x":{let t=(this.origin.x-e)/this.direction.x;if(t>0)return null;return new n.Vector3(e,this.origin.y+-(this.direction.y*t),this.origin.z+-(this.direction.z*t))}case"z":{let t=(this.origin.z-e)/this.direction.z;if(t>0)return null;return new n.Vector3(this.origin.x+-(this.direction.x*t),this.origin.y+-(this.direction.y*t),e)}default:return null}}intersectsMesh(t,e,i,r=!1,o,s=!1){let a=n.TmpVectors.Matrix[0];return t.getWorldMatrix().invertToRef(a),this._tmpRay?u.TransformToRef(this,a,this._tmpRay):this._tmpRay=u.Transform(this,a),t.intersects(this._tmpRay,e,i,r,o,s)}intersectsMeshes(t,e,i){i?i.length=0:i=[];for(let r=0;r<t.length;r++){let n=this.intersectsMesh(t[r],e);n.hit&&i.push(n)}return i.sort(this._comparePickingInfo),i}_comparePickingInfo(t,e){return t.distance<e.distance?-1:+(t.distance>e.distance)}intersectionSegment(t,e,i){let r=this.origin,o=n.TmpVectors.Vector3[0],s=n.TmpVectors.Vector3[1],a=n.TmpVectors.Vector3[2],c=n.TmpVectors.Vector3[3];e.subtractToRef(t,o),this.direction.scaleToRef(u._Rayl,a),r.addToRef(a,s),t.subtractToRef(r,c);let l=n.Vector3.Dot(o,o),h=n.Vector3.Dot(o,a),f=n.Vector3.Dot(a,a),d=n.Vector3.Dot(o,c),m=n.Vector3.Dot(a,c),y=l*f-h*h,g,R=y,p,T=y;y<u._Smallnum?(g=0,R=1,p=m,T=f):(g=h*m-f*d,p=l*m-h*d,g<0?(g=0,p=m,T=f):g>R&&(g=R,p=m+h,T=f)),p<0?(p=0,0>-d?g=0:-d>l?g=R:(g=-d,R=l)):p>T&&(p=T,-d+h<0?g=0:-d+h>l?g=R:(g=-d+h,R=l));let _=Math.abs(g)<u._Smallnum?0:g/R,P=Math.abs(p)<u._Smallnum?0:p/T,x=n.TmpVectors.Vector3[4];a.scaleToRef(P,x);let M=n.TmpVectors.Vector3[5];o.scaleToRef(_,M),M.addInPlace(c);let I=n.TmpVectors.Vector3[6];return(M.subtractToRef(x,I),P>0&&P<=this.length&&I.lengthSquared()<i*i)?M.length():-1}update(t,e,i,r,o,s,a,c=!1){if(c){u._RayDistant||(u._RayDistant=u.Zero()),u._RayDistant.unprojectRayToRef(t,e,i,r,n.Matrix.IdentityReadOnly,s,a);let c=n.TmpVectors.Matrix[0];o.invertToRef(c),u.TransformToRef(u._RayDistant,c,this)}else this.unprojectRayToRef(t,e,i,r,o,s,a);return this}static Zero(){return new u(n.Vector3.Zero(),n.Vector3.Zero())}static CreateNew(t,e,i,r,n,o,s){return u.Zero().update(t,e,i,r,n,o,s)}static CreateNewFromTo(t,e,i=n.Matrix.IdentityReadOnly){let r=new u(new n.Vector3(0,0,0),new n.Vector3(0,0,0));return u.CreateFromToToRef(t,e,r,i)}static CreateFromToToRef(t,e,i,r=n.Matrix.IdentityReadOnly){i.origin.copyFrom(t);let o=e.subtractToRef(t,i.direction);return i.length=Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z),i.direction.normalize(),u.TransformToRef(i,r,i)}static Transform(t,e){let i=new u(new n.Vector3(0,0,0),new n.Vector3(0,0,0));return u.TransformToRef(t,e,i),i}static TransformToRef(t,e,i){n.Vector3.TransformCoordinatesToRef(t.origin,e,i.origin),n.Vector3.TransformNormalToRef(t.direction,e,i.direction),i.length=t.length,i.epsilon=t.epsilon;let r=i.direction,o=r.length();if(0!==o&&1!==o){let t=1/o;r.x*=t,r.y*=t,r.z*=t,i.length*=o}return i}unprojectRayToRef(t,e,i,r,o,s,a){let l=n.TmpVectors.Matrix[0];o.multiplyToRef(s,l),l.multiplyToRef(a,l),l.invert();let h=c.EngineStore.LastCreatedEngine,u=n.TmpVectors.Vector3[0];u.x=t/i*2-1,u.y=-(e/r*2-1),u.z=h?.useReverseDepthBuffer?1:h?.isNDCHalfZRange?0:-1;let f=n.TmpVectors.Vector3[1].copyFromFloats(u.x,u.y,1-1e-8),d=n.TmpVectors.Vector3[2],m=n.TmpVectors.Vector3[3];n.Vector3.TransformCoordinatesToRef(u,l,d),n.Vector3.TransformCoordinatesToRef(f,l,m),this.origin.copyFrom(d),m.subtractToRef(d,this.direction),this.direction.normalize()}}function f(t,e,i,r,n,o=!1){let s=u.Zero();return d(t,e,i,r,s,n,o),s}function d(t,e,i,r,o,s,a=!1,c=!1){let l=t.getEngine();if(!s&&!(s=t.activeCamera)&&!(s=t.cameraToUseForPointers))return t;let h=s.viewport,u=l.getRenderHeight(),{x:f,y:m,width:y,height:g}=h.toGlobal(l.getRenderWidth(),u),R=1/l.getHardwareScalingLevel();return e=e*R-f,i=i*R-(u-m-g),o.update(e,i,y,g,r||n.Matrix.IdentityReadOnly,a?n.Matrix.IdentityReadOnly:s.getViewMatrix(),s.getProjectionMatrix(),c),t}function m(t,e,i,r){let n=u.Zero();return y(t,e,i,n,r),n}function y(t,e,i,r,o){if(!a.PickingInfo)return t;let s=t.getEngine();if(!o&&!(o=t.activeCamera)&&!(o=t.cameraToUseForPointers))throw Error("Active camera not set");let c=o.viewport,l=s.getRenderHeight(),{x:h,y:u,width:f,height:d}=c.toGlobal(s.getRenderWidth(),l),m=n.Matrix.Identity(),y=1/s.getHardwareScalingLevel();return e=e*y-h,i=i*y-(l-u-d),r.update(e,i,f,d,m,m,o.getProjectionMatrix()),t}function g(t,e,i,r,n,o,s,a){let c=e(r,i.enableDistantPicking);return R(t,i,r,c,n,o,s,a)}function R(t,e,i,r,n,o,s,a){let c=e.intersects(r,n,s,o,i,a);return c&&c.hit&&(n||null==t||!(c.distance>=t.distance))?c:null}function p(t){let e=t.getClassName();if("GreasedLineMesh"===e)return{rawBoundingInfo:null,intersectionThreshold:0};let i=t.rawBoundingInfo;return{rawBoundingInfo:i,intersectionThreshold:i?"InstancedLinesMesh"===e||"LinesMesh"===e?t.intersectionThreshold:0:0}}function T(t,e,i,r,n){let o=t(i,e.enableDistantPicking);return o.intersectsSphere(r.boundingSphere,n)&&o.intersectsBox(r.boundingBox,n)?o:null}function _(t,e,i,r,o,s){let c=null,l=!!(t.activeCameras&&t.activeCameras.length>1&&t.cameraToUseForPointers!==t.activeCamera),u=t.cameraToUseForPointers||t.activeCamera,f=h.internalPickerForMesh||g,d=f===g;for(let a=0;a<t.meshes.length;a++){let h=t.meshes[a];if(i){if(!i(h,-1))continue}else if(!h.isEnabled()||!h.isVisible||!h.isPickable)continue;let m=l&&h.isWorldMatrixCameraDependent(),y=h.computeWorldMatrix(m,u);if(h.hasThinInstances&&h.thinInstanceEnablePicking){let t=f(c,e,h,y,!0,!0,s);if(t){if(o)return t;let{rawBoundingInfo:a,intersectionThreshold:l}=p(h),u=h._thinInstanceDataStorage.matrixData;if(u){let t=n.TmpVectors.Matrix[0],m=n.TmpVectors.Matrix[1],g=Math.min(h.thinInstanceCount,u.length>>4);for(let p=0;p<g;p++){if(i&&!i(h,p))continue;n.Matrix.FromArrayToRef(u,p<<4,t),t.multiplyToRef(y,m);let g=d&&a?T(e,h,m,a,l):null;if(d&&a&&!g)continue;let _=d&&g?R(c,h,m,g,r,o,s,!0):f(c,e,h,m,r,o,s,!0);if(_&&((c=_).thinInstanceIndex=p,r))return c}}}}else{let t=f(c,e,h,y,r,o,s);if(t&&(c=t,r))return c}}return c||new a.PickingInfo}function P(t,e,i,r){if(!a.PickingInfo)return null;let o=[],s=!!(t.activeCameras&&t.activeCameras.length>1&&t.cameraToUseForPointers!==t.activeCamera),c=t.cameraToUseForPointers||t.activeCamera,l=h.internalPickerForMesh||g,u=l===g;for(let a=0;a<t.meshes.length;a++){let h=t.meshes[a];if(i){if(!i(h,-1))continue}else if(!h.isEnabled()||!h.isVisible||!h.isPickable)continue;let f=s&&h.isWorldMatrixCameraDependent(),d=h.computeWorldMatrix(f,c);if(h.hasThinInstances&&h.thinInstanceEnablePicking){if(l(null,e,h,d,!0,!0,r)){let{rawBoundingInfo:t,intersectionThreshold:s}=p(h),a=h._thinInstanceDataStorage.matrixData;if(a){let c=n.TmpVectors.Matrix[0],f=n.TmpVectors.Matrix[1],m=Math.min(h.thinInstanceCount,a.length>>4);for(let y=0;y<m;y++){if(i&&!i(h,y))continue;n.Matrix.FromArrayToRef(a,y<<4,c),c.multiplyToRef(d,f);let m=u&&t?T(e,h,f,t,s):null;if(u&&t&&!m)continue;let g=u&&m?R(null,h,f,m,!1,!1,r,!0):l(null,e,h,f,!1,!1,r,!0);g&&(g.thinInstanceIndex=y,o.push(g))}}}}else{let t=l(null,e,h,d,!1,!1,r);t&&o.push(t)}}return o}function x(t,e,i,r,o,s){if(!a.PickingInfo)return null;let c=_(t,r=>(t._tempPickingRay||(t._tempPickingRay=u.Zero()),d(t,e,i,r,t._tempPickingRay,s||null),t._tempPickingRay),r,o,!0);return c&&(c.ray=f(t,e,i,n.Matrix.Identity(),s||null)),c}function M(t,e,i,r,o,s,a,c=!1){let l=_(t,(r,n)=>(t._tempPickingRay||(t._tempPickingRay=u.Zero()),d(t,e,i,r,t._tempPickingRay,s||null,!1,n),t._tempPickingRay),r,o,!1,a);return l&&(l.ray=f(t,e,i,n.Matrix.Identity(),s||null)),l}function I(t,e,i,r,o){let s=_(t,i=>(t._pickWithRayInverseMatrix||(t._pickWithRayInverseMatrix=n.Matrix.Identity()),i.invertToRef(t._pickWithRayInverseMatrix),t._cachedRayForTransform||(t._cachedRayForTransform=u.Zero()),u.TransformToRef(e,t._pickWithRayInverseMatrix,t._cachedRayForTransform),t._cachedRayForTransform),i,r,!1,o);return s&&(s.ray=e),s}function V(t,e,i,r,n,o){return P(t,r=>f(t,e,i,r,n||null),r,o)}function k(t,e,i,r){return P(t,i=>(t._pickWithRayInverseMatrix||(t._pickWithRayInverseMatrix=n.Matrix.Identity()),i.invertToRef(t._pickWithRayInverseMatrix),t._cachedRayForTransform||(t._cachedRayForTransform=u.Zero()),u.TransformToRef(e,t._pickWithRayInverseMatrix,t._cachedRayForTransform),t._cachedRayForTransform),i,r)}function S(t,e=100,i,r){return C(t,new u(n.Vector3.Zero(),n.Vector3.Zero(),e),e,i,r)}function C(t,e,i=100,r,o){r||(r=t.getWorldMatrix()),e.length=i,o?e.origin.copyFrom(o):e.origin.copyFrom(t.position);let s=n.TmpVectors.Vector3[2];s.set(0,0,t._scene.useRightHandedSystem?-1:1);let a=n.TmpVectors.Vector3[3];return n.Vector3.TransformNormalToRef(s,r,a),n.Vector3.NormalizeToRef(a,e.direction),e}function v(t,e){e&&(e.prototype.getForwardRay=function(t=100,e,i){return C(this,new u(n.Vector3.Zero(),n.Vector3.Zero(),t),t,e,i)},e.prototype.getForwardRayToRef=function(t,e=100,i,r){return C(this,t,e,i,r)}),t&&(l._ImportHelper._IsPickingAvailable=!0,t.prototype.createPickingRay=function(t,e,i,r,n=!1){return f(this,t,e,i,r,n)})}u._TmpVector3=(0,o.BuildArray)(6,n.Vector3.Zero),u._RayDistant=u.Zero(),u._Smallnum=1e-8,u._Rayl=1e9,t.s(["AddRayExtensions",0,v,"CreatePickingRay",0,f,"CreatePickingRayInCameraSpace",0,m,"CreatePickingRayInCameraSpaceToRef",0,y,"CreatePickingRayToRef",0,d,"GetForwardRay",0,S,"GetForwardRayToRef",0,C,"MultiPick",0,V,"MultiPickWithRay",0,k,"Pick",0,M,"PickWithBoundingInfo",0,x,"PickWithRay",0,I,"PickingCustomization",0,h,"Ray",0,u],57180);let b=!1;function w(){b||(b=!0,v(e.Scene,i.Camera),e.Scene.prototype.createPickingRayToRef=function(t,e,i,r,n,o=!1,s=!1){return d(this,t,e,i,r,n,o,s)},e.Scene.prototype.createPickingRayInCameraSpace=function(t,e,i){return m(this,t,e,i)},e.Scene.prototype.createPickingRayInCameraSpaceToRef=function(t,e,i,r){return y(this,t,e,i,r)},e.Scene.prototype.pickWithBoundingInfo=function(t,e,i,r,n){return x(this,t,e,i,r,n)},e.Scene.prototype.pick=function(t,e,i,r,n,o,s=!1){return M(this,t,e,i,r,n,o,s)},e.Scene.prototype.pickWithRay=function(t,e,i,r){return I(this,t,e,i,r)},e.Scene.prototype.multiPick=function(t,e,i,r,n){return V(this,t,e,i,r,n)},e.Scene.prototype.multiPickWithRay=function(t,e,i){return k(this,t,e,i)})}t.s(["RegisterRay",0,w],88181),w(),t.s([],1727),t.i(1727),t.i(88181),t.i(57180),t.s(["AddRayExtensions",0,v,"CreatePickingRay",0,f,"CreatePickingRayInCameraSpace",0,m,"CreatePickingRayInCameraSpaceToRef",0,y,"CreatePickingRayToRef",0,d,"GetForwardRay",0,S,"GetForwardRayToRef",0,C,"MultiPick",0,V,"MultiPickWithRay",0,k,"Pick",0,M,"PickWithBoundingInfo",0,x,"PickWithRay",0,I,"PickingCustomization",0,h,"Ray",0,u,"RegisterRay",0,w],27608),t.i(27608),t.s(["AddRayExtensions",0,v,"CreatePickingRay",0,f,"CreatePickingRayInCameraSpace",0,m,"CreatePickingRayInCameraSpaceToRef",0,y,"CreatePickingRayToRef",0,d,"GetForwardRay",0,S,"GetForwardRayToRef",0,C,"MultiPick",0,V,"MultiPickWithRay",0,k,"Pick",0,M,"PickWithBoundingInfo",0,x,"PickWithRay",0,I,"PickingCustomization",0,h,"Ray",0,u,"RegisterRay",0,w],44981)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,35851,e=>{"use strict";var t,r,n,l,a,i,o=e.i(13379),u=e.i(46703),s=e.i(96704);function f(e,t){let r=new Uint8Array(e),n=0;for(;0!=r[t.value+n];)n+=1;let l=new TextDecoder().decode(r.slice(t.value,t.value+n));return t.value=t.value+n+1,l}function c(e,t){let r=e.getInt32(t.value,!0);return t.value+=4,r}function h(e,t){let r=e.getUint32(t.value,!0);return t.value+=4,r}function d(e,t){let r=e.getUint8(t.value);return t.value+=1,r}function p(e,t){let r=e.getUint16(t.value,!0);return t.value+=2,r}function y(e,t){let r=e[t.value];return t.value+=1,r}function w(e,t){let r=e.getFloat32(t.value,!0);return t.value+=4,r}function v(e,t){return(0,s.FromHalfFloat)(p(e,t))}function b(e,t){return(0,s.ToHalfFloat)((0,u.Clamp)(w(e,t),-s.MaxHalfFloat,s.MaxHalfFloat))}function S(e){for(let t=1;t<e.length;t++){let r=e[t-1]+e[t]-128;e[t]=r}}function E(e,t){let r=0,n=Math.floor((e.length+1)/2),l=0,a=e.length-1;for(;!(l>a)&&(t[l++]=e[r++],!(l>a));){;t[l++]=e[n++]}}function g(e,t){if(0x1312f76!=e.getUint32(0,!0))throw Error("Incorrect OpenEXR format");let r=e.getUint8(4),n=e.getUint8(5);t.value=8;let l={},i=!0;for(;i;){let r=f(e.buffer,t);if(r){let n=f(e.buffer,t),i=h(e,t),u=function(e,t,r,n){var l;switch(r){case"string":case"stringvector":case"iccProfile":let i;return l=e.buffer,i=new TextDecoder().decode(new Uint8Array(l).slice(t.value,t.value+n)),t.value=t.value+n,i;case"chlist":return function(e,t,r){let n=t.value,l=[];for(;t.value<n+r-1;){let r=f(e.buffer,t),n=c(e,t),a=d(e,t);t.value+=3;let i=c(e,t),o=c(e,t);l.push({name:r,pixelType:n,pLinear:a,xSampling:i,ySampling:o})}return t.value+=1,l}(e,t,n);case"chromaticities":let o,u,s,p,y,v;return o=w(e,t),u=w(e,t),s=w(e,t),p=w(e,t),y=w(e,t),v=w(e,t),{redX:o,redY:u,greenX:s,greenY:p,blueX:y,blueY:v,whiteX:w(e,t),whiteY:w(e,t)};case"compression":return d(e,t);case"box2i":let b,S;return b=c(e,t),S=c(e,t),{xMin:b,yMin:S,xMax:c(e,t),yMax:c(e,t)};case"lineOrder":return a[d(e,t)];case"float":return w(e,t);case"v2f":return[w(e,t),w(e,t)];case"v3f":let E;return E=w(e,t),[E,w(e,t),w(e,t)];case"int":return c(e,t);case"rational":return[c(e,t),h(e,t)];case"timecode":return[h(e,t),h(e,t)];case"preview":return t.value+=n,"skipped";default:t.value+=n;return}}(e,t,n,i);void 0===u?o.Logger.Warn(`Unknown header attribute type ${n}'.`):l[r]=u}else i=!1}if((-5&n)!=0)throw Error("Unsupported file format");return{version:r,spec:{singleTile:!!(2&n),longName:!!(4&n),deepFormat:!!(8&n),multiPart:!!(16&n)},...l}}(t=l||(l={}))[t.NO_COMPRESSION=0]="NO_COMPRESSION",t[t.RLE_COMPRESSION=1]="RLE_COMPRESSION",t[t.ZIPS_COMPRESSION=2]="ZIPS_COMPRESSION",t[t.ZIP_COMPRESSION=3]="ZIP_COMPRESSION",t[t.PIZ_COMPRESSION=4]="PIZ_COMPRESSION",t[t.PXR24_COMPRESSION=5]="PXR24_COMPRESSION",(r=a||(a={}))[r.INCREASING_Y=0]="INCREASING_Y",r[r.DECREASING_Y=1]="DECREASING_Y";function O(e,t,r,n,l){for(;r<e;)t=t<<8|y(n,l),r+=8;return{l:t>>(r-=e)&(1<<e)-1,c:t,lc:r}}function A(e,t,r,n){return{c:e=e<<8|y(r,n),lc:t+=8}}function C(e,t,r,n,l,a,i,o,u){if(e==t){if(n<8){let e=A(r,n,l,a);r=e.c,n=e.lc}let e=r>>(n-=8);if(e=new Uint8Array([e])[0],o.value+e>u)return null;let t=i[o.value-1];for(;e-- >0;)i[o.value++]=t}else{if(!(o.value<u))return null;i[o.value++]=e}return{c:r,lc:n}}let I=Array(59);function R(e){let t=65535&e;return t>32767?t-65536:t}function M(e,t){let r=R(e),n=R(t),l=r+(1&n)+(n>>1);return{a:l,b:l-n}}function x(e,t){let r=65535&t,n=(65535&e)-(r>>1)&65535;return{a:r+n-32768&65535,b:n}}function m(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function P(e){let t=new Uint8Array(function(e){let t=e.byteLength,r=[],n=0,l=new DataView(e);for(;t>0;){let e=l.getInt8(n++);if(e<0){let a=-e;t-=a+1;for(let e=0;e<a;e++)r.push(l.getUint8(n++))}else{t-=2;let a=l.getUint8(n++);for(let t=0;t<e+1;t++)r.push(a)}}return r}(e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size))),r=new Uint8Array(t.length);return S(t),E(t,r),new DataView(r.buffer)}function U(e){let t=e.array.slice(e.offset.value,e.offset.value+e.size),r=fflate.unzlibSync(t),n=new Uint8Array(r.length);return S(r),E(r,n),new DataView(n.buffer)}function F(e){let t=e.array.slice(e.offset.value,e.offset.value+e.size),r=fflate.unzlibSync(t),n=e.lines*e.channels*e.width,l=1==e.type?new Uint16Array(n):new Uint32Array(n),a=0,i=0,o=[,,,,];for(let t=0;t<e.lines;t++)for(let t=0;t<e.channels;t++){let t=0;switch(e.type){case 1:o[0]=a,o[1]=o[0]+e.width,a=o[1]+e.width;for(let n=0;n<e.width;++n)t+=r[o[0]++]<<8|r[o[1]++],l[i]=t,i++;break;case 2:o[0]=a,o[1]=o[0]+e.width,o[2]=o[1]+e.width,a=o[2]+e.width;for(let n=0;n<e.width;++n)t+=r[o[0]++]<<24|r[o[1]++]<<16|r[o[2]++]<<8,l[i]=t,i++}}return new DataView(l.buffer)}function N(e){let t=e.viewer,r={value:e.offset.value},n=new Uint16Array(e.width*e.scanlineBlockSize*(e.channels*e.type)),l=new Uint8Array(8192),a=0,i=Array(e.channels);for(let t=0;t<e.channels;t++)i[t]={},i[t].start=a,i[t].end=i[t].start,i[t].nx=e.width,i[t].ny=e.lines,i[t].size=e.type,a+=i[t].nx*i[t].ny*i[t].size;let o=p(t,r),u=p(t,r);if(u>=8192)throw Error("Wrong PIZ_COMPRESSION BITMAP_SIZE");if(o<=u)for(let e=0;e<u-o+1;e++)l[e+o]=d(t,r);let s=new Uint16Array(65536),f=function(e,t){let r=0;for(let n=0;n<65536;++n)(0==n||e[n>>3]&1<<(7&n))&&(t[r++]=n);let n=r-1;for(;r<65536;)t[r++]=0;return n}(l,s),c=h(t,r);!function(e,t,r,n,l,a){let i=r.value,o=h(t,r),u=h(t,r);r.value+=4;let s=h(t,r);if(r.value+=4,o<0||o>=65537||u<0||u>=65537)throw Error("Wrong HUF_ENCSIZE");let f=Array(65537),c=Array(16384);for(let e=0;e<16384;e++)c[e]={},c[e].len=0,c[e].lit=0,c[e].p=null;let d=n-(r.value-i);if(!function(e,t,r,n,l,a){let i=0,o=0;for(;n<=l;n++){if(t.value-t.value>r)return;let u=O(6,i,o,e,t),s=u.l;if(i=u.c,o=u.lc,a[n]=s,63==s){if(t.value-t.value>r)throw Error("Error in HufUnpackEncTable");let s=(u=O(8,i,o,e,t)).l+6;if(i=u.c,o=u.lc,n+s>l+1)throw Error("Error in HufUnpackEncTable");for(;s--;)a[n++]=0;n--}else if(s>=59){let e=s-59+2;if(n+e>l+1)throw Error("Error in HufUnpackEncTable");for(;e--;)a[n++]=0;n--}}!function(e){for(let e=0;e<=58;++e)I[e]=0;for(let t=0;t<65537;++t)I[e[t]]+=1;let t=0;for(let e=58;e>0;--e){let r=t+I[e]>>1;I[e]=t,t=r}for(let t=0;t<65537;++t){let r=e[t];r>0&&(e[t]=r|I[r]++<<6)}}(a)}(e,r,d,o,u,f),s>8*(n-(r.value-i)))throw Error("Wrong hufUncompress");!function(e,t,r,n){for(;t<=r;t++){let r=e[t]>>6,l=63&e[t];if(r>>l)throw Error("Invalid table entry");if(l>14){let e=n[r>>l-14];if(e.len)throw Error("Invalid table entry");if(e.lit++,e.p){let t=e.p;e.p=Array(e.lit);for(let r=0;r<e.lit-1;++r)e.p[r]=t[r]}else e.p=[,];e.p[e.lit-1]=t}else if(l){let e=0;for(let a=1<<14-l;a>0;a--){let a=n[(r<<14-l)+e];if(a.len||a.p)throw Error("Invalid table entry");a.len=l,a.lit=t,e++}}}}(f,o,u,c),function(e,t,r,n,l,a,i,o,u){let s=0,f=0,c=Math.trunc(n.value+(l+7)/8);for(;n.value<c;){let l=A(s,f,r,n);for(s=l.c,f=l.lc;f>=14;){let h=t[s>>f-14&16383];if(h.len){f-=h.len;let e=C(h.lit,a,s,f,r,n,o,u,i);e&&(s=e.c,f=e.lc)}else{let t;if(!h.p)throw Error("hufDecode issues");for(t=0;t<h.lit;t++){let d=63&e[h.p[t]];for(;f<d&&n.value<c;)s=(l=A(s,f,r,n)).c,f=l.lc;if(f>=d&&e[h.p[t]]>>6==(s>>f-d&(1<<d)-1)){f-=d;let e=C(h.p[t],a,s,f,r,n,o,u,i);e&&(s=e.c,f=e.lc);break}}if(t==h.lit)throw Error("HufDecode issues")}}}let h=8-l&7;for(s>>=h,f-=h;f>0;){let e=t[s<<14-f&16383];if(e.len){f-=e.len;let t=C(e.lit,a,s,f,r,n,o,u,i);t&&(s=t.c,f=t.lc)}else throw Error("HufDecode issues")}}(f,c,e,r,s,u,a,l,{value:0})}(e.array,t,r,c,n,a);for(let t=0;t<e.channels;++t){let e=i[t];for(let r=0;r<i[t].size;++r)!function(e,t,r,n,l,a,i){let o,u,s=i<16384,f=r>l?l:r,c=1;for(;c<=f;)c<<=1;for(c>>=1,o=c,c>>=1;c>=1;){let i,f,h,d,p=(u=0)+a*(l-o),y=a*c,w=a*o,v=n*c,b=n*o;for(;u<=p;u+=w){let l=u,a=u+n*(r-o);for(;l<=a;l+=b){let r=l+v,n=l+y,a=n+v;if(s){let o=M(e[l+t],e[n+t]);i=o.a,h=o.b,f=(o=M(e[r+t],e[a+t])).a,d=o.b,o=M(i,f),e[l+t]=o.a,e[r+t]=o.b,o=M(h,d),e[n+t]=o.a,e[a+t]=o.b}else{let o=x(e[l+t],e[n+t]);i=o.a,h=o.b,f=(o=x(e[r+t],e[a+t])).a,d=o.b,o=x(i,f),e[l+t]=o.a,e[r+t]=o.b,o=x(h,d),e[n+t]=o.a,e[a+t]=o.b}}if(r&c){let r,n=l+y;i=(r=s?M(e[l+t],e[n+t]):x(e[l+t],e[n+t])).a,e[n+t]=r.b,e[l+t]=i}}if(l&c){let l=u,a=u+n*(r-o);for(;l<=a;l+=b){let r,n=l+v;i=(r=s?M(e[l+t],e[n+t]):x(e[l+t],e[n+t])).a,e[n+t]=r.b,e[l+t]=i}}o=c,c>>=1}}(n,e.start+r,e.nx,e.size,e.ny,e.nx*e.size,f)}var y=a;for(let e=0;e<y;++e)n[e]=s[n[e]];let w=0,v=new Uint8Array(n.buffer.byteLength);for(let t=0;t<e.lines;t++)for(let t=0;t<e.channels;t++){let e=i[t],r=e.nx*e.size,l=new Uint8Array(n.buffer,2*e.end,2*r);v.set(l,w),w+=2*r,e.end+=r}return new DataView(v.buffer)}var T=e.i(65740);(n=i||(i={}))[n.Float=0]="Float",n[n.HalfFloat=1]="HalfFloat";class k{}async function z(e,t,r,n){let a={size:0,viewer:t,array:new Uint8Array(t.buffer),offset:r,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,channels:e.channels.length,channelLineOffsets:{},scanOrder:()=>0,bytesPerLine:0,outLineWidth:0,lines:0,scanlineBlockSize:0,inputSize:null,type:0,uncompress:null,getter:()=>0,format:5,outputChannels:0,decodeChannels:{},blockCount:null,byteArray:null,linearSpace:!1,textureType:0};switch(e.compression){case l.NO_COMPRESSION:a.lines=1,a.uncompress=m;break;case l.RLE_COMPRESSION:a.lines=1,a.uncompress=P;break;case l.ZIPS_COMPRESSION:a.lines=1,a.uncompress=U,await T.Tools.LoadScriptAsync(k.FFLATEUrl);break;case l.ZIP_COMPRESSION:a.lines=16,a.uncompress=U,await T.Tools.LoadScriptAsync(k.FFLATEUrl);break;case l.PIZ_COMPRESSION:a.lines=32,a.uncompress=N;break;case l.PXR24_COMPRESSION:a.lines=16,a.uncompress=F,await T.Tools.LoadScriptAsync(k.FFLATEUrl);break;default:throw Error(l[e.compression]+" is unsupported")}a.scanlineBlockSize=a.lines;let o={};for(let t of e.channels)switch(t.name){case"R":case"G":case"B":case"A":case"Y":o[t.name]=!0,a.type=t.pixelType}let u=!1;if(o.R&&o.G&&o.B&&o.A)a.outputChannels=4,a.decodeChannels={R:0,G:1,B:2,A:3};else if(o.R&&o.G&&o.B)u=!0,a.outputChannels=4,a.decodeChannels={R:0,G:1,B:2,A:3};else if(o.R&&o.G)a.outputChannels=2,a.decodeChannels={R:0,G:1};else if(o.R)a.outputChannels=1,a.decodeChannels={R:0};else if(o.Y)a.outputChannels=1,a.decodeChannels={Y:0};else throw Error("EXRLoader.parse: file contains unsupported data channels.");if(1===a.type)switch(n){case i.Float:a.getter=v,a.inputSize=2;break;case i.HalfFloat:a.getter=p,a.inputSize=2}else if(2===a.type)switch(n){case i.Float:a.getter=w,a.inputSize=4;break;case i.HalfFloat:a.getter=b,a.inputSize=4}else throw Error("Unsupported pixelType "+a.type+" for "+e.compression);a.blockCount=a.height/a.scanlineBlockSize;for(let e=0;e<a.blockCount;e++)!function(e,t){"getBigInt64"in DataView.prototype?e.getBigInt64(t.value,!0):(e.getUint32(t.value+4,!0),e.getUint32(t.value,!0)),t.value+=8}(t,r);let s=a.width*a.height*a.outputChannels;switch(n){case i.Float:a.byteArray=new Float32Array(s),a.textureType=1,u&&a.byteArray.fill(1,0,s);break;case i.HalfFloat:a.byteArray=new Uint16Array(s),a.textureType=2,u&&a.byteArray.fill(15360,0,s);break;default:throw Error("Unsupported type: "+n)}let f=0;for(let t of e.channels)void 0!==a.decodeChannels[t.name]&&(a.channelLineOffsets[t.name]=f*a.width),f+=2*t.pixelType;return a.bytesPerLine=a.width*f,a.outLineWidth=a.width*a.outputChannels,"INCREASING_Y"===e.lineOrder?a.scanOrder=e=>e:a.scanOrder=e=>a.height-1-e,4==a.outputChannels?(a.format=5,a.linearSpace=!0):(a.format=6,a.linearSpace=!1),a}function L(e,t,r,n){let l={value:0};for(let a=0;a<e.height/e.scanlineBlockSize;a++){let i=c(r,n)-t.dataWindow.yMin;e.size=h(r,n),e.lines=i+e.scanlineBlockSize>e.height?e.height-i:e.scanlineBlockSize;let o=e.size<e.lines*e.bytesPerLine&&e.uncompress?e.uncompress(e):m(e);n.value+=e.size;for(let r=0;r<e.scanlineBlockSize;r++){let n=a*e.scanlineBlockSize,i=r+e.scanOrder(n);if(i>=e.height)continue;let u=r*e.bytesPerLine,s=(e.height-1-i)*e.outLineWidth;for(let r=0;r<e.channels;r++){let n=t.channels[r].name,a=e.channelLineOffsets[n],i=e.decodeChannels[n];if(void 0!==i){l.value=u+a;for(let t=0;t<e.width;t++){let r=s+t*e.outputChannels+i;e.byteArray&&(e.byteArray[r]=e.getter(o,l))}}}}}}async function _(e){let t=new DataView(e),r={value:0},n=g(t,r);try{let e=await z(n,t,r,i.Float);if(L(e,n,t,r),!e.byteArray)return o.Logger.Error("Failed to decode EXR data: No byte array available."),{width:0,height:0,data:null};return{width:n.dataWindow.xMax-n.dataWindow.xMin+1,height:n.dataWindow.yMax-n.dataWindow.yMin+1,data:new Float32Array(e.byteArray)}}catch(e){o.Logger.Error("Failed to load EXR data: ",e)}return{width:0,height:0,data:null}}k.DefaultOutputType=i.HalfFloat,k.FFLATEUrl="https://unpkg.com/fflate@0.8.2",e.s(["ReadExrDataAsync",0,_,"_ExrTextureLoader",0,class{constructor(){this.supportCascades=!1}loadCubeData(e,t,r,n,l){throw".exr not supported in Cube."}loadData(e,t,r){let n=new DataView(e.buffer),l={value:0},a=g(n,l);z(a,n,l,k.DefaultOutputType).then(e=>{L(e,a,n,l),r(a.dataWindow.xMax-a.dataWindow.xMin+1,a.dataWindow.yMax-a.dataWindow.yMin+1,t.generateMipMaps,!1,()=>{let r=t.getEngine();t.format=a.format,t.type=e.textureType,t.invertY=!1,t._gammaSpace=!a.linearSpace,e.byteArray&&r._uploadDataToTextureDirectly(t,e.byteArray,0,0,void 0,!0)})}).catch(e=>{o.Logger.Error("Failed to load EXR texture: ",e)})}}],35851)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,54361,e=>{"use strict";class t{constructor(e,t){this.width=e,this.height=t}toString(){return`{W: ${this.width}, H: ${this.height}}`}getClassName(){return"Size"}getHashCode(){let e=0|this.width;return 397*e^this.height}copyFrom(e){this.width=e.width,this.height=e.height}copyFromFloats(e,t){return this.width=e,this.height=t,this}set(e,t){return this.copyFromFloats(e,t)}multiplyByFloats(e,i){return new t(this.width*e,this.height*i)}clone(){return new t(this.width,this.height)}equals(e){return!!e&&this.width===e.width&&this.height===e.height}get surface(){return this.width*this.height}static Zero(){return new t(0,0)}add(e){return new t(this.width+e.width,this.height+e.height)}subtract(e){return new t(this.width-e.width,this.height-e.height)}scale(e){return new t(this.width*e,this.height*e)}static Lerp(e,i,r){return new t(e.width+(i.width-e.width)*r,e.height+(i.height-e.height)*r)}}e.s(["Size",0,t])},52153,e=>{"use strict";var t,i=e.i(10272),r=e.i(37143),s=e.i(99267),a=e.i(96265),n=e.i(81623),h=e.i(84768),o=e.i(54361);class l{get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get coordinatesMode(){return 0}get isCube(){return!!this._texture&&this._texture.isCube}set isCube(e){this._texture&&(this._texture.isCube=e)}get is3D(){return!!this._texture&&this._texture.is3D}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return!!this._texture&&this._texture.is2DArray}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}getClassName(){return"ThinTexture"}static _IsRenderTargetWrapper(e){return e?.shareDepth!==void 0}constructor(e){this._wrapU=1,this._wrapV=1,this.wrapR=1,this.anisotropicFilteringLevel=4,this.delayLoadState=0,this._texture=null,this._engine=null,this._cachedSize=o.Size.Zero(),this._cachedBaseSize=o.Size.Zero(),this._initialSamplingMode=2,this._texture=l._IsRenderTargetWrapper(e)?e.texture:e,this._texture&&(this._engine=this._texture.getEngine(),this.wrapU=this._texture._cachedWrapU??this.wrapU,this.wrapV=this._texture._cachedWrapV??this.wrapV,this.wrapR=this._texture._cachedWrapR??this.wrapR)}isReady(){return 4===this.delayLoadState?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady}delayLoad(){}getInternalTexture(){return this._texture}getSize(){if(this._texture){if(this._texture.width)return this._cachedSize.width=this._texture.width,this._cachedSize.height=this._texture.height,this._cachedSize;this._texture._size&&(this._cachedSize.width=this._texture._size,this._cachedSize.height=this._texture._size)}return this._cachedSize}getBaseSize(){return this.isReady()&&this._texture?this._texture._size?(this._cachedBaseSize.width=this._texture._size,this._cachedBaseSize.height=this._texture._size):(this._cachedBaseSize.width=this._texture.baseWidth,this._cachedBaseSize.height=this._texture.baseHeight):(this._cachedBaseSize.width=0,this._cachedBaseSize.height=0),this._cachedBaseSize}get samplingMode(){return this._texture?this._texture.samplingMode:this._initialSamplingMode}updateSamplingMode(e,t=!1){this._texture&&this._engine&&this._engine.updateTextureSamplingMode(e,this._texture,this._texture.generateMipMaps&&t)}releaseInternalTexture(){this._texture&&(this._texture.dispose(),this._texture=null)}dispose(){this._texture&&(this.releaseInternalTexture(),this._engine=null)}}var u=e.i(80871),_=e.i(75405);class c extends l{set hasAlpha(e){this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get hasAlpha(){return this._hasAlpha}set getAlphaFromRGB(e){this._getAlphaFromRGB!==e&&(this._getAlphaFromRGB=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get getAlphaFromRGB(){return this._getAlphaFromRGB}set coordinatesIndex(e){this._coordinatesIndex!==e&&(this._coordinatesIndex=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get coordinatesIndex(){return this._coordinatesIndex}set coordinatesMode(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get coordinatesMode(){return this._coordinatesMode}get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get isCube(){return this._texture?this._texture.isCube:this._isCube}set isCube(e){this._texture?this._texture.isCube=e:this._isCube=e}get is3D(){return!!this._texture&&this._texture.is3D}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return!!this._texture&&this._texture.is2DArray}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}get gammaSpace(){return this._texture?(null===this._texture._gammaSpace&&(this._texture._gammaSpace=this._gammaSpace),this._texture._gammaSpace&&!this._texture._useSRGBBuffer):this._gammaSpace}set gammaSpace(e){if(this._texture){if(this._texture._gammaSpace===e)return;this._texture._gammaSpace=e}else{if(this._gammaSpace===e)return;this._gammaSpace=e}this.getScene()?.markAllMaterialsAsDirty(1,e=>e.hasTexture(this))}get isRGBD(){return null!=this._texture&&this._texture._isRGBD}set isRGBD(e){e!==this.isRGBD&&(this._texture&&(this._texture._isRGBD=e),this.getScene()?.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get noMipmap(){return!1}get lodGenerationOffset(){return this._texture?this._texture._lodGenerationOffset:0}set lodGenerationOffset(e){this._texture&&(this._texture._lodGenerationOffset=e)}get lodGenerationScale(){return this._texture?this._texture._lodGenerationScale:0}set lodGenerationScale(e){this._texture&&(this._texture._lodGenerationScale=e)}get linearSpecularLOD(){return!!this._texture&&this._texture._linearSpecularLOD}set linearSpecularLOD(e){this._texture&&(this._texture._linearSpecularLOD=e)}get irradianceTexture(){return this._texture?this._texture._irradianceTexture:null}set irradianceTexture(e){this._texture&&(this._texture._irradianceTexture=e)}get uid(){return this._uid||(this._uid=(0,h.RandomGUID)()),this._uid}toString(){return this.name}getClassName(){return"BaseTexture"}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get isBlocking(){return!0}get loadingError(){return this._loadingError}get errorObject(){return this._errorObject}constructor(e,t=null){super(null),this.metadata=null,this.reservedDataStore=null,this._hasAlpha=!1,this._getAlphaFromRGB=!1,this.level=1,this._coordinatesIndex=0,this.optimizeUVAllocation=!0,this._coordinatesMode=0,this.wrapR=1,this.anisotropicFilteringLevel=c.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,this._isCube=!1,this._gammaSpace=!0,this.invertZ=!1,this.lodLevelInAlpha=!1,this._dominantDirection=null,this.isRenderTarget=!1,this._prefiltered=!1,this._forceSerialize=!1,this.animations=[],this.onDisposeObservable=new s.Observable,this._onDisposeObserver=null,this._scene=null,this._uid=null,this._parentContainer=null,this._loadingError=!1,e?c._IsScene(e)?this._scene=e:this._engine=e:this._scene=n.EngineStore.LastCreatedScene,this._scene&&(this.uniqueId=this._scene.getUniqueId(),this._scene.addTexture(this),this._engine=this._scene.getEngine()),this._texture=t,this._uid=null}getScene(){return this._scene}_getEngine(){return this._engine}getTextureMatrix(){return a.Matrix.IdentityReadOnly}getReflectionTextureMatrix(){return a.Matrix.IdentityReadOnly}getRefractionTextureMatrix(){return this.getReflectionTextureMatrix()}isReadyOrNotBlocking(){return!this.isBlocking||this.isReady()||this.loadingError}scale(e){}get canRescale(){return!1}_getFromCache(e,t,i,r,s,a){let n=this._getEngine();if(!n)return null;let h=n._getUseSRGBBuffer(!!s,t),o=n.getLoadedTexturesCache();for(let n=0;n<o.length;n++){let l=o[n];if((void 0===s||h===l._useSRGBBuffer)&&(void 0===r||r===l.invertY)&&l.url===e&&!t===l.generateMipMaps&&(!i||i===l.samplingMode)&&(void 0===a||a===l.isCube))return l.incrementReferences(),l}return null}_rebuild(e=!1){}clone(){return null}get textureType(){return this._texture&&void 0!==this._texture.type?this._texture.type:0}get textureFormat(){return this._texture&&void 0!==this._texture.format?this._texture.format:5}_markAllSubMeshesAsTexturesDirty(){let e=this.getScene();e&&e.markAllMaterialsAsDirty(1)}readPixels(e=0,t=0,i=null,r=!0,s=!1,a=0,n=0,h=Number.MAX_VALUE,o=Number.MAX_VALUE){if(!this._texture)return null;let l=this._getEngine();if(!l)return null;let u=this.getSize(),_=u.width,c=u.height;0!==t&&(_/=Math.pow(2,t),c/=Math.pow(2,t),_=Math.round(_),c=Math.round(c)),h=Math.min(_,h),o=Math.min(c,o);try{if(this._texture.isCube||this._texture.is2DArray)return l._readTexturePixels(this._texture,h,o,e,t,i,r,s,a,n);return l._readTexturePixels(this._texture,h,o,-1,t,i,r,s,a,n)}catch(e){return null}}_readPixelsSync(e=0,t=0,i=null,r=!0,s=!1){if(!this._texture)return null;let a=this.getSize(),n=a.width,h=a.height,o=this._getEngine();if(!o)return null;0!=t&&(n/=Math.pow(2,t),h/=Math.pow(2,t),n=Math.round(n),h=Math.round(h));try{if(this._texture.isCube)return o._readTexturePixelsSync(this._texture,n,h,e,t,i,r,s);return o._readTexturePixelsSync(this._texture,n,h,-1,t,i,r,s)}catch(e){return null}}get _lodTextureHigh(){return this._texture?this._texture._lodTextureHigh:null}get _lodTextureMid(){return this._texture?this._texture._lodTextureMid:null}get _lodTextureLow(){return this._texture?this._texture._lodTextureLow:null}dispose(){if(this._scene){this._scene.stopAnimation&&this._scene.stopAnimation(this),this._scene.removePendingData(this);let e=this._scene.textures.indexOf(this);if(e>=0&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null,this._parentContainer){let e=this._parentContainer.textures.indexOf(this);e>-1&&this._parentContainer.textures.splice(e,1),this._parentContainer=null}}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.metadata=null,super.dispose()}serialize(e=!1){if(!this.name&&!e)return null;let t=u.SerializationHelper.Serialize(this);return u.SerializationHelper.AppendSerializedAnimations(this,t),t}static WhenAllReady(e,t){let i=e.length;if(0===i)return void t();for(let r=0;r<e.length;r++){let s=e[r];if(s.isReady())0==--i&&t();else{let e=s.onLoadObservable;e?e.addOnce(()=>{0==--i&&t()}):0==--i&&t()}}}static _IsScene(e){return"Scene"===e.getClassName()}}c.DEFAULT_ANISOTROPIC_FILTERING_LEVEL=4,(0,i.__decorate)([(0,r.serialize)()],c.prototype,"uniqueId",void 0),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"name",void 0),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"displayName",void 0),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"metadata",void 0),(0,i.__decorate)([(0,r.serialize)("hasAlpha")],c.prototype,"_hasAlpha",void 0),(0,i.__decorate)([(0,r.serialize)("getAlphaFromRGB")],c.prototype,"_getAlphaFromRGB",void 0),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"level",void 0),(0,i.__decorate)([(0,r.serialize)("coordinatesIndex")],c.prototype,"_coordinatesIndex",void 0),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"optimizeUVAllocation",void 0),(0,i.__decorate)([(0,r.serialize)("coordinatesMode")],c.prototype,"_coordinatesMode",void 0),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"wrapU",null),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"wrapV",null),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"wrapR",void 0),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"anisotropicFilteringLevel",void 0),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"isCube",null),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"is3D",null),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"is2DArray",null),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"gammaSpace",null),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"invertZ",void 0),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"lodLevelInAlpha",void 0),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"lodGenerationOffset",null),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"lodGenerationScale",null),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"linearSpecularLOD",null),(0,i.__decorate)([(0,r.serializeAsTexture)()],c.prototype,"irradianceTexture",null),(0,i.__decorate)([(0,r.serialize)()],c.prototype,"isRenderTarget",void 0),(t=c.prototype).forceSphericalPolynomialsRecompute??(t.forceSphericalPolynomialsRecompute=(0,_._MissingSideEffect)("BaseTexture","forceSphericalPolynomialsRecompute")),Object.getOwnPropertyDescriptor(c.prototype,"sphericalPolynomial")||Object.defineProperty(c.prototype,"sphericalPolynomial",(0,_._MissingSideEffectProperty)("BaseTexture","sphericalPolynomial")),e.s(["BaseTexture",0,c],52153)},58720,e=>{"use strict";var t=e.i(10272),i=e.i(37143),r=e.i(99267),s=e.i(96265),a=e.i(52153),n=e.i(77052),h=e.i(75405),o=e.i(23240),l=e.i(98105),u=e.i(65002),_=e.i(49311);function c(e,t,i=!1){let r=t.width,s=t.height;if(e instanceof Float32Array){let t=e.byteLength/e.BYTES_PER_ELEMENT,i=new Uint8Array(t);for(;--t>=0;){let r=e[t];r<0?r=0:r>1&&(r=1),i[t]=255*r}e=i}let a=document.createElement("canvas");a.width=r,a.height=s;let n=a.getContext("2d");if(!n)return null;let h=n.createImageData(r,s);if(h.data.set(e),n.putImageData(h,0,0),i){let e=document.createElement("canvas");e.width=r,e.height=s;let t=e.getContext("2d");return t?(t.translate(0,s),t.scale(1,-1),t.drawImage(a,0,0),e.toDataURL("image/png")):null}return a.toDataURL("image/png")}async function d(e,t=0,i=0){let r=e.getInternalTexture();if(!r)return null;let s=await e.readPixels(t,i);return s?c(s,e.getSize(),r.invertY):null}var x=e.i(1773),p=e.i(80871);class f extends a.BaseTexture{static _CreateVideoTexture(e,t,i,r=!1,s=!1,a=f.TRILINEAR_SAMPLINGMODE,n={},o,l=5){throw(0,h._WarnImport)("VideoTexture")}get noMipmap(){return this._noMipmap}get mimeType(){return this._mimeType}set isBlocking(e){this._isBlocking=e}get isBlocking(){return this._isBlocking}get invertY(){return this._invertY}constructor(e,t,i,s,a=f.TRILINEAR_SAMPLINGMODE,n=null,h=null,l=null,u=!1,_,c,d,p,g){let m;super(t),this.url=null,this.uOffset=0,this.vOffset=0,this.uScale=1,this.vScale=1,this.uAng=0,this.vAng=0,this.wAng=0,this.uRotationCenter=.5,this.vRotationCenter=.5,this.wRotationCenter=.5,this.homogeneousRotationInUVTransform=!1,this.inspectableCustomProperties=null,this._noMipmap=!1,this._invertY=!1,this._rowGenerationMatrix=null,this._cachedTextureMatrix=null,this._projectionModeMatrix=null,this._t0=null,this._t1=null,this._t2=null,this._cachedUOffset=-1,this._cachedVOffset=-1,this._cachedUScale=0,this._cachedVScale=0,this._cachedUAng=-1,this._cachedVAng=-1,this._cachedWAng=-1,this._cachedReflectionProjectionMatrixId=-1,this._cachedURotationCenter=-1,this._cachedVRotationCenter=-1,this._cachedWRotationCenter=-1,this._cachedHomogeneousRotationInUVTransform=!1,this._cachedIdentity3x2=!0,this._cachedReflectionTextureMatrix=null,this._cachedReflectionUOffset=-1,this._cachedReflectionVOffset=-1,this._cachedReflectionUScale=0,this._cachedReflectionVScale=0,this._cachedReflectionCoordinatesMode=-1,this._buffer=null,this._deleteBuffer=!1,this._format=null,this._delayedOnLoad=null,this._delayedOnError=null,this.onLoadObservable=new r.Observable,this._isBlocking=!0,this.name=e||"",this.url=e;let R=!1,M=null,T=!0;"object"==typeof i&&null!==i?(m=i.noMipmap??!1,s=i.invertY??!x.useOpenGLOrientationForUV,a=i.samplingMode??f.TRILINEAR_SAMPLINGMODE,n=i.onLoad??null,h=i.onError??null,l=i.buffer??null,u=i.deleteBuffer??!1,_=i.format,c=i.mimeType,d=i.loaderOptions,p=i.creationFlags,R=i.useSRGBBuffer??!1,M=i.internalTexture??null,T=i.gammaSpace??T,g=i.forcedExtension??g):m=!!i,this._gammaSpace=T,this._noMipmap=m,this._invertY=void 0===s?!x.useOpenGLOrientationForUV:s,this._initialSamplingMode=a,this._buffer=l,this._deleteBuffer=u,this._mimeType=c,this._loaderOptions=d,this._creationFlags=p,this._useSRGBBuffer=R,this._forcedExtension=g,void 0!==_&&(this._format=_);const S=this.getScene(),y=this._getEngine();if(!y)return;y.onBeforeTextureInitObservable.notifyObservers(this);const A=()=>{this._texture&&(this._texture._invertVScale&&(this.vScale*=-1,this.vOffset+=1),null!==this._texture._cachedWrapU&&(this.wrapU=this._texture._cachedWrapU,this._texture._cachedWrapU=null),null!==this._texture._cachedWrapV&&(this.wrapV=this._texture._cachedWrapV,this._texture._cachedWrapV=null),null!==this._texture._cachedWrapR&&(this.wrapR=this._texture._cachedWrapR,this._texture._cachedWrapR=null)),this.onLoadObservable.hasObservers()&&this.onLoadObservable.notifyObservers(this),n&&n(),!this.isBlocking&&S&&S.resetCachedMaterial()},O=(e,t)=>{this._loadingError=!0,this._errorObject={message:e,exception:t},h&&h(e,t),f.OnTextureLoadErrorObservable.notifyObservers(this)};if(!this.url&&!M){this._delayedOnLoad=A,this._delayedOnError=O;return}if(this._texture=M??this._getFromCache(this.url,m,a,this._invertY,R,this.isCube),this._texture)if(this._texture.isReady)o.TimingTools.SetImmediate(()=>A());else{const e=this._texture.onLoadedObservable.add(A);this._texture.onErrorObservable.add(t=>{O(t.message,t.exception),this._texture?.onLoadedObservable.remove(e)})}else if(S&&S.useDelayedTextureLoading)this.delayLoadState=4,this._delayedOnLoad=A,this._delayedOnError=O;else{try{this._texture=y.createTexture(this.url,m,this._invertY,S,a,A,O,this._buffer,void 0,this._format,this._forcedExtension,c,d,p,R)}catch(e){throw O("error loading",e),e}u&&(this._buffer=null)}}updateURL(e,t=null,i,r){this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(1,e=>e.hasTexture(this))),(!this.name||this.name.startsWith("data:"))&&(this.name=e),this.url=e,this._buffer=t,this._forcedExtension=r,this.delayLoadState=4;let s=this._delayedOnLoad,a=()=>{s?s():this.onLoadObservable.hasObservers()&&this.onLoadObservable.notifyObservers(this),i&&i()};this._delayedOnLoad=a,this.delayLoad()}delayLoad(){if(4!==this.delayLoadState)return;let e=this.getScene();if(!e)return;let t=this.url;!t&&(this.name.indexOf("://")>0||this.name.startsWith("data:"))&&(t=this.name),this.delayLoadState=1,this._texture=this._getFromCache(t,this._noMipmap,this.samplingMode,this._invertY,this._useSRGBBuffer,this.isCube),this._texture?this._delayedOnLoad&&(this._texture.isReady?o.TimingTools.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(t,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,this._forcedExtension,this._mimeType,this._loaderOptions,this._creationFlags,this._useSRGBBuffer),this._deleteBuffer&&(this._buffer=null)),this._delayedOnLoad=null,this._delayedOnError=null}_prepareRowForTextureGeneration(e,t,i,r){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,i-=this.wRotationCenter,s.Vector3.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,r),r.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,r.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,r.z+=this.wRotationCenter}getTextureMatrix(e=1){if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng&&this.uRotationCenter===this._cachedURotationCenter&&this.vRotationCenter===this._cachedVRotationCenter&&this.wRotationCenter===this._cachedWRotationCenter&&this.homogeneousRotationInUVTransform===this._cachedHomogeneousRotationInUVTransform)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedURotationCenter=this.uRotationCenter,this._cachedVRotationCenter=this.vRotationCenter,this._cachedWRotationCenter=this.wRotationCenter,this._cachedHomogeneousRotationInUVTransform=this.homogeneousRotationInUVTransform,this._cachedTextureMatrix&&this._rowGenerationMatrix||(this._cachedTextureMatrix=s.Matrix.Zero(),this._rowGenerationMatrix=new s.Matrix,this._t0=s.Vector3.Zero(),this._t1=s.Vector3.Zero(),this._t2=s.Vector3.Zero()),s.Matrix.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this.homogeneousRotationInUVTransform?(s.Matrix.TranslationToRef(-this._cachedURotationCenter,-this._cachedVRotationCenter,-this._cachedWRotationCenter,s.TmpVectors.Matrix[0]),s.Matrix.TranslationToRef(this._cachedURotationCenter,this._cachedVRotationCenter,this._cachedWRotationCenter,s.TmpVectors.Matrix[1]),s.Matrix.ScalingToRef(this._cachedUScale,this._cachedVScale,0,s.TmpVectors.Matrix[2]),s.Matrix.TranslationToRef(this._cachedUOffset,this._cachedVOffset,0,s.TmpVectors.Matrix[3]),s.TmpVectors.Matrix[0].multiplyToRef(this._rowGenerationMatrix,this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(s.TmpVectors.Matrix[1],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(s.TmpVectors.Matrix[2],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(s.TmpVectors.Matrix[3],this._cachedTextureMatrix),this._cachedTextureMatrix.setRowFromFloats(2,this._cachedTextureMatrix.m[12],this._cachedTextureMatrix.m[13],this._cachedTextureMatrix.m[14],1)):(this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),s.Matrix.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix));let t=this.getScene();if(!t)return this._cachedTextureMatrix;let i=this._cachedIdentity3x2;return this._cachedIdentity3x2=this._cachedTextureMatrix.isIdentityAs3x2(),this.optimizeUVAllocation&&i!==this._cachedIdentity3x2&&t.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)),this._cachedTextureMatrix}getReflectionTextureMatrix(){let e=this.getScene();if(!e)return this._cachedReflectionTextureMatrix;if(this.uOffset===this._cachedReflectionUOffset&&this.vOffset===this._cachedReflectionVOffset&&this.uScale===this._cachedReflectionUScale&&this.vScale===this._cachedReflectionVScale&&this.coordinatesMode===this._cachedReflectionCoordinatesMode){if(this.coordinatesMode!==f.PROJECTION_MODE)return this._cachedReflectionTextureMatrix;else if(this._cachedReflectionProjectionMatrixId===e.getProjectionMatrix().updateFlag)return this._cachedReflectionTextureMatrix}this._cachedReflectionTextureMatrix||(this._cachedReflectionTextureMatrix=s.Matrix.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=s.Matrix.Zero());let t=this._cachedReflectionCoordinatesMode!==this.coordinatesMode;switch(this._cachedReflectionUOffset=this.uOffset,this._cachedReflectionVOffset=this.vOffset,this._cachedReflectionUScale=this.uScale,this._cachedReflectionVScale=this.vScale,this._cachedReflectionCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case f.PLANAR_MODE:s.Matrix.IdentityToRef(this._cachedReflectionTextureMatrix),this._cachedReflectionTextureMatrix[0]=this.uScale,this._cachedReflectionTextureMatrix[5]=this.vScale,this._cachedReflectionTextureMatrix[12]=this.uOffset,this._cachedReflectionTextureMatrix[13]=this.vOffset;break;case f.PROJECTION_MODE:{s.Matrix.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);let t=e.getProjectionMatrix();this._cachedReflectionProjectionMatrixId=t.updateFlag,t.multiplyToRef(this._projectionModeMatrix,this._cachedReflectionTextureMatrix);break}default:s.Matrix.IdentityToRef(this._cachedReflectionTextureMatrix)}return t&&e.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)),this._cachedReflectionTextureMatrix}clone(){let e={noMipmap:this._noMipmap,invertY:this._invertY,samplingMode:this.samplingMode,onLoad:void 0,onError:void 0,buffer:this._texture?this._texture._buffer:void 0,deleteBuffer:this._deleteBuffer,format:this.textureFormat,mimeType:this.mimeType,loaderOptions:this._loaderOptions,creationFlags:this._creationFlags,useSRGBBuffer:this._useSRGBBuffer};return p.SerializationHelper.Clone(()=>new f(this._texture?this._texture.url:null,this.getScene(),e),this)}serialize(){let e=this.name;!f.SerializeBuffers&&this.name.startsWith("data:")&&(this.name=""),this.name.startsWith("data:")&&this.url===this.name&&(this.url="");let t=super.serialize(f._SerializeInternalTextureUniqueId);if(!t)return null;if(f.SerializeBuffers||f.ForceSerializeBuffers)if("string"==typeof this._buffer&&this._buffer.startsWith("data:"))t.base64String=this._buffer,t.name=t.name.replace("data:","");else if(this.url&&this.url.startsWith("data:")&&this._buffer instanceof Uint8Array){let e=this.mimeType||"image/png";t.base64String=`data:${e};base64,${(0,_.EncodeArrayBufferToBase64)(this._buffer)}`}else(f.ForceSerializeBuffers||this.url&&this.url.startsWith("blob:")||this._forceSerialize)&&(t.base64String=!this._engine||this._engine._features.supportSyncTextureRead?function(e,t=0,i=0){let r=e.getInternalTexture();if(!r)return null;let s=e._readPixelsSync(t,i);return s?c(s,e.getSize(),r.invertY):null}(this):d(this));return t.invertY=this._invertY,t.samplingMode=this.samplingMode,t._creationFlags=this._creationFlags,t._useSRGBBuffer=this._useSRGBBuffer,f._SerializeInternalTextureUniqueId&&(t.internalTextureUniqueId=this._texture?.uniqueId),t.internalTextureLabel=this._texture?.label,t.noMipmap=this._noMipmap,this.name=e,t}getClassName(){return"Texture"}dispose(){super.dispose(),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null,this._buffer=null}static Parse(e,t,i){let r;if(e.customType){let r=l.InstantiationTools.Instantiate(e.customType).Parse(e,t,i);return e.samplingMode&&r.updateSamplingMode&&r._samplingMode&&r._samplingMode!==e.samplingMode&&r.updateSamplingMode(e.samplingMode),r}if(e.isCube&&!e.isRenderTarget)return f._CubeTextureParser(e,t,i);let s=void 0!==e.internalTextureUniqueId;if(!e.name&&!e.isRenderTarget&&!s)return null;if(s){for(let i of t.getEngine().getLoadedTexturesCache())if(i.uniqueId===e.internalTextureUniqueId){r=i;break}}let a=t=>{if(t&&t._texture&&(t._texture._cachedWrapU=null,t._texture._cachedWrapV=null,t._texture._cachedWrapR=null),e.samplingMode){let i=e.samplingMode;t&&t.samplingMode!==i&&t.updateSamplingMode(i)}if(t&&e.animations)for(let i=0;i<e.animations.length;i++){let r=e.animations[i],s=(0,n.GetClass)("BABYLON.Animation");s&&t.animations.push(s.Parse(r))}t&&t._texture&&(s&&!r&&t._texture._setUniqueId(e.internalTextureUniqueId),t._texture.label=e.internalTextureLabel)};return p.SerializationHelper.Parse(()=>{let s=!0;if(e.noMipmap&&(s=!1),e.mirrorPlane){let i=f._CreateMirror(e.name,e.renderTargetSize,t,s);return i._waitingRenderList=e.renderList,i.mirrorPlane=u.Plane.FromArray(e.mirrorPlane),a(i),i}if(e.isRenderTarget&&!e.base64String){let i=null;if(e.isCube){if(t.reflectionProbes)for(let i=0;i<t.reflectionProbes.length;i++){let r=t.reflectionProbes[i];if(r.name===e.name)return r.cubeTexture}}else(i=f._CreateRenderTargetTexture(e.name,e.renderTargetSize,t,s,e._creationFlags??0))._waitingRenderList=e.renderList;return a(i),i}if(e.isVideo){let r=f._CreateVideoTexture(i+(e.url||e.name),i+(e.src||e.url),t,s,e.invertY,e.samplingMode,e.settings||{});return a(r),r}{let n;if("string"==typeof e.base64String&&e.base64String&&!r){let i={buffer:e.base64String,noMipmap:!s,invertY:e.invertY,samplingMode:e.samplingMode,useSRGBBuffer:e._useSRGBBuffer??!1,creationFlags:e._creationFlags??0,onLoad:()=>{a(n)}},r=e.base64String,h=r.startsWith("data:")?r.substring(5):r;(n=f.CreateFromBase64String("",h,t,i)).name=e.name}else{let h;h=e.name&&(e.name.indexOf("://")>0||e.name.startsWith("data:"))?e.name:i+e.name,e.url&&(e.url.startsWith("data:")||f.UseSerializedUrlIfAny)&&(h=e.url),n=new f(h,t,{noMipmap:!s,invertY:e.invertY,samplingMode:e.samplingMode,useSRGBBuffer:e._useSRGBBuffer??!1,creationFlags:e._creationFlags??0,onLoad:()=>{a(n)},internalTexture:r})}return n}},e,t)}static CreateFromBase64String(e,t,i,r,s,a=f.TRILINEAR_SAMPLINGMODE,n=null,h=null,o=5,l,u){return new f("data:"+t,i,r,s,a,n,h,e,!1,o,void 0,void 0,l,u)}static LoadFromDataString(e,t,i,r=!1,s,a=!0,n=f.TRILINEAR_SAMPLINGMODE,h=null,o=null,l=5,u,_){return"data:"!==e.substring(0,5)&&(e="data:"+e),new f(e,i,s,a,n,h,o,t,r,l,void 0,void 0,u,_)}}f.SerializeBuffers=!0,f.ForceSerializeBuffers=!1,f.OnTextureLoadErrorObservable=new r.Observable,f._SerializeInternalTextureUniqueId=!1,f._CubeTextureParser=(e,t,i)=>{throw(0,h._WarnImport)("CubeTexture")},f._CreateMirror=(e,t,i,r)=>{throw(0,h._WarnImport)("MirrorTexture")},f._CreateRenderTargetTexture=(e,t,i,r,s)=>{throw(0,h._WarnImport)("RenderTargetTexture")},f.NEAREST_SAMPLINGMODE=1,f.NEAREST_NEAREST_MIPLINEAR=8,f.BILINEAR_SAMPLINGMODE=2,f.LINEAR_LINEAR_MIPNEAREST=11,f.TRILINEAR_SAMPLINGMODE=3,f.LINEAR_LINEAR_MIPLINEAR=3,f.NEAREST_NEAREST_MIPNEAREST=4,f.NEAREST_LINEAR_MIPNEAREST=5,f.NEAREST_LINEAR_MIPLINEAR=6,f.NEAREST_LINEAR=7,f.NEAREST_NEAREST=1,f.LINEAR_NEAREST_MIPNEAREST=9,f.LINEAR_NEAREST_MIPLINEAR=10,f.LINEAR_LINEAR=2,f.LINEAR_NEAREST=12,f.EXPLICIT_MODE=0,f.SPHERICAL_MODE=1,f.PLANAR_MODE=2,f.CUBIC_MODE=3,f.PROJECTION_MODE=4,f.SKYBOX_MODE=5,f.INVCUBIC_MODE=6,f.EQUIRECTANGULAR_MODE=7,f.FIXED_EQUIRECTANGULAR_MODE=8,f.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,f.CLAMP_ADDRESSMODE=0,f.WRAP_ADDRESSMODE=1,f.MIRROR_ADDRESSMODE=2,f.UseSerializedUrlIfAny=!1,(0,t.__decorate)([(0,i.serialize)()],f.prototype,"url",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"uOffset",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"vOffset",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"uScale",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"vScale",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"uAng",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"vAng",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"wAng",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"uRotationCenter",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"vRotationCenter",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"wRotationCenter",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"homogeneousRotationInUVTransform",void 0),(0,t.__decorate)([(0,i.serialize)()],f.prototype,"isBlocking",null),e.s(["Texture",0,f],58720)}]);
|