| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835 |
- const jp=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerpolicy&&(o.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?o.credentials="include":s.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}};jp();function Uc(t,e){const n=Object.create(null),i=t.split(",");for(let s=0;s<i.length;s++)n[i[s]]=!0;return e?s=>!!n[s.toLowerCase()]:s=>!!n[s]}const Yp="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",qp=Uc(Yp);function Vh(t){return!!t||t===""}function uo(t){if(He(t)){const e={};for(let n=0;n<t.length;n++){const i=t[n],s=zt(i)?Jp(i):uo(i);if(s)for(const o in s)e[o]=s[o]}return e}else{if(zt(t))return t;if(Lt(t))return t}}const Zp=/;(?![^(]*\))/g,Kp=/:(.+)/;function Jp(t){const e={};return t.split(Zp).forEach(n=>{if(n){const i=n.split(Kp);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function je(t){let e="";if(zt(t))e=t;else if(He(t))for(let n=0;n<t.length;n++){const i=je(t[n]);i&&(e+=i+" ")}else if(Lt(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}function Qp(t){if(!t)return null;let{class:e,style:n}=t;return e&&!zt(e)&&(t.class=je(e)),n&&(t.style=uo(n)),t}function em(t,e){if(t.length!==e.length)return!1;let n=!0;for(let i=0;n&&i<t.length;i++)n=lr(t[i],e[i]);return n}function lr(t,e){if(t===e)return!0;let n=Ad(t),i=Ad(e);if(n||i)return n&&i?t.getTime()===e.getTime():!1;if(n=Yo(t),i=Yo(e),n||i)return t===e;if(n=He(t),i=He(e),n||i)return n&&i?em(t,e):!1;if(n=Lt(t),i=Lt(e),n||i){if(!n||!i)return!1;const s=Object.keys(t).length,o=Object.keys(e).length;if(s!==o)return!1;for(const r in t){const a=t.hasOwnProperty(r),l=e.hasOwnProperty(r);if(a&&!l||!a&&l||!lr(t[r],e[r]))return!1}}return String(t)===String(e)}function Fc(t,e){return t.findIndex(n=>lr(n,e))}const ze=t=>zt(t)?t:t==null?"":He(t)||Lt(t)&&(t.toString===Gh||!nt(t.toString))?JSON.stringify(t,Hh,2):String(t),Hh=(t,e)=>e&&e.__v_isRef?Hh(t,e.value):Ys(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[i,s])=>(n[`${i} =>`]=s,n),{})}:ho(e)?{[`Set(${e.size})`]:[...e.values()]}:Lt(e)&&!He(e)&&!Wh(e)?String(e):e,Mt={},js=[],kn=()=>{},tm=()=>!1,nm=/^on[^a-z]/,va=t=>nm.test(t),Oc=t=>t.startsWith("onUpdate:"),jt=Object.assign,Nc=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},im=Object.prototype.hasOwnProperty,dt=(t,e)=>im.call(t,e),He=Array.isArray,Ys=t=>cr(t)==="[object Map]",ho=t=>cr(t)==="[object Set]",Ad=t=>cr(t)==="[object Date]",nt=t=>typeof t=="function",zt=t=>typeof t=="string",Yo=t=>typeof t=="symbol",Lt=t=>t!==null&&typeof t=="object",$h=t=>Lt(t)&&nt(t.then)&&nt(t.catch),Gh=Object.prototype.toString,cr=t=>Gh.call(t),sm=t=>cr(t).slice(8,-1),Wh=t=>cr(t)==="[object Object]",zc=t=>zt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Yr=Uc(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ba=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},om=/-(\w)/g,Qn=ba(t=>t.replace(om,(e,n)=>n?n.toUpperCase():"")),rm=/\B([A-Z])/g,bs=ba(t=>t.replace(rm,"-$1").toLowerCase()),ya=ba(t=>t.charAt(0).toUpperCase()+t.slice(1)),Ba=ba(t=>t?`on${ya(t)}`:""),qo=(t,e)=>!Object.is(t,e),qr=(t,e)=>{for(let n=0;n<t.length;n++)t[n](e)},ra=(t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})},Zo=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Pd;const am=()=>Pd||(Pd=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});let Wn;class lm{constructor(e=!1){this.active=!0,this.effects=[],this.cleanups=[],!e&&Wn&&(this.parent=Wn,this.index=(Wn.scopes||(Wn.scopes=[])).push(this)-1)}run(e){if(this.active){const n=Wn;try{return Wn=this,e()}finally{Wn=n}}}on(){Wn=this}off(){Wn=this.parent}stop(e){if(this.active){let n,i;for(n=0,i=this.effects.length;n<i;n++)this.effects[n].stop();for(n=0,i=this.cleanups.length;n<i;n++)this.cleanups[n]();if(this.scopes)for(n=0,i=this.scopes.length;n<i;n++)this.scopes[n].stop(!0);if(this.parent&&!e){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.active=!1}}}function cm(t,e=Wn){e&&e.active&&e.effects.push(t)}const kc=t=>{const e=new Set(t);return e.w=0,e.n=0,e},Xh=t=>(t.w&ki)>0,jh=t=>(t.n&ki)>0,dm=({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=ki},um=t=>{const{deps:e}=t;if(e.length){let n=0;for(let i=0;i<e.length;i++){const s=e[i];Xh(s)&&!jh(s)?s.delete(t):e[n++]=s,s.w&=~ki,s.n&=~ki}e.length=n}},Al=new WeakMap;let Io=0,ki=1;const Pl=30;let Ln;const ps=Symbol(""),Rl=Symbol("");class Bc{constructor(e,n=null,i){this.fn=e,this.scheduler=n,this.active=!0,this.deps=[],this.parent=void 0,cm(this,i)}run(){if(!this.active)return this.fn();let e=Ln,n=Ui;for(;e;){if(e===this)return;e=e.parent}try{return this.parent=Ln,Ln=this,Ui=!0,ki=1<<++Io,Io<=Pl?dm(this):Rd(this),this.fn()}finally{Io<=Pl&&um(this),ki=1<<--Io,Ln=this.parent,Ui=n,this.parent=void 0,this.deferStop&&this.stop()}}stop(){Ln===this?this.deferStop=!0:this.active&&(Rd(this),this.onStop&&this.onStop(),this.active=!1)}}function Rd(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let Ui=!0;const Yh=[];function fo(){Yh.push(Ui),Ui=!1}function po(){const t=Yh.pop();Ui=t===void 0?!0:t}function vn(t,e,n){if(Ui&&Ln){let i=Al.get(t);i||Al.set(t,i=new Map);let s=i.get(n);s||i.set(n,s=kc()),qh(s)}}function qh(t,e){let n=!1;Io<=Pl?jh(t)||(t.n|=ki,n=!Xh(t)):n=!t.has(Ln),n&&(t.add(Ln),Ln.deps.push(t))}function pi(t,e,n,i,s,o){const r=Al.get(t);if(!r)return;let a=[];if(e==="clear")a=[...r.values()];else if(n==="length"&&He(t))r.forEach((l,d)=>{(d==="length"||d>=i)&&a.push(l)});else switch(n!==void 0&&a.push(r.get(n)),e){case"add":He(t)?zc(n)&&a.push(r.get("length")):(a.push(r.get(ps)),Ys(t)&&a.push(r.get(Rl)));break;case"delete":He(t)||(a.push(r.get(ps)),Ys(t)&&a.push(r.get(Rl)));break;case"set":Ys(t)&&a.push(r.get(ps));break}if(a.length===1)a[0]&&Dl(a[0]);else{const l=[];for(const d of a)d&&l.push(...d);Dl(kc(l))}}function Dl(t,e){const n=He(t)?t:[...t];for(const i of n)i.computed&&Dd(i);for(const i of n)i.computed||Dd(i)}function Dd(t,e){(t!==Ln||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const hm=Uc("__proto__,__v_isRef,__isVue"),Zh=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Yo)),fm=Vc(),pm=Vc(!1,!0),mm=Vc(!0),Id=_m();function _m(){const t={};return["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...n){const i=pt(this);for(let o=0,r=this.length;o<r;o++)vn(i,"get",o+"");const s=i[e](...n);return s===-1||s===!1?i[e](...n.map(pt)):s}}),["push","pop","shift","unshift","splice"].forEach(e=>{t[e]=function(...n){fo();const i=pt(this)[e].apply(this,n);return po(),i}}),t}function Vc(t=!1,e=!1){return function(i,s,o){if(s==="__v_isReactive")return!t;if(s==="__v_isReadonly")return t;if(s==="__v_isShallow")return e;if(s==="__v_raw"&&o===(t?e?Im:tf:e?ef:Qh).get(i))return i;const r=He(i);if(!t&&r&&dt(Id,s))return Reflect.get(Id,s,o);const a=Reflect.get(i,s,o);return(Yo(s)?Zh.has(s):hm(s))||(t||vn(i,"get",s),e)?a:Qt(a)?r&&zc(s)?a:a.value:Lt(a)?t?nf(a):dr(a):a}}const gm=Kh(),vm=Kh(!0);function Kh(t=!1){return function(n,i,s,o){let r=n[i];if(Ko(r)&&Qt(r)&&!Qt(s))return!1;if(!t&&!Ko(s)&&(Il(s)||(s=pt(s),r=pt(r)),!He(n)&&Qt(r)&&!Qt(s)))return r.value=s,!0;const a=He(n)&&zc(i)?Number(i)<n.length:dt(n,i),l=Reflect.set(n,i,s,o);return n===pt(o)&&(a?qo(s,r)&&pi(n,"set",i,s):pi(n,"add",i,s)),l}}function bm(t,e){const n=dt(t,e);t[e];const i=Reflect.deleteProperty(t,e);return i&&n&&pi(t,"delete",e,void 0),i}function ym(t,e){const n=Reflect.has(t,e);return(!Yo(e)||!Zh.has(e))&&vn(t,"has",e),n}function xm(t){return vn(t,"iterate",He(t)?"length":ps),Reflect.ownKeys(t)}const Jh={get:fm,set:gm,deleteProperty:bm,has:ym,ownKeys:xm},Sm={get:mm,set(t,e){return!0},deleteProperty(t,e){return!0}},Mm=jt({},Jh,{get:pm,set:vm}),Hc=t=>t,xa=t=>Reflect.getPrototypeOf(t);function _r(t,e,n=!1,i=!1){t=t.__v_raw;const s=pt(t),o=pt(e);n||(e!==o&&vn(s,"get",e),vn(s,"get",o));const{has:r}=xa(s),a=i?Hc:n?Wc:Jo;if(r.call(s,e))return a(t.get(e));if(r.call(s,o))return a(t.get(o));t!==s&&t.get(e)}function gr(t,e=!1){const n=this.__v_raw,i=pt(n),s=pt(t);return e||(t!==s&&vn(i,"has",t),vn(i,"has",s)),t===s?n.has(t):n.has(t)||n.has(s)}function vr(t,e=!1){return t=t.__v_raw,!e&&vn(pt(t),"iterate",ps),Reflect.get(t,"size",t)}function Ld(t){t=pt(t);const e=pt(this);return xa(e).has.call(e,t)||(e.add(t),pi(e,"add",t,t)),this}function Ud(t,e){e=pt(e);const n=pt(this),{has:i,get:s}=xa(n);let o=i.call(n,t);o||(t=pt(t),o=i.call(n,t));const r=s.call(n,t);return n.set(t,e),o?qo(e,r)&&pi(n,"set",t,e):pi(n,"add",t,e),this}function Fd(t){const e=pt(this),{has:n,get:i}=xa(e);let s=n.call(e,t);s||(t=pt(t),s=n.call(e,t)),i&&i.call(e,t);const o=e.delete(t);return s&&pi(e,"delete",t,void 0),o}function Od(){const t=pt(this),e=t.size!==0,n=t.clear();return e&&pi(t,"clear",void 0,void 0),n}function br(t,e){return function(i,s){const o=this,r=o.__v_raw,a=pt(r),l=e?Hc:t?Wc:Jo;return!t&&vn(a,"iterate",ps),r.forEach((d,u)=>i.call(s,l(d),l(u),o))}}function yr(t,e,n){return function(...i){const s=this.__v_raw,o=pt(s),r=Ys(o),a=t==="entries"||t===Symbol.iterator&&r,l=t==="keys"&&r,d=s[t](...i),u=n?Hc:e?Wc:Jo;return!e&&vn(o,"iterate",l?Rl:ps),{next(){const{value:f,done:h}=d.next();return h?{value:f,done:h}:{value:a?[u(f[0]),u(f[1])]:u(f),done:h}},[Symbol.iterator](){return this}}}}function _i(t){return function(...e){return t==="delete"?!1:this}}function Em(){const t={get(o){return _r(this,o)},get size(){return vr(this)},has:gr,add:Ld,set:Ud,delete:Fd,clear:Od,forEach:br(!1,!1)},e={get(o){return _r(this,o,!1,!0)},get size(){return vr(this)},has:gr,add:Ld,set:Ud,delete:Fd,clear:Od,forEach:br(!1,!0)},n={get(o){return _r(this,o,!0)},get size(){return vr(this,!0)},has(o){return gr.call(this,o,!0)},add:_i("add"),set:_i("set"),delete:_i("delete"),clear:_i("clear"),forEach:br(!0,!1)},i={get(o){return _r(this,o,!0,!0)},get size(){return vr(this,!0)},has(o){return gr.call(this,o,!0)},add:_i("add"),set:_i("set"),delete:_i("delete"),clear:_i("clear"),forEach:br(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{t[o]=yr(o,!1,!1),n[o]=yr(o,!0,!1),e[o]=yr(o,!1,!0),i[o]=yr(o,!0,!0)}),[t,n,e,i]}const[wm,Tm,Cm,Am]=Em();function $c(t,e){const n=e?t?Am:Cm:t?Tm:wm;return(i,s,o)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?i:Reflect.get(dt(n,s)&&s in i?n:i,s,o)}const Pm={get:$c(!1,!1)},Rm={get:$c(!1,!0)},Dm={get:$c(!0,!1)},Qh=new WeakMap,ef=new WeakMap,tf=new WeakMap,Im=new WeakMap;function Lm(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Um(t){return t.__v_skip||!Object.isExtensible(t)?0:Lm(sm(t))}function dr(t){return Ko(t)?t:Gc(t,!1,Jh,Pm,Qh)}function Fm(t){return Gc(t,!1,Mm,Rm,ef)}function nf(t){return Gc(t,!0,Sm,Dm,tf)}function Gc(t,e,n,i,s){if(!Lt(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const o=s.get(t);if(o)return o;const r=Um(t);if(r===0)return t;const a=new Proxy(t,r===2?i:n);return s.set(t,a),a}function qs(t){return Ko(t)?qs(t.__v_raw):!!(t&&t.__v_isReactive)}function Ko(t){return!!(t&&t.__v_isReadonly)}function Il(t){return!!(t&&t.__v_isShallow)}function sf(t){return qs(t)||Ko(t)}function pt(t){const e=t&&t.__v_raw;return e?pt(e):t}function of(t){return ra(t,"__v_skip",!0),t}const Jo=t=>Lt(t)?dr(t):t,Wc=t=>Lt(t)?nf(t):t;function rf(t){Ui&&Ln&&(t=pt(t),qh(t.dep||(t.dep=kc())))}function af(t,e){t=pt(t),t.dep&&Dl(t.dep)}function Qt(t){return!!(t&&t.__v_isRef===!0)}function lf(t){return df(t,!1)}function cf(t){return df(t,!0)}function df(t,e){return Qt(t)?t:new Om(t,e)}class Om{constructor(e,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?e:pt(e),this._value=n?e:Jo(e)}get value(){return rf(this),this._value}set value(e){e=this.__v_isShallow?e:pt(e),qo(e,this._rawValue)&&(this._rawValue=e,this._value=this.__v_isShallow?e:Jo(e),af(this))}}function zo(t){return Qt(t)?t.value:t}const Nm={get:(t,e,n)=>zo(Reflect.get(t,e,n)),set:(t,e,n,i)=>{const s=t[e];return Qt(s)&&!Qt(n)?(s.value=n,!0):Reflect.set(t,e,n,i)}};function uf(t){return qs(t)?t:new Proxy(t,Nm)}class zm{constructor(e,n,i,s){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new Bc(e,()=>{this._dirty||(this._dirty=!0,af(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=i}get value(){const e=pt(this);return rf(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}function km(t,e,n=!1){let i,s;const o=nt(t);return o?(i=t,s=kn):(i=t.get,s=t.set),new zm(i,s,o||!s,n)}function Fi(t,e,n,i){let s;try{s=i?t(...i):t()}catch(o){Sa(o,e,n)}return s}function wn(t,e,n,i){if(nt(t)){const o=Fi(t,e,n,i);return o&&$h(o)&&o.catch(r=>{Sa(r,e,n)}),o}const s=[];for(let o=0;o<t.length;o++)s.push(wn(t[o],e,n,i));return s}function Sa(t,e,n,i=!0){const s=e?e.vnode:null;if(e){let o=e.parent;const r=e.proxy,a=n;for(;o;){const d=o.ec;if(d){for(let u=0;u<d.length;u++)if(d[u](t,r,a)===!1)return}o=o.parent}const l=e.appContext.config.errorHandler;if(l){Fi(l,null,10,[t,r,a]);return}}Bm(t,n,s,i)}function Bm(t,e,n,i=!0){console.error(t)}let aa=!1,Ll=!1;const gn=[];let di=0;const ko=[];let Lo=null,Bs=0;const Bo=[];let Ai=null,Vs=0;const hf=Promise.resolve();let Xc=null,Ul=null;function ff(t){const e=Xc||hf;return t?e.then(this?t.bind(this):t):e}function Vm(t){let e=di+1,n=gn.length;for(;e<n;){const i=e+n>>>1;Qo(gn[i])<t?e=i+1:n=i}return e}function pf(t){(!gn.length||!gn.includes(t,aa&&t.allowRecurse?di+1:di))&&t!==Ul&&(t.id==null?gn.push(t):gn.splice(Vm(t.id),0,t),mf())}function mf(){!aa&&!Ll&&(Ll=!0,Xc=hf.then(vf))}function Hm(t){const e=gn.indexOf(t);e>di&&gn.splice(e,1)}function _f(t,e,n,i){He(t)?n.push(...t):(!e||!e.includes(t,t.allowRecurse?i+1:i))&&n.push(t),mf()}function $m(t){_f(t,Lo,ko,Bs)}function Gm(t){_f(t,Ai,Bo,Vs)}function Ma(t,e=null){if(ko.length){for(Ul=e,Lo=[...new Set(ko)],ko.length=0,Bs=0;Bs<Lo.length;Bs++)Lo[Bs]();Lo=null,Bs=0,Ul=null,Ma(t,e)}}function gf(t){if(Ma(),Bo.length){const e=[...new Set(Bo)];if(Bo.length=0,Ai){Ai.push(...e);return}for(Ai=e,Ai.sort((n,i)=>Qo(n)-Qo(i)),Vs=0;Vs<Ai.length;Vs++)Ai[Vs]();Ai=null,Vs=0}}const Qo=t=>t.id==null?1/0:t.id;function vf(t){Ll=!1,aa=!0,Ma(t),gn.sort((n,i)=>Qo(n)-Qo(i));const e=kn;try{for(di=0;di<gn.length;di++){const n=gn[di];n&&n.active!==!1&&Fi(n,null,14)}}finally{di=0,gn.length=0,gf(),aa=!1,Xc=null,(gn.length||ko.length||Bo.length)&&vf(t)}}function Wm(t,e,...n){if(t.isUnmounted)return;const i=t.vnode.props||Mt;let s=n;const o=e.startsWith("update:"),r=o&&e.slice(7);if(r&&r in i){const u=`${r==="modelValue"?"model":r}Modifiers`,{number:f,trim:h}=i[u]||Mt;h&&(s=n.map(m=>m.trim())),f&&(s=n.map(Zo))}let a,l=i[a=Ba(e)]||i[a=Ba(Qn(e))];!l&&o&&(l=i[a=Ba(bs(e))]),l&&wn(l,t,6,s);const d=i[a+"Once"];if(d){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,wn(d,t,6,s)}}function bf(t,e,n=!1){const i=e.emitsCache,s=i.get(t);if(s!==void 0)return s;const o=t.emits;let r={},a=!1;if(!nt(t)){const l=d=>{const u=bf(d,e,!0);u&&(a=!0,jt(r,u))};!n&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!o&&!a?(i.set(t,null),null):(He(o)?o.forEach(l=>r[l]=null):jt(r,o),i.set(t,r),r)}function Ea(t,e){return!t||!va(e)?!1:(e=e.slice(2).replace(/Once$/,""),dt(t,e[0].toLowerCase()+e.slice(1))||dt(t,bs(e))||dt(t,e))}let en=null,wa=null;function la(t){const e=en;return en=t,wa=t&&t.type.__scopeId||null,e}function Xm(t){wa=t}function jm(){wa=null}function Ct(t,e=en,n){if(!e||t._n)return t;const i=(...s)=>{i._d&&jd(-1);const o=la(e),r=t(...s);return la(o),i._d&&jd(1),r};return i._n=!0,i._c=!0,i._d=!0,i}function Va(t){const{type:e,vnode:n,proxy:i,withProxy:s,props:o,propsOptions:[r],slots:a,attrs:l,emit:d,render:u,renderCache:f,data:h,setupState:m,ctx:b,inheritAttrs:y}=t;let _,p;const T=la(t);try{if(n.shapeFlag&4){const S=s||i;_=Xn(u.call(S,S,f,o,m,h,b)),p=l}else{const S=e;_=Xn(S.length>1?S(o,{attrs:l,slots:a,emit:d}):S(o,null)),p=e.props?l:Ym(l)}}catch(S){$o.length=0,Sa(S,t,1),_=ke(Tn)}let w=_;if(p&&y!==!1){const S=Object.keys(p),{shapeFlag:I}=w;S.length&&I&7&&(r&&S.some(Oc)&&(p=qm(p,r)),w=Bi(w,p))}return n.dirs&&(w=Bi(w),w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition&&(w.transition=n.transition),_=w,la(T),_}const Ym=t=>{let e;for(const n in t)(n==="class"||n==="style"||va(n))&&((e||(e={}))[n]=t[n]);return e},qm=(t,e)=>{const n={};for(const i in t)(!Oc(i)||!(i.slice(9)in e))&&(n[i]=t[i]);return n};function Zm(t,e,n){const{props:i,children:s,component:o}=t,{props:r,children:a,patchFlag:l}=e,d=o.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return i?Nd(i,r,d):!!r;if(l&8){const u=e.dynamicProps;for(let f=0;f<u.length;f++){const h=u[f];if(r[h]!==i[h]&&!Ea(d,h))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:i===r?!1:i?r?Nd(i,r,d):!0:!!r;return!1}function Nd(t,e,n){const i=Object.keys(e);if(i.length!==Object.keys(t).length)return!0;for(let s=0;s<i.length;s++){const o=i[s];if(e[o]!==t[o]&&!Ea(n,o))return!0}return!1}function Km({vnode:t,parent:e},n){for(;e&&e.subTree===t;)(t=e.vnode).el=n,e=e.parent}const Jm=t=>t.__isSuspense;function Qm(t,e){e&&e.pendingBranch?He(t)?e.effects.push(...t):e.effects.push(t):Gm(t)}function Zr(t,e){if($t){let n=$t.provides;const i=$t.parent&&$t.parent.provides;i===n&&(n=$t.provides=Object.create(i)),n[t]=e}}function Oi(t,e,n=!1){const i=$t||en;if(i){const s=i.parent==null?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides;if(s&&t in s)return s[t];if(arguments.length>1)return n&&nt(e)?e.call(i.proxy):e}}const zd={};function Vo(t,e,n){return yf(t,e,n)}function yf(t,e,{immediate:n,deep:i,flush:s,onTrack:o,onTrigger:r}=Mt){const a=$t;let l,d=!1,u=!1;if(Qt(t)?(l=()=>t.value,d=Il(t)):qs(t)?(l=()=>t,i=!0):He(t)?(u=!0,d=t.some(p=>qs(p)||Il(p)),l=()=>t.map(p=>{if(Qt(p))return p.value;if(qs(p))return us(p);if(nt(p))return Fi(p,a,2)})):nt(t)?e?l=()=>Fi(t,a,2):l=()=>{if(!(a&&a.isUnmounted))return f&&f(),wn(t,a,3,[h])}:l=kn,e&&i){const p=l;l=()=>us(p())}let f,h=p=>{f=_.onStop=()=>{Fi(p,a,4)}};if(tr)return h=kn,e?n&&wn(e,a,3,[l(),u?[]:void 0,h]):l(),kn;let m=u?[]:zd;const b=()=>{if(!!_.active)if(e){const p=_.run();(i||d||(u?p.some((T,w)=>qo(T,m[w])):qo(p,m)))&&(f&&f(),wn(e,a,3,[p,m===zd?void 0:m,h]),m=p)}else _.run()};b.allowRecurse=!!e;let y;s==="sync"?y=b:s==="post"?y=()=>dn(b,a&&a.suspense):y=()=>$m(b);const _=new Bc(l,y);return e?n?b():m=_.run():s==="post"?dn(_.run.bind(_),a&&a.suspense):_.run(),()=>{_.stop(),a&&a.scope&&Nc(a.scope.effects,_)}}function e_(t,e,n){const i=this.proxy,s=zt(t)?t.includes(".")?xf(i,t):()=>i[t]:t.bind(i,i);let o;nt(e)?o=e:(o=e.handler,n=e);const r=$t;eo(this);const a=yf(s,o.bind(i),n);return r?eo(r):ms(),a}function xf(t,e){const n=e.split(".");return()=>{let i=t;for(let s=0;s<n.length&&i;s++)i=i[n[s]];return i}}function us(t,e){if(!Lt(t)||t.__v_skip||(e=e||new Set,e.has(t)))return t;if(e.add(t),Qt(t))us(t.value,e);else if(He(t))for(let n=0;n<t.length;n++)us(t[n],e);else if(ho(t)||Ys(t))t.forEach(n=>{us(n,e)});else if(Wh(t))for(const n in t)us(t[n],e);return t}function t_(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Tf(()=>{t.isMounted=!0}),Cf(()=>{t.isUnmounting=!0}),t}const xn=[Function,Array],n_={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:xn,onEnter:xn,onAfterEnter:xn,onEnterCancelled:xn,onBeforeLeave:xn,onLeave:xn,onAfterLeave:xn,onLeaveCancelled:xn,onBeforeAppear:xn,onAppear:xn,onAfterAppear:xn,onAppearCancelled:xn},setup(t,{slots:e}){const n=O_(),i=t_();let s;return()=>{const o=e.default&&Ef(e.default(),!0);if(!o||!o.length)return;let r=o[0];if(o.length>1){for(const y of o)if(y.type!==Tn){r=y;break}}const a=pt(t),{mode:l}=a;if(i.isLeaving)return Ha(r);const d=kd(r);if(!d)return Ha(r);const u=Fl(d,a,i,n);Ol(d,u);const f=n.subTree,h=f&&kd(f);let m=!1;const{getTransitionKey:b}=d.type;if(b){const y=b();s===void 0?s=y:y!==s&&(s=y,m=!0)}if(h&&h.type!==Tn&&(!rs(d,h)||m)){const y=Fl(h,a,i,n);if(Ol(h,y),l==="out-in")return i.isLeaving=!0,y.afterLeave=()=>{i.isLeaving=!1,n.update()},Ha(r);l==="in-out"&&d.type!==Tn&&(y.delayLeave=(_,p,T)=>{const w=Mf(i,h);w[String(h.key)]=h,_._leaveCb=()=>{p(),_._leaveCb=void 0,delete u.delayedLeave},u.delayedLeave=T})}return r}}},Sf=n_;function Mf(t,e){const{leavingVNodes:n}=t;let i=n.get(e.type);return i||(i=Object.create(null),n.set(e.type,i)),i}function Fl(t,e,n,i){const{appear:s,mode:o,persisted:r=!1,onBeforeEnter:a,onEnter:l,onAfterEnter:d,onEnterCancelled:u,onBeforeLeave:f,onLeave:h,onAfterLeave:m,onLeaveCancelled:b,onBeforeAppear:y,onAppear:_,onAfterAppear:p,onAppearCancelled:T}=e,w=String(t.key),S=Mf(n,t),I=(R,E)=>{R&&wn(R,i,9,E)},P=(R,E)=>{const g=E[1];I(R,E),He(R)?R.every(L=>L.length<=1)&&g():R.length<=1&&g()},D={mode:o,persisted:r,beforeEnter(R){let E=a;if(!n.isMounted)if(s)E=y||a;else return;R._leaveCb&&R._leaveCb(!0);const g=S[w];g&&rs(t,g)&&g.el._leaveCb&&g.el._leaveCb(),I(E,[R])},enter(R){let E=l,g=d,L=u;if(!n.isMounted)if(s)E=_||l,g=p||d,L=T||u;else return;let O=!1;const H=R._enterCb=j=>{O||(O=!0,j?I(L,[R]):I(g,[R]),D.delayedLeave&&D.delayedLeave(),R._enterCb=void 0)};E?P(E,[R,H]):H()},leave(R,E){const g=String(t.key);if(R._enterCb&&R._enterCb(!0),n.isUnmounting)return E();I(f,[R]);let L=!1;const O=R._leaveCb=H=>{L||(L=!0,E(),H?I(b,[R]):I(m,[R]),R._leaveCb=void 0,S[g]===t&&delete S[g])};S[g]=t,h?P(h,[R,O]):O()},clone(R){return Fl(R,e,n,i)}};return D}function Ha(t){if(Ta(t))return t=Bi(t),t.children=null,t}function kd(t){return Ta(t)?t.children?t.children[0]:void 0:t}function Ol(t,e){t.shapeFlag&6&&t.component?Ol(t.component.subTree,e):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Ef(t,e=!1,n){let i=[],s=0;for(let o=0;o<t.length;o++){let r=t[o];const a=n==null?r.key:String(n)+String(r.key!=null?r.key:o);r.type===rt?(r.patchFlag&128&&s++,i=i.concat(Ef(r.children,e,a))):(e||r.type!==Tn)&&i.push(a!=null?Bi(r,{key:a}):r)}if(s>1)for(let o=0;o<i.length;o++)i[o].patchFlag=-2;return i}function mo(t){return nt(t)?{setup:t,name:t.name}:t}const Ho=t=>!!t.type.__asyncLoader,Ta=t=>t.type.__isKeepAlive;function i_(t,e){wf(t,"a",e)}function s_(t,e){wf(t,"da",e)}function wf(t,e,n=$t){const i=t.__wdc||(t.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Ca(e,i,n),n){let s=n.parent;for(;s&&s.parent;)Ta(s.parent.vnode)&&o_(i,e,n,s),s=s.parent}}function o_(t,e,n,i){const s=Ca(e,t,i,!0);Af(()=>{Nc(i[e],s)},n)}function Ca(t,e,n=$t,i=!1){if(n){const s=n[t]||(n[t]=[]),o=e.__weh||(e.__weh=(...r)=>{if(n.isUnmounted)return;fo(),eo(n);const a=wn(e,n,t,r);return ms(),po(),a});return i?s.unshift(o):s.push(o),o}}const mi=t=>(e,n=$t)=>(!tr||t==="sp")&&Ca(t,e,n),r_=mi("bm"),Tf=mi("m"),a_=mi("bu"),l_=mi("u"),Cf=mi("bum"),Af=mi("um"),c_=mi("sp"),d_=mi("rtg"),u_=mi("rtc");function h_(t,e=$t){Ca("ec",t,e)}function se(t,e){const n=en;if(n===null)return t;const i=Pa(n)||n.proxy,s=t.dirs||(t.dirs=[]);for(let o=0;o<e.length;o++){let[r,a,l,d=Mt]=e[o];nt(r)&&(r={mounted:r,updated:r}),r.deep&&us(a),s.push({dir:r,instance:i,value:a,oldValue:void 0,arg:l,modifiers:d})}return t}function Wi(t,e,n,i){const s=t.dirs,o=e&&e.dirs;for(let r=0;r<s.length;r++){const a=s[r];o&&(a.oldValue=o[r].value);let l=a.dir[i];l&&(fo(),wn(l,n,8,[t.el,a,t,e]),po())}}const jc="components";function et(t,e){return Rf(jc,t,!0,e)||t}const Pf=Symbol();function f_(t){return zt(t)?Rf(jc,t,!1)||t:t||Pf}function Rf(t,e,n=!0,i=!1){const s=en||$t;if(s){const o=s.type;if(t===jc){const a=V_(o,!1);if(a&&(a===e||a===Qn(e)||a===ya(Qn(e))))return o}const r=Bd(s[t]||o[t],e)||Bd(s.appContext[t],e);return!r&&i?o:r}}function Bd(t,e){return t&&(t[e]||t[Qn(e)]||t[ya(Qn(e))])}function wt(t,e,n,i){let s;const o=n&&n[i];if(He(t)||zt(t)){s=new Array(t.length);for(let r=0,a=t.length;r<a;r++)s[r]=e(t[r],r,void 0,o&&o[r])}else if(typeof t=="number"){s=new Array(t);for(let r=0;r<t;r++)s[r]=e(r+1,r,void 0,o&&o[r])}else if(Lt(t))if(t[Symbol.iterator])s=Array.from(t,(r,a)=>e(r,a,void 0,o&&o[a]));else{const r=Object.keys(t);s=new Array(r.length);for(let a=0,l=r.length;a<l;a++){const d=r[a];s[a]=e(t[d],d,a,o&&o[a])}}else s=[];return n&&(n[i]=s),s}function Qs(t,e,n={},i,s){if(en.isCE||en.parent&&Ho(en.parent)&&en.parent.isCE)return ke("slot",e==="default"?null:{name:e},i&&i());let o=t[e];o&&o._c&&(o._d=!1),W();const r=o&&Df(o(n)),a=Jt(rt,{key:n.key||`_${e}`},r||(i?i():[]),r&&t._===1?64:-2);return!s&&a.scopeId&&(a.slotScopeIds=[a.scopeId+"-s"]),o&&o._c&&(o._d=!0),a}function Df(t){return t.some(e=>ua(e)?!(e.type===Tn||e.type===rt&&!Df(e.children)):!0)?t:null}const Nl=t=>t?Wf(t)?Pa(t)||t.proxy:Nl(t.parent):null,ca=jt(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Nl(t.parent),$root:t=>Nl(t.root),$emit:t=>t.emit,$options:t=>Lf(t),$forceUpdate:t=>t.f||(t.f=()=>pf(t.update)),$nextTick:t=>t.n||(t.n=ff.bind(t.proxy)),$watch:t=>e_.bind(t)}),p_={get({_:t},e){const{ctx:n,setupState:i,data:s,props:o,accessCache:r,type:a,appContext:l}=t;let d;if(e[0]!=="$"){const m=r[e];if(m!==void 0)switch(m){case 1:return i[e];case 2:return s[e];case 4:return n[e];case 3:return o[e]}else{if(i!==Mt&&dt(i,e))return r[e]=1,i[e];if(s!==Mt&&dt(s,e))return r[e]=2,s[e];if((d=t.propsOptions[0])&&dt(d,e))return r[e]=3,o[e];if(n!==Mt&&dt(n,e))return r[e]=4,n[e];zl&&(r[e]=0)}}const u=ca[e];let f,h;if(u)return e==="$attrs"&&vn(t,"get",e),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==Mt&&dt(n,e))return r[e]=4,n[e];if(h=l.config.globalProperties,dt(h,e))return h[e]},set({_:t},e,n){const{data:i,setupState:s,ctx:o}=t;return s!==Mt&&dt(s,e)?(s[e]=n,!0):i!==Mt&&dt(i,e)?(i[e]=n,!0):dt(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(o[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:i,appContext:s,propsOptions:o}},r){let a;return!!n[r]||t!==Mt&&dt(t,r)||e!==Mt&&dt(e,r)||(a=o[0])&&dt(a,r)||dt(i,r)||dt(ca,r)||dt(s.config.globalProperties,r)},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:dt(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};let zl=!0;function m_(t){const e=Lf(t),n=t.proxy,i=t.ctx;zl=!1,e.beforeCreate&&Vd(e.beforeCreate,t,"bc");const{data:s,computed:o,methods:r,watch:a,provide:l,inject:d,created:u,beforeMount:f,mounted:h,beforeUpdate:m,updated:b,activated:y,deactivated:_,beforeDestroy:p,beforeUnmount:T,destroyed:w,unmounted:S,render:I,renderTracked:P,renderTriggered:D,errorCaptured:R,serverPrefetch:E,expose:g,inheritAttrs:L,components:O,directives:H,filters:j}=e;if(d&&__(d,i,null,t.appContext.config.unwrapInjectedRef),r)for(const ae in r){const G=r[ae];nt(G)&&(i[ae]=G.bind(n))}if(s){const ae=s.call(n,n);Lt(ae)&&(t.data=dr(ae))}if(zl=!0,o)for(const ae in o){const G=o[ae],fe=nt(G)?G.bind(n,n):nt(G.get)?G.get.bind(n,n):kn,ye=!nt(G)&&nt(G.set)?G.set.bind(n):kn,Re=Yn({get:fe,set:ye});Object.defineProperty(i,ae,{enumerable:!0,configurable:!0,get:()=>Re.value,set:Be=>Re.value=Be})}if(a)for(const ae in a)If(a[ae],i,n,ae);if(l){const ae=nt(l)?l.call(n):l;Reflect.ownKeys(ae).forEach(G=>{Zr(G,ae[G])})}u&&Vd(u,t,"c");function q(ae,G){He(G)?G.forEach(fe=>ae(fe.bind(n))):G&&ae(G.bind(n))}if(q(r_,f),q(Tf,h),q(a_,m),q(l_,b),q(i_,y),q(s_,_),q(h_,R),q(u_,P),q(d_,D),q(Cf,T),q(Af,S),q(c_,E),He(g))if(g.length){const ae=t.exposed||(t.exposed={});g.forEach(G=>{Object.defineProperty(ae,G,{get:()=>n[G],set:fe=>n[G]=fe})})}else t.exposed||(t.exposed={});I&&t.render===kn&&(t.render=I),L!=null&&(t.inheritAttrs=L),O&&(t.components=O),H&&(t.directives=H)}function __(t,e,n=kn,i=!1){He(t)&&(t=kl(t));for(const s in t){const o=t[s];let r;Lt(o)?"default"in o?r=Oi(o.from||s,o.default,!0):r=Oi(o.from||s):r=Oi(o),Qt(r)&&i?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>r.value,set:a=>r.value=a}):e[s]=r}}function Vd(t,e,n){wn(He(t)?t.map(i=>i.bind(e.proxy)):t.bind(e.proxy),e,n)}function If(t,e,n,i){const s=i.includes(".")?xf(n,i):()=>n[i];if(zt(t)){const o=e[t];nt(o)&&Vo(s,o)}else if(nt(t))Vo(s,t.bind(n));else if(Lt(t))if(He(t))t.forEach(o=>If(o,e,n,i));else{const o=nt(t.handler)?t.handler.bind(n):e[t.handler];nt(o)&&Vo(s,o,t)}}function Lf(t){const e=t.type,{mixins:n,extends:i}=e,{mixins:s,optionsCache:o,config:{optionMergeStrategies:r}}=t.appContext,a=o.get(e);let l;return a?l=a:!s.length&&!n&&!i?l=e:(l={},s.length&&s.forEach(d=>da(l,d,r,!0)),da(l,e,r)),o.set(e,l),l}function da(t,e,n,i=!1){const{mixins:s,extends:o}=e;o&&da(t,o,n,!0),s&&s.forEach(r=>da(t,r,n,!0));for(const r in e)if(!(i&&r==="expose")){const a=g_[r]||n&&n[r];t[r]=a?a(t[r],e[r]):e[r]}return t}const g_={data:Hd,props:is,emits:is,methods:is,computed:is,beforeCreate:sn,created:sn,beforeMount:sn,mounted:sn,beforeUpdate:sn,updated:sn,beforeDestroy:sn,beforeUnmount:sn,destroyed:sn,unmounted:sn,activated:sn,deactivated:sn,errorCaptured:sn,serverPrefetch:sn,components:is,directives:is,watch:b_,provide:Hd,inject:v_};function Hd(t,e){return e?t?function(){return jt(nt(t)?t.call(this,this):t,nt(e)?e.call(this,this):e)}:e:t}function v_(t,e){return is(kl(t),kl(e))}function kl(t){if(He(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function sn(t,e){return t?[...new Set([].concat(t,e))]:e}function is(t,e){return t?jt(jt(Object.create(null),t),e):e}function b_(t,e){if(!t)return e;if(!e)return t;const n=jt(Object.create(null),t);for(const i in e)n[i]=sn(t[i],e[i]);return n}function y_(t,e,n,i=!1){const s={},o={};ra(o,Aa,1),t.propsDefaults=Object.create(null),Uf(t,e,s,o);for(const r in t.propsOptions[0])r in s||(s[r]=void 0);n?t.props=i?s:Fm(s):t.type.props?t.props=s:t.props=o,t.attrs=o}function x_(t,e,n,i){const{props:s,attrs:o,vnode:{patchFlag:r}}=t,a=pt(s),[l]=t.propsOptions;let d=!1;if((i||r>0)&&!(r&16)){if(r&8){const u=t.vnode.dynamicProps;for(let f=0;f<u.length;f++){let h=u[f];if(Ea(t.emitsOptions,h))continue;const m=e[h];if(l)if(dt(o,h))m!==o[h]&&(o[h]=m,d=!0);else{const b=Qn(h);s[b]=Bl(l,a,b,m,t,!1)}else m!==o[h]&&(o[h]=m,d=!0)}}}else{Uf(t,e,s,o)&&(d=!0);let u;for(const f in a)(!e||!dt(e,f)&&((u=bs(f))===f||!dt(e,u)))&&(l?n&&(n[f]!==void 0||n[u]!==void 0)&&(s[f]=Bl(l,a,f,void 0,t,!0)):delete s[f]);if(o!==a)for(const f in o)(!e||!dt(e,f)&&!0)&&(delete o[f],d=!0)}d&&pi(t,"set","$attrs")}function Uf(t,e,n,i){const[s,o]=t.propsOptions;let r=!1,a;if(e)for(let l in e){if(Yr(l))continue;const d=e[l];let u;s&&dt(s,u=Qn(l))?!o||!o.includes(u)?n[u]=d:(a||(a={}))[u]=d:Ea(t.emitsOptions,l)||(!(l in i)||d!==i[l])&&(i[l]=d,r=!0)}if(o){const l=pt(n),d=a||Mt;for(let u=0;u<o.length;u++){const f=o[u];n[f]=Bl(s,l,f,d[f],t,!dt(d,f))}}return r}function Bl(t,e,n,i,s,o){const r=t[n];if(r!=null){const a=dt(r,"default");if(a&&i===void 0){const l=r.default;if(r.type!==Function&&nt(l)){const{propsDefaults:d}=s;n in d?i=d[n]:(eo(s),i=d[n]=l.call(null,e),ms())}else i=l}r[0]&&(o&&!a?i=!1:r[1]&&(i===""||i===bs(n))&&(i=!0))}return i}function Ff(t,e,n=!1){const i=e.propsCache,s=i.get(t);if(s)return s;const o=t.props,r={},a=[];let l=!1;if(!nt(t)){const u=f=>{l=!0;const[h,m]=Ff(f,e,!0);jt(r,h),m&&a.push(...m)};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!o&&!l)return i.set(t,js),js;if(He(o))for(let u=0;u<o.length;u++){const f=Qn(o[u]);$d(f)&&(r[f]=Mt)}else if(o)for(const u in o){const f=Qn(u);if($d(f)){const h=o[u],m=r[f]=He(h)||nt(h)?{type:h}:h;if(m){const b=Xd(Boolean,m.type),y=Xd(String,m.type);m[0]=b>-1,m[1]=y<0||b<y,(b>-1||dt(m,"default"))&&a.push(f)}}}const d=[r,a];return i.set(t,d),d}function $d(t){return t[0]!=="$"}function Gd(t){const e=t&&t.toString().match(/^\s*function (\w+)/);return e?e[1]:t===null?"null":""}function Wd(t,e){return Gd(t)===Gd(e)}function Xd(t,e){return He(e)?e.findIndex(n=>Wd(n,t)):nt(e)&&Wd(e,t)?0:-1}const Of=t=>t[0]==="_"||t==="$stable",Yc=t=>He(t)?t.map(Xn):[Xn(t)],S_=(t,e,n)=>{if(e._n)return e;const i=Ct((...s)=>Yc(e(...s)),n);return i._c=!1,i},Nf=(t,e,n)=>{const i=t._ctx;for(const s in t){if(Of(s))continue;const o=t[s];if(nt(o))e[s]=S_(s,o,i);else if(o!=null){const r=Yc(o);e[s]=()=>r}}},zf=(t,e)=>{const n=Yc(e);t.slots.default=()=>n},M_=(t,e)=>{if(t.vnode.shapeFlag&32){const n=e._;n?(t.slots=pt(e),ra(e,"_",n)):Nf(e,t.slots={})}else t.slots={},e&&zf(t,e);ra(t.slots,Aa,1)},E_=(t,e,n)=>{const{vnode:i,slots:s}=t;let o=!0,r=Mt;if(i.shapeFlag&32){const a=e._;a?n&&a===1?o=!1:(jt(s,e),!n&&a===1&&delete s._):(o=!e.$stable,Nf(e,s)),r=e}else e&&(zf(t,e),r={default:1});if(o)for(const a in s)!Of(a)&&!(a in r)&&delete s[a]};function kf(){return{app:null,config:{isNativeTag:tm,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let w_=0;function T_(t,e){return function(i,s=null){nt(i)||(i=Object.assign({},i)),s!=null&&!Lt(s)&&(s=null);const o=kf(),r=new Set;let a=!1;const l=o.app={_uid:w_++,_component:i,_props:s,_container:null,_context:o,_instance:null,version:$_,get config(){return o.config},set config(d){},use(d,...u){return r.has(d)||(d&&nt(d.install)?(r.add(d),d.install(l,...u)):nt(d)&&(r.add(d),d(l,...u))),l},mixin(d){return o.mixins.includes(d)||o.mixins.push(d),l},component(d,u){return u?(o.components[d]=u,l):o.components[d]},directive(d,u){return u?(o.directives[d]=u,l):o.directives[d]},mount(d,u,f){if(!a){const h=ke(i,s);return h.appContext=o,u&&e?e(h,d):t(h,d,f),a=!0,l._container=d,d.__vue_app__=l,Pa(h.component)||h.component.proxy}},unmount(){a&&(t(null,l._container),delete l._container.__vue_app__)},provide(d,u){return o.provides[d]=u,l}};return l}}function Vl(t,e,n,i,s=!1){if(He(t)){t.forEach((h,m)=>Vl(h,e&&(He(e)?e[m]:e),n,i,s));return}if(Ho(i)&&!s)return;const o=i.shapeFlag&4?Pa(i.component)||i.component.proxy:i.el,r=s?null:o,{i:a,r:l}=t,d=e&&e.r,u=a.refs===Mt?a.refs={}:a.refs,f=a.setupState;if(d!=null&&d!==l&&(zt(d)?(u[d]=null,dt(f,d)&&(f[d]=null)):Qt(d)&&(d.value=null)),nt(l))Fi(l,a,12,[r,u]);else{const h=zt(l),m=Qt(l);if(h||m){const b=()=>{if(t.f){const y=h?u[l]:l.value;s?He(y)&&Nc(y,o):He(y)?y.includes(o)||y.push(o):h?(u[l]=[o],dt(f,l)&&(f[l]=u[l])):(l.value=[o],t.k&&(u[t.k]=l.value))}else h?(u[l]=r,dt(f,l)&&(f[l]=r)):m&&(l.value=r,t.k&&(u[t.k]=r))};r?(b.id=-1,dn(b,n)):b()}}}const dn=Qm;function C_(t){return A_(t)}function A_(t,e){const n=am();n.__VUE__=!0;const{insert:i,remove:s,patchProp:o,createElement:r,createText:a,createComment:l,setText:d,setElementText:u,parentNode:f,nextSibling:h,setScopeId:m=kn,cloneNode:b,insertStaticContent:y}=t,_=(A,x,Z,ie=null,te=null,ne=null,me=!1,Q=null,M=!!x.dynamicChildren)=>{if(A===x)return;A&&!rs(A,x)&&(ie=ue(A),Je(A,te,ne,!0),A=null),x.patchFlag===-2&&(M=!1,x.dynamicChildren=null);const{type:v,ref:F,shapeFlag:B}=x;switch(v){case qc:p(A,x,Z,ie);break;case Tn:T(A,x,Z,ie);break;case $a:A==null&&w(x,Z,ie,me);break;case rt:H(A,x,Z,ie,te,ne,me,Q,M);break;default:B&1?P(A,x,Z,ie,te,ne,me,Q,M):B&6?j(A,x,Z,ie,te,ne,me,Q,M):(B&64||B&128)&&v.process(A,x,Z,ie,te,ne,me,Q,M,Se)}F!=null&&te&&Vl(F,A&&A.ref,ne,x||A,!x)},p=(A,x,Z,ie)=>{if(A==null)i(x.el=a(x.children),Z,ie);else{const te=x.el=A.el;x.children!==A.children&&d(te,x.children)}},T=(A,x,Z,ie)=>{A==null?i(x.el=l(x.children||""),Z,ie):x.el=A.el},w=(A,x,Z,ie)=>{[A.el,A.anchor]=y(A.children,x,Z,ie,A.el,A.anchor)},S=({el:A,anchor:x},Z,ie)=>{let te;for(;A&&A!==x;)te=h(A),i(A,Z,ie),A=te;i(x,Z,ie)},I=({el:A,anchor:x})=>{let Z;for(;A&&A!==x;)Z=h(A),s(A),A=Z;s(x)},P=(A,x,Z,ie,te,ne,me,Q,M)=>{me=me||x.type==="svg",A==null?D(x,Z,ie,te,ne,me,Q,M):g(A,x,te,ne,me,Q,M)},D=(A,x,Z,ie,te,ne,me,Q)=>{let M,v;const{type:F,props:B,shapeFlag:X,transition:$,patchFlag:ge,dirs:pe}=A;if(A.el&&b!==void 0&&ge===-1)M=A.el=b(A.el);else{if(M=A.el=r(A.type,ne,B&&B.is,B),X&8?u(M,A.children):X&16&&E(A.children,M,null,ie,te,ne&&F!=="foreignObject",me,Q),pe&&Wi(A,null,ie,"created"),B){for(const Me in B)Me!=="value"&&!Yr(Me)&&o(M,Me,null,B[Me],ne,A.children,ie,te,Y);"value"in B&&o(M,"value",null,B.value),(v=B.onVnodeBeforeMount)&&$n(v,ie,A)}R(M,A,A.scopeId,me,ie)}pe&&Wi(A,null,ie,"beforeMount");const be=(!te||te&&!te.pendingBranch)&&$&&!$.persisted;be&&$.beforeEnter(M),i(M,x,Z),((v=B&&B.onVnodeMounted)||be||pe)&&dn(()=>{v&&$n(v,ie,A),be&&$.enter(M),pe&&Wi(A,null,ie,"mounted")},te)},R=(A,x,Z,ie,te)=>{if(Z&&m(A,Z),ie)for(let ne=0;ne<ie.length;ne++)m(A,ie[ne]);if(te){let ne=te.subTree;if(x===ne){const me=te.vnode;R(A,me,me.scopeId,me.slotScopeIds,te.parent)}}},E=(A,x,Z,ie,te,ne,me,Q,M=0)=>{for(let v=M;v<A.length;v++){const F=A[v]=Q?Pi(A[v]):Xn(A[v]);_(null,F,x,Z,ie,te,ne,me,Q)}},g=(A,x,Z,ie,te,ne,me)=>{const Q=x.el=A.el;let{patchFlag:M,dynamicChildren:v,dirs:F}=x;M|=A.patchFlag&16;const B=A.props||Mt,X=x.props||Mt;let $;Z&&Xi(Z,!1),($=X.onVnodeBeforeUpdate)&&$n($,Z,x,A),F&&Wi(x,A,Z,"beforeUpdate"),Z&&Xi(Z,!0);const ge=te&&x.type!=="foreignObject";if(v?L(A.dynamicChildren,v,Q,Z,ie,ge,ne):me||fe(A,x,Q,null,Z,ie,ge,ne,!1),M>0){if(M&16)O(Q,x,B,X,Z,ie,te);else if(M&2&&B.class!==X.class&&o(Q,"class",null,X.class,te),M&4&&o(Q,"style",B.style,X.style,te),M&8){const pe=x.dynamicProps;for(let be=0;be<pe.length;be++){const Me=pe[be],he=B[Me],Ce=X[Me];(Ce!==he||Me==="value")&&o(Q,Me,he,Ce,te,A.children,Z,ie,Y)}}M&1&&A.children!==x.children&&u(Q,x.children)}else!me&&v==null&&O(Q,x,B,X,Z,ie,te);(($=X.onVnodeUpdated)||F)&&dn(()=>{$&&$n($,Z,x,A),F&&Wi(x,A,Z,"updated")},ie)},L=(A,x,Z,ie,te,ne,me)=>{for(let Q=0;Q<x.length;Q++){const M=A[Q],v=x[Q],F=M.el&&(M.type===rt||!rs(M,v)||M.shapeFlag&70)?f(M.el):Z;_(M,v,F,null,ie,te,ne,me,!0)}},O=(A,x,Z,ie,te,ne,me)=>{if(Z!==ie){for(const Q in ie){if(Yr(Q))continue;const M=ie[Q],v=Z[Q];M!==v&&Q!=="value"&&o(A,Q,v,M,me,x.children,te,ne,Y)}if(Z!==Mt)for(const Q in Z)!Yr(Q)&&!(Q in ie)&&o(A,Q,Z[Q],null,me,x.children,te,ne,Y);"value"in ie&&o(A,"value",Z.value,ie.value)}},H=(A,x,Z,ie,te,ne,me,Q,M)=>{const v=x.el=A?A.el:a(""),F=x.anchor=A?A.anchor:a("");let{patchFlag:B,dynamicChildren:X,slotScopeIds:$}=x;$&&(Q=Q?Q.concat($):$),A==null?(i(v,Z,ie),i(F,Z,ie),E(x.children,Z,F,te,ne,me,Q,M)):B>0&&B&64&&X&&A.dynamicChildren?(L(A.dynamicChildren,X,Z,te,ne,me,Q),(x.key!=null||te&&x===te.subTree)&&Bf(A,x,!0)):fe(A,x,Z,F,te,ne,me,Q,M)},j=(A,x,Z,ie,te,ne,me,Q,M)=>{x.slotScopeIds=Q,A==null?x.shapeFlag&512?te.ctx.activate(x,Z,ie,me,M):re(x,Z,ie,te,ne,me,M):q(A,x,M)},re=(A,x,Z,ie,te,ne,me)=>{const Q=A.component=F_(A,ie,te);if(Ta(A)&&(Q.ctx.renderer=Se),N_(Q),Q.asyncDep){if(te&&te.registerDep(Q,ae),!A.el){const M=Q.subTree=ke(Tn);T(null,M,x,Z)}return}ae(Q,A,x,Z,te,ne,me)},q=(A,x,Z)=>{const ie=x.component=A.component;if(Zm(A,x,Z))if(ie.asyncDep&&!ie.asyncResolved){G(ie,x,Z);return}else ie.next=x,Hm(ie.update),ie.update();else x.el=A.el,ie.vnode=x},ae=(A,x,Z,ie,te,ne,me)=>{const Q=()=>{if(A.isMounted){let{next:F,bu:B,u:X,parent:$,vnode:ge}=A,pe=F,be;Xi(A,!1),F?(F.el=ge.el,G(A,F,me)):F=ge,B&&qr(B),(be=F.props&&F.props.onVnodeBeforeUpdate)&&$n(be,$,F,ge),Xi(A,!0);const Me=Va(A),he=A.subTree;A.subTree=Me,_(he,Me,f(he.el),ue(he),A,te,ne),F.el=Me.el,pe===null&&Km(A,Me.el),X&&dn(X,te),(be=F.props&&F.props.onVnodeUpdated)&&dn(()=>$n(be,$,F,ge),te)}else{let F;const{el:B,props:X}=x,{bm:$,m:ge,parent:pe}=A,be=Ho(x);if(Xi(A,!1),$&&qr($),!be&&(F=X&&X.onVnodeBeforeMount)&&$n(F,pe,x),Xi(A,!0),B&&Ue){const Me=()=>{A.subTree=Va(A),Ue(B,A.subTree,A,te,null)};be?x.type.__asyncLoader().then(()=>!A.isUnmounted&&Me()):Me()}else{const Me=A.subTree=Va(A);_(null,Me,Z,ie,A,te,ne),x.el=Me.el}if(ge&&dn(ge,te),!be&&(F=X&&X.onVnodeMounted)){const Me=x;dn(()=>$n(F,pe,Me),te)}(x.shapeFlag&256||pe&&Ho(pe.vnode)&&pe.vnode.shapeFlag&256)&&A.a&&dn(A.a,te),A.isMounted=!0,x=Z=ie=null}},M=A.effect=new Bc(Q,()=>pf(v),A.scope),v=A.update=()=>M.run();v.id=A.uid,Xi(A,!0),v()},G=(A,x,Z)=>{x.component=A;const ie=A.vnode.props;A.vnode=x,A.next=null,x_(A,x.props,ie,Z),E_(A,x.children,Z),fo(),Ma(void 0,A.update),po()},fe=(A,x,Z,ie,te,ne,me,Q,M=!1)=>{const v=A&&A.children,F=A?A.shapeFlag:0,B=x.children,{patchFlag:X,shapeFlag:$}=x;if(X>0){if(X&128){Re(v,B,Z,ie,te,ne,me,Q,M);return}else if(X&256){ye(v,B,Z,ie,te,ne,me,Q,M);return}}$&8?(F&16&&Y(v,te,ne),B!==v&&u(Z,B)):F&16?$&16?Re(v,B,Z,ie,te,ne,me,Q,M):Y(v,te,ne,!0):(F&8&&u(Z,""),$&16&&E(B,Z,ie,te,ne,me,Q,M))},ye=(A,x,Z,ie,te,ne,me,Q,M)=>{A=A||js,x=x||js;const v=A.length,F=x.length,B=Math.min(v,F);let X;for(X=0;X<B;X++){const $=x[X]=M?Pi(x[X]):Xn(x[X]);_(A[X],$,Z,null,te,ne,me,Q,M)}v>F?Y(A,te,ne,!0,!1,B):E(x,Z,ie,te,ne,me,Q,M,B)},Re=(A,x,Z,ie,te,ne,me,Q,M)=>{let v=0;const F=x.length;let B=A.length-1,X=F-1;for(;v<=B&&v<=X;){const $=A[v],ge=x[v]=M?Pi(x[v]):Xn(x[v]);if(rs($,ge))_($,ge,Z,null,te,ne,me,Q,M);else break;v++}for(;v<=B&&v<=X;){const $=A[B],ge=x[X]=M?Pi(x[X]):Xn(x[X]);if(rs($,ge))_($,ge,Z,null,te,ne,me,Q,M);else break;B--,X--}if(v>B){if(v<=X){const $=X+1,ge=$<F?x[$].el:ie;for(;v<=X;)_(null,x[v]=M?Pi(x[v]):Xn(x[v]),Z,ge,te,ne,me,Q,M),v++}}else if(v>X)for(;v<=B;)Je(A[v],te,ne,!0),v++;else{const $=v,ge=v,pe=new Map;for(v=ge;v<=X;v++){const Ye=x[v]=M?Pi(x[v]):Xn(x[v]);Ye.key!=null&&pe.set(Ye.key,v)}let be,Me=0;const he=X-ge+1;let Ce=!1,Xe=0;const $e=new Array(he);for(v=0;v<he;v++)$e[v]=0;for(v=$;v<=B;v++){const Ye=A[v];if(Me>=he){Je(Ye,te,ne,!0);continue}let Ge;if(Ye.key!=null)Ge=pe.get(Ye.key);else for(be=ge;be<=X;be++)if($e[be-ge]===0&&rs(Ye,x[be])){Ge=be;break}Ge===void 0?Je(Ye,te,ne,!0):($e[Ge-ge]=v+1,Ge>=Xe?Xe=Ge:Ce=!0,_(Ye,x[Ge],Z,null,te,ne,me,Q,M),Me++)}const De=Ce?P_($e):js;for(be=De.length-1,v=he-1;v>=0;v--){const Ye=ge+v,Ge=x[Ye],gt=Ye+1<F?x[Ye+1].el:ie;$e[v]===0?_(null,Ge,Z,gt,te,ne,me,Q,M):Ce&&(be<0||v!==De[be]?Be(Ge,Z,gt,2):be--)}}},Be=(A,x,Z,ie,te=null)=>{const{el:ne,type:me,transition:Q,children:M,shapeFlag:v}=A;if(v&6){Be(A.component.subTree,x,Z,ie);return}if(v&128){A.suspense.move(x,Z,ie);return}if(v&64){me.move(A,x,Z,Se);return}if(me===rt){i(ne,x,Z);for(let B=0;B<M.length;B++)Be(M[B],x,Z,ie);i(A.anchor,x,Z);return}if(me===$a){S(A,x,Z);return}if(ie!==2&&v&1&&Q)if(ie===0)Q.beforeEnter(ne),i(ne,x,Z),dn(()=>Q.enter(ne),te);else{const{leave:B,delayLeave:X,afterLeave:$}=Q,ge=()=>i(ne,x,Z),pe=()=>{B(ne,()=>{ge(),$&&$()})};X?X(ne,ge,pe):pe()}else i(ne,x,Z)},Je=(A,x,Z,ie=!1,te=!1)=>{const{type:ne,props:me,ref:Q,children:M,dynamicChildren:v,shapeFlag:F,patchFlag:B,dirs:X}=A;if(Q!=null&&Vl(Q,null,Z,A,!0),F&256){x.ctx.deactivate(A);return}const $=F&1&&X,ge=!Ho(A);let pe;if(ge&&(pe=me&&me.onVnodeBeforeUnmount)&&$n(pe,x,A),F&6)le(A.component,Z,ie);else{if(F&128){A.suspense.unmount(Z,ie);return}$&&Wi(A,null,x,"beforeUnmount"),F&64?A.type.remove(A,x,Z,te,Se,ie):v&&(ne!==rt||B>0&&B&64)?Y(v,x,Z,!1,!0):(ne===rt&&B&384||!te&&F&16)&&Y(M,x,Z),ie&&ce(A)}(ge&&(pe=me&&me.onVnodeUnmounted)||$)&&dn(()=>{pe&&$n(pe,x,A),$&&Wi(A,null,x,"unmounted")},Z)},ce=A=>{const{type:x,el:Z,anchor:ie,transition:te}=A;if(x===rt){N(Z,ie);return}if(x===$a){I(A);return}const ne=()=>{s(Z),te&&!te.persisted&&te.afterLeave&&te.afterLeave()};if(A.shapeFlag&1&&te&&!te.persisted){const{leave:me,delayLeave:Q}=te,M=()=>me(Z,ne);Q?Q(A.el,ne,M):M()}else ne()},N=(A,x)=>{let Z;for(;A!==x;)Z=h(A),s(A),A=Z;s(x)},le=(A,x,Z)=>{const{bum:ie,scope:te,update:ne,subTree:me,um:Q}=A;ie&&qr(ie),te.stop(),ne&&(ne.active=!1,Je(me,A,x,Z)),Q&&dn(Q,x),dn(()=>{A.isUnmounted=!0},x),x&&x.pendingBranch&&!x.isUnmounted&&A.asyncDep&&!A.asyncResolved&&A.suspenseId===x.pendingId&&(x.deps--,x.deps===0&&x.resolve())},Y=(A,x,Z,ie=!1,te=!1,ne=0)=>{for(let me=ne;me<A.length;me++)Je(A[me],x,Z,ie,te)},ue=A=>A.shapeFlag&6?ue(A.component.subTree):A.shapeFlag&128?A.suspense.next():h(A.anchor||A.el),Oe=(A,x,Z)=>{A==null?x._vnode&&Je(x._vnode,null,null,!0):_(x._vnode||null,A,x,null,null,null,Z),gf(),x._vnode=A},Se={p:_,um:Je,m:Be,r:ce,mt:re,mc:E,pc:fe,pbc:L,n:ue,o:t};let Ne,Ue;return e&&([Ne,Ue]=e(Se)),{render:Oe,hydrate:Ne,createApp:T_(Oe,Ne)}}function Xi({effect:t,update:e},n){t.allowRecurse=e.allowRecurse=n}function Bf(t,e,n=!1){const i=t.children,s=e.children;if(He(i)&&He(s))for(let o=0;o<i.length;o++){const r=i[o];let a=s[o];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[o]=Pi(s[o]),a.el=r.el),n||Bf(r,a))}}function P_(t){const e=t.slice(),n=[0];let i,s,o,r,a;const l=t.length;for(i=0;i<l;i++){const d=t[i];if(d!==0){if(s=n[n.length-1],t[s]<d){e[i]=s,n.push(i);continue}for(o=0,r=n.length-1;o<r;)a=o+r>>1,t[n[a]]<d?o=a+1:r=a;d<t[n[o]]&&(o>0&&(e[i]=n[o-1]),n[o]=i)}}for(o=n.length,r=n[o-1];o-- >0;)n[o]=r,r=e[r];return n}const R_=t=>t.__isTeleport,rt=Symbol(void 0),qc=Symbol(void 0),Tn=Symbol(void 0),$a=Symbol(void 0),$o=[];let Nn=null;function W(t=!1){$o.push(Nn=t?null:[])}function D_(){$o.pop(),Nn=$o[$o.length-1]||null}let er=1;function jd(t){er+=t}function Vf(t){return t.dynamicChildren=er>0?Nn||js:null,D_(),er>0&&Nn&&Nn.push(t),t}function ee(t,e,n,i,s,o){return Vf(c(t,e,n,i,s,o,!0))}function Jt(t,e,n,i,s){return Vf(ke(t,e,n,i,s,!0))}function ua(t){return t?t.__v_isVNode===!0:!1}function rs(t,e){return t.type===e.type&&t.key===e.key}const Aa="__vInternal",Hf=({key:t})=>t!=null?t:null,Kr=({ref:t,ref_key:e,ref_for:n})=>t!=null?zt(t)||Qt(t)||nt(t)?{i:en,r:t,k:e,f:!!n}:t:null;function c(t,e=null,n=null,i=0,s=null,o=t===rt?0:1,r=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Hf(e),ref:e&&Kr(e),scopeId:wa,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null};return a?(Zc(l,n),o&128&&t.normalize(l)):n&&(l.shapeFlag|=zt(n)?8:16),er>0&&!r&&Nn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&Nn.push(l),l}const ke=I_;function I_(t,e=null,n=null,i=0,s=null,o=!1){if((!t||t===Pf)&&(t=Tn),ua(t)){const a=Bi(t,e,!0);return n&&Zc(a,n),er>0&&!o&&Nn&&(a.shapeFlag&6?Nn[Nn.indexOf(t)]=a:Nn.push(a)),a.patchFlag|=-2,a}if(H_(t)&&(t=t.__vccOpts),e){e=$f(e);let{class:a,style:l}=e;a&&!zt(a)&&(e.class=je(a)),Lt(l)&&(sf(l)&&!He(l)&&(l=jt({},l)),e.style=uo(l))}const r=zt(t)?1:Jm(t)?128:R_(t)?64:Lt(t)?4:nt(t)?2:0;return c(t,e,n,i,s,r,o,!0)}function $f(t){return t?sf(t)||Aa in t?jt({},t):t:null}function Bi(t,e,n=!1){const{props:i,ref:s,patchFlag:o,children:r}=t,a=e?Gf(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&Hf(a),ref:e&&e.ref?n&&s?He(s)?s.concat(Kr(e)):[s,Kr(e)]:Kr(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:r,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==rt?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Bi(t.ssContent),ssFallback:t.ssFallback&&Bi(t.ssFallback),el:t.el,anchor:t.anchor}}function Ie(t=" ",e=0){return ke(qc,null,t,e)}function st(t="",e=!1){return e?(W(),Jt(Tn,null,t)):ke(Tn,null,t)}function Xn(t){return t==null||typeof t=="boolean"?ke(Tn):He(t)?ke(rt,null,t.slice()):typeof t=="object"?Pi(t):ke(qc,null,String(t))}function Pi(t){return t.el===null||t.memo?t:Bi(t)}function Zc(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if(He(e))n=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),Zc(t,s()),s._c&&(s._d=!0));return}else{n=32;const s=e._;!s&&!(Aa in e)?e._ctx=en:s===3&&en&&(en.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else nt(e)?(e={default:e,_ctx:en},n=32):(e=String(e),i&64?(n=16,e=[Ie(e)]):n=8);t.children=e,t.shapeFlag|=n}function Gf(...t){const e={};for(let n=0;n<t.length;n++){const i=t[n];for(const s in i)if(s==="class")e.class!==i.class&&(e.class=je([e.class,i.class]));else if(s==="style")e.style=uo([e.style,i.style]);else if(va(s)){const o=e[s],r=i[s];r&&o!==r&&!(He(o)&&o.includes(r))&&(e[s]=o?[].concat(o,r):r)}else s!==""&&(e[s]=i[s])}return e}function $n(t,e,n,i=null){wn(t,e,7,[n,i])}const L_=kf();let U_=0;function F_(t,e,n){const i=t.type,s=(e?e.appContext:t.appContext)||L_,o={uid:U_++,vnode:t,type:i,parent:e,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,scope:new lm(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(s.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Ff(i,s),emitsOptions:bf(i,s),emit:null,emitted:null,propsDefaults:Mt,inheritAttrs:i.inheritAttrs,ctx:Mt,data:Mt,props:Mt,attrs:Mt,slots:Mt,refs:Mt,setupState:Mt,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=e?e.root:o,o.emit=Wm.bind(null,o),t.ce&&t.ce(o),o}let $t=null;const O_=()=>$t||en,eo=t=>{$t=t,t.scope.on()},ms=()=>{$t&&$t.scope.off(),$t=null};function Wf(t){return t.vnode.shapeFlag&4}let tr=!1;function N_(t,e=!1){tr=e;const{props:n,children:i}=t.vnode,s=Wf(t);y_(t,n,s,e),M_(t,i);const o=s?z_(t,e):void 0;return tr=!1,o}function z_(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=of(new Proxy(t.ctx,p_));const{setup:i}=n;if(i){const s=t.setupContext=i.length>1?B_(t):null;eo(t),fo();const o=Fi(i,t,0,[t.props,s]);if(po(),ms(),$h(o)){if(o.then(ms,ms),e)return o.then(r=>{Yd(t,r,e)}).catch(r=>{Sa(r,t,0)});t.asyncDep=o}else Yd(t,o,e)}else Xf(t,e)}function Yd(t,e,n){nt(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Lt(e)&&(t.setupState=uf(e)),Xf(t,n)}let qd;function Xf(t,e,n){const i=t.type;if(!t.render){if(!e&&qd&&!i.render){const s=i.template;if(s){const{isCustomElement:o,compilerOptions:r}=t.appContext.config,{delimiters:a,compilerOptions:l}=i,d=jt(jt({isCustomElement:o,delimiters:a},r),l);i.render=qd(s,d)}}t.render=i.render||kn}eo(t),fo(),m_(t),po(),ms()}function k_(t){return new Proxy(t.attrs,{get(e,n){return vn(t,"get","$attrs"),e[n]}})}function B_(t){const e=i=>{t.exposed=i||{}};let n;return{get attrs(){return n||(n=k_(t))},slots:t.slots,emit:t.emit,expose:e}}function Pa(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(uf(of(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in ca)return ca[n](t)}}))}function V_(t,e=!0){return nt(t)?t.displayName||t.name:t.name||e&&t.__name}function H_(t){return nt(t)&&"__vccOpts"in t}const Yn=(t,e)=>km(t,e,tr);function Kc(t,e,n){const i=arguments.length;return i===2?Lt(e)&&!He(e)?ua(e)?ke(t,null,[e]):ke(t,e):ke(t,null,e):(i>3?n=Array.prototype.slice.call(arguments,2):i===3&&ua(n)&&(n=[n]),ke(t,e,n))}const $_="3.2.37",G_="http://www.w3.org/2000/svg",as=typeof document!="undefined"?document:null,Zd=as&&as.createElement("template"),W_={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,i)=>{const s=e?as.createElementNS(G_,t):as.createElement(t,n?{is:n}:void 0);return t==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:t=>as.createTextNode(t),createComment:t=>as.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>as.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},cloneNode(t){const e=t.cloneNode(!0);return"_value"in t&&(e._value=t._value),e},insertStaticContent(t,e,n,i,s,o){const r=n?n.previousSibling:e.lastChild;if(s&&(s===o||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{Zd.innerHTML=i?`<svg>${t}</svg>`:t;const a=Zd.content;if(i){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,n)}return[r?r.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}};function X_(t,e,n){const i=t._vtc;i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}function j_(t,e,n){const i=t.style,s=zt(n);if(n&&!s){for(const o in n)Hl(i,o,n[o]);if(e&&!zt(e))for(const o in e)n[o]==null&&Hl(i,o,"")}else{const o=i.display;s?e!==n&&(i.cssText=n):e&&t.removeAttribute("style"),"_vod"in t&&(i.display=o)}}const Kd=/\s*!important$/;function Hl(t,e,n){if(He(n))n.forEach(i=>Hl(t,e,i));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const i=Y_(t,e);Kd.test(n)?t.setProperty(bs(i),n.replace(Kd,""),"important"):t[i]=n}}const Jd=["Webkit","Moz","ms"],Ga={};function Y_(t,e){const n=Ga[e];if(n)return n;let i=Qn(e);if(i!=="filter"&&i in t)return Ga[e]=i;i=ya(i);for(let s=0;s<Jd.length;s++){const o=Jd[s]+i;if(o in t)return Ga[e]=o}return e}const Qd="http://www.w3.org/1999/xlink";function q_(t,e,n,i,s){if(i&&e.startsWith("xlink:"))n==null?t.removeAttributeNS(Qd,e.slice(6,e.length)):t.setAttributeNS(Qd,e,n);else{const o=qp(e);n==null||o&&!Vh(n)?t.removeAttribute(e):t.setAttribute(e,o?"":n)}}function Z_(t,e,n,i,s,o,r){if(e==="innerHTML"||e==="textContent"){i&&r(i,s,o),t[e]=n==null?"":n;return}if(e==="value"&&t.tagName!=="PROGRESS"&&!t.tagName.includes("-")){t._value=n;const l=n==null?"":n;(t.value!==l||t.tagName==="OPTION")&&(t.value=l),n==null&&t.removeAttribute(e);return}let a=!1;if(n===""||n==null){const l=typeof t[e];l==="boolean"?n=Vh(n):n==null&&l==="string"?(n="",a=!0):l==="number"&&(n=0,a=!0)}try{t[e]=n}catch{}a&&t.removeAttribute(e)}const[jf,K_]=(()=>{let t=Date.now,e=!1;if(typeof window!="undefined"){Date.now()>document.createEvent("Event").timeStamp&&(t=performance.now.bind(performance));const n=navigator.userAgent.match(/firefox\/(\d+)/i);e=!!(n&&Number(n[1])<=53)}return[t,e]})();let $l=0;const J_=Promise.resolve(),Q_=()=>{$l=0},eg=()=>$l||(J_.then(Q_),$l=jf());function Ii(t,e,n,i){t.addEventListener(e,n,i)}function tg(t,e,n,i){t.removeEventListener(e,n,i)}function ng(t,e,n,i,s=null){const o=t._vei||(t._vei={}),r=o[e];if(i&&r)r.value=i;else{const[a,l]=ig(e);if(i){const d=o[e]=sg(i,s);Ii(t,a,d,l)}else r&&(tg(t,a,r,l),o[e]=void 0)}}const eu=/(?:Once|Passive|Capture)$/;function ig(t){let e;if(eu.test(t)){e={};let n;for(;n=t.match(eu);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[bs(t.slice(2)),e]}function sg(t,e){const n=i=>{const s=i.timeStamp||jf();(K_||s>=n.attached-1)&&wn(og(i,n.value),e,5,[i])};return n.value=t,n.attached=eg(),n}function og(t,e){if(He(e)){const n=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{n.call(t),t._stopped=!0},e.map(i=>s=>!s._stopped&&i&&i(s))}else return e}const tu=/^on[a-z]/,rg=(t,e,n,i,s=!1,o,r,a,l)=>{e==="class"?X_(t,i,s):e==="style"?j_(t,n,i):va(e)?Oc(e)||ng(t,e,n,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ag(t,e,i,s))?Z_(t,e,i,o,r,a,l):(e==="true-value"?t._trueValue=i:e==="false-value"&&(t._falseValue=i),q_(t,e,i,s))};function ag(t,e,n,i){return i?!!(e==="innerHTML"||e==="textContent"||e in t&&tu.test(e)&&nt(n)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA"||tu.test(e)&&zt(n)?!1:e in t}const gi="transition",So="animation",Jc=(t,{slots:e})=>Kc(Sf,lg(t),e);Jc.displayName="Transition";const Yf={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};Jc.props=jt({},Sf.props,Yf);const ji=(t,e=[])=>{He(t)?t.forEach(n=>n(...e)):t&&t(...e)},nu=t=>t?He(t)?t.some(e=>e.length>1):t.length>1:!1;function lg(t){const e={};for(const O in t)O in Yf||(e[O]=t[O]);if(t.css===!1)return e;const{name:n="v",type:i,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:r=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:d=r,appearToClass:u=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:m=`${n}-leave-to`}=t,b=cg(s),y=b&&b[0],_=b&&b[1],{onBeforeEnter:p,onEnter:T,onEnterCancelled:w,onLeave:S,onLeaveCancelled:I,onBeforeAppear:P=p,onAppear:D=T,onAppearCancelled:R=w}=e,E=(O,H,j)=>{Yi(O,H?u:a),Yi(O,H?d:r),j&&j()},g=(O,H)=>{O._isLeaving=!1,Yi(O,f),Yi(O,m),Yi(O,h),H&&H()},L=O=>(H,j)=>{const re=O?D:T,q=()=>E(H,O,j);ji(re,[H,q]),iu(()=>{Yi(H,O?l:o),vi(H,O?u:a),nu(re)||su(H,i,y,q)})};return jt(e,{onBeforeEnter(O){ji(p,[O]),vi(O,o),vi(O,r)},onBeforeAppear(O){ji(P,[O]),vi(O,l),vi(O,d)},onEnter:L(!1),onAppear:L(!0),onLeave(O,H){O._isLeaving=!0;const j=()=>g(O,H);vi(O,f),hg(),vi(O,h),iu(()=>{!O._isLeaving||(Yi(O,f),vi(O,m),nu(S)||su(O,i,_,j))}),ji(S,[O,j])},onEnterCancelled(O){E(O,!1),ji(w,[O])},onAppearCancelled(O){E(O,!0),ji(R,[O])},onLeaveCancelled(O){g(O),ji(I,[O])}})}function cg(t){if(t==null)return null;if(Lt(t))return[Wa(t.enter),Wa(t.leave)];{const e=Wa(t);return[e,e]}}function Wa(t){return Zo(t)}function vi(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.add(n)),(t._vtc||(t._vtc=new Set)).add(e)}function Yi(t,e){e.split(/\s+/).forEach(i=>i&&t.classList.remove(i));const{_vtc:n}=t;n&&(n.delete(e),n.size||(t._vtc=void 0))}function iu(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let dg=0;function su(t,e,n,i){const s=t._endId=++dg,o=()=>{s===t._endId&&i()};if(n)return setTimeout(o,n);const{type:r,timeout:a,propCount:l}=ug(t,e);if(!r)return i();const d=r+"end";let u=0;const f=()=>{t.removeEventListener(d,h),o()},h=m=>{m.target===t&&++u>=l&&f()};setTimeout(()=>{u<l&&f()},a+1),t.addEventListener(d,h)}function ug(t,e){const n=window.getComputedStyle(t),i=b=>(n[b]||"").split(", "),s=i(gi+"Delay"),o=i(gi+"Duration"),r=ou(s,o),a=i(So+"Delay"),l=i(So+"Duration"),d=ou(a,l);let u=null,f=0,h=0;e===gi?r>0&&(u=gi,f=r,h=o.length):e===So?d>0&&(u=So,f=d,h=l.length):(f=Math.max(r,d),u=f>0?r>d?gi:So:null,h=u?u===gi?o.length:l.length:0);const m=u===gi&&/\b(transform|all)(,|$)/.test(n[gi+"Property"]);return{type:u,timeout:f,propCount:h,hasTransform:m}}function ou(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((n,i)=>ru(n)+ru(t[i])))}function ru(t){return Number(t.slice(0,-1).replace(",","."))*1e3}function hg(){return document.body.offsetHeight}const to=t=>{const e=t.props["onUpdate:modelValue"]||!1;return He(e)?n=>qr(e,n):e};function fg(t){t.target.composing=!0}function au(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const _e={created(t,{modifiers:{lazy:e,trim:n,number:i}},s){t._assign=to(s);const o=i||s.props&&s.props.type==="number";Ii(t,e?"change":"input",r=>{if(r.target.composing)return;let a=t.value;n&&(a=a.trim()),o&&(a=Zo(a)),t._assign(a)}),n&&Ii(t,"change",()=>{t.value=t.value.trim()}),e||(Ii(t,"compositionstart",fg),Ii(t,"compositionend",au),Ii(t,"change",au))},mounted(t,{value:e}){t.value=e==null?"":e},beforeUpdate(t,{value:e,modifiers:{lazy:n,trim:i,number:s}},o){if(t._assign=to(o),t.composing||document.activeElement===t&&t.type!=="range"&&(n||i&&t.value.trim()===e||(s||t.type==="number")&&Zo(t.value)===e))return;const r=e==null?"":e;t.value!==r&&(t.value=r)}},Zn={deep:!0,created(t,e,n){t._assign=to(n),Ii(t,"change",()=>{const i=t._modelValue,s=nr(t),o=t.checked,r=t._assign;if(He(i)){const a=Fc(i,s),l=a!==-1;if(o&&!l)r(i.concat(s));else if(!o&&l){const d=[...i];d.splice(a,1),r(d)}}else if(ho(i)){const a=new Set(i);o?a.add(s):a.delete(s),r(a)}else r(qf(t,o))})},mounted:lu,beforeUpdate(t,e,n){t._assign=to(n),lu(t,e,n)}};function lu(t,{value:e,oldValue:n},i){t._modelValue=e,He(e)?t.checked=Fc(e,i.props.value)>-1:ho(e)?t.checked=e.has(i.props.value):e!==n&&(t.checked=lr(e,qf(t,!0)))}const Kn={deep:!0,created(t,{value:e,modifiers:{number:n}},i){const s=ho(e);Ii(t,"change",()=>{const o=Array.prototype.filter.call(t.options,r=>r.selected).map(r=>n?Zo(nr(r)):nr(r));t._assign(t.multiple?s?new Set(o):o:o[0])}),t._assign=to(i)},mounted(t,{value:e}){cu(t,e)},beforeUpdate(t,e,n){t._assign=to(n)},updated(t,{value:e}){cu(t,e)}};function cu(t,e){const n=t.multiple;if(!(n&&!He(e)&&!ho(e))){for(let i=0,s=t.options.length;i<s;i++){const o=t.options[i],r=nr(o);if(n)He(e)?o.selected=Fc(e,r)>-1:o.selected=e.has(r);else if(lr(nr(o),e)){t.selectedIndex!==i&&(t.selectedIndex=i);return}}!n&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function nr(t){return"_value"in t?t._value:t.value}function qf(t,e){const n=e?"_trueValue":"_falseValue";return n in t?t[n]:e}const pg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Zf=(t,e)=>n=>{if(!("key"in n))return;const i=bs(n.key);if(e.some(s=>s===i||pg[s]===i))return t(n)},an={beforeMount(t,{value:e},{transition:n}){t._vod=t.style.display==="none"?"":t.style.display,n&&e?n.beforeEnter(t):Mo(t,e)},mounted(t,{value:e},{transition:n}){n&&e&&n.enter(t)},updated(t,{value:e,oldValue:n},{transition:i}){!e!=!n&&(i?e?(i.beforeEnter(t),Mo(t,!0),i.enter(t)):i.leave(t,()=>{Mo(t,!1)}):Mo(t,e))},beforeUnmount(t,{value:e}){Mo(t,e)}};function Mo(t,e){t.style.display=e?t._vod:"none"}const mg=jt({patchProp:rg},W_);let du;function _g(){return du||(du=C_(mg))}const gg=(...t)=>{const e=_g().createApp(...t),{mount:n}=e;return e.mount=i=>{const s=vg(i);if(!s)return;const o=e._component;!nt(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.innerHTML="";const r=n(s,!1,s instanceof SVGElement);return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),r},e};function vg(t){return zt(t)?document.querySelector(t):t}/*!
- * vue-router v4.0.16
- * (c) 2022 Eduardo San Martin Morote
- * @license MIT
- */const Kf=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",_o=t=>Kf?Symbol(t):"_vr_"+t,bg=_o("rvlm"),uu=_o("rvd"),Qc=_o("r"),Jf=_o("rl"),Gl=_o("rvl"),Hs=typeof window!="undefined";function yg(t){return t.__esModule||Kf&&t[Symbol.toStringTag]==="Module"}const St=Object.assign;function Xa(t,e){const n={};for(const i in e){const s=e[i];n[i]=Array.isArray(s)?s.map(t):t(s)}return n}const Go=()=>{},xg=/\/$/,Sg=t=>t.replace(xg,"");function ja(t,e,n="/"){let i,s={},o="",r="";const a=e.indexOf("?"),l=e.indexOf("#",a>-1?a:0);return a>-1&&(i=e.slice(0,a),o=e.slice(a+1,l>-1?l:e.length),s=t(o)),l>-1&&(i=i||e.slice(0,l),r=e.slice(l,e.length)),i=Tg(i!=null?i:e,n),{fullPath:i+(o&&"?")+o+r,path:i,query:s,hash:r}}function Mg(t,e){const n=e.query?t(e.query):"";return e.path+(n&&"?")+n+(e.hash||"")}function hu(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function Eg(t,e,n){const i=e.matched.length-1,s=n.matched.length-1;return i>-1&&i===s&&no(e.matched[i],n.matched[s])&&Qf(e.params,n.params)&&t(e.query)===t(n.query)&&e.hash===n.hash}function no(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Qf(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(!wg(t[n],e[n]))return!1;return!0}function wg(t,e){return Array.isArray(t)?fu(t,e):Array.isArray(e)?fu(e,t):t===e}function fu(t,e){return Array.isArray(e)?t.length===e.length&&t.every((n,i)=>n===e[i]):t.length===1&&t[0]===e}function Tg(t,e){if(t.startsWith("/"))return t;if(!t)return e;const n=e.split("/"),i=t.split("/");let s=n.length-1,o,r;for(o=0;o<i.length;o++)if(r=i[o],!(s===1||r==="."))if(r==="..")s--;else break;return n.slice(0,s).join("/")+"/"+i.slice(o-(o===i.length?1:0)).join("/")}var ir;(function(t){t.pop="pop",t.push="push"})(ir||(ir={}));var Wo;(function(t){t.back="back",t.forward="forward",t.unknown=""})(Wo||(Wo={}));function Cg(t){if(!t)if(Hs){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),Sg(t)}const Ag=/^[^#]+#/;function Pg(t,e){return t.replace(Ag,"#")+e}function Rg(t,e){const n=document.documentElement.getBoundingClientRect(),i=t.getBoundingClientRect();return{behavior:e.behavior,left:i.left-n.left-(e.left||0),top:i.top-n.top-(e.top||0)}}const Ra=()=>({left:window.pageXOffset,top:window.pageYOffset});function Dg(t){let e;if("el"in t){const n=t.el,i=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?i?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;e=Rg(s,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.pageXOffset,e.top!=null?e.top:window.pageYOffset)}function pu(t,e){return(history.state?history.state.position-e:-1)+t}const Wl=new Map;function Ig(t,e){Wl.set(t,e)}function Lg(t){const e=Wl.get(t);return Wl.delete(t),e}let Ug=()=>location.protocol+"//"+location.host;function ep(t,e){const{pathname:n,search:i,hash:s}=e,o=t.indexOf("#");if(o>-1){let a=s.includes(t.slice(o))?t.slice(o).length:1,l=s.slice(a);return l[0]!=="/"&&(l="/"+l),hu(l,"")}return hu(n,t)+i+s}function Fg(t,e,n,i){let s=[],o=[],r=null;const a=({state:h})=>{const m=ep(t,location),b=n.value,y=e.value;let _=0;if(h){if(n.value=m,e.value=h,r&&r===b){r=null;return}_=y?h.position-y.position:0}else i(m);s.forEach(p=>{p(n.value,b,{delta:_,type:ir.pop,direction:_?_>0?Wo.forward:Wo.back:Wo.unknown})})};function l(){r=n.value}function d(h){s.push(h);const m=()=>{const b=s.indexOf(h);b>-1&&s.splice(b,1)};return o.push(m),m}function u(){const{history:h}=window;!h.state||h.replaceState(St({},h.state,{scroll:Ra()}),"")}function f(){for(const h of o)h();o=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u),{pauseListeners:l,listen:d,destroy:f}}function mu(t,e,n,i=!1,s=!1){return{back:t,current:e,forward:n,replaced:i,position:window.history.length,scroll:s?Ra():null}}function Og(t){const{history:e,location:n}=window,i={value:ep(t,n)},s={value:e.state};s.value||o(i.value,{back:null,current:i.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(l,d,u){const f=t.indexOf("#"),h=f>-1?(n.host&&document.querySelector("base")?t:t.slice(f))+l:Ug()+t+l;try{e[u?"replaceState":"pushState"](d,"",h),s.value=d}catch(m){console.error(m),n[u?"replace":"assign"](h)}}function r(l,d){const u=St({},e.state,mu(s.value.back,l,s.value.forward,!0),d,{position:s.value.position});o(l,u,!0),i.value=l}function a(l,d){const u=St({},s.value,e.state,{forward:l,scroll:Ra()});o(u.current,u,!0);const f=St({},mu(i.value,l,null),{position:u.position+1},d);o(l,f,!1),i.value=l}return{location:i,state:s,push:a,replace:r}}function Ng(t){t=Cg(t);const e=Og(t),n=Fg(t,e.state,e.location,e.replace);function i(o,r=!0){r||n.pauseListeners(),history.go(o)}const s=St({location:"",base:t,go:i,createHref:Pg.bind(null,t)},e,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}function zg(t){return t=location.host?t||location.pathname+location.search:"",t.includes("#")||(t+="#"),Ng(t)}function kg(t){return typeof t=="string"||t&&typeof t=="object"}function tp(t){return typeof t=="string"||typeof t=="symbol"}const bi={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},np=_o("nf");var _u;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(_u||(_u={}));function io(t,e){return St(new Error,{type:t,[np]:!0},e)}function yi(t,e){return t instanceof Error&&np in t&&(e==null||!!(t.type&e))}const gu="[^/]+?",Bg={sensitive:!1,strict:!1,start:!0,end:!0},Vg=/[.+*?^${}()[\]/\\]/g;function Hg(t,e){const n=St({},Bg,e),i=[];let s=n.start?"^":"";const o=[];for(const d of t){const u=d.length?[]:[90];n.strict&&!d.length&&(s+="/");for(let f=0;f<d.length;f++){const h=d[f];let m=40+(n.sensitive?.25:0);if(h.type===0)f||(s+="/"),s+=h.value.replace(Vg,"\\$&"),m+=40;else if(h.type===1){const{value:b,repeatable:y,optional:_,regexp:p}=h;o.push({name:b,repeatable:y,optional:_});const T=p||gu;if(T!==gu){m+=10;try{new RegExp(`(${T})`)}catch(S){throw new Error(`Invalid custom RegExp for param "${b}" (${T}): `+S.message)}}let w=y?`((?:${T})(?:/(?:${T}))*)`:`(${T})`;f||(w=_&&d.length<2?`(?:/${w})`:"/"+w),_&&(w+="?"),s+=w,m+=20,_&&(m+=-8),y&&(m+=-20),T===".*"&&(m+=-50)}u.push(m)}i.push(u)}if(n.strict&&n.end){const d=i.length-1;i[d][i[d].length-1]+=.7000000000000001}n.strict||(s+="/?"),n.end?s+="$":n.strict&&(s+="(?:/|$)");const r=new RegExp(s,n.sensitive?"":"i");function a(d){const u=d.match(r),f={};if(!u)return null;for(let h=1;h<u.length;h++){const m=u[h]||"",b=o[h-1];f[b.name]=m&&b.repeatable?m.split("/"):m}return f}function l(d){let u="",f=!1;for(const h of t){(!f||!u.endsWith("/"))&&(u+="/"),f=!1;for(const m of h)if(m.type===0)u+=m.value;else if(m.type===1){const{value:b,repeatable:y,optional:_}=m,p=b in d?d[b]:"";if(Array.isArray(p)&&!y)throw new Error(`Provided param "${b}" is an array but it is not repeatable (* or + modifiers)`);const T=Array.isArray(p)?p.join("/"):p;if(!T)if(_)h.length<2&&t.length>1&&(u.endsWith("/")?u=u.slice(0,-1):f=!0);else throw new Error(`Missing required param "${b}"`);u+=T}}return u}return{re:r,score:i,keys:o,parse:a,stringify:l}}function $g(t,e){let n=0;for(;n<t.length&&n<e.length;){const i=e[n]-t[n];if(i)return i;n++}return t.length<e.length?t.length===1&&t[0]===40+40?-1:1:t.length>e.length?e.length===1&&e[0]===40+40?1:-1:0}function Gg(t,e){let n=0;const i=t.score,s=e.score;for(;n<i.length&&n<s.length;){const o=$g(i[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-i.length)===1){if(vu(i))return 1;if(vu(s))return-1}return s.length-i.length}function vu(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Wg={type:0,value:""},Xg=/[a-zA-Z0-9_]/;function jg(t){if(!t)return[[]];if(t==="/")return[[Wg]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(m){throw new Error(`ERR (${n})/"${d}": ${m}`)}let n=0,i=n;const s=[];let o;function r(){o&&s.push(o),o=[]}let a=0,l,d="",u="";function f(){!d||(n===0?o.push({type:0,value:d}):n===1||n===2||n===3?(o.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:d,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),d="")}function h(){d+=l}for(;a<t.length;){if(l=t[a++],l==="\\"&&n!==2){i=n,n=4;continue}switch(n){case 0:l==="/"?(d&&f(),r()):l===":"?(f(),n=1):h();break;case 4:h(),n=i;break;case 1:l==="("?n=2:Xg.test(l)?h():(f(),n=0,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case 2:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=3:u+=l;break;case 3:f(),n=0,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return n===2&&e(`Unfinished custom RegExp for param "${d}"`),f(),r(),s}function Yg(t,e,n){const i=Hg(jg(t.path),n),s=St(i,{record:t,parent:e,children:[],alias:[]});return e&&!s.record.aliasOf==!e.record.aliasOf&&e.children.push(s),s}function qg(t,e){const n=[],i=new Map;e=yu({strict:!1,end:!0,sensitive:!1},e);function s(u){return i.get(u)}function o(u,f,h){const m=!h,b=Kg(u);b.aliasOf=h&&h.record;const y=yu(e,u),_=[b];if("alias"in u){const w=typeof u.alias=="string"?[u.alias]:u.alias;for(const S of w)_.push(St({},b,{components:h?h.record.components:b.components,path:S,aliasOf:h?h.record:b}))}let p,T;for(const w of _){const{path:S}=w;if(f&&S[0]!=="/"){const I=f.record.path,P=I[I.length-1]==="/"?"":"/";w.path=f.record.path+(S&&P+S)}if(p=Yg(w,f,y),h?h.alias.push(p):(T=T||p,T!==p&&T.alias.push(p),m&&u.name&&!bu(p)&&r(u.name)),"children"in b){const I=b.children;for(let P=0;P<I.length;P++)o(I[P],p,h&&h.children[P])}h=h||p,l(p)}return T?()=>{r(T)}:Go}function r(u){if(tp(u)){const f=i.get(u);f&&(i.delete(u),n.splice(n.indexOf(f),1),f.children.forEach(r),f.alias.forEach(r))}else{const f=n.indexOf(u);f>-1&&(n.splice(f,1),u.record.name&&i.delete(u.record.name),u.children.forEach(r),u.alias.forEach(r))}}function a(){return n}function l(u){let f=0;for(;f<n.length&&Gg(u,n[f])>=0&&(u.record.path!==n[f].record.path||!ip(u,n[f]));)f++;n.splice(f,0,u),u.record.name&&!bu(u)&&i.set(u.record.name,u)}function d(u,f){let h,m={},b,y;if("name"in u&&u.name){if(h=i.get(u.name),!h)throw io(1,{location:u});y=h.record.name,m=St(Zg(f.params,h.keys.filter(T=>!T.optional).map(T=>T.name)),u.params),b=h.stringify(m)}else if("path"in u)b=u.path,h=n.find(T=>T.re.test(b)),h&&(m=h.parse(b),y=h.record.name);else{if(h=f.name?i.get(f.name):n.find(T=>T.re.test(f.path)),!h)throw io(1,{location:u,currentLocation:f});y=h.record.name,m=St({},f.params,u.params),b=h.stringify(m)}const _=[];let p=h;for(;p;)_.unshift(p.record),p=p.parent;return{name:y,path:b,params:m,matched:_,meta:Qg(_)}}return t.forEach(u=>o(u)),{addRoute:o,resolve:d,removeRoute:r,getRoutes:a,getRecordMatcher:s}}function Zg(t,e){const n={};for(const i of e)i in t&&(n[i]=t[i]);return n}function Kg(t){return{path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:void 0,beforeEnter:t.beforeEnter,props:Jg(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||{}:{default:t.component}}}function Jg(t){const e={},n=t.props||!1;if("component"in t)e.default=n;else for(const i in t.components)e[i]=typeof n=="boolean"?n:n[i];return e}function bu(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function Qg(t){return t.reduce((e,n)=>St(e,n.meta),{})}function yu(t,e){const n={};for(const i in t)n[i]=i in e?e[i]:t[i];return n}function ip(t,e){return e.children.some(n=>n===t||ip(t,n))}const sp=/#/g,e0=/&/g,t0=/\//g,n0=/=/g,i0=/\?/g,op=/\+/g,s0=/%5B/g,o0=/%5D/g,rp=/%5E/g,r0=/%60/g,ap=/%7B/g,a0=/%7C/g,lp=/%7D/g,l0=/%20/g;function ed(t){return encodeURI(""+t).replace(a0,"|").replace(s0,"[").replace(o0,"]")}function c0(t){return ed(t).replace(ap,"{").replace(lp,"}").replace(rp,"^")}function Xl(t){return ed(t).replace(op,"%2B").replace(l0,"+").replace(sp,"%23").replace(e0,"%26").replace(r0,"`").replace(ap,"{").replace(lp,"}").replace(rp,"^")}function d0(t){return Xl(t).replace(n0,"%3D")}function u0(t){return ed(t).replace(sp,"%23").replace(i0,"%3F")}function h0(t){return t==null?"":u0(t).replace(t0,"%2F")}function ha(t){try{return decodeURIComponent(""+t)}catch{}return""+t}function f0(t){const e={};if(t===""||t==="?")return e;const i=(t[0]==="?"?t.slice(1):t).split("&");for(let s=0;s<i.length;++s){const o=i[s].replace(op," "),r=o.indexOf("="),a=ha(r<0?o:o.slice(0,r)),l=r<0?null:ha(o.slice(r+1));if(a in e){let d=e[a];Array.isArray(d)||(d=e[a]=[d]),d.push(l)}else e[a]=l}return e}function xu(t){let e="";for(let n in t){const i=t[n];if(n=d0(n),i==null){i!==void 0&&(e+=(e.length?"&":"")+n);continue}(Array.isArray(i)?i.map(o=>o&&Xl(o)):[i&&Xl(i)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+n,o!=null&&(e+="="+o))})}return e}function p0(t){const e={};for(const n in t){const i=t[n];i!==void 0&&(e[n]=Array.isArray(i)?i.map(s=>s==null?null:""+s):i==null?i:""+i)}return e}function Eo(){let t=[];function e(i){return t.push(i),()=>{const s=t.indexOf(i);s>-1&&t.splice(s,1)}}function n(){t=[]}return{add:e,list:()=>t,reset:n}}function Ri(t,e,n,i,s){const o=i&&(i.enterCallbacks[s]=i.enterCallbacks[s]||[]);return()=>new Promise((r,a)=>{const l=f=>{f===!1?a(io(4,{from:n,to:e})):f instanceof Error?a(f):kg(f)?a(io(2,{from:e,to:f})):(o&&i.enterCallbacks[s]===o&&typeof f=="function"&&o.push(f),r())},d=t.call(i&&i.instances[s],e,n,l);let u=Promise.resolve(d);t.length<3&&(u=u.then(l)),u.catch(f=>a(f))})}function Ya(t,e,n,i){const s=[];for(const o of t)for(const r in o.components){let a=o.components[r];if(!(e!=="beforeRouteEnter"&&!o.instances[r]))if(m0(a)){const d=(a.__vccOpts||a)[e];d&&s.push(Ri(d,n,i,o,r))}else{let l=a();s.push(()=>l.then(d=>{if(!d)return Promise.reject(new Error(`Couldn't resolve component "${r}" at "${o.path}"`));const u=yg(d)?d.default:d;o.components[r]=u;const h=(u.__vccOpts||u)[e];return h&&Ri(h,n,i,o,r)()}))}}return s}function m0(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Su(t){const e=Oi(Qc),n=Oi(Jf),i=Yn(()=>e.resolve(zo(t.to))),s=Yn(()=>{const{matched:l}=i.value,{length:d}=l,u=l[d-1],f=n.matched;if(!u||!f.length)return-1;const h=f.findIndex(no.bind(null,u));if(h>-1)return h;const m=Mu(l[d-2]);return d>1&&Mu(u)===m&&f[f.length-1].path!==m?f.findIndex(no.bind(null,l[d-2])):h}),o=Yn(()=>s.value>-1&&b0(n.params,i.value.params)),r=Yn(()=>s.value>-1&&s.value===n.matched.length-1&&Qf(n.params,i.value.params));function a(l={}){return v0(l)?e[zo(t.replace)?"replace":"push"](zo(t.to)).catch(Go):Promise.resolve()}return{route:i,href:Yn(()=>i.value.href),isActive:o,isExactActive:r,navigate:a}}const _0=mo({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Su,setup(t,{slots:e}){const n=dr(Su(t)),{options:i}=Oi(Qc),s=Yn(()=>({[Eu(t.activeClass,i.linkActiveClass,"router-link-active")]:n.isActive,[Eu(t.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=e.default&&e.default(n);return t.custom?o:Kc("a",{"aria-current":n.isExactActive?t.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),g0=_0;function v0(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function b0(t,e){for(const n in e){const i=e[n],s=t[n];if(typeof i=="string"){if(i!==s)return!1}else if(!Array.isArray(s)||s.length!==i.length||i.some((o,r)=>o!==s[r]))return!1}return!0}function Mu(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Eu=(t,e,n)=>t!=null?t:e!=null?e:n,y0=mo({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:n}){const i=Oi(Gl),s=Yn(()=>t.route||i.value),o=Oi(uu,0),r=Yn(()=>s.value.matched[o]);Zr(uu,o+1),Zr(bg,r),Zr(Gl,s);const a=lf();return Vo(()=>[a.value,r.value,t.name],([l,d,u],[f,h,m])=>{d&&(d.instances[u]=l,h&&h!==d&&l&&l===f&&(d.leaveGuards.size||(d.leaveGuards=h.leaveGuards),d.updateGuards.size||(d.updateGuards=h.updateGuards))),l&&d&&(!h||!no(d,h)||!f)&&(d.enterCallbacks[u]||[]).forEach(b=>b(l))},{flush:"post"}),()=>{const l=s.value,d=r.value,u=d&&d.components[t.name],f=t.name;if(!u)return wu(n.default,{Component:u,route:l});const h=d.props[t.name],m=h?h===!0?l.params:typeof h=="function"?h(l):h:null,y=Kc(u,St({},m,e,{onVnodeUnmounted:_=>{_.component.isUnmounted&&(d.instances[f]=null)},ref:a}));return wu(n.default,{Component:y,route:l})||y}}});function wu(t,e){if(!t)return null;const n=t(e);return n.length===1?n[0]:n}const x0=y0;function S0(t){const e=qg(t.routes,t),n=t.parseQuery||f0,i=t.stringifyQuery||xu,s=t.history,o=Eo(),r=Eo(),a=Eo(),l=cf(bi);let d=bi;Hs&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Xa.bind(null,N=>""+N),f=Xa.bind(null,h0),h=Xa.bind(null,ha);function m(N,le){let Y,ue;return tp(N)?(Y=e.getRecordMatcher(N),ue=le):ue=N,e.addRoute(ue,Y)}function b(N){const le=e.getRecordMatcher(N);le&&e.removeRoute(le)}function y(){return e.getRoutes().map(N=>N.record)}function _(N){return!!e.getRecordMatcher(N)}function p(N,le){if(le=St({},le||l.value),typeof N=="string"){const Ue=ja(n,N,le.path),A=e.resolve({path:Ue.path},le),x=s.createHref(Ue.fullPath);return St(Ue,A,{params:h(A.params),hash:ha(Ue.hash),redirectedFrom:void 0,href:x})}let Y;if("path"in N)Y=St({},N,{path:ja(n,N.path,le.path).path});else{const Ue=St({},N.params);for(const A in Ue)Ue[A]==null&&delete Ue[A];Y=St({},N,{params:f(N.params)}),le.params=f(le.params)}const ue=e.resolve(Y,le),Oe=N.hash||"";ue.params=u(h(ue.params));const Se=Mg(i,St({},N,{hash:c0(Oe),path:ue.path})),Ne=s.createHref(Se);return St({fullPath:Se,hash:Oe,query:i===xu?p0(N.query):N.query||{}},ue,{redirectedFrom:void 0,href:Ne})}function T(N){return typeof N=="string"?ja(n,N,l.value.path):St({},N)}function w(N,le){if(d!==N)return io(8,{from:le,to:N})}function S(N){return D(N)}function I(N){return S(St(T(N),{replace:!0}))}function P(N){const le=N.matched[N.matched.length-1];if(le&&le.redirect){const{redirect:Y}=le;let ue=typeof Y=="function"?Y(N):Y;return typeof ue=="string"&&(ue=ue.includes("?")||ue.includes("#")?ue=T(ue):{path:ue},ue.params={}),St({query:N.query,hash:N.hash,params:N.params},ue)}}function D(N,le){const Y=d=p(N),ue=l.value,Oe=N.state,Se=N.force,Ne=N.replace===!0,Ue=P(Y);if(Ue)return D(St(T(Ue),{state:Oe,force:Se,replace:Ne}),le||Y);const A=Y;A.redirectedFrom=le;let x;return!Se&&Eg(i,ue,Y)&&(x=io(16,{to:A,from:ue}),ye(ue,ue,!0,!1)),(x?Promise.resolve(x):E(A,ue)).catch(Z=>yi(Z)?yi(Z,2)?Z:fe(Z):ae(Z,A,ue)).then(Z=>{if(Z){if(yi(Z,2))return D(St(T(Z.to),{state:Oe,force:Se,replace:Ne}),le||A)}else Z=L(A,ue,!0,Ne,Oe);return g(A,ue,Z),Z})}function R(N,le){const Y=w(N,le);return Y?Promise.reject(Y):Promise.resolve()}function E(N,le){let Y;const[ue,Oe,Se]=M0(N,le);Y=Ya(ue.reverse(),"beforeRouteLeave",N,le);for(const Ue of ue)Ue.leaveGuards.forEach(A=>{Y.push(Ri(A,N,le))});const Ne=R.bind(null,N,le);return Y.push(Ne),ws(Y).then(()=>{Y=[];for(const Ue of o.list())Y.push(Ri(Ue,N,le));return Y.push(Ne),ws(Y)}).then(()=>{Y=Ya(Oe,"beforeRouteUpdate",N,le);for(const Ue of Oe)Ue.updateGuards.forEach(A=>{Y.push(Ri(A,N,le))});return Y.push(Ne),ws(Y)}).then(()=>{Y=[];for(const Ue of N.matched)if(Ue.beforeEnter&&!le.matched.includes(Ue))if(Array.isArray(Ue.beforeEnter))for(const A of Ue.beforeEnter)Y.push(Ri(A,N,le));else Y.push(Ri(Ue.beforeEnter,N,le));return Y.push(Ne),ws(Y)}).then(()=>(N.matched.forEach(Ue=>Ue.enterCallbacks={}),Y=Ya(Se,"beforeRouteEnter",N,le),Y.push(Ne),ws(Y))).then(()=>{Y=[];for(const Ue of r.list())Y.push(Ri(Ue,N,le));return Y.push(Ne),ws(Y)}).catch(Ue=>yi(Ue,8)?Ue:Promise.reject(Ue))}function g(N,le,Y){for(const ue of a.list())ue(N,le,Y)}function L(N,le,Y,ue,Oe){const Se=w(N,le);if(Se)return Se;const Ne=le===bi,Ue=Hs?history.state:{};Y&&(ue||Ne?s.replace(N.fullPath,St({scroll:Ne&&Ue&&Ue.scroll},Oe)):s.push(N.fullPath,Oe)),l.value=N,ye(N,le,Y,Ne),fe()}let O;function H(){O||(O=s.listen((N,le,Y)=>{const ue=p(N),Oe=P(ue);if(Oe){D(St(Oe,{replace:!0}),ue).catch(Go);return}d=ue;const Se=l.value;Hs&&Ig(pu(Se.fullPath,Y.delta),Ra()),E(ue,Se).catch(Ne=>yi(Ne,12)?Ne:yi(Ne,2)?(D(Ne.to,ue).then(Ue=>{yi(Ue,20)&&!Y.delta&&Y.type===ir.pop&&s.go(-1,!1)}).catch(Go),Promise.reject()):(Y.delta&&s.go(-Y.delta,!1),ae(Ne,ue,Se))).then(Ne=>{Ne=Ne||L(ue,Se,!1),Ne&&(Y.delta?s.go(-Y.delta,!1):Y.type===ir.pop&&yi(Ne,20)&&s.go(-1,!1)),g(ue,Se,Ne)}).catch(Go)}))}let j=Eo(),re=Eo(),q;function ae(N,le,Y){fe(N);const ue=re.list();return ue.length?ue.forEach(Oe=>Oe(N,le,Y)):console.error(N),Promise.reject(N)}function G(){return q&&l.value!==bi?Promise.resolve():new Promise((N,le)=>{j.add([N,le])})}function fe(N){return q||(q=!N,H(),j.list().forEach(([le,Y])=>N?Y(N):le()),j.reset()),N}function ye(N,le,Y,ue){const{scrollBehavior:Oe}=t;if(!Hs||!Oe)return Promise.resolve();const Se=!Y&&Lg(pu(N.fullPath,0))||(ue||!Y)&&history.state&&history.state.scroll||null;return ff().then(()=>Oe(N,le,Se)).then(Ne=>Ne&&Dg(Ne)).catch(Ne=>ae(Ne,N,le))}const Re=N=>s.go(N);let Be;const Je=new Set;return{currentRoute:l,addRoute:m,removeRoute:b,hasRoute:_,getRoutes:y,resolve:p,options:t,push:S,replace:I,go:Re,back:()=>Re(-1),forward:()=>Re(1),beforeEach:o.add,beforeResolve:r.add,afterEach:a.add,onError:re.add,isReady:G,install(N){const le=this;N.component("RouterLink",g0),N.component("RouterView",x0),N.config.globalProperties.$router=le,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>zo(l)}),Hs&&!Be&&l.value===bi&&(Be=!0,S(s.location).catch(Oe=>{}));const Y={};for(const Oe in bi)Y[Oe]=Yn(()=>l.value[Oe]);N.provide(Qc,le),N.provide(Jf,dr(Y)),N.provide(Gl,l);const ue=N.unmount;Je.add(N),N.unmount=function(){Je.delete(N),Je.size<1&&(d=bi,O&&O(),O=null,l.value=bi,Be=!1,q=!1),ue()}}}}function ws(t){return t.reduce((e,n)=>e.then(()=>n()),Promise.resolve())}function M0(t,e){const n=[],i=[],s=[],o=Math.max(e.matched.length,t.matched.length);for(let r=0;r<o;r++){const a=e.matched[r];a&&(t.matched.find(d=>no(d,a))?i.push(a):n.push(a));const l=t.matched[r];l&&(e.matched.find(d=>no(d,l))||s.push(l))}return[n,i,s]}class E0{constructor(e,n,i){this.onConnect=n,this.onDisconnect=i,this.options=e,this.port=null,this.isOpened=!1,this.setupListeners()}async open(){try{const e=await navigator.serial.requestPort();return await e.open(this.options),this.port=e,this.isOpened=!0,this.port.getInfo()}catch(e){throw console.error(e),e}}async close(){await this.port.close(),this.isOpened=!1}async write(e){if(this.port.writable){let n=this.port.writable.getWriter();await n.write(e),n.releaseLock()}}async read(){let e=new TextDecoder;for(;this.port.readable;){if(this.port.readable.locked==!0)return new Uint8Array(0);let n=this.port.readable.getReader(),i,s=0;try{for(;;){let{value:o,done:r}=await n.read();s=s+o.length,typeof i=="undefined"?i=o:i=new Uint8Array([...i,...o]);let a=e.decode(i);if(a.includes("ok")||a.includes("error")||a.includes("ALARM")||r){n.releaseLock();break}}return i.length>2048?i.slice(i.length-2048):i}catch(o){throw console.error(o),o}finally{n.releaseLock()}}}setupListeners(){navigator.serial.addEventListener("connect",this.onConnect),navigator.serial.addEventListener("disconnect",this.onDisconnect)}}var ct=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n};const w0={data(){return{serialPortHandler:this.serialPortHandler,lastMessage:""}},computed:{isOpened(){return this.serialPortHandler?this.serialPortHandler.isOpened==!0:!1}},methods:{async connect(){try{if(this.serialPortHandler.isOpened)return;const t=await this.serialPortHandler.open();this.lastMessage=""}catch(t){console.log(t),this.lastMessage="Failed to open serial port"}},disconnect(){if(this.serialPortHandler.isOpened){let t=0;for(;(this.serialPortHandler.port.readable.locked||this.serialPortHandler.port.writable.locked)&&(console.log("waiting..."),setTimeout(10),t++,!(t>10)););this.serialPortHandler.close()}}},mounted(){if(!("serial"in navigator)){this.lastMessage="Web Serial API is not supported in your browser",console.error(this.lastMessage);return}this.serialPortHandler=new E0({baudRate:115200},()=>{console.log("Device connected")},()=>{this.serialPortHandler.isOpened=!1,console.log("Device disconnected")})}},T0={class:"container"},C0={class:"navbar navbar-expand-lg navbar-light bg-light"},A0={class:"container-fluid"},P0=c("div",null,null,-1),R0={class:"text-danger p-1 m-0",role:"alert"},D0={key:0},I0={class:"row"},L0=c("div",{class:"col"},null,-1),U0={class:"col-auto text-center"},F0=["title"],O0={class:"col-auto"};function N0(t,e,n,i,s,o){const r=et("RouterView");return W(),ee("div",T0,[c("header",null,[c("nav",C0,[c("div",A0,[P0,c("div",R0,[s.lastMessage!=""?(W(),ee("span",D0,"\u26A0 "+ze(s.lastMessage),1)):st("",!0)]),c("div",null,[c("form",null,[c("div",I0,[L0,c("div",U0,[c("span",{class:je(o.isOpened==!0?"fs-4 text-success":"fs-4 text-secondary"),title:o.isOpened==!0?"Connected":"Disconnected"},"\u25CF \u2699",10,F0)]),c("div",O0,[o.isOpened==!1?(W(),ee("button",{key:0,type:"button",onClick:e[0]||(e[0]=a=>o.connect()),class:"btn btn-dark btn-sm"},"Connect")):st("",!0),o.isOpened==!0?(W(),ee("button",{key:1,type:"button",onClick:e[1]||(e[1]=a=>o.disconnect()),class:"btn btn-dark btn-sm"},"Disconnect")):st("",!0)])])])])])])]),ke(r)])}var z0=ct(w0,[["render",N0]]);const k0="modulepreload",Tu={},B0="/",V0=function(e,n){return!n||n.length===0?e():Promise.all(n.map(i=>{if(i=`${B0}${i}`,i in Tu)return;Tu[i]=!0;const s=i.endsWith(".css"),o=s?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${o}`))return;const r=document.createElement("link");if(r.rel=s?"stylesheet":k0,s||(r.as="script",r.crossOrigin=""),r.href=i,document.head.appendChild(r),s)return new Promise((a,l)=>{r.addEventListener("load",a),r.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>e())},H0={props:{state:Boolean}},$0={key:0,class:"badge bg-success"},G0={key:1,class:"badge bg-danger"};function W0(t,e,n,i,s,o){return W(),ee("span",null,[n.state==!0?(W(),ee("span",$0," On ")):(W(),ee("span",G0," Off "))])}var X0=ct(H0,[["render",W0]]);const j0={components:{OnOff:X0},props:{state:Object,pnpProcessing:Object,valvesState:Object,pumpState:Boolean},computed:{statusString(){return this.pnpProcessing.runFlag==!0?this.pnpProcessing.pauseFlag==!0?"Paused":"Job":this.state.status}}},Y0={class:"card"},q0=c("div",{class:"card-header"},"Controller state",-1),Z0={class:"card-body"},K0={class:"row"},J0={class:"col text-center"},Q0={class:"row"},ev=c("div",{class:"col-auto"},"X",-1),tv={class:"col text-end"},nv={class:"row"},iv=c("div",{class:"col-auto"},"Y",-1),sv={class:"col text-end"},ov={class:"row"},rv=c("div",{class:"col-auto"},"Z",-1),av={class:"col text-end"},lv={class:"row"},cv=c("div",{class:"col-auto"},"A",-1),dv={class:"col text-end"},uv={class:"row"},hv=c("div",{class:"col-auto"},"Pump",-1),fv={class:"col text-end"},pv={class:"row"},mv={class:"col-auto"},_v={class:"col text-end"};function gv(t,e,n,i,s,o){const r=et("OnOff");return W(),ee("div",Y0,[q0,c("div",Z0,[c("div",K0,[c("div",J0,[c("h3",{class:je("Status "+o.statusString)},ze(o.statusString),3)])]),c("div",Q0,[ev,c("div",tv,ze(n.state.pos.x),1)]),c("div",nv,[iv,c("div",sv,ze(n.state.pos.y),1)]),c("div",ov,[rv,c("div",av,ze(n.state.pos.z),1)]),c("div",lv,[cv,c("div",dv,ze(n.state.pos.a),1)]),c("div",uv,[hv,c("div",fv,[ke(r,{state:n.pumpState},null,8,["state"])])]),(W(!0),ee(rt,null,wt(n.valvesState,(a,l)=>(W(),ee("div",pv,[c("div",mv,"Valve "+ze(l+1),1),c("div",_v,[ke(r,{state:a},null,8,["state"])])]))),256))])])}var vv=ct(j0,[["render",gv]]);const bv={props:{disabled:Boolean,enabledUnderAlaram:Boolean,settings:Object,valvesState:Object,pumpState:Boolean,movingOptions:Object},data:function(){return{tab:0,valves:[!1,!1],pump:!1}},methods:{command(t){this.$emit("command",t)},togglePump(){this.$emit("togglePump")},toggleValve(t){this.$emit("toggleValve",t)},togglePosition(){this.$emit("toggleCamNozzlePosition")}},watch:{valvesState:{handler(t,e){this.valves=this.valvesState},deep:!0},pumpState:{handler(t,e){this.pump=this.pumpState},deep:!0}}},yv={class:"border p-3 mt-1"},xv={class:"nav nav-tabs"},Sv={class:"nav-item"},Mv={class:"nav-item"},Ev={key:0,class:"p-2"},wv={class:"row"},Tv={class:"col p-1"},Cv=["disabled"],Av={class:"col p-1"},Pv=["disabled"],Rv={class:"col p-1"},Dv=["disabled"],Iv={class:"col p-1"},Lv=["disabled"],Uv={class:"row"},Fv={class:"col p-1"},Ov=["disabled"],Nv={class:"col p-1 text-nowrap"},zv={class:"row p-0 m-0"},kv={class:"col p-0 m-0"},Bv=["disabled"],Vv=c("div",{class:"col-auto p-1 m-0"},null,-1),Hv={class:"col p-0 m-0"},$v=["disabled"],Gv={class:"col p-1"},Wv=["disabled"],Xv={class:"col p-1"},jv=["disabled"],Yv={class:"row"},qv={class:"col p-1"},Zv=["disabled"],Kv={class:"col p-1"},Jv=["disabled"],Qv={class:"col p-1"},eb=["disabled"],tb={class:"col p-1"},nb=["disabled"],ib={class:"row"},sb={class:"col p-1"},ob=Ie(" Step size XYZ (mm): "),rb={class:"row"},ab={class:"col p-1"},lb=Ie(" Feed rate XYZ: "),cb=c("hr",null,null,-1),db={class:"row"},ub={class:"col p-1"},hb=Ie(" Steps A (1.0 setep = 1 turn): "),fb={class:"row"},pb={class:"col p-1"},mb=Ie(" Feed rate A: "),_b={key:0,class:"row mt-4"},gb={class:"col p-1"},vb={class:"form-check form-switch"},bb=["disabled"],yb=c("label",{class:"form-check-label",for:"pump"},"Pump",-1),xb={key:1,class:"row mt-4"},Sb={class:"col p-1"},Mb={class:"form-check form-switch"},Eb=["onUpdate:modelValue","onClick","disabled","id"],wb=["for"],Tb={key:1},Cb={class:"row"},Ab={class:"col p-1"},Pb=["disabled"],Rb={class:"col p-1"},Db=["disabled"],Ib={class:"col p-1"},Lb=["disabled"],Ub={class:"row"},Fb={class:"col p-1"},Ob=["disabled"],Nb={class:"col p-1"},zb=["disabled"],kb={class:"row"},Bb={class:"col p-1"},Vb=["disabled"],Hb={class:"row"},$b={class:"col p-1"},Gb=["disabled"],Wb={class:"col p-1"},Xb=["disabled"],jb={class:"row"},Yb={class:"col p-1"},qb=["disabled"],Zb={key:0},Kb=Ie(" Camera \u21D2 Nozzle"),Jb=c("br",null,null,-1),Qb=Ie("Toggle Position "),ey=[Kb,Jb,Qb],ty={key:1},ny=Ie(" Nozzle \u21D2 Camera"),iy=c("br",null,null,-1),sy=Ie("Toggle Position "),oy=[ny,iy,sy];function ry(t,e,n,i,s,o){return W(),ee("div",yv,[c("ul",xv,[c("li",Sv,[c("a",{class:je("nav-link"+(t.tab==0?" active":"")),onClick:e[0]||(e[0]=r=>t.tab=0)},"Jog Controller",2)]),c("li",Mv,[c("a",{class:je("nav-link"+(t.tab==1?" active":"")),onClick:e[1]||(e[1]=r=>t.tab=1)},"Toolbox",2)])]),t.tab==0?(W(),ee("div",Ev,[c("div",wv,[c("div",Tv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[2]||(e[2]=r=>o.command("X-Y+"))},"\u{1F884}",8,Cv)]),c("div",Av,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[3]||(e[3]=r=>o.command("Y+"))},"\u{1F881}Y+",8,Pv)]),c("div",Rv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[4]||(e[4]=r=>o.command("X+Y+"))},"\u{1F885}",8,Dv)]),c("div",Iv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[5]||(e[5]=r=>o.command("Z+"))},"Z+",8,Lv)])]),c("div",Uv,[c("div",Fv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[6]||(e[6]=r=>o.command("X-"))},"\u{1F878}X-",8,Ov)]),c("div",Nv,[c("div",zv,[c("div",kv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[7]||(e[7]=r=>o.command("RR"))},"\u2B6E",8,Bv)]),Vv,c("div",Hv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[8]||(e[8]=r=>o.command("RL"))},"\u2B6F",8,$v)])])]),c("div",Gv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[9]||(e[9]=r=>o.command("X+"))},"X+\u{1F87A}",8,Wv)]),c("div",Xv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[10]||(e[10]=r=>o.command("Parking")),title:"Parking"},"P",8,jv)])]),c("div",Yv,[c("div",qv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[11]||(e[11]=r=>o.command("X-Y-"))},"\u{1F887}",8,Zv)]),c("div",Kv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[12]||(e[12]=r=>o.command("Y-"))},"\u{1F883}Y-",8,Jv)]),c("div",Qv,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[13]||(e[13]=r=>o.command("X+Y-"))},"\u{1F886}",8,eb)]),c("div",tb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[14]||(e[14]=r=>o.command("Z-"))},"Z-",8,nb)])]),c("div",ib,[c("div",sb,[ob,se(c("input",{"onUpdate:modelValue":e[15]||(e[15]=r=>n.movingOptions.stepSize=r),type:"number",step:"1.0",class:"form-control form-control-sm"},null,512),[[_e,n.movingOptions.stepSize]])])]),c("div",rb,[c("div",ab,[lb,se(c("input",{"onUpdate:modelValue":e[16]||(e[16]=r=>n.movingOptions.feedRateXYZ=r),type:"number",step:"1.0",class:"form-control form-control-sm"},null,512),[[_e,n.movingOptions.feedRateXYZ]])])]),cb,c("div",db,[c("div",ub,[hb,se(c("input",{"onUpdate:modelValue":e[17]||(e[17]=r=>n.movingOptions.rotateStep=r),type:"number",step:"0.1",class:"form-control form-control-sm"},null,512),[[_e,n.movingOptions.rotateStep]])])]),c("div",fb,[c("div",pb,[mb,se(c("input",{"onUpdate:modelValue":e[18]||(e[18]=r=>n.movingOptions.feedRateA=r),type:"number",step:"1.0",class:"form-control form-control-sm"},null,512),[[_e,n.movingOptions.feedRateA]])])]),n.settings.pump?(W(),ee("div",_b,[c("div",gb,[c("div",vb,[se(c("input",{"onUpdate:modelValue":e[19]||(e[19]=r=>t.pump=r),onClick:e[20]||(e[20]=r=>o.togglePump()),disabled:n.disabled,class:"form-check-input",type:"checkbox",role:"switch",id:"pump"},null,8,bb),[[Zn,t.pump]]),yb])])])):st("",!0),n.settings.heads?(W(),ee("div",xb,[(W(!0),ee(rt,null,wt(n.settings.heads,(r,a)=>(W(),ee("div",Sb,[c("div",Mb,[se(c("input",{"onUpdate:modelValue":l=>t.valves[a]=l,onClick:l=>o.toggleValve(a),disabled:n.disabled,class:"form-check-input",type:"checkbox",role:"switch",id:"valve"+a},null,8,Eb),[[Zn,t.valves[a]]]),c("label",{class:"form-check-label",for:"valve"+a},"Valve "+ze(a+1),9,wb)])]))),256))])):st("",!0)])):st("",!0),t.tab==1?(W(),ee("div",Tb,[c("div",Cb,[c("div",Ab,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[21]||(e[21]=r=>o.command("HomeResetZero"))},"Home Machine & Reset Zero",8,Pb)]),c("div",Rb,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[22]||(e[22]=r=>o.command("Home"))},"Home Machine",8,Db)]),c("div",Ib,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[23]||(e[23]=r=>o.command("ResetZero"))},"Reset Zero",8,Lb)])]),c("div",Ub,[c("div",Fb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[24]||(e[24]=r=>o.command("Return"))},"Return to Zero XY",8,Ob)]),c("div",Nb,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[25]||(e[25]=r=>o.command("ReturnZ"))},"Return to Zero Z",8,zb)])]),c("div",kb,[c("div",Bb,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[26]||(e[26]=r=>o.command("Unlock"))},"Unlock",8,Vb)])]),c("div",Hb,[c("div",$b,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[27]||(e[27]=r=>o.command("State"))},"Get State",8,Gb)]),c("div",Wb,[c("button",{disabled:!n.enabledUnderAlaram,class:"btn btn-sm btn-outline-secondary jog-100",onClick:e[28]||(e[28]=r=>o.command("Pos"))},"Get Position",8,Xb)])]),c("div",jb,[c("div",Yb,[c("button",{disabled:n.disabled,class:je("btn btn-sm btn-outline-secondary jog-100"+(n.movingOptions.topCamNozzlePos==0?"":" active")),onClick:e[29]||(e[29]=r=>o.togglePosition())},[n.movingOptions.topCamNozzlePos==0?(W(),ee("span",Zb,ey)):(W(),ee("span",ty,oy))],10,qb)])])])):st("",!0)])}var ay=ct(bv,[["render",ry]]);const ly={props:{consoleLog:"",disabled:Boolean},data:function(){return{command:this.command,history:[],historyIndex:0}},methods:{sendCommand(){this.$emit("sendCommand",this.command),this.history.push(this.command),this.historyIndex=this.history.length,this.command=""},keyUp(t){t.key=="ArrowUp"&&this.historyIndex>0&&(this.historyIndex--,this.command=this.history[this.historyIndex]),t.key=="ArrowDown"&&this.historyIndex<this.history.length&&(this.historyIndex++,this.command=this.history[this.historyIndex])}},watch:{async consoleLog(){setTimeout(()=>{let t=this.$refs.console;t.scrollTop=t.scrollHeight},100)}}},cy={class:"card mt-1"},dy=c("div",{class:"card-header"},"Console",-1),uy={class:"card-body"},hy={class:"row"},fy={class:"col"},py={class:"row"},my={class:"col mt-1"},_y=["disabled"];function gy(t,e,n,i,s,o){return W(),ee("div",cy,[dy,c("div",uy,[c("div",hy,[c("div",fy,[c("textarea",{readonly:"",rows:"10",ref:"console",class:"form-control form-control-sm"},ze(n.consoleLog),513)])]),c("div",py,[c("div",my,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>t.command=r),disabled:n.disabled,onKeyup:[e[1]||(e[1]=Zf(r=>o.sendCommand(this.command),["enter"])),e[2]||(e[2]=(...r)=>o.keyUp&&o.keyUp(...r))],type:"text",class:"form-control form-control-sm"},null,40,_y),[[_e,t.command]])])])])])}var vy=ct(ly,[["render",gy]]);const _s=cf();function Da(t){t===void 0&&(t=_s.value.comp.returnValue()),_s.value.resolve(t),_s.value=null}function td(t,e,n="default"){return new Promise(i=>{_s.value={dialog:t,props:e,wrapper:n,resolve:i}})}const by={install:(t,e)=>{t.config.globalProperties.$close=(n,i)=>{Da(i)}}};var yy=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n};const xy=mo({name:"DialogWrapper",components:{},props:{name:{type:String,default:"default"},transitionAttrs:Object},setup(){const t=lf();return Vo(t,()=>{_s.value&&(_s.value.comp=t.value)}),{dialogRef:_s,dialogInstance:t}}});function Sy(t,e,n,i,s,o){return W(),Jt(Jc,Qp($f(t.transitionAttrs)),{default:Ct(()=>[t.dialogRef&&t.dialogRef.wrapper===t.name?(W(),Jt(f_(t.dialogRef.dialog),Gf({key:0},t.dialogRef.props,{ref:"dialogInstance"}),null,16)):st("",!0)]),_:1},16)}var My=yy(xy,[["render",Sy]]);const Ey=mo({props:{text:String,title:String},mounted:function(){window.addEventListener("keydown",this.onkey),this.$refs.btn_yes.focus()},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey(t){if(t.keyCode==37){let e=this.$refs.btn_yes;e&&e.focus()}if(t.keyCode==39){let e=this.$refs.btn_no;e&&e.focus()}t.keyCode==27&&this.closeDialog(!1)}},setup(){function t(){return!0}return{returnValue:t,closeDialog:Da}}}),wy={class:"dialog"},Ty={class:"center"},Cy={class:"title"},Ay={class:"text"},Py={class:"p-3 text-center"};function Ry(t,e,n,i,s,o){return W(),ee("div",wy,[c("div",Ty,[c("div",Cy,ze(t.title),1),c("div",Ay,ze(t.text),1),c("div",Py,[c("button",{onClick:e[0]||(e[0]=r=>t.closeDialog()),ref:"btn_yes",class:"btn bt-sm btn-dark mb-1"},"YES",512),c("button",{onClick:e[1]||(e[1]=r=>t.closeDialog(!1)),ref:"btn_no",class:"btn bt-sm btn-dark mb-1"},"NO",512)])])])}var Dy=ct(Ey,[["render",Ry],["__scopeId","data-v-cd0635e6"]]);const Iy=mo({props:{text:String,title:String,type:String},mounted:function(){window.addEventListener("keydown",this.onkey),this.$refs.btn_yes.focus()},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey(t){t.keyCode==27&&this.closeDialog(!1)}},setup(){function t(){return!0}return{returnValue:t,closeDialog:Da}}}),Ly={class:"dialog"},Uy={class:"center"},Fy={class:"text"},Oy={class:"p-3 text-center"};function Ny(t,e,n,i,s,o){return W(),ee("div",Ly,[c("div",Uy,[c("div",{class:je("title "+t.type)},ze(t.title),3),c("div",Fy,ze(t.text),1),c("div",Oy,[c("button",{onClick:e[0]||(e[0]=r=>t.closeDialog()),ref:"btn_yes",class:"btn bt-sm btn-dark mb-1"},"OK",512)])])])}var zy=ct(Iy,[["render",Ny],["__scopeId","data-v-7fc707e0"]]);const ky=mo({props:{text:String,title:String,value:String},data(){return{inputValue:this.inputValue}},mounted:function(){window.addEventListener("keydown",this.onkey),this.$refs.btn_yes.focus(),this.inputValue=this.value},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey(t){t.keyCode==13&&this.closeDialog(),t.keyCode==27&&this.closeDialog(!1)}},setup(){function t(){return this.inputValue}return{returnValue:t,closeDialog:Da}}}),By={class:"dialog"},Vy={class:"center"},Hy={class:"title"},$y={class:"text"},Gy={class:"p-3 text-center"};function Wy(t,e,n,i,s,o){return W(),ee("div",By,[c("div",Vy,[c("div",Hy,ze(t.title),1),c("div",$y,[Ie(ze(t.text)+" ",1),se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>t.inputValue=r),class:"form-control"},null,512),[[_e,t.inputValue]])]),c("div",Gy,[c("button",{onClick:e[1]||(e[1]=r=>t.closeDialog()),ref:"btn_yes",class:"btn bt-sm btn-dark mb-1"},"YES",512),c("button",{onClick:e[2]||(e[2]=r=>t.closeDialog(!1)),ref:"btn_no",class:"btn bt-sm btn-dark mb-1"},"NO",512)])])])}var Xy=ct(ky,[["render",Wy],["__scopeId","data-v-8751a8c8"]]);async function Un(t,e=""){return await td(Dy,{text:t,title:e})}async function lt(t,e="",n=""){return await td(zy,{text:t,title:e,type:n})}async function jy(t,e="",n=""){return await td(Xy,{text:t,title:e,value:n})}const Yy={props:{machineState:Object,gCodeProcess:Object,disabled:Boolean},data:function(){return{gCode:""}},computed:{enabledControls(){let t={openFile:!0,run:!1,stop:!1,pause:!1,gCode:!this.disabled};return t.run=this.machineState.status=="Idle"&&this.gCodeProcess.stopFlag==!1&&this.gCodeProcess.pauseFlag==!1&&this.gCode.length>0,t.stop=this.machineState.status=="Jog"||this.gCodeProcess.pauseFlag==!0,t.pause=this.machineState.status=="Jog"||this.gCodeProcess.pauseFlag==!0,t}},methods:{openFile(){let t=this.$refs.openFile.files[0];if(t){let e=new FileReader;e.readAsText(t,"UTF-8"),e.onload=n=>{this.gCode=n.target.result},e.onerror=n=>{console.log(n),lt("Can't read file '"+t.name+"'","Error","error")}}},run(){let t=this.gCode.split(`
- `);this.$emit("run",t)},stop(){this.$emit("stop")},pause(){this.$emit("pause")}}},qy={class:"card"},Zy=c("div",{class:"card-header"},"G Code",-1),Ky={class:"card-body"},Jy={class:"row"},Qy={class:"col"},ex=["disabled"],tx=Ie(" | "),nx=["disabled"],ix=["disabled"],sx=["disabled"],ox={class:"row"},rx={class:"col"};function ax(t,e,n,i,s,o){return W(),ee("div",qy,[Zy,c("div",Ky,[c("div",Jy,[c("div",Qy,[c("input",{type:"file",ref:"openFile",accept:".txt, .gcode",style:{display:"none"},onChange:e[0]||(e[0]=r=>o.openFile())},null,544),c("button",{disabled:!o.enabledControls.openFile,class:"btn btn-sm btn-outline-secondary",onClick:e[1]||(e[1]=r=>t.$refs.openFile.click())},"Open\u2026",8,ex),tx,c("button",{disabled:!o.enabledControls.run,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[2]||(e[2]=r=>o.run())},"Run",8,nx),c("button",{disabled:!o.enabledControls.stop,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[3]||(e[3]=r=>o.stop())},"Stop",8,ix),c("button",{disabled:!o.enabledControls.pause,class:je("btn btn-sm btn-outline-secondary m-1"+(this.gCodeProcess.pauseFlag==!0?" active":"")),onClick:e[4]||(e[4]=r=>o.pause())},"Pause",10,sx)])]),c("div",ox,[c("div",rx,[se(c("textarea",{"onUpdate:modelValue":e[5]||(e[5]=r=>t.gCode=r),rows:"15",class:"form-control form-control-sm"},null,512),[[_e,t.gCode]])])])])])}var lx=ct(Yy,[["render",ax]]);const cx={props:{settings:Object,disabled:!1},data:function(){return{values:{},description:{0:"Step pulse time, microseconds",1:"Step idle delay, milliseconds",2:"Step pulse invert, mask",3:"Step direction invert, mask",4:"Invert step enable pin, boolean",5:"Invert limit pins, boolean/mask",6:"Invert probe pin, boolean",7:"Disable spindle with 0 speed, boolean",8:"Ganged axes direction invert as bitfield",10:"Status report options, mask",11:"Junction deviation, millimeters",12:"Arc tolerance, millimeters",13:"Report in inches, boolean",14:"Limit pins invert, mask",15:"Coolant pins invert, mask",16:"Spindle pins invert, mask",17:"Control pins pullup disable, mask",18:"Limit pins pullup disable, mask",19:"Probe pin pullup disable, boolean",20:"Soft limits enable, boolean",21:"Hard limits enable, boolean",22:"Homing cycle enable, boolean (Grbl) / mask (GrblHAL)",23:"Homing direction invert, mask",24:"Homing locate feed rate, mm/min",25:"Homing search seek rate, mm/min",26:"Homing switch debounce delay, milliseconds",27:"Homing switch pull-off distance, millimeters",28:"G73 retract distance, in mm",29:"Step pulse delay (ms)",30:"Maximum spindle speed, RPM",31:"Minimum spindle speed, RPM",32:"Laser-mode enable, boolean",33:"Spindle PWM frequency",34:"Spindle off Value",35:"Spindle min value",36:"Spindle max value",37:"Stepper deenergize mask",39:"Enable printable realtime command characters, boolean",40:"Apply soft limits for jog commands, boolean",43:"Homing passes",44:"Homing cycle 1",45:"Homing cycle 2",46:"Homing cycle 3",47:"Homing cycle 4",62:"Sleep Enable",63:"Feed Hold Actions",64:"Force Init Alarm",65:"Require homing sequence to be executed at startup",70:"Network Services",73:"Wifi Mode",74:"",75:"",100:"X-axis steps per millimeter",101:"Y-axis steps per millimeter",102:"Z-axis steps per millimeter",103:"A-axis steps per millimeter",110:"X-axis maximum rate, mm/min",111:"Y-axis maximum rate, mm/min",112:"Z-axis maximum rate, mm/min",113:"A-axis maximum rate, mm/min",120:"X-axis acceleration, mm/sec^2",121:"Y-axis acceleration, mm/sec^2",122:"Z-axis acceleration, mm/sec^2",123:"A-axis acceleration, mm/sec^2",130:"X-axis maximum travel, millimeters",131:"Y-axis maximum travel, millimeters",132:"Z-axis maximum travel, millimeters",133:"A-axis maximum travel, millimeters",300:"Hostname",302:"IP Address",303:"Gateway",304:"Netmask",305:"Telnet Port",306:"HTTP Port",307:"Websocket Port",341:"Tool Change Mode",342:"Tool Change probing distance",343:"Tool Change Locate Feed rate",344:"Tool Change Search Seek rate",345:"Tool Change Probe Pull Off rate",370:"Invert I/O Port Inputs (mask)",384:"Disable G92 Persistence",346:"ToolChangeOptions",372:"Io Port Invert Out",376:"Rotary Axes",394:"Spindle On Delay",398:"Planner Blocks",481:"Auto Report Interval",484:"Unlock After EStop",486:"Offset Lock",538:"Rotary Wrap",539:"Spindle Off Delay",673:"Coolant On Delay",676:"Reset Actions",680:"Stepper Enable Delay"}}},computed:{settingsList(){for(let t in this.settings)typeof this.values[t]=="undefined"&&(this.values[t]=this.settings[t]);return this.values}},methods:{saveSetting(t){let e=["$"+t+"="+this.values[t],"$"+t];this.$emit("sendCommand",e)}}},dx={class:"card"},ux=c("div",{class:"card-header"},"Controller Settings",-1),hx={class:"card-body"},fx={class:"row mb-1"},px={class:"col-1"},mx={class:"col-auto"},_x=["onUpdate:modelValue"],gx={class:"col-auto"},vx={key:0},bx=["disabled","onClick"],yx={class:"col"};function xx(t,e,n,i,s,o){return W(),ee("div",dx,[ux,c("div",hx,[(W(!0),ee(rt,null,wt(o.settingsList,(r,a)=>(W(),ee("div",fx,[c("div",px,ze(a),1),c("div",mx,[se(c("input",{"onUpdate:modelValue":l=>t.values[a]=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,_x),[[_e,t.values[a]]])]),c("div",gx,[t.values[a]!==n.settings[a]?(W(),ee("span",vx,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary",onClick:l=>o.saveSetting(a)},"Save",8,bx)])):st("",!0)]),c("div",yx,ze(t.description[a]),1)]))),256))])])}var Sx=ct(cx,[["render",xx]]),Hn={methods:{machineStateIsOK(){if(this.machineState){if(this.machineState.status=="Idle")return!0;lt("Controller status is wrong","Error","error")}else lt("Controller state is wrong","Error","error");return!1}}};const Mx={mixins:[Hn],props:{cams:Object,machineState:Object,machinePos:Object,settings:Object,showWindow:Object,disabled:Boolean,loading:Boolean},data:function(){return{tab:0,calibrationShow:[!1,!1],currentPos:{x:0,y:0}}},methods:{calibrate(t){this.$emit("calibrate",t)},rememberPos(){this.machineStateIsOK()==!0&&(this.currentPos.x=this.machinePos.x,this.currentPos.y=this.machinePos.y)},calculateOffset(t){if(this.machineStateIsOK()==!0){let e=Math.round((this.currentPos.x-this.machinePos.x)*1e3)/1e3,n=Math.round((this.currentPos.y-this.machinePos.y)*1e3)/1e3;this.cams[t].offset.x=e,this.cams[t].offset.y=n}},setPosition(t){this.machineStateIsOK()==!0&&(this.cams[t].pos.x=this.machinePos.x,this.cams[t].pos.y=this.machinePos.y,this.cams[t].pos.z=this.machinePos.z)},jogBottomCamPos(){let t=[],e=parseFloat(this.cams[1].pos.x),n=parseFloat(this.cams[1].pos.y),i=parseFloat(this.cams[1].pos.z),s=this.settings.heads[0].safePosZ;t.push(`$J=G21G90Z${s}F2000`),t.push(`$J=G21G90X${e}Y${n}F2000`),t.push(`$J=G21G90Z${i}F2000`),this.$emit("sendCommands",t)},toggleCamParamRaw(t){this.$emit("toggleCam",{number:t,raw:1,cv:0,ppmm:this.cams[t].ppmm,grid:0,marker:0})},toggleCamParam(t){this.$emit("toggleCam",{number:t,raw:0,cv:0,ppmm:this.cams[t].ppmm,grid:1,marker:1})},changeCamParam(t){this.$emit("changeCamParam",{number:t,raw:0,cv:0,ppmm:this.cams[t].ppmm,grid:1,marker:1})},applaySettings(){this.$emit("applaySettings")}}},Ex={class:"card"},wx=c("div",{class:"card-header"},"Cameras Settings",-1),Tx={class:"card-body"},Cx={class:"row"},Ax={class:"card"},Px={class:"card-header"},Rx={class:"card-body"},Dx={class:"row"},Ix={class:"col"},Lx={class:"mb-3"},Ux=c("label",{class:"form-label"},"ID",-1),Fx=["onClick"],Ox=["onUpdate:modelValue"],Nx=c("div",{class:"form-text"},`ID of camera. Use command 'ls /dev/v4l/by-id/' to view USB cameras list. After changing pleas press "Applay settings"`,-1),zx=c("div",{class:"form-text"},[Ie("Use command '"),c("b",null,"ls /dev/v4l/by-id/"),Ie("' to view USB cameras list")],-1),kx={class:"mb-3"},Bx=c("label",{class:"form-label"},"Capture frame size",-1),Vx={class:"row mb-2"},Hx={class:"col"},$x={class:"row"},Gx=c("div",{class:"col-auto pt-1"},"Width:",-1),Wx={class:"col"},Xx=["onUpdate:modelValue"],jx={class:"col"},Yx={class:"row"},qx=c("div",{class:"col-auto pt-1"},"Height:",-1),Zx={class:"col"},Kx=["onUpdate:modelValue"],Jx={class:"mb-3"},Qx=c("label",{class:"form-label"},"Undistorting method",-1),eS={class:"row mb-2"},tS={class:"col"},nS=["onUpdate:modelValue"],iS=c("option",{value:0},"Distortion factor",-1),sS=c("option",{value:1},"Calibration data",-1),oS=[iS,sS],rS={key:0,class:"mb-3"},aS=c("label",{class:"form-label"},"Distortion factor",-1),lS={class:"row mb-2"},cS={class:"col"},dS=["onUpdate:modelValue"],uS=c("div",{class:"form-text"},'Positive and negative value available. After changing pleas press "Applay settings"',-1),hS={key:1,class:"mb-3"},fS=c("label",{class:"form-label"},"Calibration data",-1),pS={key:0,class:"row"},mS=c("div",{class:"col-auto"},"matrix:",-1),_S={class:"col-auto"},gS=c("div",{class:"col-auto"},"distortion:",-1),vS={class:"col-auto"},bS={class:"col text-end"},yS=["onClick"],xS={key:1,class:"row"},SS={class:"col"},MS=Ie("[Hiden] "),ES=["onClick"],wS=c("div",{class:"form-text"},[Ie("Please print "),c("a",{href:"images/calibration.svg",target:"_blank"},"this"),Ie(" picture, put it under cams focus then press button 'Calibration'")],-1),TS=["onClick"],CS={key:2,class:"mb-3"},AS=c("label",{class:"form-label"},"Offset from nozzle of head #1",-1),PS={class:"pb-2"},RS=["disabled"],DS=Ie(" Then move camera to Nozzle position and press "),IS=["disabled","onClick"],LS={class:"row mb-2"},US={class:"col"},FS={class:"row"},OS=c("div",{class:"col-auto pt-1"},"X:",-1),NS={class:"col"},zS=["onUpdate:modelValue"],kS={class:"col"},BS={class:"row"},VS=c("div",{class:"col-auto pt-1"},"Y:",-1),HS={class:"col"},$S=["onUpdate:modelValue"],GS=c("div",{class:"col-auto"},null,-1),WS=c("div",{class:"form-text"},"Top camera offset from nozzle of first head",-1),XS={key:3,class:"mb-3"},jS=c("label",{class:"form-label"},"Position",-1),YS={class:"row mb-2"},qS={class:"col"},ZS={class:"row"},KS=c("div",{class:"col-auto pt-1"},"X:",-1),JS={class:"col"},QS=["onUpdate:modelValue"],e1={class:"col"},t1={class:"row"},n1=c("div",{class:"col-auto pt-1"},"Y:",-1),i1={class:"col"},s1=["onUpdate:modelValue"],o1={class:"col"},r1={class:"row"},a1=c("div",{class:"col-auto pt-1"},"Z:",-1),l1={class:"col"},c1=["onUpdate:modelValue"],d1={class:"col-auto"},u1=["disabled","onClick"],h1=c("div",{class:"form-text"},"Nozzle position over Bottom camera",-1),f1=["disabled"],p1={class:"card mt-1"},m1=c("div",{class:"card-header"},"Image Transform",-1),_1={class:"card-body"},g1={class:"mb-3"},v1=c("label",{class:"form-label"},"Rotation",-1),b1={class:"row mb-2"},y1={class:"col"},x1=["onUpdate:modelValue"],S1=c("option",{value:0},"No",-1),M1=c("option",{value:90},"90",-1),E1=c("option",{value:180},"180",-1),w1=c("option",{value:-90},"-90",-1),T1=[S1,M1,E1,w1],C1={class:"mb-3"},A1=c("label",{class:"form-label"},"Scale",-1),P1={class:"row mb-2"},R1={class:"col"},D1={class:"row"},I1=c("div",{class:"col-auto pt-1"},"Width:",-1),L1={class:"col"},U1=["onUpdate:modelValue"],F1={class:"col"},O1={class:"row"},N1=c("div",{class:"col-auto pt-1"},"Height:",-1),z1={class:"col"},k1=["onUpdate:modelValue"],B1={class:"card mt-1"},V1=c("div",{class:"card-header"},"Resolution",-1),H1={class:"card-body"},$1={class:"mb-3"},G1=c("label",{class:"form-label"},"Resolution (pixels per millimeter)",-1),W1=["onClick"],X1=["onUpdate:modelValue","onChange"],j1=c("div",{class:"form-text"},[Ie("Please print "),c("a",{href:"images/calibration.svg",target:"_blank"},"this"),Ie(" picture, put it under center of cams focus then change the resolution until the marker matches the image of square.")],-1),Y1={class:"card mt-1"},q1=c("div",{class:"card-header"},"Light",-1),Z1={class:"card-body"},K1={class:"mb-3"},J1=c("label",{class:"form-label"},"Light on command",-1),Q1=["onUpdate:modelValue"],eM={class:"mb-3"},tM=c("label",{class:"form-label"},"Light off command",-1),nM=["onUpdate:modelValue"],iM={class:"row mt-2"},sM={class:"col"},oM=["disabled"];function rM(t,e,n,i,s,o){return W(),ee("div",Ex,[wx,c("div",Tx,[c("div",Cx,[(W(!0),ee(rt,null,wt(n.cams,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",Ax,[c("div",Px,"Camera "+ze(r.name),1),c("div",Rx,[c("div",Dx,[c("div",Ix,[c("div",Lx,[Ux,c("button",{class:je("btn btn-sm btn-outline-secondary float-end p-0 ps-1 pe-1 m-0 me-1"+(n.showWindow[a]==!0?" active":"")),onClick:l=>o.toggleCamParamRaw(a)},"Raw view",10,Fx),se(c("input",{"onUpdate:modelValue":l=>r.id=l,type:"text",class:"form-control form-control-sm"},null,8,Ox),[[_e,r.id]]),Nx,zx]),c("div",kx,[Bx,c("div",Vx,[c("div",Hx,[c("div",$x,[Gx,c("div",Wx,[se(c("input",{"onUpdate:modelValue":l=>r.size.width=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,Xx),[[_e,r.size.width]])])])]),c("div",jx,[c("div",Yx,[qx,c("div",Zx,[se(c("input",{"onUpdate:modelValue":l=>r.size.height=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,Kx),[[_e,r.size.height]])])])])])]),c("div",Jx,[Qx,c("div",eS,[c("div",tS,[se(c("select",{"onUpdate:modelValue":l=>r.undistort.type=l,class:"form-control form-control-sm"},oS,8,nS),[[Kn,r.undistort.type]])])])]),r.undistort.type==0?(W(),ee("div",rS,[aS,c("div",lS,[c("div",cS,[se(c("input",{"onUpdate:modelValue":l=>r.undistort.distortion_f=l,type:"number",step:"0.001",class:"form-control form-control-sm"},null,8,dS),[[_e,r.undistort.distortion_f]])])]),uS])):st("",!0),r.undistort.type==1?(W(),ee("div",hS,[fS,t.calibrationShow[a]==!0?(W(),ee("div",pS,[mS,c("div",_S,ze(r.calibration.matrix),1),gS,c("div",vS,ze(r.calibration.distortion),1),c("div",bS,[c("button",{class:"btn btn-sm btn-link p-0 ps-1 pe-1",onClick:l=>t.calibrationShow[a]=!1},"Hide",8,yS)])])):(W(),ee("div",xS,[c("div",SS,[MS,c("button",{class:"btn btn-sm btn-link p-0 ps-1 pe-1",onClick:l=>t.calibrationShow[a]=!0},"Show",8,ES)])])),wS,c("button",{class:"btn btn-sm btn-outline-secondary",onClick:l=>o.calibrate(a)},"Calibrate",8,TS)])):st("",!0),a==0?(W(),ee("div",CS,[AS,c("div",PS,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0",onClick:e[0]||(e[0]=l=>o.rememberPos())},"Remember Current Position ("+ze(t.currentPos)+")",9,RS),DS,c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0",onClick:l=>o.calculateOffset(a)},"Calculate Offset",8,IS)]),c("div",LS,[c("div",US,[c("div",FS,[OS,c("div",NS,[se(c("input",{"onUpdate:modelValue":l=>r.offset.x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,zS),[[_e,r.offset.x]])])])]),c("div",kS,[c("div",BS,[VS,c("div",HS,[se(c("input",{"onUpdate:modelValue":l=>r.offset.y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,$S),[[_e,r.offset.y]])])])]),GS]),WS])):st("",!0),a==1?(W(),ee("div",XS,[jS,c("div",YS,[c("div",qS,[c("div",ZS,[KS,c("div",JS,[se(c("input",{"onUpdate:modelValue":l=>r.pos.x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,QS),[[_e,r.pos.x]])])])]),c("div",e1,[c("div",t1,[n1,c("div",i1,[se(c("input",{"onUpdate:modelValue":l=>r.pos.y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,s1),[[_e,r.pos.y]])])])]),c("div",o1,[c("div",r1,[a1,c("div",l1,[se(c("input",{"onUpdate:modelValue":l=>r.pos.z=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,c1),[[_e,r.pos.z]])])])]),c("div",d1,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary",onClick:l=>o.setPosition(a)},"Set current controller position",8,u1)])]),h1,c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0",onClick:e[1]||(e[1]=l=>o.jogBottomCamPos())},"Jog to Bottom Camera",8,f1)])):st("",!0)])])])]),c("div",p1,[m1,c("div",_1,[c("div",g1,[v1,c("div",b1,[c("div",y1,[se(c("select",{"onUpdate:modelValue":l=>r.image_transform.rotation=l,class:"form-control form-control-sm"},T1,8,x1),[[Kn,r.image_transform.rotation]])])])]),c("div",C1,[A1,c("div",P1,[c("div",R1,[c("div",D1,[I1,c("div",L1,[se(c("input",{"onUpdate:modelValue":l=>r.image_transform.scale_x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,U1),[[_e,r.image_transform.scale_x]])])])]),c("div",F1,[c("div",O1,[N1,c("div",z1,[se(c("input",{"onUpdate:modelValue":l=>r.image_transform.scale_y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,k1),[[_e,r.image_transform.scale_y]])])])])])])])]),c("div",B1,[V1,c("div",H1,[c("div",$1,[G1,c("button",{class:je("btn btn-sm btn-outline-secondary float-end p-0 ps-1 pe-1 m-0 me-0"+(n.showWindow[a]==!0?" active":"")),onClick:l=>o.toggleCamParam(a)},"View",10,W1),se(c("input",{"onUpdate:modelValue":l=>r.ppmm=l,onChange:l=>o.changeCamParam(a),type:"number",step:"0.1",class:"form-control form-control-sm"},null,40,X1),[[_e,r.ppmm]]),j1])])]),c("div",Y1,[q1,c("div",Z1,[c("div",K1,[J1,se(c("input",{"onUpdate:modelValue":l=>r.lightOn=l,type:"text",class:"form-control form-control-sm"},null,8,Q1),[[_e,r.lightOn]])]),c("div",eM,[tM,se(c("input",{"onUpdate:modelValue":l=>r.lightOff=l,type:"text",class:"form-control form-control-sm"},null,8,nM),[[_e,r.lightOff]])])])])]))),128))]),c("div",iM,[c("div",sM,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[2]||(e[2]=r=>o.applaySettings())},"Applay settings",8,oM)])])])])}var aM=ct(Mx,[["render",rM]]);const lM={props:{cvSettings:Object,showWindow:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},toggleCV(t){this.$emit("toggleCV",t)}}},cM={class:"card"},dM=c("div",{class:"card-header"},"Computer Vision Settings",-1),uM={class:"card-body"},hM={class:"row"},fM={class:"card"},pM={class:"card-header"},mM={class:"card-body"},_M={class:"row"},gM={class:"col"},vM={class:"mb-3"},bM=c("label",{class:"form-label"},"Contrast",-1),yM=["onUpdate:modelValue"],xM=c("div",{class:"form-text"},"The default value is 1, meaning no scaling is applied. This parameter controls the contrast of the image.",-1),SM={class:"mb-3"},MM=c("label",{class:"form-label"},"Brightness",-1),EM=["onUpdate:modelValue"],wM=c("div",{class:"form-text"},"The default value is 0, meaning no shift is applied. This parameter controls the brightness of the image.",-1),TM={class:"mb-3"},CM=c("label",{class:"form-label"},"Blur",-1),AM={class:"row"},PM={class:"col-auto"},RM=["onUpdate:modelValue"],DM=c("div",{class:"col-auto mt-1"},"x",-1),IM={class:"col-auto"},LM=["onUpdate:modelValue"],UM=c("div",{class:"form-text"},"This parameter defines the size of the blurring kernel. It's a tuple representing the width and height of the kernel (e.g., (5, 5) for a 5x5 kernel). The kernel size determines the area over which the blurring is applied.",-1),FM={class:"mb-3"},OM=c("label",{class:"form-label"},"Adaptive Threshold block size",-1),NM=["onUpdate:modelValue"],zM=c("div",{class:"form-text"},"The size of the pixel neighborhood used to calculate the threshold, it must be an odd number.",-1),kM={class:"mb-3"},BM=c("label",{class:"form-label"},"Adaptive Threshold C",-1),VM=["onUpdate:modelValue"],HM=c("div",{class:"form-text"},"A constant value subtracted from the calculated mean or weighted sum to fine-tune the threshold. It can be positive, negative, or zero.",-1),$M=["onClick"],GM={class:"card mt-2"},WM=c("div",{class:"card-header"},"Objects parameters (default)",-1),XM={class:"card-body"},jM={class:"mb-3"},YM={class:"form-label capitalize"},qM=["onUpdate:modelValue"],ZM={class:"card mt-2"},KM=c("div",{class:"card-header"},"Misc Settings",-1),JM={class:"card-body"},QM={class:"mb-3"},eE=c("label",{class:"form-label capitalize"},"Delay before image processing:",-1),tE=["onUpdate:modelValue"],nE={class:"row mt-2"},iE={class:"col"},sE=["disabled"];function oE(t,e,n,i,s,o){return W(),ee("div",cM,[dM,c("div",uM,[c("div",hM,[(W(!0),ee(rt,null,wt(n.cvSettings,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",fM,[c("div",pM,"Camera "+ze(r.name)+" image transform",1),c("div",mM,[c("div",_M,[c("div",gM,[c("div",vM,[bM,se(c("input",{"onUpdate:modelValue":l=>r.contrast=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,yM),[[_e,r.contrast]]),xM]),c("div",SM,[MM,se(c("input",{"onUpdate:modelValue":l=>r.brightness=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,EM),[[_e,r.brightness]]),wM]),c("div",TM,[CM,c("div",AM,[c("div",PM,[se(c("input",{"onUpdate:modelValue":l=>r.blur[0]=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,RM),[[_e,r.blur[0]]])]),DM,c("div",IM,[se(c("input",{"onUpdate:modelValue":l=>r.blur[1]=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,LM),[[_e,r.blur[1]]])])]),UM]),c("div",FM,[OM,se(c("input",{"onUpdate:modelValue":l=>r.adaptiveThreshold_blockSize=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,NM),[[_e,r.adaptiveThreshold_blockSize]]),zM]),c("div",kM,[BM,se(c("input",{"onUpdate:modelValue":l=>r.adaptiveThreshold_C=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,VM),[[_e,r.adaptiveThreshold_C]]),HM]),c("button",{class:je("btn btn-sm btn-outline-secondary float-end p-0 ps-1 pe-1 m-0 me-0"+(n.showWindow[a]==!0?" active":"")),onClick:l=>o.toggleCV(a)},"CV View",10,$M)])])])]),c("div",GM,[WM,c("div",XM,[(W(!0),ee(rt,null,wt(r.objects,(l,d)=>(W(),ee("div",jM,[c("label",YM,ze(d),1),c("div",null,[(W(!0),ee(rt,null,wt(l,(u,f)=>(W(),ee("span",null,[Ie(ze(f)+": ",1),se(c("input",{"onUpdate:modelValue":h=>r.objects[d][f]=h,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,qM),[[_e,r.objects[d][f]]])]))),256))])]))),256))])]),c("div",ZM,[KM,c("div",JM,[c("div",QM,[eE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBefore=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,tE),[[_e,r.pauseBefore]])])])])]))),128))]),c("div",nE,[c("div",iE,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[0]||(e[0]=r=>o.applaySettings())},"Applay settings",8,sE)])])])])}var rE=ct(lM,[["render",oE]]);const aE={props:{heads:Object,nozzles:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")}}},lE={class:"card"},cE=c("div",{class:"card-header"},"Heads Settings",-1),dE={class:"card-body"},uE={class:"row"},hE={class:"card"},fE={class:"card-header"},pE={class:"card-body"},mE={class:"mb-3"},_E=c("label",{class:"form-label"},"Safety Z position",-1),gE=["onUpdate:modelValue"],vE=c("div",{class:"form-text"},"Position Z to safety moving head over the table",-1),bE={class:"mb-3"},yE=c("label",{class:"form-label"},"Valve On command",-1),xE=["onUpdate:modelValue"],SE={class:"mb-3"},ME={class:"row"},EE={class:"col"},wE=Ie(" Pause Before On: "),TE=["onUpdate:modelValue"],CE={class:"col"},AE=Ie(" Pause After On: "),PE=["onUpdate:modelValue"],RE={class:"mb-3"},DE=c("label",{class:"form-label"},"Valve Off command",-1),IE=["onUpdate:modelValue"],LE={class:"mb-3"},UE={class:"row"},FE={class:"col"},OE=Ie(" Pause Before Off: "),NE=["onUpdate:modelValue"],zE={class:"col"},kE=Ie(" Pause After Off: "),BE=["onUpdate:modelValue"],VE={class:"mb-3"},HE=c("label",{class:"form-label"},"Output name in GC",-1),$E=["onUpdate:modelValue"],GE={class:"mb-3"},WE=c("label",{class:"form-label"},"Nozzle default",-1),XE=["onUpdate:modelValue"],jE=c("option",{value:-1},"Empty",-1),YE=["value"],qE={class:"row mt-2"},ZE={class:"col"},KE=["disabled"];function JE(t,e,n,i,s,o){return W(),ee("div",lE,[cE,c("div",dE,[c("div",uE,[(W(!0),ee(rt,null,wt(n.heads,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",hE,[c("div",fE,"Head "+ze(r.name),1),c("div",pE,[c("div",mE,[_E,se(c("input",{"onUpdate:modelValue":l=>r.safePosZ=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,gE),[[_e,r.safePosZ]]),vE]),c("div",bE,[yE,se(c("input",{"onUpdate:modelValue":l=>r.valveOn=l,type:"text",class:"form-control form-control-sm"},null,8,xE),[[_e,r.valveOn]])]),c("div",SE,[c("div",ME,[c("div",EE,[wE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBeforeOn=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,TE),[[_e,r.pauseBeforeOn]])]),c("div",CE,[AE,se(c("input",{"onUpdate:modelValue":l=>r.pauseAfterOn=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,PE),[[_e,r.pauseAfterOn]])])])]),c("div",RE,[DE,se(c("input",{"onUpdate:modelValue":l=>r.valveOff=l,type:"text",class:"form-control form-control-sm"},null,8,IE),[[_e,r.valveOff]])]),c("div",LE,[c("div",UE,[c("div",FE,[OE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBeforeOff=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,NE),[[_e,r.pauseBeforeOff]])]),c("div",zE,[kE,se(c("input",{"onUpdate:modelValue":l=>r.pauseAfterOff=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,BE),[[_e,r.pauseAfterOff]])])])]),c("div",VE,[HE,se(c("input",{"onUpdate:modelValue":l=>r.inGC=l,type:"text",class:"form-control form-control-sm"},null,8,$E),[[_e,r.inGC]])]),c("div",GE,[WE,se(c("select",{"onUpdate:modelValue":l=>r.nozzle=l,class:"form-control form-control-sm"},[jE,(W(!0),ee(rt,null,wt(n.nozzles,l=>(W(),ee("option",{value:l.id},ze(l.name),9,YE))),256))],8,XE),[[Kn,r.nozzle]])])])])]))),128))]),c("div",qE,[c("div",ZE,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[0]||(e[0]=r=>o.applaySettings())},"Applay settings",8,KE)])])])])}var QE=ct(aE,[["render",JE]]);const ew={mixins:[Hn],props:{pump:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")}}},tw={class:"card"},nw=c("div",{class:"card-header"},"Pump Settings",-1),iw={class:"card-body"},sw={class:"mb-3"},ow=c("label",{class:"form-label"},"Pump On command",-1),rw={class:"mb-3"},aw=c("label",{class:"form-label"},"Pump Off command",-1),lw={class:"mb-3"},cw=c("label",{class:"form-label"},"Output name in GC",-1),dw={class:"row mt-2"},uw={class:"col"},hw=["disabled"];function fw(t,e,n,i,s,o){return W(),ee("div",tw,[nw,c("div",iw,[c("div",sw,[ow,se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.pump.On=r),type:"text",class:"form-control form-control-sm"},null,512),[[_e,n.pump.On]])]),c("div",rw,[aw,se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.pump.Off=r),type:"text",class:"form-control form-control-sm"},null,512),[[_e,n.pump.Off]])]),c("div",lw,[cw,se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.pump.inGC=r),type:"text",class:"form-control form-control-sm"},null,512),[[_e,n.pump.inGC]])]),c("div",dw,[c("div",uw,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[3]||(e[3]=r=>o.applaySettings())},"Applay settings",8,hw)])])])])}var pw=ct(ew,[["render",fw]]),Ia={methods:{array_move:function(t,e,n){if(n>=t.length)for(var i=n-t.length+1;i--;)t.push(void 0);t.splice(n,0,t.splice(e,1)[0])},rowUp(t,e){let n=t.indexOf(e);n>0&&this.array_move(t,n,n-1)},rowDown(t,e){let n=t.indexOf(e);n<t.length-1&&this.array_move(t,n,n+1)},rowDelete(t,e){Un("Do you really want to delete?","Confirm").then(n=>{if(n==!0){let i=t.indexOf(e);t.splice(i,1)}})}}},ys={props:["rows","currentRow"],mounted:function(){window.addEventListener("keydown",this.onkey)},destroyed:function(){window.removeEventListener("keydown",this.onkey)},methods:{onkey:function(t){if(this.$refs.table&&this.$refs.table.contains(document.activeElement)&&(t.keyCode==38||t.keyCode==40)){if(document.activeElement.localName=="select")return;if(this.currentRow){let e=this.rows.indexOf(this.currentRow);t.keyCode==38&&e>0&&(e=e-1),t.keyCode==40&&e<this.rows.length-1&&(e=e+1),this.$emit("set",this.rows[e])}}},setCurrentRow(t){this.currentRow!=t&&this.$emit("set",t)},setFocus(){if(this.$refs){let t=this.rows.indexOf(this.currentRow);t>-1&&this.$refs[this.currentField]&&typeof this.$refs[this.currentField][t]!="undefined"&&this.$refs[this.currentField][t].focus()}},intValidate:function(t,e){typeof t[e]=="string"&&(t[e]=t[e].replace(/[^0-9\-]/g,""))},floatValidate:function(t,e){typeof t[e]=="string"&&(t[e]=t[e].replace(",","."),t[e]=t[e].replace("..","."),t[e]=t[e].replace(/[^0-9\.\-]/g,""))},array_move:function(t,e,n){if(n>=t.length)for(var i=n-t.length+1;i--;)t.push(void 0);t.splice(n,0,t.splice(e,1)[0])},rowUp(t,e){let n=t.indexOf(e);n>0&&this.array_move(t,n,n-1)},rowDown(t,e){let n=t.indexOf(e);n<t.length-1&&this.array_move(t,n,n+1)},rowDelete(t,e){Un("Do you really want to delete?","Confirm").then(n=>{if(n==!0){let i=t.indexOf(e);t.splice(i,1)}})}},watch:{currentRow(){this.setFocus()}}};const mw={props:{machinePos:Object},mixins:[ys],data:function(){return{currentField:"dx"}}},_w={class:"scroll"},gw={class:"table",ref:"table"},vw=c("thead",null,[c("tr",null,[c("th"),c("th",null,"a"),c("th",null,"dx"),c("th",null,"dy")])],-1),bw=["onMousedown"],yw={key:0},xw={key:1},Sw=["onUpdate:modelValue"],Mw=["onUpdate:modelValue"],Ew={nowrap:""},ww=["onClick","hidden"];function Tw(t,e,n,i,s,o){return W(),ee("div",_w,[c("table",gw,[vw,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,(r,a)=>(W(),ee("tr",{onMousedown:l=>t.setCurrentRow(r),class:je(r==t.currentRow?"active-row":"")},[c("td",null,[r==t.currentRow?(W(),ee("span",yw,"\u2BC8")):(W(),ee("span",xw,"\xA0\xA0"))]),c("td",null,[c("span",{class:je(r.a==n.machinePos.a?"text-success fw-bold":"")},ze(r.a),3)]),c("td",null,[se(c("input",{"onUpdate:modelValue":l=>r.dx=l,ref_for:!0,ref:"dx",onFocus:e[0]||(e[0]=l=>t.currentField="dx"),class:"form-control form-control-sm"},null,40,Sw),[[_e,r.dx]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":l=>r.dy=l,ref_for:!0,ref:"dy",onFocus:e[1]||(e[1]=l=>t.currentField="dy"),class:"form-control form-control-sm"},null,40,Mw),[[_e,r.dy]])]),c("th",Ew,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:l=>t.$emit("setPos",r),title:"Set nozzle deviation",hidden:r.a==0},"\u{1F78A}",8,ww)])],42,bw))),256))])],512)])}var Cw=ct(mw,[["render",Tw]]);const Aw={data:function(){return{showMenu:this.showMenu}}},Pw={class:"dropdown show"};function Rw(t,e,n,i,s,o){return W(),ee("div",Pw,[c("a",{onClick:e[0]||(e[0]=r=>t.showMenu=!t.showMenu)},[Qs(t.$slots,"menubutton")]),c("div",{class:je("dropdown-menu"+(t.showMenu==!0?" show":"")),onClick:e[1]||(e[1]=r=>t.showMenu=!1)},[Qs(t.$slots,"menuitems")],2)])}var cp=ct(Aw,[["render",Rw]]);const Dw={props:{disabled:Boolean}},Iw=["disabled"];function Lw(t,e,n,i,s,o){return W(),ee("button",{class:"dropdown-item",disabled:n.disabled,type:"button"},[Qs(t.$slots,"default")],8,Iw)}var dp=ct(Dw,[["render",Lw]]);const Uw={components:{PopupMenu:cp,PopupMenuItem:dp},props:{row:Object,clipboard:Object}},Fw=Ie("Copy"),Ow=Ie("Paste");function Nw(t,e,n,i,s,o){const r=et("PopupMenuItem"),a=et("PopupMenu");return W(),Jt(a,null,{menubutton:Ct(()=>[Qs(t.$slots,"default")]),menuitems:Ct(()=>[ke(r,{onClick:e[0]||(e[0]=l=>t.$emit("copy",n.row))},{default:Ct(()=>[Fw]),_:1}),ke(r,{disabled:!n.clipboard,onClick:e[1]||(e[1]=l=>t.$emit("paste",n.row))},{default:Ct(()=>[Ow]),_:1},8,["disabled"])]),_:3})}var go=ct(Uw,[["render",Nw]]),xs={methods:{deepMerge(t,e){const n=Object.assign(t);for(const i in e)e.hasOwnProperty(i)&&(t[i]&&typeof t[i]=="object"&&typeof e[i]=="object"?n[i]=this.deepMerge(t[i],e[i]):n[i]=e[i]);return n}}};const zw={mixins:[ys,xs],props:{settings:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{NozzlesCalibrateTable:Cw,CopyPasteMenu:go},computed:{isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},data:function(){return{currentField:"name",currentCalibrateRow:this.currentCalibrateRow,clipboard:this.clipboard}},methods:{doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}}},kw={class:"row"},Bw={class:"col"},Vw={class:"scroll"},Hw={class:"table mb-5",ref:"table"},$w=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Caption"),c("th")])],-1),Gw=["onMousedown"],Ww={key:0},Xw=Ie("\u2BC8"),jw={key:1},Yw=["onUpdate:modelValue"],qw=["onUpdate:modelValue"],Zw={nowrap:""},Kw=["onClick"],Jw=["onClick"],Qw=["onClick"],eT={class:"text-end"},tT={key:0,class:"col"},nT={class:"card"},iT={class:"card-header"},sT={class:"card-body"},oT={class:"mb-3"},rT=c("label",{class:"form-label"},"Name",-1),aT={class:"row mb-2"},lT={class:"col"},cT={class:"mb-3"},dT=c("label",{class:"form-label"},"Caption",-1),uT={class:"row mb-2"},hT={class:"col"},fT={class:"card mt-1"},pT=c("div",{class:"card-header"},"Nozzle calibration table",-1),mT={class:"card-body"},_T=["disabled"];function gT(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("NozzlesCalibrateTable");return W(),ee("div",kw,[c("div",Bw,[c("div",Vw,[c("table",Hw,[$w,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,(l,d)=>(W(),ee("tr",{onMousedown:u=>t.setCurrentRow(l),class:je(l==t.currentRow?"active-row":"")},[c("td",null,[l==t.currentRow?(W(),ee("span",Ww,[ke(r,{row:l,clipboard:t.clipboard,onCopy:e[0]||(e[0]=u=>o.doAction("copy",u)),onPaste:e[1]||(e[1]=u=>o.doAction("paste",u))},{default:Ct(()=>[Xw]),_:2},1032,["row","clipboard"])])):(W(),ee("span",jw,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":u=>l.name=u,ref_for:!0,ref:"name",onFocus:e[2]||(e[2]=u=>t.currentField="name"),class:"form-control form-control-sm"},null,40,Yw),[[_e,l.name]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":u=>l.caption=u,ref_for:!0,ref:"caption",onFocus:e[3]||(e[3]=u=>t.currentField="caption"),class:"form-control form-control-sm"},null,40,qw),[[_e,l.caption]])]),c("th",Zw,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>t.$emit("up",l)},"\u2BC5",8,Kw),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>t.$emit("down",l)},"\u2BC6",8,Jw),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:u=>t.$emit("delete",l)},"\u2BBF",8,Qw)])],42,Gw))),256))])],512),c("div",eT,[c("button",{onClick:e[4]||(e[4]=l=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add nozzle")])])]),o.isCurrent?(W(),ee("div",tT,[c("div",nT,[c("div",iT,"Nozzle "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",sT,[c("div",oT,[rT,c("div",aT,[c("div",lT,[se(c("input",{"onUpdate:modelValue":e[5]||(e[5]=l=>t.currentRow.name=l),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.name]])])])]),c("div",cT,[dT,c("div",uT,[c("div",hT,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>t.currentRow.caption=l),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.caption]])])])])])]),c("div",fT,[pT,c("div",mT,[ke(a,{rows:t.currentRow.calibrationData,currentRow:t.currentCalibrateRow,machinePos:n.machinePos,onSet:e[7]||(e[7]=l=>t.currentCalibrateRow=l),onSetPos:e[8]||(e[8]=l=>t.$emit("setPos",l))},null,8,["rows","currentRow","machinePos"]),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[9]||(e[9]=l=>t.$emit("autocalibrate",t.currentRow))},"Autocalibrate",8,_T)])])])):st("",!0)])}var vT=ct(zw,[["render",gT]]);const bT={mixins:[Ia,Hn],props:{nozzles:Object,machineState:Object,machinePos:Object,settings:Object,disabled:Boolean,loading:Boolean},components:{NozzlesTable:vT},data:function(){return{currentNozzle:this.currentNozzle}},mounted(){this.nozzles.length>0&&(this.currentNozzle=this.nozzles[0])},methods:{applaySettings(){this.$emit("applaySettings")},addNozzle(){let t=1;for(let e of this.nozzles)e.id>=t&&(t=e.id+1);this.nozzles.push({id:t,name:"Nozzle "+t.toString(),caption:"",calibrationData:[{a:0,dx:0,dy:0},{a:.125,dx:0,dy:0},{a:.25,dx:0,dy:0},{a:.375,dx:0,dy:0},{a:.5,dx:0,dy:0},{a:.625,dx:0,dy:0},{a:.75,dx:0,dy:0},{a:.875,dx:0,dy:0}]}),this.currentNozzle=this.nozzles[this.nozzles.length-1]},setXYOffset(t){if(this.machineStateIsOK()==!0){let e=this.settings.cams[1].pos.x,n=this.settings.cams[1].pos.y;t.dx=Math.round((this.machinePos.x-e)*1e3)/1e3,t.dy=Math.round((this.machinePos.y-n)*1e3)/1e3}},autocalibrate(t){Un("Do You want to start Autocalibration of Nozzle?","Confirm").then(e=>{e==!0&&this.$emit("autocalibrate",t)})}}},yT={class:"card"},xT=c("div",{class:"card-header"},"Nozzles Settings",-1),ST={class:"card-body"},MT={class:"row mt-2"},ET={class:"col"},wT=["disabled"];function TT(t,e,n,i,s,o){const r=et("NozzlesTable");return W(),ee("div",yT,[xT,c("div",ST,[ke(r,{rows:n.nozzles,currentRow:t.currentNozzle,machineState:n.machineState,machinePos:n.machinePos,disabled:n.disabled,onAdd:e[0]||(e[0]=a=>o.addNozzle()),onSet:e[1]||(e[1]=a=>t.currentNozzle=a),onUp:e[2]||(e[2]=a=>t.rowUp(n.nozzles,a)),onDown:e[3]||(e[3]=a=>t.rowDown(n.nozzles,a)),onDelete:e[4]||(e[4]=a=>t.rowDelete(n.nozzles,a)),onSetPos:e[5]||(e[5]=a=>o.setXYOffset(a)),onAutocalibrate:e[6]||(e[6]=a=>o.autocalibrate(a))},null,8,["rows","currentRow","machineState","machinePos","disabled"]),c("div",MT,[c("div",ET,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[7]||(e[7]=a=>o.applaySettings())},"Applay settings",8,wT)])])])])}var CT=ct(bT,[["render",TT]]);const AT={mixins:[ys,xs],components:{CopyPasteMenu:go},data:function(){return{currentField:"x",clipboard:this.clipboard}},methods:{doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(e=this.deepMerge(e,this.clipboard))}}},PT={class:"scroll"},RT={class:"table mb-5",ref:"table"},DT=c("thead",null,[c("tr",null,[c("th"),c("th",null,"x"),c("th",null,"y"),c("th",null,"z")])],-1),IT=["onMousedown"],LT={key:0},UT=Ie("\u2BC8"),FT={key:1},OT=["onUpdate:modelValue"],NT=["onUpdate:modelValue"],zT=["onUpdate:modelValue"],kT={nowrap:""},BT=["onClick"],VT=["onClick"],HT={class:"text-end"};function $T(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",PT,[c("table",RT,[DT,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,(a,l)=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(a),class:je(a==t.currentRow?"active-row":"")},[c("td",null,[a==t.currentRow?(W(),ee("span",LT,[ke(r,{row:a,clipboard:t.clipboard,onCopy:e[0]||(e[0]=d=>o.doAction("copy",d)),onPaste:e[1]||(e[1]=d=>o.doAction("paste",d))},{default:Ct(()=>[UT]),_:2},1032,["row","clipboard"])])):(W(),ee("span",FT,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.x=d,ref_for:!0,ref:"x",onFocus:e[2]||(e[2]=d=>t.currentField="x"),class:"form-control form-control-sm"},null,40,OT),[[_e,a.x]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.y=d,ref_for:!0,ref:"y",onFocus:e[3]||(e[3]=d=>t.currentField="y"),class:"form-control form-control-sm"},null,40,NT),[[_e,a.y]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.z=d,ref_for:!0,ref:"z",onFocus:e[4]||(e[4]=d=>t.currentField="z"),class:"form-control form-control-sm"},null,40,zT),[[_e,a.z]])]),c("th",kT,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:d=>t.$emit("setPos",a),title:"Set current position of nozzle"},"\u{1F78A}",8,BT),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,VT)])],42,IT))),256))])],512),c("div",HT,[c("button",{onClick:e[5]||(e[5]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add point")])])}var GT=ct(AT,[["render",$T]]);const WT={mixins:[ys,Hn,xs],props:{settings:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{NozzlesHolderPlacePointsTable:GT,CopyPasteMenu:go},data:function(){return{currentField:"name",currentPointRow:this.currentPointRow,clipboard:this.clipboard}},computed:{isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},methods:{addPoint(){this.currentRow.points.push({x:0,y:0,z:0}),this.currentPointRow=this.currentRow.points[this.currentRow.points.length-1]},setPointPos(t){this.machineStateIsOK()==!0&&(t.x=parseFloat(this.machinePos.x),t.y=parseFloat(this.machinePos.y),t.z=parseFloat(this.machinePos.z))},doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}}},XT={class:"row"},jT={class:"col"},YT={class:"scroll"},qT={class:"table mb-5",ref:"table"},ZT=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Nozzle"),c("th")])],-1),KT=["onMousedown"],JT={key:0},QT=Ie("\u2BC8"),eC={key:1},tC=["onUpdate:modelValue"],nC=["onUpdate:modelValue"],iC=c("option",{value:-1},"Empty",-1),sC=["value"],oC={nowrap:""},rC=["onClick"],aC=["onClick"],lC=["onClick"],cC={class:"text-end"},dC={key:0,class:"col"},uC={class:"card"},hC={class:"card-header"},fC={class:"card-body"},pC={class:"mb-3"},mC=c("label",{class:"form-label"},"Name",-1),_C={class:"row mb-2"},gC={class:"col"},vC={class:"mb-3"},bC=c("label",{class:"form-label"},"Nozzle",-1),yC={class:"row mb-2"},xC={class:"col"},SC=c("option",{value:-1},"Empty",-1),MC=["value"],EC={class:"mb-3"},wC=c("label",{class:"form-label"},"Feed",-1),TC={class:"row mb-2"},CC={class:"col"},AC={class:"card mt-1"},PC=c("div",{class:"card-header"},"Path to take nozzle",-1),RC={class:"card-body"},DC={class:"card mt-1"},IC=c("div",{class:"card-header"},"Actions",-1),LC={class:"card-body"},UC=["disabled"];function FC(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("NozzlesHolderPlacePointsTable");return W(),ee("div",XT,[c("div",jT,[c("div",YT,[c("table",qT,[ZT,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,l=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(l),class:je(l==t.currentRow?"active-row":"")},[c("td",null,[l==t.currentRow?(W(),ee("span",JT,[ke(r,{row:l,clipboard:t.clipboard,onCopy:e[0]||(e[0]=d=>o.doAction("copy",d)),onPaste:e[1]||(e[1]=d=>o.doAction("paste",d))},{default:Ct(()=>[QT]),_:2},1032,["row","clipboard"])])):(W(),ee("span",eC,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>l.name=d,ref_for:!0,ref:"name",onFocus:e[2]||(e[2]=d=>t.currentField="name"),class:"form-control form-control-sm"},null,40,tC),[[_e,l.name]])]),c("td",null,[se(c("select",{"onUpdate:modelValue":d=>l.nozzleId=d,class:"form-control form-control-sm"},[iC,(W(!0),ee(rt,null,wt(n.settings.nozzles,d=>(W(),ee("option",{value:d.id},ze(d.name),9,sC))),256))],8,nC),[[Kn,l.nozzleId]])]),c("th",oC,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("up",l)},"\u2BC5",8,rC),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("down",l)},"\u2BC6",8,aC),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",l)},"\u2BBF",8,lC)])],42,KT))),256))])],512),c("div",cC,[c("button",{onClick:e[3]||(e[3]=l=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add place")])])]),o.isCurrent?(W(),ee("div",dC,[c("div",uC,[c("div",hC,"Nozzle "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",fC,[c("div",pC,[mC,c("div",_C,[c("div",gC,[se(c("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>t.currentRow.name=l),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.name]])])])]),c("div",vC,[bC,c("div",yC,[c("div",xC,[se(c("select",{"onUpdate:modelValue":e[5]||(e[5]=l=>t.currentRow.nozzleId=l),class:"form-control form-control-sm"},[SC,(W(!0),ee(rt,null,wt(n.settings.nozzles,l=>(W(),ee("option",{value:l.id},ze(l.name),9,MC))),256))],512),[[Kn,t.currentRow.nozzleId]])])])]),c("div",EC,[wC,c("div",TC,[c("div",CC,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>t.currentRow.feed=l),type:"number",step:"1",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.feed]])])])])])]),c("div",AC,[PC,c("div",RC,[ke(a,{rows:t.currentRow.points,currentRow:t.currentPointRow,machinePos:n.machinePos,onSet:e[7]||(e[7]=l=>t.currentPointRow=l),onSetPos:e[8]||(e[8]=l=>o.setPointPos(l)),onAdd:e[9]||(e[9]=l=>o.addPoint()),onDelete:e[10]||(e[10]=l=>t.rowDelete(t.currentRow.points,l))},null,8,["rows","currentRow","machinePos"])])]),c("div",DC,[IC,c("div",LC,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[11]||(e[11]=l=>t.$emit("putOnNozzle",t.currentRow))},"Put on Nozzle",8,UC)])])])):st("",!0)])}var OC=ct(WT,[["render",FC]]);const NC={mixins:[Ia,Hn],props:{nozzlesHolder:Object,machineState:Object,machinePos:Object,settings:Object,disabled:Boolean,loading:Boolean},components:{NozzlesHolderPlaceTable:OC},data:function(){return{currentPlace:this.currentPlace}},mounted(){this.nozzlesHolder.places.length>0&&(this.currentPlace=this.nozzlesHolder.places[0])},methods:{applaySettings(){let t=!1;for(let e of this.nozzlesHolder.places)if(e.nozzleId==-1){t=!0;break}t?this.$emit("applaySettings"):lt("There is no anyone empty place. There need one empty space.","Warning","warning")},addPlace(){let t=1;for(let e of this.nozzlesHolder.places)e.id>=t&&(t=e.id+1);this.nozzlesHolder.places.push({id:t,name:"Place "+t,nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100}),this.currentPlace=this.nozzlesHolder.places[this.nozzlesHolder.places.length-1]}}},zC={class:"card"},kC=c("div",{class:"card-header"},"Nozzles Holder Settings",-1),BC={class:"card-body"},VC={class:"row mt-2"},HC={class:"col"},$C=["disabled"];function GC(t,e,n,i,s,o){const r=et("NozzlesHolderPlaceTable");return W(),ee("div",zC,[kC,c("div",BC,[ke(r,{rows:n.nozzlesHolder.places,currentRow:t.currentPlace,machineState:n.machineState,machinePos:n.machinePos,settings:n.settings,disabled:n.disabled,onPutOnNozzle:e[0]||(e[0]=a=>t.$emit("putOnNozzle",a)),onAdd:e[1]||(e[1]=a=>o.addPlace()),onSet:e[2]||(e[2]=a=>t.currentPlace=a),onUp:e[3]||(e[3]=a=>t.rowUp(n.nozzlesHolder.places,a)),onDown:e[4]||(e[4]=a=>t.rowDown(n.nozzlesHolder.places,a)),onDelete:e[5]||(e[5]=a=>t.rowDelete(n.nozzlesHolder.places,a))},null,8,["rows","currentRow","machineState","machinePos","settings","disabled"]),c("div",VC,[c("div",HC,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[6]||(e[6]=a=>o.applaySettings())},"Applay settings",8,$C)])])])])}var WC=ct(NC,[["render",GC]]);const XC={mixins:[Hn],props:{basket:Object,machineState:Object,machinePos:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},setPosition(t){this.machineStateIsOK()==!0&&(this.basket.pos.x=parseFloat(this.machinePos.x),this.basket.pos.y=parseFloat(this.machinePos.y),this.basket.pos.z=parseFloat(this.machinePos.z))}}},jC={class:"card"},YC=c("div",{class:"card-header"},"Basket Settings",-1),qC={class:"card-body"},ZC={class:"mb-3"},KC=c("label",{class:"form-label"},"Position",-1),JC={class:"row mb-2"},QC={class:"col"},eA={class:"row"},tA=c("div",{class:"col-auto pt-1"},"X:",-1),nA={class:"col"},iA={class:"col"},sA={class:"row"},oA=c("div",{class:"col-auto pt-1"},"Y:",-1),rA={class:"col"},aA={class:"col"},lA={class:"row"},cA=c("div",{class:"col-auto pt-1"},"Z:",-1),dA={class:"col"},uA={class:"col-auto"},hA={class:"row mt-2"},fA={class:"col"},pA=["disabled"];function mA(t,e,n,i,s,o){return W(),ee("div",jC,[YC,c("div",qC,[c("div",ZC,[KC,c("div",JC,[c("div",QC,[c("div",eA,[tA,c("div",nA,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.basket.pos.x=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.basket.pos.x]])])])]),c("div",iA,[c("div",sA,[oA,c("div",rA,[se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.basket.pos.y=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.basket.pos.y]])])])]),c("div",aA,[c("div",lA,[cA,c("div",dA,[se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.basket.pos.z=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.basket.pos.z]])])])]),c("div",uA,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:e[3]||(e[3]=r=>o.setPosition(t.n)),title:"Set current position of nozzle"},"\u{1F78A}")])])]),c("div",hA,[c("div",fA,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,pA)])])])])}var _A=ct(XC,[["render",mA]]);const gA={mixins:[Hn],props:{parking:Object,machineState:Object,machinePos:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},setPosition(t){this.machineStateIsOK()==!0&&(this.parking.pos.x=parseFloat(this.machinePos.x),this.parking.pos.y=parseFloat(this.machinePos.y),this.parking.pos.z=parseFloat(this.machinePos.z))}}},vA={class:"card"},bA=c("div",{class:"card-header"},"Parking Settings",-1),yA={class:"card-body"},xA={class:"mb-3"},SA=c("label",{class:"form-label"},"Position",-1),MA={class:"row mb-2"},EA={class:"col"},wA={class:"row"},TA=c("div",{class:"col-auto pt-1"},"X:",-1),CA={class:"col"},AA={class:"col"},PA={class:"row"},RA=c("div",{class:"col-auto pt-1"},"Y:",-1),DA={class:"col"},IA={class:"col"},LA={class:"row"},UA=c("div",{class:"col-auto pt-1"},"Z:",-1),FA={class:"col"},OA={class:"col-auto"},NA={class:"row mt-2"},zA={class:"col"},kA=["disabled"];function BA(t,e,n,i,s,o){return W(),ee("div",vA,[bA,c("div",yA,[c("div",xA,[SA,c("div",MA,[c("div",EA,[c("div",wA,[TA,c("div",CA,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.parking.pos.x=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.parking.pos.x]])])])]),c("div",AA,[c("div",PA,[RA,c("div",DA,[se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.parking.pos.y=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.parking.pos.y]])])])]),c("div",IA,[c("div",LA,[UA,c("div",FA,[se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.parking.pos.z=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.parking.pos.z]])])])]),c("div",OA,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:e[3]||(e[3]=r=>o.setPosition(t.n)),title:"Set current position of nozzle"},"\u{1F78A}")])])]),c("div",NA,[c("div",zA,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,kA)])])])])}var VA=ct(gA,[["render",BA]]);const HA={mixins:[ys,xs],components:{CopyPasteMenu:go},data:function(){return{currentField:"x",clipboard:this.clipboard}},methods:{doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(e=this.deepMerge(e,this.clipboard))}}},$A={class:"scroll"},GA={class:"table mb-5",ref:"table"},WA=c("thead",null,[c("tr",null,[c("th"),c("th",null,"x"),c("th",null,"y"),c("th",null,"z"),c("th",null,"pick")])],-1),XA=["onMousedown"],jA={key:0},YA=Ie("\u2BC8"),qA={key:1},ZA=["onUpdate:modelValue"],KA=["onUpdate:modelValue"],JA=["onUpdate:modelValue"],QA=["onUpdate:modelValue"],eP={nowrap:""},tP=["onClick"],nP=["onClick"],iP={class:"text-end"};function sP(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",$A,[c("table",GA,[WA,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,(a,l)=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(a),class:je(a==t.currentRow?"active-row":"")},[c("td",null,[a==t.currentRow?(W(),ee("span",jA,[ke(r,{row:a,clipboard:t.clipboard,onCopy:e[0]||(e[0]=d=>o.doAction("copy",d)),onPaste:e[1]||(e[1]=d=>o.doAction("paste",d))},{default:Ct(()=>[YA]),_:2},1032,["row","clipboard"])])):(W(),ee("span",qA,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.x=d,ref_for:!0,ref:"x",onFocus:e[2]||(e[2]=d=>t.currentField="x"),class:"form-control form-control-sm"},null,40,ZA),[[_e,a.x]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.y=d,ref_for:!0,ref:"y",onFocus:e[3]||(e[3]=d=>t.currentField="y"),class:"form-control form-control-sm"},null,40,KA),[[_e,a.y]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.z=d,ref_for:!0,ref:"z",onFocus:e[4]||(e[4]=d=>t.currentField="z"),class:"form-control form-control-sm"},null,40,JA),[[_e,a.z]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pick=d,type:"checkbox",class:"form-check-input"},null,8,QA),[[Zn,a.pick]])]),c("th",eP,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:d=>t.$emit("setPos",a),title:"Set current position of nozzle"},"\u{1F78A}",8,tP),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,nP)])],42,XA))),256))])],512),c("div",iP,[c("button",{onClick:e[5]||(e[5]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add point")])])}var oP=ct(HA,[["render",sP]]);const rP={mixins:[ys,Hn,xs],props:{settings:Object,cases:Object,feederTypes:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{FeedersPathPointsTable:oP,CopyPasteMenu:go,PopupMenu:cp,PopupMenuItem:dp},data:function(){return{currentField:"name",currentPoint:this.currentPoint,clipboard:this.clipboard}},computed:{isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},methods:{addPathPoint(t){this.currentRow.pathPoints.push({x:0,y:0,z:0,pick:!1})},setFeederPos(t){this.machineStateIsOK()==!0&&(t.pos.x=this.machinePos.x,t.pos.y=this.machinePos.y,t.pos.z=this.machinePos.z)},setFeederPosCAM(t){this.machineStateIsOK()==!0&&(t.pos.x=parseFloat(this.machinePos.x)+parseFloat(this.settings.cams[0].offset.x),t.pos.y=parseFloat(this.machinePos.y)+parseFloat(this.settings.cams[0].offset.y))},setPointPos(t){this.machineStateIsOK()==!0&&(t.x=this.machinePos.x,t.y=this.machinePos.y,t.z=this.machinePos.z)},fixFiderPosByCamPos(t,e){if(this.machineStateIsOK()==!0&&(t.type==0&&((e=="x"||e=="xy")&&(t.pos.x=parseFloat(this.machinePos.x)+parseFloat(this.settings.cams[0].offset.x)),(e=="y"||e=="xy")&&(t.pos.y=parseFloat(this.machinePos.y)+parseFloat(this.settings.cams[0].offset.y))),t.type==1)){let n;for(let i of t.pathPoints)i.pick==!0&&(n=i);if(n){let i=parseFloat(this.machinePos.x)+parseFloat(this.settings.cams[0].offset.x),s=parseFloat(this.machinePos.y)+parseFloat(this.settings.cams[0].offset.y),o=i-n.x,r=s-n.y;for(let a of t.pathPoints)(e=="x"||e=="xy")&&(a.x=(parseFloat(a.x)+parseFloat(o)).toFixed(3)),(e=="y"||e=="xy")&&(a.y=(parseFloat(a.y)+parseFloat(r)).toFixed(3))}}},drawSMDCase(){let t=this.$refs.smdCase,e=t.getContext("2d"),n=t.width,i=t.height;if(e.clearRect(0,0,n,i),this.$refs.smdCase){let s=this.currentRow.case;for(let o of this.cases)if(o.name==s){const r=new Image;r.src=o.src,r.onload=()=>{let a=n/2,l=i/2,d=n*.7,u=r.height*(d/r.width),f=a-d/2,h=l-u/2,m=2*Math.PI*this.currentRow.caseRotate;e.translate(a,l),e.rotate(-m),e.translate(-a,-l),e.drawImage(r,f,h,d,u),e.translate(a,l),e.rotate(m),e.translate(-a,-l),e.stroke()}}}},doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}},watch:{currentRow(){clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.drawSMDCase()},200)}}},aP={class:"row"},lP={class:"col"},cP={class:"scroll"},dP={class:"table mb-5",ref:"table"},uP=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Caption"),c("th",null,"Type"),c("th")])],-1),hP=["onMousedown"],fP={key:0},pP=Ie("\u2BC8"),mP={key:1},_P=["onUpdate:modelValue"],gP=["onUpdate:modelValue"],vP=["onUpdate:modelValue"],bP={nowrap:""},yP=["onClick"],xP=["onClick"],SP=["onClick"],MP={class:"text-end"},EP={class:"col"},wP={key:0,class:"card"},TP={class:"card-header"},CP={class:"card-body"},AP={class:"mb-3"},PP=c("label",{class:"form-label"},"Name",-1),RP={class:"row mb-2"},DP={class:"col"},IP={class:"mb-3"},LP=c("label",{class:"form-label"},"Caption",-1),UP={class:"row mb-2"},FP={class:"col"},OP={class:"mb-3"},NP=c("label",{class:"form-label"},"Type",-1),zP={class:"row mb-2"},kP={class:"col"},BP=["value"],VP={key:0},HP={class:"mb-3"},$P=c("label",{class:"form-label"},"Position",-1),GP={class:"row mb-2"},WP={class:"col"},XP=Ie(" X: "),jP={class:"col"},YP=Ie(" Y: "),qP={class:"col"},ZP=Ie(" Z: "),KP={class:"col-auto"},JP={class:"mb-3"},QP=c("label",{class:"form-label"},"Step",-1),eR={class:"row mb-2"},tR={class:"col"},nR=Ie(" X: "),iR={class:"col"},sR=Ie(" Y: "),oR={class:"col"},rR=Ie(" Z: "),aR={class:"mb-3"},lR={class:"row mb-2"},cR={class:"col"},dR=Ie(" Capacity "),uR={class:"col"},hR=Ie(" Current "),fR={class:"col"},pR={key:1},mR={class:"mb-3"},_R=c("label",{class:"form-label"},"Path points",-1),gR={class:"row mb-2"},vR={class:"col"},bR={class:"mb-3"},yR=c("label",{class:"form-label"},"Elements height",-1),xR={class:"row mb-2"},SR={class:"col"},MR={class:"mb-3"},ER=c("label",{class:"form-label"},"Nozzle",-1),wR={class:"row mb-2"},TR={class:"col"},CR=["value"],AR=c("div",{class:"form-text"},"Specify Nozzle to pick up element",-1),PR={class:"mb-3"},RR=c("label",{class:"form-label"},"Case",-1),DR={class:"row mb-2"},IR={class:"col"},LR=["value"],UR={ref:"smdCase",width:"64",height:"64",style:{border:"silver solid 1px"}},FR={class:"mb-3"},OR=c("label",{class:"form-label"},"Orientation in the feeder",-1),NR={class:"row mb-2"},zR={class:"col"},kR=c("div",{class:"form-text"},"Sets elements orientation in the feeder",-1),BR={class:"mb-3"},VR=c("label",{class:"form-label",for:"posCorrection"},"Correct the element's position after pick",-1),HR={class:"row mb-2"},$R={class:"col"},GR={class:"form-check form-switch"},WR=c("div",{class:"form-text"},"Uses bottom camera to correct position of element after pick",-1),XR={class:"mb-3"},jR=c("label",{class:"form-label"},"Active",-1),YR={class:"row mb-2"},qR={class:"col"},ZR={class:"form-check form-switch"},KR={key:1,class:"card mt-1"},JR=c("div",{class:"card-header"},"Actions",-1),QR={class:"card-body"},e2=["disabled"],t2=["disabled"],n2=["disabled"],i2=["disabled"],s2=["disabled"],o2=["disabled"],r2=Ie("X"),a2=Ie("Y"),l2=Ie("Both");function c2(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("FeedersPathPointsTable"),l=et("PopupMenuItem"),d=et("PopupMenu");return W(),ee("div",aP,[c("div",lP,[c("div",cP,[c("table",dP,[uP,c("tbody",null,[(W(!0),ee(rt,null,wt(t.rows,(u,f)=>(W(),ee("tr",{onMousedown:h=>t.setCurrentRow(u),class:je(u==t.currentRow?"active-row":"")},[c("td",null,[u==t.currentRow?(W(),ee("span",fP,[ke(r,{row:u,clipboard:t.clipboard,onCopy:e[0]||(e[0]=h=>o.doAction("copy",h)),onPaste:e[1]||(e[1]=h=>o.doAction("paste",h))},{default:Ct(()=>[pP]),_:2},1032,["row","clipboard"])])):(W(),ee("span",mP,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":h=>u.name=h,ref_for:!0,ref:"name",onFocus:e[2]||(e[2]=h=>t.currentField="name"),class:"form-control form-control-sm"},null,40,_P),[[_e,u.name]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":h=>u.caption=h,ref_for:!0,ref:"caption",onFocus:e[3]||(e[3]=h=>t.currentField="caption"),class:"form-control form-control-sm"},null,40,gP),[[_e,u.caption]])]),c("td",null,ze(n.feederTypes[u.type].name),1),c("td",null,[se(c("input",{"onUpdate:modelValue":h=>u.active=h,ref_for:!0,ref:"active",onFocus:e[4]||(e[4]=h=>t.currentField="active"),type:"checkbox",class:"form-control form-control-sm",title:"Active"},null,40,vP),[[Zn,u.active]])]),c("th",bP,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:h=>t.$emit("up",u)},"\u2BC5",8,yP),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:h=>t.$emit("down",u)},"\u2BC6",8,xP),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:h=>t.$emit("delete",u)},"\u2BBF",8,SP)])],42,hP))),256))])],512),c("div",MP,[c("button",{onClick:e[5]||(e[5]=u=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add feeder")])])]),c("div",EP,[o.isCurrent?(W(),ee("div",wP,[c("div",TP,"Feeder "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",CP,[c("div",AP,[PP,c("div",RP,[c("div",DP,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=u=>t.currentRow.name=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.name]])])])]),c("div",IP,[LP,c("div",UP,[c("div",FP,[se(c("input",{"onUpdate:modelValue":e[7]||(e[7]=u=>t.currentRow.caption=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.caption]])])])]),c("div",OP,[NP,c("div",zP,[c("div",kP,[se(c("select",{"onUpdate:modelValue":e[8]||(e[8]=u=>t.currentRow.type=u),class:"form-control form-control-sm"},[(W(!0),ee(rt,null,wt(n.feederTypes,u=>(W(),ee("option",{value:u.id},ze(u.name),9,BP))),256))],512),[[Kn,t.currentRow.type]])])])]),t.currentRow.type==0?(W(),ee("span",VP,[c("div",HP,[$P,c("div",GP,[c("div",WP,[XP,se(c("input",{"onUpdate:modelValue":e[9]||(e[9]=u=>t.currentRow.pos.x=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.pos.x]])]),c("div",jP,[YP,se(c("input",{"onUpdate:modelValue":e[10]||(e[10]=u=>t.currentRow.pos.y=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.pos.y]])]),c("div",qP,[ZP,se(c("input",{"onUpdate:modelValue":e[11]||(e[11]=u=>t.currentRow.pos.z=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.pos.z]])]),c("div",KP,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[12]||(e[12]=u=>o.setFeederPosCAM(t.currentRow)),title:"Set current position of camera (x, y)"},"\u26F6"),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[13]||(e[13]=u=>o.setFeederPos(t.currentRow)),title:"Set current position of nozzle (x, y, z)"},"\u{1F78A}")])])]),c("div",JP,[QP,c("div",eR,[c("div",tR,[nR,se(c("input",{"onUpdate:modelValue":e[14]||(e[14]=u=>t.currentRow.step.x=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.step.x]])]),c("div",iR,[sR,se(c("input",{"onUpdate:modelValue":e[15]||(e[15]=u=>t.currentRow.step.y=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.step.y]])]),c("div",oR,[rR,se(c("input",{"onUpdate:modelValue":e[16]||(e[16]=u=>t.currentRow.step.z=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.step.z]])])])]),c("div",aR,[c("div",lR,[c("div",cR,[dR,se(c("input",{"onUpdate:modelValue":e[17]||(e[17]=u=>t.currentRow.capacity=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.capacity]])]),c("div",uR,[hR,se(c("input",{"onUpdate:modelValue":e[18]||(e[18]=u=>t.currentRow.current=u),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.current]])]),c("div",fR,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[19]||(e[19]=u=>t.currentRow.current=0)},"Reset")])])])])):st("",!0),t.currentRow.type==1?(W(),ee("span",pR,[c("div",mR,[_R,c("div",gR,[c("div",vR,[ke(a,{rows:t.currentRow.pathPoints,currentRow:t.currentPoint,onAdd:e[20]||(e[20]=u=>o.addPathPoint(u)),onSet:e[21]||(e[21]=u=>t.currentPoint=u),onSetPos:e[22]||(e[22]=u=>o.setPointPos(u)),onDelete:e[23]||(e[23]=u=>t.rowDelete(t.currentRow.pathPoints,u))},null,8,["rows","currentRow"])])])])])):st("",!0),c("div",bR,[yR,c("div",xR,[c("div",SR,[se(c("input",{"onUpdate:modelValue":e[24]||(e[24]=u=>t.currentRow.elementHeight=u),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.elementHeight]])])])]),c("div",MR,[ER,c("div",wR,[c("div",TR,[se(c("select",{"onUpdate:modelValue":e[25]||(e[25]=u=>t.currentRow.nozzle=u),class:"form-control form-control-sm"},[(W(!0),ee(rt,null,wt(n.settings.nozzles,u=>(W(),ee("option",{value:u.id},ze(u.name),9,CR))),256))],512),[[Kn,t.currentRow.nozzle]]),AR])])]),c("div",PR,[RR,c("div",DR,[c("div",IR,[se(c("select",{"onUpdate:modelValue":e[26]||(e[26]=u=>t.currentRow.case=u),class:"form-control form-control-sm",onChange:e[27]||(e[27]=u=>o.drawSMDCase())},[(W(!0),ee(rt,null,wt(n.cases,u=>(W(),ee("option",{value:u.name},ze(u.name),9,LR))),256))],544),[[Kn,t.currentRow.case]]),c("canvas",UR,null,512)])])]),c("div",FR,[OR,c("div",NR,[c("div",zR,[se(c("input",{"onUpdate:modelValue":e[28]||(e[28]=u=>t.currentRow.caseRotate=u),type:"number",step:"0.125",class:"form-control form-control-sm",onChange:e[29]||(e[29]=u=>o.drawSMDCase())},null,544),[[_e,t.currentRow.caseRotate]])]),kR])]),c("div",BR,[VR,c("div",HR,[c("div",$R,[c("div",GR,[se(c("input",{"onUpdate:modelValue":e[30]||(e[30]=u=>t.currentRow.posCorrection=u),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Zn,t.currentRow.posCorrection]])])]),WR])]),c("div",XR,[jR,c("div",YR,[c("div",qR,[c("div",ZR,[se(c("input",{"onUpdate:modelValue":e[31]||(e[31]=u=>t.currentRow.active=u),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Zn,t.currentRow.active]])])])])])])])):st("",!0),o.isCurrent?(W(),ee("div",KR,[JR,c("div",QR,[c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[32]||(e[32]=u=>t.$emit("pickFromFeeder",t.currentRow))},"Pick element from Feeder",8,e2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[33]||(e[33]=u=>t.$emit("fixPosition"))},"Fix position of Picked element",8,t2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[34]||(e[34]=u=>t.$emit("dropIntoBasket"))},"Drop Picked element into Basket",8,n2)]),c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[35]||(e[35]=u=>t.$emit("goToFeeder",t.currentRow))},"Jog Nozzle to to Feeder position",8,i2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[36]||(e[36]=u=>t.$emit("goToFeederCam",t.currentRow))},"Jog Camera to to Feeder position",8,s2)]),c("div",null,[ke(d,null,{menubutton:Ct(()=>[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1 dropdown-toggle"},"Fix feeder's position by top Camera ",8,o2)]),menuitems:Ct(()=>[ke(l,{disabled:n.disabled,onClick:e[37]||(e[37]=u=>o.fixFiderPosByCamPos(t.currentRow,"x"))},{default:Ct(()=>[r2]),_:1},8,["disabled"]),ke(l,{disabled:n.disabled,onClick:e[38]||(e[38]=u=>o.fixFiderPosByCamPos(t.currentRow,"y"))},{default:Ct(()=>[a2]),_:1},8,["disabled"]),ke(l,{disabled:n.disabled,onClick:e[39]||(e[39]=u=>o.fixFiderPosByCamPos(t.currentRow,"xy"))},{default:Ct(()=>[l2]),_:1},8,["disabled"])]),_:1})])])])):st("",!0)])])}var d2=ct(rP,[["render",c2]]);const u2={mixins:[Ia],props:{feeders:Object,settings:Object,cases:Object,machineState:Object,machinePos:Object,disabled:Boolean,loading:Boolean},components:{FeedersTable:d2},data:function(){return{feederTypes:[{id:0,name:"Liner"},{id:1,name:"Push-pull"}],currentFeeder:this.currentFeeder}},mounted(){this.setCurrentFirst()},methods:{setCurrentFirst(){this.feeders.length>0&&(this.currentFeeder=this.feeders[0])},addFeeder(){let t=1;for(let e of this.feeders)e.id>=t&&(t=e.id+1);this.feeders.push({id:t,name:"Feeder "+t.toString(),caption:"",type:0,pos:{x:0,y:0,z:0},step:{x:0,y:0,z:0},pathPoints:[],capacity:0,current:0,elementHeight:.4,nozzle:0,case:"",caseRotate:0,posCorrection:!0,active:!0}),this.currentFeeder=this.feeders[this.feeders.length-1]},saveFeeders(){this.$emit("saveFeeders")}},watch:{feeders(){this.setCurrentFirst()}}},h2={class:"card"},f2=c("div",{class:"card-header"},"Feeders Settings",-1),p2={class:"card-body"},m2={class:"mt-1"},_2=["disabled"];function g2(t,e,n,i,s,o){const r=et("FeedersTable");return W(),ee("div",h2,[f2,c("div",p2,[ke(r,{rows:n.feeders,currentRow:t.currentFeeder,settings:n.settings,cases:n.cases,feederTypes:t.feederTypes,machineState:n.machineState,machinePos:n.machinePos,disabled:n.disabled,onGoToFeeder:e[0]||(e[0]=a=>t.$emit("goToFeeder",a)),onGoToFeederCam:e[1]||(e[1]=a=>t.$emit("goToFeederCam",a)),onPickFromFeeder:e[2]||(e[2]=a=>t.$emit("pickFromFeeder",a)),onFixPosition:e[3]||(e[3]=a=>t.$emit("fixPosition",a)),onDropIntoBasket:e[4]||(e[4]=a=>t.$emit("dropIntoBasket",a)),onAdd:e[5]||(e[5]=a=>o.addFeeder()),onSet:e[6]||(e[6]=a=>t.currentFeeder=a),onUp:e[7]||(e[7]=a=>t.rowUp(n.feeders,a)),onDown:e[8]||(e[8]=a=>t.rowDown(n.feeders,a)),onDelete:e[9]||(e[9]=a=>t.rowDelete(n.feeders,a))},null,8,["rows","currentRow","settings","cases","feederTypes","machineState","machinePos","disabled"]),c("div",m2,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary me-1",onClick:e[10]||(e[10]=a=>o.saveFeeders())},"Save feeders",8,_2)])])])}var up=ct(u2,[["render",g2]]);const v2={mixins:[Hn],props:{pcbtable:Object,machineState:Object,machinePos:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},setPosition(t){this.machineStateIsOK()==!0&&(this.pcbtable.z=parseFloat(this.machinePos.z))}}},b2={class:"card"},y2=c("div",{class:"card-header"},"PCB Table Settings",-1),x2={class:"card-body"},S2={class:"mb-3"},M2=c("label",{class:"form-label"},"PCB Table position",-1),E2={class:"row mb-2"},w2={class:"col"},T2={class:"row"},C2=c("div",{class:"col-auto pt-1"},"X:",-1),A2={class:"col"},P2={class:"col"},R2={class:"row"},D2=c("div",{class:"col-auto pt-1"},"Y:",-1),I2={class:"col"},L2={class:"col"},U2={class:"row"},F2=c("div",{class:"col-auto pt-1"},"Z:",-1),O2={class:"col"},N2={class:"col-auto"},z2=c("div",{class:"form-text"},"Left bottom PCB table position",-1),k2={class:"row mt-2"},B2={class:"col"},V2=["disabled"];function H2(t,e,n,i,s,o){return W(),ee("div",b2,[y2,c("div",x2,[c("div",S2,[M2,c("div",E2,[c("div",w2,[c("div",T2,[C2,c("div",A2,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.pcbtable.x=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.pcbtable.x]])])])]),c("div",P2,[c("div",R2,[D2,c("div",I2,[se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.pcbtable.y=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.pcbtable.y]])])])]),c("div",L2,[c("div",U2,[F2,c("div",O2,[se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.pcbtable.z=r),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[_e,n.pcbtable.z]])])])]),c("div",N2,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1",onClick:e[3]||(e[3]=r=>o.setPosition(t.n)),title:"Set current position of nozzle"},"\u{1F78A}")])]),z2]),c("div",k2,[c("div",B2,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,V2)])])])])}var $2=ct(v2,[["render",H2]]);const G2={mixins:[ys,Hn,xs],props:{settings:Object,machineState:Object,machinePos:Object,feeders:Object,disabled:Boolean},components:{CopyPasteMenu:go},data:function(){return{currentField:"name",clipboard:this.clipboard}},computed:{elements(){if(this.rows){let t=this.rows;for(let e of t){let n=this.getFeederById(e.feeder);if(n!==null){let i=this.getNozzleById(n.nozzle);e.nozzleId=n.nozzle,e.nozzleName=i.name}}return t}},isCurrent(){return this.currentRow&&this.rows.indexOf(this.currentRow)>-1}},methods:{setElementPos(t){this.machineStateIsOK()==!0&&(t.pos.x=this.machinePos.x,t.pos.y=this.machinePos.y)},setElementPosCam(t){if(this.machineStateIsOK()==!0){let e=this.settings.cams[0].offset;t.pos.x=(parseFloat(this.machinePos.x)+parseFloat(e.x)).toFixed(3),t.pos.y=(parseFloat(this.machinePos.y)+parseFloat(e.y)).toFixed(3)}},refreshCurrentElement(t){this.$emit("set",t)},goToElement(t){this.$emit("goToElement",t)},goToElementCam(t){this.$emit("goToElementCam",t)},placeElement(t){this.$emit("placeElement",t)},getFeederById(t){for(let e of this.feeders)if(e.id==t)return e;return null},getNozzleById(t){for(let e of this.settings.nozzles)if(e.id==t)return e;return null},goToFeeder(t){this.$emit("goToFeeder",this.getFeederById(t))},goToFeederCam(t){this.$emit("goToFeederCam",this.getFeederById(t))},runFrom(t){this.$emit("runFrom",t)},doAction(t,e){t=="copy"&&(this.clipboard=Object.assign({},e)),t=="paste"&&(this.clipboard.id=e.id,e=this.deepMerge(e,this.clipboard))}}},W2={class:"row"},X2={class:"col mh-100"},j2={class:"scroll"},Y2={class:"table mb-5",ref:"table"},q2=c("th",null,null,-1),Z2=c("th",null,"Name",-1),K2=c("th",null,"Caption",-1),J2={nowrap:""},Q2=Ie("Feeder "),e3=Ie(),t3={nowrap:""},n3=Ie("Nozzle "),i3=Ie(),s3={nowrap:""},o3=Ie("X "),r3=Ie(),a3={nowrap:""},l3=Ie("Y "),c3=Ie(),d3=c("th",null,"A",-1),u3=c("th",null,null,-1),h3=c("th",null,null,-1),f3=["onMousedown"],p3={key:0},m3=Ie("\u2BC8"),_3={key:1},g3=["onUpdate:modelValue"],v3=["onUpdate:modelValue"],b3=["onUpdate:modelValue"],y3=["value"],x3={nowrap:""},S3=["onUpdate:modelValue"],M3=["onUpdate:modelValue"],E3=["onUpdate:modelValue"],w3=["onUpdate:modelValue"],T3={nowrap:""},C3=["onClick"],A3=["onClick"],P3=["onClick"],R3={class:"text-end"},D3={class:"col"},I3={key:0,class:"card"},L3={class:"card-header"},U3={class:"card-body"},F3={class:"mb-3"},O3=c("label",{class:"form-label"},"Name",-1),N3={class:"row mb-2"},z3={class:"col"},k3={class:"mb-3"},B3=c("label",{class:"form-label"},"Caption",-1),V3={class:"row mb-2"},H3={class:"col"},$3={class:"mb-3"},G3=c("label",{class:"form-label"},"Feeder",-1),W3={class:"row mb-2"},X3={class:"col"},j3=["value"],Y3={class:"mb-3"},q3=c("label",{class:"form-label"},"Position",-1),Z3={class:"row mb-2"},K3={class:"col"},J3=Ie(" X: "),Q3={class:"col"},eD=Ie(" Y: "),tD={class:"col"},nD=Ie(" A: "),iD={class:"col-auto"},sD={class:"mb-3"},oD=c("label",{class:"form-label"},"Active",-1),rD={class:"row mb-2"},aD={class:"col"},lD={class:"form-check form-switch"},cD={key:1,class:"card mt-1"},dD=c("div",{class:"card-header"},"Actions",-1),uD={class:"card-body"},hD=["disabled"],fD=["disabled"],pD=["disabled"],mD=Ie("Jog Nozzle to "),_D=c("b",null,"Element",-1),gD=Ie(" position"),vD=[mD,_D,gD],bD=["disabled"],yD=Ie("Jog Nozzle to to "),xD=c("b",null,"Feeder",-1),SD=Ie(" position"),MD=[yD,xD,SD],ED=["disabled"],wD=Ie("Jog Camera to "),TD=c("b",null,"Element",-1),CD=Ie(" position"),AD=[wD,TD,CD],PD=["disabled"],RD=Ie("Jog Camera to to "),DD=c("b",null,"Feeder",-1),ID=Ie(" position"),LD=[RD,DD,ID];function UD(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",W2,[c("div",X2,[c("div",j2,[c("table",Y2,[c("thead",null,[c("tr",null,[q2,Z2,K2,c("th",J2,[Q2,c("a",{onClick:e[0]||(e[0]=a=>t.$emit("sortElements",{field:"feeder",order:"up"})),title:"Sort by Feeder"},"\u2BC5"),e3,c("a",{onClick:e[1]||(e[1]=a=>t.$emit("sortElements",{field:"feeder",order:"down"})),title:"Sort by Feeder"},"\u2BC6")]),c("th",t3,[n3,c("a",{onClick:e[2]||(e[2]=a=>t.$emit("sortElements",{field:"nozzle",order:"up"})),title:"Sort by Nozzle"},"\u2BC5"),i3,c("a",{onClick:e[3]||(e[3]=a=>t.$emit("sortElements",{field:"nozzle",order:"down"})),title:"Sort by Nozzle"},"\u2BC6")]),c("th",s3,[o3,c("a",{onClick:e[4]||(e[4]=a=>t.$emit("sortElements",{field:"x",order:"up"})),title:"Sort by X"},"\u2BC5"),r3,c("a",{onClick:e[5]||(e[5]=a=>t.$emit("sortElements",{field:"x",order:"down"})),title:"Sort by X"},"\u2BC6")]),c("th",a3,[l3,c("a",{onClick:e[6]||(e[6]=a=>t.$emit("sortElements",{field:"y",order:"up"})),title:"Sort by Y"},"\u2BC5"),c3,c("a",{onClick:e[7]||(e[7]=a=>t.$emit("sortElements",{field:"y",order:"down"})),title:"Sort by Y"},"\u2BC6")]),d3,u3,h3])]),c("tbody",null,[(W(!0),ee(rt,null,wt(o.elements,(a,l)=>(W(),ee("tr",{onMousedown:d=>t.setCurrentRow(a),class:je(a==t.currentRow?"active-row":"")},[c("td",null,[a==t.currentRow?(W(),ee("span",p3,[ke(r,{row:a,clipboard:t.clipboard,onCopy:e[8]||(e[8]=d=>o.doAction("copy",d)),onPaste:e[9]||(e[9]=d=>o.doAction("paste",d))},{default:Ct(()=>[m3]),_:2},1032,["row","clipboard"])])):(W(),ee("span",_3,"\xA0\xA0"))]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.name=d,ref_for:!0,ref:"name",onFocus:e[10]||(e[10]=d=>t.currentField="name"),class:"form-control form-control-sm",size:"10"},null,40,g3),[[_e,a.name]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.caption=d,ref_for:!0,ref:"caption",onFocus:e[11]||(e[11]=d=>t.currentField="caption"),class:"form-control form-control-sm",size:"10"},null,40,v3),[[_e,a.caption]])]),c("td",null,[se(c("select",{"onUpdate:modelValue":d=>a.feeder=d,class:"form-control form-control-sm"},[(W(!0),ee(rt,null,wt(n.feeders,d=>(W(),ee("option",{value:d.id},ze(d.name)+" ( "+ze(d.caption)+" )",9,y3))),256))],8,b3),[[Kn,a.feeder]])]),c("td",x3,ze(a.nozzleName),1),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pos.x=d,ref_for:!0,ref:"X",onFocus:e[12]||(e[12]=d=>t.currentField="X"),class:"form-control form-control-sm",size:"3"},null,40,S3),[[_e,a.pos.x]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pos.y=d,ref_for:!0,ref:"Y",onFocus:e[13]||(e[13]=d=>t.currentField="Y"),class:"form-control form-control-sm",size:"3"},null,40,M3),[[_e,a.pos.y]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pos.a=d,ref_for:!0,ref:"A",onFocus:e[14]||(e[14]=d=>t.currentField="A"),onChange:e[15]||(e[15]=d=>o.refreshCurrentElement(t.currentRow)),class:"form-control form-control-sm",size:"3"},null,40,E3),[[_e,a.pos.a]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.active=d,ref_for:!0,ref:"active",onFocus:e[16]||(e[16]=d=>t.currentField="active"),type:"checkbox",class:"form-control form-control-sm",title:"Active"},null,40,w3),[[Zn,a.active]])]),c("th",T3,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("up",a)},"\u2BC5",8,C3),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("down",a)},"\u2BC6",8,A3),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,P3)])],42,f3))),256))])],512),c("div",R3,[c("button",{onClick:e[17]||(e[17]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary me-1"},"Add element"),c("button",{onClick:e[18]||(e[18]=a=>t.$emit("import")),class:"btn btn-sm btn-outline-secondary"},"Import elements...")])])]),c("div",D3,[o.isCurrent?(W(),ee("div",I3,[c("div",L3,"Element "+ze(t.currentRow.name)+" (# "+ze(t.currentRow.id)+")",1),c("div",U3,[c("div",F3,[O3,c("div",N3,[c("div",z3,[se(c("input",{"onUpdate:modelValue":e[19]||(e[19]=a=>t.currentRow.name=a),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.name]])])])]),c("div",k3,[B3,c("div",V3,[c("div",H3,[se(c("input",{"onUpdate:modelValue":e[20]||(e[20]=a=>t.currentRow.caption=a),type:"text",class:"form-control form-control-sm"},null,512),[[_e,t.currentRow.caption]])])])]),c("div",$3,[G3,c("div",W3,[c("div",X3,[se(c("select",{"onUpdate:modelValue":e[21]||(e[21]=a=>t.currentRow.feeder=a),class:"form-control form-control-sm"},[(W(!0),ee(rt,null,wt(n.feeders,a=>(W(),ee("option",{value:a.id},ze(a.name)+" ( "+ze(a.caption)+" )",9,j3))),256))],512),[[Kn,t.currentRow.feeder]])])])]),c("div",Y3,[q3,c("div",Z3,[c("div",K3,[J3,se(c("input",{"onUpdate:modelValue":e[22]||(e[22]=a=>t.currentRow.pos.x=a),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[_e,t.currentRow.pos.x]])]),c("div",Q3,[eD,se(c("input",{"onUpdate:modelValue":e[23]||(e[23]=a=>t.currentRow.pos.y=a),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[_e,t.currentRow.pos.y]])]),c("div",tD,[nD,se(c("input",{"onUpdate:modelValue":e[24]||(e[24]=a=>t.currentRow.pos.a=a),onChange:e[25]||(e[25]=a=>o.refreshCurrentElement(t.currentRow)),type:"number",class:"form-control form-control-sm",step:"0.01"},null,544),[[_e,t.currentRow.pos.a]])]),c("div",iD,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[26]||(e[26]=a=>o.setElementPosCam(t.currentRow)),title:"Set current position of camera (x, y, a)"},"\u26F6"),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[27]||(e[27]=a=>o.setElementPos(t.currentRow)),title:"Set current position of nozzle (x, y, a)"},"\u{1F78A}")])])]),c("div",sD,[oD,c("div",rD,[c("div",aD,[c("div",lD,[se(c("input",{"onUpdate:modelValue":e[28]||(e[28]=a=>t.currentRow.active=a),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Zn,t.currentRow.active]])])])])])])])):st("",!0),o.isCurrent?(W(),ee("div",cD,[dD,c("div",uD,[c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[29]||(e[29]=a=>o.placeElement(t.currentRow))},"Place element",8,hD),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[30]||(e[30]=a=>o.runFrom(t.currentRow))},"Start Job from this element",8,fD)]),c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[31]||(e[31]=a=>o.goToElement(t.currentRow))},vD,8,pD),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[32]||(e[32]=a=>o.goToFeeder(t.currentRow.feeder))},MD,8,bD)]),c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[33]||(e[33]=a=>o.goToElementCam(t.currentRow))},AD,8,ED),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[34]||(e[34]=a=>o.goToFeederCam(t.currentRow.feeder))},LD,8,PD)])])])):st("",!0)])])}var FD=ct(G2,[["render",UD]]);const OD={props:["title","number","width","height"],data:function(){return{drag:!1,dragObject:this.dragObject,shiftX:this.shiftX,shiftY:this.shiftY,downX:this.downX,downY:this.downY}},methods:{close(){this.$emit("close")},setSize:function(){typeof this.width!="undefined"&&(this.dragObject.style.width=this.width+"px"),typeof this.height!="undefined"&&(this.dragObject.style.height=this.height+"px")},onkey(t){t.keyCode==27&&this.close()}},mounted:function(){this.dragObject=this.$refs["win"+this.number],this.setSize(),window.addEventListener("keydown",this.onkey)},beforeUnmount:function(){window.removeEventListener("keydown",this.onkey)},watch:{width(){this.setSize()},height(){this.setSize()}}},ND=t=>(Xm("data-v-c19ddb68"),t=t(),jm(),t),zD=ND(()=>c("div",{class:"dialog-overlay"},null,-1)),kD={class:"dialogtitle"},BD={class:"title"},VD={class:"content"};function HD(t,e,n,i,s,o){return W(),ee("div",null,[zD,c("div",{class:"dialog",ref:"win"+n.number},[c("div",kD,[c("div",BD,ze(n.title),1),c("div",{class:"btn imgClose",onClick:e[0]||(e[0]=r=>o.close()),title:"Close"})]),c("div",VD,[Qs(t.$slots,"default",{},void 0,!0)])],512)])}var $D=ct(OD,[["render",HD],["__scopeId","data-v-c19ddb68"]]);const GD={mixins:[Ia,Hn],components:{FeedersSettings:up,ElementsTable:FD,DialogWindow:$D},data(){return{tab:0,currentElement:this.currentElement,showWindow:[!1,!1],inpuValue:""}},props:{project:Object,projects_list:Object,settings:Object,cases:Object,machineState:Object,machinePos:Object,pnpProcessing:Object,default_feeders:Object,disabled:Boolean,loading:Boolean},computed:{projectsList(){if(this.projects_list){let t=[];for(let e of this.projects_list)t.push(e.split(".").slice(0,-1).join("."));return t}},dialogIsOpened(){return this.showWindow.indexOf(!0)>-1}},methods:{importFeeder(){Un("The Feeders of this project will be replaced by Default Feeders settings. Do you want import default Feeders?","Confirm").then(t=>{t==!0&&(this.project.feeders=JSON.parse(JSON.stringify(this.default_feeders)))})},setCurrentElement(t){this.currentElement=t;for(let e of this.project.feeders)if(e.id==t.feeder){let n=parseFloat(e.caseRotate)+parseFloat(t.pos.a);this.$emit("setSMDCase",{case:e.case,rotate:n})}},pnpGoToFeeder(t){this.$emit("goToFeeder",t)},pnpGoToFeederCam(t){this.$emit("goToFeederCam",t)},pnpPickFromFeeder(t){this.$emit("pickFromFeeder",t)},pnpFixPosition(t){this.$emit("fixPosition",t)},pnpDropIntoBasket(t){this.$emit("dropIntoBasket",t)},runFrom(t){this.$emit("runFrom",t),this.tab=3},saveFeeders(){Un("Attention! This feeders set will saved when You Save Project! You can set this feeders set as default. Do You want to set this Feeders set as default?","Warning").then(t=>{t==!0&&Un("Do You want to set this Feeders set as default? Are You sure?","Confirm").then(e=>{e==!0&&this.$emit("setFeeders")})})},openDialogOpenProject(){this.showWindow[0]=!0},closeDialogOpenProject(){this.showWindow[0]=!1},openDialogSaveAs(){this.inpuValue=this.project.name,this.showWindow[1]=!0},closeDialogSaveAs(){this.showWindow[1]=!1},openDialogProjectsManager(){this.showWindow[2]=!0},closeDialogProjectsManager(){this.showWindow[2]=!1},newProject(){Un("Attention! All changes of current project will lost. Do You want to create new Project?","Confirm").then(t=>{t==!0&&this.$emit("newProject")})},loadProject(){this.projectsList.indexOf(this.project.name)!=-1?this.$emit("loadProject"):lt(`Can't load project "`+this.project.name+'". The project is missing.',"Warning","warning")},saveProject(){this.project.name!="New Project"?this.$emit("saveProject"):this.openDialogSaveAs()},async renameProject(t){let e=await jy("Please enter new project name:","Rename",t);e!==null&&e!=!1&&(this.projectsList.indexOf(e)==-1?this.$emit("renameProject",{name:t,newName:e}):lt("Can't rename the Project. A project with the specified name already exists!","Warning","warning"))},deleteProject(t){Un('Do You want to delete project "'+t+'"?',"Confirm").then(e=>{e==!0&&this.$emit("deleteProject",t)})},goToElement(t){this.$emit("goToElement",t)},goToElementCam(t){this.$emit("goToElementCam",t)},placeElement(t){this.$emit("placeElement",t)},getNextElementId(){let t=1;for(let e of this.project.elements)e.id>=t&&(t=e.id+1);return t},addElement(){let t=this.getNextElementId();this.project.elements.push({id:t,name:"SMD "+t.toString(),caption:"",feeder:0,pos:{x:0,y:0,a:0},active:!0}),this.currentElement=this.project.elements[this.project.elements.length-1]},getFeederById(t){for(let e of this.project.feeders)if(e.id==t)return e;return null},sortElements(t){let e=this.project.elements.slice();e=e.sort((n,i)=>{let s,o;if(t.field=="feeder"&&(s=parseFloat(n.feeder),o=parseFloat(i.feeder)),t.field=="nozzle"){let r=this.getFeederById(n.feeder),a=this.getFeederById(i.feeder);r!=null&&(s=parseFloat(r.nozzle)),a!=null&&(o=parseFloat(a.nozzle))}return t.field=="x"&&(s=parseFloat(n.pos.x),o=parseFloat(i.pos.x)),t.field=="y"&&(s=parseFloat(n.pos.y),o=parseFloat(i.pos.y)),t.order=="up"?s<o?-1:s>o?1:0:o<s?-1:o>s?1:0}),this.project.elements=e},importElements(){this.$refs.openFile.click()},importFile(){function t(i){return i=i.replace(/[\"]/g,""),i}function e(i){return i=parseFloat(i.replace(/[^0-9,\.]/g,"")),i}let n=this.$refs.openFile.files[0];if(n){let i=new FileReader;i.readAsText(n,"UTF-8"),i.onload=s=>{let o=s.target.result.split(`
- `);if(o.length>0){let r=o[0].split(" "),a={},l=0;for(let f of r)a[f]=l,l++;let d=parseFloat(this.settings.table.pos.x),u=parseFloat(this.settings.table.pos.y);l=0;for(let f of o)if(l>0){let h=f.split(" ");if(h.length>1){let m=t(h[a.Comment]),b=0;for(let y of this.project.feeders)y.caption.toUpperCase()==m.toUpperCase()&&(b=y.id);this.project.elements.push({id:this.getNextElementId(),name:t(h[a.Designator])+" ("+h[a.Layer]+")",caption:m,feeder:b,pos:{x:d+e(h[a["Mid X"]]),y:u+e(h[a["Mid Y"]]),a:e(h[a.Rotation])/360},active:!0})}}else l++}},i.onerror=s=>{console.log(s),lt("Can't read file '"+n.name+"'","Error","error")},this.$refs.openFile.value=""}},jogFirstElement(){this.project.elements.length>0?this.$emit("goToElementCam",this.project.elements[0]):lt("There is not a elements in the project","Warning","warning")},setPCBPosCam(){this.machineStateIsOK()==!0&&(this.project.pcb.pos.x=(parseFloat(this.machinePos.x)-parseFloat(this.project.elements[0].pos.x)+parseFloat(this.settings.cams[0].offset.x)).toFixed(3),this.project.pcb.pos.y=(parseFloat(this.machinePos.y)-parseFloat(this.project.elements[0].pos.y)+parseFloat(this.settings.cams[0].offset.y)).toFixed(3))},setPCBPos(){this.machineStateIsOK()==!0&&(this.project.pcb.pos.x=(parseFloat(this.machinePos.x)-parseFloat(this.project.elements[0].pos.x)).toFixed(3),this.project.pcb.pos.y=(parseFloat(this.machinePos.y)-parseFloat(this.project.elements[0].pos.y)).toFixed(3))},findElement(){this.setCurrentElement(this.pnpProcessing.element),this.tab=1},run(){this.$emit("run")},pause(){this.$emit("pause")},stop(){this.$emit("stop")}}},WD={style:{"max-height":"400px","overflow-y":"auto"}},XD={class:"table",ref:"table"},jD=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Projects")])],-1),YD=["onClick","onDblclick"],qD={width:"2"},ZD={key:0},KD={key:1},JD={class:"float-end",style:{position:"absolute",bottom:"0px"}},QD=["disabled"],eI=["disabled"],tI={size:"20",disabled:"",class:"form-control"},nI={class:"float-end",style:{position:"absolute",bottom:"0px"}},iI=["disabled"],sI=["disabled"],oI={style:{"max-height":"400px","overflow-y":"auto"}},rI={class:"table",ref:"table"},aI=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Project"),c("th")])],-1),lI=["onClick"],cI={width:"2"},dI={key:0},uI={key:1},hI={width:"220"},fI=["disabled","onClick"],pI=["disabled","onClick"],mI=["disabled","onClick"],_I={class:"float-end",style:{position:"absolute",bottom:"0px"}},gI=["disabled"],vI={class:"project-name"},bI={class:"row"},yI={class:"col"},xI=Ie(" Project: "),SI={class:"col-auto"},MI=["disabled"],EI=["disabled"],wI=["disabled"],TI=["disabled"],CI=["disabled"],AI={class:"nav nav-tabs"},PI={class:"nav-item"},RI={class:"nav-item"},DI={class:"nav-item"},II={class:"nav-item"},LI={class:"row mt-2"},UI={class:"col"},FI={class:"row mt-2"},OI={class:"col"},NI={class:"row mt-2"},zI={class:"col"},kI={class:"card"},BI=c("div",{class:"card-header"},"PCB manual position correction",-1),VI={class:"card-body"},HI=["disabled"],$I={class:"mb-3"},GI=c("label",{class:"form-label"},"Offset of first element (manual correction)",-1),WI={class:"row mb-2"},XI={class:"col"},jI=Ie(" X: "),YI={class:"col"},qI=Ie(" Y: "),ZI={class:"col-auto"},KI={class:"mb-3"},JI=c("label",{class:"form-label"},"PCB thickness",-1),QI={class:"row mt-2"},eL={class:"col"},tL={class:"card"},nL=c("div",{class:"card-header"},"Run",-1),iL={class:"card-body"},sL=["disabled"],oL=["disabled"],rL={key:0},aL={key:1},lL=["disabled"],cL={key:0,class:"alert alert-success",role:"alert"},dL={key:0};function uL(t,e,n,i,s,o){const r=et("DialogWindow"),a=et("FeedersSettings"),l=et("ElementsTable");return W(),ee("div",null,[c("input",{type:"file",ref:"openFile",accept:".csv",style:{display:"none"},onChange:e[0]||(e[0]=d=>o.importFile())},null,544),se(ke(r,{title:"Open",width:"800",height:"520",number:0,onClose:e[3]||(e[3]=d=>o.closeDialogOpenProject())},{default:Ct(()=>[c("div",WD,[c("table",XD,[jD,c("tbody",null,[(W(!0),ee(rt,null,wt(o.projectsList,d=>(W(),ee("tr",{onClick:u=>s.inpuValue=d,onDblclick:u=>{n.project.name=d,o.closeDialogOpenProject(),o.loadProject()},class:je(s.inpuValue==d?"active-row":"")},[c("td",qD,[s.inpuValue==d?(W(),ee("span",ZD,"\u2BC8")):(W(),ee("span",KD,"\xA0\xA0"))]),c("td",null,ze(d),1)],42,YD))),256))])],512)]),c("div",JD,[c("button",{disabled:n.loading||o.projectsList.indexOf(s.inpuValue)==-1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[1]||(e[1]=d=>{n.project.name=s.inpuValue,o.closeDialogOpenProject(),o.loadProject()})},"Open",8,QD),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[2]||(e[2]=d=>o.closeDialogOpenProject())},"Cancel",8,eI)])]),_:1},512),[[an,s.showWindow[0]]]),se(ke(r,{title:"Save as...",width:"800",height:"520",number:1,onClose:e[8]||(e[8]=d=>o.closeDialogSaveAs())},{default:Ct(()=>[se(c("input",{"onUpdate:modelValue":e[4]||(e[4]=d=>s.inpuValue=d),class:"form-control form-control-sm",type:"text",onKeyup:e[5]||(e[5]=Zf(d=>{n.project.name=s.inpuValue,o.closeDialogSaveAs(),o.saveProject()},["enter"]))},null,544),[[_e,s.inpuValue]]),c("div",null,[c("select",tI,[(W(!0),ee(rt,null,wt(o.projectsList,d=>(W(),ee("option",null,ze(d),1))),256))])]),c("div",nI,[c("button",{disabled:n.loading||o.projectsList.indexOf(s.inpuValue)>-1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[6]||(e[6]=d=>{n.project.name=s.inpuValue,o.closeDialogSaveAs(),o.saveProject()})},"Save",8,iI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[7]||(e[7]=d=>o.closeDialogSaveAs())},"Cancel",8,sI)])]),_:1},512),[[an,s.showWindow[1]]]),se(ke(r,{title:"Projects manager",width:"800",height:"520",number:2,onClose:e[10]||(e[10]=d=>o.closeDialogProjectsManager())},{default:Ct(()=>[c("div",oI,[c("table",rI,[aI,c("tbody",null,[(W(!0),ee(rt,null,wt(o.projectsList,d=>(W(),ee("tr",{onClick:u=>s.inpuValue=d,class:je(s.inpuValue==d?"active-row":"")},[c("td",cI,[s.inpuValue==d?(W(),ee("span",dI,"\u2BC8")):(W(),ee("span",uI,"\xA0\xA0"))]),c("td",null,ze(d),1),c("td",hI,[c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>{n.project.name=d,o.closeDialogProjectsManager(),o.loadProject()}},"Open",8,fI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>o.renameProject(d)},"Rename",8,pI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>o.deleteProject(d)},"Delete",8,mI)])],10,lI))),256))])],512)]),c("div",_I,[c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[9]||(e[9]=d=>o.closeDialogProjectsManager())},"Cancel",8,gI)])]),_:1},512),[[an,s.showWindow[2]]]),c("div",vI,[c("div",bI,[c("div",yI,[xI,c("b",null,ze(n.project.name),1)]),c("div",SI,[c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[11]||(e[11]=d=>o.newProject())},"New...",8,MI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[12]||(e[12]=d=>o.openDialogOpenProject())},"Open...",8,EI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[13]||(e[13]=d=>o.saveProject())},"Save Project",8,wI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[14]||(e[14]=d=>o.openDialogSaveAs())},"Save as...",8,TI),c("button",{disabled:n.loading||o.dialogIsOpened,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[15]||(e[15]=d=>o.openDialogProjectsManager())},"Projects manager...",8,CI)])])]),c("ul",AI,[c("li",PI,[c("a",{class:je("nav-link"+(s.tab==0?" active":"")),onClick:e[16]||(e[16]=d=>s.tab=0)},"Feeders",2)]),c("li",RI,[c("a",{class:je("nav-link"+(s.tab==1?" active":"")),onClick:e[17]||(e[17]=d=>s.tab=1)},"Elements",2)]),c("li",DI,[c("a",{class:je("nav-link"+(s.tab==2?" active":"")),onClick:e[18]||(e[18]=d=>s.tab=2)},"PCB",2)]),c("li",II,[c("a",{class:je("nav-link"+(s.tab==3?" active":"")),onClick:e[19]||(e[19]=d=>s.tab=3)},"Job",2)])]),se(c("div",LI,[c("div",UI,[ke(a,{settings:n.settings,cases:n.cases,machineState:n.machineState,machinePos:n.machinePos,feeders:n.project.feeders,disabled:n.disabled,loading:n.loading,onGoToFeeder:e[20]||(e[20]=d=>o.pnpGoToFeeder(d)),onGoToFeederCam:e[21]||(e[21]=d=>o.pnpGoToFeederCam(d)),onPickFromFeeder:e[22]||(e[22]=d=>o.pnpPickFromFeeder(d)),onFixPosition:e[23]||(e[23]=d=>o.pnpFixPosition(d)),onDropIntoBasket:e[24]||(e[24]=d=>o.pnpDropIntoBasket(d)),onSaveFeeders:e[25]||(e[25]=d=>o.saveFeeders())},null,8,["settings","cases","machineState","machinePos","feeders","disabled","loading"]),c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[26]||(e[26]=d=>o.importFeeder())},"Import from settings")])],512),[[an,s.tab==0]]),se(c("div",FI,[c("div",OI,[ke(l,{rows:n.project.elements,currentRow:s.currentElement,feeders:n.project.feeders,settings:n.settings,machineState:n.machineState,machinePos:n.machinePos,disabled:n.disabled,onGoToFeeder:e[27]||(e[27]=d=>o.pnpGoToFeeder(d)),onGoToFeederCam:e[28]||(e[28]=d=>o.pnpGoToFeederCam(d)),onGoToElement:e[29]||(e[29]=d=>o.goToElement(d)),onGoToElementCam:e[30]||(e[30]=d=>o.goToElementCam(d)),onPlaceElement:e[31]||(e[31]=d=>o.placeElement(d)),onSortElements:e[32]||(e[32]=d=>o.sortElements(d)),onRunFrom:e[33]||(e[33]=d=>o.runFrom(d)),onAdd:e[34]||(e[34]=d=>o.addElement()),onImport:e[35]||(e[35]=d=>o.importElements()),onSet:e[36]||(e[36]=d=>o.setCurrentElement(d)),onUp:e[37]||(e[37]=d=>t.rowUp(n.project.elements,d)),onDown:e[38]||(e[38]=d=>t.rowDown(n.project.elements,d)),onDelete:e[39]||(e[39]=d=>t.rowDelete(n.project.elements,d))},null,8,["rows","currentRow","feeders","settings","machineState","machinePos","disabled"])])],512),[[an,s.tab==1]]),se(c("div",NI,[c("div",zI,[c("div",kI,[BI,c("div",VI,[c("div",null,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[40]||(e[40]=d=>o.jogFirstElement())},"Jog Camera to first elment",8,HI)]),c("div",$I,[GI,c("div",WI,[c("div",XI,[jI,se(c("input",{"onUpdate:modelValue":e[41]||(e[41]=d=>n.project.pcb.pos.x=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[_e,n.project.pcb.pos.x]])]),c("div",YI,[qI,se(c("input",{"onUpdate:modelValue":e[42]||(e[42]=d=>n.project.pcb.pos.y=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[_e,n.project.pcb.pos.y]])]),c("div",ZI,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[43]||(e[43]=d=>o.setPCBPosCam()),title:"Set current position of camera"},"\u26F6"),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[44]||(e[44]=d=>o.setPCBPos()),title:"Set current position of nozzle"},"\u{1F78A}")])])]),c("div",KI,[JI,se(c("input",{"onUpdate:modelValue":e[45]||(e[45]=d=>n.project.pcb.pos.z=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[_e,n.project.pcb.pos.z]])])])])])],512),[[an,s.tab==2]]),se(c("div",QI,[c("div",eL,[c("div",tL,[nL,c("div",iL,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[46]||(e[46]=d=>o.run())},"Start",8,sL),c("button",{disabled:n.pnpProcessing.runFlag==!1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[47]||(e[47]=d=>o.pause())},[n.pnpProcessing.pauseFlag==!1?(W(),ee("span",rL,"Pause")):(W(),ee("span",aL,"Resume"))],8,oL),c("button",{disabled:n.pnpProcessing.runFlag==!1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[48]||(e[48]=d=>o.stop())},"Stop",8,lL),n.pnpProcessing.message!=""?(W(),ee("div",cL,[Ie(ze(n.pnpProcessing.message)+" ",1),this.pnpProcessing.runFlag==!1?(W(),ee("span",dL,[c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[49]||(e[49]=d=>o.findElement())},"Find Element in elements list"),c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[50]||(e[50]=d=>o.runFrom(this.pnpProcessing.element))},"Resume Job from this element")])):st("",!0)])):st("",!0)])])])],512),[[an,s.tab==3]])])}var hL=ct(GD,[["render",uL]]);const fL={props:{loading:Boolean}},pL={key:0,class:"loader-bg"},mL=c("div",{class:"loader-track"},[c("div",{class:"loader-fill"},"\xA0")],-1),_L=[mL];function gL(t,e,n,i,s,o){return n.loading?(W(),ee("div",pL,_L)):st("",!0)}var vL=ct(fL,[["render",gL]]);/**
- * @license
- * Copyright 2010-2025 Three.js Authors
- * SPDX-License-Identifier: MIT
- */const nd="176",Zs={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Gs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},bL=0,Cu=1,yL=2,hp=1,xL=2,li=3,Vi=0,un=1,Fn=2,Ni=0,Ks=1,Au=2,Pu=3,Ru=4,SL=5,ls=100,ML=101,EL=102,wL=103,TL=104,CL=200,AL=201,PL=202,RL=203,jl=204,Yl=205,DL=206,IL=207,LL=208,UL=209,FL=210,OL=211,NL=212,zL=213,kL=214,ql=0,Zl=1,Kl=2,so=3,Jl=4,Ql=5,ec=6,tc=7,id=0,BL=1,VL=2,zi=0,HL=1,$L=2,GL=3,WL=4,XL=5,jL=6,YL=7,fp=300,oo=301,ro=302,nc=303,ic=304,La=306,sc=1e3,hs=1001,oc=1002,Bn=1003,qL=1004,xr=1005,qn=1006,qa=1007,fs=1008,ei=1009,pp=1010,mp=1011,sr=1012,sd=1013,gs=1014,ui=1015,ur=1016,od=1017,rd=1018,or=1020,_p=35902,gp=1021,vp=1022,zn=1023,rr=1026,ar=1027,bp=1028,ad=1029,yp=1030,ld=1031,cd=1033,Jr=33776,Qr=33777,ea=33778,ta=33779,rc=35840,ac=35841,lc=35842,cc=35843,dc=36196,uc=37492,hc=37496,fc=37808,pc=37809,mc=37810,_c=37811,gc=37812,vc=37813,bc=37814,yc=37815,xc=37816,Sc=37817,Mc=37818,Ec=37819,wc=37820,Tc=37821,na=36492,Cc=36494,Ac=36495,xp=36283,Pc=36284,Rc=36285,Dc=36286,ZL=3200,KL=3201,Sp=0,JL=1,Li="",En="srgb",ao="srgb-linear",fa="linear",bt="srgb",Ts=7680,Du=519,QL=512,eU=513,tU=514,Mp=515,nU=516,iU=517,sU=518,oU=519,Iu=35044,Lu="300 es",hi=2e3,pa=2001;class Ss{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){const i=this._listeners;if(i===void 0)return;const s=i[e];if(s!==void 0){const o=s.indexOf(n);o!==-1&&s.splice(o,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const i=n[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let o=0,r=s.length;o<r;o++)s[o].call(this,e);e.target=null}}}const qt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Uu=1234567;const Xo=Math.PI/180,lo=180/Math.PI;function vo(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(qt[t&255]+qt[t>>8&255]+qt[t>>16&255]+qt[t>>24&255]+"-"+qt[e&255]+qt[e>>8&255]+"-"+qt[e>>16&15|64]+qt[e>>24&255]+"-"+qt[n&63|128]+qt[n>>8&255]+"-"+qt[n>>16&255]+qt[n>>24&255]+qt[i&255]+qt[i>>8&255]+qt[i>>16&255]+qt[i>>24&255]).toLowerCase()}function ot(t,e,n){return Math.max(e,Math.min(n,t))}function dd(t,e){return(t%e+e)%e}function rU(t,e,n,i,s){return i+(t-e)*(s-i)/(n-e)}function aU(t,e,n){return t!==e?(n-t)/(e-t):0}function jo(t,e,n){return(1-n)*t+n*e}function lU(t,e,n,i){return jo(t,e,1-Math.exp(-n*i))}function cU(t,e=1){return e-Math.abs(dd(t,e*2)-e)}function dU(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function uU(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function hU(t,e){return t+Math.floor(Math.random()*(e-t+1))}function fU(t,e){return t+Math.random()*(e-t)}function pU(t){return t*(.5-Math.random())}function mU(t){t!==void 0&&(Uu=t);let e=Uu+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function _U(t){return t*Xo}function gU(t){return t*lo}function vU(t){return(t&t-1)===0&&t!==0}function bU(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function yU(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function xU(t,e,n,i,s){const o=Math.cos,r=Math.sin,a=o(n/2),l=r(n/2),d=o((e+i)/2),u=r((e+i)/2),f=o((e-i)/2),h=r((e-i)/2),m=o((i-e)/2),b=r((i-e)/2);switch(s){case"XYX":t.set(a*u,l*f,l*h,a*d);break;case"YZY":t.set(l*h,a*u,l*f,a*d);break;case"ZXZ":t.set(l*f,l*h,a*u,a*d);break;case"XZX":t.set(a*u,l*b,l*m,a*d);break;case"YXY":t.set(l*m,a*u,l*b,a*d);break;case"ZYZ":t.set(l*b,l*m,a*u,a*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function $s(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function on(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const SU={DEG2RAD:Xo,RAD2DEG:lo,generateUUID:vo,clamp:ot,euclideanModulo:dd,mapLinear:rU,inverseLerp:aU,lerp:jo,damp:lU,pingpong:cU,smoothstep:dU,smootherstep:uU,randInt:hU,randFloat:fU,randFloatSpread:pU,seededRandom:mU,degToRad:_U,radToDeg:gU,isPowerOfTwo:vU,ceilPowerOfTwo:bU,floorPowerOfTwo:yU,setQuaternionFromProperEuler:xU,normalize:on,denormalize:$s};class Ke{constructor(e=0,n=0){Ke.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,i=this.y,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6],this.y=s[1]*n+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=ot(this.x,e.x,n.x),this.y=ot(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=ot(this.x,e,n),this.y=ot(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ot(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(ot(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),s=Math.sin(n),o=this.x-e.x,r=this.y-e.y;return this.x=o*i-r*s+e.x,this.y=o*s+r*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class tt{constructor(e,n,i,s,o,r,a,l,d){tt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,s,o,r,a,l,d)}set(e,n,i,s,o,r,a,l,d){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=n,u[4]=o,u[5]=l,u[6]=i,u[7]=r,u[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,o=this.elements,r=i[0],a=i[3],l=i[6],d=i[1],u=i[4],f=i[7],h=i[2],m=i[5],b=i[8],y=s[0],_=s[3],p=s[6],T=s[1],w=s[4],S=s[7],I=s[2],P=s[5],D=s[8];return o[0]=r*y+a*T+l*I,o[3]=r*_+a*w+l*P,o[6]=r*p+a*S+l*D,o[1]=d*y+u*T+f*I,o[4]=d*_+u*w+f*P,o[7]=d*p+u*S+f*D,o[2]=h*y+m*T+b*I,o[5]=h*_+m*w+b*P,o[8]=h*p+m*S+b*D,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],s=e[2],o=e[3],r=e[4],a=e[5],l=e[6],d=e[7],u=e[8];return n*r*u-n*a*d-i*o*u+i*a*l+s*o*d-s*r*l}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],o=e[3],r=e[4],a=e[5],l=e[6],d=e[7],u=e[8],f=u*r-a*d,h=a*l-u*o,m=d*o-r*l,b=n*f+i*h+s*m;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/b;return e[0]=f*y,e[1]=(s*d-u*i)*y,e[2]=(a*i-s*r)*y,e[3]=h*y,e[4]=(u*n-s*l)*y,e[5]=(s*o-a*n)*y,e[6]=m*y,e[7]=(i*l-d*n)*y,e[8]=(r*n-i*o)*y,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,s,o,r,a){const l=Math.cos(o),d=Math.sin(o);return this.set(i*l,i*d,-i*(l*r+d*a)+r+e,-s*d,s*l,-s*(-d*r+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(Za.makeScale(e,n)),this}rotate(e){return this.premultiply(Za.makeRotation(-e)),this}translate(e,n){return this.premultiply(Za.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<9;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Za=new tt;function Ep(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function ma(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function MU(){const t=ma("canvas");return t.style.display="block",t}const Fu={};function ia(t){t in Fu||(Fu[t]=!0,console.warn(t))}function EU(t,e,n){return new Promise(function(i,s){function o(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:s();break;case t.TIMEOUT_EXPIRED:setTimeout(o,n);break;default:i()}}setTimeout(o,n)})}function wU(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function TU(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Ou=new tt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Nu=new tt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function CU(){const t={enabled:!0,workingColorSpace:ao,spaces:{},convert:function(s,o,r){return this.enabled===!1||o===r||!o||!r||(this.spaces[o].transfer===bt&&(s.r=fi(s.r),s.g=fi(s.g),s.b=fi(s.b)),this.spaces[o].primaries!==this.spaces[r].primaries&&(s.applyMatrix3(this.spaces[o].toXYZ),s.applyMatrix3(this.spaces[r].fromXYZ)),this.spaces[r].transfer===bt&&(s.r=Js(s.r),s.g=Js(s.g),s.b=Js(s.b))),s},fromWorkingColorSpace:function(s,o){return this.convert(s,this.workingColorSpace,o)},toWorkingColorSpace:function(s,o){return this.convert(s,o,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Li?fa:this.spaces[s].transfer},getLuminanceCoefficients:function(s,o=this.workingColorSpace){return s.fromArray(this.spaces[o].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,o,r){return s.copy(this.spaces[o].toXYZ).multiply(this.spaces[r].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[ao]:{primaries:e,whitePoint:i,transfer:fa,toXYZ:Ou,fromXYZ:Nu,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:En},outputColorSpaceConfig:{drawingBufferColorSpace:En}},[En]:{primaries:e,whitePoint:i,transfer:bt,toXYZ:Ou,fromXYZ:Nu,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:En}}}),t}const ft=CU();function fi(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Js(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Cs;class AU{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Cs===void 0&&(Cs=ma("canvas")),Cs.width=e.width,Cs.height=e.height;const s=Cs.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),i=Cs}return i.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){const n=ma("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),o=s.data;for(let r=0;r<o.length;r++)o[r]=fi(o[r]/255)*255;return i.putImageData(s,0,0),n}else if(e.data){const n=e.data.slice(0);for(let i=0;i<n.length;i++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[i]=Math.floor(fi(n[i]/255)*255):n[i]=fi(n[i]);return{data:n,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let PU=0;class ud{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:PU++}),this.uuid=vo(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let o;if(Array.isArray(s)){o=[];for(let r=0,a=s.length;r<a;r++)s[r].isDataTexture?o.push(Ka(s[r].image)):o.push(Ka(s[r]))}else o=Ka(s);i.url=o}return n||(e.images[this.uuid]=i),i}}function Ka(t){return typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&t instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap?AU.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let RU=0;class hn extends Ss{constructor(e=hn.DEFAULT_IMAGE,n=hn.DEFAULT_MAPPING,i=hs,s=hs,o=qn,r=fs,a=zn,l=ei,d=hn.DEFAULT_ANISOTROPY,u=Li){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:RU++}),this.uuid=vo(),this.name="",this.source=new ud(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=o,this.minFilter=r,this.anisotropy=d,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Ke(0,0),this.repeat=new Ke(1,1),this.center=new Ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new tt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isTextureArray=e.isTextureArray,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==fp)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case sc:e.x=e.x-Math.floor(e.x);break;case hs:e.x=e.x<0?0:1;break;case oc:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case sc:e.y=e.y-Math.floor(e.y);break;case hs:e.y=e.y<0?0:1;break;case oc:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}hn.DEFAULT_IMAGE=null;hn.DEFAULT_MAPPING=fp;hn.DEFAULT_ANISOTROPY=1;class It{constructor(e=0,n=0,i=0,s=1){It.prototype.isVector4=!0,this.x=e,this.y=n,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,i,s){return this.x=e,this.y=n,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,o=this.w,r=e.elements;return this.x=r[0]*n+r[4]*i+r[8]*s+r[12]*o,this.y=r[1]*n+r[5]*i+r[9]*s+r[13]*o,this.z=r[2]*n+r[6]*i+r[10]*s+r[14]*o,this.w=r[3]*n+r[7]*i+r[11]*s+r[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,s,o;const l=e.elements,d=l[0],u=l[4],f=l[8],h=l[1],m=l[5],b=l[9],y=l[2],_=l[6],p=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-y)<.01&&Math.abs(b-_)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+y)<.1&&Math.abs(b+_)<.1&&Math.abs(d+m+p-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const w=(d+1)/2,S=(m+1)/2,I=(p+1)/2,P=(u+h)/4,D=(f+y)/4,R=(b+_)/4;return w>S&&w>I?w<.01?(i=0,s=.707106781,o=.707106781):(i=Math.sqrt(w),s=P/i,o=D/i):S>I?S<.01?(i=.707106781,s=0,o=.707106781):(s=Math.sqrt(S),i=P/s,o=R/s):I<.01?(i=.707106781,s=.707106781,o=0):(o=Math.sqrt(I),i=D/o,s=R/o),this.set(i,s,o,n),this}let T=Math.sqrt((_-b)*(_-b)+(f-y)*(f-y)+(h-u)*(h-u));return Math.abs(T)<.001&&(T=1),this.x=(_-b)/T,this.y=(f-y)/T,this.z=(h-u)/T,this.w=Math.acos((d+m+p-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=ot(this.x,e.x,n.x),this.y=ot(this.y,e.y,n.y),this.z=ot(this.z,e.z,n.z),this.w=ot(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=ot(this.x,e,n),this.y=ot(this.y,e,n),this.z=ot(this.z,e,n),this.w=ot(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ot(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class DU extends Ss{constructor(e=1,n=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=i.depth?i.depth:1,this.scissor=new It(0,0,e,n),this.scissorTest=!1,this.viewport=new It(0,0,e,n);const s={width:e,height:n,depth:this.depth};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,multiview:!1},i);const o=new hn(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);o.flipY=!1,o.generateMipmaps=i.generateMipmaps,o.internalFormat=i.internalFormat,this.textures=[];const r=i.count;for(let a=0;a<r;a++)this.textures[a]=o.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,i=1){if(this.width!==e||this.height!==n||this.depth!==i){this.width=e,this.height=n,this.depth=i;for(let s=0,o=this.textures.length;s<o;s++)this.textures[s].image.width=e,this.textures[s].image.height=n,this.textures[s].image.depth=i;this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const s=Object.assign({},e.textures[n].image);this.textures[n].source=new ud(s)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class vs extends DU{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class wp extends hn{constructor(e=null,n=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=Bn,this.minFilter=Bn,this.wrapR=hs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IU extends hn{constructor(e=null,n=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=Bn,this.minFilter=Bn,this.wrapR=hs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Xt{constructor(e=0,n=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=s}static slerpFlat(e,n,i,s,o,r,a){let l=i[s+0],d=i[s+1],u=i[s+2],f=i[s+3];const h=o[r+0],m=o[r+1],b=o[r+2],y=o[r+3];if(a===0){e[n+0]=l,e[n+1]=d,e[n+2]=u,e[n+3]=f;return}if(a===1){e[n+0]=h,e[n+1]=m,e[n+2]=b,e[n+3]=y;return}if(f!==y||l!==h||d!==m||u!==b){let _=1-a;const p=l*h+d*m+u*b+f*y,T=p>=0?1:-1,w=1-p*p;if(w>Number.EPSILON){const I=Math.sqrt(w),P=Math.atan2(I,p*T);_=Math.sin(_*P)/I,a=Math.sin(a*P)/I}const S=a*T;if(l=l*_+h*S,d=d*_+m*S,u=u*_+b*S,f=f*_+y*S,_===1-a){const I=1/Math.sqrt(l*l+d*d+u*u+f*f);l*=I,d*=I,u*=I,f*=I}}e[n]=l,e[n+1]=d,e[n+2]=u,e[n+3]=f}static multiplyQuaternionsFlat(e,n,i,s,o,r){const a=i[s],l=i[s+1],d=i[s+2],u=i[s+3],f=o[r],h=o[r+1],m=o[r+2],b=o[r+3];return e[n]=a*b+u*f+l*m-d*h,e[n+1]=l*b+u*h+d*f-a*m,e[n+2]=d*b+u*m+a*h-l*f,e[n+3]=u*b-a*f-l*h-d*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,s){return this._x=e,this._y=n,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const i=e._x,s=e._y,o=e._z,r=e._order,a=Math.cos,l=Math.sin,d=a(i/2),u=a(s/2),f=a(o/2),h=l(i/2),m=l(s/2),b=l(o/2);switch(r){case"XYZ":this._x=h*u*f+d*m*b,this._y=d*m*f-h*u*b,this._z=d*u*b+h*m*f,this._w=d*u*f-h*m*b;break;case"YXZ":this._x=h*u*f+d*m*b,this._y=d*m*f-h*u*b,this._z=d*u*b-h*m*f,this._w=d*u*f+h*m*b;break;case"ZXY":this._x=h*u*f-d*m*b,this._y=d*m*f+h*u*b,this._z=d*u*b+h*m*f,this._w=d*u*f-h*m*b;break;case"ZYX":this._x=h*u*f-d*m*b,this._y=d*m*f+h*u*b,this._z=d*u*b-h*m*f,this._w=d*u*f+h*m*b;break;case"YZX":this._x=h*u*f+d*m*b,this._y=d*m*f+h*u*b,this._z=d*u*b-h*m*f,this._w=d*u*f-h*m*b;break;case"XZY":this._x=h*u*f-d*m*b,this._y=d*m*f-h*u*b,this._z=d*u*b+h*m*f,this._w=d*u*f+h*m*b;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],s=n[4],o=n[8],r=n[1],a=n[5],l=n[9],d=n[2],u=n[6],f=n[10],h=i+a+f;if(h>0){const m=.5/Math.sqrt(h+1);this._w=.25/m,this._x=(u-l)*m,this._y=(o-d)*m,this._z=(r-s)*m}else if(i>a&&i>f){const m=2*Math.sqrt(1+i-a-f);this._w=(u-l)/m,this._x=.25*m,this._y=(s+r)/m,this._z=(o+d)/m}else if(a>f){const m=2*Math.sqrt(1+a-i-f);this._w=(o-d)/m,this._x=(s+r)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+f-i-a);this._w=(r-s)/m,this._x=(o+d)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ot(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,n/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const i=e._x,s=e._y,o=e._z,r=e._w,a=n._x,l=n._y,d=n._z,u=n._w;return this._x=i*u+r*a+s*d-o*l,this._y=s*u+r*l+o*a-i*d,this._z=o*u+r*d+i*l-s*a,this._w=r*u-i*a-s*l-o*d,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const i=this._x,s=this._y,o=this._z,r=this._w;let a=r*e._w+i*e._x+s*e._y+o*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=r,this._x=i,this._y=s,this._z=o,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-n;return this._w=m*r+n*this._w,this._x=m*i+n*this._x,this._y=m*s+n*this._y,this._z=m*o+n*this._z,this.normalize(),this}const d=Math.sqrt(l),u=Math.atan2(d,a),f=Math.sin((1-n)*u)/d,h=Math.sin(n*u)/d;return this._w=r*f+this._w*h,this._x=i*f+this._x*h,this._y=s*f+this._y*h,this._z=o*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),o=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),o*Math.sin(n),o*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class U{constructor(e=0,n=0,i=0){U.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(zu.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(zu.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,s=this.z,o=e.elements;return this.x=o[0]*n+o[3]*i+o[6]*s,this.y=o[1]*n+o[4]*i+o[7]*s,this.z=o[2]*n+o[5]*i+o[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,s=this.z,o=e.elements,r=1/(o[3]*n+o[7]*i+o[11]*s+o[15]);return this.x=(o[0]*n+o[4]*i+o[8]*s+o[12])*r,this.y=(o[1]*n+o[5]*i+o[9]*s+o[13])*r,this.z=(o[2]*n+o[6]*i+o[10]*s+o[14])*r,this}applyQuaternion(e){const n=this.x,i=this.y,s=this.z,o=e.x,r=e.y,a=e.z,l=e.w,d=2*(r*s-a*i),u=2*(a*n-o*s),f=2*(o*i-r*n);return this.x=n+l*d+r*f-a*u,this.y=i+l*u+a*d-o*f,this.z=s+l*f+o*u-r*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,s=this.z,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*s,this.y=o[1]*n+o[5]*i+o[9]*s,this.z=o[2]*n+o[6]*i+o[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=ot(this.x,e.x,n.x),this.y=ot(this.y,e.y,n.y),this.z=ot(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=ot(this.x,e,n),this.y=ot(this.y,e,n),this.z=ot(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ot(i,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,s=e.y,o=e.z,r=n.x,a=n.y,l=n.z;return this.x=s*l-o*a,this.y=o*r-i*l,this.z=i*a-s*r,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Ja.copy(this).projectOnVector(e),this.sub(Ja)}reflect(e){return this.sub(Ja.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(ot(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return n*n+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,i){const s=Math.sin(n)*e;return this.x=s*Math.sin(i),this.y=Math.cos(n)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=s,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(e),this.y=n,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ja=new U,zu=new Xt;class hr{constructor(e=new U(1/0,1/0,1/0),n=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n+=3)this.expandByPoint(Pn.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(Pn.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=Pn.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const o=i.getAttribute("position");if(n===!0&&o!==void 0&&e.isInstancedMesh!==!0)for(let r=0,a=o.count;r<a;r++)e.isMesh===!0?e.getVertexPosition(r,Pn):Pn.fromBufferAttribute(o,r),Pn.applyMatrix4(e.matrixWorld),this.expandByPoint(Pn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Sr.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Sr.copy(i.boundingBox)),Sr.applyMatrix4(e.matrixWorld),this.union(Sr)}const s=e.children;for(let o=0,r=s.length;o<r;o++)this.expandByObject(s[o],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Pn),Pn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(wo),Mr.subVectors(this.max,wo),As.subVectors(e.a,wo),Ps.subVectors(e.b,wo),Rs.subVectors(e.c,wo),xi.subVectors(Ps,As),Si.subVectors(Rs,Ps),qi.subVectors(As,Rs);let n=[0,-xi.z,xi.y,0,-Si.z,Si.y,0,-qi.z,qi.y,xi.z,0,-xi.x,Si.z,0,-Si.x,qi.z,0,-qi.x,-xi.y,xi.x,0,-Si.y,Si.x,0,-qi.y,qi.x,0];return!Qa(n,As,Ps,Rs,Mr)||(n=[1,0,0,0,1,0,0,0,1],!Qa(n,As,Ps,Rs,Mr))?!1:(Er.crossVectors(xi,Si),n=[Er.x,Er.y,Er.z],Qa(n,As,Ps,Rs,Mr))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Pn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ni[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ni[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ni[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ni[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ni[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ni[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ni[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ni[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ni),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ni=[new U,new U,new U,new U,new U,new U,new U,new U],Pn=new U,Sr=new hr,As=new U,Ps=new U,Rs=new U,xi=new U,Si=new U,qi=new U,wo=new U,Mr=new U,Er=new U,Zi=new U;function Qa(t,e,n,i,s){for(let o=0,r=t.length-3;o<=r;o+=3){Zi.fromArray(t,o);const a=s.x*Math.abs(Zi.x)+s.y*Math.abs(Zi.y)+s.z*Math.abs(Zi.z),l=e.dot(Zi),d=n.dot(Zi),u=i.dot(Zi);if(Math.max(-Math.max(l,d,u),Math.min(l,d,u))>a)return!1}return!0}const LU=new hr,To=new U,el=new U;class Ua{constructor(e=new U,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):LU.setFromPoints(e).getCenter(i);let s=0;for(let o=0,r=e.length;o<r;o++)s=Math.max(s,i.distanceToSquared(e[o]));return this.radius=Math.sqrt(s),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;To.subVectors(e,this.center);const n=To.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),s=(i-this.radius)*.5;this.center.addScaledVector(To,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(el.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(To.copy(e.center).add(el)),this.expandByPoint(To.copy(e.center).sub(el))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ii=new U,tl=new U,wr=new U,Mi=new U,nl=new U,Tr=new U,il=new U;class Fa{constructor(e=new U,n=new U(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ii)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=ii.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(ii.copy(this.origin).addScaledVector(this.direction,n),ii.distanceToSquared(e))}distanceSqToSegment(e,n,i,s){tl.copy(e).add(n).multiplyScalar(.5),wr.copy(n).sub(e).normalize(),Mi.copy(this.origin).sub(tl);const o=e.distanceTo(n)*.5,r=-this.direction.dot(wr),a=Mi.dot(this.direction),l=-Mi.dot(wr),d=Mi.lengthSq(),u=Math.abs(1-r*r);let f,h,m,b;if(u>0)if(f=r*l-a,h=r*a-l,b=o*u,f>=0)if(h>=-b)if(h<=b){const y=1/u;f*=y,h*=y,m=f*(f+r*h+2*a)+h*(r*f+h+2*l)+d}else h=o,f=Math.max(0,-(r*h+a)),m=-f*f+h*(h+2*l)+d;else h=-o,f=Math.max(0,-(r*h+a)),m=-f*f+h*(h+2*l)+d;else h<=-b?(f=Math.max(0,-(-r*o+a)),h=f>0?-o:Math.min(Math.max(-o,-l),o),m=-f*f+h*(h+2*l)+d):h<=b?(f=0,h=Math.min(Math.max(-o,-l),o),m=h*(h+2*l)+d):(f=Math.max(0,-(r*o+a)),h=f>0?o:Math.min(Math.max(-o,-l),o),m=-f*f+h*(h+2*l)+d);else h=r>0?-o:o,f=Math.max(0,-(r*h+a)),m=-f*f+h*(h+2*l)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,f),s&&s.copy(tl).addScaledVector(wr,h),m}intersectSphere(e,n){ii.subVectors(e.center,this.origin);const i=ii.dot(this.direction),s=ii.dot(ii)-i*i,o=e.radius*e.radius;if(s>o)return null;const r=Math.sqrt(o-s),a=i-r,l=i+r;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,s,o,r,a,l;const d=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,h=this.origin;return d>=0?(i=(e.min.x-h.x)*d,s=(e.max.x-h.x)*d):(i=(e.max.x-h.x)*d,s=(e.min.x-h.x)*d),u>=0?(o=(e.min.y-h.y)*u,r=(e.max.y-h.y)*u):(o=(e.max.y-h.y)*u,r=(e.min.y-h.y)*u),i>r||o>s||((o>i||isNaN(i))&&(i=o),(r<s||isNaN(s))&&(s=r),f>=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||a>s)||((a>i||i!==i)&&(i=a),(l<s||s!==s)&&(s=l),s<0)?null:this.at(i>=0?i:s,n)}intersectsBox(e){return this.intersectBox(e,ii)!==null}intersectTriangle(e,n,i,s,o){nl.subVectors(n,e),Tr.subVectors(i,e),il.crossVectors(nl,Tr);let r=this.direction.dot(il),a;if(r>0){if(s)return null;a=1}else if(r<0)a=-1,r=-r;else return null;Mi.subVectors(this.origin,e);const l=a*this.direction.dot(Tr.crossVectors(Mi,Tr));if(l<0)return null;const d=a*this.direction.dot(nl.cross(Mi));if(d<0||l+d>r)return null;const u=-a*Mi.dot(il);return u<0?null:this.at(u/r,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Tt{constructor(e,n,i,s,o,r,a,l,d,u,f,h,m,b,y,_){Tt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,i,s,o,r,a,l,d,u,f,h,m,b,y,_)}set(e,n,i,s,o,r,a,l,d,u,f,h,m,b,y,_){const p=this.elements;return p[0]=e,p[4]=n,p[8]=i,p[12]=s,p[1]=o,p[5]=r,p[9]=a,p[13]=l,p[2]=d,p[6]=u,p[10]=f,p[14]=h,p[3]=m,p[7]=b,p[11]=y,p[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Tt().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,i=e.elements,s=1/Ds.setFromMatrixColumn(e,0).length(),o=1/Ds.setFromMatrixColumn(e,1).length(),r=1/Ds.setFromMatrixColumn(e,2).length();return n[0]=i[0]*s,n[1]=i[1]*s,n[2]=i[2]*s,n[3]=0,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[7]=0,n[8]=i[8]*r,n[9]=i[9]*r,n[10]=i[10]*r,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,s=e.y,o=e.z,r=Math.cos(i),a=Math.sin(i),l=Math.cos(s),d=Math.sin(s),u=Math.cos(o),f=Math.sin(o);if(e.order==="XYZ"){const h=r*u,m=r*f,b=a*u,y=a*f;n[0]=l*u,n[4]=-l*f,n[8]=d,n[1]=m+b*d,n[5]=h-y*d,n[9]=-a*l,n[2]=y-h*d,n[6]=b+m*d,n[10]=r*l}else if(e.order==="YXZ"){const h=l*u,m=l*f,b=d*u,y=d*f;n[0]=h+y*a,n[4]=b*a-m,n[8]=r*d,n[1]=r*f,n[5]=r*u,n[9]=-a,n[2]=m*a-b,n[6]=y+h*a,n[10]=r*l}else if(e.order==="ZXY"){const h=l*u,m=l*f,b=d*u,y=d*f;n[0]=h-y*a,n[4]=-r*f,n[8]=b+m*a,n[1]=m+b*a,n[5]=r*u,n[9]=y-h*a,n[2]=-r*d,n[6]=a,n[10]=r*l}else if(e.order==="ZYX"){const h=r*u,m=r*f,b=a*u,y=a*f;n[0]=l*u,n[4]=b*d-m,n[8]=h*d+y,n[1]=l*f,n[5]=y*d+h,n[9]=m*d-b,n[2]=-d,n[6]=a*l,n[10]=r*l}else if(e.order==="YZX"){const h=r*l,m=r*d,b=a*l,y=a*d;n[0]=l*u,n[4]=y-h*f,n[8]=b*f+m,n[1]=f,n[5]=r*u,n[9]=-a*u,n[2]=-d*u,n[6]=m*f+b,n[10]=h-y*f}else if(e.order==="XZY"){const h=r*l,m=r*d,b=a*l,y=a*d;n[0]=l*u,n[4]=-f,n[8]=d*u,n[1]=h*f+y,n[5]=r*u,n[9]=m*f-b,n[2]=b*f-m,n[6]=a*u,n[10]=y*f+h}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(UU,e,FU)}lookAt(e,n,i){const s=this.elements;return pn.subVectors(e,n),pn.lengthSq()===0&&(pn.z=1),pn.normalize(),Ei.crossVectors(i,pn),Ei.lengthSq()===0&&(Math.abs(i.z)===1?pn.x+=1e-4:pn.z+=1e-4,pn.normalize(),Ei.crossVectors(i,pn)),Ei.normalize(),Cr.crossVectors(pn,Ei),s[0]=Ei.x,s[4]=Cr.x,s[8]=pn.x,s[1]=Ei.y,s[5]=Cr.y,s[9]=pn.y,s[2]=Ei.z,s[6]=Cr.z,s[10]=pn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,s=n.elements,o=this.elements,r=i[0],a=i[4],l=i[8],d=i[12],u=i[1],f=i[5],h=i[9],m=i[13],b=i[2],y=i[6],_=i[10],p=i[14],T=i[3],w=i[7],S=i[11],I=i[15],P=s[0],D=s[4],R=s[8],E=s[12],g=s[1],L=s[5],O=s[9],H=s[13],j=s[2],re=s[6],q=s[10],ae=s[14],G=s[3],fe=s[7],ye=s[11],Re=s[15];return o[0]=r*P+a*g+l*j+d*G,o[4]=r*D+a*L+l*re+d*fe,o[8]=r*R+a*O+l*q+d*ye,o[12]=r*E+a*H+l*ae+d*Re,o[1]=u*P+f*g+h*j+m*G,o[5]=u*D+f*L+h*re+m*fe,o[9]=u*R+f*O+h*q+m*ye,o[13]=u*E+f*H+h*ae+m*Re,o[2]=b*P+y*g+_*j+p*G,o[6]=b*D+y*L+_*re+p*fe,o[10]=b*R+y*O+_*q+p*ye,o[14]=b*E+y*H+_*ae+p*Re,o[3]=T*P+w*g+S*j+I*G,o[7]=T*D+w*L+S*re+I*fe,o[11]=T*R+w*O+S*q+I*ye,o[15]=T*E+w*H+S*ae+I*Re,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],s=e[8],o=e[12],r=e[1],a=e[5],l=e[9],d=e[13],u=e[2],f=e[6],h=e[10],m=e[14],b=e[3],y=e[7],_=e[11],p=e[15];return b*(+o*l*f-s*d*f-o*a*h+i*d*h+s*a*m-i*l*m)+y*(+n*l*m-n*d*h+o*r*h-s*r*m+s*d*u-o*l*u)+_*(+n*d*f-n*a*m-o*r*f+i*r*m+o*a*u-i*d*u)+p*(-s*a*u-n*l*f+n*a*h+s*r*f-i*r*h+i*l*u)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=n,s[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],s=e[2],o=e[3],r=e[4],a=e[5],l=e[6],d=e[7],u=e[8],f=e[9],h=e[10],m=e[11],b=e[12],y=e[13],_=e[14],p=e[15],T=f*_*d-y*h*d+y*l*m-a*_*m-f*l*p+a*h*p,w=b*h*d-u*_*d-b*l*m+r*_*m+u*l*p-r*h*p,S=u*y*d-b*f*d+b*a*m-r*y*m-u*a*p+r*f*p,I=b*f*l-u*y*l-b*a*h+r*y*h+u*a*_-r*f*_,P=n*T+i*w+s*S+o*I;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/P;return e[0]=T*D,e[1]=(y*h*o-f*_*o-y*s*m+i*_*m+f*s*p-i*h*p)*D,e[2]=(a*_*o-y*l*o+y*s*d-i*_*d-a*s*p+i*l*p)*D,e[3]=(f*l*o-a*h*o-f*s*d+i*h*d+a*s*m-i*l*m)*D,e[4]=w*D,e[5]=(u*_*o-b*h*o+b*s*m-n*_*m-u*s*p+n*h*p)*D,e[6]=(b*l*o-r*_*o-b*s*d+n*_*d+r*s*p-n*l*p)*D,e[7]=(r*h*o-u*l*o+u*s*d-n*h*d-r*s*m+n*l*m)*D,e[8]=S*D,e[9]=(b*f*o-u*y*o-b*i*m+n*y*m+u*i*p-n*f*p)*D,e[10]=(r*y*o-b*a*o+b*i*d-n*y*d-r*i*p+n*a*p)*D,e[11]=(u*a*o-r*f*o-u*i*d+n*f*d+r*i*m-n*a*m)*D,e[12]=I*D,e[13]=(u*y*s-b*f*s+b*i*h-n*y*h-u*i*_+n*f*_)*D,e[14]=(b*a*s-r*y*s-b*i*l+n*y*l+r*i*_-n*a*_)*D,e[15]=(r*f*s-u*a*s+u*i*l-n*f*l-r*i*h+n*a*h)*D,this}scale(e){const n=this.elements,i=e.x,s=e.y,o=e.z;return n[0]*=i,n[4]*=s,n[8]*=o,n[1]*=i,n[5]*=s,n[9]*=o,n[2]*=i,n[6]*=s,n[10]*=o,n[3]*=i,n[7]*=s,n[11]*=o,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,i,s))}makeTranslation(e,n,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),s=Math.sin(n),o=1-i,r=e.x,a=e.y,l=e.z,d=o*r,u=o*a;return this.set(d*r+i,d*a-s*l,d*l+s*a,0,d*a+s*l,u*a+i,u*l-s*r,0,d*l-s*a,u*l+s*r,o*l*l+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,s,o,r){return this.set(1,i,o,0,e,1,r,0,n,s,1,0,0,0,0,1),this}compose(e,n,i){const s=this.elements,o=n._x,r=n._y,a=n._z,l=n._w,d=o+o,u=r+r,f=a+a,h=o*d,m=o*u,b=o*f,y=r*u,_=r*f,p=a*f,T=l*d,w=l*u,S=l*f,I=i.x,P=i.y,D=i.z;return s[0]=(1-(y+p))*I,s[1]=(m+S)*I,s[2]=(b-w)*I,s[3]=0,s[4]=(m-S)*P,s[5]=(1-(h+p))*P,s[6]=(_+T)*P,s[7]=0,s[8]=(b+w)*D,s[9]=(_-T)*D,s[10]=(1-(h+y))*D,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,n,i){const s=this.elements;let o=Ds.set(s[0],s[1],s[2]).length();const r=Ds.set(s[4],s[5],s[6]).length(),a=Ds.set(s[8],s[9],s[10]).length();this.determinant()<0&&(o=-o),e.x=s[12],e.y=s[13],e.z=s[14],Rn.copy(this);const d=1/o,u=1/r,f=1/a;return Rn.elements[0]*=d,Rn.elements[1]*=d,Rn.elements[2]*=d,Rn.elements[4]*=u,Rn.elements[5]*=u,Rn.elements[6]*=u,Rn.elements[8]*=f,Rn.elements[9]*=f,Rn.elements[10]*=f,n.setFromRotationMatrix(Rn),i.x=o,i.y=r,i.z=a,this}makePerspective(e,n,i,s,o,r,a=hi){const l=this.elements,d=2*o/(n-e),u=2*o/(i-s),f=(n+e)/(n-e),h=(i+s)/(i-s);let m,b;if(a===hi)m=-(r+o)/(r-o),b=-2*r*o/(r-o);else if(a===pa)m=-r/(r-o),b=-r*o/(r-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=d,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=b,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,i,s,o,r,a=hi){const l=this.elements,d=1/(n-e),u=1/(i-s),f=1/(r-o),h=(n+e)*d,m=(i+s)*u;let b,y;if(a===hi)b=(r+o)*f,y=-2*f;else if(a===pa)b=o*f,y=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*d,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=y,l[14]=-b,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let s=0;s<16;s++)if(n[s]!==i[s])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const Ds=new U,Rn=new Tt,UU=new U(0,0,0),FU=new U(1,1,1),Ei=new U,Cr=new U,pn=new U,ku=new Tt,Bu=new Xt;class Vn{constructor(e=0,n=0,i=0,s=Vn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,i,s=this._order){return this._x=e,this._y=n,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,i=!0){const s=e.elements,o=s[0],r=s[4],a=s[8],l=s[1],d=s[5],u=s[9],f=s[2],h=s[6],m=s[10];switch(n){case"XYZ":this._y=Math.asin(ot(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-r,o)):(this._x=Math.atan2(h,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ot(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,d)):(this._y=Math.atan2(-f,o),this._z=0);break;case"ZXY":this._x=Math.asin(ot(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-r,d)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-ot(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,m),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-r,d));break;case"YZX":this._z=Math.asin(ot(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,d),this._y=Math.atan2(-f,o)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-ot(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(h,d),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return ku.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ku,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Bu.setFromEuler(this),this.setFromQuaternion(Bu,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Vn.DEFAULT_ORDER="XYZ";class hd{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let OU=0;const Vu=new U,Is=new Xt,si=new Tt,Ar=new U,Co=new U,NU=new U,zU=new Xt,Hu=new U(1,0,0),$u=new U(0,1,0),Gu=new U(0,0,1),Wu={type:"added"},kU={type:"removed"},Ls={type:"childadded",child:null},sl={type:"childremoved",child:null};class Nt extends Ss{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:OU++}),this.uuid=vo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Nt.DEFAULT_UP.clone();const e=new U,n=new Vn,i=new Xt,s=new U(1,1,1);function o(){i.setFromEuler(n,!1)}function r(){n.setFromQuaternion(i,void 0,!1)}n._onChange(o),i._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new Tt},normalMatrix:{value:new tt}}),this.matrix=new Tt,this.matrixWorld=new Tt,this.matrixAutoUpdate=Nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new hd,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return Is.setFromAxisAngle(e,n),this.quaternion.multiply(Is),this}rotateOnWorldAxis(e,n){return Is.setFromAxisAngle(e,n),this.quaternion.premultiply(Is),this}rotateX(e){return this.rotateOnAxis(Hu,e)}rotateY(e){return this.rotateOnAxis($u,e)}rotateZ(e){return this.rotateOnAxis(Gu,e)}translateOnAxis(e,n){return Vu.copy(e).applyQuaternion(this.quaternion),this.position.add(Vu.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(Hu,e)}translateY(e){return this.translateOnAxis($u,e)}translateZ(e){return this.translateOnAxis(Gu,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(si.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?Ar.copy(e):Ar.set(e,n,i);const s=this.parent;this.updateWorldMatrix(!0,!1),Co.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?si.lookAt(Co,Ar,this.up):si.lookAt(Ar,Co,this.up),this.quaternion.setFromRotationMatrix(si),s&&(si.extractRotation(s.matrixWorld),Is.setFromRotationMatrix(si),this.quaternion.premultiply(Is.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Wu),Ls.child=e,this.dispatchEvent(Ls),Ls.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(kU),sl.child=e,this.dispatchEvent(sl),sl.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),si.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),si.multiply(e.parent.matrixWorld)),e.applyMatrix4(si),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Wu),Ls.child=e,this.dispatchEvent(Ls),Ls.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let i=0,s=this.children.length;i<s;i++){const r=this.children[i].getObjectByProperty(e,n);if(r!==void 0)return r}}getObjectsByProperty(e,n,i=[]){this[e]===n&&i.push(this);const s=this.children;for(let o=0,r=s.length;o<r;o++)s[o].getObjectsByProperty(e,n,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Co,e,NU),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Co,zU,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].updateMatrixWorld(e)}updateWorldMatrix(e,n){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const s=this.children;for(let o=0,r=s.length;o<r;o++)s[o].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",i={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?{min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}:void 0,boundingSphere:a.boundingSphere?{radius:a.boundingSphere.radius,center:a.boundingSphere.center.toArray()}:void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(e),s.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()}));function o(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=o(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let d=0,u=l.length;d<u;d++){const f=l[d];o(e.shapes,f)}else o(e.shapes,l)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,d=this.material.length;l<d;l++)a.push(o(e.materials,this.material[l]));s.material=a}else s.material=o(e.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];s.animations.push(o(e.animations,l))}}if(n){const a=r(e.geometries),l=r(e.materials),d=r(e.textures),u=r(e.images),f=r(e.shapes),h=r(e.skeletons),m=r(e.animations),b=r(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),d.length>0&&(i.textures=d),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),m.length>0&&(i.animations=m),b.length>0&&(i.nodes=b)}return i.object=s,i;function r(a){const l=[];for(const d in a){const u=a[d];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i<e.children.length;i++){const s=e.children[i];this.add(s.clone())}return this}}Nt.DEFAULT_UP=new U(0,1,0);Nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Dn=new U,oi=new U,ol=new U,ri=new U,Us=new U,Fs=new U,Xu=new U,rl=new U,al=new U,ll=new U,cl=new It,dl=new It,ul=new It;class On{constructor(e=new U,n=new U,i=new U){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,s){s.subVectors(i,n),Dn.subVectors(e,n),s.cross(Dn);const o=s.lengthSq();return o>0?s.multiplyScalar(1/Math.sqrt(o)):s.set(0,0,0)}static getBarycoord(e,n,i,s,o){Dn.subVectors(s,n),oi.subVectors(i,n),ol.subVectors(e,n);const r=Dn.dot(Dn),a=Dn.dot(oi),l=Dn.dot(ol),d=oi.dot(oi),u=oi.dot(ol),f=r*d-a*a;if(f===0)return o.set(0,0,0),null;const h=1/f,m=(d*l-a*u)*h,b=(r*u-a*l)*h;return o.set(1-m-b,b,m)}static containsPoint(e,n,i,s){return this.getBarycoord(e,n,i,s,ri)===null?!1:ri.x>=0&&ri.y>=0&&ri.x+ri.y<=1}static getInterpolation(e,n,i,s,o,r,a,l){return this.getBarycoord(e,n,i,s,ri)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(o,ri.x),l.addScaledVector(r,ri.y),l.addScaledVector(a,ri.z),l)}static getInterpolatedAttribute(e,n,i,s,o,r){return cl.setScalar(0),dl.setScalar(0),ul.setScalar(0),cl.fromBufferAttribute(e,n),dl.fromBufferAttribute(e,i),ul.fromBufferAttribute(e,s),r.setScalar(0),r.addScaledVector(cl,o.x),r.addScaledVector(dl,o.y),r.addScaledVector(ul,o.z),r}static isFrontFacing(e,n,i,s){return Dn.subVectors(i,n),oi.subVectors(e,n),Dn.cross(oi).dot(s)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,s){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,n,i,s){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Dn.subVectors(this.c,this.b),oi.subVectors(this.a,this.b),Dn.cross(oi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return On.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return On.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,s,o){return On.getInterpolation(e,this.a,this.b,this.c,n,i,s,o)}containsPoint(e){return On.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return On.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,s=this.b,o=this.c;let r,a;Us.subVectors(s,i),Fs.subVectors(o,i),rl.subVectors(e,i);const l=Us.dot(rl),d=Fs.dot(rl);if(l<=0&&d<=0)return n.copy(i);al.subVectors(e,s);const u=Us.dot(al),f=Fs.dot(al);if(u>=0&&f<=u)return n.copy(s);const h=l*f-u*d;if(h<=0&&l>=0&&u<=0)return r=l/(l-u),n.copy(i).addScaledVector(Us,r);ll.subVectors(e,o);const m=Us.dot(ll),b=Fs.dot(ll);if(b>=0&&m<=b)return n.copy(o);const y=m*d-l*b;if(y<=0&&d>=0&&b<=0)return a=d/(d-b),n.copy(i).addScaledVector(Fs,a);const _=u*b-m*f;if(_<=0&&f-u>=0&&m-b>=0)return Xu.subVectors(o,s),a=(f-u)/(f-u+(m-b)),n.copy(s).addScaledVector(Xu,a);const p=1/(_+y+h);return r=y*p,a=h*p,n.copy(i).addScaledVector(Us,r).addScaledVector(Fs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Tp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},wi={h:0,s:0,l:0},Pr={h:0,s:0,l:0};function hl(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class at{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=En){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ft.toWorkingColorSpace(this,n),this}setRGB(e,n,i,s=ft.workingColorSpace){return this.r=e,this.g=n,this.b=i,ft.toWorkingColorSpace(this,s),this}setHSL(e,n,i,s=ft.workingColorSpace){if(e=dd(e,1),n=ot(n,0,1),i=ot(i,0,1),n===0)this.r=this.g=this.b=i;else{const o=i<=.5?i*(1+n):i+n-i*n,r=2*i-o;this.r=hl(r,o,e+1/3),this.g=hl(r,o,e),this.b=hl(r,o,e-1/3)}return ft.toWorkingColorSpace(this,s),this}setStyle(e,n=En){function i(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const r=s[1],a=s[2];switch(r){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,n);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,n);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=s[1],r=o.length;if(r===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,n);if(r===6)return this.setHex(parseInt(o,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=En){const i=Tp[e.toLowerCase()];return i!==void 0?this.setHex(i,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fi(e.r),this.g=fi(e.g),this.b=fi(e.b),this}copyLinearToSRGB(e){return this.r=Js(e.r),this.g=Js(e.g),this.b=Js(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=En){return ft.fromWorkingColorSpace(Zt.copy(this),e),Math.round(ot(Zt.r*255,0,255))*65536+Math.round(ot(Zt.g*255,0,255))*256+Math.round(ot(Zt.b*255,0,255))}getHexString(e=En){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=ft.workingColorSpace){ft.fromWorkingColorSpace(Zt.copy(this),n);const i=Zt.r,s=Zt.g,o=Zt.b,r=Math.max(i,s,o),a=Math.min(i,s,o);let l,d;const u=(a+r)/2;if(a===r)l=0,d=0;else{const f=r-a;switch(d=u<=.5?f/(r+a):f/(2-r-a),r){case i:l=(s-o)/f+(s<o?6:0);break;case s:l=(o-i)/f+2;break;case o:l=(i-s)/f+4;break}l/=6}return e.h=l,e.s=d,e.l=u,e}getRGB(e,n=ft.workingColorSpace){return ft.fromWorkingColorSpace(Zt.copy(this),n),e.r=Zt.r,e.g=Zt.g,e.b=Zt.b,e}getStyle(e=En){ft.fromWorkingColorSpace(Zt.copy(this),e);const n=Zt.r,i=Zt.g,s=Zt.b;return e!==En?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(e,n,i){return this.getHSL(wi),this.setHSL(wi.h+e,wi.s+n,wi.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,i){return this.r=e.r+(n.r-e.r)*i,this.g=e.g+(n.g-e.g)*i,this.b=e.b+(n.b-e.b)*i,this}lerpHSL(e,n){this.getHSL(wi),e.getHSL(Pr);const i=jo(wi.h,Pr.h,n),s=jo(wi.s,Pr.s,n),o=jo(wi.l,Pr.l,n);return this.setHSL(i,s,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,i=this.g,s=this.b,o=e.elements;return this.r=o[0]*n+o[3]*i+o[6]*s,this.g=o[1]*n+o[4]*i+o[7]*s,this.b=o[2]*n+o[5]*i+o[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Zt=new at;at.NAMES=Tp;let BU=0;class Ms extends Ss{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:BU++}),this.uuid=vo(),this.name="",this.type="Material",this.blending=Ks,this.side=Vi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=jl,this.blendDst=Yl,this.blendEquation=ls,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new at(0,0,0),this.blendAlpha=0,this.depthFunc=so,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Du,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ts,this.stencilZFail=Ts,this.stencilZPass=Ts,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const s=this[n];if(s===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ks&&(i.blending=this.blending),this.side!==Vi&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==jl&&(i.blendSrc=this.blendSrc),this.blendDst!==Yl&&(i.blendDst=this.blendDst),this.blendEquation!==ls&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==so&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Du&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ts&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ts&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ts&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(o){const r=[];for(const a in o){const l=o[a];delete l.metadata,r.push(l)}return r}if(n){const o=s(e.textures),r=s(e.images);o.length>0&&(i.textures=o),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let i=null;if(n!==null){const s=n.length;i=new Array(s);for(let o=0;o!==s;++o)i[o]=n[o].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Oa extends Ms{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new at(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vn,this.combine=id,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Ft=new U,Rr=new Ke;let VU=0;class Jn{constructor(e,n,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:VU++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=Iu,this.updateRanges=[],this.gpuType=ui,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,i){e*=this.itemSize,i*=n.itemSize;for(let s=0,o=this.itemSize;s<o;s++)this.array[e+s]=n.array[i+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,i=this.count;n<i;n++)Rr.fromBufferAttribute(this,n),Rr.applyMatrix3(e),this.setXY(n,Rr.x,Rr.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)Ft.fromBufferAttribute(this,n),Ft.applyMatrix3(e),this.setXYZ(n,Ft.x,Ft.y,Ft.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)Ft.fromBufferAttribute(this,n),Ft.applyMatrix4(e),this.setXYZ(n,Ft.x,Ft.y,Ft.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)Ft.fromBufferAttribute(this,n),Ft.applyNormalMatrix(e),this.setXYZ(n,Ft.x,Ft.y,Ft.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)Ft.fromBufferAttribute(this,n),Ft.transformDirection(e),this.setXYZ(n,Ft.x,Ft.y,Ft.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let i=this.array[e*this.itemSize+n];return this.normalized&&(i=$s(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=on(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=$s(n,this.array)),n}setX(e,n){return this.normalized&&(n=on(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=$s(n,this.array)),n}setY(e,n){return this.normalized&&(n=on(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=$s(n,this.array)),n}setZ(e,n){return this.normalized&&(n=on(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=$s(n,this.array)),n}setW(e,n){return this.normalized&&(n=on(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=on(n,this.array),i=on(i,this.array)),this.array[e+0]=n,this.array[e+1]=i,this}setXYZ(e,n,i,s){return e*=this.itemSize,this.normalized&&(n=on(n,this.array),i=on(i,this.array),s=on(s,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=s,this}setXYZW(e,n,i,s,o){return e*=this.itemSize,this.normalized&&(n=on(n,this.array),i=on(i,this.array),s=on(s,this.array),o=on(o,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=s,this.array[e+3]=o,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Iu&&(e.usage=this.usage),e}}class Cp extends Jn{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class Ap extends Jn{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class Et extends Jn{constructor(e,n,i){super(new Float32Array(e),n,i)}}let HU=0;const Sn=new Tt,fl=new Nt,Os=new U,mn=new hr,Ao=new hr,Ht=new U;class tn extends Ss{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:HU++}),this.uuid=vo(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Ep(e)?Ap:Cp)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,i=0){this.groups.push({start:e,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const o=new tt().getNormalMatrix(e);i.applyNormalMatrix(o),i.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Sn.makeRotationFromQuaternion(e),this.applyMatrix4(Sn),this}rotateX(e){return Sn.makeRotationX(e),this.applyMatrix4(Sn),this}rotateY(e){return Sn.makeRotationY(e),this.applyMatrix4(Sn),this}rotateZ(e){return Sn.makeRotationZ(e),this.applyMatrix4(Sn),this}translate(e,n,i){return Sn.makeTranslation(e,n,i),this.applyMatrix4(Sn),this}scale(e,n,i){return Sn.makeScale(e,n,i),this.applyMatrix4(Sn),this}lookAt(e){return fl.lookAt(e),fl.updateMatrix(),this.applyMatrix4(fl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Os).negate(),this.translate(Os.x,Os.y,Os.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const i=[];for(let s=0,o=e.length;s<o;s++){const r=e[s];i.push(r.x,r.y,r.z||0)}this.setAttribute("position",new Et(i,3))}else{const i=Math.min(e.length,n.count);for(let s=0;s<i;s++){const o=e[s];n.setXYZ(s,o.x,o.y,o.z||0)}e.length>n.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new hr);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,s=n.length;i<s;i++){const o=n[i];mn.setFromBufferAttribute(o),this.morphTargetsRelative?(Ht.addVectors(this.boundingBox.min,mn.min),this.boundingBox.expandByPoint(Ht),Ht.addVectors(this.boundingBox.max,mn.max),this.boundingBox.expandByPoint(Ht)):(this.boundingBox.expandByPoint(mn.min),this.boundingBox.expandByPoint(mn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ua);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new U,1/0);return}if(e){const i=this.boundingSphere.center;if(mn.setFromBufferAttribute(e),n)for(let o=0,r=n.length;o<r;o++){const a=n[o];Ao.setFromBufferAttribute(a),this.morphTargetsRelative?(Ht.addVectors(mn.min,Ao.min),mn.expandByPoint(Ht),Ht.addVectors(mn.max,Ao.max),mn.expandByPoint(Ht)):(mn.expandByPoint(Ao.min),mn.expandByPoint(Ao.max))}mn.getCenter(i);let s=0;for(let o=0,r=e.count;o<r;o++)Ht.fromBufferAttribute(e,o),s=Math.max(s,i.distanceToSquared(Ht));if(n)for(let o=0,r=n.length;o<r;o++){const a=n[o],l=this.morphTargetsRelative;for(let d=0,u=a.count;d<u;d++)Ht.fromBufferAttribute(a,d),l&&(Os.fromBufferAttribute(e,d),Ht.add(Os)),s=Math.max(s,i.distanceToSquared(Ht))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=n.position,s=n.normal,o=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Jn(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),a=[],l=[];for(let R=0;R<i.count;R++)a[R]=new U,l[R]=new U;const d=new U,u=new U,f=new U,h=new Ke,m=new Ke,b=new Ke,y=new U,_=new U;function p(R,E,g){d.fromBufferAttribute(i,R),u.fromBufferAttribute(i,E),f.fromBufferAttribute(i,g),h.fromBufferAttribute(o,R),m.fromBufferAttribute(o,E),b.fromBufferAttribute(o,g),u.sub(d),f.sub(d),m.sub(h),b.sub(h);const L=1/(m.x*b.y-b.x*m.y);!isFinite(L)||(y.copy(u).multiplyScalar(b.y).addScaledVector(f,-m.y).multiplyScalar(L),_.copy(f).multiplyScalar(m.x).addScaledVector(u,-b.x).multiplyScalar(L),a[R].add(y),a[E].add(y),a[g].add(y),l[R].add(_),l[E].add(_),l[g].add(_))}let T=this.groups;T.length===0&&(T=[{start:0,count:e.count}]);for(let R=0,E=T.length;R<E;++R){const g=T[R],L=g.start,O=g.count;for(let H=L,j=L+O;H<j;H+=3)p(e.getX(H+0),e.getX(H+1),e.getX(H+2))}const w=new U,S=new U,I=new U,P=new U;function D(R){I.fromBufferAttribute(s,R),P.copy(I);const E=a[R];w.copy(E),w.sub(I.multiplyScalar(I.dot(E))).normalize(),S.crossVectors(P,E);const L=S.dot(l[R])<0?-1:1;r.setXYZW(R,w.x,w.y,w.z,L)}for(let R=0,E=T.length;R<E;++R){const g=T[R],L=g.start,O=g.count;for(let H=L,j=L+O;H<j;H+=3)D(e.getX(H+0)),D(e.getX(H+1)),D(e.getX(H+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Jn(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let h=0,m=i.count;h<m;h++)i.setXYZ(h,0,0,0);const s=new U,o=new U,r=new U,a=new U,l=new U,d=new U,u=new U,f=new U;if(e)for(let h=0,m=e.count;h<m;h+=3){const b=e.getX(h+0),y=e.getX(h+1),_=e.getX(h+2);s.fromBufferAttribute(n,b),o.fromBufferAttribute(n,y),r.fromBufferAttribute(n,_),u.subVectors(r,o),f.subVectors(s,o),u.cross(f),a.fromBufferAttribute(i,b),l.fromBufferAttribute(i,y),d.fromBufferAttribute(i,_),a.add(u),l.add(u),d.add(u),i.setXYZ(b,a.x,a.y,a.z),i.setXYZ(y,l.x,l.y,l.z),i.setXYZ(_,d.x,d.y,d.z)}else for(let h=0,m=n.count;h<m;h+=3)s.fromBufferAttribute(n,h+0),o.fromBufferAttribute(n,h+1),r.fromBufferAttribute(n,h+2),u.subVectors(r,o),f.subVectors(s,o),u.cross(f),i.setXYZ(h+0,u.x,u.y,u.z),i.setXYZ(h+1,u.x,u.y,u.z),i.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)Ht.fromBufferAttribute(e,n),Ht.normalize(),e.setXYZ(n,Ht.x,Ht.y,Ht.z)}toNonIndexed(){function e(a,l){const d=a.array,u=a.itemSize,f=a.normalized,h=new d.constructor(l.length*u);let m=0,b=0;for(let y=0,_=l.length;y<_;y++){a.isInterleavedBufferAttribute?m=l[y]*a.data.stride+a.offset:m=l[y]*u;for(let p=0;p<u;p++)h[b++]=d[m++]}return new Jn(h,u,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new tn,i=this.index.array,s=this.attributes;for(const a in s){const l=s[a],d=e(l,i);n.setAttribute(a,d)}const o=this.morphAttributes;for(const a in o){const l=[],d=o[a];for(let u=0,f=d.length;u<f;u++){const h=d[u],m=e(h,i);l.push(m)}n.morphAttributes[a]=l}n.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let a=0,l=r.length;a<l;a++){const d=r[a];n.addGroup(d.start,d.count,d.materialIndex)}return n}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const d in l)l[d]!==void 0&&(e[d]=l[d]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const l in i){const d=i[l];e.data.attributes[l]=d.toJSON(e.data)}const s={};let o=!1;for(const l in this.morphAttributes){const d=this.morphAttributes[l],u=[];for(let f=0,h=d.length;f<h;f++){const m=d[f];u.push(m.toJSON(e.data))}u.length>0&&(s[l]=u,o=!0)}o&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const s=e.attributes;for(const d in s){const u=s[d];this.setAttribute(d,u.clone(n))}const o=e.morphAttributes;for(const d in o){const u=[],f=o[d];for(let h=0,m=f.length;h<m;h++)u.push(f[h].clone(n));this.morphAttributes[d]=u}this.morphTargetsRelative=e.morphTargetsRelative;const r=e.groups;for(let d=0,u=r.length;d<u;d++){const f=r[d];this.addGroup(f.start,f.count,f.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const ju=new Tt,Ki=new Fa,Dr=new Ua,Yu=new U,Ir=new U,Lr=new U,Ur=new U,pl=new U,Fr=new U,qu=new U,Or=new U;class Ae extends Nt{constructor(e=new tn,n=new Oa){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,r=s.length;o<r;o++){const a=s[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=o}}}}getVertexPosition(e,n){const i=this.geometry,s=i.attributes.position,o=i.morphAttributes.position,r=i.morphTargetsRelative;n.fromBufferAttribute(s,e);const a=this.morphTargetInfluences;if(o&&a){Fr.set(0,0,0);for(let l=0,d=o.length;l<d;l++){const u=a[l],f=o[l];u!==0&&(pl.fromBufferAttribute(f,e),r?Fr.addScaledVector(pl,u):Fr.addScaledVector(pl.sub(n),u))}n.add(Fr)}return n}raycast(e,n){const i=this.geometry,s=this.material,o=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Dr.copy(i.boundingSphere),Dr.applyMatrix4(o),Ki.copy(e.ray).recast(e.near),!(Dr.containsPoint(Ki.origin)===!1&&(Ki.intersectSphere(Dr,Yu)===null||Ki.origin.distanceToSquared(Yu)>(e.far-e.near)**2))&&(ju.copy(o).invert(),Ki.copy(e.ray).applyMatrix4(ju),!(i.boundingBox!==null&&Ki.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,Ki)))}_computeIntersections(e,n,i){let s;const o=this.geometry,r=this.material,a=o.index,l=o.attributes.position,d=o.attributes.uv,u=o.attributes.uv1,f=o.attributes.normal,h=o.groups,m=o.drawRange;if(a!==null)if(Array.isArray(r))for(let b=0,y=h.length;b<y;b++){const _=h[b],p=r[_.materialIndex],T=Math.max(_.start,m.start),w=Math.min(a.count,Math.min(_.start+_.count,m.start+m.count));for(let S=T,I=w;S<I;S+=3){const P=a.getX(S),D=a.getX(S+1),R=a.getX(S+2);s=Nr(this,p,e,i,d,u,f,P,D,R),s&&(s.faceIndex=Math.floor(S/3),s.face.materialIndex=_.materialIndex,n.push(s))}}else{const b=Math.max(0,m.start),y=Math.min(a.count,m.start+m.count);for(let _=b,p=y;_<p;_+=3){const T=a.getX(_),w=a.getX(_+1),S=a.getX(_+2);s=Nr(this,r,e,i,d,u,f,T,w,S),s&&(s.faceIndex=Math.floor(_/3),n.push(s))}}else if(l!==void 0)if(Array.isArray(r))for(let b=0,y=h.length;b<y;b++){const _=h[b],p=r[_.materialIndex],T=Math.max(_.start,m.start),w=Math.min(l.count,Math.min(_.start+_.count,m.start+m.count));for(let S=T,I=w;S<I;S+=3){const P=S,D=S+1,R=S+2;s=Nr(this,p,e,i,d,u,f,P,D,R),s&&(s.faceIndex=Math.floor(S/3),s.face.materialIndex=_.materialIndex,n.push(s))}}else{const b=Math.max(0,m.start),y=Math.min(l.count,m.start+m.count);for(let _=b,p=y;_<p;_+=3){const T=_,w=_+1,S=_+2;s=Nr(this,r,e,i,d,u,f,T,w,S),s&&(s.faceIndex=Math.floor(_/3),n.push(s))}}}}function $U(t,e,n,i,s,o,r,a){let l;if(e.side===un?l=i.intersectTriangle(r,o,s,!0,a):l=i.intersectTriangle(s,o,r,e.side===Vi,a),l===null)return null;Or.copy(a),Or.applyMatrix4(t.matrixWorld);const d=n.ray.origin.distanceTo(Or);return d<n.near||d>n.far?null:{distance:d,point:Or.clone(),object:t}}function Nr(t,e,n,i,s,o,r,a,l,d){t.getVertexPosition(a,Ir),t.getVertexPosition(l,Lr),t.getVertexPosition(d,Ur);const u=$U(t,e,n,i,Ir,Lr,Ur,qu);if(u){const f=new U;On.getBarycoord(qu,Ir,Lr,Ur,f),s&&(u.uv=On.getInterpolatedAttribute(s,a,l,d,f,new Ke)),o&&(u.uv1=On.getInterpolatedAttribute(o,a,l,d,f,new Ke)),r&&(u.normal=On.getInterpolatedAttribute(r,a,l,d,f,new U),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c:d,normal:new U,materialIndex:0};On.getNormal(Ir,Lr,Ur,h.normal),u.face=h,u.barycoord=f}return u}class Ot extends tn{constructor(e=1,n=1,i=1,s=1,o=1,r=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:s,heightSegments:o,depthSegments:r};const a=this;s=Math.floor(s),o=Math.floor(o),r=Math.floor(r);const l=[],d=[],u=[],f=[];let h=0,m=0;b("z","y","x",-1,-1,i,n,e,r,o,0),b("z","y","x",1,-1,i,n,-e,r,o,1),b("x","z","y",1,1,e,i,n,s,r,2),b("x","z","y",1,-1,e,i,-n,s,r,3),b("x","y","z",1,-1,e,n,i,s,o,4),b("x","y","z",-1,-1,e,n,-i,s,o,5),this.setIndex(l),this.setAttribute("position",new Et(d,3)),this.setAttribute("normal",new Et(u,3)),this.setAttribute("uv",new Et(f,2));function b(y,_,p,T,w,S,I,P,D,R,E){const g=S/D,L=I/R,O=S/2,H=I/2,j=P/2,re=D+1,q=R+1;let ae=0,G=0;const fe=new U;for(let ye=0;ye<q;ye++){const Re=ye*L-H;for(let Be=0;Be<re;Be++){const Je=Be*g-O;fe[y]=Je*T,fe[_]=Re*w,fe[p]=j,d.push(fe.x,fe.y,fe.z),fe[y]=0,fe[_]=0,fe[p]=P>0?1:-1,u.push(fe.x,fe.y,fe.z),f.push(Be/D),f.push(1-ye/R),ae+=1}}for(let ye=0;ye<R;ye++)for(let Re=0;Re<D;Re++){const Be=h+Re+re*ye,Je=h+Re+re*(ye+1),ce=h+(Re+1)+re*(ye+1),N=h+(Re+1)+re*ye;l.push(Be,Je,N),l.push(Je,ce,N),G+=6}a.addGroup(m,G,E),m+=G,h+=ae}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ot(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function co(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const s=t[n][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=s.clone():Array.isArray(s)?e[n][i]=s.slice():e[n][i]=s}}return e}function rn(t){const e={};for(let n=0;n<t.length;n++){const i=co(t[n]);for(const s in i)e[s]=i[s]}return e}function GU(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function Pp(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ft.workingColorSpace}const WU={clone:co,merge:rn};var XU=`void main() {
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }`,jU=`void main() {
- gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
- }`;class Hi extends Ms{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=XU,this.fragmentShader=jU,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=co(e.uniforms),this.uniformsGroups=GU(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const s in this.uniforms){const r=this.uniforms[s].value;r&&r.isTexture?n.uniforms[s]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?n.uniforms[s]={type:"c",value:r.getHex()}:r&&r.isVector2?n.uniforms[s]={type:"v2",value:r.toArray()}:r&&r.isVector3?n.uniforms[s]={type:"v3",value:r.toArray()}:r&&r.isVector4?n.uniforms[s]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?n.uniforms[s]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?n.uniforms[s]={type:"m4",value:r.toArray()}:n.uniforms[s]={value:r}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(n.extensions=i),n}}class Rp extends Nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Tt,this.projectionMatrix=new Tt,this.projectionMatrixInverse=new Tt,this.coordinateSystem=hi}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ti=new U,Zu=new Ke,Ku=new Ke;class _n extends Rp{constructor(e=50,n=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=lo*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Xo*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return lo*2*Math.atan(Math.tan(Xo*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,i){Ti.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ti.x,Ti.y).multiplyScalar(-e/Ti.z),Ti.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Ti.x,Ti.y).multiplyScalar(-e/Ti.z)}getViewSize(e,n){return this.getViewBounds(e,Zu,Ku),n.subVectors(Ku,Zu)}setViewOffset(e,n,i,s,o,r){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=o,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Xo*.5*this.fov)/this.zoom,i=2*n,s=this.aspect*i,o=-.5*s;const r=this.view;if(this.view!==null&&this.view.enabled){const l=r.fullWidth,d=r.fullHeight;o+=r.offsetX*s/l,n-=r.offsetY*i/d,s*=r.width/l,i*=r.height/d}const a=this.filmOffset;a!==0&&(o+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(o,o+s,n,n-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Ns=-90,zs=1;class YU extends Nt{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new _n(Ns,zs,e,n);s.layers=this.layers,this.add(s);const o=new _n(Ns,zs,e,n);o.layers=this.layers,this.add(o);const r=new _n(Ns,zs,e,n);r.layers=this.layers,this.add(r);const a=new _n(Ns,zs,e,n);a.layers=this.layers,this.add(a);const l=new _n(Ns,zs,e,n);l.layers=this.layers,this.add(l);const d=new _n(Ns,zs,e,n);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,s,o,r,a,l]=n;for(const d of n)this.remove(d);if(e===hi)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),r.up.set(0,0,1),r.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===pa)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),r.up.set(0,0,-1),r.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of n)this.add(d),d.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,r,a,l,d,u]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;const y=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,s),e.render(n,o),e.setRenderTarget(i,1,s),e.render(n,r),e.setRenderTarget(i,2,s),e.render(n,a),e.setRenderTarget(i,3,s),e.render(n,l),e.setRenderTarget(i,4,s),e.render(n,d),i.texture.generateMipmaps=y,e.setRenderTarget(i,5,s),e.render(n,u),e.setRenderTarget(f,h,m),e.xr.enabled=b,i.texture.needsPMREMUpdate=!0}}class Dp extends hn{constructor(e=[],n=oo,i,s,o,r,a,l,d,u){super(e,n,i,s,o,r,a,l,d,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class qU extends vs{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];this.texture=new Dp(s,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:qn}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
- varying vec3 vWorldDirection;
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- }
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- }
- `,fragmentShader:`
- uniform sampler2D tEquirect;
- varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vec3 direction = normalize( vWorldDirection );
- vec2 sampleUV = equirectUv( direction );
- gl_FragColor = texture2D( tEquirect, sampleUV );
- }
- `},s=new Ot(5,5,5),o=new Hi({name:"CubemapFromEquirect",uniforms:co(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:un,blending:Ni});o.uniforms.tEquirect.value=n;const r=new Ae(s,o),a=n.minFilter;return n.minFilter===fs&&(n.minFilter=qn),new YU(1,10,this).update(e,r),n.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(e,n=!0,i=!0,s=!0){const o=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(n,i,s);e.setRenderTarget(o)}}class Uo extends Nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const ZU={type:"move"};class ml{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Uo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Uo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Uo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,i){let s=null,o=null,r=null;const a=this._targetRay,l=this._grip,d=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(d&&e.hand){r=!0;for(const y of e.hand.values()){const _=n.getJointPose(y,i),p=this._getHandJoint(d,y);_!==null&&(p.matrix.fromArray(_.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=_.radius),p.visible=_!==null}const u=d.joints["index-finger-tip"],f=d.joints["thumb-tip"],h=u.position.distanceTo(f.position),m=.02,b=.005;d.inputState.pinching&&h>m+b?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&h<=m-b&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(o=n.getPose(e.gripSpace,i),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=n.getPose(e.targetRaySpace,i),s===null&&o!==null&&(s=o),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ZU)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=o!==null),d!==null&&(d.visible=r!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new Uo;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class KU extends Nt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Vn,this.environmentIntensity=1,this.environmentRotation=new Vn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}const _l=new U,JU=new U,QU=new tt;class Di{constructor(e=new U(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,s){return this.normal.set(e,n,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const s=_l.subVectors(i,n).cross(JU.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const i=e.delta(_l),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/s;return o<0||o>1?null:n.copy(e.start).addScaledVector(i,o)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const i=n||QU.getNormalMatrix(e),s=this.coplanarPoint(_l).applyMatrix4(e),o=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ji=new Ua,zr=new U;class fd{constructor(e=new Di,n=new Di,i=new Di,s=new Di,o=new Di,r=new Di){this.planes=[e,n,i,s,o,r]}set(e,n,i,s,o,r){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(i),a[3].copy(s),a[4].copy(o),a[5].copy(r),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=hi){const i=this.planes,s=e.elements,o=s[0],r=s[1],a=s[2],l=s[3],d=s[4],u=s[5],f=s[6],h=s[7],m=s[8],b=s[9],y=s[10],_=s[11],p=s[12],T=s[13],w=s[14],S=s[15];if(i[0].setComponents(l-o,h-d,_-m,S-p).normalize(),i[1].setComponents(l+o,h+d,_+m,S+p).normalize(),i[2].setComponents(l+r,h+u,_+b,S+T).normalize(),i[3].setComponents(l-r,h-u,_-b,S-T).normalize(),i[4].setComponents(l-a,h-f,_-y,S-w).normalize(),n===hi)i[5].setComponents(l+a,h+f,_+y,S+w).normalize();else if(n===pa)i[5].setComponents(a,f,y,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ji.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Ji.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ji)}intersectsSprite(e){return Ji.center.set(0,0,0),Ji.radius=.7071067811865476,Ji.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ji)}intersectsSphere(e){const n=this.planes,i=e.center,s=-e.radius;for(let o=0;o<6;o++)if(n[o].distanceToPoint(i)<s)return!1;return!0}intersectsBox(e){const n=this.planes;for(let i=0;i<6;i++){const s=n[i];if(zr.x=s.normal.x>0?e.max.x:e.min.x,zr.y=s.normal.y>0?e.max.y:e.min.y,zr.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(zr)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class fr extends Ms{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new at(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const _a=new U,ga=new U,Ju=new Tt,Po=new Fa,kr=new Ua,gl=new U,Qu=new U;class ci extends Nt{constructor(e=new tn,n=new fr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let s=1,o=n.count;s<o;s++)_a.fromBufferAttribute(n,s-1),ga.fromBufferAttribute(n,s),i[s]=i[s-1],i[s]+=_a.distanceTo(ga);e.setAttribute("lineDistance",new Et(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const i=this.geometry,s=this.matrixWorld,o=e.params.Line.threshold,r=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),kr.copy(i.boundingSphere),kr.applyMatrix4(s),kr.radius+=o,e.ray.intersectsSphere(kr)===!1)return;Ju.copy(s).invert(),Po.copy(e.ray).applyMatrix4(Ju);const a=o/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,d=this.isLineSegments?2:1,u=i.index,h=i.attributes.position;if(u!==null){const m=Math.max(0,r.start),b=Math.min(u.count,r.start+r.count);for(let y=m,_=b-1;y<_;y+=d){const p=u.getX(y),T=u.getX(y+1),w=Br(this,e,Po,l,p,T,y);w&&n.push(w)}if(this.isLineLoop){const y=u.getX(b-1),_=u.getX(m),p=Br(this,e,Po,l,y,_,b-1);p&&n.push(p)}}else{const m=Math.max(0,r.start),b=Math.min(h.count,r.start+r.count);for(let y=m,_=b-1;y<_;y+=d){const p=Br(this,e,Po,l,y,y+1,y);p&&n.push(p)}if(this.isLineLoop){const y=Br(this,e,Po,l,b-1,m,b-1);y&&n.push(y)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,r=s.length;o<r;o++){const a=s[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=o}}}}}function Br(t,e,n,i,s,o,r){const a=t.geometry.attributes.position;if(_a.fromBufferAttribute(a,s),ga.fromBufferAttribute(a,o),n.distanceSqToSegment(_a,ga,gl,Qu)>i)return;gl.applyMatrix4(t.matrixWorld);const d=e.ray.origin.distanceTo(gl);if(!(d<e.near||d>e.far))return{distance:d,point:Qu.clone().applyMatrix4(t.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:t}}const eh=new U,th=new U;class pd extends ci{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[];for(let s=0,o=n.count;s<o;s+=2)eh.fromBufferAttribute(n,s),th.fromBufferAttribute(n,s+1),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+eh.distanceTo(th);e.setAttribute("lineDistance",new Et(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Ip extends hn{constructor(e,n,i=gs,s,o,r,a=Bn,l=Bn,d,u=rr){if(u!==rr&&u!==ar)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,s,o,r,a,l,u,i,d),this.isDepthTexture=!0,this.image={width:e,height:n},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ud(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class Wt extends tn{constructor(e=1,n=1,i=1,s=32,o=1,r=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:i,radialSegments:s,heightSegments:o,openEnded:r,thetaStart:a,thetaLength:l};const d=this;s=Math.floor(s),o=Math.floor(o);const u=[],f=[],h=[],m=[];let b=0;const y=[],_=i/2;let p=0;T(),r===!1&&(e>0&&w(!0),n>0&&w(!1)),this.setIndex(u),this.setAttribute("position",new Et(f,3)),this.setAttribute("normal",new Et(h,3)),this.setAttribute("uv",new Et(m,2));function T(){const S=new U,I=new U;let P=0;const D=(n-e)/i;for(let R=0;R<=o;R++){const E=[],g=R/o,L=g*(n-e)+e;for(let O=0;O<=s;O++){const H=O/s,j=H*l+a,re=Math.sin(j),q=Math.cos(j);I.x=L*re,I.y=-g*i+_,I.z=L*q,f.push(I.x,I.y,I.z),S.set(re,D,q).normalize(),h.push(S.x,S.y,S.z),m.push(H,1-g),E.push(b++)}y.push(E)}for(let R=0;R<s;R++)for(let E=0;E<o;E++){const g=y[E][R],L=y[E+1][R],O=y[E+1][R+1],H=y[E][R+1];(e>0||E!==0)&&(u.push(g,L,H),P+=3),(n>0||E!==o-1)&&(u.push(L,O,H),P+=3)}d.addGroup(p,P,0),p+=P}function w(S){const I=b,P=new Ke,D=new U;let R=0;const E=S===!0?e:n,g=S===!0?1:-1;for(let O=1;O<=s;O++)f.push(0,_*g,0),h.push(0,g,0),m.push(.5,.5),b++;const L=b;for(let O=0;O<=s;O++){const j=O/s*l+a,re=Math.cos(j),q=Math.sin(j);D.x=E*q,D.y=_*g,D.z=E*re,f.push(D.x,D.y,D.z),h.push(0,g,0),P.x=re*.5+.5,P.y=q*.5*g+.5,m.push(P.x,P.y),b++}for(let O=0;O<s;O++){const H=I+O,j=L+O;S===!0?u.push(j,j+1,H):u.push(j+1,j,H),R+=3}d.addGroup(p,R,S===!0?1:2),p+=R}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wt(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class md extends Wt{constructor(e=1,n=1,i=32,s=1,o=!1,r=0,a=Math.PI*2){super(0,e,n,i,s,o,r,a),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:r,thetaLength:a}}static fromJSON(e){return new md(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class _d extends tn{constructor(e=[],n=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:n,radius:i,detail:s};const o=[],r=[];a(s),d(i),u(),this.setAttribute("position",new Et(o,3)),this.setAttribute("normal",new Et(o.slice(),3)),this.setAttribute("uv",new Et(r,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function a(T){const w=new U,S=new U,I=new U;for(let P=0;P<n.length;P+=3)m(n[P+0],w),m(n[P+1],S),m(n[P+2],I),l(w,S,I,T)}function l(T,w,S,I){const P=I+1,D=[];for(let R=0;R<=P;R++){D[R]=[];const E=T.clone().lerp(S,R/P),g=w.clone().lerp(S,R/P),L=P-R;for(let O=0;O<=L;O++)O===0&&R===P?D[R][O]=E:D[R][O]=E.clone().lerp(g,O/L)}for(let R=0;R<P;R++)for(let E=0;E<2*(P-R)-1;E++){const g=Math.floor(E/2);E%2===0?(h(D[R][g+1]),h(D[R+1][g]),h(D[R][g])):(h(D[R][g+1]),h(D[R+1][g+1]),h(D[R+1][g]))}}function d(T){const w=new U;for(let S=0;S<o.length;S+=3)w.x=o[S+0],w.y=o[S+1],w.z=o[S+2],w.normalize().multiplyScalar(T),o[S+0]=w.x,o[S+1]=w.y,o[S+2]=w.z}function u(){const T=new U;for(let w=0;w<o.length;w+=3){T.x=o[w+0],T.y=o[w+1],T.z=o[w+2];const S=_(T)/2/Math.PI+.5,I=p(T)/Math.PI+.5;r.push(S,1-I)}b(),f()}function f(){for(let T=0;T<r.length;T+=6){const w=r[T+0],S=r[T+2],I=r[T+4],P=Math.max(w,S,I),D=Math.min(w,S,I);P>.9&&D<.1&&(w<.2&&(r[T+0]+=1),S<.2&&(r[T+2]+=1),I<.2&&(r[T+4]+=1))}}function h(T){o.push(T.x,T.y,T.z)}function m(T,w){const S=T*3;w.x=e[S+0],w.y=e[S+1],w.z=e[S+2]}function b(){const T=new U,w=new U,S=new U,I=new U,P=new Ke,D=new Ke,R=new Ke;for(let E=0,g=0;E<o.length;E+=9,g+=6){T.set(o[E+0],o[E+1],o[E+2]),w.set(o[E+3],o[E+4],o[E+5]),S.set(o[E+6],o[E+7],o[E+8]),P.set(r[g+0],r[g+1]),D.set(r[g+2],r[g+3]),R.set(r[g+4],r[g+5]),I.copy(T).add(w).add(S).divideScalar(3);const L=_(I);y(P,g+0,T,L),y(D,g+2,w,L),y(R,g+4,S,L)}}function y(T,w,S,I){I<0&&T.x===1&&(r[w]=T.x-1),S.x===0&&S.z===0&&(r[w]=I/2/Math.PI+.5)}function _(T){return Math.atan2(T.z,-T.x)}function p(T){return Math.atan2(-T.y,Math.sqrt(T.x*T.x+T.z*T.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _d(e.vertices,e.indices,e.radius,e.details)}}class Ws extends _d{constructor(e=1,n=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,s,e,n),this.type="OctahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new Ws(e.radius,e.detail)}}class bo extends tn{constructor(e=1,n=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:i,heightSegments:s};const o=e/2,r=n/2,a=Math.floor(i),l=Math.floor(s),d=a+1,u=l+1,f=e/a,h=n/l,m=[],b=[],y=[],_=[];for(let p=0;p<u;p++){const T=p*h-r;for(let w=0;w<d;w++){const S=w*f-o;b.push(S,-T,0),y.push(0,0,1),_.push(w/a),_.push(1-p/l)}}for(let p=0;p<l;p++)for(let T=0;T<a;T++){const w=T+d*p,S=T+d*(p+1),I=T+1+d*(p+1),P=T+1+d*p;m.push(w,S,P),m.push(S,I,P)}this.setIndex(m),this.setAttribute("position",new Et(b,3)),this.setAttribute("normal",new Et(y,3)),this.setAttribute("uv",new Et(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bo(e.width,e.height,e.widthSegments,e.heightSegments)}}class gd extends tn{constructor(e=1,n=32,i=16,s=0,o=Math.PI*2,r=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:i,phiStart:s,phiLength:o,thetaStart:r,thetaLength:a},n=Math.max(3,Math.floor(n)),i=Math.max(2,Math.floor(i));const l=Math.min(r+a,Math.PI);let d=0;const u=[],f=new U,h=new U,m=[],b=[],y=[],_=[];for(let p=0;p<=i;p++){const T=[],w=p/i;let S=0;p===0&&r===0?S=.5/n:p===i&&l===Math.PI&&(S=-.5/n);for(let I=0;I<=n;I++){const P=I/n;f.x=-e*Math.cos(s+P*o)*Math.sin(r+w*a),f.y=e*Math.cos(r+w*a),f.z=e*Math.sin(s+P*o)*Math.sin(r+w*a),b.push(f.x,f.y,f.z),h.copy(f).normalize(),y.push(h.x,h.y,h.z),_.push(P+S,1-w),T.push(d++)}u.push(T)}for(let p=0;p<i;p++)for(let T=0;T<n;T++){const w=u[p][T+1],S=u[p][T],I=u[p+1][T],P=u[p+1][T+1];(p!==0||r>0)&&m.push(w,S,P),(p!==i-1||l<Math.PI)&&m.push(S,I,P)}this.setIndex(m),this.setAttribute("position",new Et(b,3)),this.setAttribute("normal",new Et(y,3)),this.setAttribute("uv",new Et(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gd(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class cs extends tn{constructor(e=1,n=.4,i=12,s=48,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:n,radialSegments:i,tubularSegments:s,arc:o},i=Math.floor(i),s=Math.floor(s);const r=[],a=[],l=[],d=[],u=new U,f=new U,h=new U;for(let m=0;m<=i;m++)for(let b=0;b<=s;b++){const y=b/s*o,_=m/i*Math.PI*2;f.x=(e+n*Math.cos(_))*Math.cos(y),f.y=(e+n*Math.cos(_))*Math.sin(y),f.z=n*Math.sin(_),a.push(f.x,f.y,f.z),u.x=e*Math.cos(y),u.y=e*Math.sin(y),h.subVectors(f,u).normalize(),l.push(h.x,h.y,h.z),d.push(b/s),d.push(m/i)}for(let m=1;m<=i;m++)for(let b=1;b<=s;b++){const y=(s+1)*m+b-1,_=(s+1)*(m-1)+b-1,p=(s+1)*(m-1)+b,T=(s+1)*m+b;r.push(y,_,T),r.push(_,p,T)}this.setIndex(r),this.setAttribute("position",new Et(a,3)),this.setAttribute("normal",new Et(l,3)),this.setAttribute("uv",new Et(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new cs(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class eF extends Ms{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new at(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class tF extends Ms{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new at(16777215),this.specular=new at(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new at(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Sp,this.normalScale=new Ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vn,this.combine=id,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class nF extends Ms{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ZL,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class iF extends Ms{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class Lp extends Nt{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new at(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}}const vl=new Tt,nh=new U,ih=new U;class sF{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ke(512,512),this.mapType=ei,this.map=null,this.mapPass=null,this.matrix=new Tt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new fd,this._frameExtents=new Ke(1,1),this._viewportCount=1,this._viewports=[new It(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;nh.setFromMatrixPosition(e.matrixWorld),n.position.copy(nh),ih.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(ih),n.updateMatrixWorld(),vl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(vl),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(vl)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class oF extends sF{constructor(){super(new _n(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const n=this.camera,i=lo*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height,o=e.distance||n.far;(i!==n.fov||s!==n.aspect||o!==n.far)&&(n.fov=i,n.aspect=s,n.far=o,n.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class rF extends Lp{constructor(e,n,i=0,s=Math.PI/3,o=0,r=2){super(e,n),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.target=new Nt,this.distance=i,this.angle=s,this.penumbra=o,this.decay=r,this.map=null,this.shadow=new oF}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class aF extends Rp{constructor(e=-1,n=1,i=1,s=-1,o=.1,r=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=s,this.near=o,this.far=r,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,i,s,o,r){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=s,this.view.width=o,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let o=i-e,r=i+e,a=s+n,l=s-n;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=d*this.view.offsetX,r=o+d*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(o,r,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}class lF extends Lp{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class cF extends _n{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const sh=new Tt;class dF{constructor(e,n,i=0,s=1/0){this.ray=new Fa(e,n),this.near=i,this.far=s,this.camera=null,this.layers=new hd,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):console.error("THREE.Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return sh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(sh),this}intersectObject(e,n=!0,i=[]){return Ic(e,this,i,n),i.sort(oh),i}intersectObjects(e,n=!0,i=[]){for(let s=0,o=e.length;s<o;s++)Ic(e[s],this,i,n);return i.sort(oh),i}}function oh(t,e){return t.distance-e.distance}function Ic(t,e,n,i){let s=!0;if(t.layers.test(e.layers)&&t.raycast(e,n)===!1&&(s=!1),s===!0&&i===!0){const o=t.children;for(let r=0,a=o.length;r<a;r++)Ic(o[r],e,n,!0)}}class rh{constructor(e=1,n=0,i=0){this.radius=e,this.phi=n,this.theta=i}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=ot(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(ot(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class uF extends pd{constructor(e=10,n=10,i=4473924,s=8947848){i=new at(i),s=new at(s);const o=n/2,r=e/n,a=e/2,l=[],d=[];for(let h=0,m=0,b=-a;h<=n;h++,b+=r){l.push(-a,0,b,a,0,b),l.push(b,0,-a,b,0,a);const y=h===o?i:s;y.toArray(d,m),m+=3,y.toArray(d,m),m+=3,y.toArray(d,m),m+=3,y.toArray(d,m),m+=3}const u=new tn;u.setAttribute("position",new Et(l,3)),u.setAttribute("color",new Et(d,3));const f=new fr({vertexColors:!0,toneMapped:!1});super(u,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class hF extends pd{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new tn;s.setAttribute("position",new Et(n,3)),s.setAttribute("color",new Et(i,3));const o=new fr({vertexColors:!0,toneMapped:!1});super(s,o),this.type="AxesHelper"}setColors(e,n,i){const s=new at,o=this.geometry.attributes.color.array;return s.set(e),s.toArray(o,0),s.toArray(o,3),s.set(n),s.toArray(o,6),s.toArray(o,9),s.set(i),s.toArray(o,12),s.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Up extends Ss{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function ah(t,e,n,i){const s=fF(i);switch(n){case gp:return t*e;case bp:return t*e/s.components*s.byteLength;case ad:return t*e/s.components*s.byteLength;case yp:return t*e*2/s.components*s.byteLength;case ld:return t*e*2/s.components*s.byteLength;case vp:return t*e*3/s.components*s.byteLength;case zn:return t*e*4/s.components*s.byteLength;case cd:return t*e*4/s.components*s.byteLength;case Jr:case Qr:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case ea:case ta:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case ac:case cc:return Math.max(t,16)*Math.max(e,8)/4;case rc:case lc:return Math.max(t,8)*Math.max(e,8)/2;case dc:case uc:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case hc:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case fc:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case pc:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case mc:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case _c:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case gc:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case vc:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case bc:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case yc:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case xc:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Sc:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Mc:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Ec:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case wc:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case Tc:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case na:case Cc:case Ac:return Math.ceil(t/4)*Math.ceil(e/4)*16;case xp:case Pc:return Math.ceil(t/4)*Math.ceil(e/4)*8;case Rc:case Dc:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function fF(t){switch(t){case ei:case pp:return{byteLength:1,components:1};case sr:case mp:case ur:return{byteLength:2,components:1};case od:case rd:return{byteLength:2,components:4};case gs:case sd:case ui:return{byteLength:4,components:1};case _p:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:nd}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=nd);/**
- * @license
- * Copyright 2010-2025 Three.js Authors
- * SPDX-License-Identifier: MIT
- */function Fp(){let t=null,e=!1,n=null,i=null;function s(o,r){n(o,r),i=t.requestAnimationFrame(s)}return{start:function(){e!==!0&&n!==null&&(i=t.requestAnimationFrame(s),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(o){n=o},setContext:function(o){t=o}}}function pF(t){const e=new WeakMap;function n(a,l){const d=a.array,u=a.usage,f=d.byteLength,h=t.createBuffer();t.bindBuffer(l,h),t.bufferData(l,d,u),a.onUploadCallback();let m;if(d instanceof Float32Array)m=t.FLOAT;else if(d instanceof Uint16Array)a.isFloat16BufferAttribute?m=t.HALF_FLOAT:m=t.UNSIGNED_SHORT;else if(d instanceof Int16Array)m=t.SHORT;else if(d instanceof Uint32Array)m=t.UNSIGNED_INT;else if(d instanceof Int32Array)m=t.INT;else if(d instanceof Int8Array)m=t.BYTE;else if(d instanceof Uint8Array)m=t.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)m=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:h,type:m,bytesPerElement:d.BYTES_PER_ELEMENT,version:a.version,size:f}}function i(a,l,d){const u=l.array,f=l.updateRanges;if(t.bindBuffer(d,a),f.length===0)t.bufferSubData(d,0,u);else{f.sort((m,b)=>m.start-b.start);let h=0;for(let m=1;m<f.length;m++){const b=f[h],y=f[m];y.start<=b.start+b.count+1?b.count=Math.max(b.count,y.start+y.count-b.start):(++h,f[h]=y)}f.length=h+1;for(let m=0,b=f.length;m<b;m++){const y=f[m];t.bufferSubData(d,y.start*u.BYTES_PER_ELEMENT,u,y.start,y.count)}l.clearUpdateRanges()}l.onUploadCallback()}function s(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function o(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(t.deleteBuffer(l.buffer),e.delete(a))}function r(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const d=e.get(a);if(d===void 0)e.set(a,n(a,l));else if(d.version<a.version){if(d.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(d.buffer,a,l),d.version=a.version}}return{get:s,remove:o,update:r}}var mF=`#ifdef USE_ALPHAHASH
- if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
- #endif`,_F=`#ifdef USE_ALPHAHASH
- const float ALPHA_HASH_SCALE = 0.05;
- float hash2D( vec2 value ) {
- return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
- }
- float hash3D( vec3 value ) {
- return hash2D( vec2( hash2D( value.xy ), value.z ) );
- }
- float getAlphaHashThreshold( vec3 position ) {
- float maxDeriv = max(
- length( dFdx( position.xyz ) ),
- length( dFdy( position.xyz ) )
- );
- float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
- vec2 pixScales = vec2(
- exp2( floor( log2( pixScale ) ) ),
- exp2( ceil( log2( pixScale ) ) )
- );
- vec2 alpha = vec2(
- hash3D( floor( pixScales.x * position.xyz ) ),
- hash3D( floor( pixScales.y * position.xyz ) )
- );
- float lerpFactor = fract( log2( pixScale ) );
- float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
- float a = min( lerpFactor, 1.0 - lerpFactor );
- vec3 cases = vec3(
- x * x / ( 2.0 * a * ( 1.0 - a ) ),
- ( x - 0.5 * a ) / ( 1.0 - a ),
- 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
- );
- float threshold = ( x < ( 1.0 - a ) )
- ? ( ( x < a ) ? cases.x : cases.y )
- : cases.z;
- return clamp( threshold , 1.0e-6, 1.0 );
- }
- #endif`,gF=`#ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
- #endif`,vF=`#ifdef USE_ALPHAMAP
- uniform sampler2D alphaMap;
- #endif`,bF=`#ifdef USE_ALPHATEST
- #ifdef ALPHA_TO_COVERAGE
- diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
- if ( diffuseColor.a == 0.0 ) discard;
- #else
- if ( diffuseColor.a < alphaTest ) discard;
- #endif
- #endif`,yF=`#ifdef USE_ALPHATEST
- uniform float alphaTest;
- #endif`,xF=`#ifdef USE_AOMAP
- float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
- reflectedLight.indirectDiffuse *= ambientOcclusion;
- #if defined( USE_CLEARCOAT )
- clearcoatSpecularIndirect *= ambientOcclusion;
- #endif
- #if defined( USE_SHEEN )
- sheenSpecularIndirect *= ambientOcclusion;
- #endif
- #if defined( USE_ENVMAP ) && defined( STANDARD )
- float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
- reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
- #endif
- #endif`,SF=`#ifdef USE_AOMAP
- uniform sampler2D aoMap;
- uniform float aoMapIntensity;
- #endif`,MF=`#ifdef USE_BATCHING
- #if ! defined( GL_ANGLE_multi_draw )
- #define gl_DrawID _gl_DrawID
- uniform int _gl_DrawID;
- #endif
- uniform highp sampler2D batchingTexture;
- uniform highp usampler2D batchingIdTexture;
- mat4 getBatchingMatrix( const in float i ) {
- int size = textureSize( batchingTexture, 0 ).x;
- int j = int( i ) * 4;
- int x = j % size;
- int y = j / size;
- vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
- vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
- vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
- vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
- return mat4( v1, v2, v3, v4 );
- }
- float getIndirectIndex( const in int i ) {
- int size = textureSize( batchingIdTexture, 0 ).x;
- int x = i % size;
- int y = i / size;
- return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
- }
- #endif
- #ifdef USE_BATCHING_COLOR
- uniform sampler2D batchingColorTexture;
- vec3 getBatchingColor( const in float i ) {
- int size = textureSize( batchingColorTexture, 0 ).x;
- int j = int( i );
- int x = j % size;
- int y = j / size;
- return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
- }
- #endif`,EF=`#ifdef USE_BATCHING
- mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
- #endif`,wF=`vec3 transformed = vec3( position );
- #ifdef USE_ALPHAHASH
- vPosition = vec3( position );
- #endif`,TF=`vec3 objectNormal = vec3( normal );
- #ifdef USE_TANGENT
- vec3 objectTangent = vec3( tangent.xyz );
- #endif`,CF=`float G_BlinnPhong_Implicit( ) {
- return 0.25;
- }
- float D_BlinnPhong( const in float shininess, const in float dotNH ) {
- return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
- }
- vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( specularColor, 1.0, dotVH );
- float G = G_BlinnPhong_Implicit( );
- float D = D_BlinnPhong( shininess, dotNH );
- return F * ( G * D );
- } // validated`,AF=`#ifdef USE_IRIDESCENCE
- const mat3 XYZ_TO_REC709 = mat3(
- 3.2404542, -0.9692660, 0.0556434,
- -1.5371385, 1.8760108, -0.2040259,
- -0.4985314, 0.0415560, 1.0572252
- );
- vec3 Fresnel0ToIor( vec3 fresnel0 ) {
- vec3 sqrtF0 = sqrt( fresnel0 );
- return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
- }
- vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
- return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
- }
- float IorToFresnel0( float transmittedIor, float incidentIor ) {
- return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
- }
- vec3 evalSensitivity( float OPD, vec3 shift ) {
- float phase = 2.0 * PI * OPD * 1.0e-9;
- vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
- vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
- vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
- vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
- xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
- xyz /= 1.0685e-7;
- vec3 rgb = XYZ_TO_REC709 * xyz;
- return rgb;
- }
- vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
- vec3 I;
- float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
- float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
- float cosTheta2Sq = 1.0 - sinTheta2Sq;
- if ( cosTheta2Sq < 0.0 ) {
- return vec3( 1.0 );
- }
- float cosTheta2 = sqrt( cosTheta2Sq );
- float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
- float R12 = F_Schlick( R0, 1.0, cosTheta1 );
- float T121 = 1.0 - R12;
- float phi12 = 0.0;
- if ( iridescenceIOR < outsideIOR ) phi12 = PI;
- float phi21 = PI - phi12;
- vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
- vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
- vec3 phi23 = vec3( 0.0 );
- if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
- if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
- if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
- float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
- vec3 phi = vec3( phi21 ) + phi23;
- vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
- vec3 r123 = sqrt( R123 );
- vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
- vec3 C0 = R12 + Rs;
- I = C0;
- vec3 Cm = Rs - T121;
- for ( int m = 1; m <= 2; ++ m ) {
- Cm *= r123;
- vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
- I += Cm * Sm;
- }
- return max( I, vec3( 0.0 ) );
- }
- #endif`,PF=`#ifdef USE_BUMPMAP
- uniform sampler2D bumpMap;
- uniform float bumpScale;
- vec2 dHdxy_fwd() {
- vec2 dSTdx = dFdx( vBumpMapUv );
- vec2 dSTdy = dFdy( vBumpMapUv );
- float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
- float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
- float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
- return vec2( dBx, dBy );
- }
- vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
- vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
- vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
- vec3 vN = surf_norm;
- vec3 R1 = cross( vSigmaY, vN );
- vec3 R2 = cross( vN, vSigmaX );
- float fDet = dot( vSigmaX, R1 ) * faceDirection;
- vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
- return normalize( abs( fDet ) * surf_norm - vGrad );
- }
- #endif`,RF=`#if NUM_CLIPPING_PLANES > 0
- vec4 plane;
- #ifdef ALPHA_TO_COVERAGE
- float distanceToPlane, distanceGradient;
- float clipOpacity = 1.0;
- #pragma unroll_loop_start
- for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
- distanceGradient = fwidth( distanceToPlane ) / 2.0;
- clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
- if ( clipOpacity == 0.0 ) discard;
- }
- #pragma unroll_loop_end
- #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
- float unionClipOpacity = 1.0;
- #pragma unroll_loop_start
- for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
- distanceGradient = fwidth( distanceToPlane ) / 2.0;
- unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
- }
- #pragma unroll_loop_end
- clipOpacity *= 1.0 - unionClipOpacity;
- #endif
- diffuseColor.a *= clipOpacity;
- if ( diffuseColor.a == 0.0 ) discard;
- #else
- #pragma unroll_loop_start
- for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
- }
- #pragma unroll_loop_end
- #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
- bool clipped = true;
- #pragma unroll_loop_start
- for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
- }
- #pragma unroll_loop_end
- if ( clipped ) discard;
- #endif
- #endif
- #endif`,DF=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
- #endif`,IF=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- #endif`,LF=`#if NUM_CLIPPING_PLANES > 0
- vClipPosition = - mvPosition.xyz;
- #endif`,UF=`#if defined( USE_COLOR_ALPHA )
- diffuseColor *= vColor;
- #elif defined( USE_COLOR )
- diffuseColor.rgb *= vColor;
- #endif`,FF=`#if defined( USE_COLOR_ALPHA )
- varying vec4 vColor;
- #elif defined( USE_COLOR )
- varying vec3 vColor;
- #endif`,OF=`#if defined( USE_COLOR_ALPHA )
- varying vec4 vColor;
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
- varying vec3 vColor;
- #endif`,NF=`#if defined( USE_COLOR_ALPHA )
- vColor = vec4( 1.0 );
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
- vColor = vec3( 1.0 );
- #endif
- #ifdef USE_COLOR
- vColor *= color;
- #endif
- #ifdef USE_INSTANCING_COLOR
- vColor.xyz *= instanceColor.xyz;
- #endif
- #ifdef USE_BATCHING_COLOR
- vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
- vColor.xyz *= batchingColor.xyz;
- #endif`,zF=`#define PI 3.141592653589793
- #define PI2 6.283185307179586
- #define PI_HALF 1.5707963267948966
- #define RECIPROCAL_PI 0.3183098861837907
- #define RECIPROCAL_PI2 0.15915494309189535
- #define EPSILON 1e-6
- #ifndef saturate
- #define saturate( a ) clamp( a, 0.0, 1.0 )
- #endif
- #define whiteComplement( a ) ( 1.0 - saturate( a ) )
- float pow2( const in float x ) { return x*x; }
- vec3 pow2( const in vec3 x ) { return x*x; }
- float pow3( const in float x ) { return x*x*x; }
- float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
- float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
- float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
- highp float rand( const in vec2 uv ) {
- const highp float a = 12.9898, b = 78.233, c = 43758.5453;
- highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
- return fract( sin( sn ) * c );
- }
- #ifdef HIGH_PRECISION
- float precisionSafeLength( vec3 v ) { return length( v ); }
- #else
- float precisionSafeLength( vec3 v ) {
- float maxComponent = max3( abs( v ) );
- return length( v / maxComponent ) * maxComponent;
- }
- #endif
- struct IncidentLight {
- vec3 color;
- vec3 direction;
- bool visible;
- };
- struct ReflectedLight {
- vec3 directDiffuse;
- vec3 directSpecular;
- vec3 indirectDiffuse;
- vec3 indirectSpecular;
- };
- #ifdef USE_ALPHAHASH
- varying vec3 vPosition;
- #endif
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- }
- vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
- }
- mat3 transposeMat3( const in mat3 m ) {
- mat3 tmp;
- tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
- tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
- tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
- return tmp;
- }
- bool isPerspectiveMatrix( mat4 m ) {
- return m[ 2 ][ 3 ] == - 1.0;
- }
- vec2 equirectUv( in vec3 dir ) {
- float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
- float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
- return vec2( u, v );
- }
- vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
- return RECIPROCAL_PI * diffuseColor;
- }
- vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
- }
- float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
- } // validated`,kF=`#ifdef ENVMAP_TYPE_CUBE_UV
- #define cubeUV_minMipLevel 4.0
- #define cubeUV_minTileSize 16.0
- float getFace( vec3 direction ) {
- vec3 absDirection = abs( direction );
- float face = - 1.0;
- if ( absDirection.x > absDirection.z ) {
- if ( absDirection.x > absDirection.y )
- face = direction.x > 0.0 ? 0.0 : 3.0;
- else
- face = direction.y > 0.0 ? 1.0 : 4.0;
- } else {
- if ( absDirection.z > absDirection.y )
- face = direction.z > 0.0 ? 2.0 : 5.0;
- else
- face = direction.y > 0.0 ? 1.0 : 4.0;
- }
- return face;
- }
- vec2 getUV( vec3 direction, float face ) {
- vec2 uv;
- if ( face == 0.0 ) {
- uv = vec2( direction.z, direction.y ) / abs( direction.x );
- } else if ( face == 1.0 ) {
- uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
- } else if ( face == 2.0 ) {
- uv = vec2( - direction.x, direction.y ) / abs( direction.z );
- } else if ( face == 3.0 ) {
- uv = vec2( - direction.z, direction.y ) / abs( direction.x );
- } else if ( face == 4.0 ) {
- uv = vec2( - direction.x, direction.z ) / abs( direction.y );
- } else {
- uv = vec2( direction.x, direction.y ) / abs( direction.z );
- }
- return 0.5 * ( uv + 1.0 );
- }
- vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
- float face = getFace( direction );
- float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
- mipInt = max( mipInt, cubeUV_minMipLevel );
- float faceSize = exp2( mipInt );
- highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
- if ( face > 2.0 ) {
- uv.y += faceSize;
- face -= 3.0;
- }
- uv.x += face * faceSize;
- uv.x += filterInt * 3.0 * cubeUV_minTileSize;
- uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
- uv.x *= CUBEUV_TEXEL_WIDTH;
- uv.y *= CUBEUV_TEXEL_HEIGHT;
- #ifdef texture2DGradEXT
- return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
- #else
- return texture2D( envMap, uv ).rgb;
- #endif
- }
- #define cubeUV_r0 1.0
- #define cubeUV_m0 - 2.0
- #define cubeUV_r1 0.8
- #define cubeUV_m1 - 1.0
- #define cubeUV_r4 0.4
- #define cubeUV_m4 2.0
- #define cubeUV_r5 0.305
- #define cubeUV_m5 3.0
- #define cubeUV_r6 0.21
- #define cubeUV_m6 4.0
- float roughnessToMip( float roughness ) {
- float mip = 0.0;
- if ( roughness >= cubeUV_r1 ) {
- mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
- } else if ( roughness >= cubeUV_r4 ) {
- mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
- } else if ( roughness >= cubeUV_r5 ) {
- mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
- } else if ( roughness >= cubeUV_r6 ) {
- mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
- } else {
- mip = - 2.0 * log2( 1.16 * roughness ); }
- return mip;
- }
- vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
- float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
- float mipF = fract( mip );
- float mipInt = floor( mip );
- vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
- if ( mipF == 0.0 ) {
- return vec4( color0, 1.0 );
- } else {
- vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
- return vec4( mix( color0, color1, mipF ), 1.0 );
- }
- }
- #endif`,BF=`vec3 transformedNormal = objectNormal;
- #ifdef USE_TANGENT
- vec3 transformedTangent = objectTangent;
- #endif
- #ifdef USE_BATCHING
- mat3 bm = mat3( batchingMatrix );
- transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
- transformedNormal = bm * transformedNormal;
- #ifdef USE_TANGENT
- transformedTangent = bm * transformedTangent;
- #endif
- #endif
- #ifdef USE_INSTANCING
- mat3 im = mat3( instanceMatrix );
- transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
- transformedNormal = im * transformedNormal;
- #ifdef USE_TANGENT
- transformedTangent = im * transformedTangent;
- #endif
- #endif
- transformedNormal = normalMatrix * transformedNormal;
- #ifdef FLIP_SIDED
- transformedNormal = - transformedNormal;
- #endif
- #ifdef USE_TANGENT
- transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
- #ifdef FLIP_SIDED
- transformedTangent = - transformedTangent;
- #endif
- #endif`,VF=`#ifdef USE_DISPLACEMENTMAP
- uniform sampler2D displacementMap;
- uniform float displacementScale;
- uniform float displacementBias;
- #endif`,HF=`#ifdef USE_DISPLACEMENTMAP
- transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
- #endif`,$F=`#ifdef USE_EMISSIVEMAP
- vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
- #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
- emissiveColor = sRGBTransferEOTF( emissiveColor );
- #endif
- totalEmissiveRadiance *= emissiveColor.rgb;
- #endif`,GF=`#ifdef USE_EMISSIVEMAP
- uniform sampler2D emissiveMap;
- #endif`,WF="gl_FragColor = linearToOutputTexel( gl_FragColor );",XF=`vec4 LinearTransferOETF( in vec4 value ) {
- return value;
- }
- vec4 sRGBTransferEOTF( in vec4 value ) {
- return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
- }
- vec4 sRGBTransferOETF( in vec4 value ) {
- return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
- }`,jF=`#ifdef USE_ENVMAP
- #ifdef ENV_WORLDPOS
- vec3 cameraToFrag;
- if ( isOrthographic ) {
- cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
- } else {
- cameraToFrag = normalize( vWorldPosition - cameraPosition );
- }
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- #ifdef ENVMAP_MODE_REFLECTION
- vec3 reflectVec = reflect( cameraToFrag, worldNormal );
- #else
- vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
- #endif
- #else
- vec3 reflectVec = vReflect;
- #endif
- #ifdef ENVMAP_TYPE_CUBE
- vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
- #else
- vec4 envColor = vec4( 0.0 );
- #endif
- #ifdef ENVMAP_BLENDING_MULTIPLY
- outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
- #elif defined( ENVMAP_BLENDING_MIX )
- outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
- #elif defined( ENVMAP_BLENDING_ADD )
- outgoingLight += envColor.xyz * specularStrength * reflectivity;
- #endif
- #endif`,YF=`#ifdef USE_ENVMAP
- uniform float envMapIntensity;
- uniform float flipEnvMap;
- uniform mat3 envMapRotation;
- #ifdef ENVMAP_TYPE_CUBE
- uniform samplerCube envMap;
- #else
- uniform sampler2D envMap;
- #endif
-
- #endif`,qF=`#ifdef USE_ENVMAP
- uniform float reflectivity;
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
- #define ENV_WORLDPOS
- #endif
- #ifdef ENV_WORLDPOS
- varying vec3 vWorldPosition;
- uniform float refractionRatio;
- #else
- varying vec3 vReflect;
- #endif
- #endif`,ZF=`#ifdef USE_ENVMAP
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
- #define ENV_WORLDPOS
- #endif
- #ifdef ENV_WORLDPOS
-
- varying vec3 vWorldPosition;
- #else
- varying vec3 vReflect;
- uniform float refractionRatio;
- #endif
- #endif`,KF=`#ifdef USE_ENVMAP
- #ifdef ENV_WORLDPOS
- vWorldPosition = worldPosition.xyz;
- #else
- vec3 cameraToVertex;
- if ( isOrthographic ) {
- cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
- } else {
- cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
- }
- vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
- #ifdef ENVMAP_MODE_REFLECTION
- vReflect = reflect( cameraToVertex, worldNormal );
- #else
- vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
- #endif
- #endif
- #endif`,JF=`#ifdef USE_FOG
- vFogDepth = - mvPosition.z;
- #endif`,QF=`#ifdef USE_FOG
- varying float vFogDepth;
- #endif`,eO=`#ifdef USE_FOG
- #ifdef FOG_EXP2
- float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
- #else
- float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
- #endif
- gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
- #endif`,tO=`#ifdef USE_FOG
- uniform vec3 fogColor;
- varying float vFogDepth;
- #ifdef FOG_EXP2
- uniform float fogDensity;
- #else
- uniform float fogNear;
- uniform float fogFar;
- #endif
- #endif`,nO=`#ifdef USE_GRADIENTMAP
- uniform sampler2D gradientMap;
- #endif
- vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
- float dotNL = dot( normal, lightDirection );
- vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
- #ifdef USE_GRADIENTMAP
- return vec3( texture2D( gradientMap, coord ).r );
- #else
- vec2 fw = fwidth( coord ) * 0.5;
- return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
- #endif
- }`,iO=`#ifdef USE_LIGHTMAP
- uniform sampler2D lightMap;
- uniform float lightMapIntensity;
- #endif`,sO=`LambertMaterial material;
- material.diffuseColor = diffuseColor.rgb;
- material.specularStrength = specularStrength;`,oO=`varying vec3 vViewPosition;
- struct LambertMaterial {
- vec3 diffuseColor;
- float specularStrength;
- };
- void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_Lambert
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,rO=`uniform bool receiveShadow;
- uniform vec3 ambientLightColor;
- #if defined( USE_LIGHT_PROBES )
- uniform vec3 lightProbe[ 9 ];
- #endif
- vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
- float x = normal.x, y = normal.y, z = normal.z;
- vec3 result = shCoefficients[ 0 ] * 0.886227;
- result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
- result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
- result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
- result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
- result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
- result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
- result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
- result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
- return result;
- }
- vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
- return irradiance;
- }
- vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
- vec3 irradiance = ambientLightColor;
- return irradiance;
- }
- float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
- float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
- if ( cutoffDistance > 0.0 ) {
- distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
- }
- return distanceFalloff;
- }
- float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
- return smoothstep( coneCosine, penumbraCosine, angleCosine );
- }
- #if NUM_DIR_LIGHTS > 0
- struct DirectionalLight {
- vec3 direction;
- vec3 color;
- };
- uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
- void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
- light.color = directionalLight.color;
- light.direction = directionalLight.direction;
- light.visible = true;
- }
- #endif
- #if NUM_POINT_LIGHTS > 0
- struct PointLight {
- vec3 position;
- vec3 color;
- float distance;
- float decay;
- };
- uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
- void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
- vec3 lVector = pointLight.position - geometryPosition;
- light.direction = normalize( lVector );
- float lightDistance = length( lVector );
- light.color = pointLight.color;
- light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
- light.visible = ( light.color != vec3( 0.0 ) );
- }
- #endif
- #if NUM_SPOT_LIGHTS > 0
- struct SpotLight {
- vec3 position;
- vec3 direction;
- vec3 color;
- float distance;
- float decay;
- float coneCos;
- float penumbraCos;
- };
- uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
- void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
- vec3 lVector = spotLight.position - geometryPosition;
- light.direction = normalize( lVector );
- float angleCos = dot( light.direction, spotLight.direction );
- float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
- if ( spotAttenuation > 0.0 ) {
- float lightDistance = length( lVector );
- light.color = spotLight.color * spotAttenuation;
- light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
- light.visible = ( light.color != vec3( 0.0 ) );
- } else {
- light.color = vec3( 0.0 );
- light.visible = false;
- }
- }
- #endif
- #if NUM_RECT_AREA_LIGHTS > 0
- struct RectAreaLight {
- vec3 color;
- vec3 position;
- vec3 halfWidth;
- vec3 halfHeight;
- };
- uniform sampler2D ltc_1; uniform sampler2D ltc_2;
- uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
- #endif
- #if NUM_HEMI_LIGHTS > 0
- struct HemisphereLight {
- vec3 direction;
- vec3 skyColor;
- vec3 groundColor;
- };
- uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
- vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
- float dotNL = dot( normal, hemiLight.direction );
- float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
- vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
- return irradiance;
- }
- #endif`,aO=`#ifdef USE_ENVMAP
- vec3 getIBLIrradiance( const in vec3 normal ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
- return PI * envMapColor.rgb * envMapIntensity;
- #else
- return vec3( 0.0 );
- #endif
- }
- vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 reflectVec = reflect( - viewDir, normal );
- reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
- reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
- return envMapColor.rgb * envMapIntensity;
- #else
- return vec3( 0.0 );
- #endif
- }
- #ifdef USE_ANISOTROPY
- vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 bentNormal = cross( bitangent, viewDir );
- bentNormal = normalize( cross( bentNormal, bitangent ) );
- bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
- return getIBLRadiance( viewDir, bentNormal, roughness );
- #else
- return vec3( 0.0 );
- #endif
- }
- #endif
- #endif`,lO=`ToonMaterial material;
- material.diffuseColor = diffuseColor.rgb;`,cO=`varying vec3 vViewPosition;
- struct ToonMaterial {
- vec3 diffuseColor;
- };
- void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
- vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_Toon
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,dO=`BlinnPhongMaterial material;
- material.diffuseColor = diffuseColor.rgb;
- material.specularColor = specular;
- material.specularShininess = shininess;
- material.specularStrength = specularStrength;`,uO=`varying vec3 vViewPosition;
- struct BlinnPhongMaterial {
- vec3 diffuseColor;
- vec3 specularColor;
- float specularShininess;
- float specularStrength;
- };
- void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
- }
- void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_BlinnPhong
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,hO=`PhysicalMaterial material;
- material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
- vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
- float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
- material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
- material.roughness = min( material.roughness, 1.0 );
- #ifdef IOR
- material.ior = ior;
- #ifdef USE_SPECULAR
- float specularIntensityFactor = specularIntensity;
- vec3 specularColorFactor = specularColor;
- #ifdef USE_SPECULAR_COLORMAP
- specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
- #endif
- material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
- #else
- float specularIntensityFactor = 1.0;
- vec3 specularColorFactor = vec3( 1.0 );
- material.specularF90 = 1.0;
- #endif
- material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
- #else
- material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
- material.specularF90 = 1.0;
- #endif
- #ifdef USE_CLEARCOAT
- material.clearcoat = clearcoat;
- material.clearcoatRoughness = clearcoatRoughness;
- material.clearcoatF0 = vec3( 0.04 );
- material.clearcoatF90 = 1.0;
- #ifdef USE_CLEARCOATMAP
- material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
- #endif
- material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
- material.clearcoatRoughness += geometryRoughness;
- material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
- #endif
- #ifdef USE_DISPERSION
- material.dispersion = dispersion;
- #endif
- #ifdef USE_IRIDESCENCE
- material.iridescence = iridescence;
- material.iridescenceIOR = iridescenceIOR;
- #ifdef USE_IRIDESCENCEMAP
- material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
- #else
- material.iridescenceThickness = iridescenceThicknessMaximum;
- #endif
- #endif
- #ifdef USE_SHEEN
- material.sheenColor = sheenColor;
- #ifdef USE_SHEEN_COLORMAP
- material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
- #endif
- material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
- #ifdef USE_SHEEN_ROUGHNESSMAP
- material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
- #endif
- #endif
- #ifdef USE_ANISOTROPY
- #ifdef USE_ANISOTROPYMAP
- mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
- vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
- vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
- #else
- vec2 anisotropyV = anisotropyVector;
- #endif
- material.anisotropy = length( anisotropyV );
- if( material.anisotropy == 0.0 ) {
- anisotropyV = vec2( 1.0, 0.0 );
- } else {
- anisotropyV /= material.anisotropy;
- material.anisotropy = saturate( material.anisotropy );
- }
- material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
- material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
- material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
- #endif`,fO=`struct PhysicalMaterial {
- vec3 diffuseColor;
- float roughness;
- vec3 specularColor;
- float specularF90;
- float dispersion;
- #ifdef USE_CLEARCOAT
- float clearcoat;
- float clearcoatRoughness;
- vec3 clearcoatF0;
- float clearcoatF90;
- #endif
- #ifdef USE_IRIDESCENCE
- float iridescence;
- float iridescenceIOR;
- float iridescenceThickness;
- vec3 iridescenceFresnel;
- vec3 iridescenceF0;
- #endif
- #ifdef USE_SHEEN
- vec3 sheenColor;
- float sheenRoughness;
- #endif
- #ifdef IOR
- float ior;
- #endif
- #ifdef USE_TRANSMISSION
- float transmission;
- float transmissionAlpha;
- float thickness;
- float attenuationDistance;
- vec3 attenuationColor;
- #endif
- #ifdef USE_ANISOTROPY
- float anisotropy;
- float alphaT;
- vec3 anisotropyT;
- vec3 anisotropyB;
- #endif
- };
- vec3 clearcoatSpecularDirect = vec3( 0.0 );
- vec3 clearcoatSpecularIndirect = vec3( 0.0 );
- vec3 sheenSpecularDirect = vec3( 0.0 );
- vec3 sheenSpecularIndirect = vec3(0.0 );
- vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
- float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
- float x2 = x * x;
- float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
- return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
- }
- float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
- float a2 = pow2( alpha );
- float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
- float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
- return 0.5 / max( gv + gl, EPSILON );
- }
- float D_GGX( const in float alpha, const in float dotNH ) {
- float a2 = pow2( alpha );
- float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
- return RECIPROCAL_PI * a2 / pow2( denom );
- }
- #ifdef USE_ANISOTROPY
- float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
- float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
- float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
- float v = 0.5 / ( gv + gl );
- return saturate(v);
- }
- float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
- float a2 = alphaT * alphaB;
- highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
- highp float v2 = dot( v, v );
- float w2 = a2 / v2;
- return RECIPROCAL_PI * a2 * pow2 ( w2 );
- }
- #endif
- #ifdef USE_CLEARCOAT
- vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
- vec3 f0 = material.clearcoatF0;
- float f90 = material.clearcoatF90;
- float roughness = material.clearcoatRoughness;
- float alpha = pow2( roughness );
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( f0, f90, dotVH );
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
- float D = D_GGX( alpha, dotNH );
- return F * ( V * D );
- }
- #endif
- vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
- vec3 f0 = material.specularColor;
- float f90 = material.specularF90;
- float roughness = material.roughness;
- float alpha = pow2( roughness );
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( f0, f90, dotVH );
- #ifdef USE_IRIDESCENCE
- F = mix( F, material.iridescenceFresnel, material.iridescence );
- #endif
- #ifdef USE_ANISOTROPY
- float dotTL = dot( material.anisotropyT, lightDir );
- float dotTV = dot( material.anisotropyT, viewDir );
- float dotTH = dot( material.anisotropyT, halfDir );
- float dotBL = dot( material.anisotropyB, lightDir );
- float dotBV = dot( material.anisotropyB, viewDir );
- float dotBH = dot( material.anisotropyB, halfDir );
- float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
- float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
- #else
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
- float D = D_GGX( alpha, dotNH );
- #endif
- return F * ( V * D );
- }
- vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
- const float LUT_SIZE = 64.0;
- const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
- const float LUT_BIAS = 0.5 / LUT_SIZE;
- float dotNV = saturate( dot( N, V ) );
- vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
- uv = uv * LUT_SCALE + LUT_BIAS;
- return uv;
- }
- float LTC_ClippedSphereFormFactor( const in vec3 f ) {
- float l = length( f );
- return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
- }
- vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
- float x = dot( v1, v2 );
- float y = abs( x );
- float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
- float b = 3.4175940 + ( 4.1616724 + y ) * y;
- float v = a / b;
- float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
- return cross( v1, v2 ) * theta_sintheta;
- }
- vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
- vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
- vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
- vec3 lightNormal = cross( v1, v2 );
- if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
- vec3 T1, T2;
- T1 = normalize( V - N * dot( V, N ) );
- T2 = - cross( N, T1 );
- mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
- vec3 coords[ 4 ];
- coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
- coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
- coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
- coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
- coords[ 0 ] = normalize( coords[ 0 ] );
- coords[ 1 ] = normalize( coords[ 1 ] );
- coords[ 2 ] = normalize( coords[ 2 ] );
- coords[ 3 ] = normalize( coords[ 3 ] );
- vec3 vectorFormFactor = vec3( 0.0 );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
- float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
- return vec3( result );
- }
- #if defined( USE_SHEEN )
- float D_Charlie( float roughness, float dotNH ) {
- float alpha = pow2( roughness );
- float invAlpha = 1.0 / alpha;
- float cos2h = dotNH * dotNH;
- float sin2h = max( 1.0 - cos2h, 0.0078125 );
- return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
- }
- float V_Neubelt( float dotNV, float dotNL ) {
- return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
- }
- vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float D = D_Charlie( sheenRoughness, dotNH );
- float V = V_Neubelt( dotNV, dotNL );
- return sheenColor * ( D * V );
- }
- #endif
- float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
- float dotNV = saturate( dot( normal, viewDir ) );
- float r2 = roughness * roughness;
- float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
- float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
- float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
- return saturate( DG * RECIPROCAL_PI );
- }
- vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
- float dotNV = saturate( dot( normal, viewDir ) );
- const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
- const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
- vec4 r = roughness * c0 + c1;
- float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
- vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
- return fab;
- }
- vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
- vec2 fab = DFGApprox( normal, viewDir, roughness );
- return specularColor * fab.x + specularF90 * fab.y;
- }
- #ifdef USE_IRIDESCENCE
- void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
- #else
- void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
- #endif
- vec2 fab = DFGApprox( normal, viewDir, roughness );
- #ifdef USE_IRIDESCENCE
- vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
- #else
- vec3 Fr = specularColor;
- #endif
- vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
- float Ess = fab.x + fab.y;
- float Ems = 1.0 - Ess;
- vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
- singleScatter += FssEss;
- multiScatter += Fms * Ems;
- }
- #if NUM_RECT_AREA_LIGHTS > 0
- void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
- vec3 normal = geometryNormal;
- vec3 viewDir = geometryViewDir;
- vec3 position = geometryPosition;
- vec3 lightPos = rectAreaLight.position;
- vec3 halfWidth = rectAreaLight.halfWidth;
- vec3 halfHeight = rectAreaLight.halfHeight;
- vec3 lightColor = rectAreaLight.color;
- float roughness = material.roughness;
- vec3 rectCoords[ 4 ];
- rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
- rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
- rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
- vec2 uv = LTC_Uv( normal, viewDir, roughness );
- vec4 t1 = texture2D( ltc_1, uv );
- vec4 t2 = texture2D( ltc_2, uv );
- mat3 mInv = mat3(
- vec3( t1.x, 0, t1.y ),
- vec3( 0, 1, 0 ),
- vec3( t1.z, 0, t1.w )
- );
- vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
- reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
- reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
- }
- #endif
- void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- #ifdef USE_CLEARCOAT
- float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
- vec3 ccIrradiance = dotNLcc * directLight.color;
- clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
- #endif
- #ifdef USE_SHEEN
- sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
- #endif
- reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
- #ifdef USE_CLEARCOAT
- clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
- #endif
- #ifdef USE_SHEEN
- sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
- #endif
- vec3 singleScattering = vec3( 0.0 );
- vec3 multiScattering = vec3( 0.0 );
- vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
- #ifdef USE_IRIDESCENCE
- computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
- #else
- computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
- #endif
- vec3 totalScattering = singleScattering + multiScattering;
- vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
- reflectedLight.indirectSpecular += radiance * singleScattering;
- reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
- reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
- }
- #define RE_Direct RE_Direct_Physical
- #define RE_Direct_RectArea RE_Direct_RectArea_Physical
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
- #define RE_IndirectSpecular RE_IndirectSpecular_Physical
- float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
- return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
- }`,pO=`
- vec3 geometryPosition = - vViewPosition;
- vec3 geometryNormal = normal;
- vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
- vec3 geometryClearcoatNormal = vec3( 0.0 );
- #ifdef USE_CLEARCOAT
- geometryClearcoatNormal = clearcoatNormal;
- #endif
- #ifdef USE_IRIDESCENCE
- float dotNVi = saturate( dot( normal, geometryViewDir ) );
- if ( material.iridescenceThickness == 0.0 ) {
- material.iridescence = 0.0;
- } else {
- material.iridescence = saturate( material.iridescence );
- }
- if ( material.iridescence > 0.0 ) {
- material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
- material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
- }
- #endif
- IncidentLight directLight;
- #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
- PointLight pointLight;
- #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
- PointLightShadow pointLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
- pointLight = pointLights[ i ];
- getPointLightInfo( pointLight, geometryPosition, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
- pointLightShadow = pointLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
- SpotLight spotLight;
- vec4 spotColor;
- vec3 spotLightCoord;
- bool inSpotLightMap;
- #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
- SpotLightShadow spotLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
- spotLight = spotLights[ i ];
- getSpotLightInfo( spotLight, geometryPosition, directLight );
- #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
- #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
- #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
- #else
- #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
- #endif
- #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
- spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
- inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
- spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
- directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
- #endif
- #undef SPOT_LIGHT_MAP_INDEX
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- spotLightShadow = spotLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
- DirectionalLight directionalLight;
- #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
- DirectionalLightShadow directionalLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
- directionalLight = directionalLights[ i ];
- getDirectionalLightInfo( directionalLight, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
- directionalLightShadow = directionalLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
- RectAreaLight rectAreaLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
- rectAreaLight = rectAreaLights[ i ];
- RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if defined( RE_IndirectDiffuse )
- vec3 iblIrradiance = vec3( 0.0 );
- vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
- #if defined( USE_LIGHT_PROBES )
- irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
- #endif
- #if ( NUM_HEMI_LIGHTS > 0 )
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
- irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
- }
- #pragma unroll_loop_end
- #endif
- #endif
- #if defined( RE_IndirectSpecular )
- vec3 radiance = vec3( 0.0 );
- vec3 clearcoatRadiance = vec3( 0.0 );
- #endif`,mO=`#if defined( RE_IndirectDiffuse )
- #ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
- vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
- irradiance += lightMapIrradiance;
- #endif
- #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
- iblIrradiance += getIBLIrradiance( geometryNormal );
- #endif
- #endif
- #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
- #ifdef USE_ANISOTROPY
- radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
- #else
- radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
- #endif
- #ifdef USE_CLEARCOAT
- clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
- #endif
- #endif`,_O=`#if defined( RE_IndirectDiffuse )
- RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- #endif
- #if defined( RE_IndirectSpecular )
- RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- #endif`,gO=`#if defined( USE_LOGDEPTHBUF )
- gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
- #endif`,vO=`#if defined( USE_LOGDEPTHBUF )
- uniform float logDepthBufFC;
- varying float vFragDepth;
- varying float vIsPerspective;
- #endif`,bO=`#ifdef USE_LOGDEPTHBUF
- varying float vFragDepth;
- varying float vIsPerspective;
- #endif`,yO=`#ifdef USE_LOGDEPTHBUF
- vFragDepth = 1.0 + gl_Position.w;
- vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
- #endif`,xO=`#ifdef USE_MAP
- vec4 sampledDiffuseColor = texture2D( map, vMapUv );
- #ifdef DECODE_VIDEO_TEXTURE
- sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
- #endif
- diffuseColor *= sampledDiffuseColor;
- #endif`,SO=`#ifdef USE_MAP
- uniform sampler2D map;
- #endif`,MO=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
- #if defined( USE_POINTS_UV )
- vec2 uv = vUv;
- #else
- vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
- #endif
- #endif
- #ifdef USE_MAP
- diffuseColor *= texture2D( map, uv );
- #endif
- #ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, uv ).g;
- #endif`,EO=`#if defined( USE_POINTS_UV )
- varying vec2 vUv;
- #else
- #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
- uniform mat3 uvTransform;
- #endif
- #endif
- #ifdef USE_MAP
- uniform sampler2D map;
- #endif
- #ifdef USE_ALPHAMAP
- uniform sampler2D alphaMap;
- #endif`,wO=`float metalnessFactor = metalness;
- #ifdef USE_METALNESSMAP
- vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
- metalnessFactor *= texelMetalness.b;
- #endif`,TO=`#ifdef USE_METALNESSMAP
- uniform sampler2D metalnessMap;
- #endif`,CO=`#ifdef USE_INSTANCING_MORPH
- float morphTargetInfluences[ MORPHTARGETS_COUNT ];
- float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
- }
- #endif`,AO=`#if defined( USE_MORPHCOLORS )
- vColor *= morphTargetBaseInfluence;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- #if defined( USE_COLOR_ALPHA )
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
- #elif defined( USE_COLOR )
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
- #endif
- }
- #endif`,PO=`#ifdef USE_MORPHNORMALS
- objectNormal *= morphTargetBaseInfluence;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
- }
- #endif`,RO=`#ifdef USE_MORPHTARGETS
- #ifndef USE_INSTANCING_MORPH
- uniform float morphTargetBaseInfluence;
- uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
- #endif
- uniform sampler2DArray morphTargetsTexture;
- uniform ivec2 morphTargetsTextureSize;
- vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
- int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
- int y = texelIndex / morphTargetsTextureSize.x;
- int x = texelIndex - y * morphTargetsTextureSize.x;
- ivec3 morphUV = ivec3( x, y, morphTargetIndex );
- return texelFetch( morphTargetsTexture, morphUV, 0 );
- }
- #endif`,DO=`#ifdef USE_MORPHTARGETS
- transformed *= morphTargetBaseInfluence;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
- }
- #endif`,IO=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
- #ifdef FLAT_SHADED
- vec3 fdx = dFdx( vViewPosition );
- vec3 fdy = dFdy( vViewPosition );
- vec3 normal = normalize( cross( fdx, fdy ) );
- #else
- vec3 normal = normalize( vNormal );
- #ifdef DOUBLE_SIDED
- normal *= faceDirection;
- #endif
- #endif
- #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
- #ifdef USE_TANGENT
- mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
- #else
- mat3 tbn = getTangentFrame( - vViewPosition, normal,
- #if defined( USE_NORMALMAP )
- vNormalMapUv
- #elif defined( USE_CLEARCOAT_NORMALMAP )
- vClearcoatNormalMapUv
- #else
- vUv
- #endif
- );
- #endif
- #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
- tbn[0] *= faceDirection;
- tbn[1] *= faceDirection;
- #endif
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- #ifdef USE_TANGENT
- mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
- #else
- mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
- #endif
- #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
- tbn2[0] *= faceDirection;
- tbn2[1] *= faceDirection;
- #endif
- #endif
- vec3 nonPerturbedNormal = normal;`,LO=`#ifdef USE_NORMALMAP_OBJECTSPACE
- normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
- #ifdef FLIP_SIDED
- normal = - normal;
- #endif
- #ifdef DOUBLE_SIDED
- normal = normal * faceDirection;
- #endif
- normal = normalize( normalMatrix * normal );
- #elif defined( USE_NORMALMAP_TANGENTSPACE )
- vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
- mapN.xy *= normalScale;
- normal = normalize( tbn * mapN );
- #elif defined( USE_BUMPMAP )
- normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
- #endif`,UO=`#ifndef FLAT_SHADED
- varying vec3 vNormal;
- #ifdef USE_TANGENT
- varying vec3 vTangent;
- varying vec3 vBitangent;
- #endif
- #endif`,FO=`#ifndef FLAT_SHADED
- varying vec3 vNormal;
- #ifdef USE_TANGENT
- varying vec3 vTangent;
- varying vec3 vBitangent;
- #endif
- #endif`,OO=`#ifndef FLAT_SHADED
- vNormal = normalize( transformedNormal );
- #ifdef USE_TANGENT
- vTangent = normalize( transformedTangent );
- vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
- #endif
- #endif`,NO=`#ifdef USE_NORMALMAP
- uniform sampler2D normalMap;
- uniform vec2 normalScale;
- #endif
- #ifdef USE_NORMALMAP_OBJECTSPACE
- uniform mat3 normalMatrix;
- #endif
- #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
- mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
- vec3 q0 = dFdx( eye_pos.xyz );
- vec3 q1 = dFdy( eye_pos.xyz );
- vec2 st0 = dFdx( uv.st );
- vec2 st1 = dFdy( uv.st );
- vec3 N = surf_norm;
- vec3 q1perp = cross( q1, N );
- vec3 q0perp = cross( N, q0 );
- vec3 T = q1perp * st0.x + q0perp * st1.x;
- vec3 B = q1perp * st0.y + q0perp * st1.y;
- float det = max( dot( T, T ), dot( B, B ) );
- float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
- return mat3( T * scale, B * scale, N );
- }
- #endif`,zO=`#ifdef USE_CLEARCOAT
- vec3 clearcoatNormal = nonPerturbedNormal;
- #endif`,kO=`#ifdef USE_CLEARCOAT_NORMALMAP
- vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
- clearcoatMapN.xy *= clearcoatNormalScale;
- clearcoatNormal = normalize( tbn2 * clearcoatMapN );
- #endif`,BO=`#ifdef USE_CLEARCOATMAP
- uniform sampler2D clearcoatMap;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- uniform sampler2D clearcoatNormalMap;
- uniform vec2 clearcoatNormalScale;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- uniform sampler2D clearcoatRoughnessMap;
- #endif`,VO=`#ifdef USE_IRIDESCENCEMAP
- uniform sampler2D iridescenceMap;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- uniform sampler2D iridescenceThicknessMap;
- #endif`,HO=`#ifdef OPAQUE
- diffuseColor.a = 1.0;
- #endif
- #ifdef USE_TRANSMISSION
- diffuseColor.a *= material.transmissionAlpha;
- #endif
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,$O=`vec3 packNormalToRGB( const in vec3 normal ) {
- return normalize( normal ) * 0.5 + 0.5;
- }
- vec3 unpackRGBToNormal( const in vec3 rgb ) {
- return 2.0 * rgb.xyz - 1.0;
- }
- const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
- const float Inv255 = 1. / 255.;
- const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
- const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
- const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
- const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
- vec4 packDepthToRGBA( const in float v ) {
- if( v <= 0.0 )
- return vec4( 0., 0., 0., 0. );
- if( v >= 1.0 )
- return vec4( 1., 1., 1., 1. );
- float vuf;
- float af = modf( v * PackFactors.a, vuf );
- float bf = modf( vuf * ShiftRight8, vuf );
- float gf = modf( vuf * ShiftRight8, vuf );
- return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
- }
- vec3 packDepthToRGB( const in float v ) {
- if( v <= 0.0 )
- return vec3( 0., 0., 0. );
- if( v >= 1.0 )
- return vec3( 1., 1., 1. );
- float vuf;
- float bf = modf( v * PackFactors.b, vuf );
- float gf = modf( vuf * ShiftRight8, vuf );
- return vec3( vuf * Inv255, gf * PackUpscale, bf );
- }
- vec2 packDepthToRG( const in float v ) {
- if( v <= 0.0 )
- return vec2( 0., 0. );
- if( v >= 1.0 )
- return vec2( 1., 1. );
- float vuf;
- float gf = modf( v * 256., vuf );
- return vec2( vuf * Inv255, gf );
- }
- float unpackRGBAToDepth( const in vec4 v ) {
- return dot( v, UnpackFactors4 );
- }
- float unpackRGBToDepth( const in vec3 v ) {
- return dot( v, UnpackFactors3 );
- }
- float unpackRGToDepth( const in vec2 v ) {
- return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
- }
- vec4 pack2HalfToRGBA( const in vec2 v ) {
- vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
- return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
- }
- vec2 unpackRGBATo2Half( const in vec4 v ) {
- return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
- }
- float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
- return ( viewZ + near ) / ( near - far );
- }
- float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
- return depth * ( near - far ) - near;
- }
- float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
- return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
- }
- float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
- return ( near * far ) / ( ( far - near ) * depth - far );
- }`,GO=`#ifdef PREMULTIPLIED_ALPHA
- gl_FragColor.rgb *= gl_FragColor.a;
- #endif`,WO=`vec4 mvPosition = vec4( transformed, 1.0 );
- #ifdef USE_BATCHING
- mvPosition = batchingMatrix * mvPosition;
- #endif
- #ifdef USE_INSTANCING
- mvPosition = instanceMatrix * mvPosition;
- #endif
- mvPosition = modelViewMatrix * mvPosition;
- gl_Position = projectionMatrix * mvPosition;`,XO=`#ifdef DITHERING
- gl_FragColor.rgb = dithering( gl_FragColor.rgb );
- #endif`,jO=`#ifdef DITHERING
- vec3 dithering( vec3 color ) {
- float grid_position = rand( gl_FragCoord.xy );
- vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
- dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
- return color + dither_shift_RGB;
- }
- #endif`,YO=`float roughnessFactor = roughness;
- #ifdef USE_ROUGHNESSMAP
- vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
- roughnessFactor *= texelRoughness.g;
- #endif`,qO=`#ifdef USE_ROUGHNESSMAP
- uniform sampler2D roughnessMap;
- #endif`,ZO=`#if NUM_SPOT_LIGHT_COORDS > 0
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
- #endif
- #if NUM_SPOT_LIGHT_MAPS > 0
- uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
- #endif
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
- struct DirectionalLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
- struct SpotLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
- struct PointLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- float shadowCameraNear;
- float shadowCameraFar;
- };
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
- #endif
- float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
- return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
- }
- vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
- return unpackRGBATo2Half( texture2D( shadow, uv ) );
- }
- float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
- float occlusion = 1.0;
- vec2 distribution = texture2DDistribution( shadow, uv );
- float hard_shadow = step( compare , distribution.x );
- if (hard_shadow != 1.0 ) {
- float distance = compare - distribution.x ;
- float variance = max( 0.00000, distribution.y * distribution.y );
- float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
- }
- return occlusion;
- }
- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
- float shadow = 1.0;
- shadowCoord.xyz /= shadowCoord.w;
- shadowCoord.z += shadowBias;
- bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
- bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
- if ( frustumTest ) {
- #if defined( SHADOWMAP_TYPE_PCF )
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
- float dx0 = - texelSize.x * shadowRadius;
- float dy0 = - texelSize.y * shadowRadius;
- float dx1 = + texelSize.x * shadowRadius;
- float dy1 = + texelSize.y * shadowRadius;
- float dx2 = dx0 / 2.0;
- float dy2 = dy0 / 2.0;
- float dx3 = dx1 / 2.0;
- float dy3 = dy1 / 2.0;
- shadow = (
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
- ) * ( 1.0 / 17.0 );
- #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
- float dx = texelSize.x;
- float dy = texelSize.y;
- vec2 uv = shadowCoord.xy;
- vec2 f = fract( uv * shadowMapSize + 0.5 );
- uv -= f * texelSize;
- shadow = (
- texture2DCompare( shadowMap, uv, shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
- f.x ) +
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
- f.x ) +
- mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
- f.y ) +
- mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
- f.y ) +
- mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
- f.x ),
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
- f.x ),
- f.y )
- ) * ( 1.0 / 9.0 );
- #elif defined( SHADOWMAP_TYPE_VSM )
- shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
- #else
- shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
- #endif
- }
- return mix( 1.0, shadow, shadowIntensity );
- }
- vec2 cubeToUV( vec3 v, float texelSizeY ) {
- vec3 absV = abs( v );
- float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
- absV *= scaleToCube;
- v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
- vec2 planar = v.xy;
- float almostATexel = 1.5 * texelSizeY;
- float almostOne = 1.0 - almostATexel;
- if ( absV.z >= almostOne ) {
- if ( v.z > 0.0 )
- planar.x = 4.0 - v.x;
- } else if ( absV.x >= almostOne ) {
- float signX = sign( v.x );
- planar.x = v.z * signX + 2.0 * signX;
- } else if ( absV.y >= almostOne ) {
- float signY = sign( v.y );
- planar.x = v.x + 2.0 * signY + 2.0;
- planar.y = v.z * signY - 2.0;
- }
- return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
- }
- float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
- float shadow = 1.0;
- vec3 lightToPosition = shadowCoord.xyz;
-
- float lightToPositionLength = length( lightToPosition );
- if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
- float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
- vec3 bd3D = normalize( lightToPosition );
- vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
- #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
- vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
- shadow = (
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
- ) * ( 1.0 / 9.0 );
- #else
- shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
- #endif
- }
- return mix( 1.0, shadow, shadowIntensity );
- }
- #endif`,KO=`#if NUM_SPOT_LIGHT_COORDS > 0
- uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
- #endif
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
- struct DirectionalLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- struct SpotLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
- struct PointLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- float shadowCameraNear;
- float shadowCameraFar;
- };
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
- #endif
- #endif`,JO=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
- vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
- vec4 shadowWorldPosition;
- #endif
- #if defined( USE_SHADOWMAP )
- #if NUM_DIR_LIGHT_SHADOWS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
- vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
- vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #endif
- #if NUM_SPOT_LIGHT_COORDS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
- shadowWorldPosition = worldPosition;
- #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
- #endif
- vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif`,QO=`float getShadowMask() {
- float shadow = 1.0;
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- DirectionalLightShadow directionalLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
- directionalLight = directionalLightShadows[ i ];
- shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- SpotLightShadow spotLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
- spotLight = spotLightShadows[ i ];
- shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- PointLightShadow pointLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
- pointLight = pointLightShadows[ i ];
- shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #endif
- return shadow;
- }`,eN=`#ifdef USE_SKINNING
- mat4 boneMatX = getBoneMatrix( skinIndex.x );
- mat4 boneMatY = getBoneMatrix( skinIndex.y );
- mat4 boneMatZ = getBoneMatrix( skinIndex.z );
- mat4 boneMatW = getBoneMatrix( skinIndex.w );
- #endif`,tN=`#ifdef USE_SKINNING
- uniform mat4 bindMatrix;
- uniform mat4 bindMatrixInverse;
- uniform highp sampler2D boneTexture;
- mat4 getBoneMatrix( const in float i ) {
- int size = textureSize( boneTexture, 0 ).x;
- int j = int( i ) * 4;
- int x = j % size;
- int y = j / size;
- vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
- vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
- vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
- vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
- return mat4( v1, v2, v3, v4 );
- }
- #endif`,nN=`#ifdef USE_SKINNING
- vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
- vec4 skinned = vec4( 0.0 );
- skinned += boneMatX * skinVertex * skinWeight.x;
- skinned += boneMatY * skinVertex * skinWeight.y;
- skinned += boneMatZ * skinVertex * skinWeight.z;
- skinned += boneMatW * skinVertex * skinWeight.w;
- transformed = ( bindMatrixInverse * skinned ).xyz;
- #endif`,iN=`#ifdef USE_SKINNING
- mat4 skinMatrix = mat4( 0.0 );
- skinMatrix += skinWeight.x * boneMatX;
- skinMatrix += skinWeight.y * boneMatY;
- skinMatrix += skinWeight.z * boneMatZ;
- skinMatrix += skinWeight.w * boneMatW;
- skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
- objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
- #ifdef USE_TANGENT
- objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
- #endif
- #endif`,sN=`float specularStrength;
- #ifdef USE_SPECULARMAP
- vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
- specularStrength = texelSpecular.r;
- #else
- specularStrength = 1.0;
- #endif`,oN=`#ifdef USE_SPECULARMAP
- uniform sampler2D specularMap;
- #endif`,rN=`#if defined( TONE_MAPPING )
- gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
- #endif`,aN=`#ifndef saturate
- #define saturate( a ) clamp( a, 0.0, 1.0 )
- #endif
- uniform float toneMappingExposure;
- vec3 LinearToneMapping( vec3 color ) {
- return saturate( toneMappingExposure * color );
- }
- vec3 ReinhardToneMapping( vec3 color ) {
- color *= toneMappingExposure;
- return saturate( color / ( vec3( 1.0 ) + color ) );
- }
- vec3 CineonToneMapping( vec3 color ) {
- color *= toneMappingExposure;
- color = max( vec3( 0.0 ), color - 0.004 );
- return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
- }
- vec3 RRTAndODTFit( vec3 v ) {
- vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
- vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
- return a / b;
- }
- vec3 ACESFilmicToneMapping( vec3 color ) {
- const mat3 ACESInputMat = mat3(
- vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
- vec3( 0.04823, 0.01566, 0.83777 )
- );
- const mat3 ACESOutputMat = mat3(
- vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
- vec3( -0.07367, -0.00605, 1.07602 )
- );
- color *= toneMappingExposure / 0.6;
- color = ACESInputMat * color;
- color = RRTAndODTFit( color );
- color = ACESOutputMat * color;
- return saturate( color );
- }
- const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
- vec3( 1.6605, - 0.1246, - 0.0182 ),
- vec3( - 0.5876, 1.1329, - 0.1006 ),
- vec3( - 0.0728, - 0.0083, 1.1187 )
- );
- const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
- vec3( 0.6274, 0.0691, 0.0164 ),
- vec3( 0.3293, 0.9195, 0.0880 ),
- vec3( 0.0433, 0.0113, 0.8956 )
- );
- vec3 agxDefaultContrastApprox( vec3 x ) {
- vec3 x2 = x * x;
- vec3 x4 = x2 * x2;
- return + 15.5 * x4 * x2
- - 40.14 * x4 * x
- + 31.96 * x4
- - 6.868 * x2 * x
- + 0.4298 * x2
- + 0.1191 * x
- - 0.00232;
- }
- vec3 AgXToneMapping( vec3 color ) {
- const mat3 AgXInsetMatrix = mat3(
- vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
- vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
- vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
- );
- const mat3 AgXOutsetMatrix = mat3(
- vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
- vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
- vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
- );
- const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
- color *= toneMappingExposure;
- color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
- color = AgXInsetMatrix * color;
- color = max( color, 1e-10 ); color = log2( color );
- color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
- color = clamp( color, 0.0, 1.0 );
- color = agxDefaultContrastApprox( color );
- color = AgXOutsetMatrix * color;
- color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
- color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
- color = clamp( color, 0.0, 1.0 );
- return color;
- }
- vec3 NeutralToneMapping( vec3 color ) {
- const float StartCompression = 0.8 - 0.04;
- const float Desaturation = 0.15;
- color *= toneMappingExposure;
- float x = min( color.r, min( color.g, color.b ) );
- float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
- color -= offset;
- float peak = max( color.r, max( color.g, color.b ) );
- if ( peak < StartCompression ) return color;
- float d = 1. - StartCompression;
- float newPeak = 1. - d * d / ( peak + d - StartCompression );
- color *= newPeak / peak;
- float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
- return mix( color, vec3( newPeak ), g );
- }
- vec3 CustomToneMapping( vec3 color ) { return color; }`,lN=`#ifdef USE_TRANSMISSION
- material.transmission = transmission;
- material.transmissionAlpha = 1.0;
- material.thickness = thickness;
- material.attenuationDistance = attenuationDistance;
- material.attenuationColor = attenuationColor;
- #ifdef USE_TRANSMISSIONMAP
- material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
- #endif
- #ifdef USE_THICKNESSMAP
- material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
- #endif
- vec3 pos = vWorldPosition;
- vec3 v = normalize( cameraPosition - pos );
- vec3 n = inverseTransformDirection( normal, viewMatrix );
- vec4 transmitted = getIBLVolumeRefraction(
- n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
- pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
- material.attenuationColor, material.attenuationDistance );
- material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
- totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
- #endif`,cN=`#ifdef USE_TRANSMISSION
- uniform float transmission;
- uniform float thickness;
- uniform float attenuationDistance;
- uniform vec3 attenuationColor;
- #ifdef USE_TRANSMISSIONMAP
- uniform sampler2D transmissionMap;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform sampler2D thicknessMap;
- #endif
- uniform vec2 transmissionSamplerSize;
- uniform sampler2D transmissionSamplerMap;
- uniform mat4 modelMatrix;
- uniform mat4 projectionMatrix;
- varying vec3 vWorldPosition;
- float w0( float a ) {
- return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
- }
- float w1( float a ) {
- return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
- }
- float w2( float a ){
- return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
- }
- float w3( float a ) {
- return ( 1.0 / 6.0 ) * ( a * a * a );
- }
- float g0( float a ) {
- return w0( a ) + w1( a );
- }
- float g1( float a ) {
- return w2( a ) + w3( a );
- }
- float h0( float a ) {
- return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
- }
- float h1( float a ) {
- return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
- }
- vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
- uv = uv * texelSize.zw + 0.5;
- vec2 iuv = floor( uv );
- vec2 fuv = fract( uv );
- float g0x = g0( fuv.x );
- float g1x = g1( fuv.x );
- float h0x = h0( fuv.x );
- float h1x = h1( fuv.x );
- float h0y = h0( fuv.y );
- float h1y = h1( fuv.y );
- vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
- vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
- vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
- vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
- return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
- g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
- }
- vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
- vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
- vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
- vec2 fLodSizeInv = 1.0 / fLodSize;
- vec2 cLodSizeInv = 1.0 / cLodSize;
- vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
- vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
- return mix( fSample, cSample, fract( lod ) );
- }
- vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
- vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
- vec3 modelScale;
- modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
- modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
- modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
- return normalize( refractionVector ) * thickness * modelScale;
- }
- float applyIorToRoughness( const in float roughness, const in float ior ) {
- return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
- }
- vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
- float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
- return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
- }
- vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
- if ( isinf( attenuationDistance ) ) {
- return vec3( 1.0 );
- } else {
- vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
- vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
- }
- }
- vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
- const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
- const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
- const in vec3 attenuationColor, const in float attenuationDistance ) {
- vec4 transmittedLight;
- vec3 transmittance;
- #ifdef USE_DISPERSION
- float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
- vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
- for ( int i = 0; i < 3; i ++ ) {
- vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
- vec3 refractedRayExit = position + transmissionRay;
- vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
- vec2 refractionCoords = ndcPos.xy / ndcPos.w;
- refractionCoords += 1.0;
- refractionCoords /= 2.0;
- vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
- transmittedLight[ i ] = transmissionSample[ i ];
- transmittedLight.a += transmissionSample.a;
- transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
- }
- transmittedLight.a /= 3.0;
- #else
- vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
- vec3 refractedRayExit = position + transmissionRay;
- vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
- vec2 refractionCoords = ndcPos.xy / ndcPos.w;
- refractionCoords += 1.0;
- refractionCoords /= 2.0;
- transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
- transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
- #endif
- vec3 attenuatedColor = transmittance * transmittedLight.rgb;
- vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
- float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
- return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
- }
- #endif`,dN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- varying vec2 vUv;
- #endif
- #ifdef USE_MAP
- varying vec2 vMapUv;
- #endif
- #ifdef USE_ALPHAMAP
- varying vec2 vAlphaMapUv;
- #endif
- #ifdef USE_LIGHTMAP
- varying vec2 vLightMapUv;
- #endif
- #ifdef USE_AOMAP
- varying vec2 vAoMapUv;
- #endif
- #ifdef USE_BUMPMAP
- varying vec2 vBumpMapUv;
- #endif
- #ifdef USE_NORMALMAP
- varying vec2 vNormalMapUv;
- #endif
- #ifdef USE_EMISSIVEMAP
- varying vec2 vEmissiveMapUv;
- #endif
- #ifdef USE_METALNESSMAP
- varying vec2 vMetalnessMapUv;
- #endif
- #ifdef USE_ROUGHNESSMAP
- varying vec2 vRoughnessMapUv;
- #endif
- #ifdef USE_ANISOTROPYMAP
- varying vec2 vAnisotropyMapUv;
- #endif
- #ifdef USE_CLEARCOATMAP
- varying vec2 vClearcoatMapUv;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- varying vec2 vClearcoatNormalMapUv;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- varying vec2 vClearcoatRoughnessMapUv;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- varying vec2 vIridescenceMapUv;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- varying vec2 vIridescenceThicknessMapUv;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- varying vec2 vSheenColorMapUv;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- varying vec2 vSheenRoughnessMapUv;
- #endif
- #ifdef USE_SPECULARMAP
- varying vec2 vSpecularMapUv;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- varying vec2 vSpecularColorMapUv;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- varying vec2 vSpecularIntensityMapUv;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- uniform mat3 transmissionMapTransform;
- varying vec2 vTransmissionMapUv;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform mat3 thicknessMapTransform;
- varying vec2 vThicknessMapUv;
- #endif`,uN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- varying vec2 vUv;
- #endif
- #ifdef USE_MAP
- uniform mat3 mapTransform;
- varying vec2 vMapUv;
- #endif
- #ifdef USE_ALPHAMAP
- uniform mat3 alphaMapTransform;
- varying vec2 vAlphaMapUv;
- #endif
- #ifdef USE_LIGHTMAP
- uniform mat3 lightMapTransform;
- varying vec2 vLightMapUv;
- #endif
- #ifdef USE_AOMAP
- uniform mat3 aoMapTransform;
- varying vec2 vAoMapUv;
- #endif
- #ifdef USE_BUMPMAP
- uniform mat3 bumpMapTransform;
- varying vec2 vBumpMapUv;
- #endif
- #ifdef USE_NORMALMAP
- uniform mat3 normalMapTransform;
- varying vec2 vNormalMapUv;
- #endif
- #ifdef USE_DISPLACEMENTMAP
- uniform mat3 displacementMapTransform;
- varying vec2 vDisplacementMapUv;
- #endif
- #ifdef USE_EMISSIVEMAP
- uniform mat3 emissiveMapTransform;
- varying vec2 vEmissiveMapUv;
- #endif
- #ifdef USE_METALNESSMAP
- uniform mat3 metalnessMapTransform;
- varying vec2 vMetalnessMapUv;
- #endif
- #ifdef USE_ROUGHNESSMAP
- uniform mat3 roughnessMapTransform;
- varying vec2 vRoughnessMapUv;
- #endif
- #ifdef USE_ANISOTROPYMAP
- uniform mat3 anisotropyMapTransform;
- varying vec2 vAnisotropyMapUv;
- #endif
- #ifdef USE_CLEARCOATMAP
- uniform mat3 clearcoatMapTransform;
- varying vec2 vClearcoatMapUv;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- uniform mat3 clearcoatNormalMapTransform;
- varying vec2 vClearcoatNormalMapUv;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- uniform mat3 clearcoatRoughnessMapTransform;
- varying vec2 vClearcoatRoughnessMapUv;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- uniform mat3 sheenColorMapTransform;
- varying vec2 vSheenColorMapUv;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- uniform mat3 sheenRoughnessMapTransform;
- varying vec2 vSheenRoughnessMapUv;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- uniform mat3 iridescenceMapTransform;
- varying vec2 vIridescenceMapUv;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- uniform mat3 iridescenceThicknessMapTransform;
- varying vec2 vIridescenceThicknessMapUv;
- #endif
- #ifdef USE_SPECULARMAP
- uniform mat3 specularMapTransform;
- varying vec2 vSpecularMapUv;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- uniform mat3 specularColorMapTransform;
- varying vec2 vSpecularColorMapUv;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- uniform mat3 specularIntensityMapTransform;
- varying vec2 vSpecularIntensityMapUv;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- uniform mat3 transmissionMapTransform;
- varying vec2 vTransmissionMapUv;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform mat3 thicknessMapTransform;
- varying vec2 vThicknessMapUv;
- #endif`,hN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- vUv = vec3( uv, 1 ).xy;
- #endif
- #ifdef USE_MAP
- vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ALPHAMAP
- vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_LIGHTMAP
- vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_AOMAP
- vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_BUMPMAP
- vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_NORMALMAP
- vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_DISPLACEMENTMAP
- vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_EMISSIVEMAP
- vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_METALNESSMAP
- vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ROUGHNESSMAP
- vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ANISOTROPYMAP
- vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOATMAP
- vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULARMAP
- vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_THICKNESSMAP
- vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
- #endif`,fN=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
- vec4 worldPosition = vec4( transformed, 1.0 );
- #ifdef USE_BATCHING
- worldPosition = batchingMatrix * worldPosition;
- #endif
- #ifdef USE_INSTANCING
- worldPosition = instanceMatrix * worldPosition;
- #endif
- worldPosition = modelMatrix * worldPosition;
- #endif`;const pN=`varying vec2 vUv;
- uniform mat3 uvTransform;
- void main() {
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
- gl_Position = vec4( position.xy, 1.0, 1.0 );
- }`,mN=`uniform sampler2D t2D;
- uniform float backgroundIntensity;
- varying vec2 vUv;
- void main() {
- vec4 texColor = texture2D( t2D, vUv );
- #ifdef DECODE_VIDEO_TEXTURE
- texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
- #endif
- texColor.rgb *= backgroundIntensity;
- gl_FragColor = texColor;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,_N=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- gl_Position.z = gl_Position.w;
- }`,gN=`#ifdef ENVMAP_TYPE_CUBE
- uniform samplerCube envMap;
- #elif defined( ENVMAP_TYPE_CUBE_UV )
- uniform sampler2D envMap;
- #endif
- uniform float flipEnvMap;
- uniform float backgroundBlurriness;
- uniform float backgroundIntensity;
- uniform mat3 backgroundRotation;
- varying vec3 vWorldDirection;
- #include <cube_uv_reflection_fragment>
- void main() {
- #ifdef ENVMAP_TYPE_CUBE
- vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
- #elif defined( ENVMAP_TYPE_CUBE_UV )
- vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
- #else
- vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- #endif
- texColor.rgb *= backgroundIntensity;
- gl_FragColor = texColor;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,vN=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- gl_Position.z = gl_Position.w;
- }`,bN=`uniform samplerCube tCube;
- uniform float tFlip;
- uniform float opacity;
- varying vec3 vWorldDirection;
- void main() {
- vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
- gl_FragColor = texColor;
- gl_FragColor.a *= opacity;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,yN=`#include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- varying vec2 vHighPrecisionZW;
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <skinbase_vertex>
- #include <morphinstance_vertex>
- #ifdef USE_DISPLACEMENTMAP
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vHighPrecisionZW = gl_Position.zw;
- }`,xN=`#if DEPTH_PACKING == 3200
- uniform float opacity;
- #endif
- #include <common>
- #include <packing>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- varying vec2 vHighPrecisionZW;
- void main() {
- vec4 diffuseColor = vec4( 1.0 );
- #include <clipping_planes_fragment>
- #if DEPTH_PACKING == 3200
- diffuseColor.a = opacity;
- #endif
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <logdepthbuf_fragment>
- float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
- #if DEPTH_PACKING == 3200
- gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
- #elif DEPTH_PACKING == 3201
- gl_FragColor = packDepthToRGBA( fragCoordZ );
- #elif DEPTH_PACKING == 3202
- gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
- #elif DEPTH_PACKING == 3203
- gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
- #endif
- }`,SN=`#define DISTANCE
- varying vec3 vWorldPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <skinbase_vertex>
- #include <morphinstance_vertex>
- #ifdef USE_DISPLACEMENTMAP
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <worldpos_vertex>
- #include <clipping_planes_vertex>
- vWorldPosition = worldPosition.xyz;
- }`,MN=`#define DISTANCE
- uniform vec3 referencePosition;
- uniform float nearDistance;
- uniform float farDistance;
- varying vec3 vWorldPosition;
- #include <common>
- #include <packing>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main () {
- vec4 diffuseColor = vec4( 1.0 );
- #include <clipping_planes_fragment>
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- float dist = length( vWorldPosition - referencePosition );
- dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
- dist = saturate( dist );
- gl_FragColor = packDepthToRGBA( dist );
- }`,EN=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- }`,wN=`uniform sampler2D tEquirect;
- varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vec3 direction = normalize( vWorldDirection );
- vec2 sampleUV = equirectUv( direction );
- gl_FragColor = texture2D( tEquirect, sampleUV );
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,TN=`uniform float scale;
- attribute float lineDistance;
- varying float vLineDistance;
- #include <common>
- #include <uv_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- vLineDistance = scale * lineDistance;
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }`,CN=`uniform vec3 diffuse;
- uniform float opacity;
- uniform float dashSize;
- uniform float totalSize;
- varying float vLineDistance;
- #include <common>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- if ( mod( vLineDistance, totalSize ) > dashSize ) {
- discard;
- }
- vec3 outgoingLight = vec3( 0.0 );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }`,AN=`#include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <fog_vertex>
- }`,PN=`uniform vec3 diffuse;
- uniform float opacity;
- #ifndef FLAT_SHADED
- varying vec3 vNormal;
- #endif
- #include <common>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- #ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
- reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
- #else
- reflectedLight.indirectDiffuse += vec3( 1.0 );
- #endif
- #include <aomap_fragment>
- reflectedLight.indirectDiffuse *= diffuseColor.rgb;
- vec3 outgoingLight = reflectedLight.indirectDiffuse;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,RN=`#define LAMBERT
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,DN=`#define LAMBERT
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_lambert_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_lambert_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,IN=`#define MATCAP
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <color_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- vViewPosition = - mvPosition.xyz;
- }`,LN=`#define MATCAP
- uniform vec3 diffuse;
- uniform float opacity;
- uniform sampler2D matcap;
- varying vec3 vViewPosition;
- #include <common>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <normal_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- vec3 viewDir = normalize( vViewPosition );
- vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
- vec3 y = cross( viewDir, x );
- vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
- #ifdef USE_MATCAP
- vec4 matcapColor = texture2D( matcap, uv );
- #else
- vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
- #endif
- vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,UN=`#define NORMAL
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- varying vec3 vViewPosition;
- #endif
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphinstance_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- vViewPosition = - mvPosition.xyz;
- #endif
- }`,FN=`#define NORMAL
- uniform float opacity;
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- varying vec3 vViewPosition;
- #endif
- #include <packing>
- #include <uv_pars_fragment>
- #include <normal_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
- #include <clipping_planes_fragment>
- #include <logdepthbuf_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
- #ifdef OPAQUE
- gl_FragColor.a = 1.0;
- #endif
- }`,ON=`#define PHONG
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphinstance_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,NN=`#define PHONG
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform vec3 specular;
- uniform float shininess;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_phong_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_phong_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,zN=`#define STANDARD
- varying vec3 vViewPosition;
- #ifdef USE_TRANSMISSION
- varying vec3 vWorldPosition;
- #endif
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- #ifdef USE_TRANSMISSION
- vWorldPosition = worldPosition.xyz;
- #endif
- }`,kN=`#define STANDARD
- #ifdef PHYSICAL
- #define IOR
- #define USE_SPECULAR
- #endif
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float roughness;
- uniform float metalness;
- uniform float opacity;
- #ifdef IOR
- uniform float ior;
- #endif
- #ifdef USE_SPECULAR
- uniform float specularIntensity;
- uniform vec3 specularColor;
- #ifdef USE_SPECULAR_COLORMAP
- uniform sampler2D specularColorMap;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- uniform sampler2D specularIntensityMap;
- #endif
- #endif
- #ifdef USE_CLEARCOAT
- uniform float clearcoat;
- uniform float clearcoatRoughness;
- #endif
- #ifdef USE_DISPERSION
- uniform float dispersion;
- #endif
- #ifdef USE_IRIDESCENCE
- uniform float iridescence;
- uniform float iridescenceIOR;
- uniform float iridescenceThicknessMinimum;
- uniform float iridescenceThicknessMaximum;
- #endif
- #ifdef USE_SHEEN
- uniform vec3 sheenColor;
- uniform float sheenRoughness;
- #ifdef USE_SHEEN_COLORMAP
- uniform sampler2D sheenColorMap;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- uniform sampler2D sheenRoughnessMap;
- #endif
- #endif
- #ifdef USE_ANISOTROPY
- uniform vec2 anisotropyVector;
- #ifdef USE_ANISOTROPYMAP
- uniform sampler2D anisotropyMap;
- #endif
- #endif
- varying vec3 vViewPosition;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <iridescence_fragment>
- #include <cube_uv_reflection_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_physical_pars_fragment>
- #include <fog_pars_fragment>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_physical_pars_fragment>
- #include <transmission_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <clearcoat_pars_fragment>
- #include <iridescence_pars_fragment>
- #include <roughnessmap_pars_fragment>
- #include <metalnessmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <roughnessmap_fragment>
- #include <metalnessmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <clearcoat_normal_fragment_begin>
- #include <clearcoat_normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_physical_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
- vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
- #include <transmission_fragment>
- vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
- #ifdef USE_SHEEN
- float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
- outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
- #endif
- #ifdef USE_CLEARCOAT
- float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
- vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
- outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
- #endif
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,BN=`#define TOON
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,VN=`#define TOON
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <gradientmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_toon_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_toon_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,HN=`uniform float size;
- uniform float scale;
- #include <common>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- #ifdef USE_POINTS_UV
- varying vec2 vUv;
- uniform mat3 uvTransform;
- #endif
- void main() {
- #ifdef USE_POINTS_UV
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
- #endif
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <project_vertex>
- gl_PointSize = size;
- #ifdef USE_SIZEATTENUATION
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
- #endif
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <worldpos_vertex>
- #include <fog_vertex>
- }`,$N=`uniform vec3 diffuse;
- uniform float opacity;
- #include <common>
- #include <color_pars_fragment>
- #include <map_particle_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- vec3 outgoingLight = vec3( 0.0 );
- #include <logdepthbuf_fragment>
- #include <map_particle_fragment>
- #include <color_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }`,GN=`#include <common>
- #include <batching_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <shadowmap_pars_vertex>
- void main() {
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphinstance_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,WN=`uniform vec3 color;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <logdepthbuf_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <shadowmask_pars_fragment>
- void main() {
- #include <logdepthbuf_fragment>
- gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- }`,XN=`uniform float rotation;
- uniform vec2 center;
- #include <common>
- #include <uv_pars_vertex>
- #include <fog_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- vec4 mvPosition = modelViewMatrix[ 3 ];
- vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
- #ifndef USE_SIZEATTENUATION
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) scale *= - mvPosition.z;
- #endif
- vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
- vec2 rotatedPosition;
- rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
- rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
- mvPosition.xy += rotatedPosition;
- gl_Position = projectionMatrix * mvPosition;
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }`,jN=`uniform vec3 diffuse;
- uniform float opacity;
- #include <common>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- vec3 outgoingLight = vec3( 0.0 );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- }`,it={alphahash_fragment:mF,alphahash_pars_fragment:_F,alphamap_fragment:gF,alphamap_pars_fragment:vF,alphatest_fragment:bF,alphatest_pars_fragment:yF,aomap_fragment:xF,aomap_pars_fragment:SF,batching_pars_vertex:MF,batching_vertex:EF,begin_vertex:wF,beginnormal_vertex:TF,bsdfs:CF,iridescence_fragment:AF,bumpmap_pars_fragment:PF,clipping_planes_fragment:RF,clipping_planes_pars_fragment:DF,clipping_planes_pars_vertex:IF,clipping_planes_vertex:LF,color_fragment:UF,color_pars_fragment:FF,color_pars_vertex:OF,color_vertex:NF,common:zF,cube_uv_reflection_fragment:kF,defaultnormal_vertex:BF,displacementmap_pars_vertex:VF,displacementmap_vertex:HF,emissivemap_fragment:$F,emissivemap_pars_fragment:GF,colorspace_fragment:WF,colorspace_pars_fragment:XF,envmap_fragment:jF,envmap_common_pars_fragment:YF,envmap_pars_fragment:qF,envmap_pars_vertex:ZF,envmap_physical_pars_fragment:aO,envmap_vertex:KF,fog_vertex:JF,fog_pars_vertex:QF,fog_fragment:eO,fog_pars_fragment:tO,gradientmap_pars_fragment:nO,lightmap_pars_fragment:iO,lights_lambert_fragment:sO,lights_lambert_pars_fragment:oO,lights_pars_begin:rO,lights_toon_fragment:lO,lights_toon_pars_fragment:cO,lights_phong_fragment:dO,lights_phong_pars_fragment:uO,lights_physical_fragment:hO,lights_physical_pars_fragment:fO,lights_fragment_begin:pO,lights_fragment_maps:mO,lights_fragment_end:_O,logdepthbuf_fragment:gO,logdepthbuf_pars_fragment:vO,logdepthbuf_pars_vertex:bO,logdepthbuf_vertex:yO,map_fragment:xO,map_pars_fragment:SO,map_particle_fragment:MO,map_particle_pars_fragment:EO,metalnessmap_fragment:wO,metalnessmap_pars_fragment:TO,morphinstance_vertex:CO,morphcolor_vertex:AO,morphnormal_vertex:PO,morphtarget_pars_vertex:RO,morphtarget_vertex:DO,normal_fragment_begin:IO,normal_fragment_maps:LO,normal_pars_fragment:UO,normal_pars_vertex:FO,normal_vertex:OO,normalmap_pars_fragment:NO,clearcoat_normal_fragment_begin:zO,clearcoat_normal_fragment_maps:kO,clearcoat_pars_fragment:BO,iridescence_pars_fragment:VO,opaque_fragment:HO,packing:$O,premultiplied_alpha_fragment:GO,project_vertex:WO,dithering_fragment:XO,dithering_pars_fragment:jO,roughnessmap_fragment:YO,roughnessmap_pars_fragment:qO,shadowmap_pars_fragment:ZO,shadowmap_pars_vertex:KO,shadowmap_vertex:JO,shadowmask_pars_fragment:QO,skinbase_vertex:eN,skinning_pars_vertex:tN,skinning_vertex:nN,skinnormal_vertex:iN,specularmap_fragment:sN,specularmap_pars_fragment:oN,tonemapping_fragment:rN,tonemapping_pars_fragment:aN,transmission_fragment:lN,transmission_pars_fragment:cN,uv_pars_fragment:dN,uv_pars_vertex:uN,uv_vertex:hN,worldpos_vertex:fN,background_vert:pN,background_frag:mN,backgroundCube_vert:_N,backgroundCube_frag:gN,cube_vert:vN,cube_frag:bN,depth_vert:yN,depth_frag:xN,distanceRGBA_vert:SN,distanceRGBA_frag:MN,equirect_vert:EN,equirect_frag:wN,linedashed_vert:TN,linedashed_frag:CN,meshbasic_vert:AN,meshbasic_frag:PN,meshlambert_vert:RN,meshlambert_frag:DN,meshmatcap_vert:IN,meshmatcap_frag:LN,meshnormal_vert:UN,meshnormal_frag:FN,meshphong_vert:ON,meshphong_frag:NN,meshphysical_vert:zN,meshphysical_frag:kN,meshtoon_vert:BN,meshtoon_frag:VN,points_vert:HN,points_frag:$N,shadow_vert:GN,shadow_frag:WN,sprite_vert:XN,sprite_frag:jN},xe={common:{diffuse:{value:new at(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new tt},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new tt}},envmap:{envMap:{value:null},envMapRotation:{value:new tt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new tt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new tt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new tt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new tt},normalScale:{value:new Ke(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new tt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new tt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new tt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new tt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new at(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new at(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0},uvTransform:{value:new tt}},sprite:{diffuse:{value:new at(16777215)},opacity:{value:1},center:{value:new Ke(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new tt},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0}}},jn={basic:{uniforms:rn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.fog]),vertexShader:it.meshbasic_vert,fragmentShader:it.meshbasic_frag},lambert:{uniforms:rn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new at(0)}}]),vertexShader:it.meshlambert_vert,fragmentShader:it.meshlambert_frag},phong:{uniforms:rn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new at(0)},specular:{value:new at(1118481)},shininess:{value:30}}]),vertexShader:it.meshphong_vert,fragmentShader:it.meshphong_frag},standard:{uniforms:rn([xe.common,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.roughnessmap,xe.metalnessmap,xe.fog,xe.lights,{emissive:{value:new at(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:it.meshphysical_vert,fragmentShader:it.meshphysical_frag},toon:{uniforms:rn([xe.common,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.gradientmap,xe.fog,xe.lights,{emissive:{value:new at(0)}}]),vertexShader:it.meshtoon_vert,fragmentShader:it.meshtoon_frag},matcap:{uniforms:rn([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,{matcap:{value:null}}]),vertexShader:it.meshmatcap_vert,fragmentShader:it.meshmatcap_frag},points:{uniforms:rn([xe.points,xe.fog]),vertexShader:it.points_vert,fragmentShader:it.points_frag},dashed:{uniforms:rn([xe.common,xe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:it.linedashed_vert,fragmentShader:it.linedashed_frag},depth:{uniforms:rn([xe.common,xe.displacementmap]),vertexShader:it.depth_vert,fragmentShader:it.depth_frag},normal:{uniforms:rn([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,{opacity:{value:1}}]),vertexShader:it.meshnormal_vert,fragmentShader:it.meshnormal_frag},sprite:{uniforms:rn([xe.sprite,xe.fog]),vertexShader:it.sprite_vert,fragmentShader:it.sprite_frag},background:{uniforms:{uvTransform:{value:new tt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:it.background_vert,fragmentShader:it.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new tt}},vertexShader:it.backgroundCube_vert,fragmentShader:it.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:it.cube_vert,fragmentShader:it.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:it.equirect_vert,fragmentShader:it.equirect_frag},distanceRGBA:{uniforms:rn([xe.common,xe.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:it.distanceRGBA_vert,fragmentShader:it.distanceRGBA_frag},shadow:{uniforms:rn([xe.lights,xe.fog,{color:{value:new at(0)},opacity:{value:1}}]),vertexShader:it.shadow_vert,fragmentShader:it.shadow_frag}};jn.physical={uniforms:rn([jn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new tt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new tt},clearcoatNormalScale:{value:new Ke(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new tt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new tt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new tt},sheen:{value:0},sheenColor:{value:new at(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new tt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new tt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new tt},transmissionSamplerSize:{value:new Ke},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new tt},attenuationDistance:{value:0},attenuationColor:{value:new at(0)},specularColor:{value:new at(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new tt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new tt},anisotropyVector:{value:new Ke},anisotropyMap:{value:null},anisotropyMapTransform:{value:new tt}}]),vertexShader:it.meshphysical_vert,fragmentShader:it.meshphysical_frag};const Vr={r:0,b:0,g:0},Qi=new Vn,YN=new Tt;function qN(t,e,n,i,s,o,r){const a=new at(0);let l=o===!0?0:1,d,u,f=null,h=0,m=null;function b(w){let S=w.isScene===!0?w.background:null;return S&&S.isTexture&&(S=(w.backgroundBlurriness>0?n:e).get(S)),S}function y(w){let S=!1;const I=b(w);I===null?p(a,l):I&&I.isColor&&(p(I,1),S=!0);const P=t.xr.getEnvironmentBlendMode();P==="additive"?i.buffers.color.setClear(0,0,0,1,r):P==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,r),(t.autoClear||S)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function _(w,S){const I=b(S);I&&(I.isCubeTexture||I.mapping===La)?(u===void 0&&(u=new Ae(new Ot(1,1,1),new Hi({name:"BackgroundCubeMaterial",uniforms:co(jn.backgroundCube.uniforms),vertexShader:jn.backgroundCube.vertexShader,fragmentShader:jn.backgroundCube.fragmentShader,side:un,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(P,D,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(u)),Qi.copy(S.backgroundRotation),Qi.x*=-1,Qi.y*=-1,Qi.z*=-1,I.isCubeTexture&&I.isRenderTargetTexture===!1&&(Qi.y*=-1,Qi.z*=-1),u.material.uniforms.envMap.value=I,u.material.uniforms.flipEnvMap.value=I.isCubeTexture&&I.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(YN.makeRotationFromEuler(Qi)),u.material.toneMapped=ft.getTransfer(I.colorSpace)!==bt,(f!==I||h!==I.version||m!==t.toneMapping)&&(u.material.needsUpdate=!0,f=I,h=I.version,m=t.toneMapping),u.layers.enableAll(),w.unshift(u,u.geometry,u.material,0,0,null)):I&&I.isTexture&&(d===void 0&&(d=new Ae(new bo(2,2),new Hi({name:"BackgroundMaterial",uniforms:co(jn.background.uniforms),vertexShader:jn.background.vertexShader,fragmentShader:jn.background.fragmentShader,side:Vi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(d)),d.material.uniforms.t2D.value=I,d.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,d.material.toneMapped=ft.getTransfer(I.colorSpace)!==bt,I.matrixAutoUpdate===!0&&I.updateMatrix(),d.material.uniforms.uvTransform.value.copy(I.matrix),(f!==I||h!==I.version||m!==t.toneMapping)&&(d.material.needsUpdate=!0,f=I,h=I.version,m=t.toneMapping),d.layers.enableAll(),w.unshift(d,d.geometry,d.material,0,0,null))}function p(w,S){w.getRGB(Vr,Pp(t)),i.buffers.color.setClear(Vr.r,Vr.g,Vr.b,S,r)}function T(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0)}return{getClearColor:function(){return a},setClearColor:function(w,S=1){a.set(w),l=S,p(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(w){l=w,p(a,l)},render:y,addToRenderList:_,dispose:T}}function ZN(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},s=h(null);let o=s,r=!1;function a(g,L,O,H,j){let re=!1;const q=f(H,O,L);o!==q&&(o=q,d(o.object)),re=m(g,H,O,j),re&&b(g,H,O,j),j!==null&&e.update(j,t.ELEMENT_ARRAY_BUFFER),(re||r)&&(r=!1,S(g,L,O,H),j!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return t.createVertexArray()}function d(g){return t.bindVertexArray(g)}function u(g){return t.deleteVertexArray(g)}function f(g,L,O){const H=O.wireframe===!0;let j=i[g.id];j===void 0&&(j={},i[g.id]=j);let re=j[L.id];re===void 0&&(re={},j[L.id]=re);let q=re[H];return q===void 0&&(q=h(l()),re[H]=q),q}function h(g){const L=[],O=[],H=[];for(let j=0;j<n;j++)L[j]=0,O[j]=0,H[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:L,enabledAttributes:O,attributeDivisors:H,object:g,attributes:{},index:null}}function m(g,L,O,H){const j=o.attributes,re=L.attributes;let q=0;const ae=O.getAttributes();for(const G in ae)if(ae[G].location>=0){const ye=j[G];let Re=re[G];if(Re===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(Re=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(Re=g.instanceColor)),ye===void 0||ye.attribute!==Re||Re&&ye.data!==Re.data)return!0;q++}return o.attributesNum!==q||o.index!==H}function b(g,L,O,H){const j={},re=L.attributes;let q=0;const ae=O.getAttributes();for(const G in ae)if(ae[G].location>=0){let ye=re[G];ye===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(ye=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(ye=g.instanceColor));const Re={};Re.attribute=ye,ye&&ye.data&&(Re.data=ye.data),j[G]=Re,q++}o.attributes=j,o.attributesNum=q,o.index=H}function y(){const g=o.newAttributes;for(let L=0,O=g.length;L<O;L++)g[L]=0}function _(g){p(g,0)}function p(g,L){const O=o.newAttributes,H=o.enabledAttributes,j=o.attributeDivisors;O[g]=1,H[g]===0&&(t.enableVertexAttribArray(g),H[g]=1),j[g]!==L&&(t.vertexAttribDivisor(g,L),j[g]=L)}function T(){const g=o.newAttributes,L=o.enabledAttributes;for(let O=0,H=L.length;O<H;O++)L[O]!==g[O]&&(t.disableVertexAttribArray(O),L[O]=0)}function w(g,L,O,H,j,re,q){q===!0?t.vertexAttribIPointer(g,L,O,j,re):t.vertexAttribPointer(g,L,O,H,j,re)}function S(g,L,O,H){y();const j=H.attributes,re=O.getAttributes(),q=L.defaultAttributeValues;for(const ae in re){const G=re[ae];if(G.location>=0){let fe=j[ae];if(fe===void 0&&(ae==="instanceMatrix"&&g.instanceMatrix&&(fe=g.instanceMatrix),ae==="instanceColor"&&g.instanceColor&&(fe=g.instanceColor)),fe!==void 0){const ye=fe.normalized,Re=fe.itemSize,Be=e.get(fe);if(Be===void 0)continue;const Je=Be.buffer,ce=Be.type,N=Be.bytesPerElement,le=ce===t.INT||ce===t.UNSIGNED_INT||fe.gpuType===sd;if(fe.isInterleavedBufferAttribute){const Y=fe.data,ue=Y.stride,Oe=fe.offset;if(Y.isInstancedInterleavedBuffer){for(let Se=0;Se<G.locationSize;Se++)p(G.location+Se,Y.meshPerAttribute);g.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=Y.meshPerAttribute*Y.count)}else for(let Se=0;Se<G.locationSize;Se++)_(G.location+Se);t.bindBuffer(t.ARRAY_BUFFER,Je);for(let Se=0;Se<G.locationSize;Se++)w(G.location+Se,Re/G.locationSize,ce,ye,ue*N,(Oe+Re/G.locationSize*Se)*N,le)}else{if(fe.isInstancedBufferAttribute){for(let Y=0;Y<G.locationSize;Y++)p(G.location+Y,fe.meshPerAttribute);g.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=fe.meshPerAttribute*fe.count)}else for(let Y=0;Y<G.locationSize;Y++)_(G.location+Y);t.bindBuffer(t.ARRAY_BUFFER,Je);for(let Y=0;Y<G.locationSize;Y++)w(G.location+Y,Re/G.locationSize,ce,ye,Re*N,Re/G.locationSize*Y*N,le)}}else if(q!==void 0){const ye=q[ae];if(ye!==void 0)switch(ye.length){case 2:t.vertexAttrib2fv(G.location,ye);break;case 3:t.vertexAttrib3fv(G.location,ye);break;case 4:t.vertexAttrib4fv(G.location,ye);break;default:t.vertexAttrib1fv(G.location,ye)}}}}T()}function I(){R();for(const g in i){const L=i[g];for(const O in L){const H=L[O];for(const j in H)u(H[j].object),delete H[j];delete L[O]}delete i[g]}}function P(g){if(i[g.id]===void 0)return;const L=i[g.id];for(const O in L){const H=L[O];for(const j in H)u(H[j].object),delete H[j];delete L[O]}delete i[g.id]}function D(g){for(const L in i){const O=i[L];if(O[g.id]===void 0)continue;const H=O[g.id];for(const j in H)u(H[j].object),delete H[j];delete O[g.id]}}function R(){E(),r=!0,o!==s&&(o=s,d(o.object))}function E(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:a,reset:R,resetDefaultState:E,dispose:I,releaseStatesOfGeometry:P,releaseStatesOfProgram:D,initAttributes:y,enableAttribute:_,disableUnusedAttributes:T}}function KN(t,e,n){let i;function s(d){i=d}function o(d,u){t.drawArrays(i,d,u),n.update(u,i,1)}function r(d,u,f){f!==0&&(t.drawArraysInstanced(i,d,u,f),n.update(u,i,f))}function a(d,u,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,d,0,u,0,f);let m=0;for(let b=0;b<f;b++)m+=u[b];n.update(m,i,1)}function l(d,u,f,h){if(f===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let b=0;b<d.length;b++)r(d[b],u[b],h[b]);else{m.multiDrawArraysInstancedWEBGL(i,d,0,u,0,h,0,f);let b=0;for(let y=0;y<f;y++)b+=u[y]*h[y];n.update(b,i,1)}}this.setMode=s,this.render=o,this.renderInstances=r,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function JN(t,e,n,i){let s;function o(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const D=e.get("EXT_texture_filter_anisotropic");s=t.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function r(D){return!(D!==zn&&i.convert(D)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(D){const R=D===ur&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(D!==ei&&i.convert(D)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&D!==ui&&!R)}function l(D){if(D==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=n.precision!==void 0?n.precision:"highp";const u=l(d);u!==d&&(console.warn("THREE.WebGLRenderer:",d,"not supported, using",u,"instead."),d=u);const f=n.logarithmicDepthBuffer===!0,h=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),m=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=t.getParameter(t.MAX_TEXTURE_SIZE),_=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),T=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),w=t.getParameter(t.MAX_VARYING_VECTORS),S=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),I=b>0,P=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:l,textureFormatReadable:r,textureTypeReadable:a,precision:d,logarithmicDepthBuffer:f,reverseDepthBuffer:h,maxTextures:m,maxVertexTextures:b,maxTextureSize:y,maxCubemapSize:_,maxAttributes:p,maxVertexUniforms:T,maxVaryings:w,maxFragmentUniforms:S,vertexTextures:I,maxSamples:P}}function QN(t){const e=this;let n=null,i=0,s=!1,o=!1;const r=new Di,a=new tt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const m=f.length!==0||h||i!==0||s;return s=h,i=f.length,m},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(f,h){n=u(f,h,0)},this.setState=function(f,h,m){const b=f.clippingPlanes,y=f.clipIntersection,_=f.clipShadows,p=t.get(f);if(!s||b===null||b.length===0||o&&!_)o?u(null):d();else{const T=o?0:i,w=T*4;let S=p.clippingState||null;l.value=S,S=u(b,h,w,m);for(let I=0;I!==w;++I)S[I]=n[I];p.clippingState=S,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=T}};function d(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(f,h,m,b){const y=f!==null?f.length:0;let _=null;if(y!==0){if(_=l.value,b!==!0||_===null){const p=m+y*4,T=h.matrixWorldInverse;a.getNormalMatrix(T),(_===null||_.length<p)&&(_=new Float32Array(p));for(let w=0,S=m;w!==y;++w,S+=4)r.copy(f[w]).applyMatrix4(T,a),r.normal.toArray(_,S),_[S+3]=r.constant}l.value=_,l.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,_}}function ez(t){let e=new WeakMap;function n(r,a){return a===nc?r.mapping=oo:a===ic&&(r.mapping=ro),r}function i(r){if(r&&r.isTexture){const a=r.mapping;if(a===nc||a===ic)if(e.has(r)){const l=e.get(r).texture;return n(l,r.mapping)}else{const l=r.image;if(l&&l.height>0){const d=new qU(l.height);return d.fromEquirectangularTexture(t,r),e.set(r,d),r.addEventListener("dispose",s),n(d.texture,r.mapping)}else return null}}return r}function s(r){const a=r.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function o(){e=new WeakMap}return{get:i,dispose:o}}const Xs=4,lh=[.125,.215,.35,.446,.526,.582],ds=20,bl=new aF,ch=new at;let yl=null,xl=0,Sl=0,Ml=!1;const ss=(1+Math.sqrt(5))/2,ks=1/ss,dh=[new U(-ss,ks,0),new U(ss,ks,0),new U(-ks,0,ss),new U(ks,0,ss),new U(0,ss,-ks),new U(0,ss,ks),new U(-1,1,-1),new U(1,1,-1),new U(-1,1,1),new U(1,1,1)],tz=new U;class uh{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,i=.1,s=100,o={}){const{size:r=256,position:a=tz}=o;yl=this._renderer.getRenderTarget(),xl=this._renderer.getActiveCubeFace(),Sl=this._renderer.getActiveMipmapLevel(),Ml=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(r);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,s,l,a),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=ph(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(yl,xl,Sl),this._renderer.xr.enabled=Ml,e.scissorTest=!1,Hr(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===oo||e.mapping===ro?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),yl=this._renderer.getRenderTarget(),xl=this._renderer.getActiveCubeFace(),Sl=this._renderer.getActiveMipmapLevel(),Ml=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:qn,minFilter:qn,generateMipmaps:!1,type:ur,format:zn,colorSpace:ao,depthBuffer:!1},s=hh(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=hh(e,n,i);const{_lodMax:o}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=nz(o)),this._blurMaterial=iz(o,e,n)}return s}_compileMaterial(e){const n=new Ae(this._lodPlanes[0],e);this._renderer.compile(n,bl)}_sceneToCubeUV(e,n,i,s,o){const l=new _n(90,1,n,i),d=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,h=f.autoClear,m=f.toneMapping;f.getClearColor(ch),f.toneMapping=zi,f.autoClear=!1;const b=new Oa({name:"PMREM.Background",side:un,depthWrite:!1,depthTest:!1}),y=new Ae(new Ot,b);let _=!1;const p=e.background;p?p.isColor&&(b.color.copy(p),e.background=null,_=!0):(b.color.copy(ch),_=!0);for(let T=0;T<6;T++){const w=T%3;w===0?(l.up.set(0,d[T],0),l.position.set(o.x,o.y,o.z),l.lookAt(o.x+u[T],o.y,o.z)):w===1?(l.up.set(0,0,d[T]),l.position.set(o.x,o.y,o.z),l.lookAt(o.x,o.y+u[T],o.z)):(l.up.set(0,d[T],0),l.position.set(o.x,o.y,o.z),l.lookAt(o.x,o.y,o.z+u[T]));const S=this._cubeSize;Hr(s,w*S,T>2?S:0,S,S),f.setRenderTarget(s),_&&f.render(y,l),f.render(e,l)}y.geometry.dispose(),y.material.dispose(),f.toneMapping=m,f.autoClear=h,e.background=p}_textureToCubeUV(e,n){const i=this._renderer,s=e.mapping===oo||e.mapping===ro;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=ph()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fh());const o=s?this._cubemapMaterial:this._equirectMaterial,r=new Ae(this._lodPlanes[0],o),a=o.uniforms;a.envMap.value=e;const l=this._cubeSize;Hr(n,0,0,3*l,2*l),i.setRenderTarget(n),i.render(r,bl)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const s=this._lodPlanes.length;for(let o=1;o<s;o++){const r=Math.sqrt(this._sigmas[o]*this._sigmas[o]-this._sigmas[o-1]*this._sigmas[o-1]),a=dh[(s-o-1)%dh.length];this._blur(e,o-1,o,r,a)}n.autoClear=i}_blur(e,n,i,s,o){const r=this._pingPongRenderTarget;this._halfBlur(e,r,n,i,s,"latitudinal",o),this._halfBlur(r,e,i,i,s,"longitudinal",o)}_halfBlur(e,n,i,s,o,r,a){const l=this._renderer,d=this._blurMaterial;r!=="latitudinal"&&r!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,f=new Ae(this._lodPlanes[s],d),h=d.uniforms,m=this._sizeLods[i]-1,b=isFinite(o)?Math.PI/(2*m):2*Math.PI/(2*ds-1),y=o/b,_=isFinite(o)?1+Math.floor(u*y):ds;_>ds&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${ds}`);const p=[];let T=0;for(let D=0;D<ds;++D){const R=D/y,E=Math.exp(-R*R/2);p.push(E),D===0?T+=E:D<_&&(T+=2*E)}for(let D=0;D<p.length;D++)p[D]=p[D]/T;h.envMap.value=e.texture,h.samples.value=_,h.weights.value=p,h.latitudinal.value=r==="latitudinal",a&&(h.poleAxis.value=a);const{_lodMax:w}=this;h.dTheta.value=b,h.mipInt.value=w-i;const S=this._sizeLods[s],I=3*S*(s>w-Xs?s-w+Xs:0),P=4*(this._cubeSize-S);Hr(n,I,P,3*S,2*S),l.setRenderTarget(n),l.render(f,bl)}}function nz(t){const e=[],n=[],i=[];let s=t;const o=t-Xs+1+lh.length;for(let r=0;r<o;r++){const a=Math.pow(2,s);n.push(a);let l=1/a;r>t-Xs?l=lh[r-t+Xs-1]:r===0&&(l=0),i.push(l);const d=1/(a-2),u=-d,f=1+d,h=[u,u,f,u,f,f,u,u,f,f,u,f],m=6,b=6,y=3,_=2,p=1,T=new Float32Array(y*b*m),w=new Float32Array(_*b*m),S=new Float32Array(p*b*m);for(let P=0;P<m;P++){const D=P%3*2/3-1,R=P>2?0:-1,E=[D,R,0,D+2/3,R,0,D+2/3,R+1,0,D,R,0,D+2/3,R+1,0,D,R+1,0];T.set(E,y*b*P),w.set(h,_*b*P);const g=[P,P,P,P,P,P];S.set(g,p*b*P)}const I=new tn;I.setAttribute("position",new Jn(T,y)),I.setAttribute("uv",new Jn(w,_)),I.setAttribute("faceIndex",new Jn(S,p)),e.push(I),s>Xs&&s--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function hh(t,e,n){const i=new vs(t,e,n);return i.texture.mapping=La,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Hr(t,e,n,i,s){t.viewport.set(e,n,i,s),t.scissor.set(e,n,i,s)}function iz(t,e,n){const i=new Float32Array(ds),s=new U(0,1,0);return new Hi({name:"SphericalGaussianBlur",defines:{n:ds,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:vd(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- uniform int samples;
- uniform float weights[ n ];
- uniform bool latitudinal;
- uniform float dTheta;
- uniform float mipInt;
- uniform vec3 poleAxis;
- #define ENVMAP_TYPE_CUBE_UV
- #include <cube_uv_reflection_fragment>
- vec3 getSample( float theta, vec3 axis ) {
- float cosTheta = cos( theta );
- // Rodrigues' axis-angle rotation
- vec3 sampleDirection = vOutputDirection * cosTheta
- + cross( axis, vOutputDirection ) * sin( theta )
- + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
- return bilinearCubeUV( envMap, sampleDirection, mipInt );
- }
- void main() {
- vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
- if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
- axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
- }
- axis = normalize( axis );
- gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
- for ( int i = 1; i < n; i++ ) {
- if ( i >= samples ) {
- break;
- }
- float theta = dTheta * float( i );
- gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
- gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
- }
- }
- `,blending:Ni,depthTest:!1,depthWrite:!1})}function fh(){return new Hi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:vd(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- #include <common>
- void main() {
- vec3 outputDirection = normalize( vOutputDirection );
- vec2 uv = equirectUv( outputDirection );
- gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
- }
- `,blending:Ni,depthTest:!1,depthWrite:!1})}function ph(){return new Hi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:vd(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- uniform float flipEnvMap;
- varying vec3 vOutputDirection;
- uniform samplerCube envMap;
- void main() {
- gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
- }
- `,blending:Ni,depthTest:!1,depthWrite:!1})}function vd(){return`
- precision mediump float;
- precision mediump int;
- attribute float faceIndex;
- varying vec3 vOutputDirection;
- // RH coordinate system; PMREM face-indexing convention
- vec3 getDirection( vec2 uv, float face ) {
- uv = 2.0 * uv - 1.0;
- vec3 direction = vec3( uv, 1.0 );
- if ( face == 0.0 ) {
- direction = direction.zyx; // ( 1, v, u ) pos x
- } else if ( face == 1.0 ) {
- direction = direction.xzy;
- direction.xz *= -1.0; // ( -u, 1, -v ) pos y
- } else if ( face == 2.0 ) {
- direction.x *= -1.0; // ( -u, v, 1 ) pos z
- } else if ( face == 3.0 ) {
- direction = direction.zyx;
- direction.xz *= -1.0; // ( -1, v, -u ) neg x
- } else if ( face == 4.0 ) {
- direction = direction.xzy;
- direction.xy *= -1.0; // ( -u, -1, v ) neg y
- } else if ( face == 5.0 ) {
- direction.z *= -1.0; // ( u, v, -1 ) neg z
- }
- return direction;
- }
- void main() {
- vOutputDirection = getDirection( uv, faceIndex );
- gl_Position = vec4( position, 1.0 );
- }
- `}function sz(t){let e=new WeakMap,n=null;function i(a){if(a&&a.isTexture){const l=a.mapping,d=l===nc||l===ic,u=l===oo||l===ro;if(d||u){let f=e.get(a);const h=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return n===null&&(n=new uh(t)),f=d?n.fromEquirectangular(a,f):n.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const m=a.image;return d&&m&&m.height>0||u&&m&&s(m)?(n===null&&(n=new uh(t)),f=d?n.fromEquirectangular(a):n.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",o),f.texture):null}}}return a}function s(a){let l=0;const d=6;for(let u=0;u<d;u++)a[u]!==void 0&&l++;return l===d}function o(a){const l=a.target;l.removeEventListener("dispose",o);const d=e.get(l);d!==void 0&&(e.delete(l),d.dispose())}function r(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:r}}function oz(t){const e={};function n(i){if(e[i]!==void 0)return e[i];let s;switch(i){case"WEBGL_depth_texture":s=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=t.getExtension(i)}return e[i]=s,s}return{has:function(i){return n(i)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(i){const s=n(i);return s===null&&ia("THREE.WebGLRenderer: "+i+" extension not supported."),s}}}function rz(t,e,n,i){const s={},o=new WeakMap;function r(f){const h=f.target;h.index!==null&&e.remove(h.index);for(const b in h.attributes)e.remove(h.attributes[b]);h.removeEventListener("dispose",r),delete s[h.id];const m=o.get(h);m&&(e.remove(m),o.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,n.memory.geometries--}function a(f,h){return s[h.id]===!0||(h.addEventListener("dispose",r),s[h.id]=!0,n.memory.geometries++),h}function l(f){const h=f.attributes;for(const m in h)e.update(h[m],t.ARRAY_BUFFER)}function d(f){const h=[],m=f.index,b=f.attributes.position;let y=0;if(m!==null){const T=m.array;y=m.version;for(let w=0,S=T.length;w<S;w+=3){const I=T[w+0],P=T[w+1],D=T[w+2];h.push(I,P,P,D,D,I)}}else if(b!==void 0){const T=b.array;y=b.version;for(let w=0,S=T.length/3-1;w<S;w+=3){const I=w+0,P=w+1,D=w+2;h.push(I,P,P,D,D,I)}}else return;const _=new(Ep(h)?Ap:Cp)(h,1);_.version=y;const p=o.get(f);p&&e.remove(p),o.set(f,_)}function u(f){const h=o.get(f);if(h){const m=f.index;m!==null&&h.version<m.version&&d(f)}else d(f);return o.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function az(t,e,n){let i;function s(h){i=h}let o,r;function a(h){o=h.type,r=h.bytesPerElement}function l(h,m){t.drawElements(i,m,o,h*r),n.update(m,i,1)}function d(h,m,b){b!==0&&(t.drawElementsInstanced(i,m,o,h*r,b),n.update(m,i,b))}function u(h,m,b){if(b===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,m,0,o,h,0,b);let _=0;for(let p=0;p<b;p++)_+=m[p];n.update(_,i,1)}function f(h,m,b,y){if(b===0)return;const _=e.get("WEBGL_multi_draw");if(_===null)for(let p=0;p<h.length;p++)d(h[p]/r,m[p],y[p]);else{_.multiDrawElementsInstancedWEBGL(i,m,0,o,h,0,y,0,b);let p=0;for(let T=0;T<b;T++)p+=m[T]*y[T];n.update(p,i,1)}}this.setMode=s,this.setIndex=a,this.render=l,this.renderInstances=d,this.renderMultiDraw=u,this.renderMultiDrawInstances=f}function lz(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(o,r,a){switch(n.calls++,r){case t.TRIANGLES:n.triangles+=a*(o/3);break;case t.LINES:n.lines+=a*(o/2);break;case t.LINE_STRIP:n.lines+=a*(o-1);break;case t.LINE_LOOP:n.lines+=a*o;break;case t.POINTS:n.points+=a*o;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r);break}}function s(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:s,update:i}}function cz(t,e,n){const i=new WeakMap,s=new It;function o(r,a,l){const d=r.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0;let h=i.get(a);if(h===void 0||h.count!==f){let E=function(){D.dispose(),i.delete(a),a.removeEventListener("dispose",E)};h!==void 0&&h.texture.dispose();const m=a.morphAttributes.position!==void 0,b=a.morphAttributes.normal!==void 0,y=a.morphAttributes.color!==void 0,_=a.morphAttributes.position||[],p=a.morphAttributes.normal||[],T=a.morphAttributes.color||[];let w=0;m===!0&&(w=1),b===!0&&(w=2),y===!0&&(w=3);let S=a.attributes.position.count*w,I=1;S>e.maxTextureSize&&(I=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const P=new Float32Array(S*I*4*f),D=new wp(P,S,I,f);D.type=ui,D.needsUpdate=!0;const R=w*4;for(let g=0;g<f;g++){const L=_[g],O=p[g],H=T[g],j=S*I*4*g;for(let re=0;re<L.count;re++){const q=re*R;m===!0&&(s.fromBufferAttribute(L,re),P[j+q+0]=s.x,P[j+q+1]=s.y,P[j+q+2]=s.z,P[j+q+3]=0),b===!0&&(s.fromBufferAttribute(O,re),P[j+q+4]=s.x,P[j+q+5]=s.y,P[j+q+6]=s.z,P[j+q+7]=0),y===!0&&(s.fromBufferAttribute(H,re),P[j+q+8]=s.x,P[j+q+9]=s.y,P[j+q+10]=s.z,P[j+q+11]=H.itemSize===4?s.w:1)}}h={count:f,texture:D,size:new Ke(S,I)},i.set(a,h),a.addEventListener("dispose",E)}if(r.isInstancedMesh===!0&&r.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",r.morphTexture,n);else{let m=0;for(let y=0;y<d.length;y++)m+=d[y];const b=a.morphTargetsRelative?1:1-m;l.getUniforms().setValue(t,"morphTargetBaseInfluence",b),l.getUniforms().setValue(t,"morphTargetInfluences",d)}l.getUniforms().setValue(t,"morphTargetsTexture",h.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",h.size)}return{update:o}}function dz(t,e,n,i){let s=new WeakMap;function o(l){const d=i.render.frame,u=l.geometry,f=e.get(l,u);if(s.get(f)!==d&&(e.update(f),s.set(f,d)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),s.get(l)!==d&&(n.update(l.instanceMatrix,t.ARRAY_BUFFER),l.instanceColor!==null&&n.update(l.instanceColor,t.ARRAY_BUFFER),s.set(l,d))),l.isSkinnedMesh){const h=l.skeleton;s.get(h)!==d&&(h.update(),s.set(h,d))}return f}function r(){s=new WeakMap}function a(l){const d=l.target;d.removeEventListener("dispose",a),n.remove(d.instanceMatrix),d.instanceColor!==null&&n.remove(d.instanceColor)}return{update:o,dispose:r}}const Op=new hn,mh=new Ip(1,1),Np=new wp,zp=new IU,kp=new Dp,_h=[],gh=[],vh=new Float32Array(16),bh=new Float32Array(9),yh=new Float32Array(4);function yo(t,e,n){const i=t[0];if(i<=0||i>0)return t;const s=e*n;let o=_h[s];if(o===void 0&&(o=new Float32Array(s),_h[s]=o),e!==0){i.toArray(o,0);for(let r=1,a=0;r!==e;++r)a+=n,t[r].toArray(o,a)}return o}function Bt(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Vt(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function Na(t,e){let n=gh[e];n===void 0&&(n=new Int32Array(e),gh[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function uz(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function hz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Bt(n,e))return;t.uniform2fv(this.addr,e),Vt(n,e)}}function fz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Bt(n,e))return;t.uniform3fv(this.addr,e),Vt(n,e)}}function pz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Bt(n,e))return;t.uniform4fv(this.addr,e),Vt(n,e)}}function mz(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Bt(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Vt(n,e)}else{if(Bt(n,i))return;yh.set(i),t.uniformMatrix2fv(this.addr,!1,yh),Vt(n,i)}}function _z(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Bt(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Vt(n,e)}else{if(Bt(n,i))return;bh.set(i),t.uniformMatrix3fv(this.addr,!1,bh),Vt(n,i)}}function gz(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Bt(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Vt(n,e)}else{if(Bt(n,i))return;vh.set(i),t.uniformMatrix4fv(this.addr,!1,vh),Vt(n,i)}}function vz(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function bz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Bt(n,e))return;t.uniform2iv(this.addr,e),Vt(n,e)}}function yz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Bt(n,e))return;t.uniform3iv(this.addr,e),Vt(n,e)}}function xz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Bt(n,e))return;t.uniform4iv(this.addr,e),Vt(n,e)}}function Sz(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Mz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Bt(n,e))return;t.uniform2uiv(this.addr,e),Vt(n,e)}}function Ez(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Bt(n,e))return;t.uniform3uiv(this.addr,e),Vt(n,e)}}function wz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Bt(n,e))return;t.uniform4uiv(this.addr,e),Vt(n,e)}}function Tz(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s);let o;this.type===t.SAMPLER_2D_SHADOW?(mh.compareFunction=Mp,o=mh):o=Op,n.setTexture2D(e||o,s)}function Cz(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTexture3D(e||zp,s)}function Az(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTextureCube(e||kp,s)}function Pz(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTexture2DArray(e||Np,s)}function Rz(t){switch(t){case 5126:return uz;case 35664:return hz;case 35665:return fz;case 35666:return pz;case 35674:return mz;case 35675:return _z;case 35676:return gz;case 5124:case 35670:return vz;case 35667:case 35671:return bz;case 35668:case 35672:return yz;case 35669:case 35673:return xz;case 5125:return Sz;case 36294:return Mz;case 36295:return Ez;case 36296:return wz;case 35678:case 36198:case 36298:case 36306:case 35682:return Tz;case 35679:case 36299:case 36307:return Cz;case 35680:case 36300:case 36308:case 36293:return Az;case 36289:case 36303:case 36311:case 36292:return Pz}}function Dz(t,e){t.uniform1fv(this.addr,e)}function Iz(t,e){const n=yo(e,this.size,2);t.uniform2fv(this.addr,n)}function Lz(t,e){const n=yo(e,this.size,3);t.uniform3fv(this.addr,n)}function Uz(t,e){const n=yo(e,this.size,4);t.uniform4fv(this.addr,n)}function Fz(t,e){const n=yo(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Oz(t,e){const n=yo(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Nz(t,e){const n=yo(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function zz(t,e){t.uniform1iv(this.addr,e)}function kz(t,e){t.uniform2iv(this.addr,e)}function Bz(t,e){t.uniform3iv(this.addr,e)}function Vz(t,e){t.uniform4iv(this.addr,e)}function Hz(t,e){t.uniform1uiv(this.addr,e)}function $z(t,e){t.uniform2uiv(this.addr,e)}function Gz(t,e){t.uniform3uiv(this.addr,e)}function Wz(t,e){t.uniform4uiv(this.addr,e)}function Xz(t,e,n){const i=this.cache,s=e.length,o=Na(n,s);Bt(i,o)||(t.uniform1iv(this.addr,o),Vt(i,o));for(let r=0;r!==s;++r)n.setTexture2D(e[r]||Op,o[r])}function jz(t,e,n){const i=this.cache,s=e.length,o=Na(n,s);Bt(i,o)||(t.uniform1iv(this.addr,o),Vt(i,o));for(let r=0;r!==s;++r)n.setTexture3D(e[r]||zp,o[r])}function Yz(t,e,n){const i=this.cache,s=e.length,o=Na(n,s);Bt(i,o)||(t.uniform1iv(this.addr,o),Vt(i,o));for(let r=0;r!==s;++r)n.setTextureCube(e[r]||kp,o[r])}function qz(t,e,n){const i=this.cache,s=e.length,o=Na(n,s);Bt(i,o)||(t.uniform1iv(this.addr,o),Vt(i,o));for(let r=0;r!==s;++r)n.setTexture2DArray(e[r]||Np,o[r])}function Zz(t){switch(t){case 5126:return Dz;case 35664:return Iz;case 35665:return Lz;case 35666:return Uz;case 35674:return Fz;case 35675:return Oz;case 35676:return Nz;case 5124:case 35670:return zz;case 35667:case 35671:return kz;case 35668:case 35672:return Bz;case 35669:case 35673:return Vz;case 5125:return Hz;case 36294:return $z;case 36295:return Gz;case 36296:return Wz;case 35678:case 36198:case 36298:case 36306:case 35682:return Xz;case 35679:case 36299:case 36307:return jz;case 35680:case 36300:case 36308:case 36293:return Yz;case 36289:case 36303:case 36311:case 36292:return qz}}class Kz{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=Rz(n.type)}}class Jz{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=Zz(n.type)}}class Qz{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,i){const s=this.seq;for(let o=0,r=s.length;o!==r;++o){const a=s[o];a.setValue(e,n[a.id],i)}}}const El=/(\w+)(\])?(\[|\.)?/g;function xh(t,e){t.seq.push(e),t.map[e.id]=e}function ek(t,e,n){const i=t.name,s=i.length;for(El.lastIndex=0;;){const o=El.exec(i),r=El.lastIndex;let a=o[1];const l=o[2]==="]",d=o[3];if(l&&(a=a|0),d===void 0||d==="["&&r+2===s){xh(n,d===void 0?new Kz(a,t,e):new Jz(a,t,e));break}else{let f=n.map[a];f===void 0&&(f=new Qz(a),xh(n,f)),n=f}}}class sa{constructor(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let s=0;s<i;++s){const o=e.getActiveUniform(n,s),r=e.getUniformLocation(n,o.name);ek(o,r,this)}}setValue(e,n,i,s){const o=this.map[n];o!==void 0&&o.setValue(e,i,s)}setOptional(e,n,i){const s=n[i];s!==void 0&&this.setValue(e,i,s)}static upload(e,n,i,s){for(let o=0,r=n.length;o!==r;++o){const a=n[o],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,s)}}static seqWithValue(e,n){const i=[];for(let s=0,o=e.length;s!==o;++s){const r=e[s];r.id in n&&i.push(r)}return i}}function Sh(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const tk=37297;let nk=0;function ik(t,e){const n=t.split(`
- `),i=[],s=Math.max(e-6,0),o=Math.min(e+6,n.length);for(let r=s;r<o;r++){const a=r+1;i.push(`${a===e?">":" "} ${a}: ${n[r]}`)}return i.join(`
- `)}const Mh=new tt;function sk(t){ft._getMatrix(Mh,ft.workingColorSpace,t);const e=`mat3( ${Mh.elements.map(n=>n.toFixed(4))} )`;switch(ft.getTransfer(t)){case fa:return[e,"LinearTransferOETF"];case bt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function Eh(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),s=t.getShaderInfoLog(e).trim();if(i&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const r=parseInt(o[1]);return n.toUpperCase()+`
- `+s+`
- `+ik(t.getShaderSource(e),r)}else return s}function ok(t,e){const n=sk(e);return[`vec4 ${t}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
- `)}function rk(t,e){let n;switch(e){case HL:n="Linear";break;case $L:n="Reinhard";break;case GL:n="Cineon";break;case WL:n="ACESFilmic";break;case jL:n="AgX";break;case YL:n="Neutral";break;case XL:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const $r=new U;function ak(){ft.getLuminanceCoefficients($r);const t=$r.x.toFixed(4),e=$r.y.toFixed(4),n=$r.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
- `)}function lk(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fo).join(`
- `)}function ck(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
- `)}function dk(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const o=t.getActiveAttrib(e,s),r=o.name;let a=1;o.type===t.FLOAT_MAT2&&(a=2),o.type===t.FLOAT_MAT3&&(a=3),o.type===t.FLOAT_MAT4&&(a=4),n[r]={type:o.type,location:t.getAttribLocation(e,r),locationSize:a}}return n}function Fo(t){return t!==""}function wh(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Th(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const uk=/^[ \t]*#include +<([\w\d./]+)>/gm;function Lc(t){return t.replace(uk,fk)}const hk=new Map;function fk(t,e){let n=it[e];if(n===void 0){const i=hk.get(e);if(i!==void 0)n=it[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Lc(n)}const pk=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ch(t){return t.replace(pk,mk)}function mk(t,e,n,i){let s="";for(let o=parseInt(e);o<parseInt(n);o++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return s}function Ah(t){let e=`precision ${t.precision} float;
- precision ${t.precision} int;
- precision ${t.precision} sampler2D;
- precision ${t.precision} samplerCube;
- precision ${t.precision} sampler3D;
- precision ${t.precision} sampler2DArray;
- precision ${t.precision} sampler2DShadow;
- precision ${t.precision} samplerCubeShadow;
- precision ${t.precision} sampler2DArrayShadow;
- precision ${t.precision} isampler2D;
- precision ${t.precision} isampler3D;
- precision ${t.precision} isamplerCube;
- precision ${t.precision} isampler2DArray;
- precision ${t.precision} usampler2D;
- precision ${t.precision} usampler3D;
- precision ${t.precision} usamplerCube;
- precision ${t.precision} usampler2DArray;
- `;return t.precision==="highp"?e+=`
- #define HIGH_PRECISION`:t.precision==="mediump"?e+=`
- #define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
- #define LOW_PRECISION`),e}function _k(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===hp?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===xL?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===li&&(e="SHADOWMAP_TYPE_VSM"),e}function gk(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case oo:case ro:e="ENVMAP_TYPE_CUBE";break;case La:e="ENVMAP_TYPE_CUBE_UV";break}return e}function vk(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case ro:e="ENVMAP_MODE_REFRACTION";break}return e}function bk(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case id:e="ENVMAP_BLENDING_MULTIPLY";break;case BL:e="ENVMAP_BLENDING_MIX";break;case VL:e="ENVMAP_BLENDING_ADD";break}return e}function yk(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),7*16)),texelHeight:i,maxMip:n}}function xk(t,e,n,i){const s=t.getContext(),o=n.defines;let r=n.vertexShader,a=n.fragmentShader;const l=_k(n),d=gk(n),u=vk(n),f=bk(n),h=yk(n),m=lk(n),b=ck(o),y=s.createProgram();let _,p,T=n.glslVersion?"#version "+n.glslVersion+`
- `:"";n.isRawShaderMaterial?(_=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(Fo).join(`
- `),_.length>0&&(_+=`
- `),p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(Fo).join(`
- `),p.length>0&&(p+=`
- `)):(_=[Ah(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
- `].filter(Fo).join(`
- `),p=[Ah(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+u:"",n.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==zi?"#define TONE_MAPPING":"",n.toneMapping!==zi?it.tonemapping_pars_fragment:"",n.toneMapping!==zi?rk("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",it.colorspace_pars_fragment,ok("linearToOutputTexel",n.outputColorSpace),ak(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
- `].filter(Fo).join(`
- `)),r=Lc(r),r=wh(r,n),r=Th(r,n),a=Lc(a),a=wh(a,n),a=Th(a,n),r=Ch(r),a=Ch(a),n.isRawShaderMaterial!==!0&&(T=`#version 300 es
- `,_=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(`
- `)+`
- `+_,p=["#define varying in",n.glslVersion===Lu?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Lu?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
- `)+`
- `+p);const w=T+_+r,S=T+p+a,I=Sh(s,s.VERTEX_SHADER,w),P=Sh(s,s.FRAGMENT_SHADER,S);s.attachShader(y,I),s.attachShader(y,P),n.index0AttributeName!==void 0?s.bindAttribLocation(y,0,n.index0AttributeName):n.morphTargets===!0&&s.bindAttribLocation(y,0,"position"),s.linkProgram(y);function D(L){if(t.debug.checkShaderErrors){const O=s.getProgramInfoLog(y).trim(),H=s.getShaderInfoLog(I).trim(),j=s.getShaderInfoLog(P).trim();let re=!0,q=!0;if(s.getProgramParameter(y,s.LINK_STATUS)===!1)if(re=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(s,y,I,P);else{const ae=Eh(s,I,"vertex"),G=Eh(s,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(y,s.VALIDATE_STATUS)+`
- Material Name: `+L.name+`
- Material Type: `+L.type+`
- Program Info Log: `+O+`
- `+ae+`
- `+G)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(H===""||j==="")&&(q=!1);q&&(L.diagnostics={runnable:re,programLog:O,vertexShader:{log:H,prefix:_},fragmentShader:{log:j,prefix:p}})}s.deleteShader(I),s.deleteShader(P),R=new sa(s,y),E=dk(s,y)}let R;this.getUniforms=function(){return R===void 0&&D(this),R};let E;this.getAttributes=function(){return E===void 0&&D(this),E};let g=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return g===!1&&(g=s.getProgramParameter(y,tk)),g},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(y),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=nk++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=I,this.fragmentShader=P,this}let Sk=0;class Mk{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(n),o=this._getShaderStage(i),r=this._getShaderCacheForMaterial(e);return r.has(s)===!1&&(r.add(s),s.usedTimes++),r.has(o)===!1&&(r.add(o),o.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new Ek(e),n.set(e,i)),i}}class Ek{constructor(e){this.id=Sk++,this.code=e,this.usedTimes=0}}function wk(t,e,n,i,s,o,r){const a=new hd,l=new Mk,d=new Set,u=[],f=s.logarithmicDepthBuffer,h=s.vertexTextures;let m=s.precision;const b={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(E){return d.add(E),E===0?"uv":`uv${E}`}function _(E,g,L,O,H){const j=O.fog,re=H.geometry,q=E.isMeshStandardMaterial?O.environment:null,ae=(E.isMeshStandardMaterial?n:e).get(E.envMap||q),G=!!ae&&ae.mapping===La?ae.image.height:null,fe=b[E.type];E.precision!==null&&(m=s.getMaxPrecision(E.precision),m!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",m,"instead."));const ye=re.morphAttributes.position||re.morphAttributes.normal||re.morphAttributes.color,Re=ye!==void 0?ye.length:0;let Be=0;re.morphAttributes.position!==void 0&&(Be=1),re.morphAttributes.normal!==void 0&&(Be=2),re.morphAttributes.color!==void 0&&(Be=3);let Je,ce,N,le;if(fe){const vt=jn[fe];Je=vt.vertexShader,ce=vt.fragmentShader}else Je=E.vertexShader,ce=E.fragmentShader,l.update(E),N=l.getVertexShaderID(E),le=l.getFragmentShaderID(E);const Y=t.getRenderTarget(),ue=t.state.buffers.depth.getReversed(),Oe=H.isInstancedMesh===!0,Se=H.isBatchedMesh===!0,Ne=!!E.map,Ue=!!E.matcap,A=!!ae,x=!!E.aoMap,Z=!!E.lightMap,ie=!!E.bumpMap,te=!!E.normalMap,ne=!!E.displacementMap,me=!!E.emissiveMap,Q=!!E.metalnessMap,M=!!E.roughnessMap,v=E.anisotropy>0,F=E.clearcoat>0,B=E.dispersion>0,X=E.iridescence>0,$=E.sheen>0,ge=E.transmission>0,pe=v&&!!E.anisotropyMap,be=F&&!!E.clearcoatMap,Me=F&&!!E.clearcoatNormalMap,he=F&&!!E.clearcoatRoughnessMap,Ce=X&&!!E.iridescenceMap,Xe=X&&!!E.iridescenceThicknessMap,$e=$&&!!E.sheenColorMap,De=$&&!!E.sheenRoughnessMap,Ye=!!E.specularMap,Ge=!!E.specularColorMap,gt=!!E.specularIntensityMap,z=ge&&!!E.transmissionMap,we=ge&&!!E.thicknessMap,oe=!!E.gradientMap,de=!!E.alphaMap,Pe=E.alphaTest>0,Te=!!E.alphaHash,Qe=!!E.extensions;let Rt=zi;E.toneMapped&&(Y===null||Y.isXRRenderTarget===!0)&&(Rt=t.toneMapping);const Yt={shaderID:fe,shaderType:E.type,shaderName:E.name,vertexShader:Je,fragmentShader:ce,defines:E.defines,customVertexShaderID:N,customFragmentShaderID:le,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:m,batching:Se,batchingColor:Se&&H._colorsTexture!==null,instancing:Oe,instancingColor:Oe&&H.instanceColor!==null,instancingMorph:Oe&&H.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:Y===null?t.outputColorSpace:Y.isXRRenderTarget===!0?Y.texture.colorSpace:ao,alphaToCoverage:!!E.alphaToCoverage,map:Ne,matcap:Ue,envMap:A,envMapMode:A&&ae.mapping,envMapCubeUVHeight:G,aoMap:x,lightMap:Z,bumpMap:ie,normalMap:te,displacementMap:h&&ne,emissiveMap:me,normalMapObjectSpace:te&&E.normalMapType===JL,normalMapTangentSpace:te&&E.normalMapType===Sp,metalnessMap:Q,roughnessMap:M,anisotropy:v,anisotropyMap:pe,clearcoat:F,clearcoatMap:be,clearcoatNormalMap:Me,clearcoatRoughnessMap:he,dispersion:B,iridescence:X,iridescenceMap:Ce,iridescenceThicknessMap:Xe,sheen:$,sheenColorMap:$e,sheenRoughnessMap:De,specularMap:Ye,specularColorMap:Ge,specularIntensityMap:gt,transmission:ge,transmissionMap:z,thicknessMap:we,gradientMap:oe,opaque:E.transparent===!1&&E.blending===Ks&&E.alphaToCoverage===!1,alphaMap:de,alphaTest:Pe,alphaHash:Te,combine:E.combine,mapUv:Ne&&y(E.map.channel),aoMapUv:x&&y(E.aoMap.channel),lightMapUv:Z&&y(E.lightMap.channel),bumpMapUv:ie&&y(E.bumpMap.channel),normalMapUv:te&&y(E.normalMap.channel),displacementMapUv:ne&&y(E.displacementMap.channel),emissiveMapUv:me&&y(E.emissiveMap.channel),metalnessMapUv:Q&&y(E.metalnessMap.channel),roughnessMapUv:M&&y(E.roughnessMap.channel),anisotropyMapUv:pe&&y(E.anisotropyMap.channel),clearcoatMapUv:be&&y(E.clearcoatMap.channel),clearcoatNormalMapUv:Me&&y(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:he&&y(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Ce&&y(E.iridescenceMap.channel),iridescenceThicknessMapUv:Xe&&y(E.iridescenceThicknessMap.channel),sheenColorMapUv:$e&&y(E.sheenColorMap.channel),sheenRoughnessMapUv:De&&y(E.sheenRoughnessMap.channel),specularMapUv:Ye&&y(E.specularMap.channel),specularColorMapUv:Ge&&y(E.specularColorMap.channel),specularIntensityMapUv:gt&&y(E.specularIntensityMap.channel),transmissionMapUv:z&&y(E.transmissionMap.channel),thicknessMapUv:we&&y(E.thicknessMap.channel),alphaMapUv:de&&y(E.alphaMap.channel),vertexTangents:!!re.attributes.tangent&&(te||v),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!re.attributes.color&&re.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!re.attributes.uv&&(Ne||de),fog:!!j,useFog:E.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:ue,skinning:H.isSkinnedMesh===!0,morphTargets:re.morphAttributes.position!==void 0,morphNormals:re.morphAttributes.normal!==void 0,morphColors:re.morphAttributes.color!==void 0,morphTargetsCount:Re,morphTextureStride:Be,numDirLights:g.directional.length,numPointLights:g.point.length,numSpotLights:g.spot.length,numSpotLightMaps:g.spotLightMap.length,numRectAreaLights:g.rectArea.length,numHemiLights:g.hemi.length,numDirLightShadows:g.directionalShadowMap.length,numPointLightShadows:g.pointShadowMap.length,numSpotLightShadows:g.spotShadowMap.length,numSpotLightShadowsWithMaps:g.numSpotLightShadowsWithMaps,numLightProbes:g.numLightProbes,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:E.dithering,shadowMapEnabled:t.shadowMap.enabled&&L.length>0,shadowMapType:t.shadowMap.type,toneMapping:Rt,decodeVideoTexture:Ne&&E.map.isVideoTexture===!0&&ft.getTransfer(E.map.colorSpace)===bt,decodeVideoTextureEmissive:me&&E.emissiveMap.isVideoTexture===!0&&ft.getTransfer(E.emissiveMap.colorSpace)===bt,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Fn,flipSided:E.side===un,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Qe&&E.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Qe&&E.extensions.multiDraw===!0||Se)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return Yt.vertexUv1s=d.has(1),Yt.vertexUv2s=d.has(2),Yt.vertexUv3s=d.has(3),d.clear(),Yt}function p(E){const g=[];if(E.shaderID?g.push(E.shaderID):(g.push(E.customVertexShaderID),g.push(E.customFragmentShaderID)),E.defines!==void 0)for(const L in E.defines)g.push(L),g.push(E.defines[L]);return E.isRawShaderMaterial===!1&&(T(g,E),w(g,E),g.push(t.outputColorSpace)),g.push(E.customProgramCacheKey),g.join()}function T(E,g){E.push(g.precision),E.push(g.outputColorSpace),E.push(g.envMapMode),E.push(g.envMapCubeUVHeight),E.push(g.mapUv),E.push(g.alphaMapUv),E.push(g.lightMapUv),E.push(g.aoMapUv),E.push(g.bumpMapUv),E.push(g.normalMapUv),E.push(g.displacementMapUv),E.push(g.emissiveMapUv),E.push(g.metalnessMapUv),E.push(g.roughnessMapUv),E.push(g.anisotropyMapUv),E.push(g.clearcoatMapUv),E.push(g.clearcoatNormalMapUv),E.push(g.clearcoatRoughnessMapUv),E.push(g.iridescenceMapUv),E.push(g.iridescenceThicknessMapUv),E.push(g.sheenColorMapUv),E.push(g.sheenRoughnessMapUv),E.push(g.specularMapUv),E.push(g.specularColorMapUv),E.push(g.specularIntensityMapUv),E.push(g.transmissionMapUv),E.push(g.thicknessMapUv),E.push(g.combine),E.push(g.fogExp2),E.push(g.sizeAttenuation),E.push(g.morphTargetsCount),E.push(g.morphAttributeCount),E.push(g.numDirLights),E.push(g.numPointLights),E.push(g.numSpotLights),E.push(g.numSpotLightMaps),E.push(g.numHemiLights),E.push(g.numRectAreaLights),E.push(g.numDirLightShadows),E.push(g.numPointLightShadows),E.push(g.numSpotLightShadows),E.push(g.numSpotLightShadowsWithMaps),E.push(g.numLightProbes),E.push(g.shadowMapType),E.push(g.toneMapping),E.push(g.numClippingPlanes),E.push(g.numClipIntersection),E.push(g.depthPacking)}function w(E,g){a.disableAll(),g.supportsVertexTextures&&a.enable(0),g.instancing&&a.enable(1),g.instancingColor&&a.enable(2),g.instancingMorph&&a.enable(3),g.matcap&&a.enable(4),g.envMap&&a.enable(5),g.normalMapObjectSpace&&a.enable(6),g.normalMapTangentSpace&&a.enable(7),g.clearcoat&&a.enable(8),g.iridescence&&a.enable(9),g.alphaTest&&a.enable(10),g.vertexColors&&a.enable(11),g.vertexAlphas&&a.enable(12),g.vertexUv1s&&a.enable(13),g.vertexUv2s&&a.enable(14),g.vertexUv3s&&a.enable(15),g.vertexTangents&&a.enable(16),g.anisotropy&&a.enable(17),g.alphaHash&&a.enable(18),g.batching&&a.enable(19),g.dispersion&&a.enable(20),g.batchingColor&&a.enable(21),E.push(a.mask),a.disableAll(),g.fog&&a.enable(0),g.useFog&&a.enable(1),g.flatShading&&a.enable(2),g.logarithmicDepthBuffer&&a.enable(3),g.reverseDepthBuffer&&a.enable(4),g.skinning&&a.enable(5),g.morphTargets&&a.enable(6),g.morphNormals&&a.enable(7),g.morphColors&&a.enable(8),g.premultipliedAlpha&&a.enable(9),g.shadowMapEnabled&&a.enable(10),g.doubleSided&&a.enable(11),g.flipSided&&a.enable(12),g.useDepthPacking&&a.enable(13),g.dithering&&a.enable(14),g.transmission&&a.enable(15),g.sheen&&a.enable(16),g.opaque&&a.enable(17),g.pointsUvs&&a.enable(18),g.decodeVideoTexture&&a.enable(19),g.decodeVideoTextureEmissive&&a.enable(20),g.alphaToCoverage&&a.enable(21),E.push(a.mask)}function S(E){const g=b[E.type];let L;if(g){const O=jn[g];L=WU.clone(O.uniforms)}else L=E.uniforms;return L}function I(E,g){let L;for(let O=0,H=u.length;O<H;O++){const j=u[O];if(j.cacheKey===g){L=j,++L.usedTimes;break}}return L===void 0&&(L=new xk(t,g,E,o),u.push(L)),L}function P(E){if(--E.usedTimes===0){const g=u.indexOf(E);u[g]=u[u.length-1],u.pop(),E.destroy()}}function D(E){l.remove(E)}function R(){l.dispose()}return{getParameters:_,getProgramCacheKey:p,getUniforms:S,acquireProgram:I,releaseProgram:P,releaseShaderCache:D,programs:u,dispose:R}}function Tk(){let t=new WeakMap;function e(r){return t.has(r)}function n(r){let a=t.get(r);return a===void 0&&(a={},t.set(r,a)),a}function i(r){t.delete(r)}function s(r,a,l){t.get(r)[a]=l}function o(){t=new WeakMap}return{has:e,get:n,remove:i,update:s,dispose:o}}function Ck(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Ph(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Rh(){const t=[];let e=0;const n=[],i=[],s=[];function o(){e=0,n.length=0,i.length=0,s.length=0}function r(f,h,m,b,y,_){let p=t[e];return p===void 0?(p={id:f.id,object:f,geometry:h,material:m,groupOrder:b,renderOrder:f.renderOrder,z:y,group:_},t[e]=p):(p.id=f.id,p.object=f,p.geometry=h,p.material=m,p.groupOrder=b,p.renderOrder=f.renderOrder,p.z=y,p.group=_),e++,p}function a(f,h,m,b,y,_){const p=r(f,h,m,b,y,_);m.transmission>0?i.push(p):m.transparent===!0?s.push(p):n.push(p)}function l(f,h,m,b,y,_){const p=r(f,h,m,b,y,_);m.transmission>0?i.unshift(p):m.transparent===!0?s.unshift(p):n.unshift(p)}function d(f,h){n.length>1&&n.sort(f||Ck),i.length>1&&i.sort(h||Ph),s.length>1&&s.sort(h||Ph)}function u(){for(let f=e,h=t.length;f<h;f++){const m=t[f];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:n,transmissive:i,transparent:s,init:o,push:a,unshift:l,finish:u,sort:d}}function Ak(){let t=new WeakMap;function e(i,s){const o=t.get(i);let r;return o===void 0?(r=new Rh,t.set(i,[r])):s>=o.length?(r=new Rh,o.push(r)):r=o[s],r}function n(){t=new WeakMap}return{get:e,dispose:n}}function Pk(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new U,color:new at};break;case"SpotLight":n={position:new U,direction:new U,color:new at,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new U,color:new at,distance:0,decay:0};break;case"HemisphereLight":n={direction:new U,skyColor:new at,groundColor:new at};break;case"RectAreaLight":n={color:new at,position:new U,halfWidth:new U,halfHeight:new U};break}return t[e.id]=n,n}}}function Rk(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Dk=0;function Ik(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Lk(t){const e=new Pk,n=Rk(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)i.probe.push(new U);const s=new U,o=new Tt,r=new Tt;function a(d){let u=0,f=0,h=0;for(let E=0;E<9;E++)i.probe[E].set(0,0,0);let m=0,b=0,y=0,_=0,p=0,T=0,w=0,S=0,I=0,P=0,D=0;d.sort(Ik);for(let E=0,g=d.length;E<g;E++){const L=d[E],O=L.color,H=L.intensity,j=L.distance,re=L.shadow&&L.shadow.map?L.shadow.map.texture:null;if(L.isAmbientLight)u+=O.r*H,f+=O.g*H,h+=O.b*H;else if(L.isLightProbe){for(let q=0;q<9;q++)i.probe[q].addScaledVector(L.sh.coefficients[q],H);D++}else if(L.isDirectionalLight){const q=e.get(L);if(q.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const ae=L.shadow,G=n.get(L);G.shadowIntensity=ae.intensity,G.shadowBias=ae.bias,G.shadowNormalBias=ae.normalBias,G.shadowRadius=ae.radius,G.shadowMapSize=ae.mapSize,i.directionalShadow[m]=G,i.directionalShadowMap[m]=re,i.directionalShadowMatrix[m]=L.shadow.matrix,T++}i.directional[m]=q,m++}else if(L.isSpotLight){const q=e.get(L);q.position.setFromMatrixPosition(L.matrixWorld),q.color.copy(O).multiplyScalar(H),q.distance=j,q.coneCos=Math.cos(L.angle),q.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),q.decay=L.decay,i.spot[y]=q;const ae=L.shadow;if(L.map&&(i.spotLightMap[I]=L.map,I++,ae.updateMatrices(L),L.castShadow&&P++),i.spotLightMatrix[y]=ae.matrix,L.castShadow){const G=n.get(L);G.shadowIntensity=ae.intensity,G.shadowBias=ae.bias,G.shadowNormalBias=ae.normalBias,G.shadowRadius=ae.radius,G.shadowMapSize=ae.mapSize,i.spotShadow[y]=G,i.spotShadowMap[y]=re,S++}y++}else if(L.isRectAreaLight){const q=e.get(L);q.color.copy(O).multiplyScalar(H),q.halfWidth.set(L.width*.5,0,0),q.halfHeight.set(0,L.height*.5,0),i.rectArea[_]=q,_++}else if(L.isPointLight){const q=e.get(L);if(q.color.copy(L.color).multiplyScalar(L.intensity),q.distance=L.distance,q.decay=L.decay,L.castShadow){const ae=L.shadow,G=n.get(L);G.shadowIntensity=ae.intensity,G.shadowBias=ae.bias,G.shadowNormalBias=ae.normalBias,G.shadowRadius=ae.radius,G.shadowMapSize=ae.mapSize,G.shadowCameraNear=ae.camera.near,G.shadowCameraFar=ae.camera.far,i.pointShadow[b]=G,i.pointShadowMap[b]=re,i.pointShadowMatrix[b]=L.shadow.matrix,w++}i.point[b]=q,b++}else if(L.isHemisphereLight){const q=e.get(L);q.skyColor.copy(L.color).multiplyScalar(H),q.groundColor.copy(L.groundColor).multiplyScalar(H),i.hemi[p]=q,p++}}_>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=xe.LTC_FLOAT_1,i.rectAreaLTC2=xe.LTC_FLOAT_2):(i.rectAreaLTC1=xe.LTC_HALF_1,i.rectAreaLTC2=xe.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=f,i.ambient[2]=h;const R=i.hash;(R.directionalLength!==m||R.pointLength!==b||R.spotLength!==y||R.rectAreaLength!==_||R.hemiLength!==p||R.numDirectionalShadows!==T||R.numPointShadows!==w||R.numSpotShadows!==S||R.numSpotMaps!==I||R.numLightProbes!==D)&&(i.directional.length=m,i.spot.length=y,i.rectArea.length=_,i.point.length=b,i.hemi.length=p,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=w,i.pointShadowMap.length=w,i.spotShadow.length=S,i.spotShadowMap.length=S,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=w,i.spotLightMatrix.length=S+I-P,i.spotLightMap.length=I,i.numSpotLightShadowsWithMaps=P,i.numLightProbes=D,R.directionalLength=m,R.pointLength=b,R.spotLength=y,R.rectAreaLength=_,R.hemiLength=p,R.numDirectionalShadows=T,R.numPointShadows=w,R.numSpotShadows=S,R.numSpotMaps=I,R.numLightProbes=D,i.version=Dk++)}function l(d,u){let f=0,h=0,m=0,b=0,y=0;const _=u.matrixWorldInverse;for(let p=0,T=d.length;p<T;p++){const w=d[p];if(w.isDirectionalLight){const S=i.directional[f];S.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),S.direction.sub(s),S.direction.transformDirection(_),f++}else if(w.isSpotLight){const S=i.spot[m];S.position.setFromMatrixPosition(w.matrixWorld),S.position.applyMatrix4(_),S.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),S.direction.sub(s),S.direction.transformDirection(_),m++}else if(w.isRectAreaLight){const S=i.rectArea[b];S.position.setFromMatrixPosition(w.matrixWorld),S.position.applyMatrix4(_),r.identity(),o.copy(w.matrixWorld),o.premultiply(_),r.extractRotation(o),S.halfWidth.set(w.width*.5,0,0),S.halfHeight.set(0,w.height*.5,0),S.halfWidth.applyMatrix4(r),S.halfHeight.applyMatrix4(r),b++}else if(w.isPointLight){const S=i.point[h];S.position.setFromMatrixPosition(w.matrixWorld),S.position.applyMatrix4(_),h++}else if(w.isHemisphereLight){const S=i.hemi[y];S.direction.setFromMatrixPosition(w.matrixWorld),S.direction.transformDirection(_),y++}}}return{setup:a,setupView:l,state:i}}function Dh(t){const e=new Lk(t),n=[],i=[];function s(u){d.camera=u,n.length=0,i.length=0}function o(u){n.push(u)}function r(u){i.push(u)}function a(){e.setup(n)}function l(u){e.setupView(n,u)}const d={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:s,state:d,setupLights:a,setupLightsView:l,pushLight:o,pushShadow:r}}function Uk(t){let e=new WeakMap;function n(s,o=0){const r=e.get(s);let a;return r===void 0?(a=new Dh(t),e.set(s,[a])):o>=r.length?(a=new Dh(t),r.push(a)):a=r[o],a}function i(){e=new WeakMap}return{get:n,dispose:i}}const Fk=`void main() {
- gl_Position = vec4( position, 1.0 );
- }`,Ok=`uniform sampler2D shadow_pass;
- uniform vec2 resolution;
- uniform float radius;
- #include <packing>
- void main() {
- const float samples = float( VSM_SAMPLES );
- float mean = 0.0;
- float squared_mean = 0.0;
- float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
- float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
- for ( float i = 0.0; i < samples; i ++ ) {
- float uvOffset = uvStart + i * uvStride;
- #ifdef HORIZONTAL_PASS
- vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
- mean += distribution.x;
- squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
- #else
- float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
- mean += depth;
- squared_mean += depth * depth;
- #endif
- }
- mean = mean / samples;
- squared_mean = squared_mean / samples;
- float std_dev = sqrt( squared_mean - mean * mean );
- gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
- }`;function Nk(t,e,n){let i=new fd;const s=new Ke,o=new Ke,r=new It,a=new nF({depthPacking:KL}),l=new iF,d={},u=n.maxTextureSize,f={[Vi]:un,[un]:Vi,[Fn]:Fn},h=new Hi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ke},radius:{value:4}},vertexShader:Fk,fragmentShader:Ok}),m=h.clone();m.defines.HORIZONTAL_PASS=1;const b=new tn;b.setAttribute("position",new Jn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Ae(b,h),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=hp;let p=this.type;this.render=function(P,D,R){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||P.length===0)return;const E=t.getRenderTarget(),g=t.getActiveCubeFace(),L=t.getActiveMipmapLevel(),O=t.state;O.setBlending(Ni),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const H=p!==li&&this.type===li,j=p===li&&this.type!==li;for(let re=0,q=P.length;re<q;re++){const ae=P[re],G=ae.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",ae,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;s.copy(G.mapSize);const fe=G.getFrameExtents();if(s.multiply(fe),o.copy(G.mapSize),(s.x>u||s.y>u)&&(s.x>u&&(o.x=Math.floor(u/fe.x),s.x=o.x*fe.x,G.mapSize.x=o.x),s.y>u&&(o.y=Math.floor(u/fe.y),s.y=o.y*fe.y,G.mapSize.y=o.y)),G.map===null||H===!0||j===!0){const Re=this.type!==li?{minFilter:Bn,magFilter:Bn}:{};G.map!==null&&G.map.dispose(),G.map=new vs(s.x,s.y,Re),G.map.texture.name=ae.name+".shadowMap",G.camera.updateProjectionMatrix()}t.setRenderTarget(G.map),t.clear();const ye=G.getViewportCount();for(let Re=0;Re<ye;Re++){const Be=G.getViewport(Re);r.set(o.x*Be.x,o.y*Be.y,o.x*Be.z,o.y*Be.w),O.viewport(r),G.updateMatrices(ae,Re),i=G.getFrustum(),S(D,R,G.camera,ae,this.type)}G.isPointLightShadow!==!0&&this.type===li&&T(G,R),G.needsUpdate=!1}p=this.type,_.needsUpdate=!1,t.setRenderTarget(E,g,L)};function T(P,D){const R=e.update(y);h.defines.VSM_SAMPLES!==P.blurSamples&&(h.defines.VSM_SAMPLES=P.blurSamples,m.defines.VSM_SAMPLES=P.blurSamples,h.needsUpdate=!0,m.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new vs(s.x,s.y)),h.uniforms.shadow_pass.value=P.map.texture,h.uniforms.resolution.value=P.mapSize,h.uniforms.radius.value=P.radius,t.setRenderTarget(P.mapPass),t.clear(),t.renderBufferDirect(D,null,R,h,y,null),m.uniforms.shadow_pass.value=P.mapPass.texture,m.uniforms.resolution.value=P.mapSize,m.uniforms.radius.value=P.radius,t.setRenderTarget(P.map),t.clear(),t.renderBufferDirect(D,null,R,m,y,null)}function w(P,D,R,E){let g=null;const L=R.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(L!==void 0)g=L;else if(g=R.isPointLight===!0?l:a,t.localClippingEnabled&&D.clipShadows===!0&&Array.isArray(D.clippingPlanes)&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0||D.map&&D.alphaTest>0||D.alphaToCoverage===!0){const O=g.uuid,H=D.uuid;let j=d[O];j===void 0&&(j={},d[O]=j);let re=j[H];re===void 0&&(re=g.clone(),j[H]=re,D.addEventListener("dispose",I)),g=re}if(g.visible=D.visible,g.wireframe=D.wireframe,E===li?g.side=D.shadowSide!==null?D.shadowSide:D.side:g.side=D.shadowSide!==null?D.shadowSide:f[D.side],g.alphaMap=D.alphaMap,g.alphaTest=D.alphaToCoverage===!0?.5:D.alphaTest,g.map=D.map,g.clipShadows=D.clipShadows,g.clippingPlanes=D.clippingPlanes,g.clipIntersection=D.clipIntersection,g.displacementMap=D.displacementMap,g.displacementScale=D.displacementScale,g.displacementBias=D.displacementBias,g.wireframeLinewidth=D.wireframeLinewidth,g.linewidth=D.linewidth,R.isPointLight===!0&&g.isMeshDistanceMaterial===!0){const O=t.properties.get(g);O.light=R}return g}function S(P,D,R,E,g){if(P.visible===!1)return;if(P.layers.test(D.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&g===li)&&(!P.frustumCulled||i.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,P.matrixWorld);const H=e.update(P),j=P.material;if(Array.isArray(j)){const re=H.groups;for(let q=0,ae=re.length;q<ae;q++){const G=re[q],fe=j[G.materialIndex];if(fe&&fe.visible){const ye=w(P,fe,E,g);P.onBeforeShadow(t,P,D,R,H,ye,G),t.renderBufferDirect(R,null,H,ye,P,G),P.onAfterShadow(t,P,D,R,H,ye,G)}}}else if(j.visible){const re=w(P,j,E,g);P.onBeforeShadow(t,P,D,R,H,re,null),t.renderBufferDirect(R,null,H,re,P,null),P.onAfterShadow(t,P,D,R,H,re,null)}}const O=P.children;for(let H=0,j=O.length;H<j;H++)S(O[H],D,R,E,g)}function I(P){P.target.removeEventListener("dispose",I);for(const R in d){const E=d[R],g=P.target.uuid;g in E&&(E[g].dispose(),delete E[g])}}}const zk={[ql]:Zl,[Kl]:ec,[Jl]:tc,[so]:Ql,[Zl]:ql,[ec]:Kl,[tc]:Jl,[Ql]:so};function kk(t,e){function n(){let z=!1;const we=new It;let oe=null;const de=new It(0,0,0,0);return{setMask:function(Pe){oe!==Pe&&!z&&(t.colorMask(Pe,Pe,Pe,Pe),oe=Pe)},setLocked:function(Pe){z=Pe},setClear:function(Pe,Te,Qe,Rt,Yt){Yt===!0&&(Pe*=Rt,Te*=Rt,Qe*=Rt),we.set(Pe,Te,Qe,Rt),de.equals(we)===!1&&(t.clearColor(Pe,Te,Qe,Rt),de.copy(we))},reset:function(){z=!1,oe=null,de.set(-1,0,0,0)}}}function i(){let z=!1,we=!1,oe=null,de=null,Pe=null;return{setReversed:function(Te){if(we!==Te){const Qe=e.get("EXT_clip_control");Te?Qe.clipControlEXT(Qe.LOWER_LEFT_EXT,Qe.ZERO_TO_ONE_EXT):Qe.clipControlEXT(Qe.LOWER_LEFT_EXT,Qe.NEGATIVE_ONE_TO_ONE_EXT),we=Te;const Rt=Pe;Pe=null,this.setClear(Rt)}},getReversed:function(){return we},setTest:function(Te){Te?Y(t.DEPTH_TEST):ue(t.DEPTH_TEST)},setMask:function(Te){oe!==Te&&!z&&(t.depthMask(Te),oe=Te)},setFunc:function(Te){if(we&&(Te=zk[Te]),de!==Te){switch(Te){case ql:t.depthFunc(t.NEVER);break;case Zl:t.depthFunc(t.ALWAYS);break;case Kl:t.depthFunc(t.LESS);break;case so:t.depthFunc(t.LEQUAL);break;case Jl:t.depthFunc(t.EQUAL);break;case Ql:t.depthFunc(t.GEQUAL);break;case ec:t.depthFunc(t.GREATER);break;case tc:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}de=Te}},setLocked:function(Te){z=Te},setClear:function(Te){Pe!==Te&&(we&&(Te=1-Te),t.clearDepth(Te),Pe=Te)},reset:function(){z=!1,oe=null,de=null,Pe=null,we=!1}}}function s(){let z=!1,we=null,oe=null,de=null,Pe=null,Te=null,Qe=null,Rt=null,Yt=null;return{setTest:function(vt){z||(vt?Y(t.STENCIL_TEST):ue(t.STENCIL_TEST))},setMask:function(vt){we!==vt&&!z&&(t.stencilMask(vt),we=vt)},setFunc:function(vt,Cn,ti){(oe!==vt||de!==Cn||Pe!==ti)&&(t.stencilFunc(vt,Cn,ti),oe=vt,de=Cn,Pe=ti)},setOp:function(vt,Cn,ti){(Te!==vt||Qe!==Cn||Rt!==ti)&&(t.stencilOp(vt,Cn,ti),Te=vt,Qe=Cn,Rt=ti)},setLocked:function(vt){z=vt},setClear:function(vt){Yt!==vt&&(t.clearStencil(vt),Yt=vt)},reset:function(){z=!1,we=null,oe=null,de=null,Pe=null,Te=null,Qe=null,Rt=null,Yt=null}}}const o=new n,r=new i,a=new s,l=new WeakMap,d=new WeakMap;let u={},f={},h=new WeakMap,m=[],b=null,y=!1,_=null,p=null,T=null,w=null,S=null,I=null,P=null,D=new at(0,0,0),R=0,E=!1,g=null,L=null,O=null,H=null,j=null;const re=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,ae=0;const G=t.getParameter(t.VERSION);G.indexOf("WebGL")!==-1?(ae=parseFloat(/^WebGL (\d)/.exec(G)[1]),q=ae>=1):G.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),q=ae>=2);let fe=null,ye={};const Re=t.getParameter(t.SCISSOR_BOX),Be=t.getParameter(t.VIEWPORT),Je=new It().fromArray(Re),ce=new It().fromArray(Be);function N(z,we,oe,de){const Pe=new Uint8Array(4),Te=t.createTexture();t.bindTexture(z,Te),t.texParameteri(z,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(z,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Qe=0;Qe<oe;Qe++)z===t.TEXTURE_3D||z===t.TEXTURE_2D_ARRAY?t.texImage3D(we,0,t.RGBA,1,1,de,0,t.RGBA,t.UNSIGNED_BYTE,Pe):t.texImage2D(we+Qe,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Pe);return Te}const le={};le[t.TEXTURE_2D]=N(t.TEXTURE_2D,t.TEXTURE_2D,1),le[t.TEXTURE_CUBE_MAP]=N(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),le[t.TEXTURE_2D_ARRAY]=N(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),le[t.TEXTURE_3D]=N(t.TEXTURE_3D,t.TEXTURE_3D,1,1),o.setClear(0,0,0,1),r.setClear(1),a.setClear(0),Y(t.DEPTH_TEST),r.setFunc(so),ie(!1),te(Cu),Y(t.CULL_FACE),x(Ni);function Y(z){u[z]!==!0&&(t.enable(z),u[z]=!0)}function ue(z){u[z]!==!1&&(t.disable(z),u[z]=!1)}function Oe(z,we){return f[z]!==we?(t.bindFramebuffer(z,we),f[z]=we,z===t.DRAW_FRAMEBUFFER&&(f[t.FRAMEBUFFER]=we),z===t.FRAMEBUFFER&&(f[t.DRAW_FRAMEBUFFER]=we),!0):!1}function Se(z,we){let oe=m,de=!1;if(z){oe=h.get(we),oe===void 0&&(oe=[],h.set(we,oe));const Pe=z.textures;if(oe.length!==Pe.length||oe[0]!==t.COLOR_ATTACHMENT0){for(let Te=0,Qe=Pe.length;Te<Qe;Te++)oe[Te]=t.COLOR_ATTACHMENT0+Te;oe.length=Pe.length,de=!0}}else oe[0]!==t.BACK&&(oe[0]=t.BACK,de=!0);de&&t.drawBuffers(oe)}function Ne(z){return b!==z?(t.useProgram(z),b=z,!0):!1}const Ue={[ls]:t.FUNC_ADD,[ML]:t.FUNC_SUBTRACT,[EL]:t.FUNC_REVERSE_SUBTRACT};Ue[wL]=t.MIN,Ue[TL]=t.MAX;const A={[CL]:t.ZERO,[AL]:t.ONE,[PL]:t.SRC_COLOR,[jl]:t.SRC_ALPHA,[FL]:t.SRC_ALPHA_SATURATE,[LL]:t.DST_COLOR,[DL]:t.DST_ALPHA,[RL]:t.ONE_MINUS_SRC_COLOR,[Yl]:t.ONE_MINUS_SRC_ALPHA,[UL]:t.ONE_MINUS_DST_COLOR,[IL]:t.ONE_MINUS_DST_ALPHA,[OL]:t.CONSTANT_COLOR,[NL]:t.ONE_MINUS_CONSTANT_COLOR,[zL]:t.CONSTANT_ALPHA,[kL]:t.ONE_MINUS_CONSTANT_ALPHA};function x(z,we,oe,de,Pe,Te,Qe,Rt,Yt,vt){if(z===Ni){y===!0&&(ue(t.BLEND),y=!1);return}if(y===!1&&(Y(t.BLEND),y=!0),z!==SL){if(z!==_||vt!==E){if((p!==ls||S!==ls)&&(t.blendEquation(t.FUNC_ADD),p=ls,S=ls),vt)switch(z){case Ks:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Au:t.blendFunc(t.ONE,t.ONE);break;case Pu:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Ru:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",z);break}else switch(z){case Ks:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Au:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case Pu:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Ru:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",z);break}T=null,w=null,I=null,P=null,D.set(0,0,0),R=0,_=z,E=vt}return}Pe=Pe||we,Te=Te||oe,Qe=Qe||de,(we!==p||Pe!==S)&&(t.blendEquationSeparate(Ue[we],Ue[Pe]),p=we,S=Pe),(oe!==T||de!==w||Te!==I||Qe!==P)&&(t.blendFuncSeparate(A[oe],A[de],A[Te],A[Qe]),T=oe,w=de,I=Te,P=Qe),(Rt.equals(D)===!1||Yt!==R)&&(t.blendColor(Rt.r,Rt.g,Rt.b,Yt),D.copy(Rt),R=Yt),_=z,E=!1}function Z(z,we){z.side===Fn?ue(t.CULL_FACE):Y(t.CULL_FACE);let oe=z.side===un;we&&(oe=!oe),ie(oe),z.blending===Ks&&z.transparent===!1?x(Ni):x(z.blending,z.blendEquation,z.blendSrc,z.blendDst,z.blendEquationAlpha,z.blendSrcAlpha,z.blendDstAlpha,z.blendColor,z.blendAlpha,z.premultipliedAlpha),r.setFunc(z.depthFunc),r.setTest(z.depthTest),r.setMask(z.depthWrite),o.setMask(z.colorWrite);const de=z.stencilWrite;a.setTest(de),de&&(a.setMask(z.stencilWriteMask),a.setFunc(z.stencilFunc,z.stencilRef,z.stencilFuncMask),a.setOp(z.stencilFail,z.stencilZFail,z.stencilZPass)),me(z.polygonOffset,z.polygonOffsetFactor,z.polygonOffsetUnits),z.alphaToCoverage===!0?Y(t.SAMPLE_ALPHA_TO_COVERAGE):ue(t.SAMPLE_ALPHA_TO_COVERAGE)}function ie(z){g!==z&&(z?t.frontFace(t.CW):t.frontFace(t.CCW),g=z)}function te(z){z!==bL?(Y(t.CULL_FACE),z!==L&&(z===Cu?t.cullFace(t.BACK):z===yL?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):ue(t.CULL_FACE),L=z}function ne(z){z!==O&&(q&&t.lineWidth(z),O=z)}function me(z,we,oe){z?(Y(t.POLYGON_OFFSET_FILL),(H!==we||j!==oe)&&(t.polygonOffset(we,oe),H=we,j=oe)):ue(t.POLYGON_OFFSET_FILL)}function Q(z){z?Y(t.SCISSOR_TEST):ue(t.SCISSOR_TEST)}function M(z){z===void 0&&(z=t.TEXTURE0+re-1),fe!==z&&(t.activeTexture(z),fe=z)}function v(z,we,oe){oe===void 0&&(fe===null?oe=t.TEXTURE0+re-1:oe=fe);let de=ye[oe];de===void 0&&(de={type:void 0,texture:void 0},ye[oe]=de),(de.type!==z||de.texture!==we)&&(fe!==oe&&(t.activeTexture(oe),fe=oe),t.bindTexture(z,we||le[z]),de.type=z,de.texture=we)}function F(){const z=ye[fe];z!==void 0&&z.type!==void 0&&(t.bindTexture(z.type,null),z.type=void 0,z.texture=void 0)}function B(){try{t.compressedTexImage2D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function X(){try{t.compressedTexImage3D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function $(){try{t.texSubImage2D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function ge(){try{t.texSubImage3D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function pe(){try{t.compressedTexSubImage2D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function be(){try{t.compressedTexSubImage3D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function Me(){try{t.texStorage2D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function he(){try{t.texStorage3D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function Ce(){try{t.texImage2D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function Xe(){try{t.texImage3D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function $e(z){Je.equals(z)===!1&&(t.scissor(z.x,z.y,z.z,z.w),Je.copy(z))}function De(z){ce.equals(z)===!1&&(t.viewport(z.x,z.y,z.z,z.w),ce.copy(z))}function Ye(z,we){let oe=d.get(we);oe===void 0&&(oe=new WeakMap,d.set(we,oe));let de=oe.get(z);de===void 0&&(de=t.getUniformBlockIndex(we,z.name),oe.set(z,de))}function Ge(z,we){const de=d.get(we).get(z);l.get(we)!==de&&(t.uniformBlockBinding(we,de,z.__bindingPointIndex),l.set(we,de))}function gt(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),r.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),u={},fe=null,ye={},f={},h=new WeakMap,m=[],b=null,y=!1,_=null,p=null,T=null,w=null,S=null,I=null,P=null,D=new at(0,0,0),R=0,E=!1,g=null,L=null,O=null,H=null,j=null,Je.set(0,0,t.canvas.width,t.canvas.height),ce.set(0,0,t.canvas.width,t.canvas.height),o.reset(),r.reset(),a.reset()}return{buffers:{color:o,depth:r,stencil:a},enable:Y,disable:ue,bindFramebuffer:Oe,drawBuffers:Se,useProgram:Ne,setBlending:x,setMaterial:Z,setFlipSided:ie,setCullFace:te,setLineWidth:ne,setPolygonOffset:me,setScissorTest:Q,activeTexture:M,bindTexture:v,unbindTexture:F,compressedTexImage2D:B,compressedTexImage3D:X,texImage2D:Ce,texImage3D:Xe,updateUBOMapping:Ye,uniformBlockBinding:Ge,texStorage2D:Me,texStorage3D:he,texSubImage2D:$,texSubImage3D:ge,compressedTexSubImage2D:pe,compressedTexSubImage3D:be,scissor:$e,viewport:De,reset:gt}}function Bk(t,e,n,i,s,o,r){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new Ke,u=new WeakMap;let f;const h=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(M,v){return m?new OffscreenCanvas(M,v):ma("canvas")}function y(M,v,F){let B=1;const X=Q(M);if((X.width>F||X.height>F)&&(B=F/Math.max(X.width,X.height)),B<1)if(typeof HTMLImageElement!="undefined"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&M instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&M instanceof ImageBitmap||typeof VideoFrame!="undefined"&&M instanceof VideoFrame){const $=Math.floor(B*X.width),ge=Math.floor(B*X.height);f===void 0&&(f=b($,ge));const pe=v?b($,ge):f;return pe.width=$,pe.height=ge,pe.getContext("2d").drawImage(M,0,0,$,ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+X.width+"x"+X.height+") to ("+$+"x"+ge+")."),pe}else return"data"in M&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+X.width+"x"+X.height+")."),M;return M}function _(M){return M.generateMipmaps}function p(M){t.generateMipmap(M)}function T(M){return M.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:M.isWebGL3DRenderTarget?t.TEXTURE_3D:M.isWebGLArrayRenderTarget||M.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function w(M,v,F,B,X=!1){if(M!==null){if(t[M]!==void 0)return t[M];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let $=v;if(v===t.RED&&(F===t.FLOAT&&($=t.R32F),F===t.HALF_FLOAT&&($=t.R16F),F===t.UNSIGNED_BYTE&&($=t.R8)),v===t.RED_INTEGER&&(F===t.UNSIGNED_BYTE&&($=t.R8UI),F===t.UNSIGNED_SHORT&&($=t.R16UI),F===t.UNSIGNED_INT&&($=t.R32UI),F===t.BYTE&&($=t.R8I),F===t.SHORT&&($=t.R16I),F===t.INT&&($=t.R32I)),v===t.RG&&(F===t.FLOAT&&($=t.RG32F),F===t.HALF_FLOAT&&($=t.RG16F),F===t.UNSIGNED_BYTE&&($=t.RG8)),v===t.RG_INTEGER&&(F===t.UNSIGNED_BYTE&&($=t.RG8UI),F===t.UNSIGNED_SHORT&&($=t.RG16UI),F===t.UNSIGNED_INT&&($=t.RG32UI),F===t.BYTE&&($=t.RG8I),F===t.SHORT&&($=t.RG16I),F===t.INT&&($=t.RG32I)),v===t.RGB_INTEGER&&(F===t.UNSIGNED_BYTE&&($=t.RGB8UI),F===t.UNSIGNED_SHORT&&($=t.RGB16UI),F===t.UNSIGNED_INT&&($=t.RGB32UI),F===t.BYTE&&($=t.RGB8I),F===t.SHORT&&($=t.RGB16I),F===t.INT&&($=t.RGB32I)),v===t.RGBA_INTEGER&&(F===t.UNSIGNED_BYTE&&($=t.RGBA8UI),F===t.UNSIGNED_SHORT&&($=t.RGBA16UI),F===t.UNSIGNED_INT&&($=t.RGBA32UI),F===t.BYTE&&($=t.RGBA8I),F===t.SHORT&&($=t.RGBA16I),F===t.INT&&($=t.RGBA32I)),v===t.RGB&&F===t.UNSIGNED_INT_5_9_9_9_REV&&($=t.RGB9_E5),v===t.RGBA){const ge=X?fa:ft.getTransfer(B);F===t.FLOAT&&($=t.RGBA32F),F===t.HALF_FLOAT&&($=t.RGBA16F),F===t.UNSIGNED_BYTE&&($=ge===bt?t.SRGB8_ALPHA8:t.RGBA8),F===t.UNSIGNED_SHORT_4_4_4_4&&($=t.RGBA4),F===t.UNSIGNED_SHORT_5_5_5_1&&($=t.RGB5_A1)}return($===t.R16F||$===t.R32F||$===t.RG16F||$===t.RG32F||$===t.RGBA16F||$===t.RGBA32F)&&e.get("EXT_color_buffer_float"),$}function S(M,v){let F;return M?v===null||v===gs||v===or?F=t.DEPTH24_STENCIL8:v===ui?F=t.DEPTH32F_STENCIL8:v===sr&&(F=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===gs||v===or?F=t.DEPTH_COMPONENT24:v===ui?F=t.DEPTH_COMPONENT32F:v===sr&&(F=t.DEPTH_COMPONENT16),F}function I(M,v){return _(M)===!0||M.isFramebufferTexture&&M.minFilter!==Bn&&M.minFilter!==qn?Math.log2(Math.max(v.width,v.height))+1:M.mipmaps!==void 0&&M.mipmaps.length>0?M.mipmaps.length:M.isCompressedTexture&&Array.isArray(M.image)?v.mipmaps.length:1}function P(M){const v=M.target;v.removeEventListener("dispose",P),R(v),v.isVideoTexture&&u.delete(v)}function D(M){const v=M.target;v.removeEventListener("dispose",D),g(v)}function R(M){const v=i.get(M);if(v.__webglInit===void 0)return;const F=M.source,B=h.get(F);if(B){const X=B[v.__cacheKey];X.usedTimes--,X.usedTimes===0&&E(M),Object.keys(B).length===0&&h.delete(F)}i.remove(M)}function E(M){const v=i.get(M);t.deleteTexture(v.__webglTexture);const F=M.source,B=h.get(F);delete B[v.__cacheKey],r.memory.textures--}function g(M){const v=i.get(M);if(M.depthTexture&&(M.depthTexture.dispose(),i.remove(M.depthTexture)),M.isWebGLCubeRenderTarget)for(let B=0;B<6;B++){if(Array.isArray(v.__webglFramebuffer[B]))for(let X=0;X<v.__webglFramebuffer[B].length;X++)t.deleteFramebuffer(v.__webglFramebuffer[B][X]);else t.deleteFramebuffer(v.__webglFramebuffer[B]);v.__webglDepthbuffer&&t.deleteRenderbuffer(v.__webglDepthbuffer[B])}else{if(Array.isArray(v.__webglFramebuffer))for(let B=0;B<v.__webglFramebuffer.length;B++)t.deleteFramebuffer(v.__webglFramebuffer[B]);else t.deleteFramebuffer(v.__webglFramebuffer);if(v.__webglDepthbuffer&&t.deleteRenderbuffer(v.__webglDepthbuffer),v.__webglMultisampledFramebuffer&&t.deleteFramebuffer(v.__webglMultisampledFramebuffer),v.__webglColorRenderbuffer)for(let B=0;B<v.__webglColorRenderbuffer.length;B++)v.__webglColorRenderbuffer[B]&&t.deleteRenderbuffer(v.__webglColorRenderbuffer[B]);v.__webglDepthRenderbuffer&&t.deleteRenderbuffer(v.__webglDepthRenderbuffer)}const F=M.textures;for(let B=0,X=F.length;B<X;B++){const $=i.get(F[B]);$.__webglTexture&&(t.deleteTexture($.__webglTexture),r.memory.textures--),i.remove(F[B])}i.remove(M)}let L=0;function O(){L=0}function H(){const M=L;return M>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+s.maxTextures),L+=1,M}function j(M){const v=[];return v.push(M.wrapS),v.push(M.wrapT),v.push(M.wrapR||0),v.push(M.magFilter),v.push(M.minFilter),v.push(M.anisotropy),v.push(M.internalFormat),v.push(M.format),v.push(M.type),v.push(M.generateMipmaps),v.push(M.premultiplyAlpha),v.push(M.flipY),v.push(M.unpackAlignment),v.push(M.colorSpace),v.join()}function re(M,v){const F=i.get(M);if(M.isVideoTexture&&ne(M),M.isRenderTargetTexture===!1&&M.version>0&&F.__version!==M.version){const B=M.image;if(B===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(B.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ce(F,M,v);return}}n.bindTexture(t.TEXTURE_2D,F.__webglTexture,t.TEXTURE0+v)}function q(M,v){const F=i.get(M);if(M.version>0&&F.__version!==M.version){ce(F,M,v);return}n.bindTexture(t.TEXTURE_2D_ARRAY,F.__webglTexture,t.TEXTURE0+v)}function ae(M,v){const F=i.get(M);if(M.version>0&&F.__version!==M.version){ce(F,M,v);return}n.bindTexture(t.TEXTURE_3D,F.__webglTexture,t.TEXTURE0+v)}function G(M,v){const F=i.get(M);if(M.version>0&&F.__version!==M.version){N(F,M,v);return}n.bindTexture(t.TEXTURE_CUBE_MAP,F.__webglTexture,t.TEXTURE0+v)}const fe={[sc]:t.REPEAT,[hs]:t.CLAMP_TO_EDGE,[oc]:t.MIRRORED_REPEAT},ye={[Bn]:t.NEAREST,[qL]:t.NEAREST_MIPMAP_NEAREST,[xr]:t.NEAREST_MIPMAP_LINEAR,[qn]:t.LINEAR,[qa]:t.LINEAR_MIPMAP_NEAREST,[fs]:t.LINEAR_MIPMAP_LINEAR},Re={[QL]:t.NEVER,[oU]:t.ALWAYS,[eU]:t.LESS,[Mp]:t.LEQUAL,[tU]:t.EQUAL,[sU]:t.GEQUAL,[nU]:t.GREATER,[iU]:t.NOTEQUAL};function Be(M,v){if(v.type===ui&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===qn||v.magFilter===qa||v.magFilter===xr||v.magFilter===fs||v.minFilter===qn||v.minFilter===qa||v.minFilter===xr||v.minFilter===fs)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(M,t.TEXTURE_WRAP_S,fe[v.wrapS]),t.texParameteri(M,t.TEXTURE_WRAP_T,fe[v.wrapT]),(M===t.TEXTURE_3D||M===t.TEXTURE_2D_ARRAY)&&t.texParameteri(M,t.TEXTURE_WRAP_R,fe[v.wrapR]),t.texParameteri(M,t.TEXTURE_MAG_FILTER,ye[v.magFilter]),t.texParameteri(M,t.TEXTURE_MIN_FILTER,ye[v.minFilter]),v.compareFunction&&(t.texParameteri(M,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(M,t.TEXTURE_COMPARE_FUNC,Re[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Bn||v.minFilter!==xr&&v.minFilter!==fs||v.type===ui&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||i.get(v).__currentAnisotropy){const F=e.get("EXT_texture_filter_anisotropic");t.texParameterf(M,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,s.getMaxAnisotropy())),i.get(v).__currentAnisotropy=v.anisotropy}}}function Je(M,v){let F=!1;M.__webglInit===void 0&&(M.__webglInit=!0,v.addEventListener("dispose",P));const B=v.source;let X=h.get(B);X===void 0&&(X={},h.set(B,X));const $=j(v);if($!==M.__cacheKey){X[$]===void 0&&(X[$]={texture:t.createTexture(),usedTimes:0},r.memory.textures++,F=!0),X[$].usedTimes++;const ge=X[M.__cacheKey];ge!==void 0&&(X[M.__cacheKey].usedTimes--,ge.usedTimes===0&&E(v)),M.__cacheKey=$,M.__webglTexture=X[$].texture}return F}function ce(M,v,F){let B=t.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(B=t.TEXTURE_2D_ARRAY),v.isData3DTexture&&(B=t.TEXTURE_3D);const X=Je(M,v),$=v.source;n.bindTexture(B,M.__webglTexture,t.TEXTURE0+F);const ge=i.get($);if($.version!==ge.__version||X===!0){n.activeTexture(t.TEXTURE0+F);const pe=ft.getPrimaries(ft.workingColorSpace),be=v.colorSpace===Li?null:ft.getPrimaries(v.colorSpace),Me=v.colorSpace===Li||pe===be?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,v.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,v.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Me);let he=y(v.image,!1,s.maxTextureSize);he=me(v,he);const Ce=o.convert(v.format,v.colorSpace),Xe=o.convert(v.type);let $e=w(v.internalFormat,Ce,Xe,v.colorSpace,v.isVideoTexture);Be(B,v);let De;const Ye=v.mipmaps,Ge=v.isVideoTexture!==!0,gt=ge.__version===void 0||X===!0,z=$.dataReady,we=I(v,he);if(v.isDepthTexture)$e=S(v.format===ar,v.type),gt&&(Ge?n.texStorage2D(t.TEXTURE_2D,1,$e,he.width,he.height):n.texImage2D(t.TEXTURE_2D,0,$e,he.width,he.height,0,Ce,Xe,null));else if(v.isDataTexture)if(Ye.length>0){Ge&>&&n.texStorage2D(t.TEXTURE_2D,we,$e,Ye[0].width,Ye[0].height);for(let oe=0,de=Ye.length;oe<de;oe++)De=Ye[oe],Ge?z&&n.texSubImage2D(t.TEXTURE_2D,oe,0,0,De.width,De.height,Ce,Xe,De.data):n.texImage2D(t.TEXTURE_2D,oe,$e,De.width,De.height,0,Ce,Xe,De.data);v.generateMipmaps=!1}else Ge?(gt&&n.texStorage2D(t.TEXTURE_2D,we,$e,he.width,he.height),z&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,he.width,he.height,Ce,Xe,he.data)):n.texImage2D(t.TEXTURE_2D,0,$e,he.width,he.height,0,Ce,Xe,he.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){Ge&>&&n.texStorage3D(t.TEXTURE_2D_ARRAY,we,$e,Ye[0].width,Ye[0].height,he.depth);for(let oe=0,de=Ye.length;oe<de;oe++)if(De=Ye[oe],v.format!==zn)if(Ce!==null)if(Ge){if(z)if(v.layerUpdates.size>0){const Pe=ah(De.width,De.height,v.format,v.type);for(const Te of v.layerUpdates){const Qe=De.data.subarray(Te*Pe/De.data.BYTES_PER_ELEMENT,(Te+1)*Pe/De.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,Te,De.width,De.height,1,Ce,Qe)}v.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,0,De.width,De.height,he.depth,Ce,De.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,oe,$e,De.width,De.height,he.depth,0,De.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ge?z&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,0,De.width,De.height,he.depth,Ce,Xe,De.data):n.texImage3D(t.TEXTURE_2D_ARRAY,oe,$e,De.width,De.height,he.depth,0,Ce,Xe,De.data)}else{Ge&>&&n.texStorage2D(t.TEXTURE_2D,we,$e,Ye[0].width,Ye[0].height);for(let oe=0,de=Ye.length;oe<de;oe++)De=Ye[oe],v.format!==zn?Ce!==null?Ge?z&&n.compressedTexSubImage2D(t.TEXTURE_2D,oe,0,0,De.width,De.height,Ce,De.data):n.compressedTexImage2D(t.TEXTURE_2D,oe,$e,De.width,De.height,0,De.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ge?z&&n.texSubImage2D(t.TEXTURE_2D,oe,0,0,De.width,De.height,Ce,Xe,De.data):n.texImage2D(t.TEXTURE_2D,oe,$e,De.width,De.height,0,Ce,Xe,De.data)}else if(v.isDataArrayTexture)if(Ge){if(gt&&n.texStorage3D(t.TEXTURE_2D_ARRAY,we,$e,he.width,he.height,he.depth),z)if(v.layerUpdates.size>0){const oe=ah(he.width,he.height,v.format,v.type);for(const de of v.layerUpdates){const Pe=he.data.subarray(de*oe/he.data.BYTES_PER_ELEMENT,(de+1)*oe/he.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,de,he.width,he.height,1,Ce,Xe,Pe)}v.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,he.width,he.height,he.depth,Ce,Xe,he.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,$e,he.width,he.height,he.depth,0,Ce,Xe,he.data);else if(v.isData3DTexture)Ge?(gt&&n.texStorage3D(t.TEXTURE_3D,we,$e,he.width,he.height,he.depth),z&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,he.width,he.height,he.depth,Ce,Xe,he.data)):n.texImage3D(t.TEXTURE_3D,0,$e,he.width,he.height,he.depth,0,Ce,Xe,he.data);else if(v.isFramebufferTexture){if(gt)if(Ge)n.texStorage2D(t.TEXTURE_2D,we,$e,he.width,he.height);else{let oe=he.width,de=he.height;for(let Pe=0;Pe<we;Pe++)n.texImage2D(t.TEXTURE_2D,Pe,$e,oe,de,0,Ce,Xe,null),oe>>=1,de>>=1}}else if(Ye.length>0){if(Ge&>){const oe=Q(Ye[0]);n.texStorage2D(t.TEXTURE_2D,we,$e,oe.width,oe.height)}for(let oe=0,de=Ye.length;oe<de;oe++)De=Ye[oe],Ge?z&&n.texSubImage2D(t.TEXTURE_2D,oe,0,0,Ce,Xe,De):n.texImage2D(t.TEXTURE_2D,oe,$e,Ce,Xe,De);v.generateMipmaps=!1}else if(Ge){if(gt){const oe=Q(he);n.texStorage2D(t.TEXTURE_2D,we,$e,oe.width,oe.height)}z&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Ce,Xe,he)}else n.texImage2D(t.TEXTURE_2D,0,$e,Ce,Xe,he);_(v)&&p(B),ge.__version=$.version,v.onUpdate&&v.onUpdate(v)}M.__version=v.version}function N(M,v,F){if(v.image.length!==6)return;const B=Je(M,v),X=v.source;n.bindTexture(t.TEXTURE_CUBE_MAP,M.__webglTexture,t.TEXTURE0+F);const $=i.get(X);if(X.version!==$.__version||B===!0){n.activeTexture(t.TEXTURE0+F);const ge=ft.getPrimaries(ft.workingColorSpace),pe=v.colorSpace===Li?null:ft.getPrimaries(v.colorSpace),be=v.colorSpace===Li||ge===pe?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,v.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,v.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,be);const Me=v.isCompressedTexture||v.image[0].isCompressedTexture,he=v.image[0]&&v.image[0].isDataTexture,Ce=[];for(let de=0;de<6;de++)!Me&&!he?Ce[de]=y(v.image[de],!0,s.maxCubemapSize):Ce[de]=he?v.image[de].image:v.image[de],Ce[de]=me(v,Ce[de]);const Xe=Ce[0],$e=o.convert(v.format,v.colorSpace),De=o.convert(v.type),Ye=w(v.internalFormat,$e,De,v.colorSpace),Ge=v.isVideoTexture!==!0,gt=$.__version===void 0||B===!0,z=X.dataReady;let we=I(v,Xe);Be(t.TEXTURE_CUBE_MAP,v);let oe;if(Me){Ge&>&&n.texStorage2D(t.TEXTURE_CUBE_MAP,we,Ye,Xe.width,Xe.height);for(let de=0;de<6;de++){oe=Ce[de].mipmaps;for(let Pe=0;Pe<oe.length;Pe++){const Te=oe[Pe];v.format!==zn?$e!==null?Ge?z&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Pe,0,0,Te.width,Te.height,$e,Te.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Pe,Ye,Te.width,Te.height,0,Te.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Pe,0,0,Te.width,Te.height,$e,De,Te.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Pe,Ye,Te.width,Te.height,0,$e,De,Te.data)}}}else{if(oe=v.mipmaps,Ge&>){oe.length>0&&we++;const de=Q(Ce[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,we,Ye,de.width,de.height)}for(let de=0;de<6;de++)if(he){Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,Ce[de].width,Ce[de].height,$e,De,Ce[de].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,Ye,Ce[de].width,Ce[de].height,0,$e,De,Ce[de].data);for(let Pe=0;Pe<oe.length;Pe++){const Qe=oe[Pe].image[de].image;Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Pe+1,0,0,Qe.width,Qe.height,$e,De,Qe.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Pe+1,Ye,Qe.width,Qe.height,0,$e,De,Qe.data)}}else{Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,$e,De,Ce[de]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,Ye,$e,De,Ce[de]);for(let Pe=0;Pe<oe.length;Pe++){const Te=oe[Pe];Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Pe+1,0,0,$e,De,Te.image[de]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Pe+1,Ye,$e,De,Te.image[de])}}}_(v)&&p(t.TEXTURE_CUBE_MAP),$.__version=X.version,v.onUpdate&&v.onUpdate(v)}M.__version=v.version}function le(M,v,F,B,X,$){const ge=o.convert(F.format,F.colorSpace),pe=o.convert(F.type),be=w(F.internalFormat,ge,pe,F.colorSpace),Me=i.get(v),he=i.get(F);if(he.__renderTarget=v,!Me.__hasExternalTextures){const Ce=Math.max(1,v.width>>$),Xe=Math.max(1,v.height>>$);X===t.TEXTURE_3D||X===t.TEXTURE_2D_ARRAY?n.texImage3D(X,$,be,Ce,Xe,v.depth,0,ge,pe,null):n.texImage2D(X,$,be,Ce,Xe,0,ge,pe,null)}n.bindFramebuffer(t.FRAMEBUFFER,M),te(v)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,B,X,he.__webglTexture,0,ie(v)):(X===t.TEXTURE_2D||X>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&X<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,B,X,he.__webglTexture,$),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Y(M,v,F){if(t.bindRenderbuffer(t.RENDERBUFFER,M),v.depthBuffer){const B=v.depthTexture,X=B&&B.isDepthTexture?B.type:null,$=S(v.stencilBuffer,X),ge=v.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,pe=ie(v);te(v)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,pe,$,v.width,v.height):F?t.renderbufferStorageMultisample(t.RENDERBUFFER,pe,$,v.width,v.height):t.renderbufferStorage(t.RENDERBUFFER,$,v.width,v.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,ge,t.RENDERBUFFER,M)}else{const B=v.textures;for(let X=0;X<B.length;X++){const $=B[X],ge=o.convert($.format,$.colorSpace),pe=o.convert($.type),be=w($.internalFormat,ge,pe,$.colorSpace),Me=ie(v);F&&te(v)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Me,be,v.width,v.height):te(v)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Me,be,v.width,v.height):t.renderbufferStorage(t.RENDERBUFFER,be,v.width,v.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function ue(M,v){if(v&&v.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,M),!(v.depthTexture&&v.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const B=i.get(v.depthTexture);B.__renderTarget=v,(!B.__webglTexture||v.depthTexture.image.width!==v.width||v.depthTexture.image.height!==v.height)&&(v.depthTexture.image.width=v.width,v.depthTexture.image.height=v.height,v.depthTexture.needsUpdate=!0),re(v.depthTexture,0);const X=B.__webglTexture,$=ie(v);if(v.depthTexture.format===rr)te(v)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,X,0,$):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,X,0);else if(v.depthTexture.format===ar)te(v)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,X,0,$):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,X,0);else throw new Error("Unknown depthTexture format")}function Oe(M){const v=i.get(M),F=M.isWebGLCubeRenderTarget===!0;if(v.__boundDepthTexture!==M.depthTexture){const B=M.depthTexture;if(v.__depthDisposeCallback&&v.__depthDisposeCallback(),B){const X=()=>{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,B.removeEventListener("dispose",X)};B.addEventListener("dispose",X),v.__depthDisposeCallback=X}v.__boundDepthTexture=B}if(M.depthTexture&&!v.__autoAllocateDepthBuffer){if(F)throw new Error("target.depthTexture not supported in Cube render targets");const B=M.texture.mipmaps;B&&B.length>0?ue(v.__webglFramebuffer[0],M):ue(v.__webglFramebuffer,M)}else if(F){v.__webglDepthbuffer=[];for(let B=0;B<6;B++)if(n.bindFramebuffer(t.FRAMEBUFFER,v.__webglFramebuffer[B]),v.__webglDepthbuffer[B]===void 0)v.__webglDepthbuffer[B]=t.createRenderbuffer(),Y(v.__webglDepthbuffer[B],M,!1);else{const X=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,$=v.__webglDepthbuffer[B];t.bindRenderbuffer(t.RENDERBUFFER,$),t.framebufferRenderbuffer(t.FRAMEBUFFER,X,t.RENDERBUFFER,$)}}else{const B=M.texture.mipmaps;if(B&&B.length>0?n.bindFramebuffer(t.FRAMEBUFFER,v.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=t.createRenderbuffer(),Y(v.__webglDepthbuffer,M,!1);else{const X=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,$=v.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,$),t.framebufferRenderbuffer(t.FRAMEBUFFER,X,t.RENDERBUFFER,$)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Se(M,v,F){const B=i.get(M);v!==void 0&&le(B.__webglFramebuffer,M,M.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),F!==void 0&&Oe(M)}function Ne(M){const v=M.texture,F=i.get(M),B=i.get(v);M.addEventListener("dispose",D);const X=M.textures,$=M.isWebGLCubeRenderTarget===!0,ge=X.length>1;if(ge||(B.__webglTexture===void 0&&(B.__webglTexture=t.createTexture()),B.__version=v.version,r.memory.textures++),$){F.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(v.mipmaps&&v.mipmaps.length>0){F.__webglFramebuffer[pe]=[];for(let be=0;be<v.mipmaps.length;be++)F.__webglFramebuffer[pe][be]=t.createFramebuffer()}else F.__webglFramebuffer[pe]=t.createFramebuffer()}else{if(v.mipmaps&&v.mipmaps.length>0){F.__webglFramebuffer=[];for(let pe=0;pe<v.mipmaps.length;pe++)F.__webglFramebuffer[pe]=t.createFramebuffer()}else F.__webglFramebuffer=t.createFramebuffer();if(ge)for(let pe=0,be=X.length;pe<be;pe++){const Me=i.get(X[pe]);Me.__webglTexture===void 0&&(Me.__webglTexture=t.createTexture(),r.memory.textures++)}if(M.samples>0&&te(M)===!1){F.__webglMultisampledFramebuffer=t.createFramebuffer(),F.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let pe=0;pe<X.length;pe++){const be=X[pe];F.__webglColorRenderbuffer[pe]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,F.__webglColorRenderbuffer[pe]);const Me=o.convert(be.format,be.colorSpace),he=o.convert(be.type),Ce=w(be.internalFormat,Me,he,be.colorSpace,M.isXRRenderTarget===!0),Xe=ie(M);t.renderbufferStorageMultisample(t.RENDERBUFFER,Xe,Ce,M.width,M.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+pe,t.RENDERBUFFER,F.__webglColorRenderbuffer[pe])}t.bindRenderbuffer(t.RENDERBUFFER,null),M.depthBuffer&&(F.__webglDepthRenderbuffer=t.createRenderbuffer(),Y(F.__webglDepthRenderbuffer,M,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if($){n.bindTexture(t.TEXTURE_CUBE_MAP,B.__webglTexture),Be(t.TEXTURE_CUBE_MAP,v);for(let pe=0;pe<6;pe++)if(v.mipmaps&&v.mipmaps.length>0)for(let be=0;be<v.mipmaps.length;be++)le(F.__webglFramebuffer[pe][be],M,v,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+pe,be);else le(F.__webglFramebuffer[pe],M,v,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0);_(v)&&p(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(ge){for(let pe=0,be=X.length;pe<be;pe++){const Me=X[pe],he=i.get(Me);n.bindTexture(t.TEXTURE_2D,he.__webglTexture),Be(t.TEXTURE_2D,Me),le(F.__webglFramebuffer,M,Me,t.COLOR_ATTACHMENT0+pe,t.TEXTURE_2D,0),_(Me)&&p(t.TEXTURE_2D)}n.unbindTexture()}else{let pe=t.TEXTURE_2D;if((M.isWebGL3DRenderTarget||M.isWebGLArrayRenderTarget)&&(pe=M.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(pe,B.__webglTexture),Be(pe,v),v.mipmaps&&v.mipmaps.length>0)for(let be=0;be<v.mipmaps.length;be++)le(F.__webglFramebuffer[be],M,v,t.COLOR_ATTACHMENT0,pe,be);else le(F.__webglFramebuffer,M,v,t.COLOR_ATTACHMENT0,pe,0);_(v)&&p(pe),n.unbindTexture()}M.depthBuffer&&Oe(M)}function Ue(M){const v=M.textures;for(let F=0,B=v.length;F<B;F++){const X=v[F];if(_(X)){const $=T(M),ge=i.get(X).__webglTexture;n.bindTexture($,ge),p($),n.unbindTexture()}}}const A=[],x=[];function Z(M){if(M.samples>0){if(te(M)===!1){const v=M.textures,F=M.width,B=M.height;let X=t.COLOR_BUFFER_BIT;const $=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ge=i.get(M),pe=v.length>1;if(pe)for(let Me=0;Me<v.length;Me++)n.bindFramebuffer(t.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Me,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,ge.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Me,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,ge.__webglMultisampledFramebuffer);const be=M.texture.mipmaps;be&&be.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ge.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let Me=0;Me<v.length;Me++){if(M.resolveDepthBuffer&&(M.depthBuffer&&(X|=t.DEPTH_BUFFER_BIT),M.stencilBuffer&&M.resolveStencilBuffer&&(X|=t.STENCIL_BUFFER_BIT)),pe){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,ge.__webglColorRenderbuffer[Me]);const he=i.get(v[Me]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,he,0)}t.blitFramebuffer(0,0,F,B,0,0,F,B,X,t.NEAREST),l===!0&&(A.length=0,x.length=0,A.push(t.COLOR_ATTACHMENT0+Me),M.depthBuffer&&M.resolveDepthBuffer===!1&&(A.push($),x.push($),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,x)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,A))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),pe)for(let Me=0;Me<v.length;Me++){n.bindFramebuffer(t.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Me,t.RENDERBUFFER,ge.__webglColorRenderbuffer[Me]);const he=i.get(v[Me]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,ge.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Me,t.TEXTURE_2D,he,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ge.__webglMultisampledFramebuffer)}else if(M.depthBuffer&&M.resolveDepthBuffer===!1&&l){const v=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[v])}}}function ie(M){return Math.min(s.maxSamples,M.samples)}function te(M){const v=i.get(M);return M.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function ne(M){const v=r.render.frame;u.get(M)!==v&&(u.set(M,v),M.update())}function me(M,v){const F=M.colorSpace,B=M.format,X=M.type;return M.isCompressedTexture===!0||M.isVideoTexture===!0||F!==ao&&F!==Li&&(ft.getTransfer(F)===bt?(B!==zn||X!==ei)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",F)),v}function Q(M){return typeof HTMLImageElement!="undefined"&&M instanceof HTMLImageElement?(d.width=M.naturalWidth||M.width,d.height=M.naturalHeight||M.height):typeof VideoFrame!="undefined"&&M instanceof VideoFrame?(d.width=M.displayWidth,d.height=M.displayHeight):(d.width=M.width,d.height=M.height),d}this.allocateTextureUnit=H,this.resetTextureUnits=O,this.setTexture2D=re,this.setTexture2DArray=q,this.setTexture3D=ae,this.setTextureCube=G,this.rebindTextures=Se,this.setupRenderTarget=Ne,this.updateRenderTargetMipmap=Ue,this.updateMultisampleRenderTarget=Z,this.setupDepthRenderbuffer=Oe,this.setupFrameBufferTexture=le,this.useMultisampledRTT=te}function Vk(t,e){function n(i,s=Li){let o;const r=ft.getTransfer(s);if(i===ei)return t.UNSIGNED_BYTE;if(i===od)return t.UNSIGNED_SHORT_4_4_4_4;if(i===rd)return t.UNSIGNED_SHORT_5_5_5_1;if(i===_p)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===pp)return t.BYTE;if(i===mp)return t.SHORT;if(i===sr)return t.UNSIGNED_SHORT;if(i===sd)return t.INT;if(i===gs)return t.UNSIGNED_INT;if(i===ui)return t.FLOAT;if(i===ur)return t.HALF_FLOAT;if(i===gp)return t.ALPHA;if(i===vp)return t.RGB;if(i===zn)return t.RGBA;if(i===rr)return t.DEPTH_COMPONENT;if(i===ar)return t.DEPTH_STENCIL;if(i===bp)return t.RED;if(i===ad)return t.RED_INTEGER;if(i===yp)return t.RG;if(i===ld)return t.RG_INTEGER;if(i===cd)return t.RGBA_INTEGER;if(i===Jr||i===Qr||i===ea||i===ta)if(r===bt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(i===Jr)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Qr)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===ea)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===ta)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(i===Jr)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Qr)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===ea)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===ta)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===rc||i===ac||i===lc||i===cc)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(i===rc)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ac)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===lc)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===cc)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===dc||i===uc||i===hc)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(i===dc||i===uc)return r===bt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(i===hc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===fc||i===pc||i===mc||i===_c||i===gc||i===vc||i===bc||i===yc||i===xc||i===Sc||i===Mc||i===Ec||i===wc||i===Tc)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(i===fc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===pc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===mc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===_c)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===gc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===vc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===bc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===yc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===xc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Sc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Mc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Ec)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===wc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Tc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===na||i===Cc||i===Ac)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(i===na)return r===bt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Cc)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Ac)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===xp||i===Pc||i===Rc||i===Dc)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(i===na)return o.COMPRESSED_RED_RGTC1_EXT;if(i===Pc)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Rc)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Dc)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===or?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const Hk=`
- void main() {
- gl_Position = vec4( position, 1.0 );
- }`,$k=`
- uniform sampler2DArray depthColor;
- uniform float depthWidth;
- uniform float depthHeight;
- void main() {
- vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
- if ( coord.x >= 1.0 ) {
- gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
- } else {
- gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
- }
- }`;class Gk{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,i){if(this.texture===null){const s=new hn,o=e.properties.get(s);o.__webglTexture=n.texture,(n.depthNear!==i.depthNear||n.depthFar!==i.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new Hi({vertexShader:Hk,fragmentShader:$k,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Ae(new bo(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Wk extends Ss{constructor(e,n){super();const i=this;let s=null,o=1,r=null,a="local-floor",l=1,d=null,u=null,f=null,h=null,m=null,b=null;const y=new Gk,_=n.getContextAttributes();let p=null,T=null;const w=[],S=[],I=new Ke;let P=null;const D=new _n;D.viewport=new It;const R=new _n;R.viewport=new It;const E=[D,R],g=new cF;let L=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ce){let N=w[ce];return N===void 0&&(N=new ml,w[ce]=N),N.getTargetRaySpace()},this.getControllerGrip=function(ce){let N=w[ce];return N===void 0&&(N=new ml,w[ce]=N),N.getGripSpace()},this.getHand=function(ce){let N=w[ce];return N===void 0&&(N=new ml,w[ce]=N),N.getHandSpace()};function H(ce){const N=S.indexOf(ce.inputSource);if(N===-1)return;const le=w[N];le!==void 0&&(le.update(ce.inputSource,ce.frame,d||r),le.dispatchEvent({type:ce.type,data:ce.inputSource}))}function j(){s.removeEventListener("select",H),s.removeEventListener("selectstart",H),s.removeEventListener("selectend",H),s.removeEventListener("squeeze",H),s.removeEventListener("squeezestart",H),s.removeEventListener("squeezeend",H),s.removeEventListener("end",j),s.removeEventListener("inputsourceschange",re);for(let ce=0;ce<w.length;ce++){const N=S[ce];N!==null&&(S[ce]=null,w[ce].disconnect(N))}L=null,O=null,y.reset(),e.setRenderTarget(p),m=null,h=null,f=null,s=null,T=null,Je.stop(),i.isPresenting=!1,e.setPixelRatio(P),e.setSize(I.width,I.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ce){o=ce,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ce){a=ce,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||r},this.setReferenceSpace=function(ce){d=ce},this.getBaseLayer=function(){return h!==null?h:m},this.getBinding=function(){return f},this.getFrame=function(){return b},this.getSession=function(){return s},this.setSession=async function(ce){if(s=ce,s!==null){if(p=e.getRenderTarget(),s.addEventListener("select",H),s.addEventListener("selectstart",H),s.addEventListener("selectend",H),s.addEventListener("squeeze",H),s.addEventListener("squeezestart",H),s.addEventListener("squeezeend",H),s.addEventListener("end",j),s.addEventListener("inputsourceschange",re),_.xrCompatible!==!0&&await n.makeXRCompatible(),P=e.getPixelRatio(),e.getSize(I),typeof XRWebGLBinding!="undefined"&&"createProjectionLayer"in XRWebGLBinding.prototype){let le=null,Y=null,ue=null;_.depth&&(ue=_.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,le=_.stencil?ar:rr,Y=_.stencil?or:gs);const Oe={colorFormat:n.RGBA8,depthFormat:ue,scaleFactor:o};f=new XRWebGLBinding(s,n),h=f.createProjectionLayer(Oe),s.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),T=new vs(h.textureWidth,h.textureHeight,{format:zn,type:ei,depthTexture:new Ip(h.textureWidth,h.textureHeight,Y,void 0,void 0,void 0,void 0,void 0,void 0,le),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const le={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(s,n,le),s.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),T=new vs(m.framebufferWidth,m.framebufferHeight,{format:zn,type:ei,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(l),d=null,r=await s.requestReferenceSpace(a),Je.setContext(s),Je.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};function re(ce){for(let N=0;N<ce.removed.length;N++){const le=ce.removed[N],Y=S.indexOf(le);Y>=0&&(S[Y]=null,w[Y].disconnect(le))}for(let N=0;N<ce.added.length;N++){const le=ce.added[N];let Y=S.indexOf(le);if(Y===-1){for(let Oe=0;Oe<w.length;Oe++)if(Oe>=S.length){S.push(le),Y=Oe;break}else if(S[Oe]===null){S[Oe]=le,Y=Oe;break}if(Y===-1)break}const ue=w[Y];ue&&ue.connect(le)}}const q=new U,ae=new U;function G(ce,N,le){q.setFromMatrixPosition(N.matrixWorld),ae.setFromMatrixPosition(le.matrixWorld);const Y=q.distanceTo(ae),ue=N.projectionMatrix.elements,Oe=le.projectionMatrix.elements,Se=ue[14]/(ue[10]-1),Ne=ue[14]/(ue[10]+1),Ue=(ue[9]+1)/ue[5],A=(ue[9]-1)/ue[5],x=(ue[8]-1)/ue[0],Z=(Oe[8]+1)/Oe[0],ie=Se*x,te=Se*Z,ne=Y/(-x+Z),me=ne*-x;if(N.matrixWorld.decompose(ce.position,ce.quaternion,ce.scale),ce.translateX(me),ce.translateZ(ne),ce.matrixWorld.compose(ce.position,ce.quaternion,ce.scale),ce.matrixWorldInverse.copy(ce.matrixWorld).invert(),ue[10]===-1)ce.projectionMatrix.copy(N.projectionMatrix),ce.projectionMatrixInverse.copy(N.projectionMatrixInverse);else{const Q=Se+ne,M=Ne+ne,v=ie-me,F=te+(Y-me),B=Ue*Ne/M*Q,X=A*Ne/M*Q;ce.projectionMatrix.makePerspective(v,F,B,X,Q,M),ce.projectionMatrixInverse.copy(ce.projectionMatrix).invert()}}function fe(ce,N){N===null?ce.matrixWorld.copy(ce.matrix):ce.matrixWorld.multiplyMatrices(N.matrixWorld,ce.matrix),ce.matrixWorldInverse.copy(ce.matrixWorld).invert()}this.updateCamera=function(ce){if(s===null)return;let N=ce.near,le=ce.far;y.texture!==null&&(y.depthNear>0&&(N=y.depthNear),y.depthFar>0&&(le=y.depthFar)),g.near=R.near=D.near=N,g.far=R.far=D.far=le,(L!==g.near||O!==g.far)&&(s.updateRenderState({depthNear:g.near,depthFar:g.far}),L=g.near,O=g.far),D.layers.mask=ce.layers.mask|2,R.layers.mask=ce.layers.mask|4,g.layers.mask=D.layers.mask|R.layers.mask;const Y=ce.parent,ue=g.cameras;fe(g,Y);for(let Oe=0;Oe<ue.length;Oe++)fe(ue[Oe],Y);ue.length===2?G(g,D,R):g.projectionMatrix.copy(D.projectionMatrix),ye(ce,g,Y)};function ye(ce,N,le){le===null?ce.matrix.copy(N.matrixWorld):(ce.matrix.copy(le.matrixWorld),ce.matrix.invert(),ce.matrix.multiply(N.matrixWorld)),ce.matrix.decompose(ce.position,ce.quaternion,ce.scale),ce.updateMatrixWorld(!0),ce.projectionMatrix.copy(N.projectionMatrix),ce.projectionMatrixInverse.copy(N.projectionMatrixInverse),ce.isPerspectiveCamera&&(ce.fov=lo*2*Math.atan(1/ce.projectionMatrix.elements[5]),ce.zoom=1)}this.getCamera=function(){return g},this.getFoveation=function(){if(!(h===null&&m===null))return l},this.setFoveation=function(ce){l=ce,h!==null&&(h.fixedFoveation=ce),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=ce)},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(g)};let Re=null;function Be(ce,N){if(u=N.getViewerPose(d||r),b=N,u!==null){const le=u.views;m!==null&&(e.setRenderTargetFramebuffer(T,m.framebuffer),e.setRenderTarget(T));let Y=!1;le.length!==g.cameras.length&&(g.cameras.length=0,Y=!0);for(let Se=0;Se<le.length;Se++){const Ne=le[Se];let Ue=null;if(m!==null)Ue=m.getViewport(Ne);else{const x=f.getViewSubImage(h,Ne);Ue=x.viewport,Se===0&&(e.setRenderTargetTextures(T,x.colorTexture,x.depthStencilTexture),e.setRenderTarget(T))}let A=E[Se];A===void 0&&(A=new _n,A.layers.enable(Se),A.viewport=new It,E[Se]=A),A.matrix.fromArray(Ne.transform.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale),A.projectionMatrix.fromArray(Ne.projectionMatrix),A.projectionMatrixInverse.copy(A.projectionMatrix).invert(),A.viewport.set(Ue.x,Ue.y,Ue.width,Ue.height),Se===0&&(g.matrix.copy(A.matrix),g.matrix.decompose(g.position,g.quaternion,g.scale)),Y===!0&&g.cameras.push(A)}const ue=s.enabledFeatures;if(ue&&ue.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&f){const Se=f.getDepthInformation(le[0]);Se&&Se.isValid&&Se.texture&&y.init(e,Se,s.renderState)}}for(let le=0;le<w.length;le++){const Y=S[le],ue=w[le];Y!==null&&ue!==void 0&&ue.update(Y,N,d||r)}Re&&Re(ce,N),N.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:N}),b=null}const Je=new Fp;Je.setAnimationLoop(Be),this.setAnimationLoop=function(ce){Re=ce},this.dispose=function(){}}}const es=new Vn,Xk=new Tt;function jk(t,e){function n(_,p){_.matrixAutoUpdate===!0&&_.updateMatrix(),p.value.copy(_.matrix)}function i(_,p){p.color.getRGB(_.fogColor.value,Pp(t)),p.isFog?(_.fogNear.value=p.near,_.fogFar.value=p.far):p.isFogExp2&&(_.fogDensity.value=p.density)}function s(_,p,T,w,S){p.isMeshBasicMaterial||p.isMeshLambertMaterial?o(_,p):p.isMeshToonMaterial?(o(_,p),f(_,p)):p.isMeshPhongMaterial?(o(_,p),u(_,p)):p.isMeshStandardMaterial?(o(_,p),h(_,p),p.isMeshPhysicalMaterial&&m(_,p,S)):p.isMeshMatcapMaterial?(o(_,p),b(_,p)):p.isMeshDepthMaterial?o(_,p):p.isMeshDistanceMaterial?(o(_,p),y(_,p)):p.isMeshNormalMaterial?o(_,p):p.isLineBasicMaterial?(r(_,p),p.isLineDashedMaterial&&a(_,p)):p.isPointsMaterial?l(_,p,T,w):p.isSpriteMaterial?d(_,p):p.isShadowMaterial?(_.color.value.copy(p.color),_.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function o(_,p){_.opacity.value=p.opacity,p.color&&_.diffuse.value.copy(p.color),p.emissive&&_.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(_.map.value=p.map,n(p.map,_.mapTransform)),p.alphaMap&&(_.alphaMap.value=p.alphaMap,n(p.alphaMap,_.alphaMapTransform)),p.bumpMap&&(_.bumpMap.value=p.bumpMap,n(p.bumpMap,_.bumpMapTransform),_.bumpScale.value=p.bumpScale,p.side===un&&(_.bumpScale.value*=-1)),p.normalMap&&(_.normalMap.value=p.normalMap,n(p.normalMap,_.normalMapTransform),_.normalScale.value.copy(p.normalScale),p.side===un&&_.normalScale.value.negate()),p.displacementMap&&(_.displacementMap.value=p.displacementMap,n(p.displacementMap,_.displacementMapTransform),_.displacementScale.value=p.displacementScale,_.displacementBias.value=p.displacementBias),p.emissiveMap&&(_.emissiveMap.value=p.emissiveMap,n(p.emissiveMap,_.emissiveMapTransform)),p.specularMap&&(_.specularMap.value=p.specularMap,n(p.specularMap,_.specularMapTransform)),p.alphaTest>0&&(_.alphaTest.value=p.alphaTest);const T=e.get(p),w=T.envMap,S=T.envMapRotation;w&&(_.envMap.value=w,es.copy(S),es.x*=-1,es.y*=-1,es.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(es.y*=-1,es.z*=-1),_.envMapRotation.value.setFromMatrix4(Xk.makeRotationFromEuler(es)),_.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=p.reflectivity,_.ior.value=p.ior,_.refractionRatio.value=p.refractionRatio),p.lightMap&&(_.lightMap.value=p.lightMap,_.lightMapIntensity.value=p.lightMapIntensity,n(p.lightMap,_.lightMapTransform)),p.aoMap&&(_.aoMap.value=p.aoMap,_.aoMapIntensity.value=p.aoMapIntensity,n(p.aoMap,_.aoMapTransform))}function r(_,p){_.diffuse.value.copy(p.color),_.opacity.value=p.opacity,p.map&&(_.map.value=p.map,n(p.map,_.mapTransform))}function a(_,p){_.dashSize.value=p.dashSize,_.totalSize.value=p.dashSize+p.gapSize,_.scale.value=p.scale}function l(_,p,T,w){_.diffuse.value.copy(p.color),_.opacity.value=p.opacity,_.size.value=p.size*T,_.scale.value=w*.5,p.map&&(_.map.value=p.map,n(p.map,_.uvTransform)),p.alphaMap&&(_.alphaMap.value=p.alphaMap,n(p.alphaMap,_.alphaMapTransform)),p.alphaTest>0&&(_.alphaTest.value=p.alphaTest)}function d(_,p){_.diffuse.value.copy(p.color),_.opacity.value=p.opacity,_.rotation.value=p.rotation,p.map&&(_.map.value=p.map,n(p.map,_.mapTransform)),p.alphaMap&&(_.alphaMap.value=p.alphaMap,n(p.alphaMap,_.alphaMapTransform)),p.alphaTest>0&&(_.alphaTest.value=p.alphaTest)}function u(_,p){_.specular.value.copy(p.specular),_.shininess.value=Math.max(p.shininess,1e-4)}function f(_,p){p.gradientMap&&(_.gradientMap.value=p.gradientMap)}function h(_,p){_.metalness.value=p.metalness,p.metalnessMap&&(_.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,_.metalnessMapTransform)),_.roughness.value=p.roughness,p.roughnessMap&&(_.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,_.roughnessMapTransform)),p.envMap&&(_.envMapIntensity.value=p.envMapIntensity)}function m(_,p,T){_.ior.value=p.ior,p.sheen>0&&(_.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),_.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(_.sheenColorMap.value=p.sheenColorMap,n(p.sheenColorMap,_.sheenColorMapTransform)),p.sheenRoughnessMap&&(_.sheenRoughnessMap.value=p.sheenRoughnessMap,n(p.sheenRoughnessMap,_.sheenRoughnessMapTransform))),p.clearcoat>0&&(_.clearcoat.value=p.clearcoat,_.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(_.clearcoatMap.value=p.clearcoatMap,n(p.clearcoatMap,_.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,n(p.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(_.clearcoatNormalMap.value=p.clearcoatNormalMap,n(p.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===un&&_.clearcoatNormalScale.value.negate())),p.dispersion>0&&(_.dispersion.value=p.dispersion),p.iridescence>0&&(_.iridescence.value=p.iridescence,_.iridescenceIOR.value=p.iridescenceIOR,_.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(_.iridescenceMap.value=p.iridescenceMap,n(p.iridescenceMap,_.iridescenceMapTransform)),p.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=p.iridescenceThicknessMap,n(p.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),p.transmission>0&&(_.transmission.value=p.transmission,_.transmissionSamplerMap.value=T.texture,_.transmissionSamplerSize.value.set(T.width,T.height),p.transmissionMap&&(_.transmissionMap.value=p.transmissionMap,n(p.transmissionMap,_.transmissionMapTransform)),_.thickness.value=p.thickness,p.thicknessMap&&(_.thicknessMap.value=p.thicknessMap,n(p.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=p.attenuationDistance,_.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(_.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(_.anisotropyMap.value=p.anisotropyMap,n(p.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=p.specularIntensity,_.specularColor.value.copy(p.specularColor),p.specularColorMap&&(_.specularColorMap.value=p.specularColorMap,n(p.specularColorMap,_.specularColorMapTransform)),p.specularIntensityMap&&(_.specularIntensityMap.value=p.specularIntensityMap,n(p.specularIntensityMap,_.specularIntensityMapTransform))}function b(_,p){p.matcap&&(_.matcap.value=p.matcap)}function y(_,p){const T=e.get(p).light;_.referencePosition.value.setFromMatrixPosition(T.matrixWorld),_.nearDistance.value=T.shadow.camera.near,_.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function Yk(t,e,n,i){let s={},o={},r=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(T,w){const S=w.program;i.uniformBlockBinding(T,S)}function d(T,w){let S=s[T.id];S===void 0&&(b(T),S=u(T),s[T.id]=S,T.addEventListener("dispose",_));const I=w.program;i.updateUBOMapping(T,I);const P=e.render.frame;o[T.id]!==P&&(h(T),o[T.id]=P)}function u(T){const w=f();T.__bindingPointIndex=w;const S=t.createBuffer(),I=T.__size,P=T.usage;return t.bindBuffer(t.UNIFORM_BUFFER,S),t.bufferData(t.UNIFORM_BUFFER,I,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,w,S),S}function f(){for(let T=0;T<a;T++)if(r.indexOf(T)===-1)return r.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(T){const w=s[T.id],S=T.uniforms,I=T.__cache;t.bindBuffer(t.UNIFORM_BUFFER,w);for(let P=0,D=S.length;P<D;P++){const R=Array.isArray(S[P])?S[P]:[S[P]];for(let E=0,g=R.length;E<g;E++){const L=R[E];if(m(L,P,E,I)===!0){const O=L.__offset,H=Array.isArray(L.value)?L.value:[L.value];let j=0;for(let re=0;re<H.length;re++){const q=H[re],ae=y(q);typeof q=="number"||typeof q=="boolean"?(L.__data[0]=q,t.bufferSubData(t.UNIFORM_BUFFER,O+j,L.__data)):q.isMatrix3?(L.__data[0]=q.elements[0],L.__data[1]=q.elements[1],L.__data[2]=q.elements[2],L.__data[3]=0,L.__data[4]=q.elements[3],L.__data[5]=q.elements[4],L.__data[6]=q.elements[5],L.__data[7]=0,L.__data[8]=q.elements[6],L.__data[9]=q.elements[7],L.__data[10]=q.elements[8],L.__data[11]=0):(q.toArray(L.__data,j),j+=ae.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,O,L.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function m(T,w,S,I){const P=T.value,D=w+"_"+S;if(I[D]===void 0)return typeof P=="number"||typeof P=="boolean"?I[D]=P:I[D]=P.clone(),!0;{const R=I[D];if(typeof P=="number"||typeof P=="boolean"){if(R!==P)return I[D]=P,!0}else if(R.equals(P)===!1)return R.copy(P),!0}return!1}function b(T){const w=T.uniforms;let S=0;const I=16;for(let D=0,R=w.length;D<R;D++){const E=Array.isArray(w[D])?w[D]:[w[D]];for(let g=0,L=E.length;g<L;g++){const O=E[g],H=Array.isArray(O.value)?O.value:[O.value];for(let j=0,re=H.length;j<re;j++){const q=H[j],ae=y(q),G=S%I,fe=G%ae.boundary,ye=G+fe;S+=fe,ye!==0&&I-ye<ae.storage&&(S+=I-ye),O.__data=new Float32Array(ae.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=S,S+=ae.storage}}}const P=S%I;return P>0&&(S+=I-P),T.__size=S,T.__cache={},this}function y(T){const w={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(w.boundary=4,w.storage=4):T.isVector2?(w.boundary=8,w.storage=8):T.isVector3||T.isColor?(w.boundary=16,w.storage=12):T.isVector4?(w.boundary=16,w.storage=16):T.isMatrix3?(w.boundary=48,w.storage=48):T.isMatrix4?(w.boundary=64,w.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),w}function _(T){const w=T.target;w.removeEventListener("dispose",_);const S=r.indexOf(w.__bindingPointIndex);r.splice(S,1),t.deleteBuffer(s[w.id]),delete s[w.id],delete o[w.id]}function p(){for(const T in s)t.deleteBuffer(s[T]);r=[],s={},o={}}return{bind:l,update:d,dispose:p}}class qk{constructor(e={}){const{canvas:n=MU(),context:i=null,depth:s=!0,stencil:o=!1,alpha:r=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:d=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:h=!1}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext!="undefined"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=r;const b=new Uint32Array(4),y=new Int32Array(4);let _=null,p=null;const T=[],w=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=zi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let I=!1;this._outputColorSpace=En;let P=0,D=0,R=null,E=-1,g=null;const L=new It,O=new It;let H=null;const j=new at(0);let re=0,q=n.width,ae=n.height,G=1,fe=null,ye=null;const Re=new It(0,0,q,ae),Be=new It(0,0,q,ae);let Je=!1;const ce=new fd;let N=!1,le=!1;const Y=new Tt,ue=new Tt,Oe=new U,Se=new It,Ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ue=!1;function A(){return R===null?G:1}let x=i;function Z(C,k){return n.getContext(C,k)}try{const C={alpha:!0,depth:s,stencil:o,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:d,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${nd}`),n.addEventListener("webglcontextlost",de,!1),n.addEventListener("webglcontextrestored",Pe,!1),n.addEventListener("webglcontextcreationerror",Te,!1),x===null){const k="webgl2";if(x=Z(k,C),x===null)throw Z(k)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(C){throw console.error("THREE.WebGLRenderer: "+C.message),C}let ie,te,ne,me,Q,M,v,F,B,X,$,ge,pe,be,Me,he,Ce,Xe,$e,De,Ye,Ge,gt,z;function we(){ie=new oz(x),ie.init(),Ge=new Vk(x,ie),te=new JN(x,ie,e,Ge),ne=new kk(x,ie),te.reverseDepthBuffer&&h&&ne.buffers.depth.setReversed(!0),me=new lz(x),Q=new Tk,M=new Bk(x,ie,ne,Q,te,Ge,me),v=new ez(S),F=new sz(S),B=new pF(x),gt=new ZN(x,B),X=new rz(x,B,me,gt),$=new dz(x,X,B,me),$e=new cz(x,te,M),he=new QN(Q),ge=new wk(S,v,F,ie,te,gt,he),pe=new jk(S,Q),be=new Ak,Me=new Uk(ie),Xe=new qN(S,v,F,ne,$,m,l),Ce=new Nk(S,$,te),z=new Yk(x,me,te,ne),De=new KN(x,ie,me),Ye=new az(x,ie,me),me.programs=ge.programs,S.capabilities=te,S.extensions=ie,S.properties=Q,S.renderLists=be,S.shadowMap=Ce,S.state=ne,S.info=me}we();const oe=new Wk(S,x);this.xr=oe,this.getContext=function(){return x},this.getContextAttributes=function(){return x.getContextAttributes()},this.forceContextLoss=function(){const C=ie.get("WEBGL_lose_context");C&&C.loseContext()},this.forceContextRestore=function(){const C=ie.get("WEBGL_lose_context");C&&C.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(C){C!==void 0&&(G=C,this.setSize(q,ae,!1))},this.getSize=function(C){return C.set(q,ae)},this.setSize=function(C,k,K=!0){if(oe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=C,ae=k,n.width=Math.floor(C*G),n.height=Math.floor(k*G),K===!0&&(n.style.width=C+"px",n.style.height=k+"px"),this.setViewport(0,0,C,k)},this.getDrawingBufferSize=function(C){return C.set(q*G,ae*G).floor()},this.setDrawingBufferSize=function(C,k,K){q=C,ae=k,G=K,n.width=Math.floor(C*K),n.height=Math.floor(k*K),this.setViewport(0,0,C,k)},this.getCurrentViewport=function(C){return C.copy(L)},this.getViewport=function(C){return C.copy(Re)},this.setViewport=function(C,k,K,J){C.isVector4?Re.set(C.x,C.y,C.z,C.w):Re.set(C,k,K,J),ne.viewport(L.copy(Re).multiplyScalar(G).round())},this.getScissor=function(C){return C.copy(Be)},this.setScissor=function(C,k,K,J){C.isVector4?Be.set(C.x,C.y,C.z,C.w):Be.set(C,k,K,J),ne.scissor(O.copy(Be).multiplyScalar(G).round())},this.getScissorTest=function(){return Je},this.setScissorTest=function(C){ne.setScissorTest(Je=C)},this.setOpaqueSort=function(C){fe=C},this.setTransparentSort=function(C){ye=C},this.getClearColor=function(C){return C.copy(Xe.getClearColor())},this.setClearColor=function(){Xe.setClearColor(...arguments)},this.getClearAlpha=function(){return Xe.getClearAlpha()},this.setClearAlpha=function(){Xe.setClearAlpha(...arguments)},this.clear=function(C=!0,k=!0,K=!0){let J=0;if(C){let V=!1;if(R!==null){const ve=R.texture.format;V=ve===cd||ve===ld||ve===ad}if(V){const ve=R.texture.type,Ee=ve===ei||ve===gs||ve===sr||ve===or||ve===od||ve===rd,Le=Xe.getClearColor(),Fe=Xe.getClearAlpha(),Ze=Le.r,qe=Le.g,Ve=Le.b;Ee?(b[0]=Ze,b[1]=qe,b[2]=Ve,b[3]=Fe,x.clearBufferuiv(x.COLOR,0,b)):(y[0]=Ze,y[1]=qe,y[2]=Ve,y[3]=Fe,x.clearBufferiv(x.COLOR,0,y))}else J|=x.COLOR_BUFFER_BIT}k&&(J|=x.DEPTH_BUFFER_BIT),K&&(J|=x.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),x.clear(J)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",de,!1),n.removeEventListener("webglcontextrestored",Pe,!1),n.removeEventListener("webglcontextcreationerror",Te,!1),Xe.dispose(),be.dispose(),Me.dispose(),Q.dispose(),v.dispose(),F.dispose(),$.dispose(),gt.dispose(),z.dispose(),ge.dispose(),oe.dispose(),oe.removeEventListener("sessionstart",xd),oe.removeEventListener("sessionend",Sd),$i.stop()};function de(C){C.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function Pe(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1;const C=me.autoReset,k=Ce.enabled,K=Ce.autoUpdate,J=Ce.needsUpdate,V=Ce.type;we(),me.autoReset=C,Ce.enabled=k,Ce.autoUpdate=K,Ce.needsUpdate=J,Ce.type=V}function Te(C){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",C.statusMessage)}function Qe(C){const k=C.target;k.removeEventListener("dispose",Qe),Rt(k)}function Rt(C){Yt(C),Q.remove(C)}function Yt(C){const k=Q.get(C).programs;k!==void 0&&(k.forEach(function(K){ge.releaseProgram(K)}),C.isShaderMaterial&&ge.releaseShaderCache(C))}this.renderBufferDirect=function(C,k,K,J,V,ve){k===null&&(k=Ne);const Ee=V.isMesh&&V.matrixWorld.determinant()<0,Le=Vp(C,k,K,J,V);ne.setMaterial(J,Ee);let Fe=K.index,Ze=1;if(J.wireframe===!0){if(Fe=X.getWireframeAttribute(K),Fe===void 0)return;Ze=2}const qe=K.drawRange,Ve=K.attributes.position;let ut=qe.start*Ze,mt=(qe.start+qe.count)*Ze;ve!==null&&(ut=Math.max(ut,ve.start*Ze),mt=Math.min(mt,(ve.start+ve.count)*Ze)),Fe!==null?(ut=Math.max(ut,0),mt=Math.min(mt,Fe.count)):Ve!=null&&(ut=Math.max(ut,0),mt=Math.min(mt,Ve.count));const Ut=mt-ut;if(Ut<0||Ut===1/0)return;gt.setup(V,J,Le,K,Fe);let Dt,ht=De;if(Fe!==null&&(Dt=B.get(Fe),ht=Ye,ht.setIndex(Dt)),V.isMesh)J.wireframe===!0?(ne.setLineWidth(J.wireframeLinewidth*A()),ht.setMode(x.LINES)):ht.setMode(x.TRIANGLES);else if(V.isLine){let We=J.linewidth;We===void 0&&(We=1),ne.setLineWidth(We*A()),V.isLineSegments?ht.setMode(x.LINES):V.isLineLoop?ht.setMode(x.LINE_LOOP):ht.setMode(x.LINE_STRIP)}else V.isPoints?ht.setMode(x.POINTS):V.isSprite&&ht.setMode(x.TRIANGLES);if(V.isBatchedMesh)if(V._multiDrawInstances!==null)ia("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ht.renderMultiDrawInstances(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount,V._multiDrawInstances);else if(ie.get("WEBGL_multi_draw"))ht.renderMultiDraw(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount);else{const We=V._multiDrawStarts,Gt=V._multiDrawCounts,_t=V._multiDrawCount,An=Fe?B.get(Fe).bytesPerElement:1,Es=Q.get(J).currentProgram.getUniforms();for(let fn=0;fn<_t;fn++)Es.setValue(x,"_gl_DrawID",fn),ht.render(We[fn]/An,Gt[fn])}else if(V.isInstancedMesh)ht.renderInstances(ut,Ut,V.count);else if(K.isInstancedBufferGeometry){const We=K._maxInstanceCount!==void 0?K._maxInstanceCount:1/0,Gt=Math.min(K.instanceCount,We);ht.renderInstances(ut,Ut,Gt)}else ht.render(ut,Ut)};function vt(C,k,K){C.transparent===!0&&C.side===Fn&&C.forceSinglePass===!1?(C.side=un,C.needsUpdate=!0,mr(C,k,K),C.side=Vi,C.needsUpdate=!0,mr(C,k,K),C.side=Fn):mr(C,k,K)}this.compile=function(C,k,K=null){K===null&&(K=C),p=Me.get(K),p.init(k),w.push(p),K.traverseVisible(function(V){V.isLight&&V.layers.test(k.layers)&&(p.pushLight(V),V.castShadow&&p.pushShadow(V))}),C!==K&&C.traverseVisible(function(V){V.isLight&&V.layers.test(k.layers)&&(p.pushLight(V),V.castShadow&&p.pushShadow(V))}),p.setupLights();const J=new Set;return C.traverse(function(V){if(!(V.isMesh||V.isPoints||V.isLine||V.isSprite))return;const ve=V.material;if(ve)if(Array.isArray(ve))for(let Ee=0;Ee<ve.length;Ee++){const Le=ve[Ee];vt(Le,K,V),J.add(Le)}else vt(ve,K,V),J.add(ve)}),p=w.pop(),J},this.compileAsync=function(C,k,K=null){const J=this.compile(C,k,K);return new Promise(V=>{function ve(){if(J.forEach(function(Ee){Q.get(Ee).currentProgram.isReady()&&J.delete(Ee)}),J.size===0){V(C);return}setTimeout(ve,10)}ie.get("KHR_parallel_shader_compile")!==null?ve():setTimeout(ve,10)})};let Cn=null;function ti(C){Cn&&Cn(C)}function xd(){$i.stop()}function Sd(){$i.start()}const $i=new Fp;$i.setAnimationLoop(ti),typeof self!="undefined"&&$i.setContext(self),this.setAnimationLoop=function(C){Cn=C,oe.setAnimationLoop(C),C===null?$i.stop():$i.start()},oe.addEventListener("sessionstart",xd),oe.addEventListener("sessionend",Sd),this.render=function(C,k){if(k!==void 0&&k.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;if(C.matrixWorldAutoUpdate===!0&&C.updateMatrixWorld(),k.parent===null&&k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(k),k=oe.getCamera()),C.isScene===!0&&C.onBeforeRender(S,C,k,R),p=Me.get(C,w.length),p.init(k),w.push(p),ue.multiplyMatrices(k.projectionMatrix,k.matrixWorldInverse),ce.setFromProjectionMatrix(ue),le=this.localClippingEnabled,N=he.init(this.clippingPlanes,le),_=be.get(C,T.length),_.init(),T.push(_),oe.enabled===!0&&oe.isPresenting===!0){const ve=S.xr.getDepthSensingMesh();ve!==null&&za(ve,k,-1/0,S.sortObjects)}za(C,k,0,S.sortObjects),_.finish(),S.sortObjects===!0&&_.sort(fe,ye),Ue=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,Ue&&Xe.addToRenderList(_,C),this.info.render.frame++,N===!0&&he.beginShadows();const K=p.state.shadowsArray;Ce.render(K,C,k),N===!0&&he.endShadows(),this.info.autoReset===!0&&this.info.reset();const J=_.opaque,V=_.transmissive;if(p.setupLights(),k.isArrayCamera){const ve=k.cameras;if(V.length>0)for(let Ee=0,Le=ve.length;Ee<Le;Ee++){const Fe=ve[Ee];Ed(J,V,C,Fe)}Ue&&Xe.render(C);for(let Ee=0,Le=ve.length;Ee<Le;Ee++){const Fe=ve[Ee];Md(_,C,Fe,Fe.viewport)}}else V.length>0&&Ed(J,V,C,k),Ue&&Xe.render(C),Md(_,C,k);R!==null&&D===0&&(M.updateMultisampleRenderTarget(R),M.updateRenderTargetMipmap(R)),C.isScene===!0&&C.onAfterRender(S,C,k),gt.resetDefaultState(),E=-1,g=null,w.pop(),w.length>0?(p=w[w.length-1],N===!0&&he.setGlobalState(S.clippingPlanes,p.state.camera)):p=null,T.pop(),T.length>0?_=T[T.length-1]:_=null};function za(C,k,K,J){if(C.visible===!1)return;if(C.layers.test(k.layers)){if(C.isGroup)K=C.renderOrder;else if(C.isLOD)C.autoUpdate===!0&&C.update(k);else if(C.isLight)p.pushLight(C),C.castShadow&&p.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||ce.intersectsSprite(C)){J&&Se.setFromMatrixPosition(C.matrixWorld).applyMatrix4(ue);const Ee=$.update(C),Le=C.material;Le.visible&&_.push(C,Ee,Le,K,Se.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||ce.intersectsObject(C))){const Ee=$.update(C),Le=C.material;if(J&&(C.boundingSphere!==void 0?(C.boundingSphere===null&&C.computeBoundingSphere(),Se.copy(C.boundingSphere.center)):(Ee.boundingSphere===null&&Ee.computeBoundingSphere(),Se.copy(Ee.boundingSphere.center)),Se.applyMatrix4(C.matrixWorld).applyMatrix4(ue)),Array.isArray(Le)){const Fe=Ee.groups;for(let Ze=0,qe=Fe.length;Ze<qe;Ze++){const Ve=Fe[Ze],ut=Le[Ve.materialIndex];ut&&ut.visible&&_.push(C,Ee,ut,K,Se.z,Ve)}}else Le.visible&&_.push(C,Ee,Le,K,Se.z,null)}}const ve=C.children;for(let Ee=0,Le=ve.length;Ee<Le;Ee++)za(ve[Ee],k,K,J)}function Md(C,k,K,J){const V=C.opaque,ve=C.transmissive,Ee=C.transparent;p.setupLightsView(K),N===!0&&he.setGlobalState(S.clippingPlanes,K),J&&ne.viewport(L.copy(J)),V.length>0&&pr(V,k,K),ve.length>0&&pr(ve,k,K),Ee.length>0&&pr(Ee,k,K),ne.buffers.depth.setTest(!0),ne.buffers.depth.setMask(!0),ne.buffers.color.setMask(!0),ne.setPolygonOffset(!1)}function Ed(C,k,K,J){if((K.isScene===!0?K.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[J.id]===void 0&&(p.state.transmissionRenderTarget[J.id]=new vs(1,1,{generateMipmaps:!0,type:ie.has("EXT_color_buffer_half_float")||ie.has("EXT_color_buffer_float")?ur:ei,minFilter:fs,samples:4,stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ft.workingColorSpace}));const ve=p.state.transmissionRenderTarget[J.id],Ee=J.viewport||L;ve.setSize(Ee.z*S.transmissionResolutionScale,Ee.w*S.transmissionResolutionScale);const Le=S.getRenderTarget();S.setRenderTarget(ve),S.getClearColor(j),re=S.getClearAlpha(),re<1&&S.setClearColor(16777215,.5),S.clear(),Ue&&Xe.render(K);const Fe=S.toneMapping;S.toneMapping=zi;const Ze=J.viewport;if(J.viewport!==void 0&&(J.viewport=void 0),p.setupLightsView(J),N===!0&&he.setGlobalState(S.clippingPlanes,J),pr(C,K,J),M.updateMultisampleRenderTarget(ve),M.updateRenderTargetMipmap(ve),ie.has("WEBGL_multisampled_render_to_texture")===!1){let qe=!1;for(let Ve=0,ut=k.length;Ve<ut;Ve++){const mt=k[Ve],Ut=mt.object,Dt=mt.geometry,ht=mt.material,We=mt.group;if(ht.side===Fn&&Ut.layers.test(J.layers)){const Gt=ht.side;ht.side=un,ht.needsUpdate=!0,wd(Ut,K,J,Dt,ht,We),ht.side=Gt,ht.needsUpdate=!0,qe=!0}}qe===!0&&(M.updateMultisampleRenderTarget(ve),M.updateRenderTargetMipmap(ve))}S.setRenderTarget(Le),S.setClearColor(j,re),Ze!==void 0&&(J.viewport=Ze),S.toneMapping=Fe}function pr(C,k,K){const J=k.isScene===!0?k.overrideMaterial:null;for(let V=0,ve=C.length;V<ve;V++){const Ee=C[V],Le=Ee.object,Fe=Ee.geometry,Ze=Ee.group;let qe=Ee.material;qe.allowOverride===!0&&J!==null&&(qe=J),Le.layers.test(K.layers)&&wd(Le,k,K,Fe,qe,Ze)}}function wd(C,k,K,J,V,ve){C.onBeforeRender(S,k,K,J,V,ve),C.modelViewMatrix.multiplyMatrices(K.matrixWorldInverse,C.matrixWorld),C.normalMatrix.getNormalMatrix(C.modelViewMatrix),V.onBeforeRender(S,k,K,J,C,ve),V.transparent===!0&&V.side===Fn&&V.forceSinglePass===!1?(V.side=un,V.needsUpdate=!0,S.renderBufferDirect(K,k,J,V,C,ve),V.side=Vi,V.needsUpdate=!0,S.renderBufferDirect(K,k,J,V,C,ve),V.side=Fn):S.renderBufferDirect(K,k,J,V,C,ve),C.onAfterRender(S,k,K,J,V,ve)}function mr(C,k,K){k.isScene!==!0&&(k=Ne);const J=Q.get(C),V=p.state.lights,ve=p.state.shadowsArray,Ee=V.state.version,Le=ge.getParameters(C,V.state,ve,k,K),Fe=ge.getProgramCacheKey(Le);let Ze=J.programs;J.environment=C.isMeshStandardMaterial?k.environment:null,J.fog=k.fog,J.envMap=(C.isMeshStandardMaterial?F:v).get(C.envMap||J.environment),J.envMapRotation=J.environment!==null&&C.envMap===null?k.environmentRotation:C.envMapRotation,Ze===void 0&&(C.addEventListener("dispose",Qe),Ze=new Map,J.programs=Ze);let qe=Ze.get(Fe);if(qe!==void 0){if(J.currentProgram===qe&&J.lightsStateVersion===Ee)return Cd(C,Le),qe}else Le.uniforms=ge.getUniforms(C),C.onBeforeCompile(Le,S),qe=ge.acquireProgram(Le,Fe),Ze.set(Fe,qe),J.uniforms=Le.uniforms;const Ve=J.uniforms;return(!C.isShaderMaterial&&!C.isRawShaderMaterial||C.clipping===!0)&&(Ve.clippingPlanes=he.uniform),Cd(C,Le),J.needsLights=$p(C),J.lightsStateVersion=Ee,J.needsLights&&(Ve.ambientLightColor.value=V.state.ambient,Ve.lightProbe.value=V.state.probe,Ve.directionalLights.value=V.state.directional,Ve.directionalLightShadows.value=V.state.directionalShadow,Ve.spotLights.value=V.state.spot,Ve.spotLightShadows.value=V.state.spotShadow,Ve.rectAreaLights.value=V.state.rectArea,Ve.ltc_1.value=V.state.rectAreaLTC1,Ve.ltc_2.value=V.state.rectAreaLTC2,Ve.pointLights.value=V.state.point,Ve.pointLightShadows.value=V.state.pointShadow,Ve.hemisphereLights.value=V.state.hemi,Ve.directionalShadowMap.value=V.state.directionalShadowMap,Ve.directionalShadowMatrix.value=V.state.directionalShadowMatrix,Ve.spotShadowMap.value=V.state.spotShadowMap,Ve.spotLightMatrix.value=V.state.spotLightMatrix,Ve.spotLightMap.value=V.state.spotLightMap,Ve.pointShadowMap.value=V.state.pointShadowMap,Ve.pointShadowMatrix.value=V.state.pointShadowMatrix),J.currentProgram=qe,J.uniformsList=null,qe}function Td(C){if(C.uniformsList===null){const k=C.currentProgram.getUniforms();C.uniformsList=sa.seqWithValue(k.seq,C.uniforms)}return C.uniformsList}function Cd(C,k){const K=Q.get(C);K.outputColorSpace=k.outputColorSpace,K.batching=k.batching,K.batchingColor=k.batchingColor,K.instancing=k.instancing,K.instancingColor=k.instancingColor,K.instancingMorph=k.instancingMorph,K.skinning=k.skinning,K.morphTargets=k.morphTargets,K.morphNormals=k.morphNormals,K.morphColors=k.morphColors,K.morphTargetsCount=k.morphTargetsCount,K.numClippingPlanes=k.numClippingPlanes,K.numIntersection=k.numClipIntersection,K.vertexAlphas=k.vertexAlphas,K.vertexTangents=k.vertexTangents,K.toneMapping=k.toneMapping}function Vp(C,k,K,J,V){k.isScene!==!0&&(k=Ne),M.resetTextureUnits();const ve=k.fog,Ee=J.isMeshStandardMaterial?k.environment:null,Le=R===null?S.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:ao,Fe=(J.isMeshStandardMaterial?F:v).get(J.envMap||Ee),Ze=J.vertexColors===!0&&!!K.attributes.color&&K.attributes.color.itemSize===4,qe=!!K.attributes.tangent&&(!!J.normalMap||J.anisotropy>0),Ve=!!K.morphAttributes.position,ut=!!K.morphAttributes.normal,mt=!!K.morphAttributes.color;let Ut=zi;J.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(Ut=S.toneMapping);const Dt=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,ht=Dt!==void 0?Dt.length:0,We=Q.get(J),Gt=p.state.lights;if(N===!0&&(le===!0||C!==g)){const nn=C===g&&J.id===E;he.setState(J,C,nn)}let _t=!1;J.version===We.__version?(We.needsLights&&We.lightsStateVersion!==Gt.state.version||We.outputColorSpace!==Le||V.isBatchedMesh&&We.batching===!1||!V.isBatchedMesh&&We.batching===!0||V.isBatchedMesh&&We.batchingColor===!0&&V.colorTexture===null||V.isBatchedMesh&&We.batchingColor===!1&&V.colorTexture!==null||V.isInstancedMesh&&We.instancing===!1||!V.isInstancedMesh&&We.instancing===!0||V.isSkinnedMesh&&We.skinning===!1||!V.isSkinnedMesh&&We.skinning===!0||V.isInstancedMesh&&We.instancingColor===!0&&V.instanceColor===null||V.isInstancedMesh&&We.instancingColor===!1&&V.instanceColor!==null||V.isInstancedMesh&&We.instancingMorph===!0&&V.morphTexture===null||V.isInstancedMesh&&We.instancingMorph===!1&&V.morphTexture!==null||We.envMap!==Fe||J.fog===!0&&We.fog!==ve||We.numClippingPlanes!==void 0&&(We.numClippingPlanes!==he.numPlanes||We.numIntersection!==he.numIntersection)||We.vertexAlphas!==Ze||We.vertexTangents!==qe||We.morphTargets!==Ve||We.morphNormals!==ut||We.morphColors!==mt||We.toneMapping!==Ut||We.morphTargetsCount!==ht)&&(_t=!0):(_t=!0,We.__version=J.version);let An=We.currentProgram;_t===!0&&(An=mr(J,k,V));let Es=!1,fn=!1,xo=!1;const At=An.getUniforms(),bn=We.uniforms;if(ne.useProgram(An.program)&&(Es=!0,fn=!0,xo=!0),J.id!==E&&(E=J.id,fn=!0),Es||g!==C){ne.buffers.depth.getReversed()?(Y.copy(C.projectionMatrix),wU(Y),TU(Y),At.setValue(x,"projectionMatrix",Y)):At.setValue(x,"projectionMatrix",C.projectionMatrix),At.setValue(x,"viewMatrix",C.matrixWorldInverse);const ln=At.map.cameraPosition;ln!==void 0&&ln.setValue(x,Oe.setFromMatrixPosition(C.matrixWorld)),te.logarithmicDepthBuffer&&At.setValue(x,"logDepthBufFC",2/(Math.log(C.far+1)/Math.LN2)),(J.isMeshPhongMaterial||J.isMeshToonMaterial||J.isMeshLambertMaterial||J.isMeshBasicMaterial||J.isMeshStandardMaterial||J.isShaderMaterial)&&At.setValue(x,"isOrthographic",C.isOrthographicCamera===!0),g!==C&&(g=C,fn=!0,xo=!0)}if(V.isSkinnedMesh){At.setOptional(x,V,"bindMatrix"),At.setOptional(x,V,"bindMatrixInverse");const nn=V.skeleton;nn&&(nn.boneTexture===null&&nn.computeBoneTexture(),At.setValue(x,"boneTexture",nn.boneTexture,M))}V.isBatchedMesh&&(At.setOptional(x,V,"batchingTexture"),At.setValue(x,"batchingTexture",V._matricesTexture,M),At.setOptional(x,V,"batchingIdTexture"),At.setValue(x,"batchingIdTexture",V._indirectTexture,M),At.setOptional(x,V,"batchingColorTexture"),V._colorsTexture!==null&&At.setValue(x,"batchingColorTexture",V._colorsTexture,M));const yn=K.morphAttributes;if((yn.position!==void 0||yn.normal!==void 0||yn.color!==void 0)&&$e.update(V,K,An),(fn||We.receiveShadow!==V.receiveShadow)&&(We.receiveShadow=V.receiveShadow,At.setValue(x,"receiveShadow",V.receiveShadow)),J.isMeshGouraudMaterial&&J.envMap!==null&&(bn.envMap.value=Fe,bn.flipEnvMap.value=Fe.isCubeTexture&&Fe.isRenderTargetTexture===!1?-1:1),J.isMeshStandardMaterial&&J.envMap===null&&k.environment!==null&&(bn.envMapIntensity.value=k.environmentIntensity),fn&&(At.setValue(x,"toneMappingExposure",S.toneMappingExposure),We.needsLights&&Hp(bn,xo),ve&&J.fog===!0&&pe.refreshFogUniforms(bn,ve),pe.refreshMaterialUniforms(bn,J,G,ae,p.state.transmissionRenderTarget[C.id]),sa.upload(x,Td(We),bn,M)),J.isShaderMaterial&&J.uniformsNeedUpdate===!0&&(sa.upload(x,Td(We),bn,M),J.uniformsNeedUpdate=!1),J.isSpriteMaterial&&At.setValue(x,"center",V.center),At.setValue(x,"modelViewMatrix",V.modelViewMatrix),At.setValue(x,"normalMatrix",V.normalMatrix),At.setValue(x,"modelMatrix",V.matrixWorld),J.isShaderMaterial||J.isRawShaderMaterial){const nn=J.uniformsGroups;for(let ln=0,ka=nn.length;ln<ka;ln++){const Gi=nn[ln];z.update(Gi,An),z.bind(Gi,An)}}return An}function Hp(C,k){C.ambientLightColor.needsUpdate=k,C.lightProbe.needsUpdate=k,C.directionalLights.needsUpdate=k,C.directionalLightShadows.needsUpdate=k,C.pointLights.needsUpdate=k,C.pointLightShadows.needsUpdate=k,C.spotLights.needsUpdate=k,C.spotLightShadows.needsUpdate=k,C.rectAreaLights.needsUpdate=k,C.hemisphereLights.needsUpdate=k}function $p(C){return C.isMeshLambertMaterial||C.isMeshToonMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isShadowMaterial||C.isShaderMaterial&&C.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return D},this.getRenderTarget=function(){return R},this.setRenderTargetTextures=function(C,k,K){const J=Q.get(C);J.__autoAllocateDepthBuffer=C.resolveDepthBuffer===!1,J.__autoAllocateDepthBuffer===!1&&(J.__useRenderToTexture=!1),Q.get(C.texture).__webglTexture=k,Q.get(C.depthTexture).__webglTexture=J.__autoAllocateDepthBuffer?void 0:K,J.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(C,k){const K=Q.get(C);K.__webglFramebuffer=k,K.__useDefaultFramebuffer=k===void 0};const Gp=x.createFramebuffer();this.setRenderTarget=function(C,k=0,K=0){R=C,P=k,D=K;let J=!0,V=null,ve=!1,Ee=!1;if(C){const Fe=Q.get(C);if(Fe.__useDefaultFramebuffer!==void 0)ne.bindFramebuffer(x.FRAMEBUFFER,null),J=!1;else if(Fe.__webglFramebuffer===void 0)M.setupRenderTarget(C);else if(Fe.__hasExternalTextures)M.rebindTextures(C,Q.get(C.texture).__webglTexture,Q.get(C.depthTexture).__webglTexture);else if(C.depthBuffer){const Ve=C.depthTexture;if(Fe.__boundDepthTexture!==Ve){if(Ve!==null&&Q.has(Ve)&&(C.width!==Ve.image.width||C.height!==Ve.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");M.setupDepthRenderbuffer(C)}}const Ze=C.texture;(Ze.isData3DTexture||Ze.isDataArrayTexture||Ze.isCompressedArrayTexture)&&(Ee=!0);const qe=Q.get(C).__webglFramebuffer;C.isWebGLCubeRenderTarget?(Array.isArray(qe[k])?V=qe[k][K]:V=qe[k],ve=!0):C.samples>0&&M.useMultisampledRTT(C)===!1?V=Q.get(C).__webglMultisampledFramebuffer:Array.isArray(qe)?V=qe[K]:V=qe,L.copy(C.viewport),O.copy(C.scissor),H=C.scissorTest}else L.copy(Re).multiplyScalar(G).floor(),O.copy(Be).multiplyScalar(G).floor(),H=Je;if(K!==0&&(V=Gp),ne.bindFramebuffer(x.FRAMEBUFFER,V)&&J&&ne.drawBuffers(C,V),ne.viewport(L),ne.scissor(O),ne.setScissorTest(H),ve){const Fe=Q.get(C.texture);x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_CUBE_MAP_POSITIVE_X+k,Fe.__webglTexture,K)}else if(Ee){const Fe=Q.get(C.texture),Ze=k;x.framebufferTextureLayer(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,Fe.__webglTexture,K,Ze)}else if(C!==null&&K!==0){const Fe=Q.get(C.texture);x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,Fe.__webglTexture,K)}E=-1},this.readRenderTargetPixels=function(C,k,K,J,V,ve,Ee){if(!(C&&C.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Le=Q.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Ee!==void 0&&(Le=Le[Ee]),Le){ne.bindFramebuffer(x.FRAMEBUFFER,Le);try{const Fe=C.texture,Ze=Fe.format,qe=Fe.type;if(!te.textureFormatReadable(Ze)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!te.textureTypeReadable(qe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k>=0&&k<=C.width-J&&K>=0&&K<=C.height-V&&x.readPixels(k,K,J,V,Ge.convert(Ze),Ge.convert(qe),ve)}finally{const Fe=R!==null?Q.get(R).__webglFramebuffer:null;ne.bindFramebuffer(x.FRAMEBUFFER,Fe)}}},this.readRenderTargetPixelsAsync=async function(C,k,K,J,V,ve,Ee){if(!(C&&C.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Le=Q.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Ee!==void 0&&(Le=Le[Ee]),Le)if(k>=0&&k<=C.width-J&&K>=0&&K<=C.height-V){ne.bindFramebuffer(x.FRAMEBUFFER,Le);const Fe=C.texture,Ze=Fe.format,qe=Fe.type;if(!te.textureFormatReadable(Ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!te.textureTypeReadable(qe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ve=x.createBuffer();x.bindBuffer(x.PIXEL_PACK_BUFFER,Ve),x.bufferData(x.PIXEL_PACK_BUFFER,ve.byteLength,x.STREAM_READ),x.readPixels(k,K,J,V,Ge.convert(Ze),Ge.convert(qe),0);const ut=R!==null?Q.get(R).__webglFramebuffer:null;ne.bindFramebuffer(x.FRAMEBUFFER,ut);const mt=x.fenceSync(x.SYNC_GPU_COMMANDS_COMPLETE,0);return x.flush(),await EU(x,mt,4),x.bindBuffer(x.PIXEL_PACK_BUFFER,Ve),x.getBufferSubData(x.PIXEL_PACK_BUFFER,0,ve),x.deleteBuffer(Ve),x.deleteSync(mt),ve}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(C,k=null,K=0){const J=Math.pow(2,-K),V=Math.floor(C.image.width*J),ve=Math.floor(C.image.height*J),Ee=k!==null?k.x:0,Le=k!==null?k.y:0;M.setTexture2D(C,0),x.copyTexSubImage2D(x.TEXTURE_2D,K,0,0,Ee,Le,V,ve),ne.unbindTexture()};const Wp=x.createFramebuffer(),Xp=x.createFramebuffer();this.copyTextureToTexture=function(C,k,K=null,J=null,V=0,ve=null){ve===null&&(V!==0?(ia("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ve=V,V=0):ve=0);let Ee,Le,Fe,Ze,qe,Ve,ut,mt,Ut;const Dt=C.isCompressedTexture?C.mipmaps[ve]:C.image;if(K!==null)Ee=K.max.x-K.min.x,Le=K.max.y-K.min.y,Fe=K.isBox3?K.max.z-K.min.z:1,Ze=K.min.x,qe=K.min.y,Ve=K.isBox3?K.min.z:0;else{const yn=Math.pow(2,-V);Ee=Math.floor(Dt.width*yn),Le=Math.floor(Dt.height*yn),C.isDataArrayTexture?Fe=Dt.depth:C.isData3DTexture?Fe=Math.floor(Dt.depth*yn):Fe=1,Ze=0,qe=0,Ve=0}J!==null?(ut=J.x,mt=J.y,Ut=J.z):(ut=0,mt=0,Ut=0);const ht=Ge.convert(k.format),We=Ge.convert(k.type);let Gt;k.isData3DTexture?(M.setTexture3D(k,0),Gt=x.TEXTURE_3D):k.isDataArrayTexture||k.isCompressedArrayTexture?(M.setTexture2DArray(k,0),Gt=x.TEXTURE_2D_ARRAY):(M.setTexture2D(k,0),Gt=x.TEXTURE_2D),x.pixelStorei(x.UNPACK_FLIP_Y_WEBGL,k.flipY),x.pixelStorei(x.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),x.pixelStorei(x.UNPACK_ALIGNMENT,k.unpackAlignment);const _t=x.getParameter(x.UNPACK_ROW_LENGTH),An=x.getParameter(x.UNPACK_IMAGE_HEIGHT),Es=x.getParameter(x.UNPACK_SKIP_PIXELS),fn=x.getParameter(x.UNPACK_SKIP_ROWS),xo=x.getParameter(x.UNPACK_SKIP_IMAGES);x.pixelStorei(x.UNPACK_ROW_LENGTH,Dt.width),x.pixelStorei(x.UNPACK_IMAGE_HEIGHT,Dt.height),x.pixelStorei(x.UNPACK_SKIP_PIXELS,Ze),x.pixelStorei(x.UNPACK_SKIP_ROWS,qe),x.pixelStorei(x.UNPACK_SKIP_IMAGES,Ve);const At=C.isDataArrayTexture||C.isData3DTexture,bn=k.isDataArrayTexture||k.isData3DTexture;if(C.isDepthTexture){const yn=Q.get(C),nn=Q.get(k),ln=Q.get(yn.__renderTarget),ka=Q.get(nn.__renderTarget);ne.bindFramebuffer(x.READ_FRAMEBUFFER,ln.__webglFramebuffer),ne.bindFramebuffer(x.DRAW_FRAMEBUFFER,ka.__webglFramebuffer);for(let Gi=0;Gi<Fe;Gi++)At&&(x.framebufferTextureLayer(x.READ_FRAMEBUFFER,x.COLOR_ATTACHMENT0,Q.get(C).__webglTexture,V,Ve+Gi),x.framebufferTextureLayer(x.DRAW_FRAMEBUFFER,x.COLOR_ATTACHMENT0,Q.get(k).__webglTexture,ve,Ut+Gi)),x.blitFramebuffer(Ze,qe,Ee,Le,ut,mt,Ee,Le,x.DEPTH_BUFFER_BIT,x.NEAREST);ne.bindFramebuffer(x.READ_FRAMEBUFFER,null),ne.bindFramebuffer(x.DRAW_FRAMEBUFFER,null)}else if(V!==0||C.isRenderTargetTexture||Q.has(C)){const yn=Q.get(C),nn=Q.get(k);ne.bindFramebuffer(x.READ_FRAMEBUFFER,Wp),ne.bindFramebuffer(x.DRAW_FRAMEBUFFER,Xp);for(let ln=0;ln<Fe;ln++)At?x.framebufferTextureLayer(x.READ_FRAMEBUFFER,x.COLOR_ATTACHMENT0,yn.__webglTexture,V,Ve+ln):x.framebufferTexture2D(x.READ_FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,yn.__webglTexture,V),bn?x.framebufferTextureLayer(x.DRAW_FRAMEBUFFER,x.COLOR_ATTACHMENT0,nn.__webglTexture,ve,Ut+ln):x.framebufferTexture2D(x.DRAW_FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,nn.__webglTexture,ve),V!==0?x.blitFramebuffer(Ze,qe,Ee,Le,ut,mt,Ee,Le,x.COLOR_BUFFER_BIT,x.NEAREST):bn?x.copyTexSubImage3D(Gt,ve,ut,mt,Ut+ln,Ze,qe,Ee,Le):x.copyTexSubImage2D(Gt,ve,ut,mt,Ze,qe,Ee,Le);ne.bindFramebuffer(x.READ_FRAMEBUFFER,null),ne.bindFramebuffer(x.DRAW_FRAMEBUFFER,null)}else bn?C.isDataTexture||C.isData3DTexture?x.texSubImage3D(Gt,ve,ut,mt,Ut,Ee,Le,Fe,ht,We,Dt.data):k.isCompressedArrayTexture?x.compressedTexSubImage3D(Gt,ve,ut,mt,Ut,Ee,Le,Fe,ht,Dt.data):x.texSubImage3D(Gt,ve,ut,mt,Ut,Ee,Le,Fe,ht,We,Dt):C.isDataTexture?x.texSubImage2D(x.TEXTURE_2D,ve,ut,mt,Ee,Le,ht,We,Dt.data):C.isCompressedTexture?x.compressedTexSubImage2D(x.TEXTURE_2D,ve,ut,mt,Dt.width,Dt.height,ht,Dt.data):x.texSubImage2D(x.TEXTURE_2D,ve,ut,mt,Ee,Le,ht,We,Dt);x.pixelStorei(x.UNPACK_ROW_LENGTH,_t),x.pixelStorei(x.UNPACK_IMAGE_HEIGHT,An),x.pixelStorei(x.UNPACK_SKIP_PIXELS,Es),x.pixelStorei(x.UNPACK_SKIP_ROWS,fn),x.pixelStorei(x.UNPACK_SKIP_IMAGES,xo),ve===0&&k.generateMipmaps&&x.generateMipmap(Gt),ne.unbindTexture()},this.copyTextureToTexture3D=function(C,k,K=null,J=null,V=0){return ia('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(C,k,K,J,V)},this.initRenderTarget=function(C){Q.get(C).__webglFramebuffer===void 0&&M.setupRenderTarget(C)},this.initTexture=function(C){C.isCubeTexture?M.setTextureCube(C,0):C.isData3DTexture?M.setTexture3D(C,0):C.isDataArrayTexture||C.isCompressedArrayTexture?M.setTexture2DArray(C,0):M.setTexture2D(C,0),ne.unbindTexture()},this.resetState=function(){P=0,D=0,R=null,ne.reset(),gt.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return hi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=ft._getDrawingBufferColorSpace(e),n.unpackColorSpace=ft._getUnpackColorSpace()}}const Ih={type:"change"},bd={type:"start"},Bp={type:"end"},Gr=new Fa,Lh=new Di,Zk=Math.cos(70*SU.DEG2RAD),kt=new U,cn=2*Math.PI,yt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},wl=1e-6;class Kk extends Up{constructor(e,n=null){super(e,n),this.state=yt.NONE,this.target=new U,this.cursor=new U,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Zs.ROTATE,MIDDLE:Zs.DOLLY,RIGHT:Zs.PAN},this.touches={ONE:Gs.ROTATE,TWO:Gs.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new U,this._lastQuaternion=new Xt,this._lastTargetPosition=new U,this._quat=new Xt().setFromUnitVectors(e.up,new U(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new rh,this._sphericalDelta=new rh,this._scale=1,this._panOffset=new U,this._rotateStart=new Ke,this._rotateEnd=new Ke,this._rotateDelta=new Ke,this._panStart=new Ke,this._panEnd=new Ke,this._panDelta=new Ke,this._dollyStart=new Ke,this._dollyEnd=new Ke,this._dollyDelta=new Ke,this._dollyDirection=new U,this._mouse=new Ke,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Qk.bind(this),this._onPointerDown=Jk.bind(this),this._onPointerUp=e4.bind(this),this._onContextMenu=a4.bind(this),this._onMouseWheel=i4.bind(this),this._onKeyDown=s4.bind(this),this._onTouchStart=o4.bind(this),this._onTouchMove=r4.bind(this),this._onMouseDown=t4.bind(this),this._onMouseMove=n4.bind(this),this._interceptControlDown=l4.bind(this),this._interceptControlUp=c4.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Ih),this.update(),this.state=yt.NONE}update(e=null){const n=this.object.position;kt.copy(n).sub(this.target),kt.applyQuaternion(this._quat),this._spherical.setFromVector3(kt),this.autoRotate&&this.state===yt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,s=this.maxAzimuthAngle;isFinite(i)&&isFinite(s)&&(i<-Math.PI?i+=cn:i>Math.PI&&(i-=cn),s<-Math.PI?s+=cn:s>Math.PI&&(s-=cn),i<=s?this._spherical.theta=Math.max(i,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+s)/2?Math.max(i,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let o=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const r=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),o=r!=this._spherical.radius}if(kt.setFromSpherical(this._spherical),kt.applyQuaternion(this._quatInverse),n.copy(this.target).add(kt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let r=null;if(this.object.isPerspectiveCamera){const a=kt.length();r=this._clampDistance(a*this._scale);const l=a-r;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),o=!!l}else if(this.object.isOrthographicCamera){const a=new U(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),o=l!==this.object.zoom;const d=new U(this._mouse.x,this._mouse.y,0);d.unproject(this.object),this.object.position.sub(d).add(a),this.object.updateMatrixWorld(),r=kt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;r!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(r).add(this.object.position):(Gr.origin.copy(this.object.position),Gr.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Gr.direction))<Zk?this.object.lookAt(this.target):(Lh.setFromNormalAndCoplanarPoint(this.object.up,this.target),Gr.intersectPlane(Lh,this.target))))}else if(this.object.isOrthographicCamera){const r=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),r!==this.object.zoom&&(this.object.updateProjectionMatrix(),o=!0)}return this._scale=1,this._performCursorZoom=!1,o||this._lastPosition.distanceToSquared(this.object.position)>wl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>wl||this._lastTargetPosition.distanceToSquared(this.target)>wl?(this.dispatchEvent(Ih),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?cn/60*this.autoRotateSpeed*e:cn/60/60*this.autoRotateSpeed}_getZoomScale(e){const n=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,n){kt.setFromMatrixColumn(n,0),kt.multiplyScalar(-e),this._panOffset.add(kt)}_panUp(e,n){this.screenSpacePanning===!0?kt.setFromMatrixColumn(n,1):(kt.setFromMatrixColumn(n,0),kt.crossVectors(this.object.up,kt)),kt.multiplyScalar(e),this._panOffset.add(kt)}_pan(e,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;kt.copy(s).sub(this.target);let o=kt.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*o/i.clientHeight,this.object.matrix),this._panUp(2*n*o/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),s=e-i.left,o=n-i.top,r=i.width,a=i.height;this._mouse.x=s/r*2-1,this._mouse.y=-(o/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(cn*this._rotateDelta.x/n.clientHeight),this._rotateUp(cn*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let n=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-cn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateStart.set(i,s)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._panStart.set(i,s)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,s=e.pageY-n.y,o=Math.sqrt(i*i+s*s);this._dollyStart.set(0,o)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const i=this._getSecondPointerPosition(e),s=.5*(e.pageX+i.x),o=.5*(e.pageY+i.y);this._rotateEnd.set(s,o)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(cn*this._rotateDelta.x/n.clientHeight),this._rotateUp(cn*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._panEnd.set(i,s)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,s=e.pageY-n.y,o=Math.sqrt(i*i+s*s);this._dollyEnd.set(0,o),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const r=(e.pageX+n.x)*.5,a=(e.pageY+n.y)*.5;this._updateZoomParameters(r,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId){this._pointers.splice(n,1);return}}_isTrackingPointer(e){for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId)return!0;return!1}_trackPointer(e){let n=this._pointerPositions[e.pointerId];n===void 0&&(n=new Ke,this._pointerPositions[e.pointerId]=n),n.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const n=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[n]}_customWheelEvent(e){const n=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(n){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function Jk(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t)))}function Qk(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function e4(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Bp),this.state=yt.NONE;break;case 1:const e=this._pointers[0],n=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:n.x,pageY:n.y});break}}function t4(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Zs.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=yt.DOLLY;break;case Zs.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=yt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=yt.ROTATE}break;case Zs.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=yt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=yt.PAN}break;default:this.state=yt.NONE}this.state!==yt.NONE&&this.dispatchEvent(bd)}function n4(t){switch(this.state){case yt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case yt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case yt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function i4(t){this.enabled===!1||this.enableZoom===!1||this.state!==yt.NONE||(t.preventDefault(),this.dispatchEvent(bd),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(Bp))}function s4(t){this.enabled!==!1&&this._handleKeyDown(t)}function o4(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case Gs.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=yt.TOUCH_ROTATE;break;case Gs.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=yt.TOUCH_PAN;break;default:this.state=yt.NONE}break;case 2:switch(this.touches.TWO){case Gs.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=yt.TOUCH_DOLLY_PAN;break;case Gs.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=yt.TOUCH_DOLLY_ROTATE;break;default:this.state=yt.NONE}break;default:this.state=yt.NONE}this.state!==yt.NONE&&this.dispatchEvent(bd)}function r4(t){switch(this._trackPointer(t),this.state){case yt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case yt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case yt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case yt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=yt.NONE}}function a4(t){this.enabled!==!1&&t.preventDefault()}function l4(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function c4(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const ts=new dF,Kt=new U,Ci=new U,Pt=new Xt,Uh={X:new U(1,0,0),Y:new U(0,1,0),Z:new U(0,0,1)},Tl={type:"change"},Fh={type:"mouseDown",mode:null},Oh={type:"mouseUp",mode:null},Nh={type:"objectChange"};class d4 extends Up{constructor(e,n=null){super(void 0,n);const i=new _4(this);this._root=i;const s=new g4;this._gizmo=s,i.add(s);const o=new v4;this._plane=o,i.add(o);const r=this;function a(w,S){let I=S;Object.defineProperty(r,w,{get:function(){return I!==void 0?I:S},set:function(P){I!==P&&(I=P,o[w]=P,s[w]=P,r.dispatchEvent({type:w+"-changed",value:P}),r.dispatchEvent(Tl))}}),r[w]=S,o[w]=S,s[w]=S}a("camera",e),a("object",void 0),a("enabled",!0),a("axis",null),a("mode","translate"),a("translationSnap",null),a("rotationSnap",null),a("scaleSnap",null),a("space","world"),a("size",1),a("dragging",!1),a("showX",!0),a("showY",!0),a("showZ",!0),a("minX",-1/0),a("maxX",1/0),a("minY",-1/0),a("maxY",1/0),a("minZ",-1/0),a("maxZ",1/0);const l=new U,d=new U,u=new Xt,f=new Xt,h=new U,m=new Xt,b=new U,y=new U,_=new U,p=0,T=new U;a("worldPosition",l),a("worldPositionStart",d),a("worldQuaternion",u),a("worldQuaternionStart",f),a("cameraPosition",h),a("cameraQuaternion",m),a("pointStart",b),a("pointEnd",y),a("rotationAxis",_),a("rotationAngle",p),a("eye",T),this._offset=new U,this._startNorm=new U,this._endNorm=new U,this._cameraScale=new U,this._parentPosition=new U,this._parentQuaternion=new Xt,this._parentQuaternionInv=new Xt,this._parentScale=new U,this._worldScaleStart=new U,this._worldQuaternionInv=new Xt,this._worldScale=new U,this._positionStart=new U,this._quaternionStart=new Xt,this._scaleStart=new U,this._getPointer=u4.bind(this),this._onPointerDown=f4.bind(this),this._onPointerHover=h4.bind(this),this._onPointerMove=p4.bind(this),this._onPointerUp=m4.bind(this),n!==null&&this.connect(n)}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="auto"}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&ts.setFromCamera(e,this.camera);const n=Cl(this._gizmo.picker[this.mode],ts);n?this.axis=n.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&ts.setFromCamera(e,this.camera);const n=Cl(this._plane,ts,!0);n&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(n.point).sub(this.worldPositionStart)),this.dragging=!0,Fh.mode=this.mode,this.dispatchEvent(Fh)}}pointerMove(e){const n=this.axis,i=this.mode,s=this.object;let o=this.space;if(i==="scale"?o="local":(n==="E"||n==="XYZE"||n==="XYZ")&&(o="world"),s===void 0||n===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&ts.setFromCamera(e,this.camera);const r=Cl(this._plane,ts,!0);if(!!r){if(this.pointEnd.copy(r.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),o==="local"&&n!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),n.indexOf("X")===-1&&(this._offset.x=0),n.indexOf("Y")===-1&&(this._offset.y=0),n.indexOf("Z")===-1&&(this._offset.z=0),o==="local"&&n!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(o==="local"&&(s.position.applyQuaternion(Pt.copy(this._quaternionStart).invert()),n.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),n.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),n.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),o==="world"&&(s.parent&&s.position.add(Kt.setFromMatrixPosition(s.parent.matrixWorld)),n.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),n.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),n.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(Kt.setFromMatrixPosition(s.parent.matrixWorld)))),s.position.x=Math.max(this.minX,Math.min(this.maxX,s.position.x)),s.position.y=Math.max(this.minY,Math.min(this.maxY,s.position.y)),s.position.z=Math.max(this.minZ,Math.min(this.maxZ,s.position.z));else if(i==="scale"){if(n.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Ci.set(a,a,a)}else Kt.copy(this.pointStart),Ci.copy(this.pointEnd),Kt.applyQuaternion(this._worldQuaternionInv),Ci.applyQuaternion(this._worldQuaternionInv),Ci.divide(Kt),n.search("X")===-1&&(Ci.x=1),n.search("Y")===-1&&(Ci.y=1),n.search("Z")===-1&&(Ci.z=1);s.scale.copy(this._scaleStart).multiply(Ci),this.scaleSnap&&(n.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),n.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),n.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Kt.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;n==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Kt.copy(this.rotationAxis).cross(this.eye))*a):(n==="X"||n==="Y"||n==="Z")&&(this.rotationAxis.copy(Uh[n]),Kt.copy(Uh[n]),o==="local"&&Kt.applyQuaternion(this.worldQuaternion),Kt.cross(this.eye),Kt.length()===0?l=!0:this.rotationAngle=this._offset.dot(Kt.normalize())*a),(n==="E"||l)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),o==="local"&&n!=="E"&&n!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(Pt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(Pt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Tl),this.dispatchEvent(Nh)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(Oh.mode=this.mode,this.dispatchEvent(Oh)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,this}reset(){!this.enabled||this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(Tl),this.dispatchEvent(Nh),this.pointStart.copy(this.pointEnd))}getRaycaster(){return ts}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function u4(t){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};{const e=this.domElement.getBoundingClientRect();return{x:(t.clientX-e.left)/e.width*2-1,y:-(t.clientY-e.top)/e.height*2+1,button:t.button}}}function h4(t){if(!!this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(t));break}}function f4(t){!this.enabled||(document.pointerLockElement||this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(t)),this.pointerDown(this._getPointer(t)))}function p4(t){!this.enabled||this.pointerMove(this._getPointer(t))}function m4(t){!this.enabled||(this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(t)))}function Cl(t,e,n){const i=e.intersectObject(t,!0);for(let s=0;s<i.length;s++)if(i[s].object.visible||n)return i[s];return!1}const Wr=new Vn,xt=new U(0,1,0),zh=new U(0,0,0),kh=new Tt,Xr=new Xt,oa=new Xt,Gn=new U,Bh=new Tt,Oo=new U(1,0,0),os=new U(0,1,0),No=new U(0,0,1),jr=new U,Ro=new U,Do=new U;class _4 extends Nt{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){const n=this.controls;n.object!==void 0&&(n.object.updateMatrixWorld(),n.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):n.object.parent.matrixWorld.decompose(n._parentPosition,n._parentQuaternion,n._parentScale),n.object.matrixWorld.decompose(n.worldPosition,n.worldQuaternion,n._worldScale),n._parentQuaternionInv.copy(n._parentQuaternion).invert(),n._worldQuaternionInv.copy(n.worldQuaternion).invert()),n.camera.updateMatrixWorld(),n.camera.matrixWorld.decompose(n.cameraPosition,n.cameraQuaternion,n._cameraScale),n.camera.isOrthographicCamera?n.camera.getWorldDirection(n.eye).negate():n.eye.copy(n.cameraPosition).sub(n.worldPosition).normalize(),super.updateMatrixWorld(e)}dispose(){this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}}class g4 extends Nt{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new Oa({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),n=new fr({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=e.clone();i.opacity=.15;const s=n.clone();s.opacity=.5;const o=e.clone();o.color.setHex(16711680);const r=e.clone();r.color.setHex(65280);const a=e.clone();a.color.setHex(255);const l=e.clone();l.color.setHex(16711680),l.opacity=.5;const d=e.clone();d.color.setHex(65280),d.opacity=.5;const u=e.clone();u.color.setHex(255),u.opacity=.5;const f=e.clone();f.opacity=.25;const h=e.clone();h.color.setHex(16776960),h.opacity=.25,e.clone().color.setHex(16776960);const b=e.clone();b.color.setHex(7895160);const y=new Wt(0,.04,.1,12);y.translate(0,.05,0);const _=new Ot(.08,.08,.08);_.translate(0,.04,0);const p=new tn;p.setAttribute("position",new Et([0,0,0,1,0,0],3));const T=new Wt(.0075,.0075,.5,3);T.translate(0,.25,0);function w(re,q){const ae=new cs(re,.0075,3,64,q*Math.PI*2);return ae.rotateY(Math.PI/2),ae.rotateX(Math.PI/2),ae}function S(){const re=new tn;return re.setAttribute("position",new Et([0,0,0,1,1,1],3)),re}const I={X:[[new Ae(y,o),[.5,0,0],[0,0,-Math.PI/2]],[new Ae(y,o),[-.5,0,0],[0,0,Math.PI/2]],[new Ae(T,o),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new Ae(y,r),[0,.5,0]],[new Ae(y,r),[0,-.5,0],[Math.PI,0,0]],[new Ae(T,r)]],Z:[[new Ae(y,a),[0,0,.5],[Math.PI/2,0,0]],[new Ae(y,a),[0,0,-.5],[-Math.PI/2,0,0]],[new Ae(T,a),null,[Math.PI/2,0,0]]],XYZ:[[new Ae(new Ws(.1,0),f.clone()),[0,0,0]]],XY:[[new Ae(new Ot(.15,.15,.01),u.clone()),[.15,.15,0]]],YZ:[[new Ae(new Ot(.15,.15,.01),l.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Ae(new Ot(.15,.15,.01),d.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},P={X:[[new Ae(new Wt(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new Ae(new Wt(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new Ae(new Wt(.2,0,.6,4),i),[0,.3,0]],[new Ae(new Wt(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new Ae(new Wt(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new Ae(new Wt(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new Ae(new Ws(.2,0),i)]],XY:[[new Ae(new Ot(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new Ae(new Ot(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Ae(new Ot(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},D={START:[[new Ae(new Ws(.01,2),s),null,null,null,"helper"]],END:[[new Ae(new Ws(.01,2),s),null,null,null,"helper"]],DELTA:[[new ci(S(),s),null,null,null,"helper"]],X:[[new ci(p,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ci(p,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ci(p,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},R={XYZE:[[new Ae(w(.5,1),b),null,[0,Math.PI/2,0]]],X:[[new Ae(w(.5,.5),o)]],Y:[[new Ae(w(.5,.5),r),null,[0,0,-Math.PI/2]]],Z:[[new Ae(w(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new Ae(w(.75,1),h),null,[0,Math.PI/2,0]]]},E={AXIS:[[new ci(p,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},g={XYZE:[[new Ae(new gd(.25,10,8),i)]],X:[[new Ae(new cs(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new Ae(new cs(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new Ae(new cs(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new Ae(new cs(.75,.1,2,24),i)]]},L={X:[[new Ae(_,o),[.5,0,0],[0,0,-Math.PI/2]],[new Ae(T,o),[0,0,0],[0,0,-Math.PI/2]],[new Ae(_,o),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new Ae(_,r),[0,.5,0]],[new Ae(T,r)],[new Ae(_,r),[0,-.5,0],[0,0,Math.PI]]],Z:[[new Ae(_,a),[0,0,.5],[Math.PI/2,0,0]],[new Ae(T,a),[0,0,0],[Math.PI/2,0,0]],[new Ae(_,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new Ae(new Ot(.15,.15,.01),u),[.15,.15,0]]],YZ:[[new Ae(new Ot(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Ae(new Ot(.15,.15,.01),d),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new Ae(new Ot(.1,.1,.1),f.clone())]]},O={X:[[new Ae(new Wt(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new Ae(new Wt(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new Ae(new Wt(.2,0,.6,4),i),[0,.3,0]],[new Ae(new Wt(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new Ae(new Wt(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new Ae(new Wt(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new Ae(new Ot(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new Ae(new Ot(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Ae(new Ot(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new Ae(new Ot(.2,.2,.2),i),[0,0,0]]]},H={X:[[new ci(p,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ci(p,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ci(p,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function j(re){const q=new Nt;for(const ae in re)for(let G=re[ae].length;G--;){const fe=re[ae][G][0].clone(),ye=re[ae][G][1],Re=re[ae][G][2],Be=re[ae][G][3],Je=re[ae][G][4];fe.name=ae,fe.tag=Je,ye&&fe.position.set(ye[0],ye[1],ye[2]),Re&&fe.rotation.set(Re[0],Re[1],Re[2]),Be&&fe.scale.set(Be[0],Be[1],Be[2]),fe.updateMatrix();const ce=fe.geometry.clone();ce.applyMatrix4(fe.matrix),fe.geometry=ce,fe.renderOrder=1/0,fe.position.set(0,0,0),fe.rotation.set(0,0,0),fe.scale.set(1,1,1),q.add(fe)}return q}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=j(I)),this.add(this.gizmo.rotate=j(R)),this.add(this.gizmo.scale=j(L)),this.add(this.picker.translate=j(P)),this.add(this.picker.rotate=j(g)),this.add(this.picker.scale=j(O)),this.add(this.helper.translate=j(D)),this.add(this.helper.rotate=j(E)),this.add(this.helper.scale=j(H)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const i=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:oa;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let o=0;o<s.length;o++){const r=s[o];r.visible=!0,r.rotation.set(0,0,0),r.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),r.scale.set(1,1,1).multiplyScalar(a*this.size/4),r.tag==="helper"){r.visible=!1,r.name==="AXIS"?(r.visible=!!this.axis,this.axis==="X"&&(Pt.setFromEuler(Wr.set(0,0,0)),r.quaternion.copy(i).multiply(Pt),Math.abs(xt.copy(Oo).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Y"&&(Pt.setFromEuler(Wr.set(0,0,Math.PI/2)),r.quaternion.copy(i).multiply(Pt),Math.abs(xt.copy(os).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(Pt.setFromEuler(Wr.set(0,Math.PI/2,0)),r.quaternion.copy(i).multiply(Pt),Math.abs(xt.copy(No).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(Pt.setFromEuler(Wr.set(0,Math.PI/2,0)),xt.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(kh.lookAt(zh,xt,os)),r.quaternion.multiply(Pt),r.visible=this.dragging),this.axis==="E"&&(r.visible=!1)):r.name==="START"?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name==="END"?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name==="DELTA"?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),Kt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Kt.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(Kt),r.visible=this.dragging):(r.quaternion.copy(i),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}r.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(r.name==="X"&&Math.abs(xt.copy(Oo).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Y"&&Math.abs(xt.copy(os).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Z"&&Math.abs(xt.copy(No).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XY"&&Math.abs(xt.copy(No).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="YZ"&&Math.abs(xt.copy(Oo).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XZ"&&Math.abs(xt.copy(os).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(Xr.copy(i),xt.copy(this.eye).applyQuaternion(Pt.copy(i).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix(kh.lookAt(this.eye,zh,os)),r.name==="X"&&(Pt.setFromAxisAngle(Oo,Math.atan2(-xt.y,xt.z)),Pt.multiplyQuaternions(Xr,Pt),r.quaternion.copy(Pt)),r.name==="Y"&&(Pt.setFromAxisAngle(os,Math.atan2(xt.x,xt.z)),Pt.multiplyQuaternions(Xr,Pt),r.quaternion.copy(Pt)),r.name==="Z"&&(Pt.setFromAxisAngle(No,Math.atan2(xt.y,xt.x)),Pt.multiplyQuaternions(Xr,Pt),r.quaternion.copy(Pt))),r.visible=r.visible&&(r.name.indexOf("X")===-1||this.showX),r.visible=r.visible&&(r.name.indexOf("Y")===-1||this.showY),r.visible=r.visible&&(r.name.indexOf("Z")===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split("").some(function(l){return r.name===l}))&&(r.material.color.setHex(16776960),r.material.opacity=1)}super.updateMatrixWorld(e)}}class v4 extends Ae{constructor(){super(new bo(1e5,1e5,2,2),new Oa({visible:!1,wireframe:!0,side:Fn,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let n=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(n="local"),jr.copy(Oo).applyQuaternion(n==="local"?this.worldQuaternion:oa),Ro.copy(os).applyQuaternion(n==="local"?this.worldQuaternion:oa),Do.copy(No).applyQuaternion(n==="local"?this.worldQuaternion:oa),xt.copy(Ro),this.mode){case"translate":case"scale":switch(this.axis){case"X":xt.copy(this.eye).cross(jr),Gn.copy(jr).cross(xt);break;case"Y":xt.copy(this.eye).cross(Ro),Gn.copy(Ro).cross(xt);break;case"Z":xt.copy(this.eye).cross(Do),Gn.copy(Do).cross(xt);break;case"XY":Gn.copy(Do);break;case"YZ":Gn.copy(jr);break;case"XZ":xt.copy(Do),Gn.copy(Ro);break;case"XYZ":case"E":Gn.set(0,0,0);break}break;case"rotate":default:Gn.set(0,0,0)}Gn.length()===0?this.quaternion.copy(this.cameraQuaternion):(Bh.lookAt(Kt.set(0,0,0),Gn,xt),this.quaternion.setFromRotationMatrix(Bh)),super.updateMatrixWorld(e)}}let ns,In,ai,Mn;const b4={props:{width:Number,height:Number,x:Number,y:Number,z:Number,a:Number,x_max:Number,x_min:Number,y_max:Number,y_min:Number,z_max:Number,z_min:Number},methods:{render(){ai.render(In,ns)},setSize(){ai.setSize(this.width,this.height),this.render()},setPos(){let t={x:this.x,y:this.y,z:this.z,a:this.a};t.x=t.x>this.x_max?this.x_max:t.x,t.x=t.x<this.x_min?this.x_min:t.x,t.y=t.y>this.y_max?this.y_max:t.y,t.y=t.y<this.y_min?this.y_min:t.y,t.z=t.z>this.z_max?this.z_max:t.z,t.z=t.z<this.z_min?this.z_min:t.z,t.a=1.8*t.a;let e={x:2e3*t.x/(this.x_max-this.x_min),y:2e3*t.y/(this.y_max-this.y_min),z:2e3*t.z/(this.z_max-this.z_min),a:t.a*(Math.PI/180)};Mn.position.z=1e3+e.x,Mn.position.x=1e3+e.y,Mn.position.y=100+e.z,Mn.rotation.set(Math.PI,e.a,0),this.render()}},mounted(){let t,e=this.$refs.container3d;In=new KU,In.background=new at(15790320),ns=new _n(70,this.width/this.height,1,1e4),ns.rotation.set(-Math.PI/2,0,-Math.PI/2),ns.position.set(-300,1800,0),In.add(ns),In.add(new lF(15790320,3));const n=new rF(16777215,4.5);n.position.set(0,1500,200),n.angle=Math.PI*.2,n.decay=0,n.castShadow=!0,n.shadow.camera.near=200,n.shadow.camera.far=2e3,n.shadow.bias=-222e-6,n.shadow.mapSize.width=1024,n.shadow.mapSize.height=1024,In.add(n);const i=new bo(50,50),s=new eF({color:0,opacity:.2}),o=new Ae(i,s);o.position.y=-200,o.receiveShadow=!0,In.add(o);const r=new uF(2e3,20);r.position.y=0,r.material.opacity=.25,r.material.transparent=!0,In.add(r);const a=new hF(200);a.position.x=1e3,a.position.z=1e3,a.rotateY(Math.PI),In.add(a),ai=new qk({antialias:!0}),ai.setPixelRatio(window.devicePixelRatio),ai.setSize(this.width,this.height),ai.shadowMap.enabled=!0,e.appendChild(ai.domElement);const l=new Kk(ns,ai.domElement);l.damping=.2,l.addEventListener("change",this.render),t=new d4(ns,ai.domElement),t.addEventListener("change",this.render),t.addEventListener("dragging-changed",function(h){l.enabled=!h.value}),In.add(t.getHelper()),t.addEventListener("objectChange",function(){updateSplineOutline()});const d=new md(50,200,4,1),u=new fr({color:16777215,transparent:!0,opacity:.5}),f=new tF({color:1401481,emissive:468276,side:Fn,flatShading:!0});Mn=new Uo,Mn.add(new pd(d,u)),Mn.add(new Ae(d,f)),In.add(Mn),Mn.rotateX(Math.PI),Mn.position.y=100,Mn.position.x=1e3,Mn.position.z=1e3,this.setPos(),this.render()},watch:{height(){this.setSize()},width(){this.setPos()},x(){this.setPos()},y(){this.setPos()},z(){this.setPos()},a(){this.setPos()}}},y4={class:"card mt-1"},x4=c("div",{class:"card-header"},"Vializer",-1),S4={class:"card-body"},M4={ref:"container3d",id:"container3d",class:"border p-0 m-0"};function E4(t,e,n,i,s,o){return W(),ee("div",y4,[x4,c("div",S4,[c("div",M4,null,512)])])}var w4=ct(b4,[["render",E4]]);const T4={props:["title","number","width","height"],data:function(){return{winStateClass:"",drag:!1,dragObject:this.dragObject,shiftX:this.shiftX,shiftY:this.shiftY,downX:this.downX,downY:this.downY}},computed:{windowRightOffset(){return 10+(this.number-1)*310}},methods:{toggleMinimize:function(){this.winStateClass==""?this.winStateClass="minimized":this.winStateClass=""},close(){this.$emit("close")},moveOnTop(){let t=document.getElementsByClassName("win"),e=0;for(let n of t)e=Math.max(e,n.style.zIndex),n.style.zIndex--;this.dragObject.style.zIndex=e},mousedownTitle(t){this.moveOnTop();let e=this.dragObject.getBoundingClientRect();this.shiftX=e.left,this.shiftY=e.top,t.type=="mousedown"?(this.downX=t.pageX,this.downY=t.pageY):t.type=="touchstart"&&(this.downX=t.touches[0].pageX,this.downY=t.touches[0].pageY),this.drag=!0},mouseupTitle(){this.drag=!1},dblclickTitle(){this.winStateClass=="minimized"&&(this.winStateClass="")},onMouseMove(t){if(this.drag==!0){let e=0,n=0;t.type=="mousemove"?(e=t.pageX,n=t.pageY):t.type=="touchmove"&&(e=t.touches[0].pageX,n=t.touches[0].pageY),this.dragObject.style.left=this.shiftX+(e-this.downX)+"px",this.dragObject.style.top=this.shiftY+(n-this.downY)+"px"}},setSize:function(){typeof this.width!="undefined"&&(this.dragObject.style.width=this.width+"px"),typeof this.height!="undefined"&&(this.dragObject.style.height=this.height+"px")}},mounted:function(){this.dragObject=this.$refs["win"+this.number],document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("touchmove",this.onMouseMove),this.setSize()},beforeUnmount:function(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("touchmove",this.onMouseMove)},watch:{width(){this.setSize()},height(){this.setSize()}}},C4=c("div",{class:"icon"},null,-1),A4={class:"title"},P4={class:"content"};function R4(t,e,n,i,s,o){return W(),ee("div",{class:je("win "+t.winStateClass),style:uo("z-index: 100; right: "+o.windowRightOffset+"px;"),ref:"win"+n.number,onClick:e[5]||(e[5]=r=>o.moveOnTop())},[c("div",{class:"wintitle",onDblclick:e[2]||(e[2]=r=>o.dblclickTitle()),onMousedown:e[3]||(e[3]=(...r)=>o.mousedownTitle&&o.mousedownTitle(...r)),onMouseup:e[4]||(e[4]=r=>o.mouseupTitle())},[C4,c("div",A4,ze(n.title),1),c("div",{class:"btn imgClose",onClick:e[0]||(e[0]=r=>o.close()),title:"Close"}),c("div",{class:"btn imgMin",onClick:e[1]||(e[1]=r=>o.toggleMinimize()),title:"Minimize / Restore"})],32),c("div",P4,[Qs(t.$slots,"default")])],6)}var D4=ct(T4,[["render",R4]]),I4={methods:{async controllerMove(t){let e=[];switch(t){case"X-Y+":e=[`$J=G21G91X-${this.movingOptions.stepSize}Y${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Y+":e=[`$J=G21G91Y${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X+Y+":e=[`$J=G21G91X${this.movingOptions.stepSize}Y${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X-":e=[`$J=G21G91X-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X+":e=[`$J=G21G91X${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X-Y-":e=[`$J=G21G91X-${this.movingOptions.stepSize}Y-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Y-":e=[`$J=G21G91Y-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"X+Y-":e=[`$J=G21G91X${this.movingOptions.stepSize}Y-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Z+":e=[`$J=G21G91Z${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"Z-":e=[`$J=G21G91Z-${this.movingOptions.stepSize}F${this.movingOptions.feedRateXYZ}`];break;case"RL":e=[`$J=G21G91A${this.movingOptions.rotateStep}F${this.movingOptions.feedRateA}`];break;case"RR":e=[`$J=G21G91A-${this.movingOptions.rotateStep}F${this.movingOptions.feedRateA}`];break;case"Return":e=["G90 G0 X0 Y0"];break;case"ReturnZ":e=["G90 G0 Z0"];break;case"Reset":cmd=String.fromCharCode(24);break;case"State":e=["$G"];break;case"Pos":e=["?"];break;case"Home":e=["$H"];break;case"Unlock":e=["$X"];break;case"ResetZero":e=["G10 P0 L20 X0 Y0 Z0"];break;case"HomeResetZero":e.push("$H"),e.push("G10 P0 L20 X0 Y0 Z0");break;case"Parking":e.push(`G0 Z${this.settings.parking.pos.z}`),e.push(`G0 X${this.settings.parking.pos.x} Y${this.settings.parking.pos.y} A0`);break}for(let n of e)await this.sendCommandUI(n)},controllerTogglePump(){let t=this.pumpState?this.settings.pump.Off:this.settings.pump.On;this.sendCommandUI(t)},controllerToggleValve(t){let e=this.valvesState[t]?this.settings.heads[t].valveOff:this.settings.heads[t].valveOn;this.sendCommandUI(e)},controllerToggleCamNozzlePosition(){let t,e=this.settings.cams[0].offset;this.movingOptions.topCamNozzlePos==0?(this.movingOptions.topCamNozzlePos=1,t=`$J=G21G91X${-e.x}Y${-e.y}F${this.movingOptions.feedRateXYZ}`):(this.movingOptions.topCamNozzlePos=0,t=`$J=G21G91X${e.x}Y${e.y}F${this.movingOptions.feedRateXYZ}`),this.sendCommandUI(t)}}},L4={methods:{async sendCommandUI(t){if(this.consoleLogAppend(">>> "+t),this.portIsOpened)for(await this.sendCommand(t),this.consoleLogAppend(this.request),t[0]=="M"&&await this.sendCommand("$G"),t!=="?"&&await this.sendCommand("?");this.machineState.status!=="Idle"&&this.machineState.status!=="Alarm";)await new Promise(e=>setTimeout(e,100)),await this.sendCommand("?")},async sendCommands(t,e=!1){if(this.pnpProcessing.stopFlag!=!0){this.gCodeProcess.stopFlag=!1,this.gCodeProcess.pauseFlag=!1;for(let n of t){if(console.log(n),await this.sendCommand(n),n!=="?"&&await this.sendCommand("?"),e)for(;this.machineState.status!=="Idle";)await new Promise(i=>setTimeout(i,100)),await this.sendCommand("?");for(;this.gCodeProcess.pauseFlag==!0||this.pnpProcessing.pauseFlag==!0;)await new Promise(i=>setTimeout(i,200));if(this.gCodeProcess.stopFlag==!0||this.pnpProcessing.stopFlag==!0)break}this.gCodeProcess.stopFlag=!1,this.gCodeProcess.pauseFlag=!1}},async sendCommand(t){if(this.portIsOpened){t=="$H"&&(this.machineState.status="Homing");let e=Uint8Array.from(Array.from(t+`
- `).map(n=>n.charCodeAt(0)));await this.portConnection.write(e),await this.readRequest()}},async readRequest(){let t=await this.portConnection.read();this.parseRequest(t)},parseRequest(t){let n=new TextDecoder().decode(t);this.request=n;let i=/<([a-z,A-Z]*)\|MPos:(.*)>/g,s=n.matchAll(i);if(s=Array.from(s),s.length==1){if(s[0].length==3){this.machineState.status=s[0][1];let o=s[0][2].split(",");this.machineState.pos.x=parseFloat(o[0]),this.machineState.pos.y=parseFloat(o[1]),this.machineState.pos.z=parseFloat(o[2]),this.machineState.pos.a=parseFloat(o[3])}}else{let o=/\[([a-z,A-Z, ]*):(.*)]/g,r=n.matchAll(o);if(r=Array.from(r),r.length>0)for(let a of r)a.length==3&&(this.machineState.info[a[1]]=a[2]);else{let a=/\$([0-9]*)=(.*)/g,l=n.matchAll(a);if(l=Array.from(l),l.length>0)for(let d of l)d.length==3&&(this.machineState.settings[d[1]]=parseFloat(d[2]))}}},async getCVData(t){let e="http://localhost:5000/cv/"+t+"?"+Date.now(),n=this.cvParams[t];return await this.fetch_execute_async(e,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(n)})},fetch_execute_async:async function(t,e){this.loading=!0;try{return await(await fetch(t,e)).json()}catch(n){console.log(n)}finally{this.loading=!1}},async pnpGoToZero(){let t=[],e=parseFloat(this.settings.heads[0].safePosZ);t.push(`G0 Z${e}`),t.push("G0 X0 Y0"),t.push("G0 Z0"),await this.sendCommands(t,!0)},async pnpGoToParking(){let t=[];t.push(`G0 Z${this.settings.parking.pos.z}`),t.push(`G0 X${this.settings.parking.pos.x} Y${this.settings.parking.pos.y} A0`),await this.sendCommands(t,!0)},async pnpPumpOn(){let t=[];t.push(this.settings.pump.On),t.push("$G"),await this.sendCommands(t,!0)},async pnpPumpOff(){let t=[];t.push(this.settings.pump.Off),t.push("$G"),await this.sendCommands(t,!0)},async pnpValveOn(t){let e=[];e.push(`G04 P${t.pauseBeforeOn}`),e.push(t.valveOn),e.push(`G04 P${t.pauseAfterOn}`),e.push("$G"),await this.sendCommands(e,!0)},async pnpValveOff(t){let e=[];e.push(`G04 P${t.pauseBeforeOff}`),e.push(t.valveOff),e.push(`G04 P${t.pauseAfterOff}`),e.push("$G"),await this.sendCommands(e,!0)},async pnpLightOn(t){let e=[];e.push(this.settings.cams[t].lightOn),e.push("$G"),await this.sendCommands(e,!0)},async pnpLightOff(t){let e=[];e.push(this.settings.cams[t].lightOff),e.push("$G"),await this.sendCommands(e,!0)},async pnpSafetyUp(t){let n=`G0 Z${parseFloat(this.settings.heads[0].safePosZ)}`;isNaN(t)||(n=n+` A${t}`);let i=[n];await this.sendCommands(i,!0)},async pnpSafetyGoToXYZ(t,e,n){let i=[],s=parseFloat(this.settings.heads[0].safePosZ);i.push(`G0 Z${s}`),i.push(`G0 X${t} Y${e}`),isNaN(n)||i.push(`G0 Z${n}`),await this.sendCommands(i,!0)},async pnpGoToXYZA(t,e,n,i){let s="G0";isNaN(t)||(s=s+` X${t}`),isNaN(e)||(s=s+` Y${e}`),isNaN(n)||(s=s+` Z${n}`),isNaN(i)||(s=s+` A${i}`);let o=[s];await this.sendCommands(o,!0)},async pnpGoToXYZF(t,e,n,i){let s="G1";isNaN(t)||(s=s+` X${t}`),isNaN(e)||(s=s+` Y${e}`),isNaN(n)||(s=s+` Z${n}`),isNaN(i)||(s=s+` F${i}`);let o=[s];await this.sendCommands(o,!0)},async pnpGoToBottomCam(){let t=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let e=1,n,i,s;n=parseFloat(this.settings.cams[e].pos.x),i=parseFloat(this.settings.cams[e].pos.y),s=parseFloat(this.settings.cams[e].pos.z),await this.pnpSafetyGoToXYZ(n,i,NaN,NaN),await this.pnpLightOn(e),await this.pnpGoToXYZA(NaN,NaN,s,NaN)}finally{this.pnpProcessing.runFlag=t}},getFeederPos(t){let e=0,n=0;if(t.type==0&&(e=t.pos.x,n=t.pos.y),t.type==1)for(let i of t.pathPoints)i.pick==!0&&(e=i.x,n=i.y);return{x:e,y:n}},async pnpGoToFeeder(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.getFeederPos(t);await this.pnpSafetyGoToXYZ(n.x,n.y,NaN)}finally{this.pnpProcessing.runFlag=e}},async pnpGoToFeederCam(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.getFeederPos(t);n.x=parseFloat(n.x)-parseFloat(this.settings.cams[0].offset.x),n.y=parseFloat(n.y)-parseFloat(this.settings.cams[0].offset.y),await this.pnpSafetyGoToXYZ(n.x,n.y,NaN)}finally{this.pnpProcessing.runFlag=e}},async pnpPickFromFeeder(t,e=0){let n=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let i,s,o,r=this.settings.heads[e];if(t.type==0)if(parseInt(t.current)+1<parseInt(t.capacity))if(this.valvesState[e]==!1)i=parseFloat(t.pos.x)+parseFloat(t.step.x)*parseFloat(t.current),s=parseFloat(t.pos.y)+parseFloat(t.step.y)*parseFloat(t.current),o=parseFloat(t.pos.z)+parseFloat(t.step.z)*parseFloat(t.current),await this.pnpSafetyUp(0),await this.pnpSafetyGoToXYZ(i,s,o),await this.pnpValveOn(r),await this.pnpSafetyUp(),t.current=parseInt(t.current)+1;else return await lt("Valve is On!","Warning","warning"),!1;else return await lt("Feeder is empty","Warning","warning"),!1;if(t.type==1){await this.pnpSafetyUp(0);for(let a of t.pathPoints)await this.pnpGoToXYZA(a.x,a.y,NaN,NaN),await this.pnpGoToXYZA(NaN,NaN,a.z,NaN),a.pick==!0&&await this.pnpValveOn(r);await this.pnpSafetyUp()}return!0}finally{this.pnpProcessing.runFlag=n}},async pnpDropIntoBasket(){let t=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let e=this.settings.basket.pos.x,n=this.settings.basket.pos.y,i=this.settings.basket.pos.z;await this.pnpSafetyGoToXYZ(e,n,i);for(let s of this.settings.heads)await this.pnpValveOff(s);await this.pnpSafetyUp(0)}finally{this.pnpProcessing.runFlag=t}},async pnpFixPosition(){let t=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let e=1,n,i,s,o,r;n=parseFloat(this.settings.cams[e].pos.x),i=parseFloat(this.settings.cams[e].pos.y),s=parseFloat(this.settings.cams[e].pos.z),o=this.machinePos.a;let a=o*360;await this.pnpGoToBottomCam();for(let f=0;f<3;f++)if(await new Promise(h=>setTimeout(h,this.settings.cv[e].pauseBefore*1e3)),r=await this.getCVData(e),typeof r.objects.object!="undefined"){let h=Math.round(r.objects.object.dx*1e3/this.settings.cams[e].ppmm)/1e3,m=Math.round(r.objects.object.dy*1e3/this.settings.cams[e].ppmm)/1e3;n=n-h,i=i-m;let b=r.objects.object.angle_degrees;b<-45&&(b=90+b),b>45&&(b=-90+b),b=b/360,o=o-b,Math.abs(h)<5&&Math.abs(m)<5&&Math.abs(b)<.25&&await this.pnpGoToXYZA(n,i,NaN,o)}await this.pnpLightOff(e);let l=parseFloat(this.machinePos.x)-parseFloat(this.settings.cams[e].pos.x),d=parseFloat(this.machinePos.y)-parseFloat(this.settings.cams[e].pos.y);return{x:l,y:d}}finally{this.pnpProcessing.runFlag=t}},async pnpGoToElement(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.project.pcb.pos,i=parseFloat(t.pos.x)+parseFloat(n.x),s=parseFloat(t.pos.y)+parseFloat(n.y);await this.pnpSafetyGoToXYZ(i,s,NaN)}finally{this.pnpProcessing.runFlag=e}},async pnpGoToElementCam(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.project.pcb.pos,i=parseFloat(t.pos.x)+parseFloat(n.x)-parseFloat(this.settings.cams[0].offset.x),s=parseFloat(t.pos.y)+parseFloat(n.y)-parseFloat(this.settings.cams[0].offset.y);await this.pnpSafetyGoToXYZ(i,s,NaN)}finally{this.pnpProcessing.runFlag=e}},getNozzle(t){for(let e of this.settings.nozzles)if(e.id==t)return e},getNozzleOffset(t,e){e<0&&(e=1+e);for(let n of t.calibrationData)if(n.a>=e)return n},async pnpPlaceElement(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=this.settings.heads[0],i=parseFloat(this.settings.table.pos.z),s=t.feeder,o={x:0,y:0},r=parseFloat(t.pos.a);for(let a of this.project.feeders)if(a.id==s){if(await this.pnpPickFromFeeder(a)==!1)return!1;if(r!==0&&await this.pnpGoToXYZA(NaN,NaN,NaN,r),a.posCorrection==!0)o=await this.pnpFixPosition();else{let h=this.getNozzle(a.nozzle),m=this.getNozzleOffset(h,r);o.x=m.dx,o.y=m.dy}let l=this.project.pcb.pos,d=parseFloat(t.pos.x)+parseFloat(o.x)+parseFloat(l.x),u=parseFloat(t.pos.y)+parseFloat(o.y)+parseFloat(l.y),f=i+parseFloat(l.z)+parseFloat(a.elementHeight);await this.pnpSafetyGoToXYZ(d,u,f),await this.pnpValveOff(n),await this.pnpSafetyUp(),await this.pnpGoToXYZA(NaN,NaN,NaN,0)}return!0}finally{this.pnpProcessing.runFlag=e}},async pnpAutocalibrateNozzle(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let n=1,i=this.settings.cams[n].ppmm;await this.pnpSafetyUp(0),await this.pnpGoToBottomCam();for(let s of t.calibrationData){await this.pnpGoToXYZA(NaN,NaN,NaN,s.a),await new Promise(r=>setTimeout(r,this.settings.cv[n].pauseBefore*1e3));let o=await this.getCVData(n);if(typeof o.objects.nozzle!="undefined")s.dx=-(o.objects.nozzle.dx/i).toFixed(3),s.dy=-(o.objects.nozzle.dy/i).toFixed(3);else{await lt("Autocalibration is failed! Nozzle not found!","Error","error");return}}await this.pnpLightOff(n),await this.pnpSafetyUp(0),await lt("Calibration has been completed","Completed","success")}finally{this.pnpProcessing.runFlag=e}},getNozzlePlace(t){for(let e of this.settings.nozzlesHolder.places)if(e.nozzleId==t)return e;return null},async pnpPullOffNozzle(t){if(this.settings.heads[0].nozzle==-1)return!0;let e=null;for(let n of this.settings.nozzlesHolder.places)if(n.nozzleId==-1){e=n;break}if(e==null)return lt("Not found the empty place!","Error","error"),!1;console.log(e);for(let n=e.points.length-1;n>=0;n--){let i=e.points[n];console.log(i),n==e.points.length-1?await this.pnpSafetyGoToXYZ(i.x,i.y,i.z):await this.pnpGoToXYZF(i.x,i.y,i.z,t.feed)}return e.nozzleId=this.settings.heads[0].nozzle,this.settings.heads[0].nozzle=-1,!0},async pnpPutOnNozzle(t){if(t.nozzleId==-1){lt("Specified Nozzle place is empty!","Error","error");return}if(t.points.length==0){lt("Not specified the path to take!","Error","error");return}if(await this.pnpPullOffNozzle(t)!=!1){console.log(t);for(let e=0;e<t.points.length;e++){let n=t.points[e];console.log(n),e==0?await this.pnpSafetyGoToXYZ(n.x,n.y,n.z):await this.pnpGoToXYZF(n.x,n.y,n.z,t.feed)}this.settings.heads[0].nozzle=t.nozzleId,t.nozzleId=-1,await this.pnpSafetyUp(0)}},async pnpJobStart(t=null){let e=[];t!==null?e=this.project.elements.slice(this.project.elements.indexOf(t),this.project.elements.length):e=this.project.elements;for(let s of e)if(s.active==!0&&s.nozzleId!=this.settings.heads[0].nozzle&&this.getNozzlePlace(s.nozzleId)==null){let r=this.getNozzle(s.nozzleId);lt(`Can't start Job because the nozzles holder doesn't have the required nozzle '${r.name}'`,"Warning","warning");return}let n=this.getNozzle(this.settings.heads[0].nozzle),i=this.getNozzlePlace(-1);await Un(`Head is use the Nozzle '${n.name}'. Empty place in the Nozzles Holder is '${i.name}'. Is it correct? Shall we begin?`,"Please check").then(async s=>{s==!0&&this.pnpJobProcessing(e)})},async pnpJobProcessing(t){let e=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0,this.pnpProcessingRun(),await this.pnpPumpOn();let n=this.settings.heads[0].nozzle;for(let i of t)if(this.pnpProcessing.stopFlag==!1&&i.active==!0){if(this.pnpProcessing.element=i,this.pnpProcessing.message=`Element is being placed: ${i.name}`,i.nozzleId!=this.settings.heads[0].nozzle){let s=this.getNozzlePlace(i.nozzleId);console.log("Change Nozzle"),console.log(s),await this.pnpPutOnNozzle(s)}if(await this.pnpPlaceElement(i)==!1)return await lt("Job is braked!","Warning","warning"),!1}if(this.settings.heads[0].nozzle!=n){let i=this.getNozzlePlace(n);await this.pnpPutOnNozzle(i)}await this.pnpPumpOff(),await this.pnpGoToParking(),this.pnpProcessing.stopFlag==!0?(this.pnpProcessing.message=`The Job has been canceled on Element: ${this.pnpProcessing.element.name}`,await lt("The Job has been canceled!","Canceled","warning"),this.pnpProcessingReset()):(this.pnpProcessing.message="Completed",this.pnpProcessing.element=null,await lt('The project "'+this.project.name+'" has been completed',"Completed","success"),this.pnpProcessing.message="")}finally{this.pnpProcessing.runFlag=e}}}};const U4={mixins:[I4,L4,xs],components:{Loading:vL,DialogWrapper:My,Window:D4,Vializer3D:w4,ControllerState:vv,ControllerMovingNew:ay,ControllerConsole:vy,ControllerGCode:lx,ControllerSettings:Sx,CamerasSettings:aM,CVSettings:rE,HeadsSettings:QE,PumpSettings:pw,NozzlesSettings:CT,NozzlesHolderSettings:WC,BasketSettings:_A,ParkingSettings:VA,FeedersSettings:up,PCBTableSettings:$2,Projects:hL},data(){return{tab:0,tabSettings:0,showWindow:[!1,!1,!1,!1],timerId:this.timerId,consoleLog:"",command:this.command,request:this.request,gCodeProcess:{stopFlag:!1,pauseFlag:!1},pnpProcessing:{runFlag:!1,stopFlag:!1,pauseFlag:!1,element:null,message:""},camsViewSMDCase:{case:"",rotate:0},camsViewParams:[{raw:1,cv:0,ppmm:10,grid:1,marker:0},{raw:1,cv:0,ppmm:10,grid:1,marker:0}],CVLikeMachineView:!1,CVResult:[{},{}],machineState:{status:"Not connected",pos:{x:0,y:0,z:0,a:0},settings:{},info:{},gc:[]},loading:!1,movingOptions:{topCamNozzlePos:0,stepSize:10,feedRateXYZ:2e3,rotateStep:.125,feedRateA:500},settings:{machineOffsets:{x:1,y:1,z:1,a:0},cams:[{id:"0",name:"Top",size:{width:800,height:600},undistort:{type:0,distortion_f:0,calibration:{matrix:[[543196.224,0,2499.72745],[0,524402.144,1899.1843],[0,0,1]],distortion:[[-11.527107,.00137230942,-.00112470987,-.0196992455,266238632e-16]]}},image_transform:{rotation:0,scale_x:1,scale_y:1},ppmm:10,pos:{x:0,y:0,z:0},offset:{x:0,y:0},lightOn:"M72",lightOff:"M71"},{id:"1",name:"Bottom",size:{width:800,height:600},undistort:{type:0,distortion_f:0,calibration:{matrix:[[543196.224,0,2499.72745],[0,524402.144,1899.1843],[0,0,1]],distortion:[[-11.527107,.00137230942,-.00112470987,-.0196992455,266238632e-16]]}},image_transform:{rotation:0,scale_x:1,scale_y:1},ppmm:10,pos:{x:0,y:0,z:0},offset:{x:0,y:0},lightOn:"M82",lightOff:"M81"}],cv:[{name:"Top",contrast:1,brightness:0,blur:[1,1],adaptiveThreshold_blockSize:11,adaptiveThreshold_C:2,objects:{circle:{"r-min":1.5,"r-max":2,"dist-min":7},rectangle:{"w-min":2,"w-max":8,"h-min":2,"h-max":8}},pauseBefore:0},{name:"Bottom",contrast:1,brightness:0,blur:[1,1],adaptiveThreshold_blockSize:799,adaptiveThreshold_C:27,objects:{contour:{"w-min":.2,"w-max":20,"h-min":.2,"h-max":20},circle:{"r-min":1.5,"r-max":4,"dist-min":10}},pauseBefore:0}],basket:{pos:{x:0,y:0,z:0}},parking:{pos:{x:0,y:0,z:0}},table:{pos:{x:0,y:0,z:0}},heads:[{id:0,name:"Head 1",safePosZ:20,valveOn:"M32",valveOff:"M31",inGC:"V1",pauseBeforeOn:0,pauseAfterOn:0,pauseBeforeOff:0,pauseAfterOff:0,nozzle:0}],pump:{On:"M42",Off:"M41",inGC:"V2"},nozzles:[{id:0,name:"Nozzle 1",caption:"",calibrationData:[{a:0,dx:0,dy:0},{a:.125,dx:0,dy:0},{a:.25,dx:0,dy:0},{a:.375,dx:0,dy:0},{a:.5,dx:0,dy:0},{a:.625,dx:0,dy:0},{a:.75,dx:0,dy:0},{a:.875,dx:0,dy:0}]}],nozzlesHolder:{places:[{id:1,name:"Place 1",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:2,name:"Place 2",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:3,name:"Place 3",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:4,name:"Place 4",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100},{id:5,name:"Place 5",nozzleId:-1,points:[{x:0,y:0,z:0},{x:0,y:0,z:0},{x:0,y:0,z:0}],feed:100}]}},cases:[{name:"",src:""},{name:"R0402",src:"cases/R0402.svg"},{name:"R0603",src:"cases/R0603.svg"},{name:"R0805",src:"cases/R0805.svg"},{name:"R1206",src:"cases/R1206.svg"},{name:"R1210",src:"cases/R1210.svg"},{name:"R1812",src:"cases/1812.svg"},{name:"R2010",src:"cases/2010.svg"},{name:"R2220",src:"cases/2220.svg"},{name:"R2512",src:"cases/2512.svg"},{name:"C0402",src:"cases/C0402.svg"},{name:"C0603",src:"cases/C0603.svg"},{name:"C0805",src:"cases/C0805.svg"},{name:"C1206",src:"cases/C1206.svg"},{name:"SOD-923",src:"cases/sod923.svg"},{name:"SOD-723",src:"cases/sod723.svg"},{name:"SOD-523",src:"cases/sod523.svg"},{name:"SOD-323",src:"cases/SOD-323.svg"},{name:"SOD-123",src:"cases/sod123.svg"},{name:"SOD-123F",src:"cases/sod123f.svg"},{name:"SOD-123FL",src:"cases/SOD-123FL.svg"},{name:"SOD-123W",src:"cases/sod123w.svg"},{name:"SMA",src:"cases/SMA.svg"},{name:"SMB",src:"cases/SMB.svg"},{name:"SMC",src:"cases/smc.svg"},{name:"LED-0603",src:"cases/LED0603.svg"},{name:"LED-0805",src:"cases/LED0805.svg"},{name:"SOT-23",src:"cases/SOT-23.svg"},{name:"SOT-23-5",src:"cases/SOT-23-5.svg"},{name:"SOT-23-6",src:"cases/SOT-23-6.svg"},{name:"SOT-AMS-1117-2.5",src:"cases/SOT-AMS-1117-2.5.svg"},{name:"TO-263-2",src:"cases/TO-263-2.svg"},{name:"PDFN-8-L5.2W5.9",src:"cases/PDFN-8-L5.2W5.9.svg"},{name:"PDFN-8-L5.5W5.2",src:"cases/PDFN-8-L5.5W5.2.svg"},{name:"SOP-8",src:"cases/SOP-8.svg"},{name:"SOIC-8",src:"cases/SOIC-8.svg"},{name:"SOP-16",src:"cases/SOP-16.svg"},{name:"TSSOP-8",src:"cases/TSSOP-8.svg"},{name:"TSSOP-16",src:"cases/TSSOP-16.svg"},{name:"TSSOP-20",src:"cases/TSSOP-20.svg"},{name:"LQFP-48",src:"cases/LQFP-48.svg"},{name:"LQFP-64",src:"cases/LQFP-64.svg"},{name:"BTS7960B",src:"cases/BTS7960B.svg"},{name:"OSC-SMD-4P3225",src:"cases/OSC-SMD-4P3225.svg"}],feeders:[],project:{name:"New Project",feeders:[],elements:[],pcb:{pos:{x:0,y:0,z:1.6}}},projects_list:[]}},computed:{portConnection(){return this.$root.serialPortHandler},portIsOpened(){if(this.portConnection&&this.portConnection.isOpened==!0)return!0},videoSrc(){let t=[],e=0;for(let n of this.camsViewParams){let i=`http://localhost:5000/video_feed/${e}/${n.raw}/${n.cv}/${n.ppmm}/${n.grid}/${n.marker}?${Date.now()}`;e+=1,t.push(i)}return t},controlsEnabled(){return this.machineState.status=="Idle"&&this.pnpProcessing.runFlag==!1},controlsEnabledUnderAlarm(){return(this.machineState.status=="Idle"||this.machineState.status=="Alarm"||this.machineState.status=="Home")&&this.pnpProcessing.runFlag==!1},pumpState(){let t=!1;return typeof this.machineState.info.GC!="undefined"&&(t=this.machineState.info.GC.indexOf(this.settings.pump.inGC)>-1),t},valvesState(){let t=[!1];if(typeof this.machineState.info.GC!="undefined")for(let e in this.settings.heads)t[e]=this.machineState.info.GC.indexOf(this.settings.heads[e].inGC)>-1;return t},lightsState(){let t=[!1,!1];if(typeof this.machineState.info.GC!="undefined")for(let e=0;e<2;e++)t[e]=this.machineState.info.GC.indexOf("L"+(e+1))>-1;return t},machinePos(){let t=parseFloat(this.machineState.pos.x)+this.settings.machineOffsets.x,e=parseFloat(this.machineState.pos.y)+this.settings.machineOffsets.y,n=parseFloat(this.machineState.pos.z)+this.settings.machineOffsets.z,i=parseFloat(this.machineState.pos.a)+this.settings.machineOffsets.a;return{x:t.toFixed(3),y:e.toFixed(3),z:n.toFixed(3),a:i.toFixed(3)}},cvParams(){let t=[];for(let e in this.settings.cv){let n=structuredClone(pt(this.settings.cv[e].objects));for(let i in n)for(let s in n[i])n[i][s]=Math.round(n[i][s]*this.settings.cams[e].ppmm);n=Object.assign(n,{text:!1,img_type:this.CVLikeMachineView?1:0}),t.push(n)}return t}},methods:{fetch_execute:async function(t,e,n,i){this.loading=!0;try{let o=await(await fetch(t,e)).json();n&&n(o)}catch(s){i&&i(s)}finally{this.loading=!1}},loadMachineState(){this.sendCommands(["$I","$$","$G","?"])},consoleLogAppend(t){this.consoleLog=this.consoleLog+t+`
- `},changeCamParam(t){this.camsViewParams[t.number]={raw:t.raw,cv:t.cv,ppmm:t.ppmm,grid:t.grid,marker:t.marker}},toggleCamParam(t){this.showWindow[t.number]==!0?this.closeCam(t.number):(this.changeCamParam(t),this.openCam(t.number))},toggleCam(t){this.toggleCamParam({number:t,raw:0,cv:0,ppmm:10,grid:1,marker:0})},openCam(t){this.showWindow[t]=!0},closeCam(t){let e=this.$refs["cam_feed"+t];e.src="",this.showWindow[t]=!1,t==0&&(this.camsViewSMDCase={case:"",rotate:0})},toggleCV(t){this.showWindow[t+2]==!0?this.closeCV(t):this.openCV(t)},lightOn(t){let e=this.settings.cams[t].lightOn;this.sendCommandUI(e)},lightOff(t){let e=this.settings.cams[t].lightOff;this.sendCommandUI(e)},toggleLight(t){this.lightsState[t]==!1?this.lightOn(t):this.lightOff(t)},getCV(t){let e="http://localhost:5000/cv/"+t,n=this.cvParams[t];this.fetch_execute(e,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(n)},i=>{this.CVResult[t]=i,console.log(i.objects)},i=>{console.log(i),lt(i,"Error","error")})},openCV(t){this.showWindow[t+2]=!0,this.getCV(t)},closeCV(t){this.showWindow[t+2]=!1},toggleMoviePanel(){this.showWindow[4]==!0?this.closeMoviePanel():this.openMoviePanel()},openMoviePanel(){this.showWindow[4]=!0},closeMoviePanel(){this.showWindow[4]=!1},gCodeRun(t){this.sendCommands(t,!0)},gCodeStop(){this.gCodeProcess.pauseFlag=!1,this.gCodeProcess.stopFlag=!0},gCodePause(){this.gCodeProcess.pauseFlag=!this.gCodeProcess.pauseFlag},pnpProcessingRun(){this.pnpProcessing.pauseFlag=!1,this.pnpProcessing.stopFlag=!1,this.pnpProcessing.runFlag=!0},pnpProcessingPause(){this.pnpProcessing.pauseFlag=!this.pnpProcessing.pauseFlag},pnpProcessingResume(){this.pnpProcessing.pauseFlag=!1},pnpProcessingStop(){this.pnpProcessing.stopFlag=!0},pnpProcessingReset(){this.pnpProcessing.pauseFlag=!1,this.pnpProcessing.stopFlag=!1,this.pnpProcessing.runFlag=!1},moveOnClick(t){if(this.controlsEnabled==!0){let e=t.srcElement.width/2,n=t.srcElement.height/2,i=t.srcElement.id,s,o;i==0?(s=t.offsetX-e,o=n-t.offsetY):(s=t.offsetX-e,o=t.offsetY-n);let r=this.settings.cams[i].ppmm,a=Math.round(s/r*1e3)/1e3,l=Math.round(o/r*1e3)/1e3,d=`$J=G21G91X${a}Y${l}F500`;this.sendCommandUI(d)}},calibrate(t){let e="http://localhost:5000/calibration/"+t+"?"+Date.now();this.fetch_execute(e,{method:"GET",credentials:"same-origin",cache:"no-cache"},n=>{n.result=="OK"?(this.settings.cams[t].calibration=n,lt("Calibration complete successfully. Don't forget to apply settings.","Calibration","success")):lt(n.msg,"Error","error")},n=>{console.log(n),lt(n,"Error","error")})},loadSettings(){let t="http://localhost:5000/settings?"+Date.now();this.fetch_execute(t,{method:"GET",credentials:"same-origin",cache:"no-cache"},e=>{this.settings=this.deepMerge(this.settings,e)},e=>{console.log(e),lt(e,"Error","error")})},applaySettings(){let t="http://localhost:5000/settings",e=this.settings;this.fetch_execute(t,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(e)},n=>{n.result=="OK"?lt("Settings applied successfully","Settings","success"):n.error?lt(n.error,"Error","error"):lt("Unexpected Error!","Error","error")},n=>{console.log(n),lt(n,"Error","error")})},setFeedersFromProject(){this.feeders=this.project.feeders,Un("Feeders set from current project applied as default feeder set, but settings is not saved yet. Do You want to save and apply settings?","Confirm").then(t=>{t==!0&&this.applaySettings()})},newProject(){this.project={name:"New Project",feeders:[],elements:[],pcb:{pos:{x:0,y:0,z:0}}}},loadProject(){this.loadJSON("projects",this.project.name,"project")},saveProject(){this.saveJSON("projects",this.project.name,this.project),setTimeout(()=>{this.loadProjectsList()},1e3)},renameProject(t){let e=`http://localhost:5000/json/rename/projects/${t.name}/${t.newName}`;this.fetch_execute(e,{method:"GET",credentials:"same-origin",cache:"no-cache"},n=>{this.loadProjectsList()},n=>{console.log(n),lt(n,"Error","error")})},deleteProject(t){let e=`http://localhost:5000/json/delete/projects/${t}`;this.fetch_execute(e,{method:"GET",credentials:"same-origin",cache:"no-cache"},n=>{this.loadProjectsList()},n=>{console.log(n),lt(n,"Error","error")})},loadProjectsList(){let t="http://localhost:5000/json-list/projects?"+Date.now();this.fetch_execute(t,{method:"GET",credentials:"same-origin",cache:"no-cache"},e=>{this.projects_list=e.result},e=>{console.log(e),lt(e,"Error","error")})},loadJSON(t,e,n){let i="http://localhost:5000/json";t!==""&&(i=i+"/"+t),i=i+"/"+e,this.fetch_execute(i,{method:"GET",credentials:"same-origin",cache:"no-cache"},s=>{this[n]=s.result},s=>{console.log(s),lt(s,"Error","error")})},saveJSON(t,e,n){let i="http://localhost:5000/json";t!==""&&(i=i+"/"+t),i=i+"/"+e,this.fetch_execute(i,{method:"POST",credentials:"same-origin",cache:"no-cache",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(n)},s=>{s.result=="OK"?lt('File "'+e+'" saved successfully',"Settings","success"):s.error?lt(s.error,"Error","error"):lt("Unexpected Error!","Error","error")},s=>{console.log(s),lt(s,"Error","error")})},setSMDCase(t){this.camsViewSMDCase=t,this.drawTopCamCanvas()},drawTopCamCanvas(){if(this.$refs.camCanvas0){let t=this.$refs.camCanvas0,e=t.getContext("2d");if(e){e.globalAlpha=.7;let n=t.width,i=t.height,s=t.width/2,o="#239b56",r=1,a=n/2,l=i/2,d=2*Math.PI*parseFloat(this.camsViewSMDCase.rotate),u=parseFloat(this.settings.cams[0].ppmm),f=this.camsViewSMDCase.case;e.clearRect(0,0,n,i),e.translate(a,l),e.rotate(-d),e.translate(-a,-l),e.beginPath(),e.moveTo(a-s/2,l),e.lineTo(a+s/2,l),e.strokeStyle=o,e.lineWidth=r,e.arc(a,l,.6*u,0,2*Math.PI),e.stroke(),e.translate(a,l),e.rotate(d),e.translate(-a,-l);for(let h of this.cases)if(h.name==f){const m=new Image;m.src=h.src,m.onload=()=>{let b=n/2,y=i/2,p=96/25.4,T=m.width*(u/p),w=m.height*(u/p),S=b-T/2,I=y-w/2;e.translate(b,y),e.rotate(-d),e.translate(-b,-y),e.drawImage(m,S,I,T,w),e.translate(b,y),e.rotate(d),e.translate(-b,-y),e.stroke()}}}}}},mounted(){this.loadSettings(),this.loadJSON("","feeders","feeders"),this.loadProjectsList()},unmounted(){},watch:{async portIsOpened(t){t?(this.loadMachineState(),setTimeout(()=>{parseFloat(this.machineState.pos.x)+parseFloat(this.machineState.pos.y)+parseFloat(this.machineState.pos.z)==0&&Un("Are You wish to dispatch Machine to Home & Reset Zero?","Confirm").then(n=>{n==!0&&this.controllerMove("HomeResetZero")})},300)):this.machineState.status="Not connected"},showWindow:{handler(t,e){this.showWindow[0]==1&&setTimeout(()=>{this.drawTopCamCanvas()},200)},deep:!0},machineState:{handler(t,e){clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.drawTopCamCanvas()},200)},deep:!0}}},F4={class:"float-end tool-buttons"},O4={class:"row border bg-light machine-pos"},N4={class:"col-3 p-1"},z4={class:"col-3 p-1"},k4={class:"col-3 p-1"},B4={class:"col-3 p-1"},V4=["src"],H4=["width","height"],$4={class:"form-check form-switch"},G4=["checked"],W4=c("label",{class:"form-check-label",for:"topLight"},"Light",-1),X4=["src"],j4={class:"form-check form-switch"},Y4=["checked"],q4=c("label",{class:"form-check-label",for:"bottomLight"},"Light",-1),Z4=["src"],K4={class:"row m-0"},J4={class:"col form-check form-switch"},Q4=["checked"],eB=c("label",{class:"form-check-label",for:"topLight"},"Light",-1),tB={class:"col form-check form-switch"},nB=c("label",{class:"form-check-label",for:"machineView"},"Machine vision",-1),iB=["src"],sB={class:"row m-0"},oB={class:"col form-check form-switch"},rB=["checked"],aB=c("label",{class:"form-check-label",for:"bottomLight"},"Light",-1),lB={class:"col form-check form-switch"},cB=c("label",{class:"form-check-label",for:"machineView"},"Machine vision",-1),dB={class:"nav nav-tabs"},uB={class:"nav-item"},hB={class:"nav-item"},fB={class:"nav-item"},pB={class:"row mt-2"},mB={class:"col-md-auto left-column"},_B={class:"col-md central-column"},gB={class:"row"},vB={class:"col"},bB={class:"row"},yB={class:"col"},xB={class:"col-auto"},SB={class:"row mt-2"},MB={class:"col"},EB={class:"row flex-nowrap"},wB={class:"col-auto"},TB={class:"d-flex flex-column"},CB={class:"nav nav-pills flex-column"},AB={class:"nav-item"},PB={class:"nav-item"},RB={class:"nav-item"},DB={class:"nav-item"},IB={class:"nav-item"},LB={class:"nav-item"},UB={class:"nav-item"},FB={class:"nav-item"},OB={class:"nav-item"},NB={class:"nav-item"},zB={class:"nav-item"},kB={class:"col"},BB={class:"row mt-2"},VB={class:"col"},HB=c("hr",null,null,-1);function $B(t,e,n,i,s,o){const r=et("Loading"),a=et("DialogWrapper"),l=et("window"),d=et("ControllerMovingNew"),u=et("ControllerState"),f=et("ControllerGCode"),h=et("ControllerConsole"),m=et("Vializer3D"),b=et("ControllerSettings"),y=et("CamerasSettings"),_=et("CVSettings"),p=et("NozzlesSettings"),T=et("NozzlesHolderSettings"),w=et("HeadsSettings"),S=et("PumpSettings"),I=et("ParkingSettings"),P=et("BasketSettings"),D=et("FeedersSettings"),R=et("PCBTableSettings"),E=et("Projects");return W(),ee("div",null,[c("div",F4,[c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[2]==!0?" active":"")),onClick:e[0]||(e[0]=g=>o.toggleCV(0))},"\u{1F441}\u{1F81F}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[3]==!0?" active":"")),onClick:e[1]||(e[1]=g=>o.toggleCV(1))},"\u{1F441}\u{1F81D}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[0]==!0?" active":"")),onClick:e[2]||(e[2]=g=>o.toggleCam(0))},"\u{1F4F7}\u{1F81F}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[1]==!0?" active":"")),onClick:e[3]||(e[3]=g=>o.toggleCam(1))},"\u{1F4F7}\u{1F81D}",2),c("button",{class:je("btn btn-sm btn-outline-secondary p-0 ps-1 pe-1 m-0 me-1"+(s.showWindow[4]==!0?" active":"")),onClick:e[4]||(e[4]=g=>o.toggleMoviePanel())},"\xA0\u2725\xA0",2)]),c("div",O4,[c("div",N4," X: "+ze(o.machinePos.x),1),c("div",z4," Y: "+ze(o.machinePos.y),1),c("div",k4," Z: "+ze(o.machinePos.z),1),c("div",B4," A: "+ze(o.machinePos.a),1)]),ke(r,{loading:s.loading},null,8,["loading"]),ke(a),se(ke(l,{title:"Cam "+s.settings.cams[0].name,width:s.settings.cams[0].size.width+28,height:s.settings.cams[0].size.height+100,number:1,onClose:e[8]||(e[8]=g=>o.closeCam(0))},{default:Ct(()=>[s.showWindow[0]?(W(),ee("img",{key:0,ref:"cam_feed0",id:0,src:o.videoSrc[0],onClick:e[5]||(e[5]=(...g)=>o.moveOnClick&&o.moveOnClick(...g))},null,8,V4)):st("",!0),s.showWindow[0]?(W(),ee("canvas",{key:1,ref:"camCanvas0",id:0,width:s.settings.cams[0].size.width,height:s.settings.cams[0].size.height,style:uo("position: relative; top: -"+s.settings.cams[0].size.height+"px; margin-bottom: -"+(s.settings.cams[0].size.height-12)+"px;"),onClick:e[6]||(e[6]=(...g)=>o.moveOnClick&&o.moveOnClick(...g))},null,12,H4)):st("",!0),c("div",$4,[c("input",{onChange:e[7]||(e[7]=g=>o.toggleLight(0)),checked:o.lightsState[0],class:"form-check-input",type:"checkbox",role:"switch",id:"topLight"},null,40,G4),W4])]),_:1},8,["title","width","height"]),[[an,s.showWindow[0]]]),se(ke(l,{title:"Cam "+s.settings.cams[1].name,width:s.settings.cams[1].size.width+20,height:s.settings.cams[1].size.height+82,number:2,onClose:e[11]||(e[11]=g=>o.closeCam(1))},{default:Ct(()=>[s.showWindow[1]?(W(),ee("img",{key:0,ref:"cam_feed1",id:1,src:o.videoSrc[1],onClick:e[9]||(e[9]=(...g)=>o.moveOnClick&&o.moveOnClick(...g))},null,8,X4)):st("",!0),c("div",j4,[c("input",{onChange:e[10]||(e[10]=g=>o.toggleLight(1)),checked:o.lightsState[1],class:"form-check-input",type:"checkbox",role:"switch",id:"bottomLight"},null,40,Y4),q4])]),_:1},8,["title","width","height"]),[[an,s.showWindow[1]]]),se(ke(l,{title:"CV Top",width:s.settings.cams[0].size.width+20,height:s.settings.cams[0].size.height+82,number:3,onClose:e[16]||(e[16]=g=>o.closeCV(0))},{default:Ct(()=>[c("img",{ref:"cv0",src:s.CVResult[0].img,onClick:e[12]||(e[12]=g=>o.getCV(0)),title:"Click to Refresh"},null,8,Z4),c("div",K4,[c("div",J4,[c("input",{onChange:e[13]||(e[13]=g=>o.toggleLight(0)),checked:o.lightsState[0],class:"form-check-input",type:"checkbox",role:"switch",id:"topLight"},null,40,Q4),eB]),c("div",tB,[se(c("input",{"onUpdate:modelValue":e[14]||(e[14]=g=>s.CVLikeMachineView=g),onChange:e[15]||(e[15]=g=>o.getCV(0)),class:"form-check-input",type:"checkbox",role:"switch",id:"machineView"},null,544),[[Zn,s.CVLikeMachineView]]),nB])])]),_:1},8,["width","height"]),[[an,s.showWindow[2]]]),se(ke(l,{title:"CV Bottom",width:s.settings.cams[0].size.width+20,height:s.settings.cams[0].size.height+82,number:4,onClose:e[21]||(e[21]=g=>o.closeCV(1))},{default:Ct(()=>[c("img",{ref:"cv1",src:s.CVResult[1].img,onClick:e[17]||(e[17]=g=>o.getCV(1)),title:"Click to Refresh"},null,8,iB),c("div",sB,[c("div",oB,[c("input",{onChange:e[18]||(e[18]=g=>o.toggleLight(1)),checked:o.lightsState[1],class:"form-check-input",type:"checkbox",role:"switch",id:"bottomLight"},null,40,rB),aB]),c("div",lB,[se(c("input",{"onUpdate:modelValue":e[19]||(e[19]=g=>s.CVLikeMachineView=g),onChange:e[20]||(e[20]=g=>o.getCV(1)),class:"form-check-input",type:"checkbox",role:"switch",id:"machineView"},null,544),[[Zn,s.CVLikeMachineView]]),cB])])]),_:1},8,["width","height"]),[[an,s.showWindow[3]]]),se(ke(l,{title:"Move panel",width:350,height:680,number:5,onClose:e[26]||(e[26]=g=>o.closeMoviePanel())},{default:Ct(()=>[ke(d,{onCommand:e[22]||(e[22]=g=>t.controllerMove(g)),onToggleValve:e[23]||(e[23]=g=>t.controllerToggleValve(g)),onTogglePump:e[24]||(e[24]=g=>t.controllerTogglePump()),onToggleCamNozzlePosition:e[25]||(e[25]=g=>t.controllerToggleCamNozzlePosition()),settings:s.settings,movingOptions:s.movingOptions,valvesState:o.valvesState,pumpState:o.pumpState,disabled:!o.controlsEnabled,enabledUnderAlaram:o.controlsEnabledUnderAlarm},null,8,["settings","movingOptions","valvesState","pumpState","disabled","enabledUnderAlaram"])]),_:1},512),[[an,s.showWindow[4]]]),c("ul",dB,[c("li",uB,[c("a",{class:je("nav-link"+(s.tab==0?" active":"")),onClick:e[27]||(e[27]=g=>s.tab=0)},"Manual control",2)]),c("li",hB,[c("a",{class:je("nav-link"+(s.tab==1?" active":"")),onClick:e[28]||(e[28]=g=>s.tab=1)},"Settings",2)]),c("li",fB,[c("a",{class:je("nav-link"+(s.tab==2?" active":"")),onClick:e[29]||(e[29]=g=>s.tab=2)},"Projects",2)])]),se(c("div",pB,[c("div",mB,[ke(u,{state:s.machineState,pnpProcessing:s.pnpProcessing,valvesState:o.valvesState,pumpState:o.pumpState},null,8,["state","pnpProcessing","valvesState","pumpState"]),ke(d,{onCommand:e[30]||(e[30]=g=>t.controllerMove(g)),onToggleValve:e[31]||(e[31]=g=>t.controllerToggleValve(g)),onTogglePump:e[32]||(e[32]=g=>t.controllerTogglePump()),onToggleCamNozzlePosition:e[33]||(e[33]=g=>t.controllerToggleCamNozzlePosition()),settings:s.settings,movingOptions:s.movingOptions,valvesState:o.valvesState,pumpState:o.pumpState,disabled:!o.controlsEnabled,enabledUnderAlaram:o.controlsEnabledUnderAlarm},null,8,["settings","movingOptions","valvesState","pumpState","disabled","enabledUnderAlaram"])]),c("div",_B,[c("div",gB,[c("div",vB,[ke(f,{disabled:!o.controlsEnabled,machineState:s.machineState,gCodeProcess:s.gCodeProcess,onRun:e[34]||(e[34]=g=>o.gCodeRun(g)),onStop:e[35]||(e[35]=g=>o.gCodeStop()),onPause:e[36]||(e[36]=g=>o.gCodePause())},null,8,["disabled","machineState","gCodeProcess"])])]),c("div",bB,[c("div",yB,[ke(h,{consoleLog:s.consoleLog,disabled:!o.controlsEnabledUnderAlarm,onSendCommand:e[37]||(e[37]=g=>t.sendCommandUI([g]))},null,8,["consoleLog","disabled"])])])]),c("div",xB,[ke(m,{width:600,height:300,x:s.machineState.pos.x,y:s.machineState.pos.y,z:s.machineState.pos.z,a:s.machineState.pos.a,x_max:0,x_min:-200,y_max:0,y_min:-200,z_max:55,z_min:-55},null,8,["x","y","z","a"])])],512),[[an,s.tab==0]]),se(c("div",SB,[c("div",MB,[c("div",EB,[c("div",wB,[c("div",TB,[c("ul",CB,[c("li",AB,[c("a",{class:je("nav-link"+(s.tabSettings==0?" active":"")),onClick:e[38]||(e[38]=g=>s.tabSettings=0)},"Controller",2)]),c("li",PB,[c("a",{class:je("nav-link"+(s.tabSettings==1?" active":"")),onClick:e[39]||(e[39]=g=>s.tabSettings=1)},"Cameras",2)]),c("li",RB,[c("a",{class:je("nav-link"+(s.tabSettings==2?" active":"")),onClick:e[40]||(e[40]=g=>s.tabSettings=2)},"Computer Vision",2)]),c("li",DB,[c("a",{class:je("nav-link"+(s.tabSettings==3?" active":"")),onClick:e[41]||(e[41]=g=>s.tabSettings=3)},"Nozzles",2)]),c("li",IB,[c("a",{class:je("nav-link"+(s.tabSettings==4?" active":"")),onClick:e[42]||(e[42]=g=>s.tabSettings=4)},"Nozzles Holder",2)]),c("li",LB,[c("a",{class:je("nav-link"+(s.tabSettings==5?" active":"")),onClick:e[43]||(e[43]=g=>s.tabSettings=5)},"Heads",2)]),c("li",UB,[c("a",{class:je("nav-link"+(s.tabSettings==6?" active":"")),onClick:e[44]||(e[44]=g=>s.tabSettings=6)},"Pump",2)]),c("li",FB,[c("a",{class:je("nav-link"+(s.tabSettings==7?" active":"")),onClick:e[45]||(e[45]=g=>s.tabSettings=7)},"Parking",2)]),c("li",OB,[c("a",{class:je("nav-link"+(s.tabSettings==8?" active":"")),onClick:e[46]||(e[46]=g=>s.tabSettings=8)},"Basket",2)]),c("li",NB,[c("a",{class:je("nav-link"+(s.tabSettings==9?" active":"")),onClick:e[47]||(e[47]=g=>s.tabSettings=9)},"Feeders",2)]),c("li",zB,[c("a",{class:je("nav-link"+(s.tabSettings==10?" active":"")),onClick:e[48]||(e[48]=g=>s.tabSettings=10)},"PCB Table",2)])])])]),c("div",kB,[s.tabSettings==0?(W(),Jt(b,{key:0,settings:s.machineState.settings,disabled:!o.controlsEnabled,onSendCommand:e[49]||(e[49]=g=>t.sendCommands(g))},null,8,["settings","disabled"])):st("",!0),s.tabSettings==1?(W(),Jt(y,{key:1,cams:s.settings.cams,machineState:s.machineState,machinePos:o.machinePos,settings:s.settings,showWindow:s.showWindow,disabled:!o.controlsEnabled,loading:s.loading,onCalibrate:e[50]||(e[50]=g=>o.calibrate(g)),onSendCommands:e[51]||(e[51]=g=>t.sendCommands(g,!0)),onApplaySettings:e[52]||(e[52]=g=>o.applaySettings()),onToggleCam:e[53]||(e[53]=g=>o.toggleCamParam(g)),onChangeCamParam:e[54]||(e[54]=g=>o.changeCamParam(g)),onToggleMoviePanel:e[55]||(e[55]=g=>o.toggleMoviePanel())},null,8,["cams","machineState","machinePos","settings","showWindow","disabled","loading"])):st("",!0),s.tabSettings==2?(W(),Jt(_,{key:2,cvSettings:s.settings.cv,showWindow:s.showWindow,loading:s.loading,onToggleCV:e[56]||(e[56]=g=>o.toggleCV(g)),onApplaySettings:e[57]||(e[57]=g=>o.applaySettings())},null,8,["cvSettings","showWindow","loading"])):st("",!0),s.tabSettings==3?(W(),Jt(p,{key:3,nozzles:s.settings.nozzles,machineState:s.machineState,machinePos:o.machinePos,settings:s.settings,disabled:!o.controlsEnabled,loading:s.loading,onAutocalibrate:e[58]||(e[58]=g=>t.pnpAutocalibrateNozzle(g)),onApplaySettings:e[59]||(e[59]=g=>o.applaySettings())},null,8,["nozzles","machineState","machinePos","settings","disabled","loading"])):st("",!0),s.tabSettings==4?(W(),Jt(T,{key:4,nozzlesHolder:s.settings.nozzlesHolder,machineState:s.machineState,machinePos:o.machinePos,settings:s.settings,disabled:!o.controlsEnabled,loading:s.loading,onPutOnNozzle:e[60]||(e[60]=g=>t.pnpPutOnNozzle(g)),onApplaySettings:e[61]||(e[61]=g=>o.applaySettings())},null,8,["nozzlesHolder","machineState","machinePos","settings","disabled","loading"])):st("",!0),s.tabSettings==5?(W(),Jt(w,{key:5,heads:s.settings.heads,nozzles:s.settings.nozzles,loading:s.loading,onApplaySettings:e[62]||(e[62]=g=>o.applaySettings())},null,8,["heads","nozzles","loading"])):st("",!0),s.tabSettings==6?(W(),Jt(S,{key:6,pump:s.settings.pump,loading:s.loading,onApplaySettings:e[63]||(e[63]=g=>o.applaySettings())},null,8,["pump","loading"])):st("",!0),s.tabSettings==7?(W(),Jt(I,{key:7,parking:s.settings.parking,machineState:s.machineState,machinePos:o.machinePos,loading:s.loading,onApplaySettings:e[64]||(e[64]=g=>o.applaySettings())},null,8,["parking","machineState","machinePos","loading"])):st("",!0),s.tabSettings==8?(W(),Jt(P,{key:8,basket:s.settings.basket,machineState:s.machineState,machinePos:o.machinePos,loading:s.loading,onApplaySettings:e[65]||(e[65]=g=>o.applaySettings())},null,8,["basket","machineState","machinePos","loading"])):st("",!0),s.tabSettings==9?(W(),Jt(D,{key:9,settings:s.settings,cases:s.cases,machineState:s.machineState,machinePos:o.machinePos,feeders:s.feeders,disabled:!o.controlsEnabled,loading:s.loading,onGoToFeeder:e[66]||(e[66]=g=>t.pnpGoToFeeder(g)),onGoToFeederCam:e[67]||(e[67]=g=>t.pnpGoToFeederCam(g)),onPickFromFeeder:e[68]||(e[68]=g=>t.pnpPickFromFeeder(g)),onFixPosition:e[69]||(e[69]=g=>t.pnpFixPosition(g)),onDropIntoBasket:e[70]||(e[70]=g=>t.pnpDropIntoBasket(g)),onSaveFeeders:e[71]||(e[71]=g=>o.saveJSON("","feeders",this.feeders))},null,8,["settings","cases","machineState","machinePos","feeders","disabled","loading"])):st("",!0),s.tabSettings==10?(W(),Jt(R,{key:10,pcbtable:s.settings.table.pos,machineState:s.machineState,machinePos:o.machinePos,loading:s.loading,onApplaySettings:e[72]||(e[72]=g=>o.applaySettings())},null,8,["pcbtable","machineState","machinePos","loading"])):st("",!0)])])])],512),[[an,s.tab==1]]),se(c("div",BB,[c("div",VB,[ke(E,{project:s.project,projects_list:s.projects_list,disabled:!o.controlsEnabled,loading:s.loading,settings:s.settings,cases:s.cases,default_feeders:s.feeders,machineState:s.machineState,machinePos:o.machinePos,pnpProcessing:s.pnpProcessing,onSetSMDCase:e[73]||(e[73]=g=>o.setSMDCase(g)),onGoToFeeder:e[74]||(e[74]=g=>t.pnpGoToFeeder(g)),onGoToFeederCam:e[75]||(e[75]=g=>t.pnpGoToFeederCam(g)),onPickFromFeeder:e[76]||(e[76]=g=>t.pnpPickFromFeeder(g)),onFixPosition:e[77]||(e[77]=g=>t.pnpFixPosition(g)),onDropIntoBasket:e[78]||(e[78]=g=>t.pnpDropIntoBasket(g)),onGoToElement:e[79]||(e[79]=g=>t.pnpGoToElement(g)),onGoToElementCam:e[80]||(e[80]=g=>t.pnpGoToElementCam(g)),onPlaceElement:e[81]||(e[81]=g=>t.pnpPlaceElement(g)),onSetFeeders:e[82]||(e[82]=g=>o.setFeedersFromProject()),onNewProject:e[83]||(e[83]=g=>o.newProject()),onLoadProject:e[84]||(e[84]=g=>o.loadProject()),onSaveProject:e[85]||(e[85]=g=>o.saveProject()),onRenameProject:e[86]||(e[86]=g=>o.renameProject(g)),onDeleteProject:e[87]||(e[87]=g=>o.deleteProject(g)),onRun:e[88]||(e[88]=g=>t.pnpJobStart()),onRunFrom:e[89]||(e[89]=g=>t.pnpJobStart(g)),onPause:e[90]||(e[90]=g=>o.pnpProcessingPause()),onStop:e[91]||(e[91]=g=>o.pnpProcessingStop())},null,8,["project","projects_list","disabled","loading","settings","cases","default_feeders","machineState","machinePos","pnpProcessing"])])],512),[[an,s.tab==2]]),HB])}var GB=ct(U4,[["render",$B]]);const WB=S0({history:zg(),routes:[{path:"/",name:"home",component:GB},{path:"/about",name:"about",component:()=>V0(()=>import("./AboutView.84216d57.js"),[])}]}),yd=gg(z0);yd.use(WB);yd.use(by);yd.mount("#app");export{ct as _,c as a,ee as c,W as o};
|