mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-26 15:31:04 +00:00
3998 lines
2.8 MiB
JavaScript
3998 lines
2.8 MiB
JavaScript
|
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]);
|
|||
|
var tD=Object.defineProperty;var nD=(n,e,t)=>e in n?tD(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Xt=(n,e,t)=>nD(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)}})();/**
|
|||
|
* @vue/shared v3.5.10
|
|||
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|||
|
* @license MIT
|
|||
|
**//*! #__NO_SIDE_EFFECTS__ */function Yb(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const Zt={},wa=[],Si=()=>{},rD=()=>!1,Sp=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),$b=n=>n.startsWith("onUpdate:"),mn=Object.assign,Wb=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},iD=Object.prototype.hasOwnProperty,zt=(n,e)=>iD.call(n,e),lt=Array.isArray,Ca=n=>bl(n)==="[object Map]",gl=n=>bl(n)==="[object Set]",pE=n=>bl(n)==="[object Date]",sD=n=>bl(n)==="[object RegExp]",gt=n=>typeof n=="function",rn=n=>typeof n=="string",xi=n=>typeof n=="symbol",Kt=n=>n!==null&&typeof n=="object",YR=n=>(Kt(n)||gt(n))&>(n.then)&>(n.catch),$R=Object.prototype.toString,bl=n=>$R.call(n),oD=n=>bl(n).slice(8,-1),WR=n=>bl(n)==="[object Object]",Kb=n=>rn(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,sc=Yb(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Tp=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},aD=/-(\w)/g,Vr=Tp(n=>n.replace(aD,(e,t)=>t?t.toUpperCase():"")),lD=/\B([A-Z])/g,qs=Tp(n=>n.replace(lD,"-$1").toLowerCase()),xp=Tp(n=>n.charAt(0).toUpperCase()+n.slice(1)),fu=Tp(n=>n?`on${xp(n)}`:""),zs=(n,e)=>!Object.is(n,e),Ra=(n,...e)=>{for(let t=0;t<n.length;t++)n[t](...e)},KR=(n,e,t,r=!1)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:r,value:t})},Ou=n=>{const e=parseFloat(n);return isNaN(e)?n:e},cD=n=>{const e=rn(n)?Number(n):NaN;return isNaN(e)?n:e};let fE;const jR=()=>fE||(fE=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Wt(n){if(lt(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=rn(r)?fD(r):Wt(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(rn(n)||Kt(n))return n}const dD=/;(?![^(]*\))/g,uD=/:([^]+)/,pD=/\/\*[^]*?\*\//g;function fD(n){const e={};return n.replace(pD,"").split(dD).forEach(t=>{if(t){const r=t.split(uD);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function Le(n){let e="";if(rn(n))e=n;else if(lt(n))for(let t=0;t<n.length;t++){const r=Le(n[t]);r&&(e+=r+" ")}else if(Kt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}const hD="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",mD=Yb(hD);function QR(n){return!!n||n===""}function _D(n,e){if(n.length!==e.length)return!1;let t=!0;for(let r=0;t&&r<n.length;r++)t=ko(n[r],e[r]);return t}function ko(n,e){if(n===e)return!0;let t=pE(n),r=pE(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=lt(n),r=lt(e),t||r)return t&&r?_D(n,e):!1;if(t=Kt(n),r=Kt(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||!ko(n[o],e[o]))return!1}}return String(n)===String(e)}function jb(n,e){return n.findIndex(t=>ko(t,e))}const XR=n=>!!(n&&n.__v_isRef===!0),Y=n=>rn(n)?n:n==null?"":lt(n)||Kt(n)&&(n.toString===$R||!gt(n.toString))?XR(n)?Y(n.value):JSON.stringify(n,ZR,2):String(n),ZR=(n,e)=>XR(e)?ZR(n,e.value):Ca(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[r,i],s)=>(t[Df(r,s)+" =>"]=i,t),{})}:gl(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>Df(t))}:xi(e)?Df(e):Kt(e)&&!lt(e)&&!WR(e)?String(e):e,Df=(n,e="")=>{var t;return xi(n)?`Symbol(${(t=n.description)!=null?t:e})`:n};/**
|
|||
|
* @vue/reactivity v3.5.10
|
|||
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|||
|
* @license MIT
|
|||
|
**/let jn;class JR{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=jn,!e&&jn&&(this.index=(jn.scopes||(jn.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=jn;try{return jn=this,e()}finally{jn=t}}}on(){jn=this}off(){jn=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 gD(n){return new JR(n)}function eA(){return jn}function bD(n,e=!1){jn&&jn.cleanups.push(n)}let en;const Lf=new WeakSet;class tA{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,jn&&jn.active&&jn.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Lf.has(this)&&(Lf.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||rA(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,hE(this),iA(this);const e=en,t=ei;en=this,ei=!0;try{return this.fn()}finally{sA(this),en=e,ei=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Zb(e);this.deps=this.depsTail=void 0,hE(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Lf.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){P0(this)&&this.run()}get dirty(){return P0(this)}}let nA=0,Ea;function rA(n){n.flags|=8,n.next=Ea,Ea=n}function Qb(){nA++}function Xb(){if(--nA>0)return;let n;for(;Ea;){let e=Ea,t;for(;e;)e.flags&1||(e.flags&=-9),e=e.next;for(e=Ea,Ea=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 iA(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function sA(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),Zb(r),vD(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function P0(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(oA(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function oA(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===wc))return;n.globalVersion=wc;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!P0(n)){n.flags&=-3;return}const t=en,r=ei;en=n,ei=!0;try{iA(n);const i=n.fn(n._value);(e.version===0||zs(i,n._value))&&(n._value=i,e.version++)}catch(i){throw e.version++,i}finally{en=t,ei=r,sA(n),n.flags&=-3}}function Zb(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)Zb(s,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function vD(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let ei=!0;const aA=[];function Ys(){aA.push(ei),ei=!1}function $s(){const n=aA.pop();ei=n===void 0?!0:n}function hE(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=en;en=void 0;try{e()}finally{en=t}}}let wc=0;class yD{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 wp{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.target=vo
|
|||
|
* @vue/runtime-core v3.5.10
|
|||
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|||
|
* @license MIT
|
|||
|
**/function $c(n,e,t,r){try{return r?n(...r):n()}catch(i){Op(i,e,t)}}function oi(n,e,t,r){if(gt(n)){const i=$c(n,e,t,r);return i&&YR(i)&&i.catch(s=>{Op(s,e,t)}),i}if(lt(n)){const i=[];for(let s=0;s<n.length;s++)i.push(oi(n[s],e,t,r));return i}}function Op(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||Zt;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 h=0;h<u.length;h++)if(u[h](n,l,d)===!1)return}a=a.parent}if(s){Ys(),$c(s,null,10,[n,l,d]),$s();return}}e3(n,t,i,r,o)}function e3(n,e,t,r=!0,i=!1){if(i)throw n;console.error(n)}let Rc=!1,U0=!1;const Xn=[];let fi=0;const Ma=[];let Es=null,va=0;const SA=Promise.resolve();let nv=null;function Pe(n){const e=nv||SA;return n?e.then(this?n.bind(this):n):e}function t3(n){let e=Rc?fi+1:0,t=Xn.length;for(;e<t;){const r=e+t>>>1,i=Xn[r],s=Ac(i);s<n||s===n&&i.flags&2?e=r+1:t=r}return e}function rv(n){if(!(n.flags&1)){const e=Ac(n),t=Xn[Xn.length-1];!t||!(n.flags&2)&&e>=Ac(t)?Xn.push(n):Xn.splice(t3(e),0,n),n.flags|=1,TA()}}function TA(){!Rc&&!U0&&(U0=!0,nv=SA.then(wA))}function n3(n){lt(n)?Ma.push(...n):Es&&n.id===-1?Es.splice(va+1,0,n):n.flags&1||(Ma.push(n),n.flags|=1),TA()}function yE(n,e,t=Rc?fi+1:0){for(;t<Xn.length;t++){const r=Xn[t];if(r&&r.flags&2){if(n&&r.id!==n.uid)continue;Xn.splice(t,1),t--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function xA(n){if(Ma.length){const e=[...new Set(Ma)].sort((t,r)=>Ac(t)-Ac(r));if(Ma.length=0,Es){Es.push(...e);return}for(Es=e,va=0;va<Es.length;va++){const t=Es[va];t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2}Es=null,va=0}}const Ac=n=>n.id==null?n.flags&2?-1:1/0:n.id;function wA(n){U0=!1,Rc=!0;try{for(fi=0;fi<Xn.length;fi++){const e=Xn[fi];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),$c(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;fi<Xn.length;fi++){const e=Xn[fi];e&&(e.flags&=-2)}fi=0,Xn.length=0,xA(),Rc=!1,nv=null,(Xn.length||Ma.length)&&wA()}}let Rn=null,CA=null;function Lu(n){const e=Rn;return Rn=n,CA=n&&n.type.__scopeId||null,e}function Ae(n,e=Rn,t){if(!e||n._n)return n;const r=(...i)=>{r._d&&OE(-1);const s=Lu(e);let o;try{o=n(...i)}finally{Lu(s),r._d&&OE(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function D(n,e){if(Rn===null)return n;const t=Up(Rn),r=n.dirs||(n.dirs=[]);for(let i=0;i<e.length;i++){let[s,o,a,l=Zt]=e[i];s&&(gt(s)&&(s={mounted:s,updated:s}),s.deep&&Yi(o),r.push({dir:s,instance:t,value:o,oldValue:void 0,arg:a,modifiers:l}))}return n}function eo(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&&(Ys(),oi(l,t,8,[n.el,a,n,e]),$s())}}const RA=Symbol("_vte"),AA=n=>n.__isTeleport,oc=n=>n&&(n.disabled||n.disabled===""),r3=n=>n&&(n.defer||n.defer===""),EE=n=>typeof SVGElement<"u"&&n instanceof SVGElement,SE=n=>typeof MathMLElement=="function"&&n instanceof MathMLElement,B0=(n,e)=>{const t=n&&n.to;return rn(t)?e?e(t):null:t},i3={name:"Teleport",__isTeleport:!0,process(n,e,t,r,i,s,o,a,l,d){const{mc:u,pc:h,pbc:m,o:{insert:g,querySelector:_,createText:f,createComment:b}}=d,v=oc(e.props);let{shapeFlag:y,children:E,dynamicChildren:S}=e;if(n==null){const R=e.el=f(""),w=e.anchor=f("");g(R,t,r),g(w,t,r);const A=(x,M)=>{y&16&&(i&&i.isCE&&(i.ce._teleportTarget=x),u(E,x,M,i,s,o,a,l))},I=()=>{const x=e.target=B0(e.props,_),M=MA(x,e,f,g);x&&(o!=="svg"&&EE(x)?o="svg":o!=="mathml"&&SE(x)&&(o="mathml"),v||(A(x,M),hu(e)))};v&&(A(t,w),hu(e)),r3(e.props)?wn(I,s):I()}else{e.el=n.el,e.targetStart=n.targetStart;const R=e.anchor=n.anchor,w=e.target=n.target,A=e.targetAnchor=n.targetAnchor,I=oc(n.props),x=I?t:w,M=I?R:A;if(o==="svg"||EE(w)?o="svg":(o==="mathml"||SE(w))&&(o="mathml"),S?(m(n.dynamicChildren,S,x,i,s,o,a),av(n,e,!0)):l||h(n,e,x,M,i,s,o,a,!1),v)I?e.props&&n.props&&e.props.to!==n.props.to&&(e.props.to=n.props.to):Ed(e,t,R,d,1);else if((e.props&&e.props.to)!==(n.props&&n.props.to)){const z=e.target=B0(e.props,_);z&&Ed(e,z,null,d,0)}else I&&Ed(e,w,A,d,1);hu(e)}},remove(n,e,t,{um:r,o:{remove:i}},s){const{shapeF
|
|||
|
* @vue/runtime-dom v3.5.10
|
|||
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|||
|
* @license MIT
|
|||
|
**/let W0;const LE=typeof window<"u"&&window.trustedTypes;if(LE)try{W0=LE.createPolicy("vue",{createHTML:n=>n})}catch{}const lM=W0?n=>W0.createHTML(n):n=>n,aL="http://www.w3.org/2000/svg",lL="http://www.w3.org/1998/Math/MathML",qi=typeof document<"u"?document:null,PE=qi&&qi.createElement("template"),cL={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"?qi.createElementNS(aL,n):e==="mathml"?qi.createElementNS(lL,n):t?qi.createElement(n,{is:t}):qi.createElement(n);return n==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:n=>qi.createTextNode(n),createComment:n=>qi.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>qi.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{PE.innerHTML=lM(r==="svg"?`<svg>${n}</svg>`:r==="mathml"?`<math>${n}</math>`:n);const a=PE.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]}},us="transition",Fl="animation",za=Symbol("_vtc"),cM={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},dM=mn({},OA,cM),dL=n=>(n.displayName="Transition",n.props=dM,n),ti=dL((n,{slots:e})=>dv(l3,uM(n),e)),no=(n,e=[])=>{lt(n)?n.forEach(t=>t(...e)):n&&n(...e)},FE=n=>n?lt(n)?n.some(e=>e.length>1):n.length>1:!1;function uM(n){const e={};for(const V in n)V in cM||(e[V]=n[V]);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:h=`${t}-leave-from`,leaveActiveClass:m=`${t}-leave-active`,leaveToClass:g=`${t}-leave-to`}=n,_=uL(i),f=_&&_[0],b=_&&_[1],{onBeforeEnter:v,onEnter:y,onEnterCancelled:E,onLeave:S,onLeaveCancelled:R,onBeforeAppear:w=v,onAppear:A=y,onAppearCancelled:I=E}=e,x=(V,J,O)=>{ys(V,J?u:a),ys(V,J?d:o),O&&O()},M=(V,J)=>{V._isLeaving=!1,ys(V,h),ys(V,g),ys(V,m),J&&J()},z=V=>(J,O)=>{const q=V?A:y,k=()=>x(J,V,O);no(q,[J,k]),UE(()=>{ys(J,V?l:s),Vi(J,V?u:a),FE(q)||BE(J,r,f,k)})};return mn(e,{onBeforeEnter(V){no(v,[V]),Vi(V,s),Vi(V,o)},onBeforeAppear(V){no(w,[V]),Vi(V,l),Vi(V,d)},onEnter:z(!1),onAppear:z(!0),onLeave(V,J){V._isLeaving=!0;const O=()=>M(V,J);Vi(V,h),Vi(V,m),fM(),UE(()=>{V._isLeaving&&(ys(V,h),Vi(V,g),FE(S)||BE(V,r,b,O))}),no(S,[V,O])},onEnterCancelled(V){x(V,!1),no(E,[V])},onAppearCancelled(V){x(V,!0),no(I,[V])},onLeaveCancelled(V){M(V),no(R,[V])}})}function uL(n){if(n==null)return null;if(Kt(n))return[Hf(n.enter),Hf(n.leave)];{const e=Hf(n);return[e,e]}}function Hf(n){return cD(n)}function Vi(n,e){e.split(/\s+/).forEach(t=>t&&n.classList.add(t)),(n[za]||(n[za]=new Set)).add(e)}function ys(n,e){e.split(/\s+/).forEach(r=>r&&n.classList.remove(r));const t=n[za];t&&(t.delete(e),t.size||(n[za]=void 0))}function UE(n){requestAnimationFrame(()=>{requestAnimationFrame(n)})}let pL=0;function BE(n,e,t,r){const i=n._endId=++pL,s=()=>{i===n._endId&&r()};if(t!=null)return setTimeout(s,t);const{type:o,timeout:a,propCount:l}=pM(n,e);if(!o)return r();const d=o+"end";let u=0;const h=()=>{n.removeEventListener(d,m),s()},m=g=>{g.target===n&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),n.addEventListener(d,m)}function pM(n,e){const t=window.getComputedStyle(n),r=_=>(t[_]||"").split(", "),i=r(`${us}Delay`),s=r(`${us}Duration`),o=GE(i,s),a=r(`${Fl}Delay`),l=r(`${Fl}Duration`),d=GE(a,l);let u=null,h=0,m=0;e===us?o>0&&(u=us,h=o,m=s.length):e===Fl?d>0&&
|
|||
|
* vuex v4.1.0
|
|||
|
* (c) 2022 Evan You
|
|||
|
* @license MIT
|
|||
|
*/var XL="store";function yl(n,e){Object.keys(n).forEach(function(t){return e(n[t],t)})}function vM(n){return n!==null&&typeof n=="object"}function ZL(n){return n&&typeof n.then=="function"}function JL(n,e){return function(){return n(e)}}function yM(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 EM(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;Bp(n,t,[],n._modules.root,!0),uv(n,t,e)}function uv(n,e,t){var r=n._state,i=n._scope;n.getters={},n._makeLocalGettersCache=Object.create(null);var s=n._wrappedGetters,o={},a={},l=gD(!0);l.run(function(){yl(s,function(d,u){o[u]=JL(d,n),a[u]=tt(function(){return o[u]()}),Object.defineProperty(n.getters,u,{get:function(){return a[u].value},enumerable:!0})})}),n._state=nr({data:e}),n._scope=l,n.strict&&i4(n),r&&t&&n._withCommit(function(){r.data=null}),i&&i.stop()}function Bp(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=pv(e,t.slice(0,-1)),l=t[t.length-1];n._withCommit(function(){a[l]=r.state})}var d=r.context=e4(n,o,t);r.forEachMutation(function(u,h){var m=o+h;t4(n,m,u,d)}),r.forEachAction(function(u,h){var m=u.root?h:o+h,g=u.handler||u;n4(n,m,g,d)}),r.forEachGetter(function(u,h){var m=o+h;r4(n,m,u,d)}),r.forEachChild(function(u,h){Bp(n,e,t.concat(h),u,i)})}function e4(n,e,t){var r=e==="",i={dispatch:r?n.dispatch:function(s,o,a){var l=Vu(s,o,a),d=l.payload,u=l.options,h=l.type;return(!u||!u.root)&&(h=e+h),n.dispatch(h,d)},commit:r?n.commit:function(s,o,a){var l=Vu(s,o,a),d=l.payload,u=l.options,h=l.type;(!u||!u.root)&&(h=e+h),n.commit(h,d,u)}};return Object.defineProperties(i,{getters:{get:r?function(){return n.getters}:function(){return SM(n,e)}},state:{get:function(){return pv(n.state,t)}}}),i}function SM(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 t4(n,e,t,r){var i=n._mutations[e]||(n._mutations[e]=[]);i.push(function(o){t.call(n,r.state,o)})}function n4(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 ZL(a)||(a=Promise.resolve(a)),n._devtoolHook?a.catch(function(l){throw n._devtoolHook.emit("vuex:error",l),l}):a})}function r4(n,e,t,r){n._wrappedGetters[e]||(n._wrappedGetters[e]=function(s){return t(r.state,r.getters,s.state,s.getters)})}function i4(n){kn(function(){return n._state.data},function(){},{deep:!0,flush:"sync"})}function pv(n,e){return e.reduce(function(t,r){return t[r]},n)}function Vu(n,e,t){return vM(n)&&n.type&&(t=e,e=n,n=n.type),{type:n,payload:e,options:t}}var s4="vuex bindings",t1="vuex:mutations",$f="vuex:actions",Zo="vuex",o4=0;function a4(n,e){QL({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:[s4]},function(t){t.addTimelineLayer({id:t1,label:"Vuex Mutations",color:n1}),t.addTimelineLayer({id:$f,label:"Vuex Actions",color:n1}),t.addInspector({id:Zo,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),t.on.getInspectorTree(function(r){if(r.app===n&&r.inspectorId===Zo)if(r.filter){var i=[];CM(i,e._modules.root,r.filter,""),r.rootNodes=i}else r.rootNodes=[wM(e._modules.root,"")]}),t.on.getInspectorState(function(r){if(r.app===n&&r.inspectorId===Zo){var i=r.nodeId;SM(e,i),r.state=d4(p4(e._modules,i),i==="root"?e.getters:e._makeLocalGettersCache,i)}}),t.on.editInspectorState(function(r){if(r.app===n&&r.inspectorId===Zo){var i=r.nodeId,s=r.path;i!=="root"&&(s=i.split("/").filter(Boolean).concat(s)),e._withCommit(function(){r.set(e._st
|
|||
|
`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&yP[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},l1=Symbol("internals");function Bl(n){return n&&String(n).trim().toLowerCase()}function vu(n){return n===!1||n==null?n:Se.isArray(n)?n.map(vu):String(n)}function SP(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 TP=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Kf(n,e,t,r,i){if(Se.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Se.isString(e)){if(Se.isString(r))return e.indexOf(r)!==-1;if(Se.isRegExp(r))return r.test(e)}}function xP(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function wP(n,e){const t=Se.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 cr{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,d){const u=Bl(l);if(!u)throw new Error("header name must be a non-empty string");const h=Se.findKey(i,u);(!h||i[h]===void 0||d===!0||d===void 0&&i[h]!==!1)&&(i[h||l]=vu(a))}const o=(a,l)=>Se.forEach(a,(d,u)=>s(d,u,l));if(Se.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Se.isString(e)&&(e=e.trim())&&!TP(e))o(EP(e),t);else if(Se.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=Bl(e),e){const r=Se.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return SP(i);if(Se.isFunction(t))return t.call(this,i,r);if(Se.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Bl(e),e){const r=Se.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Kf(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=Bl(o),o){const a=Se.findKey(r,o);a&&(!t||Kf(r,r[a],a,t))&&(delete r[a],i=!0)}}return Se.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||Kf(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Se.forEach(this,(i,s)=>{const o=Se.findKey(r,s);if(o){t[o]=vu(i),delete t[s];return}const a=e?xP(s):String(s).trim();a!==s&&delete t[s],t[a]=vu(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Se.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Se.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[l1]=this[l1]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Bl(o);r[a]||(wP(i,o),r[a]=!0)}return Se.isArray(e)?e.forEach(s):s(e),this}}cr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Se.reduceDescriptors(cr.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Se.freezeMethods(cr);function jf(n,e){const t=this||Qc,r=e||t,i=cr.from(r.headers);let s=r.data;return Se.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function qM(n){return!!(n&&n.__CANCEL__)}function Sl(n,e,t){St.call(this,n??"canceled",St.ERR_CANCELED,e,t),this.name="CanceledError"}Se.inherits(Sl,St,{__CANCEL__:!0});function YM(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new St("Request failed with status code "+t.status,[St.ERR_BAD_REQUEST,St.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function CP(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function RP(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 h=s,m=0;for(;h!==i;)m+=t[h++],h=h%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(m*1e3/g):void 0}}function AP(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(),h=u-t;h>=r?o(d,u):(i=d,s||(s=setTimeout(()=>{s=null,o(i)},r-h)))},()=>i&&o(i)]}const Hu=(n,e,t=3)=>{let r=0;const i=RP(50,250);return AP(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,d=i(l),u=o<=a;r=o;const h={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(h)},t)},c1=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},d1=n=>(...e)=>Se.asap(()=>n(...e)),MP=lr.hasStandardBrowserEnv?function(){const e=lr.navigator&&/(msie|trident)/i.test(lr.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=Se.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}(),NP=lr.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Se.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Se.isString(r)&&o.push("path="+r),Se.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 OP(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function IP(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function $M(n,e){return n&&!OP(e)?IP(n,e):e}const u1=n=>n instanceof cr?{...n}:n;function Lo(n,e){e=e||{};const t={};function r(d,u,h){return Se.isPlainObject(d)&&Se.isPlainObject(u)?Se.merge.call({caseless:h},d,u):Se.isPlainObject(u)?Se.merge({},u):Se.isArray(u)?u.slice():u}function i(d,u,h){if(Se.isUndefined(u)){if(!Se.isUndefined(d))return r(void 0,d,h)}else return r(d,u,h)}function s(d,u){if(!Se.isUndefined(u))return r(void 0,u)}function o(d,u){if(Se.isUndefined(u)){if(!Se.isUndefined(d))return r(void 0,d)}else return r(void 0,u)}function a(d,u,h){if(h in e)return r(d,u);if(h in n
|
|||
|
`+s.map(h1).join(`
|
|||
|
`):" "+h1(s[0]):"as no adapter specified";throw new St("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:eb};function Qf(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Sl(null,n)}function m1(n){return Qf(n),n.headers=cr.from(n.headers),n.data=jf.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),QM.getAdapter(n.adapter||Qc.adapter)(n).then(function(r){return Qf(n),r.data=jf.call(n,n.transformResponse,r),r.headers=cr.from(r.headers),r},function(r){return qM(r)||(Qf(n),r&&r.response&&(r.response.data=jf.call(n,n.transformResponse,r.response),r.response.headers=cr.from(r.response.headers))),Promise.reject(r)})}const XM="1.7.7",gv={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{gv[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const _1={};gv.transitional=function(e,t,r){function i(s,o){return"[Axios v"+XM+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new St(i(o," has been removed"+(t?" in "+t:"")),St.ERR_DEPRECATED);return t&&!_1[o]&&(_1[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 YP(n,e,t){if(typeof n!="object")throw new St("options must be an object",St.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 St("option "+s+" must be "+l,St.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new St("Unknown option "+s,St.ERR_BAD_OPTION)}}const tb={assertOptions:YP,validators:gv},ps=tb.validators;class wo{constructor(e){this.defaults=e,this.interceptors={request:new a1,response:new a1}}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=Lo(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&tb.assertOptions(r,{silentJSONParsing:ps.transitional(ps.boolean),forcedJSONParsing:ps.transitional(ps.boolean),clarifyTimeoutError:ps.transitional(ps.boolean)},!1),i!=null&&(Se.isFunction(i)?t.paramsSerializer={serialize:i}:tb.assertOptions(i,{encode:ps.function,serialize:ps.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Se.merge(s.common,s[t.method]);s&&Se.forEach(["delete","get","head","post","put","patch","common"],_=>{delete s[_]}),t.headers=cr.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(t)===!1||(l=l&&f.synchronous,a.unshift(f.fulfilled,f.rejected))});const d=[];this.interceptors.response.forEach(function(f){d.push(f.fulfilled,f.rejected)});let u,h=0,m;if(!l){const _=[m1.bind(this),void 0];for(_.unshift.apply(_,a),_.push.apply(_,d),m=_.length,u=Promise.resolve(t);h<m;)u=u.then(_[h++],_[h++]);return u}m=a.length;let g=t;for(h=0;h<m;){const _=a[h++],f=a[h++];try{g=_(g)}catch(b){f.call(this,b);break}}try{u=m1.call(this,g)}catch(_){return Promise.reject(_)}for(h=0,m=d.length;h<m;)u=u.then(d[h++],d[h++]);return u}getUri(e){e=Lo(this.defaults,e);const t=$M(e.baseURL,e.url);return zM(t,e.params,e.paramsSerializer)}}Se.forEach(["delete","get","head","options"],function(e){wo.prototype[e]=function(t,r){return this.request(Lo(r||{},{method:e,url:t,data:(r||{}).data}))}});Se.forEach(["post","put","patch"],function(e){function t(r){return function(s,o,a){return this.request(Lo(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}wo.prototype[e]=t(),wo.prototype[e+"Form"]=t(!0)});class bv{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 Sl(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 bv(function(i){e=i}),cancel:e}}}function $P(n){return function(t){return n.apply(null,t)}}function WP(n){return Se.isObject(n)&&n.isAxiosError===!0}const nb={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
|
|||
|
* vue-router v4.4.5
|
|||
|
* (c) 2024 Eduardo San Martin Morote
|
|||
|
* @license MIT
|
|||
|
*/const ya=typeof document<"u";function JM(n){return typeof n=="object"||"displayName"in n||"props"in n||"__vccOpts"in n}function KP(n){return n.__esModule||n[Symbol.toStringTag]==="Module"||n.default&&JM(n.default)}const Ht=Object.assign;function Xf(n,e){const t={};for(const r in e){const i=e[r];t[r]=ai(i)?i.map(n):n(i)}return t}const cc=()=>{},ai=Array.isArray,eN=/#/g,jP=/&/g,QP=/\//g,XP=/=/g,ZP=/\?/g,tN=/\+/g,JP=/%5B/g,e5=/%5D/g,nN=/%5E/g,t5=/%60/g,rN=/%7B/g,n5=/%7C/g,iN=/%7D/g,r5=/%20/g;function vv(n){return encodeURI(""+n).replace(n5,"|").replace(JP,"[").replace(e5,"]")}function i5(n){return vv(n).replace(rN,"{").replace(iN,"}").replace(nN,"^")}function rb(n){return vv(n).replace(tN,"%2B").replace(r5,"+").replace(eN,"%23").replace(jP,"%26").replace(t5,"`").replace(rN,"{").replace(iN,"}").replace(nN,"^")}function s5(n){return rb(n).replace(XP,"%3D")}function o5(n){return vv(n).replace(eN,"%23").replace(ZP,"%3F")}function a5(n){return n==null?"":o5(n).replace(QP,"%2F")}function Ic(n){try{return decodeURIComponent(""+n)}catch{}return""+n}const l5=/\/$/,c5=n=>n.replace(l5,"");function Zf(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=f5(r??e,t),{fullPath:r+(s&&"?")+s+o,path:r,query:i,hash:Ic(o)}}function d5(n,e){const t=e.query?n(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function g1(n,e){return!e||!n.toLowerCase().startsWith(e.toLowerCase())?n:n.slice(e.length)||"/"}function u5(n,e,t){const r=e.matched.length-1,i=t.matched.length-1;return r>-1&&r===i&&Ha(e.matched[r],t.matched[i])&&sN(e.params,t.params)&&n(e.query)===n(t.query)&&e.hash===t.hash}function Ha(n,e){return(n.aliasOf||n)===(e.aliasOf||e)}function sN(n,e){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(!p5(n[t],e[t]))return!1;return!0}function p5(n,e){return ai(n)?b1(n,e):ai(e)?b1(e,n):n===e}function b1(n,e){return ai(e)?n.length===e.length&&n.every((t,r)=>t===e[r]):n.length===1&&n[0]===e}function f5(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 fs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var kc;(function(n){n.pop="pop",n.push="push"})(kc||(kc={}));var dc;(function(n){n.back="back",n.forward="forward",n.unknown=""})(dc||(dc={}));function h5(n){if(!n)if(ya){const e=document.querySelector("base");n=e&&e.getAttribute("href")||"/",n=n.replace(/^\w+:\/\/[^\/]+/,"")}else n="/";return n[0]!=="/"&&n[0]!=="#"&&(n="/"+n),c5(n)}const m5=/^[^#]+#/;function _5(n,e){return n.replace(m5,"#")+e}function g5(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 Yp=()=>({left:window.scrollX,top:window.scrollY});function b5(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=g5(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 v1(n,e){return(history.state?history.state.position-e:-1)+n}const ib=new Map;function v5(n,e){ib.set(n,e)}function y5(n){const e=ib.get(n);return ib.delete(n),e}let E5=()=>location.protocol+"//"+location.host;function oN(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),g1(l,"")}return g1(t,n)+r+i}function S5(n,e,t,r){let i=[],s=[],o=null;const a=({state:m})=>{const g=oN(n,location),_=t.value,f=e.value;let b=0;if(m){if(t.value=g,e.value=m,o&&o===_){o=null;return}b=f?m.position
|
|||
|
Copyright (c) 2016 Jed Watson.
|
|||
|
Licensed under the MIT License (MIT), see
|
|||
|
http://jedwatson.github.io/classnames
|
|||
|
*/(function(){var a=function(){function l(){}l.prototype=Object.create(null);function d(v,y){for(var E=y.length,S=0;S<E;++S)f(v,y[S])}var u={}.hasOwnProperty;function h(v,y){v[y]=!0}function m(v,y){for(var E in y)u.call(y,E)&&(v[E]=!!y[E])}var g=/\s+/;function _(v,y){for(var E=y.split(g),S=E.length,R=0;R<S;++R)v[E[R]]=!0}function f(v,y){if(y){var E=typeof y;E==="string"?_(v,y):Array.isArray(y)?d(v,y):E==="object"?m(v,y):E==="number"&&h(v,y)}}function b(){for(var v=arguments.length,y=Array(v),E=0;E<v;E++)y[E]=arguments[E];var S=new l;d(S,y);var R=[];for(var w in S)S[w]&&R.push(w);return R.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"),h=i("./node_modules/core-js/internals/get-iterator-method.js");t.exports=function(g){var _=o(g),f=typeof this=="function"?this:Array,b=arguments.length,v=b>1?arguments[1]:void 0,y=v!==void 0,E=0,S=h(_),R,w,A,I;if(y&&(v=s(v,b>2?arguments[2]:void 0,2)),S!=null&&!(f==Array&&l(S)))for(I=S.call(_),w=new f;!(A=I.next()).done;E++)u(w,E,y?a(I,v,[A.value,E],!0):A.value);else for(R=d(_.length),w=new f(R);R>E;E++)u(w,E,y?v(_[E],E):_[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,h){var m=s(d),g=o(m.length),_=a(h,g),f;if(l&&u!=u){for(;g>_;)if(f=m[_++],f!=f)return!0}else for(;g>_;_++)if((l||_ in m)&&m[_]===u)return l||_||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,h){return o.call(a,d,u,h)}}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(h){var u=o.return;throw u!==void 0&&s(u.call(o)),h}}},"./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,h){if(!h&&!a)return!1;var m=!1;try{var g={};g[o]=function(){return{next:function(){return{done:m=!0}}}},u(g)}catch{}return m}},"./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
|
|||
|
`,QJ="∄",XJ="∄",ZJ="𝔑",JJ="𝔫",eee="≧̸",tee="≱",nee="≱",ree="≧̸",iee="⩾̸",see="⩾̸",oee="⋙̸",aee="≵",lee="≫⃒",cee="≯",dee="≯",uee="≫̸",pee="↮",fee="⇎",hee="⫲",mee="∋",_ee="⋼",gee="⋺",bee="∋",vee="Њ",yee="њ",Eee="↚",See="⇍",Tee="‥",xee="≦̸",wee="≰",Cee="↚",Ree="⇍",Aee="↮",Mee="⇎",Nee="≰",Oee="≦̸",Iee="⩽̸",kee="⩽̸",Dee="≮",Lee="⋘̸",Pee="≴",Fee="≪⃒",Uee="≮",Bee="⋪",Gee="⋬",zee="≪̸",Vee="∤",Hee="",qee=" ",Yee="𝕟",$ee="ℕ",Wee="⫬",Kee="¬",jee="≢",Qee="≭",Xee="∦",Zee="∉",Jee="≠",ete="≂̸",tte="∄",nte="≯",rte="≱",ite="≧̸",ste="≫̸",ote="≹",ate="⩾̸",lte="≵",cte="≎̸",dte="≏̸",ute="∉",pte="⋵̸",fte="⋹̸",hte="∉",mte="⋷",_te="⋶",gte="⧏̸",bte="⋪",vte="⋬",yte="≮",Ete="≰",Ste="≸",Tte="≪̸",xte="⩽̸",wte="≴",Cte="⪢̸",Rte="⪡̸",Ate="∌",Mte="∌",Nte="⋾",Ote="⋽",Ite="⊀",kte="⪯̸",Dte="⋠",Lte="∌",Pte="⧐̸",Fte="⋫",Ute="⋭",Bte="⊏̸",Gte="⋢",zte="⊐̸",Vte="⋣",Hte="⊂⃒",qte="⊈",Yte="⊁",$te="⪰̸",Wte="⋡",Kte="≿̸",jte="⊃⃒",Qte="⊉",Xte="≁",Zte="≄",Jte="≇",ene="≉",tne="∤",nne="∦",rne="∦",ine="⫽⃥",sne="∂̸",one="⨔",ane="⊀",lne="⋠",cne="⊀",dne="⪯̸",une="⪯̸",pne="⤳̸",fne="↛",hne="⇏",mne="↝̸",_ne="↛",gne="⇏",bne="⋫",vne="⋭",yne="⊁",Ene="⋡",Sne="⪰̸",Tne="𝒩",xne="𝓃",wne="∤",Cne="∦",Rne="≁",Ane="≄",Mne="≄",Nne="∤",One="∦",Ine="⋢",kne="⋣",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="≥⃒",fre=">⃒",hre="⤄",mre="⧞",_re="⤂",gre="≤⃒",bre="<⃒",vre="⊴⃒",yre="⤃",Ere="⊵⃒",Sre="∼⃒",Tre="⤣",xre="↖",wre="⇖",Cre="↖",Rre="⤧",Are="Ó",Mre="ó",Nre="⊛",Ore="Ô",Ire="ô",kre="⊚",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="⊖",fie="𝕆",hie="𝕠",mie="⦷",_ie="“",gie="‘",bie="⦹",vie="⊕",yie="↻",Eie="⩔",Sie="∨",Tie="⩝",xie="ℴ",wie="ℴ",Cie="ª",Rie="º",Aie="⊶",Mie="⩖",Nie="⩗",Oie="⩛",Iie="Ⓢ",kie="𝒪",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="Φ",fse="φ",hse="ϕ",mse="ℳ",_se="☎",gse="Π",bse="π",vse="⋔",yse="ϖ",Ese="ℏ",Sse="ℎ",Tse="ℏ",xse="⨣",wse="⊞",Cse="⨢",Rse="+",Ase="∔",Mse="⨥",Nse="⩲",Ose="±",Ise="±",kse="⨦",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="∏",foe="⌮",hoe="⌒",moe="⌓",_oe="∝",goe="∝",boe="∷",voe="∝",yoe="≾",Eoe="⊰",Soe="𝒫",Toe="𝓅",xoe="Ψ",woe="ψ",Coe=" ",Roe="𝔔",Aoe="𝔮",Moe="⨌",Noe="𝕢",Ooe="ℚ",Ioe="⁗",koe="𝒬",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="↣",fae="↝",hae="⤚",mae="⤜",_ae="∶",gae="ℚ",bae="⤍",vae="⤏
|
|||
|
`," "],j0e=["{","}","|","\\","^","`"].concat(K0e),Q0e=["'"].concat(j0e),F1=["%","/","?",";","#"].concat(Q0e),U1=["/","?","#"],X0e=255,B1=/^[+a-z0-9A-Z_-]{0,63}$/,Z0e=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,G1={javascript:!0,"javascript:":!0},z1={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function J0e(n,e){if(n&&n instanceof $u)return n;var t=new $u;return t.parse(n,e),t}$u.prototype.parse=function(n,e){var t,r,i,s,o,a=n;if(a=a.trim(),!e&&n.split("#").length===1){var l=W0e.exec(a);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}var d=Y0e.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&&G1[d])&&(a=a.substr(2),this.slashes=!0)),!G1[d]&&(o||d&&!z1[d])){var u=-1;for(t=0;t<U1.length;t++)s=a.indexOf(U1[t]),s!==-1&&(u===-1||s<u)&&(u=s);var h,m;for(u===-1?m=a.lastIndexOf("@"):m=a.lastIndexOf("@",u),m!==-1&&(h=a.slice(0,m),a=a.slice(m+1),this.auth=h),u=-1,t=0;t<F1.length;t++)s=a.indexOf(F1[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 _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_){var f=this.hostname.split(/\./);for(t=0,r=f.length;t<r;t++){var b=f[t];if(b&&!b.match(B1)){for(var v="",y=0,E=b.length;y<E;y++)b.charCodeAt(y)>127?v+="x":v+=b[y];if(!v.match(B1)){var S=f.slice(0,t),R=f.slice(t+1),w=b.match(Z0e);w&&(S.push(w[1]),R.unshift(w[2])),R.length&&(a=R.join(".")+a),this.hostname=S.join(".");break}}}}this.hostname.length>X0e&&(this.hostname=""),_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var A=a.indexOf("#");A!==-1&&(this.hash=a.substr(A),a=a.slice(0,A));var I=a.indexOf("?");return I!==-1&&(this.search=a.substr(I),a=a.slice(0,I)),a&&(this.pathname=a),z1[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this};$u.prototype.parseHost=function(n){var e=$0e.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 ebe=J0e;Tl.encode=z0e;Tl.decode=H0e;Tl.format=q0e;Tl.parse=ebe;var ro={},th,V1;function gN(){return V1||(V1=1,th=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),th}var nh,H1;function bN(){return H1||(H1=1,nh=/[\0-\x1F\x7F-\x9F]/),nh}var rh,q1;function tbe(){return q1||(q1=1,rh=/[\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]/),rh}var ih,Y1;function vN(){return Y1||(Y1=1,ih=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),ih}var $1;function nbe(){return $1||($1=1,ro.Any=gN(),ro.Cc=bN(),ro.Cf=tbe(),ro.P=Sv,ro.Z=vN()),ro}(function(n){function e(O){return Object.prototype.toString.call(O)}function t(O){return e(O)==="[object String]"}var r=Object.prototype.hasOwnProperty;function i(O,q){return r.call(O,q)}function s(O){var q=Array.prototype.slice.call(arguments,1);return q.forEach(function(k){if(k){if(typeof k!="object")throw new TypeError(k+"must be object");Object.keys(k).forEach(function(G){O[G]=k[G]})}}),O}function o(O,q,k){return[].concat(O.slice(0,q),k,O.slice(q+1))}function a(O){return!(O>=55296&&O<=57343||O>=64976&&O<=65007||(O&65535)===65535||(O&65535)===65534||O>=0&&O<=8||O===11||O>=14&&O<=31||O>=127&&O<=159||O>1114111)}function l(O){if(O>65535){O-=65536;var q=55296+(O>>10),k=56320+(O&1023);return String.fromCharCode(q,k)}return String.fromCharCode(O)}var d=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,u=/&([a-z#][a-z0-9]{1,31});/gi,h=new RegExp(d.source+"|"+u.source,"gi"),m=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i,g=_N;function _(O,q){var k;return i(g,q)?g[q]:q.charCodeAt(0)===35&&m.test(q)&&(k=q[1].toLowerCase()==="x"?parseInt(q.slice(2),16):parseInt(q.slice(1),10),a(k))?l(k):O}function f(O){return O.indexOf("\\")<0?O:O.replace(d,"$1")}function b(O){return O.indexOf("\\")<0&&O.indexOf("&"
|
|||
|
`};Mi.fence=function(n,e,t,r,i){var s=n[e],o=s.info?lbe(s.info).trim():"",a="",l="",d,u,h,m,g;return o&&(h=o.split(/(\s+)/g),a=h[0],l=h.slice(2).join("")),t.highlight?d=t.highlight(s.content,a,l)||Po(s.content):d=Po(s.content),d.indexOf("<pre")===0?d+`
|
|||
|
`:o?(u=s.attrIndex("class"),m=s.attrs?s.attrs.slice():[],u<0?m.push(["class",t.langPrefix+a]):(m[u]=m[u].slice(),m[u][1]+=" "+t.langPrefix+a),g={attrs:m},"<pre><code"+i.renderAttrs(g)+">"+d+`</code></pre>
|
|||
|
`):"<pre><code"+i.renderAttrs(s)+">"+d+`</code></pre>
|
|||
|
`};Mi.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)};Mi.hardbreak=function(n,e,t){return t.xhtmlOut?`<br />
|
|||
|
`:`<br>
|
|||
|
`};Mi.softbreak=function(n,e,t){return t.breaks?t.xhtmlOut?`<br />
|
|||
|
`:`<br>
|
|||
|
`:`
|
|||
|
`};Mi.text=function(n,e){return Po(n[e].content)};Mi.html_block=function(n,e){return n[e].content};Mi.html_inline=function(n,e){return n[e].content};function xl(){this.rules=abe({},Mi)}xl.prototype.renderAttrs=function(e){var t,r,i;if(!e.attrs)return"";for(i="",t=0,r=e.attrs.length;t<r;t++)i+=" "+Po(e.attrs[t][0])+'="'+Po(e.attrs[t][1])+'"';return i};xl.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+=`
|
|||
|
`),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?`>
|
|||
|
`:">",s)};xl.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};xl.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};xl.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 cbe=xl;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 Tv=di,dbe=/\r\n?|\n/g,ube=/\0/g,pbe=function(e){var t;t=e.src.replace(dbe,`
|
|||
|
`),t=t.replace(ube,"<22>"),e.src=t},fbe=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)},hbe=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)},mbe=Gt.arrayReplaceAt;function _be(n){return/^<a[>\s]/i.test(n)}function gbe(n){return/^<\/a\s*>/i.test(n)}var bbe=function(e){var t,r,i,s,o,a,l,d,u,h,m,g,_,f,b,v,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,_=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"&&(_be(a.content)&&_>0&&_--,gbe(a.content)&&_++),!(_>0)&&a.type==="text"&&e.md.linkify.test(a.content)){for(u=a.content,E=e.md.linkify.match(u),l=[],g=a.level,m=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++)f=E[d].url,b=e.md.normalizeLink(f),e.md.validateLink(b)&&(v=E[d].text,E[d].schema?E[d].schema==="mailto:"&&!/^mailto:/i.test(v)?v=e.md.normalizeLinkText("mailto:"+v).replace(/^mailto:/,""):v=e.md.normalizeLinkText(v):v=e.md.normalizeLinkText("http://"+v).replace(/^http:\/\//,""),h=E[d].index,h>m&&(o=new e.Token("text","",0),o.content=u.slice(m,h),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=v,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),m=E[d].lastIndex);m<u.length&&(o=new e.Token("text","",0),o.content=u.slice(m),o.level=g,l.push(o)),y[r].children=s=mbe(s,t,l)}}}},yN=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,vbe=/\((c|tm|r)\)/i,ybe=/\((c|tm|r)\)/ig,Ebe={c:"©",r:"®",tm:"™"};function Sbe(n,e){return Ebe[e.toLowerCase()]}function Tbe(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(ybe,Sbe)),t.type==="link_open"&&t.info==="auto"&&r--,t.type==="link_close"&&t.info==="auto"&&r++}function xbe(n){var e,t,r=0;for(e=n.length-1;e>=0;e--)t=n[e],t.type==="text"&&!r&&yN.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 wbe=function(e){var t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(vbe.test(e.tokens[t].content)&&Tbe(e.tokens[t].children),yN.test(e.tokens[t].content)&&xbe(e.tokens[t].children))},K1=Gt.isWhiteSpace,j1=Gt.isPunctChar,Q1=Gt.isMdAsciiPunct,Cbe=/['"]/,X1=/['"]/g,Z1="’";function xd(n,e,t){return n.slice(0,e)+t+n.slice(e+1)}function Rbe(n,e){var t,r,i,s,o,a,l,d,u,h,m,g,_,f,b,v,y,E,S,R,w;for(S=[],t=0;t<n.length;t++){for(r=n[t],l=n[t].level,y=S.length-1;y>=0&&!(S[y].level<=l);y--);if(S.length=y+1,r.type==="text"){i=r.content,o=0,a=i.length;e:for(;o<a&&(X1.lastIndex=o,s=X1.exec(i),!!s);){if(b=v=!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(h=32,o<a)h=i.charCodeAt(o);else for(y=t+1;y<n.length&&!(n[y].type==="softbreak"||n[y].type==="hardbreak");y++)if(n[y].content){h=n[y].content.charCodeAt(0);break}if(m=Q1(u)||j1(String.fromCharCode(u)),g=Q1(h)||j1(String.fromCharCode(h)),_=K1(u),f=K1(h),f?b=!1:g&&(_||m||(b=!1)),_?v=!1:m&&(f||g||(v=!1)),h===34&&s[0]==='"'&&u>=48&&u<=57&&(v=b=!1),b&&v&&(b=m,v=g),!b&&!v){E&&(r.content=xd(r.content,s.index,Z1));continue}if(v){for(y=S.length-1;y>=0&&(d=S[y],!(S[y].level<l));y--)if(d.single===E&&S[y].level===l){d=S[y],E?(R=e.md.options.quotes[2],w=e.md.options.quotes[
|
|||
|
`,o.map=[t,e.line],!0},Pbe=function(e,t,r,i){var s,o,a,l,d,u,h,m=!1,g=e.bMarks[t]+e.tShift[t],_=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||g+3>_||(s=e.src.charCodeAt(g),s!==126&&s!==96)||(d=g,g=e.skipChars(g,s),o=g-d,o<3)||(h=e.src.slice(d,g),a=e.src.slice(g,_),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],_=e.eMarks[l],g<_&&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<_)))){m=!0;break}return o=e.sCount[t],e.line=l+(m?1:0),u=e.push("fence","code",0),u.info=a,u.content=e.getLines(t+1,l,o,!0),u.markup=h,u.map=[t,e.line],!0},Fbe=Gt.isSpace,Ube=function(e,t,r,i){var s,o,a,l,d,u,h,m,g,_,f,b,v,y,E,S,R,w,A,I,x=e.lineMax,M=e.bMarks[t]+e.tShift[t],z=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(M)!==62)return!1;if(i)return!0;for(_=[],f=[],y=[],E=[],w=e.md.block.ruler.getRules("blockquote"),v=e.parentType,e.parentType="blockquote",m=t;m<r&&(I=e.sCount[m]<e.blkIndent,M=e.bMarks[m]+e.tShift[m],z=e.eMarks[m],!(M>=z));m++){if(e.src.charCodeAt(M++)===62&&!I){for(l=e.sCount[m]+1,e.src.charCodeAt(M)===32?(M++,l++,s=!1,S=!0):e.src.charCodeAt(M)===9?(S=!0,(e.bsCount[m]+l)%4===3?(M++,l++,s=!1):s=!0):S=!1,g=l,_.push(e.bMarks[m]),e.bMarks[m]=M;M<z&&(o=e.src.charCodeAt(M),Fbe(o));){o===9?g+=4-(g+e.bsCount[m]+(s?1:0))%4:g++;M++}u=M>=z,f.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+(S?1:0),y.push(e.sCount[m]),e.sCount[m]=g-l,E.push(e.tShift[m]),e.tShift[m]=M-e.bMarks[m];continue}if(u)break;for(R=!1,a=0,d=w.length;a<d;a++)if(w[a](e,m,r,!0)){R=!0;break}if(R){e.lineMax=m,e.blkIndent!==0&&(_.push(e.bMarks[m]),f.push(e.bsCount[m]),E.push(e.tShift[m]),y.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}_.push(e.bMarks[m]),f.push(e.bsCount[m]),E.push(e.tShift[m]),y.push(e.sCount[m]),e.sCount[m]=-1}for(b=e.blkIndent,e.blkIndent=0,A=e.push("blockquote_open","blockquote",1),A.markup=">",A.map=h=[t,0],e.md.block.tokenize(e,t,m),A=e.push("blockquote_close","blockquote",-1),A.markup=">",e.lineMax=x,e.parentType=v,h[1]=e.line,a=0;a<E.length;a++)e.bMarks[a+t]=_[a],e.tShift[a+t]=E[a],e.sCount[a+t]=y[a],e.bsCount[a+t]=f[a];return e.blkIndent=b,!0},Bbe=Gt.isSpace,Gbe=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&&!Bbe(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=Gt.isSpace;function eS(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 tS(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 zbe(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 Vbe=function(e,t,r,i){var s,o,a,l,d,u,h,m,g,_,f,b,v,y,E,S,R,w,A,I,x,M,z,V,J,O,q,k=t,G=!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&&(G=!0),(M=tS(e,k))>=0){if(h=!0,V=e.bMarks[k]+e.tShift[k],v=Number(e.src.slice(V,M-1)),G&&v!==1)return!1}else if((M=eS(e,k))>=0)h=!1;else return!1;if(G&&e.skipSpaces(M)>=e.eMarks[k])return!1;if(i)return!0;for(b=e.src.charCodeAt(M-1),f=e.tokens.length,h?(q=e.push("ordered_list_open","ol",1),v!==1&&(q.attrs=[["start",v]])):q=e.push("bullet_list_open","ul",1),q.map=_=[k,0],q.markup=String.fromCharCode(b),z=!1,O=e.md.block.ruler.getRules("list"),R=e.parentType,e.parentType="list";k<r;){for(x=M,y=e.eMarks[k],u=E=e.sCount[k]+M-(e.bMarks[k]+e.tShift[k]);x<y;){
|
|||
|
]+)|(---?|[!-\\[\\]-‧-豈-]|[\uD800-\uDBFF][\uDC00-\uDFFF]|\\\\(?:[a-zA-Z]+|[^\uD800-\uDFFF]))`),Bv=/\s*/;Cl.prototype._innerLex=function(n,e){var t=this._input;if(n===t.length)return new La("EOF",null,n);var r=ja(m1e,t,n);if(r===null)throw new Xu("Unexpected character: '"+t[n]+"'",this,n);return r[2]?new La(r[2],null,n+r[2].length):e?this._innerLex(n+r[1].length,!0):new La(" ",null,n+r[1].length)};var _1e=/#[a-z0-9]+|[a-z]+/i;Cl.prototype._innerLexColor=function(n){var e=this._input,t=ja(Bv,e,n)[0];n+=t.length;var r;if(r=ja(_1e,e,n))return new La(r[0],null,n+r[0].length);throw new Xu("Invalid color",this,n)};var g1e=/(-?)\s*(\d+(?:\.\d*)?|\.\d+)\s*([a-z]{2})/;Cl.prototype._innerLexSize=function(n){var e=this._input,t=ja(Bv,e,n)[0];n+=t.length;var r;if(r=ja(g1e,e,n)){var i=r[3];if(i!=="em"&&i!=="ex")throw new Xu("Invalid unit: '"+i+"'",this,n);return new La(r[0],{number:+(r[1]+r[2]),unit:i},n+r[0].length)}throw new Xu("Invalid size",this,n)};Cl.prototype._innerLexWhitespace=function(n){var e=this._input,t=ja(Bv,e,n)[0];return n+=t.length,new La(t[0],null,n)};Cl.prototype.lex=function(n,e){if(e==="math")return this._innerLex(n,!0);if(e==="text")return this._innerLex(n,!1);if(e==="color")return this._innerLexColor(n);if(e==="size")return this._innerLexSize(n);if(e==="whitespace")return this._innerLexWhitespace(n)};var b1e=Cl,td=c1e,wS=u1e,v1e=b1e,CS=sf,bh=is,y1e=iO,Gr=Ks;function Tn(n,e){this.lexer=new v1e(n),this.settings=e}var An=y1e.ParseNode;function Qa(n,e){this.result=n,this.isFunction=e}Tn.prototype.expect=function(n,e){if(this.nextToken.text!==n)throw new Gr("Expected '"+n+"', got '"+this.nextToken.text+"'",this.lexer,this.nextToken.position);e!==!1&&this.consume()};Tn.prototype.consume=function(){this.pos=this.nextToken.position,this.nextToken=this.lexer.lex(this.pos,this.mode)};Tn.prototype.parse=function(){this.mode="math",this.pos=0,this.nextToken=this.lexer.lex(this.pos,this.mode);var n=this.parseInput();return n};Tn.prototype.parseInput=function(){var n=this.parseExpression(!1);return this.expect("EOF",!1),n};var E1e=["}","\\end","\\right","&","\\\\","\\cr"];Tn.prototype.parseExpression=function(n,e){for(var t=[];;){var r=this.nextToken,i=this.pos;if(E1e.indexOf(r.text)!==-1||e&&r.text===e)break;var s=this.parseAtom();if(!s){if(!this.settings.throwOnError&&r.text[0]==="\\"){var o=this.handleUnsupportedCmd();t.push(o),i=r.position;continue}break}if(n&&s.type==="infix"){this.pos=i,this.nextToken=r;break}t.push(s)}return this.handleInfixNodes(t)};Tn.prototype.handleInfixNodes=function(n){for(var e=-1,t,r=0;r<n.length;r++){var i=n[r];if(i.type==="infix"){if(e!==-1)throw new Gr("only one infix operator per group",this.lexer,-1);e=r,t=i.value.replaceWith}}if(e!==-1){var s,o,a=n.slice(0,e),l=n.slice(e+1);a.length===1&&a[0].type==="ordgroup"?s=a[0]:s=new An("ordgroup",a,this.mode),l.length===1&&l[0].type==="ordgroup"?o=l[0]:o=new An("ordgroup",l,this.mode);var d=this.callFunction(t,[s,o],null);return[new An(d.type,d,this.mode)]}else return n};var S1e=1;Tn.prototype.handleSupSubscript=function(n){var e=this.nextToken.text,t=this.pos;this.consume();var r=this.parseGroup();if(r)if(r.isFunction){var i=td[r.result].greediness;if(i>S1e)return this.parseFunction(r);throw new Gr("Got function '"+r.result+"' with no arguments as "+n,this.lexer,t+1)}else return r.result;else{if(!this.settings.throwOnError&&this.nextToken.text[0]==="\\")return this.handleUnsupportedCmd();throw new Gr("Expected group after '"+e+"'",this.lexer,t+1)}};Tn.prototype.handleUnsupportedCmd=function(){for(var n=this.nextToken.text,e=[],t=0;t<n.length;t++)e.push(new An("textord",n[t],"text"));var r=new An("text",{body:e,type:"text"},this.mode),i=new An("color",{color:this.settings.errorColor,value:[r],type:"color"},this.mode);return this.consume(),i};Tn.prototype.parseAtom=function(){var n=this.parseImplicitGroup();if(this.mode==="text")return n;for(var e,t;;){var r=this.nextToken;if(r.text==="\\limits"||r.text==="\\nolimits"){if(!n||n.type!=="op")throw new Gr("Limit controls must follow a math operator",this.lexer,this.pos);var i=r.text==="
|
|||
|
`:"")+n.getLines(e+1,o,n.tShift[e],!0)+(s&&s.trim()?s:""),d.map=[e,n.line],d.markup="$$",!0}var D1e=function(e,t){t=t||{};var r=function(a){t.displayMode=!1;try{return AS.renderToString(a,t)}catch(l){return t.throwOnError&&console.log(l),a}},i=function(a,l){return r(a[l].content)},s=function(a){t.displayMode=!0;try{return"<p>"+AS.renderToString(a,t)+"</p>"}catch(l){return t.throwOnError&&console.log(l),a}},o=function(a,l){return s(a[l].content)+`
|
|||
|
`};e.inline.ruler.after("escape","math_inline",I1e),e.block.ruler.after("blockquote","math_block",k1e,{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules.math_inline=i,e.renderer.rules.math_block=o};const L1e=Ws(D1e),P1e="😀",F1e="😃",U1e="😄",B1e="😁",G1e="😆",z1e="😆",V1e="😅",H1e="🤣",q1e="😂",Y1e="🙂",$1e="🙃",W1e="😉",K1e="😊",j1e="😇",Q1e="🥰",X1e="😍",Z1e="🤩",J1e="😘",eSe="😗",tSe="☺️",nSe="😚",rSe="😙",iSe="🥲",sSe="😋",oSe="😛",aSe="😜",lSe="🤪",cSe="😝",dSe="🤑",uSe="🤗",pSe="🤭",fSe="🤫",hSe="🤔",mSe="🤐",_Se="🤨",gSe="😐",bSe="😑",vSe="😶",ySe="😏",ESe="😒",SSe="🙄",TSe="😬",xSe="🤥",wSe="😌",CSe="😔",RSe="😪",ASe="🤤",MSe="😴",NSe="😷",OSe="🤒",ISe="🤕",kSe="🤢",DSe="🤮",LSe="🤧",PSe="🥵",FSe="🥶",USe="🥴",BSe="😵",GSe="🤯",zSe="🤠",VSe="🥳",HSe="🥸",qSe="😎",YSe="🤓",$Se="🧐",WSe="😕",KSe="😟",jSe="🙁",QSe="☹️",XSe="😮",ZSe="😯",JSe="😲",eTe="😳",tTe="🥺",nTe="😦",rTe="😧",iTe="😨",sTe="😰",oTe="😥",aTe="😢",lTe="😭",cTe="😱",dTe="😖",uTe="😣",pTe="😞",fTe="😓",hTe="😩",mTe="😫",_Te="🥱",gTe="😤",bTe="😡",vTe="😡",yTe="😠",ETe="🤬",STe="😈",TTe="👿",xTe="💀",wTe="☠️",CTe="💩",RTe="💩",ATe="💩",MTe="🤡",NTe="👹",OTe="👺",ITe="👻",kTe="👽",DTe="👾",LTe="🤖",PTe="😺",FTe="😸",UTe="😹",BTe="😻",GTe="😼",zTe="😽",VTe="🙀",HTe="😿",qTe="😾",YTe="🙈",$Te="🙉",WTe="🙊",KTe="💋",jTe="💌",QTe="💘",XTe="💝",ZTe="💖",JTe="💗",exe="💓",txe="💞",nxe="💕",rxe="💟",ixe="❣️",sxe="💔",oxe="❤️",axe="🧡",lxe="💛",cxe="💚",dxe="💙",uxe="💜",pxe="🤎",fxe="🖤",hxe="🤍",mxe="💢",_xe="💥",gxe="💥",bxe="💫",vxe="💦",yxe="💨",Exe="🕳️",Sxe="💣",Txe="💬",xxe="👁️🗨️",wxe="🗨️",Cxe="🗯️",Rxe="💭",Axe="💤",Mxe="👋",Nxe="🤚",Oxe="🖐️",Ixe="✋",kxe="✋",Dxe="🖖",Lxe="👌",Pxe="🤌",Fxe="🤏",Uxe="✌️",Bxe="🤞",Gxe="🤟",zxe="🤘",Vxe="🤙",Hxe="👈",qxe="👉",Yxe="👆",$xe="🖕",Wxe="🖕",Kxe="👇",jxe="☝️",Qxe="👍",Xxe="👎",Zxe="✊",Jxe="✊",e2e="👊",t2e="👊",n2e="👊",r2e="🤛",i2e="🤜",s2e="👏",o2e="🙌",a2e="👐",l2e="🤲",c2e="🤝",d2e="🙏",u2e="✍️",p2e="💅",f2e="🤳",h2e="💪",m2e="🦾",_2e="🦿",g2e="🦵",b2e="🦶",v2e="👂",y2e="🦻",E2e="👃",S2e="🧠",T2e="🫀",x2e="🫁",w2e="🦷",C2e="🦴",R2e="👀",A2e="👁️",M2e="👅",N2e="👄",O2e="👶",I2e="🧒",k2e="👦",D2e="👧",L2e="🧑",P2e="👱",F2e="👨",U2e="🧔",B2e="👨🦰",G2e="👨🦱",z2e="👨🦳",V2e="👨🦲",H2e="👩",q2e="👩🦰",Y2e="🧑🦰",$2e="👩🦱",W2e="🧑🦱",K2e="👩🦳",j2e="🧑🦳",Q2e="👩🦲",X2e="🧑🦲",Z2e="👱♀️",J2e="👱♀️",ewe="👱♂️",twe="🧓",nwe="👴",rwe="👵",iwe="🙍",swe="🙍♂️",owe="🙍♀️",awe="🙎",lwe="🙎♂️",cwe="🙎♀️",dwe="🙅",uwe="🙅♂️",pwe="🙅♂️",fwe="🙅♀️",hwe="🙅♀️",mwe="🙆",_we="🙆♂️",gwe="🙆♀️",bwe="💁",vwe="💁",ywe="💁♂️",Ewe="💁♂️",Swe="💁♀️",Twe="💁♀️",xwe="🙋",wwe="🙋♂️",Cwe="🙋♀️",Rwe="🧏",Awe="🧏♂️",Mwe="🧏♀️",Nwe="🙇",Owe="🙇♂️",Iwe="🙇♀️",kwe="🤦",Dwe="🤦♂️",Lwe="🤦♀️",Pwe="🤷",Fwe="🤷♂️",Uwe="🤷♀️",Bwe="🧑⚕️",Gwe="👨⚕️",zwe="👩⚕️",Vwe="🧑🎓",Hwe="👨🎓",qwe="👩🎓",Ywe="🧑🏫",$we="👨🏫",Wwe="👩🏫",Kwe="🧑⚖️",jwe="👨⚖️",Qwe="👩⚖️",Xwe="🧑🌾",Zwe="👨🌾",Jwe="👩🌾",eCe="🧑🍳",tCe="👨🍳",nCe="👩🍳",rCe="🧑🔧",iCe="👨🔧",sCe="👩🔧",oCe="🧑🏭",aCe="👨🏭",lCe="👩🏭",cCe="🧑💼",dCe="👨💼",uCe="👩<>
|
|||
|
`})),r.tokens.splice(i+3+u.length+1,0,Object.assign(new r.Token("html_block","",0),{content:e.wrapper[1]+`
|
|||
|
`})))});function IS(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 Sa(n,e){e=Object.assign({},Sa.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(h){return r.includes(h)}):function(h){return function(m){return m>=h}}(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?IS(e.slugify(d),i,!1,e.uniqueSlugStartIndex):IS(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!==db)&&e.renderPermalink(u,e,t,a),a=s.indexOf(l),e.callback&&e.callback(l,{slug:u,title:d})}}})}Object.assign(OS.defaults,{style:"visually-hidden",space:!0,placement:"after",wrapper:null}),Sa.permalink={__proto__:null,legacy:db,renderHref:lO,renderAttrs:cO,makePermalink:nd,linkInsideHeader:cf,ariaHidden:uo,headerLink:dO,linkAfterHeader:OS},Sa.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:db,permalinkClass:uo.defaults.class,permalinkSpace:uo.defaults.space,permalinkSymbol:"¶",permalinkBefore:uo.defaults.placement==="before",permalinkHref:uo.defaults.renderHref,permalinkAttrs:uo.defaults.renderAttrs},Sa.default=Sa;function ss(){this.__highest_alphabet__=0,this.__match_alphabets__={},this.__initial_state__=0,this.__accept_states__={},this.__transitions__={},this.__actions__={}}ss.prototype.set_highest_alphabet=function(n){this.__highest_alphabet__=n};ss.prototype.set_match_alphabets=function(n){this.__match_alphabets__=n};ss.prototype.set_initial_state=function(n){this.__initial_state__=n};ss.prototype.set_accept_states=function(n){for(var e=0;e<n.length;e++)this.__accept_states__[n[e]]=!0};ss.prototype.set_transitions=function(n){this.__transitions__=n};ss.prototype.set_actions=function(n){this.__actions__=n};ss.prototype.update_transition=function(n,e){this.__transitions__[n]=Object.assign(this.__transitions__[n]||Object(),e)};ss.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 zWe=ss,VWe=zWe,HWe=function(e,t){var r={multiline:!1,rowspan:!1,headerless:!1,multibody:!0,autolabel:!0};t=e.utils.assign({},r,t||{});function i(u,h){var m=u.bMarks[h]+u.sCount[h],g=u.bMarks[h]+u.blkIndent,_=u.skipSpacesBack(u.eMarks[h],g),f=[],b,v,y=!1,E=!1,S=0;for(b=m;b<_;b++)switch(u.src.charCodeAt(b)){case 92:y=!0;break;case 96:v=u.skipChars(b,96)-1,v>b?(E||(S===0?S=v-b:S===v-b&&(S=0)),b=v):(E||!y&&!S)&&(E=!E),y=!1;break;case 124:!E&&!y&&f.push(b),y=!1;break;default:y=!1;break}return f.length===0||(f[0]>g&&f.unshift(g-1),f[f.length-1]<_-1&&f.push(_)),f}function s(u,h,m){var g={text:null,label:null},_=u.bMarks[m]+u.sCount[m],f=u.eMarks[m],b=/^\[(.+?)\](\[([^\[\]]+)\])?\s*$/,v=u.src.slice(_,f).match(b);return v?h?!0:(g.text=v[1],!t.autolabel&&!v[2]||(g.label=v[2]||v[1],g.label=g.label.toLowerCase().replace(/\W+/g,"")),g):!1}function o(u,h,m){var g={bounds:null,multiline:null},_=i(u,m),f,b,v;return _.length<2?!1:h?!0:(g.bounds=_,t.multiline&&(f=u.bMarks[m]+u.sCount[m],b=u.eMarks[m]-1,g.multiline=u.src.charCodeAt(b)===92,g.multiline&&(v=u.eMarks[m],u.eMarks[m]=u.skipSpacesBack(b,f),g.bounds=i(u,m),u.eMarks[m]=v)),g)}function a(u,h,m){var g={aligns:[],wraps:[]},_=i(u,m),f=/^:?(-+|=+):?\+?$/,b,v,y;if(u.sCount[m]-u.bl
|
|||
|
`),u.md,u.env,[]),G.level=E.level+1,u.md.block.tokenize(G,E.map[0],G.lineMax),k=0;k<G.tokens.length;k++)u.tokens.push(G.tokens[k])}else v=u.push("inline","",0),v.content=z.trim(),v.map=E.map,v.level=E.level+1,v.children=[];v=u.push(M+"_close",M,-1)}u.push("tr_close","tr",-1),E.meta.grp&1&&(M=E.meta.type===256?"thead":"tbody",v=u.push(M+"_close",M,-1),x[1]=E.map[1])}return I[1]=Math.max(x[1],y.meta.sep.map[1],y.meta.cap?y.meta.cap.map[1]:-1),v=u.push("table_close","table",-1),u.line=I[1],!0}e.block.ruler.at("table",d,{alt:["paragraph","reference"]})};const qWe=Ws(HWe);var YWe=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 h=t.copyAttrs===!0?"":t.copyAttrs;d.attrs=u.attrs.filter(([m,g])=>m.match(h))}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 $We=Ws(YWe),WWe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Xs={};Xs.getAttrs=function(n,e,t){const r=/[^\t\n\f />"'=]/,i=" ",s="=",o=".",a="#",l=[];let d="",u="",h=!0,m=!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 _=n.charAt(g);if(_===s&&h){h=!1;continue}if(_===o&&d===""){n.charAt(g+1)===o?(d="css-module",g+=1):d="class",h=!1;continue}if(_===a&&d===""){d="id",h=!1;continue}if(_==='"'&&u===""&&!m){m=!0;continue}if(_==='"'&&m){m=!1;continue}if(_===i&&!m){if(d==="")continue;l.push([d,u]),d="",u="",h=!0;continue}if(!(h&&_.search(r)===-1)){if(h){d+=_;continue}u+=_}}if(t.allowedAttributes&&t.allowedAttributes.length){const g=t.allowedAttributes;return l.filter(function(_){const f=_[0];function b(v){return f===v||v instanceof RegExp&&v.test(f)}return g.some(b)})}return l};Xs.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};Xs.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 h=u.charAt(e.leftDelimiter.length)===".",m=u.charAt(e.leftDelimiter.length)==="#";return h||m?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:Mt.hasDelimiters("only",n)}]}],transform:(t,r,i)=>{const s=t[r].children[i],o=Mt.getAttrs(s.content,0,n);let a=r+1;for(;t[a+1]&&t[a+1].nesting===-1;)a++;const l=Mt.getMatchingOpeningToken(t,a);Mt.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=Mt.getAttrs(s,o,n);Mt.addAttrs(a,i),i.markup=s,t.splice(r+1,2)}},{name:"end of block",tests:[{shift:0,type:"inline",children:[{position:-1,content:Mt.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=Mt.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=Mt.getMatchingOpeningToken(t,l);Mt.addAttrs(a,d);const u=o.slice(0,o.lastIndexOf(n.leftDelimiter));s.content=kS(u)!==" "?u:u.slice(0,-1)}}]};function kS(n){return n.slice(-1)[0]}const JWe=ZWe,eKe={leftDelimiter:"{",rightDelimiter:"}",allowedAttributes:[]};var tKe=function(e,t){let r=Object.assign({},eKe);r=Object.assign(r,t);const i=JWe(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 h=null;u.tests.every(g=>{const _=pb(a,l,g);return _.j!==null&&(h=_.j),_.match})&&(u.transform(a,l,h),(u.name==="inline attributes"||u.name==="inline nesting 0")&&d--)}}e.core.ruler.before("linkify","curly_attributes",s)};function pb(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=iKe(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"&&nKe(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=>pb(d,u.position,u).match),a){const u=sKe(l).position;r.j=u>=0?u:d.length+u}}else for(let u=0;u<d.length;u++)if(a=l.every(h=>pb(d,u,h).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(rKe(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 nKe(n){return Array.isArray(n)&&n.length&&n.every(e=>typeof e=="object")}function rKe(n){return Array.isArray(n)&&n.length&&n.every(e=>typeof e=="function")}function iKe(n,e){return e>=0?n[e]:n[n.length+e]}function sKe(n){return n.slice(-1)[0]||{}}const oKe=Ws(tKe);function uO(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)&&uO(t)}),n}let DS=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function pO(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ks(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 aKe="</span>",LS=n=>!!n.scope,lKe=(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 cKe{constructor(e,t){this.buffer="",this.classPrefix=t.classPref
|
|||
|
https://github.com/highlightjs/highlight.js/issues/2277`),le=k,oe=G),Z===void 0&&(Z=!0);const Te={code:oe,language:le};O("before:highlight",Te);const xe=Te.result?Te.result:h(Te.language,Te.code,Z);return xe.code=Te.code,O("after:highlight",xe),xe}function h(k,G,Z,oe){const le=Object.create(null);function Te($,te){return $.keywords[te]}function xe(){if(!ie.keywords){ve.addText(ye);return}let $=0;ie.keywordPatternRe.lastIndex=0;let te=ie.keywordPatternRe.exec(ye),ue="";for(;te;){ue+=ye.substring($,te.index);const Me=Q.case_insensitive?te[0].toLowerCase():te[0],Oe=Te(ie,Me);if(Oe){const[De,Je]=Oe;if(ve.addText(ue),ue="",le[Me]=(le[Me]||0)+1,le[Me]<=ZKe&&(Re+=Je),De.startsWith("_"))ue+=te[0];else{const ut=Q.classNameAliases[De]||De;Ie(te[0],ut)}}else ue+=te[0];$=ie.keywordPatternRe.lastIndex,te=ie.keywordPatternRe.exec(ye)}ue+=ye.substring($),ve.addText(ue)}function de(){if(ye==="")return;let $=null;if(typeof ie.subLanguage=="string"){if(!e[ie.subLanguage]){ve.addText(ye);return}$=h(ie.subLanguage,ye,!0,Ce[ie.subLanguage]),Ce[ie.subLanguage]=$._top}else $=g(ye,ie.subLanguage.length?ie.subLanguage:null);ie.relevance>0&&(Re+=$.relevance),ve.__addSublanguage($._emitter,$.language)}function he(){ie.subLanguage!=null?de():xe(),ye=""}function Ie($,te){$!==""&&(ve.startScope(te),ve.addText($),ve.endScope())}function Be($,te){let ue=1;const Me=te.length-1;for(;ue<=Me;){if(!$._emit[ue]){ue++;continue}const Oe=Q.classNameAliases[$[ue]]||$[ue],De=te[ue];Oe?Ie(De,Oe):(ye=De,xe(),ye=""),ue++}}function j($,te){return $.scope&&typeof $.scope=="string"&&ve.openNode(Q.classNameAliases[$.scope]||$.scope),$.beginScope&&($.beginScope._wrap?(Ie(ye,Q.classNameAliases[$.beginScope._wrap]||$.beginScope._wrap),ye=""):$.beginScope._multi&&(Be($.beginScope,te),ye="")),ie=Object.create($,{parent:{value:ie}}),ie}function me($,te,ue){let Me=hKe($.endRe,ue);if(Me){if($["on:end"]){const Oe=new DS($);$["on:end"](te,Oe),Oe.isMatchIgnored&&(Me=!1)}if(Me){for(;$.endsParent&&$.parent;)$=$.parent;return $}}if($.endsWithParent)return me($.parent,te,ue)}function _e($){return ie.matcher.regexIndex===0?(ye+=$[0],1):(K=!0,0)}function we($){const te=$[0],ue=$.rule,Me=new DS(ue),Oe=[ue.__beforeBegin,ue["on:begin"]];for(const De of Oe)if(De&&(De($,Me),Me.isMatchIgnored))return _e(te);return ue.skip?ye+=te:(ue.excludeBegin&&(ye+=te),he(),!ue.returnBegin&&!ue.excludeBegin&&(ye=te)),j(ue,$),ue.returnBegin?0:te.length}function Fe($){const te=$[0],ue=G.substring($.index),Me=me(ie,$,ue);if(!Me)return GS;const Oe=ie;ie.endScope&&ie.endScope._wrap?(he(),Ie(te,ie.endScope._wrap)):ie.endScope&&ie.endScope._multi?(he(),Be(ie.endScope,$)):Oe.skip?ye+=te:(Oe.returnEnd||Oe.excludeEnd||(ye+=te),he(),Oe.excludeEnd&&(ye=te));do ie.scope&&ve.closeNode(),!ie.skip&&!ie.subLanguage&&(Re+=ie.relevance),ie=ie.parent;while(ie!==Me.parent);return Me.starts&&j(Me.starts,$),Oe.returnEnd?0:te.length}function re(){const $=[];for(let te=ie;te!==Q;te=te.parent)te.scope&&$.unshift(te.scope);$.forEach(te=>ve.openNode(te))}let P={};function U($,te){const ue=te&&te[0];if(ye+=$,ue==null)return he(),0;if(P.type==="begin"&&te.type==="end"&&P.index===te.index&&ue===""){if(ye+=G.slice(te.index,te.index+1),!i){const Me=new Error(`0 width match regex (${k})`);throw Me.languageName=k,Me.badRule=P.rule,Me}return 1}if(P=te,te.type==="begin")return we(te);if(te.type==="illegal"&&!Z){const Me=new Error('Illegal lexeme "'+ue+'" for mode "'+(ie.scope||"<unnamed>")+'"');throw Me.mode=ie,Me}else if(te.type==="end"){const Me=Fe(te);if(Me!==GS)return Me}if(te.type==="illegal"&&ue==="")return ye+=`
|
|||
|
`,1;if(N>1e5&&N>te.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ye+=ue,ue.length}const Q=I(k);if(!Q)throw Ro(s.replace("{}",k)),new Error('Unknown language: "'+k+'"');const pe=KKe(Q);let fe="",ie=oe||pe;const Ce={},ve=new a.__emitter(a);re();let ye="",Re=0,L=0,N=0,K=!1;try{if(Q.__emitTokens)Q.__emitTokens(G,ve);else{for(ie.matcher.considerAll();;){N++,K?K=!1:ie.matcher.considerAll(),ie.matcher.lastIndex=L;const $=ie.matcher.exec(G);if(!$)break;const te=G.substring(L,$.index),ue=U(te,$);L=$.index+ue}U(G.substring(L))}return ve.finalize(),fe=ve.toHTML(),{language:k,value:fe,relevance:Re,illegal:!1,_emitter:ve,_top:ie}}catch($){if($.message&&$.message.includes("Illegal"))return{language:k,value:vh(G),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:L,context:G.slice(L-100,L+100),mode:$.mode,resultSoFar:fe},_emitter:ve};if(i)return{language:k,value:vh(G),illegal:!1,relevance:0,errorRaised:$,_emitter:ve,_top:ie};throw $}}function m(k){const G={value:vh(k),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return G._emitter.addText(k),G}function g(k,G){G=G||a.languages||Object.keys(e);const Z=m(k),oe=G.filter(I).filter(M).map(he=>h(he,k,!1));oe.unshift(Z);const le=oe.sort((he,Ie)=>{if(he.relevance!==Ie.relevance)return Ie.relevance-he.relevance;if(he.language&&Ie.language){if(I(he.language).supersetOf===Ie.language)return 1;if(I(Ie.language).supersetOf===he.language)return-1}return 0}),[Te,xe]=le,de=Te;return de.secondBest=xe,de}function _(k,G,Z){const oe=G&&t[G]||Z;k.classList.add("hljs"),k.classList.add(`language-${oe}`)}function f(k){let G=null;const Z=d(k);if(l(Z))return;if(O("before:highlightElement",{el:k,language:Z}),k.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",k);return}if(k.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(k)),a.throwUnescapedHTML))throw new XKe("One of your code blocks includes unescaped HTML.",k.innerHTML);G=k;const oe=G.textContent,le=Z?u(oe,{language:Z,ignoreIllegals:!0}):g(oe);k.innerHTML=le.value,k.dataset.highlighted="yes",_(k,Z,le.language),k.result={language:le.language,re:le.relevance,relevance:le.relevance},le.secondBest&&(k.secondBest={language:le.secondBest.language,relevance:le.secondBest.relevance}),O("after:highlightElement",{el:k,result:le,text:oe})}function b(k){a=BS(a,k)}const v=()=>{S(),ta("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){S(),ta("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function S(){function k(){S()}if(document.readyState==="loading"){E||window.addEventListener("DOMContentLoaded",k,!1),E=!0;return}document.querySelectorAll(a.cssSelector).forEach(f)}function R(k,G){let Z=null;try{Z=G(n)}catch(oe){if(Ro("Language definition for '{}' could not be registered.".replace("{}",k)),i)Ro(oe);else throw oe;Z=o}Z.name||(Z.name=k),e[k]=Z,Z.rawDefinition=G.bind(null,n),Z.aliases&&x(Z.aliases,{languageName:k})}function w(k){delete e[k];for(const G of Object.keys(t))t[G]===k&&delete t[G]}function A(){return Object.keys(e)}function I(k){return k=(k||"").toLowerCase(),e[k]||e[t[k]]}function x(k,{languageName:G}){typeof k=="string"&&(k=[k]),k.forEach(Z=>{t[Z.toLowerCase()]=G})}function M(k){const G=I(k);return G&&!G.disableAutodetect}function z(k){k["before:highlightBlock"]&&!k["before:highlightElement"]&&(k["before:highlightElement"]=G=>{k["before:highlightBlock"](Object.assign({block:G.el},G))}),k["after:highlightBlock"]&&!k["after:highlightElement"]&&(k["after:highlightElement"]=G=>{k["after:highlightBlock"](Object.assign({block:G.el},G))})}function V(k){z(k),r.push(k)}function J(k){const G=r.indexOf(k);G!==-1&&r.splice(G,1)}function O(k,G){const Z=k;r.forEach(function(oe){oe[Z]&&oe[Z](G)})}function q(k){return ta("10.7.0","highlig
|
|||
|
`},_]}}return i_=i,i_}var s_,Cx;function BQe(){if(Cx)return s_;Cx=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 s_=n,s_}var o_,Rx;function GQe(){if(Rx)return o_;Rx=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(z=>z+"(?![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-
|
|||
|
]`,f={scope:"string",variants:[h,u,m,g]},b={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},v=["false","null","true"],y=["__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"],E=["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"],R={keyword:y,literal:(q=>{const k=[];return q.forEach(G=>{k.push(G),G.toLowerCase()===G?k.push(G.toUpperCase()):k.push(G.toLowerCase())}),k})(v),built_in:E},w=q=>q.map(k=>k.replace(/\|\d+$/,"")),A={variants:[{match:[/new/,t.concat(_,"+"),t.concat("(?!",w(E).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},I=t.concat(i,"\\b(?!\\()"),x={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),I],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),I],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"}}]},M={scope:"attr",match:t.concat(i,t.lookahead(":"),t.lookahead(/(?!::)/))},z={relevance:0,begin:/\(/,end:/\)/,keywords:R,contains:[M,a,x,e.C_BLOCK_COMMENT_MODE,f,b,A]},V={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",w(y).join("\\b|"),"|",w(E).join("\\b|"),"\\b)"),i,t.concat(_,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[z]};z.contains.push(V);const J=[M,x,e.C_BLOCK_COMMENT_MODE,f,b,A],O={begin:t.concat(/#\[\s*\\?/,t.either(s,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self"
|
|||
|
]*;`,relevance:0},{begin:"[vp][0-9]+"}]}}return bg=n,bg}var vg,G2;function JXe(){if(G2)return vg;G2=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 vg=n,vg}var yg,z2;function eZe(){if(z2)return yg;z2=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 yg=n,yg}var Eg,V2;function tZe(){if(V2)return Eg;V2=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
|
|||
|
]*?"'`},{begin:`"[^\r
|
|||
|
"]*"`}]},{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 xg=n,xg}var wg,$2;function sZe(){if($2)return wg;$2=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 wg=n,wg}var Cg,W2;function oZe(){if(W2)return Cg;W2=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
|
|||
|
(multipart)?`,end:`\\]
|
|||
|
`},{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 Rg=n,Rg}var Ag,j2;function lZe(){if(j2)return Ag;j2=1;function n(I){return I?typeof I=="string"?I:I.source:null}function e(I){return t("(?=",I,")")}function t(...I){return I.map(M=>n(M)).join("")}function r(I){const x=I[I.length-1];return typeof x=="object"&&x.constructor===Object?(I.splice(I.length-1,1),x):{}}function i(...I){return"("+(r(I).capture?"":"?:")+I.map(z=>n(z)).join("|")+")"}const s=I=>t(/\b/,I,/\w$/.test(I)?/\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"],h=["assignment","associativity","higherThan","left","lowerThan","none","right"],m=["#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"],_=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]/),f=i(_,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),b=t(_,f,"*"),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(v,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),E=t(v,y,"*"),S=t(/[A-Z]/,y,"*"),R=["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=Bo.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),Pe(()=>{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)})}}},DZe={class:"bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},LZe={class:"hljs p-1 rounded-md break-all grid grid-cols-1"},PZe={class:"code-container"},FZe=["innerHTML"],UZe={class:"flex flex-row bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},BZe={class:"text-2xl mr-2"},GZe=["title"],zZe={key:0,class:"text-2xl"},VZe={key:1,class:"hljs mt-0 p-1 rounded-md break-all grid grid-cols-1"},HZe={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"},qZe=["innerHTML"];function YZe(n,e,t,r,i,s){return T(),C("div",DZe,[c("pre",LZe,[e[9]||(e[9]=Qe(" ")),c("div",PZe,[e[7]||(e[7]=Qe(`
|
|||
|
`)),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,FZe),e[8]||(e[8]=Qe(`
|
|||
|
`))]),e[10]||(e[10]=Qe(`
|
|||
|
|
|||
|
`))]),c("div",UZe,[c("span",BZe,Y(t.language.trim()),1),c("button",{onClick:e[1]||(e[1]=(...o)=>s.copyCode&&s.copyCode(...o)),title:i.isCopied?"Copied!":"Copy code",class:Le([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,GZe),["function","python","sh","shell","bash","cmd","powershell","latex","mermaid","graphviz","dot","javascript","html","html5","svg","lilypond"].includes(t.language)?(T(),C("button",{key:0,ref:"btn_code_exec",onClick:e[2]||(e[2]=(...o)=>s.executeCode&&s.executeCode(...o)),title:"execute",class:Le(["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)):B("",!0),["airplay","mermaid","graphviz","dot","javascript","html","html5","svg","css"].includes(t.language.trim())?(T(),C("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:Le(["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)):B("",!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(),C("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:OZe,width:"25",height:"25"},null,-1)]))):B("",!0),["python","latex","html"].includes(t.language.trim())?(T(),C("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:IZe,width:"25",height:"25"},null,-1)]))):B("",!0)]),i.executionOutput?(T(),C("span",zZe,"Execution output")):B("",!0),i.executionOutput?(T(),C("pre",VZe,[e[19]||(e[19]=Qe(" ")),c("div",HZe,[e[17]||(e[17]=Qe(`
|
|||
|
`)),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,qZe),e[18]||(e[18]=Qe(`
|
|||
|
`))]),e[20]||(e[20]=Qe(`
|
|||
|
`))])):B("",!0)])}const $Ze=ot(kZe,[["render",YZe]]);var WZe={exports:{}};(function(n,e){(function(t,r){n.exports=r()})(hN,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 h,m,g;u[0]==="\\["?(h="display_math",m="\\\\]"):u[0]==="\\("?(h="inline_math",m="\\\\)"):u[1]&&(h="math",m="\\end{"+u[1]+"}",g=!0);var _=a.src.indexOf(m,d);if(_===-1)return!1;var f=_+m.length;if(!l){var b=a.push(h,"",0);b.content=g?a.src.slice(a.pos,f):a.src.slice(d,_)}return a.pos=f,!0}function r(a,l){var d=a.pos;if(a.src.charCodeAt(d)!==36)return!1;var u="$",h=a.src.charCodeAt(++d);if(h===36){if(u="$$",a.src.charCodeAt(++d)===36)return!1}else if(h===32||h===9||h===10)return!1;var m=a.src.indexOf(u,d);if(m===-1||a.src.charCodeAt(m-1)===92)return!1;var g=m+u.length;if(u.length===1){var _=a.src.charCodeAt(m-1);if(_===32||_===9||_===10)return!1;var f=a.src.charCodeAt(g);if(f>=48&&f<58)return!1}if(!l){var b=a.push(u.length===1?"inline_math":"display_math","",0);b.content=a.src.slice(d,m)}return a.pos=g,!0}function i(a){return a.replace(/&/g,"&").replace(/</g,"<").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 h=a["before"+o[u]],m=a["after"+o[u]];d.renderer.rules[u]=function(g,_){return h+i(g[_].content)+m}})}}})})(WZe);function KZe(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const jZe={name:"MarkdownRenderer",props:{host:{type:String,required:!1,default:"http://localhost:9600"},client_id:{type:String,required:!0},markdownText:{type:String,required:!0},discussion_id:{type:[String,Number],default:"0",required:!1},message_id:{value:"0",type:[String,Number],required:!1}},components:{CodeBlock:$Ze},setup(n){const e=new Nye({html:!0,breaks:!0,highlight:(s,o)=>{const a=o&&Bo.getLanguage(o)?o:"plaintext";return Bo.highlight(a,s).value},renderInline:!1}).use(BWe).use(Sa).use($We,{figcaption:!0}).use(oKe).use(qWe,{enableRowspan:!0,enableColspan:!0,enableGridTables:!0,enableGridTablesExtra:!0,enableTableIndentation:!0,tableCellPadding:" ",tableCellJoiner:"|",multilineCellStartMarker:"|>",multilineCellEndMarker:"<|",multilineCellPadding:" ",multilineCellJoiner:`
|
|||
|
`}).use(L1e),t=ct([]),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:KZe(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=[];Pe(()=>{ze.replace(),window.MathJax&&window.MathJax.typesetPromise()})},i=(s,o)=>{t.value[s].code=o};return kn(()=>n.markdownText,r),Ai(()=>{r()}),{markdownItems:t,updateCode:i}}},QZe={class:"break-all container w-full"},XZe={ref:"mdRender",class:"markdown-content"},ZZe=["innerHTML"];function JZe(n,e,t,r,i,s){const o=Xe("code-block");return T(),C("div",QZe,[c("div",XZe,[(T(!0),C(ke,null,We(r.markdownItems,(a,l)=>(T(),C("div",{key:l},[a.type==="code"?(T(),dt(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(),C("div",{key:1,innerHTML:a.html},null,8,ZZe))]))),128))],512)])}const uf=ot(jZe,[["render",JZe]]),eJe={data(){return{show:!1,has_button:!0,message:""}},components:{MarkdownRenderer:uf},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}}},tJe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-50"},nJe={class:"pl-10 pr-10 bg-bg-light dark:bg-bg-dark p-8 rounded-lg shadow-lg"},rJe={class:"container max-h-500 overflow-y-auto"},iJe={class:"text-lg font-medium"},sJe={class:"mt-4 flex justify-center"},oJe={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 aJe(n,e,t,r,i,s){const o=Xe("MarkdownRenderer");return i.show?(T(),C("div",tJe,[c("div",nJe,[c("div",rJe,[c("div",iJe,[H(o,{ref:"mdRender",host:"","markdown-text":i.message,message_id:0,discussion_id:0},null,8,["markdown-text"])])]),c("div",sJe,[i.has_button?(T(),C("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 ")):B("",!0),i.has_button?B("",!0):(T(),C("svg",oJe,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)])))])])])):B("",!0)}const lJe=ot(eJe,[["render",aJe]]),cJe={props:{progress:{type:Number,required:!0}}},dJe={class:"progress-bar-container"};function uJe(n,e,t,r,i,s){return T(),C("div",dJe,[c("div",{class:"progress-bar",style:Wt({width:`${t.progress}%`})},null,4)])}const $v=ot(cJe,[["render",uJe]]),pJe={setup(){return{}},name:"UniversalForm",data(){return{show:!1,resolve:null,controls_array:[],title:"Universal form",ConfirmButtonText:"Submit",DenyButto
|
|||
|
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,ltt))],8,att),H(o),c("div",{class:"toolbar-button",onMouseleave:e[5]||(e[5]=(...f)=>s.hideInfosMenu&&s.hideInfosMenu(...f))},[c("div",ctt,[i.isInfosMenuVisible?(T(),C("div",{key:0,onMouseenter:e[3]||(e[3]=(...f)=>s.showInfosMenu&&s.showInfosMenu(...f)),class:"absolute context-menu m-0 p-0 z-50 top-full right-0 transform rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none transition-all duration-300 ease-out mb-2"},[c("div",dtt,[c("div",utt,[s.isModelOK?(T(),C("div",ptt,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(),C("div",ftt,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(),C("div",mtt,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(),C("div",htt,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(),C("div",_tt,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(),C("div",gtt,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",btt,[H(a,{onClick:n.restartProgram,icon:"power",title:"restart program"},null,8,["onClick"]),H(a,{onClick:s.refreshPage,icon:"refresh-ccw",title:"refresh page"},null,8,["onClick"]),H(a,{href:"/docs",icon:"file-text",title:"Fast API doc"})]),H(l,{href:"https://github.com/ParisNeo/lollms-webui",icon:"github"}),H(l,{href:"https://www.youtube.com/channel/UCJzrg0cyQV2Z30SQ1v2FdSQ",icon:"youtube"}),H(l,{href:"https://x.com/ParisNeo_AI",icon:"x"}),H(l,{href:"https://discord.com/channels/1092918764925882418",icon:"discord"}),c("div",vtt,[c("div",{onClick:e[2]||(e[2]=f=>s.showNews()),class:"text-2xl w-8 h-8 cursor-pointer transition-colors duration-300 svg-button"},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 2 0 0 0-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"})],-1)])),e[23]||(e[23]=c("span",{
|
|||
|
<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>
|
|||
|
`,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 bit(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,v])=>{console.log(`Key: ${b}, Value: ${v}`);function y(R){return R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const E=y(b),S=new RegExp(E,"g");d=d.replace(S,v)});let h=d.split(":"),m=h[0],g=h[1]||"",_=[];h.length>2&&(_=h.slice(1));let f=await Ow(m,g,_);f!==null&&(t[l]=f)}else{let u=await Ow(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 h=u(l),m=new RegExp(h,"g");n=n.replace(m,d)}),e(n)})}const vit={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:VO,html5_block:HO,LaTeX_block:qO,javascript_block:GO,json_block:zO,code_block:UO,python_block:BO,bash_block:YO,tokenize_icon:Znt,deaf_off:ert,deaf_on:Jnt,rec_off:nrt,rec_on:trt,loading_icon:$O,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:Wv,MarkdownRenderer:uf,ClipBoardTextInput:Jv,TokensHilighter:Ynt,ChatBarButton:hf,Card:mf,ToolbarButton:ey,DropdownMenu:nI},mounted(){ne.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,th
|
|||
|
`?(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,ne.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)),ne.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,Pe(()=>{ze.replace()})}).catch(r=>{this.$refs.toast.showToast(`Error: ${r}`,4,!1),this.isSynthesizingVoice=!1,Pe(()=>{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=[".","!","?",`
|
|||
|
`];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),He.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 ne.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}`),He.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(){He.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=bit(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},ne.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(){ne.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?ne.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)}):ne.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?ne.get("/stop_recording").then(n=>{this.is_dea
|
|||
|
`).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 tp{constructor(e){Xt(this,"options");Xt(this,"rules");Xt(this,"lexer");this.options=e||Ko}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:Hl(r,`
|
|||
|
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const r=t[0],i=gst(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=Hl(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:Hl(t[0],`
|
|||
|
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let r=Hl(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(`
|
|||
|
`),h=u.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|||
|
$1`).replace(/^ {0,3}>[ \t]?/gm,"");i=i?`${i}
|
|||
|
${u}`:u,s=s?`${s}
|
|||
|
${h}`:h;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,o,!0),this.lexer.state.top=m,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 _=g,f=_.raw+`
|
|||
|
`+r.join(`
|
|||
|
`),b=this.blockquote(f);o[o.length-1]=b,i=i.substring(0,i.length-_.raw.length)+b.raw,s=s.substring(0,s.length-_.text.length)+b.text;break}else if((g==null?void 0:g.type)==="list"){const _=g,f=_.raw+`
|
|||
|
`+r.join(`
|
|||
|
`),b=this.list(f);o[o.length-1]=b,i=i.substring(0,i.length-g.raw.length)+b.raw,s=s.substring(0,s.length-_.raw.length)+b.raw,r=f.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 h=t[2].split(`
|
|||
|
`,1)[0].replace(/^\t+/,v=>" ".repeat(3*v.length)),m=e.split(`
|
|||
|
`,1)[0],g=!h.trim(),_=0;if(this.options.pedantic?(_=2,u=h.trimStart()):g?_=t[1].length+1:(_=t[2].search(/[^ ]/),_=_>4?1:_,u=h.slice(_),_+=t[1].length),g&&/^[ \t]*$/.test(m)&&(d+=m+`
|
|||
|
`,e=e.substring(m.length+1),l=!0),!l){const v=new RegExp(`^ {0,${Math.min(3,_-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,_-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),E=new RegExp(`^ {0,${Math.min(3,_-1)}}(?:\`\`\`|~~~)`),S=new RegExp(`^ {0,${Math.min(3,_-1)}}#`),R=new RegExp(`^ {0,${Math.min(3,_-1)}}<(?:[a-z].*>|!--)`,"i");for(;e;){const w=e.split(`
|
|||
|
`,1)[0];let A;if(m=w,this.options.pedantic?(m=m.replace(/^ {1,4}(?=( {4})*[^ ])/g," "),A=m):A=m.replace(/\t/g," "),E.test(m)||S.test(m)||R.test(m)||v.test(m)||y.test(m))break;if(A.search(/[^ ]/)>=_||!m.trim())u+=`
|
|||
|
`+A.slice(_);else{if(g||h.replace(/\t/g," ").search(/[^ ]/)>=4||E.test(h)||S.test(h)||y.test(h))break;u+=`
|
|||
|
`+m}!g&&!m.trim()&&(g=!0),d+=w+`
|
|||
|
`,e=e.substring(w.length+1),h=A.slice(_)}}s.loose||(a?s.loose=!0:/\n[ \t]*\n[ \t]*$/.test(d)&&(a=!0));let f=null,b;this.options.gfm&&(f=/^\[[ xX]\] /.exec(u),f&&(b=f[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:d,task:!!f,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(h=>h.type==="space"),u=d.length>0&&d.some(h=>/\n.*\n/.test(h.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=Dw(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(Dw(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:gr(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=Hl(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{const o=_st(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)),Lw(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 Lw(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 h=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,t=t.slice(-1*e.length+o);(i=h.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 m=[...i[0]][0].length,g=e.slice(0,o+i.index+m+l);if(Math.min(o,l)%2){const f=g.slice(1,-1);return{type:"em",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}const _=g.slice(2,-2);return{type:"strong",raw:g,text:_,tokens:this.lexer.inlineTokens(_)}}}}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=gr(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=gr(t[1]),i="mailto:"+r):(r=gr(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=gr(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=gr(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=gr(t[0]),{type:"text",raw:t[0],text:r}}}}const bst=/^(?:[ \t]*(?:\n|$))+/,vst=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,yst=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,sd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Est=/^ {0,3}(#{1,6})(?=\s|$
|
|||
|
]`).replace("lheading",aI).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},cI=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Mst=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,dI=/^( {2,}|\\)\n(?!\s*$)/,Nst=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,od="\\p{P}\\p{S}",Ost=jt(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,od).getRegex(),Ist=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,kst=jt(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,od).getRegex(),Dst=jt("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,od).getRegex(),Lst=jt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,od).getRegex(),Pst=jt(/\\([punct])/,"gu").replace(/punct/g,od).getRegex(),Fst=jt(/^<(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(),Ust=jt(uy).replace("(?:-->|$)","-->").getRegex(),Bst=jt("^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",Ust).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),np=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Gst=jt(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",np).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),uI=jt(/^!?\[(label)\]\[(ref)\]/).replace("label",np).replace("ref",dy).getRegex(),pI=jt(/^!?\[(ref)\](?:\[\])?/).replace("ref",dy).getRegex(),zst=jt("reflink|nolink(?!\\()","g").replace("reflink",uI).replace("nolink",pI).getRegex(),fy={_backpedal:gc,anyPunctuation:Pst,autolink:Fst,blockSkip:Ist,br:dI,code:Mst,del:gc,emStrongLDelim:kst,emStrongRDelimAst:Dst,emStrongRDelimUnd:Lst,escape:cI,link:Gst,nolink:pI,punctuation:Ost,reflink:uI,reflinkSearch:zst,tag:Bst,text:Nst,url:gc},Vst={...fy,link:jt(/^!?\[(label)\]\((.*?)\)/).replace("label",np).getRegex(),reflink:jt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",np).getRegex()},Eb={...fy,escape:jt(cI).replace("])","~|])").getRegex(),url:jt(/^((?: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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Hst={...Eb,br:jt(dI).replace("{2,}","*").getRegex(),text:jt(Eb.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Od={normal:py,gfm:Rst,pedantic:Ast},ql={normal:fy,gfm:Eb,breaks:Hst,pedantic:Vst};class Lr{constructor(e){Xt(this,"tokens");Xt(this,"options");Xt(this,"state");Xt(this,"tokenizer");Xt(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ko,this.options.tokenizer=this.options.tokenizer||new tp,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:Od.normal,in
|
|||
|
`),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 h=e.slice(1);let m;this.options.extensions.startInline.forEach(g=>{m=g.call({lexer:this},h),typeof m=="number"&&m>=0&&(u=Math.min(u,m))}),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 rp{constructor(e){Xt(this,"options");Xt(this,"parser");this.options=e||Ko}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-'+gr(i)+'">'+(r?s:gr(s,!0))+`</code></pre>
|
|||
|
`:"<pre><code>"+(r?s:gr(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}>
|
|||
|
`}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=kw(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=kw(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 hy{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 Pr{constructor(e){Xt(this,"options");Xt(this,"renderer");Xt(this,"textRenderer");this.options=e||Ko,this.options.renderer=this.options.renderer||new rp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new hy}static parse(e,t){return new Pr(t).parse(e)}static parseInline(e,t){return new Pr(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 bc{constructor(e){Xt(this,"options");Xt(this,"block");this.options=e||Ko}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Lr.lex:Lr.lexInline}provideParser(){return this.block?Pr.parse:Pr.parseInline}}Xt(bc,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class qst{constructor(...e){Xt(this,"defaults",ly());Xt(this,"options",this.setOptions);Xt(this,"parse",this.parseMarkdown(!0));Xt(this,"parseInline",this.parseMarkdown(!1));Xt(this,"Parser",Pr);Xt(this,"Renderer",rp);Xt(this,"TextRenderer",hy);Xt(this,"Lexer",Lr);Xt(this,"Tokenizer",tp);Xt(this,"Hooks",bc);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 rp(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 h=l.apply(s,u);return h===!1&&(h=d.apply(s,u)),h||""}}i.renderer=s}if(r.tokenizer){const s=this.defaults.tokenizer||new tp(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 h=l.apply(s,u);return h===!1&&(h=d.apply(s,u)),h}}i.tokenizer=s}if(r.hooks){const s=this.defaults.hooks||new bc;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>"+gr(r.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(r);throw r}}}const zo=new qst;function Bt(n,e){return zo.parse(n,e)}Bt.options=Bt.setOptions=function(n){return zo.setOptions(n),Bt.defaults=zo.defaults,rI(Bt.defaults),Bt};Bt.getDefaults=ly;Bt.defaults=Ko;Bt.use=function(...n){return zo.use(...n),Bt.defaults=zo.defaults,rI(Bt.defaults),Bt};Bt.walkTokens=function(n,e){return zo.walkTokens(n,e)};Bt.parseInline=zo.parseInline;Bt.Parser=Pr;Bt.parser=Pr.parse;Bt.Renderer=rp;Bt.TextRenderer=hy;Bt.Lexer=Lr;Bt.lexer=Lr.lex;Bt.Tokenizer=tp;Bt.Hooks=bc;Bt.parse=Bt;Bt.options;Bt.setOptions;Bt.use;Bt.walkTokens;Bt.parseInline;Pr.parse;Lr.lex;const Yst={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 Bt(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()}},$st={class:"help-view background-color p-6 w-full"},Wst={class:"big-card w-full"},Kst={class:"help-sections-container"},jst={class:"help-sections space-y-4"},Qst=["onClick"],Xst={class:"toggle-icon"},Zst={key:0,class:"help-content mt-4"},Jst=["innerHTML"];function eot(n,e,t,r,i,s){return T(),C("div",$st,[c("div",Wst,[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",Kst,[c("div",jst,[(T(!0),C(ke,null,We(i.helpSections,(o,a)=>(T(),C("div",{key:a,class:"help-section message"},[c("h2",{onClick:l=>s.toggleSection(a),class:"menu-item cursor-pointer flex justify-between items-center"},[Qe(Y(o.title)+" ",1),c("span",Xst,Y(o.isOpen?"▼":"▶"),1)],8,Qst),o.isOpen?(T(),C("div",Zst,[c("div",{innerHTML:o.content,class:"prose dark:prose-invert"},null,8,Jst)])):B("",!0)]))),128))])])])])}const tot=ot(Yst,[["render",eot],["__scopeId","data-v-8c1798f3"]]);function Ei(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 or="/assets/default_model-B22RoIQ8.png",not={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),Pe(()=>{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.getBoun
|
|||
|
`,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(){ne.post("/install_diffusers",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},upgradeDiffusersService(){ne.post("install_diffusers",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallXTTSService(){ne.post("install_xtts",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallWhisperService(){ne.post("install_whisper",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallSDService(){ne.post("/install_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},upgradeSDService(){ne.post("upgrade_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},startSDService(){ne.post("start_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},showSD(){ne.post("show_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallComfyUIService(){ne.post("install_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},upgradeComfyUIService(){ne.post("upgrade_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startComfyUIService(){ne.post("start_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},showComfyui(){ne.post("show_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallvLLMService(){ne.post("install_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startvLLMService(){ne.post("start_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startollamaService(){ne.post("start_ollama",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallPetalsService(){ne.post("install_petals",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallOLLAMAService(){ne.post("install_ollama",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallElasticSearchService(){ne.post("install_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},getSeviceVoices(){ne.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,Pe(()=>{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 He.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")};He.on("install_progress",r),He.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"),ne.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"),ne.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,Pe(()=>{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;He.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);Pe(()=>{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),Pe(()=>{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),Pe(()=>{ze.replace()})),this.settingsChanged=!0,this.isModelSelected=!0}):this.$store.state.toast.showToast(`Model:
|
|||
|
`+n.model.name+`
|
|||
|
is not installed`,4,!1),Pe(()=>{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 ne.post("/copy_to_custom_personas",{client_id:this.$store.state.client_id,category:n.personality.category,name:n.personality.name})},async handleOpenFolder(n){await ne.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={},He.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(){ne.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"),He.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"))):(He.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"))};He.on("install_progress",e),He.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"),He.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"))):(He.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"))};He.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,He.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,He.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"))};He.on("uninstall_progress",t),this.selected_variant!=null?He.emit("uninstall_model",{path:"https://huggingface.co/"+n.model.quantizer+"/"+n.model.name+"/resolve/main/"+this.selected_variant.name,type:n.model.type}):He.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"),ne.post("/install_binding",{client_id:this.$store.state.client_id,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,ne.post("/unInstall_binding",{client_id:this.$store.state.client_id,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,ne.post("/reinstall_binding",{client_id:this.$store.state.client_id,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,ne.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{ne.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),ne.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,ne.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,ne.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{ne.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 ne.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,Pe(()=>{ze.replace()}),console.log("updating model"),this.update_model(null).then(()=>{}),Pe(()=>{ze.replace()})}),Pe(()=>{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,Pe(()=>{ze.replace()}),e},async cancelConfiguration(){await this.$store.dispatch("refreshConfig"),this.settingsChanged=!1},applyConfiguration(){this.isLoading=!0,ne.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),Pe(()=>{ze.replace()})})},save_configuration(){this.showConfirmation=!1,ne.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&&ne.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 ne.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 ne.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 Ei(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 ne.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 ne.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 ne.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 ne.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,ne.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,ne.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),ne.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=ri},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 ne.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 ne.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 ne.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(`
|
|||
|
`,"<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 or;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return or}}},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):or}catch{console.log("error")}if(!this.isMounted)return or;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return or}}},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:ri},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
|
|||
|
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.
|
|||
|
<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[685]||(e[685]=[c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)]))])]),c("tr",null,[e[687]||(e[687]=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",dht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[363]||(e[363]=(...f)=>s.reinstallOLLAMAService&&s.reinstallOLLAMAService(...f))},"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[364]||(e[364]=(...f)=>s.startollamaService&&s.startollamaService(...f))},"start ollama service")])])]),c("tr",null,[e[688]||(e[688]=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",uht,[D(c("input",{type:"text",id:"ollama_base_url",required:"","onUpdate:modelValue":e[365]||(e[365]=f=>s.configFile.ollama_base_url=f),onChange:e[366]||(e[366]=f=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ce,s.configFile.ollama_base_url]])])])])])]),_:1}),H(a,{title:"vLLM service",is_subcard:!0,class:"pb-2 m-2"},{default:Ae(()=>[c("table",pht,[c("tr",null,[e[690]||(e[690]=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",fht,[D(c("input",{type:"checkbox",id:"enable_vllm_service",required:"","onUpdate:modelValue":e[367]||(e[367]=f=>s.configFile.enable_vllm_service=f),onChange:e[368]||(e[368]=f=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[qe,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[369]||(e[369]=f=>this.$store.state.messageBox.showMessage(`Activates vllm service. The service will be automatically loaded at startup alowing you to use the elf binding.
|
|||
|
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.
|
|||
|
<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[689]||(e[689]=[c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)]))])]),c("tr",null,[e[691]||(e[691]=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",hht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[370]||(e[370]=(...f)=>s.reinstallvLLMService&&s.reinstallvLLMService(...f))},"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[371]||(e[371]=(...f)=>s.startvLLMService&&s.startvLLMService(...f))},"start vllm service")])])]),c("tr",null,[e[692]||(e[692]=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",mht,[D(c("input",{type:"text",id:"vllm_url",required:"","onUpdate:modelValue":e[372]||(e[372]=f=>s.configFile.vllm_url=f),onChange:e[373]||(e[373]=f=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ce,s.configFile.vllm_url]])])])]),c("tr",null,[e[694]||(e[694]=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",_ht,[c("div",ght,[e[693]||(e[693]=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",bht,[D(c("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[374]||(e[374]=f=>s.configFile.vllm_gpu_memory_utilization=f),onChange:e[375]||(e[375]=f=>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),[[ce,s.configFile.vllm_gpu_memory_utilization]])])]),D(c("input",{id:"vllm_gpu_memory_utilization",onChange:e[376]||(e[376]=f=>i.settingsChanged=!0),type:"range","onUpdate:modelValue":e[377]||(e[377]=f=>s.configFile.vllm_gpu_memory_utilization=f),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),[[ce,s.configFile.vllm_gpu_memory_utilization]])])])]),c("tr",null,[e[695]||(e[695]=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",vht,[D(c("input",{type:"number",id:"vllm_max_num_seqs",min:"64",max:"2048",required:"","onUpdate:modelValue":e[378]||(e[378]=f=>s.configFile.vllm_max_num_seqs=f),onChange:e[379]||(e[379]=f=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ce,s.configFile.vllm_max_num_seqs]])])])]),c("tr",null,[e[696]||(e[696]=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",yht,[D(c("input",{type:"number",id:"vllm_max_model_len",min:"2048",max:"1000000",required:"","onUpdate:modelValue":e[380]||(e[380]=f=>s.configFile.vllm_max_model_len=f),onChange:e[381]||(e[381]=f=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ce,s.configFile.vllm_max_model_len]])])])]),c("tr",null,[e[697]||(e[697]=c("td",{style:{"min-width":"200px"}},[c("label",{for:"vllm_model_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"vllm mo
|
|||
|
If You are using windows, this will install wsl so you need to activate it.
|
|||
|
<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[698]||(e[698]=[c("i",{"data-feather":"help-circle",class:"w-5 h-5"},null,-1)]))])]),c("tr",null,[e[700]||(e[700]=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",xht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[387]||(e[387]=(...f)=>s.reinstallPetalsService&&s.reinstallPetalsService(...f))},"install petals service")])])]),c("tr",null,[e[701]||(e[701]=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",wht,[D(c("input",{type:"text",id:"petals_base_url",required:"","onUpdate:modelValue":e[388]||(e[388]=f=>s.configFile.petals_base_url=f),onChange:e[389]||(e[389]=f=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ce,s.configFile.petals_base_url]])])])])])]),_:1})]),_:1}),H(a,{title:"TTV settings",is_subcard:!0,class:"pb-2 m-2"},{default:Ae(()=>[c("table",Cht,[c("tr",null,[e[702]||(e[702]=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",Rht,[D(c("input",{type:"text",id:"lumalabs_key",required:"","onUpdate:modelValue":e[390]||(e[390]=f=>s.configFile.lumalabs_key=f),onChange:e[391]||(e[391]=f=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ce,s.configFile.lumalabs_key]])])])])])]),_:1}),H(a,{title:"Misc",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:Ae(()=>[H(a,{title:"Elastic search Service (under construction)",is_subcard:!0,class:"pb-2 m-2"},{default:Ae(()=>[c("table",Aht,[c("tr",null,[e[703]||(e[703]=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",Mht,[D(c("input",{type:"checkbox",id:"elastic_search_service",required:"","onUpdate:modelValue":e[392]||(e[392]=f=>s.configFile.elastic_search_service=f),onChange:e[393]||(e[393]=f=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[qe,s.configFile.elastic_search_service]])])])]),c("tr",null,[e[704]||(e[704]=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",Nht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[394]||(e[394]=(...f)=>s.reinstallElasticSearchService&&s.reinstallElasticSearchService(...f))},"install ElasticSearch service")])])]),c("tr",null,[e[705]||(e[705]=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",Oht,[D(c("input",{type:"text",id:"elastic_search_url",required:"","onUpdate:modelValue":e[395]||(e[395]=f=>s.configFile.elastic_search_url=f),onChange:e[396]||(e[396]=f=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[ce,s.configFile.elastic_search_url]])])])])])]),_:1})]),_:1})],2)]),c("div",Iht,[c("div",kht,[c("button",{onClick:e[397]||(e[397]=W(f=>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"},[D(c("div",null,e[706]||(e[706]=[c("i",{"data-feather":"chevron-right"},null,-1)]),512),[[bt,i.bzc_collapsed]]),D(c("div",null,e[707]||(e[707]=[c("i",{"data-feather":"chevron-down"},null,-1)]),512),[[bt,!i.bzc_collapsed]]),e[709]||(e[709]=c("p
|
|||
|
`).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,ne.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,ne.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,ne.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+`
|
|||
|
`+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?Hgt+this.avatar:(console.log("No avatar found"),ri)},defaultImg(n){n.target.src=ri},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(){Pe(()=>{ze.replace()})},deleteMsgMode(){Pe(()=>{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,Pe(()=>{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"}}},Ygt={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"},$gt={class:"flex flex-row gap-2"},Wgt={class:"flex-shrink-0"},Kgt={class:"group/avatar"},jgt=["src","data-popover-target"],Qgt={class:"flex flex-col w-full flex-grow-0"},Xgt={class:"flex fle
|
|||
|
`+r.error,4,!1),this.loading=!1,He.off("file_received")}),He.emit("send_file",t)},e.readAsDataURL(this.selectedFile)},async constructor(){Pe(()=>{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)}},V0t={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"};function H0t(n,e,t,r,i,s){const o=Xe("InteractiveMenu");return i.loading?(T(),C("div",V0t,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(),dt(o,{key:1,commands:t.commandsList,execute_cmd:s.execute_cmd},null,8,["commands","execute_cmd"]))}const q0t=ot(z0t,[["render",H0t],["__scopeId","data-v-1a32c141"]]),Y0t="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",$0t="/",W0t={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:{default:!1},onShowToastMessage:Function},components:{PersonalitiesCommands:q0t,ChatBarButton:hf},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(Pe(()=>{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 ne.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=_y}}},vvt={class:"relative group/item"},yvt=["src","alt"],Evt={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"},Svt={class:"p-1 bg-gray-500 rounded-full text-white hover:bg-gray-600 focus:outline-none ml-1",title:"Show more"},Tvt={class:"text-xs font-bold"};function xvt(n,e,t,r,i,s){const o=Xe("UniversalForm");return T(),C(ke,null,[c("div",vvt,[c("button",{onClick:e[1]||(e[1]=W((...a)=>s.onSettingsPersonality&&s.onSettingsPersonality(...a),["prevent"])),class:Le(["w-6 h-6 rounded-full overflow-hidden transition-transform duration-200 transform group-hover/item:scale-110 focus:outline-none relative",{"glow-effect":n.$store.state.config.activate_skills_lib}])},[c("img",{src:s.mountedPers.avatar,onError:e[0]||(e[0]=(...a)=>s.personalityImgPlacehodler&&s.personalityImgPlacehodler(...a)),alt:s.mountedPers.name,class:Le(["w-full h-full object-cover",{"border-2 border-secondary":n.isActive}])},null,42,yvt)],2),c("div",Evt,[c("button",{onClick:e[2]||(e[2]=W(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]=W(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",Svt,[c("span",Tvt,"+"+Y(s.mountedPersArr.length-1),1)])])]),H(o,{ref:"universalForm",class:"z-50"},null,512)],64)}const kI=ot(bvt,[["render",xvt],["__scopeId","data-v-31178107"]]),wvt={key:0,class:"fixed top-0 left-0 w-screen h-screen flex items-center justify-center overflow-hidden"},Cvt={key:0,class:"absolute inset-0 pointer-events-none overflow-hidden"},Rvt={class:"flex flex-col items-center text-center max-w-4xl w-full px-4 relative z-10"},Avt={class:"mb-8 w-full"},Mvt={class:"text-5xl md:text-6xl font-bold mb-2 hover:scale-105 transition-transform lollms-title-style"},Nvt={class:"bottom-0 text-2xl italic"},Ovt={class:"text-lg"},Ivt=["innerHTML"],kvt={class:"animated-progressbar-bg"},Dvt={class:"w-full max-w-2xl"},Lvt={role:"status",class:"w-full"},Pvt={class:"text-xl"},Fvt={class:"text-2xl font-bold mt-2"},Uvt={key:0,class:"relative flex flex-col no-scrollbar shadow-lg w-[16rem]"},Bvt={class:"logo-container"},Gvt=["src"],zvt={class:"toolbar discussion"},Vvt={class:"toolbar-container"},Hvt={class:"p-4 flex flex-wrap gap-2 items-center"},qvt={class:"p-4 flex flex-wrap gap-2 items-center"},Yvt={class:"relative"},$vt={class:"relative"},Wvt={key:0,title:"Loading..",class:"flex justify-center"},Kvt={key:1,class:"flex justify-center space-x-4"},jvt={key:2,class:"flex flex-col space-y-2"},Qvt={class:"relative inline-block"},Xvt={class:"p-2 border-b border-gray-200 dark:border-gray-700"},Zvt={class:"p-4 grid grid-cols-3 gap-4 max-h-80 overflow-y-auto custom-scrollbar"},
|
|||
|
<!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>
|
|||
|
`,memory_icon:pvt,active_skills:fvt,inactive_skills:hvt,skillsRegistry:mvt,robot:_vt,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){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(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"),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.$emit("personalitySelected"),Pe(()=>{ze.replace()})}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};const e=n.full_path,t=this.$store.state.config.personalities.findIndex(i=>i===e),r={client_id:this.$store.state.client_id,id:t};try{const i=await ne.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},showSkillsLibraryMenu(){clearTimeout(this.hideSkillsLibraryMenuTimeout),this.isSkillsLibraryMenuVisible=!0},hideSkillsLibraryMenu(){this.hideMenuTimeout=setTimeout(()=>{this.isSkillsLibraryMenuVisible=!1},300)},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){this.selecting_binding=!0,this.selectedBinding=n,this.$store.state.messageBox.showBlockingMessage("Loading binding"),ne.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(),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){this.selecting_model=!0,this.selectedModel=n,this.$store.state.messageBox.showBlockingMessage("Loading model"),ne.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(),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,ne.get("/get_active_binding_settings").then(n=>{this.isLoading=!1,n&&(n.data&&Object.keys(n.data).length>0?this.$store.state.universalForm.showForm(n.data,"Binding settings ","Save changes","Cancel").then(e=>{try{ne.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,settings:e}).then(t=>{t&&t.data?this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0):(this.$store.state.toast.showToast(`Did not get binding settings responses.
|
|||
|
`+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(!n)return{status:!1,error:"no personality - mount_personality"};try{const e={client_id:this.$store.state.client_id,category:n.category,folder:n.folder,language:n.language},t=await ne.post("/remount_personality",e);if(t)return 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(!n)return;const e=await this.unmount_personality(n.personality||n);if(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];(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 ne.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),Pe(()=>{ze.replace()})},showMenu(){this.isMenuVisible=!0,Pe(()=>{ze.replace()})},hideMenu(){this.isMenuVisible=!1,Pe(()=>{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),setTimeout(()=>{window.close()},2e3)},applyConfiguration(){this.isLoading=!0,ne.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),Pe(()=>{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,this.extractTitle(n)?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},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,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()}))},add_webpage(){this.$refs.web_url_input_box.showPanel()},addWebpage(){ne.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&&this.recoverFiles()})},show_progress(n){this.progress_visibility_val=!0},hide_progress(n){this.progress_visibility_val=!1},update_progress(n){this.progress_value=n.value},onSettingsBinding(){try{this.isLoading=!0,ne.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{ne.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,settings:t}).then(r=>{r&&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((await ne.post("/select_database",e,{headers:this.posts_headers})).status){this.$store.state.config=await ne.post("/get_config",{client_id:this.client_id});let r=await ne.get("/list_databases").data;this.$store.state.databases=r,location.reload()}},async addDiscussion2SkillsLibrary(){(await ne.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 ne.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),Pe(()=>{ze.replace()})},save_configuration(){this.showConfirmation=!1,ne.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=>(this.$store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},showToastMessage(n,e,t){this.$store.state.toast.showToast(n,e,t)},toggleDropdown(){this.isOpen=!this.isOpen},importChatGPT(){},async api_get_req(n){try{const e=await ne.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req");return}},async list_discussions(){try{const n=await ne.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&&(this.loading=!0,this.discussionArr=[],this.setDiscussionLoading(n,this.loading),He.on("discussion",t=>{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"}),e&&e()),He.off("discussion"),this.extractHtml()}),He.emit("load_discussion",{id:n}))},recoverFiles(){ne.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)})},new_discussion(n){try{this.loading=!0,He.on("discussion_created",e=>{He.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(),Pe(()=>{const i=document.getElementById("dis-"+e.id);this.scrollToElement(i),console.log("Scrolling tp "+i)})})})}),He.emit("new_discussion",{title:n})}catch(e){return console.log("Error: Could not create new discussion",e.message),{}}},async delete_discussion(n){try{n&&(this.loading=!0,this.setDiscussionLoading(n,this.loading),await ne.post("/delete_discussion",{client_id:this.client_id,id:n},{headers:this.posts_headers}),this.loading=!1,this.setDiscussionLoading(n,this.loading))}catch(e){console.log("Error: Could not delete discussion",e.message),this.loading=!1,this.setDiscussionLoading(n,this.loading)}},async edit_title(
|
|||
|
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),Pe(()=>{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){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){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 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)];const e=(await ne.get("/get_versionID")).data.versionId;He.onopen=()=>{this.currentDiscussion!=null&&(this.setPageTitle(item),localStorage.setItem("selected_discussion",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()});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";He.id===void 0;)await new Promise(t=>setTimeout(t,100));this.$store.state.client_id=He.id,await this.$store.dispatch("refreshConfig")}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=He.id,this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),this.isCreated=!0,this.$store.state.ready=!0,He.on("connected",this.socketIOConnected),He.on("disconnected",this.socketIODisconnected),He.on("show_progress",this.show_progress),He.on("hide_progress",this.hide_progress),He.on("update_progress",this.update_progress),He.on("notification",this.notify),He.on("new_message",this.new_message),He.on("update_message",this.update_message),He.on("close_message",this.finalMsgEvent),He.on("disucssion_renamed",t=>{const r=this.list.findIndex(s=>s.id==t.discussion_id),i=this.list[r];i.title=t.title}),He.onclose=t=>{this.socketIODisconnected()},He.on("connect_error",t=>{t.message==="ERR_CONNECTION_REFUSED"?console.error("Connection refused. The server is not available."):console.error("Connection error:",t),this.$store.state.isConnected=!1}),He.onerror=t=>{console.log("WebSocket connection error:",t.code,t.reason),this.socketIODisconnected(),He.disconnect()}},beforeUnmount(){window.removeEventListener("resize",this.adjustMenuPosition)},async mounted(){window.a
|
|||
|
* @license
|
|||
|
* Copyright 2010-2023 Three.js Authors
|
|||
|
* SPDX-License-Identifier: MIT
|
|||
|
*/const Ny="159",IEt=0,Gw=1,kEt=2,DI=1,DEt=2,Hi=3,ns=0,pr=1,gi=2,Fs=0,Fa=1,zw=2,Vw=3,Hw=4,LEt=5,go=100,PEt=101,FEt=102,qw=103,Yw=104,UEt=200,BEt=201,GEt=202,zEt=203,xb=204,wb=205,VEt=206,HEt=207,qEt=208,YEt=209,$Et=210,WEt=211,KEt=212,jEt=213,QEt=214,XEt=0,ZEt=1,JEt=2,fp=3,e1t=4,t1t=5,n1t=6,r1t=7,Oy=0,i1t=1,s1t=2,Us=0,o1t=1,a1t=2,l1t=3,c1t=4,d1t=5,$w="attached",u1t="detached",LI=300,rl=301,il=302,Cb=303,Rb=304,vf=306,sl=1e3,Nr=1001,hp=1002,Cn=1003,Ab=1004,Ru=1005,ar=1006,PI=1007,Vo=1008,Bs=1009,p1t=1010,f1t=1011,Iy=1012,FI=1013,Ds=1014,Ki=1015,zc=1016,UI=1017,BI=1018,Mo=1020,h1t=1021,Or=1023,m1t=1024,_1t=1025,No=1026,ol=1027,g1t=1028,GI=1029,b1t=1030,zI=1031,VI=1033,Jg=33776,e0=33777,t0=33778,n0=33779,Ww=35840,Kw=35841,jw=35842,Qw=35843,HI=36196,Xw=37492,Zw=37496,Jw=37808,eC=37809,tC=37810,nC=37811,rC=37812,iC=37813,sC=37814,oC=37815,aC=37816,lC=37817,cC=37818,dC=37819,uC=37820,pC=37821,r0=36492,fC=36494,hC=36495,v1t=36283,mC=36284,_C=36285,gC=36286,Vc=2300,al=2301,i0=2302,bC=2400,vC=2401,yC=2402,y1t=2500,E1t=0,qI=1,Mb=2,YI=3e3,Oo=3001,S1t=3200,T1t=3201,ky=0,x1t=1,Ir="",cn="srgb",Ln="srgb-linear",Dy="display-p3",yf="display-p3-linear",mp="linear",tn="srgb",_p="rec709",gp="p3",na=7680,EC=519,w1t=512,C1t=513,R1t=514,$I=515,A1t=516,M1t=517,N1t=518,O1t=519,Nb=35044,SC="300 es",Ob=1035,ji=2e3,bp=2001;class Al{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 Un=["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 TC=1234567;const yc=Math.PI/180,ll=180/Math.PI;function ii(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Un[n&255]+Un[n>>8&255]+Un[n>>16&255]+Un[n>>24&255]+"-"+Un[e&255]+Un[e>>8&255]+"-"+Un[e>>16&15|64]+Un[e>>24&255]+"-"+Un[t&63|128]+Un[t>>8&255]+"-"+Un[t>>16&255]+Un[t>>24&255]+Un[r&255]+Un[r>>8&255]+Un[r>>16&255]+Un[r>>24&255]).toLowerCase()}function zn(n,e,t){return Math.max(e,Math.min(t,n))}function Ly(n,e){return(n%e+e)%e}function I1t(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function k1t(n,e,t){return n!==e?(t-n)/(e-n):0}function Ec(n,e,t){return(1-t)*n+t*e}function D1t(n,e,t,r){return Ec(n,e,1-Math.exp(-t*r))}function L1t(n,e=1){return e-Math.abs(Ly(n,e*2)-e)}function P1t(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function F1t(n,e,t){return
|
|||
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|||
|
}`,fSt=`void main() {
|
|||
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|||
|
}`;class qo extends si{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=pSt,this.fragmentShader=fSt,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=cl(e.uniforms),this.uniformsGroups=dSt(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 nk extends on{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new At,this.projectionMatrix=new At,this.projectionMatrixInverse=new At,this.coordinateSystem=ji}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 Zn extends nk{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=ll*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(yc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ll*2*Math.atan(Math.tan(yc*.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(yc*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-
|
|||
|
|
|||
|
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 Gs(5,5,5),s=new qo({name:"CubemapFromEquirect",uniforms:cl(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:pr,blending:Fs});s.uniforms.tEquirect.value=t;const o=new er(i,s),a=t.minFilter;return t.minFilter===Vo&&(t.minFilter=ar),new hSt(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 E0=new se,_St=new se,gSt=new Ct;class po{constructor(e=new se(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=E0.subVectors(r,t).cross(_St.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(E0),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||gSt.getNormalMatrix(e),i=this.coplanarPoint(E0).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 ao=new Oi,nu=new se;class Py{constructor(e=new po,t=new po,r=new po,i=new po,s=new po,o=new po){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=ji){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],h=i[6],m=i[7],g=i[8],_=i[9],f=i[10],b=i[11],v=i[12],y=i[13],E=i[14],S=i[15];if(r[0].setComponents(l-s,m-d,b-g,S-v).normalize(),r[1].setComponents(l+s,m+d,b+g,S+v).normalize(),r[2].setComponents(l+o,m+u,b+_,S+y).normalize(),r[3].setComponents(l-o,m-u,b-_,S-y).normalize(),r[4].setComponents(l-a,m-h,b-f,S-E).normalize(),t===ji)r[5].setComponents(l+a,m+h,b+f,S+E).normalize();else if(t===bp)r[5].setComponents(a,h,f,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(),ao.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ao.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ao)}intersectsSprite(e){return ao.center.set(0,0,0),ao.radius=.7071067811865476,ao.applyMatrix4(e.matrixWorld),this.intersectsSphere(ao)}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(nu.x=i.normal.x>0?e.max.x:e.min.x,nu.y=i.normal.y>0?e.max.y:e.min.y,nu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(nu)<0)return!1}ret
|
|||
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|||
|
#endif`,ySt=`#ifdef USE_ALPHAHASH
|
|||
|
const float ALPHA_HASH_SCALE = 0.05;
|
|||
|
float hash2D( vec2 value ) {
|
|||
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|||
|
}
|
|||
|
float hash3D( vec3 value ) {
|
|||
|
return hash2D( vec2( hash2D( value.xy ), value.z ) );
|
|||
|
}
|
|||
|
float getAlphaHashThreshold( vec3 position ) {
|
|||
|
float maxDeriv = max(
|
|||
|
length( dFdx( position.xyz ) ),
|
|||
|
length( dFdy( position.xyz ) )
|
|||
|
);
|
|||
|
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
|
|||
|
vec2 pixScales = vec2(
|
|||
|
exp2( floor( log2( pixScale ) ) ),
|
|||
|
exp2( ceil( log2( pixScale ) ) )
|
|||
|
);
|
|||
|
vec2 alpha = vec2(
|
|||
|
hash3D( floor( pixScales.x * position.xyz ) ),
|
|||
|
hash3D( floor( pixScales.y * position.xyz ) )
|
|||
|
);
|
|||
|
float lerpFactor = fract( log2( pixScale ) );
|
|||
|
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
|
|||
|
float a = min( lerpFactor, 1.0 - lerpFactor );
|
|||
|
vec3 cases = vec3(
|
|||
|
x * x / ( 2.0 * a * ( 1.0 - a ) ),
|
|||
|
( x - 0.5 * a ) / ( 1.0 - a ),
|
|||
|
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
|
|||
|
);
|
|||
|
float threshold = ( x < ( 1.0 - a ) )
|
|||
|
? ( ( x < a ) ? cases.x : cases.y )
|
|||
|
: cases.z;
|
|||
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|||
|
}
|
|||
|
#endif`,ESt=`#ifdef USE_ALPHAMAP
|
|||
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|||
|
#endif`,SSt=`#ifdef USE_ALPHAMAP
|
|||
|
uniform sampler2D alphaMap;
|
|||
|
#endif`,TSt=`#ifdef USE_ALPHATEST
|
|||
|
if ( diffuseColor.a < alphaTest ) discard;
|
|||
|
#endif`,xSt=`#ifdef USE_ALPHATEST
|
|||
|
uniform float alphaTest;
|
|||
|
#endif`,wSt=`#ifdef USE_AOMAP
|
|||
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|||
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|||
|
#if defined( USE_CLEARCOAT )
|
|||
|
clearcoatSpecularIndirect *= ambientOcclusion;
|
|||
|
#endif
|
|||
|
#if defined( USE_SHEEN )
|
|||
|
sheenSpecularIndirect *= ambientOcclusion;
|
|||
|
#endif
|
|||
|
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|||
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|||
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|||
|
#endif
|
|||
|
#endif`,CSt=`#ifdef USE_AOMAP
|
|||
|
uniform sampler2D aoMap;
|
|||
|
uniform float aoMapIntensity;
|
|||
|
#endif`,RSt=`#ifdef USE_BATCHING
|
|||
|
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 );
|
|||
|
}
|
|||
|
#endif`,ASt=`#ifdef USE_BATCHING
|
|||
|
mat4 batchingMatrix = getBatchingMatrix( batchId );
|
|||
|
#endif`,MSt=`vec3 transformed = vec3( position );
|
|||
|
#ifdef USE_ALPHAHASH
|
|||
|
vPosition = vec3( position );
|
|||
|
#endif`,NSt=`vec3 objectNormal = vec3( normal );
|
|||
|
#ifdef USE_TANGENT
|
|||
|
vec3 objectTangent = vec3( tangent.xyz );
|
|||
|
#endif`,OSt=`float G_BlinnPhong_Implicit( ) {
|
|||
|
return 0.25;
|
|||
|
}
|
|||
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|||
|
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
|||
|
}
|
|||
|
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
|||
|
vec3 halfDir = normalize( lightDir + viewDir );
|
|||
|
float dotNH = saturate( dot( normal, halfDir ) );
|
|||
|
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|||
|
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
|||
|
float G = G_BlinnPhong_Implicit( );
|
|||
|
float D = D_BlinnPhong( shininess, dotNH );
|
|||
|
return F * ( G * D );
|
|||
|
} // validated`,ISt=`#ifdef USE_IRIDESCENCE
|
|||
|
const mat3 XYZ_TO_REC709 = mat3(
|
|||
|
3.2404542, -0.9692660, 0.0556434,
|
|||
|
-1.5371385, 1.8760108, -0.2040259,
|
|||
|
-0.4985314, 0.0415560, 1.0572252
|
|||
|
);
|
|||
|
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
|
|||
|
vec3 sqrtF0 = sqrt( fresnel0 );
|
|||
|
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
|
|||
|
}
|
|||
|
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
|
|||
|
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
|
|||
|
}
|
|||
|
float IorToFresnel0( float transmittedIor, float incidentIor ) {
|
|||
|
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
|
|||
|
}
|
|||
|
vec3 evalSensitivity( float OPD, vec3 shift ) {
|
|||
|
float phase = 2.0 * PI * OPD * 1.0e-9;
|
|||
|
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
|
|||
|
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
|
|||
|
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
|
|||
|
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
|
|||
|
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
|
|||
|
xyz /= 1.0685e-7;
|
|||
|
vec3 rgb = XYZ_TO_REC709 * xyz;
|
|||
|
return rgb;
|
|||
|
}
|
|||
|
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
|
|||
|
vec3 I;
|
|||
|
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
|
|||
|
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
|
|||
|
float cosTheta2Sq = 1.0 - sinTheta2Sq;
|
|||
|
if ( cosTheta2Sq < 0.0 ) {
|
|||
|
return vec3( 1.0 );
|
|||
|
}
|
|||
|
float cosTheta2 = sqrt( cosTheta2Sq );
|
|||
|
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
|
|||
|
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
|
|||
|
float T121 = 1.0 - R12;
|
|||
|
float phi12 = 0.0;
|
|||
|
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
|
|||
|
float phi21 = PI - phi12;
|
|||
|
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
|
|||
|
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
|
|||
|
vec3 phi23 = vec3( 0.0 );
|
|||
|
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
|
|||
|
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
|
|||
|
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
|
|||
|
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
|
|||
|
vec3 phi = vec3( phi21 ) + phi23;
|
|||
|
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
|
|||
|
vec3 r123 = sqrt( R123 );
|
|||
|
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
|
|||
|
vec3 C0 = R12 + Rs;
|
|||
|
I = C0;
|
|||
|
vec3 Cm = Rs - T121;
|
|||
|
for ( int m = 1; m <= 2; ++ m ) {
|
|||
|
Cm *= r123;
|
|||
|
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
|
|||
|
I += Cm * Sm;
|
|||
|
}
|
|||
|
return max( I, vec3( 0.0 ) );
|
|||
|
}
|
|||
|
#endif`,kSt=`#ifdef USE_BUMPMAP
|
|||
|
uniform sampler2D bumpMap;
|
|||
|
uniform float bumpScale;
|
|||
|
vec2 dHdxy_fwd() {
|
|||
|
vec2 dSTdx = dFdx( vBumpMapUv );
|
|||
|
vec2 dSTdy = dFdy( vBumpMapUv );
|
|||
|
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
|
|||
|
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
|
|||
|
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
|
|||
|
return vec2( dBx, dBy );
|
|||
|
}
|
|||
|
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
|||
|
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
|
|||
|
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
|
|||
|
vec3 vN = surf_norm;
|
|||
|
vec3 R1 = cross( vSigmaY, vN );
|
|||
|
vec3 R2 = cross( vN, vSigmaX );
|
|||
|
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
|||
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|||
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|||
|
}
|
|||
|
#endif`,DSt=`#if NUM_CLIPPING_PLANES > 0
|
|||
|
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
|
|||
|
#endif`,LSt=`#if NUM_CLIPPING_PLANES > 0
|
|||
|
varying vec3 vClipPosition;
|
|||
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|||
|
#endif`,PSt=`#if NUM_CLIPPING_PLANES > 0
|
|||
|
varying vec3 vClipPosition;
|
|||
|
#endif`,FSt=`#if NUM_CLIPPING_PLANES > 0
|
|||
|
vClipPosition = - mvPosition.xyz;
|
|||
|
#endif`,USt=`#if defined( USE_COLOR_ALPHA )
|
|||
|
diffuseColor *= vColor;
|
|||
|
#elif defined( USE_COLOR )
|
|||
|
diffuseColor.rgb *= vColor;
|
|||
|
#endif`,BSt=`#if defined( USE_COLOR_ALPHA )
|
|||
|
varying vec4 vColor;
|
|||
|
#elif defined( USE_COLOR )
|
|||
|
varying vec3 vColor;
|
|||
|
#endif`,GSt=`#if defined( USE_COLOR_ALPHA )
|
|||
|
varying vec4 vColor;
|
|||
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|||
|
varying vec3 vColor;
|
|||
|
#endif`,zSt=`#if defined( USE_COLOR_ALPHA )
|
|||
|
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;
|
|||
|
#endif`,VSt=`#define PI 3.141592653589793
|
|||
|
#define PI2 6.283185307179586
|
|||
|
#define PI_HALF 1.5707963267948966
|
|||
|
#define RECIPROCAL_PI 0.3183098861837907
|
|||
|
#define RECIPROCAL_PI2 0.15915494309189535
|
|||
|
#define EPSILON 1e-6
|
|||
|
#ifndef saturate
|
|||
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|||
|
#endif
|
|||
|
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
|||
|
float pow2( const in float x ) { return x*x; }
|
|||
|
vec3 pow2( const in vec3 x ) { return x*x; }
|
|||
|
float pow3( const in float x ) { return x*x*x; }
|
|||
|
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
|||
|
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
|||
|
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
|
|||
|
highp float rand( const in vec2 uv ) {
|
|||
|
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
|||
|
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
|||
|
return fract( sin( sn ) * c );
|
|||
|
}
|
|||
|
#ifdef HIGH_PRECISION
|
|||
|
float precisionSafeLength( vec3 v ) { return length( v ); }
|
|||
|
#else
|
|||
|
float precisionSafeLength( vec3 v ) {
|
|||
|
float maxComponent = max3( abs( v ) );
|
|||
|
return length( v / maxComponent ) * maxComponent;
|
|||
|
}
|
|||
|
#endif
|
|||
|
struct IncidentLight {
|
|||
|
vec3 color;
|
|||
|
vec3 direction;
|
|||
|
bool visible;
|
|||
|
};
|
|||
|
struct ReflectedLight {
|
|||
|
vec3 directDiffuse;
|
|||
|
vec3 directSpecular;
|
|||
|
vec3 indirectDiffuse;
|
|||
|
vec3 indirectSpecular;
|
|||
|
};
|
|||
|
#ifdef USE_ALPHAHASH
|
|||
|
varying vec3 vPosition;
|
|||
|
#endif
|
|||
|
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|||
|
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|||
|
}
|
|||
|
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
|||
|
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
|||
|
}
|
|||
|
mat3 transposeMat3( const in mat3 m ) {
|
|||
|
mat3 tmp;
|
|||
|
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
|
|||
|
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
|
|||
|
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
|
|||
|
return tmp;
|
|||
|
}
|
|||
|
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 );
|
|||
|
} // validated`,HSt=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|||
|
#define cubeUV_minMipLevel 4.0
|
|||
|
#define cubeUV_minTileSize 16.0
|
|||
|
float getFace( vec3 direction ) {
|
|||
|
vec3 absDirection = abs( direction );
|
|||
|
float face = - 1.0;
|
|||
|
if ( absDirection.x > absDirection.z ) {
|
|||
|
if ( absDirection.x > absDirection.y )
|
|||
|
face = direction.x > 0.0 ? 0.0 : 3.0;
|
|||
|
else
|
|||
|
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|||
|
} else {
|
|||
|
if ( absDirection.z > absDirection.y )
|
|||
|
face = direction.z > 0.0 ? 2.0 : 5.0;
|
|||
|
else
|
|||
|
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|||
|
}
|
|||
|
return face;
|
|||
|
}
|
|||
|
vec2 getUV( vec3 direction, float face ) {
|
|||
|
vec2 uv;
|
|||
|
if ( face == 0.0 ) {
|
|||
|
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
|||
|
} else if ( face == 1.0 ) {
|
|||
|
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
|||
|
} else if ( face == 2.0 ) {
|
|||
|
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
|||
|
} else if ( face == 3.0 ) {
|
|||
|
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
|||
|
} else if ( face == 4.0 ) {
|
|||
|
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
|||
|
} else {
|
|||
|
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
|||
|
}
|
|||
|
return 0.5 * ( uv + 1.0 );
|
|||
|
}
|
|||
|
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
|||
|
float face = getFace( direction );
|
|||
|
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
|||
|
mipInt = max( mipInt, cubeUV_minMipLevel );
|
|||
|
float faceSize = exp2( mipInt );
|
|||
|
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
|
|||
|
if ( face > 2.0 ) {
|
|||
|
uv.y += faceSize;
|
|||
|
face -= 3.0;
|
|||
|
}
|
|||
|
uv.x += face * faceSize;
|
|||
|
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
|
|||
|
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
|
|||
|
uv.x *= CUBEUV_TEXEL_WIDTH;
|
|||
|
uv.y *= CUBEUV_TEXEL_HEIGHT;
|
|||
|
#ifdef texture2DGradEXT
|
|||
|
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
|
|||
|
#else
|
|||
|
return texture2D( envMap, uv ).rgb;
|
|||
|
#endif
|
|||
|
}
|
|||
|
#define cubeUV_r0 1.0
|
|||
|
#define cubeUV_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 );
|
|||
|
}
|
|||
|
}
|
|||
|
#endif`,qSt=`vec3 transformedNormal = objectNormal;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
vec3 transformedTangent = objectTangent;
|
|||
|
#endif
|
|||
|
#ifdef USE_BATCHING
|
|||
|
mat3 bm = mat3( batchingMatrix );
|
|||
|
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
|
|||
|
transformedNormal = bm * transformedNormal;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
transformedTangent = bm * transformedTangent;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_INSTANCING
|
|||
|
mat3 im = mat3( instanceMatrix );
|
|||
|
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
|
|||
|
transformedNormal = im * transformedNormal;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
transformedTangent = im * transformedTangent;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
transformedNormal = normalMatrix * transformedNormal;
|
|||
|
#ifdef FLIP_SIDED
|
|||
|
transformedNormal = - transformedNormal;
|
|||
|
#endif
|
|||
|
#ifdef USE_TANGENT
|
|||
|
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
|
|||
|
#ifdef FLIP_SIDED
|
|||
|
transformedTangent = - transformedTangent;
|
|||
|
#endif
|
|||
|
#endif`,YSt=`#ifdef USE_DISPLACEMENTMAP
|
|||
|
uniform sampler2D displacementMap;
|
|||
|
uniform float displacementScale;
|
|||
|
uniform float displacementBias;
|
|||
|
#endif`,$St=`#ifdef USE_DISPLACEMENTMAP
|
|||
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|||
|
#endif`,WSt=`#ifdef USE_EMISSIVEMAP
|
|||
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|||
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|||
|
#endif`,KSt=`#ifdef USE_EMISSIVEMAP
|
|||
|
uniform sampler2D emissiveMap;
|
|||
|
#endif`,jSt="gl_FragColor = linearToOutputTexel( gl_FragColor );",QSt=`
|
|||
|
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 );
|
|||
|
}`,XSt=`#ifdef USE_ENVMAP
|
|||
|
#ifdef ENV_WORLDPOS
|
|||
|
vec3 cameraToFrag;
|
|||
|
if ( isOrthographic ) {
|
|||
|
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|||
|
} else {
|
|||
|
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
|||
|
}
|
|||
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|||
|
#ifdef ENVMAP_MODE_REFLECTION
|
|||
|
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
|||
|
#else
|
|||
|
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
|||
|
#endif
|
|||
|
#else
|
|||
|
vec3 reflectVec = vReflect;
|
|||
|
#endif
|
|||
|
#ifdef ENVMAP_TYPE_CUBE
|
|||
|
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
|||
|
#else
|
|||
|
vec4 envColor = vec4( 0.0 );
|
|||
|
#endif
|
|||
|
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|||
|
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|||
|
#elif defined( ENVMAP_BLENDING_MIX )
|
|||
|
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|||
|
#elif defined( ENVMAP_BLENDING_ADD )
|
|||
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|||
|
#endif
|
|||
|
#endif`,ZSt=`#ifdef USE_ENVMAP
|
|||
|
uniform float envMapIntensity;
|
|||
|
uniform float flipEnvMap;
|
|||
|
#ifdef ENVMAP_TYPE_CUBE
|
|||
|
uniform samplerCube envMap;
|
|||
|
#else
|
|||
|
uniform sampler2D envMap;
|
|||
|
#endif
|
|||
|
|
|||
|
#endif`,JSt=`#ifdef USE_ENVMAP
|
|||
|
uniform float reflectivity;
|
|||
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|||
|
#define ENV_WORLDPOS
|
|||
|
#endif
|
|||
|
#ifdef ENV_WORLDPOS
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
uniform float refractionRatio;
|
|||
|
#else
|
|||
|
varying vec3 vReflect;
|
|||
|
#endif
|
|||
|
#endif`,eTt=`#ifdef USE_ENVMAP
|
|||
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|||
|
#define ENV_WORLDPOS
|
|||
|
#endif
|
|||
|
#ifdef ENV_WORLDPOS
|
|||
|
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
#else
|
|||
|
varying vec3 vReflect;
|
|||
|
uniform float refractionRatio;
|
|||
|
#endif
|
|||
|
#endif`,tTt=`#ifdef USE_ENVMAP
|
|||
|
#ifdef ENV_WORLDPOS
|
|||
|
vWorldPosition = worldPosition.xyz;
|
|||
|
#else
|
|||
|
vec3 cameraToVertex;
|
|||
|
if ( isOrthographic ) {
|
|||
|
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|||
|
} else {
|
|||
|
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
|||
|
}
|
|||
|
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|||
|
#ifdef ENVMAP_MODE_REFLECTION
|
|||
|
vReflect = reflect( cameraToVertex, worldNormal );
|
|||
|
#else
|
|||
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#endif`,nTt=`#ifdef USE_FOG
|
|||
|
vFogDepth = - mvPosition.z;
|
|||
|
#endif`,rTt=`#ifdef USE_FOG
|
|||
|
varying float vFogDepth;
|
|||
|
#endif`,iTt=`#ifdef USE_FOG
|
|||
|
#ifdef FOG_EXP2
|
|||
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|||
|
#else
|
|||
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|||
|
#endif
|
|||
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|||
|
#endif`,sTt=`#ifdef USE_FOG
|
|||
|
uniform vec3 fogColor;
|
|||
|
varying float vFogDepth;
|
|||
|
#ifdef FOG_EXP2
|
|||
|
uniform float fogDensity;
|
|||
|
#else
|
|||
|
uniform float fogNear;
|
|||
|
uniform float fogFar;
|
|||
|
#endif
|
|||
|
#endif`,oTt=`#ifdef USE_GRADIENTMAP
|
|||
|
uniform sampler2D gradientMap;
|
|||
|
#endif
|
|||
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|||
|
float dotNL = dot( normal, lightDirection );
|
|||
|
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
|||
|
#ifdef USE_GRADIENTMAP
|
|||
|
return vec3( texture2D( gradientMap, coord ).r );
|
|||
|
#else
|
|||
|
vec2 fw = fwidth( coord ) * 0.5;
|
|||
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|||
|
#endif
|
|||
|
}`,aTt=`#ifdef USE_LIGHTMAP
|
|||
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|||
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|||
|
reflectedLight.indirectDiffuse += lightMapIrradiance;
|
|||
|
#endif`,lTt=`#ifdef USE_LIGHTMAP
|
|||
|
uniform sampler2D lightMap;
|
|||
|
uniform float lightMapIntensity;
|
|||
|
#endif`,cTt=`LambertMaterial material;
|
|||
|
material.diffuseColor = diffuseColor.rgb;
|
|||
|
material.specularStrength = specularStrength;`,dTt=`varying vec3 vViewPosition;
|
|||
|
struct LambertMaterial {
|
|||
|
vec3 diffuseColor;
|
|||
|
float specularStrength;
|
|||
|
};
|
|||
|
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|||
|
vec3 irradiance = dotNL * directLight.color;
|
|||
|
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
#define RE_Direct RE_Direct_Lambert
|
|||
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,uTt=`uniform bool receiveShadow;
|
|||
|
uniform vec3 ambientLightColor;
|
|||
|
#if defined( USE_LIGHT_PROBES )
|
|||
|
uniform vec3 lightProbe[ 9 ];
|
|||
|
#endif
|
|||
|
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|||
|
float x = normal.x, y = normal.y, z = normal.z;
|
|||
|
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|||
|
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|||
|
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|||
|
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|||
|
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|||
|
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|||
|
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|||
|
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|||
|
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|||
|
return result;
|
|||
|
}
|
|||
|
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
|||
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|||
|
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|||
|
return irradiance;
|
|||
|
}
|
|||
|
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
|||
|
vec3 irradiance = ambientLightColor;
|
|||
|
return irradiance;
|
|||
|
}
|
|||
|
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
|||
|
#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;
|
|||
|
}
|
|||
|
#endif`,pTt=`#ifdef USE_ENVMAP
|
|||
|
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
|
|||
|
#endif`,fTt=`ToonMaterial material;
|
|||
|
material.diffuseColor = diffuseColor.rgb;`,hTt=`varying vec3 vViewPosition;
|
|||
|
struct ToonMaterial {
|
|||
|
vec3 diffuseColor;
|
|||
|
};
|
|||
|
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
|
|||
|
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
#define RE_Direct RE_Direct_Toon
|
|||
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,mTt=`BlinnPhongMaterial material;
|
|||
|
material.diffuseColor = diffuseColor.rgb;
|
|||
|
material.specularColor = specular;
|
|||
|
material.specularShininess = shininess;
|
|||
|
material.specularStrength = specularStrength;`,_Tt=`varying vec3 vViewPosition;
|
|||
|
struct BlinnPhongMaterial {
|
|||
|
vec3 diffuseColor;
|
|||
|
vec3 specularColor;
|
|||
|
float specularShininess;
|
|||
|
float specularStrength;
|
|||
|
};
|
|||
|
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|||
|
vec3 irradiance = dotNL * directLight.color;
|
|||
|
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|||
|
}
|
|||
|
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|||
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|||
|
}
|
|||
|
#define RE_Direct RE_Direct_BlinnPhong
|
|||
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,gTt=`PhysicalMaterial material;
|
|||
|
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|||
|
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|||
|
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|||
|
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
|||
|
material.roughness = min( material.roughness, 1.0 );
|
|||
|
#ifdef IOR
|
|||
|
material.ior = ior;
|
|||
|
#ifdef USE_SPECULAR
|
|||
|
float specularIntensityFactor = specularIntensity;
|
|||
|
vec3 specularColorFactor = specularColor;
|
|||
|
#ifdef USE_SPECULAR_COLORMAP
|
|||
|
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_INTENSITYMAP
|
|||
|
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
|
|||
|
#endif
|
|||
|
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
|||
|
#else
|
|||
|
float specularIntensityFactor = 1.0;
|
|||
|
vec3 specularColorFactor = vec3( 1.0 );
|
|||
|
material.specularF90 = 1.0;
|
|||
|
#endif
|
|||
|
material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
|
|||
|
#else
|
|||
|
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
|
|||
|
material.specularF90 = 1.0;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
material.clearcoat = clearcoat;
|
|||
|
material.clearcoatRoughness = clearcoatRoughness;
|
|||
|
material.clearcoatF0 = vec3( 0.04 );
|
|||
|
material.clearcoatF90 = 1.0;
|
|||
|
#ifdef USE_CLEARCOATMAP
|
|||
|
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|||
|
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
|
|||
|
#endif
|
|||
|
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
|||
|
material.clearcoatRoughness += geometryRoughness;
|
|||
|
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE
|
|||
|
material.iridescence = iridescence;
|
|||
|
material.iridescenceIOR = iridescenceIOR;
|
|||
|
#ifdef USE_IRIDESCENCEMAP
|
|||
|
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|||
|
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
|
|||
|
#else
|
|||
|
material.iridescenceThickness = iridescenceThicknessMaximum;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN
|
|||
|
material.sheenColor = sheenColor;
|
|||
|
#ifdef USE_SHEEN_COLORMAP
|
|||
|
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
|
|||
|
#endif
|
|||
|
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
|
|||
|
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|||
|
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPY
|
|||
|
#ifdef USE_ANISOTROPYMAP
|
|||
|
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
|
|||
|
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
|
|||
|
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
|
|||
|
#else
|
|||
|
vec2 anisotropyV = anisotropyVector;
|
|||
|
#endif
|
|||
|
material.anisotropy = length( anisotropyV );
|
|||
|
if( material.anisotropy == 0.0 ) {
|
|||
|
anisotropyV = vec2( 1.0, 0.0 );
|
|||
|
} else {
|
|||
|
anisotropyV /= material.anisotropy;
|
|||
|
material.anisotropy = saturate( material.anisotropy );
|
|||
|
}
|
|||
|
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|||
|
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|||
|
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|||
|
#endif`,bTt=`struct PhysicalMaterial {
|
|||
|
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 );
|
|||
|
}`,vTt=`
|
|||
|
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 );
|
|||
|
#endif`,yTt=`#if defined( RE_IndirectDiffuse )
|
|||
|
#ifdef USE_LIGHTMAP
|
|||
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|||
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|||
|
irradiance += lightMapIrradiance;
|
|||
|
#endif
|
|||
|
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|||
|
iblIrradiance += getIBLIrradiance( geometryNormal );
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|||
|
#ifdef USE_ANISOTROPY
|
|||
|
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
|
|||
|
#else
|
|||
|
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|||
|
#endif
|
|||
|
#endif`,ETt=`#if defined( RE_IndirectDiffuse )
|
|||
|
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|||
|
#endif
|
|||
|
#if defined( RE_IndirectSpecular )
|
|||
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|||
|
#endif`,STt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|||
|
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|||
|
#endif`,TTt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|||
|
uniform float logDepthBufFC;
|
|||
|
varying float vFragDepth;
|
|||
|
varying float vIsPerspective;
|
|||
|
#endif`,xTt=`#ifdef USE_LOGDEPTHBUF
|
|||
|
#ifdef USE_LOGDEPTHBUF_EXT
|
|||
|
varying float vFragDepth;
|
|||
|
varying float vIsPerspective;
|
|||
|
#else
|
|||
|
uniform float logDepthBufFC;
|
|||
|
#endif
|
|||
|
#endif`,wTt=`#ifdef USE_LOGDEPTHBUF
|
|||
|
#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
|
|||
|
#endif`,CTt=`#ifdef USE_MAP
|
|||
|
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;
|
|||
|
#endif`,RTt=`#ifdef USE_MAP
|
|||
|
uniform sampler2D map;
|
|||
|
#endif`,ATt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|||
|
#if defined( USE_POINTS_UV )
|
|||
|
vec2 uv = vUv;
|
|||
|
#else
|
|||
|
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_MAP
|
|||
|
diffuseColor *= texture2D( map, uv );
|
|||
|
#endif
|
|||
|
#ifdef USE_ALPHAMAP
|
|||
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|||
|
#endif`,MTt=`#if defined( USE_POINTS_UV )
|
|||
|
varying vec2 vUv;
|
|||
|
#else
|
|||
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|||
|
uniform mat3 uvTransform;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_MAP
|
|||
|
uniform sampler2D map;
|
|||
|
#endif
|
|||
|
#ifdef USE_ALPHAMAP
|
|||
|
uniform sampler2D alphaMap;
|
|||
|
#endif`,NTt=`float metalnessFactor = metalness;
|
|||
|
#ifdef USE_METALNESSMAP
|
|||
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|||
|
metalnessFactor *= texelMetalness.b;
|
|||
|
#endif`,OTt=`#ifdef USE_METALNESSMAP
|
|||
|
uniform sampler2D metalnessMap;
|
|||
|
#endif`,ITt=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
|
|||
|
vColor *= morphTargetBaseInfluence;
|
|||
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|||
|
#if defined( USE_COLOR_ALPHA )
|
|||
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
|
|||
|
#elif defined( USE_COLOR )
|
|||
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|||
|
#endif
|
|||
|
}
|
|||
|
#endif`,kTt=`#ifdef USE_MORPHNORMALS
|
|||
|
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
|
|||
|
#endif`,DTt=`#ifdef USE_MORPHTARGETS
|
|||
|
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
|
|||
|
#endif`,LTt=`#ifdef USE_MORPHTARGETS
|
|||
|
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
|
|||
|
#endif`,PTt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|||
|
#ifdef FLAT_SHADED
|
|||
|
vec3 fdx = dFdx( vViewPosition );
|
|||
|
vec3 fdy = dFdy( vViewPosition );
|
|||
|
vec3 normal = normalize( cross( fdx, fdy ) );
|
|||
|
#else
|
|||
|
vec3 normal = normalize( vNormal );
|
|||
|
#ifdef DOUBLE_SIDED
|
|||
|
normal *= faceDirection;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
|
|||
|
#ifdef USE_TANGENT
|
|||
|
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
|||
|
#else
|
|||
|
mat3 tbn = getTangentFrame( - vViewPosition, normal,
|
|||
|
#if defined( USE_NORMALMAP )
|
|||
|
vNormalMapUv
|
|||
|
#elif defined( USE_CLEARCOAT_NORMALMAP )
|
|||
|
vClearcoatNormalMapUv
|
|||
|
#else
|
|||
|
vUv
|
|||
|
#endif
|
|||
|
);
|
|||
|
#endif
|
|||
|
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
|||
|
tbn[0] *= faceDirection;
|
|||
|
tbn[1] *= faceDirection;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
#ifdef USE_TANGENT
|
|||
|
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
|||
|
#else
|
|||
|
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
|
|||
|
#endif
|
|||
|
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
|||
|
tbn2[0] *= faceDirection;
|
|||
|
tbn2[1] *= faceDirection;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
vec3 nonPerturbedNormal = normal;`,FTt=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|||
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|||
|
#ifdef FLIP_SIDED
|
|||
|
normal = - normal;
|
|||
|
#endif
|
|||
|
#ifdef DOUBLE_SIDED
|
|||
|
normal = normal * faceDirection;
|
|||
|
#endif
|
|||
|
normal = normalize( normalMatrix * normal );
|
|||
|
#elif defined( USE_NORMALMAP_TANGENTSPACE )
|
|||
|
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|||
|
mapN.xy *= normalScale;
|
|||
|
normal = normalize( tbn * mapN );
|
|||
|
#elif defined( USE_BUMPMAP )
|
|||
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|||
|
#endif`,UTt=`#ifndef FLAT_SHADED
|
|||
|
varying vec3 vNormal;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
varying vec3 vTangent;
|
|||
|
varying vec3 vBitangent;
|
|||
|
#endif
|
|||
|
#endif`,BTt=`#ifndef FLAT_SHADED
|
|||
|
varying vec3 vNormal;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
varying vec3 vTangent;
|
|||
|
varying vec3 vBitangent;
|
|||
|
#endif
|
|||
|
#endif`,GTt=`#ifndef FLAT_SHADED
|
|||
|
vNormal = normalize( transformedNormal );
|
|||
|
#ifdef USE_TANGENT
|
|||
|
vTangent = normalize( transformedTangent );
|
|||
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|||
|
#endif
|
|||
|
#endif`,zTt=`#ifdef USE_NORMALMAP
|
|||
|
uniform sampler2D normalMap;
|
|||
|
uniform vec2 normalScale;
|
|||
|
#endif
|
|||
|
#ifdef USE_NORMALMAP_OBJECTSPACE
|
|||
|
uniform mat3 normalMatrix;
|
|||
|
#endif
|
|||
|
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
|
|||
|
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
|
|||
|
vec3 q0 = dFdx( eye_pos.xyz );
|
|||
|
vec3 q1 = dFdy( eye_pos.xyz );
|
|||
|
vec2 st0 = dFdx( uv.st );
|
|||
|
vec2 st1 = dFdy( uv.st );
|
|||
|
vec3 N = surf_norm;
|
|||
|
vec3 q1perp = cross( q1, N );
|
|||
|
vec3 q0perp = cross( N, q0 );
|
|||
|
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
|||
|
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
|||
|
float det = max( dot( T, T ), dot( B, B ) );
|
|||
|
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|||
|
return mat3( T * scale, B * scale, N );
|
|||
|
}
|
|||
|
#endif`,VTt=`#ifdef USE_CLEARCOAT
|
|||
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|||
|
#endif`,HTt=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|||
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|||
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|||
|
#endif`,qTt=`#ifdef USE_CLEARCOATMAP
|
|||
|
uniform sampler2D clearcoatMap;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
uniform sampler2D clearcoatNormalMap;
|
|||
|
uniform vec2 clearcoatNormalScale;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|||
|
uniform sampler2D clearcoatRoughnessMap;
|
|||
|
#endif`,YTt=`#ifdef USE_IRIDESCENCEMAP
|
|||
|
uniform sampler2D iridescenceMap;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|||
|
uniform sampler2D iridescenceThicknessMap;
|
|||
|
#endif`,$Tt=`#ifdef OPAQUE
|
|||
|
diffuseColor.a = 1.0;
|
|||
|
#endif
|
|||
|
#ifdef USE_TRANSMISSION
|
|||
|
diffuseColor.a *= material.transmissionAlpha;
|
|||
|
#endif
|
|||
|
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,WTt=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|||
|
return normalize( normal ) * 0.5 + 0.5;
|
|||
|
}
|
|||
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|||
|
return 2.0 * rgb.xyz - 1.0;
|
|||
|
}
|
|||
|
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
|
|||
|
const 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 );
|
|||
|
}`,KTt=`#ifdef PREMULTIPLIED_ALPHA
|
|||
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|||
|
#endif`,jTt=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|||
|
#ifdef USE_BATCHING
|
|||
|
mvPosition = batchingMatrix * mvPosition;
|
|||
|
#endif
|
|||
|
#ifdef USE_INSTANCING
|
|||
|
mvPosition = instanceMatrix * mvPosition;
|
|||
|
#endif
|
|||
|
mvPosition = modelViewMatrix * mvPosition;
|
|||
|
gl_Position = projectionMatrix * mvPosition;`,QTt=`#ifdef DITHERING
|
|||
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|||
|
#endif`,XTt=`#ifdef DITHERING
|
|||
|
vec3 dithering( vec3 color ) {
|
|||
|
float grid_position = rand( gl_FragCoord.xy );
|
|||
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|||
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|||
|
return color + dither_shift_RGB;
|
|||
|
}
|
|||
|
#endif`,ZTt=`float roughnessFactor = roughness;
|
|||
|
#ifdef USE_ROUGHNESSMAP
|
|||
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|||
|
roughnessFactor *= texelRoughness.g;
|
|||
|
#endif`,JTt=`#ifdef USE_ROUGHNESSMAP
|
|||
|
uniform sampler2D roughnessMap;
|
|||
|
#endif`,ext=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|||
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|||
|
#endif
|
|||
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|||
|
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
|
|||
|
#endif
|
|||
|
#ifdef USE_SHADOWMAP
|
|||
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|||
|
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|||
|
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|||
|
struct DirectionalLightShadow {
|
|||
|
float 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
|
|||
|
}
|
|||
|
#endif`,txt=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|||
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|||
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|||
|
#endif
|
|||
|
#ifdef USE_SHADOWMAP
|
|||
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|||
|
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
|||
|
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|||
|
struct DirectionalLightShadow {
|
|||
|
float 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
|
|||
|
#endif`,nxt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|||
|
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|||
|
vec4 shadowWorldPosition;
|
|||
|
#endif
|
|||
|
#if defined( USE_SHADOWMAP )
|
|||
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|||
|
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
|||
|
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|||
|
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
|||
|
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#if NUM_SPOT_LIGHT_COORDS > 0
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
|
|||
|
shadowWorldPosition = worldPosition;
|
|||
|
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|||
|
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
|
|||
|
#endif
|
|||
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|||
|
}
|
|||
|
#pragma unroll_loop_end
|
|||
|
#endif`,rxt=`float getShadowMask() {
|
|||
|
float shadow = 1.0;
|
|||
|
#ifdef USE_SHADOWMAP
|
|||
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|||
|
DirectionalLightShadow directionalLight;
|
|||
|
#pragma unroll_loop_start
|
|||
|
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|||
|
directionalLight = directionalLightShadows[ i ];
|
|||
|
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.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;
|
|||
|
}`,ixt=`#ifdef USE_SKINNING
|
|||
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|||
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|||
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|||
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|||
|
#endif`,sxt=`#ifdef USE_SKINNING
|
|||
|
uniform mat4 bindMatrix;
|
|||
|
uniform mat4 bindMatrixInverse;
|
|||
|
uniform highp sampler2D boneTexture;
|
|||
|
mat4 getBoneMatrix( const in float i ) {
|
|||
|
int size = textureSize( boneTexture, 0 ).x;
|
|||
|
int j = int( i ) * 4;
|
|||
|
int x = j % size;
|
|||
|
int y = j / size;
|
|||
|
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
|
|||
|
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
|
|||
|
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
|
|||
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|||
|
return mat4( v1, v2, v3, v4 );
|
|||
|
}
|
|||
|
#endif`,oxt=`#ifdef USE_SKINNING
|
|||
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|||
|
vec4 skinned = vec4( 0.0 );
|
|||
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|||
|
skinned += boneMatY * skinVertex * skinWeight.y;
|
|||
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|||
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|||
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|||
|
#endif`,axt=`#ifdef USE_SKINNING
|
|||
|
mat4 skinMatrix = mat4( 0.0 );
|
|||
|
skinMatrix += skinWeight.x * boneMatX;
|
|||
|
skinMatrix += skinWeight.y * boneMatY;
|
|||
|
skinMatrix += skinWeight.z * boneMatZ;
|
|||
|
skinMatrix += skinWeight.w * boneMatW;
|
|||
|
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
|||
|
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
|||
|
#ifdef USE_TANGENT
|
|||
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|||
|
#endif
|
|||
|
#endif`,lxt=`float specularStrength;
|
|||
|
#ifdef USE_SPECULARMAP
|
|||
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|||
|
specularStrength = texelSpecular.r;
|
|||
|
#else
|
|||
|
specularStrength = 1.0;
|
|||
|
#endif`,cxt=`#ifdef USE_SPECULARMAP
|
|||
|
uniform sampler2D specularMap;
|
|||
|
#endif`,dxt=`#if defined( TONE_MAPPING )
|
|||
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|||
|
#endif`,uxt=`#ifndef saturate
|
|||
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|||
|
#endif
|
|||
|
uniform float toneMappingExposure;
|
|||
|
vec3 LinearToneMapping( vec3 color ) {
|
|||
|
return saturate( toneMappingExposure * color );
|
|||
|
}
|
|||
|
vec3 ReinhardToneMapping( vec3 color ) {
|
|||
|
color *= toneMappingExposure;
|
|||
|
return saturate( color / ( vec3( 1.0 ) + color ) );
|
|||
|
}
|
|||
|
vec3 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 );
|
|||
|
}
|
|||
|
vec3 CustomToneMapping( vec3 color ) { return color; }`,pxt=`#ifdef USE_TRANSMISSION
|
|||
|
material.transmission = transmission;
|
|||
|
material.transmissionAlpha = 1.0;
|
|||
|
material.thickness = thickness;
|
|||
|
material.attenuationDistance = attenuationDistance;
|
|||
|
material.attenuationColor = attenuationColor;
|
|||
|
#ifdef USE_TRANSMISSIONMAP
|
|||
|
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
|
|||
|
#endif
|
|||
|
#ifdef USE_THICKNESSMAP
|
|||
|
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
|
|||
|
#endif
|
|||
|
vec3 pos = vWorldPosition;
|
|||
|
vec3 v = normalize( cameraPosition - pos );
|
|||
|
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
|||
|
vec4 transmitted = getIBLVolumeRefraction(
|
|||
|
n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
|
|||
|
pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
|
|||
|
material.attenuationColor, material.attenuationDistance );
|
|||
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|||
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|||
|
#endif`,fxt=`#ifdef USE_TRANSMISSION
|
|||
|
uniform float transmission;
|
|||
|
uniform float thickness;
|
|||
|
uniform float attenuationDistance;
|
|||
|
uniform vec3 attenuationColor;
|
|||
|
#ifdef USE_TRANSMISSIONMAP
|
|||
|
uniform sampler2D transmissionMap;
|
|||
|
#endif
|
|||
|
#ifdef USE_THICKNESSMAP
|
|||
|
uniform sampler2D thicknessMap;
|
|||
|
#endif
|
|||
|
uniform vec2 transmissionSamplerSize;
|
|||
|
uniform sampler2D transmissionSamplerMap;
|
|||
|
uniform mat4 modelMatrix;
|
|||
|
uniform mat4 projectionMatrix;
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
float w0( float a ) {
|
|||
|
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
|
|||
|
}
|
|||
|
float w1( float a ) {
|
|||
|
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
|
|||
|
}
|
|||
|
float w2( float a ){
|
|||
|
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
|
|||
|
}
|
|||
|
float w3( float a ) {
|
|||
|
return ( 1.0 / 6.0 ) * ( a * a * a );
|
|||
|
}
|
|||
|
float g0( float a ) {
|
|||
|
return w0( a ) + w1( a );
|
|||
|
}
|
|||
|
float g1( float a ) {
|
|||
|
return w2( a ) + w3( a );
|
|||
|
}
|
|||
|
float h0( float a ) {
|
|||
|
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
|
|||
|
}
|
|||
|
float h1( float a ) {
|
|||
|
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
|
|||
|
}
|
|||
|
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
|
|||
|
uv = uv * texelSize.zw + 0.5;
|
|||
|
vec2 iuv = floor( uv );
|
|||
|
vec2 fuv = fract( uv );
|
|||
|
float g0x = g0( fuv.x );
|
|||
|
float g1x = g1( fuv.x );
|
|||
|
float h0x = h0( fuv.x );
|
|||
|
float h1x = h1( fuv.x );
|
|||
|
float h0y = h0( fuv.y );
|
|||
|
float h1y = h1( fuv.y );
|
|||
|
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
|||
|
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
|||
|
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
|||
|
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
|||
|
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
|
|||
|
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
|
|||
|
}
|
|||
|
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
|
|||
|
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
|
|||
|
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
|
|||
|
vec2 fLodSizeInv = 1.0 / fLodSize;
|
|||
|
vec2 cLodSizeInv = 1.0 / cLodSize;
|
|||
|
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
|
|||
|
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
|
|||
|
return mix( fSample, cSample, fract( lod ) );
|
|||
|
}
|
|||
|
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
|||
|
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
|||
|
vec3 modelScale;
|
|||
|
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
|||
|
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
|||
|
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
|||
|
return normalize( refractionVector ) * thickness * modelScale;
|
|||
|
}
|
|||
|
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
|||
|
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
|||
|
}
|
|||
|
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
|||
|
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
|||
|
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
|
|||
|
}
|
|||
|
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|||
|
if ( isinf( attenuationDistance ) ) {
|
|||
|
return vec3( 1.0 );
|
|||
|
} else {
|
|||
|
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
|||
|
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
|
|||
|
}
|
|||
|
}
|
|||
|
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
|||
|
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
|||
|
const in mat4 viewMatrix, const in mat4 projMatrix, const in float 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 );
|
|||
|
}
|
|||
|
#endif`,hxt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|||
|
varying vec2 vUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_MAP
|
|||
|
varying vec2 vMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ALPHAMAP
|
|||
|
varying vec2 vAlphaMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_LIGHTMAP
|
|||
|
varying vec2 vLightMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_AOMAP
|
|||
|
varying vec2 vAoMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_BUMPMAP
|
|||
|
varying vec2 vBumpMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_NORMALMAP
|
|||
|
varying vec2 vNormalMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_EMISSIVEMAP
|
|||
|
varying vec2 vEmissiveMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_METALNESSMAP
|
|||
|
varying vec2 vMetalnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ROUGHNESSMAP
|
|||
|
varying vec2 vRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPYMAP
|
|||
|
varying vec2 vAnisotropyMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOATMAP
|
|||
|
varying vec2 vClearcoatMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
varying vec2 vClearcoatNormalMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|||
|
varying vec2 vClearcoatRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCEMAP
|
|||
|
varying vec2 vIridescenceMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|||
|
varying vec2 vIridescenceThicknessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_COLORMAP
|
|||
|
varying vec2 vSheenColorMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|||
|
varying vec2 vSheenRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULARMAP
|
|||
|
varying vec2 vSpecularMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_COLORMAP
|
|||
|
varying vec2 vSpecularColorMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_INTENSITYMAP
|
|||
|
varying vec2 vSpecularIntensityMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_TRANSMISSIONMAP
|
|||
|
uniform mat3 transmissionMapTransform;
|
|||
|
varying vec2 vTransmissionMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_THICKNESSMAP
|
|||
|
uniform mat3 thicknessMapTransform;
|
|||
|
varying vec2 vThicknessMapUv;
|
|||
|
#endif`,mxt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|||
|
varying vec2 vUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_MAP
|
|||
|
uniform mat3 mapTransform;
|
|||
|
varying vec2 vMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ALPHAMAP
|
|||
|
uniform mat3 alphaMapTransform;
|
|||
|
varying vec2 vAlphaMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_LIGHTMAP
|
|||
|
uniform mat3 lightMapTransform;
|
|||
|
varying vec2 vLightMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_AOMAP
|
|||
|
uniform mat3 aoMapTransform;
|
|||
|
varying vec2 vAoMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_BUMPMAP
|
|||
|
uniform mat3 bumpMapTransform;
|
|||
|
varying vec2 vBumpMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_NORMALMAP
|
|||
|
uniform mat3 normalMapTransform;
|
|||
|
varying vec2 vNormalMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_DISPLACEMENTMAP
|
|||
|
uniform mat3 displacementMapTransform;
|
|||
|
varying vec2 vDisplacementMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_EMISSIVEMAP
|
|||
|
uniform mat3 emissiveMapTransform;
|
|||
|
varying vec2 vEmissiveMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_METALNESSMAP
|
|||
|
uniform mat3 metalnessMapTransform;
|
|||
|
varying vec2 vMetalnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ROUGHNESSMAP
|
|||
|
uniform mat3 roughnessMapTransform;
|
|||
|
varying vec2 vRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPYMAP
|
|||
|
uniform mat3 anisotropyMapTransform;
|
|||
|
varying vec2 vAnisotropyMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOATMAP
|
|||
|
uniform mat3 clearcoatMapTransform;
|
|||
|
varying vec2 vClearcoatMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
uniform mat3 clearcoatNormalMapTransform;
|
|||
|
varying vec2 vClearcoatNormalMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|||
|
uniform mat3 clearcoatRoughnessMapTransform;
|
|||
|
varying vec2 vClearcoatRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_COLORMAP
|
|||
|
uniform mat3 sheenColorMapTransform;
|
|||
|
varying vec2 vSheenColorMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|||
|
uniform mat3 sheenRoughnessMapTransform;
|
|||
|
varying vec2 vSheenRoughnessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCEMAP
|
|||
|
uniform mat3 iridescenceMapTransform;
|
|||
|
varying vec2 vIridescenceMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|||
|
uniform mat3 iridescenceThicknessMapTransform;
|
|||
|
varying vec2 vIridescenceThicknessMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULARMAP
|
|||
|
uniform mat3 specularMapTransform;
|
|||
|
varying vec2 vSpecularMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_COLORMAP
|
|||
|
uniform mat3 specularColorMapTransform;
|
|||
|
varying vec2 vSpecularColorMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_INTENSITYMAP
|
|||
|
uniform mat3 specularIntensityMapTransform;
|
|||
|
varying vec2 vSpecularIntensityMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_TRANSMISSIONMAP
|
|||
|
uniform mat3 transmissionMapTransform;
|
|||
|
varying vec2 vTransmissionMapUv;
|
|||
|
#endif
|
|||
|
#ifdef USE_THICKNESSMAP
|
|||
|
uniform mat3 thicknessMapTransform;
|
|||
|
varying vec2 vThicknessMapUv;
|
|||
|
#endif`,_xt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|||
|
vUv = vec3( uv, 1 ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_MAP
|
|||
|
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_ALPHAMAP
|
|||
|
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_LIGHTMAP
|
|||
|
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_AOMAP
|
|||
|
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_BUMPMAP
|
|||
|
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_NORMALMAP
|
|||
|
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_DISPLACEMENTMAP
|
|||
|
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_EMISSIVEMAP
|
|||
|
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_METALNESSMAP
|
|||
|
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_ROUGHNESSMAP
|
|||
|
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_ANISOTROPYMAP
|
|||
|
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOATMAP
|
|||
|
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|||
|
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|||
|
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCEMAP
|
|||
|
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|||
|
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_COLORMAP
|
|||
|
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|||
|
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULARMAP
|
|||
|
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_COLORMAP
|
|||
|
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_INTENSITYMAP
|
|||
|
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_TRANSMISSIONMAP
|
|||
|
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#ifdef USE_THICKNESSMAP
|
|||
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|||
|
#endif`,gxt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|||
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|||
|
#ifdef USE_BATCHING
|
|||
|
worldPosition = batchingMatrix * worldPosition;
|
|||
|
#endif
|
|||
|
#ifdef USE_INSTANCING
|
|||
|
worldPosition = instanceMatrix * worldPosition;
|
|||
|
#endif
|
|||
|
worldPosition = modelMatrix * worldPosition;
|
|||
|
#endif`;const bxt=`varying vec2 vUv;
|
|||
|
uniform mat3 uvTransform;
|
|||
|
void main() {
|
|||
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|||
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|||
|
}`,vxt=`uniform sampler2D t2D;
|
|||
|
uniform float backgroundIntensity;
|
|||
|
varying vec2 vUv;
|
|||
|
void main() {
|
|||
|
vec4 texColor = texture2D( t2D, vUv );
|
|||
|
#ifdef DECODE_VIDEO_TEXTURE
|
|||
|
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
|
|||
|
#endif
|
|||
|
texColor.rgb *= backgroundIntensity;
|
|||
|
gl_FragColor = texColor;
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
}`,yxt=`varying vec3 vWorldDirection;
|
|||
|
#include <common>
|
|||
|
void main() {
|
|||
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|||
|
#include <begin_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
gl_Position.z = gl_Position.w;
|
|||
|
}`,Ext=`#ifdef ENVMAP_TYPE_CUBE
|
|||
|
uniform samplerCube envMap;
|
|||
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|||
|
uniform sampler2D envMap;
|
|||
|
#endif
|
|||
|
uniform float flipEnvMap;
|
|||
|
uniform float backgroundBlurriness;
|
|||
|
uniform float backgroundIntensity;
|
|||
|
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>
|
|||
|
}`,Sxt=`varying vec3 vWorldDirection;
|
|||
|
#include <common>
|
|||
|
void main() {
|
|||
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|||
|
#include <begin_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
gl_Position.z = gl_Position.w;
|
|||
|
}`,Txt=`uniform samplerCube tCube;
|
|||
|
uniform float tFlip;
|
|||
|
uniform float opacity;
|
|||
|
varying vec3 vWorldDirection;
|
|||
|
void main() {
|
|||
|
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
|
|||
|
gl_FragColor = texColor;
|
|||
|
gl_FragColor.a *= opacity;
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
}`,xxt=`#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
varying vec2 vHighPrecisionZW;
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#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;
|
|||
|
}`,wxt=`#if DEPTH_PACKING == 3200
|
|||
|
uniform float opacity;
|
|||
|
#endif
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
varying vec2 vHighPrecisionZW;
|
|||
|
void main() {
|
|||
|
#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
|
|||
|
}`,Cxt=`#define DISTANCE
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <skinbase_vertex>
|
|||
|
#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;
|
|||
|
}`,Rxt=`#define DISTANCE
|
|||
|
uniform vec3 referencePosition;
|
|||
|
uniform float nearDistance;
|
|||
|
uniform float farDistance;
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main () {
|
|||
|
#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 );
|
|||
|
}`,Axt=`varying vec3 vWorldDirection;
|
|||
|
#include <common>
|
|||
|
void main() {
|
|||
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|||
|
#include <begin_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
}`,Mxt=`uniform sampler2D tEquirect;
|
|||
|
varying vec3 vWorldDirection;
|
|||
|
#include <common>
|
|||
|
void main() {
|
|||
|
vec3 direction = normalize( vWorldDirection );
|
|||
|
vec2 sampleUV = equirectUv( direction );
|
|||
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
}`,Nxt=`uniform float scale;
|
|||
|
attribute float lineDistance;
|
|||
|
varying float vLineDistance;
|
|||
|
#include <common>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
vLineDistance = scale * lineDistance;
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <morphcolor_vertex>
|
|||
|
#include <begin_vertex>
|
|||
|
#include <morphtarget_vertex>
|
|||
|
#include <project_vertex>
|
|||
|
#include <logdepthbuf_vertex>
|
|||
|
#include <clipping_planes_vertex>
|
|||
|
#include <fog_vertex>
|
|||
|
}`,Oxt=`uniform vec3 diffuse;
|
|||
|
uniform float opacity;
|
|||
|
uniform float dashSize;
|
|||
|
uniform float totalSize;
|
|||
|
varying float vLineDistance;
|
|||
|
#include <common>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#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>
|
|||
|
}`,Ixt=`#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <envmap_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <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>
|
|||
|
}`,kxt=`uniform vec3 diffuse;
|
|||
|
uniform float opacity;
|
|||
|
#ifndef FLAT_SHADED
|
|||
|
varying vec3 vNormal;
|
|||
|
#endif
|
|||
|
#include <common>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <aomap_pars_fragment>
|
|||
|
#include <lightmap_pars_fragment>
|
|||
|
#include <envmap_common_pars_fragment>
|
|||
|
#include <envmap_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <specularmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#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>
|
|||
|
}`,Dxt=`#define LAMBERT
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <envmap_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <shadowmap_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <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>
|
|||
|
}`,Lxt=`#define LAMBERT
|
|||
|
uniform vec3 diffuse;
|
|||
|
uniform vec3 emissive;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <aomap_pars_fragment>
|
|||
|
#include <lightmap_pars_fragment>
|
|||
|
#include <emissivemap_pars_fragment>
|
|||
|
#include <envmap_common_pars_fragment>
|
|||
|
#include <envmap_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <bsdfs>
|
|||
|
#include <lights_pars_begin>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <lights_lambert_pars_fragment>
|
|||
|
#include <shadowmap_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <specularmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#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>
|
|||
|
}`,Pxt=`#define MATCAP
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <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;
|
|||
|
}`,Fxt=`#define MATCAP
|
|||
|
uniform vec3 diffuse;
|
|||
|
uniform float opacity;
|
|||
|
uniform sampler2D matcap;
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#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>
|
|||
|
}`,Uxt=`#define NORMAL
|
|||
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#endif
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <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
|
|||
|
}`,Bxt=`#define NORMAL
|
|||
|
uniform float opacity;
|
|||
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#endif
|
|||
|
#include <packing>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#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
|
|||
|
}`,Gxt=`#define PHONG
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <envmap_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <shadowmap_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <morphcolor_vertex>
|
|||
|
#include <batching_vertex>
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <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>
|
|||
|
}`,zxt=`#define PHONG
|
|||
|
uniform vec3 diffuse;
|
|||
|
uniform vec3 emissive;
|
|||
|
uniform vec3 specular;
|
|||
|
uniform float shininess;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <aomap_pars_fragment>
|
|||
|
#include <lightmap_pars_fragment>
|
|||
|
#include <emissivemap_pars_fragment>
|
|||
|
#include <envmap_common_pars_fragment>
|
|||
|
#include <envmap_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <bsdfs>
|
|||
|
#include <lights_pars_begin>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <lights_phong_pars_fragment>
|
|||
|
#include <shadowmap_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <specularmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#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>
|
|||
|
}`,Vxt=`#define STANDARD
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#ifdef USE_TRANSMISSION
|
|||
|
varying vec3 vWorldPosition;
|
|||
|
#endif
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <shadowmap_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <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
|
|||
|
}`,Hxt=`#define STANDARD
|
|||
|
#ifdef PHYSICAL
|
|||
|
#define IOR
|
|||
|
#define USE_SPECULAR
|
|||
|
#endif
|
|||
|
uniform vec3 diffuse;
|
|||
|
uniform vec3 emissive;
|
|||
|
uniform float roughness;
|
|||
|
uniform float metalness;
|
|||
|
uniform float opacity;
|
|||
|
#ifdef IOR
|
|||
|
uniform float ior;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR
|
|||
|
uniform float specularIntensity;
|
|||
|
uniform vec3 specularColor;
|
|||
|
#ifdef USE_SPECULAR_COLORMAP
|
|||
|
uniform sampler2D specularColorMap;
|
|||
|
#endif
|
|||
|
#ifdef USE_SPECULAR_INTENSITYMAP
|
|||
|
uniform sampler2D specularIntensityMap;
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
#ifdef USE_CLEARCOAT
|
|||
|
uniform float clearcoat;
|
|||
|
uniform float clearcoatRoughness;
|
|||
|
#endif
|
|||
|
#ifdef USE_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>
|
|||
|
}`,qxt=`#define TOON
|
|||
|
varying vec3 vViewPosition;
|
|||
|
#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <displacementmap_pars_vertex>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <normal_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <shadowmap_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
#include <color_vertex>
|
|||
|
#include <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>
|
|||
|
}`,Yxt=`#define TOON
|
|||
|
uniform vec3 diffuse;
|
|||
|
uniform vec3 emissive;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <dithering_pars_fragment>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <aomap_pars_fragment>
|
|||
|
#include <lightmap_pars_fragment>
|
|||
|
#include <emissivemap_pars_fragment>
|
|||
|
#include <gradientmap_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <bsdfs>
|
|||
|
#include <lights_pars_begin>
|
|||
|
#include <normal_pars_fragment>
|
|||
|
#include <lights_toon_pars_fragment>
|
|||
|
#include <shadowmap_pars_fragment>
|
|||
|
#include <bumpmap_pars_fragment>
|
|||
|
#include <normalmap_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#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>
|
|||
|
}`,$xt=`uniform float size;
|
|||
|
uniform float scale;
|
|||
|
#include <common>
|
|||
|
#include <color_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
#ifdef USE_POINTS_UV
|
|||
|
varying vec2 vUv;
|
|||
|
uniform mat3 uvTransform;
|
|||
|
#endif
|
|||
|
void main() {
|
|||
|
#ifdef USE_POINTS_UV
|
|||
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|||
|
#endif
|
|||
|
#include <color_vertex>
|
|||
|
#include <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>
|
|||
|
}`,Wxt=`uniform vec3 diffuse;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <color_pars_fragment>
|
|||
|
#include <map_particle_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#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>
|
|||
|
}`,Kxt=`#include <common>
|
|||
|
#include <batching_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <morphtarget_pars_vertex>
|
|||
|
#include <skinning_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <shadowmap_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <batching_vertex>
|
|||
|
#include <beginnormal_vertex>
|
|||
|
#include <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>
|
|||
|
}`,jxt=`uniform vec3 color;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <packing>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <bsdfs>
|
|||
|
#include <lights_pars_begin>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <shadowmap_pars_fragment>
|
|||
|
#include <shadowmask_pars_fragment>
|
|||
|
void main() {
|
|||
|
#include <logdepthbuf_fragment>
|
|||
|
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
|||
|
#include <tonemapping_fragment>
|
|||
|
#include <colorspace_fragment>
|
|||
|
#include <fog_fragment>
|
|||
|
}`,Qxt=`uniform float rotation;
|
|||
|
uniform vec2 center;
|
|||
|
#include <common>
|
|||
|
#include <uv_pars_vertex>
|
|||
|
#include <fog_pars_vertex>
|
|||
|
#include <logdepthbuf_pars_vertex>
|
|||
|
#include <clipping_planes_pars_vertex>
|
|||
|
void main() {
|
|||
|
#include <uv_vertex>
|
|||
|
vec4 mvPosition = modelViewMatrix * 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>
|
|||
|
}`,Xxt=`uniform vec3 diffuse;
|
|||
|
uniform float opacity;
|
|||
|
#include <common>
|
|||
|
#include <uv_pars_fragment>
|
|||
|
#include <map_pars_fragment>
|
|||
|
#include <alphamap_pars_fragment>
|
|||
|
#include <alphatest_pars_fragment>
|
|||
|
#include <alphahash_pars_fragment>
|
|||
|
#include <fog_pars_fragment>
|
|||
|
#include <logdepthbuf_pars_fragment>
|
|||
|
#include <clipping_planes_pars_fragment>
|
|||
|
void main() {
|
|||
|
#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>
|
|||
|
}`,xt={alphahash_fragment:vSt,alphahash_pars_fragment:ySt,alphamap_fragment:ESt,alphamap_pars_fragment:SSt,alphatest_fragment:TSt,alphatest_pars_fragment:xSt,aomap_fragment:wSt,aomap_pars_fragment:CSt,batching_pars_vertex:RSt,batching_vertex:ASt,begin_vertex:MSt,beginnormal_vertex:NSt,bsdfs:OSt,iridescence_fragment:ISt,bumpmap_pars_fragment:kSt,clipping_planes_fragment:DSt,clipping_planes_pars_fragment:LSt,clipping_planes_pars_vertex:PSt,clipping_planes_vertex:FSt,color_fragment:USt,color_pars_fragment:BSt,color_pars_vertex:GSt,color_vertex:zSt,common:VSt,cube_uv_reflection_fragment:HSt,defaultnormal_vertex:qSt,displacementmap_pars_vertex:YSt,displacementmap_vertex:$St,emissivemap_fragment:WSt,emissivemap_pars_fragment:KSt,colorspace_fragment:jSt,colorspace_pars_fragment:QSt,envmap_fragment:XSt,envmap_common_pars_fragment:ZSt,envmap_pars_fragment:JSt,envmap_pars_vertex:eTt,envmap_physical_pars_fragment:pTt,envmap_vertex:tTt,fog_vertex:nTt,fog_pars_vertex:rTt,fog_fragment:iTt,fog_pars_fragment:sTt,gradientmap_pars_fragment:oTt,lightmap_fragment:aTt,lightmap_pars_fragment:lTt,lights_lambert_fragment:cTt,lights_lambert_pars_fragment:dTt,lights_pars_begin:uTt,lights_toon_fragment:fTt,lights_toon_pars_fragment:hTt,lights_phong_fragment:mTt,lights_phong_pars_fragment:_Tt,lights_physical_fragment:gTt,lights_physical_pars_fragment:bTt,lights_fragment_begin:vTt,lights_fragment_maps:yTt,lights_fragment_end:ETt,logdepthbuf_fragment:STt,logdepthbuf_pars_fragment:TTt,logdepthbuf_pars_vertex:xTt,logdepthbuf_vertex:wTt,map_fragment:CTt,map_pars_fragment:RTt,map_particle_fragment:ATt,map_particle_pars_fragment:MTt,metalnessmap_fragment:NTt,metalnessmap_pars_fragment:OTt,morphcolor_vertex:ITt,morphnormal_vertex:kTt,morphtarget_pars_vertex:DTt,morphtarget_vertex:LTt,normal_fragment_begin:PTt,normal_fragment_maps:FTt,normal_pars_fragment:UTt,normal_pars_vertex:BTt,normal_vertex:GTt,normalmap_pars_fragment:zTt,clearcoat_normal_fragment_begin:VTt,clearcoat_normal_fragment_maps:HTt,clearcoat_pars_fragment:qTt,iridescence_pars_fragment:YTt,opaque_fragment:$Tt,packing:WTt,premultiplied_alpha_fragment:KTt,project_vertex:jTt,dithering_fragment:QTt,dithering_pars_fragment:XTt,roughnessmap_fragment:ZTt,roughnessmap_pars_fragment:JTt,shadowmap_pars_fragment:ext,shadowmap_pars_vertex:txt,shadowmap_vertex:nxt,shadowmask_pars_fragment:rxt,skinbase_vertex:ixt,skinning_pars_vertex:sxt,skinning_vertex:oxt,skinnormal_vertex:axt,specularmap_fragment:lxt,specularmap_pars_fragment:cxt,tonemapping_fragment:dxt,tonemapping_pars_fragment:uxt,transmission_fragment:pxt,transmission_pars_fragment:fxt,uv_pars_fragment:hxt,uv_pars_vertex:mxt,uv_vertex:_xt,worldpos_vertex:gxt,background_vert:bxt,background_frag:vxt,backgroundCube_vert:yxt,backgroundCube_frag:Ext,cube_vert:Sxt,cube_frag:Txt,depth_vert:xxt,depth_frag:wxt,distanceRGBA_vert:Cxt,distanceRGBA_frag:Rxt,equirect_vert:Axt,equirect_frag:Mxt,linedashed_vert:Nxt,linedashed_frag:Oxt,meshbasic_vert:Ixt,meshbasic_frag:kxt,meshlambert_vert:Dxt,meshlambert_frag:Lxt,meshmatcap_vert:Pxt,meshmatcap_frag:Fxt,meshnormal_vert:Uxt,meshnormal_frag:Bxt,meshphong_vert:Gxt,meshphong_frag:zxt,meshphysical_vert:Vxt,meshphysical_frag:Hxt,meshtoon_vert:qxt,meshtoon_frag:Yxt,points_vert:$xt,points_frag:Wxt,shadow_vert:Kxt,shadow_frag:jxt,sprite_vert:Qxt,sprite_frag:Xxt},Ye={common:{diffuse:{value:new _t(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ct},alphaMap:{value:null},alphaMapTransform:{value:new Ct},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ct}},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 Ct}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ct}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ct},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ct},normalScale:{value:new Ot(1,1)}},displacementmap:{displacementMap:{value:
|
|||
|
|
|||
|
precision mediump float;
|
|||
|
precision mediump int;
|
|||
|
|
|||
|
varying vec3 vOutputDirection;
|
|||
|
|
|||
|
uniform sampler2D envMap;
|
|||
|
uniform int samples;
|
|||
|
uniform float weights[ n ];
|
|||
|
uniform bool latitudinal;
|
|||
|
uniform float dTheta;
|
|||
|
uniform float mipInt;
|
|||
|
uniform vec3 poleAxis;
|
|||
|
|
|||
|
#define ENVMAP_TYPE_CUBE_UV
|
|||
|
#include <cube_uv_reflection_fragment>
|
|||
|
|
|||
|
vec3 getSample( float theta, vec3 axis ) {
|
|||
|
|
|||
|
float cosTheta = cos( theta );
|
|||
|
// Rodrigues' axis-angle rotation
|
|||
|
vec3 sampleDirection = vOutputDirection * cosTheta
|
|||
|
+ cross( axis, vOutputDirection ) * sin( theta )
|
|||
|
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|||
|
|
|||
|
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|||
|
|
|||
|
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|||
|
|
|||
|
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
axis = normalize( axis );
|
|||
|
|
|||
|
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|||
|
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|||
|
|
|||
|
for ( int i = 1; i < n; i++ ) {
|
|||
|
|
|||
|
if ( i >= samples ) {
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
float theta = dTheta * float( i );
|
|||
|
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|||
|
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
`,blending:Fs,depthTest:!1,depthWrite:!1})}function YC(){return new qo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:By(),fragmentShader:`
|
|||
|
|
|||
|
precision mediump float;
|
|||
|
precision mediump int;
|
|||
|
|
|||
|
varying vec3 vOutputDirection;
|
|||
|
|
|||
|
uniform sampler2D envMap;
|
|||
|
|
|||
|
#include <common>
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
vec3 outputDirection = normalize( vOutputDirection );
|
|||
|
vec2 uv = equirectUv( outputDirection );
|
|||
|
|
|||
|
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|||
|
|
|||
|
}
|
|||
|
`,blending:Fs,depthTest:!1,depthWrite:!1})}function $C(){return new qo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:By(),fragmentShader:`
|
|||
|
|
|||
|
precision mediump float;
|
|||
|
precision mediump int;
|
|||
|
|
|||
|
uniform float flipEnvMap;
|
|||
|
|
|||
|
varying vec3 vOutputDirection;
|
|||
|
|
|||
|
uniform samplerCube envMap;
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|||
|
|
|||
|
}
|
|||
|
`,blending:Fs,depthTest:!1,depthWrite:!1})}function By(){return`
|
|||
|
|
|||
|
precision mediump float;
|
|||
|
precision mediump int;
|
|||
|
|
|||
|
attribute float faceIndex;
|
|||
|
|
|||
|
varying vec3 vOutputDirection;
|
|||
|
|
|||
|
// RH coordinate system; PMREM face-indexing convention
|
|||
|
vec3 getDirection( vec2 uv, float face ) {
|
|||
|
|
|||
|
uv = 2.0 * uv - 1.0;
|
|||
|
|
|||
|
vec3 direction = vec3( uv, 1.0 );
|
|||
|
|
|||
|
if ( face == 0.0 ) {
|
|||
|
|
|||
|
direction = direction.zyx; // ( 1, v, u ) pos x
|
|||
|
|
|||
|
} else if ( face == 1.0 ) {
|
|||
|
|
|||
|
direction = direction.xzy;
|
|||
|
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|||
|
|
|||
|
} else if ( face == 2.0 ) {
|
|||
|
|
|||
|
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|||
|
|
|||
|
} else if ( face == 3.0 ) {
|
|||
|
|
|||
|
direction = direction.zyx;
|
|||
|
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|||
|
|
|||
|
} else if ( face == 4.0 ) {
|
|||
|
|
|||
|
direction = direction.xzy;
|
|||
|
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|||
|
|
|||
|
} else if ( face == 5.0 ) {
|
|||
|
|
|||
|
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return direction;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
|
|||
|
vOutputDirection = getDirection( uv, faceIndex );
|
|||
|
gl_Position = vec4( position, 1.0 );
|
|||
|
|
|||
|
}
|
|||
|
`}function o2t(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,d=l===Cb||l===Rb,u=l===rl||l===il;if(d||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new HC(n)),h=d?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(d&&h&&h.height>0||u&&h&&i(h)){t===null&&(t=new HC(n));const m=d?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,m),a.addEventListener("dispose",s),m.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 a2t(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 l2t(n,e,t,r){const i={},s=new WeakMap;function o(h){const m=h.target;m.index!==null&&e.remove(m.index);for(const _ in m.attributes)e.remove(m.attributes[_]);for(const _ in m.morphAttributes){const f=m.morphAttributes[_];for(let b=0,v=f.length;b<v;b++)e.remove(f[b])}m.removeEventListener("dispose",o),delete i[m.id];const g=s.get(m);g&&(e.remove(g),s.delete(m)),r.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function a(h,m){return i[m.id]===!0||(m.addEventListener("dispose",o),i[m.id]=!0,t.memory.geometries++),m}function l(h){const m=h.attributes;for(const _ in m)e.update(m[_],n.ARRAY_BUFFER);const g=h.morphAttributes;for(const _ in g){const f=g[_];for(let b=0,v=f.length;b<v;b++)e.update(f[b],n.ARRAY_BUFFER)}}function d(h){const m=[],g=h.index,_=h.attributes.position;let f=0;if(g!==null){const y=g.array;f=g.version;for(let E=0,S=y.length;E<S;E+=3){const R=y[E+0],w=y[E+1],A=y[E+2];m.push(R,w,w,A,A,R)}}else if(_!==void 0){const y=_.array;f=_.version;for(let E=0,S=y.length/3-1;E<S;E+=3){const R=E+0,w=E+1,A=E+2;m.push(R,w,w,A,A,R)}}else return;const b=new(WI(m)?ek:JI)(m,1);b.version=f;const v=s.get(h);v&&e.remove(v),s.set(h,b)}function u(h){const m=s.get(h);if(m){const g=h.index;g!==null&&m.version<g.version&&d(h)}else d(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function c2t(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,_){n.drawElements(s,_,a,g*l),t.update(_,s,1)}function h(g,_,f){if(f===0)return;let b,v;if(i)b=n,v="drawElementsInstanced";else if(b=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",b===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support ex
|
|||
|
`),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(`
|
|||
|
`)}function lwt(n){const e=Vt.getPrimaries(Vt.workingColorSpace),t=Vt.getPrimaries(n);let r;switch(e===t?r="":e===gp&&t===_p?r="LinearDisplayP3ToLinearSRGB":e===_p&&t===gp&&(r="LinearSRGBToLinearDisplayP3"),n){case Ln:case yf:return[r,"LinearTransferOETF"];case cn:case Dy:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[r,"LinearTransferOETF"]}}function eR(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()+`
|
|||
|
|
|||
|
`+i+`
|
|||
|
|
|||
|
`+awt(n.getShaderSource(e),o)}else return i}function cwt(n,e){const t=lwt(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function dwt(n,e){let t;switch(e){case o1t:t="Linear";break;case a1t:t="Reinhard";break;case l1t:t="OptimizedCineon";break;case c1t:t="ACESFilmic";break;case d1t:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function uwt(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(rc).join(`
|
|||
|
`)}function pwt(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(`
|
|||
|
`)}function fwt(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 rc(n){return n!==""}function tR(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 nR(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const hwt=/^[ \t]*#include +<([\w\d./]+)>/gm;function kb(n){return n.replace(hwt,_wt)}const mwt=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function _wt(n,e){let t=xt[e];if(t===void 0){const r=mwt.get(e);if(r!==void 0)t=xt[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 kb(t)}const gwt=/#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 rR(n){return n.replace(gwt,bwt)}function bwt(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 iR(n){let e="precision "+n.precision+` float;
|
|||
|
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 vwt(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===DI?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===DEt?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===Hi&&(e="SHADOWMAP_TYPE_VSM"),e}function ywt(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case rl:case il:e="ENVMAP_TYPE_CUBE";break;case vf:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Ewt(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case il:e="ENVMAP_MODE_REFRACTION";break}return e}function Swt(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Oy:e="ENVMAP_BLENDING_MULTIPLY";break;case i1t:e="ENVMAP_BLENDING_MIX";break;case s1t:e="ENVMAP_BLENDING_ADD";break}return e}function Twt(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 xwt(n,e,t,r){const i=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=vwt(t),d=ywt(t),u=Ewt(t),h=Swt(t),m=Twt(t),g=t.isWebGL2?"":uwt(t),_=pwt(s),f=i.createProgram();let b,v,y=t.glslVersion?"#version "+t.glslVersion+`
|
|||
|
`:"";t.isRawShaderMaterial?(b=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(rc).join(`
|
|||
|
`),b.length>0&&(b+=`
|
|||
|
`),v=[g,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(rc).join(`
|
|||
|
`),v.length>0&&(v+=`
|
|||
|
`)):(b=[iR(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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?
|
|||
|
`].filter(rc).join(`
|
|||
|
`),v=[g,iR(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+h:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.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!==Us?"#define TONE_MAPPING":"",t.toneMapping!==Us?xt.tonemapping_pars_fragment:"",t.toneMapping!==Us?dwt("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",xt.colorspace_pars_fragment,cwt("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|||
|
`].filter(rc).join(`
|
|||
|
`)),o=kb(o),o=tR(o,t),o=nR(o,t),a=kb(a),a=tR(a,t),a=nR(a,t),o=rR(o),a=rR(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es
|
|||
|
`,b=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|||
|
`)+`
|
|||
|
`+b,v=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===SC?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===SC?"":"#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(`
|
|||
|
`)+`
|
|||
|
`+v);const E=y+b+o,S=y+v+a,R=JC(i,i.VERTEX_SHADER,E),w=JC(i,i.FRAGMENT_SHADER,S);i.attachShader(f,R),i.attachShader(f,w),t.index0AttributeName!==void 0?i.bindAttribLocation(f,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(f,0,"position"),i.linkProgram(f);function A(z){if(n.debug.checkShaderErrors){const V=i.getProgramInfoLog(f).trim(),J=i.getShaderInfoLog(R).trim(),O=i.getShaderInfoLog(w).trim();let q=!0,k=!0;if(i.getProgramParameter(f,i.LINK_STATUS)===!1)if(q=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,f,R,w);else{const G=eR(i,R,"vertex"),Z=eR(i,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(f,i.VALIDATE_STATUS)+`
|
|||
|
|
|||
|
Program Info Log: `+V+`
|
|||
|
`+G+`
|
|||
|
`+Z)}else V!==""?console.warn("THREE.WebGLProgram: Program Info Log:",V):(J===""||O==="")&&(k=!1);k&&(z.diagnostics={runnable:q,programLog:V,vertexShader:{log:J,prefix:b},fragmentShader:{log:O,prefix:v}})}i.deleteShader(R),i.deleteShader(w),I=new Au(i,f),x=fwt(i,f)}let I;this.getUniforms=function(){return I===void 0&&A(this),I};let x;this.getAttributes=function(){return x===void 0&&A(this),x};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=i.getProgramParameter(f,swt)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(f),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=owt++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=R,this.fragmentShader=w,this}let wwt=0;class Cwt{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 Rwt(e),t.set(e,r)),r}}class Rwt{constructor(e){this.id=wwt++,this.code=e,this.usedTimes=0}}function Awt(n,e,t,r,i,s,o){const a=new XI,l=new Cwt,d=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,m=i.vertexTextures;let g=i.precision;const _={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 f(x){return x===0?"uv":`uv${x}`}function b(x,M,z,V,J){const O=V.fog,q=J.geometry,k=x.isMeshStandardMaterial?V.environment:null,G=(x.isMeshStandardMaterial?t:e).get(x.envMap||k),Z=G&&G.mapping===vf?G.image.height:null,oe=_[x.type];x.precision!==null&&(g=i.getMaxPrecision(x.precision),g!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",g,"instead."));const le=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,Te=le!==void 0?le.length:0;let xe=0;q.morphAttributes.position!==void 0&&(xe=1),q.morphAttributes.normal!==void 0&&(xe=2),q.morphAttributes.color!==void 0&&(xe=3);let de,he,Ie,Be;if(oe){const Pn=_i[oe];de=Pn.vertexShader,he=Pn.fragmentShader}else de=x.vertexShader,he=x.fragmentShader,l.update(x),Ie=l.getVertexShaderID(x),Be=l.getFragmentShaderID(x);const j=n.getRenderTarget(),me=J.isInstancedMesh===!0,_e=J.isBatchedMesh===!0,we=!!x.map,Fe=!!x.matcap,re=!!G,P=!!x.aoMap,U=!!x.lightMap,Q=!!x.bumpMap,pe=!!x.normalMap,fe=!!x.displacementMap,ie=!!x.emissiveMap,Ce=!!x.metalnessMap,ve=!!x.roughnessMap,ye=x.anisotropy>0,Re=x.clearcoat>0,L=x.iridescence>0,N=x.sheen>0,K=x.transmission>0,$=ye&&!!x.anisotropyMap,te=Re&&!!x.clearcoatMap,ue=Re&&!!x.clearcoatNormalMap,Me=Re&&!!x.clearcoatRoughnessMap,Oe=L&&!!x.iridescenceMap,De=L&&!!x.iridescenceThicknessMap,Je=N&&!!x.sheenColorMap,ut=N&&!!x.sheenRoughnessMap,Ue=!!x.specularMap,kt=!!x.specularColorMap,nt=!!x.specularIntensityMap,rt=K&&!!x.transmissionMap,it=K&&!!x.thicknessMap,je=!!x.gradientMap,Ze=!!x.alphaMap,ee=x.alphaTest>0,$e=!!x.alphaHash,Ge=!!x.extensions,Ne=!!q.attributes.uv1,Ve=!!q.attributes.uv2,ft=!!q.attributes.uv3;let Dt=Us;return x.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(Dt=n.toneMapping),{isWebGL2:u,sha
|
|||
|
gl_Position = vec4( position, 1.0 );
|
|||
|
}`,zwt=`uniform sampler2D shadow_pass;
|
|||
|
uniform vec2 resolution;
|
|||
|
uniform float radius;
|
|||
|
#include <packing>
|
|||
|
void main() {
|
|||
|
const float samples = float( VSM_SAMPLES );
|
|||
|
float mean = 0.0;
|
|||
|
float squared_mean = 0.0;
|
|||
|
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
|
|||
|
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
|
|||
|
for ( float i = 0.0; i < samples; i ++ ) {
|
|||
|
float uvOffset = uvStart + i * uvStride;
|
|||
|
#ifdef HORIZONTAL_PASS
|
|||
|
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
|
|||
|
mean += distribution.x;
|
|||
|
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
|||
|
#else
|
|||
|
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
|
|||
|
mean += depth;
|
|||
|
squared_mean += depth * depth;
|
|||
|
#endif
|
|||
|
}
|
|||
|
mean = mean / samples;
|
|||
|
squared_mean = squared_mean / samples;
|
|||
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|||
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|||
|
}`;function Vwt(n,e,t){let r=new Py;const i=new Ot,s=new Ot,o=new Jt,a=new Uwt({depthPacking:T1t}),l=new Bwt,d={},u=t.maxTextureSize,h={[ns]:pr,[pr]:ns,[gi]:gi},m=new qo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ot},radius:{value:4}},vertexShader:Gwt,fragmentShader:zwt}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const _=new Ii;_.setAttribute("position",new tr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new er(_,m),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=DI;let v=this.type;this.render=function(R,w,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||R.length===0)return;const I=n.getRenderTarget(),x=n.getActiveCubeFace(),M=n.getActiveMipmapLevel(),z=n.state;z.setBlending(Fs),z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);const V=v!==Hi&&this.type===Hi,J=v===Hi&&this.type!==Hi;for(let O=0,q=R.length;O<q;O++){const k=R[O],G=k.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",k,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;i.copy(G.mapSize);const Z=G.getFrameExtents();if(i.multiply(Z),s.copy(G.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/Z.x),i.x=s.x*Z.x,G.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/Z.y),i.y=s.y*Z.y,G.mapSize.y=s.y)),G.map===null||V===!0||J===!0){const le=this.type!==Hi?{minFilter:Cn,magFilter:Cn}:{};G.map!==null&&G.map.dispose(),G.map=new Ho(i.x,i.y,le),G.map.texture.name=k.name+".shadowMap",G.camera.updateProjectionMatrix()}n.setRenderTarget(G.map),n.clear();const oe=G.getViewportCount();for(let le=0;le<oe;le++){const Te=G.getViewport(le);o.set(s.x*Te.x,s.y*Te.y,s.x*Te.z,s.y*Te.w),z.viewport(o),G.updateMatrices(k,le),r=G.getFrustum(),S(w,A,G.camera,k,this.type)}G.isPointLightShadow!==!0&&this.type===Hi&&y(G,A),G.needsUpdate=!1}v=this.type,b.needsUpdate=!1,n.setRenderTarget(I,x,M)};function y(R,w){const A=e.update(f);m.defines.VSM_SAMPLES!==R.blurSamples&&(m.defines.VSM_SAMPLES=R.blurSamples,g.defines.VSM_SAMPLES=R.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Ho(i.x,i.y)),m.uniforms.shadow_pass.value=R.map.texture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,n.setRenderTarget(R.mapPass),n.clear(),n.renderBufferDirect(w,null,A,m,f,null),g.uniforms.shadow_pass.value=R.mapPass.texture,g.uniforms.resolution.value=R.mapSize,g.uniforms.radius.value=R.radius,n.setRenderTarget(R.map),n.clear(),n.renderBufferDirect(w,null,A,g,f,null)}function E(R,w,A,I){let x=null;const M=A.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(M!==void 0)x=M;else if(x=A.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 z=x.uuid,V=w.uuid;let J=d[z];J===void 0&&(J={},d[z]=J);let O=J[V];O===void 0&&(O=x.clone(),J[V]=O),x=O}if(x.visible=w.visible,x.wireframe=w.wireframe,I===Hi?x.side=w.shadowSide!==null?w.shadowSide:w.side:x.side=w.shadowSide!==null?w.shadowSide:h[w.side],x.alphaMap=w.alphaMap,x.alphaTest=w.alphaTest,x.map=w.map,x.clipShadows=w.clipShadows,x.clippingPlanes=w.clippingPlanes,x.clipIntersection=w.clipIntersection,x.displacementMap=w.displacementMap,x.displacementScale=w.displacementScale,x.displacementBias=w.displacementBias,x.wireframeLinewidth=w.wireframeLinewidth,x.linewidth=w.linewidth,A.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const z=n.properties.get(x);z.light=A}return x}function S(R,w,A,I,x){if(R.visible===!1)return;if(R.layers.test(w.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&x===Hi)&&(!R.frustumCulled||r.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,R.matrixWorld);const V=e.update(R),J=R.material;if(Array.isArray(J)){const O=V.groups;for(let q=0,k=O.length;q<k;q++){const G=O[q],Z=J[G.materialIndex];if(Z&&Z.visible){const oe=E(R,Z,I,x);R.onBeforeShadow(n,R,w,A,V,oe,G),n.renderBufferDirect(A,null,V,oe,R,G),R.onAfterShadow(n,R,w,A,
|
|||
|
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.
|
|||
|
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 $t extends Io{constructor(e){super(),this.entity=e}emit(e){this.listeners.forEach(t=>t(e,this.entity))}}class Hn extends Io{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 Sk extends Io{execute(e,t){let r=e;for(const i of this.listeners)r=i(r,t);return r}}class Tr extends Sk{constructor(e){super(),this.entity=e}execute(e){return super.execute(e,this.entity)}}class HRt extends Io{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 hi(){const n=Symbol(),e=new Map,t=new Set,r=(l,d)=>{d instanceof Io&&d.registerProxy(n,()=>{var u,h;return(h=(u=e.get(l))===null||u===void 0?void 0:u.listeners)!==null&&h!==void 0?h:[]})},i=l=>{const d=new Io;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 Io&&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 DR{constructor(e,t){if(this.destructed=!1,this.events={destruct:new $t(this)},!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Ji(),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 Tk{constructor(e,t){if(!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Ji(),this.from=e,this.to=t}}function Ub(n,e){return Object.fromEntries(Object.entries(n).map(([t,r])=>[t,e(r)]))}class xk{constructor(){this._title="",this.id=Ji(),this.events={loaded:new $t(this),beforeAddInput:new Hn(this),addInput:new $t(this),beforeRemoveInput:new Hn(this),removeInput:new $t(this),beforeAddOutput:new Hn(this),addOutput:new $t(this),beforeRemoveOutput:new Hn(this),removeOutput:new $t(this),beforeTitleChanged:new Hn(this),titleChanged:new $t(this),update:new $t(this)},this.hooks={beforeLoad:new Tr(this),afterSave:new Tr(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=Ub(this.inputs,i=>i.save()),t=Ub(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===
|
|||
|
This is likely a Baklava internal issue. Please report it on GitHub.`);const g=this.hooks.transferData.execute(d[m],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 ZRt=["INPUT","TEXTAREA","SELECT"];function Mk(n){return ZRt.includes(n.tagName)}let Bb=null;function JRt(n){Bb=n}function xr(){if(!Bb)throw new Error("providePlugin() must be called before usePlugin()");return{viewModel:Bb}}function $r(){const{viewModel:n}=xr();return{graph:ku(n.value,"displayedGraph"),switchGraph:n.value.switchGraph}}function Nk(n){const{graph:e}=$r(),t=ct(null),r=ct(null);return{dragging:tt(()=>!!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 Ok(n,e,t){if(!e.template)return!1;if(ml(e.template)===t)return!0;const r=n.graphTemplates.find(s=>ml(s)===t);return r?r.nodes.filter(s=>s.type.startsWith(qc)).some(s=>Ok(n,e,s.type)):!1}function Ik(n){return tt(()=>{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])=>!Ok(n.value.editor,n.value.displayedGraph,o)):s=s.filter(([o])=>![fl,hl].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 kk(){const{graph:n}=$r();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 eAt(){const{graph:n}=$r();let e=[],t=-1,r={x:0,y:0};const i=tt(()=>n.value.panning),s=Nk(i),o=tt(()=>({"transform-origin":"0 0",transform:`scale(${n.value.scaling}) translate(${n.value.panning.x}px, ${n.value.panning.y}px)`})),a=(g,_,f)=>{const b=[g/n.value.scaling-n.value.panning.x,_/n.value.scaling-n.value.panning.y],v=[g/f-n.value.panning.x,_/f-n.value.panning.y],y=[v[0]-b[0],v[1]-b[1]];n.value.panning.x+=y[0],n.value.panning.y+=y[1],n.value.scaling=f},l=g=>{g.preventDefault();let _=g.deltaY;g.deltaMode===1&&(_*=32);const f=n.value.scaling*(1-_/3e3);a(g.offsetX,g.offsetY,f)},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:_,ay:f,bx:b,by:v}=d();r={x:_+(b-_)/2,y:f+(v-f)/2}}},onPointerMove:g=>{for(let _=0;_<e.length;_++)if(g.pointerId==e[_].pointerId){e[_]=g;break}if(e.length==2){const{ax:_,ay:f,bx:b,by:v}=d(),y=_-b,E=f-v,S=Math.sqrt(y*y+E*E);if(t>0){const R=n.value.scaling*(1+(S-t)/500);a(r.x,r.y,R)}t=S}else s.onPointerMove(g)},onPointerUp:g=>{e=e.filter(_=>_.pointerId!==g.pointerId),t=-1,s.onPointerUp()},onMouseWheel:l}}var kr=(n=>(n[n.NONE=0]="NONE",n[n.ALLOWED=1]="ALLOWED",n[n.FORBIDDEN=2]="FORBIDDEN",n))(kr||{});const Dk=Symbol();function tAt(){const{graph:n}=$r(),e=ct(null),t=ct(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:kr.NONE,from:a.from},n.value.removeConnection(a)):e.value={status:kr.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?kr.ALLOWED:kr.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=kr.NONE,n.value.connections.forEach(l=>{l.isInDanger=!1}))};return Oa(Dk,{temporaryConnection:e,hoveredOver:o}),{temporaryConnection:e,onMouseMove:r,onMouseDown:i,onMouseUp:s,hoveredOver:o}}function nAt(n){const e=ct(!1),t=ct(0),r=ct(0),i=Ik(n),{transform:s}=kk(),o=tt(
|
|||
|
This may take some time the first time as some libraries need to be installed.`),ne.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 ne.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 ne.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 ne.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 ne.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 ne.get(`/apps/${n.folder_name}/README.md`);this.appCode=Bt(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 ne.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 ne.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 ne.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 ne.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 ne.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
|
|||
|
`+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);Pe(()=>{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),Pe(()=>{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),Pe(()=>{feather.replace()})),this.settingsChanged=!0,this.isModelSelected=!0}):this.$store.state.toast.showToast(`Model:
|
|||
|
`+n.model.name+`
|
|||
|
is not installed`,4,!1),Pe(()=>{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.`),ne.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 ne.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 ne.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 ne.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 ne.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 ne.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,ne.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,ne.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),ne.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 ne.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)}},UIt={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"},BIt={class:"panels-color shadow-lg rounded-lg p-4 max-w-4xl mx-auto mb-8"},GIt={class:"flex flex-wrap items-center justify-between gap-4"},zIt={key:0},VIt={key:1,class:"error"},HIt={class:"relative flex-grow max-w-md"},qIt={class:"flex items-center space-x-4"},YIt=["value"],$It={class:"flex items-center space-x-4"},WIt={key:0,class:"flex justify-center items-center space-x-2 my-8","aria-live":"polite"},KIt={key:1},jIt={class:"container mx-auto px-4 flex flex-column pb-20"},QIt={key:0},XIt={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8 mb-12"},ZIt={class:"container mx-auto px-4 flex flex-column pb-20"},JIt={class:"text-2xl font-bold my-8"},ekt={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8 mb-12"},tkt={key:2,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 overflow-y-auto"},nkt={class:"bg-white rounded-lg p-6 w-11/12 h-5/6 flex flex-col"},rkt={class:"flex justify-between items-center mb-4"},ikt={class:"text-2xl font-bold"},skt=["srcdoc"],okt={key:1,class:"text-center text-red-500"};function akt(n,e,t,r,i,s){const o=Xe("personality-entry");return T(),C("div",UIt,[c("nav",BIt,[c("div",GIt,[i.message?(T(),C("p",zIt,Y(i.message),1)):B("",!0),i.error?(T(),C("p",VIt,Y(i.error),1)):B("",!0),c("div",HIt,[D(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),[[ce,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",qIt,[e[7]||(e[7]=c("label",{for:"category-select",class:"font-semibold"},"Category:",-1)),D(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),C(ke,null,We(s.categories,a=>(T(),C("option",{key:a,value:a},Y(a),9,YIt))),128))],512),[[Ut,i.selectedCategory]])]),c("div",$It,[e[9]||(e[9]=c("label",{for:"sort-select",class:"font-semibold"},"Sort by:",-1)),D(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),[[Ut,i.sortBy]]),c("button",{onClick:e[3]||(e[3]=(...a)=>s.toggleSortOrder&&s.toggleSortOrder(...a)),class:"btn btn-secondary"},Y(i.sortOrder==="asc"?"↑":"↓"),1)])])]),i.loading?(T(),C("div",WIt,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(),C("div",KIt,[c("div",jIt,[s.fav
|