diff --git "a/assets/index-CgcZzzI2.js" "b/assets/index-CgcZzzI2.js" new file mode 100644--- /dev/null +++ "b/assets/index-CgcZzzI2.js" @@ -0,0 +1,536 @@ +var Ts=Object.defineProperty;var ks=(t,e,n)=>e in t?Ts(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Mi=(t,e,n)=>ks(t,typeof e!="symbol"?e+"":e,n);import{E as _s,V as As,a as Es,c as Ms,r as Ss,b as Nr,d as Is,e as Si,f as Rs,g as Cs,h as Ns,s as Ls,i as Ps,j as Ds}from"./live2d-zip-loader-C5j9stxV.js";import{f as $n,g as W,h as Ue,i as Ot,t as Os,d as ze,j as zs,k as Fs,l as Zr,w as je,m as pn,c as ie,o as ee,p as gn,q as Bs,s as Ze,v as Xt,x as Qt,y as Be,b as ke,a as z,z as st,A as At,B as Jr,C as it,D as ge,e as H,M as yt,T as _t,E as ei,F as qn,G as Wo,Z as On,H as zt,I as Us,V as ae,S as Ii,Q as zn,O as $t,J as Pe,P as Et,K as js,L as Xo,N as hn,U as ti,W as Fe,X as Qo,Y as Zo,_ as ni,$ as yn,a0 as Vs,a1 as ri,a2 as Hs,a3 as Jo,a4 as xt,a5 as ii,a6 as Mt,a7 as Gs,a8 as ea,a9 as Dt,aa as ta,ab as $s,ac as qs,ad as Ys,ae as Ks,af as na,ag as Yn,ah as Ws,ai as Xs,aj as Qs,ak as Pt,al as Zs,am as Js,an as el,ao as tl,ap as er,aq as Fn,ar as Lr,as as Nt,at as ra,au as Pr,av as Ht,aw as Ri,ax as Lt,ay as Gt,az as tr,aA as nl,aB as rl,aC as il,aD as ol,aE as ia,aF as oa,aG as Bn,aH as aa,aI as oi,aJ as Un,aK as sa,aL as al,n as Dr,aM as sl,aN as Or,aO as la,aP as ll,aQ as cn,aR as ua,aS as ft,aT as vt,aU as mn,aV as ul,aW as cl,aX as fl,aY as dl,aZ as pl,a_ as ai,a$ as hl,b0 as ml,b1 as gl,b2 as nr,b3 as yl,b4 as ca,b5 as xl,b6 as vl,b7 as bl,b8 as wl,b9 as Tl,ba as rr,bb as kl,bc as _l,bd as Al,be as Ci,bf as Ni,bg as Li,bh as Pi,bi as El,bj as Ml,bk as Sl,bl as Il,bm as Rl,bn as Kn,bo as Cl,bp as fa,bq as Nl,br as Ll,bs as Pl,bt as Dl,bu as da,bv as jn,bw as pa,bx as si,by as li,bz as Ol,bA as ir,bB as zl,bC as Fl}from"./index-Dlp4W1Zl.js";import{s as qt,c as Di,u as Bl,g as Ul}from"./speech-DU07zXBj.js";import{u as or}from"./queue-DW8o1RLT.js";import{u as jl,a as Vl,b as Hl,l as Gl,_ as ha}from"./queues-CJq1hDiQ.js";import{r as $l,a as ql,b as Yl,c as Kl,d as Wl,l as Xl,u as ui}from"./providers-BRCa7xUS.js";import{_ as Ql,a as Zl,r as on}from"./Model.vue_vue_type_script_setup_true_lang-CSqfK4Nz.js";import{_ as ci}from"./TransitionVertical.vue_vue_type_script_setup_true_lang-Dch7MbTT.js";import{_ as Oi}from"./Collapsable.vue_vue_type_script_setup_true_lang-DB9y2Oef.js";import{H as Jl}from"./HeaderLink-Dg_3MlXg.js";import{u as ma}from"./consciousness-CnU1Bi0O.js";import{d as zi}from"./index-YJa3XIzO.js";import{b as Fi}from"./route-block-B_A1xBdJ.js";async function*eu(t,e){const n=t.getReader();try{for(;;){const{done:r,value:i}=await n.read();if(r)return;yield e(i)}}finally{n.releaseLock()}}function tu(t){const e=new Uint8Array(t.frequencyBinCount);t.getByteFrequencyData(e);const n=[];for(let i=0;i<700;i+=80)n.push(e[i]);return e.map(i=>i**1.2).map(i=>i*1.2).reduce((i,o)=>i+o,0)/e.length/100}function nu(t){const e=new Uint8Array(t.frequencyBinCount);t.getByteFrequencyData(e);const n=[];for(let u=0;u<700;u+=80)n.push(e[u]);const r=e.map(u=>u**1.5),i=Math.min(...r),a=Math.max(...r)-i;let s;return a===0?s=r.map(()=>0):s=r.map(u=>(u-i)/a),s.reduce((u,c)=>u+c,0)/e.length}function ru(t,e="linear"){switch(e){case"linear":return tu(t);case"minmax":return nu(t)}}const ga=$n("AudioContext",()=>({audioContext:new AudioContext,calculateVolume:ru})),iu=$n("SpeakingStore",()=>{const n=W(0),r=W(!1),i=Ue(()=>r.value?(30+70*n.value)/100:30);return{mouthOpenSize:n,nowSpeaking:r,nowSpeakingAvatarBorderOpacity:i}});function _n(t,e,n){return e+n<0||e+n>=t.length-1?"":t[e+n]}function ou(t){let e="literal",n="";return{async consume(r){var i,o,a;for(let s=0;s"?(l+=_n(r,s,1),u="literal",s++):l==="<"?u="special":l===">"&&(u="literal"),e==="literal"&&u==="special"?n!==""&&(await((i=t.onLiteral)==null?void 0:i.call(t,n)),n=""):e==="special"&&u==="literal"&&n!==""&&(n+=l,await((o=t.onSpecial)==null?void 0:o.call(t,n)),n=""),e==="literal"&&u==="literal"?(await((a=t.onLiteral)==null?void 0:a.call(t,l)),n=""):e==="special"&&u==="literal"?n="":n+=l,e=u}},async end(){var r,i;n!==""&&(e==="literal"?await((r=t.onLiteral)==null?void 0:r.call(t,n)):n.endsWith("|>")&&await((i=t.onSpecial)==null?void 0:i.call(t,n)))}}}function au(t,e){return{role:"system",content:[t,_s.map(n=>`- ${n}`).join(` +`),e].join(` + +`)}}var su=async t=>{var e;return(t.fetch??globalThis.fetch)($l("chat/completions",t.baseURL),{body:Yl({...t,tools:(e=t.tools)==null?void 0:e.map(n=>({function:Kl({...n.function,returns:void 0}),type:"function"}))}),headers:ql({"Content-Type":"application/json",...t.headers},t.apiKey),method:"POST",signal:t.abortSignal}).then(Wl)},lu=({finishReason:t,maxSteps:e,stepsLength:n,toolCallsLength:r})=>{if(n===0)return"initial";if(n0&&t==="tool_calls")return"tool-result";if(!["error","length"].includes(t))return"continue"}return"done"},uu=t=>typeof t=="string"||Array.isArray(t)&&t.every(e=>!!(typeof e=="object"&&"type"in e&&["audio","image","text"].includes(e.type)))?t:JSON.stringify(t),cu=async({abortSignal:t,messages:e,toolCall:n,tools:r})=>{const i=r==null?void 0:r.find(s=>s.function.name===n.function.name);if(!i){const s=r==null?void 0:r.map(u=>u.function.name),l=s==null||s.length===0?"No tools are available.":`Available tools: ${s.join(", ")}.`;throw new Error(`Model tried to call unavailable tool '${n.function.name}. ${l}.`)}const o=JSON.parse(n.function.arguments),a=uu(await i.execute(o,{abortSignal:t,messages:e,toolCallId:n.id}));return{parsedArgs:o,result:a,toolName:n.function.name}},ar=class extends Error{constructor(e,n){super(e);Mi(this,"response");this.name="XSAIError",this.response=n}},Bi="data:",fu=t=>{if(!t||!t.startsWith(Bi))return[void 0,!1];const e=t.slice(Bi.length),n=e.startsWith(" ")?e.slice(1):e;if(n==="[DONE]")return[void 0,!0];if(n.startsWith("{")&&n.includes('"error":'))throw new Error(`Error from server: ${n}`);return[JSON.parse(n),!1]},du=async t=>{let e,n,r;const i=new ReadableStream({start(p){e=p}}),o=new ReadableStream({start(p){n=p}}),a=new ReadableStream({start(p){r=p}}),s=t.maxSteps??1,l=new TextDecoder,u=[],c=async p=>{var I,A,C;const d={choices:[],finishReason:"error",messages:structuredClone(p.messages),stepType:"initial",toolCalls:[],toolResults:[]},b={};let x="",v=!0;const T=(P,h)=>{P.endedToolCallIDs.has(h)||(P.endedToolCallIDs.add(h),P.currentToolID=null)};if(await su({...p,stream:!0}).then(async P=>P.body.pipeThrough(new TransformStream({transform:async(h,S)=>{const y=l.decode(h,{stream:!0});x+=y;const g=x.split(` +`);x=g.pop()??"";for(const m of g)try{const[k,E]=fu(m);if(E)break;k&&S.enqueue(k)}catch(k){S.error(k)}}})).pipeTo(new WritableStream({abort:h=>{e.error(h),n.error(h),r.error(h)},write:async h=>{var Q,_,te;(Q=p.onChunk)==null||Q.call(p,h),e.enqueue(h);const S=h.choices[0];if(!S)throw new ar("no choice found");S.delta.tool_calls&&(v=!1);const{delta:y,finish_reason:g,index:m,...k}=S,E=(_=d.choices)[m]??(_[m]={finish_reason:g,index:m,message:{role:"assistant"}});if(g!==void 0){if(d.finishReason=g,E.finish_reason=g,g==="length")throw new ar("length exceeded");if(g==="content_filter")throw new ar("content filter")}Object.assign(E,k);const{content:O,refusal:F,tool_calls:D,...B}=y,X=E.message;Object.assign(X,B),F!==void 0&&(X.refusal=(X.refusal||"")+F),O!==void 0&&(X.content=(X.content||"")+O,v&&(r==null||r.enqueue(O)));for(const{function:ce,id:R,type:pe}of D||[]){X.tool_calls??(X.tool_calls={});const ye=(te=X.tool_calls)[R]??(te[R]={function:{arguments:"",name:ce.name,parsed_arguments:{}},id:R,type:pe});ye.function.arguments+=ce.arguments}const Z=b[m]??(b[m]={calledToolCallIDs:new Set,currentToolID:null,endedToolCallIDs:new Set,index:m,toolCallErrors:{},toolCallResults:{}});g&&Z.currentToolID!==null&&T(Z,Z.currentToolID);for(const ce of y.tool_calls||[])Z.currentToolID!==null&&Z.currentToolID!==ce.id&&T(Z,Z.currentToolID),Z.calledToolCallIDs.add(ce.id),Z.currentToolID=ce.id}}))),d.messages.push({content:((I=d.choices[0])==null?void 0:I.message.content)??"",refusal:(A=d.choices[0])==null?void 0:A.message.refusal,role:"assistant"}),await Promise.allSettled(d.choices.map(async P=>{const h=b[P.index];return Promise.allSettled([...h.endedToolCallIDs].map(async S=>{const y=P.message.tool_calls[S];if(d.toolCalls.push({args:y.function.arguments,toolCallId:S,toolCallType:"function",toolName:y.function.name}),!h.toolCallResults[S])try{const{parsedArgs:g,result:m,toolName:k}=await cu({abortSignal:p.abortSignal,messages:p.messages,toolCall:y,tools:p.tools});y.function.parsed_arguments=g,h.toolCallResults[S]=m,d.messages.push({content:m,role:"tool",tool_call_id:S}),d.toolResults.push({args:g,result:m,toolCallId:S,toolName:k})}catch(g){h.toolCallErrors[S]=g}}))})),d.stepType=lu({finishReason:d.finishReason,maxSteps:s,stepsLength:u.length,toolCallsLength:d.toolCalls.length}),u.push(d),n.enqueue(d),(C=p.onStepFinish)==null||C.call(p,d),!v)return async()=>c({...p,messages:d.messages})};return(async()=>{var d;let p=await c(t);for(;typeof p=="function"&&u.length{e.error(p),n.error(p),r.error(p)}),Promise.resolve({chunkStream:i,stepStream:o,textStream:a})};const pu=$n("llm",()=>{async function t(n,r,i,o){const a=o==null?void 0:o.headers;return await du({...r.chat(n),messages:i,streamOptions:{usage:!0},headers:a})}async function e(n,r){if(n==="")return[];try{return await Xl({baseURL:n.endsWith("/")?n:`${n}/`,apiKey:r})}catch(i){if(String(i).includes("Failed to construct 'URL': Invalid URL"))return[];throw i}}return{models:e,stream:t}}),St=$n("chat",()=>{const{stream:t}=pu(),{t:e}=Ot(),n=W(!1),r=W([]),i=W([]),o=W([]),a=W([]),s=W([]),l=W([]),u=W([]),c=W([]);function f(h){r.value.push(h)}function p(h){i.value.push(h)}function d(h){o.value.push(h)}function b(h){a.value.push(h)}function x(h){s.value.push(h)}function v(h){l.value.push(h)}function T(h){u.value.push(h)}function I(h){c.value.push(h)}const A=W([au(e("prompt.prefix"),e("prompt.suffix"))]),C=W({role:"assistant",content:""});async function P(h,S){var y;try{if(n.value=!0,!h)return;for(const D of r.value)await D(h);C.value={role:"assistant",content:""},A.value.push({role:"user",content:h}),A.value.push(C.value);const g=A.value.slice(0,A.value.length-1).map(D=>Os(D));for(const D of i.value)await D(h);for(const D of o.value)await D(h);const m=(y=S.providerConfig)==null?void 0:y.headers,k=m==null?void 0:m.filter(D=>D.key&&D.value).reduce((D,B)=>(D[B.key]=B.value,D),{}),E=await t(S.model,S.chatProvider,g,{headers:k});for(const D of a.value)await D(h);let O="";const F=ou({onLiteral:async D=>{for(const B of s.value)await B(D);C.value.content+=D},onSpecial:async D=>{for(const B of l.value)await B(D)}});for await(const D of eu(E.textStream,async B=>B))O+=D,await F.consume(D);await F.end();for(const D of u.value)await D();for(const D of c.value)await D(O);console.debug("LLM output:",O)}finally{n.value=!1}}return{sending:n,messages:A,streamingMessage:C,send:P,onBeforeMessageComposed:f,onAfterMessageComposed:p,onBeforeSend:d,onAfterSend:b,onTokenLiteral:x,onTokenSpecial:v,onStreamEnd:T,onAssistantResponseEnd:I}}),ya=ze({__name:"Screen",setup(t){const e=W(),n=zs(Bs),{width:r,height:i}=Fs(),o=Zr(e,{immediate:!0,windowResize:!0,reset:!0}),a=Ue(()=>n.between("sm","md").value||n.smaller("sm").value),s=Ue(()=>n.between("md","lg").value),l=Ue(()=>n.greaterOrEqual("lg").value),u=Ue(()=>l.value?o.width.value:a.value||s.value?r.value-16:o.width.value),c=W(0);return je([r,i,e],()=>{var p,d;const f=(d=(p=e.value)==null?void 0:p.parentElement)==null?void 0:d.getBoundingClientRect();l.value||a.value||s.value?c.value=(f==null?void 0:f.height)||0:c.value=600}),je([o.width,o.height],()=>{l.value||a.value||s.value?c.value=o.height.value:c.value=600}),pn(async()=>{e.value&&o.update()}),(f,p)=>(ee(),ie("div",{ref_key:"containerRef",ref:e,"h-full":"","w-full":""},[gn(f.$slots,"default",{width:u.value,height:c.value})],512))}}),hu={absolute:"",bottom:"3",right:"3"},mu={flex:"~ row","cursor-pointer":""},gu=["checked","aria-checked"],yu={key:0,"min-w":"50vw",z:"(ee(),Qt(ya,{relative:""},{default:Be(({width:a,height:s})=>[ke(Zl,{width:a,height:s},{default:Be(({app:l})=>[ke(Ql,{app:l,"mouth-open-size":t.mouthOpenSize,width:a,height:s,paused:t.paused},null,8,["app","mouth-open-size","width","height","paused"])]),_:2},1032,["width","height"]),z("div",hu,[z("div",mu,[z("label",{class:st([n.value?"bg-zinc-300 dark:bg-zinc-200":"bg-zinc-100 dark:bg-zinc-700"]),transition:"all ease-in-out duration-500",text:"lg zinc-500 dark:zinc-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[At(z("input",{"onUpdate:modelValue":o[0]||(o[0]=l=>n.value=l),checked:n.value,"aria-checked":n.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,gu),[[Jr,n.value]]),o[8]||(o[8]=z("div",{"select-none":""},[z("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),ke(ci,null,{default:Be(()=>[n.value?(ee(),ie("div",yu,[z("div",xu,[z("div",vu,[z("span",null,ge(H(e)("stage.viewers.debug-menu.emotions")),1)]),z("div",bu,[z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[1]||(o[1]=l=>r.value={group:"Surprise",index:0})},ge(H(e)("stage.viewers.debug-menu.emotions-btn.surprised")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[2]||(o[2]=l=>r.value={group:"Sad",index:0})},ge(H(e)("stage.viewers.debug-menu.emotions-btn.sad")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[3]||(o[3]=l=>r.value={group:"Angry",index:0})},ge(H(e)("stage.viewers.debug-menu.emotions-btn.angry")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[4]||(o[4]=l=>r.value={group:"Happy",index:0})},ge(H(e)("stage.viewers.debug-menu.emotions-btn.happy")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[5]||(o[5]=l=>r.value={group:"Awkward",index:0})},ge(H(e)("stage.viewers.debug-menu.emotions-btn.awkward")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[6]||(o[6]=l=>r.value={group:"Question",index:0})},ge(H(e)("stage.viewers.debug-menu.emotions-btn.question")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[7]||(o[7]=l=>r.value={group:"Think",index:0})},ge(H(e)("stage.viewers.debug-menu.emotions-btn.think")),1)])])])):it("",!0)]),_:1})])]),_:1}))}});var Tu=Object.defineProperty,ku=(t,e,n)=>e in t?Tu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_u=(t,e,n)=>ku(t,e+"",n);function Au(t){return Ws()?(Xs(t),!0):!1}function xa(t){return typeof t=="function"?t():H(t)}const Eu=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Mu=Object.prototype.toString,Su=t=>Mu.call(t)==="[object Object]",Iu=()=>{},Ru=Eu?window:void 0;function Cu(t){var e;const n=xa(t);return(e=n==null?void 0:n.$el)!=null?e:n}function sr(...t){let e,n,r,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,i]=t,e=Ru):[e,n,r,i]=t,!e)return Iu;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const o=[],a=()=>{o.forEach(c=>c()),o.length=0},s=(c,f,p,d)=>(c.addEventListener(f,p,d),()=>c.removeEventListener(f,p,d)),l=je(()=>[Cu(e),xa(i)],([c,f])=>{if(a(),!c)return;const p=Su(f)?{...f}:f;o.push(...n.flatMap(d=>r.map(b=>s(c,d,b,p))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return Au(u),u}function va(t,e,n,r){const i=class extends yn{constructor(o={}){const a=Object.entries(t);super({uniforms:a.reduce((s,[l,u])=>{const c=ri.clone({[l]:{value:u}});return{...s,...c}},{}),vertexShader:e,fragmentShader:n}),_u(this,"key",""),a.forEach(([s])=>Object.defineProperty(this,s,{get:()=>this.uniforms[s].value,set:l=>this.uniforms[s].value=l})),Object.assign(this,o)}};return i.key=Dt.generateUUID(),i}va({color:new Fe("white"),scale:new Pe(1,1),imageBounds:new Pe(1,1),resolution:1024,map:null,zoom:1,radius:0,grayscale:0,opacity:1},` + varying vec2 vUv; + varying vec2 vPos; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + vPos = position.xy; + } + `,` + // mostly from https://gist.github.com/statico/df64c5d167362ecf7b34fca0b1459a44 + varying vec2 vUv; + varying vec2 vPos; + uniform vec2 scale; + uniform vec2 imageBounds; + uniform float resolution; + uniform vec3 color; + uniform sampler2D map; + uniform float radius; + uniform float zoom; + uniform float grayscale; + uniform float opacity; + const vec3 luma = vec3(.299, 0.587, 0.114); + vec4 toGrayscale(vec4 color, float intensity) { + return vec4(mix(color.rgb, vec3(dot(color.rgb, luma)), intensity), color.a); + } + vec2 aspect(vec2 size) { + return size / min(size.x, size.y); + } + + const float PI = 3.14159265; + + // from https://iquilezles.org/articles/distfunctions + float udRoundBox( vec2 p, vec2 b, float r ) { + return length(max(abs(p)-b+r,0.0))-r; + } + + void main() { + vec2 s = aspect(scale); + vec2 i = aspect(imageBounds); + float rs = s.x / s.y; + float ri = i.x / i.y; + vec2 new = rs < ri ? vec2(i.x * s.y / i.y, s.y) : vec2(s.x, i.y * s.x / i.x); + vec2 offset = (rs < ri ? vec2((new.x - s.x) / 2.0, 0.0) : vec2(0.0, (new.y - s.y) / 2.0)) / new; + vec2 uv = vUv * s / new + offset; + vec2 zUv = (uv - vec2(0.5, 0.5)) / zoom + vec2(0.5, 0.5); + + vec2 res = vec2(scale * resolution); + vec2 halfRes = 0.5 * res; + float b = udRoundBox(vUv.xy * res - halfRes, halfRes, resolution * radius); + vec3 a = mix(vec3(1.0,0.0,0.0), vec3(0.0,0.0,0.0), smoothstep(0.0, 1.0, b)); + gl_FragColor = toGrayscale(texture2D(map, zUv) * vec4(color, opacity * a), grayscale); + + #include + #include + } + `);const fi=parseInt(Qs.replace(/\D+/g,""));var Nu=Object.defineProperty,Lu=(t,e,n)=>e in t?Nu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Pu=(t,e,n)=>(Lu(t,e+"",n),n);async function Ui(t){const e=await t.arrayBuffer(),n=btoa(String.fromCharCode(...new Uint8Array(e)));return`data:${t.type||""};base64,${n}`}let An,lr,Bt,En;function ur(t,e=1/0,n=null){lr||(lr=new ta(2,2,1,1)),Bt||(Bt=new yn({uniforms:{blitTexture:new il(t)},vertexShader:` + varying vec2 vUv; + void main(){ + vUv = uv; + gl_Position = vec4(position.xy * 1.0,0.,.999999); + } + `,fragmentShader:` + uniform sampler2D blitTexture; + varying vec2 vUv; + + void main(){ + gl_FragColor = vec4(vUv.xy, 0, 1); + + #ifdef IS_SRGB + gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) ); + #else + gl_FragColor = texture2D( blitTexture, vUv); + #endif + } + `})),Bt.uniforms.blitTexture.value=t,Bt.defines.IS_SRGB="colorSpace"in t?t.colorSpace==="srgb":t.encoding===3001,Bt.needsUpdate=!0,En||(En=new Pt(lr,Bt),En.frustrumCulled=!1);const r=new Et,i=new Pr;i.add(En),n||(n=An=new ol({antialias:!1})),n.setSize(Math.min(t.image.width,e),Math.min(t.image.height,e)),n.clear(),n.render(i,r);const o=new Fn(n.domElement);return o.minFilter=t.minFilter,o.magFilter=t.magFilter,o.wrapS=t.wrapS,o.wrapT=t.wrapT,o.name=t.name,An&&(An.dispose(),An=null),o}const ji={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class ba{constructor(){this.pluginCallbacks=[],this.register(function(e){return new Gu(e)}),this.register(function(e){return new $u(e)}),this.register(function(e){return new Ku(e)}),this.register(function(e){return new Wu(e)}),this.register(function(e){return new Xu(e)}),this.register(function(e){return new Qu(e)}),this.register(function(e){return new qu(e)}),this.register(function(e){return new Yu(e)}),this.register(function(e){return new Zu(e)}),this.register(function(e){return new Ju(e)}),this.register(function(e){return new ec(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,n,r,i){const o=new Hu,a=[];for(let s=0,l=this.pluginCallbacks.length;st.times[t.times.length-1]){if(Math.abs(t.times[t.times.length-1]-e)<.001)return t.times.length-1;r[r.length-1]=e,r.set(t.times,0),i.set(t.values,0),i.set(o.evaluate(e),t.values.length),a=r.length-1}else for(let s=0;se){r.set(t.times.slice(0,s+1),0),r[s+1]=e,r.set(t.times.slice(s+1),s+2),i.set(t.values.slice(0,(s+1)*n),0),i.set(o.evaluate(e),(s+1)*n),i.set(t.values.slice((s+1)*n),(s+2)*n),a=s+1;break}}return t.times=r,t.values=i,a},mergeMorphTargetTracks:function(t,e){const n=[],r={},i=t.tracks;for(let o=0;o4?a=t.array[i*t.itemSize+o]:(o===0?a=t.getX(i):o===1?a=t.getY(i):o===2?a=t.getZ(i):o===3&&(a=t.getW(i)),t.normalized===!0&&(a=Dt.normalize(a,t.array))),r.min[o]=Math.min(r.min[o],a),r.max[o]=Math.max(r.max[o],a)}return r}function wa(t){return Math.ceil(t/4)*4}function fr(t,e=0){const n=wa(t.byteLength);if(n!==t.byteLength){const r=new Uint8Array(n);if(r.set(new Uint8Array(t)),e!==0)for(let i=t.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function qi(t,e){if(t.toBlob!==void 0)return new Promise(r=>t.toBlob(r,e));let n;return e==="image/jpeg"?n=.92:e==="image/webp"&&(n=.8),t.convertToBlob({type:e,quality:n})}class Hu{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,n,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,o=i.buffers,a=i.json;r=i.options;const s=i.extensionsUsed,l=i.extensionsRequired,u=new Blob(o,{type:"application/octet-stream"}),c=Object.keys(s),f=Object.keys(l);c.length>0&&(a.extensionsUsed=c),f.length>0&&(a.extensionsRequired=f),a.buffers&&a.buffers.length>0&&(a.buffers[0].byteLength=u.size),r.binary===!0?u.arrayBuffer().then(p=>{const d=fr(p),b=new DataView(new ArrayBuffer(Gi));b.setUint32(0,d.byteLength,!0),b.setUint32(4,Bu,!0);const x=fr(Uu(JSON.stringify(a)),32),v=new DataView(new ArrayBuffer(Gi));v.setUint32(0,x.byteLength,!0),v.setUint32(4,Fu,!0);const T=new ArrayBuffer(Hi),I=new DataView(T);I.setUint32(0,Ou,!0),I.setUint32(4,zu,!0);const A=Hi+v.byteLength+x.byteLength+b.byteLength+d.byteLength;I.setUint32(8,A,!0),new Blob([T,v,x,b,d],{type:"application/octet-stream"}).arrayBuffer().then(n)}):a.buffers&&a.buffers.length>0?Ui(u).then(p=>{a.buffers[0].uri=p,n(a)}):n(a)}serializeUserData(e,n){if(Object.keys(e.userData).length===0)return;const r=this.options,i=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&o.gltfExtensions){n.extensions===void 0&&(n.extensions={});for(const a in o.gltfExtensions)n.extensions[a]=o.gltfExtensions[a],i[a]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(n.extras=o)}catch(o){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+o.message)}}getUID(e,n=!1){if(this.uids.has(e)===!1){const r=new Map;r.set(!0,this.uid++),r.set(!1,this.uid++),this.uids.set(e,r)}return this.uids.get(e).get(n)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new ae;for(let r=0,i=e.count;r5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const n=this.cache;if(n.attributesNormalized.has(e))return n.attributesNormalized.get(e);const r=e.clone(),i=new ae;for(let o=0,a=r.count;o4?b=e.array[p*e.itemSize+d]:(d===0?b=e.getX(p):d===1?b=e.getY(p):d===2?b=e.getZ(p):d===3&&(b=e.getW(p)),e.normalized===!0&&(b=Dt.normalize(b,e.array))),n===me.FLOAT?u.setFloat32(c,b,!0):n===me.INT?u.setInt32(c,b,!0):n===me.UNSIGNED_INT?u.setUint32(c,b,!0):n===me.SHORT?u.setInt16(c,b,!0):n===me.UNSIGNED_SHORT?u.setUint16(c,b,!0):n===me.BYTE?u.setInt8(c,b):n===me.UNSIGNED_BYTE&&u.setUint8(c,b),c+=s}const f={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:l};return o!==void 0&&(f.target=o),o===me.ARRAY_BUFFER&&(f.byteStride=e.itemSize*s),this.byteOffset+=l,a.bufferViews.push(f),{id:a.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const n=this,r=n.json;return r.bufferViews||(r.bufferViews=[]),e.arrayBuffer().then(i=>{const o=fr(i),a={buffer:n.processBuffer(o),byteOffset:n.byteOffset,byteLength:o.byteLength};return n.byteOffset+=o.byteLength,r.bufferViews.push(a)-1})}processAccessor(e,n,r,i){const o=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let s;if(e.array.constructor===Float32Array)s=me.FLOAT;else if(e.array.constructor===Int32Array)s=me.INT;else if(e.array.constructor===Uint32Array)s=me.UNSIGNED_INT;else if(e.array.constructor===Int16Array)s=me.SHORT;else if(e.array.constructor===Uint16Array)s=me.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)s=me.BYTE;else if(e.array.constructor===Uint8Array)s=me.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),i===void 0&&(i=e.count),i===0)return null;const l=Vu(e,r,i);let u;n!==void 0&&(u=e===n.index?me.ELEMENT_ARRAY_BUFFER:me.ARRAY_BUFFER);const c=this.processBufferView(e,s,r,i,u),f={bufferView:c.id,byteOffset:c.byteOffset,componentType:s,count:i,max:l.max,min:l.min,type:a[e.itemSize]};return e.normalized===!0&&(f.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(f)-1}processImage(e,n,r,i="image/png"){if(e!==null){const o=this,a=o.cache,s=o.json,l=o.options,u=o.pending;a.images.has(e)||a.images.set(e,{});const c=a.images.get(e),f=i+":flipY/"+r.toString();if(c[f]!==void 0)return c[f];s.images||(s.images=[]);const p={mimeType:i},d=$i();d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize);const b=d.getContext("2d");if(r===!0&&(b.translate(0,d.height),b.scale(1,-1)),e.data!==void 0){n!==Lr&&console.error("GLTFExporter: Only RGBAFormat is supported.",n),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const v=new Uint8ClampedArray(e.height*e.width*4);for(let T=0;To.processBufferViewImage(v)).then(v=>{p.bufferView=v})):d.toDataURL!==void 0?p.uri=d.toDataURL(i):u.push(qi(d,i).then(Ui).then(v=>{p.uri=v}));const x=s.images.push(p)-1;return c[f]=x,x}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const n=this.json;n.samplers||(n.samplers=[]);const r={magFilter:Je[e.magFilter],minFilter:Je[e.minFilter],wrapS:Je[e.wrapS],wrapT:Je[e.wrapT]};return n.samplers.push(r)-1}processTexture(e){const n=this.options,r=this.cache,i=this.json;if(r.textures.has(e))return r.textures.get(e);i.textures||(i.textures=[]),e instanceof er&&(e=ur(e,n.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),this._invokeAll(function(l){l.writeTexture&&l.writeTexture(e,a)});const s=i.textures.push(a)-1;return r.textures.set(e,s),s}processMaterial(e){const n=this.cache,r=this.json;if(n.materials.has(e))return n.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(un(o,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const s=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),l={index:this.processTexture(s),channel:s.channel};this.applyTextureTransform(l,s),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const s={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(s,e.map),i.pbrMetallicRoughness.baseColorTexture=s}if(e.emissive){const s=e.emissive;if(Math.max(s.r,s.g,s.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const l={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(l,e.emissiveMap),i.emissiveTexture=l}}if(e.normalMap){const s={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(s.scale=e.normalScale.x),this.applyTextureTransform(s,e.normalMap),i.normalTexture=s}if(e.aoMap){const s={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(s.strength=e.aoMapIntensity),this.applyTextureTransform(s,e.aoMap),i.occlusionTexture=s}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===Yn&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(s){s.writeMaterial&&s.writeMaterial(e,i)});const a=r.materials.push(i)-1;return n.materials.set(e,a),a}processMesh(e){const n=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let A=0,C=e.material.length;A=152?{uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3"}:{uv:"TEXCOORD_0",uv2:"TEXCOORD_1"},color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},d=a.getAttribute("normal");d!==void 0&&!this.isNormalizedNormalAttribute(d)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),a.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let b=null;for(let A in a.attributes){if(A.slice(0,5)==="morph")continue;const C=a.attributes[A];if(A=p[A]||A.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(A)||(A="_"+A),n.attributes.has(this.getUID(C))){u[A]=n.attributes.get(this.getUID(C));continue}b=null;const P=C.array;A==="JOINTS_0"&&!(P instanceof Uint16Array)&&!(P instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new Nt(new Uint16Array(P),C.itemSize,C.normalized));const h=this.processAccessor(b||C,a);h!==null&&(A.startsWith("_")||this.detectMeshQuantization(A,C),u[A]=h,n.attributes.set(this.getUID(C),h))}if(d!==void 0&&a.setAttribute("normal",d),Object.keys(u).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const A=[],C=[],P={};if(e.morphTargetDictionary!==void 0)for(const h in e.morphTargetDictionary)P[e.morphTargetDictionary[h]]=h;for(let h=0;h0&&(l.extras={},l.extras.targetNames=C)}const x=Array.isArray(e.material);if(x&&a.groups.length===0)return null;const v=x?e.material:[e.material],T=x?a.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let A=0,C=T.length;A0&&(P.targets=f),a.index!==null){let S=this.getUID(a.index);(T[A].start!==void 0||T[A].count!==void 0)&&(S+=":"+T[A].start+":"+T[A].count),n.attributes.has(S)?P.indices=n.attributes.get(S):(P.indices=this.processAccessor(a.index,a,T[A].start,T[A].count),n.attributes.set(S,P.indices)),P.indices===null&&delete P.indices}const h=this.processMaterial(v[T[A].materialIndex]);h!==null&&(P.material=h),c.push(P)}l.primitives=c,r.meshes||(r.meshes=[]),this._invokeAll(function(A){A.writeMesh&&A.writeMesh(e,l)});const I=r.meshes.push(l)-1;return n.meshes.set(o,I),I}detectMeshQuantization(e,n){if(this.extensionsUsed[cr])return;let r;switch(n.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}n.normalized&&(r+=" normalized");const i=e.split("_",1)[0];ji[i]&&ji[i].includes(r)&&(this.extensionsUsed[cr]=!0,this.extensionsRequired[cr]=!0)}processCamera(e){const n=this.json;n.cameras||(n.cameras=[]);const r=e.isOrthographicCamera,i={type:r?"orthographic":"perspective"};return r?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:Dt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),n.cameras.push(i)-1}processAnimation(e,n){const r=this.json,i=this.nodeMap;r.animations||(r.animations=[]),e=ba.Utils.mergeMorphTargetTracks(e.clone(),n);const o=e.tracks,a=[],s=[];for(let l=0;l0){const s=[];for(let l=0,u=e.children.length;l0&&(o.children=s)}this._invokeAll(function(s){s.writeNode&&s.writeNode(e,o)});const a=n.nodes.push(o)-1;return i.set(e,a),a}processScene(e){const n=this.json,r=this.options;n.scenes||(n.scenes=[],n.scene=0);const i={};e.name!==""&&(i.name=e.name),n.scenes.push(i);const o=[];for(let a=0,s=e.children.length;a0&&(i.nodes=o),this.serializeUserData(e,i)}processObjects(e){const n=new Pr;n.name="AuxScene";for(let r=0;r0&&this.processObjects(r);for(let i=0;i0&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,a.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},o[this.name]=!0);const s=i.extensions[this.name].lights;s.push(a),n.extensions=n.extensions||{},n.extensions[this.name]={light:s.length-1}}}let $u=class{constructor(t){this.writer=t,this.name="KHR_materials_unlit"}writeMaterial(t,e){if(!t.isMeshBasicMaterial)return;const n=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},n[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}},qu=class{constructor(t){this.writer=t,this.name="KHR_materials_clearcoat"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.clearcoat===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.clearcoatFactor=t.clearcoat,t.clearcoatMap){const o={index:n.processTexture(t.clearcoatMap),texCoord:t.clearcoatMap.channel};n.applyTextureTransform(o,t.clearcoatMap),i.clearcoatTexture=o}if(i.clearcoatRoughnessFactor=t.clearcoatRoughness,t.clearcoatRoughnessMap){const o={index:n.processTexture(t.clearcoatRoughnessMap),texCoord:t.clearcoatRoughnessMap.channel};n.applyTextureTransform(o,t.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o}if(t.clearcoatNormalMap){const o={index:n.processTexture(t.clearcoatNormalMap),texCoord:t.clearcoatNormalMap.channel};n.applyTextureTransform(o,t.clearcoatNormalMap),i.clearcoatNormalTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Yu=class{constructor(t){this.writer=t,this.name="KHR_materials_iridescence"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.iridescence===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.iridescenceFactor=t.iridescence,t.iridescenceMap){const o={index:n.processTexture(t.iridescenceMap),texCoord:t.iridescenceMap.channel};n.applyTextureTransform(o,t.iridescenceMap),i.iridescenceTexture=o}if(i.iridescenceIor=t.iridescenceIOR,i.iridescenceThicknessMinimum=t.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=t.iridescenceThicknessRange[1],t.iridescenceThicknessMap){const o={index:n.processTexture(t.iridescenceThicknessMap),texCoord:t.iridescenceThicknessMap.channel};n.applyTextureTransform(o,t.iridescenceThicknessMap),i.iridescenceThicknessTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Ku=class{constructor(t){this.writer=t,this.name="KHR_materials_transmission"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.transmission===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.transmissionFactor=t.transmission,t.transmissionMap){const o={index:n.processTexture(t.transmissionMap),texCoord:t.transmissionMap.channel};n.applyTextureTransform(o,t.transmissionMap),i.transmissionTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Wu=class{constructor(t){this.writer=t,this.name="KHR_materials_volume"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.transmission===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.thicknessFactor=t.thickness,t.thicknessMap){const o={index:n.processTexture(t.thicknessMap),texCoord:t.thicknessMap.channel};n.applyTextureTransform(o,t.thicknessMap),i.thicknessTexture=o}i.attenuationDistance=t.attenuationDistance,i.attenuationColor=t.attenuationColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Xu=class{constructor(t){this.writer=t,this.name="KHR_materials_ior"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.ior===1.5)return;const n=this.writer.extensionsUsed,r={};r.ior=t.ior,e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}},Qu=class{constructor(t){this.writer=t,this.name="KHR_materials_specular"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.specularIntensity===1&&t.specularColor.equals(Du)&&!t.specularIntensityMap&&!t.specularColorTexture)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.specularIntensityMap){const o={index:n.processTexture(t.specularIntensityMap),texCoord:t.specularIntensityMap.channel};n.applyTextureTransform(o,t.specularIntensityMap),i.specularTexture=o}if(t.specularColorMap){const o={index:n.processTexture(t.specularColorMap),texCoord:t.specularColorMap.channel};n.applyTextureTransform(o,t.specularColorMap),i.specularColorTexture=o}i.specularFactor=t.specularIntensity,i.specularColorFactor=t.specularColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Zu=class{constructor(t){this.writer=t,this.name="KHR_materials_sheen"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.sheen==0)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.sheenRoughnessMap){const o={index:n.processTexture(t.sheenRoughnessMap),texCoord:t.sheenRoughnessMap.channel};n.applyTextureTransform(o,t.sheenRoughnessMap),i.sheenRoughnessTexture=o}if(t.sheenColorMap){const o={index:n.processTexture(t.sheenColorMap),texCoord:t.sheenColorMap.channel};n.applyTextureTransform(o,t.sheenColorMap),i.sheenColorTexture=o}i.sheenRoughnessFactor=t.sheenRoughness,i.sheenColorFactor=t.sheenColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Ju=class{constructor(t){this.writer=t,this.name="KHR_materials_anisotropy"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.anisotropy==0)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.anisotropyMap){const o={index:n.processTexture(t.anisotropyMap)};n.applyTextureTransform(o,t.anisotropyMap),i.anisotropyTexture=o}i.anisotropyStrength=t.anisotropy,i.anisotropyRotation=t.anisotropyRotation,e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},ec=class{constructor(t){this.writer=t,this.name="KHR_materials_emissive_strength"}writeMaterial(t,e){if(!t.isMeshStandardMaterial||t.emissiveIntensity===1)return;const n=this.writer.extensionsUsed,r={};r.emissiveStrength=t.emissiveIntensity,e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}};var xn=Uint8Array,Ta=Uint16Array,tc=Uint32Array,nc=new xn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),rc=new xn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ka=function(t,e){for(var n=new Ta(31),r=0;r<31;++r)n[r]=e+=1<>>1|(Ne&21845)<<1;wt=(wt&52428)>>>2|(wt&13107)<<2,wt=(wt&61680)>>>4|(wt&3855)<<4,ac[Ne]=((wt&65280)>>>8|(wt&255)<<8)>>>1}var Wn=new xn(288);for(var Ne=0;Ne<144;++Ne)Wn[Ne]=8;for(var Ne=144;Ne<256;++Ne)Wn[Ne]=9;for(var Ne=256;Ne<280;++Ne)Wn[Ne]=7;for(var Ne=280;Ne<288;++Ne)Wn[Ne]=8;var sc=new xn(32);for(var Ne=0;Ne<32;++Ne)sc[Ne]=5;var lc=new xn(0),uc=typeof TextDecoder<"u"&&new TextDecoder,cc=0;try{uc.decode(lc,{stream:!0}),cc=1}catch{}var fc=Object.defineProperty,dc=(t,e,n)=>e in t?fc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,pc=(t,e,n)=>(dc(t,e+"",n),n);const Aa=class extends Pt{constructor(t,e={}){super(t),this.isReflector=!0,this.type="Reflector",this.camera=new Et;const n=this,r=e.color!==void 0?new Fe(e.color):new Fe(8355711),i=e.textureWidth||512,o=e.textureHeight||512,a=e.clipBias||0,s=e.shader||Aa.ReflectorShader,l=e.multisample!==void 0?e.multisample:4,u=new Xo,c=new ae,f=new ae,p=new ae,d=new xt,b=new ae(0,0,-1),x=new Mt,v=new ae,T=new ae,I=new Mt,A=new xt,C=this.camera,P=new Js(i,o,{samples:l,type:el}),h=new yn({uniforms:ri.clone(s.uniforms),fragmentShader:s.fragmentShader,vertexShader:s.vertexShader});h.uniforms.tDiffuse.value=P.texture,h.uniforms.color.value=r,h.uniforms.textureMatrix.value=A,this.material=h,this.onBeforeRender=function(S,y,g){if(f.setFromMatrixPosition(n.matrixWorld),p.setFromMatrixPosition(g.matrixWorld),d.extractRotation(n.matrixWorld),c.set(0,0,1),c.applyMatrix4(d),v.subVectors(f,p),v.dot(c)>0)return;v.reflect(c).negate(),v.add(f),d.extractRotation(g.matrixWorld),b.set(0,0,-1),b.applyMatrix4(d),b.add(p),T.subVectors(f,b),T.reflect(c).negate(),T.add(f),C.position.copy(v),C.up.set(0,1,0),C.up.applyMatrix4(d),C.up.reflect(c),C.lookAt(T),C.far=g.far,C.updateMatrixWorld(),C.projectionMatrix.copy(g.projectionMatrix),A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),A.multiply(C.projectionMatrix),A.multiply(C.matrixWorldInverse),A.multiply(n.matrixWorld),u.setFromNormalAndCoplanarPoint(c,f),u.applyMatrix4(C.matrixWorldInverse),x.set(u.normal.x,u.normal.y,u.normal.z,u.constant);const m=C.projectionMatrix;I.x=(Math.sign(x.x)+m.elements[8])/m.elements[0],I.y=(Math.sign(x.y)+m.elements[9])/m.elements[5],I.z=-1,I.w=(1+m.elements[10])/m.elements[14],x.multiplyScalar(2/x.dot(I)),m.elements[2]=x.x,m.elements[6]=x.y,m.elements[10]=x.z+1-a,m.elements[14]=x.w,n.visible=!1;const k=S.getRenderTarget(),E=S.xr.enabled,O=S.shadowMap.autoUpdate,F=S.toneMapping;let D=!1;"outputColorSpace"in S?D=S.outputColorSpace==="srgb":D=S.outputEncoding===3001,S.xr.enabled=!1,S.shadowMap.autoUpdate=!1,"outputColorSpace"in S?S.outputColorSpace="srgb-linear":S.outputEncoding=3e3,S.toneMapping=tl,S.setRenderTarget(P),S.state.buffers.depth.setMask(!0),S.autoClear===!1&&S.clear(),S.render(y,C),S.xr.enabled=E,S.shadowMap.autoUpdate=O,S.toneMapping=F,"outputColorSpace"in S?S.outputColorSpace=D?"srgb":"srgb-linear":S.outputEncoding=D?3001:3e3,S.setRenderTarget(k);const B=g.viewport;B!==void 0&&S.state.viewport(B),n.visible=!0},this.getRenderTarget=function(){return P},this.dispose=function(){P.dispose(),n.material.dispose()}}};let zr=Aa;pc(zr,"ReflectorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:` + uniform mat4 textureMatrix; + varying vec4 vUv; + + #include + #include + + void main() { + + vUv = textureMatrix * vec4( position, 1.0 ); + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + #include + + }`,fragmentShader:` + uniform vec3 color; + uniform sampler2D tDiffuse; + varying vec4 vUv; + + #include + + float blendOverlay( float base, float blend ) { + + return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); + + } + + vec3 blendOverlay( vec3 base, vec3 blend ) { + + return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); + + } + + void main() { + + #include + + vec4 base = texture2DProj( tDiffuse, vUv ); + gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); + + #include + #include <${fi>=154?"colorspace_fragment":"encodings_fragment"}> + + }`});var hc=Object.defineProperty,mc=(t,e,n)=>e in t?hc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ea=(t,e,n)=>(mc(t,typeof e!="symbol"?e+"":e,n),n);const Xn=new Qo,gc=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),Ma=new Zo(gc,5);Xn.setIndex([0,1,2,0,2,3]);Xn.setAttribute("position",new ni(Ma,3,0,!1));Xn.setAttribute("uv",new ni(Ma,2,3,!1));const Fr=class extends Pt{constructor(){super(Fr.Geometry,new Ht({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const t=new ae,e=new ae,n=new Ri(new Uint8Array(16*16*3),16,16,Lr);n.minFilter=Lt,n.magFilter=Lt,n.wrapS=Gt,n.wrapT=Gt;const r=new Ri(new Uint8Array(16*16*3),16,16,Lr);r.minFilter=Lt,r.magFilter=Lt,r.wrapS=Gt,r.wrapT=Gt;const i=Fr.Geometry,o=new tr({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:` + + precision highp float; + + uniform vec3 screenPosition; + uniform vec2 scale; + + attribute vec3 position; + + void main() { + + gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); + + }`,fragmentShader:` + + precision highp float; + + void main() { + + gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 ); + + }`,depthTest:!0,depthWrite:!1,transparent:!1}),a=new tr({uniforms:{map:{value:n},scale:{value:null},screenPosition:{value:null}},vertexShader:` + + precision highp float; + + uniform vec3 screenPosition; + uniform vec2 scale; + + attribute vec3 position; + attribute vec2 uv; + + varying vec2 vUV; + + void main() { + + vUV = uv; + + gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); + + }`,fragmentShader:` + + precision highp float; + + uniform sampler2D map; + + varying vec2 vUV; + + void main() { + + gl_FragColor = texture2D( map, vUV ); + + }`,depthTest:!1,depthWrite:!1,transparent:!1}),s=new Pt(i,o),l=[],u=Sa.Shader,c=new tr({uniforms:{map:{value:null},occlusionMap:{value:r},color:{value:new Fe(16777215)},scale:{value:new Pe},screenPosition:{value:new ae}},vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:nl,transparent:!0,depthWrite:!1}),f=new Pt(i,c);this.addElement=function(v){l.push(v)};const p=new Pe,d=new Pe,b=new rl,x=new Mt;this.onBeforeRender=function(v,T,I){v.getCurrentViewport(x);const A=x.w/x.z,C=x.z/2,P=x.w/2;let h=16/x.w;if(p.set(h*A,h),b.min.set(x.x,x.y),b.max.set(x.x+(x.z-16),x.y+(x.w-16)),e.setFromMatrixPosition(this.matrixWorld),e.applyMatrix4(I.matrixWorldInverse),!(e.z>0)&&(t.copy(e).applyMatrix4(I.projectionMatrix),d.x=x.x+t.x*C+C-8,d.y=x.y+t.y*P+P-8,b.containsPoint(d))){v.copyFramebufferToTexture(d,n);let S=o.uniforms;S.scale.value=p,S.screenPosition.value=t,v.renderBufferDirect(I,null,i,o,s,null),v.copyFramebufferToTexture(d,r),S=a.uniforms,S.scale.value=p,S.screenPosition.value=t,v.renderBufferDirect(I,null,i,a,s,null);const y=-t.x*2,g=-t.y*2;for(let m=0,k=l.length;me in t?xc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ia=(t,e,n)=>(vc(t,typeof e!="symbol"?e+"":e,n),n);const Pn={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new ae},up:{value:new ae(0,1,0)}},vertexShader:` + uniform vec3 sunPosition; + uniform float rayleigh; + uniform float turbidity; + uniform float mieCoefficient; + uniform vec3 up; + + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + // constants for atmospheric scattering + const float e = 2.71828182845904523536028747135266249775724709369995957; + const float pi = 3.141592653589793238462643383279502884197169; + + // wavelength of used primaries, according to preetham + const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); + // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: + // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) + const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); + + // mie stuff + // K coefficient for the primaries + const float v = 4.0; + const vec3 K = vec3( 0.686, 0.678, 0.666 ); + // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K + const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 ); + + // earth shadow hack + // cutoffAngle = pi / 1.95; + const float cutoffAngle = 1.6110731556870734; + const float steepness = 1.5; + const float EE = 1000.0; + + float sunIntensity( float zenithAngleCos ) { + zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 ); + return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) ); + } + + vec3 totalMie( float T ) { + float c = ( 0.2 * T ) * 10E-18; + return 0.434 * c * MieConst; + } + + void main() { + + vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + gl_Position.z = gl_Position.w; // set z to camera.far + + vSunDirection = normalize( sunPosition ); + + vSunE = sunIntensity( dot( vSunDirection, up ) ); + + vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 ); + + float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); + + // extinction (absorbtion + out scattering) + // rayleigh coefficients + vBetaR = totalRayleigh * rayleighCoefficient; + + // mie coefficients + vBetaM = totalMie( turbidity ) * mieCoefficient; + + } + `,fragmentShader:` + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + uniform float mieDirectionalG; + uniform vec3 up; + + const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 ); + + // constants for atmospheric scattering + const float pi = 3.141592653589793238462643383279502884197169; + + const float n = 1.0003; // refractive index of air + const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius) + + // optical length at zenith for molecules + const float rayleighZenithLength = 8.4E3; + const float mieZenithLength = 1.25E3; + // 66 arc seconds -> degrees, and the cosine of that + const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; + + // 3.0 / ( 16.0 * pi ) + const float THREE_OVER_SIXTEENPI = 0.05968310365946075; + // 1.0 / ( 4.0 * pi ) + const float ONE_OVER_FOURPI = 0.07957747154594767; + + float rayleighPhase( float cosTheta ) { + return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); + } + + float hgPhase( float cosTheta, float g ) { + float g2 = pow( g, 2.0 ); + float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); + return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); + } + + void main() { + + vec3 direction = normalize( vWorldPosition - cameraPos ); + + // optical length + // cutoff angle at 90 to avoid singularity in next formula. + float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); + float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); + float sR = rayleighZenithLength * inverse; + float sM = mieZenithLength * inverse; + + // combined extinction factor + vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); + + // in scattering + float cosTheta = dot( direction, vSunDirection ); + + float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); + vec3 betaRTheta = vBetaR * rPhase; + + float mPhase = hgPhase( cosTheta, mieDirectionalG ); + vec3 betaMTheta = vBetaM * mPhase; + + vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); + Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); + + // nightsky + float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] + float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] + vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); + vec3 L0 = vec3( 0.1 ) * Fex; + + // composition + solar disc + float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); + L0 += ( vSunE * 19000.0 * Fex ) * sundisk; + + vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); + + vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); + + gl_FragColor = vec4( retColor, 1.0 ); + + #include + #include <${fi>=154?"colorspace_fragment":"encodings_fragment"}> + + } + `},Ra=new yn({name:"SkyShader",fragmentShader:Pn.fragmentShader,vertexShader:Pn.vertexShader,uniforms:ri.clone(Pn.uniforms),side:Vs,depthWrite:!1});class Ca extends Pt{constructor(){super(new Zs(1,1,1),Ra)}}Ia(Ca,"SkyShader",Pn);Ia(Ca,"material",Ra);new Hs;new ae;new Jo(0,0,0,"YXZ");new ae;var bc=Object.defineProperty,wc=(t,e,n)=>e in t?bc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,re=(t,e,n)=>(wc(t,typeof e!="symbol"?e+"":e,n),n);const Mn=new js,Yi=new Xo,Tc=Math.cos(70*(Math.PI/180)),Ki=(t,e)=>(t%e+e)%e;class kc extends Us{constructor(e,n){super(),re(this,"object"),re(this,"domElement"),re(this,"enabled",!0),re(this,"target",new ae),re(this,"minDistance",0),re(this,"maxDistance",1/0),re(this,"minZoom",0),re(this,"maxZoom",1/0),re(this,"minPolarAngle",0),re(this,"maxPolarAngle",Math.PI),re(this,"minAzimuthAngle",-1/0),re(this,"maxAzimuthAngle",1/0),re(this,"enableDamping",!1),re(this,"dampingFactor",.05),re(this,"enableZoom",!0),re(this,"zoomSpeed",1),re(this,"enableRotate",!0),re(this,"rotateSpeed",1),re(this,"enablePan",!0),re(this,"panSpeed",1),re(this,"screenSpacePanning",!0),re(this,"keyPanSpeed",7),re(this,"zoomToCursor",!1),re(this,"autoRotate",!1),re(this,"autoRotateSpeed",2),re(this,"reverseOrbit",!1),re(this,"reverseHorizontalOrbit",!1),re(this,"reverseVerticalOrbit",!1),re(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),re(this,"mouseButtons",{LEFT:yt.ROTATE,MIDDLE:yt.DOLLY,RIGHT:yt.PAN}),re(this,"touches",{ONE:_t.ROTATE,TWO:_t.DOLLY_PAN}),re(this,"target0"),re(this,"position0"),re(this,"zoom0"),re(this,"_domElementKeyEvents",null),re(this,"getPolarAngle"),re(this,"getAzimuthalAngle"),re(this,"setPolarAngle"),re(this,"setAzimuthalAngle"),re(this,"getDistance"),re(this,"getZoomScale"),re(this,"listenToKeyEvents"),re(this,"stopListenToKeyEvents"),re(this,"saveState"),re(this,"reset"),re(this,"update"),re(this,"connect"),re(this,"dispose"),re(this,"dollyIn"),re(this,"dollyOut"),re(this,"getScale"),re(this,"setScale"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>c.phi,this.getAzimuthalAngle=()=>c.theta,this.setPolarAngle=L=>{let q=Ki(L,2*Math.PI),J=c.phi;J<0&&(J+=2*Math.PI),q<0&&(q+=2*Math.PI);let Ee=Math.abs(q-J);2*Math.PI-Ee{let q=Ki(L,2*Math.PI),J=c.theta;J<0&&(J+=2*Math.PI),q<0&&(q+=2*Math.PI);let Ee=Math.abs(q-J);2*Math.PI-Eer.object.position.distanceTo(r.target),this.listenToKeyEvents=L=>{L.addEventListener("keydown",oe),this._domElementKeyEvents=L},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",oe),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=s.NONE},this.update=(()=>{const L=new ae,q=new ae(0,1,0),J=new zn().setFromUnitVectors(e.up,q),Ee=J.clone().invert(),Xe=new ae,at=new zn,Tn=2*Math.PI;return function(){const Ei=r.object.position;J.setFromUnitVectors(e.up,q),Ee.copy(J).invert(),L.copy(Ei).sub(r.target),L.applyQuaternion(J),c.setFromVector3(L),r.autoRotate&&l===s.NONE&&F(E()),r.enableDamping?(c.theta+=f.theta*r.dampingFactor,c.phi+=f.phi*r.dampingFactor):(c.theta+=f.theta,c.phi+=f.phi);let ht=r.minAzimuthAngle,mt=r.maxAzimuthAngle;isFinite(ht)&&isFinite(mt)&&(ht<-Math.PI?ht+=Tn:ht>Math.PI&&(ht-=Tn),mt<-Math.PI?mt+=Tn:mt>Math.PI&&(mt-=Tn),ht<=mt?c.theta=Math.max(ht,Math.min(mt,c.theta)):c.theta=c.theta>(ht+mt)/2?Math.max(ht,c.theta):Math.min(mt,c.theta)),c.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,c.phi)),c.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(d,r.dampingFactor):r.target.add(d),r.zoomToCursor&&g||r.object.isOrthographicCamera?c.radius=R(c.radius):c.radius=R(c.radius*p),L.setFromSpherical(c),L.applyQuaternion(Ee),Ei.copy(r.target).add(L),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(f.theta*=1-r.dampingFactor,f.phi*=1-r.dampingFactor,d.multiplyScalar(1-r.dampingFactor)):(f.set(0,0,0),d.set(0,0,0));let tn=!1;if(r.zoomToCursor&&g){let nn=null;if(r.object instanceof Et&&r.object.isPerspectiveCamera){const rn=L.length();nn=R(rn*p);const kn=rn-nn;r.object.position.addScaledVector(S,kn),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const rn=new ae(y.x,y.y,0);rn.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),tn=!0;const kn=new ae(y.x,y.y,0);kn.unproject(r.object),r.object.position.sub(kn).add(rn),r.object.updateMatrixWorld(),nn=L.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;nn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(nn).add(r.object.position):(Mn.origin.copy(r.object.position),Mn.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(Mn.direction))u||8*(1-at.dot(r.object.quaternion))>u?(r.dispatchEvent(i),Xe.copy(r.object.position),at.copy(r.object.quaternion),tn=!1,!0):!1}})(),this.connect=L=>{r.domElement=L,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",He),r.domElement.addEventListener("pointerdown",Me),r.domElement.addEventListener("pointercancel",tt),r.domElement.addEventListener("wheel",K)},this.dispose=()=>{var L,q,J,Ee,Xe,at;r.domElement&&(r.domElement.style.touchAction="auto"),(L=r.domElement)==null||L.removeEventListener("contextmenu",He),(q=r.domElement)==null||q.removeEventListener("pointerdown",Me),(J=r.domElement)==null||J.removeEventListener("pointercancel",tt),(Ee=r.domElement)==null||Ee.removeEventListener("wheel",K),(Xe=r.domElement)==null||Xe.ownerDocument.removeEventListener("pointermove",Ve),(at=r.domElement)==null||at.ownerDocument.removeEventListener("pointerup",tt),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",oe)};const r=this,i={type:"change"},o={type:"start"},a={type:"end"},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=s.NONE;const u=1e-6,c=new Ii,f=new Ii;let p=1;const d=new ae,b=new Pe,x=new Pe,v=new Pe,T=new Pe,I=new Pe,A=new Pe,C=new Pe,P=new Pe,h=new Pe,S=new ae,y=new Pe;let g=!1;const m=[],k={};function E(){return 2*Math.PI/60/60*r.autoRotateSpeed}function O(){return Math.pow(.95,r.zoomSpeed)}function F(L){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=L:f.theta-=L}function D(L){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=L:f.phi-=L}const B=(()=>{const L=new ae;return function(q,J){L.setFromMatrixColumn(J,0),L.multiplyScalar(-q),d.add(L)}})(),X=(()=>{const L=new ae;return function(q,J){r.screenSpacePanning===!0?L.setFromMatrixColumn(J,1):(L.setFromMatrixColumn(J,0),L.crossVectors(r.object.up,L)),L.multiplyScalar(q),d.add(L)}})(),Z=(()=>{const L=new ae;return function(q,J){const Ee=r.domElement;if(Ee&&r.object instanceof Et&&r.object.isPerspectiveCamera){const Xe=r.object.position;L.copy(Xe).sub(r.target);let at=L.length();at*=Math.tan(r.object.fov/2*Math.PI/180),B(2*q*at/Ee.clientHeight,r.object.matrix),X(2*J*at/Ee.clientHeight,r.object.matrix)}else Ee&&r.object instanceof $t&&r.object.isOrthographicCamera?(B(q*(r.object.right-r.object.left)/r.object.zoom/Ee.clientWidth,r.object.matrix),X(J*(r.object.top-r.object.bottom)/r.object.zoom/Ee.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function Q(L){r.object instanceof Et&&r.object.isPerspectiveCamera||r.object instanceof $t&&r.object.isOrthographicCamera?p=L:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function _(L){Q(p/L)}function te(L){Q(p*L)}function ce(L){if(!r.zoomToCursor||!r.domElement)return;g=!0;const q=r.domElement.getBoundingClientRect(),J=L.clientX-q.left,Ee=L.clientY-q.top,Xe=q.width,at=q.height;y.x=J/Xe*2-1,y.y=-(Ee/at)*2+1,S.set(y.x,y.y,1).unproject(r.object).sub(r.object.position).normalize()}function R(L){return Math.max(r.minDistance,Math.min(r.maxDistance,L))}function pe(L){b.set(L.clientX,L.clientY)}function ye(L){ce(L),C.set(L.clientX,L.clientY)}function xe(L){T.set(L.clientX,L.clientY)}function Oe(L){x.set(L.clientX,L.clientY),v.subVectors(x,b).multiplyScalar(r.rotateSpeed);const q=r.domElement;q&&(F(2*Math.PI*v.x/q.clientHeight),D(2*Math.PI*v.y/q.clientHeight)),b.copy(x),r.update()}function G(L){P.set(L.clientX,L.clientY),h.subVectors(P,C),h.y>0?_(O()):h.y<0&&te(O()),C.copy(P),r.update()}function w(L){I.set(L.clientX,L.clientY),A.subVectors(I,T).multiplyScalar(r.panSpeed),Z(A.x,A.y),T.copy(I),r.update()}function M(L){ce(L),L.deltaY<0?te(O()):L.deltaY>0&&_(O()),r.update()}function N(L){let q=!1;switch(L.code){case r.keys.UP:Z(0,r.keyPanSpeed),q=!0;break;case r.keys.BOTTOM:Z(0,-r.keyPanSpeed),q=!0;break;case r.keys.LEFT:Z(r.keyPanSpeed,0),q=!0;break;case r.keys.RIGHT:Z(-r.keyPanSpeed,0),q=!0;break}q&&(L.preventDefault(),r.update())}function V(){if(m.length==1)b.set(m[0].pageX,m[0].pageY);else{const L=.5*(m[0].pageX+m[1].pageX),q=.5*(m[0].pageY+m[1].pageY);b.set(L,q)}}function U(){if(m.length==1)T.set(m[0].pageX,m[0].pageY);else{const L=.5*(m[0].pageX+m[1].pageX),q=.5*(m[0].pageY+m[1].pageY);T.set(L,q)}}function Y(){const L=m[0].pageX-m[1].pageX,q=m[0].pageY-m[1].pageY,J=Math.sqrt(L*L+q*q);C.set(0,J)}function ne(){r.enableZoom&&Y(),r.enablePan&&U()}function ve(){r.enableZoom&&Y(),r.enableRotate&&V()}function _e(L){if(m.length==1)x.set(L.pageX,L.pageY);else{const J=pt(L),Ee=.5*(L.pageX+J.x),Xe=.5*(L.pageY+J.y);x.set(Ee,Xe)}v.subVectors(x,b).multiplyScalar(r.rotateSpeed);const q=r.domElement;q&&(F(2*Math.PI*v.x/q.clientHeight),D(2*Math.PI*v.y/q.clientHeight)),b.copy(x)}function de(L){if(m.length==1)I.set(L.pageX,L.pageY);else{const q=pt(L),J=.5*(L.pageX+q.x),Ee=.5*(L.pageY+q.y);I.set(J,Ee)}A.subVectors(I,T).multiplyScalar(r.panSpeed),Z(A.x,A.y),T.copy(I)}function be(L){const q=pt(L),J=L.pageX-q.x,Ee=L.pageY-q.y,Xe=Math.sqrt(J*J+Ee*Ee);P.set(0,Xe),h.set(0,Math.pow(P.y/C.y,r.zoomSpeed)),_(h.y),C.copy(P)}function Ie(L){r.enableZoom&&be(L),r.enablePan&&de(L)}function Te(L){r.enableZoom&&be(L),r.enableRotate&&_e(L)}function Me(L){var q,J;r.enabled!==!1&&(m.length===0&&((q=r.domElement)==null||q.ownerDocument.addEventListener("pointermove",Ve),(J=r.domElement)==null||J.ownerDocument.addEventListener("pointerup",tt)),dt(L),L.pointerType==="touch"?ue(L):en(L))}function Ve(L){r.enabled!==!1&&(L.pointerType==="touch"?we(L):j(L))}function tt(L){var q,J,Ee;ot(L),m.length===0&&((q=r.domElement)==null||q.releasePointerCapture(L.pointerId),(J=r.domElement)==null||J.ownerDocument.removeEventListener("pointermove",Ve),(Ee=r.domElement)==null||Ee.ownerDocument.removeEventListener("pointerup",tt)),r.dispatchEvent(a),l=s.NONE}function en(L){let q;switch(L.button){case 0:q=r.mouseButtons.LEFT;break;case 1:q=r.mouseButtons.MIDDLE;break;case 2:q=r.mouseButtons.RIGHT;break;default:q=-1}switch(q){case yt.DOLLY:if(r.enableZoom===!1)return;ye(L),l=s.DOLLY;break;case yt.ROTATE:if(L.ctrlKey||L.metaKey||L.shiftKey){if(r.enablePan===!1)return;xe(L),l=s.PAN}else{if(r.enableRotate===!1)return;pe(L),l=s.ROTATE}break;case yt.PAN:if(L.ctrlKey||L.metaKey||L.shiftKey){if(r.enableRotate===!1)return;pe(L),l=s.ROTATE}else{if(r.enablePan===!1)return;xe(L),l=s.PAN}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(o)}function j(L){if(r.enabled!==!1)switch(l){case s.ROTATE:if(r.enableRotate===!1)return;Oe(L);break;case s.DOLLY:if(r.enableZoom===!1)return;G(L);break;case s.PAN:if(r.enablePan===!1)return;w(L);break}}function K(L){r.enabled===!1||r.enableZoom===!1||l!==s.NONE&&l!==s.ROTATE||(L.preventDefault(),r.dispatchEvent(o),M(L),r.dispatchEvent(a))}function oe(L){r.enabled===!1||r.enablePan===!1||N(L)}function ue(L){switch(bt(L),m.length){case 1:switch(r.touches.ONE){case _t.ROTATE:if(r.enableRotate===!1)return;V(),l=s.TOUCH_ROTATE;break;case _t.PAN:if(r.enablePan===!1)return;U(),l=s.TOUCH_PAN;break;default:l=s.NONE}break;case 2:switch(r.touches.TWO){case _t.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ne(),l=s.TOUCH_DOLLY_PAN;break;case _t.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;ve(),l=s.TOUCH_DOLLY_ROTATE;break;default:l=s.NONE}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(o)}function we(L){switch(bt(L),l){case s.TOUCH_ROTATE:if(r.enableRotate===!1)return;_e(L),r.update();break;case s.TOUCH_PAN:if(r.enablePan===!1)return;de(L),r.update();break;case s.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Ie(L),r.update();break;case s.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Te(L),r.update();break;default:l=s.NONE}}function He(L){r.enabled!==!1&&L.preventDefault()}function dt(L){m.push(L)}function ot(L){delete k[L.pointerId];for(let q=0;q{te(L),r.update()},this.dollyOut=(L=O())=>{_(L),r.update()},this.getScale=()=>p,this.setScale=L=>{Q(L),r.update()},this.getZoomScale=()=>O(),n!==void 0&&this.connect(n),this.update()}}new xt;new ae;new Jo;new ae;var _c=Object.defineProperty,Ac=(t,e,n)=>e in t?_c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,di=(t,e,n)=>(Ac(t,typeof e!="symbol"?e+"":e,n),n);class Na{constructor(e){di(this,"data"),this.data=e}generateShapes(e,n=100,r){const i=[],o={letterSpacing:0,lineHeight:1,...r},a=Ec(e,n,this.data,o);for(let s=0,l=a.length;s + #include + #include + uniform float thickness; + uniform bool screenspace; + uniform vec2 size; + void main() { + #if defined (USE_SKINNING) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + vec4 tNormal = vec4(normal, 0.0); + vec4 tPosition = vec4(transformed, 1.0); + #ifdef USE_INSTANCING + tNormal = instanceMatrix * tNormal; + tPosition = instanceMatrix * tPosition; + #endif + if (screenspace) { + vec3 newPosition = tPosition.xyz + tNormal.xyz * thickness; + gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0); + } else { + vec4 clipPosition = projectionMatrix * modelViewMatrix * tPosition; + vec4 clipNormal = projectionMatrix * modelViewMatrix * tNormal; + vec2 offset = normalize(clipNormal.xy) * thickness / size * clipPosition.w * 2.0; + clipPosition.xy += offset; + gl_Position = clipPosition; + } + }`,`uniform vec3 color; + uniform float opacity; + void main(){ + gl_FragColor = vec4(color, opacity); + #include + #include + }`);const Sc=["args","material-uniforms-color-value"];zr.ReflectorShader;new ae;new ae;new ae;var dr;/Mac/.test((dr=globalThis==null?void 0:globalThis.navigator)===null||dr===void 0?void 0:dr.platform);const Ic=["target","auto-rotate","auto-rotate-speed","enable-damping","damping-factor","enable-pan","key-pan-speed","keys","max-azimuth-angle","min-azimuth-angle","max-polar-angle","min-polar-angle","min-distance","max-distance","min-zoom","max-zoom","touches","enable-zoom","zoom-speed","enable-rotate","rotate-speed","mouse-buttons","args"],Rc=ze({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[0,0,0]},enableDamping:{type:Boolean,default:!0},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:Number.POSITIVE_INFINITY},minZoom:{default:0},maxZoom:{default:Number.POSITIVE_INFINITY},touches:{default:()=>({ONE:_t.ROTATE,TWO:_t.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1},mouseButtons:{default:()=>({LEFT:yt.ROTATE,MIDDLE:yt.DOLLY,RIGHT:yt.PAN})}},emits:["change","start","end"],setup(t,{expose:e,emit:n}){const r=t,i=n,{makeDefault:o,autoRotate:a,autoRotateSpeed:s,enableDamping:l,dampingFactor:u,enablePan:c,keyPanSpeed:f,maxAzimuthAngle:p,minAzimuthAngle:d,maxPolarAngle:b,minPolarAngle:x,minDistance:v,maxDistance:T,minZoom:I,maxZoom:A,enableZoom:C,zoomSpeed:P,enableRotate:h,touches:S,rotateSpeed:y,target:g,mouseButtons:m}=ei(r),{camera:k,renderer:E,extend:O,controls:F,invalidate:D}=qn(),B=Wo(null);O({OrbitControls:kc}),je(B,Q=>{X(),Q&&o.value?F.value=Q:F.value=null});function X(){sr(B.value,"change",()=>{i("change",B.value),D()}),sr(B.value,"start",()=>i("start",B.value)),sr(B.value,"end",()=>i("end",B.value))}const{onBeforeRender:Z}=On();return Z(({invalidate:Q})=>{B.value&&(l.value||a.value)&&(B.value.update(),a.value&&Q())}),zt(()=>{B.value&&B.value.dispose()}),e({instance:B}),(Q,_)=>(Q.camera||H(k))&&(Q.domElement||H(E))?(ee(),ie("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:B,target:H(g),"auto-rotate":H(a),"auto-rotate-speed":H(s),"enable-damping":H(l),"damping-factor":H(u),"enable-pan":H(c),"key-pan-speed":H(f),keys:Q.keys,"max-azimuth-angle":H(p),"min-azimuth-angle":H(d),"max-polar-angle":H(b),"min-polar-angle":H(x),"min-distance":H(v),"max-distance":H(T),"min-zoom":H(I),"max-zoom":H(A),touches:H(S),"enable-zoom":H(C),"zoom-speed":H(P),"enable-rotate":H(h),"rotate-speed":H(y),"mouse-buttons":H(m),args:[Q.camera||H(k),Q.domElement||H(E).domElement]},null,8,Ic)):it("",!0)}});function Sn(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Wi={exports:{}},Xi;function Cc(){return Xi||(Xi=1,function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,o){function a(u,c){if(!i[u]){if(!r[u]){var f=typeof Sn=="function"&&Sn;if(!c&&f)return f(u,!0);if(s)return s(u,!0);throw new Error("Cannot find module '"+u+"'")}c=i[u]={exports:{}},r[u][0].call(c.exports,function(p){var d=r[u][1][p];return a(d||p)},c,c.exports,n,r,i,o)}return i[u].exports}for(var s=typeof Sn=="function"&&Sn,l=0;l>16),D((65280&m)>>8),D(255&m);return k==2?D(255&(m=S(y.charAt(g))<<2|S(y.charAt(g+1))>>4)):k==1&&(D((m=S(y.charAt(g))<<10|S(y.charAt(g+1))<<4|S(y.charAt(g+2))>>2)>>8&255),D(255&m)),E},b.fromByteArray=function(y){var g,m,k,E,O=y.length%3,F="";function D(B){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(B)}for(g=0,k=y.length-O;g>18&63)+D(E>>12&63)+D(E>>6&63)+D(63&E);switch(O){case 1:F=(F+=D((m=y[y.length-1])>>2))+D(m<<4&63)+"==";break;case 2:F=(F=(F+=D((m=(y[y.length-2]<<8)+y[y.length-1])>>10))+D(m>>4&63))+D(m<<2&63)+"="}return F}})(i===void 0?this.base64js={}:i)}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(n,r,i){(function(o,a,v,l,u,c,f,p,d){var b=n("base64-js"),x=n("ieee754");function v(w,M,N){if(!(this instanceof v))return new v(w,M,N);var V,U,Y,ne,ve=typeof w;if(M==="base64"&&ve=="string")for(w=(ne=w).trim?ne.trim():ne.replace(/^\s+|\s+$/g,"");w.length%4!=0;)w+="=";if(ve=="number")V=Z(w);else if(ve=="string")V=v.byteLength(w,M);else{if(ve!="object")throw new Error("First argument needs to be a number, array or string.");V=Z(w.length)}if(v._useTypedArrays?U=v._augment(new Uint8Array(V)):((U=this).length=V,U._isBuffer=!0),v._useTypedArrays&&typeof w.byteLength=="number")U._set(w);else if(Q(ne=w)||v.isBuffer(ne)||ne&&typeof ne=="object"&&typeof ne.length=="number")for(Y=0;Y>8,ne=ne%256,ve.push(ne),ve.push(Y);return ve}(M),w,N,V)}function A(w,M,N){var V="";N=Math.min(w.length,N);for(var U=M;U>>0)):(M+1>>0),U}function h(w,M,N,V){if(V||(G(typeof N=="boolean","missing or invalid endian"),G(M!=null,"missing offset"),G(M+1>>8*(V?Y:1-Y)}function k(w,M,N,V,U){if(U||(G(M!=null,"missing value"),G(typeof V=="boolean","missing or invalid endian"),G(N!=null,"missing offset"),G(N+3>>8*(V?Y:3-Y)&255}function E(w,M,N,V,U){U||(G(M!=null,"missing value"),G(typeof V=="boolean","missing or invalid endian"),G(N!=null,"missing offset"),G(N+1this.length&&(V=this.length);var U=(V=w.length-M=this.length))return this[w]},v.prototype.readUInt16LE=function(w,M){return C(this,w,!0,M)},v.prototype.readUInt16BE=function(w,M){return C(this,w,!1,M)},v.prototype.readUInt32LE=function(w,M){return P(this,w,!0,M)},v.prototype.readUInt32BE=function(w,M){return P(this,w,!1,M)},v.prototype.readInt8=function(w,M){if(M||(G(w!=null,"missing offset"),G(w=this.length))return 128&this[w]?-1*(255-this[w]+1):this[w]},v.prototype.readInt16LE=function(w,M){return h(this,w,!0,M)},v.prototype.readInt16BE=function(w,M){return h(this,w,!1,M)},v.prototype.readInt32LE=function(w,M){return S(this,w,!0,M)},v.prototype.readInt32BE=function(w,M){return S(this,w,!1,M)},v.prototype.readFloatLE=function(w,M){return y(this,w,!0,M)},v.prototype.readFloatBE=function(w,M){return y(this,w,!1,M)},v.prototype.readDoubleLE=function(w,M){return g(this,w,!0,M)},v.prototype.readDoubleBE=function(w,M){return g(this,w,!1,M)},v.prototype.writeUInt8=function(w,M,N){N||(G(w!=null,"missing value"),G(M!=null,"missing offset"),G(M=this.length||(this[M]=w)},v.prototype.writeUInt16LE=function(w,M,N){m(this,w,M,!0,N)},v.prototype.writeUInt16BE=function(w,M,N){m(this,w,M,!1,N)},v.prototype.writeUInt32LE=function(w,M,N){k(this,w,M,!0,N)},v.prototype.writeUInt32BE=function(w,M,N){k(this,w,M,!1,N)},v.prototype.writeInt8=function(w,M,N){N||(G(w!=null,"missing value"),G(M!=null,"missing offset"),G(M=this.length||(0<=w?this.writeUInt8(w,M,N):this.writeUInt8(255+w+1,M,N))},v.prototype.writeInt16LE=function(w,M,N){E(this,w,M,!0,N)},v.prototype.writeInt16BE=function(w,M,N){E(this,w,M,!1,N)},v.prototype.writeInt32LE=function(w,M,N){O(this,w,M,!0,N)},v.prototype.writeInt32BE=function(w,M,N){O(this,w,M,!1,N)},v.prototype.writeFloatLE=function(w,M,N){F(this,w,M,!0,N)},v.prototype.writeFloatBE=function(w,M,N){F(this,w,M,!1,N)},v.prototype.writeDoubleLE=function(w,M,N){D(this,w,M,!0,N)},v.prototype.writeDoubleBE=function(w,M,N){D(this,w,M,!1,N)},v.prototype.fill=function(w,M,N){if(M=M||0,N=N||this.length,G(typeof(w=typeof(w=w||0)=="string"?w.charCodeAt(0):w)=="number"&&!isNaN(w),"value is not a number"),G(M<=N,"end < start"),N!==M&&this.length!==0){G(0<=M&&M"},v.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(v._useTypedArrays)return new v(this).buffer;for(var w=new Uint8Array(this.length),M=0,N=w.length;M=M.length||U>=w.length);U++)M[U+N]=w[U];return U}function pe(w){try{return decodeURIComponent(w)}catch{return"�"}}function ye(w,M){G(typeof w=="number","cannot write a non-number as a number"),G(0<=w,"specified a negative value for writing an unsigned value"),G(w<=M,"value is larger than maximum value for type"),G(Math.floor(w)===w,"value has a fractional component")}function xe(w,M,N){G(typeof w=="number","cannot write a non-number as a number"),G(w<=M,"value larger than maximum allowed value"),G(N<=w,"value smaller than minimum allowed value"),G(Math.floor(w)===w,"value has a fractional component")}function Oe(w,M,N){G(typeof w=="number","cannot write a non-number as a number"),G(w<=M,"value larger than maximum allowed value"),G(N<=w,"value smaller than minimum allowed value")}function G(w,M){if(!w)throw new Error(M||"Failed assertion")}v._augment=function(w){return w._isBuffer=!0,w._get=w.get,w._set=w.set,w.get=B.get,w.set=B.set,w.write=B.write,w.toString=B.toString,w.toLocaleString=B.toString,w.toJSON=B.toJSON,w.copy=B.copy,w.slice=B.slice,w.readUInt8=B.readUInt8,w.readUInt16LE=B.readUInt16LE,w.readUInt16BE=B.readUInt16BE,w.readUInt32LE=B.readUInt32LE,w.readUInt32BE=B.readUInt32BE,w.readInt8=B.readInt8,w.readInt16LE=B.readInt16LE,w.readInt16BE=B.readInt16BE,w.readInt32LE=B.readInt32LE,w.readInt32BE=B.readInt32BE,w.readFloatLE=B.readFloatLE,w.readFloatBE=B.readFloatBE,w.readDoubleLE=B.readDoubleLE,w.readDoubleBE=B.readDoubleBE,w.writeUInt8=B.writeUInt8,w.writeUInt16LE=B.writeUInt16LE,w.writeUInt16BE=B.writeUInt16BE,w.writeUInt32LE=B.writeUInt32LE,w.writeUInt32BE=B.writeUInt32BE,w.writeInt8=B.writeInt8,w.writeInt16LE=B.writeInt16LE,w.writeInt16BE=B.writeInt16BE,w.writeInt32LE=B.writeInt32LE,w.writeInt32BE=B.writeInt32BE,w.writeFloatLE=B.writeFloatLE,w.writeFloatBE=B.writeFloatBE,w.writeDoubleLE=B.writeDoubleLE,w.writeDoubleBE=B.writeDoubleBE,w.fill=B.fill,w.inspect=B.inspect,w.toArrayBuffer=B.toArrayBuffer,w}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(n,r,i){(function(o,a,b,l,u,c,f,p,d){var b=n("buffer").Buffer,x=4,v=new b(x);v.fill(0),r.exports={hash:function(T,I,A,C){for(var P=I(function(m,k){m.length%x!=0&&(E=m.length+(x-m.length%x),m=b.concat([m,v],E));for(var E,O=[],F=k?m.readInt32BE:m.readInt32LE,D=0;DA?X=B(X):X.length>5]|=128<>>9<<4)]=S;for(var y=1732584193,g=-271733879,m=-1732584194,k=271733878,E=0;E>>32-m,y)}function T(h,S,y,g,m,k,E){return v(S&y|~S&g,h,S,m,k,E)}function I(h,S,y,g,m,k,E){return v(S&g|y&~g,h,S,m,k,E)}function A(h,S,y,g,m,k,E){return v(S^y^g,h,S,m,k,E)}function C(h,S,y,g,m,k,E){return v(y^(S|~g),h,S,m,k,E)}function P(h,S){var y=(65535&h)+(65535&S);return(h>>16)+(S>>16)+(y>>16)<<16|65535&y}r.exports=function(h){return b.hash(h,x,16)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){r.exports=function(b){for(var x,v=new Array(b),T=0;T>>((3&T)<<3)&255;return v}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){var b=n("./helpers");function x(I,A){I[A>>5]|=128<<24-A%32,I[15+(A+64>>9<<4)]=A;for(var C,P,h,S=Array(80),y=1732584193,g=-271733879,m=-1732584194,k=271733878,E=-1009589776,O=0;O>16)+(A>>16)+(C>>16)<<16|65535&C}function T(I,A){return I<>>32-A}r.exports=function(I){return b.hash(I,x,20,!0)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){function b(A,C){var P=(65535&A)+(65535&C);return(A>>16)+(C>>16)+(P>>16)<<16|65535&P}function x(A,C){var P,h=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),S=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),y=new Array(64);A[C>>5]|=128<<24-C%32,A[15+(C+64>>9<<4)]=C;for(var g,m,k=0;k>>C|A<<32-C},I=function(A,C){return A>>>C};r.exports=function(A){return v.hash(A,x,32,!0)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){i.read=function(b,x,v,T,k){var A,C,P=8*k-T-1,h=(1<>1,y=-7,g=v?k-1:0,m=v?-1:1,k=b[x+g];for(g+=m,A=k&(1<<-y)-1,k>>=-y,y+=P;0>=-y,y+=T;0>1,g=I===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=T?0:E-1,k=T?1:-1,E=x<0||x===0&&1/x<0?1:0;for(x=Math.abs(x),isNaN(x)||x===1/0?(P=isNaN(x)?1:0,C=S):(C=Math.floor(Math.log(x)/Math.LN2),x*(T=Math.pow(2,-C))<1&&(C--,T*=2),2<=(x+=1<=C+y?g/T:g*Math.pow(2,1-y))*T&&(C++,T/=2),S<=C+y?(P=0,C=S):1<=C+y?(P=(x*T-1)*Math.pow(2,I),C+=y):(P=x*Math.pow(2,y-1)*Math.pow(2,I),C=0));8<=I;b[v+m]=255&P,m+=k,P/=256,I-=8);for(C=C<>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]),Ji}var to,no;function Pa(){return no||(no=1,to=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]),to}var pr,ro;function Lc(){if(ro)return pr;ro=1;var t=La();return pr=t.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),pr}var hr,io;function Pc(){if(io)return hr;io=1;var t=Pa();return t=t.slice().filter(function(e){return!/^(gl\_|texture)/.test(e)}),hr=t.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),hr}var mr,oo;function Dc(){if(oo)return mr;oo=1,mr=C;var t=La(),e=Nc(),n=Pa(),r=Lc(),i=Pc(),o=999,a=9999,s=0,l=1,u=2,c=3,f=4,p=5,d=6,b=7,x=8,v=9,T=10,I=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function C(P){var h=0,S=0,y=o,g,m,k=[],E=[],O=1,F=0,D=0,B=!1,X=!1,Z="",Q;P=P||{};var _=n,te=t;P.version==="300 es"&&(_=i,te=r);for(var ce={},R={},h=0;h<_.length;h++)ce[_[h]]=!0;for(var h=0;h0)continue;Te=de.slice(0,1).join("")}return pe(Te),D+=Te.length,k=k.slice(Te.length),k.length}while(!0)}function Y(){return/[^a-fA-F0-9]/.test(g)?(pe(k.join("")),y=o,h):(k.push(g),m=g,h+1)}function ne(){return g==="."||/[eE]/.test(g)?(k.push(g),y=p,m=g,h+1):g==="x"&&k.length===1&&k[0]==="0"?(y=I,k.push(g),m=g,h+1):/[^\d]/.test(g)?(pe(k.join("")),y=o,h):(k.push(g),m=g,h+1)}function ve(){return g==="f"&&(k.push(g),m=g,h+=1),/[eE]/.test(g)||(g==="-"||g==="+")&&/[eE]/.test(m)?(k.push(g),m=g,h+1):/[^\d]/.test(g)?(pe(k.join("")),y=o,h):(k.push(g),m=g,h+1)}function _e(){if(/[^\d\w_]/.test(g)){var de=k.join("");return R[de]?y=x:ce[de]?y=b:y=d,pe(k.join("")),y=o,h}return k.push(g),m=g,h+1}}return mr}var gr,ao;function Oc(){if(ao)return gr;ao=1;var t=Dc();gr=e;function e(n,r){var i=t(r),o=[];return o=o.concat(i(n)),o=o.concat(i(null)),o}return gr}Oc();function zc(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Fc(t){var e=zc(t,"string");return typeof e=="symbol"?e:String(e)}function Se(t,e,n){return e=Fc(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var le={position:"csm_Position",positionRaw:"csm_PositionRaw",pointSize:"csm_PointSize",fragColor:"csm_FragColor",diffuseColor:"csm_DiffuseColor",normal:"csm_Normal",roughness:"csm_Roughness",metalness:"csm_Metalness",emissive:"csm_Emissive",ao:"csm_AO",bump:"csm_Bump",depthAlpha:"csm_DepthAlpha"},Ge,Ut;Ge={},Se(Ge,"".concat(le.normal),{"#include ":` + vec3 objectNormal = `.concat(le.normal,`; + #ifdef USE_TANGENT + vec3 objectTangent = vec3( tangent.xyz ); + #endif + `)}),Se(Ge,"".concat(le.position),{"#include ":` + vec3 transformed = `.concat(le.position,`; + `)}),Se(Ge,"".concat(le.positionRaw),{"#include ":` + vec4 csm_internal_positionUnprojected = `.concat(le.positionRaw,`; + mat4x4 csm_internal_unprojectMatrix = projectionMatrix * modelViewMatrix; + #ifdef USE_INSTANCING + csm_internal_unprojectMatrix = csm_internal_unprojectMatrix * instanceMatrix; + #endif + csm_internal_positionUnprojected = inverse(csm_internal_unprojectMatrix) * csm_internal_positionUnprojected; + vec3 transformed = csm_internal_positionUnprojected.xyz; + `)}),Se(Ge,"".concat(le.pointSize),{"gl_PointSize = size;":` + gl_PointSize = `.concat(le.pointSize,`; + `)}),Se(Ge,"".concat(le.diffuseColor),{"#include ":` + #include + diffuseColor = `.concat(le.diffuseColor,`; + `)}),Se(Ge,"".concat(le.fragColor),{"#include ":` + #include + gl_FragColor = `.concat(le.fragColor,`; + `)}),Se(Ge,"".concat(le.emissive),{"vec3 totalEmissiveRadiance = emissive;":` + vec3 totalEmissiveRadiance = `.concat(le.emissive,`; + `)}),Se(Ge,"".concat(le.roughness),{"#include ":` + #include + roughnessFactor = `.concat(le.roughness,`; + `)}),Se(Ge,"".concat(le.metalness),{"#include ":` + #include + metalnessFactor = `.concat(le.metalness,`; + `)}),Se(Ge,"".concat(le.ao),{"#include ":` + #include + reflectedLight.indirectDiffuse *= 1. - `.concat(le.ao,`; + `)}),Se(Ge,"".concat(le.bump),{"#include ":` + #include + + vec3 csm_internal_orthogonal = `.concat(le.bump," - (dot(").concat(le.bump,`, normal) * normal); + vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal; + normal = normalize(normal - csm_internal_projectedbump); + `)}),Se(Ge,"".concat(le.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":` + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * `.concat(le.depthAlpha,` ); + `),"gl_FragColor = packDepthToRGBA( fragCoordZ );":` + gl_FragColor = packDepthToRGBA( fragCoordZ ); + gl_FragColor.a *= `.concat(le.depthAlpha,`; + `)});Ut={},Se(Ut,"".concat(le.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(le.position,`, 1.0 ); + `)}),Se(Ut,"".concat(le.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = `.concat(le.position,`; + `)}),Se(Ut,"".concat(le.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(le.diffuseColor,`; + `)}),Se(Ut,"".concat(le.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(le.fragColor,`; + `)});var $e;$e={},Se($e,"".concat(le.position),"*"),Se($e,"".concat(le.positionRaw),"*"),Se($e,"".concat(le.normal),"*"),Se($e,"".concat(le.pointSize),["PointsMaterial"]),Se($e,"".concat(le.diffuseColor),"*"),Se($e,"".concat(le.fragColor),"*"),Se($e,"".concat(le.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se($e,"".concat(le.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se($e,"".concat(le.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se($e,"".concat(le.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),Se($e,"".concat(le.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),Se($e,"".concat(le.depthAlpha),"*");var Bc=`void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +}`,Uc=`#include + +void main() { + vec2 center = vec2(0., 1.); + float rotation = 0.0; + + + + float size = 0.03; + + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; + 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; +}`;const vn=new ae(0,0,0),pi=new ae(0,0,0),jc=new ae(0,0,0);function so(t,e,n){const r=vn.setFromMatrixPosition(t.matrixWorld);r.project(e);const i=n.width/2,o=n.height/2;return[(Number.isNaN(r.x)?0:r.x)*i+i,-(r.y*o)+o,r.z]}function Vc(t,e){const n=vn.setFromMatrixPosition(t.matrixWorld),r=pi.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),o=e.getWorldDirection(jc);return i.angleTo(o)>Math.PI/2}function Hc(t,e,n,r){const i=vn.setFromMatrixPosition(t.matrixWorld),o=i.clone();o.project(e),n.setFromCamera(new Pe(o.x,o.y),e);const a=n.intersectObjects(r,!0);if(a.length>0){const s=a[0].distance;return i.distanceTo(n.ray.origin)Math.abs(t)<1e-10?0:t;function Da(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=Br(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const qc=(t=>e=>Da(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Yc=(t=>(e,n)=>Da(e,t(n),"translate(-50%,-50%)"))(t=>[1/t,1/t,1/t,1,-1/t,-1/t,-1/t,-1,1/t,1/t,1/t,1,1,1,1,1]),Kc=["geometry","material"];new ta;var Ur={exports:{}},Wc=Ur.exports,lo;function Xc(){return lo||(lo=1,function(t,e){(function(n,r){t.exports=r()})(Wc,function(){var n=function(){function r(d){return a.appendChild(d.dom),d}function i(d){for(var b=0;bl+1e3&&(c.update(1e3*u/(d-l),100),l=d,u=0,p)){var b=performance.memory;p.update(b.usedJSHeapSize/1048576,b.jsHeapSizeLimit/1048576)}return d},update:function(){s=this.end()},domElement:a,setMode:i}};return n.Panel=function(r,i,o){var a=1/0,s=0,l=Math.round,u=l(window.devicePixelRatio||1),c=80*u,f=48*u,p=3*u,d=2*u,b=3*u,x=15*u,v=74*u,T=30*u,I=document.createElement("canvas");I.width=c,I.height=f,I.style.cssText="width:80px;height:48px";var A=I.getContext("2d");return A.font="bold "+9*u+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=o,A.fillRect(0,0,c,f),A.fillStyle=i,A.fillText(r,p,d),A.fillRect(b,x,v,T),A.fillStyle=o,A.globalAlpha=.9,A.fillRect(b,x,v,T),{dom:I,update:function(C,P){a=Math.min(a,C),s=Math.max(s,C),A.fillStyle=o,A.globalAlpha=1,A.fillRect(0,0,c,x),A.fillStyle=i,A.fillText(l(C)+" "+r+" ("+l(a)+"-"+l(s)+")",p,d),A.drawImage(I,b+u,x,v-u,T,b,x,v-u,T),A.fillRect(b+v-u,x,u,T),A.fillStyle=o,A.globalAlpha=.9,A.fillRect(b+v-u,x,u,l((1-C/P)*T))}}},n})}(Ur)),Ur.exports}Xc();const Qc={key:0,args:[0,1,64]},Zc={key:1,args:[.5,1,64]},Jc={key:2},ef=["tone-mapped","map","side","color"];new Fe(16777215);const jt=ze({__name:"Range",props:{modelValue:null,min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","mousedown"],setup(t,{emit:e}){const n=t,r=e,i=W(null);function o(b,x,v){return Math.min(Math.max(b,x),v)}function a(b){const x=b.toString();return x.includes("e-")?Number.parseInt(x.split("e-")[1],10):x.includes(".")?x.split(".")[1].length:0}function s(b,x){const v=a(x),T=10**(v+3);return Number.parseFloat((b*T/T).toFixed(v))}const l=Ue(()=>s(o(n.modelValue,n.min,n.max),n.step)),u=Ue(()=>{const b=(l.value-n.min)/(n.max-n.min)*100;return{width:`${b}%`,backgroundSize:`${b}% 100%`}});function c(b){if(!i.value)return l.value;const x=i.value.getBoundingClientRect(),T=(b.clientX-x.left)/x.width,I=n.max-n.min,A=n.min+I*T,C=Math.round(A/n.step)*n.step;return Math.min(Math.max(C,n.min),n.max)}function f(b){if(n.disabled)return;const x=c(b);r("update:modelValue",x)}function p(b){if(n.disabled)return;b.preventDefault();const x=c(b);r("update:modelValue",x),window.addEventListener("mousemove",f),window.addEventListener("mouseup",d)}function d(b){window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",d)}return zt(()=>{window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",d)}),(b,x)=>(ee(),ie("span",{ref_key:"sliderRef",ref:i,class:st(["range-slider disabled:pointer-events-none disabled:cursor-default disabled:opacity-50",{disabled:t.disabled}]),bg:"[#e6e1fc] dark:[#676085]","touch-action-none":"",relative:"","inline-block":"","w-full":"","cursor-ew-resize":"","rounded-sm":"",onMousedown:p},[z("span",{style:Dr(u.value),bg:"[#cabeff] dark:[#4e34b9]",relative:"",block:"","rounded-sm":"",h:"[14px]"},null,4),z("span",{role:"slider",class:"slider-thumb",style:Dr({left:`${(l.value-t.min)/(t.max-t.min)*100}%`}),absolute:"","rounded-sm":"",w:"[1px]",h:"[14px]",bg:"zinc-100 dark:zinc-400",top:"50%",transform:"translate-x-[50%] translate-y-[-50%]"},null,4)],34))}});function uo(t,e){if(e===sl)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===Or||e===la){let n=t.getIndex();if(n===null){const a=[],s=t.getAttribute("position");if(s!==void 0){for(let l=0;l=2.0 are supported."));return}const u=new Df(o,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&s[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(a),u.setPlugins(s),u.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,o){r.parse(e,n,i,o)})}}function nf(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const he={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class rf{constructor(e){this.parser=e,this.name=he.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,o.source,a)}}class xf{constructor(e){this.parser=e,this.name=he.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,o=i.textures[e];if(!o.extensions||!o.extensions[n])return null;const a=o.extensions[n],s=i.images[a.source];let l=r.textureLoader;if(s.uri){const u=r.options.manager.getHandler(s.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class vf{constructor(e){this.parser=e,this.name=he.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,o=i.textures[e];if(!o.extensions||!o.extensions[n])return null;const a=o.extensions[n],s=i.images[a.source];let l=r.textureLoader;if(s.uri){const u=r.options.manager.getHandler(s.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class bf{constructor(e){this.name=he.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(s){const l=i.byteOffset||0,u=i.byteLength||0,c=i.count,f=i.byteStride,p=new Uint8Array(s,l,u);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(c,f,p,i.mode,i.filter).then(function(d){return d.buffer}):a.ready.then(function(){const d=new ArrayBuffer(c*f);return a.decodeGltfBuffer(new Uint8Array(d),c,f,p,i.mode,i.filter),d})})}else return null}}class wf{constructor(e){this.name=he.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const u of i.primitives)if(u.mode!==nt.TRIANGLES&&u.mode!==nt.TRIANGLE_STRIP&&u.mode!==nt.TRIANGLE_FAN&&u.mode!==void 0)return null;const a=r.extensions[this.name].attributes,s=[],l={};for(const u in a)s.push(this.parser.getDependency("accessor",a[u]).then(c=>(l[u]=c,l[u])));return s.length<1?null:(s.push(this.parser.createNodeMesh(e)),Promise.all(s).then(u=>{const c=u.pop(),f=c.isGroup?c.children:[c],p=u[0].count,d=[];for(const b of f){const x=new xt,v=new ae,T=new zn,I=new ae(1,1,1),A=new dl(b.geometry,b.material,p);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":t.search(/\.ktx2($|\?)/i)>0||t.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Pf=new xt;class Df{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new nf,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,o=!1,a=-1;if(typeof navigator<"u"){const s=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(s)===!0;const l=s.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,o=s.indexOf("Firefox")>-1,a=o?s.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||o&&a<98?this.textureLoader=new hl(this.options.manager):this.textureLoader=new ml(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ua(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(a){const s={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:r,userData:{}};return Rt(o,s,i),gt(s,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(s)})).then(function(){for(const l of s.scenes)l.updateMatrixWorld();e(s)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,o=n.length;i{const l=this.associations.get(a);l!=null&&this.associations.set(s,l);for(const[u,c]of a.children.entries())o(c,s.children[u])};return o(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r=2&&v.setY(g,h[S*l+1]),l>=3&&v.setZ(g,h[S*l+2]),l>=4&&v.setW(g,h[S*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}v.normalized=b}return v})}loadTexture(e){const n=this.json,r=this.options,o=n.textures[e].source,a=n.images[o];let s=this.textureLoader;if(a.uri){const l=r.manager.getHandler(a.uri);l!==null&&(s=l)}return this.loadTextureImage(e,o,s)}loadTextureImage(e,n,r){const i=this,o=this.json,a=o.textures[e],s=o.images[n],l=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const u=this.loadImageSource(n,r).then(function(c){c.flipY=!1,c.name=a.name||s.name||"",c.name===""&&typeof s.uri=="string"&&s.uri.startsWith("data:image/")===!1&&(c.name=s.uri);const p=(o.samplers||{})[a.sampler]||{};return c.magFilter=fo[p.magFilter]||Bn,c.minFilter=fo[p.minFilter]||oi,c.wrapS=po[p.wrapS]||Un,c.wrapT=po[p.wrapT]||Un,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==Lt&&c.minFilter!==Bn,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,n){const r=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const a=i.images[e],s=self.URL||self.webkitURL;let l=a.uri||"",u=!1;if(a.bufferView!==void 0)l=r.getDependency("bufferView",a.bufferView).then(function(f){u=!0;const p=new Blob([f],{type:a.mimeType});return l=s.createObjectURL(p),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(l).then(function(f){return new Promise(function(p,d){let b=p;n.isImageBitmapLoader===!0&&(b=function(x){const v=new Fn(x);v.needsUpdate=!0,p(v)}),n.load(cn.resolveURL(f,o.path),b,void 0,d)})}).then(function(f){return u===!0&&s.revokeObjectURL(l),gt(f,a),f.userData.mimeType=a.mimeType||Lf(a.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=c,c}assignTexture(e,n,r,i){const o=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(a=a.clone(),a.channel=r.texCoord),o.extensions[he.KHR_TEXTURE_TRANSFORM]){const s=r.extensions!==void 0?r.extensions[he.KHR_TEXTURE_TRANSFORM]:void 0;if(s){const l=o.associations.get(a);a=o.extensions[he.KHR_TEXTURE_TRANSFORM].extendTexture(a,s),o.associations.set(a,l)}}return i!==void 0&&(a.colorSpace=i),e[n]=a,a})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,o=n.attributes.color!==void 0,a=n.attributes.normal===void 0;if(e.isPoints){const s="PointsMaterial:"+r.uuid;let l=this.cache.get(s);l||(l=new gl,nr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(s,l)),r=l}else if(e.isLine){const s="LineBasicMaterial:"+r.uuid;let l=this.cache.get(s);l||(l=new yl,nr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(s,l)),r=l}if(i||o||a){let s="ClonedMaterial:"+r.uuid+":";i&&(s+="derivative-tangents:"),o&&(s+="vertex-colors:"),a&&(s+="flat-shading:");let l=this.cache.get(s);l||(l=r.clone(),o&&(l.vertexColors=!0),a&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(s,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return ca}loadMaterial(e){const n=this,r=this.json,i=this.extensions,o=r.materials[e];let a;const s={},l=o.extensions||{},u=[];if(l[he.KHR_MATERIALS_UNLIT]){const f=i[he.KHR_MATERIALS_UNLIT];a=f.getMaterialType(),u.push(f.extendParams(s,o,n))}else{const f=o.pbrMetallicRoughness||{};if(s.color=new Fe(1,1,1),s.opacity=1,Array.isArray(f.baseColorFactor)){const p=f.baseColorFactor;s.color.setRGB(p[0],p[1],p[2],vt),s.opacity=p[3]}f.baseColorTexture!==void 0&&u.push(n.assignTexture(s,"map",f.baseColorTexture,mn)),s.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,s.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(u.push(n.assignTexture(s,"metalnessMap",f.metallicRoughnessTexture)),u.push(n.assignTexture(s,"roughnessMap",f.metallicRoughnessTexture))),a=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,s)})))}o.doubleSided===!0&&(s.side=Yn);const c=o.alphaMode||xr.OPAQUE;if(c===xr.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,c===xr.MASK&&(s.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&a!==Ht&&(u.push(n.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new Pe(1,1),o.normalTexture.scale!==void 0)){const f=o.normalTexture.scale;s.normalScale.set(f,f)}if(o.occlusionTexture!==void 0&&a!==Ht&&(u.push(n.assignTexture(s,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(s.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&a!==Ht){const f=o.emissiveFactor;s.emissive=new Fe().setRGB(f[0],f[1],f[2],vt)}return o.emissiveTexture!==void 0&&a!==Ht&&u.push(n.assignTexture(s,"emissiveMap",o.emissiveTexture,mn)),Promise.all(u).then(function(){const f=new a(s);return o.name&&(f.name=o.name),gt(f,o),n.associations.set(f,{materials:e}),o.extensions&&Rt(i,f,o),f})}createUniqueName(e){const n=hn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function o(s){return r[he.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(s,n).then(function(l){return ho(l,s,n)})}const a=[];for(let s=0,l=e.length;s0&&Cf(T,o),T.name=n.createUniqueName(o.name||"mesh_"+e),gt(T,o),v.extensions&&Rt(i,T,v),n.assignFinalMaterial(T),f.push(T)}for(let d=0,b=f.length;d1?c=new rr:u.length===1?c=u[0]:c=new ai,c!==u[0])for(let f=0,p=u.length;f{const f=new Map;for(const[p,d]of i.associations)(p instanceof nr||p instanceof Fn)&&f.set(p,d);return c.traverse(p=>{const d=i.associations.get(p);d!=null&&f.set(p,d)}),f};return i.associations=u(o),o})}_createAnimationTracks(e,n,r,i,o){const a=[],s=e.name?e.name:e.uuid,l=[];Tt[o.path]===Tt.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(s);let u;switch(Tt[o.path]){case Tt.weights:u=Ni;break;case Tt.rotation:u=Li;break;case Tt.position:case Tt.scale:u=Ci;break;default:switch(r.itemSize){case 1:u=Ni;break;case 2:case 3:default:u=Ci;break}break}const c=i.interpolation!==void 0?Sf[i.interpolation]:ti,f=this._getArrayFromAccessor(r);for(let p=0,d=l.length;pnew As(t)),Ct.register(t=>new Es(t)),Ct)}async function zf(t){const r=(await Fa().loadAsync(t)).userData;if(!r.vrmAnimations){console.warn("No VRM animations found in the .vrma file");return}if(r.vrmAnimations.length===0){console.warn("No VRM animations found in the .vrma file");return}return r.vrmAnimations[0]}async function Ff(t,e){if(!t){console.warn("No VRM found");return}if(e)return Ms(e,t)}function Bf(){const t=W(!1),e=W(0),n=W(0),r=.2,i=1,o=6,a=W(Math.random()*(o-i)+i);function s(l,u){if(l!=null&&l.expressionManager&&(n.value+=u,!t.value&&n.value>=a.value&&(t.value=!0,e.value=0),t.value)){e.value+=u/r;const c=Math.sin(Math.PI*e.value);l.expressionManager.setValue("blink",c),e.value>=1&&(t.value=!1,n.value=0,l.expressionManager.setValue("blink",0),a.value=Math.random()*(o-i)+i)}}return{update:s}}function Uf(){let t=-1,e,n=0;function r(){e?e.set(on(-.25,.25),on(-.2,.15),-.65):e=new ae(on(-.25,.25),on(-.2,.15),-.65)}function i(o,a){var s;!(o!=null&&o.expressionManager)||!o.lookAt||(n>=t?(r(),n=0,t=Ss()/1e3):e||r(),o.lookAt.target||(o.lookAt.target=new ai),o.lookAt.target.position.lerp(e,on(.2,.5)),(s=o.lookAt)==null||s.update(a),n+=a)}return{update:i}}async function jf(t,e){const i=(await Fa().loadAsync(t,a=>{var s;return(s=e==null?void 0:e.onProgress)==null?void 0:s.call(e,a)})).userData;if(!i.vrm)return;const o=i.vrm;if(Nr.removeUnnecessaryVertices(o.scene),Nr.combineSkeletons(o.scene),o.scene.traverse(a=>{a.frustumCulled=!1}),o.lookAt){const a=new Is(o.lookAt);a.name="lookAtQuaternionProxy",o.scene.add(a)}return e!=null&&e.scene&&e.scene.add(o.scene),e!=null&&e.position&&o.scene.position.set(...e.position),o}function Vf(t){const e=W(null),n=W(!1),r=W(0),i=W(new Map),o=W(new Map),a=W(),s=(T,I,A)=>T+(I-T)*A,l=T=>T<.5?4*T*T*T:1-(-2*T+2)**3/2,u=new Map([["happy",{expression:[{name:"happy",value:1,duration:.3},{name:"aa",value:.3}],blendDuration:.3}],["sad",{expression:[{name:"sad",value:1},{name:"oh",value:.2}],blendDuration:.3}],["angry",{expression:[{name:"angry",value:1},{name:"ee",value:.4}],blendDuration:.2}],["surprised",{expression:[{name:"Surprised",value:1},{name:"oh",value:.6}],blendDuration:.1}],["neutral",{expression:[{name:"neutral",value:1}],blendDuration:.5}]]),c=()=>{a.value&&(clearTimeout(a.value),a.value=void 0)},f=T=>{var A;if(c(),!u.has(T)){console.warn(`Emotion ${T} not found`);return}const I=u.get(T);if(e.value=T,n.value=!0,r.value=0,t.expressionManager){const C=Object.keys(t.expressionManager.expressionMap);for(const P of C)t.expressionManager.setValue(P,0)}i.value.clear(),o.value.clear();for(const C of I.expression||[]){const P=((A=t.expressionManager)==null?void 0:A.getValue(C.name))||0;i.value.set(C.name,P),o.value.set(C.name,C.value)}};return{currentEmotion:e,isTransitioning:n,setEmotion:f,setEmotionWithResetAfter:(T,I)=>{c(),f(T),a.value=setTimeout(()=>{f("neutral"),a.value=void 0},I)},update:T=>{var C;if(!n.value||!e.value)return;const A=u.get(e.value).blendDuration||.3;r.value+=T/A,r.value>=1&&(r.value=1,n.value=!1);for(const[P,h]of o.value){const S=i.value.get(P)||0,y=s(S,h,l(r.value));(C=t.expressionManager)==null||C.setValue(P,y)}},addEmotionState:(T,I)=>{u.set(T,I)},removeEmotionState:T=>{u.delete(T)},dispose:()=>{c()}}}const Hf=ze({__name:"Model",props:{model:null,idleAnimation:null,loadAnimations:null,position:null,paused:{type:Boolean}},emits:["loadModelProgress","error"],setup(t,{expose:e,emit:n}){const r=t,i=n;let o;const a=W(),s=W(),{scene:l}=qn(),{onBeforeRender:u}=On(),c=Bf(),f=Uf(),p=W();je(()=>r.position,([x,v,T])=>{a.value&&a.value.scene.position.set(x,v,T)}),pn(async()=>{if(l.value)try{const x=await jf(r.model,{scene:l.value,lookAt:!0,position:r.position,onProgress:I=>i("loadModelProgress",Number.parseFloat((100*(I.loaded/I.total)).toFixed(2)))});if(!x){console.warn("No VRM model loaded");return}const v=await zf(r.idleAnimation),T=await Ff(x,v);if(!T){console.warn("No VRM animation loaded");return}s.value=new Sl(x.scene),s.value.clipAction(T).play(),p.value=Vf(x),a.value=x,o=u(({delta:I})=>{var A,C,P;(A=s.value)==null||A.update(I),(C=a.value)==null||C.update(I),c.update(a.value,I),f.update(a.value,I),(P=p.value)==null||P.update(I)}).off}catch(x){i("error",x)}}),zt(()=>{o==null||o(),a.value&&(a.value.scene.removeFromParent(),Nr.deepDispose(a.value.scene))}),e({setExpression(x){var v;(v=p.value)==null||v.setEmotionWithResetAfter(x,1e3)}});const{pause:d,resume:b}=On();return je(()=>r.paused,x=>{x?d():b()}),(x,v)=>gn(x.$slots,"default")}}),Gf=["position"],$f={absolute:"",bottom:"3",right:"3"},qf={flex:"~ row","cursor-pointer":""},Yf=["checked","aria-checked"],Kf={key:0,"min-w":"50vw",z:"{var x;(x=p.value)==null||x.setExpression(b)}}),(b,x)=>(ee(),Qt(ya,{relative:""},{default:Be(({height:v,width:T})=>[ke(H(Il),{alpha:!0,antialias:!0,width:T,height:v},{default:Be(()=>[ke(H(Rc)),z("TresPerspectiveCamera",{position:[a.value,s.value,l.value]},null,8,Gf),x[14]||(x[14]=z("TresDirectionalLight",{color:16777215,intensity:1.2,position:[1,1,1]},null,-1)),x[15]||(x[15]=z("TresAmbientLight",{color:16777215,intensity:1.5},null,-1)),ke(Hf,{ref_key:"modelRef",ref:p,model:r.model,"idle-animation":r.idleAnimation,position:[u.value,c.value,f.value],paused:r.paused,onLoadModelProgress:x[0]||(x[0]=I=>i("loadModelProgress",I)),onError:x[1]||(x[1]=I=>i("error",I))},null,8,["model","idle-animation","position","paused"])]),_:2},1032,["width","height"]),z("div",$f,[z("div",qf,[z("label",{class:st([o.value?"bg-zinc-300 dark:bg-zinc-200":"bg-zinc-100 dark:bg-zinc-700"]),transition:"all ease-in-out duration-500",text:"lg zinc-500 dark:zinc-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[At(z("input",{"onUpdate:modelValue":x[2]||(x[2]=I=>o.value=I),checked:o.value,"aria-checked":o.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,Yf),[[Jr,o.value]]),x[16]||(x[16]=z("div",{"select-none":""},[z("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),ke(ci,null,{default:Be(()=>[o.value?(ee(),ie("div",Kf,[z("div",Wf,[z("div",Xf,[z("span",null,ge(H(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),ke(Oi,{"h-fit":"","w-full":"",flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},{label:Be(()=>[z("span",Qf,ge(H(d)("stage.viewers.debug-menu.vrm.camera")),1)]),default:Be(()=>[z("div",Zf,[x[17]||(x[17]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"X")],-1)),z("label",Jf,[ke(jt,{modelValue:a.value,"onUpdate:modelValue":x[3]||(x[3]=I=>a.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",ed,[z("span",null,ge(a.value),1)]),x[18]||(x[18]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"Y")],-1)),z("label",td,[ke(jt,{modelValue:s.value,"onUpdate:modelValue":x[4]||(x[4]=I=>s.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",nd,[z("span",null,ge(s.value),1)]),x[19]||(x[19]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"Z")],-1)),z("label",rd,[ke(jt,{modelValue:l.value,"onUpdate:modelValue":x[5]||(x[5]=I=>l.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",id,[z("span",null,ge(l.value),1)])])]),_:1}),ke(Oi,{"h-fit":"","w-full":"",flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},{label:Be(()=>[z("span",od,ge(H(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),default:Be(()=>[z("div",ad,[x[20]||(x[20]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"X")],-1)),z("label",sd,[ke(jt,{modelValue:u.value,"onUpdate:modelValue":x[6]||(x[6]=I=>u.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",ld,[z("span",null,ge(u.value),1)]),x[21]||(x[21]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"Y")],-1)),z("label",ud,[ke(jt,{modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=I=>c.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",cd,[z("span",null,ge(c.value),1)]),x[22]||(x[22]=z("div",{text:"zinc-400 dark:zinc-500"},[z("span",null,"Z")],-1)),z("label",fd,[ke(jt,{modelValue:f.value,"onUpdate:modelValue":x[8]||(x[8]=I=>f.value=I),min:-10,max:10,step:.01},null,8,["modelValue"])]),z("div",dd,[z("span",null,ge(f.value),1)])])]),_:1}),z("div",pd,[z("span",null,ge(H(d)("stage.viewers.debug-menu.emotions")),1)]),z("div",hd,[z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[9]||(x[9]=I=>{var A;return(A=p.value)==null?void 0:A.setExpression("neutral")})},ge(H(d)("stage.viewers.debug-menu.emotions-btn.neutral")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[10]||(x[10]=I=>{var A;return(A=p.value)==null?void 0:A.setExpression("surprised")})},ge(H(d)("stage.viewers.debug-menu.emotions-btn.surprised")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[11]||(x[11]=I=>{var A;return(A=p.value)==null?void 0:A.setExpression("sad")})},ge(H(d)("stage.viewers.debug-menu.emotions-btn.sad")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[12]||(x[12]=I=>{var A;return(A=p.value)==null?void 0:A.setExpression("angry")})},ge(H(d)("stage.viewers.debug-menu.emotions-btn.angry")),1),z("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[13]||(x[13]=I=>{var A;return(A=p.value)==null?void 0:A.setExpression("happy")})},ge(H(d)("stage.viewers.debug-menu.emotions-btn.happy")),1)])])])):it("",!0)]),_:1})])]),_:1}))}}),gd=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class bn{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}bn.prototype.normal={};bn.prototype.property={};bn.prototype.space=void 0;function Ba(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new bn(n,r,e)}function Hr(t){return t.toLowerCase()}class Ke{constructor(e,n){this.attribute=n,this.property=e}}Ke.prototype.attribute="";Ke.prototype.booleanish=!1;Ke.prototype.boolean=!1;Ke.prototype.commaOrSpaceSeparated=!1;Ke.prototype.commaSeparated=!1;Ke.prototype.defined=!1;Ke.prototype.mustUseProperty=!1;Ke.prototype.number=!1;Ke.prototype.overloadedBoolean=!1;Ke.prototype.property="";Ke.prototype.spaceSeparated=!1;Ke.prototype.space=void 0;let yd=0;const fe=Ft(),Le=Ft(),Ua=Ft(),$=Ft(),Re=Ft(),Kt=Ft(),Qe=Ft();function Ft(){return 2**++yd}const Gr=Object.freeze(Object.defineProperty({__proto__:null,boolean:fe,booleanish:Le,commaOrSpaceSeparated:Qe,commaSeparated:Kt,number:$,overloadedBoolean:Ua,spaceSeparated:Re},Symbol.toStringTag,{value:"Module"})),br=Object.keys(Gr);class hi extends Ke{constructor(e,n,r,i){let o=-1;if(super(e,n),mo(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&wd.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(go,_d);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!go.test(o)){let a=o.replace(bd,kd);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=hi}return new i(r,e)}function kd(t){return"-"+t.toLowerCase()}function _d(t){return t.charAt(1).toUpperCase()}const Ad=Ba([ja,xd,Ga,$a,qa],"html"),Ya=Ba([ja,vd,Ga,$a,qa],"svg"),yo={}.hasOwnProperty;function Ed(t,e){const n=e||{};function r(i,...o){let a=r.invalid;const s=r.handlers;if(i&&yo.call(i,t)){const l=String(i[t]);a=yo.call(s,l)?s[l]:r.unknown}if(a)return a.call(this,i,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Md=/^>|^->||--!>|"],Id=["<",">"];function Rd(t,e,n,r){return r.settings.bogusComments?"":"";function i(o){return qt(o,Object.assign({},r.settings.characterReferences,{subset:Id}))}}function Cd(t,e,n,r){return""}function Nd(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Ld(t){return t.join(" ").trim()}const Pd=/[ \t\n\f\r]/g;function mi(t){return typeof t=="object"?t.type==="text"?xo(t.value):!1:xo(t)}function xo(t){return t.replace(Pd,"")===""}const De=Wa(1),Ka=Wa(-1),Dd=[];function Wa(t){return e;function e(n,r,i){const o=n?n.children:Dd;let a=(r||0)+t,s=o[a];if(!i)for(;s&&mi(s);)a+=t,s=o[a];return s}}const Od={}.hasOwnProperty;function Xa(t){return e;function e(n,r,i){return Od.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const gi=Xa({body:Fd,caption:wr,colgroup:wr,dd:Vd,dt:jd,head:wr,html:zd,li:Ud,optgroup:Hd,option:Gd,p:Bd,rp:vo,rt:vo,tbody:qd,td:bo,tfoot:Yd,th:bo,thead:$d,tr:Kd});function wr(t,e,n){const r=De(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&mi(r.value.charAt(0)))}function zd(t,e,n){const r=De(n,e);return!r||r.type!=="comment"}function Fd(t,e,n){const r=De(n,e);return!r||r.type!=="comment"}function Bd(t,e,n){const r=De(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Ud(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="li"}function jd(t,e,n){const r=De(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Vd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function vo(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Hd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Gd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function $d(t,e,n){const r=De(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function qd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Yd(t,e,n){return!De(n,e)}function Kd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function bo(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Wd=Xa({body:Zd,colgroup:Jd,head:Qd,html:Xd,tbody:ep});function Xd(t){const e=De(t,-1);return!e||e.type!=="comment"}function Qd(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Zd(t){const e=De(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&mi(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Jd(t,e,n){const r=Ka(n,e),i=De(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&gi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function ep(t,e,n){const r=Ka(n,e),i=De(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&gi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const In={name:[[` +\f\r &/=>`.split(""),` +\f\r "&'/=>\``.split("")],[`\0 +\f\r "&'/<=>`.split(""),`\0 +\f\r "&'/<=>\``.split("")]],unquoted:[[` +\f\r &>`.split(""),`\0 +\f\r "&'<=>\``.split("")],[`\0 +\f\r "&'<=>\``.split(""),`\0 +\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function tp(t,e,n,r){const i=r.schema,o=i.space==="svg"?!1:r.settings.omitOptionalTags;let a=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const s=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=Ya);const u=np(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(a=!1),(u||!o||!Wd(t,e,n))&&(s.push("<",t.tagName,u?" "+u:""),a&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(c),!a&&(!o||!gi(t,e,n))&&s.push(""),s.join("")}function np(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=rp(t,i,e[i]);o&&n.push(o)}}for(;++rDi(n,t.alternative)&&(a=t.alternative),s=a+qt(n,Object.assign({},t.settings.characterReferences,{subset:(a==="'"?In.single:In.double)[i][o],attribute:!0}))+a),l+(s&&"="+s))}const ip=["<","&"];function Qa(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:qt(t.value,Object.assign({},r.settings.characterReferences,{subset:ip}))}function op(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Qa(t,e,n,r)}function ap(t,e,n,r){return r.all(t)}const sp=Ed("type",{invalid:lp,unknown:up,handlers:{comment:Rd,doctype:Cd,element:tp,raw:op,root:ap,text:Qa}});function lp(t){throw new Error("Expected node, not `"+t+"`")}function up(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const cp={},fp={},dp=[];function pp(t,e){const n=e||cp,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:hp,all:mp,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||gd,characterReferences:n.characterReferences||fp,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Ya:Ad,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function hp(t,e,n){return sp(t,e,n,this)}function mp(t){const e=[],n=t&&t.children||dp;let r=-1;for(;++ri?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);o0?(ct(t,t.length,0,e),t):e}const ko={}.hasOwnProperty;function bp(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Wt(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ut=It(/[A-Za-z]/),et=It(/[\dA-Za-z]/),kp=It(/[#-'*+\--9=?A-Z^-~]/);function $r(t){return t!==null&&(t<32||t===127)}const qr=It(/\d/),_p=It(/[\dA-Fa-f]/),Ap=It(/[!-/:-@[-`{-~]/);function se(t){return t!==null&&t<-2}function Ye(t){return t!==null&&(t<0||t===32)}function Ae(t){return t===-2||t===-1||t===32}const Ep=It(new RegExp("\\p{P}|\\p{S}","u")),Mp=It(/\s/);function It(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Jt(t){const e=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const s=t.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ce(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return Ae(l)?(t.enter(n),s(l)):e(l)}function s(l){return Ae(l)&&o++a))return;const S=e.events.length;let y=S,g,m;for(;y--;)if(e.events[y][0]==="exit"&&e.events[y][1].type==="chunkFlow"){if(g){m=e.events[y][1].end;break}g=!0}for(T(r),h=S;hA;){const P=n[C];e.containerState=P[1],P[0].exit.call(e,t)}n.length=A}function I(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Np(t,e,n){return Ce(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ao(t){if(t===null||Ye(t)||Mp(t))return 1;if(Ep(t))return 2}function xi(t,e,n){const r=[];let i=-1;for(;++i1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f={...t[r][1].end},p={...t[n][1].start};Eo(f,-l),Eo(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},o={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},t[r][1].end={...a.start},t[n][1].start={...s.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=rt(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=rt(u,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",o,e]]),u=rt(u,xi(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=rt(u,[["exit",o,e],["enter",s,e],["exit",s,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(c=2,u=rt(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,ct(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&Ae(h)?Ce(t,I,"linePrefix",o+1)(h):I(h)}function I(h){return h===null||se(h)?t.check(Mo,x,C)(h):(t.enter("codeFlowValue"),A(h))}function A(h){return h===null||se(h)?(t.exit("codeFlowValue"),I(h)):(t.consume(h),A)}function C(h){return t.exit("codeFenced"),e(h)}function P(h,S,y){let g=0;return m;function m(D){return h.enter("lineEnding"),h.consume(D),h.exit("lineEnding"),k}function k(D){return h.enter("codeFencedFence"),Ae(D)?Ce(h,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):E(D)}function E(D){return D===s?(h.enter("codeFencedFenceSequence"),O(D)):y(D)}function O(D){return D===s?(g++,h.consume(D),O):g>=a?(h.exit("codeFencedFenceSequence"),Ae(D)?Ce(h,F,"whitespace")(D):F(D)):y(D)}function F(D){return D===null||se(D)?(h.exit("codeFencedFence"),S(D)):y(D)}}}function Gp(t,e,n){const r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const Tr={name:"codeIndented",tokenize:qp},$p={partial:!0,tokenize:Yp};function qp(t,e,n){const r=this;return i;function i(u){return t.enter("codeIndented"),Ce(t,o,"linePrefix",5)(u)}function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):se(u)?t.attempt($p,a,l)(u):(t.enter("codeFlowValue"),s(u))}function s(u){return u===null||se(u)?(t.exit("codeFlowValue"),a(u)):(t.consume(u),s)}function l(u){return t.exit("codeIndented"),e(u)}}function Yp(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):se(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):Ce(t,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):se(a)?i(a):n(a)}}const Kp={name:"codeText",previous:Xp,resolve:Wp,tokenize:Qp};function Wp(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length)return this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse();const i=this.left.slice(e);return i.push(...this.right.slice(this.right.length-r+this.left.length).reverse()),i}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&sn(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),sn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),sn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function is(t,e,n,r,i,o,a,s,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(T){return T===60?(t.enter(r),t.enter(i),t.enter(o),t.consume(T),t.exit(o),p):T===null||T===32||T===41||$r(T)?n(T):(t.enter(r),t.enter(a),t.enter(s),t.enter("chunkString",{contentType:"string"}),x(T))}function p(T){return T===62?(t.enter(o),t.consume(T),t.exit(o),t.exit(i),t.exit(r),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),d(T))}function d(T){return T===62?(t.exit("chunkString"),t.exit(s),p(T)):T===null||T===60||se(T)?n(T):(t.consume(T),T===92?b:d)}function b(T){return T===60||T===62||T===92?(t.consume(T),d):d(T)}function x(T){return!c&&(T===null||T===41||Ye(T))?(t.exit("chunkString"),t.exit(s),t.exit(a),t.exit(r),e(T)):c999||d===null||d===91||d===93&&!l||d===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):d===93?(t.exit(o),t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):se(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||se(d)||s++>999?(t.exit("chunkString"),c(d)):(t.consume(d),l||(l=!Ae(d)),d===92?p:f)}function p(d){return d===91||d===92||d===93?(t.consume(d),s++,f):f(d)}}function as(t,e,n,r,i,o){let a;return s;function s(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),a=p===40?41:p,l):n(p)}function l(p){return p===a?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(o),u(p))}function u(p){return p===a?(t.exit(o),l(a)):p===null?n(p):se(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),Ce(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===a||p===null||se(p)?(t.exit("chunkString"),u(p)):(t.consume(p),p===92?f:c)}function f(p){return p===a||p===92?(t.consume(p),c):c(p)}}function fn(t,e){let n;return r;function r(i){return se(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ae(i)?Ce(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const oh={name:"definition",tokenize:sh},ah={partial:!0,tokenize:lh};function sh(t,e,n){const r=this;let i;return o;function o(d){return t.enter("definition"),a(d)}function a(d){return os.call(r,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function s(d){return i=Wt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(t.enter("definitionMarker"),t.consume(d),t.exit("definitionMarker"),l):n(d)}function l(d){return Ye(d)?fn(t,u)(d):u(d)}function u(d){return is(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function c(d){return t.attempt(ah,f,f)(d)}function f(d){return Ae(d)?Ce(t,p,"whitespace")(d):p(d)}function p(d){return d===null||se(d)?(t.exit("definition"),r.parser.defined.push(i),e(d)):n(d)}}function lh(t,e,n){return r;function r(s){return Ye(s)?fn(t,i)(s):n(s)}function i(s){return as(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return Ae(s)?Ce(t,a,"whitespace")(s):a(s)}function a(s){return s===null||se(s)?e(s):n(s)}}const uh={name:"hardBreakEscape",tokenize:ch};function ch(t,e,n){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return se(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}const fh={name:"headingAtx",resolve:dh,tokenize:ph};function dh(t,e){let n=t.length-2,r=3,i,o;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},o={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ct(t,r,n-r+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function ph(t,e,n){let r=0;return i;function i(c){return t.enter("atxHeading"),o(c)}function o(c){return t.enter("atxHeadingSequence"),a(c)}function a(c){return c===35&&r++<6?(t.consume(c),a):c===null||Ye(c)?(t.exit("atxHeadingSequence"),s(c)):n(c)}function s(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||se(c)?(t.exit("atxHeading"),e(c)):Ae(c)?Ce(t,s,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),s(c))}function u(c){return c===null||c===35||Ye(c)?(t.exit("atxHeadingText"),s(c)):(t.consume(c),u)}}const hh=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Io=["pre","script","style","textarea"],mh={concrete:!0,name:"htmlFlow",resolveTo:xh,tokenize:vh},gh={partial:!0,tokenize:wh},yh={partial:!0,tokenize:bh};function xh(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function vh(t,e,n){const r=this;let i,o,a,s,l;return u;function u(R){return c(R)}function c(R){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(R),f}function f(R){return R===33?(t.consume(R),p):R===47?(t.consume(R),o=!0,x):R===63?(t.consume(R),i=3,r.interrupt?e:_):ut(R)?(t.consume(R),a=String.fromCharCode(R),v):n(R)}function p(R){return R===45?(t.consume(R),i=2,d):R===91?(t.consume(R),i=5,s=0,b):ut(R)?(t.consume(R),i=4,r.interrupt?e:_):n(R)}function d(R){return R===45?(t.consume(R),r.interrupt?e:_):n(R)}function b(R){const pe="CDATA[";return R===pe.charCodeAt(s++)?(t.consume(R),s===pe.length?r.interrupt?e:E:b):n(R)}function x(R){return ut(R)?(t.consume(R),a=String.fromCharCode(R),v):n(R)}function v(R){if(R===null||R===47||R===62||Ye(R)){const pe=R===47,ye=a.toLowerCase();return!pe&&!o&&Io.includes(ye)?(i=1,r.interrupt?e(R):E(R)):hh.includes(a.toLowerCase())?(i=6,pe?(t.consume(R),T):r.interrupt?e(R):E(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):o?I(R):A(R))}return R===45||et(R)?(t.consume(R),a+=String.fromCharCode(R),v):n(R)}function T(R){return R===62?(t.consume(R),r.interrupt?e:E):n(R)}function I(R){return Ae(R)?(t.consume(R),I):m(R)}function A(R){return R===47?(t.consume(R),m):R===58||R===95||ut(R)?(t.consume(R),C):Ae(R)?(t.consume(R),A):m(R)}function C(R){return R===45||R===46||R===58||R===95||et(R)?(t.consume(R),C):P(R)}function P(R){return R===61?(t.consume(R),h):Ae(R)?(t.consume(R),P):A(R)}function h(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),l=R,S):Ae(R)?(t.consume(R),h):y(R)}function S(R){return R===l?(t.consume(R),l=null,g):R===null||se(R)?n(R):(t.consume(R),S)}function y(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Ye(R)?P(R):(t.consume(R),y)}function g(R){return R===47||R===62||Ae(R)?A(R):n(R)}function m(R){return R===62?(t.consume(R),k):n(R)}function k(R){return R===null||se(R)?E(R):Ae(R)?(t.consume(R),k):n(R)}function E(R){return R===45&&i===2?(t.consume(R),B):R===60&&i===1?(t.consume(R),X):R===62&&i===4?(t.consume(R),te):R===63&&i===3?(t.consume(R),_):R===93&&i===5?(t.consume(R),Q):se(R)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(gh,ce,O)(R)):R===null||se(R)?(t.exit("htmlFlowData"),O(R)):(t.consume(R),E)}function O(R){return t.check(yh,F,ce)(R)}function F(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),D}function D(R){return R===null||se(R)?O(R):(t.enter("htmlFlowData"),E(R))}function B(R){return R===45?(t.consume(R),_):E(R)}function X(R){return R===47?(t.consume(R),a="",Z):E(R)}function Z(R){if(R===62){const pe=a.toLowerCase();return Io.includes(pe)?(t.consume(R),te):E(R)}return ut(R)&&a.length<8?(t.consume(R),a+=String.fromCharCode(R),Z):E(R)}function Q(R){return R===93?(t.consume(R),_):E(R)}function _(R){return R===62?(t.consume(R),te):R===45&&i===2?(t.consume(R),_):E(R)}function te(R){return R===null||se(R)?(t.exit("htmlFlowData"),ce(R)):(t.consume(R),te)}function ce(R){return t.exit("htmlFlow"),e(R)}}function bh(t,e,n){const r=this;return i;function i(a){return se(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function wh(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Qn,e,n)}}const Th={name:"htmlText",tokenize:kh};function kh(t,e,n){const r=this;let i,o,a;return s;function s(_){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(_),l}function l(_){return _===33?(t.consume(_),u):_===47?(t.consume(_),P):_===63?(t.consume(_),A):ut(_)?(t.consume(_),y):n(_)}function u(_){return _===45?(t.consume(_),c):_===91?(t.consume(_),o=0,b):ut(_)?(t.consume(_),I):n(_)}function c(_){return _===45?(t.consume(_),d):n(_)}function f(_){return _===null?n(_):_===45?(t.consume(_),p):se(_)?(a=f,X(_)):(t.consume(_),f)}function p(_){return _===45?(t.consume(_),d):f(_)}function d(_){return _===62?B(_):_===45?p(_):f(_)}function b(_){const te="CDATA[";return _===te.charCodeAt(o++)?(t.consume(_),o===te.length?x:b):n(_)}function x(_){return _===null?n(_):_===93?(t.consume(_),v):se(_)?(a=x,X(_)):(t.consume(_),x)}function v(_){return _===93?(t.consume(_),T):x(_)}function T(_){return _===62?B(_):_===93?(t.consume(_),T):x(_)}function I(_){return _===null||_===62?B(_):se(_)?(a=I,X(_)):(t.consume(_),I)}function A(_){return _===null?n(_):_===63?(t.consume(_),C):se(_)?(a=A,X(_)):(t.consume(_),A)}function C(_){return _===62?B(_):A(_)}function P(_){return ut(_)?(t.consume(_),h):n(_)}function h(_){return _===45||et(_)?(t.consume(_),h):S(_)}function S(_){return se(_)?(a=S,X(_)):Ae(_)?(t.consume(_),S):B(_)}function y(_){return _===45||et(_)?(t.consume(_),y):_===47||_===62||Ye(_)?g(_):n(_)}function g(_){return _===47?(t.consume(_),B):_===58||_===95||ut(_)?(t.consume(_),m):se(_)?(a=g,X(_)):Ae(_)?(t.consume(_),g):B(_)}function m(_){return _===45||_===46||_===58||_===95||et(_)?(t.consume(_),m):k(_)}function k(_){return _===61?(t.consume(_),E):se(_)?(a=k,X(_)):Ae(_)?(t.consume(_),k):g(_)}function E(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(t.consume(_),i=_,O):se(_)?(a=E,X(_)):Ae(_)?(t.consume(_),E):(t.consume(_),F)}function O(_){return _===i?(t.consume(_),i=void 0,D):_===null?n(_):se(_)?(a=O,X(_)):(t.consume(_),O)}function F(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||Ye(_)?g(_):(t.consume(_),F)}function D(_){return _===47||_===62||Ye(_)?g(_):n(_)}function B(_){return _===62?(t.consume(_),t.exit("htmlTextData"),t.exit("htmlText"),e):n(_)}function X(_){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),Z}function Z(_){return Ae(_)?Ce(t,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Q(_)}function Q(_){return t.enter("htmlTextData"),a(_)}}const vi={name:"labelEnd",resolveAll:Mh,resolveTo:Sh,tokenize:Ih},_h={tokenize:Rh},Ah={tokenize:Ch},Eh={tokenize:Nh};function Mh(t){let e=-1;const n=[];for(;++e=3&&(u===null||se(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===i?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),Ae(u)?Ce(t,s,"whitespace")(u):s(u))}}const qe={continuation:{tokenize:Vh},exit:Gh,name:"list",tokenize:jh},Bh={partial:!0,tokenize:$h},Uh={partial:!0,tokenize:Hh};function jh(t,e,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(d){const b=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:qr(d)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),d===42||d===45?t.check(Dn,n,u)(d):u(d);if(!r.interrupt||d===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(d)}return n(d)}function l(d){return qr(d)&&++a<10?(t.consume(d),l):(!r.interrupt||a<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(t.exit("listItemValue"),u(d)):n(d)}function u(d){return t.enter("listItemMarker"),t.consume(d),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,t.check(Qn,r.interrupt?n:c,t.attempt(Bh,p,f))}function c(d){return r.containerState.initialBlankLine=!0,o++,p(d)}function f(d){return Ae(d)?(t.enter("listItemPrefixWhitespace"),t.consume(d),t.exit("listItemPrefixWhitespace"),p):n(d)}function p(d){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(d)}}function Vh(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Qn,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ce(t,e,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!Ae(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Uh,e,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ce(t,t.attempt(qe,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Hh(t,e,n){const r=this;return Ce(t,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(o):n(o)}}function Gh(t){t.exit(this.containerState.type)}function $h(t,e,n){const r=this;return Ce(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!Ae(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}const Ro={name:"setextUnderline",resolveTo:qh,tokenize:Yh};function qh(t,e){let n=t.length,r,i,o;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!o&&t[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",a,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end={...t[o][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function Yh(t,e,n){const r=this;let i;return o;function o(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return t.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(t.consume(u),s):(t.exit("setextHeadingLineSequence"),Ae(u)?Ce(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||se(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const Kh={tokenize:Wh};function Wh(t){const e=this,n=t.attempt(Qn,r,t.attempt(this.parser.constructs.flowInitial,i,Ce(t,t.attempt(this.parser.constructs.flow,i,t.attempt(eh,i)),"linePrefix")));return n;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const Xh={resolveAll:ls()},Qh=ss("string"),Zh=ss("text");function ss(t){return{resolveAll:ls(t==="text"?Jh:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],o=n.attempt(i,a,s);return a;function a(c){return u(c)?o(c):s(c)}function s(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),o(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=i[c];let p=-1;if(f)for(;++p-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(t[i].slice(0,o))}return a}function dm(t,e){let n=-1;const r=[];let i;for(;++n0){const He=oe.tokenStack[oe.tokenStack.length-1];(He[1]||Po).call(oe,void 0,He[0])}for(K.position={start:kt(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:kt(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function Im(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Rm(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function fs(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function Cm(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return fs(t,e);const i={src:Jt(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,o),t.applyData(e,o)}function Nm(t,e){const n={src:Jt(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Lm(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Pm(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return fs(t,e);const i={href:Jt(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function Dm(t,e){const n={href:Jt(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Om(t,e,n){const r=t.all(e),i=n?zm(n):ds(e),o={},a=[];if(typeof e.checked=="boolean"){const c=r[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let s=-1;for(;++s1}function Fm(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Vm(t){const e=hs(t),n=ps(t);if(e&&n)return{start:e,end:n}}function Hm(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},s=hs(e.children[1]),l=ps(e.children[e.children.length-1]);s&&l&&(a.position={start:s,end:l}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,o),t.applyData(e,o)}function Gm(t,e,n){const r=n?n.children:void 0,o=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,s=a?a.length:e.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return o.push(zo(e.slice(i),i>0,!1)),o.join("")}function zo(t,e,n){let r=0,i=t.length;if(e){let o=t.codePointAt(r);for(;o===Do||o===Oo;)r++,o=t.codePointAt(r)}if(n){let o=t.codePointAt(i-1);for(;o===Do||o===Oo;)i--,o=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function Ym(t,e){const n={type:"text",value:qm(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Km(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Wm={blockquote:km,break:_m,code:Am,delete:Em,emphasis:Mm,footnoteReference:Sm,heading:Im,html:Rm,imageReference:Cm,image:Nm,inlineCode:Lm,linkReference:Pm,link:Dm,listItem:Om,list:Fm,paragraph:Bm,root:Um,strong:jm,table:Hm,tableCell:$m,tableRow:Gm,text:Ym,thematicBreak:Km,toml:Rn,yaml:Rn,definition:Rn,footnoteDefinition:Rn};function Rn(){}const gs=-1,Zn=0,Vn=1,Hn=2,bi=3,wi=4,Ti=5,ki=6,ys=7,xs=8,Fo=typeof self=="object"?self:globalThis,Xm=(t,e)=>{const n=(i,o)=>(t.set(o,i),i),r=i=>{if(t.has(i))return t.get(i);const[o,a]=e[i];switch(o){case Zn:case gs:return n(a,i);case Vn:{const s=n([],i);for(const l of a)s.push(r(l));return s}case Hn:{const s=n({},i);for(const[l,u]of a)s[r(l)]=r(u);return s}case bi:return n(new Date(a),i);case wi:{const{source:s,flags:l}=a;return n(new RegExp(s,l),i)}case Ti:{const s=n(new Map,i);for(const[l,u]of a)s.set(r(l),r(u));return s}case ki:{const s=n(new Set,i);for(const l of a)s.add(r(l));return s}case ys:{const{name:s,message:l}=a;return n(new Fo[s](l),i)}case xs:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i)}return n(new Fo[o](a),i)};return r},Bo=t=>Xm(new Map,t)(0),Vt="",{toString:Qm}={},{keys:Zm}=Object,ln=t=>{const e=typeof t;if(e!=="object"||!t)return[Zn,e];const n=Qm.call(t).slice(8,-1);switch(n){case"Array":return[Vn,Vt];case"Object":return[Hn,Vt];case"Date":return[bi,Vt];case"RegExp":return[wi,Vt];case"Map":return[Ti,Vt];case"Set":return[ki,Vt]}return n.includes("Array")?[Vn,n]:n.includes("Error")?[ys,n]:[Hn,n]},Cn=([t,e])=>t===Zn&&(e==="function"||e==="symbol"),Jm=(t,e,n,r)=>{const i=(a,s)=>{const l=r.push(a)-1;return n.set(s,l),l},o=a=>{if(n.has(a))return n.get(a);let[s,l]=ln(a);switch(s){case Zn:{let c=a;switch(l){case"bigint":s=xs,c=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([gs],a)}return i([s,c],a)}case Vn:{if(l)return i([l,[...a]],a);const c=[],f=i([s,c],a);for(const p of a)c.push(o(p));return f}case Hn:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(e&&"toJSON"in a)return o(a.toJSON());const c=[],f=i([s,c],a);for(const p of Zm(a))(t||!Cn(ln(a[p])))&&c.push([o(p),o(a[p])]);return f}case bi:return i([s,a.toISOString()],a);case wi:{const{source:c,flags:f}=a;return i([s,{source:c,flags:f}],a)}case Ti:{const c=[],f=i([s,c],a);for(const[p,d]of a)(t||!(Cn(ln(p))||Cn(ln(d))))&&c.push([o(p),o(d)]);return f}case ki:{const c=[],f=i([s,c],a);for(const p of a)(t||!Cn(ln(p)))&&c.push(o(p));return f}}const{message:u}=a;return i([s,{name:l,message:u}],a)};return o},Uo=(t,{json:e,lossy:n}={})=>{const r=[];return Jm(!(e||n),!!e,new Map,r)(t),r},Gn=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Bo(Uo(t,e)):structuredClone(t):(t,e)=>Bo(Uo(t,e));function eg(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function tg(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function ng(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||eg,r=t.options.footnoteBackLabel||tg,i=t.options.footnoteLabel||"Footnotes",o=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l0&&b.push({type:"text",value:" "});let I=typeof n=="string"?n:n(l,d);typeof I=="string"&&(I={type:"text",value:I}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,d),className:["data-footnote-backref"]},children:Array.isArray(I)?I:[I]})}const v=c[c.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const I=v.children[v.children.length-1];I&&I.type==="text"?I.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...b)}else c.push(...b);const T={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(c,!0)};t.patch(u,T),s.push(T)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Gn(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(s,!0)},{type:"text",value:` +`}]}}const vs=function(t){if(t==null)return ag;if(typeof t=="function")return Jn(t);if(typeof t=="object")return Array.isArray(t)?rg(t):ig(t);if(typeof t=="string")return og(t);throw new Error("Expected function, string, or object as test")};function rg(t){const e=[];let n=-1;for(;++n":""))+")"})}return p;function p(){let d=bs,b,x,v;if((!e||o(l,u,c[c.length-1]||void 0))&&(d=fg(n(l,c)),d[0]===jo))return d;if("children"in l&&l.children){const T=l;if(T.children&&d[0]!==ug)for(x=(r?T.children.length:-1)+a,v=c.concat(T);x>-1&&x0&&n.push({type:"text",value:` +`}),n}function Vo(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Ho(t,e){const n=hg(t,e),r=n.one(t,void 0),i=ng(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:` +`},i),o}function vg(t,e){return t&&"run"in t?async function(n,r){const i=Ho(n,{file:r,...e});await t.run(i,r)}:function(n,r){return Ho(n,{file:r,...t||e})}}function Go(t){if(t)throw t}var _r,$o;function bg(){if($o)return _r;$o=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},o=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=t.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!f)return!1;var p;for(p in u);return typeof p>"u"||t.call(u,p)},a=function(u,c){n&&c.name==="__proto__"?n(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},s=function(u,c){if(c==="__proto__")if(t.call(u,c)){if(r)return r(u,c).value}else return;return u[c]};return _r=function l(){var u,c,f,p,d,b,x=arguments[0],v=1,T=arguments.length,I=!1;for(typeof x=="boolean"&&(I=x,x=arguments[1]||{},v=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});va.length;let l;s&&a.push(i);try{l=t.apply(this,a)}catch(u){const c=u;if(s&&n)throw c;return i(c)}s||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(a,...s){n||(n=!0,e(a,...s))}function o(a){i(null,a)}}class We extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof e=="string"?i=e:!o.cause&&e&&(a=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=dn(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}}We.prototype.file="";We.prototype.name="";We.prototype.reason="";We.prototype.message="";We.prototype.stack="";We.prototype.column=void 0;We.prototype.line=void 0;We.prototype.ancestors=void 0;We.prototype.cause=void 0;We.prototype.fatal=void 0;We.prototype.place=void 0;We.prototype.ruleId=void 0;We.prototype.source=void 0;const lt={basename:_g,dirname:Ag,extname:Eg,join:Mg,sep:"/"};function _g(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');wn(t);let n=0,r=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,s=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),s>-1&&(t.codePointAt(i)===e.codePointAt(s--)?s<0&&(r=i):(s=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function Ag(t){if(wn(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Eg(t){wn(t);let e=t.length,n=-1,r=0,i=-1,o=0,a;for(;e--;){const s=t.codePointAt(e);if(s===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),s===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function Mg(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Ig(t,e){let n="",r=0,i=-1,o=0,a=-1,s,l;for(;++a<=t.length;){if(a2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,o=0}else s===46&&o>-1?o++:o=-1}return n}function wn(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Rg={cwd:Cg};function Cg(){return"/"}function Qr(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Ng(t){if(typeof t=="string")t=new URL(t);else if(!Qr(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Lg(t)}function Lg(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[d,...b]=c;const x=r[p][1];Xr(x)&&Xr(d)&&(d=Ar(!0,x,d)),r[p]=[u,d,...b]}}}}const Fg=new _i().freeze();function Ir(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Rr(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Cr(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Yo(t){if(!Xr(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ko(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Nn(t){return Bg(t)?t:new Pg(t)}function Bg(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Ug(t){return typeof t=="string"||jg(t)}function jg(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function Ai(){const t=Fg().use(Tm).use(vg).use(gp);return{process:e=>t.processSync(e).toString()}}const Vg={relative:""},Hg={"h-full":"","w-full":""},Gg={key:0,class:"animate-stripe",absolute:"",left:"1/2",bottom:"20%",z:"20","rounded-2xl":"",text:"primary-600","px-2":"","py-2":"",transform:"translate-x--1/2"},$g={bg:"primary-50","rounded-xl":"","px-10":"","py-6":""},qg=["innerHTML"],Yg=ze({__name:"Stage",props:{paused:{type:Boolean,default:!1}},setup(t){const e=W(),n=W(),{stageView:r}=Ze(Xt()),{mouthOpenSize:i}=Ze(iu()),{audioContext:o,calculateVolume:a}=ga(),{onBeforeMessageComposed:s,onBeforeSend:l,onTokenLiteral:u,onTokenSpecial:c,onStreamEnd:f,streamingMessage:p,onAssistantResponseEnd:d}=St(),{process:b}=Ai(),x=ui(),v=W(),T=W(!1),I=W(!1),A=or({handlers:[_=>new Promise(te=>{const ce=o.createBufferSource();ce.buffer=_.data.audioBuffer,ce.connect(o.destination),ce.connect(v.value),T.value=!0,ce.start(0),ce.onended=()=>{T.value=!1,te()}})]}),C=Bl(),{ssmlEnabled:P,activeSpeechProvider:h,activeSpeechModel:S,activeSpeechVoice:y,pitch:g}=Ze(C);async function m(_){try{if(!h.value){console.warn("No active speech provider configured");return}if(!y.value){console.warn("No active speech voice configured");return}const te=x.getProviderInstance(h.value);if(!te){console.error("Failed to initialize speech provider");return}const ce=x.getProviderConfig(h.value),R=P.value?C.generateSSML(_.data,y.value,{...ce,pitch:g.value}):_.data,pe=await Ul({...te.speech(S.value,ce),input:R,voice:y.value.id}),ye=await o.decodeAudioData(pe);await A.add({audioBuffer:ye,text:_.data})}catch(te){console.error("Speech generation failed:",te)}}const k=or({handlers:[m]});k.on("add",_=>{console.debug("ttsQueue added",_)});const E=jl(k),{live2dCurrentMotion:O}=Ze(Xt()),F=or({handlers:[async _=>{if(r.value==="3d"){const te=Ps[_.data];if(!te)return;await n.value.setExpression(te)}else r.value==="2d"&&(O.value={group:Ds[_.data]})}]}),D=Vl(F);D.onHandlerEvent("emotion",_=>{console.debug("emotion detected",_)});const B=Hl();B.onHandlerEvent("delay",_=>{console.debug("delay detected",_)});function X(){requestAnimationFrame(X),T.value&&(i.value=a(v.value,"linear"))}function Z(){I.value||(X(),o.resume(),I.value=!0)}function Q(){v.value||(v.value=o.createAnalyser())}return s(async()=>{Q(),Z()}),l(async()=>{O.value={group:Si}}),u(async _=>{await E.add(_)}),c(async _=>{await B.add(_),await D.add(_)}),f(async()=>{await B.add(Gl)}),d(async _=>{}),zt(()=>{var te,ce,R;I.value=!1;const _=window;(te=_.electron)==null||te.ipcRenderer.removeAllListeners("before-hide"),(ce=_.electron)==null||ce.ipcRenderer.removeAllListeners("after-show"),(R=_.electron)==null||R.ipcRenderer.removeAllListeners("before-quit")}),pn(()=>{var te,ce,R;const _=window;(te=_.electron)==null||te.ipcRenderer.on("before-hide",()=>{O.value={group:Rs}}),(ce=_.electron)==null||ce.ipcRenderer.on("after-show",()=>{O.value={group:Cs}}),(R=_.electron)==null||R.ipcRenderer.on("before-quit",()=>{O.value={group:Si}})}),pn(async()=>{e.value=Ns("duckdb-wasm://?bundles=import-url"),await e.value.execute(Ls`CREATE TABLE memory_test (vec FLOAT[768]);`)}),(_,te)=>(ee(),ie("div",Vg,[z("div",Hg,[H(r)==="2d"?(ee(),Qt(wu,{key:0,"mouth-open-size":H(i),"min-w":"50% (ee(),ie("header",Jg,[z("div",ey,[ke(Jl)]),ke(H(Cl),{class:"m-1 block max-h-[10lh] min-h-[1lh] rounded-lg bg-zinc-100 p-2 text-lg text-zinc-500 outline-none dark:bg-zinc-800 dark:text-zinc-400",to:"/settings"},{default:Be(()=>n[0]||(n[0]=[z("div",{"i-solar:settings-minimalistic-bold-duotone":""},null,-1)])),_:1})]))}});function ws(t,e){const n=fa(e??{},{...zi.getDefaultRealTimeVADOptions("v5"),preSpeechPadFrames:30,positiveSpeechThreshold:.5,negativeSpeechThreshold:.35,minSpeechFrames:30,auto:!0}),r=W(),i=Nl("microphone");async function o(){if(r.value&&(r.value.destroy(),r.value=void 0,console.warn("existing MicVAD destroyed")),!i.value)return;const a=H(t);if(!a)return;const s=await navigator.mediaDevices.getUserMedia({audio:{deviceId:a}});r.value=await zi.MicVAD.new({...n,stream:s}),n.auto&&r.value.start()}return je(i,o,{immediate:!0}),je(Ll(t),o,{immediate:!0}),Pl(o),zt(()=>{r.value&&(r.value.destroy(),r.value=void 0)}),{destroy:()=>{r.value&&(r.value.destroy(),r.value=void 0)},start:()=>{r.value&&r.value.start()}}}function ny(t,e){const n=fa(e,{onLoading:()=>{},onInitiate:()=>{},onProgress:()=>{},onDone:()=>{},onReady:()=>{},onStart:()=>{},onUpdate:()=>{},onComplete:()=>{}}),{post:r,data:i,terminate:o}=Dl(t,{type:"module"}),a=W(null),s=W(""),l=W([]),u=W(!1),c=W(0),f=W("");return je(i,p=>{var d,b,x,v,T,I,A,C;switch(p.status){case"loading":a.value="loading",s.value=p.data,(d=n.onLoading)==null||d.call(n,p.data);break;case"initiate":l.value.push(p),(b=n.onInitiate)==null||b.call(n,p);break;case"progress":l.value=l.value.map(P=>P.file===p.file?{...P,...p}:P),(x=n.onProgress)==null||x.call(n,p);break;case"done":l.value=l.value.filter(P=>P.file!==p.file),(v=n.onDone)==null||v.call(n,p);break;case"ready":a.value="ready",(T=n.onReady)==null||T.call(n);break;case"start":u.value=!0,(I=n.onStart)==null||I.call(n);break;case"update":c.value=p.tps,(A=n.onUpdate)==null||A.call(n,p.tps);break;case"complete":u.value=!1,f.value=p.output[0]||"",console.debug("Whisper result:",f.value),(C=n.onComplete)==null||C.call(n,p.output[0]);break}}),zt(()=>{o()}),{transcribe:p=>r(p),status:a,loadingMessage:s,loadingProgress:l,transcribing:u,tps:c,result:f,load:()=>r({type:"load"}),terminate:o}}const ry="/assets/worker-D9VCBMJ0.js";async function iy(t,e){const n=new ArrayBuffer(44+t.length*2),r=new DataView(n);Ln(r,0,"RIFF"),r.setUint32(4,36+t.length*2,!0),Ln(r,8,"WAVE"),Ln(r,12,"fmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,e,!0),r.setUint32(28,e*2,!0),r.setUint16(32,2,!0),r.setUint16(34,16,!0),Ln(r,36,"data"),r.setUint32(40,t.length*2,!0),oy(r,44,t);const i=new Blob([r],{type:"audio/wav"});return new Promise((o,a)=>{const s=new FileReader;s.onload=()=>{const l=s.result.split(",")[1];o(l)},s.onerror=a,s.readAsDataURL(i)})}function Ln(t,e,n){for(let r=0;r{jn().then(()=>{i.update(),o.value=i.height.value})}),u(async()=>{jn().then(()=>{i.update(),o.value=i.height.value})}),(c,f)=>{const p=pa("auto-animate");return ee(),ie("div",ay,[f[2]||(f[2]=z("div",{"flex-1":""},null,-1)),At((ee(),ie("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"",flex:"~ col","overflow-scroll":""},[f[1]||(f[1]=z("div",{"flex-1":""},null,-1)),(ee(!0),ie(si,null,li(H(n),(d,b)=>(ee(),ie("div",{key:b,"mb-2":""},[d.role==="error"?(ee(),ie("div",sy,[z("div",ly,[z("div",uy,[z("div",cy,[z("span",fy,ge(H(a)("stage.chat.message.character-name.core-system")),1)]),f[0]||(f[0]=z("div",{"i-solar:danger-triangle-bold-duotone":"","text-violet-500":""},null,-1))]),H(r)?(ee(),ie("div",dy)):(ee(),ie("div",{key:1,class:"markdown-content break-words text-violet-500",text:"base {if(!E||!E.trim())return;const O=o.getProviderConfig(a.value);await d(E,{chatProvider:o.getProviderInstance(a.value),model:s.value,providerConfig:O})}});async function h(){if(e.value.trim())try{const E=o.getProviderConfig(a.value);await d(e.value,{chatProvider:o.getProviderInstance(a.value),model:s.value,providerConfig:E})}catch(E){x.value.pop(),x.value.push({role:"error",content:E.message})}}const{destroy:S,start:y}=ws(p,{onSpeechStart:()=>{n.value=!0},onVADMisfire:()=>{n.value=!1},onSpeechEnd:E=>{n.value=!1,m(E)},auto:!1});function g(){C.value!=="loading"&&(A(),y())}async function m(E){await v.resume();const O=await iy(E,v.sampleRate);I({type:"generate",data:{audio:O,language:"en"}})}async function k(E){const O=E.target,F=u.value.find(D=>D.deviceId===O.value);if(!F){c.value=void 0;return}c.value=F}return je(f,async E=>{E==="false"&&(S(),P())}),b(async()=>{e.value=""}),(E,O)=>(ee(),ie("div",Ay,[z("fieldset",Ey,[z("label",{class:st([r.value==="chat"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="chat"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":H(l)}]),flex:"~ row",checked:r.value==="chat","aria-checked":r.value==="chat",border:"solid l-2 t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-l-lg":"","px-2":""},[At(z("input",{"onUpdate:modelValue":O[0]||(O[0]=F=>r.value=F),type:"radio",name:"tab",value:"chat",hidden:""},null,512),[[ir,r.value]]),O[5]||(O[5]=z("div",{"i-solar:dialog-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),z("div",Sy,[z("span",Iy,ge(H(T)("stage.chat.tabs.chat")),1)])],10,My),z("label",{class:st([r.value==="custom"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="custom"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":H(l)}]),flex:"~ row",checked:r.value==="custom","aria-checked":r.value==="custom",border:"solid t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","px-2":""},[At(z("input",{"onUpdate:modelValue":O[1]||(O[1]=F=>r.value=F),type:"radio",name:"tab",value:"custom",hidden:""},null,512),[[ir,r.value]]),O[6]||(O[6]=z("div",{"i-solar:star-fall-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),z("div",Cy,[z("span",null,ge(H(T)("stage.chat.tabs.custom")),1)])],10,Ry),z("label",{class:st([r.value==="clothes"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="clothes"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":H(l)}]),flex:"~ row",checked:r.value==="clothes","aria-checked":r.value==="clothes",border:"solid r-2 t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-r-lg":"","px-2":""},[At(z("input",{"onUpdate:modelValue":O[2]||(O[2]=F=>r.value=F),type:"radio",name:"tab",value:"clothes",hidden:""},null,512),[[ir,r.value]]),O[7]||(O[7]=z("div",{"i-solar:magic-stick-3-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),z("div",Ly,[z("span",null,ge(H(T)("stage.chat.tabs.clothes")),1)])],10,Ny)]),z("div",Py,[z("div",Dy,[ke(_y,{"h-full":"","flex-1":"","p-4":"",w:"full","max-h":"e.value=F),placeholder:H(T)("stage.message"),text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500 placeholder:primary-300 placeholder:hover:primary-500 placeholder:dark:primary-300/50 placeholder:dark:hover:primary-500",bg:"primary-100 dark:primary-400/20","min-h":"[100px]","max-h":"[300px]","w-full":"","rounded-t-xl":"","p-4":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",class:st({"transition-colors-none placeholder:transition-colors-none":H(l)}),onSubmit:h},null,8,["modelValue","placeholder","class"])])])]),z("div",zy,[z("button",{bg:"complementary-100 hover:complementary-200 dark:complementary-800 dark:hover:complementary-700",transition:"all duration-250 ease-in-out",class:st({"transition-colors-none":H(l)}),text:"complementary-400","mb-6":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":"",onClick:g},[ke(zl,{mode:"out-in"},{default:Be(()=>[H(C)===null?(ee(),ie("div",Fy,ge(H(T)("stage.operations.load-models")),1)):H(C)==="loading"?(ee(),ie("div",By,[O[8]||(O[8]=z("div",{"i-svg-spinners:bouncing-ball":"",class:"text-cyan"},null,-1)),z("span",null,ge(H(T)("stage.operations.load-models-status.loading")),1)])):H(C)==="ready"?(ee(),ie("div",Uy,[O[9]||(O[9]=z("div",{"i-lucide:check":"",class:"text-cyan"},null,-1)),z("span",null,ge(H(T)("stage.operations.load-models-status.ready")),1)])):it("",!0)]),_:1})],2),z("div",jy,[ke(H(ci),null,{default:Be(()=>[i.value?(ee(),ie("fieldset",Vy,[(ee(!0),ie(si,null,li(H(u),(F,D)=>(ee(),ie("label",{key:D,class:"[&_div_span]:dark:hover:bg-cyan-300 [&_div_span]:dark:hover:bg-cyan-900"},[z("input",{type:"radio",name:"audioInput",value:F.deviceId,hidden:"",onChange:k},null,40,Hy),z("div",Gy,[z("div",$y,[F.deviceId===H(p)?(ee(),ie("div",qy)):it("",!0)]),z("span",{"inline-block":"",class:st([F.deviceId===H(p)?"cyan-400 dark:text-white":"cyan-400/50 dark:text-white/50"]),transition:"all duration-250 ease-in-out"},ge(F.label),3)])]))),128))])):it("",!0)]),_:1}),z("label",{bg:"complementary-100 hover:complementary-200 dark:complementary-800 dark:hover:complementary-700",transition:"all duration-250 ease-in-out",class:st({"transition-colors-none":H(l)}),text:"complementary-400","mb-6":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":""},[At(z("input",{"onUpdate:modelValue":O[4]||(O[4]=F=>i.value=F),type:"checkbox",hidden:""},null,512),[[Jr,i.value]]),O[10]||(O[10]=z("div",{"i-solar:microphone-2-bold-duotone":""},null,-1)),z("div",null,[n.value?(ee(),ie("span",Ky,"Listening...")):(ee(),ie("span",Yy,ge(H(T)("settings.microphone")),1))])],2)])])]))}}),Xy=Kn(Wy,[["__scopeId","data-v-0b41b5bf"]]),Qy={py:"1",flex:"~ col",rounded:"lg","overflow-hidden":""},Zy={key:0,flex:"",mr:"12"},Jy={flex:"~ col",border:"4 solid primary-200/50 dark:primary-500/50",shadow:"md primary-200/50 dark:none","min-w-20":"","rounded-lg":"","px-2":"","py-1":"",h:"unset {jn().then(()=>{i.update(),o.value=i.height.value})}),l(async()=>{jn().then(()=>{i.update(),o.value=i.height.value})}),(u,c)=>{const f=pa("auto-animate");return ee(),ie("div",Qy,[c[1]||(c[1]=z("div",{"flex-1":""},null,-1)),At((ee(),ie("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"","max-h":"30vh",flex:"~ col","overflow-scroll":""},[c[0]||(c[0]=z("div",{"flex-1":""},null,-1)),(ee(!0),ie(si,null,li(H(r),(p,d)=>(ee(),ie("div",{key:d,"mb-2":""},[p.role==="assistant"?(ee(),ie("div",Zy,[z("div",Jy,[z("div",null,[z("span",e0,ge(H(n)("stage.chat.message.character-name.airi")),1)]),p.content?(ee(),ie("div",{key:0,class:"markdown-content",text:"base {n.value=!0},onVADMisfire:()=>{n.value=!1},onSpeechEnd:v=>{n.value=!1,x()},auto:!1});function x(v){alert("Transcription is not implemented yet")}return je(a,async v=>{v==="false"&&d()}),c(async()=>{e.value=""}),pn(()=>{b()}),(v,T)=>(ee(),ie("div",null,[z("div",u0,[ke(l0,{absolute:"","left-0":"","top-0":"",transform:"translate-y-[-100%]","w-full":""}),z("div",c0,[ke(H(ha),{modelValue:e.value,"onUpdate:modelValue":T[0]||(T[0]=I=>e.value=I),placeholder:H(f)("stage.message"),border:"solid 2 primary-100 dark:primary-400/20",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500 placeholder:primary-300 placeholder:hover:primary-500 placeholder:dark:primary-300/50 placeholder:dark:hover:primary-500",bg:"primary-100 dark:primary-400/20","max-h":"[10lh]","min-h":"[1lh]","w-full":"","resize-none":"","overflow-y-scroll":"","rounded-xl":"","p-2":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",class:st({"transition-colors-none placeholder:transition-colors-none":H(l)}),onSubmit:p},null,8,["modelValue","placeholder","class"])])])]))}}),d0={class:"relative"},p0={absolute:"","left-0":"","right-0":"","top-0":"","w-full":"","overflow-hidden":""},h0=ze({__name:"AnimatedWave",props:{height:{default:40},amplitude:{default:14},waveLength:{default:250},fillColor:{default:"oklch(95% 0.10 var(--theme-colors-hue))"},direction:{default:"down"},movementDirection:{default:"left"},animationSpeed:{default:50}},setup(t){const e=t,n=W(e.height),r=W(e.amplitude),i=W(e.waveLength),o=W(e.fillColor),a=W(e.direction),s=W(e.movementDirection);function l(f,p,d,b,x){const v=[],I=Math.ceil(f/b)*b,A=1,C=x==="up"?d:p-d;v.push(`M 0 ${C}`);const P=Math.PI*2/b;for(let S=0;S<=I;S+=A){const y=d*Math.sin(P*S),g=x==="up"?C-y:C+y;v.push(`L ${S} ${g}`)}const h=x==="up"?p:0;return v.push(`L ${I} ${h}`),v.push(`L 0 ${h} Z`),v.join(" ")}const u=Ue(()=>n.value+r.value*2),c=Ue(()=>{const f=` + + `;return`url(data:image/svg+xml;base64,${btoa(f)})`});return je(()=>[e.height,e.amplitude,e.waveLength,e.fillColor,e.direction,e.movementDirection],()=>{n.value=e.height,r.value=e.amplitude,i.value=e.waveLength,o.value=e.fillColor,a.value=e.direction,s.value=e.movementDirection},{immediate:!0}),(f,p)=>(ee(),ie("div",d0,[gn(f.$slots,"default",{},void 0,!0),z("div",p0,[z("div",{class:"wave",style:Dr({background:o.value,height:`${u.value}px`,maskImage:c.value,WebkitMaskImage:c.value,"--wave-translate":`${-i.value}px`,"--animation-duration":`${i.value/t.animationSpeed}s`,"animation-direction":s.value==="left"?"normal":"reverse"})},null,4)])]))}}),m0=Kn(h0,[["__scopeId","data-v-d4cf94d8"]]),g0={relative:"",flex:"~ col","z-2":"","h-100dvh":"","w-100vw":"","of-hidden":""},y0={relative:"",flex:"~ 1 row gap-y-0 gap-x-2 (ee(),Qt(Zg,null,{default:Be(()=>[ke(m0,{"fill-color":H(e)?"oklch(35% calc(var(--theme-colors-chroma) * 0.6) var(--theme-colors-hue))":"color-mix(in srgb, oklch(95% calc(var(--theme-colors-chroma-50) * 0.5) var(--theme-colors-hue)) 80%, oklch(100% 0 360))"},{default:Be(()=>[z("div",g0,[z("div",null,[ke(ty,{class:"flex",p2:""})]),z("div",y0,[ke(H(Kg),{"flex-1":"","min-w":"1/2",paused:n.value},null,8,["paused"]),ke(Xy,{class:"flex