lollms-webui/web/dist/assets/index-DszaGEWB.js

4258 lines
3.0 MiB
JavaScript
Raw Normal View History

2024-11-04 00:22:50 +00:00
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/stackoverflow-dark-8CFru5b-.css","assets/stackoverflow-light-CpIvNHzo.css"])))=>i.map(i=>d[i]);
2024-11-06 23:05:30 +00:00
var l5=Object.defineProperty;var c5=(n,e,t)=>e in n?l5(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pn=(n,e,t)=>c5(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();/**
2024-11-04 00:22:50 +00:00
* @vue/shared v3.5.10
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**//*! #__NO_SIDE_EFFECTS__ */function j1(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const hn={},ll=[],Ki=()=>{},d5=()=>!1,dh=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),Q1=n=>n.startsWith("onUpdate:"),Ln=Object.assign,X1=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},u5=Object.prototype.hasOwnProperty,en=(n,e)=>u5.call(n,e),vt=Array.isArray,cl=n=>Kl(n)==="[object Map]",Wl=n=>Kl(n)==="[object Set]",CE=n=>Kl(n)==="[object Date]",p5=n=>Kl(n)==="[object RegExp]",kt=n=>typeof n=="function",yn=n=>typeof n=="string",Xi=n=>typeof n=="symbol",cn=n=>n!==null&&typeof n=="object",CM=n=>(cn(n)||kt(n))&&kt(n.then)&&kt(n.catch),AM=Object.prototype.toString,Kl=n=>AM.call(n),h5=n=>Kl(n).slice(8,-1),RM=n=>Kl(n)==="[object Object]",Z1=n=>yn(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,Pc=j1(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),uh=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},m5=/-(\w)/g,di=uh(n=>n.replace(m5,(e,t)=>t?t.toUpperCase():"")),f5=/\B([A-Z])/g,Io=uh(n=>n.replace(f5,"-$1").toLowerCase()),ph=uh(n=>n.charAt(0).toUpperCase()+n.slice(1)),Zu=uh(n=>n?`on${ph(n)}`:""),Co=(n,e)=>!Object.is(n,e),dl=(n,...e)=>{for(let t=0;t<n.length;t++)n[t](...e)},MM=(n,e,t,r=!1)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:r,value:t})},bp=n=>{const e=parseFloat(n);return isNaN(e)?n:e},g5=n=>{const e=yn(n)?Number(n):NaN;return isNaN(e)?n:e};let AE;const NM=()=>AE||(AE=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function on(n){if(vt(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=yn(r)?y5(r):on(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(yn(n)||cn(n))return n}const _5=/;(?![^(]*\))/g,b5=/:([^]+)/,v5=/\/\*[^]*?\*\//g;function y5(n){const e={};return n.replace(v5,"").split(_5).forEach(t=>{if(t){const r=t.split(b5);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function qe(n){let e="";if(yn(n))e=n;else if(vt(n))for(let t=0;t<n.length;t++){const r=qe(n[t]);r&&(e+=r+" ")}else if(cn(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}const E5="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",S5=j1(E5);function kM(n){return!!n||n===""}function x5(n,e){if(n.length!==e.length)return!1;let t=!0;for(let r=0;t&&r<n.length;r++)t=ga(n[r],e[r]);return t}function ga(n,e){if(n===e)return!0;let t=CE(n),r=CE(e);if(t||r)return t&&r?n.getTime()===e.getTime():!1;if(t=Xi(n),r=Xi(e),t||r)return n===e;if(t=vt(n),r=vt(e),t||r)return t&&r?x5(n,e):!1;if(t=cn(n),r=cn(e),t||r){if(!t||!r)return!1;const i=Object.keys(n).length,s=Object.keys(e).length;if(i!==s)return!1;for(const o in n){const a=n.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!ga(n[o],e[o]))return!1}}return String(n)===String(e)}function J1(n,e){return n.findIndex(t=>ga(t,e))}const IM=n=>!!(n&&n.__v_isRef===!0),X=n=>yn(n)?n:n==null?"":vt(n)||cn(n)&&(n.toString===AM||!kt(n.toString))?IM(n)?X(n.value):JSON.stringify(n,OM,2):String(n),OM=(n,e)=>IM(e)?OM(n,e.value):cl(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[r,i],s)=>(t[ym(r,s)+" =>"]=i,t),{})}:Wl(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>ym(t))}:Xi(e)?ym(e):cn(e)&&!vt(e)&&!RM(e)?String(e):e,ym=(n,e="")=>{var t;return Xi(n)?`Symbol(${(t=n.description)!=null?t:e})`:n};/**
2024-11-04 00:22:50 +00:00
* @vue/reactivity v3.5.10
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let mr;class DM{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=mr,!e&&mr&&(this.index=(mr.scopes||(mr.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=mr;try{return mr=this,e()}finally{mr=t}}}on(){mr=this}off(){mr=this.parent}stop(e){if(this._active){let t,r;for(t=0,r=this.effects.length;t<r;t++)this.effects[t].stop();for(t=0,r=this.cleanups.length;t<r;t++)this.cleanups[t]();if(this.scopes)for(t=0,r=this.scopes.length;t<r;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0,this._active=!1}}}function T5(n){return new DM(n)}function LM(){return mr}function w5(n,e=!1){mr&&mr.cleanups.push(n)}let gn;const Em=new WeakSet;class PM{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,mr&&mr.active&&mr.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Em.has(this)&&(Em.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||UM(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,RE(this),BM(this);const e=gn,t=Ci;gn=this,Ci=!0;try{return this.fn()}finally{GM(this),gn=e,Ci=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)nv(e);this.deps=this.depsTail=void 0,RE(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Em.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ob(this)&&this.run()}get dirty(){return Ob(this)}}let FM=0,il;function UM(n){n.flags|=8,n.next=il,il=n}function ev(){FM++}function tv(){if(--FM>0)return;let n;for(;il;){let e=il,t;for(;e;)e.flags&1||(e.flags&=-9),e=e.next;for(e=il,il=void 0;e;){if(t=e.next,e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){n||(n=r)}e=t}}if(n)throw n}function BM(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function GM(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),nv(r),C5(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function Ob(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(zM(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function zM(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===td))return;n.globalVersion=td;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!Ob(n)){n.flags&=-3;return}const t=gn,r=Ci;gn=n,Ci=!0;try{BM(n);const i=n.fn(n._value);(e.version===0||Co(i,n._value))&&(n._value=i,e.version++)}catch(i){throw e.version++,i}finally{gn=t,Ci=r,GM(n),n.flags&=-3}}function nv(n,e=!1){const{dep:t,prevSub:r,nextSub:i}=n;if(r&&(r.nextSub=i,n.prevSub=void 0),i&&(i.prevSub=r,n.nextSub=void 0),t.subs===n&&(t.subs=r),!t.subs&&t.computed){t.computed.flags&=-5;for(let s=t.computed.deps;s;s=s.nextDep)nv(s,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function C5(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let Ci=!0;const VM=[];function Oo(){VM.push(Ci),Ci=!1}function Do(){const n=VM.pop();Ci=n===void 0?!0:n}function RE(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=gn;gn=void 0;try{e()}finally{gn=t}}}let td=0;class A5{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class hh{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.target=vo
2024-11-04 00:22:50 +00:00
* @vue/runtime-core v3.5.10
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function Sd(n,e,t,r){try{return r?n(...r):n()}catch(i){vh(i,e,t)}}function Ni(n,e,t,r){if(kt(n)){const i=Sd(n,e,t,r);return i&&CM(i)&&i.catch(s=>{vh(s,e,t)}),i}if(vt(n)){const i=[];for(let s=0;s<n.length;s++)i.push(Ni(n[s],e,t,r));return i}}function vh(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||hn;if(e){let a=e.parent;const l=e.proxy,d=`https://vuejs.org/error-reference/#runtime-${t}`;for(;a;){const u=a.ec;if(u){for(let m=0;m<u.length;m++)if(u[m](n,l,d)===!1)return}a=a.parent}if(s){Oo(),Sd(s,null,10,[n,l,d]),Do();return}}aD(n,t,i,r,o)}function aD(n,e,t,r=!0,i=!1){if(i)throw n;console.error(n)}let rd=!1,Lb=!1;const fr=[];let Fi=0;const pl=[];let io=null,nl=0;const r4=Promise.resolve();let ov=null;function We(n){const e=ov||r4;return n?e.then(this?n.bind(this):n):e}function lD(n){let e=rd?Fi+1:0,t=fr.length;for(;e<t;){const r=e+t>>>1,i=fr[r],s=id(i);s<n||s===n&&i.flags&2?e=r+1:t=r}return e}function av(n){if(!(n.flags&1)){const e=id(n),t=fr[fr.length-1];!t||!(n.flags&2)&&e>=id(t)?fr.push(n):fr.splice(lD(e),0,n),n.flags|=1,i4()}}function i4(){!rd&&!Lb&&(Lb=!0,ov=r4.then(o4))}function cD(n){vt(n)?pl.push(...n):io&&n.id===-1?io.splice(nl+1,0,n):n.flags&1||(pl.push(n),n.flags|=1),i4()}function DE(n,e,t=rd?Fi+1:0){for(;t<fr.length;t++){const r=fr[t];if(r&&r.flags&2){if(n&&r.id!==n.uid)continue;fr.splice(t,1),t--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function s4(n){if(pl.length){const e=[...new Set(pl)].sort((t,r)=>id(t)-id(r));if(pl.length=0,io){io.push(...e);return}for(io=e,nl=0;nl<io.length;nl++){const t=io[nl];t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2}io=null,nl=0}}const id=n=>n.id==null?n.flags&2?-1:1/0:n.id;function o4(n){Lb=!1,rd=!0;try{for(Fi=0;Fi<fr.length;Fi++){const e=fr[Fi];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Sd(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Fi<fr.length;Fi++){const e=fr[Fi];e&&(e.flags&=-2)}Fi=0,fr.length=0,s4(),rd=!1,ov=null,(fr.length||pl.length)&&o4()}}let Wn=null,a4=null;function Sp(n){const e=Wn;return Wn=n,a4=n&&n.type.__scopeId||null,e}function Ge(n,e=Wn,t){if(!e||n._n)return n;const r=(...i)=>{r._d&&YE(-1);const s=Sp(e);let o;try{o=n(...i)}finally{Sp(s),r._d&&YE(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function F(n,e){if(Wn===null)return n;const t=Ch(Wn),r=n.dirs||(n.dirs=[]);for(let i=0;i<e.length;i++){let[s,o,a,l=hn]=e[i];s&&(kt(s)&&(s={mounted:s,updated:s}),s.deep&&Ss(o),r.push({dir:s,instance:t,value:o,oldValue:void 0,arg:a,modifiers:l}))}return n}function Bo(n,e,t,r){const i=n.dirs,s=e&&e.dirs;for(let o=0;o<i.length;o++){const a=i[o];s&&(a.oldValue=s[o].value);let l=a.dir[r];l&&(Oo(),Ni(l,t,8,[n.el,a,n,e]),Do())}}const l4=Symbol("_vte"),c4=n=>n.__isTeleport,Fc=n=>n&&(n.disabled||n.disabled===""),dD=n=>n&&(n.defer||n.defer===""),LE=n=>typeof SVGElement<"u"&&n instanceof SVGElement,PE=n=>typeof MathMLElement=="function"&&n instanceof MathMLElement,Pb=(n,e)=>{const t=n&&n.to;return yn(t)?e?e(t):null:t},uD={name:"Teleport",__isTeleport:!0,process(n,e,t,r,i,s,o,a,l,d){const{mc:u,pc:m,pbc:f,o:{insert:g,querySelector:h,createText:v,createComment:b}}=d,_=Fc(e.props);let{shapeFlag:y,children:E,dynamicChildren:x}=e;if(n==null){const A=e.el=v(""),w=e.anchor=v("");g(A,t,r),g(w,t,r);const N=(C,k)=>{y&16&&(i&&i.isCE&&(i.ce._teleportTarget=C),u(E,C,k,i,s,o,a,l))},L=()=>{const C=e.target=Pb(e.props,h),k=d4(C,e,v,g);C&&(o!=="svg"&&LE(C)?o="svg":o!=="mathml"&&PE(C)&&(o="mathml"),_||(N(C,k),Ju(e)))};_&&(N(t,w),Ju(e)),dD(e.props)?Yn(L,s):L()}else{e.el=n.el,e.targetStart=n.targetStart;const A=e.anchor=n.anchor,w=e.target=n.target,N=e.targetAnchor=n.targetAnchor,L=Fc(n.props),C=L?t:w,k=L?A:N;if(o==="svg"||LE(w)?o="svg":(o==="mathml"||PE(w))&&(o="mathml"),x?(f(n.dynamicChildren,x,C,i,s,o,a),uv(n,e,!0)):l||m(n,e,C,k,i,s,o,a,!1),_)L?e.props&&n.props&&e.props.to!==n.props.to&&(e.props.to=n.props.to):Xd(e,t,A,d,1);else if((e.props&&e.props.to)!==(n.props&&n.props.to)){const H=e.target=Pb(e.props,h);H&&Xd(e,H,null,d,0)}else L&&Xd(e,w,N,d,1);Ju(e)}},remove(n,e,t,{um:r,o:{remove:i}},s){const{shapeF
2024-11-04 00:22:50 +00:00
* @vue/runtime-dom v3.5.10
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let qb;const jE=typeof window<"u"&&window.trustedTypes;if(jE)try{qb=jE.createPolicy("vue",{createHTML:n=>n})}catch{}const H4=qb?n=>qb.createHTML(n):n=>n,mL="http://www.w3.org/2000/svg",fL="http://www.w3.org/1998/Math/MathML",ys=typeof document<"u"?document:null,QE=ys&&ys.createElement("template"),gL={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,r)=>{const i=e==="svg"?ys.createElementNS(mL,n):e==="mathml"?ys.createElementNS(fL,n):t?ys.createElement(n,{is:t}):ys.createElement(n);return n==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:n=>ys.createTextNode(n),createComment:n=>ys.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>ys.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,r,i,s){const o=t?t.previousSibling:e.lastChild;if(i&&(i===s||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),t),!(i===s||!(i=i.nextSibling)););else{QE.innerHTML=H4(r==="svg"?`<svg>${n}</svg>`:r==="mathml"?`<math>${n}</math>`:n);const a=QE.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},$s="transition",mc="animation",Sl=Symbol("_vtc"),q4={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Y4=Ln({},p4,q4),_L=n=>(n.displayName="Transition",n.props=Y4,n),ji=_L((n,{slots:e})=>mv(fD,$4(n),e)),zo=(n,e=[])=>{vt(n)?n.forEach(t=>t(...e)):n&&n(...e)},XE=n=>n?vt(n)?n.some(e=>e.length>1):n.length>1:!1;function $4(n){const e={};for(const q in n)q in q4||(e[q]=n[q]);if(n.css===!1)return e;const{name:t="v",type:r,duration:i,enterFromClass:s=`${t}-enter-from`,enterActiveClass:o=`${t}-enter-active`,enterToClass:a=`${t}-enter-to`,appearFromClass:l=s,appearActiveClass:d=o,appearToClass:u=a,leaveFromClass:m=`${t}-leave-from`,leaveActiveClass:f=`${t}-leave-active`,leaveToClass:g=`${t}-leave-to`}=n,h=bL(i),v=h&&h[0],b=h&&h[1],{onBeforeEnter:_,onEnter:y,onEnterCancelled:E,onLeave:x,onLeaveCancelled:A,onBeforeAppear:w=_,onAppear:N=y,onAppearCancelled:L=E}=e,C=(q,ie,D)=>{ro(q,ie?u:a),ro(q,ie?d:o),D&&D()},k=(q,ie)=>{q._isLeaving=!1,ro(q,m),ro(q,g),ro(q,f),ie&&ie()},H=q=>(ie,D)=>{const $=q?N:y,K=()=>C(ie,q,D);zo($,[ie,K]),ZE(()=>{ro(ie,q?l:s),bs(ie,q?u:a),XE($)||JE(ie,r,v,K)})};return Ln(e,{onBeforeEnter(q){zo(_,[q]),bs(q,s),bs(q,o)},onBeforeAppear(q){zo(w,[q]),bs(q,l),bs(q,d)},onEnter:H(!1),onAppear:H(!0),onLeave(q,ie){q._isLeaving=!0;const D=()=>k(q,ie);bs(q,m),bs(q,f),K4(),ZE(()=>{q._isLeaving&&(ro(q,m),bs(q,g),XE(x)||JE(q,r,b,D))}),zo(x,[q,D])},onEnterCancelled(q){C(q,!1),zo(E,[q])},onAppearCancelled(q){C(q,!0),zo(L,[q])},onLeaveCancelled(q){k(q),zo(A,[q])}})}function bL(n){if(n==null)return null;if(cn(n))return[Mm(n.enter),Mm(n.leave)];{const e=Mm(n);return[e,e]}}function Mm(n){return g5(n)}function bs(n,e){e.split(/\s+/).forEach(t=>t&&n.classList.add(t)),(n[Sl]||(n[Sl]=new Set)).add(e)}function ro(n,e){e.split(/\s+/).forEach(r=>r&&n.classList.remove(r));const t=n[Sl];t&&(t.delete(e),t.size||(n[Sl]=void 0))}function ZE(n){requestAnimationFrame(()=>{requestAnimationFrame(n)})}let vL=0;function JE(n,e,t,r){const i=n._endId=++vL,s=()=>{i===n._endId&&r()};if(t!=null)return setTimeout(s,t);const{type:o,timeout:a,propCount:l}=W4(n,e);if(!o)return r();const d=o+"end";let u=0;const m=()=>{n.removeEventListener(d,f),s()},f=g=>{g.target===n&&++u>=l&&m()};setTimeout(()=>{u<l&&m()},a+1),n.addEventListener(d,f)}function W4(n,e){const t=window.getComputedStyle(n),r=h=>(t[h]||"").split(", "),i=r(`${$s}Delay`),s=r(`${$s}Duration`),o=eS(i,s),a=r(`${mc}Delay`),l=r(`${mc}Duration`),d=eS(a,l);let u=null,m=0,f=0;e===$s?o>0&&(u=$s,m=o,f=s.length
2024-11-04 00:22:50 +00:00
* vuex v4.1.0
* (c) 2022 Evan You
* @license MIT
2024-11-06 23:05:30 +00:00
*/var e3="store";function i6(n){return n===void 0&&(n=null),Gr(n!==null?n:e3)}function Ql(n,e){Object.keys(n).forEach(function(t){return e(n[t],t)})}function t3(n){return n!==null&&typeof n=="object"}function s6(n){return n&&typeof n.then=="function"}function o6(n,e){return function(){return n(e)}}function n3(n,e,t){return e.indexOf(n)<0&&(t&&t.prepend?e.unshift(n):e.push(n)),function(){var r=e.indexOf(n);r>-1&&e.splice(r,1)}}function r3(n,e){n._actions=Object.create(null),n._mutations=Object.create(null),n._wrappedGetters=Object.create(null),n._modulesNamespaceMap=Object.create(null);var t=n.state;Ah(n,t,[],n._modules.root,!0),fv(n,t,e)}function fv(n,e,t){var r=n._state,i=n._scope;n.getters={},n._makeLocalGettersCache=Object.create(null);var s=n._wrappedGetters,o={},a={},l=T5(!0);l.run(function(){Ql(s,function(d,u){o[u]=o6(d,n),a[u]=mt(function(){return o[u]()}),Object.defineProperty(n.getters,u,{get:function(){return a[u].value},enumerable:!0})})}),n._state=yr({data:e}),n._scope=l,n.strict&&u6(n),r&&t&&n._withCommit(function(){r.data=null}),i&&i.stop()}function Ah(n,e,t,r,i){var s=!t.length,o=n._modules.getNamespace(t);if(r.namespaced&&(n._modulesNamespaceMap[o],n._modulesNamespaceMap[o]=r),!s&&!i){var a=gv(e,t.slice(0,-1)),l=t[t.length-1];n._withCommit(function(){a[l]=r.state})}var d=r.context=a6(n,o,t);r.forEachMutation(function(u,m){var f=o+m;l6(n,f,u,d)}),r.forEachAction(function(u,m){var f=u.root?m:o+m,g=u.handler||u;c6(n,f,g,d)}),r.forEachGetter(function(u,m){var f=o+m;d6(n,f,u,d)}),r.forEachChild(function(u,m){Ah(n,e,t.concat(m),u,i)})}function a6(n,e,t){var r=e==="",i={dispatch:r?n.dispatch:function(s,o,a){var l=Mp(s,o,a),d=l.payload,u=l.options,m=l.type;return(!u||!u.root)&&(m=e+m),n.dispatch(m,d)},commit:r?n.commit:function(s,o,a){var l=Mp(s,o,a),d=l.payload,u=l.options,m=l.type;(!u||!u.root)&&(m=e+m),n.commit(m,d,u)}};return Object.defineProperties(i,{getters:{get:r?function(){return n.getters}:function(){return i3(n,e)}},state:{get:function(){return gv(n.state,t)}}}),i}function i3(n,e){if(!n._makeLocalGettersCache[e]){var t={},r=e.length;Object.keys(n.getters).forEach(function(i){if(i.slice(0,r)===e){var s=i.slice(r);Object.defineProperty(t,s,{get:function(){return n.getters[i]},enumerable:!0})}}),n._makeLocalGettersCache[e]=t}return n._makeLocalGettersCache[e]}function l6(n,e,t,r){var i=n._mutations[e]||(n._mutations[e]=[]);i.push(function(o){t.call(n,r.state,o)})}function c6(n,e,t,r){var i=n._actions[e]||(n._actions[e]=[]);i.push(function(o){var a=t.call(n,{dispatch:r.dispatch,commit:r.commit,getters:r.getters,state:r.state,rootGetters:n.getters,rootState:n.state},o);return s6(a)||(a=Promise.resolve(a)),n._devtoolHook?a.catch(function(l){throw n._devtoolHook.emit("vuex:error",l),l}):a})}function d6(n,e,t,r){n._wrappedGetters[e]||(n._wrappedGetters[e]=function(s){return t(r.state,r.getters,s.state,s.getters)})}function u6(n){Zn(function(){return n._state.data},function(){},{deep:!0,flush:"sync"})}function gv(n,e){return e.reduce(function(t,r){return t[r]},n)}function Mp(n,e,t){return t3(n)&&n.type&&(t=e,e=n,n=n.type),{type:n,payload:e,options:t}}var p6="vuex bindings",fS="vuex:mutations",Im="vuex:actions",La="vuex",h6=0;function m6(n,e){r6({id:"org.vuejs.vuex",app:n,label:"Vuex",homepage:"https://next.vuex.vuejs.org/",logo:"https://vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:[p6]},function(t){t.addTimelineLayer({id:fS,label:"Vuex Mutations",color:gS}),t.addTimelineLayer({id:Im,label:"Vuex Actions",color:gS}),t.addInspector({id:La,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),t.on.getInspectorTree(function(r){if(r.app===n&&r.inspectorId===La)if(r.filter){var i=[];l3(i,e._modules.root,r.filter,""),r.rootNodes=i}else r.rootNodes=[a3(e._modules.root,"")]}),t.on.getInspectorState(function(r){if(r.app===n&&r.inspectorId===La){var i=r.nodeId;i3(e,i),r.state=_6(v6(e._modules,i),i==="root"?e.getters:e._makeLocalGettersCache,i)}}),t.on.editInspectorState(function(r){if(r.app===n&&r.inspectorId===La){var i=r.nodeId,s=r.path;i!=="root"&&(s=i.split("/").fi
`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&AP[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},SS=Symbol("internals");function gc(n){return n&&String(n).trim().toLowerCase()}function ip(n){return n===!1||n==null?n:Ie.isArray(n)?n.map(ip):String(n)}function MP(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const NP=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Dm(n,e,t,r,i){if(Ie.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Ie.isString(e)){if(Ie.isString(r))return e.indexOf(r)!==-1;if(Ie.isRegExp(r))return r.test(e)}}function kP(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function IP(n,e){const t=Ie.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}class Rr{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,d){const u=gc(l);if(!u)throw new Error("header name must be a non-empty string");const m=Ie.findKey(i,u);(!m||i[m]===void 0||d===!0||d===void 0&&i[m]!==!1)&&(i[m||l]=ip(a))}const o=(a,l)=>Ie.forEach(a,(d,u)=>s(d,u,l));if(Ie.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Ie.isString(e)&&(e=e.trim())&&!NP(e))o(RP(e),t);else if(Ie.isHeaders(e))for(const[a,l]of e.entries())s(l,a,r);else e!=null&&s(t,e,r);return this}get(e,t){if(e=gc(e),e){const r=Ie.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return MP(i);if(Ie.isFunction(t))return t.call(this,i,r);if(Ie.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=gc(e),e){const r=Ie.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Dm(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=gc(o),o){const a=Ie.findKey(r,o);a&&(!t||Dm(r,r[a],a,t))&&(delete r[a],i=!0)}}return Ie.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const s=t[r];(!e||Dm(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Ie.forEach(this,(i,s)=>{const o=Ie.findKey(r,s);if(o){t[o]=ip(i),delete t[s];return}const a=e?kP(s):String(s).trim();a!==s&&delete t[s],t[a]=ip(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ie.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Ie.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[SS]=this[SS]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=gc(o);r[a]||(IP(i,o),r[a]=!0)}return Ie.isArray(e)?e.forEach(s):s(e),this}}Rr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ie.reduceDescriptors(Rr.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Ie.freezeMethods(Rr);function Lm(n,e){const t=this||Cd,r=e||t,i=Rr.from(r.headers);let s=r.data;return Ie.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function C3(n){return!!(n&&n.__CANCEL__)}function Zl(n,e,t){Ft.call(this,n??"canceled",Ft.ERR_CANCELED,e,t),this.name="CanceledError"}Ie.inherits(Zl,Ft,{__CANCEL__:!0});function A3(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new Ft("Request failed with status code "+t.status,[Ft.ERR_BAD_REQUEST,Ft.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function OP(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function DP(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const d=Date.now(),u=r[s];o||(o=d),t[i]=l,r[i]=d;let m=s,f=0;for(;m!==i;)f+=t[m++],m=m%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),d-o<e)return;const g=u&&d-u;return g?Math.round(f*1e3/g):void 0}}function LP(n,e){let t=0,r=1e3/e,i,s;const o=(d,u=Date.now())=>{t=u,i=null,s&&(clearTimeout(s),s=null),n.apply(null,d)};return[(...d)=>{const u=Date.now(),m=u-t;m>=r?o(d,u):(i=d,s||(s=setTimeout(()=>{s=null,o(i)},r-m)))},()=>i&&o(i)]}const Np=(n,e,t=3)=>{let r=0;const i=DP(50,250);return LP(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,d=i(l),u=o<=a;r=o;const m={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:d||void 0,estimated:d&&a&&u?(a-o)/d:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(m)},t)},xS=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},TS=n=>(...e)=>Ie.asap(()=>n(...e)),PP=Ar.hasStandardBrowserEnv?function(){const e=Ar.navigator&&/(msie|trident)/i.test(Ar.navigator.userAgent),t=document.createElement("a");let r;function i(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(o){const a=Ie.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}(),FP=Ar.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Ie.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Ie.isString(r)&&o.push("path="+r),Ie.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function UP(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function BP(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function R3(n,e){return n&&!UP(e)?BP(n,e):e}const wS=n=>n instanceof Rr?{...n}:n;function ba(n,e){e=e||{};const t={};function r(d,u,m){return Ie.isPlainObject(d)&&Ie.isPlainObject(u)?Ie.merge.call({caseless:m},d,u):Ie.isPlainObject(u)?Ie.merge({},u):Ie.isArray(u)?u.slice():u}function i(d,u,m){if(Ie.isUndefined(u)){if(!Ie.isUndefined(d))return r(void 0,d,m)}else return r(d,u,m)}function s(d,u){if(!Ie.isUndefined(u))return r(void 0,u)}function o(d,u){if(Ie.isUndefined(u)){if(!Ie.isUndefined(d))return r(void 0,d)}else return r(void 0,u)}function a(d,u,m){if(m in e)return r(d,u);if(m in n
`+s.map(RS).join(`
`):" "+RS(s[0]):"as no adapter specified";throw new Ft("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:Xb};function Pm(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Zl(null,n)}function MS(n){return Pm(n),n.headers=Rr.from(n.headers),n.data=Lm.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),I3.getAdapter(n.adapter||Cd.adapter)(n).then(function(r){return Pm(n),r.data=Lm.call(n,n.transformResponse,r),r.headers=Rr.from(r.headers),r},function(r){return C3(r)||(Pm(n),r&&r.response&&(r.response.data=Lm.call(n,n.transformResponse,r.response),r.response.headers=Rr.from(r.response.headers))),Promise.reject(r)})}const O3="1.7.7",Ev={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{Ev[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const NS={};Ev.transitional=function(e,t,r){function i(s,o){return"[Axios v"+O3+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new Ft(i(o," has been removed"+(t?" in "+t:"")),Ft.ERR_DEPRECATED);return t&&!NS[o]&&(NS[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};function ZP(n,e,t){if(typeof n!="object")throw new Ft("options must be an object",Ft.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=n[s],l=a===void 0||o(a,s,n);if(l!==!0)throw new Ft("option "+s+" must be "+l,Ft.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Ft("Unknown option "+s,Ft.ERR_BAD_OPTION)}}const Zb={assertOptions:ZP,validators:Ev},Ws=Zb.validators;class ca{constructor(e){this.defaults=e,this.interceptors={request:new ES,response:new ES}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=ba(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&Zb.assertOptions(r,{silentJSONParsing:Ws.transitional(Ws.boolean),forcedJSONParsing:Ws.transitional(Ws.boolean),clarifyTimeoutError:Ws.transitional(Ws.boolean)},!1),i!=null&&(Ie.isFunction(i)?t.paramsSerializer={serialize:i}:Zb.assertOptions(i,{encode:Ws.function,serialize:Ws.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Ie.merge(s.common,s[t.method]);s&&Ie.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),t.headers=Rr.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(t)===!1||(l=l&&v.synchronous,a.unshift(v.fulfilled,v.rejected))});const d=[];this.interceptors.response.forEach(function(v){d.push(v.fulfilled,v.rejected)});let u,m=0,f;if(!l){const h=[MS.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,d),f=h.length,u=Promise.resolve(t);m<f;)u=u.then(h[m++],h[m++]);return u}f=a.length;let g=t;for(m=0;m<f;){const h=a[m++],v=a[m++];try{g=h(g)}catch(b){v.call(this,b);break}}try{u=MS.call(this,g)}catch(h){return Promise.reject(h)}for(m=0,f=d.length;m<f;)u=u.then(d[m++],d[m++]);return u}getUri(e){e=ba(this.defaults,e);const t=R3(e.baseURL,e.url);return x3(t,e.params,e.paramsSerializer)}}Ie.forEach(["delete","get","head","options"],function(e){ca.prototype[e]=function(t,r){return this.request(ba(r||{},{method:e,url:t,data:(r||{}).data}))}});Ie.forEach(["post","put","patch"],function(e){function t(r){return function(s,o,a){return this.request(ba(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}ca.prototype[e]=t(),ca.prototype[e+"Form"]=t(!0)});class Sv{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(s){t=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new Zl(s,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Sv(function(i){e=i}),cancel:e}}}function JP(n){return function(t){return n.apply(null,t)}}function e7(n){return Ie.isObject(n)&&n.isAxiosError===!0}const Jb={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticat
2024-11-04 00:22:50 +00:00
* vue-router v4.4.5
* (c) 2024 Eduardo San Martin Morote
* @license MIT
*/const rl=typeof document<"u";function L3(n){return typeof n=="object"||"displayName"in n||"props"in n||"__vccOpts"in n}function t7(n){return n.__esModule||n[Symbol.toStringTag]==="Module"||n.default&&L3(n.default)}const rn=Object.assign;function Fm(n,e){const t={};for(const r in e){const i=e[r];t[r]=ki(i)?i.map(n):n(i)}return t}const Gc=()=>{},ki=Array.isArray,P3=/#/g,n7=/&/g,r7=/\//g,i7=/=/g,s7=/\?/g,F3=/\+/g,o7=/%5B/g,a7=/%5D/g,U3=/%5E/g,l7=/%60/g,B3=/%7B/g,c7=/%7C/g,G3=/%7D/g,d7=/%20/g;function xv(n){return encodeURI(""+n).replace(c7,"|").replace(o7,"[").replace(a7,"]")}function u7(n){return xv(n).replace(B3,"{").replace(G3,"}").replace(U3,"^")}function e1(n){return xv(n).replace(F3,"%2B").replace(d7,"+").replace(P3,"%23").replace(n7,"%26").replace(l7,"`").replace(B3,"{").replace(G3,"}").replace(U3,"^")}function p7(n){return e1(n).replace(i7,"%3D")}function h7(n){return xv(n).replace(P3,"%23").replace(s7,"%3F")}function m7(n){return n==null?"":h7(n).replace(r7,"%2F")}function ld(n){try{return decodeURIComponent(""+n)}catch{}return""+n}const f7=/\/$/,g7=n=>n.replace(f7,"");function Um(n,e,t="/"){let r,i={},s="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return a<l&&a>=0&&(l=-1),l>-1&&(r=e.slice(0,l),s=e.slice(l+1,a>-1?a:e.length),i=n(s)),a>-1&&(r=r||e.slice(0,a),o=e.slice(a,e.length)),r=y7(r??e,t),{fullPath:r+(s&&"?")+s+o,path:r,query:i,hash:ld(o)}}function _7(n,e){const t=e.query?n(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function kS(n,e){return!e||!n.toLowerCase().startsWith(e.toLowerCase())?n:n.slice(e.length)||"/"}function b7(n,e,t){const r=e.matched.length-1,i=t.matched.length-1;return r>-1&&r===i&&Tl(e.matched[r],t.matched[i])&&z3(e.params,t.params)&&n(e.query)===n(t.query)&&e.hash===t.hash}function Tl(n,e){return(n.aliasOf||n)===(e.aliasOf||e)}function z3(n,e){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(!v7(n[t],e[t]))return!1;return!0}function v7(n,e){return ki(n)?IS(n,e):ki(e)?IS(e,n):n===e}function IS(n,e){return ki(e)?n.length===e.length&&n.every((t,r)=>t===e[r]):n.length===1&&n[0]===e}function y7(n,e){if(n.startsWith("/"))return n;if(!n)return e;const t=e.split("/"),r=n.split("/"),i=r[r.length-1];(i===".."||i===".")&&r.push("");let s=t.length-1,o,a;for(o=0;o<r.length;o++)if(a=r[o],a!==".")if(a==="..")s>1&&s--;else break;return t.slice(0,s).join("/")+"/"+r.slice(o).join("/")}const Ks={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var cd;(function(n){n.pop="pop",n.push="push"})(cd||(cd={}));var zc;(function(n){n.back="back",n.forward="forward",n.unknown=""})(zc||(zc={}));function E7(n){if(!n)if(rl){const e=document.querySelector("base");n=e&&e.getAttribute("href")||"/",n=n.replace(/^\w+:\/\/[^\/]+/,"")}else n="/";return n[0]!=="/"&&n[0]!=="#"&&(n="/"+n),g7(n)}const S7=/^[^#]+#/;function x7(n,e){return n.replace(S7,"#")+e}function T7(n,e){const t=document.documentElement.getBoundingClientRect(),r=n.getBoundingClientRect();return{behavior:e.behavior,left:r.left-t.left-(e.left||0),top:r.top-t.top-(e.top||0)}}const Oh=()=>({left:window.scrollX,top:window.scrollY});function w7(n){let e;if("el"in n){const t=n.el,r=typeof t=="string"&&t.startsWith("#"),i=typeof t=="string"?r?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!i)return;e=T7(i,n)}else e=n;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function OS(n,e){return(history.state?history.state.position-e:-1)+n}const t1=new Map;function C7(n,e){t1.set(n,e)}function A7(n){const e=t1.get(n);return t1.delete(n),e}let R7=()=>location.protocol+"//"+location.host;function V3(n,e){const{pathname:t,search:r,hash:i}=e,s=n.indexOf("#");if(s>-1){let a=i.includes(n.slice(s))?n.slice(s).length:1,l=i.slice(a);return l[0]!=="/"&&(l="/"+l),kS(l,"")}return kS(t,n)+r+i}function M7(n,e,t,r){let i=[],s=[],o=null;const a=({state:f})=>{const g=V3(n,location),h=t.value,v=e.value;let b=0;if(f){if(t.value=g,e.value=f,o&&o===h){o=null;return}b=v?f.position
2024-11-04 00:22:50 +00:00
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
2024-11-06 23:05:30 +00:00
*/(function(){var a=function(){function l(){}l.prototype=Object.create(null);function d(_,y){for(var E=y.length,x=0;x<E;++x)v(_,y[x])}var u={}.hasOwnProperty;function m(_,y){_[y]=!0}function f(_,y){for(var E in y)u.call(y,E)&&(_[E]=!!y[E])}var g=/\s+/;function h(_,y){for(var E=y.split(g),x=E.length,A=0;A<x;++A)_[E[A]]=!0}function v(_,y){if(y){var E=typeof y;E==="string"?h(_,y):Array.isArray(y)?d(_,y):E==="object"?f(_,y):E==="number"&&m(_,y)}}function b(){for(var _=arguments.length,y=Array(_),E=0;E<_;E++)y[E]=arguments[E];var x=new l;d(x,y);var A=[];for(var w in x)x[w]&&A.push(w);return A.join(" ")}return b}();typeof t<"u"&&t.exports?t.exports=a:(s=[],o=(function(){return a}).apply(r,s),o!==void 0&&(t.exports=o))})()},"./node_modules/core-js/es/array/from.js":function(t,r,i){i("./node_modules/core-js/modules/es.string.iterator.js"),i("./node_modules/core-js/modules/es.array.from.js");var s=i("./node_modules/core-js/internals/path.js");t.exports=s.Array.from},"./node_modules/core-js/internals/a-function.js":function(t,r){t.exports=function(i){if(typeof i!="function")throw TypeError(String(i)+" is not a function");return i}},"./node_modules/core-js/internals/an-object.js":function(t,r,i){var s=i("./node_modules/core-js/internals/is-object.js");t.exports=function(o){if(!s(o))throw TypeError(String(o)+" is not an object");return o}},"./node_modules/core-js/internals/array-from.js":function(t,r,i){var s=i("./node_modules/core-js/internals/bind-context.js"),o=i("./node_modules/core-js/internals/to-object.js"),a=i("./node_modules/core-js/internals/call-with-safe-iteration-closing.js"),l=i("./node_modules/core-js/internals/is-array-iterator-method.js"),d=i("./node_modules/core-js/internals/to-length.js"),u=i("./node_modules/core-js/internals/create-property.js"),m=i("./node_modules/core-js/internals/get-iterator-method.js");t.exports=function(g){var h=o(g),v=typeof this=="function"?this:Array,b=arguments.length,_=b>1?arguments[1]:void 0,y=_!==void 0,E=0,x=m(h),A,w,N,L;if(y&&(_=s(_,b>2?arguments[2]:void 0,2)),x!=null&&!(v==Array&&l(x)))for(L=x.call(h),w=new v;!(N=L.next()).done;E++)u(w,E,y?a(L,_,[N.value,E],!0):N.value);else for(A=d(h.length),w=new v(A);A>E;E++)u(w,E,y?_(h[E],E):h[E]);return w.length=E,w}},"./node_modules/core-js/internals/array-includes.js":function(t,r,i){var s=i("./node_modules/core-js/internals/to-indexed-object.js"),o=i("./node_modules/core-js/internals/to-length.js"),a=i("./node_modules/core-js/internals/to-absolute-index.js");t.exports=function(l){return function(d,u,m){var f=s(d),g=o(f.length),h=a(m,g),v;if(l&&u!=u){for(;g>h;)if(v=f[h++],v!=v)return!0}else for(;g>h;h++)if((l||h in f)&&f[h]===u)return l||h||0;return!l&&-1}}},"./node_modules/core-js/internals/bind-context.js":function(t,r,i){var s=i("./node_modules/core-js/internals/a-function.js");t.exports=function(o,a,l){if(s(o),a===void 0)return o;switch(l){case 0:return function(){return o.call(a)};case 1:return function(d){return o.call(a,d)};case 2:return function(d,u){return o.call(a,d,u)};case 3:return function(d,u,m){return o.call(a,d,u,m)}}return function(){return o.apply(a,arguments)}}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(t,r,i){var s=i("./node_modules/core-js/internals/an-object.js");t.exports=function(o,a,l,d){try{return d?a(s(l)[0],l[1]):a(l)}catch(m){var u=o.return;throw u!==void 0&&s(u.call(o)),m}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(t,r,i){var s=i("./node_modules/core-js/internals/well-known-symbol.js"),o=s("iterator"),a=!1;try{var l=0,d={next:function(){return{done:!!l++}},return:function(){a=!0}};d[o]=function(){return this},Array.from(d,function(){throw 2})}catch{}t.exports=function(u,m){if(!m&&!a)return!1;var f=!1;try{var g={};g[o]=function(){return{next:function(){return{done:f=!0}}}},u(g)}catch{}return f}},"./node_modules/core-js/internals/classof-raw.js":function(t,r){var i={}.toString;t.exports=function(s){return i.call(s).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":function(t,r,i){var s=i("./node_modules/core-js/internals/classof
`,nne="∄",rne="∄",ine="𝔑",sne="𝔫",one="≧̸",ane="≱",lne="≱",cne="≧̸",dne="⩾̸",une="⩾̸",pne="⋙̸",hne="≵",mne="≫⃒",fne="≯",gne="≯",_ne="≫̸",bne="↮",vne="⇎",yne="⫲",Ene="∋",Sne="⋼",xne="⋺",Tne="∋",wne="Њ",Cne="њ",Ane="↚",Rne="⇍",Mne="‥",Nne="≦̸",kne="≰",Ine="↚",One="⇍",Dne="↮",Lne="⇎",Pne="≰",Fne="≦̸",Une="⩽̸",Bne="⩽̸",Gne="≮",zne="⋘̸",Vne="≴",Hne="≪⃒",qne="≮",Yne="⋪",$ne="⋬",Wne="≪̸",Kne="∤",jne="",Qne=" ",Xne="𝕟",Zne="",Jne="⫬",ere="¬",tre="≢",nre="≭",rre="∦",ire="∉",sre="≠",ore="≂̸",are="∄",lre="≯",cre="≱",dre="≧̸",ure="≫̸",pre="≹",hre="⩾̸",mre="≵",fre="≎̸",gre="≏̸",_re="∉",bre="⋵̸",vre="⋹̸",yre="∉",Ere="⋷",Sre="⋶",xre="⧏̸",Tre="⋪",wre="⋬",Cre="≮",Are="≰",Rre="≸",Mre="≪̸",Nre="⩽̸",kre="≴",Ire="⪢̸",Ore="⪡̸",Dre="∌",Lre="∌",Pre="⋾",Fre="⋽",Ure="⊀",Bre="⪯̸",Gre="⋠",zre="∌",Vre="⧐̸",Hre="⋫",qre="⋭",Yre="⊏̸",$re="⋢",Wre="⊐̸",Kre="⋣",jre="⊂⃒",Qre="⊈",Xre="⊁",Zre="⪰̸",Jre="⋡",eie="≿̸",tie="⊃⃒",nie="⊉",rie="≁",iie="≄",sie="≇",oie="≉",aie="∤",lie="∦",cie="∦",die="⫽⃥",uie="∂̸",pie="⨔",hie="⊀",mie="⋠",fie="⊀",gie="⪯̸",_ie="⪯̸",bie="⤳̸",vie="↛",yie="⇏",Eie="↝̸",Sie="↛",xie="⇏",Tie="⋫",wie="⋭",Cie="⊁",Aie="⋡",Rie="⪰̸",Mie="𝒩",Nie="𝓃",kie="∤",Iie="∦",Oie="≁",Die="≄",Lie="≄",Pie="∤",Fie="∦",Uie="⋢",Bie="⋣",Gie="⊄",zie="⫅̸",Vie="⊈",Hie="⊂⃒",qie="⊈",Yie="⫅̸",$ie="⊁",Wie="⪰̸",Kie="⊅",jie="⫆̸",Qie="⊉",Xie="⊃⃒",Zie="⊉",Jie="⫆̸",ese="≹",tse="Ñ",nse="ñ",rse="≸",ise="⋪",sse="⋬",ose="⋫",ase="⋭",lse="Ν",cse="ν",dse="#",use="№",pse="",hse="≍⃒",mse="⊬",fse="⊭",gse="⊮",_se="⊯",bse="≥⃒",vse=">⃒",yse="⤄",Ese="⧞",Sse="⤂",xse="≤⃒",Tse="<⃒",wse="⊴⃒",Cse="⤃",Ase="⊵⃒",Rse="∼⃒",Mse="⤣",Nse="↖",kse="⇖",Ise="↖",Ose="⤧",Dse="Ó",Lse="ó",Pse="⊛",Fse="Ô",Use="ô",Bse="⊚",Gse="О",zse="о",Vse="⊝",Hse="Ő",qse="ő",Yse="⨸",$se="⊙",Wse="⦼",Kse="Œ",jse="œ",Qse="⦿",Xse="𝔒",Zse="𝔬",Jse="˛",eoe="Ò",toe="ò",noe="⧁",roe="⦵",ioe="Ω",soe="∮",ooe="↺",aoe="⦾",loe="⦻",coe="‾",doe="⧀",uoe="Ō",poe="ō",hoe="Ω",moe="ω",foe="Ο",goe="ο",_oe="⦶",boe="⊖",voe="𝕆",yoe="𝕠",Eoe="⦷",Soe="“",xoe="",Toe="⦹",woe="⊕",Coe="↻",Aoe="⩔",Roe="",Moe="⩝",Noe="",koe="",Ioe="ª",Ooe="º",Doe="⊶",Loe="⩖",Poe="⩗",Foe="⩛",Uoe="Ⓢ",Boe="𝒪",Goe="",zoe="Ø",Voe="ø",Hoe="⊘",qoe="Õ",Yoe="õ",$oe="⨶",Woe="⨷",Koe="⊗",joe="Ö",Qoe="ö",Xoe="⌽",Zoe="‾",Joe="⏞",eae="⎴",tae="⏜",nae="¶",rae="∥",iae="∥",sae="⫳",oae="⫽",aae="∂",lae="∂",cae="П",dae="п",uae="%",pae=".",hae="‰",mae="⊥",fae="‱",gae="𝔓",_ae="𝔭",bae="Φ",vae="φ",yae="ϕ",Eae="",Sae="☎",xae="Π",Tae="π",wae="⋔",Cae="ϖ",Aae="ℏ",Rae="",Mae="ℏ",Nae="⨣",kae="⊞",Iae="⨢",Oae="+",Dae="∔",Lae="⨥",Pae="⩲",Fae="±",Uae="±",Bae="⨦",Gae="⨧",zae="±",Vae="",Hae="⨕",qae="𝕡",Yae="",$ae="£",Wae="⪷",Kae="⪻",jae="≺",Qae="≼",Xae="⪷",Zae="≺",Jae="≼",ele="≺",tle="⪯",nle="≼",rle="≾",ile="⪯",sle="⪹",ole="⪵",ale="⋨",lle="⪯",cle="⪳",dle="≾",ule="",ple="″",hle="",mle="⪹",fle="⪵",gle="⋨",_le="∏",ble="∏",vle="⌮",yle="⌒",Ele="⌓",Sle="∝",xle="∝",Tle="∷",wle="∝",Cle="≾",Ale="⊰",Rle="𝒫",Mle="𝓅",Nle="Ψ",kle="ψ",Ile="",Ole="𝔔",Dle="𝔮",Lle="⨌",Ple="𝕢",Fle="",Ule="⁗",Ble="𝒬",Gle="𝓆",zle="",Vle="⨖",Hle="?",qle="≟",Yle='"',$le='"',Wle="⇛",Kle="∽̱",jle="Ŕ",Qle="ŕ",Xle="√",Zle="⦳",Jle="⟩",ece="⟫",tce="⦒",nce="⦥",rce="⟩",ice="»",sce="⥵",oce="⇥",ace="⤠",lce="⤳",cce="→",dce="↠",uce="⇒",pce="⤞",hce="↪",mce="↬",fce="⥅",gce="⥴",_ce="⤖",bce="↣",vce="↝",yce="⤚",Ece="⤜",Sce="",xce="",Tce="⤍",wce=
`," "],tve=["{","}","|","\\","^","`"].concat(eve),nve=["'"].concat(tve),XS=["%","/","?",";","#"].concat(nve),ZS=["/","?","#"],rve=255,JS=/^[+a-z0-9A-Z_-]{0,63}$/,ive=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,e2={javascript:!0,"javascript:":!0},t2={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function sve(n,e){if(n&&n instanceof Op)return n;var t=new Op;return t.parse(n,e),t}Op.prototype.parse=function(n,e){var t,r,i,s,o,a=n;if(a=a.trim(),!e&&n.split("#").length===1){var l=J1e.exec(a);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}var d=X1e.exec(a);if(d&&(d=d[0],i=d.toLowerCase(),this.protocol=d,a=a.substr(d.length)),(e||d||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=a.substr(0,2)==="//",o&&!(d&&e2[d])&&(a=a.substr(2),this.slashes=!0)),!e2[d]&&(o||d&&!t2[d])){var u=-1;for(t=0;t<ZS.length;t++)s=a.indexOf(ZS[t]),s!==-1&&(u===-1||s<u)&&(u=s);var m,f;for(u===-1?f=a.lastIndexOf("@"):f=a.lastIndexOf("@",u),f!==-1&&(m=a.slice(0,f),a=a.slice(f+1),this.auth=m),u=-1,t=0;t<XS.length;t++)s=a.indexOf(XS[t]),s!==-1&&(u===-1||s<u)&&(u=s);u===-1&&(u=a.length),a[u-1]===":"&&u--;var g=a.slice(0,u);a=a.slice(u),this.parseHost(g),this.hostname=this.hostname||"";var h=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!h){var v=this.hostname.split(/\./);for(t=0,r=v.length;t<r;t++){var b=v[t];if(b&&!b.match(JS)){for(var _="",y=0,E=b.length;y<E;y++)b.charCodeAt(y)>127?_+="x":_+=b[y];if(!_.match(JS)){var x=v.slice(0,t),A=v.slice(t+1),w=b.match(ive);w&&(x.push(w[1]),A.unshift(w[2])),A.length&&(a=A.join(".")+a),this.hostname=x.join(".");break}}}}this.hostname.length>rve&&(this.hostname=""),h&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var N=a.indexOf("#");N!==-1&&(this.hash=a.substr(N),a=a.slice(0,N));var L=a.indexOf("?");return L!==-1&&(this.search=a.substr(L),a=a.slice(0,L)),a&&(this.pathname=a),t2[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Op.prototype.parseHost=function(n){var e=Z1e.exec(n);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),n=n.substr(0,n.length-e.length)),n&&(this.hostname=n)};var ove=sve;Jl.encode=W1e;Jl.decode=j1e;Jl.format=Q1e;Jl.parse=ove;var Vo={},zm,n2;function eN(){return n2||(n2=1,zm=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),zm}var Vm,r2;function tN(){return r2||(r2=1,Vm=/[\0-\x1F\x7F-\x9F]/),Vm}var Hm,i2;function ave(){return i2||(i2=1,Hm=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/),Hm}var qm,s2;function nN(){return s2||(s2=1,qm=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),qm}var o2;function lve(){return o2||(o2=1,Vo.Any=eN(),Vo.Cc=tN(),Vo.Cf=ave(),Vo.P=Cv,Vo.Z=nN()),Vo}(function(n){function e(D){return Object.prototype.toString.call(D)}function t(D){return e(D)==="[object String]"}var r=Object.prototype.hasOwnProperty;function i(D,$){return r.call(D,$)}function s(D){var $=Array.prototype.slice.call(arguments,1);return $.forEach(function(K){if(K){if(typeof K!="object")throw new TypeError(K+"must be object");Object.keys(K).forEach(function(B){D[B]=K[B]})}}),D}function o(D,$,K){return[].concat(D.slice(0,$),K,D.slice($+1))}function a(D){return!(D>=55296&&D<=57343||D>=64976&&D<=65007||(D&65535)===65535||(D&65535)===65534||D>=0&&D<=8||D===11||D>=14&&D<=31||D>=127&&D<=159||D>1114111)}function l(D){if(D>65535){D-=65536;var $=55296+(D>>10),K=56320+(D&1023);return String.fromCharCode($,K)}return String.fromCharCode(D)}var d=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,u=/&([a-z#][a-z0-9]{1,31});/gi,m=new RegExp(d.source+"|"+u.source,"gi"),f=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i,g=J3;function h(D,$){var K;return i(g,$)?g[$]:$.charCodeAt(0)===35&&f.test($)&&(K=$[1].toLowerCase()==="x"?parseInt($.slice(2),16):parseInt($.slice(1),10),a(K))?l(K):D}function v(D){return D.indexOf("\\")<0?D:D.replace(d,"$1")}function b(D){return D.indexOf("\\")<0&&D.indexOf("&"
`};ts.fence=function(n,e,t,r,i){var s=n[e],o=s.info?mve(s.info).trim():"",a="",l="",d,u,m,f,g;return o&&(m=o.split(/(\s+)/g),a=m[0],l=m.slice(2).join("")),t.highlight?d=t.highlight(s.content,a,l)||va(s.content):d=va(s.content),d.indexOf("<pre")===0?d+`
2024-11-04 00:22:50 +00:00
`:o?(u=s.attrIndex("class"),f=s.attrs?s.attrs.slice():[],u<0?f.push(["class",t.langPrefix+a]):(f[u]=f[u].slice(),f[u][1]+=" "+t.langPrefix+a),g={attrs:f},"<pre><code"+i.renderAttrs(g)+">"+d+`</code></pre>
`):"<pre><code"+i.renderAttrs(s)+">"+d+`</code></pre>
`};ts.image=function(n,e,t,r,i){var s=n[e];return s.attrs[s.attrIndex("alt")][1]=i.renderInlineAsText(s.children,t,r),i.renderToken(n,e,t)};ts.hardbreak=function(n,e,t){return t.xhtmlOut?`<br />
2024-11-04 00:22:50 +00:00
`:`<br>
`};ts.softbreak=function(n,e,t){return t.breaks?t.xhtmlOut?`<br />
2024-11-04 00:22:50 +00:00
`:`<br>
`:`
`};ts.text=function(n,e){return va(n[e].content)};ts.html_block=function(n,e){return n[e].content};ts.html_inline=function(n,e){return n[e].content};function ec(){this.rules=hve({},ts)}ec.prototype.renderAttrs=function(e){var t,r,i;if(!e.attrs)return"";for(i="",t=0,r=e.attrs.length;t<r;t++)i+=" "+va(e.attrs[t][0])+'="'+va(e.attrs[t][1])+'"';return i};ec.prototype.renderToken=function(e,t,r){var i,s="",o=!1,a=e[t];return a.hidden?"":(a.block&&a.nesting!==-1&&t&&e[t-1].hidden&&(s+=`
2024-11-04 00:22:50 +00:00
`),s+=(a.nesting===-1?"</":"<")+a.tag,s+=this.renderAttrs(a),a.nesting===0&&r.xhtmlOut&&(s+=" /"),a.block&&(o=!0,a.nesting===1&&t+1<e.length&&(i=e[t+1],(i.type==="inline"||i.hidden||i.nesting===-1&&i.tag===a.tag)&&(o=!1))),s+=o?`>
2024-11-06 23:05:30 +00:00
`:">",s)};ec.prototype.renderInline=function(n,e,t){for(var r,i="",s=this.rules,o=0,a=n.length;o<a;o++)r=n[o].type,typeof s[r]<"u"?i+=s[r](n,o,e,t,this):i+=this.renderToken(n,o,e);return i};ec.prototype.renderInlineAsText=function(n,e,t){for(var r="",i=0,s=n.length;i<s;i++)n[i].type==="text"?r+=n[i].content:n[i].type==="image"?r+=this.renderInlineAsText(n[i].children,e,t):n[i].type==="softbreak"&&(r+=`
`);return r};ec.prototype.render=function(n,e,t){var r,i,s,o="",a=this.rules;for(r=0,i=n.length;r<i;r++)s=n[r].type,s==="inline"?o+=this.renderInline(n[r].children,e,t):typeof a[s]<"u"?o+=a[s](n,r,e,t,this):o+=this.renderToken(n,r,e,t);return o};var fve=ec;function Di(){this.__rules__=[],this.__cache__=null}Di.prototype.__find__=function(n){for(var e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===n)return e;return-1};Di.prototype.__compile__=function(){var n=this,e=[""];n.__rules__.forEach(function(t){t.enabled&&t.alt.forEach(function(r){e.indexOf(r)<0&&e.push(r)})}),n.__cache__={},e.forEach(function(t){n.__cache__[t]=[],n.__rules__.forEach(function(r){r.enabled&&(t&&r.alt.indexOf(t)<0||n.__cache__[t].push(r.fn))})})};Di.prototype.at=function(n,e,t){var r=this.__find__(n),i=t||{};if(r===-1)throw new Error("Parser rule not found: "+n);this.__rules__[r].fn=e,this.__rules__[r].alt=i.alt||[],this.__cache__=null};Di.prototype.before=function(n,e,t,r){var i=this.__find__(n),s=r||{};if(i===-1)throw new Error("Parser rule not found: "+n);this.__rules__.splice(i,0,{name:e,enabled:!0,fn:t,alt:s.alt||[]}),this.__cache__=null};Di.prototype.after=function(n,e,t,r){var i=this.__find__(n),s=r||{};if(i===-1)throw new Error("Parser rule not found: "+n);this.__rules__.splice(i+1,0,{name:e,enabled:!0,fn:t,alt:s.alt||[]}),this.__cache__=null};Di.prototype.push=function(n,e,t){var r=t||{};this.__rules__.push({name:n,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null};Di.prototype.enable=function(n,e){Array.isArray(n)||(n=[n]);var t=[];return n.forEach(function(r){var i=this.__find__(r);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[i].enabled=!0,t.push(r)},this),this.__cache__=null,t};Di.prototype.enableOnly=function(n,e){Array.isArray(n)||(n=[n]),this.__rules__.forEach(function(t){t.enabled=!1}),this.enable(n,e)};Di.prototype.disable=function(n,e){Array.isArray(n)||(n=[n]);var t=[];return n.forEach(function(r){var i=this.__find__(r);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[i].enabled=!1,t.push(r)},this),this.__cache__=null,t};Di.prototype.getRules=function(n){return this.__cache__===null&&this.__compile__(),this.__cache__[n]||[]};var Av=Di,gve=/\r\n?|\n/g,_ve=/\0/g,bve=function(e){var t;t=e.src.replace(gve,`
`),t=t.replace(_ve,"<22>"),e.src=t},vve=function(e){var t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)},yve=function(e){var t=e.tokens,r,i,s;for(i=0,s=t.length;i<s;i++)r=t[i],r.type==="inline"&&e.md.inline.parse(r.content,e.md,e.env,r.children)},Eve=Jt.arrayReplaceAt;function Sve(n){return/^<a[>\s]/i.test(n)}function xve(n){return/^<\/a\s*>/i.test(n)}var Tve=function(e){var t,r,i,s,o,a,l,d,u,m,f,g,h,v,b,_,y=e.tokens,E;if(e.md.options.linkify){for(r=0,i=y.length;r<i;r++)if(!(y[r].type!=="inline"||!e.md.linkify.pretest(y[r].content)))for(s=y[r].children,h=0,t=s.length-1;t>=0;t--){if(a=s[t],a.type==="link_close"){for(t--;s[t].level!==a.level&&s[t].type!=="link_open";)t--;continue}if(a.type==="html_inline"&&(Sve(a.content)&&h>0&&h--,xve(a.content)&&h++),!(h>0)&&a.type==="text"&&e.md.linkify.test(a.content)){for(u=a.content,E=e.md.linkify.match(u),l=[],g=a.level,f=0,E.length>0&&E[0].index===0&&t>0&&s[t-1].type==="text_special"&&(E=E.slice(1)),d=0;d<E.length;d++)v=E[d].url,b=e.md.normalizeLink(v),e.md.validateLink(b)&&(_=E[d].text,E[d].schema?E[d].schema==="mailto:"&&!/^mailto:/i.test(_)?_=e.md.normalizeLinkText("mailto:"+_).replace(/^mailto:/,""):_=e.md.normalizeLinkText(_):_=e.md.normalizeLinkText("http://"+_).replace(/^http:\/\//,""),m=E[d].index,m>f&&(o=new e.Token("text","",0),o.content=u.slice(f,m),o.level=g,l.push(o)),o=new e.Token("link_open","a",1),o.attrs=[["href",b]],o.level=g++,o.markup="linkify",o.info="auto",l.push(o),o=new e.Token("text","",0),o.content=_,o.level=g,l.push(o),o=new e.Token("link_close","a",-1),o.level=--g,o.markup="linkify",o.info="auto",l.push(o),f=E[d].lastIndex);f<u.length&&(o=new e.Token("text","",0),o.content=u.slice(f),o.level=g,l.push(o)),y[r].children=s=Eve(s,t,l)}}}},rN=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,wve=/\((c|tm|r)\)/i,Cve=/\((c|tm|r)\)/ig,Ave={c:"©",r:"®",tm:"™"};function Rve(n,e){return Ave[e.toLowerCase()]}function Mve(n){var e,t,r=0;for(e=n.length-1;e>=0;e--)t=n[e],t.type==="text"&&!r&&(t.content=t.content.replace(Cve,Rve)),t.type==="link_open"&&t.info==="auto"&&r--,t.type==="link_close"&&t.info==="auto"&&r++}function Nve(n){var e,t,r=0;for(e=n.length-1;e>=0;e--)t=n[e],t.type==="text"&&!r&&rN.test(t.content)&&(t.content=t.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1")),t.type==="link_open"&&t.info==="auto"&&r--,t.type==="link_close"&&t.info==="auto"&&r++}var kve=function(e){var t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(wve.test(e.tokens[t].content)&&Mve(e.tokens[t].children),rN.test(e.tokens[t].content)&&Nve(e.tokens[t].children))},l2=Jt.isWhiteSpace,c2=Jt.isPunctChar,d2=Jt.isMdAsciiPunct,Ive=/['"]/,u2=/['"]/g,p2="";function eu(n,e,t){return n.slice(0,e)+t+n.slice(e+1)}function Ove(n,e){var t,r,i,s,o,a,l,d,u,m,f,g,h,v,b,_,y,E,x,A,w;for(x=[],t=0;t<n.length;t++){for(r=n[t],l=n[t].level,y=x.length-1;y>=0&&!(x[y].level<=l);y--);if(x.length=y+1,r.type==="text"){i=r.content,o=0,a=i.length;e:for(;o<a&&(u2.lastIndex=o,s=u2.exec(i),!!s);){if(b=_=!0,o=s.index+1,E=s[0]==="'",u=32,s.index-1>=0)u=i.charCodeAt(s.index-1);else for(y=t-1;y>=0&&!(n[y].type==="softbreak"||n[y].type==="hardbreak");y--)if(n[y].content){u=n[y].content.charCodeAt(n[y].content.length-1);break}if(m=32,o<a)m=i.charCodeAt(o);else for(y=t+1;y<n.length&&!(n[y].type==="softbreak"||n[y].type==="hardbreak");y++)if(n[y].content){m=n[y].content.charCodeAt(0);break}if(f=d2(u)||c2(String.fromCharCode(u)),g=d2(m)||c2(String.fromCharCode(m)),h=l2(u),v=l2(m),v?b=!1:g&&(h||f||(b=!1)),h?_=!1:f&&(v||g||(_=!1)),m===34&&s[0]==='"'&&u>=48&&u<=57&&(_=b=!1),b&&_&&(b=f,_=g),!b&&!_){E&&(r.content=eu(r.content,s.index,p2));continue}if(_){for(y=x.length-1;y>=0&&(d=x[y],!(x[y].level<l));y--)if(d.single===E&&x[y].level===l){d=x[y],E?(A=e.md.options.quotes[2],w=e.md.options.quotes[
`,o.map=[t,e.line],!0},Vve=function(e,t,r,i){var s,o,a,l,d,u,m,f=!1,g=e.bMarks[t]+e.tShift[t],h=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||g+3>h||(s=e.src.charCodeAt(g),s!==126&&s!==96)||(d=g,g=e.skipChars(g,s),o=g-d,o<3)||(m=e.src.slice(d,g),a=e.src.slice(g,h),s===96&&a.indexOf(String.fromCharCode(s))>=0))return!1;if(i)return!0;for(l=t;l++,!(l>=r||(g=d=e.bMarks[l]+e.tShift[l],h=e.eMarks[l],g<h&&e.sCount[l]<e.blkIndent));)if(e.src.charCodeAt(g)===s&&!(e.sCount[l]-e.blkIndent>=4)&&(g=e.skipChars(g,s),!(g-d<o)&&(g=e.skipSpaces(g),!(g<h)))){f=!0;break}return o=e.sCount[t],e.line=l+(f?1:0),u=e.push("fence","code",0),u.info=a,u.content=e.getLines(t+1,l,o,!0),u.markup=m,u.map=[t,e.line],!0},Hve=Jt.isSpace,qve=function(e,t,r,i){var s,o,a,l,d,u,m,f,g,h,v,b,_,y,E,x,A,w,N,L,C=e.lineMax,k=e.bMarks[t]+e.tShift[t],H=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(k)!==62)return!1;if(i)return!0;for(h=[],v=[],y=[],E=[],w=e.md.block.ruler.getRules("blockquote"),_=e.parentType,e.parentType="blockquote",f=t;f<r&&(L=e.sCount[f]<e.blkIndent,k=e.bMarks[f]+e.tShift[f],H=e.eMarks[f],!(k>=H));f++){if(e.src.charCodeAt(k++)===62&&!L){for(l=e.sCount[f]+1,e.src.charCodeAt(k)===32?(k++,l++,s=!1,x=!0):e.src.charCodeAt(k)===9?(x=!0,(e.bsCount[f]+l)%4===3?(k++,l++,s=!1):s=!0):x=!1,g=l,h.push(e.bMarks[f]),e.bMarks[f]=k;k<H&&(o=e.src.charCodeAt(k),Hve(o));){o===9?g+=4-(g+e.bsCount[f]+(s?1:0))%4:g++;k++}u=k>=H,v.push(e.bsCount[f]),e.bsCount[f]=e.sCount[f]+1+(x?1:0),y.push(e.sCount[f]),e.sCount[f]=g-l,E.push(e.tShift[f]),e.tShift[f]=k-e.bMarks[f];continue}if(u)break;for(A=!1,a=0,d=w.length;a<d;a++)if(w[a](e,f,r,!0)){A=!0;break}if(A){e.lineMax=f,e.blkIndent!==0&&(h.push(e.bMarks[f]),v.push(e.bsCount[f]),E.push(e.tShift[f]),y.push(e.sCount[f]),e.sCount[f]-=e.blkIndent);break}h.push(e.bMarks[f]),v.push(e.bsCount[f]),E.push(e.tShift[f]),y.push(e.sCount[f]),e.sCount[f]=-1}for(b=e.blkIndent,e.blkIndent=0,N=e.push("blockquote_open","blockquote",1),N.markup=">",N.map=m=[t,0],e.md.block.tokenize(e,t,f),N=e.push("blockquote_close","blockquote",-1),N.markup=">",e.lineMax=C,e.parentType=_,m[1]=e.line,a=0;a<E.length;a++)e.bMarks[a+t]=h[a],e.tShift[a+t]=E[a],e.sCount[a+t]=y[a],e.bsCount[a+t]=v[a];return e.blkIndent=b,!0},Yve=Jt.isSpace,$ve=function(e,t,r,i){var s,o,a,l,d=e.bMarks[t]+e.tShift[t],u=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||(s=e.src.charCodeAt(d++),s!==42&&s!==45&&s!==95))return!1;for(o=1;d<u;){if(a=e.src.charCodeAt(d++),a!==s&&!Yve(a))return!1;a===s&&o++}return o<3?!1:(i||(e.line=t+1,l=e.push("hr","hr",0),l.map=[t,e.line],l.markup=Array(o+1).join(String.fromCharCode(s))),!0)},sN=Jt.isSpace;function m2(n,e){var t,r,i,s;return r=n.bMarks[e]+n.tShift[e],i=n.eMarks[e],t=n.src.charCodeAt(r++),t!==42&&t!==45&&t!==43||r<i&&(s=n.src.charCodeAt(r),!sN(s))?-1:r}function f2(n,e){var t,r=n.bMarks[e]+n.tShift[e],i=r,s=n.eMarks[e];if(i+1>=s||(t=n.src.charCodeAt(i++),t<48||t>57))return-1;for(;;){if(i>=s)return-1;if(t=n.src.charCodeAt(i++),t>=48&&t<=57){if(i-r>=10)return-1;continue}if(t===41||t===46)break;return-1}return i<s&&(t=n.src.charCodeAt(i),!sN(t))?-1:i}function Wve(n,e){var t,r,i=n.level+2;for(t=e+2,r=n.tokens.length-2;t<r;t++)n.tokens[t].level===i&&n.tokens[t].type==="paragraph_open"&&(n.tokens[t+2].hidden=!0,n.tokens[t].hidden=!0,t+=2)}var Kve=function(e,t,r,i){var s,o,a,l,d,u,m,f,g,h,v,b,_,y,E,x,A,w,N,L,C,k,H,q,ie,D,$,K=t,B=!1,Z=!0;if(e.sCount[K]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[K]-e.listIndent>=4&&e.sCount[K]<e.blkIndent)return!1;if(i&&e.parentType==="paragraph"&&e.sCount[K]>=e.blkIndent&&(B=!0),(k=f2(e,K))>=0){if(m=!0,q=e.bMarks[K]+e.tShift[K],_=Number(e.src.slice(q,k-1)),B&&_!==1)return!1}else if((k=m2(e,K))>=0)m=!1;else return!1;if(B&&e.skipSpaces(k)>=e.eMarks[K])return!1;if(i)return!0;for(b=e.src.charCodeAt(k-1),v=e.tokens.length,m?($=e.push("ordered_list_open","ol",1),_!==1&&($.attrs=[["start",_]])):$=e.push("bullet_list_open","ul",1),$.map=h=[K,0],$.markup=String.fromCharCode(b),H=!1,D=e.md.block.ruler.getRules("list"),A=e.parentType,e.parentType="list";K<r;){for(C=k,y=e.eMarks[K],u=E=e.sCount[K]+k-(e.bMarks[K]+e.tShift[K]);C<y;)
2024-11-04 00:22:50 +00:00
`})),r.tokens.splice(i+3+u.length+1,0,Object.assign(new r.Token("html_block","",0),{content:e.wrapper[1]+`
2024-11-06 23:05:30 +00:00
`})))});function O2(n,e,t,r){var i=n,s=r;if(t&&Object.prototype.hasOwnProperty.call(e,i))throw new Error("User defined `id` attribute `"+n+"` is not unique. Please fix it in your Markdown to continue.");for(;Object.prototype.hasOwnProperty.call(e,i);)i=n+"-"+s,s+=1;return e[i]=!0,i}function sl(n,e){e=Object.assign({},sl.defaults,e),n.core.ruler.push("anchor",function(t){for(var r,i={},s=t.tokens,o=Array.isArray(e.level)?(r=e.level,function(m){return r.includes(m)}):function(m){return function(f){return f>=m}}(e.level),a=0;a<s.length;a++){var l=s[a];if(l.type==="heading_open"&&o(Number(l.tag.substr(1)))){var d=e.getTokensText(s[a+1].children),u=l.attrGet("id");u=u==null?O2(e.slugify(d),i,!1,e.uniqueSlugStartIndex):O2(u,i,!0,e.uniqueSlugStartIndex),l.attrSet("id",u),e.tabIndex!==!1&&l.attrSet("tabindex",""+e.tabIndex),typeof e.permalink=="function"?e.permalink(u,e,t,a):(e.permalink||e.renderPermalink&&e.renderPermalink!==s1)&&e.renderPermalink(u,e,t,a),a=s.indexOf(l),e.callback&&e.callback(l,{slug:u,title:d})}}})}Object.assign(I2.defaults,{style:"visually-hidden",space:!0,placement:"after",wrapper:null}),sl.permalink={__proto__:null,legacy:s1,renderHref:yN,renderAttrs:EN,makePermalink:Md,linkInsideHeader:Hh,ariaHidden:Xo,headerLink:SN,linkAfterHeader:I2},sl.defaults={level:1,slugify:function(n){return encodeURIComponent(String(n).trim().toLowerCase().replace(/\s+/g,"-"))},uniqueSlugStartIndex:1,tabIndex:"-1",getTokensText:function(n){return n.filter(function(e){return["text","code_inline"].includes(e.type)}).map(function(e){return e.content}).join("")},permalink:!1,renderPermalink:s1,permalinkClass:Xo.defaults.class,permalinkSpace:Xo.defaults.space,permalinkSymbol:"¶",permalinkBefore:Xo.defaults.placement==="before",permalinkHref:Xo.defaults.renderHref,permalinkAttrs:Xo.defaults.renderAttrs},sl.default=sl;function Bs(){this.__highest_alphabet__=0,this.__match_alphabets__={},this.__initial_state__=0,this.__accept_states__={},this.__transitions__={},this.__actions__={}}Bs.prototype.set_highest_alphabet=function(n){this.__highest_alphabet__=n};Bs.prototype.set_match_alphabets=function(n){this.__match_alphabets__=n};Bs.prototype.set_initial_state=function(n){this.__initial_state__=n};Bs.prototype.set_accept_states=function(n){for(var e=0;e<n.length;e++)this.__accept_states__[n[e]]=!0};Bs.prototype.set_transitions=function(n){this.__transitions__=n};Bs.prototype.set_actions=function(n){this.__actions__=n};Bs.prototype.update_transition=function(n,e){this.__transitions__[n]=Object.assign(this.__transitions__[n]||Object(),e)};Bs.prototype.execute=function(n,e){var t,r,i;for(t=this.__initial_state__,r=n;t&&r<e;r++){for(i=this.__highest_alphabet__;i>0&&!(t&i&&this.__match_alphabets__[i].call(this,r,t,i));i>>=4);if(this.__actions__(r,t,i),i===0)break;t=this.__transitions__[t][i]||0}return!!this.__accept_states__[t]};var VWe=Bs,HWe=VWe,qWe=function(e,t){var r={multiline:!1,rowspan:!1,headerless:!1,multibody:!0,autolabel:!0};t=e.utils.assign({},r,t||{});function i(u,m){var f=u.bMarks[m]+u.sCount[m],g=u.bMarks[m]+u.blkIndent,h=u.skipSpacesBack(u.eMarks[m],g),v=[],b,_,y=!1,E=!1,x=0;for(b=f;b<h;b++)switch(u.src.charCodeAt(b)){case 92:y=!0;break;case 96:_=u.skipChars(b,96)-1,_>b?(E||(x===0?x=_-b:x===_-b&&(x=0)),b=_):(E||!y&&!x)&&(E=!E),y=!1;break;case 124:!E&&!y&&v.push(b),y=!1;break;default:y=!1;break}return v.length===0||(v[0]>g&&v.unshift(g-1),v[v.length-1]<h-1&&v.push(h)),v}function s(u,m,f){var g={text:null,label:null},h=u.bMarks[f]+u.sCount[f],v=u.eMarks[f],b=/^\[(.+?)\](\[([^\[\]]+)\])?\s*$/,_=u.src.slice(h,v).match(b);return _?m?!0:(g.text=_[1],!t.autolabel&&!_[2]||(g.label=_[2]||_[1],g.label=g.label.toLowerCase().replace(/\W+/g,"")),g):!1}function o(u,m,f){var g={bounds:null,multiline:null},h=i(u,f),v,b,_;return h.length<2?!1:m?!0:(g.bounds=h,t.multiline&&(v=u.bMarks[f]+u.sCount[f],b=u.eMarks[f]-1,g.multiline=u.src.charCodeAt(b)===92,g.multiline&&(_=u.eMarks[f],u.eMarks[f]=u.skipSpacesBack(b,v),g.bounds=i(u,f),u.eMarks[f]=_)),g)}function a(u,m,f){var g={aligns:[],wraps:[]},h=i(u,f),v=/^:?(-+|=+):?\+?$/,b,_,y;if(u.sCount[f]-u.bl
`),u.md,u.env,[]),B.level=E.level+1,u.md.block.tokenize(B,E.map[0],B.lineMax),K=0;K<B.tokens.length;K++)u.tokens.push(B.tokens[K])}else _=u.push("inline","",0),_.content=H.trim(),_.map=E.map,_.level=E.level+1,_.children=[];_=u.push(k+"_close",k,-1)}u.push("tr_close","tr",-1),E.meta.grp&1&&(k=E.meta.type===256?"thead":"tbody",_=u.push(k+"_close",k,-1),C[1]=E.map[1])}return L[1]=Math.max(C[1],y.meta.sep.map[1],y.meta.cap?y.meta.cap.map[1]:-1),_=u.push("table_close","table",-1),u.line=L[1],!0}e.block.ruler.at("table",d,{alt:["paragraph","reference"]})};const YWe=Ra(qWe);var $We=function(e,t){t=t||{};function r(i){for(var s=1,o=1,a=i.tokens.length;o<a-1;++o){var l=i.tokens[o];if(l.type==="inline"&&!(!l.children||l.children.length!==1&&l.children.length!==3)&&!(l.children.length===1&&l.children[0].type!=="image")&&!(l.children.length===3&&(l.children[0].type!=="link_open"||l.children[1].type!=="image"||l.children[2].type!=="link_close"))&&!(o!==0&&i.tokens[o-1].type!=="paragraph_open")&&!(o!==a-1&&i.tokens[o+1].type!=="paragraph_close")){var d=i.tokens[o-1];d.type="figure_open",d.tag="figure",i.tokens[o+1].type="figure_close",i.tokens[o+1].tag="figure",t.dataType==!0&&i.tokens[o-1].attrPush(["data-type","image"]);var u;if(t.link==!0&&l.children.length===1&&(u=l.children[0],l.children.unshift(new i.Token("link_open","a",1)),l.children[0].attrPush(["href",u.attrGet("src")]),l.children.push(new i.Token("link_close","a",-1))),u=l.children.length===1?l.children[0]:l.children[1],t.figcaption==!0&&u.children&&u.children.length&&(l.children.push(new i.Token("figcaption_open","figcaption",1)),l.children.splice(l.children.length,0,...u.children),l.children.push(new i.Token("figcaption_close","figcaption",-1)),u.children.length=0),t.copyAttrs&&u.attrs){const m=t.copyAttrs===!0?"":t.copyAttrs;d.attrs=u.attrs.filter(([f,g])=>f.match(m))}t.tabindex==!0&&(i.tokens[o-1].attrPush(["tabindex",s]),s++),t.lazyLoading==!0&&u.attrPush(["loading","lazy"])}}}e.core.ruler.before("linkify","implicit_figures",r)};const WWe=Ra($We),KWe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Lo={};Lo.getAttrs=function(n,e,t){const r=/[^\t\n\f />"'=]/,i=" ",s="=",o=".",a="#",l=[];let d="",u="",m=!0,f=!1;for(let g=e+t.leftDelimiter.length;g<n.length;g++){if(n.slice(g,g+t.rightDelimiter.length)===t.rightDelimiter){d!==""&&l.push([d,u]);break}const h=n.charAt(g);if(h===s&&m){m=!1;continue}if(h===o&&d===""){n.charAt(g+1)===o?(d="css-module",g+=1):d="class",m=!1;continue}if(h===a&&d===""){d="id",m=!1;continue}if(h==='"'&&u===""&&!f){f=!0;continue}if(h==='"'&&f){f=!1;continue}if(h===i&&!f){if(d==="")continue;l.push([d,u]),d="",u="",m=!0;continue}if(!(m&&h.search(r)===-1)){if(m){d+=h;continue}u+=h}}if(t.allowedAttributes&&t.allowedAttributes.length){const g=t.allowedAttributes;return l.filter(function(h){const v=h[0];function b(_){return v===_||_ instanceof RegExp&&_.test(v)}return g.some(b)})}return l};Lo.addAttrs=function(n,e){for(let t=0,r=n.length;t<r;++t){const i=n[t][0];i==="class"?e.attrJoin("class",n[t][1]):i==="css-module"?e.attrJoin("css-module",n[t][1]):e.attrPush(n[t])}return e};Lo.hasDelimiters=function(n,e){if(!n)throw new Error('Parameter `where` not passed. Should be "start", "end" or "only".');return function(t){const r=e.leftDelimiter.length+1+e.rightDelimiter.length;if(!t||typeof t!="string"||t.length<r)return!1;function i(u){const m=u.charAt(e.leftDelimiter.length)===".",f=u.charAt(e.leftDelimiter.length)==="#";return m||f?u.length>=r+1:u.length>=r}let s,o,a,l;const d=r-e.rightDelimiter.length;switch(n){case"start":a=t.slice(0,e.leftDelimiter.length),s=a===e.leftDelimiter?0:-1,o=s===-1?-1:t.indexOf(e.rightDelimiter,d),l=t.charAt(o+e.rightDelimiter.length),l&&e.rightDelimiter.indexOf(l)!==-1&&(o=-1);break;case"end":s=t.lastIndexOf(e.leftDelimiter),o=s===-1?-1:t.indexOf(e.rightDelimiter,s+d),o=o===t.length-e.rightDelimiter.length?o:-1;break;case"only":a=t.slice(0,e.leftDelimiter.length),s=a===e.leftDelimiter?0:-1,a=t.slice(t.length-e.rightDelimiter.length),o=a===e.rightDelimiter?t.length-e.rightDelimiter.
{.a} softbreak then curly in start`,tests:[{shift:0,type:"inline",children:[{position:-2,type:"softbreak"},{position:-1,type:"text",content:qt.hasDelimiters("only",n)}]}],transform:(t,r,i)=>{const s=t[r].children[i],o=qt.getAttrs(s.content,0,n);let a=r+1;for(;t[a+1]&&t[a+1].nesting===-1;)a++;const l=qt.getMatchingOpeningToken(t,a);qt.addAttrs(o,l),t[r].children=t[r].children.slice(0,-2)}},{name:"horizontal rule",tests:[{shift:0,type:"paragraph_open"},{shift:1,type:"inline",children:t=>t.length===1,content:t=>t.match(e)!==null},{shift:2,type:"paragraph_close"}],transform:(t,r)=>{const i=t[r];i.type="hr",i.tag="hr",i.nesting=0;const s=t[r+1].content,o=s.lastIndexOf(n.leftDelimiter),a=qt.getAttrs(s,o,n);qt.addAttrs(a,i),i.markup=s,t.splice(r+1,2)}},{name:"end of block",tests:[{shift:0,type:"inline",children:[{position:-1,content:qt.hasDelimiters("end",n),type:t=>t!=="code_inline"&&t!=="math_inline"}]}],transform:(t,r,i)=>{const s=t[r].children[i],o=s.content,a=qt.getAttrs(o,o.lastIndexOf(n.leftDelimiter),n);let l=r+1;do if(t[l]&&t[l].nesting===-1)break;while(l++<t.length);const d=qt.getMatchingOpeningToken(t,l);qt.addAttrs(a,d);const u=o.slice(0,o.lastIndexOf(n.leftDelimiter));s.content=D2(u)!==" "?u:u.slice(0,-1)}}]};function D2(n){return n.slice(-1)[0]}const eKe=JWe,tKe={leftDelimiter:"{",rightDelimiter:"}",allowedAttributes:[]};var nKe=function(e,t){let r=Object.assign({},tKe);r=Object.assign(r,t);const i=eKe(r);function s(o){const a=o.tokens;for(let l=0;l<a.length;l++)for(let d=0;d<i.length;d++){const u=i[d];let m=null;u.tests.every(g=>{const h=a1(a,l,g);return h.j!==null&&(m=h.j),h.match})&&(u.transform(a,l,m),(u.name==="inline attributes"||u.name==="inline nesting 0")&&d--)}}e.core.ruler.before("linkify","curly_attributes",s)};function a1(n,e,t){const r={match:!1,j:null},i=t.shift!==void 0?e+t.shift:t.position;if(t.shift!==void 0&&i<0)return r;const s=sKe(n,i);if(s===void 0)return r;for(const o of Object.keys(t))if(!(o==="shift"||o==="position")){if(s[o]===void 0)return r;if(o==="children"&&rKe(t.children)){if(s.children.length===0)return r;let a;const l=t.children,d=s.children;if(l.every(u=>u.position!==void 0)){if(a=l.every(u=>a1(d,u.position,u).match),a){const u=oKe(l).position;r.j=u>=0?u:d.length+u}}else for(let u=0;u<d.length;u++)if(a=l.every(m=>a1(d,u,m).match),a){r.j=u;break}if(a===!1)return r;continue}switch(typeof t[o]){case"boolean":case"number":case"string":if(s[o]!==t[o])return r;break;case"function":if(!t[o](s[o]))return r;break;case"object":if(iKe(t[o])){if(t[o].every(l=>l(s[o]))===!1)return r;break}default:throw new Error(`Unknown type of pattern test (key: ${o}). Test should be of type boolean, number, string, function or array of functions.`)}}return r.match=!0,r}function rKe(n){return Array.isArray(n)&&n.length&&n.every(e=>typeof e=="object")}function iKe(n){return Array.isArray(n)&&n.length&&n.every(e=>typeof e=="function")}function sKe(n,e){return e>=0?n[e]:n[n.length+e]}function oKe(n){return n.slice(-1)[0]||{}}const aKe=Ra(nKe);function xN(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach(e=>{const t=n[e],r=typeof t;(r==="object"||r==="function")&&!Object.isFrozen(t)&&xN(t)}),n}let L2=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function TN(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function go(n,...e){const t=Object.create(null);for(const r in n)t[r]=n[r];return e.forEach(function(r){for(const i in r)t[i]=r[i]}),t}const lKe="</span>",P2=n=>!!n.scope,cKe=(n,{prefix:e})=>{if(n.startsWith("language:"))return n.replace("language:","language-");if(n.includes(".")){const t=n.split(".");return[`${e}${t.shift()}`,...t.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${n}`};class dKe{constructor(e,t){this.buffer="",this.classPrefix=t.classPref
https://github.com/highlightjs/highlight.js/issues/2277`),xe=B,ue=Z),ce===void 0&&(ce=!0);const Ce={code:ue,language:xe};$("before:highlight",Ce);const me=Ce.result?Ce.result:m(Ce.language,Ce.code,ce);return me.code=Ce.code,$("after:highlight",me),me}function m(B,Z,ce,ue){const xe=Object.create(null);function Ce(ne,pe){return ne.keywords[pe]}function me(){if(!fe.keywords){Pe.addText(Re);return}let ne=0;fe.keywordPatternRe.lastIndex=0;let pe=fe.keywordPatternRe.exec(Re),De="";for(;pe;){De+=Re.substring(ne,pe.index);const Le=ge.case_insensitive?pe[0].toLowerCase():pe[0],Ve=Ce(fe,Le);if(Ve){const[ot,wt]=Ve;if(Pe.addText(De),De="",xe[Le]=(xe[Le]||0)+1,xe[Le]<=JKe&&(U+=wt),ot.startsWith("_"))De+=pe[0];else{const $e=ge.classNameAliases[ot]||ot;ze(pe[0],$e)}}else De+=pe[0];ne=fe.keywordPatternRe.lastIndex,pe=fe.keywordPatternRe.exec(Re)}De+=Re.substring(ne),Pe.addText(De)}function Ae(){if(Re==="")return;let ne=null;if(typeof fe.subLanguage=="string"){if(!e[fe.subLanguage]){Pe.addText(Re);return}ne=m(fe.subLanguage,Re,!0,Ue[fe.subLanguage]),Ue[fe.subLanguage]=ne._top}else ne=g(Re,fe.subLanguage.length?fe.subLanguage:null);fe.relevance>0&&(U+=ne.relevance),Pe.__addSublanguage(ne._emitter,ne.language)}function Fe(){fe.subLanguage!=null?Ae():me(),Re=""}function ze(ne,pe){ne!==""&&(Pe.startScope(pe),Pe.addText(ne),Pe.endScope())}function te(ne,pe){let De=1;const Le=pe.length-1;for(;De<=Le;){if(!ne._emit[De]){De++;continue}const Ve=ge.classNameAliases[ne[De]]||ne[De],ot=pe[De];Ve?ze(ot,Ve):(Re=ot,me(),Re=""),De++}}function ye(ne,pe){return ne.scope&&typeof ne.scope=="string"&&Pe.openNode(ge.classNameAliases[ne.scope]||ne.scope),ne.beginScope&&(ne.beginScope._wrap?(ze(Re,ge.classNameAliases[ne.beginScope._wrap]||ne.beginScope._wrap),Re=""):ne.beginScope._multi&&(te(ne.beginScope,pe),Re="")),fe=Object.create(ne,{parent:{value:fe}}),fe}function Se(ne,pe,De){let Le=fKe(ne.endRe,De);if(Le){if(ne["on:end"]){const Ve=new L2(ne);ne["on:end"](pe,Ve),Ve.isMatchIgnored&&(Le=!1)}if(Le){for(;ne.endsParent&&ne.parent;)ne=ne.parent;return ne}}if(ne.endsWithParent)return Se(ne.parent,pe,De)}function Oe(ne){return fe.matcher.regexIndex===0?(Re+=ne[0],1):(we=!0,0)}function Ye(ne){const pe=ne[0],De=ne.rule,Le=new L2(De),Ve=[De.__beforeBegin,De["on:begin"]];for(const ot of Ve)if(ot&&(ot(ne,Le),Le.isMatchIgnored))return Oe(pe);return De.skip?Re+=pe:(De.excludeBegin&&(Re+=pe),Fe(),!De.returnBegin&&!De.excludeBegin&&(Re=pe)),ye(De,ne),De.returnBegin?0:pe.length}function le(ne){const pe=ne[0],De=Z.substring(ne.index),Le=Se(fe,ne,De);if(!Le)return z2;const Ve=fe;fe.endScope&&fe.endScope._wrap?(Fe(),ze(pe,fe.endScope._wrap)):fe.endScope&&fe.endScope._multi?(Fe(),te(fe.endScope,ne)):Ve.skip?Re+=pe:(Ve.returnEnd||Ve.excludeEnd||(Re+=pe),Fe(),Ve.excludeEnd&&(Re=pe));do fe.scope&&Pe.closeNode(),!fe.skip&&!fe.subLanguage&&(U+=fe.relevance),fe=fe.parent;while(fe!==Le.parent);return Le.starts&&ye(Le.starts,ne),Ve.returnEnd?0:pe.length}function V(){const ne=[];for(let pe=fe;pe!==ge;pe=pe.parent)pe.scope&&ne.unshift(pe.scope);ne.forEach(pe=>Pe.openNode(pe))}let G={};function oe(ne,pe){const De=pe&&pe[0];if(Re+=ne,De==null)return Fe(),0;if(G.type==="begin"&&pe.type==="end"&&G.index===pe.index&&De===""){if(Re+=Z.slice(pe.index,pe.index+1),!i){const Le=new Error(`0 width match regex (${B})`);throw Le.languageName=B,Le.badRule=G.rule,Le}return 1}if(G=pe,pe.type==="begin")return Ye(pe);if(pe.type==="illegal"&&!ce){const Le=new Error('Illegal lexeme "'+De+'" for mode "'+(fe.scope||"<unnamed>")+'"');throw Le.mode=fe,Le}else if(pe.type==="end"){const Le=le(pe);if(Le!==z2)return Le}if(pe.type==="illegal"&&De==="")return 1;if(ee>1e5&&ee>pe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Re+=De,De.length}const ge=C(B);if(!ge)throw da(s.replace("{}",B)),new Error('Unknown language: "'+B+'"');const Ee=jKe(ge);let Te="",fe=ue||Ee;const Ue={},Pe=new a.__emitter(a);V();let Re="",U=0,I=0,ee=0,we=!1;try{if(ge.__emitTokens)ge.__emitTokens(Z,Pe);else{for(fe.matcher.considerAll();;){ee++,we?we=!1:fe.matcher.considerAll(),fe.matcher.lastIndex=I;
`},h]}}return zg=i,zg}var Vg,AT;function GQe(){if(AT)return Vg;AT=1;function n(e){const t="[a-zA-Z_][\\w.]*",r="<\\?(lasso(script)?|=)",i="\\]|\\?>",s={$pattern:t+"|&[lg]t;",literal:"true false none minimal full all void and or not bw nbw ew new cn ncn lt lte gt gte eq neq rx nrx ft",built_in:"array date decimal duration integer map pair string tag xml null boolean bytes keyword list locale queue set stack staticarray local var variable global data self inherited currentcapture givenblock",keyword:"cache database_names database_schemanames database_tablenames define_tag define_type email_batch encode_set html_comment handle handle_error header if inline iterate ljax_target link link_currentaction link_currentgroup link_currentrecord link_detail link_firstgroup link_firstrecord link_lastgroup link_lastrecord link_nextgroup link_nextrecord link_prevgroup link_prevrecord log loop namespace_using output_none portal private protect records referer referrer repeating resultset rows search_args search_arguments select sort_args sort_arguments thread_atomic value_list while abort case else fail_if fail_ifnot fail if_empty if_false if_null if_true loop_abort loop_continue loop_count params params_up return return_value run_children soap_definetag soap_lastrequest soap_lastresponse tag_name ascending average by define descending do equals frozen group handle_failure import in into join let match max min on order parent protected provide public require returnhome skip split_thread sum take thread to trait type where with yield yieldhome"},o=e.COMMENT("<!--","-->",{relevance:0}),a={className:"meta",begin:"\\[noprocess\\]",starts:{end:"\\[/noprocess\\]",returnEnd:!0,contains:[o]}},l={className:"meta",begin:"\\[/noprocess|"+r},d={className:"symbol",begin:"'"+t+"'"},u=[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.inherit(e.C_NUMBER_MODE,{begin:e.C_NUMBER_RE+"|(-?infinity|NaN)\\b"}),e.inherit(e.APOS_STRING_MODE,{illegal:null}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"string",begin:"`",end:"`"},{variants:[{begin:"[#$]"+t},{begin:"#",end:"\\d+",illegal:"\\W"}]},{className:"type",begin:"::\\s*",end:t,illegal:"\\W"},{className:"params",variants:[{begin:"-(?!infinity)"+t,relevance:0},{begin:"(\\.\\.\\.)"}]},{begin:/(->|\.)\s*/,relevance:0,contains:[d]},{className:"class",beginKeywords:"define",returnEnd:!0,end:"\\(|=>",contains:[e.inherit(e.TITLE_MODE,{begin:t+"(=(?!>))?|[-+*/%](?!>)"})]}];return{name:"Lasso",aliases:["ls","lassoscript"],case_insensitive:!0,keywords:s,contains:[{className:"meta",begin:i,relevance:0,starts:{end:"\\[|"+r,returnEnd:!0,relevance:0,contains:[o]}},a,l,{className:"meta",begin:"\\[no_square_brackets",starts:{end:"\\[/no_square_brackets\\]",keywords:s,contains:[{className:"meta",begin:i,relevance:0,starts:{end:"\\[noprocess\\]|"+r,returnEnd:!0,contains:[o]}},a,l].concat(u)}},{className:"meta",begin:"\\[",relevance:0},{className:"meta",begin:"^#!",end:"lasso9$",relevance:10}].concat(u)}}return Vg=n,Vg}var Hg,RT;function zQe(){if(RT)return Hg;RT=1;function n(e){const r=e.regex.either(...["(?:NeedsTeXFormat|RequirePackage|GetIdInfo)","Provides(?:Expl)?(?:Package|Class|File)","(?:DeclareOption|ProcessOptions)","(?:documentclass|usepackage|input|include)","makeat(?:letter|other)","ExplSyntax(?:On|Off)","(?:new|renew|provide)?command","(?:re)newenvironment","(?:New|Renew|Provide|Declare)(?:Expandable)?DocumentCommand","(?:New|Renew|Provide|Declare)DocumentEnvironment","(?:(?:e|g|x)?def|let)","(?:begin|end)","(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph)","caption","(?:label|(?:eq|page|name)?ref|(?:paren|foot|super)?cite)","(?:alpha|beta|[Gg]amma|[Dd]elta|(?:var)?epsilon|zeta|eta|[Tt]heta|vartheta)","(?:iota|(?:var)?kappa|[Ll]ambda|mu|nu|[Xx]i|[Pp]i|varpi|(?:var)rho)","(?:[Ss]igma|varsigma|tau|[Uu]psilon|[Pp]hi|varphi|chi|[Pp]si|[Oo]mega)","(?:frac|sum|prod|lim|infty|times|sqrt|leq|geq|left|right|middle|[bB]igg?)","(?:[lr]angle|q?quad|[lcvdi]?dots|d?dot|hat|tilde|bar)"].map(H=>H+"(?![a-zA-Z@:_])")),i=new RegExp(["(?:__)?[a-zA-Z]{2,}_[a-zA-Z](?:_?[a-zA-Z])+:[a-zA-Z]*","[lgc]__?[a-zA-Z](?:_?[a-zA-
]`,h={scope:"string",variants:[u,d,m,f]},v={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},b=["false","null","true"],_=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],y=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],x={keyword:_,literal:(D=>{const $=[];return D.forEach(K=>{$.push(K),K.toLowerCase()===K?$.push(K.toUpperCase()):$.push(K.toLowerCase())}),$})(b),built_in:y},A=D=>D.map($=>$.replace(/\|\d+$/,"")),w={variants:[{match:[/new/,t.concat(g,"+"),t.concat("(?!",A(y).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},N=t.concat(i,"\\b(?!\\()"),L={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),N],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),N],scope:{1:"title.class",3:"variable.constant"}},{match:[s,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},C={scope:"attr",match:t.concat(i,t.lookahead(":"),t.lookahead(/(?!::)/))},k={relevance:0,begin:/\(/,end:/\)/,keywords:x,contains:[C,o,L,e.C_BLOCK_COMMENT_MODE,h,v,w]},H={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",A(_).join("\\b|"),"|",A(y).join("\\b|"),"\\b)"),i,t.concat(g,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[k]};k.contains.push(H);const q=[C,L,e.C_BLOCK_COMMENT_MODE,h,v,w],ie={begin:t.concat(/#\[\s*/,s),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...q]},...q,{
]*;`,relevance:0},{begin:"[vp][0-9]+"}]}}return t0=n,t0}var n0,zw;function eZe(){if(zw)return n0;zw=1;function n(e){const t="[a-z][a-zA-Z0-9_]*",r={className:"string",begin:"\\$.{1}"},i={className:"symbol",begin:"#"+e.UNDERSCORE_IDENT_RE};return{name:"Smalltalk",aliases:["st"],keywords:["self","super","nil","true","false","thisContext"],contains:[e.COMMENT('"','"'),e.APOS_STRING_MODE,{className:"type",begin:"\\b[A-Z][A-Za-z0-9_]*",relevance:0},{begin:t+":",relevance:0},e.C_NUMBER_MODE,i,r,{begin:"\\|[ ]*"+t+"([ ]+"+t+")*[ ]*\\|",returnBegin:!0,end:/\|/,illegal:/\S/,contains:[{begin:"(\\|[ ]*)?"+t}]},{begin:"#\\(",end:"\\)",contains:[e.APOS_STRING_MODE,r,e.C_NUMBER_MODE,i]}]}}return n0=n,n0}var r0,Vw;function tZe(){if(Vw)return r0;Vw=1;function n(e){return{name:"SML (Standard ML)",aliases:["ml"],keywords:{$pattern:"[a-z_]\\w*!?",keyword:"abstype and andalso as case datatype do else end eqtype exception fn fun functor handle if in include infix infixr let local nonfix of op open orelse raise rec sharing sig signature struct structure then type val with withtype where while",built_in:"array bool char exn int list option order real ref string substring vector unit word",literal:"true false NONE SOME LESS EQUAL GREATER nil"},illegal:/\/\/|>>/,contains:[{className:"literal",begin:/\[(\|\|)?\]|\(\)/,relevance:0},e.COMMENT("\\(\\*","\\*\\)",{contains:["self"]}),{className:"symbol",begin:"'[A-Za-z_](?!')[\\w']*"},{className:"type",begin:"`[A-Z][\\w']*"},{className:"type",begin:"\\b[A-Z][\\w']*",relevance:0},{begin:"[a-z_]\\w*'[\\w']*"},e.inherit(e.APOS_STRING_MODE,{className:"string",relevance:0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"number",begin:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",relevance:0},{begin:/[-=]>/}]}}return r0=n,r0}var i0,Hw;function nZe(){if(Hw)return i0;Hw=1;function n(e){const t={className:"variable",begin:/\b_+[a-zA-Z]\w*/},r={className:"title",begin:/[a-zA-Z][a-zA-Z_0-9]*_fnc_[a-zA-Z_0-9]+/},i={className:"string",variants:[{begin:'"',end:'"',contains:[{begin:'""',relevance:0}]},{begin:"'",end:"'",contains:[{begin:"''",relevance:0}]}]},s=["break","breakWith","breakOut","breakTo","case","catch","continue","continueWith","default","do","else","exit","exitWith","for","forEach","from","if","local","private","switch","step","then","throw","to","try","waitUntil","while","with"],o=["blufor","civilian","configNull","controlNull","displayNull","diaryRecordNull","east","endl","false","grpNull","independent","lineBreak","locationNull","nil","objNull","opfor","pi","resistance","scriptNull","sideAmbientLife","sideEmpty","sideEnemy","sideFriendly","sideLogic","sideUnknown","taskNull","teamMemberNull","true","west"],a=["abs","accTime","acos","action","actionIDs","actionKeys","actionKeysEx","actionKeysImages","actionKeysNames","actionKeysNamesArray","actionName","actionParams","activateAddons","activatedAddons","activateKey","activeTitleEffectParams","add3DENConnection","add3DENEventHandler","add3DENLayer","addAction","addBackpack","addBackpackCargo","addBackpackCargoGlobal","addBackpackGlobal","addBinocularItem","addCamShake","addCuratorAddons","addCuratorCameraArea","addCuratorEditableObjects","addCuratorEditingArea","addCuratorPoints","addEditorObject","addEventHandler","addForce","addForceGeneratorRTD","addGoggles","addGroupIcon","addHandgunItem","addHeadgear","addItem","addItemCargo","addItemCargoGlobal","addItemPool","addItemToBackpack","addItemToUniform","addItemToVest","addLiveStats","addMagazine","addMagazineAmmoCargo","addMagazineCargo","addMagazineCargoGlobal","addMagazineGlobal","addMagazinePool","addMagazines","addMagazineTurret","addMenu","addMenuItem","addMissionEventHandler","addMPEventHandler","addMusicEventHandler","addonFiles","addOwnedMine","addPlayerScores","addPrimaryWeaponItem","addPublicVariableEventHandler","addRating","addResources","addScore","addScoreSide","addSecondaryWeaponItem","addSwitchableUnit","addTeamMember","addToRemainsCollector","addTorque","addUniform","addUserActionEventHandler","a
2024-11-04 00:22:50 +00:00
]*?"'`},{begin:`"[^\r
2024-11-06 23:05:30 +00:00
"]*"`}]},{className:"built_in",variants:[{begin:"\\b(abs|acos|asin|atan|atan2|atanh|ceil|cloglog|comb|cos|digamma|exp|floor|invcloglog|invlogit|ln|lnfact|lnfactorial|lngamma|log|log10|max|min|mod|reldif|round|sign|sin|sqrt|sum|tan|tanh|trigamma|trunc|betaden|Binomial|binorm|binormal|chi2|chi2tail|dgammapda|dgammapdada|dgammapdadx|dgammapdx|dgammapdxdx|F|Fden|Ftail|gammaden|gammap|ibeta|invbinomial|invchi2|invchi2tail|invF|invFtail|invgammap|invibeta|invnchi2|invnFtail|invnibeta|invnorm|invnormal|invttail|nbetaden|nchi2|nFden|nFtail|nibeta|norm|normal|normalden|normd|npnchi2|tden|ttail|uniform|abbrev|char|index|indexnot|length|lower|ltrim|match|plural|proper|real|regexm|regexr|regexs|reverse|rtrim|string|strlen|strlower|strltrim|strmatch|strofreal|strpos|strproper|strreverse|strrtrim|strtrim|strupper|subinstr|subinword|substr|trim|upper|word|wordcount|_caller|autocode|byteorder|chop|clip|cond|e|epsdouble|epsfloat|group|inlist|inrange|irecode|matrix|maxbyte|maxdouble|maxfloat|maxint|maxlong|mi|minbyte|mindouble|minfloat|minint|minlong|missing|r|recode|replay|return|s|scalar|d|date|day|dow|doy|halfyear|mdy|month|quarter|week|year|d|daily|dofd|dofh|dofm|dofq|dofw|dofy|h|halfyearly|hofd|m|mofd|monthly|q|qofd|quarterly|tin|twithin|w|weekly|wofd|y|yearly|yh|ym|yofd|yq|yw|cholesky|colnumb|colsof|corr|det|diag|diag0cnt|el|get|hadamard|I|inv|invsym|issym|issymmetric|J|matmissing|matuniform|mreldif|nullmat|rownumb|rowsof|sweep|syminv|trace|vec|vecdiag)(?=\\()"}]},e.COMMENT("^[ ]*\\*.*$",!1),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]}}return a0=n,a0}var l0,Ww;function oZe(){if(Ww)return l0;Ww=1;function n(e){return{name:"STEP Part 21",aliases:["p21","step","stp"],case_insensitive:!0,keywords:{$pattern:"[A-Z_][A-Z0-9_.]*",keyword:["HEADER","ENDSEC","DATA"]},contains:[{className:"meta",begin:"ISO-10303-21;",relevance:10},{className:"meta",begin:"END-ISO-10303-21;",relevance:10},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.COMMENT("/\\*\\*!","\\*/"),e.C_NUMBER_MODE,e.inherit(e.APOS_STRING_MODE,{illegal:null}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"string",begin:"'",end:"'"},{className:"symbol",variants:[{begin:"#",end:"\\d+",illegal:"\\W"}]}]}}return l0=n,l0}var c0,Kw;function aZe(){if(Kw)return c0;Kw=1;const n=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),e=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],t=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],r=[...e,...t],i=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","i
2024-11-04 00:22:50 +00:00
(multipart)?`,end:`\\]
2024-11-06 23:05:30 +00:00
`},{className:"string",begin:"\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}.\\d+Z"},{className:"string",begin:"(\\+|-)\\d+"},{className:"keyword",relevance:10,variants:[{begin:"^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?"},{begin:"^progress(:?)(\\s+)?(pop|push)?"},{begin:"^tags:"},{begin:"^time:"}]}]}}return d0=n,d0}var u0,Qw;function cZe(){if(Qw)return u0;Qw=1;function n(L){return L?typeof L=="string"?L:L.source:null}function e(L){return t("(?=",L,")")}function t(...L){return L.map(k=>n(k)).join("")}function r(L){const C=L[L.length-1];return typeof C=="object"&&C.constructor===Object?(L.splice(L.length-1,1),C):{}}function i(...L){return"("+(r(L).capture?"":"?:")+L.map(H=>n(H)).join("|")+")"}const s=L=>t(/\b/,L,/\w$/.test(L)?/\b/:/\B/),o=["Protocol","Type"].map(s),a=["init","self"].map(s),l=["Any","Self"],d=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],u=["false","nil","true"],m=["assignment","associativity","higherThan","left","lowerThan","none","right"],f=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],g=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],h=i(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),v=i(h,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),b=t(h,v,"*"),_=i(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),y=i(_,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),E=t(_,y,"*"),x=t(/[A-Z]/,y,"*"),A=["attached","autoclosure",t(/convention\(/,i("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",t(/objc\(/,E,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplica
`),r=t.length.toString().length,i=t.map((d,u)=>(u+1).toString().padStart(r," ")),s=document.createElement("div");s.classList.add("line-numbers"),s.innerHTML=i.join("<br>");const o=document.createElement("div");o.classList.add("code-container");const a=document.createElement("pre"),l=document.createElement("code");return l.classList.add("code-content"),l.innerHTML=ya.highlight(e,{language:n,ignoreIllegals:!0}).value,a.appendChild(l),o.appendChild(s),o.appendChild(a),o.outerHTML}},methods:{copyCode(){this.isCopied=!0,console.log("Copying code");const n=document.createElement("textarea");n.value=this.code,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),We(()=>{Ze.replace()})},executeCode(){this.isExecuting=!0;const n=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id?this.discussion_id:0,message_id:this.message_id?this.message_id:0,language:this.language});console.log(n),fetch(`${this.host}/execute_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>(this.isExecuting=!1,e.json())).then(e=>{console.log(e),this.executionOutput=e.output}).catch(e=>{this.isExecuting=!1,console.error("Fetch error:",e)})},executeCode_in_new_tab(){this.isExecuting=!0;const n=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id,message_id:this.message_id,language:this.language});console.log(n),fetch(`${this.host}/execute_code_in_new_tab`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>(this.isExecuting=!1,e.json())).then(e=>{console.log(e),this.executionOutput=e.output}).catch(e=>{this.isExecuting=!1,console.error("Fetch error:",e)})},openFolderVsCode(){const n=JSON.stringify({client_id:this.client_id,code:this.code,discussion_id:this.discussion_id,message_id:this.message_id});console.log(n),fetch(`${this.host}/open_discussion_folder_in_vs_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})},openVsCode(){const n=JSON.stringify({client_id:this.client_id,discussion_id:typeof this.discussion_id=="string"?parseInt(this.discussion_id):this.discussion_id,message_id:this.message_id,code:this.code});console.log(n),fetch(`${this.host}/open_code_in_vs_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})},openFolder(){const n=JSON.stringify({client_id:this.client_id,discussion_id:this.discussion_id});console.log(n),fetch(`${this.host}/open_discussion_folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})}}},LZe={class:"bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},PZe={class:"hljs p-1 rounded-md break-all grid grid-cols-1"},FZe={class:"code-container"},UZe=["innerHTML"],BZe={class:"flex flex-row bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},GZe={class:"text-2xl mr-2"},zZe=["title"],VZe={key:0,class:"text-2xl"},HZe={key:1,class:"hljs mt-0 p-1 rounded-md break-all grid grid-cols-1"},qZe={class:"container h-[200px] overflow-x-auto break-all scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},YZe=["innerHTML"];function $Ze(n,e,t,r,i,s){return T(),M("div",LZe,[c("pre",PZe,[e[9]||(e[9]=pt(" ")),c("div",FZe,[e[7]||(e[7]=pt(`
`)),c("div",{class:"code-content overflow-x-auto break-all scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",innerHTML:s.highlightedCode,contenteditable:"true",onInput:e[0]||(e[0]=(...o)=>n.updateCode&&n.updateCode(...o))},null,40,UZe),e[8]||(e[8]=pt(`
2024-11-04 00:22:50 +00:00
`))]),e[10]||(e[10]=pt(`
2024-11-06 23:05:30 +00:00
`))]),c("div",BZe,[c("span",GZe,X(t.language.trim()),1),c("button",{onClick:e[1]||(e[1]=(...o)=>s.copyCode&&s.copyCode(...o)),title:i.isCopied?"Copied!":"Copy code",class:qe([i.isCopied?"bg-green-500":"","px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"])},e[11]||(e[11]=[c("i",{"data-feather":"copy"},null,-1)]),10,zZe),["function","python","sh","shell","bash","cmd","powershell","latex","mermaid","graphviz","dot","javascript","html","html5","svg","lilypond"].includes(t.language)?(T(),M("button",{key:0,ref:"btn_code_exec",onClick:e[2]||(e[2]=(...o)=>s.executeCode&&s.executeCode(...o)),title:"execute",class:qe(["px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200",i.isExecuting?"bg-green-500":""])},e[12]||(e[12]=[c("i",{"data-feather":"play-circle"},null,-1)]),2)):Y("",!0),["airplay","mermaid","graphviz","dot","javascript","html","html5","svg","css"].includes(t.language.trim())?(T(),M("button",{key:1,ref:"btn_code_exec_in_new_tab",onClick:e[3]||(e[3]=(...o)=>s.executeCode_in_new_tab&&s.executeCode_in_new_tab(...o)),title:"execute",class:qe(["px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200",i.isExecuting?"bg-green-500":""])},e[13]||(e[13]=[c("i",{"data-feather":"airplay"},null,-1)]),2)):Y("",!0),c("button",{onClick:e[4]||(e[4]=(...o)=>s.openFolder&&s.openFolder(...o)),title:"open code project folder",class:"px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"},e[14]||(e[14]=[c("i",{"data-feather":"folder"},null,-1)])),["python","latex","html"].includes(t.language.trim())?(T(),M("button",{key:2,onClick:e[5]||(e[5]=(...o)=>s.openFolderVsCode&&s.openFolderVsCode(...o)),title:"open code project folder in vscode",class:"px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"},e[15]||(e[15]=[c("img",{src:IZe,width:"25",height:"25"},null,-1)]))):Y("",!0),["python","latex","html"].includes(t.language.trim())?(T(),M("button",{key:3,onClick:e[6]||(e[6]=(...o)=>s.openVsCode&&s.openVsCode(...o)),title:"open code in vscode",class:"px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"},e[16]||(e[16]=[c("img",{src:OZe,width:"25",height:"25"},null,-1)]))):Y("",!0)]),i.executionOutput?(T(),M("span",VZe,"Execution output")):Y("",!0),i.executionOutput?(T(),M("pre",HZe,[e[19]||(e[19]=pt(" ")),c("div",qZe,[e[17]||(e[17]=pt(`
`)),c("div",{ref:"execution_output",class:"w-full h-full overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",innerHTML:i.executionOutput},null,8,YZe),e[18]||(e[18]=pt(`
2024-11-04 00:22:50 +00:00
`))]),e[20]||(e[20]=pt(`
2024-11-06 23:05:30 +00:00
`))])):Y("",!0)])}const WZe=bt(DZe,[["render",$Ze]]);var KZe={exports:{}};(function(n,e){(function(t,r){n.exports=r()})(Q3,function(){function t(a,l){var d=a.pos;if(a.src.charCodeAt(d)!==92)return!1;var u=a.src.slice(++d).match(/^(?:\\\[|\\\(|begin\{([^}]*)\})/);if(!u)return!1;d+=u[0].length;var m,f,g;u[0]==="\\["?(m="display_math",f="\\\\]"):u[0]==="\\("?(m="inline_math",f="\\\\)"):u[1]&&(m="math",f="\\end{"+u[1]+"}",g=!0);var h=a.src.indexOf(f,d);if(h===-1)return!1;var v=h+f.length;if(!l){var b=a.push(m,"",0);b.content=g?a.src.slice(a.pos,v):a.src.slice(d,h)}return a.pos=v,!0}function r(a,l){var d=a.pos;if(a.src.charCodeAt(d)!==36)return!1;var u="$",m=a.src.charCodeAt(++d);if(m===36){if(u="$$",a.src.charCodeAt(++d)===36)return!1}else if(m===32||m===9||m===10)return!1;var f=a.src.indexOf(u,d);if(f===-1||a.src.charCodeAt(f-1)===92)return!1;var g=f+u.length;if(u.length===1){var h=a.src.charCodeAt(f-1);if(h===32||h===9||h===10)return!1;var v=a.src.charCodeAt(g);if(v>=48&&v<58)return!1}if(!l){var b=a.push(u.length===1?"inline_math":"display_math","",0);b.content=a.src.slice(d,f)}return a.pos=g,!0}function i(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")}function s(a,l){return Object.keys(l).reduce(function(d,u){return d[u]===void 0&&(d[u]=l[u]),d},a)}var o={math:"Math",inline_math:"InlineMath",display_math:"DisplayMath"};return function(a){var l={beforeMath:"",afterMath:"",beforeInlineMath:"\\(",afterInlineMath:"\\)",beforeDisplayMath:"\\[",afterDisplayMath:"\\]"};return a=s(a||{},l),function(d){d.inline.ruler.before("escape","math",t),d.inline.ruler.push("texMath",r),Object.keys(o).forEach(function(u){var m=a["before"+o[u]],f=a["after"+o[u]];d.renderer.rules[u]=function(g,h){return m+i(g[h].content)+f}})}}})})(KZe);var jZe={exports:{}};class Fr{constructor(e,t,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=r}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new Fr(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class li{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new li(t,Fr.range(this,e))}}class Qe{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var r="KaTeX parse error: "+e,i,s,o=t&&t.loc;if(o&&o.start<=o.end){var a=o.lexer.input;i=o.start,s=o.end,i===a.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var l=a.slice(i,s).replace(/[^]/g,"$&̲"),d;i>15?d="…"+a.slice(i-15,i):d=a.slice(0,i);var u;s+15<a.length?u=a.slice(s,s+15)+"…":u=a.slice(s),r+=d+l+u}var m=new Error(r);return m.name="ParseError",m.__proto__=Qe.prototype,m.position=i,i!=null&&s!=null&&(m.length=s-i),m.rawMessage=e,m}}Qe.prototype.__proto__=Error.prototype;var QZe=function(e,t){return e.indexOf(t)!==-1},XZe=function(e,t){return e===void 0?t:e},ZZe=/([A-Z])/g,JZe=function(e){return e.replace(ZZe,"-$1").toLowerCase()},eJe={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},tJe=/[&><"']/g;function nJe(n){return String(n).replace(tJe,e=>eJe[e])}var LN=function n(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?n(e.body[0]):e:e.type==="font"?n(e.body):e},rJe=function(e){var t=LN(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},iJe=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},sJe=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},Et={contains:QZe,deflt:XZe,escape:nJe,hyphenate:JZe,getBaseElem:LN,isCharacterBox:rJe,protocolFromUrl:sJe},sp={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type
2024-11-04 00:22:50 +00:00
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l`+e/2.075+" -"+e+`
c5.3,-9.3,12,-14,20,-14
H400000v`+(40+e)+`H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
2024-11-06 23:05:30 +00:00
M`+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},fJe=function(e,t){return"M263,"+(601+e+t)+`c0.7,0,18,39.7,52,119
2024-11-04 00:22:50 +00:00
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
c340,-704.7,510.7,-1060.3,512,-1067
l`+e/2.084+" -"+e+`
c4.7,-7.3,11,-11,19,-11
H40000v`+(40+e)+`H1012.3
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
2024-11-06 23:05:30 +00:00
M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},gJe=function(e,t){return"M983 "+(10+e+t)+`
2024-11-04 00:22:50 +00:00
l`+e/3.13+" -"+e+`
c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
2024-11-06 23:05:30 +00:00
M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},_Je=function(e,t){return"M424,"+(2398+e+t)+`
2024-11-04 00:22:50 +00:00
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000
v`+(40+e)+`H1014.6
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+t+`
2024-11-06 23:05:30 +00:00
h400000v`+(40+e)+"h-400000z"},bJe=function(e,t){return"M473,"+(2713+e+t)+`
2024-11-04 00:22:50 +00:00
c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
2024-11-06 23:05:30 +00:00
606zM`+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"},vJe=function(e){var t=e/2;return"M400000 "+e+" H0 L"+t+" 0 l65 45 L145 "+(e-80)+" H400000z"},yJe=function(e,t,r){var i=r-54-t-e;return"M702 "+(e+t)+"H400000"+(40+e)+`
2024-11-04 00:22:50 +00:00
H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
2024-11-06 23:05:30 +00:00
219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},EJe=function(e,t,r){t=1e3*t;var i="";switch(e){case"sqrtMain":i=mJe(t,Ua);break;case"sqrtSize1":i=fJe(t,Ua);break;case"sqrtSize2":i=gJe(t,Ua);break;case"sqrtSize3":i=_Je(t,Ua);break;case"sqrtSize4":i=bJe(t,Ua);break;case"sqrtTall":i=yJe(t,Ua,r)}return i},SJe=function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z"+("M367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z");case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257z"+("M478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z");default:return""}},bC={doubleleftarrow:`M262 157
2024-11-04 00:22:50 +00:00
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
435 0h399565z`,leftgroupunder:`M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
-338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
-175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
2024-11-06 23:05:30 +00:00
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},xJe=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v1759 h347 v-84
2024-11-04 00:22:50 +00:00
H403z M403 1759 V0 H319 V1759 v`+t+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v1759 H0 v84 H347z
M347 1759 V0 H263 V1759 v`+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+" v585 h43z";case"doublevert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+` v585 h43z
M367 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+` v1715 h263 v84 H319z
MM319 602 V0 H403 V602 v`+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+` v1799 H0 v-84 H319z
MM319 602 V0 H403 V602 v`+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v602 h84z
M403 1759 V0 H319 V1759 v`+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v602 h84z
M347 1759 V0 h-84 V1759 v`+t+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
-36,557 l0,`+(t+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
l0,-`+(t+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(t+9)+`
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Nd{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return Et.contains(this.classes,e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){var e=t=>t.toText();return this.children.map(e).join("")}}var $i={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.755
`+N+" children.");for(var H=0;H<N;H++){var q=new No(E[H]),ie=new Os([q],{width:"400em",height:Je(w),viewBox:"0 0 "+a+" "+A,preserveAspectRatio:C[H]+" slice"}),D=ve.makeSvgSpan([L[H]],[ie],t);if(N===1)return{span:D,minWidth:x,height:w};D.style.height=Je(w),_.push(D)}return{span:ve.makeSpan(["stretchy"],_,t),minWidth:x,height:w}}}var{span:i,minWidth:s,height:o}=r();return i.height=o,i.style.height=Je(o),s>0&&(i.style.minWidth=Je(s)),i},aet=function(e,t,r,i,s){var o,a=e.height+e.depth+r+i;if(/fbox|color|angl/.test(t)){if(o=ve.makeSpan(["stretchy",t],[],s),t==="fbox"){var l=s.color&&s.getColor();l&&(o.style.borderColor=l)}}else{var d=[];/^[bx]cancel$/.test(t)&&d.push(new d1({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&d.push(new d1({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new Os(d,{width:"100%",height:Je(a)});o=ve.makeSvgSpan([],[u],s)}return o.height=a,o.style.height=Je(a),o},Ls={encloseSpan:aet,mathMLnode:ret,svgSpan:oet};function Ut(n,e){if(!n||n.type!==e)throw new Error("Expected node of type "+e+", but got "+(n?"node of type "+n.type:String(n)));return n}function Wv(n){var e=Wh(n);if(!e)throw new Error("Expected node of symbol group type, but got "+(n?"node of type "+n.type:String(n)));return e}function Wh(n){return n&&(n.type==="atom"||IJe.hasOwnProperty(n.type))?n:null}var Kv=(n,e)=>{var t,r,i;n&&n.type==="supsub"?(r=Ut(n.base,"accent"),t=r.base,n.base=t,i=NJe(Zt(n,e)),n.base=r):(r=Ut(n,"accent"),t=r.base);var s=Zt(t,e.havingCrampedStyle()),o=r.isShifty&&Et.isCharacterBox(t),a=0;if(o){var l=Et.getBaseElem(t),d=Zt(l,e.havingCrampedStyle());a=SC(d).skew}var u=r.label==="\\c",m=u?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),f;if(r.isStretchy)f=Ls.svgSpan(r,e),f=ve.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Je(2*a)+")",marginLeft:Je(2*a)}:void 0}]},e);else{var g,h;r.label==="\\vec"?(g=ve.staticSvg("vec",e),h=ve.svgData.vec[1]):(g=ve.makeOrd({mode:r.mode,text:r.label},e,"textord"),g=SC(g),g.italic=0,h=g.width,u&&(m+=g.depth)),f=ve.makeSpan(["accent-body"],[g]);var v=r.label==="\\textcircled";v&&(f.classes.push("accent-full"),m=s.height);var b=a;v||(b-=h/2),f.style.left=Je(b),r.label==="\\textcircled"&&(f.style.top=".2em"),f=ve.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-m},{type:"elem",elem:f}]},e)}var _=ve.makeSpan(["mord","accent"],[f],e);return i?(i.children[0]=_,i.height=Math.max(_.height,i.height),i.classes[0]="mord",i):_},XN=(n,e)=>{var t=n.isStretchy?Ls.mathMLnode(n.label):new Ke.MathNode("mo",[mi(n.label,n.mode)]),r=new Ke.MathNode("mover",[fn(n.base,e),t]);return r.setAttribute("accent","true"),r},cet=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(n=>"\\"+n).join("|"));st({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(n,e)=>{var t=zp(e[0]),r=!cet.test(n.funcName),i=!r||n.funcName==="\\widehat"||n.funcName==="\\widetilde"||n.funcName==="\\widecheck";return{type:"accent",mode:n.parser.mode,label:n.funcName,isStretchy:r,isShifty:i,base:t}},htmlBuilder:Kv,mathmlBuilder:XN});st({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(n,e)=>{var t=e[0],r=n.parser.mode;return r==="math"&&(n.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+n.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:n.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:Kv,mathmlBuilder:XN});st({type:"accentUnder",names:["\\underleftar
2024-11-06 23:05:30 +00:00
]`,Fet="\\\\[a-zA-Z@]+",Uet="\\\\[^\uD800-\uDFFF]",Bet="("+Fet+")"+Tk+"*",Get=`\\\\(
2024-11-04 00:22:50 +00:00
|[ \r ]+
2024-11-06 23:05:30 +00:00
?)[ \r ]*`,g1="[̀-ͯ]",zet=new RegExp(g1+"+$"),Vet="("+Tk+"+)|"+(Get+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(g1+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(g1+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Bet)+("|"+Uet+")");class WC{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(Vet,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new li("EOF",new Fr(this,t,t));var r=this.tokenRegex.exec(e);if(r===null||r.index!==t)throw new Qe("Unexpected character: '"+e[t]+"'",new li(e[t],new Fr(this,t,t+1)));var i=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
`,this.tokenRegex.lastIndex);return s===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=s+1,this.lex()}return new li(i,new Fr(this,t,this.tokenRegex.lastIndex))}}class Het{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Qe("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,r){if(r===void 0&&(r=!1),r){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var qet=hk;P("\\noexpand",function(n){var e=n.popToken();return n.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});P("\\expandafter",function(n){var e=n.popToken();return n.expandOnce(!0),{tokens:[e],numArgs:0}});P("\\@firstoftwo",function(n){var e=n.consumeArgs(2);return{tokens:e[0],numArgs:0}});P("\\@secondoftwo",function(n){var e=n.consumeArgs(2);return{tokens:e[1],numArgs:0}});P("\\@ifnextchar",function(n){var e=n.consumeArgs(3);n.consumeSpaces();var t=n.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});P("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");P("\\TextOrMath",function(n){var e=n.consumeArgs(2);return n.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var KC={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};P("\\char",function(n){var e=n.popToken(),t,r="";if(e.text==="'")t=8,e=n.popToken();else if(e.text==='"')t=16,e=n.popToken();else if(e.text==="`")if(e=n.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new Qe("\\char` missing argument");r=e.text.charCodeAt(0)}else t=10;if(t){if(r=KC[e.text],r==null||r>=t)throw new Qe("Invalid base-"+t+" digit "+e.text);for(var i;(i=KC[n.future().text])!=null&&i<t;)r*=t,r+=i,n.popToken()}return"\\@char{"+r+"}"});var ny=(n,e,t)=>{var r=n.consumeArg().tokens;if(r.length!==1)throw new Qe("\\newcommand's first argument must be a macro name");var i=r[0].text,s=n.isDefined(i);if(s&&!e)throw new Qe("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!s&&!t)throw new Qe("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var o=0;if(r=n.consumeArg().tokens,r.length===1&&r[0].text==="["){for(var a="",l=n.expandNextToken();l.text!=="]"&&l.text!=="EOF";)a+=l.text,l=n.expandNextToken();if(!a.match(/^\s*[0-9]+\s*$/))throw new Qe("Invalid number of arguments: "+a);o=parseInt(a),r=n.consumeArg().tokens}return n.macros.set(i,{tokens:r,numArgs:o}),""};P("\\newcommand",n=>ny(n,!1,!0));P("\\renewcommand",n=>ny(n,!0,!1));P("\\providecommand",n=>ny(n,!0,!0));P("\\message",n=>{var e=n.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""});P("\\errmessage",n=>{var e=n.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""});P("\\show",n=>{var e=n.popToken(),t=e.text;return console.log(e,n.macros.get(t),_o[t],_n.math[t],_n.text[t]),""});P("\\bgroup","{");P("\\egroup","}");P("~","\\nobreakspace");P("\\lq","`");P("\\rq","'");P("\\aa","\\r a");P("\\AA","\\r A");P("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");P("\\copyright","\\TextOrMath{\\textcopyright
please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}XC.hasOwnProperty(t[0])&&!_n[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=XC[t[0]]+t.slice(1));var s=zet.exec(t);s&&(t=t.substring(0,s.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var o;if(_n[this.mode][t]){this.settings.strict&&this.mode==="math"&&u1.indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var a=_n[this.mode][t].group,l=Fr.range(e),d;if(kJe.hasOwnProperty(a)){var u=a;d={type:"atom",mode:this.mode,family:u,loc:l,text:t}}else d={type:a,mode:this.mode,loc:l,text:t};o=d}else if(t.charCodeAt(0)>=128)this.settings.strict&&(PN(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),o={type:"textord",mode:"text",loc:Fr.range(e),text:t};else return null;if(this.consume(),s)for(var m=0;m<s[0].length;m++){var f=s[0][m];if(!$0[f])throw new Qe("Unknown accent ' "+f+"'",e);var g=$0[f][this.mode]||$0[f].text;if(!g)throw new Qe("Accent "+f+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:Fr.range(e),label:g,isStretchy:!1,isShifty:!0,base:o}}return o}}Xh.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var iy=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new Xh(e,t);delete r.gullet.macros.current["\\df@tag"];var i=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new Qe("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new li("\\df@tag")])}]}return i},Rk=function(e,t,r){t.textContent="";var i=sy(e,r).toNode();t.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Rk=function(){throw new Qe("KaTeX doesn't work in quirks mode.")});var $et=function(e,t){var r=sy(e,t).toMarkup();return r},Wet=function(e,t){var r=new Gv(t);return iy(e,r)},Mk=function(e,t,r){if(r.throwOnError||!(e instanceof Qe))throw e;var i=ve.makeSpan(["katex-error"],[new hi(t)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},sy=function(e,t){var r=new Gv(t);try{var i=iy(e,r);return eet(i,e,r)}catch(s){return Mk(s,e,r)}},Ket=function(e,t){var r=new Gv(t);try{var i=iy(e,r);return tet(i,e,r)}catch(s){return Mk(s,e,r)}},jet={version:"0.16.11",render:Rk,renderToString:$et,ParseError:Qe,SETTINGS_SCHEMA:sp,__parse:Wet,__renderToDomTree:sy,__renderToHTMLTree:Ket,__setFontMetrics:TJe,__defineSymbol:S,__defineFunction:st,__defineMacro:P,__domTree:{Span:kd,Anchor:Hv,SymbolNode:hi,SvgNode:Os,PathNode:No,LineNode:d1}};const Qet=Object.freeze(Object.defineProperty({__proto__:null,default:jet},Symbol.toStringTag,{value:"Module"})),Xet=X3(Qet);(function(n){function e(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function t(r,i){const s=t.mergeDelimiters(i&&i.delimiters),o=i&&i.outerSpace||!1,a=i&&i.katexOptions||{};a.throwOnError=a.throwOnError||!1,a.macros=a.macros||i&&i.macros,t.katex||(i&&typeof i.engine=="object"?t.katex=i.engine:t.katex=Xet);for(const l of s.inline)o&&"outerSpace"in l&&(l.outerSpace=!0),r.inline.ruler.before("escape",l.name,t.inline(l)),r.renderer.rules[l.name]=(d,u)=>l.tmpl.replace(/\$1/,t.render(d[u].content,!!l.displayMode,a));for(const l of s.block)r.block.ruler.before("fence",l.name,t.block(l)),r.renderer.rules[l.name]=(d,u)=>l.tmpl.replace(/\$2/,e(d[u].info)).replace(
`}),t=yt([]),r=()=>{if(n.markdownText){let s=e.parse(n.markdownText,{}),o=[];t.value=[];for(let a=0;a<s.length;a++)s[a].type!=="fence"?o.push(s[a]):(o.length>0&&(t.value.push({type:"html",html:e.renderer.render(o,e.options,{})}),o=[]),t.value.push({type:"code",language:Zet(s[a].info),code:s[a].content}));o.length>0&&(t.value.push({type:"html",html:e.renderer.render(o,e.options,{})}),o=[])}else t.value=[];We(()=>{Ze.replace()})},i=(s,o)=>{t.value[s].code=o};return Zn(()=>n.markdownText,r),es(()=>{r(),We(()=>{window.MathJax&&window.MathJax.typesetPromise()})}),{markdownItems:t,updateCode:i}}},ett={class:"break-all container w-full"},ttt={ref:"mdRender",class:"markdown-content"},ntt=["innerHTML"];function rtt(n,e,t,r,i,s){const o=ht("code-block");return T(),M("div",ett,[c("div",ttt,[(T(!0),M(je,null,at(r.markdownItems,(a,l)=>(T(),M("div",{key:l},[a.type==="code"?(T(),Tt(o,{key:0,host:t.host,language:a.language,code:a.code,discussion_id:t.discussion_id,message_id:t.message_id,client_id:t.client_id,onUpdateCode:d=>r.updateCode(l,d)},null,8,["host","language","code","discussion_id","message_id","client_id","onUpdateCode"])):(T(),M("div",{key:1,innerHTML:a.html},null,8,ntt))]))),128))],512)])}const Zh=bt(Jet,[["render",rtt]]),itt={data(){return{show:!1,has_button:!0,message:""}},components:{MarkdownRenderer:Zh},methods:{hide(){this.show=!1,this.$emit("ok")},showMessage(n){this.message=n,this.has_button=!0,this.show=!0},showBlockingMessage(n){this.message=n,this.has_button=!1,this.show=!0},updateMessage(n){this.message=n,this.show=!0},hideMessage(){this.show=!1}}},stt={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-50"},ott={class:"pl-10 pr-10 bg-bg-light dark:bg-bg-dark p-8 rounded-lg shadow-lg"},att={class:"container max-h-500 overflow-y-auto"},ltt={class:"text-lg font-medium"},ctt={class:"mt-4 flex justify-center"},dtt={key:1,"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function utt(n,e,t,r,i,s){const o=ht("MarkdownRenderer");return i.show?(T(),M("div",stt,[c("div",ott,[c("div",att,[c("div",ltt,[W(o,{ref:"mdRender",host:"","markdown-text":i.message,message_id:0,discussion_id:0},null,8,["markdown-text"])])]),c("div",ctt,[i.has_button?(T(),M("button",{key:0,onClick:e[0]||(e[0]=(...a)=>s.hide&&s.hide(...a)),class:"bg-primary hover:bg-primary-light active:scale-95 duration-150 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-secondary-dark"}," OK ")):Y("",!0),i.has_button?Y("",!0):(T(),M("svg",dtt,e[1]||(e[1]=[c("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"},null,-1),c("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"},null,-1)])))])])])):Y("",!0)}const ptt=bt(itt,[["render",utt]]),htt={props:{progress:{type:Number,required:!0}}},mtt={class:"progress-bar-container"};function ftt(n,e,t,r,i,s){return T(),M("div",mtt,[c("div",{class:"progress-bar",style:on({width:`${t.progress}%`})},null,4)])}const oy=bt(htt,[["render",ftt]]),gtt={setup(){return{}},name:"UniversalForm",data(){return{show:!1,resolve:null,controls_array:[],title:"Universal form",ConfirmButtonText:"Submit",DenyButt
2024-11-06 23:05:30 +00:00
c-3-0.3-6-0.5-8.9-0.5c-21.7,0-42.2,8.5-57.5,23.8l-20.8,20.8c-6.7,6.7-6.7,17.6,0,24.3l108.5,108.5l-132.4,132.4\r
c-6.7,6.7-6.7,17.6,0,24.3c3.3,3.3,7.7,5,12.1,5s8.8-1.7,12.1-5l132.5-132.5l108.5,108.5c3.3,3.3,7.7,5,12.1,5s8.8-1.7,12.1-5\r
l20.8-20.8c17.6-17.6,26.1-41.8,23.3-66.4l-7-63.5l40.3-40.3l16.2,16.2c6.7,6.7,17.6,6.7,24.3,0l72.6-72.6c3.2-3.2,5-7.6,5-12.1\r
s-1.8-8.9-5-12.1L300.625,5.025z M400.425,250.025l-16.2-16.3c-6.4-6.4-17.8-6.4-24.3,0l-58.2,58.3c-3.7,3.7-5.5,8.8-4.9,14\r
l7.9,71.6c1.6,14.3-3.3,28.3-13.5,38.4l-8.7,8.7l-217.1-217.1l8.7-8.6c10.1-10.1,24.2-15,38.4-13.5l71.7,7.9\r
c5.2,0.6,10.3-1.2,14-4.9l58.2-58.2c6.7-6.7,6.7-17.6,0-24.3l-16.3-16.3l48.3-48.3l160.3,160.3L400.425,250.025z`})],-1)]),8,drt))],8,crt),W(o),c("div",{class:"toolbar-button",onMouseleave:e[5]||(e[5]=(...b)=>s.hideInfosMenu&&s.hideInfosMenu(...b))},[c("div",urt,[i.isInfosMenuVisible?(T(),M("div",{key:0,onMouseenter:e[3]||(e[3]=(...b)=>s.showInfosMenu&&s.showInfosMenu(...b)),class:"absolute m-0 p-0 z-50 top-full right-0 transform bg-white dark:bg-gray-900 rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none transition-all duration-300 ease-out mb-2"},[c("div",prt,[c("div",hrt,[s.isModelOK?(T(),M("div",mrt,e[16]||(e[16]=[c("svg",{class:"w-8 h-8",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[c("path",{d:"M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),c("path",{d:"M9 12L11 14L15 10",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))):(T(),M("div",frt,e[17]||(e[17]=[c("svg",{class:"w-8 h-8",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[c("path",{d:"M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),c("path",{d:"M15 9L9 15",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),c("path",{d:"M9 9L15 15",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))),s.isGenerating?(T(),M("div",_rt,e[19]||(e[19]=[c("svg",{class:"w-6 h-6 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1)]))):(T(),M("div",grt,e[18]||(e[18]=[c("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 21v-4m0 0V5a2 2 0 012-2h6.5l1 1H21l-3 6 3 6h-8.5l-1-1H5a2 2 0 00-2 2zm9-13.5V9"})],-1)]))),s.isConnected?(T(),M("div",brt,e[20]||(e[20]=[c("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 10V3L4 14h7v7l9-11h-7z"})],-1)]))):(T(),M("div",vrt,e[21]||(e[21]=[c("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"})],-1)])))]),c("div",yrt,[W(a,{onClick:n.restartProgram,icon:"power",title:"restart program"},null,8,["onClick"]),W(a,{onClick:s.refreshPage,icon:"refresh-ccw",title:"refresh page"},null,8,["onClick"]),W(a,{href:"/docs",icon:"file-text",title:"Fast API doc"})]),W(l,{href:"https://github.com/ParisNeo/lollms-webui",icon:"github"}),W(l,{href:"https://www.youtube.com/channel/UCJzrg0cyQV2Z30SQ1v2FdSQ",icon:"youtube"}),W(l,{href:"https://x.com/ParisNeo_AI",icon:"x"}),W(l,{href:"https://discord.com/channels/1092918764925882418",icon:"discord"}),c("div",Ert,[c("div",{onClick:e[2]||(e[2]=b=>s.showNews()),class:"text-2xl w-8 h-8 cursor-pointer transition-colors duration-300 text-gray-600 hover:text-primary dark:text-gray-300 dark:hover:text-primary"},e[22]||(e[22]=[c("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"w-full h-full"},[c("path",{d:"M19 20H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v1m2 13a2 2 0 0 1-2-2V7m2 13a2 2 0 0 0 2-2V9a2
2024-11-04 00:22:50 +00:00
<div class="bg-white p-6 rounded-md shadow-md w-80">
<h2 class="text-lg font-semibold mb-3">${n}</h2>
<textarea id="replacementInput" class="w-full h-32 border rounded p-2 mb-3">${e}</textarea>
<div class="flex justify-end">
<button id="cancelButton" class="mr-2 px-4 py-2 border rounded">Cancel</button>
<button id="okButton" class="px-4 py-2 bg-blue-500 text-white rounded">OK</button>
</div>
</div>
`:s.innerHTML=`
<div class="bg-white p-6 rounded-md shadow-md w-80">
<h2 class="text-lg font-semibold mb-3">${n}</h2>
<select id="options_selector" class="form-control w-full h-25 border rounded p-2 mb-3">
${t.map(l=>`<option value="${l}">${l}</option>`)}
</select>
<div class="flex justify-end">
<button id="cancelButton" class="mr-2 px-4 py-2 border rounded">Cancel</button>
<button id="okButton" class="px-4 py-2 bg-blue-500 text-white rounded">OK</button>
</div>
</div>
2024-11-06 23:05:30 +00:00
`,document.body.appendChild(s);const o=s.querySelector("#cancelButton"),a=s.querySelector("#okButton");o.addEventListener("click",()=>{document.body.removeChild(s),r(null)}),a.addEventListener("click",()=>{if(t.length===0){const d=s.querySelector("#replacementInput").value.trim();document.body.removeChild(s),r(d)}else{const d=s.querySelector("#options_selector").value.trim();document.body.removeChild(s),r(d)}})})}function yot(n,e){console.log(n);let t={},r=/@<([^>]+)>@/g,i=[],s;for(;(s=r.exec(n))!==null;)i.push("@<"+s[1]+">@");console.log("matches"),console.log(i),i=[...new Set(i)];async function o(l){console.log(l);let d=l.toLowerCase().substring(2,l.length-2);if(d!=="generation_placeholder")if(d.includes(":")){Object.entries({all_language_options:"english:french:german:chinese:japanese:spanish:italian:russian:portuguese:swedish:danish:dutch:norwegian:slovak:czech:hungarian:polish:ukrainian:bulgarian:latvian:lithuanian:estonian:maltese:irish:galician:basque:welsh:breton:georgian:turkmen:kazakh:uzbek:tajik:afghan:sri-lankan:filipino:vietnamese:lao:cambodian:thai:burmese:kenyan:botswanan:zimbabwean:malawian:mozambican:angolan:namibian:south-african:madagascan:seychellois:mauritian:haitian:peruvian:ecuadorian:bolivian:paraguayan:chilean:argentinean:uruguayan:brazilian:colombian:venezuelan:puerto-rican:cuban:dominican:honduran:nicaraguan:salvadorean:guatemalan:el-salvadoran:belizean:panamanian:costa-rican:antiguan:barbudan:dominica's:grenada's:st-lucia's:st-vincent's:gibraltarian:faroe-islander:greenlandic:icelandic:jamaican:trinidadian:tobagonian:barbadian:anguillan:british-virgin-islander:us-virgin-islander:turkish:israeli:palestinian:lebanese:egyptian:libyan:tunisian:algerian:moroccan:bahraini:kuwaiti:saudi-arabian:yemeni:omani:irani:iraqi:afghanistan's:pakistani:indian:nepalese:sri-lankan:maldivan:burmese:thai:lao:vietnamese:kampuchean:malaysian:bruneian:indonesian:australian:new-zealanders:fijians:tongans:samoans:vanuatuans:wallisians:kiribatians:tuvaluans:solomon-islanders:marshallese:micronesians:hawaiians",all_programming_language_options:"python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio"}).forEach(([b,_])=>{console.log(`Key: ${b}, Value: ${_}`);function y(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const E=y(b),x=new RegExp(E,"g");d=d.replace(x,_)});let m=d.split(":"),f=m[0],g=m[1]||"",h=[];m.length>2&&(h=m.slice(1));let v=await pA(f,g,h);v!==null&&(t[l]=v)}else{let u=await pA(d);u!==null&&(t[l]=u)}}let a=Promise.resolve();i.forEach(l=>{a=a.then(()=>o(l)).then(d=>{console.log(d)})}),a.then(()=>{Object.entries(t).forEach(([l,d])=>{console.log(`Key: ${l}, Value: ${d}`);function u(g){return g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const m=u(l),f=new RegExp(m,"g");n=n.replace(f,d)}),e(n)})}const Eot={name:"PlayGroundView",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},showSettings:!1,pending:!1,is_recording:!1,is_deaf_transcribing:!1,cpp_block:Qk,html5_block:Xk,LaTeX_block:Zk,javascript_block:Kk,json_block:jk,code_block:$k,python_block:Wk,bash_block:Jk,tokenize_icon:est,deaf_off:nst,deaf_on:tst,rec_off:ist,rec_on:rst,loading_icon:eI,isSynthesizingVoice:!1,audio_url:null,mdRenderHeight:300,selecting_model:!1,tab_id:"source",generating:!1,isSpeaking:!1,voices:[],isLesteningToVoice:!1,presets:[],selectedPreset:"",cursorPosition:0,namedTokens:[],text:"",pre_text:"",post_text:"",temperature:.1,top_k:50,top_p:.9,repeat_penalty:1.3,repeat_last_n:50,n_crop:-1,n_predicts:2e3,seed:-1,silenceTimeout:5e3}},components:{Toast:ay,MarkdownRenderer:Zh,ClipBoardTextInput:hy,TokensHilighter:Wit,ChatBarButton:Yk,Card:tm,ToolbarButton:my,DropdownMenu:dI},mounted(){de.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,th
2024-11-04 00:22:50 +00:00
`?(this.text=this.text.slice(0,e)+"```"+n+"\n\n```\n"+this.text.slice(e),e=e+4+n.length):(this.text=this.text.slice(0,e)+"\n```"+n+"\n\n```\n"+this.text.slice(e),e=e+3+n.length):speechSynthesis==0||this.text[e-1]==`
`?(this.text=this.text.slice(0,e)+"```"+n+`
`+this.text.slice(e,t)+"\n```\n"+this.text.slice(t),e=e+4+n.length):(this.text=this.text.slice(0,e)+"\n```"+n+`
`+this.text.slice(e,t)+"\n```\n"+this.text.slice(t),e=e+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},insertTab(n){const e=n.target,t=e.selectionStart,r=e.selectionEnd,i=e.value.substring(0,t),s=e.value.substring(r),o=i+" "+s;this.text=o,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+4}),n.preventDefault()},mdTextarea_changed(){console.log("mdTextarea_changed"),this.cursorPosition=this.$refs.mdTextarea.selectionStart},mdTextarea_clicked(){console.log(`mdTextarea_clicked: ${this.$refs.mdTextarea.selectionStart}`),this.cursorPosition=this.$refs.mdTextarea.selectionStart},setModel(){this.selecting_model=!0,de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:this.selectedModel}).then(n=>{console.log(n),n.status&&this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,!0),this.selecting_model=!1}).catch(n=>{this.$refs.toast.showToast(`Error ${n}`,4,!0),this.selecting_model=!1})},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){console.log("READING..."),this.isSynthesizingVoice=!0;let n=this.$refs.mdTextarea.selectionStart,e=this.$refs.mdTextarea.selectionEnd,t=this.text;n!=e&&(t=t.slice(n,e)),de.post("./text2Wave",{client_id:this.$store.state.client_id,text:t}).then(r=>{console.log(r.data.url);let i=r.data.url;this.audio_url=i,this.isSynthesizingVoice=!1,We(()=>{Ze.replace()})}).catch(r=>{this.$refs.toast.showToast(`Error: ${r}`,4,!1),this.isSynthesizingVoice=!1,We(()=>{Ze.replace()})})},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let n=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(i=>i.name===this.$store.state.config.audio_out_voice)[0]);const t=i=>{let s=this.text.substring(i,i+e);const o=[".","!","?",`
2024-11-06 23:05:30 +00:00
`];let a=-1;return o.forEach(l=>{const d=s.lastIndexOf(l);d>a&&(a=d)}),a==-1&&(a=s.length),console.log(a),a+i+1},r=()=>{const i=t(n),s=this.text.substring(n,i);this.msg.text=s,n=i+1,this.msg.onend=o=>{n<this.text.length-2?setTimeout(()=>{r()},1):(this.isSpeaking=!1,console.log("voice off :",this.text.length," ",i))},this.speechSynthesis.speak(this.msg)};r()},getCursorPosition(){return this.$refs.mdTextarea.selectionStart},appendToOutput(n){this.pre_text+=n,this.text=this.pre_text+this.post_text},generate_in_placeholder(){console.log("Finding cursor position");let n=this.text.indexOf("@<generation_placeholder>@");if(n<0){this.$refs.toast.showToast("No generation placeholder found",4,!1);return}this.text=this.text.substring(0,n)+this.text.substring(n+26,this.text.length),this.pre_text=this.text.substring(0,n),this.post_text=this.text.substring(n,this.text.length);var e=this.text.substring(0,n);console.log(e),rt.emit("generate_text",{prompt:e,personality:-1,n_predicts:this.n_predicts,n_crop:this.n_crop,parameters:{temperature:this.temperature,top_k:this.top_k,top_p:this.top_p,repeat_penalty:this.repeat_penalty,repeat_last_n:this.repeat_last_n,seed:parseInt(this.seed)}}),this.generating=!0},async tokenize_text(){const n=await de.post("/lollms_tokenize",{prompt:this.text},{headers:this.posts_headers});console.log(n.data.named_tokens),this.namedTokens=n.data.named_tokens},generate(){console.log("Finding cursor position"),this.pre_text=this.text.substring(0,this.getCursorPosition()),this.post_text=this.text.substring(this.getCursorPosition(),this.text.length);var n=this.text.substring(0,this.getCursorPosition());console.log(this.text),console.log(`cursor position :${this.getCursorPosition()}`),console.log(`pretext:${this.pre_text}`),console.log(`post_text:${this.post_text}`),console.log(`prompt:${n}`),rt.emit("generate_text",{prompt:n,personality:-1,n_predicts:this.n_predicts,n_crop:this.n_crop,parameters:{temperature:this.temperature,top_k:this.top_k,top_p:this.top_p,repeat_penalty:this.repeat_penalty,repeat_last_n:this.repeat_last_n,seed:parseInt(this.seed)}}),this.generating=!0},stopGeneration(){rt.emit("cancel_text_generation",{})},exportText(){const n=this.text,e=document.createElement("a"),t=new Blob([n],{type:"text/plain"});e.href=URL.createObjectURL(t),e.download="exported_text.txt",document.body.appendChild(e),e.click(),document.body.removeChild(e)},importText(){const n=document.getElementById("import-input");n&&(n.addEventListener("change",e=>{if(e.target.files&&e.target.files[0]){const t=new FileReader;t.onload=()=>{this.text=t.result},t.readAsText(e.target.files[0])}else alert("Please select a file.")}),n.click())},setPreset(){console.log("Setting preset"),console.log(this.selectedPreset),this.tab_id="render",this.text=yot(this.selectedPreset.content,n=>{console.log("Done"),console.log(n),this.text=n})},addPreset(){let n=prompt("Enter the title of the preset:");this.presets[n]={client_id:this.$store.state.client_id,name:n,content:this.text},de.post("./add_preset",this.presets[n]).then(e=>{console.log(e.data)}).catch(e=>{this.$refs.toast.showToast(`Error: ${e}`,4,!1)})},removePreset(){this.selectedPreset&&delete this.presets[this.selectedPreset.name]},reloadPresets(){de.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)})},startRecording(){this.pending=!0,this.is_recording?de.post("/stop_recording",{client_id:this.$store.state.client_id}).then(n=>{this.is_recording=!1,this.pending=!1,console.log(n),this.text+=n.data,console.log("text"),console.log(this.text),console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)}):de.post("/start_recording",{client_id:this.$store.state.client_id}).then(n=>{this.is_recording=!0,this.pending=!1,console.log(n.data)}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)})},startRecordingAndTranscribing(){this.pending=!0,this.is_deaf_transcribing?de.get("/stop_recording").then(n=>{this.is_dea
2024-11-04 00:22:50 +00:00
`).map(i=>{const s=i.match(/^\s+/);if(s===null)return i;const[o]=s;return o.length>=r.length?i.slice(r.length):i}).join(`
`)}class Hp{constructor(e){pn(this,"options");pn(this,"rules");pn(this,"lexer");this.options=e||ka}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const r=t[0].replace(/^(?: {1,4}| {0,3}\t)/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:yc(r,`
2024-11-06 23:05:30 +00:00
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const r=t[0],i=vat(r,t[3]||"");return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(/#$/.test(r)){const i=yc(r,"#");(this.options.pedantic||!i||/ $/.test(i))&&(r=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:yc(t[0],`
2024-11-04 00:22:50 +00:00
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let r=yc(t[0],`
`).split(`
`),i="",s="";const o=[];for(;r.length>0;){let a=!1;const l=[];let d;for(d=0;d<r.length;d++)if(/^ {0,3}>/.test(r[d]))l.push(r[d]),a=!0;else if(!a)l.push(r[d]);else break;r=r.slice(d);const u=l.join(`
`),m=u.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
$1`).replace(/^ {0,3}>[ \t]?/gm,"");i=i?`${i}
${u}`:u,s=s?`${s}
${m}`:m;const f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(m,o,!0),this.lexer.state.top=f,r.length===0)break;const g=o[o.length-1];if((g==null?void 0:g.type)==="code")break;if((g==null?void 0:g.type)==="blockquote"){const h=g,v=h.raw+`
`+r.join(`
`),b=this.blockquote(v);o[o.length-1]=b,i=i.substring(0,i.length-h.raw.length)+b.raw,s=s.substring(0,s.length-h.text.length)+b.text;break}else if((g==null?void 0:g.type)==="list"){const h=g,v=h.raw+`
`+r.join(`
`),b=this.list(v);o[o.length-1]=b,i=i.substring(0,i.length-g.raw.length)+b.raw,s=s.substring(0,s.length-h.raw.length)+b.raw,r=v.substring(o[o.length-1].raw.length).split(`
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim();const i=r.length>1,s={type:"list",raw:"",ordered:i,start:i?+r.slice(0,-1):"",loose:!1,items:[]};r=i?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=i?r:"[*+-]");const o=new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`);let a=!1;for(;e;){let l=!1,d="",u="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let m=t[2].split(`
`,1)[0].replace(/^\t+/,_=>" ".repeat(3*_.length)),f=e.split(`
`,1)[0],g=!m.trim(),h=0;if(this.options.pedantic?(h=2,u=m.trimStart()):g?h=t[1].length+1:(h=t[2].search(/[^ ]/),h=h>4?1:h,u=m.slice(h),h+=t[1].length),g&&/^[ \t]*$/.test(f)&&(d+=f+`
`,e=e.substring(f.length+1),l=!0),!l){const _=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),E=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),x=new RegExp(`^ {0,${Math.min(3,h-1)}}#`),A=new RegExp(`^ {0,${Math.min(3,h-1)}}<[a-z].*>`,"i");for(;e;){const w=e.split(`
`,1)[0];let N;if(f=w,this.options.pedantic?(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," "),N=f):N=f.replace(/\t/g," "),E.test(f)||x.test(f)||A.test(f)||_.test(f)||y.test(f))break;if(N.search(/[^ ]/)>=h||!f.trim())u+=`
`+N.slice(h);else{if(g||m.replace(/\t/g," ").search(/[^ ]/)>=4||E.test(m)||x.test(m)||y.test(m))break;u+=`
`+f}!g&&!f.trim()&&(g=!0),d+=w+`
2024-11-06 23:05:30 +00:00
`,e=e.substring(w.length+1),m=N.slice(h)}}s.loose||(a?s.loose=!0:/\n[ \t]*\n[ \t]*$/.test(d)&&(a=!0));let v=null,b;this.options.gfm&&(v=/^\[[ xX]\] /.exec(u),v&&(b=v[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:d,task:!!v,checked:b,loose:!1,text:u,tokens:[]}),s.raw+=d}s.items[s.items.length-1].raw=s.items[s.items.length-1].raw.trimEnd(),s.items[s.items.length-1].text=s.items[s.items.length-1].text.trimEnd(),s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){const d=s.items[l].tokens.filter(m=>m.type==="space"),u=d.length>0&&d.some(m=>/\n.*\n/.test(m.raw));s.loose=u}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const r=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:i,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const r=fA(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),s=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===i.length){for(const a of i)/^ *-+: *$/.test(a)?o.align.push("right"):/^ *:-+: *$/.test(a)?o.align.push("center"):/^ *:-+ *$/.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<r.length;a++)o.header.push({text:r[a],tokens:this.lexer.inline(r[a]),header:!0,align:o.align[a]});for(const a of s)o.rows.push(fA(a,o.header.length).map((l,d)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[d]})));return o}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const r=t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Ur(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const r=t[2].trim();if(!this.options.pedantic&&/^</.test(r)){if(!/>$/.test(r))return;const o=yc(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{const o=bat(t[2],"()");if(o>-1){const l=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){const o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);o&&(i=o[1],s=o[3])}else s=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(r)?i=i.slice(1):i=i.slice(1,-1)),gA(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const i=(r[2]||r[1]).replace(/\s+/g," "),s=t[i.toLowerCase()];if(!s){const o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return gA(r,s,r[0],this.lexer)}}emStrong(e,t,r=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i||i[3]&&r.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const o=[...i[0]].length-1;let a,l,d=o,u=0;const m=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+o);(i=m.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(l=[...a].length,i[3]||i[4]){d+=l;continue}else if((i[5]||i[6])&&o%3&&!((o+l)%3)){u+=l;continue}if(d-=l,d>0)continue;l=Math.min(l,l+d+u);const f=[...i[0]][0].length,g=e.slice(0,o+i.index+f+l);if(Math.min(o,l)%2){const v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}const h=g.slice(2,-2);return{type:"strong",raw:g,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(/\n/g," ");const i=/[^ ]/.test(r),s=/^ /.test(r)&&/ $/.test(r);return i&&s&&(r=r.substring(1,r.length-1)),r=Ur(r,!0),{type:"codespan",raw:t[0],text:r}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let r,i;return t[2]==="@"?(r=Ur(t[1]),i="mailto:"+r):(r=Ur(t[1]),i=r),{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}url(e){var r;let t;if(t=this.rules.inline.url.exec(e)){let i,s;if(t[2]==="@")i=Ur(t[0]),s="mailto:"+i;else{let o;do o=t[0],t[0]=((r=this.rules.inline._backpedal.exec(t[0]))==null?void 0:r[0])??"";while(o!==t[0]);i=Ur(t[0]),t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let r;return this.lexer.state.inRawBlock?r=t[0]:r=Ur(t[0]),{type:"text",raw:t[0],text:r}}}}const yat=/^(?:[ \t]*(?:\n|$))+/,Eat=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Sat=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ld=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,xat=/^ {0,3}(#{1,6})(?=\s|$
]`).replace("lheading",fI).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},_I=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,kat=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,bI=/^( {2,}|\\)\n(?!\s*$)/,Iat=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Pd="\\p{P}\\p{S}",Oat=dn(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Pd).getRegex(),Dat=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Lat=dn(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Pd).getRegex(),Pat=dn("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Pd).getRegex(),Fat=dn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Pd).getRegex(),Uat=dn(/\\([punct])/,"gu").replace(/punct/g,Pd).getRegex(),Bat=dn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Gat=dn(wy).replace("(?:-->|$)","-->").getRegex(),zat=dn("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Gat).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qp=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Vat=dn(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",qp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),vI=dn(/^!?\[(label)\]\[(ref)\]/).replace("label",qp).replace("ref",Ty).getRegex(),yI=dn(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ty).getRegex(),Hat=dn("reflink|nolink(?!\\()","g").replace("reflink",vI).replace("nolink",yI).getRegex(),Ay={_backpedal:Wc,anyPunctuation:Uat,autolink:Bat,blockSkip:Dat,br:bI,code:kat,del:Wc,emStrongLDelim:Lat,emStrongRDelimAst:Pat,emStrongRDelimUnd:Fat,escape:_I,link:Vat,nolink:yI,punctuation:Oat,reflink:vI,reflinkSearch:Hat,tag:zat,text:Iat,url:Wc},qat={...Ay,link:dn(/^!?\[(label)\]\((.*?)\)/).replace("label",qp).getRegex(),reflink:dn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qp).getRegex()},w1={...Ay,escape:dn(_I).replace("])","~|])").getRegex(),url:dn(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Yat={...w1,br:dn(bI).replace("{2,}","*").getRegex(),text:dn(w1.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},gu={normal:Cy,gfm:Mat,pedantic:Nat},Ec={normal:Ay,gfm:w1,breaks:Yat,pedantic:qat};class ii{constructor(e){pn(this,"tokens");pn(this,"options");pn(this,"state");pn(this,"tokenizer");pn(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ka,this.options.tokenizer=this.options.tokenizer||new Hp,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:gu.normal,inline:Ec.normal};this.options.pedantic?(t.block=gu
2024-11-04 00:22:50 +00:00
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){this.options.pedantic&&(e=e.replace(/\t/g," ").replace(/^ +$/gm,""));let i,s,o;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(i=a.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))){if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length),i.raw.length===1&&t.length>0?t[t.length-1].raw+=`
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
`+i.raw,s.text+=`
`+i.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
`+i.raw,s.text+=`
`+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(o=e,this.options.extensions&&this.options.extensions.startBlock){let a=1/0;const l=e.slice(1);let d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},l),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(i=this.tokenizer.paragraph(o))){s=t[t.length-1],r&&(s==null?void 0:s.type)==="paragraph"?(s.raw+=`
`+i.raw,s.text+=`
`+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i),r=o.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length),s=t[t.length-1],s&&s.type==="text"?(s.raw+=`
`+i.raw,s.text+=`
`+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r,i,s,o=e,a,l,d;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)u.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,a.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(d=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(r=u.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))){if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),i=t[t.length-1],i&&r.type==="text"&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length),i=t[t.length-1],i&&r.type==="text"&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,o,d)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}if(s=e,this.options.extensions&&this.options.extensions.startInline){let u=1/0;const m=e.slice(1);let f;this.options.extensions.startInline.forEach(g=>{f=g.call({lexer:this},m),typeof f=="number"&&f>=0&&(u=Math.min(u,f))}),u<1/0&&u>=0&&(s=e.substring(0,u+1))}if(r=this.tokenizer.inlineText(s)){e=e.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(d=r.raw.slice(-1)),l=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):t.push(r);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}}class Yp{constructor(e){pn(this,"options");pn(this,"parser");this.options=e||ka}space(e){return""}code({text:e,lang:t,escaped:r}){var o;const i=(o=(t||"").match(/^\S*/))==null?void 0:o[0],s=e.replace(/\n$/,"")+`
`;return i?'<pre><code class="language-'+Ur(i)+'">'+(r?s:Ur(s,!0))+`</code></pre>
`:"<pre><code>"+(r?s:Ur(s,!0))+`</code></pre>
`}blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
`}hr(e){return`<hr>
`}list(e){const t=e.ordered,r=e.start;let i="";for(let a=0;a<e.items.length;a++){const l=e.items[a];i+=this.listitem(l)}const s=t?"ol":"ul",o=t&&r!==1?' start="'+r+'"':"";return"<"+s+o+`>
`+i+"</"+s+`>
`}listitem(e){let t="";if(e.task){const r=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&e.tokens[0].type==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" "}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let t="",r="";for(let s=0;s<e.header.length;s++)r+=this.tablecell(e.header[s]);t+=this.tablerow({text:r});let i="";for(let s=0;s<e.rows.length;s++){const o=e.rows[s];r="";for(let a=0;a<o.length;a++)r+=this.tablecell(o[a]);i+=this.tablerow({text:r})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+i+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){const t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
2024-11-06 23:05:30 +00:00
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){const i=this.parser.parseInline(r),s=mA(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+i+"</a>",o}image({href:e,title:t,text:r}){const i=mA(e);if(i===null)return r;e=i;let s=`<img src="${e}" alt="${r}"`;return t&&(s+=` title="${t}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class Ry{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class si{constructor(e){pn(this,"options");pn(this,"renderer");pn(this,"textRenderer");this.options=e||ka,this.options.renderer=this.options.renderer||new Yp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ry}static parse(e,t){return new si(t).parse(e)}static parseInline(e,t){return new si(t).parseInline(e)}parse(e,t=!0){let r="";for(let i=0;i<e.length;i++){const s=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const a=s,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){r+=l||"";continue}}const o=s;switch(o.type){case"space":{r+=this.renderer.space(o);continue}case"hr":{r+=this.renderer.hr(o);continue}case"heading":{r+=this.renderer.heading(o);continue}case"code":{r+=this.renderer.code(o);continue}case"table":{r+=this.renderer.table(o);continue}case"blockquote":{r+=this.renderer.blockquote(o);continue}case"list":{r+=this.renderer.list(o);continue}case"html":{r+=this.renderer.html(o);continue}case"paragraph":{r+=this.renderer.paragraph(o);continue}case"text":{let a=o,l=this.renderer.text(a);for(;i+1<e.length&&e[i+1].type==="text";)a=e[++i],l+=`
`+this.renderer.text(a);t?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l}]}):r+=l;continue}default:{const a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,t){t=t||this.renderer;let r="";for(let i=0;i<e.length;i++){const s=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=a||"";continue}}const o=s;switch(o.type){case"escape":{r+=t.text(o);break}case"html":{r+=t.html(o);break}case"link":{r+=t.link(o);break}case"image":{r+=t.image(o);break}case"strong":{r+=t.strong(o);break}case"em":{r+=t.em(o);break}case"codespan":{r+=t.codespan(o);break}case"br":{r+=t.br(o);break}case"del":{r+=t.del(o);break}case"text":{r+=t.text(o);break}default:{const a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}}class Kc{constructor(e){pn(this,"options");pn(this,"block");this.options=e||ka}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?ii.lex:ii.lexInline}provideParser(){return this.block?si.parse:si.parseInline}}pn(Kc,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class $at{constructor(...e){pn(this,"defaults",Sy());pn(this,"options",this.setOptions);pn(this,"parse",this.parseMarkdown(!0));pn(this,"parseInline",this.parseMarkdown(!1));pn(this,"Parser",si);pn(this,"Renderer",Yp);pn(this,"TextRenderer",Ry);pn(this,"Lexer",ii);pn(this,"Tokenizer",Hp);pn(this,"Hooks",Kc);this.use(...e)}walkTokens(e,t){var i,s;let r=[];for(const o of e)switch(r=r.concat(t.call(this,o)),o.type){case"table":{const a=o;for(const l of a.header)r=r.concat(this.walkTokens(l.tokens,t));for(const l of a.rows)for(const d of l)r=r.concat(this.walkTokens(d.tokens,t));break}case"list":{const a=o;r=r.concat(this.walkTokens(a.items,t));break}default:{const a=o;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{const d=a[l].flat(1/0);r=r.concat(this.walkTokens(d,t))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,t)))}}return r}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{const i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const o=t.renderers[s.name];o?t.renderers[s.name]=function(...a){let l=s.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const o=t[s.level];o?o.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),i.extensions=t),r.renderer){const s=this.defaults.renderer||new Yp(this.defaults);for(const o in r.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;const a=o,l=r.renderer[a],d=s[a];s[a]=(...u)=>{let m=l.apply(s,u);return m===!1&&(m=d.apply(s,u)),m||""}}i.renderer=s}if(r.tokenizer){const s=this.defaults.tokenizer||new Hp(this.defaults);for(const o in r.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;const a=o,l=r.tokenizer[a],d=s[a];s[a]=(...u)=>{let m=l.apply(s,u);return m===!1&&(m=d.apply(s,u)),m}}i.tokenizer=s}if(r.hooks){const s=this.defaults.hooks||new Kc;for(const o in r.hooks){if(!(o in s))throw new Error(`hook '$
Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An error occurred:</p><pre>"+Ur(r.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(r);throw r}}}const Sa=new $at;function nn(n,e){return Sa.parse(n,e)}nn.options=nn.setOptions=function(n){return Sa.setOptions(n),nn.defaults=Sa.defaults,uI(nn.defaults),nn};nn.getDefaults=Sy;nn.defaults=ka;nn.use=function(...n){return Sa.use(...n),nn.defaults=Sa.defaults,uI(nn.defaults),nn};nn.walkTokens=function(n,e){return Sa.walkTokens(n,e)};nn.parseInline=Sa.parseInline;nn.Parser=si;nn.parser=si.parse;nn.Renderer=Yp;nn.TextRenderer=Ry;nn.Lexer=ii;nn.lexer=ii.lex;nn.Tokenizer=Hp;nn.Hooks=Kc;nn.parse=nn;nn.options;nn.setOptions;nn.use;nn.walkTokens;nn.parseInline;si.parse;ii.lex;const Wat={name:"HelpView",data(){return{helpSections:[]}},methods:{toggleSection(n){this.helpSections[n].isOpen=!this.helpSections[n].isOpen},async loadMarkdownFile(n){try{const t=await(await fetch(`/help/${n}`)).text();return nn(t)}catch(e){return console.error("Error loading markdown file:",e),"Error loading help content."}},async loadHelpSections(){const n=[{title:"About LoLLMs",file:"lollms-context.md"},{title:"Getting Started",file:"getting-started.md"},{title:"Uploading Files",file:"uploading-files.md"},{title:"Sending Images",file:"sending-images.md"},{title:"Using Code Interpreter",file:"code-interpreter.md"},{title:"Internet Search",file:"internet-search.md"}];for(const e of n){const t=await this.loadMarkdownFile(e.file);this.helpSections.push({title:e.title,content:t,isOpen:!1})}}},mounted(){this.loadHelpSections()}},Kat={class:"help-view background-color p-6 w-full"},jat={class:"big-card w-full"},Qat={class:"help-sections-container"},Xat={class:"help-sections space-y-4"},Zat=["onClick"],Jat={class:"toggle-icon"},elt={key:0,class:"help-content mt-4"},tlt=["innerHTML"];function nlt(n,e,t,r,i,s){return T(),M("div",Kat,[c("div",jat,[e[0]||(e[0]=c("h1",{class:"text-4xl md:text-5xl font-bold text-gray-800 dark:text-gray-100 mb-6"},"LoLLMs Help",-1)),c("div",Qat,[c("div",Xat,[(T(!0),M(je,null,at(i.helpSections,(o,a)=>(T(),M("div",{key:a,class:"help-section message"},[c("h2",{onClick:l=>s.toggleSection(a),class:"menu-item cursor-pointer flex justify-between items-center"},[pt(X(o.title)+" ",1),c("span",Jat,X(o.isOpen?"▼":"▶"),1)],8,Zat),o.isOpen?(T(),M("div",elt,[c("div",{innerHTML:o.content,class:"prose dark:prose-invert"},null,8,tlt)])):Y("",!0)]))),128))])])])])}const rlt=bt(Wat,[["render",nlt],["__scopeId","data-v-8c1798f3"]]);function Wi(n,e=!0,t=1){const r=e?1e3:1024;if(Math.abs(n)<r)return n+" B";const i=e?["kB","MB","GB","TB","PB","EB","ZB","YB"]:["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let s=-1;const o=10**t;do n/=r,++s;while(Math.round(Math.abs(n)*o)/o>=r&&s<i.length-1);return n.toFixed(t)+" "+i[s]}const wr="/assets/logo-B22RoIQ8.png",ilt={props:{title:{type:String,required:!1,value:"menu"},icon:{type:String,required:!1,value:"feather:menu"},commands:{type:Array,required:!0},force_position:{required:!1,value:0},execute_cmd:{type:Function,required:!1},menuIconClass:{type:String,required:!1,default:""},selected_entry:{type:String,required:!1}},data(){return{isMenuOpen:!1,menuPosition:{bottom:"auto",top:"calc(100% + 10px)"}}},methods:{handleClickOutside(n){const e=this.$refs.menu,t=this.$refs.menuButton;e&&!e.contains(n.target)&&!t.contains(n.target)&&(this.isMenuOpen=!1,window.removeEventListener("click",this.handleClickOutside))},toggleMenu(){this.positionMenu(),this.isMenuOpen=!this.isMenuOpen,this.isMenuOpen?window.addEventListener("click",this.handleClickOutside):window.removeEventListener("click",this.handleClickOutside),We(()=>{Ze.replace()})},executeCommand(n){this.isMenuOpen=!1,console.log("Selected"),console.log(n.value),typeof n.value=="function"&&(console.log("Command detected",n),n.value()),this.execute_cmd&&(console.log("executing generic command"),this.execute_cmd(n))},positionMenu(){var n;if(this.$refs.menuButton!=null){if(this.force_position==0||this.force_position==null){const e=this.$refs.menuButton.getBoundingClien
2024-11-04 00:22:50 +00:00
`,this.configFile.start_user_header_id_template="!@>",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="!@>",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="lollms_simplified"?(console.log("Using lollms template"),this.configFile.start_header_id_template="@>",this.configFile.system_message_template="system",this.configFile.end_header_id_template=": ",this.configFile.separator_template=`
`,this.configFile.start_user_header_id_template="@>",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="@>",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="bare"?(console.log("Using lollms template"),this.configFile.start_header_id_template="",this.configFile.system_message_template="system",this.configFile.end_header_id_template=": ",this.configFile.separator_template=`
`,this.configFile.start_user_header_id_template="",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="llama3"?(console.log("Using llama3 template"),this.configFile.start_header_id_template="<|start_header_id|>",this.configFile.system_message_template="system",this.configFile.end_header_id_template="<|end_header_id|>",this.configFile.separator_template="<|eot_id|>",this.configFile.start_user_header_id_template="<|start_header_id|>",this.configFile.end_user_header_id_template="<|end_header_id|>",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="<|start_header_id|>",this.configFile.end_ai_header_id_template="<|end_header_id|>",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="mistral"?(console.log("Using mistral template"),this.configFile.start_header_id_template="[INST]",this.configFile.system_message_template=" Using this information",this.configFile.end_header_id_template=": ",this.configFile.separator_template=`
`,this.configFile.start_user_header_id_template="[INST]",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="[/INST]",this.configFile.start_ai_header_id_template="[INST]",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="[/INST]",this.settingsChanged=!0):e==="deepseek"&&(console.log("Using deepseek template"),this.configFile.start_header_id_template="",this.configFile.system_message_template=" Using this information",this.configFile.end_header_id_template=": ",this.configFile.separator_template=`
`,this.configFile.start_user_header_id_template="",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0)},install_model(){},reinstallDiffusersService(){de.post("/install_diffusers",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},upgradeDiffusersService(){de.post("install_diffusers",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallXTTSService(){de.post("install_xtts",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallWhisperService(){de.post("install_whisper",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallSDService(){de.post("/install_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},upgradeSDService(){de.post("upgrade_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},startSDService(){de.post("start_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},showSD(){de.post("show_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallComfyUIService(){de.post("install_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},upgradeComfyUIService(){de.post("upgrade_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startComfyUIService(){de.post("start_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},showComfyui(){de.post("show_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallvLLMService(){de.post("install_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startvLLMService(){de.post("start_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startollamaService(){de.post("start_ollama",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallPetalsService(){de.post("install_petals",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallOLLAMAService(){de.post("install_ollama",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallElasticSearchService(){de.post("install_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},getSeviceVoices(){de.get("list_voices").then(n=>{this.voices=n.data.voices}).catch(n=>{console.error(n)})},load_more_models(){this.models_zoo_initialLoadCount+10<this.models_zoo.length?this.models_zoo_initialLoadCount+=10:this.models_zoo_initialLoadCount=this.models_zoo.length},async modelsZooToggleCollapse(){this.mzc_collapsed=!this.mzc_collapsed,We(()=>{Ze.replace()}),this.binding_changed&&!this.mzc_collapsed&&(this.modelsZoo==null||this.modelsZoo.length==0)&&(console.log("Refreshing models"),await this.$store.dispatch("refreshConfig"),this.models_zoo=[],this.refreshModelsZoo(),this.binding_changed=!1)},async selectSortOption(n){this.$store.state.sort_type=n,this.updateModelsZoo(),console.log(`Selected sorting:${n}`),console.log(`models:${this.models_zoo}`)},handleRadioSelected(n){this.isLoading=!0,this.selectSortOption(n).then(()=>{this.isLoading=!1})},filter_installed(n){return console.log("filtering"),n.filter(e=>e.isInstalled===!0)},getVoices(){"speechSynthesis"in window&&(console.log("voice synthesis"),this.audioVoices=speechSynthesis.getVoices(),console.log("Voices:"+this.audioVoices),!this.audio_out_voice&&this.audioVoices.length>0&&(this.audio_out_voice=this.audioVoices[0].name),speechSynthesis.onvoiceschanged=()=>{})},async updateHasUpdates(){let n=await this.a
`+e.model.name+`
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage")}}else rt.off("install_progress",r),console.log("Install failed"),e.installing=!1,this.showProgress=!1,console.error("Installation failed:",i.error),this.$store.state.toast.showToast(`Model:
`+e.model.name+`
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage");console.log("Here")};rt.on("install_progress",r),rt.emit("install_model",{path:t,name:e.model.name,variant_name:this.selected_variant.name,type:e.model.type}),console.log("Started installation, please wait")},resetLogo(){this.configFile.app_custom_logo="",this.settingsChanged=!0},resetAvatar(){this.configFile.user_avatar="",this.settingsChanged=!0},uploadLogo(n){const e=n.target.files[0],t=new FormData;t.append("logo",e),console.log("Uploading logo"),de.post("/upload_logo",t).then(r=>{console.log("Logo uploaded successfully"),this.$store.state.toast.showToast("Avatar uploaded successfully!",4,!0);const i=r.data.fileName;console.log("response",r),this.app_custom_logo=i,this.$store.state.config.app_custom_logo=i,this.settingsChanged=!0}).catch(r=>{console.error("Error uploading avatar:",r)})},uploadAvatar(n){const e=n.target.files[0],t=new FormData;t.append("avatar",e),console.log("Uploading avatar"),de.post("/upload_avatar",t).then(r=>{console.log("Avatar uploaded successfully"),this.$store.state.toast.showToast("Avatar uploaded successfully!",4,!0);const i=r.data.fileName;console.log("response",r),this.user_avatar=i,this.$store.state.config.user_avatar=i,this.settingsChanged=!0}).catch(r=>{console.error("Error uploading avatar:",r)})},async update_software(){console.log("Posting");const n=await this.api_post_req("update_software");console.log("Posting done"),n.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast("Failure!",4,!1)},async restart_software(){console.log("Posting");const n=await this.api_post_req("restart_program");console.log("Posting done"),n.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast("Failure!",4,!1)},on_loading_text(n){console.log("Loading text",n),this.loading_text=n},async load_everything(){for(this.isLoading=!0,We(()=>{Ze.replace()});this.isReady===!1;)await new Promise(n=>setTimeout(n,100));this.refresh(),console.log("Ready"),this.configFile.model_name&&(this.isModelSelected=!0),this.persCatgArr=await this.api_get_req("list_personalities_categories"),this.persArr=await this.api_get_req("list_personalities?category="+this.configFile.personality_category),console.log("category"),this.personality_category=this.configFile.personality_category,this.personalitiesFiltered=this.$store.state.personalities.filter(n=>n.category===this.configFile.personality_category),this.modelsFiltered=[],this.updateModelsZoo(),this.isLoading=!1,this.isMounted=!0,console.log("READY Stuff")},async open_mzl(){this.mzl_collapsed=!this.mzl_collapsed,console.log("Fetching models")},async getVramUsage(){await this.api_get_req("vram_usage")},async progressListener(n){if(console.log("received something"),n.status==="progress"){if(this.$refs.modelZoo){const e=this.$refs.modelZoo.findIndex(r=>r.model.name==n.model_name&&this.configFile.binding_name==n.binding_folder),t=this.models_zoo[e];t&&(console.log("model entry",t),t.installing=!0,t.progress=n.progress,console.log(`Progress = ${n.progress}`),n.progress>=100?(t.installing=!1,t.isInstalled=!0):(t.installing=!0,t.isInstalled=!0))}}else if(n.status==="succeeded"){if(console.log("Received succeeded"),this.$refs.modelZoo){const e=this.$refs.modelZoo.findIndex(r=>r.model.name==n.model_name&&this.configFile.binding_name==n.binding_folder),t=this.models_zoo[e];n.progress>=100&&(t.installing=!1,t.isInstalled=!0)}if(console.log("Installed successfully"),this.$refs.modelZoo){const e=this.$refs.modelZoo.findIndex(r=>r.model.name==n.model_name&&this.configFile.binding_name==n.binding_folder),t=this.models_zoo[e];t&&(t.installing=!1,t.isInstalled=!0)}this.$store.state.toast.showToast(`Model:
`+model_object.name+`
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage")}else if(n.status==="failed"&&(console.log("Install failed"),this.$refs.modelZoo)){const e=this.$refs.modelZoo.findIndex(r=>r.model.name==n.model_name&&this.configFile.binding_name==n.binding_folder),t=this.models_zoo[e];t&&(t.installing=!1,t.isInstalled=!1),console.error("Installation failed:",n.error),this.$store.state.toast.showToast(`Model:
`+model_object.name+`
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage")}},showAddModelDialog(){this.$refs.addmodeldialog.showDialog("").then(()=>{console.log(this.$refs.addmodeldialog.model_path);const n=this.$refs.addmodeldialog.model_path;rt.emit("install_model",{path:n,type:this.models_zoo[0].type},e=>{console.log("Model installation successful:",e)}),console.log(this.$refs.addmodeldialog.model_path)})},closeAddModelDialog(){this.addModelDialogVisibility=!1},collapseAll(n){this.servers_conf_collapsed=n,this.mainconf_collapsed=n,this.bec_collapsed=n,this.mzc_collapsed=n,this.pzc_collapsed=n,this.bzc_collapsed=n,this.pc_collapsed=n,this.mc_collapsed=n,this.sc_collapsed=n,this.mzdc_collapsed=n},fetchPersonalities(){this.api_get_req("list_personalities_categories").then(n=>{this.persCatgArr=n,this.persCatgArr.sort()}),this.api_get_req("list_personalities").then(n=>{this.persArr=n,this.persArr.sort(),console.log(`Listed personalities:
${n}`)})},fetchHardwareInfos(){this.$store.dispatch("refreshDiskUsage"),this.$store.dispatch("refreshRamUsage")},async onPersonalitySelected(n){if(console.log("on pers",n),this.isLoading&&this.$store.state.toast.showToast("Loading... please wait",4,!1),this.isLoading=!0,console.log("selecting ",n),n){if(n.selected){this.$store.state.toast.showToast("Personality already selected",4,!0),this.isLoading=!1;return}let e=n.language==null?n.full_path:n.full_path+":"+n.language;if(console.log("pth",e),n.isMounted&&this.configFile.personalities.includes(e)){const t=await this.select_personality(n);console.log("pers is mounted",t),t&&t.status&&t.active_personality_id>-1?this.$store.state.toast.showToast(`Selected personality:
`+n.name,4,!0):this.$store.state.toast.showToast(`Error on select personality:
`+n.name,4,!1),this.isLoading=!1}else console.log("mounting pers"),this.mountPersonality(n);We(()=>{Ze.replace()})}},onModelSelected(n){if(this.isLoading){this.$store.state.toast.showToast("Loading... please wait",4,!1);return}n&&(n.isInstalled?this.update_model(n.model.name).then(e=>{console.log("update_model",e),this.configFile.model_name=n.model.name,e.status?(this.$store.state.toast.showToast(`Selected model:
`+n.name,4,!0),We(()=>{Ze.replace(),this.is_loading_zoo=!1}),this.updateModelsZoo(),this.api_get_req("get_model_status").then(t=>{this.$store.commit("setIsModelOk",t)})):(this.$store.state.toast.showToast(`Couldn't select model:
`+n.name,4,!1),We(()=>{Ze.replace()})),this.settingsChanged=!0,this.isModelSelected=!0}):this.$store.state.toast.showToast(`Model:
`+n.model.name+`
is not installed`,4,!1),We(()=>{Ze.replace()}))},onCopy(n){let e;n.model.isCustomModel?e=`Model name: ${n.name}
File size: ${n.fileSize}
Manually downloaded model `:e=`Model name: ${n.name}
File size: ${n.fileSize}
Download: ${"https://huggingface.co/"+n.quantizer+"/"+n.name}
License: ${n.license}
Owner: ${n.quantizer}
Website: ${"https://huggingface.co/"+n.quantizer}
Description: ${n.description}`,this.$store.state.toast.showToast("Copied model info to clipboard!",4,!0),navigator.clipboard.writeText(e.trim())},onCopyLink(n){this.$store.state.toast.showToast("Copied link to clipboard!",4,!0),navigator.clipboard.writeText(n.model.name)},onCopyPersonalityName(n){this.$store.state.toast.showToast("Copied name to clipboard!",4,!0),navigator.clipboard.writeText(n.name)},async onCopyToCustom(n){await de.post("/copy_to_custom_personas",{client_id:this.$store.state.client_id,category:n.personality.category,name:n.personality.name})},async handleOpenFolder(n){await de.post("/open_personality_folder",{client_id:this.$store.state.client_id,personality_folder:n.personality.category/n.personality.folder})},onCancelInstall(){const n=this.addModel;console.log("cancel install",n),this.modelDownlaodInProgress=!1,this.addModel={},rt.emit("cancel_install",{model_name:n.model_name,binding_folder:n.binding_folder,model_url:n.model_url,patreon:n.patreon?n.patreon:"None"}),this.$store.state.toast.showToast("Model installation aborted",4,!1)},onInstall(n){this.variant_choices=n.model.variants,this.currenModelToInstall=n,console.log("variant_choices"),console.log(this.variant_choices),console.log(n),this.variantSelectionDialogVisible=!0},onCreateReference(){de.post("/add_reference_to_local_model",{path:this.reference_path}).then(n=>{n.status?(this.$store.state.toast.showToast("Reference created",4,!0),this.is_loading_zoo=!0,this.refreshModelsZoo().then(()=>{this.updateModelsZoo(),this.is_loading_zoofalse})):this.$store.state.toast.showToast("Couldn't create reference",4,!1)})},onInstallAddModel(){if(!this.addModel.url){this.$store.state.toast.showToast("Link is empty",4,!1);return}let n=this.addModel.url;this.addModel.progress=0,console.log("installing..."),console.log("value ",this.addModel.url),this.modelDownlaodInProgress=!0;const e=t=>{console.log("received something"),t.status&&t.progress<=100?(console.log("Progress",t),this.addModel=t,this.addModel.url=n,this.addModel.progress==100&&(this.modelDownlaodInProgress=!1,console.log("Received succeeded"),rt.off("install_progress",e),console.log("Installed successfully"),this.addModel={},this.$store.state.toast.showToast(`Model:
`+this.addModel.model_name+`
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage"))):(rt.off("install_progress",e),console.log("Install failed"),this.modelDownlaodInProgress=!1,console.error("Installation failed:",t.error),this.$store.state.toast.showToast(`Model:
`+this.addModel.model_name+`
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage"))};rt.on("install_progress",e),rt.emit("install_model",{path:n,type:this.models_zoo[0].type}),console.log("Started installation, please wait")},uploadLocalModel(){if(this.uploadData.length==0){this.$store.state.toast.showToast("No files to upload",4,!1);return}let n=this.addModel.url;this.addModel.progress=0,console.log("installing..."),console.log("value ",this.addModel.url),this.modelDownlaodInProgress=!0;const e=t=>{console.log("received something"),t.status&&t.progress<=100?(console.log("Progress",t),this.addModel=t,this.addModel.url=n,this.addModel.progress==100&&(this.modelDownlaodInProgress=!1,console.log("Received succeeded"),rt.off("progress",e),console.log("Installed successfully"),this.addModel={},this.$store.state.toast.showToast(`Model:
`+this.addModel.model_name+`
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage"))):(rt.off("progress",e),console.log("Install failed"),this.modelDownlaodInProgress=!1,console.error("Installation failed:",t.error),this.$store.state.toast.showToast(`Model:
`+this.addModel.model_name+`
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage"))};rt.on("progress",e),console.log("Started installation, please wait")},setFileList(n){this.uploadData=n.target.files,console.log("set file list",this.uploadData)},onUninstall(n){this.$store.state.yesNoDialog.askQuestion(`Are you sure you want to delete this model?
[`+n.name+"]","Yes","Cancel").then(e=>{if(e){console.log("uninstalling model...");const t=r=>{console.log("uninstalling res",r),r.status?(console.log("uninstalling success",r),n.uninstalling=!1,rt.off("install_progress",t),this.showProgress=!1,this.is_loading_zoo=!0,this.refreshModelsZoo().then(()=>{this.updateModelsZoo(),this.is_loading_zoo=!1}),this.modelsFiltered=this.models_zoo,this.$store.state.toast.showToast(`Model:
`+n.model.name+`
was uninstalled!`,4,!0),this.$store.dispatch("refreshDiskUsage")):(console.log("uninstalling failed",r),n.uninstalling=!1,this.showProgress=!1,rt.off("uninstall_progress",t),console.error("Uninstallation failed:",r.error),this.$store.state.toast.showToast(`Model:
`+n.model.name+`
failed to uninstall!`,4,!1),this.$store.dispatch("refreshDiskUsage"))};rt.on("uninstall_progress",t),this.selected_variant!=null?rt.emit("uninstall_model",{path:"https://huggingface.co/"+n.model.quantizer+"/"+n.model.name+"/resolve/main/"+this.selected_variant.name,type:n.model.type}):rt.emit("uninstall_model",{path:"https://huggingface.co/"+n.model.quantizer+"/"+n.model.name,type:n.model.type})}})},onBindingSelected(n){if(console.log("Binding selected"),!n.binding.installed){this.$store.state.toast.showToast(`Binding is not installed:
`+n.binding.name,4,!1);return}this.mzc_collapsed=!0,this.configFile.binding_name!=n.binding.folder&&(this.update_binding(n.binding.folder),this.binding_changed=!0),this.api_get_req("get_model_status").then(e=>{this.$store.commit("setIsModelOk",e)})},onInstallBinding(n){this.configFile.binding_name!=n.binding.folder?(this.isLoading=!0,n.disclaimer&&this.$store.state.yesNoDialog.askQuestion(n.disclaimer,"Proceed","Cancel"),de.post("/install_binding",{name:n.binding.folder}).then(e=>{if(e)return this.isLoading=!1,console.log("install_binding",e),e.data.status?(this.$store.state.toast.showToast("Binding installed successfully!",4,!0),this.$store.state.messageBox.showMessage(`It is advised to reboot the application after installing a binding.
Page will refresh in 5s.`),setTimeout(()=>{window.location.href="/"},5e3)):this.$store.state.toast.showToast("Could not reinstall binding",4,!1),this.isLoading=!1,e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall binding
`+e.message,4,!1),{status:!1}))):this.update_binding(n.binding.folder)},onUnInstallBinding(n){this.isLoading=!0,de.post("/unInstall_binding",{name:n.binding.folder}).then(e=>{if(e){if(this.isLoading=!1,console.log("unInstall_binding",e),e.data.status){const t=this.bindingsZoo.findIndex(i=>i.folder==n.binding.folder),r=this.bindingsZoo[t];r?r.installed=!0:r.installed=!1,this.settingsChanged=!0,this.binding_changed=!0,this.$store.state.toast.showToast("Binding uninstalled successfully!",4,!0)}else this.$store.state.toast.showToast("Could not uninstall binding",4,!1);return e.data}this.isLoading=!1,n.isInstalled=False}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not uninstall binding
`+e.message,4,!1),{status:!1}))},onReinstallBinding(n){this.isLoading=!0,de.post("/reinstall_binding",{name:n.binding.folder}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_binding",e),e.data.status?(this.$store.state.toast.showToast("Binding reinstalled successfully!",4,!0),this.$store.state.messageBox.showMessage("It is advised to reboot the application after installing a binding")):this.$store.state.toast.showToast("Could not reinstall binding",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall binding
`+e.message,4,!1),{status:!1}))},onSettingsBinding(n){try{this.isLoading=!0,de.get("/get_active_binding_settings").then(e=>{console.log(e),this.isLoading=!1,e&&(console.log("binding setting",e),e.data&&Object.keys(e.data).length>0?this.$store.state.universalForm.showForm(e.data,"Binding settings - "+n.binding.name,"Save changes","Cancel").then(t=>{try{de.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,settings:t},{headers:this.posts_headers}).then(r=>{r&&r.data?(console.log("binding set with new settings",r.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0),de.post("/update_binding_settings",{client_id:this.$store.state.client_id}).then(i=>{this.$store.state.toast.showToast("Binding settings committed successfully!",4,!0),window.location.href="/"})):(this.$store.state.toast.showToast(`Did not get binding settings responses.
`+r,4,!1),this.isLoading=!1)})}catch(r){this.$store.state.toast.showToast(`Did not get binding settings responses.
Endpoint error: `+r.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(e){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+e.message,4,!1)}},onReloadBinding(n){console.log("Reloading binding"),this.isLoading=!0,de.post("/reload_binding",{name:n.binding.folder},{headers:this.posts_headers}).then(e=>{if(e)return this.isLoading=!1,console.log("reload_binding",e),e.data.status?this.$store.state.toast.showToast("Binding reloaded successfully!",4,!0):this.$store.state.toast.showToast("Could not reload binding",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reload binding
`+e.message,4,!1),{status:!1}))},onSettingsPersonality(n){try{this.isLoading=!0,de.get("/get_active_personality_settings").then(e=>{this.isLoading=!1,e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$store.state.universalForm.showForm(e.data,"Personality settings - "+n.personality.name,"Save changes","Cancel").then(t=>{try{de.post("/set_active_personality_settings",t).then(r=>{r&&r.data?(console.log("personality set with new settings",r.data),this.$store.state.toast.showToast("Personality settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get Personality settings responses.
`+r,4,!1),this.isLoading=!1)})}catch(r){this.$store.state.toast.showToast(`Did not get Personality settings responses.
Endpoint error: `+r.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Personality has no settings",4,!1),this.isLoading=!1))})}catch(e){this.isLoading=!1,this.$store.state.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},onMessageBoxOk(){console.log("OK button clicked")},update_personality_category(n,e){this.personality_category=n,e()},refresh(){console.log("Refreshing"),this.$store.dispatch("refreshConfig").then(()=>{console.log(this.personality_category),this.api_get_req("list_personalities_categories").then(n=>{console.log("cats",n),this.persCatgArr=n,this.personalitiesFiltered=this.$store.state.personalities.filter(e=>e.category===this.personality_category),this.personalitiesFiltered.sort()})})},toggleAccordion(){this.showAccordion=!this.showAccordion},async update_setting(n,e,t){this.isLoading=!0;const r={client_id:this.$store.state.client_id,setting_name:n,setting_value:e};console.log("Updating setting",n,":",e);let i=await de.post("/update_setting",r,{headers:this.posts_headers});if(i)return this.isLoading=!1,console.log("update_setting",i),i.status?this.$store.state.toast.showToast(`Setting updated successfully.
`,4,!0):this.$store.state.toast.showToast(`Setting update failed.
Please view the console for more details.`,4,!1),t!==void 0&&t(i),i.data;this.isLoading=!1},async refreshModelsZoo(){this.models_zoo=[],console.log("refreshing models"),this.is_loading_zoo=!0,await this.$store.dispatch("refreshModelsZoo"),console.log("ModelsZoo refreshed"),await this.$store.dispatch("refreshModels"),console.log("Models refreshed"),this.updateModelsZoo(),console.log("Models updated"),this.is_loading_zoo=!1},async updateModelsZoo(){let n=this.$store.state.modelsZoo;if(n.length!=0){console.log(`REFRESHING models using sorting ${this.sort_type}`),n.length>1?(this.sort_type==0?(n.sort((e,t)=>{const r=new Date(e.last_commit_time);return new Date(t.last_commit_time)-r}),console.log("Sorted")):this.sort_type==1?n.sort((e,t)=>t.rank-e.rank):this.sort_type==2?n.sort((e,t)=>e.name.localeCompare(t.name)):this.sort_type==3&&n.sort((e,t)=>e.name.localeCompare(t.name)),console.log("Sorted")):console.log("No sorting needed"),n.forEach(e=>{e.name==this.$store.state.config.model_name?e.selected=!0:e.selected=!1}),console.log("Selected models");for(let e=0;e<this.$store.state.modelsArr.length;e++){const t=this.$store.state.modelsArr[e];let r=n.findIndex(i=>i.name==t);if(r==-1)for(let i=0;i<n.length;i++){let s=n[i].variants;if(s!=null&&(r=s.findIndex(o=>o.name==t),r!=-1)){r=i,console.log(`Found ${t} at index ${r}`);break}}if(r==-1){let i={};i.name=t,i.icon=this.imgBinding,i.isCustomModel=!0,i.isInstalled=!0,n.push(i)}else n[r].isInstalled=!0}console.log("Determined models"),n.sort((e,t)=>e.isInstalled&&!t.isInstalled?-1:!e.isInstalled&&t.isInstalled?1:0),console.log("Done"),this.models_zoo=this.$store.state.modelsZoo}},update_binding(n){this.isLoading=!0,this.$store.state.modelsZoo=[],this.configFile.model_name=null,this.$store.state.config.model_name=null,console.log("updating binding_name"),this.update_setting("binding_name",n,async e=>{console.log("updated binding_name"),await this.$store.dispatch("refreshConfig"),this.models_zoo=[],this.mzc_collapsed=!0;const t=this.bindingsZoo.findIndex(i=>i.folder==n),r=this.bindingsZoo[t];r?r.installed=!0:r.installed=!1,this.settingsChanged=!0,this.isLoading=!1,We(()=>{Ze.replace()}),console.log("updating model"),this.update_model(null).then(()=>{}),We(()=>{Ze.replace()})}),We(()=>{Ze.replace()})},async update_model(n){n||(this.isModelSelected=!1),this.isLoading=!0;let e=await this.update_setting("model_name",n);return this.isLoading=!1,We(()=>{Ze.replace()}),e},async cancelConfiguration(){await this.$store.dispatch("refreshConfig"),this.settingsChanged=!1},applyConfiguration(){this.isLoading=!0,de.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.configFile},{headers:this.posts_headers}).then(n=>{this.isLoading=!1,n.data.status?(this.$store.state.toast.showToast("Configuration changed successfully.",4,!0),this.settingsChanged=!1):this.$store.state.toast.showToast("Configuration change failed.",4,!1),We(()=>{Ze.replace()})})},save_configuration(){this.showConfirmation=!1,de.post("/save_settings",{},{headers:this.posts_headers}).then(n=>{if(n)return n.status||this.$store.state.messageBox.showMessage("Error: Couldn't save settings!"),n.data}).catch(n=>(console.log(n.message,"save_configuration"),this.$store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},reset_configuration(){this.$store.state.yesNoDialog.askQuestion(`Are you sure?
This will delete all your configurations and get back to default configuration.`).then(n=>{n&&de.post("/reset_settings",{},{headers:this.posts_headers}).then(e=>{if(e)return e.status?this.$store.state.messageBox.showMessage("Settings have been reset correctly"):this.$store.state.messageBox.showMessage("Couldn't reset settings!"),e.data}).catch(e=>(console.log(e.message,"reset_configuration"),this.$store.state.messageBox.showMessage("Couldn't reset settings!"),{status:!1}))})},async api_get_req(n){try{const e=await de.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - settings");return}},async api_post_req(n){try{const e=await de.post("/"+n,{client_id:this.$store.state.client_id});if(e)return e.data}catch(e){console.log(e.message,"api_post_req - settings");return}},closeToast(){this.showToast=!1},async getPersonalitiesArr(){this.isLoading=!0,this.$store.state.personalities=[];const n=await this.api_get_req("get_all_personalities"),e=this.$store.state.config;console.log("recovering all_personalities");const t=Object.keys(n);for(let r=0;r<t.length;r++){const i=t[r],o=n[i].map(a=>{const l=e.personalities.includes(i+"/"+a.folder);let d={};return d=a,d.category=i,d.language="",d.full_path=i+"/"+a.folder,d.isMounted=l,d});this.$store.state.personalities.length==0?this.$store.state.personalities=o:this.$store.state.personalities=this.$store.state.personalities.concat(o)}this.$store.state.personalities.sort((r,i)=>r.name.localeCompare(i.name)),this.personalitiesFiltered=this.$store.state.personalities.filter(r=>r.category===this.configFile.personality_category),this.personalitiesFiltered.sort(),console.log("per filtered",this.personalitiesFiltered),this.isLoading=!1},async filterPersonalities(){if(!this.searchPersonality){this.personalitiesFiltered=this.$store.state.personalities.filter(t=>t.category===this.configFile.personality_category),this.personalitiesFiltered.sort(),this.searchPersonalityInProgress=!1;return}const n=this.searchPersonality.toLowerCase(),e=this.$store.state.personalities.filter(t=>{if(t.name&&t.name.toLowerCase().includes(n)||t.description&&t.description.toLowerCase().includes(n)||t.full_path&&t.full_path.toLowerCase().includes(n))return t});e.length>0?this.personalitiesFiltered=e.sort():(this.personalitiesFiltered=this.$store.state.personalities.filter(t=>t.category===this.configFile.personality_category),this.personalitiesFiltered.sort()),this.searchPersonalityInProgress=!1},async filterModels(){const n=this.searchModel.toLowerCase();this.is_loading_zoo=!0,console.log("filtering models"),console.log(this.models_zoo);const e=this.models_zoo.filter(t=>{if(t.name&&t.name.toLowerCase().includes(n)||t.description&&t.description.toLowerCase().includes(n)||t.category&&t.category.toLowerCase().includes(n))return t});this.is_loading_zoo=!1,e.length>0?this.modelsFiltered=e:this.modelsFiltered=[],this.searchModelInProgress=!1},computedFileSize(n){return Wi(n)},async mount_personality(n){if(!n)return{status:!1,error:"no personality - mount_personality"};try{const e={client_id:this.$store.state.client_id,language:n.language?n.language:"",category:n.category?n.category:"",folder:n.folder?n.folder:""},t=await de.post("/mount_personality",e,{headers:this.posts_headers});if(t)return t.data}catch(e){console.log(e.message,"mount_personality - settings");return}},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={client_id:this.$store.state.client_id,language:n.language,category:n.category,folder:n.folder};try{const t=await de.post("/unmount_personality",e,{headers:this.posts_headers});if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};let e=n.language==null?n.full_path:n.full_path+":"+n.language;console.log("pth",e);const t=this.configFile.personalities.findIndex(i=>i===e),r={client_id:this.$store.state.client_id,id:t};try{const i=await de.post("/select_personality",r,{headers:this.posts_headers});if(i)return
`+n.personality.name,4,!0),this.$store.dispatch("refreshMountedPersonalities")):(n.isMounted=!1,this.$store.state.toast.showToast(`Could not mount personality
Error: `+e.error+`
Response:
`+e,4,!1)),this.isLoading=!1},async unmountAll(){await de.post("/unmount_all_personalities",{client_id:this.$store.state.client_id},{headers:this.posts_headers}),this.$store.dispatch("refreshMountedPersonalities"),this.$store.dispatch("refreshConfig"),this.$store.state.toast.showToast("All personas unmounted",4,!0)},async unmountPersonality(n){if(this.isLoading=!0,!n)return;const e=await this.unmount_personality(n.personality||n);if(e.status){this.configFile.personalities=e.personalities,this.$store.state.toast.showToast("Personality unmounted",4,!0);const t=this.$store.state.personalities.findIndex(a=>a.full_path==n.full_path),r=this.personalitiesFiltered.findIndex(a=>a.full_path==n.full_path),i=this.$refs.personalitiesZoo.findIndex(a=>a.full_path==n.full_path);console.log("ppp",this.$store.state.personalities[t]),this.$store.state.personalities[t].isMounted=!1,r>-1&&(this.personalitiesFiltered[r].isMounted=!1),i>-1&&(this.$refs.personalitiesZoo[i].isMounted=!1),this.$store.dispatch("refreshMountedPersonalities");const s=this.mountedPersArr[this.mountedPersArr.length-1];console.log(s,this.mountedPersArr.length),(await this.select_personality(n.personality)).status&&this.$store.state.toast.showToast(`Selected personality:
`+s.name,4,!0)}else this.$store.state.toast.showToast(`Could not unmount personality
Error: `+e.error,4,!1);this.isLoading=!1},editPersonality(n){n=n.personality,de.post("/get_personality_config",{client_id:this.$store.state.client_id,category:n.category,name:n.folder}).then(e=>{const t=e.data;console.log("Done"),t.status?(this.$store.state.currentPersonConfig=t.config,this.$store.state.showPersonalityEditor=!0,this.$store.state.personality_editor.showPanel(),this.$store.state.selectedPersonality=n):console.error(t.error)}).catch(e=>{console.error(e)})},copyToCustom(n){n=n.personality,de.post("/copy_to_custom_personas",{category:n.category,name:n.folder}).then(e=>{e.status?(this.$store.state.messageBox.showMessage(`Personality copied to the custom personalities folder:
Now it's up to you to modify it, enhance it, and maybe even share it.
Feel free to add your name as an author, but please remember to keep the original creator's name as well.
You have the freedom to give, sell, or keep the personas you create for yourself.
The possibilities are endless, they are now yours to mold and customize as you see fit.`),this.$store.dispatch("refreshPersonalitiesZoo")):this.$store.state.toast.showToast(`Personality couldn't be copied to the custom personalities folder:
Verify that the personality is not already copied there.`,4,!1)}).catch(e=>{this.$store.state.toast.showToast(`Personality couldn't be copied to the custom personalities folder:
`,4,!1),console.error(e)})},async remountPersonality(n){await this.unmountPersonality(n),await this.mountPersonality(n)},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,console.log("Personality path:",n.personality.path),de.post("/reinstall_personality",{client_id:this.$store.state.client_id,name:n.personality.path},{headers:this.posts_headers}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$store.state.toast.showToast("Personality reinstalled successfully!",4,!0):this.$store.state.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall personality
`+e.message,4,!1),{status:!1}))},personalityImgPlacehodler(n){n.target.src=Ai},searchPersonality_func(){clearTimeout(this.searchPersonalityTimer),this.searchPersonality&&(this.searchPersonalityInProgress=!0,setTimeout(this.filterPersonalities,this.searchPersonalityTimerInterval))},searchModel_func(){this.filterModels()}},async mounted(){console.log("Getting voices"),this.getVoices(),console.log("Constructing"),this.load_everything(),this.getSeviceVoices();try{console.log("Loading input devices list");const n=await de.get("/get_snd_input_devices");this.snd_input_devices=n.data.device_names,this.snd_input_devices_indexes=n.data.device_indexes}catch{console.log("Couldin't list input devices")}try{console.log("Loading output devices list");const n=await de.get("/get_snd_output_devices");this.snd_output_devices=n.data.device_names,this.snd_output_devices_indexes=n.data.device_indexes}catch{console.log("Couldin't list output devices")}try{if(console.log("Getting comfyui models"),this.configFile.activate_lollms_tti_server&&this.configFile.active_tti_service=="comfyui"){const n=await de.get("/list_comfyui_models");n.data.status&&(this.comfyui_models=n.data.models)}}catch{console.log("Couldin't list output devices")}this.fetchElevenLabsVoices()},activated(){},computed:{full_template:{get(){return(this.configFile.start_header_id_template+this.configFile.system_message_template+this.configFile.end_header_id_template+" system message"+this.configFile.separator_template+this.configFile.start_user_header_id_template+"user name"+this.configFile.end_user_header_id_template+" User prompt"+this.configFile.separator_template+this.configFile.end_user_message_id_template+this.configFile.separator_template+this.configFile.start_ai_header_id_template+"ai personality"+this.configFile.end_ai_header_id_template+"ai response"+this.configFile.end_ai_message_id_template).replace(`
2024-11-06 23:05:30 +00:00
`,"<br>")}},rendered_models_zoo:{get(){return this.searchModel?this.show_only_installed_models?this.modelsFiltered.filter(n=>n.isInstalled===!0):this.modelsFiltered.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)):(console.log("this.models_zoo"),console.log(this.models_zoo),console.log(this.models_zoo_initialLoadCount),this.show_only_installed_models?this.models_zoo.filter(n=>n.isInstalled===!0):this.models_zoo.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)))}},imgBinding:{get(){if(!this.isMounted)return wr;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return wr}}},imgModel:{get(){try{let n=this.$store.state.modelsZoo.findIndex(e=>e.name==this.$store.state.selectedModel);return n>=0?(console.log(`model avatar : ${this.$store.state.modelsZoo[n].icon}`),this.$store.state.modelsZoo[n].icon):wr}catch{console.log("error")}if(!this.isMounted)return wr;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return wr}}},isReady:{get(){return this.$store.state.ready}},audio_out_voice:{get(){return this.$store.state.config.audio_out_voice},set(n){this.$store.state.config.audio_out_voice=n}},openaiWhisperModels(){return["whisper-1"]},whisperModels(){return["tiny.en","tiny","base.en","base","small.en","small","medium.en","medium","large-v1","large-v2","large-v3","large"]},audioLanguages(){return[{code:"en-US",name:"English (US)"},{code:"en-GB",name:"English (UK)"},{code:"es-ES",name:"Spanish (Spain)"},{code:"es-MX",name:"Spanish (Mexico)"},{code:"fr-FR",name:"French (France)"},{code:"fr-CA",name:"French (Canada)"},{code:"de-DE",name:"German (Germany)"},{code:"it-IT",name:"Italian (Italy)"},{code:"pt-BR",name:"Portuguese (Brazil)"},{code:"pt-PT",name:"Portuguese (Portugal)"},{code:"ru-RU",name:"Russian (Russia)"},{code:"zh-CN",name:"Chinese (China)"},{code:"ja-JP",name:"Japanese (Japan)"},{code:"ar-SA",name:"Arabic (Saudi Arabia)"},{code:"tr-TR",name:"Turkish (Turkey)"},{code:"ms-MY",name:"Malay (Malaysia)"},{code:"ko-KR",name:"Korean (South Korea)"},{code:"nl-NL",name:"Dutch (Netherlands)"},{code:"sv-SE",name:"Swedish (Sweden)"},{code:"da-DK",name:"Danish (Denmark)"},{code:"fi-FI",name:"Finnish (Finland)"},{code:"no-NO",name:"Norwegian (Norway)"},{code:"pl-PL",name:"Polish (Poland)"},{code:"el-GR",name:"Greek (Greece)"},{code:"hu-HU",name:"Hungarian (Hungary)"},{code:"cs-CZ",name:"Czech (Czech Republic)"},{code:"th-TH",name:"Thai (Thailand)"},{code:"hi-IN",name:"Hindi (India)"},{code:"he-IL",name:"Hebrew (Israel)"},{code:"id-ID",name:"Indonesian (Indonesia)"},{code:"vi-VN",name:"Vietnamese (Vietnam)"},{code:"uk-UA",name:"Ukrainian (Ukraine)"},{code:"ro-RO",name:"Romanian (Romania)"},{code:"bg-BG",name:"Bulgarian (Bulgaria)"},{code:"hr-HR",name:"Croatian (Croatia)"},{code:"sr-RS",name:"Serbian (Serbia)"},{code:"sk-SK",name:"Slovak (Slovakia)"},{code:"sl-SI",name:"Slovenian (Slovenia)"},{code:"et-EE",name:"Estonian (Estonia)"},{code:"lv-LV",name:"Latvian (Latvia)"},{code:"lt-LT",name:"Lithuanian (Lithuania)"},{code:"ka-GE",name:"Georgian (Georgia)"},{code:"hy-AM",name:"Armenian (Armenia)"},{code:"az-AZ",name:"Azerbaijani (Azerbaijan)"},{code:"kk-KZ",name:"Kazakh (Kazakhstan)"},{code:"uz-UZ",name:"Uzbek (Uzbekistan)"},{code:"kkj-CM",name:"Kako (Cameroon)"},{code:"my-MM",name:"Burmese (Myanmar)"},{code:"ne-NP",name:"Nepali (Nepal)"},{code:"si-LK",name:"Sinhala (Sri Lanka)"}]},configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},userName:{get(){return this.$store.state.config.user_name},set(n){this.$store.state.config.user_name=n}},user_avatar:{get(){return this.$store.state.config.user_avatar!=""?"/user_infos/"+this.$store.state.config.user_avatar:Ai},set(n){this.$store.state.config.user_avatar=n}},hardware_mode:{get(){return this.$store.state.config.hardware_mode},set(n){this.$store.state.config.hardware_mode=n}},auto_update:{get(){return this.$store.state.co
2024-11-04 00:22:50 +00:00
If you are using windows, this uses wsl which requires you to have it installed or at least activated.
If You are using windows, this will install wsl so you need to activate it.
2024-11-06 23:05:30 +00:00
<a href='https://techcommunity.microsoft.com/t5/windows-11/how-to-install-the-linux-windows-subsystem-in-windows-11/m-p/2701207' target='_blank'>Here is how you can do that</a>`))},e[706]||(e[706]=[c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)]))])]),c("tr",null,[e[708]||(e[708]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"ollama_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Ollama service:")],-1)),c("td",null,[c("div",Uft,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[383]||(e[383]=(...h)=>s.reinstallOLLAMAService&&s.reinstallOLLAMAService(...h))},"install ollama service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[384]||(e[384]=(...h)=>s.startollamaService&&s.startollamaService(...h))},"start ollama service")])])]),c("tr",null,[e[709]||(e[709]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"ollama_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"ollama base url:")],-1)),c("td",null,[c("div",Bft,[F(c("input",{type:"text",id:"ollama_base_url",required:"","onUpdate:modelValue":e[385]||(e[385]=h=>s.configFile.ollama_base_url=h),onChange:e[386]||(e[386]=h=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[_e,s.configFile.ollama_base_url]])])])])])]),_:1}),W(a,{title:"vLLM service",is_subcard:!0,class:"pb-2 m-2"},{default:Ge(()=>[c("table",Gft,[c("tr",null,[e[711]||(e[711]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"enable_vllm_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable vLLM service:")],-1)),c("td",null,[c("div",zft,[F(c("input",{type:"checkbox",id:"enable_vllm_service",required:"","onUpdate:modelValue":e[387]||(e[387]=h=>s.configFile.enable_vllm_service=h),onChange:e[388]||(e[388]=h=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[tt,s.configFile.enable_vllm_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[389]||(e[389]=h=>this.$store.state.messageBox.showMessage(`Activates vllm service. The service will be automatically loaded at startup alowing you to use the elf binding.
2024-11-04 00:22:50 +00:00
If you are using windows, this uses wsl which requires you to have it installed or at least activated.
If You are using windows, this will install wsl so you need to activate it.
2024-11-06 23:05:30 +00:00
<a href='https://techcommunity.microsoft.com/t5/windows-11/how-to-install-the-linux-windows-subsystem-in-windows-11/m-p/2701207' target='_blank'>Here is how you can do that</a>`))},e[710]||(e[710]=[c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)]))])]),c("tr",null,[e[712]||(e[712]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install vLLM service:")],-1)),c("td",null,[c("div",Vft,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[390]||(e[390]=(...h)=>s.reinstallvLLMService&&s.reinstallvLLMService(...h))},"install vLLM service"),c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[391]||(e[391]=(...h)=>s.startvLLMService&&s.startvLLMService(...h))},"start vllm service")])])]),c("tr",null,[e[713]||(e[713]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm base url:")],-1)),c("td",null,[c("div",Hft,[F(c("input",{type:"text",id:"vllm_url",required:"","onUpdate:modelValue":e[392]||(e[392]=h=>s.configFile.vllm_url=h),onChange:e[393]||(e[393]=h=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[_e,s.configFile.vllm_url]])])])]),c("tr",null,[e[715]||(e[715]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_gpu_memory_utilization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"gpu memory utilization:")],-1)),c("td",null,[c("div",qft,[c("div",Yft,[e[714]||(e[714]=c("p",{class:"absolute left-0 mt-6"},[c("label",{for:"vllm_gpu_memory_utilization",class:"text-sm font-medium"}," vllm gpu memory utilization: ")],-1)),c("p",$ft,[F(c("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[394]||(e[394]=h=>s.configFile.vllm_gpu_memory_utilization=h),onChange:e[395]||(e[395]=h=>i.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[_e,s.configFile.vllm_gpu_memory_utilization]])])]),F(c("input",{id:"vllm_gpu_memory_utilization",onChange:e[396]||(e[396]=h=>i.settingsChanged=!0),type:"range","onUpdate:modelValue":e[397]||(e[397]=h=>s.configFile.vllm_gpu_memory_utilization=h),min:"0.10",max:"1",step:"0.01",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[_e,s.configFile.vllm_gpu_memory_utilization]])])])]),c("tr",null,[e[716]||(e[716]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_max_num_seqs",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm max num seqs:")],-1)),c("td",null,[c("div",Wft,[F(c("input",{type:"number",id:"vllm_max_num_seqs",min:"64",max:"2048",required:"","onUpdate:modelValue":e[398]||(e[398]=h=>s.configFile.vllm_max_num_seqs=h),onChange:e[399]||(e[399]=h=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[_e,s.configFile.vllm_max_num_seqs]])])])]),c("tr",null,[e[717]||(e[717]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_max_model_len",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"max model len:")],-1)),c("td",null,[c("div",Kft,[F(c("input",{type:"number",id:"vllm_max_model_len",min:"2048",max:"1000000",required:"","onUpdate:modelValue":e[400]||(e[400]=h=>s.configFile.vllm_max_model_len=h),onChange:e[401]||(e[401]=h=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[_e,s.configFile.vllm_max_model_len]])])])]),c("tr",null,[e[718]||(e[718]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_model_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm mo
2024-11-04 00:22:50 +00:00
If You are using windows, this will install wsl so you need to activate it.
2024-11-06 23:05:30 +00:00
<a href='https://techcommunity.microsoft.com/t5/windows-11/how-to-install-the-linux-windows-subsystem-in-windows-11/m-p/2701207' target='_blank'>Here is how you can do that</a>`))},e[719]||(e[719]=[c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)]))])]),c("tr",null,[e[721]||(e[721]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"petals_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Install Petals service:")],-1)),c("td",null,[c("div",Zft,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[407]||(e[407]=(...h)=>s.reinstallPetalsService&&s.reinstallPetalsService(...h))},"install petals service")])])]),c("tr",null,[e[722]||(e[722]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"petals_base_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"petals base url:")],-1)),c("td",null,[c("div",Jft,[F(c("input",{type:"text",id:"petals_base_url",required:"","onUpdate:modelValue":e[408]||(e[408]=h=>s.configFile.petals_base_url=h),onChange:e[409]||(e[409]=h=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[_e,s.configFile.petals_base_url]])])])])])]),_:1})]),_:1}),W(a,{title:"TTV settings",is_subcard:!0,class:"pb-2 m-2"},{default:Ge(()=>[c("table",egt,[c("tr",null,[e[723]||(e[723]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"lumalabs_key",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Lumalabs key:")],-1)),c("td",null,[c("div",tgt,[F(c("input",{type:"text",id:"lumalabs_key",required:"","onUpdate:modelValue":e[410]||(e[410]=h=>s.configFile.lumalabs_key=h),onChange:e[411]||(e[411]=h=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[_e,s.configFile.lumalabs_key]])])])])])]),_:1}),W(a,{title:"Misc",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:Ge(()=>[W(a,{title:"Elastic search Service (under construction)",is_subcard:!0,class:"pb-2 m-2"},{default:Ge(()=>[c("table",ngt,[c("tr",null,[e[724]||(e[724]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"elastic_search_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable elastic search service:")],-1)),c("td",null,[c("div",rgt,[F(c("input",{type:"checkbox",id:"elastic_search_service",required:"","onUpdate:modelValue":e[412]||(e[412]=h=>s.configFile.elastic_search_service=h),onChange:e[413]||(e[413]=h=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[tt,s.configFile.elastic_search_service]])])])]),c("tr",null,[e[725]||(e[725]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"install_elastic_search_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Reinstall Elastic Search service:")],-1)),c("td",null,[c("div",igt,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[414]||(e[414]=(...h)=>s.reinstallElasticSearchService&&s.reinstallElasticSearchService(...h))},"install ElasticSearch service")])])]),c("tr",null,[e[726]||(e[726]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"elastic_search_url",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"elastic search base url:")],-1)),c("td",null,[c("div",sgt,[F(c("input",{type:"text",id:"elastic_search_url",required:"","onUpdate:modelValue":e[415]||(e[415]=h=>s.configFile.elastic_search_url=h),onChange:e[416]||(e[416]=h=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[_e,s.configFile.elastic_search_url]])])])])])]),_:1})]),_:1})],2)]),c("div",ogt,[c("div",agt,[c("button",{onClick:e[417]||(e[417]=J(h=>i.bzc_collapsed=!i.bzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[F(c("div",null,e[727]||(e[727]=[c("i",{"data-feather":"chevron-right"},null,-1)]),512),[[Dt,i.bzc_collapsed]]),F(c("div",null,e[728]||(e[728]=[c("i",{"data-feather":"chevron-down"},null,-1)]),512),[[Dt,!i.bzc_collapsed]]),e[730]||(e[730]=c("p
2024-11-04 00:22:50 +00:00
`).map(u=>u.trim()===""?u:i?u.startsWith(" ")?u.substring(4):u:" "+u),a=e.value.substring(0,t),l=e.value.substring(r),d=a+o.join(`
`)+l;this.message.content=d,this.$nextTick(()=>{e.selectionStart=t,e.selectionEnd=r+o.length*4})}n.preventDefault()},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){this.isSynthesizingVoice?(this.isSynthesizingVoice=!1,this.$refs.audio_player.pause()):(this.isSynthesizingVoice=!0,de.post("./text2wav",{text:this.message.content}).then(n=>{this.isSynthesizingVoice=!1;let e=n.data.url;console.log(e),this.audio_url=e,this.message.metadata||(this.message.metadata=[]);let t=!1;for(let r of this.message.metadata)Object.prototype.hasOwnProperty.call(r,"audio_url")&&(r.audio_url=this.audio_url,t=!0);t||this.message.metadata.push({audio_url:this.audio_url}),this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url)}).catch(n=>{this.$store.state.toast.showToast(`Error: ${n}`,4,!1),this.isSynthesizingVoice=!1}))},async speak(){if(this.$store.state.config.active_tts_service!="browser"&&this.$store.state.config.active_tts_service!="None")this.isSpeaking?(this.isSpeaking=!0,de.post("./stop",{text:this.message.content}).then(n=>{this.isSpeaking=!1}).catch(n=>{this.$store.state.toast.showToast(`Error: ${n}`,4,!1),this.isSpeaking=!1})):(this.isSpeaking=!0,de.post("./text2Audio",{client_id:this.$store.state.client_id,text:this.message.content}).then(n=>{this.isSpeaking=!1}).catch(n=>{this.$store.state.toast.showToast(`Error: ${n}`,4,!1),this.isSpeaking=!1}));else{if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let n=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.message.content,this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(i=>i.name===this.$store.state.config.audio_out_voice)[0]);const t=i=>{let s=this.message.content.substring(i,i+e);const o=[".","!","?",`
`];let a=-1;return o.forEach(l=>{const d=s.lastIndexOf(l);d>a&&(a=d)}),a==-1&&(a=s.length),console.log(a),a+i+1},r=()=>{if(this.message.status_message=="Done"||this.message.content.includes(".")||this.message.content.includes("?")||this.message.content.includes("!")){const i=t(n),s=this.message.content.substring(n,i);this.msg.text=s,n=i+1,this.msg.onend=o=>{n<this.message.content.length-2?setTimeout(()=>{r()},1):(this.isSpeaking=!1,console.log("voice off :",this.message.content.length," ",i))},this.speechSynthesis.speak(this.msg)}else setTimeout(()=>{r()},1)};console.log("Speaking chunk"),r()}},toggleModel(){this.expanded=!this.expanded},addBlock(n){let e=this.$refs.mdTextarea.selectionStart,t=this.$refs.mdTextarea.selectionEnd;e==t?speechSynthesis==0||this.message.content[e-1]==`
`?(this.message.content=this.message.content.slice(0,e)+"```"+n+"\n\n```\n"+this.message.content.slice(e),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+"\n```"+n+"\n\n```\n"+this.message.content.slice(e),e=e+3+n.length):speechSynthesis==0||this.message.content[e-1]==`
`?(this.message.content=this.message.content.slice(0,e)+"```"+n+`
`+this.message.content.slice(e,t)+"\n```\n"+this.message.content.slice(t),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+"\n```"+n+`
2024-11-06 23:05:30 +00:00
`+this.message.content.slice(e,t)+"\n```\n"+this.message.content.slice(t),p=p+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},copyContentToClipboard(){this.$emit("copy",this)},deleteMsg(){this.$emit("delete",this.message.id),this.deleteMsgMode=!1},rankUp(){this.$emit("rankUp",this.message.id)},rankDown(){this.$emit("rankDown",this.message.id)},updateMessage(){this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url),this.editMsgMode=!1},resendMessage(n){this.$emit("resendMessage",this.message.id,this.message.content,n)},continueMessage(){this.$emit("continueMessage",this.message.id,this.message.content)},getImgUrl(){return this.avatar?ybt+this.avatar:(console.log("No avatar found"),Ai)},defaultImg(n){n.target.src=Ai},parseDate(n){let e=new Date(Date.parse(n)),r=Math.floor((new Date-e)/1e3);return r<=1?"just now":r<20?r+" seconds ago":r<40?"half a minute ago":r<60?"less than a minute ago":r<=90?"one minute ago":r<=3540?Math.round(r/60)+" minutes ago":r<=5400?"1 hour ago":r<=86400?Math.round(r/3600)+" hours ago":r<=129600?"1 day ago":r<604800?Math.round(r/86400)+" days ago":r<=777600?"1 week ago":n},prettyDate(n){let e=new Date((n||"").replace(/-/g,"/").replace(/[TZ]/g," ")),t=(new Date().getTime()-e.getTime())/1e3,r=Math.floor(t/86400);if(!(isNaN(r)||r<0||r>=31))return r==0&&(t<60&&"just now"||t<120&&"1 minute ago"||t<3600&&Math.floor(t/60)+" minutes ago"||t<7200&&"1 hour ago"||t<86400&&Math.floor(t/3600)+" hours ago")||r==1&&"Yesterday"||r<7&&r+" days ago"||r<31&&Math.ceil(r/7)+" weeks ago"},checkForFullSentence(){if(this.message.content.trim().split(" ").length>3){this.speak();return}}},watch:{audio_url(n){n&&(this.$refs.audio_player.src=n)},"message.content":function(n){this.$store.state.config.auto_speak&&(this.$store.state.config.xtts_enable&&this.$store.state.config.xtts_use_streaming_mode||this.isSpeaking||this.checkForFullSentence())},"message.ui":function(n){console.log("ui changed to",n),this.ui_componentKey++},showConfirmation(){We(()=>{Ze.replace()})},deleteMsgMode(){We(()=>{Ze.replace()})}},computed:{editMsgMode:{get(){return this.message.hasOwnProperty("open")?this.editMsgMode_||this.message.open:this.editMsgMode_},set(n){this.message.open=n,this.editMsgMode_=n,We(()=>{Ze.replace()})}},isTalking:{get(){return this.isSpeaking}},created_at(){return this.prettyDate(this.message.created_at)},created_at_parsed(){return new Date(Date.parse(this.message.created_at)).toLocaleString()},finished_generating_at_parsed(){return new Date(Date.parse(this.message.finished_generating_at)).toLocaleString()},time_spent(){const n=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(e.getTime()===n.getTime()||!n.getTime()||!e.getTime())return;let[r,i,s]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(r)+"h:"+o(i)+"m:"+o(s)+"s"},warmup_duration(){const n=new Date(Date.parse(this.message.created_at)),e=new Date(Date.parse(this.message.started_generating_at));if(console.log("Computing the warmup duration, ",n," -> ",e),e.getTime()===n.getTime())return 0;if(!n.getTime()||!e.getTime())return;let r,i,s;[r,i,s]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(r)+"h:"+o(i)+"m:"+o(s)+"s"},generation_rate(){const n=new Date(Date.parse(this.message.started_generating_at)),e=new Date(Date.parse(this.message.finished_generating_at)),t=this.message.nb_tokens;if(e.getTime()===n.getTime()||!t||!n.getTime()||!e.getTime())return;let i=e.getTime()-n.getTime();const s=Math.floor(i/1e3),o=t/s;return Math.round(o)+" t/s"}}},Sbt={class:"relative message w-full group rounded-lg m-2 shadow-lg hover:border-primary dark:hover:border-primary hover:border-solid hover:border-2 border-2 border-transparent flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2"},xbt={class:"flex flex-row gap-2"},Tbt={class:"flex-shrink-0"},wbt={class:"group/avatar"},Cbt=["src","data-popover-target"],Abt={class:"flex flex-col w-full flex-grow-0"},Rbt={class:"flex fle
2024-11-12 16:41:39 +00:00
`+r.error,4,!1),this.loading=!1,rt.off("file_received")}),rt.emit("send_file",t)},e.readAsDataURL(this.selectedFile)},async constructor(){We(()=>{Ze.replace()})},toggleMenu(){this.showMenu=!this.showMenu},execute_cmd(n){this.showMenu=!this.showMenu,n.hasOwnProperty("is_file")?(console.log("Need to send a file."),this.selectFile(n.hasOwnProperty("file_types")?n.file_types:"*",()=>{this.selectedFile!=null&&this.uploadFile()})):this.sendCommand(n.value)},handleClickOutside(n){const e=this.$el.querySelector(".commands-menu-items-wrapper");e&&!e.contains(n.target)&&(this.showMenu=!1)}},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},v1t={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"};function y1t(n,e,t,r,i,s){const o=ht("InteractiveMenu");return i.loading?(T(),M("div",v1t,e[0]||(e[0]=[c("div",{role:"status"},[c("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[c("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),c("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),c("span",{class:"sr-only"},"Loading...")],-1)]))):(T(),Tt(o,{key:1,commands:t.commandsList,execute_cmd:s.execute_cmd},null,8,["commands","execute_cmd"]))}const E1t=bt(b1t,[["render",y1t],["__scopeId","data-v-1a32c141"]]),S1t="data:image/svg+xml,%3csvg%20aria-hidden='true'%20class='w-6%20h-6%20animate-spin%20fill-secondary'%20viewBox='0%200%20100%20101'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M100%2050.5908C100%2078.2051%2077.6142%20100.591%2050%20100.591C22.3858%20100.591%200%2078.2051%200%2050.5908C0%2022.9766%2022.3858%200.59082%2050%200.59082C77.6142%200.59082%20100%2022.9766%20100%2050.5908ZM9.08144%2050.5908C9.08144%2073.1895%2027.4013%2091.5094%2050%2091.5094C72.5987%2091.5094%2090.9186%2073.1895%2090.9186%2050.5908C90.9186%2027.9921%2072.5987%209.67226%2050%209.67226C27.4013%209.67226%209.08144%2027.9921%209.08144%2050.5908Z'%20fill='currentColor'%20/%3e%3cpath%20d='M93.9676%2039.0409C96.393%2038.4038%2097.8624%2035.9116%2097.0079%2033.5539C95.2932%2028.8227%2092.871%2024.3692%2089.8167%2020.348C85.8452%2015.1192%2080.8826%2010.7238%2075.2124%207.41289C69.5422%204.10194%2063.2754%201.94025%2056.7698%201.05124C51.7666%200.367541%2046.6976%200.446843%2041.7345%201.27873C39.2613%201.69328%2037.813%204.19778%2038.4501%206.62326C39.0873%209.04874%2041.5694%2010.4717%2044.0505%2010.1071C47.8511%209.54855%2051.7191%209.52689%2055.5402%2010.0491C60.8642%2010.7766%2065.9928%2012.5457%2070.6331%2015.2552C75.2735%2017.9648%2079.3347%2021.5619%2082.5849%2025.841C84.9175%2028.9121%2086.7997%2032.2913%2088.1811%2035.8758C89.083%2038.2158%2091.5421%2039.6781%2093.9676%2039.0409Z'%20fill='currentFill'%20/%3e%3c/svg%3e",x1t="/",T1t={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:{default:!1},onShowToastMessage:Function},components:{PersonalitiesCommands:E1t,ChatBarButton:Yk},setup(){},data(){return{isSendMenuVisible:!1,is_rt:!1,bindi
`+r,4,!1)})}catch(r){this.$store.state.toast.showToast(`Did not get Personality settings responses.
Endpoint error: `+r.message,4,!1)}}):this.$store.state.toast.showToast("Personality has no settings",4,!1))})}catch(e){this.$store.state.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},async constructor(){for(We(()=>{Ze.replace()});this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100));this.onReady()},async api_get_req(n){try{const e=await de.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=Ny}}},Bvt={class:"relative group/item"},Gvt=["src","alt"],zvt={class:"absolute bottom-6 left-0 w-full flex items-center justify-center opacity-0 group-hover/item:opacity-100 transition-opacity duration-200 p-1"},Vvt={class:"p-1 bg-gray-500 rounded-full text-white hover:bg-gray-600 focus:outline-none ml-1",title:"Show more"},Hvt={class:"text-xs font-bold"};function qvt(n,e,t,r,i,s){const o=ht("UniversalForm");return T(),M(je,null,[c("div",Bvt,[c("button",{onClick:e[1]||(e[1]=J((...a)=>s.onSettingsPersonality&&s.onSettingsPersonality(...a),["prevent"])),class:"w-6 h-6 rounded-full overflow-hidden transition-transform duration-200 transform group-hover/item:scale-110 focus:outline-none"},[c("img",{src:s.mountedPers.avatar,onError:e[0]||(e[0]=(...a)=>s.personalityImgPlacehodler&&s.personalityImgPlacehodler(...a)),alt:s.mountedPers.name,class:qe(["w-full h-full object-cover",{"border-2 border-secondary":n.isActive}])},null,42,Gvt)]),c("div",zvt,[c("button",{onClick:e[2]||(e[2]=J(a=>s.remount_personality(),["prevent"])),class:"p-1 bg-blue-500 rounded-full text-white hover:bg-blue-600 focus:outline-none",title:"Remount"},e[4]||(e[4]=[c("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1)])),c("button",{onClick:e[3]||(e[3]=J(a=>s.handleOnTalk(),["prevent"])),class:"p-1 bg-green-500 rounded-full text-white hover:bg-green-600 focus:outline-none ml-1",title:"Talk"},e[5]||(e[5]=[c("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})],-1)])),c("button",Vvt,[c("span",Hvt,"+"+X(s.mountedPersArr.length-1),1)])])]),W(o,{ref:"universalForm",class:"z-50"},null,512)],64)}const GI=bt(Uvt,[["render",qvt]]),Yvt={key:0,class:"fixed top-0 left-0 w-screen h-screen flex items-center justify-center overflow-hidden"},$vt={class:"absolute inset-0 pointer-events-none overflow-hidden"},Wvt={class:"flex flex-col items-center text-center max-w-4xl w-full px-4 relative z-10"},Kvt={class:"mb-8 w-full"},jvt={class:"bottom-0 text-2xl text-gray-600 dark:text-gray-300 italic"},Qvt={class:"text-lg text-gray-700 dark:text-gray-300"},Xvt=["innerHTML"],Zvt={class:"animated-progressbar-bg"},Jvt={class:"w-full max-w-2xl"},eyt={role:"status",class:"w-full"},tyt={class:"text-xl text-gray-700 dark:text-gray-300"},nyt={class:"text-2xl font-bold text-blue-600 dark:text-blue-400 mt-2"},ryt={key:0,class:"relative flex flex-col no-scrollbar shadow-lg min-w-[15rem] max-w-[15rem]"},iyt={class:"logo-container"},syt=["src"],oyt={class:"toolbar discussion"},ayt={class:"toolbar-container"},lyt={class:"p-4 flex flex-wrap gap-2 items-center"},cyt={class:"relative"},dyt={class:"relative"},uyt={key:4,title:"Loading..",class:"flex justify-center"},pyt={key:5,class:"flex justify-center space-x-4"},hyt={key:6,class:"flex flex-col space-y-2"},myt={class:"relative inline-block"},fyt={class:"p-2 border-b border-gray-200 dark:border-gray-700"},gyt={class:"p-4 grid grid-cols-3 gap-4 max-h-80 overflow-y-auto custom-scrollbar"},_yt={class:"flex flex-col items-center hover:bg-blue-100 dark:hover:bg-blue-900 p-2 rounded-md w-full cursor-pointer"},by
2024-11-04 00:22:50 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Default Render Panel</title>
<style>
body, html {
margin: 0;
padding: 0;
height: 100%;
font-family: Arial, sans-serif;
background-color: #f0f0f0;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
padding: 20px;
box-sizing: border-box;
}
.message {
text-align: center;
padding: 30px;
background-color: white;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
max-width: 600px;
width: 100%;
}
h1 {
color: #2c3e50;
margin-bottom: 20px;
font-size: 28px;
}
p {
color: #34495e;
margin: 0 0 15px;
line-height: 1.6;
}
.highlight {
color: #e74c3c;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<div class="message">
<h1>Welcome to the Interactive Render Panel</h1>
<p>This space is designed to bring your ideas to life! Currently, it's empty because no HTML has been generated yet.</p>
<p>To see something amazing here, try asking the AI to <span class="highlight">create a specific web component or application</span>. For example:</p>
<p>"Create a responsive image gallery" or "Build a simple todo list app"</p>
<p>Once you request a web component, the AI will generate the necessary HTML, CSS, and JavaScript, and it will be rendered right here in this panel!</p>
</div>
</div>
</body>
</html>
2024-11-06 23:05:30 +00:00
`,memory_icon:Ivt,active_skills:Ovt,inactive_skills:Dvt,skillsRegistry:Lvt,robot:Pvt,posts_headers:{accept:"application/json","Content-Type":"application/json"},host:"",progress_visibility_val:!0,progress_value:0,msgTypes:{MSG_TYPE_CONTENT:1,MSG_TYPE_CONTENT_INVISIBLE_TO_AI:2,MSG_TYPE_CONTENT_INVISIBLE_TO_USER:3},operationTypes:{MSG_OPERATION_TYPE_ADD_CHUNK:0,MSG_OPERATION_TYPE_SET_CONTENT:1,MSG_OPERATION_TYPE_SET_CONTENT_INVISIBLE_TO_AI:2,MSG_OPERATION_TYPE_SET_CONTENT_INVISIBLE_TO_USER:3,MSG_OPERATION_TYPE_EXCEPTION:4,MSG_OPERATION_TYPE_WARNING:5,MSG_OPERATION_TYPE_INFO:6,MSG_OPERATION_TYPE_STEP:7,MSG_OPERATION_TYPE_STEP_START:8,MSG_OPERATION_TYPE_STEP_PROGRESS:9,MSG_OPERATION_TYPE_STEP_END_SUCCESS:10,MSG_OPERATION_TYPE_STEP_END_FAILURE:11,MSG_OPERATION_TYPE_JSON_INFOS:12,MSG_OPERATION_TYPE_REF:13,MSG_OPERATION_TYPE_CODE:14,MSG_OPERATION_TYPE_UI:15,MSG_OPERATION_TYPE_NEW_MESSAGE:16,MSG_OPERATION_TYPE_FINISHED_MESSAGE:17},senderTypes:{SENDER_TYPES_USER:0,SENDER_TYPES_AI:1,SENDER_TYPES_SYSTEM:2},list:[],tempList:[],currentDiscussion:{},discussionArr:[],loading:!1,filterTitle:"",filterInProgress:!1,isCreated:!1,isCheckbox:!1,isSelectAll:!1,showSaveConfirmation:!1,showBrainConfirmation:!1,showConfirmation:!1,chime:new Audio("chime_aud.wav"),showToast:!1,isDiscussionBottom:!1,personalityAvatars:[],fileList:[],database_selectorDialogVisible:!1,isDragOverDiscussion:!1,isDragOverChat:!1,isOpen:!1,discussion_id:0}},methods:{updateRandomFact(){let n;do n=this.interestingFacts[Math.floor(Math.random()*this.interestingFacts.length)];while(n===this.randomFact&&this.interestingFacts.length>1);this.randomFact=n},handleOnTalk(n){console.log("talking"),this.showPersonalities=!1,this.$store.state.toast.showToast(`Personality ${n.name} is Talking`,4,!0),this.onTalk(n)},onPersonalitiesReadyFun(){this.$store.state.personalities_ready=!0},async showBindingHoveredIn(n){this.bindingHoveredIndex=n},async showBindingHoveredOut(){this.bindingHoveredIndex=null},async showModelHoveredIn(n){this.modelHoveredIndex=n},async showModelHoveredOut(){this.modelHoveredIndex=null},async showPersonalityHoveredIn(n){this.personalityHoveredIndex=n},async showPersonalityHoveredOut(){this.personalityHoveredIndex=null},async onPersonalitySelected(n){if(this.hidePersonalitiesMenu(),n){if(n.selected){this.$store.state.toast.showToast("Personality already selected",4,!0);return}const e=n.full_path;if(console.log("pers_path",e),console.log("this.$store.state.config.personalities",this.$store.state.config.personalities),this.$store.state.config.personalities.includes(e)){const t=await this.select_personality(n);await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshBindings"),await this.$store.dispatch("refreshModelsZoo"),await this.$store.dispatch("refreshModels"),await this.$store.dispatch("refreshMountedPersonalities"),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("fetchLanguages"),await this.$store.dispatch("fetchLanguage"),await this.$store.dispatch("fetchisRTOn"),console.log("pers is mounted",t),t&&t.status&&t.active_personality_id>-1?this.$store.state.toast.showToast(`Selected personality:
2024-11-04 00:22:50 +00:00
`+n.name,4,!0):this.$store.state.toast.showToast(`Error on select personality:
2024-11-12 16:41:39 +00:00
`+n.name,4,!1)}else console.log("mounting pers");this.$emit("personalitySelected"),We(()=>{Ze.replace()})}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};const e=n.full_path;console.log("Selecting personality ",e);const t=this.$store.state.config.personalities.findIndex(i=>i===e),r={client_id:this.$store.state.client_id,id:t};try{const i=await de.post("/select_personality",r);if(i)return this.$store.dispatch("refreshConfig").then(()=>{this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),i.data}catch(i){console.log(i.message,"select_personality - settings");return}},showPersonalitiesMenu(){clearTimeout(this.hideMenuTimeout),this.isPersonalitiesMenuVisible=!0},hidePersonalitiesMenu(){this.hideMenuTimeout=setTimeout(()=>{this.isPersonalitiesMenuVisible=!1},300)},copyModelName(){navigator.clipboard.writeText(this.binding_name+"::"+this.model_name),this.$store.state.toast.showToast("Model name copyed to clipboard: "+this.binding_name+"::"+this.model_name,4,!0)},copyModelNameFrom(n){navigator.clipboard.writeText(this.binding_name+"::"+n),this.$store.state.toast.showToast("Model name copyed to clipboard: "+this.binding_name+"::"+this.model_name,4,!0)},showBindingsMenu(){clearTimeout(this.hideBindingsMenuTimeout),this.isBindingsMenuVisible=!0},hideBindingsMenu(){this.hideBindingsMenuTimeout=setTimeout(()=>{this.isBindingsMenuVisible=!1},300)},setBinding(n){console.log("Setting binding to "+n.name),this.selecting_binding=!0,this.selectedBinding=n,this.$store.state.messageBox.showBlockingMessage("Loading binding"),de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"binding_name",setting_value:n.name}).then(async e=>{this.$store.state.messageBox.hideMessage(),console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshBindings"),await this.$store.dispatch("refreshModelsZoo"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Binding changed to ${this.currentBinding.name}`,4,!0),this.selecting_binding=!1}).catch(e=>{this.$store.state.messageBox.hideMessage(),this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_binding=!1})},showModelsMenu(){clearTimeout(this.hideModelsMenuTimeout),this.isModelsMenuVisible=!0},hideModelsMenu(){this.hideModelsMenuTimeout=setTimeout(()=>{this.isModelsMenuVisible=!1},300)},setModel(n){console.log("Setting model to "+n.name),this.selecting_model=!0,this.selectedModel=n,this.$store.state.messageBox.showBlockingMessage("Loading model"),de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:n.name}).then(async e=>{this.$store.state.messageBox.hideMessage(),console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Model changed to ${this.currentModel.name}`,4,!0),this.selecting_model=!1}).catch(e=>{this.$store.state.messageBox.hideMessage(),this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_model=!1})},showModelConfig(){try{this.isLoading=!0,de.get("/get_active_binding_settings").then(n=>{this.isLoading=!1,n&&(console.log("binding sett",n),n.data&&Object.keys(n.data).length>0?this.$store.state.universalForm.showForm(n.data,"Binding settings ","Save changes","Cancel").then(e=>{try{de.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,settings:e}).then(t=>{t&&t.data?(console.log("binding set with new settings",t.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses.
2024-11-04 00:22:50 +00:00
`+t,4,!1),this.isLoading=!1)})}catch(t){this.$store.state.toast.showToast(`Did not get binding settings responses.
Endpoint error: `+t.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(n){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+n.message,4,!1)}},async remount_personality(n){if(console.log("Remounting personality ",n),!n)return{status:!1,error:"no personality - mount_personality"};try{console.log("before");const e={client_id:this.$store.state.client_id,category:n.category,folder:n.folder,language:n.language};console.log("after");const t=await de.post("/remount_personality",e);if(console.log("Remounting personality executed:",t),t)return console.log("Remounting personality res"),this.$store.state.toast.showToast("Personality remounted",4,!0),t.data;console.log("failed remount_personality")}catch(e){console.log(e.message,"remount_personality - settings");return}},async unmountPersonality(n){if(console.log("Unmounting personality:",n),!n)return;const e=await this.unmount_personality(n.personality||n);if(console.log(e),e.status){this.$store.state.config.personalities=e.personalities,this.$store.state.toast.showToast("Personality unmounted",4,!0),this.$store.dispatch("refreshMountedPersonalities");const t=this.$store.state.mountedPersArr[this.$store.state.mountedPersArr.length-1];console.log(t,this.$store.state.mountedPersArr.length),(await this.select_personality(n.personality)).status&&this.$store.state.toast.showToast(`Selected personality:
`+t.name,4,!0)}else this.$store.state.toast.showToast(`Could not unmount personality
Error: `+e.error,4,!1)},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={client_id:this.$store.state.client_id,language:n.language,category:n.category,folder:n.folder};try{const t=await de.post("/unmount_personality",e);if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},handleShortcut(n){n.ctrlKey&&n.key==="d"&&(n.preventDefault(),n.stopPropagation(),this.createNewDiscussion())},toggleMenu(){this.isMenuVisible=!this.isMenuVisible,this.isMenuVisible&&(this.isinfosMenuVisible=!1),We(()=>{Ze.replace()})},showMenu(){this.isMenuVisible=!0,We(()=>{Ze.replace()})},hideMenu(){this.isMenuVisible=!1,We(()=>{Ze.replace()})},adjustMenuPosition(){const n=this.$refs.languageMenu;if(n){const e=n.getBoundingClientRect(),t=window.innerWidth;e.right>t?(n.style.left="auto",n.style.right="0"):(n.style.left="0",n.style.right="auto")}},restartProgram(n){n.preventDefault(),this.$store.state.api_post_req("restart_program",this.$store.state.client_id),this.rebooting_audio.play(),this.$store.state.toast.showToast("Rebooting the app. Please wait...",410,!1),console.log("this.$store.state.api_get_req",this.$store.state.api_get_req),setTimeout(()=>{window.close()},2e3)},applyConfiguration(){this.isLoading=!0,console.log(this.$store.state.config),de.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.$store.state.config},{headers:this.posts_headers}).then(n=>{this.isLoading=!1,n.data.status?(this.$store.state.toast.showToast("Configuration changed successfully.",4,!0),this.settingsChanged=!1):this.$store.state.toast.showToast("Configuration change failed.",4,!1),We(()=>{Ze.replace()})})},getRandomEdgePosition(){switch(Math.floor(Math.random()*4)){case 0:return 0;case 1:return 100;case 2:return Math.random()*100;case 3:return Math.random()*100}},extractTitle(n){const e=n.match(/@<(.*?)>@/);return e?e[1]:null},getPromptContent(n){return n.replace(/@<.*?>@/,"").trim()},handlePromptSelection(n){this.selectedPrompt=n;const e=this.extractTitle(n);console.log("title"),console.log(e),e?this.previewPrompt=this.getPromptContent(n):this.previewPrompt=n,this.placeholders=this.extractPlaceholders(n),this.placeholders.length>0?(this.showPlaceholderModal=!0,this.placeholderValues={}):this.setPromptInChatbox(n)},updatePreview(){let n=this.selectedPrompt;this.parsedPlaceholders.forEach((e,t)=>{const r=this.placeholderValues[t],i=new RegExp(this.escapeRegExp(e.fullText),"g");n=n.replace(i,r||e.fullText)}),this.previewPrompt=n,console.log("previewPrompt"),console.log(this.previewPrompt)},escapeRegExp(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},cancelPlaceholders(){this.showPlaceholderModal=!1,this.placeholders=[],this.placeholderValues={},this.previewPrompt=""},applyPlaceholders(){let n=this.selectedPrompt;this.parsedPlaceholders.forEach((e,t)=>{const r=this.placeholderValues[t];if(r){const i=new RegExp(this.escapeRegExp(e.fullText),"g");n=n.replace(i,r)}}),this.finalPrompt=n,this.showPlaceholderModal=!1,console.log("previewPrompt apply"),console.log(this.previewPrompt),this.setPromptInChatbox(this.getPromptContent(this.previewPrompt))},extractPlaceholders(n){const e=/\[(.*?)\]/g;return[...n.matchAll(e)].map(t=>t[0])},setPromptInChatbox(n){this.$refs.chatBox.message=n},extractHtml(){if(this.discussionArr.length>0){const n=this.discussionArr[this.discussionArr.length-1].content,e="```html",t="```";let r=n.indexOf(e);if(r===-1)return this.lastMessageHtml=this.defaultMessageHtml,this.renderIsolatedContent(),this.defaultMessageHtml;r+=e.length;let i=n.indexOf(t,r);i===-1?this.lastMessageHtml=n.slice(r).trim():this.lastMessageHtml=n.slice(r,i).trim()}else this.lastMessageHtml=this.defaultMessageHtml;this.renderIsolatedContent()},renderIsolatedContent(){const n=document.createElement("iframe");if(n.style.border="none",n.style.width="100%",n.style.height="100%",this.$refs.isolatedContent){this.$refs.isolatedContent.innerHTML="",this.$refs.isolatedContent.appendChild(n);const e=n.contentDocument||n.contentWindow.document;e.open(),e.write(`
${this.lastMessageHtml}
`),e.close()}},async triggerRobotAction(){this.rightPanelCollapsed=!this.rightPanelCollapsed,this.rightPanelCollapsed||(this.$store.commit("setleftPanelCollapsed",!1),this.$nextTick(()=>{this.extractHtml()})),console.log(this.rightPanelCollapsed)},add_webpage(){console.log("addWebLink received"),this.$refs.web_url_input_box.showPanel()},addWebpage(){de.post("/add_webpage",{client_id:this.client_id,url:this.$refs.web_url_input_box.inputText},{headers:this.posts_headers}).then(n=>{n&&n.status&&(console.log("Done"),this.recoverFiles())})},show_progress(n){this.progress_visibility_val=!0},hide_progress(n){this.progress_visibility_val=!1},update_progress(n){console.log("Progress update"),this.progress_value=n.value},onSettingsBinding(){try{this.isLoading=!0,de.get("/get_active_binding_settings").then(n=>{if(this.isLoading=!1,n)if(n.data&&Object.keys(n.data).length>0){const e=this.$store.state.bindingsZoo.find(t=>t.name==this.state.config.binding_name);this.$store.state.universalForm.showForm(n.data,"Binding settings - "+e.binding.name,"Save changes","Cancel").then(t=>{try{de.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,settings:t}).then(r=>{r&&r.data?(console.log("binding set with new settings",r.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses.
`+r,4,!1),this.isLoading=!1)})}catch(r){this.$store.state.toast.showToast(`Did not get binding settings responses.
Endpoint error: `+r.message,4,!1),this.isLoading=!1}})}else this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1})}catch(n){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+n.message,4,!1)}},showDatabaseSelector(){this.database_selectorDialogVisible=!0},async ondatabase_selectorDialogRemoved(n){console.log("Deleted:",n)},async ondatabase_selectorDialogSelected(n){console.log("Selected:",n)},onclosedatabase_selectorDialog(){this.database_selectorDialogVisible=!1},async onvalidatedatabase_selectorChoice(n){this.database_selectorDialogVisible=!1;const e={client_id:this.client_id,name:typeof n=="string"?n:n.name};if(console.log("data:"),console.log(e),(await de.post("/select_database",e,{headers:this.posts_headers})).status){console.log("Selected database"),this.$store.state.config=await de.post("/get_config",{client_id:this.client_id}),console.log("new config loaded :",this.$store.state.config);let r=await de.get("/list_databases").data;console.log("New list of database: ",r),this.$store.state.databases=r,console.log("New list of database: ",this.$store.state.databases),location.reload()}},async addDiscussion2SkillsLibrary(){(await de.post("/add_discussion_to_skills_library",{client_id:this.client_id},{headers:this.posts_headers})).status&&console.log("done")},async toggleSkillsLib(){this.$store.state.config.activate_skills_lib=!this.$store.state.config.activate_skills_lib,await this.applyConfiguration()},async showSkillsLib(){this.$refs.skills_lib.showSkillsLibrary()},async applyConfiguration(){this.loading=!0;const n=await de.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.$store.state.config});this.loading=!1,n.data.status?this.$store.state.toast.showToast("Configuration changed successfully.",4,!0):this.$store.state.toast.showToast("Configuration change failed.",4,!1),We(()=>{Ze.replace()})},save_configuration(){this.showConfirmation=!1,de.post("/save_settings",{}).then(n=>{if(n)return n.status?this.$store.state.toast.showToast("Settings saved!",4,!0):this.$store.state.messageBox.showMessage("Error: Couldn't save settings!"),n.data}).catch(n=>(console.log(n.message,"save_configuration"),this.$store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},showToastMessage(n,e,t){console.log("sending",n),this.$store.state.toast.showToast(n,e,t)},toggleDropdown(){this.isOpen=!this.isOpen},importChatGPT(){},async api_get_req(n){try{const e=await de.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req");return}},async list_discussions(){try{const n=await de.get("/list_discussions");if(n)return this.createDiscussionList(n.data),n.data}catch(n){return console.log("Error: Could not list discussions",n.message),[]}},load_discussion(n,e){n&&(console.log("Loading discussion",n),this.loading=!0,this.discussionArr=[],this.setDiscussionLoading(n,this.loading),rt.on("discussion",t=>{console.log("Discussion recovered"),this.loading=!1,this.setDiscussionLoading(n,this.loading),t&&(this.discussionArr=t.filter(r=>r.message_type==this.msgTypes.MSG_TYPE_CONTENT||r.message_type==this.msgTypes.MSG_TYPE_CONTENT_INVISIBLE_TO_AI),this.discussionArr.forEach(r=>{r.status_message="Done"}),console.log("this.discussionArr"),console.log(this.discussionArr),e&&e()),rt.off("discussion"),this.extractHtml()}),rt.emit("load_discussion",{id:n}))},recoverFiles(){console.log("Recovering files"),de.post("/get_discussion_files_list",{client_id:this.$store.state.client_id}).then(n=>{this.$refs.chatBox.filesList=n.data.files,this.$refs.chatBox.isFileSentList=n.data.files.map(e=>!0),console.log(`Files recovered: ${this.$refs.chatBox.filesList}`)})},new_discussion(n){try{this.loading=!0,rt.on("discussion_created",e=>{rt.off("discussion_created"),this.list_discussions().then(()=>{const t=this.list.findIndex(i=>i.id==e.id),r=this.list[t];this.selectDiscussion(r),this.load_discussion(e.id,()=>{this.loading=!1,this.recoverFiles(),We(()=>{const i=document.getElementById("dis-"+e.id);this.scrollToElement(i),console.log("Scro
Personality: ${n.message.personality}`);let i="";n.created_at_parsed&&(i=`
Created: ${n.created_at_parsed}`);let s="";n.message.model&&(s=`Model: ${n.message.model}`);let o="";n.message.seed&&(o=`Seed: ${n.message.seed}`);let a="";n.time_spent&&(a=`
Time spent: ${n.time_spent}`);let l="";l=`${t} ${s} ${o} ${a}`.trim();const d=`${n.message.sender}${r}${i}
${e}
${l}`;navigator.clipboard.writeText(d)}else navigator.clipboard.writeText(e);this.$store.state.toast.showToast("Copied to clipboard successfully",4,!0),We(()=>{Ze.replace()})},closeToast(){this.showToast=!1},saveJSONtoFile(n,e){e=e||"data.json";const t=document.createElement("a");t.href=URL.createObjectURL(new Blob([JSON.stringify(n,null,2)],{type:"text/plain"})),t.setAttribute("download",e),document.body.appendChild(t),t.click(),document.body.removeChild(t)},saveMarkdowntoFile(n,e){e=e||"data.md";const t=document.createElement("a");t.href=URL.createObjectURL(new Blob([n],{type:"text/plain"})),t.setAttribute("download",e),document.body.appendChild(t),t.click(),document.body.removeChild(t)},parseJsonObj(n){try{return JSON.parse(n)}catch(e){return this.$store.state.toast.showToast(`Could not parse JSON.
`+e.message,4,!1),null}},async parseJsonFile(n){return new Promise((e,t)=>{const r=new FileReader;r.onload=i=>e(this.parseJsonObj(i.target.result)),r.onerror=i=>t(i),r.readAsText(n)})},async exportDiscussionsAsMarkdown(){const n=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(n.length>0){console.log("export",n);let e=new Date;const t=e.getFullYear(),r=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),s=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),d="discussions_export_"+(t+"."+r+"."+i+"."+s+o+a)+".md";this.loading=!0;const u=await this.export_multiple_discussions(n,"markdown");u?(this.saveMarkdowntoFile(u,d),this.$store.state.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$store.state.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async exportDiscussions(){},async exportDiscussionsAsJson(){const n=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(n.length>0){console.log("export",n);let e=new Date;const t=e.getFullYear(),r=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),s=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),d="discussions_export_"+(t+"."+r+"."+i+"."+s+o+a)+".json";this.loading=!0;const u=await this.export_multiple_discussions(n,"json");u?(this.saveJSONtoFile(u,d),this.$store.state.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$store.state.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async importDiscussionsBundle(n){},async importDiscussions(n){const e=await this.parseJsonFile(n.target.files[0]);await this.import_multiple_discussions(e)?(this.$store.state.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$store.state.toast.showToast("Failed to import discussions",4,!1)},async getPersonalityAvatars(){for(;this.$store.state.personalities===null;)await new Promise(e=>setTimeout(e,100));let n=this.$store.state.personalities;this.personalityAvatars=n.map(e=>({name:e.name,avatar:e.avatar}))},getAvatar(n){if(n.toLowerCase().trim()==this.$store.state.config.user_name.toLowerCase().trim())return"user_infos/"+this.$store.state.config.user_avatar;const e=this.personalityAvatars.findIndex(r=>r.name===n),t=this.personalityAvatars[e];if(t)return console.log("Avatar",t.avatar),t.avatar},setFileListChat(n){try{this.$refs.chatBox.fileList=this.$refs.chatBox.fileList.concat(n)}catch(e){this.$store.state.toast.showToast(`Failed to set filelist in chatbox
`+e.message,4,!1)}this.isDragOverChat=!1},async setFileListDiscussion(n){if(n.length>1){this.$store.state.toast.showToast("Failed to import discussions. Too many files",4,!1);return}const e=await this.parseJsonFile(n[0]);await this.import_multiple_discussions(e)?(this.$store.state.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$store.state.toast.showToast("Failed to import discussions",4,!1),this.isDragOverDiscussion=!1}},async created(){this.randomFact=this.interestingFacts[Math.floor(Math.random()*this.interestingFacts.length)],console.log("Created discussions view");const e=(await de.get("/get_versionID")).data.versionId;rt.onopen=()=>{console.log("WebSocket connection established."),this.currentDiscussion!=null&&(this.setPageTitle(item),localStorage.setItem("selected_discussion",this.currentDiscussion.id),console.log(`Saved discussion to : ${this.currentDiscussion.id}`),this.load_discussion(item.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)}))},this.versionId!==e&&(this.$store.commit("updateVersionId",e),window.location.reload(!0)),this.$nextTick(()=>{Ze.replace()}),console.log("Connected to socket io");try{this.$store.state.loading_infos="Getting version",this.$store.state.loading_progress=30,await this.$store.dispatch("getVersion")}catch(t){console.log("Error cought:",t)}try{for(this.$store.state.loading_infos="Loading Configuration";rt.id===void 0;)await new Promise(t=>setTimeout(t,100));this.$store.state.client_id=rt.id,console.log(this.$store.state.client_id),await this.$store.dispatch("refreshConfig"),console.log("Config ready")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Loading Database",this.$store.state.loading_progress=20,await this.$store.dispatch("refreshDatabase")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting Bindings list",this.$store.state.loading_progress=40,await this.$store.dispatch("refreshBindings")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting personalities zoo",this.$store.state.loading_progress=70,await this.$store.dispatch("refreshPersonalitiesZoo")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting mounted personalities",this.$store.state.loading_progress=80,await this.$store.dispatch("refreshMountedPersonalities")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting models zoo",this.$store.state.loading_progress=90,await this.$store.dispatch("refreshModelsZoo")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting active models",this.$store.state.loading_progress=100,await this.$store.dispatch("refreshModels"),await this.$store.dispatch("refreshModelStatus")}catch(t){console.log("Error cought:",t)}try{await this.$store.dispatch("fetchLanguages"),await this.$store.dispatch("fetchLanguage")}catch(t){console.log("Error cought:",t)}try{await this.$store.dispatch("fetchisRTOn")}catch(t){console.log("Error cought:",t)}this.$store.state.isConnected=!0,this.$store.state.client_id=rt.id,console.log("Ready"),this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),this.isCreated=!0,this.$store.state.ready=!0,rt.on("connected",this.socketIOConnected),rt.on("disconnected",this.socketIODisconnected),console.log("Added events"),rt.on("show_progress",this.show_progress),rt.on("hide_progress",this.hide_progress),rt.on("update_progress",this.update_progress),rt.on("notification",this.notify),rt.on("new_message",this.new_message),rt.on("update_message",this.update_message),rt.on("close_message",this.finalMsgEvent),rt.on("disucssion_renamed",t=>{console.log("Received new title",t.discussion_id,t.title);const r=this.list.findIndex(s=>s.id==t.discussion_id),i=this.list[r];i.title=t.title}),rt.onclose=t=>{console.log("WebSocket connection closed:",t.code,t.reason),this.socketIODisconnect
2024-11-04 00:22:50 +00:00
2px 2px 0px white, \r
-2px -2px 0px white, \r
2px -2px 0px white, \r
-2px 2px 0px white`,background:"linear-gradient(45deg, #f59e0b, #fbbf24)","-webkit-background-clip":"text","background-clip":"text"}},[pt(" L"),c("span",{class:"animate-pulse"},"⭐"),pt("LLMS ")],-1)),t[60]||(t[60]=c("p",{class:"text-2xl text-gray-600 dark:text-gray-300 italic"}," One tool to rule them all ",-1)),t[61]||(t[61]=c("p",{class:"text-xl text-gray-500 dark:text-gray-400 mb-6"}," by ParisNeo ",-1)),c("p",jvt,X(e.version_info),1),c("div",{class:"interesting-facts transition-transform duration-300 cursor-pointer",onClick:t[0]||(t[0]=(...r)=>e.updateRandomFact&&e.updateRandomFact(...r))},[c("p",Qvt,[t[57]||(t[57]=c("span",{class:"font-semibold text-blue-600 dark:text-blue-400"},"🤔 Fun Fact: ",-1)),c("span",{innerHTML:e.randomFact},null,8,Xvt)])]),c("div",Zvt,[c("div",{class:"animated-progressbar-fg",style:on({width:`${e.loading_progress}%`})},null,4),c("div",{class:"absolute top-0 h-full flex items-center transition-all duration-300",style:on({left:`${e.loading_progress}%`,transform:"translateX(-50%)"})},t[58]||(t[58]=[c("p",{style:{"font-size":"48px","line-height":"1"}},"🌟",-1)]),4)])]),c("div",Jvt,[c("div",eyt,[c("p",tyt,X(e.loading_infos)+"... ",1),c("p",nyt,X(Math.round(e.loading_progress))+"% ",1)])])])]))]),_:1}),W(ji,{name:"slide-right"},{default:Ge(()=>[e.showLeftPanel?(T(),M("div",ryt,[W(Pt(Ip),{to:{name:"discussions"},class:"flex items-center space-x-2"},{default:Ge(()=>[c("div",iyt,[c("img",{class:"w-12 h-12 rounded-full object-cover logo-image",src:e.$store.state.config==null?Pt(Ai):e.$store.state.config.app_custom_logo!=""?"/user_infos/"+e.$store.state.config.app_custom_logo:Pt(Ai),alt:"Logo",title:"LoLLMS WebUI"},null,8,syt)]),t[62]||(t[62]=c("div",{class:"flex flex-col justify-center"},[c("div",{class:"text-center p-2"},[c("div",{class:"text-md relative inline-block"},[c("span",{class:"relative inline-block font-bold tracking-wide text-black dark:text-white"}," LoLLMS "),c("div",{class:"absolute -bottom-0.5 left-0 w-full h-0.5 bg-black dark:bg-white transform origin-left transition-transform duration-300 hover:scale-x-100 scale-x-0"})])]),c("p",{class:"text-gray-400 text-sm"},"One tool to rule them all")],-1))]),_:1}),c("div",oyt,[c("div",ayt,[c("button",{class:"toolbar-button",title:"Create new discussion",onClick:t[1]||(t[1]=(...r)=>e.createNewDiscussion&&e.createNewDiscussion(...r))},t[63]||(t[63]=[c("i",{"data-feather":"plus"},null,-1)])),e.loading?Y("",!0):(T(),M("div",{key:0,class:"toolbar-button",onMouseleave:t[19]||(t[19]=(...r)=>e.hideMenu&&e.hideMenu(...r))},[F(c("div",{onMouseenter:t[17]||(t[17]=(...r)=>e.showMenu&&e.showMenu(...r)),class:"absolute m-0 p-0 z-50 top-full left-0 transform bg-white dark:bg-bg-dark rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none transition-all duration-300 ease-out mb-2"},[c("div",lyt,[c("button",{class:qe(["text-3xl hover:text-secondary dark:hover:text-secondary-light duration-150 active:scale-95",e.isCheckbox?"text-secondary dark:text-secondary-light":"text-gray-700 dark:text-gray-300"]),title:"Edit discussion list",type:"button",onClick:t[2]||(t[2]=r=>e.isCheckbox=!e.isCheckbox)},t[64]||(t[64]=[c("i",{"data-feather":"check-square"},null,-1)]),2),c("button",{class:"text-3xl hover:text-red-500 dark:hover:text-red-400 duration-150 active:scale-95",title:"Reset database, remove all discussions",onClick:t[3]||(t[3]=J(()=>{},["stop"]))},t[65]||(t[65]=[c("i",{"data-feather":"trash-2"},null,-1)])),c("button",{class:"text-3xl hover:text-secondary dark:hover:text-secondary-light duration-150 active:scale-95",title:"Export database",type:"button",onClick:t[4]||(t[4]=J(r=>e.database_selectorDialogVisible=!0,["stop"]))},t[66]||(t[66]=[c("i",{"data-feather":"database"},null,-1)])),c("div",cyt,[c("input",{type:"file",ref:"fileDialog",class:"hidden",onChange:t[5]||(t[5]=(...r)=>e.importDiscussions&&e.importDiscussions(...r))},null,544),c("button",{class:"text-3xl hover:text-secondary dark:hover:text-secondary-light duration-150 active:scale-95 rotate-90",title:"Import discussions",type:"button",o
2024-11-04 00:22:50 +00:00
* @license
* Copyright 2010-2023 Three.js Authors
* SPDX-License-Identifier: MIT
*/const qy="159",jEt=0,EA=1,QEt=2,zI=1,XEt=2,vs=3,Fs=0,kr=1,Vi=2,So=0,bl=1,SA=2,xA=3,TA=4,ZEt=5,na=100,JEt=101,eSt=102,wA=103,CA=104,tSt=200,nSt=201,rSt=202,iSt=203,R1=204,M1=205,sSt=206,oSt=207,aSt=208,lSt=209,cSt=210,dSt=211,uSt=212,pSt=213,hSt=214,mSt=0,fSt=1,gSt=2,th=3,_St=4,bSt=5,vSt=6,ySt=7,Yy=0,ESt=1,SSt=2,xo=0,xSt=1,TSt=2,wSt=3,CSt=4,ASt=5,AA="attached",RSt="detached",VI=300,Ol=301,Dl=302,N1=303,k1=304,sm=306,Ll=1e3,Jr=1001,nh=1002,$n=1003,I1=1004,mp=1005,Cr=1006,HI=1007,xa=1008,To=1009,MSt=1010,NSt=1011,$y=1012,qI=1013,bo=1014,Ts=1015,_d=1016,YI=1017,$I=1018,pa=1020,kSt=1021,ei=1023,ISt=1024,OSt=1025,ha=1026,Pl=1027,DSt=1028,WI=1029,LSt=1030,KI=1031,jI=1033,Q0=33776,X0=33777,Z0=33778,J0=33779,RA=35840,MA=35841,NA=35842,kA=35843,QI=36196,IA=37492,OA=37496,DA=37808,LA=37809,PA=37810,FA=37811,UA=37812,BA=37813,GA=37814,zA=37815,VA=37816,HA=37817,qA=37818,YA=37819,$A=37820,WA=37821,eb=36492,KA=36494,jA=36495,PSt=36283,QA=36284,XA=36285,ZA=36286,bd=2300,Fl=2301,tb=2302,JA=2400,eR=2401,tR=2402,FSt=2500,USt=0,XI=1,O1=2,ZI=3e3,ma=3001,BSt=3200,GSt=3201,Wy=0,zSt=1,ti="",Mn="srgb",er="srgb-linear",Ky="display-p3",om="display-p3-linear",rh="linear",bn="srgb",ih="rec709",sh="p3",Ba=7680,nR=519,VSt=512,HSt=513,qSt=514,JI=515,YSt=516,$St=517,WSt=518,KSt=519,D1=35044,rR="300 es",L1=1035,ws=2e3,oh=2001;class sc{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}const rr=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let iR=1234567;const Qc=Math.PI/180,Ul=180/Math.PI;function Ri(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(rr[n&255]+rr[n>>8&255]+rr[n>>16&255]+rr[n>>24&255]+"-"+rr[e&255]+rr[e>>8&255]+"-"+rr[e>>16&15|64]+rr[e>>24&255]+"-"+rr[t&63|128]+rr[t>>8&255]+"-"+rr[t>>16&255]+rr[t>>24&255]+rr[r&255]+rr[r>>8&255]+rr[r>>16&255]+rr[r>>24&255]).toLowerCase()}function or(n,e,t){return Math.max(e,Math.min(t,n))}function jy(n,e){return(n%e+e)%e}function jSt(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function QSt(n,e,t){return n!==e?(t-n)/(e-n):0}function Xc(n,e,t){return(1-t)*n+t*e}function XSt(n,e,t,r){return Xc(n,e,1-Math.exp(-t*r))}function ZSt(n,e=1){return e-Math.abs(jy(n,e*2)-e)}function JSt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function e2t(n,e,t){return
2024-11-04 00:22:50 +00:00
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
2024-11-05 00:44:58 +00:00
}`,N2t=`void main() {
2024-11-04 00:22:50 +00:00
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class wa extends Mi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=M2t,this.fragmentShader=N2t,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Bl(e.uniforms),this.uniformsGroups=A2t(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class cO extends wn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ht,this.projectionMatrix=new Ht,this.projectionMatrixInverse=new Ht,this.coordinateSystem=ws}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class gr extends cO{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ul*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Qc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ul*2*Math.atan(Math.tan(Qc*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,r,i,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Qc*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-
2024-11-04 00:22:50 +00:00
varying vec3 vWorldDirection;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},i=new wo(5,5,5),s=new wa({name:"CubemapFromEquirect",uniforms:Bl(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:kr,blending:So});s.uniforms.tEquirect.value=t;const o=new br(i,s),a=t.minFilter;return t.minFilter===xa&&(t.minFilter=Cr),new k2t(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,i);e.setRenderTarget(s)}}const bb=new he,O2t=new he,D2t=new Vt;class Zo{constructor(e=new he(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const i=bb.subVectors(r,t).cross(O2t.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const r=e.delta(bb),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||D2t.getNormalMatrix(e),i=this.coplanarPoint(bb).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ko=new os,zu=new he;class Qy{constructor(e=new Zo,t=new Zo,r=new Zo,i=new Zo,s=new Zo,o=new Zo){this.planes=[e,t,r,i,s,o]}set(e,t,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=ws){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],d=i[4],u=i[5],m=i[6],f=i[7],g=i[8],h=i[9],v=i[10],b=i[11],_=i[12],y=i[13],E=i[14],x=i[15];if(r[0].setComponents(l-s,f-d,b-g,x-_).normalize(),r[1].setComponents(l+s,f+d,b+g,x+_).normalize(),r[2].setComponents(l+o,f+u,b+h,x+y).normalize(),r[3].setComponents(l-o,f-u,b-h,x-y).normalize(),r[4].setComponents(l-a,f-m,b-v,x-E).normalize(),t===ws)r[5].setComponents(l+a,f+m,b+v,x+E).normalize();else if(t===oh)r[5].setComponents(a,m,v,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ko.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ko.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ko)}intersectsSprite(e){return Ko.center.set(0,0,0),Ko.radius=.7071067811865476,Ko.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ko)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let r=0;r<6;r++){const i=t[r];if(zu.x=i.normal.x>0?e.max.x:e.min.x,zu.y=i.normal.y>0?e.max.y:e.min.y,zu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(zu)<0)return!1}ret
2024-11-04 00:22:50 +00:00
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
2024-11-05 00:44:58 +00:00
#endif`,F2t=`#ifdef USE_ALPHAHASH
2024-11-04 00:22:50 +00:00
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
}
float hash3D( vec3 value ) {
return hash2D( vec2( hash2D( value.xy ), value.z ) );
}
float getAlphaHashThreshold( vec3 position ) {
float maxDeriv = max(
length( dFdx( position.xyz ) ),
length( dFdy( position.xyz ) )
);
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
vec2 pixScales = vec2(
exp2( floor( log2( pixScale ) ) ),
exp2( ceil( log2( pixScale ) ) )
);
vec2 alpha = vec2(
hash3D( floor( pixScales.x * position.xyz ) ),
hash3D( floor( pixScales.y * position.xyz ) )
);
float lerpFactor = fract( log2( pixScale ) );
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
float a = min( lerpFactor, 1.0 - lerpFactor );
vec3 cases = vec3(
x * x / ( 2.0 * a * ( 1.0 - a ) ),
( x - 0.5 * a ) / ( 1.0 - a ),
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
);
float threshold = ( x < ( 1.0 - a ) )
? ( ( x < a ) ? cases.x : cases.y )
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
2024-11-05 00:44:58 +00:00
#endif`,U2t=`#ifdef USE_ALPHAMAP
2024-11-04 00:22:50 +00:00
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
2024-11-05 00:44:58 +00:00
#endif`,B2t=`#ifdef USE_ALPHAMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D alphaMap;
2024-11-05 00:44:58 +00:00
#endif`,G2t=`#ifdef USE_ALPHATEST
2024-11-04 00:22:50 +00:00
if ( diffuseColor.a < alphaTest ) discard;
2024-11-05 00:44:58 +00:00
#endif`,z2t=`#ifdef USE_ALPHATEST
2024-11-04 00:22:50 +00:00
uniform float alphaTest;
2024-11-05 00:44:58 +00:00
#endif`,V2t=`#ifdef USE_AOMAP
2024-11-04 00:22:50 +00:00
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
clearcoatSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_SHEEN )
sheenSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
2024-11-05 00:44:58 +00:00
#endif`,H2t=`#ifdef USE_AOMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D aoMap;
uniform float aoMapIntensity;
2024-11-05 00:44:58 +00:00
#endif`,q2t=`#ifdef USE_BATCHING
2024-11-04 00:22:50 +00:00
attribute float batchId;
uniform highp sampler2D batchingTexture;
mat4 getBatchingMatrix( const in float i ) {
int size = textureSize( batchingTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
2024-11-05 00:44:58 +00:00
#endif`,Y2t=`#ifdef USE_BATCHING
2024-11-04 00:22:50 +00:00
mat4 batchingMatrix = getBatchingMatrix( batchId );
2024-11-05 00:44:58 +00:00
#endif`,$2t=`vec3 transformed = vec3( position );
2024-11-04 00:22:50 +00:00
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
2024-11-05 00:44:58 +00:00
#endif`,W2t=`vec3 objectNormal = vec3( normal );
2024-11-04 00:22:50 +00:00
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
2024-11-05 00:44:58 +00:00
#endif`,K2t=`float G_BlinnPhong_Implicit( ) {
2024-11-04 00:22:50 +00:00
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
2024-11-05 00:44:58 +00:00
} // validated`,j2t=`#ifdef USE_IRIDESCENCE
2024-11-04 00:22:50 +00:00
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
-0.4985314, 0.0415560, 1.0572252
);
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
vec3 sqrtF0 = sqrt( fresnel0 );
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
}
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
}
float IorToFresnel0( float transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
}
vec3 evalSensitivity( float OPD, vec3 shift ) {
float phase = 2.0 * PI * OPD * 1.0e-9;
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
xyz /= 1.0685e-7;
vec3 rgb = XYZ_TO_REC709 * xyz;
return rgb;
}
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
vec3 I;
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
float cosTheta2Sq = 1.0 - sinTheta2Sq;
if ( cosTheta2Sq < 0.0 ) {
return vec3( 1.0 );
}
float cosTheta2 = sqrt( cosTheta2Sq );
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
float T121 = 1.0 - R12;
float phi12 = 0.0;
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
float phi21 = PI - phi12;
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
vec3 phi23 = vec3( 0.0 );
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
vec3 phi = vec3( phi21 ) + phi23;
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
vec3 r123 = sqrt( R123 );
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
vec3 C0 = R12 + Rs;
I = C0;
vec3 Cm = Rs - T121;
for ( int m = 1; m <= 2; ++ m ) {
Cm *= r123;
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
I += Cm * Sm;
}
return max( I, vec3( 0.0 ) );
}
2024-11-05 00:44:58 +00:00
#endif`,Q2t=`#ifdef USE_BUMPMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vBumpMapUv );
vec2 dSTdy = dFdy( vBumpMapUv );
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 ) * faceDirection;
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
2024-11-05 00:44:58 +00:00
#endif`,X2t=`#if NUM_CLIPPING_PLANES > 0
2024-11-04 00:22:50 +00:00
vec4 plane;
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
}
#pragma unroll_loop_end
if ( clipped ) discard;
#endif
2024-11-05 00:44:58 +00:00
#endif`,Z2t=`#if NUM_CLIPPING_PLANES > 0
2024-11-04 00:22:50 +00:00
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
2024-11-05 00:44:58 +00:00
#endif`,J2t=`#if NUM_CLIPPING_PLANES > 0
2024-11-04 00:22:50 +00:00
varying vec3 vClipPosition;
2024-11-05 00:44:58 +00:00
#endif`,ext=`#if NUM_CLIPPING_PLANES > 0
2024-11-04 00:22:50 +00:00
vClipPosition = - mvPosition.xyz;
2024-11-05 00:44:58 +00:00
#endif`,txt=`#if defined( USE_COLOR_ALPHA )
2024-11-04 00:22:50 +00:00
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
2024-11-05 00:44:58 +00:00
#endif`,nxt=`#if defined( USE_COLOR_ALPHA )
2024-11-04 00:22:50 +00:00
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
2024-11-05 00:44:58 +00:00
#endif`,rxt=`#if defined( USE_COLOR_ALPHA )
2024-11-04 00:22:50 +00:00
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
varying vec3 vColor;
2024-11-05 00:44:58 +00:00
#endif`,ixt=`#if defined( USE_COLOR_ALPHA )
2024-11-04 00:22:50 +00:00
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
vColor.xyz *= instanceColor.xyz;
2024-11-05 00:44:58 +00:00
#endif`,sxt=`#define PI 3.141592653589793
2024-11-04 00:22:50 +00:00
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
float precisionSafeLength( vec3 v ) { return length( v ); }
#else
float precisionSafeLength( vec3 v ) {
float maxComponent = max3( abs( v ) );
return length( v / maxComponent ) * maxComponent;
}
#endif
struct IncidentLight {
vec3 color;
vec3 direction;
bool visible;
};
struct ReflectedLight {
vec3 directDiffuse;
vec3 directSpecular;
vec3 indirectDiffuse;
vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
mat3 tmp;
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
return tmp;
}
float luminance( const in vec3 rgb ) {
const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
return dot( weights, rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
2024-11-05 00:44:58 +00:00
} // validated`,oxt=`#ifdef ENVMAP_TYPE_CUBE_UV
2024-11-04 00:22:50 +00:00
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
vec3 absDirection = abs( direction );
float face = - 1.0;
if ( absDirection.x > absDirection.z ) {
if ( absDirection.x > absDirection.y )
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if ( absDirection.z > absDirection.y )
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}
vec2 getUV( vec3 direction, float face ) {
vec2 uv;
if ( face == 0.0 ) {
uv = vec2( direction.z, direction.y ) / abs( direction.x );
} else if ( face == 1.0 ) {
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
} else if ( face == 2.0 ) {
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
} else if ( face == 3.0 ) {
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
} else if ( face == 4.0 ) {
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
} else {
uv = vec2( direction.x, direction.y ) / abs( direction.z );
}
return 0.5 * ( uv + 1.0 );
}
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
float face = getFace( direction );
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
mipInt = max( mipInt, cubeUV_minMipLevel );
float faceSize = exp2( mipInt );
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
if ( face > 2.0 ) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
uv.x *= CUBEUV_TEXEL_WIDTH;
uv.y *= CUBEUV_TEXEL_HEIGHT;
#ifdef texture2DGradEXT
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
#else
return texture2D( envMap, uv ).rgb;
#endif
}
#define cubeUV_r0 1.0
#define cubeUV_v0 0.339
#define cubeUV_m0 - 2.0
#define cubeUV_r1 0.8
#define cubeUV_v1 0.276
#define cubeUV_m1 - 1.0
#define cubeUV_r4 0.4
#define cubeUV_v4 0.046
#define cubeUV_m4 2.0
#define cubeUV_r5 0.305
#define cubeUV_v5 0.016
#define cubeUV_m5 3.0
#define cubeUV_r6 0.21
#define cubeUV_v6 0.0038
#define cubeUV_m6 4.0
float roughnessToMip( float roughness ) {
float mip = 0.0;
if ( roughness >= cubeUV_r1 ) {
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
} else if ( roughness >= cubeUV_r4 ) {
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
} else if ( roughness >= cubeUV_r5 ) {
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
} else if ( roughness >= cubeUV_r6 ) {
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
} else {
mip = - 2.0 * log2( 1.16 * roughness ); }
return mip;
}
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
float mipF = fract( mip );
float mipInt = floor( mip );
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
if ( mipF == 0.0 ) {
return vec4( color0, 1.0 );
} else {
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
2024-11-05 00:44:58 +00:00
#endif`,axt=`vec3 transformedNormal = objectNormal;
2024-11-04 00:22:50 +00:00
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
mat3 bm = mat3( batchingMatrix );
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
transformedNormal = bm * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = bm * transformedTangent;
#endif
#endif
#ifdef USE_INSTANCING
mat3 im = mat3( instanceMatrix );
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
transformedNormal = im * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = im * transformedTangent;
#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
2024-11-05 00:44:58 +00:00
#endif`,lxt=`#ifdef USE_DISPLACEMENTMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
2024-11-05 00:44:58 +00:00
#endif`,cxt=`#ifdef USE_DISPLACEMENTMAP
2024-11-04 00:22:50 +00:00
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
2024-11-05 00:44:58 +00:00
#endif`,dxt=`#ifdef USE_EMISSIVEMAP
2024-11-04 00:22:50 +00:00
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
totalEmissiveRadiance *= emissiveColor.rgb;
2024-11-05 00:44:58 +00:00
#endif`,uxt=`#ifdef USE_EMISSIVEMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D emissiveMap;
2024-11-05 00:44:58 +00:00
#endif`,pxt="gl_FragColor = linearToOutputTexel( gl_FragColor );",hxt=`
2024-11-04 00:22:50 +00:00
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
vec3( 0.8224621, 0.177538, 0.0 ),
vec3( 0.0331941, 0.9668058, 0.0 ),
vec3( 0.0170827, 0.0723974, 0.9105199 )
);
const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
vec3( 1.2249401, - 0.2249404, 0.0 ),
vec3( - 0.0420569, 1.0420571, 0.0 ),
vec3( - 0.0196376, - 0.0786361, 1.0982735 )
);
vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
}
vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
}
vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferOETF( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}
vec4 LinearToLinear( in vec4 value ) {
return value;
}
vec4 LinearTosRGB( in vec4 value ) {
return sRGBTransferOETF( value );
2024-11-05 00:44:58 +00:00
}`,mxt=`#ifdef USE_ENVMAP
2024-11-04 00:22:50 +00:00
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
#else
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
#endif
#else
vec3 reflectVec = vReflect;
#endif
#ifdef ENVMAP_TYPE_CUBE
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
#else
vec4 envColor = vec4( 0.0 );
#endif
#ifdef ENVMAP_BLENDING_MULTIPLY
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_MIX )
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
2024-11-05 00:44:58 +00:00
#endif`,fxt=`#ifdef USE_ENVMAP
2024-11-04 00:22:50 +00:00
uniform float envMapIntensity;
uniform float flipEnvMap;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
2024-11-05 00:44:58 +00:00
#endif`,gxt=`#ifdef USE_ENVMAP
2024-11-04 00:22:50 +00:00
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
uniform float refractionRatio;
#else
varying vec3 vReflect;
#endif
2024-11-05 00:44:58 +00:00
#endif`,_xt=`#ifdef USE_ENVMAP
2024-11-04 00:22:50 +00:00
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
#else
varying vec3 vReflect;
uniform float refractionRatio;
#endif
2024-11-05 00:44:58 +00:00
#endif`,bxt=`#ifdef USE_ENVMAP
2024-11-04 00:22:50 +00:00
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
vec3 cameraToVertex;
if ( isOrthographic ) {
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
2024-11-05 00:44:58 +00:00
#endif`,vxt=`#ifdef USE_FOG
2024-11-04 00:22:50 +00:00
vFogDepth = - mvPosition.z;
2024-11-05 00:44:58 +00:00
#endif`,yxt=`#ifdef USE_FOG
2024-11-04 00:22:50 +00:00
varying float vFogDepth;
2024-11-05 00:44:58 +00:00
#endif`,Ext=`#ifdef USE_FOG
2024-11-04 00:22:50 +00:00
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
2024-11-05 00:44:58 +00:00
#endif`,Sxt=`#ifdef USE_FOG
2024-11-04 00:22:50 +00:00
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
2024-11-05 00:44:58 +00:00
#endif`,xxt=`#ifdef USE_GRADIENTMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return vec3( texture2D( gradientMap, coord ).r );
#else
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
2024-11-05 00:44:58 +00:00
}`,Txt=`#ifdef USE_LIGHTMAP
2024-11-04 00:22:50 +00:00
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
reflectedLight.indirectDiffuse += lightMapIrradiance;
2024-11-05 00:44:58 +00:00
#endif`,wxt=`#ifdef USE_LIGHTMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D lightMap;
uniform float lightMapIntensity;
2024-11-05 00:44:58 +00:00
#endif`,Cxt=`LambertMaterial material;
2024-11-04 00:22:50 +00:00
material.diffuseColor = diffuseColor.rgb;
2024-11-05 00:44:58 +00:00
material.specularStrength = specularStrength;`,Axt=`varying vec3 vViewPosition;
2024-11-04 00:22:50 +00:00
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
2024-11-05 00:44:58 +00:00
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Rxt=`uniform bool receiveShadow;
2024-11-04 00:22:50 +00:00
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
float x = normal.x, y = normal.y, z = normal.z;
vec3 result = shCoefficients[ 0 ] * 0.886227;
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor;
return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
#if defined ( LEGACY_LIGHTS )
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
}
return 1.0;
#else
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
#endif
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
struct DirectionalLight {
vec3 direction;
vec3 color;
};
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
light.color = directionalLight.color;
light.direction = directionalLight.direction;
light.visible = true;
}
#endif
#if NUM_POINT_LIGHTS > 0
struct PointLight {
vec3 position;
vec3 color;
float distance;
float decay;
};
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = pointLight.position - geometryPosition;
light.direction = normalize( lVector );
float lightDistance = length( lVector );
light.color = pointLight.color;
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
}
#endif
#if NUM_SPOT_LIGHTS > 0
struct SpotLight {
vec3 position;
vec3 direction;
vec3 color;
float distance;
float decay;
float coneCos;
float penumbraCos;
};
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = spotLight.position - geometryPosition;
light.direction = normalize( lVector );
float angleCos = dot( light.direction, spotLight.direction );
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
if ( spotAttenuation > 0.0 ) {
float lightDistance = length( lVector );
light.color = spotLight.color * spotAttenuation;
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
} else {
light.color = vec3( 0.0 );
light.visible = false;
}
}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
struct RectAreaLight {
vec3 color;
vec3 position;
vec3 halfWidth;
vec3 halfHeight;
};
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
struct HemisphereLight {
vec3 direction;
vec3 skyColor;
vec3 groundColor;
};
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
float dotNL = dot( normal, hemiLight.direction );
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
2024-11-05 00:44:58 +00:00
#endif`,Mxt=`#ifdef USE_ENVMAP
2024-11-04 00:22:50 +00:00
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
return PI * envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 reflectVec = reflect( - viewDir, normal );
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
return envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
#ifdef USE_ANISOTROPY
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 bentNormal = cross( bitangent, viewDir );
bentNormal = normalize( cross( bentNormal, bitangent ) );
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
return getIBLRadiance( viewDir, bentNormal, roughness );
#else
return vec3( 0.0 );
#endif
}
#endif
2024-11-05 00:44:58 +00:00
#endif`,Nxt=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,kxt=`varying vec3 vViewPosition;
2024-11-04 00:22:50 +00:00
struct ToonMaterial {
vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
2024-11-05 00:44:58 +00:00
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Ixt=`BlinnPhongMaterial material;
2024-11-04 00:22:50 +00:00
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
2024-11-05 00:44:58 +00:00
material.specularStrength = specularStrength;`,Oxt=`varying vec3 vViewPosition;
2024-11-04 00:22:50 +00:00
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
2024-11-05 00:44:58 +00:00
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Dxt=`PhysicalMaterial material;
2024-11-04 00:22:50 +00:00
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
material.ior = ior;
#ifdef USE_SPECULAR
float specularIntensityFactor = specularIntensity;
vec3 specularColorFactor = specularColor;
#ifdef USE_SPECULAR_COLORMAP
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
#endif
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
#else
float specularIntensityFactor = 1.0;
vec3 specularColorFactor = vec3( 1.0 );
material.specularF90 = 1.0;
#endif
material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
material.clearcoat = clearcoat;
material.clearcoatRoughness = clearcoatRoughness;
material.clearcoatF0 = vec3( 0.04 );
material.clearcoatF90 = 1.0;
#ifdef USE_CLEARCOATMAP
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
#endif
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
material.clearcoatRoughness += geometryRoughness;
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_IRIDESCENCE
material.iridescence = iridescence;
material.iridescenceIOR = iridescenceIOR;
#ifdef USE_IRIDESCENCEMAP
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
#else
material.iridescenceThickness = iridescenceThicknessMaximum;
#endif
#endif
#ifdef USE_SHEEN
material.sheenColor = sheenColor;
#ifdef USE_SHEEN_COLORMAP
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
#endif
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
#ifdef USE_SHEEN_ROUGHNESSMAP
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
#endif
#endif
#ifdef USE_ANISOTROPY
#ifdef USE_ANISOTROPYMAP
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
#else
vec2 anisotropyV = anisotropyVector;
#endif
material.anisotropy = length( anisotropyV );
if( material.anisotropy == 0.0 ) {
anisotropyV = vec2( 1.0, 0.0 );
} else {
anisotropyV /= material.anisotropy;
material.anisotropy = saturate( material.anisotropy );
}
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
2024-11-05 00:44:58 +00:00
#endif`,Lxt=`struct PhysicalMaterial {
2024-11-04 00:22:50 +00:00
vec3 diffuseColor;
float roughness;
vec3 specularColor;
float specularF90;
#ifdef USE_CLEARCOAT
float clearcoat;
float clearcoatRoughness;
vec3 clearcoatF0;
float clearcoatF90;
#endif
#ifdef USE_IRIDESCENCE
float iridescence;
float iridescenceIOR;
float iridescenceThickness;
vec3 iridescenceFresnel;
vec3 iridescenceF0;
#endif
#ifdef USE_SHEEN
vec3 sheenColor;
float sheenRoughness;
#endif
#ifdef IOR
float ior;
#endif
#ifdef USE_TRANSMISSION
float transmission;
float transmissionAlpha;
float thickness;
float attenuationDistance;
vec3 attenuationColor;
#endif
#ifdef USE_ANISOTROPY
float anisotropy;
float alphaT;
vec3 anisotropyT;
vec3 anisotropyB;
#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
float x2 = x * x;
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
float a2 = pow2( alpha );
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
float v = 0.5 / ( gv + gl );
return saturate(v);
}
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
float a2 = alphaT * alphaB;
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
highp float v2 = dot( v, v );
float w2 = a2 / v2;
return RECIPROCAL_PI * a2 * pow2 ( w2 );
}
#endif
#ifdef USE_CLEARCOAT
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
vec3 f0 = material.clearcoatF0;
float f90 = material.clearcoatF90;
float roughness = material.clearcoatRoughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( V * D );
}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
vec3 f0 = material.specularColor;
float f90 = material.specularF90;
float roughness = material.roughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
#ifdef USE_IRIDESCENCE
F = mix( F, material.iridescenceFresnel, material.iridescence );
#endif
#ifdef USE_ANISOTROPY
float dotTL = dot( material.anisotropyT, lightDir );
float dotTV = dot( material.anisotropyT, viewDir );
float dotTH = dot( material.anisotropyT, halfDir );
float dotBL = dot( material.anisotropyB, lightDir );
float dotBV = dot( material.anisotropyB, viewDir );
float dotBH = dot( material.anisotropyB, halfDir );
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
#else
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
#endif
return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
const float LUT_SIZE = 64.0;
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
const float LUT_BIAS = 0.5 / LUT_SIZE;
float dotNV = saturate( dot( N, V ) );
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
uv = uv * LUT_SCALE + LUT_BIAS;
return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
float l = length( f );
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
float x = dot( v1, v2 );
float y = abs( x );
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
float b = 3.4175940 + ( 4.1616724 + y ) * y;
float v = a / b;
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
vec3 lightNormal = cross( v1, v2 );
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
vec3 T1, T2;
T1 = normalize( V - N * dot( V, N ) );
T2 = - cross( N, T1 );
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
vec3 coords[ 4 ];
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
coords[ 0 ] = normalize( coords[ 0 ] );
coords[ 1 ] = normalize( coords[ 1 ] );
coords[ 2 ] = normalize( coords[ 2 ] );
coords[ 3 ] = normalize( coords[ 3 ] );
vec3 vectorFormFactor = vec3( 0.0 );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
float alpha = pow2( roughness );
float invAlpha = 1.0 / alpha;
float cos2h = dotNH * dotNH;
float sin2h = max( 1.0 - cos2h, 0.0078125 );
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float D = D_Charlie( sheenRoughness, dotNH );
float V = V_Neubelt( dotNV, dotNL );
return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
float r2 = roughness * roughness;
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
vec4 r = roughness * c0 + c1;
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
vec2 fab = DFGApprox( normal, viewDir, roughness );
return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
vec2 fab = DFGApprox( normal, viewDir, roughness );
#ifdef USE_IRIDESCENCE
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
#else
vec3 Fr = specularColor;
#endif
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
float Ess = fab.x + fab.y;
float Ems = 1.0 - Ess;
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
singleScatter += FssEss;
multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometryNormal;
vec3 viewDir = geometryViewDir;
vec3 position = geometryPosition;
vec3 lightPos = rectAreaLight.position;
vec3 halfWidth = rectAreaLight.halfWidth;
vec3 halfHeight = rectAreaLight.halfHeight;
vec3 lightColor = rectAreaLight.color;
float roughness = material.roughness;
vec3 rectCoords[ 4 ];
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
vec2 uv = LTC_Uv( normal, viewDir, roughness );
vec4 t1 = texture2D( ltc_1, uv );
vec4 t2 = texture2D( ltc_2, uv );
mat3 mInv = mat3(
vec3( t1.x, 0, t1.y ),
vec3( 0, 1, 0 ),
vec3( t1.z, 0, t1.w )
);
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifdef USE_CLEARCOAT
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = dotNLcc * directLight.color;
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
#endif
#ifdef USE_SHEEN
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
#endif
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
#ifdef USE_CLEARCOAT
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
#endif
#ifdef USE_SHEEN
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
#endif
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
#ifdef USE_IRIDESCENCE
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
#else
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
#endif
vec3 totalScattering = singleScattering + multiScattering;
vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
reflectedLight.indirectSpecular += radiance * singleScattering;
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct RE_Direct_Physical
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
2024-11-05 00:44:58 +00:00
}`,Pxt=`
2024-11-04 00:22:50 +00:00
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
float dotNVi = saturate( dot( normal, geometryViewDir ) );
if ( material.iridescenceThickness == 0.0 ) {
material.iridescence = 0.0;
} else {
material.iridescence = saturate( material.iridescence );
}
if ( material.iridescence > 0.0 ) {
material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
PointLight pointLight;
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
pointLight = pointLights[ i ];
getPointLightInfo( pointLight, geometryPosition, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
pointLightShadow = pointLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
SpotLight spotLight;
vec4 spotColor;
vec3 spotLightCoord;
bool inSpotLightMap;
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
spotLight = spotLights[ i ];
getSpotLightInfo( spotLight, geometryPosition, directLight );
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
#else
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#endif
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
#endif
#undef SPOT_LIGHT_MAP_INDEX
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
DirectionalLight directionalLight;
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalLightInfo( directionalLight, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
RectAreaLight rectAreaLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
#if defined( USE_LIGHT_PROBES )
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
#endif
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
}
#pragma unroll_loop_end
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
2024-11-05 00:44:58 +00:00
#endif`,Fxt=`#if defined( RE_IndirectDiffuse )
2024-11-04 00:22:50 +00:00
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
irradiance += lightMapIrradiance;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
iblIrradiance += getIBLIrradiance( geometryNormal );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
#ifdef USE_ANISOTROPY
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
#else
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
#endif
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
2024-11-05 00:44:58 +00:00
#endif`,Uxt=`#if defined( RE_IndirectDiffuse )
2024-11-04 00:22:50 +00:00
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2024-11-05 00:44:58 +00:00
#endif`,Bxt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
2024-11-04 00:22:50 +00:00
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
2024-11-05 00:44:58 +00:00
#endif`,Gxt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
2024-11-04 00:22:50 +00:00
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
2024-11-05 00:44:58 +00:00
#endif`,zxt=`#ifdef USE_LOGDEPTHBUF
2024-11-04 00:22:50 +00:00
#ifdef USE_LOGDEPTHBUF_EXT
varying float vFragDepth;
varying float vIsPerspective;
#else
uniform float logDepthBufFC;
#endif
2024-11-05 00:44:58 +00:00
#endif`,Vxt=`#ifdef USE_LOGDEPTHBUF
2024-11-04 00:22:50 +00:00
#ifdef USE_LOGDEPTHBUF_EXT
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#else
if ( isPerspectiveMatrix( projectionMatrix ) ) {
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
gl_Position.z *= gl_Position.w;
}
#endif
2024-11-05 00:44:58 +00:00
#endif`,Hxt=`#ifdef USE_MAP
2024-11-04 00:22:50 +00:00
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
#endif
diffuseColor *= sampledDiffuseColor;
2024-11-05 00:44:58 +00:00
#endif`,qxt=`#ifdef USE_MAP
2024-11-04 00:22:50 +00:00
uniform sampler2D map;
2024-11-05 00:44:58 +00:00
#endif`,Yxt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
2024-11-04 00:22:50 +00:00
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#endif
#ifdef USE_MAP
diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
2024-11-05 00:44:58 +00:00
#endif`,$xt=`#if defined( USE_POINTS_UV )
2024-11-04 00:22:50 +00:00
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
uniform mat3 uvTransform;
#endif
#endif
#ifdef USE_MAP
uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
2024-11-05 00:44:58 +00:00
#endif`,Wxt=`float metalnessFactor = metalness;
2024-11-04 00:22:50 +00:00
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
2024-11-05 00:44:58 +00:00
#endif`,Kxt=`#ifdef USE_METALNESSMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D metalnessMap;
2024-11-05 00:44:58 +00:00
#endif`,jxt=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
2024-11-04 00:22:50 +00:00
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
#elif defined( USE_COLOR )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
2024-11-05 00:44:58 +00:00
#endif`,Qxt=`#ifdef USE_MORPHNORMALS
2024-11-04 00:22:50 +00:00
objectNormal *= morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
#else
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
#endif
2024-11-05 00:44:58 +00:00
#endif`,Xxt=`#ifdef USE_MORPHTARGETS
2024-11-04 00:22:50 +00:00
uniform float morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
uniform sampler2DArray morphTargetsTexture;
uniform ivec2 morphTargetsTextureSize;
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
int y = texelIndex / morphTargetsTextureSize.x;
int x = texelIndex - y * morphTargetsTextureSize.x;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
#else
#ifndef USE_MORPHNORMALS
uniform float morphTargetInfluences[ 8 ];
#else
uniform float morphTargetInfluences[ 4 ];
#endif
#endif
2024-11-05 00:44:58 +00:00
#endif`,Zxt=`#ifdef USE_MORPHTARGETS
2024-11-04 00:22:50 +00:00
transformed *= morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
#else
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
#ifndef USE_MORPHNORMALS
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
#endif
#endif
2024-11-05 00:44:58 +00:00
#endif`,Jxt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
2024-11-04 00:22:50 +00:00
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
vec3 normal = normalize( cross( fdx, fdy ) );
#else
vec3 normal = normalize( vNormal );
#ifdef DOUBLE_SIDED
normal *= faceDirection;
#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
#ifdef USE_TANGENT
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn = getTangentFrame( - vViewPosition, normal,
#if defined( USE_NORMALMAP )
vNormalMapUv
#elif defined( USE_CLEARCOAT_NORMALMAP )
vClearcoatNormalMapUv
#else
vUv
#endif
);
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn[0] *= faceDirection;
tbn[1] *= faceDirection;
#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
#ifdef USE_TANGENT
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn2[0] *= faceDirection;
tbn2[1] *= faceDirection;
#endif
#endif
2024-11-05 00:44:58 +00:00
vec3 nonPerturbedNormal = normal;`,eTt=`#ifdef USE_NORMALMAP_OBJECTSPACE
2024-11-04 00:22:50 +00:00
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * faceDirection;
#endif
normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
2024-11-05 00:44:58 +00:00
#endif`,tTt=`#ifndef FLAT_SHADED
2024-11-04 00:22:50 +00:00
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
2024-11-05 00:44:58 +00:00
#endif`,nTt=`#ifndef FLAT_SHADED
2024-11-04 00:22:50 +00:00
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
2024-11-05 00:44:58 +00:00
#endif`,rTt=`#ifndef FLAT_SHADED
2024-11-04 00:22:50 +00:00
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
2024-11-05 00:44:58 +00:00
#endif`,iTt=`#ifdef USE_NORMALMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
vec3 q0 = dFdx( eye_pos.xyz );
vec3 q1 = dFdy( eye_pos.xyz );
vec2 st0 = dFdx( uv.st );
vec2 st1 = dFdy( uv.st );
vec3 N = surf_norm;
vec3 q1perp = cross( q1, N );
vec3 q0perp = cross( N, q0 );
vec3 T = q1perp * st0.x + q0perp * st1.x;
vec3 B = q1perp * st0.y + q0perp * st1.y;
float det = max( dot( T, T ), dot( B, B ) );
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
2024-11-05 00:44:58 +00:00
#endif`,sTt=`#ifdef USE_CLEARCOAT
2024-11-04 00:22:50 +00:00
vec3 clearcoatNormal = nonPerturbedNormal;
2024-11-05 00:44:58 +00:00
#endif`,oTt=`#ifdef USE_CLEARCOAT_NORMALMAP
2024-11-04 00:22:50 +00:00
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
2024-11-05 00:44:58 +00:00
#endif`,aTt=`#ifdef USE_CLEARCOATMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearcoatNormalMap;
uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
2024-11-05 00:44:58 +00:00
#endif`,lTt=`#ifdef USE_IRIDESCENCEMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
2024-11-05 00:44:58 +00:00
#endif`,cTt=`#ifdef OPAQUE
2024-11-04 00:22:50 +00:00
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
2024-11-05 00:44:58 +00:00
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,dTt=`vec3 packNormalToRGB( const in vec3 normal ) {
2024-11-04 00:22:50 +00:00
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
vec4 r = vec4( fract( v * PackFactors ), v );
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
return dot( v, UnpackFactors );
}
vec2 packDepthToRG( in highp float v ) {
return packDepthToRGBA( v ).yx;
}
float unpackRGToDepth( const in highp vec2 v ) {
return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
}
vec4 pack2HalfToRGBA( vec2 v ) {
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( vec4 v ) {
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far );
2024-11-05 00:44:58 +00:00
}`,uTt=`#ifdef PREMULTIPLIED_ALPHA
2024-11-04 00:22:50 +00:00
gl_FragColor.rgb *= gl_FragColor.a;
2024-11-05 00:44:58 +00:00
#endif`,pTt=`vec4 mvPosition = vec4( transformed, 1.0 );
2024-11-04 00:22:50 +00:00
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
2024-11-05 00:44:58 +00:00
gl_Position = projectionMatrix * mvPosition;`,hTt=`#ifdef DITHERING
2024-11-04 00:22:50 +00:00
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
2024-11-05 00:44:58 +00:00
#endif`,mTt=`#ifdef DITHERING
2024-11-04 00:22:50 +00:00
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
2024-11-05 00:44:58 +00:00
#endif`,fTt=`float roughnessFactor = roughness;
2024-11-04 00:22:50 +00:00
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
2024-11-05 00:44:58 +00:00
#endif`,gTt=`#ifdef USE_ROUGHNESSMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D roughnessMap;
2024-11-05 00:44:58 +00:00
#endif`,_Tt=`#if NUM_SPOT_LIGHT_COORDS > 0
2024-11-04 00:22:50 +00:00
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
struct SpotLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
}
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
return unpackRGBATo2Half( texture2D( shadow, uv ) );
}
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
float occlusion = 1.0;
vec2 distribution = texture2DDistribution( shadow, uv );
float hard_shadow = step( compare , distribution.x );
if (hard_shadow != 1.0 ) {
float distance = compare - distribution.x ;
float variance = max( 0.00000, distribution.y * distribution.y );
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
}
return occlusion;
}
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
#if defined( SHADOWMAP_TYPE_PCF )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx0 = - texelSize.x * shadowRadius;
float dy0 = - texelSize.y * shadowRadius;
float dx1 = + texelSize.x * shadowRadius;
float dy1 = + texelSize.y * shadowRadius;
float dx2 = dx0 / 2.0;
float dy2 = dy0 / 2.0;
float dx3 = dx1 / 2.0;
float dy3 = dy1 / 2.0;
shadow = (
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
) * ( 1.0 / 17.0 );
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx = texelSize.x;
float dy = texelSize.y;
vec2 uv = shadowCoord.xy;
vec2 f = fract( uv * shadowMapSize + 0.5 );
uv -= f * texelSize;
shadow = (
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
f.x ),
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
f.x ),
f.y )
) * ( 1.0 / 9.0 );
#elif defined( SHADOWMAP_TYPE_VSM )
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
#else
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
#endif
}
return shadow;
}
vec2 cubeToUV( vec3 v, float texelSizeY ) {
vec3 absV = abs( v );
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
absV *= scaleToCube;
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
vec2 planar = v.xy;
float almostATexel = 1.5 * texelSizeY;
float almostOne = 1.0 - almostATexel;
if ( absV.z >= almostOne ) {
if ( v.z > 0.0 )
planar.x = 4.0 - v.x;
} else if ( absV.x >= almostOne ) {
float signX = sign( v.x );
planar.x = v.z * signX + 2.0 * signX;
} else if ( absV.y >= almostOne ) {
float signY = sign( v.y );
planar.x = v.x + 2.0 * signY + 2.0;
planar.y = v.z * signY - 2.0;
}
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
}
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
vec3 lightToPosition = shadowCoord.xyz;
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
vec3 bd3D = normalize( lightToPosition );
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
return (
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
) * ( 1.0 / 9.0 );
#else
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
#endif
}
2024-11-05 00:44:58 +00:00
#endif`,bTt=`#if NUM_SPOT_LIGHT_COORDS > 0
2024-11-04 00:22:50 +00:00
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
struct SpotLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
2024-11-05 00:44:58 +00:00
#endif`,vTt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2024-11-04 00:22:50 +00:00
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
#if NUM_DIR_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
shadowWorldPosition = worldPosition;
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
#endif
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
2024-11-05 00:44:58 +00:00
#endif`,yTt=`float getShadowMask() {
2024-11-04 00:22:50 +00:00
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
directionalLight = directionalLightShadows[ i ];
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
spotLight = spotLightShadows[ i ];
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
pointLight = pointLightShadows[ i ];
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#pragma unroll_loop_end
#endif
#endif
return shadow;
2024-11-05 00:44:58 +00:00
}`,ETt=`#ifdef USE_SKINNING
2024-11-04 00:22:50 +00:00
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
2024-11-05 00:44:58 +00:00
#endif`,STt=`#ifdef USE_SKINNING
2024-11-04 00:22:50 +00:00
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
mat4 getBoneMatrix( const in float i ) {
int size = textureSize( boneTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
2024-11-05 00:44:58 +00:00
#endif`,xTt=`#ifdef USE_SKINNING
2024-11-04 00:22:50 +00:00
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
2024-11-05 00:44:58 +00:00
#endif`,TTt=`#ifdef USE_SKINNING
2024-11-04 00:22:50 +00:00
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
2024-11-05 00:44:58 +00:00
#endif`,wTt=`float specularStrength;
2024-11-04 00:22:50 +00:00
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
2024-11-05 00:44:58 +00:00
#endif`,CTt=`#ifdef USE_SPECULARMAP
2024-11-04 00:22:50 +00:00
uniform sampler2D specularMap;
2024-11-05 00:44:58 +00:00
#endif`,ATt=`#if defined( TONE_MAPPING )
2024-11-04 00:22:50 +00:00
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2024-11-05 00:44:58 +00:00
#endif`,RTt=`#ifndef saturate
2024-11-04 00:22:50 +00:00
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
const mat3 ACESInputMat = mat3(
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
vec3( 0.04823, 0.01566, 0.83777 )
);
const mat3 ACESOutputMat = mat3(
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
vec3( -0.07367, -0.00605, 1.07602 )
);
color *= toneMappingExposure / 0.6;
color = ACESInputMat * color;
color = RRTAndODTFit( color );
color = ACESOutputMat * color;
return saturate( color );
}
2024-11-05 00:44:58 +00:00
vec3 CustomToneMapping( vec3 color ) { return color; }`,MTt=`#ifdef USE_TRANSMISSION
2024-11-04 00:22:50 +00:00
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
material.attenuationDistance = attenuationDistance;
material.attenuationColor = attenuationColor;
#ifdef USE_TRANSMISSIONMAP
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
#endif
#ifdef USE_THICKNESSMAP
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
#endif
vec3 pos = vWorldPosition;
vec3 v = normalize( cameraPosition - pos );
vec3 n = inverseTransformDirection( normal, viewMatrix );
vec4 transmitted = getIBLVolumeRefraction(
n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2024-11-05 00:44:58 +00:00
#endif`,NTt=`#ifdef USE_TRANSMISSION
2024-11-04 00:22:50 +00:00
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
uniform vec3 attenuationColor;
#ifdef USE_TRANSMISSIONMAP
uniform sampler2D transmissionMap;
#endif
#ifdef USE_THICKNESSMAP
uniform sampler2D thicknessMap;
#endif
uniform vec2 transmissionSamplerSize;
uniform sampler2D transmissionSamplerMap;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
varying vec3 vWorldPosition;
float w0( float a ) {
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
}
float w1( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
}
float w2( float a ){
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
}
float w3( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * a );
}
float g0( float a ) {
return w0( a ) + w1( a );
}
float g1( float a ) {
return w2( a ) + w3( a );
}
float h0( float a ) {
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
}
float h1( float a ) {
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
}
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
uv = uv * texelSize.zw + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
float g0x = g0( fuv.x );
float g1x = g1( fuv.x );
float h0x = h0( fuv.x );
float h1x = h1( fuv.x );
float h0y = h0( fuv.y );
float h1y = h1( fuv.y );
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
}
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
vec2 fLodSizeInv = 1.0 / fLodSize;
vec2 cLodSizeInv = 1.0 / cLodSize;
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
return mix( fSample, cSample, fract( lod ) );
}
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
vec3 modelScale;
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
return normalize( refractionVector ) * thickness * modelScale;
}
float applyIorToRoughness( const in float roughness, const in float ior ) {
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
}
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
}
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
if ( isinf( attenuationDistance ) ) {
return vec3( 1.0 );
} else {
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
}
}
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
const in vec3 attenuationColor, const in float attenuationDistance ) {
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
2024-11-05 00:44:58 +00:00
#endif`,kTt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2024-11-04 00:22:50 +00:00
varying vec2 vUv;
#endif
#ifdef USE_MAP
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
2024-11-05 00:44:58 +00:00
#endif`,ITt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2024-11-04 00:22:50 +00:00
varying vec2 vUv;
#endif
#ifdef USE_MAP
uniform mat3 mapTransform;
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
uniform mat3 alphaMapTransform;
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
uniform mat3 lightMapTransform;
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
uniform mat3 aoMapTransform;
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
uniform mat3 bumpMapTransform;
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
uniform mat3 normalMapTransform;
varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
uniform mat3 displacementMapTransform;
varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
uniform mat3 emissiveMapTransform;
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
uniform mat3 metalnessMapTransform;
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
uniform mat3 roughnessMapTransform;
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
uniform mat3 anisotropyMapTransform;
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
uniform mat3 clearcoatMapTransform;
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform mat3 clearcoatNormalMapTransform;
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform mat3 clearcoatRoughnessMapTransform;
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
uniform mat3 sheenColorMapTransform;
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform mat3 sheenRoughnessMapTransform;
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
uniform mat3 iridescenceMapTransform;
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform mat3 iridescenceThicknessMapTransform;
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
uniform mat3 specularMapTransform;
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
uniform mat3 specularColorMapTransform;
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform mat3 specularIntensityMapTransform;
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
2024-11-05 00:44:58 +00:00
#endif`,OTt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2024-11-04 00:22:50 +00:00
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2024-11-05 00:44:58 +00:00
#endif`,DTt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2024-11-04 00:22:50 +00:00
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
#endif
#ifdef USE_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
2024-11-05 00:44:58 +00:00
#endif`;const LTt=`varying vec2 vUv;
2024-11-04 00:22:50 +00:00
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
2024-11-05 00:44:58 +00:00
}`,PTt=`uniform sampler2D t2D;
2024-11-04 00:22:50 +00:00
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
#ifdef DECODE_VIDEO_TEXTURE
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
2024-11-05 00:44:58 +00:00
}`,FTt=`varying vec3 vWorldDirection;
2024-11-04 00:22:50 +00:00
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
2024-11-05 00:44:58 +00:00
}`,UTt=`#ifdef ENVMAP_TYPE_CUBE
2024-11-04 00:22:50 +00:00
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
#ifdef ENVMAP_TYPE_CUBE
vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
#else
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
2024-11-05 00:44:58 +00:00
}`,BTt=`varying vec3 vWorldDirection;
2024-11-04 00:22:50 +00:00
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
2024-11-05 00:44:58 +00:00
}`,GTt=`uniform samplerCube tCube;
2024-11-04 00:22:50 +00:00
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
gl_FragColor = texColor;
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
2024-11-05 00:44:58 +00:00
}`,zTt=`#include <common>
2024-11-04 00:22:50 +00:00
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
2024-11-05 00:44:58 +00:00
}`,VTt=`#if DEPTH_PACKING == 3200
2024-11-04 00:22:50 +00:00
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <logdepthbuf_fragment>
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
#if DEPTH_PACKING == 3200
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
#elif DEPTH_PACKING == 3201
gl_FragColor = packDepthToRGBA( fragCoordZ );
#endif
2024-11-05 00:44:58 +00:00
}`,HTt=`#define DISTANCE
2024-11-04 00:22:50 +00:00
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
2024-11-05 00:44:58 +00:00
}`,qTt=`#define DISTANCE
2024-11-04 00:22:50 +00:00
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
2024-11-05 00:44:58 +00:00
}`,YTt=`varying vec3 vWorldDirection;
2024-11-04 00:22:50 +00:00
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
2024-11-05 00:44:58 +00:00
}`,$Tt=`uniform sampler2D tEquirect;
2024-11-04 00:22:50 +00:00
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
2024-11-05 00:44:58 +00:00
}`,WTt=`uniform float scale;
2024-11-04 00:22:50 +00:00
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
vLineDistance = scale * lineDistance;
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
2024-11-05 00:44:58 +00:00
}`,KTt=`uniform vec3 diffuse;
2024-11-04 00:22:50 +00:00
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
2024-11-05 00:44:58 +00:00
}`,jTt=`#include <common>
2024-11-04 00:22:50 +00:00
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
2024-11-05 00:44:58 +00:00
}`,QTt=`uniform vec3 diffuse;
2024-11-04 00:22:50 +00:00
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
#else
reflectedLight.indirectDiffuse += vec3( 1.0 );
#endif
#include <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-11-05 00:44:58 +00:00
}`,XTt=`#define LAMBERT
2024-11-04 00:22:50 +00:00
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
2024-11-05 00:44:58 +00:00
}`,ZTt=`#define LAMBERT
2024-11-04 00:22:50 +00:00
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_lambert_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-11-05 00:44:58 +00:00
}`,JTt=`#define MATCAP
2024-11-04 00:22:50 +00:00
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
2024-11-05 00:44:58 +00:00
}`,ewt=`#define MATCAP
2024-11-04 00:22:50 +00:00
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
#ifdef USE_MATCAP
vec4 matcapColor = texture2D( matcap, uv );
#else
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
#endif
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-11-05 00:44:58 +00:00
}`,twt=`#define NORMAL
2024-11-04 00:22:50 +00:00
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
2024-11-05 00:44:58 +00:00
}`,nwt=`#define NORMAL
2024-11-04 00:22:50 +00:00
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
2024-11-05 00:44:58 +00:00
}`,rwt=`#define PHONG
2024-11-04 00:22:50 +00:00
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
2024-11-05 00:44:58 +00:00
}`,iwt=`#define PHONG
2024-11-04 00:22:50 +00:00
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-11-05 00:44:58 +00:00
}`,swt=`#define STANDARD
2024-11-04 00:22:50 +00:00
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
2024-11-05 00:44:58 +00:00
}`,owt=`#define STANDARD
2024-11-04 00:22:50 +00:00
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
uniform float ior;
#endif
#ifdef USE_SPECULAR
uniform float specularIntensity;
uniform vec3 specularColor;
#ifdef USE_SPECULAR_COLORMAP
uniform sampler2D specularColorMap;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform sampler2D specularIntensityMap;
#endif
#endif
#ifdef USE_CLEARCOAT
uniform float clearcoat;
uniform float clearcoatRoughness;
#endif
#ifdef USE_IRIDESCENCE
uniform float iridescence;
uniform float iridescenceIOR;
uniform float iridescenceThicknessMinimum;
uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
uniform vec3 sheenColor;
uniform float sheenRoughness;
#ifdef USE_SHEEN_COLORMAP
uniform sampler2D sheenColorMap;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform sampler2D sheenRoughnessMap;
#endif
#endif
#ifdef USE_ANISOTROPY
uniform vec2 anisotropyVector;
#ifdef USE_ANISOTROPYMAP
uniform sampler2D anisotropyMap;
#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
#include <transmission_fragment>
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
#ifdef USE_SHEEN
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
#endif
#ifdef USE_CLEARCOAT
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
#endif
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-11-05 00:44:58 +00:00
}`,awt=`#define TOON
2024-11-04 00:22:50 +00:00
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
2024-11-05 00:44:58 +00:00
}`,lwt=`#define TOON
2024-11-04 00:22:50 +00:00
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-11-05 00:44:58 +00:00
}`,cwt=`uniform float size;
2024-11-04 00:22:50 +00:00
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
varying vec2 vUv;
uniform mat3 uvTransform;
#endif
void main() {
#ifdef USE_POINTS_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif
#include <color_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
2024-11-05 00:44:58 +00:00
}`,dwt=`uniform vec3 diffuse;
2024-11-04 00:22:50 +00:00
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
2024-11-05 00:44:58 +00:00
}`,uwt=`#include <common>
2024-11-04 00:22:50 +00:00
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
2024-11-05 00:44:58 +00:00
}`,pwt=`uniform vec3 color;
2024-11-04 00:22:50 +00:00
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
#include <logdepthbuf_fragment>
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
2024-11-05 00:44:58 +00:00
}`,hwt=`uniform float rotation;
2024-11-04 00:22:50 +00:00
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
vec4 mvPosition = modelViewMatrix * 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 ) );
#ifndef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
#endif
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
2024-11-05 00:44:58 +00:00
}`,mwt=`uniform vec3 diffuse;
2024-11-04 00:22:50 +00:00
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,Gt={alphahash_fragment:P2t,alphahash_pars_fragment:F2t,alphamap_fragment:U2t,alphamap_pars_fragment:B2t,alphatest_fragment:G2t,alphatest_pars_fragment:z2t,aomap_fragment:V2t,aomap_pars_fragment:H2t,batching_pars_vertex:q2t,batching_vertex:Y2t,begin_vertex:$2t,beginnormal_vertex:W2t,bsdfs:K2t,iridescence_fragment:j2t,bumpmap_pars_fragment:Q2t,clipping_planes_fragment:X2t,clipping_planes_pars_fragment:Z2t,clipping_planes_pars_vertex:J2t,clipping_planes_vertex:ext,color_fragment:txt,color_pars_fragment:nxt,color_pars_vertex:rxt,color_vertex:ixt,common:sxt,cube_uv_reflection_fragment:oxt,defaultnormal_vertex:axt,displacementmap_pars_vertex:lxt,displacementmap_vertex:cxt,emissivemap_fragment:dxt,emissivemap_pars_fragment:uxt,colorspace_fragment:pxt,colorspace_pars_fragment:hxt,envmap_fragment:mxt,envmap_common_pars_fragment:fxt,envmap_pars_fragment:gxt,envmap_pars_vertex:_xt,envmap_physical_pars_fragment:Mxt,envmap_vertex:bxt,fog_vertex:vxt,fog_pars_vertex:yxt,fog_fragment:Ext,fog_pars_fragment:Sxt,gradientmap_pars_fragment:xxt,lightmap_fragment:Txt,lightmap_pars_fragment:wxt,lights_lambert_fragment:Cxt,lights_lambert_pars_fragment:Axt,lights_pars_begin:Rxt,lights_toon_fragment:Nxt,lights_toon_pars_fragment:kxt,lights_phong_fragment:Ixt,lights_phong_pars_fragment:Oxt,lights_physical_fragment:Dxt,lights_physical_pars_fragment:Lxt,lights_fragment_begin:Pxt,lights_fragment_maps:Fxt,lights_fragment_end:Uxt,logdepthbuf_fragment:Bxt,logdepthbuf_pars_fragment:Gxt,logdepthbuf_pars_vertex:zxt,logdepthbuf_vertex:Vxt,map_fragment:Hxt,map_pars_fragment:qxt,map_particle_fragment:Yxt,map_particle_pars_fragment:$xt,metalnessmap_fragment:Wxt,metalnessmap_pars_fragment:Kxt,morphcolor_vertex:jxt,morphnormal_vertex:Qxt,morphtarget_pars_vertex:Xxt,morphtarget_vertex:Zxt,normal_fragment_begin:Jxt,normal_fragment_maps:eTt,normal_pars_fragment:tTt,normal_pars_vertex:nTt,normal_vertex:rTt,normalmap_pars_fragment:iTt,clearcoat_normal_fragment_begin:sTt,clearcoat_normal_fragment_maps:oTt,clearcoat_pars_fragment:aTt,iridescence_pars_fragment:lTt,opaque_fragment:cTt,packing:dTt,premultiplied_alpha_fragment:uTt,project_vertex:pTt,dithering_fragment:hTt,dithering_pars_fragment:mTt,roughnessmap_fragment:fTt,roughnessmap_pars_fragment:gTt,shadowmap_pars_fragment:_Tt,shadowmap_pars_vertex:bTt,shadowmap_vertex:vTt,shadowmask_pars_fragment:yTt,skinbase_vertex:ETt,skinning_pars_vertex:STt,skinning_vertex:xTt,skinnormal_vertex:TTt,specularmap_fragment:wTt,specularmap_pars_fragment:CTt,tonemapping_fragment:ATt,tonemapping_pars_fragment:RTt,transmission_fragment:MTt,transmission_pars_fragment:NTt,uv_pars_fragment:kTt,uv_pars_vertex:ITt,uv_vertex:OTt,worldpos_vertex:DTt,background_vert:LTt,background_frag:PTt,backgroundCube_vert:FTt,backgroundCube_frag:UTt,cube_vert:BTt,cube_frag:GTt,depth_vert:zTt,depth_frag:VTt,distanceRGBA_vert:HTt,distanceRGBA_frag:qTt,equirect_vert:YTt,equirect_frag:$Tt,linedashed_vert:WTt,linedashed_frag:KTt,meshbasic_vert:jTt,meshbasic_frag:QTt,meshlambert_vert:XTt,meshlambert_frag:ZTt,meshmatcap_vert:JTt,meshmatcap_frag:ewt,meshnormal_vert:twt,meshnormal_frag:nwt,meshphong_vert:rwt,meshphong_frag:iwt,meshphysical_vert:swt,meshphysical_frag:owt,meshtoon_vert:awt,meshtoon_frag:lwt,points_vert:cwt,points_frag:dwt,shadow_vert:uwt,shadow_frag:pwt,sprite_vert:hwt,sprite_frag:mwt},it={common:{diffuse:{value:new Nt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Vt},alphaMap:{value:null},alphaMapTransform:{value:new Vt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Vt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Vt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Vt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Vt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Vt},normalScale:{value:new $t(1,1)}},displacementmap:{displacementMap:{value:
2024-11-04 00:22:50 +00:00
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform int samples;
uniform float weights[ n ];
uniform bool latitudinal;
uniform float dTheta;
uniform float mipInt;
uniform vec3 poleAxis;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
vec3 getSample( float theta, vec3 axis ) {
float cosTheta = cos( theta );
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross( axis, vOutputDirection ) * sin( theta )
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
return bilinearCubeUV( envMap, sampleDirection, mipInt );
}
void main() {
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
}
axis = normalize( axis );
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
for ( int i = 1; i < n; i++ ) {
if ( i >= samples ) {
break;
}
float theta = dTheta * float( i );
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
}
}
2024-11-06 23:05:30 +00:00
`,blending:So,depthTest:!1,depthWrite:!1})}function CR(){return new wa({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Jy(),fragmentShader:`
2024-11-04 00:22:50 +00:00
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
#include <common>
void main() {
vec3 outputDirection = normalize( vOutputDirection );
vec2 uv = equirectUv( outputDirection );
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
2024-11-06 23:05:30 +00:00
`,blending:So,depthTest:!1,depthWrite:!1})}function AR(){return new wa({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Jy(),fragmentShader:`
2024-11-04 00:22:50 +00:00
precision mediump float;
precision mediump int;
uniform float flipEnvMap;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
2024-11-06 23:05:30 +00:00
`,blending:So,depthTest:!1,depthWrite:!1})}function Jy(){return`
2024-11-04 00:22:50 +00:00
precision mediump float;
precision mediump int;
attribute float faceIndex;
varying vec3 vOutputDirection;
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection( vec2 uv, float face ) {
uv = 2.0 * uv - 1.0;
vec3 direction = vec3( uv, 1.0 );
if ( face == 0.0 ) {
direction = direction.zyx; // ( 1, v, u ) pos x
} else if ( face == 1.0 ) {
direction = direction.xzy;
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
} else if ( face == 2.0 ) {
direction.x *= -1.0; // ( -u, v, 1 ) pos z
} else if ( face == 3.0 ) {
direction = direction.zyx;
direction.xz *= -1.0; // ( -1, v, -u ) neg x
} else if ( face == 4.0 ) {
direction = direction.xzy;
direction.xy *= -1.0; // ( -u, -1, v ) neg y
} else if ( face == 5.0 ) {
direction.z *= -1.0; // ( u, v, -1 ) neg z
}
return direction;
}
void main() {
vOutputDirection = getDirection( uv, faceIndex );
gl_Position = vec4( position, 1.0 );
}
`}function xwt(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,d=l===N1||l===k1,u=l===Ol||l===Dl;if(d||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let m=e.get(a);return t===null&&(t=new TR(n)),m=d?t.fromEquirectangular(a,m):t.fromCubemap(a,m),e.set(a,m),m.texture}else{if(e.has(a))return e.get(a).texture;{const m=a.image;if(d&&m&&m.height>0||u&&m&&i(m)){t===null&&(t=new TR(n));const f=d?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function i(a){let l=0;const d=6;for(let u=0;u<d;u++)a[u]!==void 0&&l++;return l===d}function s(a){const l=a.target;l.removeEventListener("dispose",s);const d=e.get(l);d!==void 0&&(e.delete(l),d.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:r,dispose:o}}function Twt(n){const e={};function t(r){if(e[r]!==void 0)return e[r];let i;switch(r){case"WEBGL_depth_texture":i=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=n.getExtension(r)}return e[r]=i,i}return{has:function(r){return t(r)!==null},init:function(r){r.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(r){const i=t(r);return i===null&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),i}}}function wwt(n,e,t,r){const i={},s=new WeakMap;function o(m){const f=m.target;f.index!==null&&e.remove(f.index);for(const h in f.attributes)e.remove(f.attributes[h]);for(const h in f.morphAttributes){const v=f.morphAttributes[h];for(let b=0,_=v.length;b<_;b++)e.remove(v[b])}f.removeEventListener("dispose",o),delete i[f.id];const g=s.get(f);g&&(e.remove(g),s.delete(f)),r.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(m,f){return i[f.id]===!0||(f.addEventListener("dispose",o),i[f.id]=!0,t.memory.geometries++),f}function l(m){const f=m.attributes;for(const h in f)e.update(f[h],n.ARRAY_BUFFER);const g=m.morphAttributes;for(const h in g){const v=g[h];for(let b=0,_=v.length;b<_;b++)e.update(v[b],n.ARRAY_BUFFER)}}function d(m){const f=[],g=m.index,h=m.attributes.position;let v=0;if(g!==null){const y=g.array;v=g.version;for(let E=0,x=y.length;E<x;E+=3){const A=y[E+0],w=y[E+1],N=y[E+2];f.push(A,w,w,N,N,A)}}else if(h!==void 0){const y=h.array;v=h.version;for(let E=0,x=y.length/3-1;E<x;E+=3){const A=E+0,w=E+1,N=E+2;f.push(A,w,w,N,N,A)}}else return;const b=new(eO(f)?aO:oO)(f,1);b.version=v;const _=s.get(m);_&&e.remove(_),s.set(m,b)}function u(m){const f=s.get(m);if(f){const g=m.index;g!==null&&f.version<g.version&&d(m)}else d(m);return s.get(m)}return{get:a,update:l,getWireframeAttribute:u}}function Cwt(n,e,t,r){const i=r.isWebGL2;let s;function o(g){s=g}let a,l;function d(g){a=g.type,l=g.bytesPerElement}function u(g,h){n.drawElements(s,h,a,g*l),t.update(h,s,1)}function m(g,h,v){if(v===0)return;let b,_;if(i)b=n,_="drawElementsInstanced";else if(b=e.get("ANGLE_instanced_arrays"),_="drawElementsInstancedANGLE",b===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support ex
2024-11-04 00:22:50 +00:00
`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=i;o<s;o++){const a=o+1;r.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return r.join(`
2024-11-06 23:05:30 +00:00
`)}function wCt(n){const e=tn.getPrimaries(tn.workingColorSpace),t=tn.getPrimaries(n);let r;switch(e===t?r="":e===sh&&t===ih?r="LinearDisplayP3ToLinearSRGB":e===ih&&t===sh&&(r="LinearSRGBToLinearDisplayP3"),n){case er:case om:return[r,"LinearTransferOETF"];case Mn:case Ky:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[r,"LinearTransferOETF"]}}function LR(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),i=n.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`
2024-11-04 00:22:50 +00:00
`+i+`
2024-11-05 00:44:58 +00:00
`+TCt(n.getShaderSource(e),o)}else return i}function CCt(n,e){const t=wCt(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function ACt(n,e){let t;switch(e){case xSt:t="Linear";break;case TSt:t="Reinhard";break;case wSt:t="OptimizedCineon";break;case CSt:t="ACESFilmic";break;case ASt:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function RCt(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Dc).join(`
`)}function MCt(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(`
2024-11-06 23:05:30 +00:00
`)}function NCt(n,e){const t={},r=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=n.getActiveAttrib(e,i),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function Dc(n){return n!==""}function PR(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function FR(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const kCt=/^[ \t]*#include +<([\w\d./]+)>/gm;function F1(n){return n.replace(kCt,OCt)}const ICt=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function OCt(n,e){let t=Gt[e];if(t===void 0){const r=ICt.get(e);if(r!==void 0)t=Gt[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return F1(t)}const DCt=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function UR(n){return n.replace(DCt,LCt)}function LCt(n,e,t,r){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function BR(n){let e="precision "+n.precision+` float;
2024-11-04 00:22:50 +00:00
precision `+n.precision+" int;";return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function PCt(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===zI?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===XEt?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===vs&&(e="SHADOWMAP_TYPE_VSM"),e}function FCt(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Ol:case Dl:e="ENVMAP_TYPE_CUBE";break;case sm:e="ENVMAP_TYPE_CUBE_UV";break}return e}function UCt(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Dl:e="ENVMAP_MODE_REFRACTION";break}return e}function BCt(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Yy:e="ENVMAP_BLENDING_MULTIPLY";break;case ESt:e="ENVMAP_BLENDING_MIX";break;case SSt:e="ENVMAP_BLENDING_ADD";break}return e}function GCt(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:r,maxMip:t}}function zCt(n,e,t,r){const i=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=PCt(t),d=FCt(t),u=UCt(t),m=BCt(t),f=GCt(t),g=t.isWebGL2?"":RCt(t),h=MCt(s),v=i.createProgram();let b,_,y=t.glslVersion?"#version "+t.glslVersion+`
2024-11-04 00:22:50 +00:00
`:"";t.isRawShaderMaterial?(b=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h].filter(Dc).join(`
`),b.length>0&&(b+=`
`),_=[g,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h].filter(Dc).join(`
`),_.length>0&&(_+=`
2024-11-06 23:05:30 +00:00
`)):(b=[BR(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h,t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?
2024-11-04 00:22:50 +00:00
`].filter(Dc).join(`
2024-11-06 23:05:30 +00:00
`),_=[g,BR(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.envMap?"#define "+u:"",t.envMap?"#define "+m:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==xo?"#define TONE_MAPPING":"",t.toneMapping!==xo?Gt.tonemapping_pars_fragment:"",t.toneMapping!==xo?ACt("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Gt.colorspace_pars_fragment,CCt("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
2024-11-04 00:22:50 +00:00
`].filter(Dc).join(`
2024-11-06 23:05:30 +00:00
`)),o=F1(o),o=PR(o,t),o=FR(o,t),a=F1(a),a=PR(a,t),a=FR(a,t),o=UR(o),a=UR(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es
2024-11-04 00:22:50 +00:00
`,b=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
2024-11-06 23:05:30 +00:00
`+b,_=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===rR?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===rR?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
2024-11-04 00:22:50 +00:00
`)+`
2024-11-06 23:05:30 +00:00
`+_);const E=y+b+o,x=y+_+a,A=DR(i,i.VERTEX_SHADER,E),w=DR(i,i.FRAGMENT_SHADER,x);i.attachShader(v,A),i.attachShader(v,w),t.index0AttributeName!==void 0?i.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(v,0,"position"),i.linkProgram(v);function N(H){if(n.debug.checkShaderErrors){const q=i.getProgramInfoLog(v).trim(),ie=i.getShaderInfoLog(A).trim(),D=i.getShaderInfoLog(w).trim();let $=!0,K=!0;if(i.getProgramParameter(v,i.LINK_STATUS)===!1)if($=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,v,A,w);else{const B=LR(i,A,"vertex"),Z=LR(i,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(v,i.VALIDATE_STATUS)+`
2024-11-04 00:22:50 +00:00
Program Info Log: `+q+`
`+B+`
2024-11-06 23:05:30 +00:00
`+Z)}else q!==""?console.warn("THREE.WebGLProgram: Program Info Log:",q):(ie===""||D==="")&&(K=!1);K&&(H.diagnostics={runnable:$,programLog:q,vertexShader:{log:ie,prefix:b},fragmentShader:{log:D,prefix:_}})}i.deleteShader(A),i.deleteShader(w),L=new fp(i,v),C=NCt(i,v)}let L;this.getUniforms=function(){return L===void 0&&N(this),L};let C;this.getAttributes=function(){return C===void 0&&N(this),C};let k=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(v,SCt)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=xCt++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=A,this.fragmentShader=w,this}let VCt=0;class HCt{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new qCt(e),t.set(e,r)),r}}class qCt{constructor(e){this.id=VCt++,this.code=e,this.usedTimes=0}}function YCt(n,e,t,r,i,s,o){const a=new iO,l=new HCt,d=[],u=i.isWebGL2,m=i.logarithmicDepthBuffer,f=i.vertexTextures;let g=i.precision;const h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(C){return C===0?"uv":`uv${C}`}function b(C,k,H,q,ie){const D=q.fog,$=ie.geometry,K=C.isMeshStandardMaterial?q.environment:null,B=(C.isMeshStandardMaterial?t:e).get(C.envMap||K),Z=B&&B.mapping===sm?B.image.height:null,ce=h[C.type];C.precision!==null&&(g=i.getMaxPrecision(C.precision),g!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",g,"instead."));const ue=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,xe=ue!==void 0?ue.length:0;let Ce=0;$.morphAttributes.position!==void 0&&(Ce=1),$.morphAttributes.normal!==void 0&&(Ce=2),$.morphAttributes.color!==void 0&&(Ce=3);let me,Ae,Fe,ze;if(ce){const tr=zi[ce];me=tr.vertexShader,Ae=tr.fragmentShader}else me=C.vertexShader,Ae=C.fragmentShader,l.update(C),Fe=l.getVertexShaderID(C),ze=l.getFragmentShaderID(C);const te=n.getRenderTarget(),ye=ie.isInstancedMesh===!0,Se=ie.isBatchedMesh===!0,Oe=!!C.map,Ye=!!C.matcap,le=!!B,V=!!C.aoMap,G=!!C.lightMap,oe=!!C.bumpMap,ge=!!C.normalMap,Ee=!!C.displacementMap,Te=!!C.emissiveMap,fe=!!C.metalnessMap,Ue=!!C.roughnessMap,Pe=C.anisotropy>0,Re=C.clearcoat>0,U=C.iridescence>0,I=C.sheen>0,ee=C.transmission>0,we=Pe&&!!C.anisotropyMap,ne=Re&&!!C.clearcoatMap,pe=Re&&!!C.clearcoatNormalMap,De=Re&&!!C.clearcoatRoughnessMap,Le=U&&!!C.iridescenceMap,Ve=U&&!!C.iridescenceThicknessMap,ot=I&&!!C.sheenColorMap,wt=I&&!!C.sheenRoughnessMap,$e=!!C.specularMap,Kt=!!C.specularColorMap,ft=!!C.specularIntensityMap,gt=ee&&!!C.transmissionMap,et=ee&&!!C.thicknessMap,lt=!!C.gradientMap,It=!!C.alphaMap,ae=C.alphaTest>0,dt=!!C.alphaHash,Xe=!!C.extensions,Be=!!$.attributes.uv1,nt=!!$.attributes.uv2,At=!!$.attributes.uv3;let jt=xo;return C.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(jt=n.toneMapping),{
2024-11-04 00:22:50 +00:00
gl_Position = vec4( position, 1.0 );
2024-11-05 00:44:58 +00:00
}`,iAt=`uniform sampler2D shadow_pass;
2024-11-04 00:22:50 +00:00
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
const float samples = float( VSM_SAMPLES );
float mean = 0.0;
float squared_mean = 0.0;
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
for ( float i = 0.0; i < samples; i ++ ) {
float uvOffset = uvStart + i * uvStride;
#ifdef HORIZONTAL_PASS
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
mean += distribution.x;
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
#else
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
mean += depth;
squared_mean += depth * depth;
#endif
}
mean = mean / samples;
squared_mean = squared_mean / samples;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function sAt(n,e,t){let r=new Qy;const i=new $t,s=new $t,o=new mn,a=new tAt({depthPacking:GSt}),l=new nAt,d={},u=t.maxTextureSize,m={[Fs]:kr,[kr]:Fs,[Vi]:Vi},f=new wa({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new $t},radius:{value:4}},vertexShader:rAt,fragmentShader:iAt}),g=f.clone();g.defines.HORIZONTAL_PASS=1;const h=new as;h.setAttribute("position",new vr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new br(h,f),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zI;let _=this.type;this.render=function(A,w,N){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||A.length===0)return;const L=n.getRenderTarget(),C=n.getActiveCubeFace(),k=n.getActiveMipmapLevel(),H=n.state;H.setBlending(So),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);const q=_!==vs&&this.type===vs,ie=_===vs&&this.type!==vs;for(let D=0,$=A.length;D<$;D++){const K=A[D],B=K.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",K,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;i.copy(B.mapSize);const Z=B.getFrameExtents();if(i.multiply(Z),s.copy(B.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/Z.x),i.x=s.x*Z.x,B.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/Z.y),i.y=s.y*Z.y,B.mapSize.y=s.y)),B.map===null||q===!0||ie===!0){const ue=this.type!==vs?{minFilter:$n,magFilter:$n}:{};B.map!==null&&B.map.dispose(),B.map=new Ta(i.x,i.y,ue),B.map.texture.name=K.name+".shadowMap",B.camera.updateProjectionMatrix()}n.setRenderTarget(B.map),n.clear();const ce=B.getViewportCount();for(let ue=0;ue<ce;ue++){const xe=B.getViewport(ue);o.set(s.x*xe.x,s.y*xe.y,s.x*xe.z,s.y*xe.w),H.viewport(o),B.updateMatrices(K,ue),r=B.getFrustum(),x(w,N,B.camera,K,this.type)}B.isPointLightShadow!==!0&&this.type===vs&&y(B,N),B.needsUpdate=!1}_=this.type,b.needsUpdate=!1,n.setRenderTarget(L,C,k)};function y(A,w){const N=e.update(v);f.defines.VSM_SAMPLES!==A.blurSamples&&(f.defines.VSM_SAMPLES=A.blurSamples,g.defines.VSM_SAMPLES=A.blurSamples,f.needsUpdate=!0,g.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new Ta(i.x,i.y)),f.uniforms.shadow_pass.value=A.map.texture,f.uniforms.resolution.value=A.mapSize,f.uniforms.radius.value=A.radius,n.setRenderTarget(A.mapPass),n.clear(),n.renderBufferDirect(w,null,N,f,v,null),g.uniforms.shadow_pass.value=A.mapPass.texture,g.uniforms.resolution.value=A.mapSize,g.uniforms.radius.value=A.radius,n.setRenderTarget(A.map),n.clear(),n.renderBufferDirect(w,null,N,g,v,null)}function E(A,w,N,L){let C=null;const k=N.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(k!==void 0)C=k;else if(C=N.isPointLight===!0?l:a,n.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const H=C.uuid,q=w.uuid;let ie=d[H];ie===void 0&&(ie={},d[H]=ie);let D=ie[q];D===void 0&&(D=C.clone(),ie[q]=D),C=D}if(C.visible=w.visible,C.wireframe=w.wireframe,L===vs?C.side=w.shadowSide!==null?w.shadowSide:w.side:C.side=w.shadowSide!==null?w.shadowSide:m[w.side],C.alphaMap=w.alphaMap,C.alphaTest=w.alphaTest,C.map=w.map,C.clipShadows=w.clipShadows,C.clippingPlanes=w.clippingPlanes,C.clipIntersection=w.clipIntersection,C.displacementMap=w.displacementMap,C.displacementScale=w.displacementScale,C.displacementBias=w.displacementBias,C.wireframeLinewidth=w.wireframeLinewidth,C.linewidth=w.linewidth,N.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const H=n.properties.get(C);H.light=N}return C}function x(A,w,N,L,C){if(A.visible===!1)return;if(A.layers.test(w.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&C===vs)&&(!A.frustumCulled||r.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,A.matrixWorld);const q=e.update(A),ie=A.material;if(Array.isArray(ie)){const D=q.groups;for(let $=0,K=D.length;$<K;$++){const B=D[$],Z=ie[B.materialIndex];if(Z&&Z.visible){const ce=E(A,Z,L,C);A.onBeforeShadow(n,A,w,N,q,ce,B),n.renderBufferDirect(N,null,q,ce,A,B),A.onAfterShad
2024-11-04 00:22:50 +00:00
Please check that you don't accidentally use the same token twice to register two different handlers for the same event/hook.`),this.unsubscribe(e)),this.listenerMap.set(e,t),this._listeners.push(t)}unsubscribe(e){if(this.listenerMap.has(e)){const t=this.listenerMap.get(e);this.listenerMap.delete(e);const r=this._listeners.indexOf(t);r>=0&&this._listeners.splice(r,1)}}registerProxy(e,t){this.proxyMap.has(e)&&(console.warn(`Already subscribed. Unsubscribing for you.
2024-11-06 23:05:30 +00:00
Please check that you don't accidentally use the same token twice to register two different proxies for the same event/hook.`),this.unregisterProxy(e)),this.proxyMap.set(e,t),this.proxies.push(t)}unregisterProxy(e){if(!this.proxyMap.has(e))return;const t=this.proxyMap.get(e);this.proxyMap.delete(e);const r=this.proxies.indexOf(t);r>=0&&this.proxies.splice(r,1)}}class ln extends fa{constructor(e){super(),this.entity=e}emit(e){this.listeners.forEach(t=>t(e,this.entity))}}class lr extends fa{constructor(e){super(),this.entity=e}emit(e){let t=!1;const r=()=>[t=!0];for(const i of Array.from(this.listeners.values()))if(i(e,r,this.entity),t)return{prevented:!0};return{prevented:!1}}}class MO extends fa{execute(e,t){let r=e;for(const i of this.listeners)r=i(r,t);return r}}class qr extends MO{constructor(e){super(),this.entity=e}execute(e){return super.execute(e,this.entity)}}class oMt extends fa{constructor(e){super(),this.entity=e}execute(e){const t=[];for(const r of this.listeners)t.push(r(e,this.entity));return t}}function Ui(){const n=Symbol(),e=new Map,t=new Set,r=(l,d)=>{d instanceof fa&&d.registerProxy(n,()=>{var u,m;return(m=(u=e.get(l))===null||u===void 0?void 0:u.listeners)!==null&&m!==void 0?m:[]})},i=l=>{const d=new fa;e.set(l,d),t.forEach(u=>r(l,u[l]))},s=l=>{t.add(l);for(const d of e.keys())r(d,l[d])},o=l=>{for(const d of e.keys())l[d]instanceof fa&&l[d].unregisterProxy(n);t.delete(l)},a=()=>{t.forEach(l=>o(l)),e.clear()};return new Proxy({},{get(l,d){return d==="addTarget"?s:d==="removeTarget"?o:d==="destroy"?a:typeof d!="string"||d.startsWith("_")?l[d]:(e.has(d)||i(d),e.get(d))}})}class fM{constructor(e,t){if(this.destructed=!1,this.events={destruct:new ln(this)},!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=ks(),this.from=e,this.to=t,this.from.connectionCount++,this.to.connectionCount++}destruct(){this.events.destruct.emit(),this.from.connectionCount--,this.to.connectionCount--,this.destructed=!0}}class NO{constructor(e,t){if(!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=ks(),this.from=e,this.to=t}}function V1(n,e){return Object.fromEntries(Object.entries(n).map(([t,r])=>[t,e(r)]))}class kO{constructor(){this._title="",this.id=ks(),this.events={loaded:new ln(this),beforeAddInput:new lr(this),addInput:new ln(this),beforeRemoveInput:new lr(this),removeInput:new ln(this),beforeAddOutput:new lr(this),addOutput:new ln(this),beforeRemoveOutput:new lr(this),removeOutput:new ln(this),beforeTitleChanged:new lr(this),titleChanged:new ln(this),update:new ln(this)},this.hooks={beforeLoad:new qr(this),afterSave:new qr(this)}}get graph(){return this.graphInstance}get title(){return this._title}set title(e){this.events.beforeTitleChanged.emit(e).prevented||(this._title=e,this.events.titleChanged.emit(e))}addInput(e,t){return this.addInterface("input",e,t)}addOutput(e,t){return this.addInterface("output",e,t)}removeInput(e){return this.removeInterface("input",e)}removeOutput(e){return this.removeInterface("output",e)}registerGraph(e){this.graphInstance=e}load(e){this.hooks.beforeLoad.execute(e),this.id=e.id,this._title=e.title,Object.entries(e.inputs).forEach(([t,r])=>{this.inputs[t]&&(this.inputs[t].load(r),this.inputs[t].nodeId=this.id)}),Object.entries(e.outputs).forEach(([t,r])=>{this.outputs[t]&&(this.outputs[t].load(r),this.outputs[t].nodeId=this.id)}),this.events.loaded.emit(this)}save(){const e=V1(this.inputs,i=>i.save()),t=V1(this.outputs,i=>i.save()),r={type:this.type,id:this.id,title:this.title,inputs:e,outputs:t};return this.hooks.afterSave.execute(r)}onPlaced(){}onDestroy(){}initializeIo(){Object.entries(this.inputs).forEach(([e,t])=>this.initializeIntf("input",e,t)),Object.entries(this.outputs).forEach(([e,t])=>this.initializeIntf("output",e,t))}initializeIntf(e,t,r){r.isInput=e==="input",r.nodeId=this.id,r.events.setValue.subscribe(this,()=>this.events.update.emit({type:e,name:t,intf:r}))}addInterface(e,t,r){const i=e==="input"?this.events.beforeAddInput:this.events.beforeAddOutput,s=e===
2024-11-04 00:22:50 +00:00
This is likely a Baklava internal issue. Please report it on GitHub.`);const g=this.hooks.transferData.execute(d[f],u);u.to.allowMultipleConnections?t.has(u.to.id)?t.get(u.to.id).push(g):t.set(u.to.id,[g]):t.set(u.to.id,g)})}return o}async execute(e){this.recalculateOrder&&(this.order.clear(),this.recalculateOrder=!1);const t=this.getInputValues(this.editor.graph);return await this.runGraph(this.editor.graph,t,e)}getInputValues(e){const t=new Map;for(const r of e.nodes)Object.values(r.inputs).forEach(i=>{i.connectionCount===0&&t.set(i.id,i.value)}),r.calculate||Object.values(r.outputs).forEach(i=>{t.set(i.id,i.value)});return t}onChange(e){this.recalculateOrder=e||this.recalculateOrder,this.calculateWithoutData()}getInterfaceValue(e,t){if(!e.has(t))throw new Error(`Could not find value for interface ${t}
This is likely a Baklava internal issue. Please report it on GitHub.`);return e.get(t)}}const fMt=["INPUT","TEXTAREA","SELECT"];function PO(n){return fMt.includes(n.tagName)}let H1=null;function gMt(n){H1=n}function $r(){if(!H1)throw new Error("providePlugin() must be called before usePlugin()");return{viewModel:H1}}function _i(){const{viewModel:n}=$r();return{graph:yp(n.value,"displayedGraph"),switchGraph:n.value.switchGraph}}function FO(n){const{graph:e}=_i(),t=yt(null),r=yt(null);return{dragging:mt(()=>!!t.value),onPointerDown:l=>{t.value={x:l.pageX,y:l.pageY},r.value={x:n.value.x,y:n.value.y}},onPointerMove:l=>{if(t.value){const d=l.pageX-t.value.x,u=l.pageY-t.value.y;n.value.x=r.value.x+d/e.value.scaling,n.value.y=r.value.y+u/e.value.scaling}},onPointerUp:()=>{t.value=null,r.value=null}}}function UO(n,e,t){if(!e.template)return!1;if(Yl(e.template)===t)return!0;const r=n.graphTemplates.find(s=>Yl(s)===t);return r?r.nodes.filter(s=>s.type.startsWith(yd)).some(s=>UO(n,e,s.type)):!1}function BO(n){return mt(()=>{const e=Array.from(n.value.editor.nodeTypes.entries()),t=new Set(e.map(([,i])=>i.category)),r=[];for(const i of t.values()){let s=e.filter(([,o])=>o.category===i);n.value.displayedGraph.template?s=s.filter(([o])=>!UO(n.value.editor,n.value.displayedGraph,o)):s=s.filter(([o])=>![Hl,ql].includes(o)),s.length>0&&r.push({name:i,nodeTypes:Object.fromEntries(s)})}return r.sort((i,s)=>i.name==="default"?-1:s.name==="default"||i.name>s.name?1:-1),r})}function GO(){const{graph:n}=_i();return{transform:(t,r)=>{const i=t/n.value.scaling-n.value.panning.x,s=r/n.value.scaling-n.value.panning.y;return[i,s]}}}function _Mt(){const{graph:n}=_i();let e=[],t=-1,r={x:0,y:0};const i=mt(()=>n.value.panning),s=FO(i),o=mt(()=>({"transform-origin":"0 0",transform:`scale(${n.value.scaling}) translate(${n.value.panning.x}px, ${n.value.panning.y}px)`})),a=(g,h,v)=>{const b=[g/n.value.scaling-n.value.panning.x,h/n.value.scaling-n.value.panning.y],_=[g/v-n.value.panning.x,h/v-n.value.panning.y],y=[_[0]-b[0],_[1]-b[1]];n.value.panning.x+=y[0],n.value.panning.y+=y[1],n.value.scaling=v},l=g=>{g.preventDefault();let h=g.deltaY;g.deltaMode===1&&(h*=32);const v=n.value.scaling*(1-h/3e3);a(g.offsetX,g.offsetY,v)},d=()=>({ax:e[0].clientX,ay:e[0].clientY,bx:e[1].clientX,by:e[1].clientY});return{styles:o,...s,onPointerDown:g=>{if(e.push(g),s.onPointerDown(g),e.length===2){const{ax:h,ay:v,bx:b,by:_}=d();r={x:h+(b-h)/2,y:v+(_-v)/2}}},onPointerMove:g=>{for(let h=0;h<e.length;h++)if(g.pointerId==e[h].pointerId){e[h]=g;break}if(e.length==2){const{ax:h,ay:v,bx:b,by:_}=d(),y=h-b,E=v-_,x=Math.sqrt(y*y+E*E);if(t>0){const A=n.value.scaling*(1+(x-t)/500);a(r.x,r.y,A)}t=x}else s.onPointerMove(g)},onPointerUp:g=>{e=e.filter(h=>h.pointerId!==g.pointerId),t=-1,s.onPointerUp()},onMouseWheel:l}}var ni=(n=>(n[n.NONE=0]="NONE",n[n.ALLOWED=1]="ALLOWED",n[n.FORBIDDEN=2]="FORBIDDEN",n))(ni||{});const zO=Symbol();function bMt(){const{graph:n}=_i(),e=yt(null),t=yt(null),r=a=>{e.value&&(e.value.mx=a.offsetX/n.value.scaling-n.value.panning.x,e.value.my=a.offsetY/n.value.scaling-n.value.panning.y)},i=()=>{if(t.value){if(e.value)return;const a=n.value.connections.find(l=>l.to===t.value);t.value.isInput&&a?(e.value={status:ni.NONE,from:a.from},n.value.removeConnection(a)):e.value={status:ni.NONE,from:t.value},e.value.mx=void 0,e.value.my=void 0}},s=()=>{if(e.value&&t.value){if(e.value.from===t.value)return;n.value.addConnection(e.value.from,e.value.to)}e.value=null},o=a=>{if(t.value=a??null,a&&e.value){e.value.to=a;const l=n.value.checkConnection(e.value.from,e.value.to);if(e.value.status=l.connectionAllowed?ni.ALLOWED:ni.FORBIDDEN,l.connectionAllowed){const d=l.connectionsInDanger.map(u=>u.id);n.value.connections.forEach(u=>{d.includes(u.id)&&(u.isInDanger=!0)})}}else!a&&e.value&&(e.value.to=void 0,e.value.status=ni.NONE,n.value.connections.forEach(l=>{l.isInDanger=!1}))};return ml(zO,{temporaryConnection:e,hoveredOver:o}),{temporaryConnection:e,onMouseMove:r,onMouseDown:i,onMouseUp:s,hoveredOver:o}}function vMt(n){const e=yt(!1),t=yt(0),r=yt(0),i=BO(n),{transform:s}=GO(),o=mt(
This may take some time the first time as some libraries need to be installed.`),de.post("/apps/start_server",e).then(t=>{this.$store.state.messageBox.hideMessage(),console.log("Server start initiated:",t.data.message),this.$notify({type:"success",title:"Server Starting",text:t.data.message})}).catch(t=>{var r,i;this.$store.state.messageBox.hideMessage(),console.error("Error starting server:",t),this.$notify({type:"error",title:"Server Start Failed",text:((i=(r=t.response)==null?void 0:r.data)==null?void 0:i.detail)||"An error occurred while starting the server"})})},triggerFileInput(){this.$refs.fileInput.click()},onFileSelected(n){this.selectedFile=n.target.files[0],this.message="",this.error="",this.uploadApp()},async uploadApp(){var e,t;if(!this.selectedFile){this.error="Please select a file to upload.";return}this.isUploading=!0,this.message="",this.error="";const n=new FormData;n.append("file",this.selectedFile),n.append("client_id",this.$store.state.client_id);try{const r=await de.post("/upload_app",n,{headers:{"Content-Type":"multipart/form-data"}});this.message=r.data.message,this.$refs.fileInput.value="",this.selectedFile=null}catch(r){console.error("Error uploading app:",r),this.error=((t=(e=r.response)==null?void 0:e.data)==null?void 0:t.detail)||"Failed to upload the app. Please try again."}finally{this.isUploading=!1}},async fetchApps(){this.loading=!0;try{const n=await de.get("/apps");this.apps=n.data,this.showMessage("Refresh successful!",!0)}catch{this.showMessage("Failed to refresh apps.",!1)}finally{this.loading=!1}},async openAppsFolder(){this.loading=!0;try{console.log("opening apps folder");const n=await de.post("/show_apps_folder",{client_id:this.$store.state.client_id})}catch{this.showMessage("Failed to open apps folder.",!1)}finally{this.loading=!1}},async fetchGithubApps(){this.loading=!0;try{const n=await de.get("/github/apps");this.githubApps=n.data.apps,await this.fetchApps()}catch{this.showMessage("Failed to refresh GitHub apps.",!1)}finally{this.loading=!1}},async handleAppClick(n){if(n.installed){this.selectedApp=n;const e=await de.get(`/apps/${n.folder_name}/README.md`);this.appCode=nn(e.data)}else this.showMessage(`Please install ${n.folder_name} to view its code.`,!1)},backToZoo(){this.selectedApp=null,this.appCode=""},async installApp(n){this.loading=!0,this.$store.state.messageBox.showBlockingMessage(`Installing app ${n}`);try{await de.post(`/install/${n}`,{client_id:this.$store.state.client_id}),this.showMessage("Installation succeeded!",!0)}catch{this.showMessage("Installation failed.",!1)}finally{this.loading=!1,this.fetchApps(),this.fetchGithubApps(),this.$store.state.messageBox.hideMessage()}},async uninstallApp(n){this.loading=!0;try{await de.post(`/uninstall/${n}`,{client_id:this.$store.state.client_id}),this.showMessage("Uninstallation succeeded!",!0)}catch{this.showMessage("Uninstallation failed.",!1)}finally{this.loading=!1,this.fetchApps()}},async deleteApp(n){this.loading=!0;try{await de.post(`/delete/${n}`,{client_id:this.$store.state.client_id}),this.showMessage("Deletion succeeded!",!0)}catch{this.showMessage("Deletion failed.",!1)}finally{this.loading=!1,this.fetchApps()}},async editApp(n){this.loading=!0;try{const e=await de.post("/open_app_in_vscode",{client_id:this.$store.state.client_id,app_name:n.folder_name});this.showMessage(e.data.message,!0)}catch{this.showMessage("Failed to open folder in VSCode.",!1)}finally{this.loading=!1}},async downloadApp(n){this.isLoading=!0,this.error=null;try{const e=await de.post("/download_app",{client_id:this.$store.state.client_id,app_name:n},{responseType:"arraybuffer"}),t=e.headers["content-disposition"],r=t&&t.match(/filename="?(.+)"?/i),i=r?r[1]:"app.zip",s=new Blob([e.data],{type:"application/zip"}),o=window.URL.createObjectURL(s),a=document.createElement("a");a.style.display="none",a.href=o,a.download=i,document.body.appendChild(a),a.click(),window.URL.revokeObjectURL(o),document.body.removeChild(a)}catch(e){console.error("Error downloading app:",e),this.error="Failed to download the app. Please try again."}finally{this.is
2024-11-04 00:22:50 +00:00
`+n.name,4,!0):this.$store.state.toast.showToast(`Error on select personality:
`+n.name,4,!1),this.isLoading=!1}else console.log("mounting pers"),this.mountPersonality(n);We(()=>{feather.replace()})}},onModelSelected(n){if(this.isLoading){this.$store.state.toast.showToast("Loading... please wait",4,!1);return}n&&(n.isInstalled?this.update_model(n.model.name).then(e=>{console.log("update_model",e),this.configFile.model_name=n.model.name,e.status?(this.$store.state.toast.showToast(`Selected model:
`+n.name,4,!0),We(()=>{feather.replace(),this.is_loading_zoo=!1}),this.updateModelsZoo(),this.api_get_req("get_model_status").then(t=>{this.$store.commit("setIsModelOk",t)})):(this.$store.state.toast.showToast(`Couldn't select model:
`+n.name,4,!1),We(()=>{feather.replace()})),this.settingsChanged=!0,this.isModelSelected=!0}):this.$store.state.toast.showToast(`Model:
`+n.model.name+`
is not installed`,4,!1),We(()=>{feather.replace()}))},toggleSortOrder(){this.sortOrder=this.sortOrder==="asc"?"desc":"asc"},toggleFavorite(n){console.log("Toggling favorite");const e=this.favorites.indexOf(n);e===-1?this.favorites.push(n):this.favorites.splice(e,1),this.saveFavoritesToLocalStorage()},saveFavoritesToLocalStorage(){localStorage.setItem("appZooFavorites",JSON.stringify(this.favorites))},loadFavoritesFromLocalStorage(){const n=localStorage.getItem("appZooFavorites");console.log("savedFavorites",n),n&&(this.favorites=JSON.parse(n))},startServer(n){const e={client_id:this.$store.state.client_id,app_name:n};this.$store.state.messageBox.showBlockingMessage(`Loading server.
This may take some time the first time as some libraries need to be installed.`),de.post("/personalities/start_server",e).then(t=>{this.$store.state.messageBox.hideMessage(),console.log("Server start initiated:",t.data.message),this.$notify({type:"success",title:"Server Starting",text:t.data.message})}).catch(t=>{var r,i;this.$store.state.messageBox.hideMessage(),console.error("Error starting server:",t),this.$notify({type:"error",title:"Server Start Failed",text:((i=(r=t.response)==null?void 0:r.data)==null?void 0:i.detail)||"An error occurred while starting the server"})})},triggerFileInput(){this.$refs.fileInput.click()},onFileSelected(n){this.selectedFile=n.target.files[0],this.message="",this.error="",this.uploadApp()},async uploadApp(){var e,t;if(!this.selectedFile){this.error="Please select a file to upload.";return}this.isUploading=!0,this.message="",this.error="";const n=new FormData;n.append("file",this.selectedFile),n.append("client_id",this.$store.state.client_id);try{const r=await de.post("/upload_app",n,{headers:{"Content-Type":"multipart/form-data"}});this.message=r.data.message,this.$refs.fileInput.value="",this.selectedFile=null}catch(r){console.error("Error uploading app:",r),this.error=((t=(e=r.response)==null?void 0:e.data)==null?void 0:t.detail)||"Failed to upload the app. Please try again."}finally{this.isUploading=!1}},async mount_personality(n){if(this.$store.state.messageBox.showMessage("Loading personality"),!n)return{status:!1,error:"no personality - mount_personality"};try{const e={client_id:this.$store.state.client_id,language:n.language?n.language:"",category:n.category?n.category:"",folder:n.folder?n.folder:""},t=await de.post("/mount_personality",e,{headers:this.posts_headers});if(t)return t.data}catch(e){console.log(e.message,"mount_personality - settings");return}this.$store.state.messageBox.hideMessage()},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};let e=n.language==null?n.full_path:n.full_path+":"+n.language;console.log("pth",e);const t=this.configFile.personalities.findIndex(i=>i===e),r={client_id:this.$store.state.client_id,id:t};try{const i=await de.post("/select_personality",r,{headers:this.posts_headers});if(i)return this.$store.dispatch("refreshConfig").then(()=>{this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),i.data}catch(i){console.log(i.message,"select_personality - settings");return}},async mountPersonality(n){if(this.isLoading=!0,console.log("mount pers",n),n.personality.disclaimer!=""&&this.$store.state.messageBox.showMessage(n.personality.disclaimer),!n)return;if(this.configFile.personalities.includes(n.personality.full_path)){this.isLoading=!1,this.$store.state.toast.showToast("Personality already mounted",4,!1);return}const e=await this.mount_personality(n.personality);console.log("mount_personality res",e),e&&e.status&&e.active_personality_id>-1&&e.personalities.includes(n.personality.full_path)?(this.configFile.personalities=e.personalities,this.$store.state.toast.showToast("Personality mounted",4,!0),n.isMounted=!0,(await this.select_personality(n.personality)).status&&this.$store.state.toast.showToast(`Selected personality:
`+n.personality.name,4,!0),this.$store.dispatch("refreshMountedPersonalities"),window.location.href.split("/").length>4?window.location.href="/":window.location.reload(!0)):(n.isMounted=!1,this.$store.state.toast.showToast(`Could not mount personality
Error: `+e.error+`
Response:
`+e,4,!1)),this.isLoading=!1},async unmountAll(){await de.post("/unmount_all_personalities",{client_id:this.$store.state.client_id},{headers:this.posts_headers}),this.$store.dispatch("refreshMountedPersonalities"),this.$store.dispatch("refreshConfig"),this.$store.state.toast.showToast("All personas unmounted",4,!0)},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={client_id:this.$store.state.client_id,language:n.language,category:n.category,folder:n.folder};try{const t=await de.post("/unmount_personality",e,{headers:this.posts_headers});if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},async unmountPersonality(n){if(this.isLoading=!0,!n)return;const e=await this.unmount_personality(n.personality||n);if(e.status){this.configFile.personalities=e.personalities,this.$store.state.toast.showToast("Personality unmounted",4,!0);const t=this.$store.state.personalities.findIndex(a=>a.full_path==n.full_path),r=this.personalitiesFiltered.findIndex(a=>a.full_path==n.full_path),i=this.$refs.personalitiesZoo.findIndex(a=>a.full_path==n.full_path);console.log("ppp",this.$store.state.personalities[t]),this.$store.state.personalities[t].isMounted=!1,r>-1&&(this.personalitiesFiltered[r].isMounted=!1),i>-1&&(this.$refs.personalitiesZoo[i].isMounted=!1),this.$store.dispatch("refreshMountedPersonalities");const s=this.mountedPersArr[this.mountedPersArr.length-1];console.log(s,this.mountedPersArr.length),(await this.select_personality(n.personality)).status&&this.$store.state.toast.showToast(`Selected personality:
`+s.name,4,!0)}else this.$store.state.toast.showToast(`Could not unmount personality
Error: `+e.error,4,!1);this.isLoading=!1},editPersonality(n){n=n.personality,de.post("/get_personality_config",{client_id:this.$store.state.client_id,category:n.category,name:n.folder}).then(e=>{const t=e.data;console.log("Done"),t.status?(this.$store.state.currentPersonConfig=t.config,this.$store.state.showPersonalityEditor=!0,this.$store.state.personality_editor.showPanel(),this.$store.state.selectedPersonality=n):console.error(t.error)}).catch(e=>{console.error(e)})},copyToCustom(n){n=n.personality,de.post("/copy_to_custom_personas",{category:n.category,name:n.folder}).then(e=>{e.status?(this.$store.state.messageBox.showMessage(`Personality copied to the custom personalities folder:
Now it's up to you to modify it, enhance it, and maybe even share it.
Feel free to add your name as an author, but please remember to keep the original creator's name as well.
You have the freedom to give, sell, or keep the personas you create for yourself.
The possibilities are endless, they are now yours to mold and customize as you see fit.`),this.$store.dispatch("refreshPersonalitiesZoo")):this.$store.state.toast.showToast(`Personality couldn't be copied to the custom personalities folder:
Verify that the personality is not already copied there.`,4,!1)}).catch(e=>{this.$store.state.toast.showToast(`Personality couldn't be copied to the custom personalities folder:
`,4,!1),console.error(e)})},async remountPersonality(n){await this.unmountPersonality(n),await this.mountPersonality(n)},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,console.log("Personality path:",n.personality.path),de.post("/reinstall_personality",{client_id:this.$store.state.client_id,name:n.personality.path},{headers:this.posts_headers}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$store.state.toast.showToast("Personality reinstalled successfully!",4,!0):this.$store.state.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall personality
`+e.message,4,!1),{status:!1}))},async handleOpenFolder(n){await de.post("/open_personality_folder",{client_id:this.$store.state.client_id,personality_folder:n.personality.folder})},showMessage(n,e){this.message=n,this.successMessage=e,setTimeout(()=>{this.message=""},3e3)},loadPersonalities(){this.loading=!0,setTimeout(()=>{this.personalities=this.$store.state.personalities,this.loading=!1},500)}},mounted(){this.loadFavoritesFromLocalStorage(),this.loading=!0,setTimeout(()=>{this.personalities=this.$store.state.personalities,this.loading=!1},500)}},tIt={class:"app-zoo mb-100 pb-100 pt-12 background-color w-full p-6 overflow-y-auto h-screen scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},nIt={class:"panels-color shadow-lg rounded-lg p-4 max-w-4xl mx-auto mb-8"},rIt={class:"flex flex-wrap items-center justify-between gap-4"},iIt={key:0},sIt={key:1,class:"error"},oIt={class:"relative flex-grow max-w-md"},aIt={class:"flex items-center space-x-4"},lIt=["value"],cIt={class:"flex items-center space-x-4"},dIt={key:0,class:"flex justify-center items-center space-x-2 my-8","aria-live":"polite"},uIt={key:1},pIt={class:"container mx-auto px-4 flex flex-column pb-20"},hIt={key:0},mIt={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8 mb-12"},fIt={class:"container mx-auto px-4 flex flex-column pb-20"},gIt={class:"text-2xl font-bold my-8"},_It={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8 mb-12"},bIt={key:2,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 overflow-y-auto"},vIt={class:"bg-white rounded-lg p-6 w-11/12 h-5/6 flex flex-col"},yIt={class:"flex justify-between items-center mb-4"},EIt={class:"text-2xl font-bold"},SIt=["srcdoc"],xIt={key:1,class:"text-center text-red-500"};function TIt(n,e,t,r,i,s){const o=ht("personality-entry");return T(),M("div",tIt,[c("nav",nIt,[c("div",rIt,[i.message?(T(),M("p",iIt,X(i.message),1)):Y("",!0),i.error?(T(),M("p",sIt,X(i.error),1)):Y("",!0),c("div",oIt,[F(c("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>i.searchQuery=a),placeholder:"Search personalities...",class:"w-full border-b-2 border-gray-300 px-4 py-2 pl-10 focus:outline-none focus:border-blue-500 transition duration-300 ease-in-out","aria-label":"Search personalities"},null,512),[[_e,i.searchQuery]]),e[5]||(e[5]=c("svg",{class:"w-5 h-5 text-gray-400 absolute left-3 top-1/2 transform -translate-y-1/2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1))]),c("div",aIt,[e[7]||(e[7]=c("label",{for:"category-select",class:"font-semibold"},"Category:",-1)),F(c("select",{id:"category-select","onUpdate:modelValue":e[1]||(e[1]=a=>i.selectedCategory=a),class:"border-2 border-gray-300 rounded-md px-2 py-1"},[e[6]||(e[6]=c("option",{value:"all"},"All Categories",-1)),(T(!0),M(je,null,at(s.categories,a=>(T(),M("option",{key:a,value:a},X(a),9,lIt))),128))],512),[[Qt,i.selectedCategory]])]),c("div",cIt,[e[9]||(e[9]=c("label",{for:"sort-select",class:"font-semibold"},"Sort by:",-1)),F(c("select",{id:"sort-select","onUpdate:modelValue":e[2]||(e[2]=a=>i.sortBy=a),class:"border-2 border-gray-300 rounded-md px-2 py-1"},e[8]||(e[8]=[c("option",{value:"name"},"Name",-1),c("option",{value:"author"},"Author",-1),c("option",{value:"date"},"Creation Date",-1),c("option",{value:"update"},"Last Update",-1)]),512),[[Qt,i.sortBy]]),c("button",{onClick:e[3]||(e[3]=(...a)=>s.toggleSortOrder&&s.toggleSortOrder(...a)),class:"btn btn-secondary"},X(i.sortOrder==="asc"?"↑":"↓"),1)])])]),i.loading?(T(),M("div",dIt,e[10]||(e[10]=[c("div",{class:"animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-blue-500"},null,-1),c("span",{class:"text-xl text-gray-700 font-semibold"},"Loading...",-1)]))):(T(),M("div",uIt,[c("div",pIt,[s.fav