lollms-webui/web/dist/assets/index-16e94ccb.js

3908 lines
2.5 MiB
JavaScript
Raw Normal View History

2024-07-29 22:02:24 +00:00
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();function eb(n,e){const t=Object.create(null),s=n.split(",");for(let i=0;i<s.length;i++)t[s[i]]=!0;return e?i=>!!t[i.toLowerCase()]:i=>!!t[i]}const Kt={},Po=[],Os=()=>{},xI=()=>!1,CI=/^on[^a-z]/,nu=n=>CI.test(n),tb=n=>n.startsWith("onUpdate:"),tn=Object.assign,nb=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},wI=Object.prototype.hasOwnProperty,Lt=(n,e)=>wI.call(n,e),it=Array.isArray,Uo=n=>Sa(n)==="[object Map]",va=n=>Sa(n)==="[object Set]",jE=n=>Sa(n)==="[object Date]",RI=n=>Sa(n)==="[object RegExp]",gt=n=>typeof n=="function",nn=n=>typeof n=="string",vl=n=>typeof n=="symbol",Ht=n=>n!==null&&typeof n=="object",cw=n=>Ht(n)&&gt(n.then)&&gt(n.catch),dw=Object.prototype.toString,Sa=n=>dw.call(n),AI=n=>Sa(n).slice(8,-1),uw=n=>Sa(n)==="[object Object]",sb=n=>nn(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,od=eb(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),su=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},NI=/-(\w)/g,Js=su(n=>n.replace(NI,(e,t)=>t?t.toUpperCase():"")),OI=/\B([A-Z])/g,so=su(n=>n.replace(OI,"-$1").toLowerCase()),iu=su(n=>n.charAt(0).toUpperCase()+n.slice(1)),np=su(n=>n?`on${iu(n)}`:""),Sl=(n,e)=>!Object.is(n,e),Fo=(n,e)=>{for(let t=0;t<n.length;t++)n[t](e)},vd=(n,e,t)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value:t})},Sd=n=>{const e=parseFloat(n);return isNaN(e)?n:e},II=n=>{const e=nn(n)?Number(n):NaN;return isNaN(e)?n:e};let QE;const Xm=()=>QE||(QE=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function jt(n){if(it(n)){const e={};for(let t=0;t<n.length;t++){const s=n[t],i=nn(s)?LI(s):jt(s);if(i)for(const r in i)e[r]=i[r]}return e}else{if(nn(n))return n;if(Ht(n))return n}}const MI=/;(?![^(]*\))/g,DI=/:([^]+)/,kI=/\/\*[^]*?\*\//g;function LI(n){const e={};return n.replace(kI,"").split(MI).forEach(t=>{if(t){const s=t.split(DI);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function Fe(n){let e="";if(nn(n))e=n;else if(it(n))for(let t=0;t<n.length;t++){const s=Fe(n[t]);s&&(e+=s+" ")}else if(Ht(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}const PI="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",UI=eb(PI);function pw(n){return!!n||n===""}function FI(n,e){if(n.length!==e.length)return!1;let t=!0;for(let s=0;t&&s<n.length;s++)t=jr(n[s],e[s]);return t}function jr(n,e){if(n===e)return!0;let t=jE(n),s=jE(e);if(t||s)return t&&s?n.getTime()===e.getTime():!1;if(t=vl(n),s=vl(e),t||s)return n===e;if(t=it(n),s=it(e),t||s)return t&&s?FI(n,e):!1;if(t=Ht(n),s=Ht(e),t||s){if(!t||!s)return!1;const i=Object.keys(n).length,r=Object.keys(e).length;if(i!==r)return!1;for(const o in n){const a=n.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!jr(n[o],e[o]))return!1}}return String(n)===String(e)}function ib(n,e){return n.findIndex(t=>jr(t,e))}const ee=n=>nn(n)?n:n==null?"":it(n)||Ht(n)&&(n.toString===dw||!gt(n.toString))?JSON.stringify(n,_w,2):String(n),_w=(n,e)=>e&&e.__v_isRef?_w(n,e.value):Uo(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[s,i])=>(t[`${s} =>`]=i,t),{})}:va(e)?{[`Set(${e.size})`]:[...e.values()]}:Ht(e)&&!it(e)&&!uw(e)?String(e):e;let Xn;class hw{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Xn,!e&&Xn&&(this.index=(Xn.scopes||(Xn.scopes=[])).pu
2024-07-18 22:38:03 +00:00
* vuex v4.1.0
* (c) 2022 Evan You
* @license MIT
2024-07-29 22:02:24 +00:00
*/var gD="store";function wa(n,e){Object.keys(n).forEach(function(t){return e(n[t],t)})}function gR(n){return n!==null&&typeof n=="object"}function bD(n){return n&&typeof n.then=="function"}function ED(n,e){return function(){return n(e)}}function bR(n,e,t){return e.indexOf(n)<0&&(t&&t.prepend?e.unshift(n):e.push(n)),function(){var s=e.indexOf(n);s>-1&&e.splice(s,1)}}function ER(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;Eu(n,t,[],n._modules.root,!0),vb(n,t,e)}function vb(n,e,t){var s=n._state,i=n._scope;n.getters={},n._makeLocalGettersCache=Object.create(null);var r=n._wrappedGetters,o={},a={},l=BI(!0);l.run(function(){wa(r,function(u,d){o[d]=ED(u,n),a[d]=et(function(){return o[d]()}),Object.defineProperty(n.getters,d,{get:function(){return a[d].value},enumerable:!0})})}),n._state=Wn({data:e}),n._scope=l,n.strict&&xD(n),s&&t&&n._withCommit(function(){s.data=null}),i&&i.stop()}function Eu(n,e,t,s,i){var r=!t.length,o=n._modules.getNamespace(t);if(s.namespaced&&(n._modulesNamespaceMap[o],n._modulesNamespaceMap[o]=s),!r&&!i){var a=Sb(e,t.slice(0,-1)),l=t[t.length-1];n._withCommit(function(){a[l]=s.state})}var u=s.context=yD(n,o,t);s.forEachMutation(function(d,h){var f=o+h;vD(n,f,d,u)}),s.forEachAction(function(d,h){var f=d.root?h:o+h,_=d.handler||d;SD(n,f,_,u)}),s.forEachGetter(function(d,h){var f=o+h;TD(n,f,d,u)}),s.forEachChild(function(d,h){Eu(n,e,t.concat(h),d,i)})}function yD(n,e,t){var s=e==="",i={dispatch:s?n.dispatch:function(r,o,a){var l=Nd(r,o,a),u=l.payload,d=l.options,h=l.type;return(!d||!d.root)&&(h=e+h),n.dispatch(h,u)},commit:s?n.commit:function(r,o,a){var l=Nd(r,o,a),u=l.payload,d=l.options,h=l.type;(!d||!d.root)&&(h=e+h),n.commit(h,u,d)}};return Object.defineProperties(i,{getters:{get:s?function(){return n.getters}:function(){return yR(n,e)}},state:{get:function(){return Sb(n.state,t)}}}),i}function yR(n,e){if(!n._makeLocalGettersCache[e]){var t={},s=e.length;Object.keys(n.getters).forEach(function(i){if(i.slice(0,s)===e){var r=i.slice(s);Object.defineProperty(t,r,{get:function(){return n.getters[i]},enumerable:!0})}}),n._makeLocalGettersCache[e]=t}return n._makeLocalGettersCache[e]}function vD(n,e,t,s){var i=n._mutations[e]||(n._mutations[e]=[]);i.push(function(o){t.call(n,s.state,o)})}function SD(n,e,t,s){var i=n._actions[e]||(n._actions[e]=[]);i.push(function(o){var a=t.call(n,{dispatch:s.dispatch,commit:s.commit,getters:s.getters,state:s.state,rootGetters:n.getters,rootState:n.state},o);return bD(a)||(a=Promise.resolve(a)),n._devtoolHook?a.catch(function(l){throw n._devtoolHook.emit("vuex:error",l),l}):a})}function TD(n,e,t,s){n._wrappedGetters[e]||(n._wrappedGetters[e]=function(r){return t(s.state,s.getters,r.state,r.getters)})}function xD(n){Fn(function(){return n._state.data},function(){},{deep:!0,flush:"sync"})}function Sb(n,e){return e.reduce(function(t,s){return t[s]},n)}function Nd(n,e,t){return gR(n)&&n.type&&(t=e,e=n,n=n.type),{type:n,payload:e,options:t}}var CD="vuex bindings",Ly="vuex:mutations",up="vuex:actions",uo="vuex",wD=0;function RD(n,e){mD({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:[CD]},function(t){t.addTimelineLayer({id:Ly,label:"Vuex Mutations",color:Py}),t.addTimelineLayer({id:up,label:"Vuex Actions",color:Py}),t.addInspector({id:uo,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),t.on.getInspectorTree(function(s){if(s.app===n&&s.inspectorId===uo)if(s.filter){var i=[];xR(i,e._modules.root,s.filter,""),s.rootNodes=i}else s.rootNodes=[TR(e._modules.root,"")]}),t.on.getInspectorState(function(s){if(s.app===n&&s.inspectorId===uo){var i=s.nodeId;yR(e,i),s.state=OD(MD(e._modules,i),i==="root"?e.getters:e._makeLocalGettersCache,i)}}),t.on.editInspectorState(function(s){if(s.app===n&&s.inspectorId===uo){var i=s.nodeId,r=s.path;i!=="root"&&(r=i.split("/").filter(Boolean).concat(r)),e._withCommit(function(){s.set(e._st
`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),s=o.substring(i+1).trim(),!(!t||e[t]&&Lk[t])&&(t==="set-cookie"?e[t]?e[t].push(s):e[t]=[s]:e[t]=e[t]?e[t]+", "+s:s)}),e},zy=Symbol("internals");function qa(n){return n&&String(n).trim().toLowerCase()}function dd(n){return n===!1||n==null?n:Ie.isArray(n)?n.map(dd):String(n)}function Uk(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(n);)e[s[1]]=s[2];return e}const Fk=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function _p(n,e,t,s,i){if(Ie.isFunction(s))return s.call(this,e,t);if(i&&(e=t),!!Ie.isString(e)){if(Ie.isString(s))return e.indexOf(s)!==-1;if(Ie.isRegExp(s))return s.test(e)}}function Bk(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}function Gk(n,e){const t=Ie.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(n,s+t,{value:function(i,r,o){return this[s].call(this,e,i,r,o)},configurable:!0})})}class xu{constructor(e){e&&this.set(e)}set(e,t,s){const i=this;function r(a,l,u){const d=qa(l);if(!d)throw new Error("header name must be a non-empty string");const h=Ie.findKey(i,d);(!h||i[h]===void 0||u===!0||u===void 0&&i[h]!==!1)&&(i[h||l]=dd(a))}const o=(a,l)=>Ie.forEach(a,(u,d)=>r(u,d,l));return Ie.isPlainObject(e)||e instanceof this.constructor?o(e,t):Ie.isString(e)&&(e=e.trim())&&!Fk(e)?o(Pk(e),t):e!=null&&r(t,e,s),this}get(e,t){if(e=qa(e),e){const s=Ie.findKey(this,e);if(s){const i=this[s];if(!t)return i;if(t===!0)return Uk(i);if(Ie.isFunction(t))return t.call(this,i,s);if(Ie.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=qa(e),e){const s=Ie.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||_p(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let i=!1;function r(o){if(o=qa(o),o){const a=Ie.findKey(s,o);a&&(!t||_p(s,s[a],a,t))&&(delete s[a],i=!0)}}return Ie.isArray(e)?e.forEach(r):r(e),i}clear(e){const t=Object.keys(this);let s=t.length,i=!1;for(;s--;){const r=t[s];(!e||_p(this,this[r],r,e,!0))&&(delete this[r],i=!0)}return i}normalize(e){const t=this,s={};return Ie.forEach(this,(i,r)=>{const o=Ie.findKey(s,r);if(o){t[o]=dd(i),delete t[r];return}const a=e?Bk(r):String(r).trim();a!==r&&delete t[r],t[a]=dd(i),s[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ie.forEach(this,(s,i)=>{s!=null&&s!==!1&&(t[i]=e&&Ie.isArray(s)?s.join(", "):s)}),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 s=new this(e);return t.forEach(i=>s.set(i)),s}static accessor(e){const s=(this[zy]=this[zy]={accessors:{}}).accessors,i=this.prototype;function r(o){const a=qa(o);s[a]||(Gk(i,o),s[a]=!0)}return Ie.isArray(e)?e.forEach(r):r(e),this}}xu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ie.reduceDescriptors(xu.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(s){this[t]=s}}});Ie.freezeMethods(xu);const Ti=xu;function hp(n,e){const t=this||Rb,s=e||t,i=Ti.from(s.headers);let r=s.data;return Ie.forEach(n,function(a){r=a.call(t,r,i.normalize(),e?e.status:void 0)}),i.normalize(),r}function HR(n){return!!(n&&n.__CANCEL__)}function $l(n,e,t){Mt.call(this,n??"canceled",Mt.ERR_CANCELED,e,t),this.name="CanceledError"}Ie.inherits($l,Mt,{__CANCEL__:!0});function Vk(n,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?n(t):e(new Mt("Request failed with status code "+t.status,[Mt.ERR_BAD_REQUEST,Mt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const zk=Ws.hasStandardBrowserEnv?{write(n,e,t,s,i,r){const o=[n+"="+encodeURIComponent(e)];Ie.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Ie.isString(s)&&o.push("path="+s),Ie.isString(i)&&o.push("domain="+i),r===!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 Hk(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function qk(n,e){return e?n.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):n}function qR(n,e){return n&&!Hk(e)?qk(n,e):e}const Yk=Ws.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let s;function i(r){let o=r;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 s=i(window.location.href),function(o){const a=Ie.isString(o)?i(o):o;return a.protocol===s.protocol&&a.host===s.host}}():function(){return function(){return!0}}();function $k(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function Wk(n,e){n=n||10;const t=new Array(n),s=new Array(n);let i=0,r=0,o;return e=e!==void 0?e:1e3,function(l){const u=Date.now(),d=s[r];o||(o=u),t[i]=l,s[i]=u;let h=r,f=0;for(;h!==i;)f+=t[h++],h=h%n;if(i=(i+1)%n,i===r&&(r=(r+1)%n),u-o<e)return;const _=d&&u-d;return _?Math.round(f*1e3/_):void 0}}function Hy(n,e){let t=0;const s=Wk(50,250);return i=>{const r=i.loaded,o=i.lengthComputable?i.total:void 0,a=r-t,l=s(a),u=r<=o;t=r;const d={loaded:r,total:o,progress:o?r/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&u?(o-r)/l:void 0,event:i};d[e?"download":"upload"]=!0,n(d)}}const Kk=typeof XMLHttpRequest<"u",jk=Kk&&function(n){return new Promise(function(t,s){let i=n.data;const r=Ti.from(n.headers).normalize();let{responseType:o,withXSRFToken:a}=n,l;function u(){n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let d;if(Ie.isFormData(i)){if(Ws.hasStandardBrowserEnv||Ws.hasStandardBrowserWebWorkerEnv)r.setContentType(!1);else if((d=r.getContentType())!==!1){const[E,...b]=d?d.split(";").map(g=>g.trim()).filter(Boolean):[];r.setContentType([E||"multipart/form-data",...b].join("; "))}}let h=new XMLHttpRequest;if(n.auth){const E=n.auth.username||"",b=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";r.set("Authorization","Basic "+btoa(E+":"+b))}const f=qR(n.baseURL,n.url);h.open(n.method.toUpperCase(),BR(f,n.params,n.paramsSerializer),!0),h.timeout=n.timeout;function _(){if(!h)return;const E=Ti.from("getAllResponseHeaders"in h&&h.getAllR
2024-07-18 22:38:03 +00:00
`+r.map(qy).join(`
2024-07-29 22:02:24 +00:00
`):" "+qy(r[0]):"as no adapter specified";throw new Mt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return s},adapters:_g};function fp(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new $l(null,n)}function Yy(n){return fp(n),n.headers=Ti.from(n.headers),n.data=hp.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),YR.getAdapter(n.adapter||Rb.adapter)(n).then(function(s){return fp(n),s.data=hp.call(n,n.transformResponse,s),s.headers=Ti.from(s.headers),s},function(s){return HR(s)||(fp(n),s&&s.response&&(s.response.data=hp.call(n,n.transformResponse,s.response),s.response.headers=Ti.from(s.response.headers))),Promise.reject(s)})}const $y=n=>n instanceof Ti?n.toJSON():n;function Zo(n,e){e=e||{};const t={};function s(u,d,h){return Ie.isPlainObject(u)&&Ie.isPlainObject(d)?Ie.merge.call({caseless:h},u,d):Ie.isPlainObject(d)?Ie.merge({},d):Ie.isArray(d)?d.slice():d}function i(u,d,h){if(Ie.isUndefined(d)){if(!Ie.isUndefined(u))return s(void 0,u,h)}else return s(u,d,h)}function r(u,d){if(!Ie.isUndefined(d))return s(void 0,d)}function o(u,d){if(Ie.isUndefined(d)){if(!Ie.isUndefined(u))return s(void 0,u)}else return s(void 0,d)}function a(u,d,h){if(h in e)return s(u,d);if(h in n)return s(void 0,u)}const l={url:r,method:r,data:r,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,d)=>i($y(u),$y(d),!0)};return Ie.forEach(Object.keys(Object.assign({},n,e)),function(d){const h=l[d]||i,f=h(n[d],e[d],d);Ie.isUndefined(f)&&h!==a||(t[d]=f)}),t}const $R="1.6.2",Ab={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{Ab[n]=function(s){return typeof s===n||"a"+(e<1?"n ":" ")+n}});const Wy={};Ab.transitional=function(e,t,s){function i(r,o){return"[Axios v"+$R+"] Transitional option '"+r+"'"+o+(s?". "+s:"")}return(r,o,a)=>{if(e===!1)throw new Mt(i(o," has been removed"+(t?" in "+t:"")),Mt.ERR_DEPRECATED);return t&&!Wy[o]&&(Wy[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(r,o,a):!0}};function Xk(n,e,t){if(typeof n!="object")throw new Mt("options must be an object",Mt.ERR_BAD_OPTION_VALUE);const s=Object.keys(n);let i=s.length;for(;i-- >0;){const r=s[i],o=e[r];if(o){const a=n[r],l=a===void 0||o(a,r,n);if(l!==!0)throw new Mt("option "+r+" must be "+l,Mt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Mt("Unknown option "+r,Mt.ERR_BAD_OPTION)}}const hg={assertOptions:Xk,validators:Ab},Fi=hg.validators;class Od{constructor(e){this.defaults=e,this.interceptors={request:new Vy,response:new Vy}}request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Zo(this.defaults,t);const{transitional:s,paramsSerializer:i,headers:r}=t;s!==void 0&&hg.assertOptions(s,{silentJSONParsing:Fi.transitional(Fi.boolean),forcedJSONParsing:Fi.transitional(Fi.boolean),clarifyTimeoutError:Fi.transitional(Fi.boolean)},!1),i!=null&&(Ie.isFunction(i)?t.paramsSerializer={serialize:i}:hg.assertOptions(i,{encode:Fi.function,serialize:Fi.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=r&&Ie.merge(r.common,r[t.method]);r&&Ie.forEach(["delete","get","head","post","put","patch","common"],m=>{delete r[m]}),t.headers=Ti.concat(o,r);const a=[];let l=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(t)===!1||(l=l&&E.synchronous,a.unshift(E.fulfilled,E.rejected))});const u=[];this.interceptors.response.forEach(function(E){u.push(E.fulfilled,E.rejected)});let d,h=0,f;if(!l){const m=[Yy.bind(this),void 0];for(m.unshift.apply(m,a),m.push.apply(m,u),f=m.length,d=Promise.resolve(t);h<f;)d=d.then(m[h++],m[h++]);return d}f=a.length;let
2024-07-18 22:38:03 +00:00
* vue-router v4.2.5
* (c) 2023 Eduardo San Martin Morote
* @license MIT
2024-07-29 22:02:24 +00:00
*/const Io=typeof window<"u";function nL(n){return n.__esModule||n[Symbol.toStringTag]==="Module"}const Ft=Object.assign;function mp(n,e){const t={};for(const s in e){const i=e[s];t[s]=Ls(i)?i.map(n):n(i)}return t}const dl=()=>{},Ls=Array.isArray,sL=/\/$/,iL=n=>n.replace(sL,"");function gp(n,e,t="/"){let s,i={},r="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return a<l&&a>=0&&(l=-1),l>-1&&(s=e.slice(0,l),r=e.slice(l+1,a>-1?a:e.length),i=n(r)),a>-1&&(s=s||e.slice(0,a),o=e.slice(a,e.length)),s=lL(s??e,t),{fullPath:s+(r&&"?")+r+o,path:s,query:i,hash:o}}function rL(n,e){const t=e.query?n(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function Ky(n,e){return!e||!n.toLowerCase().startsWith(e.toLowerCase())?n:n.slice(e.length)||"/"}function oL(n,e,t){const s=e.matched.length-1,i=t.matched.length-1;return s>-1&&s===i&&Jo(e.matched[s],t.matched[i])&&KR(e.params,t.params)&&n(e.query)===n(t.query)&&e.hash===t.hash}function Jo(n,e){return(n.aliasOf||n)===(e.aliasOf||e)}function KR(n,e){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(!aL(n[t],e[t]))return!1;return!0}function aL(n,e){return Ls(n)?jy(n,e):Ls(e)?jy(e,n):n===e}function jy(n,e){return Ls(e)?n.length===e.length&&n.every((t,s)=>t===e[s]):n.length===1&&n[0]===e}function lL(n,e){if(n.startsWith("/"))return n;if(!n)return e;const t=e.split("/"),s=n.split("/"),i=s[s.length-1];(i===".."||i===".")&&s.push("");let r=t.length-1,o,a;for(o=0;o<s.length;o++)if(a=s[o],a!==".")if(a==="..")r>1&&r--;else break;return t.slice(0,r).join("/")+"/"+s.slice(o-(o===s.length?1:0)).join("/")}var Il;(function(n){n.pop="pop",n.push="push"})(Il||(Il={}));var ul;(function(n){n.back="back",n.forward="forward",n.unknown=""})(ul||(ul={}));function cL(n){if(!n)if(Io){const e=document.querySelector("base");n=e&&e.getAttribute("href")||"/",n=n.replace(/^\w+:\/\/[^\/]+/,"")}else n="/";return n[0]!=="/"&&n[0]!=="#"&&(n="/"+n),iL(n)}const dL=/^[^#]+#/;function uL(n,e){return n.replace(dL,"#")+e}function pL(n,e){const t=document.documentElement.getBoundingClientRect(),s=n.getBoundingClientRect();return{behavior:e.behavior,left:s.left-t.left-(e.left||0),top:s.top-t.top-(e.top||0)}}const Cu=()=>({left:window.pageXOffset,top:window.pageYOffset});function _L(n){let e;if("el"in n){const t=n.el,s=typeof t=="string"&&t.startsWith("#"),i=typeof t=="string"?s?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!i)return;e=pL(i,n)}else e=n;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.pageXOffset,e.top!=null?e.top:window.pageYOffset)}function Qy(n,e){return(history.state?history.state.position-e:-1)+n}const mg=new Map;function hL(n,e){mg.set(n,e)}function fL(n){const e=mg.get(n);return mg.delete(n),e}let mL=()=>location.protocol+"//"+location.host;function jR(n,e){const{pathname:t,search:s,hash:i}=e,r=n.indexOf("#");if(r>-1){let a=i.includes(n.slice(r))?n.slice(r).length:1,l=i.slice(a);return l[0]!=="/"&&(l="/"+l),Ky(l,"")}return Ky(t,n)+s+i}function gL(n,e,t,s){let i=[],r=[],o=null;const a=({state:f})=>{const _=jR(n,location),m=t.value,E=e.value;let b=0;if(f){if(t.value=_,e.value=f,o&&o===m){o=null;return}b=E?f.position-E.position:0}else s(_);i.forEach(g=>{g(t.value,m,{delta:b,type:Il.pop,direction:b?b>0?ul.forward:ul.back:ul.unknown})})};function l(){o=t.value}function u(f){i.push(f);const _=()=>{const m=i.indexOf(f);m>-1&&i.splice(m,1)};return r.push(_),_}function d(){const{history:f}=window;f.state&&f.replaceState(Ft({},f.state,{scroll:Cu()}),"")}function h(){for(const f of r)f();r=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",d)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",d,{passive:!0}),{pauseListeners:l,listen:u,destroy:h}}function Xy(n,e,t,s=!1,i=!1){return{back:n,current:e,forward:t,replaced:s,position:window.history.length,scroll:i?Cu():null}}function bL(n){const{history:e,location:t}=window,s={value:jR(n,t)},i={value:e.state};i.value||r(s.value,{back:null,current:s.value,forward:null,position:e.length-1,replace
2024-07-18 22:38:03 +00:00
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
2024-07-29 22:02:24 +00:00
*/(function(){var a=function(){function l(){}l.prototype=Object.create(null);function u(g,y){for(var v=y.length,S=0;S<v;++S)E(g,y[S])}var d={}.hasOwnProperty;function h(g,y){g[y]=!0}function f(g,y){for(var v in y)d.call(y,v)&&(g[v]=!!y[v])}var _=/\s+/;function m(g,y){for(var v=y.split(_),S=v.length,w=0;w<S;++w)g[v[w]]=!0}function E(g,y){if(y){var v=typeof y;v==="string"?m(g,y):Array.isArray(y)?u(g,y):v==="object"?f(g,y):v==="number"&&h(g,y)}}function b(){for(var g=arguments.length,y=Array(g),v=0;v<g;v++)y[v]=arguments[v];var S=new l;u(S,y);var w=[];for(var C in S)S[C]&&w.push(C);return w.join(" ")}return b}();typeof t<"u"&&t.exports?t.exports=a:(r=[],o=(function(){return a}).apply(s,r),o!==void 0&&(t.exports=o))})()},"./node_modules/core-js/es/array/from.js":function(t,s,i){i("./node_modules/core-js/modules/es.string.iterator.js"),i("./node_modules/core-js/modules/es.array.from.js");var r=i("./node_modules/core-js/internals/path.js");t.exports=r.Array.from},"./node_modules/core-js/internals/a-function.js":function(t,s){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,s,i){var r=i("./node_modules/core-js/internals/is-object.js");t.exports=function(o){if(!r(o))throw TypeError(String(o)+" is not an object");return o}},"./node_modules/core-js/internals/array-from.js":function(t,s,i){var r=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"),u=i("./node_modules/core-js/internals/to-length.js"),d=i("./node_modules/core-js/internals/create-property.js"),h=i("./node_modules/core-js/internals/get-iterator-method.js");t.exports=function(_){var m=o(_),E=typeof this=="function"?this:Array,b=arguments.length,g=b>1?arguments[1]:void 0,y=g!==void 0,v=0,S=h(m),w,C,A,D;if(y&&(g=r(g,b>2?arguments[2]:void 0,2)),S!=null&&!(E==Array&&l(S)))for(D=S.call(m),C=new E;!(A=D.next()).done;v++)d(C,v,y?a(D,g,[A.value,v],!0):A.value);else for(w=u(m.length),C=new E(w);w>v;v++)d(C,v,y?g(m[v],v):m[v]);return C.length=v,C}},"./node_modules/core-js/internals/array-includes.js":function(t,s,i){var r=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(u,d,h){var f=r(u),_=o(f.length),m=a(h,_),E;if(l&&d!=d){for(;_>m;)if(E=f[m++],E!=E)return!0}else for(;_>m;m++)if((l||m in f)&&f[m]===d)return l||m||0;return!l&&-1}}},"./node_modules/core-js/internals/bind-context.js":function(t,s,i){var r=i("./node_modules/core-js/internals/a-function.js");t.exports=function(o,a,l){if(r(o),a===void 0)return o;switch(l){case 0:return function(){return o.call(a)};case 1:return function(u){return o.call(a,u)};case 2:return function(u,d){return o.call(a,u,d)};case 3:return function(u,d,h){return o.call(a,u,d,h)}}return function(){return o.apply(a,arguments)}}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(t,s,i){var r=i("./node_modules/core-js/internals/an-object.js");t.exports=function(o,a,l,u){try{return u?a(r(l)[0],l[1]):a(l)}catch(h){var d=o.return;throw d!==void 0&&r(d.call(o)),h}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(t,s,i){var r=i("./node_modules/core-js/internals/well-known-symbol.js"),o=r("iterator"),a=!1;try{var l=0,u={next:function(){return{done:!!l++}},return:function(){a=!0}};u[o]=function(){return this},Array.from(u,function(){throw 2})}catch{}t.exports=function(d,h){if(!h&&!a)return!1;var f=!1;try{var _={};_[o]=function(){return{next:function(){return{done:f=!0}}}},d(_)}catch{}return f}},"./node_modules/core-js/internals/classof-raw.js":function(t,s){var i={}.toString;t.exports=function(r){return i.call(r).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":function(t,s,i){var r=i("./node_modules/core-js/internals/classof
`,pQ="∄",_Q="∄",hQ="𝔑",fQ="𝔫",mQ="≧̸",gQ="≱",bQ="≱",EQ="≧̸",yQ="⩾̸",vQ="⩾̸",SQ="⋙̸",TQ="≵",xQ="≫⃒",CQ="≯",wQ="≯",RQ="≫̸",AQ="↮",NQ="⇎",OQ="⫲",IQ="∋",MQ="⋼",DQ="⋺",kQ="∋",LQ="Њ",PQ="њ",UQ="↚",FQ="⇍",BQ="‥",GQ="≦̸",VQ="≰",zQ="↚",HQ="⇍",qQ="↮",YQ="⇎",$Q="≰",WQ="≦̸",KQ="⩽̸",jQ="⩽̸",QQ="≮",XQ="⋘̸",ZQ="≴",JQ="≪⃒",eX="≮",tX="⋪",nX="⋬",sX="≪̸",iX="∤",rX="",oX=" ",aX="𝕟",lX="",cX="⫬",dX="¬",uX="≢",pX="≭",_X="∦",hX="∉",fX="≠",mX="≂̸",gX="∄",bX="≯",EX="≱",yX="≧̸",vX="≫̸",SX="≹",TX="⩾̸",xX="≵",CX="≎̸",wX="≏̸",RX="∉",AX="⋵̸",NX="⋹̸",OX="∉",IX="⋷",MX="⋶",DX="⧏̸",kX="⋪",LX="⋬",PX="≮",UX="≰",FX="≸",BX="≪̸",GX="⩽̸",VX="≴",zX="⪢̸",HX="⪡̸",qX="∌",YX="∌",$X="⋾",WX="⋽",KX="⊀",jX="⪯̸",QX="⋠",XX="∌",ZX="⧐̸",JX="⋫",eZ="⋭",tZ="⊏̸",nZ="⋢",sZ="⊐̸",iZ="⋣",rZ="⊂⃒",oZ="⊈",aZ="⊁",lZ="⪰̸",cZ="⋡",dZ="≿̸",uZ="⊃⃒",pZ="⊉",_Z="≁",hZ="≄",fZ="≇",mZ="≉",gZ="∤",bZ="∦",EZ="∦",yZ="⫽⃥",vZ="∂̸",SZ="⨔",TZ="⊀",xZ="⋠",CZ="⊀",wZ="⪯̸",RZ="⪯̸",AZ="⤳̸",NZ="↛",OZ="⇏",IZ="↝̸",MZ="↛",DZ="⇏",kZ="⋫",LZ="⋭",PZ="⊁",UZ="⋡",FZ="⪰̸",BZ="𝒩",GZ="𝓃",VZ="∤",zZ="∦",HZ="≁",qZ="≄",YZ="≄",$Z="∤",WZ="∦",KZ="⋢",jZ="⋣",QZ="⊄",XZ="⫅̸",ZZ="⊈",JZ="⊂⃒",eJ="⊈",tJ="⫅̸",nJ="⊁",sJ="⪰̸",iJ="⊅",rJ="⫆̸",oJ="⊉",aJ="⊃⃒",lJ="⊉",cJ="⫆̸",dJ="≹",uJ="Ñ",pJ="ñ",_J="≸",hJ="⋪",fJ="⋬",mJ="⋫",gJ="⋭",bJ="Ν",EJ="ν",yJ="#",vJ="№",SJ="",TJ="≍⃒",xJ="⊬",CJ="⊭",wJ="⊮",RJ="⊯",AJ="≥⃒",NJ=">⃒",OJ="⤄",IJ="⧞",MJ="⤂",DJ="≤⃒",kJ="<⃒",LJ="⊴⃒",PJ="⤃",UJ="⊵⃒",FJ="∼⃒",BJ="⤣",GJ="↖",VJ="⇖",zJ="↖",HJ="⤧",qJ="Ó",YJ="ó",$J="⊛",WJ="Ô",KJ="ô",jJ="⊚",QJ="О",XJ="о",ZJ="⊝",JJ="Ő",eee="ő",tee="⨸",nee="⊙",see="⦼",iee="Œ",ree="œ",oee="⦿",aee="𝔒",lee="𝔬",cee="˛",dee="Ò",uee="ò",pee="⧁",_ee="⦵",hee="Ω",fee="∮",mee="↺",gee="⦾",bee="⦻",Eee="‾",yee="⧀",vee="Ō",See="ō",Tee="Ω",xee="ω",Cee="Ο",wee="ο",Ree="⦶",Aee="⊖",Nee="𝕆",Oee="𝕠",Iee="⦷",Mee="“",Dee="",kee="⦹",Lee="⊕",Pee="↻",Uee="⩔",Fee="",Bee="⩝",Gee="",Vee="",zee="ª",Hee="º",qee="⊶",Yee="⩖",$ee="⩗",Wee="⩛",Kee="Ⓢ",jee="𝒪",Qee="",Xee="Ø",Zee="ø",Jee="⊘",ete="Õ",tte="õ",nte="⨶",ste="⨷",ite="⊗",rte="Ö",ote="ö",ate="⌽",lte="‾",cte="⏞",dte="⎴",ute="⏜",pte="¶",_te="∥",hte="∥",fte="⫳",mte="⫽",gte="∂",bte="∂",Ete="П",yte="п",vte="%",Ste=".",Tte="‰",xte="⊥",Cte="‱",wte="𝔓",Rte="𝔭",Ate="Φ",Nte="φ",Ote="ϕ",Ite="",Mte="☎",Dte="Π",kte="π",Lte="⋔",Pte="ϖ",Ute="ℏ",Fte="",Bte="ℏ",Gte="⨣",Vte="⊞",zte="⨢",Hte="+",qte="∔",Yte="⨥",$te="⩲",Wte="±",Kte="±",jte="⨦",Qte="⨧",Xte="±",Zte="",Jte="⨕",ene="𝕡",tne="",nne="£",sne="⪷",ine="⪻",rne="≺",one="≼",ane="⪷",lne="≺",cne="≼",dne="≺",une="⪯",pne="≼",_ne="≾",hne="⪯",fne="⪹",mne="⪵",gne="⋨",bne="⪯",Ene="⪳",yne="≾",vne="",Sne="″",Tne="",xne="⪹",Cne="⪵",wne="⋨",Rne="∏",Ane="∏",Nne="⌮",One="⌒",Ine="⌓",Mne="∝",Dne="∝",kne="∷",Lne="∝",Pne="≾",Une="⊰",Fne="𝒫",Bne="𝓅",Gne="Ψ",Vne="ψ",zne="",Hne="𝔔",qne="𝔮",Yne="⨌",$ne="𝕢",Wne="",Kne="⁗",jne="𝒬",Qne="𝓆",Xne="",Zne="⨖",Jne="?",ese="≟",tse='"',nse='"',sse="⇛",ise="∽̱",rse="Ŕ",ose="ŕ",ase="√",lse="⦳",cse="⟩",dse="⟫",use="⦒",pse="⦥",_se="⟩",hse="»",fse="⥵",mse="⇥",gse="⤠",bse="⤳",Ese="→",yse="↠",vse="⇒",Sse="⤞",Tse="↪",xse="↬",Cse="⥅",wse="⥴",Rse="⤖",Ase="↣",Nse="↝",Ose="⤚",Ise="⤜",Mse="",Dse="",kse="⤍",Lse="⤏",Pse="⤐",Use="",Fse="}",Bse="]",Gse="⦌",Vse="⦎",zse="⦐",Hse="Ř",qse="ř",Yse="Ŗ",$se="ŗ",Wse="⌉",Kse="}",jse="Р",Qse="р",Xse="⤷",Zse="⥩",Jse="”",eie="”",tie="↳",nie="",
`," "],ufe=["{","}","|","\\","^","`"].concat(dfe),pfe=["'"].concat(ufe),_v=["%","/","?",";","#"].concat(pfe),hv=["/","?","#"],_fe=255,fv=/^[+a-z0-9A-Z_-]{0,63}$/,hfe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,mv={javascript:!0,"javascript:":!0},gv={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function ffe(n,e){if(n&&n instanceof Md)return n;var t=new Md;return t.parse(n,e),t}Md.prototype.parse=function(n,e){var t,s,i,r,o,a=n;if(a=a.trim(),!e&&n.split("#").length===1){var l=cfe.exec(a);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}var u=afe.exec(a);if(u&&(u=u[0],i=u.toLowerCase(),this.protocol=u,a=a.substr(u.length)),(e||u||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=a.substr(0,2)==="//",o&&!(u&&mv[u])&&(a=a.substr(2),this.slashes=!0)),!mv[u]&&(o||u&&!gv[u])){var d=-1;for(t=0;t<hv.length;t++)r=a.indexOf(hv[t]),r!==-1&&(d===-1||r<d)&&(d=r);var h,f;for(d===-1?f=a.lastIndexOf("@"):f=a.lastIndexOf("@",d),f!==-1&&(h=a.slice(0,f),a=a.slice(f+1),this.auth=h),d=-1,t=0;t<_v.length;t++)r=a.indexOf(_v[t]),r!==-1&&(d===-1||r<d)&&(d=r);d===-1&&(d=a.length),a[d-1]===":"&&d--;var _=a.slice(0,d);a=a.slice(d),this.parseHost(_),this.hostname=this.hostname||"";var m=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!m){var E=this.hostname.split(/\./);for(t=0,s=E.length;t<s;t++){var b=E[t];if(b&&!b.match(fv)){for(var g="",y=0,v=b.length;y<v;y++)b.charCodeAt(y)>127?g+="x":g+=b[y];if(!g.match(fv)){var S=E.slice(0,t),w=E.slice(t+1),C=b.match(hfe);C&&(S.push(C[1]),w.unshift(C[2])),w.length&&(a=w.join(".")+a),this.hostname=S.join(".");break}}}}this.hostname.length>_fe&&(this.hostname=""),m&&(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 D=a.indexOf("?");return D!==-1&&(this.search=a.substr(D),a=a.slice(0,D)),a&&(this.pathname=a),gv[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Md.prototype.parseHost=function(n){var e=lfe.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 mfe=ffe;Aa.encode=sfe;Aa.decode=rfe;Aa.format=ofe;Aa.parse=mfe;var Tr={},yp,bv;function cA(){return bv||(bv=1,yp=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),yp}var vp,Ev;function dA(){return Ev||(Ev=1,vp=/[\0-\x1F\x7F-\x9F]/),vp}var Sp,yv;function gfe(){return yv||(yv=1,Sp=/[\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]/),Sp}var Tp,vv;function uA(){return vv||(vv=1,Tp=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),Tp}var Sv;function bfe(){return Sv||(Sv=1,Tr.Any=cA(),Tr.Cc=dA(),Tr.Cf=gfe(),Tr.P=Mb,Tr.Z=uA()),Tr}(function(n){function e(M){return Object.prototype.toString.call(M)}function t(M){return e(M)==="[object String]"}var s=Object.prototype.hasOwnProperty;function i(M,q){return s.call(M,q)}function r(M){var q=Array.prototype.slice.call(arguments,1);return q.forEach(function(H){if(H){if(typeof H!="object")throw new TypeError(H+"must be object");Object.keys(H).forEach(function(P){M[P]=H[P]})}}),M}function o(M,q,H){return[].concat(M.slice(0,q),H,M.slice(q+1))}function a(M){return!(M>=55296&&M<=57343||M>=64976&&M<=65007||(M&65535)===65535||(M&65535)===65534||M>=0&&M<=8||M===11||M>=14&&M<=31||M>=127&&M<=159||M>1114111)}function l(M){if(M>65535){M-=65536;var q=55296+(M>>10),H=56320+(M&1023);return String.fromCharCode(q,H)}return String.fromCharCode(M)}var u=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,d=/&([a-z#][a-z0-9]{1,31});/gi,h=new RegExp(u.source+"|"+d.source,"gi"),f=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i,_=lA;function m(M,q){var H;return i(_,q)?_[q]:q.charCodeAt(0)===35&&f.test(q)&&(H=q[1].toLowerCase()==="x"?parseInt(q.slice(2),16):parseInt(q.slice(1),10),a(H))?l(H):M}function E(M){return M.indexOf("\\")<0?M:M.replace(u,"$1")}function b(M){return M.indexOf("\\")<0&&M.indexOf("&"
`};si.fence=function(n,e,t,s,i){var r=n[e],o=r.info?xfe(r.info).trim():"",a="",l="",u,d,h,f,_;return o&&(h=o.split(/(\s+)/g),a=h[0],l=h.slice(2).join("")),t.highlight?u=t.highlight(r.content,a,l)||Qr(r.content):u=Qr(r.content),u.indexOf("<pre")===0?u+`
2024-07-18 22:38:03 +00:00
`:o?(d=r.attrIndex("class"),f=r.attrs?r.attrs.slice():[],d<0?f.push(["class",t.langPrefix+a]):(f[d]=f[d].slice(),f[d][1]+=" "+t.langPrefix+a),_={attrs:f},"<pre><code"+i.renderAttrs(_)+">"+u+`</code></pre>
`):"<pre><code"+i.renderAttrs(r)+">"+u+`</code></pre>
2024-07-27 23:19:18 +00:00
`};si.image=function(n,e,t,s,i){var r=n[e];return r.attrs[r.attrIndex("alt")][1]=i.renderInlineAsText(r.children,t,s),i.renderToken(n,e,t)};si.hardbreak=function(n,e,t){return t.xhtmlOut?`<br />
2024-07-18 22:38:03 +00:00
`:`<br>
2024-07-27 23:19:18 +00:00
`};si.softbreak=function(n,e,t){return t.breaks?t.xhtmlOut?`<br />
2024-07-18 22:38:03 +00:00
`:`<br>
`:`
2024-07-29 22:02:24 +00:00
`};si.text=function(n,e){return Qr(n[e].content)};si.html_block=function(n,e){return n[e].content};si.html_inline=function(n,e){return n[e].content};function Na(){this.rules=Tfe({},si)}Na.prototype.renderAttrs=function(e){var t,s,i;if(!e.attrs)return"";for(i="",t=0,s=e.attrs.length;t<s;t++)i+=" "+Qr(e.attrs[t][0])+'="'+Qr(e.attrs[t][1])+'"';return i};Na.prototype.renderToken=function(e,t,s){var i,r="",o=!1,a=e[t];return a.hidden?"":(a.block&&a.nesting!==-1&&t&&e[t-1].hidden&&(r+=`
2024-07-18 22:38:03 +00:00
`),r+=(a.nesting===-1?"</":"<")+a.tag,r+=this.renderAttrs(a),a.nesting===0&&s.xhtmlOut&&(r+=" /"),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))),r+=o?`>
`:">",r)};Na.prototype.renderInline=function(n,e,t){for(var s,i="",r=this.rules,o=0,a=n.length;o<a;o++)s=n[o].type,typeof r[s]<"u"?i+=r[s](n,o,e,t,this):i+=this.renderToken(n,o,e);return i};Na.prototype.renderInlineAsText=function(n,e,t){for(var s="",i=0,r=n.length;i<r;i++)n[i].type==="text"?s+=n[i].content:n[i].type==="image"?s+=this.renderInlineAsText(n[i].children,e,t):n[i].type==="softbreak"&&(s+=`
2024-07-29 22:02:24 +00:00
`);return s};Na.prototype.render=function(n,e,t){var s,i,r,o="",a=this.rules;for(s=0,i=n.length;s<i;s++)r=n[s].type,r==="inline"?o+=this.renderInline(n[s].children,e,t):typeof a[r]<"u"?o+=a[r](n,s,e,t,this):o+=this.renderToken(n,s,e,t);return o};var Cfe=Na;function Us(){this.__rules__=[],this.__cache__=null}Us.prototype.__find__=function(n){for(var e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===n)return e;return-1};Us.prototype.__compile__=function(){var n=this,e=[""];n.__rules__.forEach(function(t){t.enabled&&t.alt.forEach(function(s){e.indexOf(s)<0&&e.push(s)})}),n.__cache__={},e.forEach(function(t){n.__cache__[t]=[],n.__rules__.forEach(function(s){s.enabled&&(t&&s.alt.indexOf(t)<0||n.__cache__[t].push(s.fn))})})};Us.prototype.at=function(n,e,t){var s=this.__find__(n),i=t||{};if(s===-1)throw new Error("Parser rule not found: "+n);this.__rules__[s].fn=e,this.__rules__[s].alt=i.alt||[],this.__cache__=null};Us.prototype.before=function(n,e,t,s){var i=this.__find__(n),r=s||{};if(i===-1)throw new Error("Parser rule not found: "+n);this.__rules__.splice(i,0,{name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null};Us.prototype.after=function(n,e,t,s){var i=this.__find__(n),r=s||{};if(i===-1)throw new Error("Parser rule not found: "+n);this.__rules__.splice(i+1,0,{name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null};Us.prototype.push=function(n,e,t){var s=t||{};this.__rules__.push({name:n,enabled:!0,fn:e,alt:s.alt||[]}),this.__cache__=null};Us.prototype.enable=function(n,e){Array.isArray(n)||(n=[n]);var t=[];return n.forEach(function(s){var i=this.__find__(s);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+s)}this.__rules__[i].enabled=!0,t.push(s)},this),this.__cache__=null,t};Us.prototype.enableOnly=function(n,e){Array.isArray(n)||(n=[n]),this.__rules__.forEach(function(t){t.enabled=!1}),this.enable(n,e)};Us.prototype.disable=function(n,e){Array.isArray(n)||(n=[n]);var t=[];return n.forEach(function(s){var i=this.__find__(s);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+s)}this.__rules__[i].enabled=!1,t.push(s)},this),this.__cache__=null,t};Us.prototype.getRules=function(n){return this.__cache__===null&&this.__compile__(),this.__cache__[n]||[]};var Db=Us,wfe=/\r\n?|\n/g,Rfe=/\0/g,Afe=function(e){var t;t=e.src.replace(wfe,`
`),t=t.replace(Rfe,"<22>"),e.src=t},Nfe=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)},Ofe=function(e){var t=e.tokens,s,i,r;for(i=0,r=t.length;i<r;i++)s=t[i],s.type==="inline"&&e.md.inline.parse(s.content,e.md,e.env,s.children)},Ife=Pt.arrayReplaceAt;function Mfe(n){return/^<a[>\s]/i.test(n)}function Dfe(n){return/^<\/a\s*>/i.test(n)}var kfe=function(e){var t,s,i,r,o,a,l,u,d,h,f,_,m,E,b,g,y=e.tokens,v;if(e.md.options.linkify){for(s=0,i=y.length;s<i;s++)if(!(y[s].type!=="inline"||!e.md.linkify.pretest(y[s].content)))for(r=y[s].children,m=0,t=r.length-1;t>=0;t--){if(a=r[t],a.type==="link_close"){for(t--;r[t].level!==a.level&&r[t].type!=="link_open";)t--;continue}if(a.type==="html_inline"&&(Mfe(a.content)&&m>0&&m--,Dfe(a.content)&&m++),!(m>0)&&a.type==="text"&&e.md.linkify.test(a.content)){for(d=a.content,v=e.md.linkify.match(d),l=[],_=a.level,f=0,v.length>0&&v[0].index===0&&t>0&&r[t-1].type==="text_special"&&(v=v.slice(1)),u=0;u<v.length;u++)E=v[u].url,b=e.md.normalizeLink(E),e.md.validateLink(b)&&(g=v[u].text,v[u].schema?v[u].schema==="mailto:"&&!/^mailto:/i.test(g)?g=e.md.normalizeLinkText("mailto:"+g).replace(/^mailto:/,""):g=e.md.normalizeLinkText(g):g=e.md.normalizeLinkText("http://"+g).replace(/^http:\/\//,""),h=v[u].index,h>f&&(o=new e.Token("text","",0),o.content=d.slice(f,h),o.level=_,l.push(o)),o=new e.Token("link_open","a",1),o.attrs=[["href",b]],o.level=_++,o.markup="linkify",o.info="auto",l.push(o),o=new e.Token("text","",0),o.content=g,o.level=_,l.push(o),o=new e.Token("link_close","a",-1),o.level=--_,o.markup="linkify",o.info="auto",l.push(o),f=v[u].lastIndex);f<d.length&&(o=new e.Token("text","",0),o.content=d.slice(f),o.level=_,l.push(o)),y[s].children=r=Ife(r,t,l)}}}},pA=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Lfe=/\((c|tm|r)\)/i,Pfe=/\((c|tm|r)\)/ig,Ufe={c:"©",r:"®",tm:"™"};function Ffe(n,e){return Ufe[e.toLowerCase()]}function Bfe(n){var e,t,s=0;for(e=n.length-1;e>=0;e--)t=n[e],t.type==="text"&&!s&&(t.content=t.content.replace(Pfe,Ffe)),t.type==="link_open"&&t.info==="auto"&&s--,t.type==="link_close"&&t.info==="auto"&&s++}function Gfe(n){var e,t,s=0;for(e=n.length-1;e>=0;e--)t=n[e],t.type==="text"&&!s&&pA.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"&&s--,t.type==="link_close"&&t.info==="auto"&&s++}var Vfe=function(e){var t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(Lfe.test(e.tokens[t].content)&&Bfe(e.tokens[t].children),pA.test(e.tokens[t].content)&&Gfe(e.tokens[t].children))},xv=Pt.isWhiteSpace,Cv=Pt.isPunctChar,wv=Pt.isMdAsciiPunct,zfe=/['"]/,Rv=/['"]/g,Av="";function mc(n,e,t){return n.slice(0,e)+t+n.slice(e+1)}function Hfe(n,e){var t,s,i,r,o,a,l,u,d,h,f,_,m,E,b,g,y,v,S,w,C;for(S=[],t=0;t<n.length;t++){for(s=n[t],l=n[t].level,y=S.length-1;y>=0&&!(S[y].level<=l);y--);if(S.length=y+1,s.type==="text"){i=s.content,o=0,a=i.length;e:for(;o<a&&(Rv.lastIndex=o,r=Rv.exec(i),!!r);){if(b=g=!0,o=r.index+1,v=r[0]==="'",d=32,r.index-1>=0)d=i.charCodeAt(r.index-1);else for(y=t-1;y>=0&&!(n[y].type==="softbreak"||n[y].type==="hardbreak");y--)if(n[y].content){d=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(f=wv(d)||Cv(String.fromCharCode(d)),_=wv(h)||Cv(String.fromCharCode(h)),m=xv(d),E=xv(h),E?b=!1:_&&(m||f||(b=!1)),m?g=!1:f&&(E||_||(g=!1)),h===34&&r[0]==='"'&&d>=48&&d<=57&&(g=b=!1),b&&g&&(b=f,g=_),!b&&!g){v&&(s.content=mc(s.content,r.index,Av));continue}if(g){for(y=S.length-1;y>=0&&(u=S[y],!(S[y].level<l));y--)if(u.single===v&&S[y].level===l){u=S[y],v?(w=e.md.options.quotes[2],C=e.md.options.quotes[
`,o.map=[t,e.line],!0},Zfe=function(e,t,s,i){var r,o,a,l,u,d,h,f=!1,_=e.bMarks[t]+e.tShift[t],m=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||_+3>m||(r=e.src.charCodeAt(_),r!==126&&r!==96)||(u=_,_=e.skipChars(_,r),o=_-u,o<3)||(h=e.src.slice(u,_),a=e.src.slice(_,m),r===96&&a.indexOf(String.fromCharCode(r))>=0))return!1;if(i)return!0;for(l=t;l++,!(l>=s||(_=u=e.bMarks[l]+e.tShift[l],m=e.eMarks[l],_<m&&e.sCount[l]<e.blkIndent));)if(e.src.charCodeAt(_)===r&&!(e.sCount[l]-e.blkIndent>=4)&&(_=e.skipChars(_,r),!(_-u<o)&&(_=e.skipSpaces(_),!(_<m)))){f=!0;break}return o=e.sCount[t],e.line=l+(f?1:0),d=e.push("fence","code",0),d.info=a,d.content=e.getLines(t+1,l,o,!0),d.markup=h,d.map=[t,e.line],!0},Jfe=Pt.isSpace,eme=function(e,t,s,i){var r,o,a,l,u,d,h,f,_,m,E,b,g,y,v,S,w,C,A,D,T=e.lineMax,O=e.bMarks[t]+e.tShift[t],F=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(O)!==62)return!1;if(i)return!0;for(m=[],E=[],y=[],v=[],C=e.md.block.ruler.getRules("blockquote"),g=e.parentType,e.parentType="blockquote",f=t;f<s&&(D=e.sCount[f]<e.blkIndent,O=e.bMarks[f]+e.tShift[f],F=e.eMarks[f],!(O>=F));f++){if(e.src.charCodeAt(O++)===62&&!D){for(l=e.sCount[f]+1,e.src.charCodeAt(O)===32?(O++,l++,r=!1,S=!0):e.src.charCodeAt(O)===9?(S=!0,(e.bsCount[f]+l)%4===3?(O++,l++,r=!1):r=!0):S=!1,_=l,m.push(e.bMarks[f]),e.bMarks[f]=O;O<F&&(o=e.src.charCodeAt(O),Jfe(o));){o===9?_+=4-(_+e.bsCount[f]+(r?1:0))%4:_++;O++}d=O>=F,E.push(e.bsCount[f]),e.bsCount[f]=e.sCount[f]+1+(S?1:0),y.push(e.sCount[f]),e.sCount[f]=_-l,v.push(e.tShift[f]),e.tShift[f]=O-e.bMarks[f];continue}if(d)break;for(w=!1,a=0,u=C.length;a<u;a++)if(C[a](e,f,s,!0)){w=!0;break}if(w){e.lineMax=f,e.blkIndent!==0&&(m.push(e.bMarks[f]),E.push(e.bsCount[f]),v.push(e.tShift[f]),y.push(e.sCount[f]),e.sCount[f]-=e.blkIndent);break}m.push(e.bMarks[f]),E.push(e.bsCount[f]),v.push(e.tShift[f]),y.push(e.sCount[f]),e.sCount[f]=-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,f),A=e.push("blockquote_close","blockquote",-1),A.markup=">",e.lineMax=T,e.parentType=g,h[1]=e.line,a=0;a<v.length;a++)e.bMarks[a+t]=m[a],e.tShift[a+t]=v[a],e.sCount[a+t]=y[a],e.bsCount[a+t]=E[a];return e.blkIndent=b,!0},tme=Pt.isSpace,nme=function(e,t,s,i){var r,o,a,l,u=e.bMarks[t]+e.tShift[t],d=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||(r=e.src.charCodeAt(u++),r!==42&&r!==45&&r!==95))return!1;for(o=1;u<d;){if(a=e.src.charCodeAt(u++),a!==r&&!tme(a))return!1;a===r&&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(r))),!0)},hA=Pt.isSpace;function Ov(n,e){var t,s,i,r;return s=n.bMarks[e]+n.tShift[e],i=n.eMarks[e],t=n.src.charCodeAt(s++),t!==42&&t!==45&&t!==43||s<i&&(r=n.src.charCodeAt(s),!hA(r))?-1:s}function Iv(n,e){var t,s=n.bMarks[e]+n.tShift[e],i=s,r=n.eMarks[e];if(i+1>=r||(t=n.src.charCodeAt(i++),t<48||t>57))return-1;for(;;){if(i>=r)return-1;if(t=n.src.charCodeAt(i++),t>=48&&t<=57){if(i-s>=10)return-1;continue}if(t===41||t===46)break;return-1}return i<r&&(t=n.src.charCodeAt(i),!hA(t))?-1:i}function sme(n,e){var t,s,i=n.level+2;for(t=e+2,s=n.tokens.length-2;t<s;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 ime=function(e,t,s,i){var r,o,a,l,u,d,h,f,_,m,E,b,g,y,v,S,w,C,A,D,T,O,F,z,Z,M,q,H=t,P=!1,$=!0;if(e.sCount[H]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[H]-e.listIndent>=4&&e.sCount[H]<e.blkIndent)return!1;if(i&&e.parentType==="paragraph"&&e.sCount[H]>=e.blkIndent&&(P=!0),(O=Iv(e,H))>=0){if(h=!0,z=e.bMarks[H]+e.tShift[H],g=Number(e.src.slice(z,O-1)),P&&g!==1)return!1}else if((O=Ov(e,H))>=0)h=!1;else return!1;if(P&&e.skipSpaces(O)>=e.eMarks[H])return!1;if(i)return!0;for(b=e.src.charCodeAt(O-1),E=e.tokens.length,h?(q=e.push("ordered_list_open","ol",1),g!==1&&(q.attrs=[["start",g]])):q=e.push("bullet_list_open","ul",1),q.map=m=[H,0],q.markup=String.fromCharCode(b),F=!1,M=e.md.block.ruler.getRules("list"),w=e.parentType,e.parentType="list";H<s;){for(T=O,y=e.eMarks[H],d=v=e.sCount[H]+O-(e.bMarks[H]+e.tShift[H]);T<y;){
2024-07-18 22:38:03 +00:00
`})),s.tokens.splice(i+3+d.length+1,0,Object.assign(new s.Token("html_block","",0),{content:e.wrapper[1]+`
2024-07-29 22:02:24 +00:00
`})))});function jv(n,e,t,s){var i=n,r=s;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+"-"+r,r+=1;return e[i]=!0,i}function Do(n,e){e=Object.assign({},Do.defaults,e),n.core.ruler.push("anchor",function(t){for(var s,i={},r=t.tokens,o=Array.isArray(e.level)?(s=e.level,function(h){return s.includes(h)}):function(h){return function(f){return f>=h}}(e.level),a=0;a<r.length;a++){var l=r[a];if(l.type==="heading_open"&&o(Number(l.tag.substr(1)))){var u=e.getTokensText(r[a+1].children),d=l.attrGet("id");d=d==null?jv(e.slugify(u),i,!1,e.uniqueSlugStartIndex):jv(d,i,!0,e.uniqueSlugStartIndex),l.attrSet("id",d),e.tabIndex!==!1&&l.attrSet("tabindex",""+e.tabIndex),typeof e.permalink=="function"?e.permalink(d,e,t,a):(e.permalink||e.renderPermalink&&e.renderPermalink!==vg)&&e.renderPermalink(d,e,t,a),a=r.indexOf(l),e.callback&&e.callback(l,{slug:d,title:u})}}})}Object.assign(Kv.defaults,{style:"visually-hidden",space:!0,placement:"after",wrapper:null}),Do.permalink={__proto__:null,legacy:vg,renderHref:NA,renderAttrs:OA,makePermalink:Ql,linkInsideHeader:Lu,ariaHidden:Nr,headerLink:IA,linkAfterHeader:Kv},Do.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:vg,permalinkClass:Nr.defaults.class,permalinkSpace:Nr.defaults.space,permalinkSymbol:"¶",permalinkBefore:Nr.defaults.placement==="before",permalinkHref:Nr.defaults.renderHref,permalinkAttrs:Nr.defaults.renderAttrs},Do.default=Do;function Di(){this.__highest_alphabet__=0,this.__match_alphabets__={},this.__initial_state__=0,this.__accept_states__={},this.__transitions__={},this.__actions__={}}Di.prototype.set_highest_alphabet=function(n){this.__highest_alphabet__=n};Di.prototype.set_match_alphabets=function(n){this.__match_alphabets__=n};Di.prototype.set_initial_state=function(n){this.__initial_state__=n};Di.prototype.set_accept_states=function(n){for(var e=0;e<n.length;e++)this.__accept_states__[n[e]]=!0};Di.prototype.set_transitions=function(n){this.__transitions__=n};Di.prototype.set_actions=function(n){this.__actions__=n};Di.prototype.update_transition=function(n,e){this.__transitions__[n]=Object.assign(this.__transitions__[n]||Object(),e)};Di.prototype.execute=function(n,e){var t,s,i;for(t=this.__initial_state__,s=n;t&&s<e;s++){for(i=this.__highest_alphabet__;i>0&&!(t&i&&this.__match_alphabets__[i].call(this,s,t,i));i>>=4);if(this.__actions__(s,t,i),i===0)break;t=this.__transitions__[t][i]||0}return!!this.__accept_states__[t]};var Zze=Di,Jze=Zze,eHe=function(e,t){var s={multiline:!1,rowspan:!1,headerless:!1,multibody:!0,autolabel:!0};t=e.utils.assign({},s,t||{});function i(d,h){var f=d.bMarks[h]+d.sCount[h],_=d.bMarks[h]+d.blkIndent,m=d.skipSpacesBack(d.eMarks[h],_),E=[],b,g,y=!1,v=!1,S=0;for(b=f;b<m;b++)switch(d.src.charCodeAt(b)){case 92:y=!0;break;case 96:g=d.skipChars(b,96)-1,g>b?(v||(S===0?S=g-b:S===g-b&&(S=0)),b=g):(v||!y&&!S)&&(v=!v),y=!1;break;case 124:!v&&!y&&E.push(b),y=!1;break;default:y=!1;break}return E.length===0||(E[0]>_&&E.unshift(_-1),E[E.length-1]<m-1&&E.push(m)),E}function r(d,h,f){var _={text:null,label:null},m=d.bMarks[f]+d.sCount[f],E=d.eMarks[f],b=/^\[(.+?)\](\[([^\[\]]+)\])?\s*$/,g=d.src.slice(m,E).match(b);return g?h?!0:(_.text=g[1],!t.autolabel&&!g[2]||(_.label=g[2]||g[1],_.label=_.label.toLowerCase().replace(/\W+/g,"")),_):!1}function o(d,h,f){var _={bounds:null,multiline:null},m=i(d,f),E,b,g;return m.length<2?!1:h?!0:(_.bounds=m,t.multiline&&(E=d.bMarks[f]+d.sCount[f],b=d.eMarks[f]-1,_.multiline=d.src.charCodeAt(b)===92,_.multiline&&(g=d.eMarks[f],d.eMarks[f]=d.skipSpacesBack(b,E),_.bounds=i(d,f),d.eMarks[f]=g)),_)}function a(d,h,f){var _={aligns:[],wraps:[]},m=i(d,f),E=/^:?(-+|=+):?\+?$/,b,g,y;if(d.sCount[f]-d.bl
`),d.md,d.env,[]),P.level=v.level+1,d.md.block.tokenize(P,v.map[0],P.lineMax),H=0;H<P.tokens.length;H++)d.tokens.push(P.tokens[H])}else g=d.push("inline","",0),g.content=F.trim(),g.map=v.map,g.level=v.level+1,g.children=[];g=d.push(O+"_close",O,-1)}d.push("tr_close","tr",-1),v.meta.grp&1&&(O=v.meta.type===256?"thead":"tbody",g=d.push(O+"_close",O,-1),T[1]=v.map[1])}return D[1]=Math.max(T[1],y.meta.sep.map[1],y.meta.cap?y.meta.cap.map[1]:-1),g=d.push("table_close","table",-1),d.line=D[1],!0}e.block.ruler.at("table",u,{alt:["paragraph","reference"]})};const tHe=fr(eHe);var nHe=function(e,t){t=t||{};function s(i){for(var r=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 u=i.tokens[o-1];u.type="figure_open",u.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 d;if(t.link==!0&&l.children.length===1&&(d=l.children[0],l.children.unshift(new i.Token("link_open","a",1)),l.children[0].attrPush(["href",d.attrGet("src")]),l.children.push(new i.Token("link_close","a",-1))),d=l.children.length===1?l.children[0]:l.children[1],t.figcaption==!0&&d.children&&d.children.length&&(l.children.push(new i.Token("figcaption_open","figcaption",1)),l.children.splice(l.children.length,0,...d.children),l.children.push(new i.Token("figcaption_close","figcaption",-1)),d.children.length=0),t.copyAttrs&&d.attrs){const h=t.copyAttrs===!0?"":t.copyAttrs;u.attrs=d.attrs.filter(([f,_])=>f.match(h))}t.tabindex==!0&&(i.tokens[o-1].attrPush(["tabindex",r]),r++),t.lazyLoading==!0&&d.attrPush(["loading","lazy"])}}}e.core.ruler.before("linkify","implicit_figures",s)};const sHe=fr(nHe);var mr={};mr.getAttrs=function(n,e,t){const s=/[^\t\n\f />"'=]/,i=" ",r="=",o=".",a="#",l=[];let u="",d="",h=!0,f=!1;for(let _=e+t.leftDelimiter.length;_<n.length;_++){if(n.slice(_,_+t.rightDelimiter.length)===t.rightDelimiter){u!==""&&l.push([u,d]);break}const m=n.charAt(_);if(m===r&&h){h=!1;continue}if(m===o&&u===""){n.charAt(_+1)===o?(u="css-module",_+=1):u="class",h=!1;continue}if(m===a&&u===""){u="id",h=!1;continue}if(m==='"'&&d===""&&!f){f=!0;continue}if(m==='"'&&f){f=!1;continue}if(m===i&&!f){if(u==="")continue;l.push([u,d]),u="",d="",h=!0;continue}if(!(h&&m.search(s)===-1)){if(h){u+=m;continue}d+=m}}if(t.allowedAttributes&&t.allowedAttributes.length){const _=t.allowedAttributes;return l.filter(function(m){const E=m[0];function b(g){return E===g||g instanceof RegExp&&g.test(E)}return _.some(b)})}return l};mr.addAttrs=function(n,e){for(let t=0,s=n.length;t<s;++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};mr.hasDelimiters=function(n,e){if(!n)throw new Error('Parameter `where` not passed. Should be "start", "end" or "only".');return function(t){const s=e.leftDelimiter.length+1+e.rightDelimiter.length;if(!t||typeof t!="string"||t.length<s)return!1;function i(d){const h=d.charAt(e.leftDelimiter.length)===".",f=d.charAt(e.leftDelimiter.length)==="#";return h||f?d.length>=s+1:d.length>=s}let r,o,a,l;const u=s-e.rightDelimiter.length;switch(n){case"start":a=t.slice(0,e.leftDelimiter.length),r=a===e.leftDelimiter?0:-1,o=r===-1?-1:t.indexOf(e.rightDelimiter,u),l=t.charAt(o+e.rightDelimiter.length),l&&e.rightDelimiter.indexOf(l)!==-1&&(o=-1);break;case"end":r=t.lastIndexOf(e.leftDelimiter),o=r===-1?-1:t.indexOf(e.rightDelimiter,r+u),o=o===t.length-e.rightDelimiter.length?o:-1;break;case"only":a=t.slice(0,e.leftDelimiter.length),r=a===e.leftDelimiter?0:-1,a=t.slice(t.length-e.rightDelimiter.length),o=a===e.rightDelimiter?t.length-e.rightDelimiter.length:-1;break;default:throw new Error(`Unexpected case ${n}, expected 'start', 'end' or 'only
{.a} softbreak then curly in start`,tests:[{shift:0,type:"inline",children:[{position:-2,type:"softbreak"},{position:-1,type:"text",content:Ct.hasDelimiters("only",n)}]}],transform:(t,s,i)=>{const r=t[s].children[i],o=Ct.getAttrs(r.content,0,n);let a=s+1;for(;t[a+1]&&t[a+1].nesting===-1;)a++;const l=Ct.getMatchingOpeningToken(t,a);Ct.addAttrs(o,l),t[s].children=t[s].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,s)=>{const i=t[s];i.type="hr",i.tag="hr",i.nesting=0;const r=t[s+1].content,o=r.lastIndexOf(n.leftDelimiter),a=Ct.getAttrs(r,o,n);Ct.addAttrs(a,i),i.markup=r,t.splice(s+1,2)}},{name:"end of block",tests:[{shift:0,type:"inline",children:[{position:-1,content:Ct.hasDelimiters("end",n),type:t=>t!=="code_inline"&&t!=="math_inline"}]}],transform:(t,s,i)=>{const r=t[s].children[i],o=r.content,a=Ct.getAttrs(o,o.lastIndexOf(n.leftDelimiter),n);let l=s+1;for(;t[l+1]&&t[l+1].nesting===-1;)l++;const u=Ct.getMatchingOpeningToken(t,l);Ct.addAttrs(a,u);const d=o.slice(0,o.lastIndexOf(n.leftDelimiter));r.content=Qv(d)!==" "?d:d.slice(0,-1)}}]};function Qv(n){return n.slice(-1)[0]}const cHe=lHe,dHe={leftDelimiter:"{",rightDelimiter:"}",allowedAttributes:[]};var uHe=function(e,t){let s=Object.assign({},dHe);s=Object.assign(s,t);const i=cHe(s);function r(o){const a=o.tokens;for(let l=0;l<a.length;l++)for(let u=0;u<i.length;u++){const d=i[u];let h=null;d.tests.every(_=>{const m=Tg(a,l,_);return m.j!==null&&(h=m.j),m.match})&&(d.transform(a,l,h),(d.name==="inline attributes"||d.name==="inline nesting 0")&&u--)}}e.core.ruler.before("linkify","curly_attributes",r)};function Tg(n,e,t){const s={match:!1,j:null},i=t.shift!==void 0?e+t.shift:t.position;if(t.shift!==void 0&&i<0)return s;const r=hHe(n,i);if(r===void 0)return s;for(const o of Object.keys(t))if(!(o==="shift"||o==="position")){if(r[o]===void 0)return s;if(o==="children"&&pHe(t.children)){if(r.children.length===0)return s;let a;const l=t.children,u=r.children;if(l.every(d=>d.position!==void 0)){if(a=l.every(d=>Tg(u,d.position,d).match),a){const d=fHe(l).position;s.j=d>=0?d:u.length+d}}else for(let d=0;d<u.length;d++)if(a=l.every(h=>Tg(u,d,h).match),a){s.j=d;break}if(a===!1)return s;continue}switch(typeof t[o]){case"boolean":case"number":case"string":if(r[o]!==t[o])return s;break;case"function":if(!t[o](r[o]))return s;break;case"object":if(_He(t[o])){if(t[o].every(l=>l(r[o]))===!1)return s;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 s.match=!0,s}function pHe(n){return Array.isArray(n)&&n.length&&n.every(e=>typeof e=="object")}function _He(n){return Array.isArray(n)&&n.length&&n.every(e=>typeof e=="function")}function hHe(n,e){return e>=0?n[e]:n[n.length+e]}function fHe(n){return n.slice(-1)[0]||{}}const mHe=fr(uHe);function MA(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],s=typeof t;(s==="object"||s==="function")&&!Object.isFrozen(t)&&MA(t)}),n}let Xv=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function DA(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function nr(n,...e){const t=Object.create(null);for(const s in n)t[s]=n[s];return e.forEach(function(s){for(const i in s)t[i]=s[i]}),t}const gHe="</span>",Zv=n=>!!n.scope,bHe=(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((s,i)=>`${s}${"_".repeat(i+1)}`)].join(" ")}return`${e}${n}`};class EHe{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}ad
https://github.com/highlightjs/highlight.js/issues/2277`),me=P,re=$),J===void 0&&(J=!0);const Se={code:re,language:me};q("before:highlight",Se);const le=Se.result?Se.result:h(Se.language,Se.code,J);return le.code=Se.code,q("after:highlight",le),le}function h(P,$,J,re){const me=Object.create(null);function Se(K,te){return K.keywords[te]}function le(){if(!ne.keywords){ge.addText(De);return}let K=0;ne.keywordPatternRe.lastIndex=0;let te=ne.keywordPatternRe.exec(De),Re="";for(;te;){Re+=De.substring(K,te.index);const xe=se.case_insensitive?te[0].toLowerCase():te[0],Le=Se(ne,xe);if(Le){const[Ze,ft]=Le;if(ge.addText(Re),Re="",me[xe]=(me[xe]||0)+1,me[xe]<=l7e&&(k+=ft),Ze.startsWith("_"))Re+=te[0];else{const Pe=se.classNameAliases[Ze]||Ze;Me(te[0],Pe)}}else Re+=te[0];K=ne.keywordPatternRe.lastIndex,te=ne.keywordPatternRe.exec(De)}Re+=De.substring(K),ge.addText(Re)}function Ee(){if(De==="")return;let K=null;if(typeof ne.subLanguage=="string"){if(!e[ne.subLanguage]){ge.addText(De);return}K=h(ne.subLanguage,De,!0,we[ne.subLanguage]),we[ne.subLanguage]=K._top}else K=_(De,ne.subLanguage.length?ne.subLanguage:null);ne.relevance>0&&(k+=K.relevance),ge.__addSublanguage(K._emitter,K.language)}function Oe(){ne.subLanguage!=null?Ee():le(),De=""}function Me(K,te){K!==""&&(ge.startScope(te),ge.addText(K),ge.endScope())}function j(K,te){let Re=1;const xe=te.length-1;for(;Re<=xe;){if(!K._emit[Re]){Re++;continue}const Le=se.classNameAliases[K[Re]]||K[Re],Ze=te[Re];Le?Me(Ze,Le):(De=Ze,le(),De=""),Re++}}function pe(K,te){return K.scope&&typeof K.scope=="string"&&ge.openNode(se.classNameAliases[K.scope]||K.scope),K.beginScope&&(K.beginScope._wrap?(Me(De,se.classNameAliases[K.beginScope._wrap]||K.beginScope._wrap),De=""):K.beginScope._multi&&(j(K.beginScope,te),De="")),ne=Object.create(K,{parent:{value:ne}}),ne}function ue(K,te,Re){let xe=xHe(K.endRe,Re);if(xe){if(K["on:end"]){const Le=new Xv(K);K["on:end"](te,Le),Le.isMatchIgnored&&(xe=!1)}if(xe){for(;K.endsParent&&K.parent;)K=K.parent;return K}}if(K.endsWithParent)return ue(K.parent,te,Re)}function Ce(K){return ne.matcher.regexIndex===0?(De+=K[0],1):(ye=!0,0)}function ke(K){const te=K[0],Re=K.rule,xe=new Xv(Re),Le=[Re.__beforeBegin,Re["on:begin"]];for(const Ze of Le)if(Ze&&(Ze(K,xe),xe.isMatchIgnored))return Ce(te);return Re.skip?De+=te:(Re.excludeBegin&&(De+=te),Oe(),!Re.returnBegin&&!Re.excludeBegin&&(De=te)),pe(Re,K),Re.returnBegin?0:te.length}function N(K){const te=K[0],Re=$.substring(K.index),xe=ue(ne,K,Re);if(!xe)return sS;const Le=ne;ne.endScope&&ne.endScope._wrap?(Oe(),Me(te,ne.endScope._wrap)):ne.endScope&&ne.endScope._multi?(Oe(),j(ne.endScope,K)):Le.skip?De+=te:(Le.returnEnd||Le.excludeEnd||(De+=te),Oe(),Le.excludeEnd&&(De=te));do ne.scope&&ge.closeNode(),!ne.skip&&!ne.subLanguage&&(k+=ne.relevance),ne=ne.parent;while(ne!==xe.parent);return xe.starts&&pe(xe.starts,K),Le.returnEnd?0:te.length}function V(){const K=[];for(let te=ne;te!==se;te=te.parent)te.scope&&K.unshift(te.scope);K.forEach(te=>ge.openNode(te))}let Y={};function oe(K,te){const Re=te&&te[0];if(De+=K,Re==null)return Oe(),0;if(Y.type==="begin"&&te.type==="end"&&Y.index===te.index&&Re===""){if(De+=$.slice(te.index,te.index+1),!i){const xe=new Error(`0 width match regex (${P})`);throw xe.languageName=P,xe.badRule=Y.rule,xe}return 1}if(Y=te,te.type==="begin")return ke(te);if(te.type==="illegal"&&!J){const xe=new Error('Illegal lexeme "'+Re+'" for mode "'+(ne.scope||"<unnamed>")+'"');throw xe.mode=ne,xe}else if(te.type==="end"){const xe=N(te);if(xe!==sS)return xe}if(te.type==="illegal"&&Re==="")return 1;if(W>1e5&&W>te.index*3)throw new Error("potential infinite loop, way more iterations than matches");return De+=Re,Re.length}const se=T(P);if(!se)throw Hr(r.replace("{}",P)),new Error('Unknown language: "'+P+'"');const Te=i7e(se);let Ae="",ne=re||Te;const we={},ge=new a.__emitter(a);V();let De="",k=0,I=0,W=0,ye=!1;try{if(se.__emitTokens)se.__emitTokens($,ge);else{for(ne.matcher.considerAll();;){W++,ye?ye=!1:ne.matcher.considerAll(),ne.matcher.lastIndex=I;const K=ne.matcher.exec($);if(!K)break;const te=$.substring(I,K.index),Re=oe
`},m]}}return Eh=i,Eh}var yh,H0;function jqe(){if(H0)return yh;H0=1;function n(e){const t="[a-zA-Z_][\\w.]*",s="<\\?(lasso(script)?|=)",i="\\]|\\?>",r={$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|"+s},u={className:"symbol",begin:"'"+t+"'"},d=[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:[u]},{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:r,contains:[{className:"meta",begin:i,relevance:0,starts:{end:"\\[|"+s,returnEnd:!0,relevance:0,contains:[o]}},a,l,{className:"meta",begin:"\\[no_square_brackets",starts:{end:"\\[/no_square_brackets\\]",keywords:r,contains:[{className:"meta",begin:i,relevance:0,starts:{end:"\\[noprocess\\]|"+s,returnEnd:!0,contains:[o]}},a,l].concat(d)}},{className:"meta",begin:"\\[",relevance:0},{className:"meta",begin:"^#!",end:"lasso9$",relevance:10}].concat(d)}}return yh=n,yh}var vh,q0;function Qqe(){if(q0)return vh;q0=1;function n(e){const s=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(F=>F+"(?![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-
]`,m={scope:"string",variants:[d,u,h,f]},E={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},b=["false","null","true"],g=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],y=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],S={keyword:g,literal:(M=>{const q=[];return M.forEach(H=>{q.push(H),H.toLowerCase()===H?q.push(H.toUpperCase()):q.push(H.toLowerCase())}),q})(b),built_in:y},w=M=>M.map(q=>q.replace(/\|\d+$/,"")),C={variants:[{match:[/new/,t.concat(_,"+"),t.concat("(?!",w(y).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},A=t.concat(i,"\\b(?!\\()"),D={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,t.concat(/::/,t.lookahead(/(?!class\b)/)),A],scope:{1:"title.class",3:"variable.constant"}},{match:[r,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},T={scope:"attr",match:t.concat(i,t.lookahead(":"),t.lookahead(/(?!::)/))},O={relevance:0,begin:/\(/,end:/\)/,keywords:S,contains:[T,o,D,e.C_BLOCK_COMMENT_MODE,m,E,C]},F={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",w(g).join("\\b|"),"|",w(y).join("\\b|"),"\\b)"),i,t.concat(_,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[O]};O.contains.push(F);const z=[T,D,e.C_BLOCK_COMMENT_MODE,m,E,C],Z={begin:t.concat(/#\[\s*/,r),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...z]},...z,{s
]*;`,relevance:0},{begin:"[vp][0-9]+"}]}}return kf=n,kf}var Lf,sx;function c$e(){if(sx)return Lf;sx=1;function n(e){const t="[a-z][a-zA-Z0-9_]*",s={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,s,{begin:"\\|[ ]*"+t+"([ ]+"+t+")*[ ]*\\|",returnBegin:!0,end:/\|/,illegal:/\S/,contains:[{begin:"(\\|[ ]*)?"+t}]},{begin:"#\\(",end:"\\)",contains:[e.APOS_STRING_MODE,s,e.C_NUMBER_MODE,i]}]}}return Lf=n,Lf}var Pf,ix;function d$e(){if(ix)return Pf;ix=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 Pf=n,Pf}var Uf,rx;function u$e(){if(rx)return Uf;rx=1;function n(e){const t={className:"variable",begin:/\b_+[a-zA-Z]\w*/},s={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}]}]},r=["break","breakWith","breakOut","breakTo","case","catch","continue","continueWith","default","do","else","exit","exitWith","for","forEach","from","if","local","private","switch","step","then","throw","to","try","waitUntil","while","with"],o=["blufor","civilian","configNull","controlNull","displayNull","diaryRecordNull","east","endl","false","grpNull","independent","lineBreak","locationNull","nil","objNull","opfor","pi","resistance","scriptNull","sideAmbientLife","sideEmpty","sideEnemy","sideFriendly","sideLogic","sideUnknown","taskNull","teamMemberNull","true","west"],a=["abs","accTime","acos","action","actionIDs","actionKeys","actionKeysEx","actionKeysImages","actionKeysNames","actionKeysNamesArray","actionName","actionParams","activateAddons","activatedAddons","activateKey","activeTitleEffectParams","add3DENConnection","add3DENEventHandler","add3DENLayer","addAction","addBackpack","addBackpackCargo","addBackpackCargoGlobal","addBackpackGlobal","addBinocularItem","addCamShake","addCuratorAddons","addCuratorCameraArea","addCuratorEditableObjects","addCuratorEditingArea","addCuratorPoints","addEditorObject","addEventHandler","addForce","addForceGeneratorRTD","addGoggles","addGroupIcon","addHandgunItem","addHeadgear","addItem","addItemCargo","addItemCargoGlobal","addItemPool","addItemToBackpack","addItemToUniform","addItemToVest","addLiveStats","addMagazine","addMagazineAmmoCargo","addMagazineCargo","addMagazineCargoGlobal","addMagazineGlobal","addMagazinePool","addMagazines","addMagazineTurret","addMenu","addMenuItem","addMissionEventHandler","addMPEventHandler","addMusicEventHandler","addonFiles","addOwnedMine","addPlayerScores","addPrimaryWeaponItem","addPublicVariableEventHandler","addRating","addResources","addScore","addScoreSide","addSecondaryWeaponItem","addSwitchableUnit","addTeamMember","addToRemainsCollector","addTorque","addUniform","addUserActionEventHandler","a
2024-07-18 22:38:03 +00:00
]*?"'`},{begin:`"[^\r
2024-07-29 22:02:24 +00:00
"]*"`}]},{className:"built_in",variants:[{begin:"\\b(abs|acos|asin|atan|atan2|atanh|ceil|cloglog|comb|cos|digamma|exp|floor|invcloglog|invlogit|ln|lnfact|lnfactorial|lngamma|log|log10|max|min|mod|reldif|round|sign|sin|sqrt|sum|tan|tanh|trigamma|trunc|betaden|Binomial|binorm|binormal|chi2|chi2tail|dgammapda|dgammapdada|dgammapdadx|dgammapdx|dgammapdxdx|F|Fden|Ftail|gammaden|gammap|ibeta|invbinomial|invchi2|invchi2tail|invF|invFtail|invgammap|invibeta|invnchi2|invnFtail|invnibeta|invnorm|invnormal|invttail|nbetaden|nchi2|nFden|nFtail|nibeta|norm|normal|normalden|normd|npnchi2|tden|ttail|uniform|abbrev|char|index|indexnot|length|lower|ltrim|match|plural|proper|real|regexm|regexr|regexs|reverse|rtrim|string|strlen|strlower|strltrim|strmatch|strofreal|strpos|strproper|strreverse|strrtrim|strtrim|strupper|subinstr|subinword|substr|trim|upper|word|wordcount|_caller|autocode|byteorder|chop|clip|cond|e|epsdouble|epsfloat|group|inlist|inrange|irecode|matrix|maxbyte|maxdouble|maxfloat|maxint|maxlong|mi|minbyte|mindouble|minfloat|minint|minlong|missing|r|recode|replay|return|s|scalar|d|date|day|dow|doy|halfyear|mdy|month|quarter|week|year|d|daily|dofd|dofh|dofm|dofq|dofw|dofy|h|halfyearly|hofd|m|mofd|monthly|q|qofd|quarterly|tin|twithin|w|weekly|wofd|y|yearly|yh|ym|yofd|yq|yw|cholesky|colnumb|colsof|corr|det|diag|diag0cnt|el|get|hadamard|I|inv|invsym|issym|issymmetric|J|matmissing|matuniform|mreldif|nullmat|rownumb|rowsof|sweep|syminv|trace|vec|vecdiag)(?=\\()"}]},e.COMMENT("^[ ]*\\*.*$",!1),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]}}return Gf=n,Gf}var Vf,cx;function f$e(){if(cx)return Vf;cx=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 Vf=n,Vf}var zf,dx;function m$e(){if(dx)return zf;dx=1;const n=a=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:a.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:[a.APOS_STRING_MODE,a.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:a.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","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],t=["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","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],s=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","
2024-07-18 22:38:03 +00:00
(multipart)?`,end:`\\]
2024-07-29 22:02:24 +00:00
`},{className:"string",begin:"\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}.\\d+Z"},{className:"string",begin:"(\\+|-)\\d+"},{className:"keyword",relevance:10,variants:[{begin:"^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?"},{begin:"^progress(:?)(\\s+)?(pop|push)?"},{begin:"^tags:"},{begin:"^time:"}]}]}}return Hf=n,Hf}var qf,px;function b$e(){if(px)return qf;px=1;function n(D){return D?typeof D=="string"?D:D.source:null}function e(D){return t("(?=",D,")")}function t(...D){return D.map(O=>n(O)).join("")}function s(D){const T=D[D.length-1];return typeof T=="object"&&T.constructor===Object?(D.splice(D.length-1,1),T):{}}function i(...D){return"("+(s(D).capture?"":"?:")+D.map(F=>n(F)).join("|")+")"}const r=D=>t(/\b/,D,/\w$/.test(D)?/\b/:/\B/),o=["Protocol","Type"].map(r),a=["init","self"].map(r),l=["Any","Self"],u=["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","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"],d=["false","nil","true"],h=["assignment","associativity","higherThan","left","lowerThan","none","right"],f=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],_=["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"],m=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]/),E=i(m,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),b=t(m,E,"*"),g=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(g,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),v=t(g,y,"*"),S=t(/[A-Z]/,y,"*"),w=["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\(/,v,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain",
`),s=t.length.toString().length,i=t.map((u,d)=>(d+1).toString().padStart(s," ")),r=document.createElement("div");r.classList.add("line-numbers"),r.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=Xr.highlight(e,{language:n,ignoreIllegals:!0}).value,a.appendChild(l),o.appendChild(r),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),Ue(()=>{Ge.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)})}}},q$e={class:"bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},Y$e={class:"hljs p-1 rounded-md break-all grid grid-cols-1"},$$e={class:"code-container"},W$e=["innerHTML"],K$e={class:"flex flex-row bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},j$e={class:"text-2xl mr-2"},Q$e=["title"],X$e=c("i",{"data-feather":"copy"},null,-1),Z$e=[X$e],J$e=c("i",{"data-feather":"play-circle"},null,-1),eWe=[J$e],tWe=c("i",{"data-feather":"airplay"},null,-1),nWe=[tWe],sWe=c("i",{"data-feather":"folder"},null,-1),iWe=[sWe],rWe=c("img",{src:V$e,width:"25",height:"25"},null,-1),oWe=[rWe],aWe=c("img",{src:z$e,width:"25",height:"25"},null,-1),lWe=[aWe],cWe={key:0,class:"text-2xl"},dWe={key:1,class:"hljs mt-0 p-1 rounded-md break-all grid grid-cols-1"},uWe={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"},pWe=["innerHTML"];function _We(n,e,t,s,i,r){return x(),R("div",q$e,[c("pre",Y$e,[Xe(" "),c("div",$$e,[Xe(`
`),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:r.highlightedCode,contenteditable:"true",onInput:e[0]||(e[0]=(...o)=>n.updateCode&&n.updateCode(...o))},null,40,W$e),Xe(`
2024-07-18 22:38:03 +00:00
`)]),Xe(`
2024-07-29 22:02:24 +00:00
`)]),c("div",K$e,[c("span",j$e,ee(t.language.trim()),1),c("button",{onClick:e[1]||(e[1]=(...o)=>r.copyCode&&r.copyCode(...o)),title:i.isCopied?"Copied!":"Copy code",class:Fe([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"])},Z$e,10,Q$e),["function","python","sh","shell","bash","cmd","powershell","latex","mermaid","graphviz","dot","javascript","html","html5","svg"].includes(t.language)?(x(),R("button",{key:0,ref:"btn_code_exec",onClick:e[2]||(e[2]=(...o)=>r.executeCode&&r.executeCode(...o)),title:"execute",class:Fe(["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":""])},eWe,2)):G("",!0),["airplay","mermaid","graphviz","dot","javascript","html","html5","svg","css"].includes(t.language.trim())?(x(),R("button",{key:1,ref:"btn_code_exec_in_new_tab",onClick:e[3]||(e[3]=(...o)=>r.executeCode_in_new_tab&&r.executeCode_in_new_tab(...o)),title:"execute",class:Fe(["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":""])},nWe,2)):G("",!0),c("button",{onClick:e[4]||(e[4]=(...o)=>r.openFolder&&r.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"},iWe),["python","latex","html"].includes(t.language.trim())?(x(),R("button",{key:2,onClick:e[5]||(e[5]=(...o)=>r.openFolderVsCode&&r.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"},oWe)):G("",!0),["python","latex","html"].includes(t.language.trim())?(x(),R("button",{key:3,onClick:e[6]||(e[6]=(...o)=>r.openVsCode&&r.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"},lWe)):G("",!0)]),i.executionOutput?(x(),R("span",cWe,"Execution output")):G("",!0),i.executionOutput?(x(),R("pre",dWe,[Xe(" "),c("div",uWe,[Xe(`
`),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,pWe),Xe(`
2024-07-18 22:38:03 +00:00
`)]),Xe(`
2024-07-29 22:02:24 +00:00
`)])):G("",!0)])}const hWe=ct(H$e,[["render",_We]]);var qA={exports:{}};(function(n,e){(function(t,s){n.exports=s()})(oA,function(){function t(a,l){var u=a.pos;if(a.src.charCodeAt(u)!==92)return!1;var d=a.src.slice(++u).match(/^(?:\\\[|\\\(|begin\{([^}]*)\})/);if(!d)return!1;u+=d[0].length;var h,f,_;d[0]==="\\["?(h="display_math",f="\\\\]"):d[0]==="\\("?(h="inline_math",f="\\\\)"):d[1]&&(h="math",f="\\end{"+d[1]+"}",_=!0);var m=a.src.indexOf(f,u);if(m===-1)return!1;var E=m+f.length;if(!l){var b=a.push(h,"",0);b.content=_?a.src.slice(a.pos,E):a.src.slice(u,m)}return a.pos=E,!0}function s(a,l){var u=a.pos;if(a.src.charCodeAt(u)!==36)return!1;var d="$",h=a.src.charCodeAt(++u);if(h===36){if(d="$$",a.src.charCodeAt(++u)===36)return!1}else if(h===32||h===9||h===10)return!1;var f=a.src.indexOf(d,u);if(f===-1||a.src.charCodeAt(f-1)===92)return!1;var _=f+d.length;if(d.length===1){var m=a.src.charCodeAt(f-1);if(m===32||m===9||m===10)return!1;var E=a.src.charCodeAt(_);if(E>=48&&E<58)return!1}if(!l){var b=a.push(d.length===1?"inline_math":"display_math","",0);b.content=a.src.slice(u,f)}return a.pos=_,!0}function i(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")}function r(a,l){return Object.keys(l).reduce(function(u,d){return u[d]===void 0&&(u[d]=l[d]),u},a)}var o={math:"Math",inline_math:"InlineMath",display_math:"DisplayMath"};return function(a){var l={beforeMath:"",afterMath:"",beforeInlineMath:"\\(",afterInlineMath:"\\)",beforeDisplayMath:"\\[",afterDisplayMath:"\\]"};return a=r(a||{},l),function(u){u.inline.ruler.before("escape","math",t),u.inline.ruler.push("texMath",s),Object.keys(o).forEach(function(d){var h=a["before"+o[d]],f=a["after"+o[d]];u.renderer.rules[d]=function(_,m){return h+i(_[m].content)+f}})}}})})(qA);var fWe=qA.exports;const mWe=fr(fWe);function gWe(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const bWe={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:hWe},setup(n){const e=new $ge({html:!0,highlight:(r,o)=>{const a=o&&Xr.getLanguage(o)?o:"plaintext";return Xr.highlight(a,r).value},renderInline:!0,breaks:!0}).use(Qze).use(Do).use(sHe,{figcaption:!0}).use(mHe).use(tHe,{enableRowspan:!0,enableColspan:!0,enableGridTables:!0,enableGridTablesExtra:!0,enableTableIndentation:!0,tableCellPadding:" ",tableCellJoiner:"|",multilineCellStartMarker:"|>",multilineCellEndMarker:"<|",multilineCellPadding:" ",multilineCellJoiner:`
`}).use(mWe({inlineMath:[["$","$"],["\\(","\\)"]],blockMath:[["$$","$$"],["\\[","\\]"]]})),t=lt([]),s=()=>{if(n.markdownText){let r=e.parse(n.markdownText,{}),o=[];t.value=[];for(let a=0;a<r.length;a++)r[a].type!=="fence"?o.push(r[a]):(o.length>0&&(t.value.push({type:"html",html:e.renderer.render(o,e.options,{})}),o=[]),t.value.push({type:"code",language:gWe(r[a].info),code:r[a].content}));o.length>0&&(t.value.push({type:"html",html:e.renderer.render(o,e.options,{})}),o=[])}else t.value=[];Ue(()=>{Ge.replace()})},i=(r,o)=>{t.value[r].code=o};return Fn(()=>n.markdownText,s),Mi(()=>{s(),Ue(()=>{window.MathJax&&window.MathJax.typesetPromise()})}),{markdownItems:t,updateCode:i}}},EWe={class:"break-all container w-full"},yWe={ref:"mdRender",class:"markdown-content"},vWe=["innerHTML"];function SWe(n,e,t,s,i,r){const o=ut("code-block");return x(),R("div",EWe,[c("div",yWe,[(x(!0),R(Ve,null,Je(s.markdownItems,(a,l)=>(x(),R("div",{key:l},[a.type==="code"?(x(),St(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:u=>s.updateCode(l,u)},null,8,["host","language","code","discussion_id","message_id","client_id","onUpdateCode"])):(x(),R("div",{key:1,innerHTML:a.html},null,8,vWe))]))),128))],512)])}const Uu=ct(bWe,[["render",SWe]]),TWe={data(){return{show:!1,has_button:!0,message:""}},components:{MarkdownRenderer:Uu},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}}},xWe={key:0,class:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black bg-opacity-50 z-50"},CWe={class:"pl-10 pr-10 bg-bg-light dark:bg-bg-dark p-8 rounded-lg shadow-lg"},wWe={class:"container max-h-500 overflow-y-auto"},RWe={class:"text-lg font-medium"},AWe={class:"mt-4 flex justify-center"},NWe={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"},OWe=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),IWe=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),MWe=[OWe,IWe];function DWe(n,e,t,s,i,r){const o=ut("MarkdownRenderer");return i.show?(x(),R("div",xWe,[c("div",CWe,[c("div",wWe,[c("div",RWe,[_e(o,{ref:"mdRender",host:"","markdown-text":i.message,message_id:0,discussion_id:0},null,8,["markdown-text"])])]),c("div",AWe,[i.has_button?(x(),R("button",{key:0,onClick:e[0]||(e[0]=(...a)=>r.hide&&r.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 ")):G("",!0),i.has_button?G("",!0):(x(),R("svg",NWe,MWe))])])])):G("",!0)}const YA=ct(TWe,[["render",DWe]]);const kWe={props:{progress:{type:Number,required:!0}}},LWe={class:"progress-bar-container"};function PWe(n,e,t,s,i,r){return x(),R("div",LWe,[c("div",{class:"progress-bar",style:jt({width:`${t.progress}%`})},null,4)])}const Ll=ct(kWe,[["render",PWe]]),UWe={setup(){return{}},name:"UniversalForm",data(){
h-87.51l-313.51,338.7l-253.31-338.7H283.94z M412.63,231.77h136.81l604.13,807.76h-136.81L412.63,231.77z`})],-1),$Qe=[YQe],WQe={href:"https://discord.com/channels/1092918764925882418",target:"_blank"},KQe={class:"text-2xl hover:text-primary duration-150",title:"Visit my discord channel"},jQe=["src"],QQe=c("i",{"data-feather":"sun"},null,-1),XQe=[QQe],ZQe=c("i",{"data-feather":"moon"},null,-1),JQe=[ZQe],eXe=["src"],tXe=["src"],nXe=["src"],sXe={class:"language-selector relative",style:{position:"relative"}},iXe={key:0,ref:"languageMenu",class:"container language-menu absolute left-0 mt-1 bg-white dark:bg-bg-dark-tone rounded shadow-lg z-10 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",style:{position:"absolute",top:"100%",width:"200px","max-height":"300px","overflow-y":"auto"}},rXe={style:{"list-style-type":"none","padding-left":"0","margin-left":"0"}},oXe=["onClick"],aXe=["onClick"],lXe={class:"cursor-pointer hover:text-white py-0 px-0 block whitespace-no-wrap"},cXe={role:"status",class:"fixed m-0 p-2 left-2 bottom-2 min-w-[24rem] max-w-[24rem] h-20 flex flex-col justify-center items-center pb-4 bg-blue-500 rounded-lg shadow-lg z-50 background-a"},dXe={class:"text-2xl animate-pulse mt-2 text-white"},uXe={id:"app"},pXe=c("body",null,null,-1),_Xe={name:"TopBar",computed:{storeLogo(){return this.$store.state.config?hs:this.$store.state.config.app_custom_logo!=""?"/user_infos/"+this.$store.state.config.app_custom_logo:hs},languages:{get(){return console.log("searching languages",this.$store.state.languages),this.$store.state.languages}},language:{get(){return console.log("searching language",this.$store.state.language),this.$store.state.language}},currentPersonConfig(){try{return this.$store.state.currentPersonConfig}catch{console.log("Error finding current personality configuration");return}},selectedPersonality(){try{return this.$store.state.selectedPersonality}catch{console.log("Error finding current personality configuration");return}},loading_infos(){return this.$store.state.loading_infos},is_fun_mode(){try{return this.$store.state.config?this.$store.state.config.fun_mode:!1}catch(n){return console.error("Oopsie! Looks like we hit a snag: ",n),!1}},isModelOK(){return this.$store.state.isModelOk},isGenerating(){return this.$store.state.isGenerating},isConnected(){return this.$store.state.isConnected}},components:{Toast:Wl,MessageBox:YA,ProgressBar:Ll,UniversalForm:Xl,YesNoDialog:$A,Navigation:XA,PersonalityEditor:WA,PopupViewer:KA},watch:{"$store.state.config.fun_mode":function(n,e){console.log(`Fun mode changed from ${e} to ${n}! 🎉`)},"$store.state.isConnected":function(n,e){this.isConnected?(console.log("this.is_first_connection"),console.log(this.is_first_connection),this.is_first_connection||(this.$store.state.messageBox.hideMessage(),this.$store.state.messageBox.showMessage("Server connected."),this.$store.state.config.activate_audio_infos&&this.connection_recovered_audio.play())):(this.$store.state.messageBox.showBlockingMessage("Server suddenly disconnected. Please reboot the server to recover the connection"),this.is_first_connection=!1,console.log("this.is_first_connection set to false"),console.log(this.is_first_connection),this.$store.state.config.activate_audio_infos&&this.connection_lost_audio.play()),Ue(()=>{Ge.replace()})}},data(){return{customLanguage:"",selectedLanguage:"",isLanguageMenuVisible:!1,static_info:ZA,animated_info:lQe,normal_mode:eN,fun_mode:JA,is_first_connection:!0,discord:QA,FastAPI:jA,rebooting_audio:new Audio("rebooting.wav"),connection_lost_audio:new Audio("connection_lost.wav"),connection_recovered_audio:new Audio("connection_recovered.wav"),database_selectorDialogVisible:!1,progress_visibility:!1,progress_value:0,codeBlockStylesheet:"",sunIcon:document.querySelector(".sun"),moonIcon:document.querySelector(".moon"),userTheme:localSto
2024-07-18 22:38:03 +00:00
<div class="bg-white p-6 rounded-md shadow-md w-80">
<h2 class="text-lg font-semibold mb-3">${n}</h2>
<textarea id="replacementInput" class="w-full h-32 border rounded p-2 mb-3">${e}</textarea>
<div class="flex justify-end">
<button id="cancelButton" class="mr-2 px-4 py-2 border rounded">Cancel</button>
<button id="okButton" class="px-4 py-2 bg-blue-500 text-white rounded">OK</button>
</div>
</div>
`:r.innerHTML=`
<div class="bg-white p-6 rounded-md shadow-md w-80">
<h2 class="text-lg font-semibold mb-3">${n}</h2>
<select id="options_selector" class="form-control w-full h-25 border rounded p-2 mb-3">
${t.map(l=>`<option value="${l}">${l}</option>`)}
</select>
<div class="flex justify-end">
<button id="cancelButton" class="mr-2 px-4 py-2 border rounded">Cancel</button>
<button id="okButton" class="px-4 py-2 bg-blue-500 text-white rounded">OK</button>
</div>
</div>
2024-07-29 22:02:24 +00:00
`,document.body.appendChild(r);const o=r.querySelector("#cancelButton"),a=r.querySelector("#okButton");o.addEventListener("click",()=>{document.body.removeChild(r),s(null)}),a.addEventListener("click",()=>{if(t.length===0){const u=r.querySelector("#replacementInput").value.trim();document.body.removeChild(r),s(u)}else{const u=r.querySelector("#options_selector").value.trim();document.body.removeChild(r),s(u)}})})}function MZe(n,e){console.log(n);let t={},s=/@<([^>]+)>@/g,i=[],r;for(;(r=s.exec(n))!==null;)i.push("@<"+r[1]+">@");console.log("matches"),console.log(i),i=[...new Set(i)];async function o(l){console.log(l);let u=l.toLowerCase().substring(2,l.length-2);if(u!=="generation_placeholder")if(u.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,g])=>{console.log(`Key: ${b}, Value: ${g}`);function y(w){return w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const v=y(b),S=new RegExp(v,"g");u=u.replace(S,g)});let h=u.split(":"),f=h[0],_=h[1]||"",m=[];h.length>2&&(m=h.slice(1));let E=await qx(f,_,m);E!==null&&(t[l]=E)}else{let d=await qx(u);d!==null&&(t[l]=d)}}let a=Promise.resolve();i.forEach(l=>{a=a.then(()=>o(l)).then(u=>{console.log(u)})}),a.then(()=>{Object.entries(t).forEach(([l,u])=>{console.log(`Key: ${l}, Value: ${u}`);function d(_){return _.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const h=d(l),f=new RegExp(h,"g");n=n.replace(f,u)}),e(n)})}const DZe={name:"PlayGroundView",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/json"},pending:!1,is_recording:!1,is_deaf_transcribing:!1,cpp_block:yN,html5_block:vN,LaTeX_block:SN,javascript_block:bN,json_block:EN,code_block:mN,python_block:gN,bash_block:TN,tokenize_icon:RZe,deaf_off:NZe,deaf_on:AZe,rec_off:IZe,rec_on:OZe,loading_icon:xN,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:Wl,MarkdownRenderer:Uu,ClipBoardTextInput:Zb,TokensHilighter:SZe,Card:Bu},mounted(){de.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.sho
2024-07-18 22:38:03 +00:00
`?(this.text=this.text.slice(0,e)+"```"+n+"\n\n```\n"+this.text.slice(e),e=e+4+n.length):(this.text=this.text.slice(0,e)+"\n```"+n+"\n\n```\n"+this.text.slice(e),e=e+3+n.length):speechSynthesis==0||this.text[e-1]==`
`?(this.text=this.text.slice(0,e)+"```"+n+`
`+this.text.slice(e,t)+"\n```\n"+this.text.slice(t),e=e+4+n.length):(this.text=this.text.slice(0,e)+"\n```"+n+`
`+this.text.slice(e,t)+"\n```\n"+this.text.slice(t),e=e+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},insertTab(n){const e=n.target,t=e.selectionStart,s=e.selectionEnd,i=e.value.substring(0,t),r=e.value.substring(s),o=i+" "+r;this.text=o,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+4}),n.preventDefault()},mdTextarea_changed(){console.log("mdTextarea_changed"),this.cursorPosition=this.$refs.mdTextarea.selectionStart},mdTextarea_clicked(){console.log(`mdTextarea_clicked: ${this.$refs.mdTextarea.selectionStart}`),this.cursorPosition=this.$refs.mdTextarea.selectionStart},setModel(){this.selecting_model=!0,de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:this.selectedModel}).then(n=>{console.log(n),n.status&&this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,!0),this.selecting_model=!1}).catch(n=>{this.$refs.toast.showToast(`Error ${n}`,4,!0),this.selecting_model=!1})},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){console.log("READING..."),this.isSynthesizingVoice=!0;let n=this.$refs.mdTextarea.selectionStart,e=this.$refs.mdTextarea.selectionEnd,t=this.text;n!=e&&(t=t.slice(n,e)),de.post("./text2Wave",{text:t}).then(s=>{console.log(s.data.url);let i=s.data.url;this.audio_url=i,this.isSynthesizingVoice=!1,Ue(()=>{Ge.replace()})}).catch(s=>{this.$refs.toast.showToast(`Error: ${s}`,4,!1),this.isSynthesizingVoice=!1,Ue(()=>{Ge.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 r=this.text.substring(i,i+e);const o=[".","!","?",`
2024-07-29 22:02:24 +00:00
`];let a=-1;return o.forEach(l=>{const u=r.lastIndexOf(l);u>a&&(a=u)}),a==-1&&(a=r.length),console.log(a),a+i+1},s=()=>{const i=t(n),r=this.text.substring(n,i);this.msg.text=r,n=i+1,this.msg.onend=o=>{n<this.text.length-2?setTimeout(()=>{s()},1):(this.isSpeaking=!1,console.log("voice off :",this.text.length," ",i))},this.speechSynthesis.speak(this.msg)};s()},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 de.post("/lollms_tokenize",{prompt:this.text},{headers:this.posts_headers});console.log(n.data.named_tokens),this.namedTokens=n.data.named_tokens},generate(){console.log("Finding cursor position"),this.pre_text=this.text.substring(0,this.getCursorPosition()),this.post_text=this.text.substring(this.getCursorPosition(),this.text.length);var n=this.text.substring(0,this.getCursorPosition());console.log(this.text),console.log(`cursor position :${this.getCursorPosition()}`),console.log(`pretext:${this.pre_text}`),console.log(`post_text:${this.post_text}`),console.log(`prompt:${n}`),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=MZe(this.selectedPreset.content,n=>{console.log("Done"),console.log(n),this.text=n})},addPreset(){let n=prompt("Enter the title of the preset:");this.presets[n]={client_id:this.$store.state.client_id,name:n,content:this.text},de.post("./add_preset",this.presets[n]).then(e=>{console.log(e.data)}).catch(e=>{this.$refs.toast.showToast(`Error: ${e}`,4,!1)})},removePreset(){this.selectedPreset&&delete this.presets[this.selectedPreset.name]},reloadPresets(){de.get("./get_presets").then(n=>{console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)})},startRecording(){this.pending=!0,this.is_recording?de.post("/stop_recording",{client_id:this.$store.state.client_id}).then(n=>{this.is_recording=!1,this.pending=!1,console.log(n),this.text+=n.data.text,console.log(n.data),this.presets=n.data,this.selectedPreset=this.presets[0]}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)}):de.post("/start_recording",{client_id:this.$store.state.client_id}).then(n=>{this.is_recording=!0,this.pending=!1,console.log(n.data)}).catch(n=>{this.$refs.toast.showToast(`Error: ${n}`,4,!1)})},startRecordingAndTranscribing(){this.pending=!0,this.is_deaf_transcribing?de.get("/stop_recording").then(n=>{this.is_deaf_transcribing=!1,this.pending=!1,this
`,36),[[he,i.text]]),c("span",null,"Cursor position "+ee(i.cursorPosition),1)])):G("",!0),i.audio_url!=null?(x(),R("audio",{controls:"",key:i.audio_url},[c("source",{src:i.audio_url,type:"audio/wav",ref:"audio_player"},null,8,wJe),Xe(" Your browser does not support the audio element. ")])):G("",!0),_e(o,{namedTokens:i.namedTokens},null,8,["namedTokens"]),i.tab_id==="render"?(x(),R("div",RJe,[_e(a,{ref:"mdRender",client_id:this.$store.state.client_id,message_id:0,discussion_id:0,"markdown-text":i.text,class:"mt-4 p-2 rounded shadow-lg dark:bg-bg-dark"},null,8,["client_id","markdown-text"])])):G("",!0)],2)]),_e(l,{title:"settings",class:"slider-container ml-0 mr-0",isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:qe(()=>[_e(l,{title:"Model",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:qe(()=>[B(c("select",{"onUpdate:modelValue":e[28]||(e[28]=d=>this.$store.state.selectedModel=d),onChange:e[29]||(e[29]=(...d)=>r.setModel&&r.setModel(...d)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(x(!0),R(Ve,null,Je(r.models,d=>(x(),R("option",{key:d,value:d},ee(d),9,AJe))),128))],544),[[qt,this.$store.state.selectedModel]]),i.selecting_model?(x(),R("div",NJe,IJe)):G("",!0)]),_:1}),_e(l,{title:"Presets",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:qe(()=>[B(c("select",{"onUpdate:modelValue":e[30]||(e[30]=d=>i.selectedPreset=d),class:"bg-white dark:bg-black mb-2 border-2 rounded-md shadow-sm w-full"},[(x(!0),R(Ve,null,Je(i.presets,d=>(x(),R("option",{key:d,value:d},ee(d.name),9,MJe))),128))],512),[[qt,i.selectedPreset]]),DJe,c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[31]||(e[31]=(...d)=>r.setPreset&&r.setPreset(...d)),title:"Use preset"},LJe),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[32]||(e[32]=(...d)=>r.addPreset&&r.addPreset(...d)),title:"Add this text as a preset"},UJe),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[33]||(e[33]=(...d)=>r.removePreset&&r.removePreset(...d)),title:"Remove preset"},BJe),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[34]||(e[34]=(...d)=>r.reloadPresets&&r.reloadPresets(...d)),title:"Reload presets list"},VJe)]),_:1}),_e(l,{title:"Generation params",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:qe(()=>[c("div",zJe,[HJe,B(c("input",{type:"range","onUpdate:modelValue":e[35]||(e[35]=d=>i.temperature=d),min:"0",max:"5",step:"0.1",class:"w-full"},null,512),[[he,i.temperature]]),c("span",qJe,"Current value: "+ee(i.temperature),1)]),c("div",YJe,[$Je,B(c("input",{type:"range","onUpdate:modelValue":e[36]||(e[36]=d=>i.top_k=d),min:"1",max:"100",step:"1",class:"w-full"},null,512),[[he,i.top_k]]),c("span",WJe,"Current value: "+ee(i.top_k),1)]),c("div",KJe,[jJe,B(c("input",{type:"range","onUpdate:modelValue":e[37]||(e[37]=d=>i.top_p=d),min:"0",max:"1",step:"0.1",class:"w-full"},null,512),[[he,i.top_p]]),c("span",QJe,"Current value: "+ee(i.top_p),1)]),c("div",XJe,[ZJe,B(c("input",{type:"range","onUpdate:modelValue":e[38]||(e[38]=d=>i.repeat_penalty=d),min:"0",max:"5",step:"0.1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[he,i.repeat_penalty]]),c("span",JJe,"Current value: "+ee(i.repeat_penalty),1)]),c("div",eet,[tet,B(c("input",{type:"range","onUpdate:modelValue":e[39]||(e[39]=d=>i.repeat_last_n=d),min:"0",max:"100",step:"1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[he,i.repeat_last_n]]),c("span",net,"Current value: "+ee(i.repeat_last_n),1)]),c("div",set,[iet,B(c("input",{type:"number","onUpdate:modelValue":e[40]||(e[40]=d=>i.n_crop=d),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[he,i.n_crop]]),c("
2024-07-18 22:38:03 +00:00
`,this.configFile.start_user_header_id_template="!@>",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="!@>",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="lollms_simplified"?(console.log("Using lollms template"),this.configFile.start_header_id_template="@>",this.configFile.system_message_template="system",this.configFile.end_header_id_template=": ",this.configFile.separator_template=`
2024-07-23 23:35:50 +00:00
`,this.configFile.start_user_header_id_template="@>",this.configFile.end_user_header_id_template=": ",this.configFile.end_user_message_id_template="",this.configFile.start_ai_header_id_template="@>",this.configFile.end_ai_header_id_template=": ",this.configFile.end_ai_message_id_template="",this.settingsChanged=!0):e==="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=`
2024-07-21 19:50:34 +00:00
`,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)},install_model(){},reinstallDiffusersService(){de.post("/install_diffusers",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},upgradeDiffusersService(){de.post("upgrade_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallSDService(){de.post("/install_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},upgradeSDService(){de.post("upgrade_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},startSDService(){de.post("start_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},showSD(){de.post("show_sd",{client_id:this.$store.state.client_id},this.posts_headers).then(n=>{}).catch(n=>{console.error(n)})},reinstallComfyUIService(){de.post("install_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},upgradeComfyUIService(){de.post("upgrade_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startComfyUIService(){de.post("start_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},showComfyui(){de.post("show_comfyui",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallMotionCtrlService(){de.post("install_motion_ctrl",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallvLLMService(){de.post("install_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startvLLMService(){de.post("start_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},startollamaService(){de.post("start_ollama",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallPetalsService(){de.post("install_petals",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallOLLAMAService(){de.post("install_ollama",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},reinstallElasticSearchService(){de.post("install_vllm",{client_id:this.$store.state.client_id}).then(n=>{}).catch(n=>{console.error(n)})},getSeviceVoices(){de.get("list_voices").then(n=>{this.voices=n.data.voices}).catch(n=>{console.error(n)})},load_more_models(){this.models_zoo_initialLoadCount+10<this.models_zoo.length?this.models_zoo_initialLoadCount+=10:this.models_zoo_initialLoadCount=this.models_zoo.length},async modelsZooToggleCollapse(){this.mzc_collapsed=!this.mzc_collapsed,Ue(()=>{Ge.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.api_get_req("check_update");this.has_updates=n.update_availability,console.log("has_updates",this.has_updates)},onVariantChoiceSelected(n){thi
2024-07-18 22:38:03 +00:00
`+e.model.name+`
2024-07-21 19:50:34 +00:00
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage")}}else He.off("install_progress",s),console.log("Install failed"),e.installing=!1,this.showProgress=!1,console.error("Installation failed:",i.error),this.$store.state.toast.showToast(`Model:
2024-07-18 22:38:03 +00:00
`+e.model.name+`
2024-07-21 19:50:34 +00:00
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage");console.log("Here")};He.on("install_progress",s),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"),de.post("/upload_logo",t).then(s=>{console.log("Logo uploaded successfully"),this.$store.state.toast.showToast("Avatar uploaded successfully!",4,!0);const i=s.data.fileName;console.log("response",s),this.app_custom_logo=i,this.$store.state.config.app_custom_logo=i,this.settingsChanged=!0}).catch(s=>{console.error("Error uploading avatar:",s)})},uploadAvatar(n){const e=n.target.files[0],t=new FormData;t.append("avatar",e),console.log("Uploading avatar"),de.post("/upload_avatar",t).then(s=>{console.log("Avatar uploaded successfully"),this.$store.state.toast.showToast("Avatar uploaded successfully!",4,!0);const i=s.data.fileName;console.log("response",s),this.user_avatar=i,this.$store.state.config.user_avatar=i,this.settingsChanged=!0}).catch(s=>{console.error("Error uploading avatar:",s)})},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,Ue(()=>{Ge.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.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(s=>s.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(s=>s.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(s=>s.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:
2024-07-18 22:38:03 +00:00
`+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(s=>s.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+`
2024-07-21 19:50:34 +00:00
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.minconf_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:
2024-07-18 22:38:03 +00:00
${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);Ue(()=>{Ge.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),Ue(()=>{Ge.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),Ue(()=>{Ge.replace()})),this.settingsChanged=!0,this.isModelSelected=!0}):this.$store.state.toast.showToast(`Model:
`+n.model.name+`
is not installed`,4,!1),Ue(()=>{Ge.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}
2024-07-21 19:50:34 +00:00
Description: ${n.description}`,this.$store.state.toast.showToast("Copied model info to clipboard!",4,!0),navigator.clipboard.writeText(e.trim())},onCopyLink(n){this.$store.state.toast.showToast("Copied link to clipboard!",4,!0),navigator.clipboard.writeText(n.model.name)},onCopyPersonalityName(n){this.$store.state.toast.showToast("Copied name to clipboard!",4,!0),navigator.clipboard.writeText(n.name)},async onCopyToCustom(n){await de.post("/copy_to_custom_personas",{client_id:this.$store.state.client_id,category:n.personality.category,name:n.personality.name})},async handleOpenFolder(n){await de.post("/open_personality_folder",{client_id:this.$store.state.client_id,personality_folder:n.personality.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(){de.post("/add_reference_to_local_model",{path:this.reference_path}).then(n=>{n.status?(this.$store.state.toast.showToast("Reference created",4,!0),this.is_loading_zoo=!0,this.refreshModelsZoo().then(()=>{this.updateModelsZoo(),this.is_loading_zoofalse})):this.$store.state.toast.showToast("Couldn't create reference",4,!1)})},onInstallAddModel(){if(!this.addModel.url){this.$store.state.toast.showToast("Link is empty",4,!1);return}let n=this.addModel.url;this.addModel.progress=0,console.log("installing..."),console.log("value ",this.addModel.url),this.modelDownlaodInProgress=!0;const e=t=>{console.log("received something"),t.status&&t.progress<=100?(console.log("Progress",t),this.addModel=t,this.addModel.url=n,this.addModel.progress==100&&(this.modelDownlaodInProgress=!1,console.log("Received succeeded"),He.off("install_progress",e),console.log("Installed successfully"),this.addModel={},this.$store.state.toast.showToast(`Model:
2024-07-18 22:38:03 +00:00
`+this.addModel.model_name+`
2024-07-21 19:50:34 +00:00
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:
2024-07-18 22:38:03 +00:00
`+this.addModel.model_name+`
2024-07-21 19:50:34 +00:00
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:
2024-07-18 22:38:03 +00:00
`+this.addModel.model_name+`
2024-07-21 19:50:34 +00:00
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:
2024-07-18 22:38:03 +00:00
`+this.addModel.model_name+`
2024-07-21 19:50:34 +00:00
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=s=>{console.log("uninstalling res",s),s.status?(console.log("uninstalling success",s),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:
2024-07-18 22:38:03 +00:00
`+n.model.name+`
2024-07-21 19:50:34 +00:00
was uninstalled!`,4,!0),this.$store.dispatch("refreshDiskUsage")):(console.log("uninstalling failed",s),n.uninstalling=!1,this.showProgress=!1,He.off("uninstall_progress",t),console.error("Uninstallation failed:",s.error),this.$store.state.toast.showToast(`Model:
2024-07-18 22:38:03 +00:00
`+n.model.name+`
2024-07-21 19:50:34 +00:00
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:
2024-07-18 22:38:03 +00:00
`+n.binding.name,4,!1);return}this.mzc_collapsed=!0,this.configFile.binding_name!=n.binding.folder&&(this.update_binding(n.binding.folder),this.binding_changed=!0),this.api_get_req("get_model_status").then(e=>{this.$store.commit("setIsModelOk",e)})},onInstallBinding(n){this.configFile.binding_name!=n.binding.folder?(this.isLoading=!0,n.disclaimer&&this.$store.state.yesNoDialog.askQuestion(n.disclaimer,"Proceed","Cancel"),de.post("/install_binding",{name:n.binding.folder}).then(e=>{if(e)return this.isLoading=!1,console.log("install_binding",e),e.data.status?(this.$store.state.toast.showToast("Binding installed successfully!",4,!0),this.$store.state.messageBox.showMessage(`It is advised to reboot the application after installing a binding.
Page will refresh in 5s.`),setTimeout(()=>{window.location.href="/"},5e3)):this.$store.state.toast.showToast("Could not reinstall binding",4,!1),this.isLoading=!1,e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall binding
`+e.message,4,!1),{status:!1}))):this.update_binding(n.binding.folder)},onUnInstallBinding(n){this.isLoading=!0,de.post("/unInstall_binding",{name:n.binding.folder}).then(e=>{if(e){if(this.isLoading=!1,console.log("unInstall_binding",e),e.data.status){const t=this.bindingsZoo.findIndex(i=>i.folder==n.binding.folder),s=this.bindingsZoo[t];s?s.installed=!0:s.installed=!1,this.settingsChanged=!0,this.binding_changed=!0,this.$store.state.toast.showToast("Binding uninstalled successfully!",4,!0)}else this.$store.state.toast.showToast("Could not uninstall binding",4,!1);return e.data}this.isLoading=!1,n.isInstalled=False}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not uninstall binding
`+e.message,4,!1),{status:!1}))},onReinstallBinding(n){this.isLoading=!0,de.post("/reinstall_binding",{name:n.binding.folder}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_binding",e),e.data.status?(this.$store.state.toast.showToast("Binding reinstalled successfully!",4,!0),this.$store.state.messageBox.showMessage("It is advised to reboot the application after installing a binding")):this.$store.state.toast.showToast("Could not reinstall binding",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall binding
`+e.message,4,!1),{status:!1}))},onSettingsBinding(n){try{this.isLoading=!0,de.get("/get_active_binding_settings").then(e=>{console.log(e),this.isLoading=!1,e&&(console.log("binding setting",e),e.data&&Object.keys(e.data).length>0?this.$store.state.universalForm.showForm(e.data,"Binding settings - "+n.binding.name,"Save changes","Cancel").then(t=>{try{de.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,settings:t},{headers:this.posts_headers}).then(s=>{s&&s.data?(console.log("binding set with new settings",s.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0),de.post("/update_binding_settings",{client_id:this.$store.state.client_id}).then(i=>{this.$store.state.toast.showToast("Binding settings committed successfully!",4,!0),window.location.href="/"})):(this.$store.state.toast.showToast(`Did not get binding settings responses.
`+s,4,!1),this.isLoading=!1)})}catch(s){this.$store.state.toast.showToast(`Did not get binding settings responses.
Endpoint error: `+s.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(e){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+e.message,4,!1)}},onReloadBinding(n){console.log("Reloading binding"),this.isLoading=!0,de.post("/reload_binding",{name:n.binding.folder},{headers:this.posts_headers}).then(e=>{if(e)return this.isLoading=!1,console.log("reload_binding",e),e.data.status?this.$store.state.toast.showToast("Binding reloaded successfully!",4,!0):this.$store.state.toast.showToast("Could not reload binding",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reload binding
`+e.message,4,!1),{status:!1}))},onSettingsPersonality(n){try{this.isLoading=!0,de.get("/get_active_personality_settings").then(e=>{this.isLoading=!1,e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$store.state.universalForm.showForm(e.data,"Personality settings - "+n.personality.name,"Save changes","Cancel").then(t=>{try{de.post("/set_active_personality_settings",t).then(s=>{s&&s.data?(console.log("personality set with new settings",s.data),this.$store.state.toast.showToast("Personality settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get Personality settings responses.
`+s,4,!1),this.isLoading=!1)})}catch(s){this.$store.state.toast.showToast(`Did not get Personality settings responses.
Endpoint error: `+s.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.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 s={client_id:this.$store.state.client_id,setting_name:n,setting_value:e};console.log("Updating setting",n,":",e);let i=await de.post("/update_setting",s,{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 s=new Date(e.last_commit_time);return new Date(t.last_commit_time)-s}),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 s=n.findIndex(i=>i.name==t);if(s==-1)for(let i=0;i<n.length;i++){let r=n[i].variants;if(r!=null&&(s=r.findIndex(o=>o.name==t),s!=-1)){s=i,console.log(`Found ${t} at index ${s}`);break}}if(s==-1){let i={};i.name=t,i.icon=this.imgBinding,i.isCustomModel=!0,i.isInstalled=!0,n.push(i)}else n[s].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),s=this.bindingsZoo[t];s?s.installed=!0:s.installed=!1,this.settingsChanged=!0,this.isLoading=!1,Ue(()=>{Ge.replace()}),console.log("updating model"),this.update_model(null).then(()=>{}),Ue(()=>{Ge.replace()})}),Ue(()=>{Ge.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,Ue(()=>{Ge.replace()}),e},async cancelConfiguration(){await this.$store.dispatch("refreshConfig"),this.settingsChanged=!1},applyConfiguration(){this.isLoading=!0,de.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.configFile},{headers:this.posts_headers}).then(n=>{this.isLoading=!1,n.data.status?(this.$store.state.toast.showToast("Configuration changed successfully.",4,!0),this.settingsChanged=!1):this.$store.state.toast.showToast("Configuration change failed.",4,!1),Ue(()=>{Ge.replace()})})},save_configuration(){this.showConfirmation=!1,de.post("/save_settings",{},{headers:this.posts_headers}).then(n=>{if(n)return n.status||this.$store.state.messageBox.showMessage("Error: Couldn't save settings!"),n.data}).catch(n=>(console.log(n.message,"save_configuration"),this.$store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},reset_configuration(){this.$store.state.yesNoDialog.askQuestion(`Are you sure?
2024-07-27 23:19:18 +00:00
This will delete all your configurations and get back to default configuration.`).then(n=>{n&&de.post("/reset_settings",{},{headers:this.posts_headers}).then(e=>{if(e)return e.status?this.$store.state.messageBox.showMessage("Settings have been reset correctly"):this.$store.state.messageBox.showMessage("Couldn't reset settings!"),e.data}).catch(e=>(console.log(e.message,"reset_configuration"),this.$store.state.messageBox.showMessage("Couldn't reset settings!"),{status:!1}))})},async api_get_req(n){try{const e=await de.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - settings");return}},async api_post_req(n){try{const e=await de.post("/"+n,{client_id:this.$store.state.client_id});if(e)return e.data}catch(e){console.log(e.message,"api_post_req - settings");return}},closeToast(){this.showToast=!1},async getPersonalitiesArr(){this.isLoading=!0,this.personalities=[];const n=await this.api_get_req("get_all_personalities"),e=this.$store.state.config,t=Object.keys(n);for(let s=0;s<t.length;s++){const i=t[s],o=n[i].map(a=>{const l=e.personalities.includes(i+"/"+a.folder);let u={};return u=a,u.category=i,u.language="",u.full_path=i+"/"+a.folder,u.isMounted=l,u});this.personalities.length==0?this.personalities=o:this.personalities=this.personalities.concat(o)}this.personalities.sort((s,i)=>s.name.localeCompare(i.name)),this.personalitiesFiltered=this.personalities.filter(s=>s.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.personalities.filter(t=>t.category===this.configFile.personality_category),this.personalitiesFiltered.sort(),this.searchPersonalityInProgress=!1;return}const n=this.searchPersonality.toLowerCase(),e=this.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.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 Qs(n)},async mount_personality(n){if(!n)return{status:!1,error:"no personality - mount_personality"};try{const e={client_id:this.$store.state.client_id,language:n.language?n.language:"",category:n.category?n.category:"",folder:n.folder?n.folder:""},t=await de.post("/mount_personality",e,{headers:this.posts_headers});if(t)return t.data}catch(e){console.log(e.message,"mount_personality - settings");return}},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={client_id:this.$store.state.client_id,language:n.language,category:n.category,folder:n.folder};try{const t=await de.post("/unmount_personality",e,{headers:this.posts_headers});if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};let e=n.language==null?n.full_path:n.full_path+":"+n.language;console.log("pth",e);const t=this.configFile.personalities.findIndex(i=>i===e),s={client_id:this.$store.state.client_id,id:t};try{const i=await de.post("/select_personality",s,{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){c
2024-07-18 22:38:03 +00:00
`+n.personality.name,4,!0),this.$store.dispatch("refreshMountedPersonalities")):(n.isMounted=!1,this.$store.state.toast.showToast(`Could not mount personality
Error: `+e.error+`
Response:
`+e,4,!1)),this.isLoading=!1},async unmountAll(){await de.post("/unmount_all_personalities",{client_id:this.$store.state.client_id},{headers:this.posts_headers}),this.$store.dispatch("refreshMountedPersonalities"),this.$store.dispatch("refreshConfig"),this.$store.state.toast.showToast("All personas unmounted",4,!0)},async unmountPersonality(n){if(this.isLoading=!0,!n)return;const e=await this.unmount_personality(n.personality||n);if(e.status){this.configFile.personalities=e.personalities,this.$store.state.toast.showToast("Personality unmounted",4,!0);const t=this.personalities.findIndex(a=>a.full_path==n.full_path),s=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.personalities[t]),this.personalities[t].isMounted=!1,s>-1&&(this.personalitiesFiltered[s].isMounted=!1),i>-1&&(this.$refs.personalitiesZoo[i].isMounted=!1),this.$store.dispatch("refreshMountedPersonalities");const r=this.mountedPersArr[this.mountedPersArr.length-1];console.log(r,this.mountedPersArr.length),(await this.select_personality(n.personality)).status&&this.$store.state.toast.showToast(`Selected personality:
`+r.name,4,!0)}else this.$store.state.toast.showToast(`Could not unmount personality
Error: `+e.error,4,!1);this.isLoading=!1},editPersonality(n){n=n.personality,de.post("/get_personality_config",{client_id:this.$store.state.client_id,category:n.category,name:n.folder}).then(e=>{const t=e.data;console.log("Done"),t.status?(this.$store.state.currentPersonConfig=t.config,this.$store.state.showPersonalityEditor=!0,this.$store.state.personality_editor.showPanel(),this.$store.state.selectedPersonality=n):console.error(t.error)}).catch(e=>{console.error(e)})},copyToCustom(n){n=n.personality,de.post("/copy_to_custom_personas",{category:n.category,name:n.folder}).then(e=>{e.status?(this.$store.state.messageBox.showMessage(`Personality copied to the custom personalities folder:
Now it's up to you to modify it, enhance it, and maybe even share it.
Feel free to add your name as an author, but please remember to keep the original creator's name as well.
You have the freedom to give, sell, or keep the personas you create for yourself.
The possibilities are endless, they are now yours to mold and customize as you see fit.`),this.$store.dispatch("refreshPersonalitiesZoo")):this.$store.state.toast.showToast(`Personality couldn't be copied to the custom personalities folder:
Verify that the personality is not already copied there.`,4,!1)}).catch(e=>{this.$store.state.toast.showToast(`Personality couldn't be copied to the custom personalities folder:
`,4,!1),console.error(e)})},async remountPersonality(n){await this.unmountPersonality(n),await this.mountPersonality(n)},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,console.log("Personality path:",n.personality.path),de.post("/reinstall_personality",{client_id:this.$store.state.client_id,name:n.personality.path},{headers:this.posts_headers}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$store.state.toast.showToast("Personality reinstalled successfully!",4,!0):this.$store.state.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall personality
`+e.message,4,!1),{status:!1}))},personalityImgPlacehodler(n){n.target.src=hs},searchPersonality_func(){clearTimeout(this.searchPersonalityTimer),this.searchPersonality&&(this.searchPersonalityInProgress=!0,setTimeout(this.filterPersonalities,this.searchPersonalityTimerInterval))},searchModel_func(){this.filterModels()}},async mounted(){console.log("Getting voices"),this.getVoices(),console.log("Constructing"),this.load_everything(),this.getSeviceVoices();try{console.log("Loading input devices list");const n=await de.get("/get_snd_input_devices");this.snd_input_devices=n.data.device_names,this.snd_input_devices_indexes=n.data.device_indexes}catch{console.log("Couldin't list input devices")}try{console.log("Loading output devices list");const n=await de.get("/get_snd_output_devices");this.snd_output_devices=n.data.device_names,this.snd_output_devices_indexes=n.data.device_indexes}catch{console.log("Couldin't list output devices")}try{console.log("Getting comfyui models");const n=await de.get("/list_comfyui_models");console.log("res is ",n),n.data.status&&(this.comfyui_models=n.data.models)}catch{console.log("Couldin't list output devices")}},activated(){},computed:{full_template:{get(){return(this.configFile.start_header_id_template+this.configFile.system_message_template+this.configFile.end_header_id_template+" system message"+this.configFile.separator_template+this.configFile.start_user_header_id_template+"user name"+this.configFile.end_user_header_id_template+" User prompt"+this.configFile.separator_template+this.configFile.end_user_message_id_template+this.configFile.separator_template+this.configFile.start_ai_header_id_template+"ai personality"+this.configFile.end_ai_header_id_template+"ai response"+this.configFile.end_ai_message_id_template).replace(`
2024-07-27 23:19:18 +00:00
`,"<br>")}},rendered_models_zoo:{get(){return this.searchModel?this.show_only_installed_models?this.modelsFiltered.filter(n=>n.isInstalled===!0):this.modelsFiltered.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)):(console.log("this.models_zoo"),console.log(this.models_zoo),console.log(this.models_zoo_initialLoadCount),this.show_only_installed_models?this.models_zoo.filter(n=>n.isInstalled===!0):this.models_zoo.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)))}},imgBinding:{get(){if(!this.isMounted)return ws;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return ws}}},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):ws}catch{console.log("error")}if(!this.isMounted)return ws;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return ws}}},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:hs},set(n){this.$store.state.config.user_avatar=n}},hardware_mode:{get(){return this.$store.state.config.hardware_mode},set(n){this.$store.state.config.hardware_mode=n}},auto_update:{get(){return this.$store.state.co
2024-07-29 22:02:24 +00:00
You need to apply changes before you leave, or else.`,"Apply configuration","Cancel")&&this.applyConfiguration(),!1}},L=n=>(_r("data-v-e519cdb3"),n=n(),hr(),n),kit={class:"container overflow-y-scroll flex flex-row shadow-lg p-10 pt-0 overflow-y-scroll w-full dark:bg-bg-dark 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"},Lit={class:"sticky top-0 z-10 flex flex-row mb-2 p-3 gap-3 w-full rounded-b-lg bg-bg-light-tone dark:bg-bg-dark-tone shadow-lg"},Pit={key:0,class:"flex gap-3 flex-1 items-center duration-75"},Uit=L(()=>c("i",{"data-feather":"x"},null,-1)),Fit=[Uit],Bit=L(()=>c("i",{"data-feather":"check"},null,-1)),Git=[Bit],Vit={key:1,class:"flex gap-3 flex-1 items-center"},zit=L(()=>c("i",{"data-feather":"refresh-ccw"},null,-1)),Hit=[zit],qit=L(()=>c("i",{"data-feather":"list"},null,-1)),Yit=[qit],$it={class:"flex gap-3 flex-1 items-center justify-end"},Wit=L(()=>c("i",{"data-feather":"trash-2"},null,-1)),Kit=[Wit],jit=L(()=>c("i",{"data-feather":"refresh-ccw"},null,-1)),Qit=[jit],Xit=L(()=>c("i",{"data-feather":"arrow-up-circle"},null,-1)),Zit=L(()=>c("i",{"data-feather":"alert-circle"},null,-1)),Jit={class:"flex gap-3 items-center"},ert={key:0,class:"flex gap-3 items-center"},trt=L(()=>c("div",{class:"flex flex-row"},[c("p",{class:"text-green-600 font-bold hover:text-green-300 ml-4 pl-4 mr-4 pr-4"},"Apply changes:"),c("i",{"data-feather":"check"})],-1)),nrt=[trt],srt=L(()=>c("div",{class:"flex flex-row"},[c("p",{class:"text-red-600 font-bold hover:text-red-300 ml-4 pl-4 mr-4 pr-4"},"Cancel changes:"),c("i",{"data-feather":"x"})],-1)),irt=[srt],rrt={key:1,role:"status"},ort=L(()=>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"})],-1)),art=L(()=>c("span",{class:"sr-only"},"Loading...",-1)),lrt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},crt={class:"flex flex-row p-3"},drt=L(()=>c("i",{"data-feather":"chevron-right"},null,-1)),urt=[drt],prt=L(()=>c("i",{"data-feather":"chevron-down"},null,-1)),_rt=[prt],hrt=L(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," System status",-1)),frt=L(()=>c("div",{class:"mr-2"},"|",-1)),mrt={class:"text-base font-semibold cursor-pointer select-none items-center"},grt={class:"flex gap-2 items-center"},brt={key:0},Ert=["src"],yrt={class:"font-bold font-large text-lg"},vrt={key:1},Srt={class:"flex gap-2 items-center"},Trt=["src"],xrt={class:"font-bold font-large text-lg"},Crt=L(()=>c("i",{"data-feather":"cpu",title:"CPU Ram",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),wrt={class:"font-bold font-large text-lg"},Rrt=L(()=>c("i",{"data-feather":"hard-drive",title:"Hard drive",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Art={class:"font-bold fo
2024-07-18 22:38:03 +00:00
If you are using windows, this uses wsl which requires you to have it installed or at least activated.
If You are using windows, this will install wsl so you need to activate it.
2024-07-29 22:02:24 +00:00
<a href='https://techcommunity.microsoft.com/t5/windows-11/how-to-install-the-linux-windows-subsystem-in-windows-11/m-p/2701207' target='_blank'>Here is how you can do that</a>`))},M_t)])]),c("tr",null,[D_t,c("td",null,[c("div",k_t,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[336]||(e[336]=(..._)=>r.reinstallOLLAMAService&&r.reinstallOLLAMAService(..._))},"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[337]||(e[337]=(..._)=>r.startollamaService&&r.startollamaService(..._))},"start ollama service")])])]),c("tr",null,[L_t,c("td",null,[c("div",P_t,[B(c("input",{type:"text",id:"ollama_base_url",required:"","onUpdate:modelValue":e[338]||(e[338]=_=>r.configFile.ollama_base_url=_),onChange:e[339]||(e[339]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[he,r.configFile.ollama_base_url]])])])])])]),_:1}),_e(o,{title:"vLLM service",is_subcard:!0,class:"pb-2 m-2"},{default:qe(()=>[c("table",U_t,[c("tr",null,[F_t,c("td",null,[c("div",B_t,[B(c("input",{type:"checkbox",id:"enable_vllm_service",required:"","onUpdate:modelValue":e[340]||(e[340]=_=>r.configFile.enable_vllm_service=_),onChange:e[341]||(e[341]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Ke,r.configFile.enable_vllm_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[342]||(e[342]=_=>this.$store.state.messageBox.showMessage(`Activates vllm service. The service will be automatically loaded at startup alowing you to use the elf binding.
2024-07-18 22:38:03 +00:00
If you are using windows, this uses wsl which requires you to have it installed or at least activated.
If You are using windows, this will install wsl so you need to activate it.
2024-07-29 22:02:24 +00:00
<a href='https://techcommunity.microsoft.com/t5/windows-11/how-to-install-the-linux-windows-subsystem-in-windows-11/m-p/2701207' target='_blank'>Here is how you can do that</a>`))},V_t)])]),c("tr",null,[z_t,c("td",null,[c("div",H_t,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[343]||(e[343]=(..._)=>r.reinstallvLLMService&&r.reinstallvLLMService(..._))},"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[344]||(e[344]=(..._)=>r.startvLLMService&&r.startvLLMService(..._))},"start vllm service")])])]),c("tr",null,[q_t,c("td",null,[c("div",Y_t,[B(c("input",{type:"text",id:"vllm_url",required:"","onUpdate:modelValue":e[345]||(e[345]=_=>r.configFile.vllm_url=_),onChange:e[346]||(e[346]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[he,r.configFile.vllm_url]])])])]),c("tr",null,[$_t,c("td",null,[c("div",W_t,[c("div",K_t,[j_t,c("p",Q_t,[B(c("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[347]||(e[347]=_=>r.configFile.vllm_gpu_memory_utilization=_),onChange:e[348]||(e[348]=_=>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),[[he,r.configFile.vllm_gpu_memory_utilization]])])]),B(c("input",{id:"vllm_gpu_memory_utilization",onChange:e[349]||(e[349]=_=>i.settingsChanged=!0),type:"range","onUpdate:modelValue":e[350]||(e[350]=_=>r.configFile.vllm_gpu_memory_utilization=_),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),[[he,r.configFile.vllm_gpu_memory_utilization]])])])]),c("tr",null,[X_t,c("td",null,[c("div",Z_t,[B(c("input",{type:"number",id:"vllm_max_num_seqs",min:"64",max:"2048",required:"","onUpdate:modelValue":e[351]||(e[351]=_=>r.configFile.vllm_max_num_seqs=_),onChange:e[352]||(e[352]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[he,r.configFile.vllm_max_num_seqs]])])])]),c("tr",null,[J_t,c("td",null,[c("div",eht,[B(c("input",{type:"number",id:"vllm_max_model_len",min:"2048",max:"1000000",required:"","onUpdate:modelValue":e[353]||(e[353]=_=>r.configFile.vllm_max_model_len=_),onChange:e[354]||(e[354]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[he,r.configFile.vllm_max_model_len]])])])]),c("tr",null,[tht,c("td",null,[c("div",nht,[B(c("input",{type:"text",id:"vllm_model_path",required:"","onUpdate:modelValue":e[355]||(e[355]=_=>r.configFile.vllm_model_path=_),onChange:e[356]||(e[356]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[he,r.configFile.vllm_model_path]])])])])])]),_:1}),_e(o,{title:"Petals service",is_subcard:!0,class:"pb-2 m-2"},{default:qe(()=>[c("table",sht,[c("tr",null,[iht,c("td",null,[c("div",rht,[B(c("input",{type:"checkbox",id:"enable_petals_service",required:"","onUpdate:modelValue":e[357]||(e[357]=_=>r.configFile.enable_petals_service=_),onChange:e[358]||(e[358]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Ke,r.configFile.enable_petals_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[359]||(e[359]=_=>this.$store.state.messageBox.showMessage(`Activates Petals service. The service will be automatically loaded at startup alowing you to use the petals endpoint to generate text in a distributed network.
2024-07-18 22:38:03 +00:00
If You are using windows, this will install wsl so you need to activate it.
2024-07-29 22:02:24 +00:00
<a href='https://techcommunity.microsoft.com/t5/windows-11/how-to-install-the-linux-windows-subsystem-in-windows-11/m-p/2701207' target='_blank'>Here is how you can do that</a>`))},aht)])]),c("tr",null,[lht,c("td",null,[c("div",cht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[360]||(e[360]=(..._)=>r.reinstallPetalsService&&r.reinstallPetalsService(..._))},"install petals service")])])]),c("tr",null,[dht,c("td",null,[c("div",uht,[B(c("input",{type:"text",id:"petals_base_url",required:"","onUpdate:modelValue":e[361]||(e[361]=_=>r.configFile.petals_base_url=_),onChange:e[362]||(e[362]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[he,r.configFile.petals_base_url]])])])])])]),_:1})]),_:1}),_e(o,{title:"Misc",is_shrunk:!0,is_subcard:!0,class:"pb-2 m-2"},{default:qe(()=>[_e(o,{title:"Motion Ctrl service",is_subcard:!0,class:"pb-2 m-2"},{default:qe(()=>[c("table",pht,[c("tr",null,[_ht,c("td",null,[c("div",hht,[B(c("input",{type:"checkbox",id:"enable_motion_ctrl_service",required:"","onUpdate:modelValue":e[363]||(e[363]=_=>r.configFile.enable_motion_ctrl_service=_),onChange:e[364]||(e[364]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Ke,r.configFile.enable_motion_ctrl_service]])])]),c("td",null,[c("div",{class:"hover:text-secondary duration-75 active:scale-90 peer-checked:text-primary",onClick:e[365]||(e[365]=_=>this.$store.state.messageBox.showMessage("Activates Motion ctrl service. The service will be automatically loaded at startup alowing you to use the motoin control endpoint to generate videos"))},mht)])]),c("tr",null,[ght,c("td",null,[c("div",bht,[c("button",{class:"hover:text-primary bg-green-200 rounded-lg p-4 m-4 w-full text-center items-center",onClick:e[366]||(e[366]=(..._)=>r.reinstallMotionCtrlService&&r.reinstallMotionCtrlService(..._))},"install Motion Ctrl service")])])]),c("tr",null,[Eht,c("td",null,[c("div",yht,[B(c("input",{type:"text",id:"sd_base_url",required:"","onUpdate:modelValue":e[367]||(e[367]=_=>r.configFile.sd_base_url=_),onChange:e[368]||(e[368]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[he,r.configFile.sd_base_url]])])])])])]),_:1}),_e(o,{title:"Elastic search Service (under construction)",is_subcard:!0,class:"pb-2 m-2"},{default:qe(()=>[c("table",vht,[c("tr",null,[Sht,c("td",null,[c("div",Tht,[B(c("input",{type:"checkbox",id:"elastic_search_service",required:"","onUpdate:modelValue":e[369]||(e[369]=_=>r.configFile.elastic_search_service=_),onChange:e[370]||(e[370]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Ke,r.configFile.elastic_search_service]])])])]),c("tr",null,[xht,c("td",null,[c("div",Cht,[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]=(..._)=>r.reinstallElasticSearchService&&r.reinstallElasticSearchService(..._))},"install ElasticSearch service")])])]),c("tr",null,[wht,c("td",null,[c("div",Rht,[B(c("input",{type:"text",id:"elastic_search_url",required:"","onUpdate:modelValue":e[372]||(e[372]=_=>r.configFile.elastic_search_url=_),onChange:e[373]||(e[373]=_=>i.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[he,r.configFile.elastic_search_url]])])])])])]),_:1})]),_:1})],2)]),c("div",Aht,[c("div",Nht,[c("button",{onClick:e[374]||(e[374]=ae(_=>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"},[B(c("div",null,Iht,512),[[Ot,i.bzc_collapsed]]),B(c("div",null,Dht,512),[[Ot,!i.bzc_collapsed]]),kht,r.configFile.binding_name?G("",!0):(x(),R("div",Lht,[Pht,Xe(" No binding selected! ")])),r.configFile.binding_name?(x(),R("div",Uht,"|")):G("",!0),r.configFile.binding_name?(x(),R("div",Fht,[c("div",Bht,[c("img",{src:r.imgBinding,class:"w-8 h-8 rounded-full object-fill
2024-07-18 22:38:03 +00:00
`).map(d=>d.trim()===""?d:i?d.startsWith(" ")?d.substring(4):d:" "+d),a=e.value.substring(0,t),l=e.value.substring(s),u=a+o.join(`
2024-07-19 00:17:02 +00:00
`)+l;this.message.content=u,this.$nextTick(()=>{e.selectionStart=t,e.selectionEnd=s+o.length*4})}n.preventDefault()},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){this.isSynthesizingVoice?(this.isSynthesizingVoice=!1,this.$refs.audio_player.pause()):(this.isSynthesizingVoice=!0,de.post("./text2wav",{text:this.message.content}).then(n=>{this.isSynthesizingVoice=!1;let e=n.data.url;console.log(e),this.audio_url=e,this.message.metadata||(this.message.metadata=[]);let t=!1;for(let s of this.message.metadata)Object.prototype.hasOwnProperty.call(s,"audio_url")&&(s.audio_url=this.audio_url,t=!0);t||this.message.metadata.push({audio_url:this.audio_url}),this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url)}).catch(n=>{this.$store.state.toast.showToast(`Error: ${n}`,4,!1),this.isSynthesizingVoice=!1}))},async speak(){if(this.$store.state.config.active_tts_service!="browser"&&this.$store.state.config.active_tts_service!="None")this.isSpeaking?(this.isSpeaking=!0,de.post("./stop",{text:this.message.content}).then(n=>{this.isSpeaking=!1}).catch(n=>{this.$store.state.toast.showToast(`Error: ${n}`,4,!1),this.isSpeaking=!1})):(this.isSpeaking=!0,de.post("./text2Audio",{client_id:this.$store.state.client_id,text:this.message.content}).then(n=>{this.isSpeaking=!1}).catch(n=>{this.$store.state.toast.showToast(`Error: ${n}`,4,!1),this.isSpeaking=!1}));else{if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let n=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.message.content,this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(i=>i.name===this.$store.state.config.audio_out_voice)[0]);const t=i=>{let r=this.message.content.substring(i,i+e);const o=[".","!","?",`
2024-07-18 22:38:03 +00:00
`];let a=-1;return o.forEach(l=>{const u=r.lastIndexOf(l);u>a&&(a=u)}),a==-1&&(a=r.length),console.log(a),a+i+1},s=()=>{if(this.status_message=="Done"||this.message.content.includes(".")||this.message.content.includes("?")||this.message.content.includes("!")){const i=t(n),r=this.message.content.substring(n,i);this.msg.text=r,n=i+1,this.msg.onend=o=>{n<this.message.content.length-2?setTimeout(()=>{s()},1):(this.isSpeaking=!1,console.log("voice off :",this.message.content.length," ",i))},this.speechSynthesis.speak(this.msg)}else setTimeout(()=>{s()},1)};console.log("Speaking chunk"),s()}},toggleModel(){this.expanded=!this.expanded},addBlock(n){let e=this.$refs.mdTextarea.selectionStart,t=this.$refs.mdTextarea.selectionEnd;e==t?speechSynthesis==0||this.message.content[e-1]==`
`?(this.message.content=this.message.content.slice(0,e)+"```"+n+"\n\n```\n"+this.message.content.slice(e),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+"\n```"+n+"\n\n```\n"+this.message.content.slice(e),e=e+3+n.length):speechSynthesis==0||this.message.content[e-1]==`
`?(this.message.content=this.message.content.slice(0,e)+"```"+n+`
`+this.message.content.slice(e,t)+"\n```\n"+this.message.content.slice(t),e=e+4+n.length):(this.message.content=this.message.content.slice(0,e)+"\n```"+n+`
2024-07-29 22:02:24 +00:00
`+this.message.content.slice(e,t)+"\n```\n"+this.message.content.slice(t),p=p+3+n.length),this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=p},copyContentToClipboard(){this.$emit("copy",this)},deleteMsg(){this.$emit("delete",this.message.id),this.deleteMsgMode=!1},rankUp(){this.$emit("rankUp",this.message.id)},rankDown(){this.$emit("rankDown",this.message.id)},updateMessage(){this.$emit("updateMessage",this.message.id,this.message.content,this.audio_url),this.editMsgMode=!1},resendMessage(n){this.$emit("resendMessage",this.message.id,this.message.content,n)},continueMessage(){this.$emit("continueMessage",this.message.id,this.message.content)},getImgUrl(){return this.avatar?CEt+this.avatar:(console.log("No avatar found"),hs)},defaultImg(n){n.target.src=hs},parseDate(n){let e=new Date(Date.parse(n)),s=Math.floor((new Date-e)/1e3);return s<=1?"just now":s<20?s+" seconds ago":s<40?"half a minute ago":s<60?"less than a minute ago":s<=90?"one minute ago":s<=3540?Math.round(s/60)+" minutes ago":s<=5400?"1 hour ago":s<=86400?Math.round(s/3600)+" hours ago":s<=129600?"1 day ago":s<604800?Math.round(s/86400)+" days ago":s<=777600?"1 week ago":n},prettyDate(n){let e=new Date((n||"").replace(/-/g,"/").replace(/[TZ]/g," ")),t=(new Date().getTime()-e.getTime())/1e3,s=Math.floor(t/86400);if(!(isNaN(s)||s<0||s>=31))return s==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")||s==1&&"Yesterday"||s<7&&s+" days ago"||s<31&&Math.ceil(s/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"),this.ui_componentKey++},showConfirmation(){Ue(()=>{Ge.replace()})},deleteMsgMode(){Ue(()=>{Ge.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,Ue(()=>{Ge.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[s,i,r]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(s)+"h:"+o(i)+"m:"+o(r)+"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 s,i,r;[s,i,r]=this.computeTimeDiff(n,e);function o(l){return l<10&&(l="0"+l),l}return o(s)+"h:"+o(i)+"m:"+o(r)+"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 r=Math.floor(i/1e3),o=t/r;return Math.round(o)+" t/s"}}},REt={class:"relative 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 even:bg-bg-light-discussion-odd dark:even:bg-bg-dark-discussion-odd flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2"},AEt={class:"flex flex-row gap-2"},NEt={class:"flex-shrink-0"},OEt={class:"group/avatar"},IEt=["src","data-popover-target"],MEt={class:"
`,544)),[[he,t.message.content]]):G("",!0)]),t.message.metadata!==null?(x(),R("div",ZEt,[(x(!0),R(Ve,null,Je(((h=t.message.metadata)==null?void 0:h.filter(f=>f!=null&&f.hasOwnProperty("title")&&f.hasOwnProperty("content")))||[],(f,_)=>(x(),R("div",{key:"json-"+t.message.id+"-"+_,class:"json font-bold"},[_e(u,{jsonFormText:f.title,jsonData:f.content},null,8,["jsonFormText","jsonData"])]))),128))])):G("",!0),t.message.ui!==null?(x(),R("div",JEt,[_e(d,{ref:"ui",class:"w-full",ui:t.message.ui},null,8,["ui"])])):G("",!0),i.audio_url!=null?(x(),R("audio",{controls:"",key:i.audio_url},[c("source",{src:i.audio_url,type:"audio/wav",ref:"audio_player"},null,8,eyt),Xe(" Your browser does not support the audio element. ")])):G("",!0)]),c("div",tyt,[c("div",nyt,[r.editMsgMode?(x(),R("div",syt,[c("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2",title:"Cancel edit",type:"button",onClick:e[3]||(e[3]=ae(f=>r.editMsgMode=!1,["stop"]))},ryt),c("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Update message",type:"button",onClick:e[4]||(e[4]=ae((...f)=>r.updateMessage&&r.updateMessage(...f),["stop"]))},ayt)])):G("",!0),r.editMsgMode?G("",!0):(x(),R("div",{key:1,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Edit message",onClick:e[5]||(e[5]=ae(f=>r.editMsgMode=!0,["stop"]))},cyt)),r.editMsgMode?(x(),R("div",{key:2,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add generic block",onClick:e[6]||(e[6]=ae(f=>r.addBlock(""),["stop"]))},[c("img",{src:i.code_block,width:"25",height:"25"},null,8,dyt)])):G("",!0),r.editMsgMode?(x(),R("div",{key:3,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer hover:border-2",title:"Add python block",onClick:e[7]||(e[7]=ae(f=>r.addBlock("python"),["stop"]))},[c("img",{src:i.python_block,width:"25",height:"25"},null,8,uyt)])):G("",!0),r.editMsgMode?(x(),R("div",{key:4,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add javascript block",onClick:e[8]||(e[8]=ae(f=>r.addBlock("javascript"),["stop"]))},[c("img",{src:i.javascript_block,width:"25",height:"25"},null,8,pyt)])):G("",!0),r.editMsgMode?(x(),R("div",{key:5,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add json block",onClick:e[9]||(e[9]=ae(f=>r.addBlock("json"),["stop"]))},[c("img",{src:i.json_block,width:"25",height:"25"},null,8,_yt)])):G("",!0),r.editMsgMode?(x(),R("div",{key:6,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add c++ block",onClick:e[10]||(e[10]=ae(f=>r.addBlock("c++"),["stop"]))},[c("img",{src:i.cpp_block,width:"25",height:"25"},null,8,hyt)])):G("",!0),r.editMsgMode?(x(),R("div",{key:7,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add html block",onClick:e[11]||(e[11]=ae(f=>r.addBlock("html"),["stop"]))},[c("img",{src:i.html5_block,width:"25",height:"25"},null,8,fyt)])):G("",!0),r.editMsgMode?(x(),R("div",{key:8,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add LaTex block",onClick:e[12]||(e[12]=ae(f=>r.addBlock("latex"),["stop"]))},[c("img",{src:i.LaTeX_block,width:"25",height:"25"},null,8,myt)])):G("",!0),r.editMsgMode?(x(),R("div",{key:9,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Add bash block",onClick:e[13]||(e[13]=ae(f=>r.addBlock("bash"),["stop"]))},[c("img",{src:i.bash_block,width:"25",height:"25"},null,8,gyt)])):G("",!0),c("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",title:"Copy message to clipboard",onClick:e[14]||(e[14]=ae(f=>r.copyContentToClipboard(),["stop"]))},Eyt),!r.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(x(),R("div",{key:10,class:Fe(["text-lg text-red-500 hover:text-secondary duration-75 active:scale-90 p-2 cursor-pointer",{"text-5xl":r.editMsgMode}]),title:"Resend
2024-07-18 22:38:03 +00:00
`+s,4,!1)})}catch(s){this.$refs.toast.showToast(`Did not get Personality settings responses.
2024-07-29 22:02:24 +00:00
Endpoint error: `+s.message,4,!1)}}):this.$refs.toast.showToast("Personality has no settings",4,!1))})}catch(e){this.$refs.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},toggleShowPersList(){this.onShowPersList()},async constructor(){for(Ue(()=>{Ge.replace()});this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100));this.onReady()},async api_get_req(n){try{const e=await de.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=Gu}}},uvt={class:"w-fit flex select-none"},pvt={class:"w-fit flex select-none"},_vt={class:"w-8 h-8 group relative"},hvt=["src","title"],fvt={class:"opacity-0 group-hover:opacity-100"},mvt=c("span",{title:"Remount"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",class:"top-0 left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 30 30",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[c("g",{id:"surface1"},[c("path",{style:{},d:"M 16 4 C 10.886719 4 6.617188 7.160156 4.875 11.625 L 6.71875 12.375 C 8.175781 8.640625 11.710938 6 16 6 C 19.242188 6 22.132813 7.589844 23.9375 10 L 20 10 L 20 12 L 27 12 L 27 5 L 25 5 L 25 8.09375 C 22.808594 5.582031 19.570313 4 16 4 Z M 25.28125 19.625 C 23.824219 23.359375 20.289063 26 16 26 C 12.722656 26 9.84375 24.386719 8.03125 22 L 12 22 L 12 20 L 5 20 L 5 27 L 7 27 L 7 23.90625 C 9.1875 26.386719 12.394531 28 16 28 C 21.113281 28 25.382813 24.839844 27.125 20.375 Z "})])])],-1),gvt=[mvt],bvt=c("span",{title:"Talk"},[c("svg",{xmlns:"http://www.w3.org/2000/svg",class:"left-1 relative w-4 h-4 text-red-600 hover:text-red-500",viewBox:"0 0 24 24",width:"2",height:"2",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"},[c("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),c("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})])],-1),Evt=[bvt];function yvt(n,e,t,s,i,r){const o=ut("UniversalForm");return x(),R(Ve,null,[c("div",uvt,[c("div",pvt,[c("div",_vt,[c("img",{src:i.bUrl+r.mountedPers.avatar,onError:e[0]||(e[0]=(...a)=>r.personalityImgPlacehodler&&r.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 hover:scale-150 active:scale-90 hover:z-50 hover:-translate-y-2 duration-150 border-secondary cursor-pointer",title:"Active personality: "+r.mountedPers.name,onClick:e[1]||(e[1]=a=>r.onSettingsPersonality(r.mountedPers))},null,40,hvt),c("div",fvt,[n.personalityHoveredIndex===n.index?(x(),R("button",{key:0,class:"z-50 -top-1 group-hover:translate-x-5 border-gray-500 absolute active:scale-90 w-7 h-7 hover:scale-150 transition bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[2]||(e[2]=ae(a=>r.remount_personality(),["prevent"]))},gvt)):G("",!0),n.personalityHoveredIndex===n.index?(x(),R("button",{key:1,class:"-top-1 group-hover:-translate-x-12 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-200 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[3]||(e[3]=ae(a=>r.handleOnTalk(),["prevent"]))},Evt)):G("",!0),c("div",{class:"top-0 group-hover:-translate-x-8 group-hover:-translate-y-8 left-0 border-gray-500 active:scale-90 absolute items-center w-7 h-7 hover:scale-150 transition text-red-500 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2",onClick:e[4]||(e[4]=ae((...a)=>r.toggleShowPersList&&r.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+ee(r.mountedPersArr.length-1),1)])])])]),_e(o,{ref:"universalForm",class:"z-50"},null,512)],64)}const vvt=ct(dvt,[["render",yvt]]);const Svt="/";de.defaults.baseURL="/";const Tvt={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:CN,Toast:Wl,UniversalForm:Xl},name:"MountedPersonalitiesList",data(){return{posts_headers:{accept:"application/json","Content-Type":"application/
2024-07-18 22:38:03 +00:00
`+e.message,4,!1),{status:!1}))},editPersonality(n){n=n.personality,de.post("/get_personality_config",{client_id:this.$store.state.client_id,category:n.category,name:n.folder}).then(e=>{const t=e.data;console.log("Done"),t.status?(this.$store.state.currentPersonConfig=t.config,this.$store.state.showPersonalityEditor=!0,this.$store.state.personality_editor.showPanel(),this.$store.state.selectedPersonality=n):console.error(t.error)}).catch(e=>{console.error(e)})},onPersonalityMounted(n){this.mountPersonality(n)},onPersonalityUnMounted(n){this.unmountPersonality(n)},onPersonalityRemount(n){this.reMountPersonality(n)},async handleOpenFolder(n){const e={client_id:this.$store.state.client_id,personality_folder:n.personality.folder};console.log(e),await de.post("/open_personality_folder",e)},async handleOnTalk(n){if(Ge.replace(),console.log("ppa",n),n){if(n.isMounted){const e=await this.select_personality(n);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality:
`+n.name,4,!0))}else this.onPersonalityMounted(n);this.onTalk(n)}},async onPersonalitySelected(n){if(Ge.replace(),console.log("Selected personality : ",JSON.stringify(n.personality)),n){if(n.selected){this.$refs.toast.showToast("Personality already selected",4,!0);return}if(n.isMounted){const e=await this.select_personality(n);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality:
`+n.name,4,!0))}else this.onPersonalityMounted(n)}},onSettingsPersonality(n){try{de.get("/get_active_personality_settings").then(e=>{e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Personality settings - "+n.personality.name,"Save changes","Cancel").then(t=>{try{de.post("/set_active_personality_settings",t).then(s=>{s&&s.data?(console.log("personality set with new settings",s.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses.
`+s,4,!1)})}catch(s){this.$refs.toast.showToast(`Did not get Personality settings responses.
Endpoint error: `+s.message,4,!1)}}):this.$refs.toast.showToast("Personality has no settings",4,!1))})}catch(e){this.$refs.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},async mount_personality(n){if(!n)return{status:!1,error:"no personality - mount_personality"};try{const e={category:n.category,folder:n.folder,language:n.language},t=await de.post("/mount_personality",e);if(t)return t.data}catch(e){console.log(e.message,"mount_personality - settings");return}},async remount_personality(n){if(console.log("Remounting personality ",n),!n)return{status:!1,error:"no personality - mount_personality"};try{console.log("before");const e={client_id:this.$store.state.client_id,category:n.category,folder:n.folder,language:n.language};console.log("after");const t=await de.post("/remount_personality",e);if(console.log("Remounting personality executed:",t),t)return console.log("Remounting personality res"),t.data;console.log("failed remount_personality")}catch(e){console.log(e.message,"remount_personality - settings");return}},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={client_id:this.$store.state.client_id,language:n.language,category:n.category,folder:n.folder};try{const t=await de.post("/unmount_personality",e,{headers:this.posts_headers});if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},async select_personality(n){if(!n||!n.personality)return{status:!1,error:"no personality - select_personality"};let e=-1;if(console.log("Personality full path : ",n.full_path),console.log("Personality language : ",n.personality.language),n.personality.language!=null&&n.personality.language!=null?(console.log("Mounting a localized version of personality"),console.log("Mounted personalities :",JSON.stringify(this.configFile.personalities)),console.log("Personality to select: ",n.full_path+":"+n.personality.language),e=this.configFile.personalities.findIndex(t=>t===n.full_path+":"+n.personality.language)):(console.log("Mounted personalities :",JSON.stringify(this.configFile.personalities)),e=this.configFile.personalities.findIndex(t=>t===n.full_path)),e>-1){console.log("Selecting personality with id:",JSON.stringify(e));const t={client_id:this.$store.state.client_id,id:e};try{const s=await de.post("/select_personality",t);if(s)return this.$store.dispatch("refreshConfig").then(()=>{console.log("recovered config",this.configFile.active_personality_id),this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),s.data}catch(s){console.log(s,"select_personality - settings");return}}else return console.log("Personality id is wrong"),this.$refs.toast.showToast("Personality id is wrong!",4,!1),{status:!1,error:"Personality id is wrong"}},async mountPersonality(n){if(console.log("mount pers",n),!n)return;if(this.configFile.personalities.includes(n.personality.full_path)){this.$refs.toast.showToast("Personality already mounted",4,!1);return}const e=await this.mount_personality(n.personality);console.log("mount_personality res",e),e.status?(this.configFile.personalities=e.personalities,this.$refs.toast.showToast("Personality mounted",4,!0),n.isMounted=!0,this.onMounted(this),(await this.select_personality(n.personality)).status&&this.$refs.toast.showToast(`Selected personality:
`+n.personality.name,4,!0),this.getMountedPersonalities()):(n.isMounted=!1,this.$refs.toast.showToast(`Could not mount personality
Error: `+e.error,4,!1))},async reMountPersonality(n){if(console.log("remount pers",n),!n)return;if(!this.configFile.personalities.includes(n.personality.full_path)){this.$refs.toast.showToast("Personality not mounted",4,!1);return}const e=await this.remount_personality(n.personality);console.log("remount_personality res",e),e.status?(this.configFile.personalities=e.personalities,this.$refs.toast.showToast("Personality remounted",4,!0),n.isMounted=!0,this.onMounted(this),(await this.select_personality(n.personality)).status&&this.$refs.toast.showToast(`Selected personality:
`+n.personality.name,4,!0),this.getMountedPersonalities()):(n.isMounted=!1,this.$refs.toast.showToast(`Could not mount personality
Error: `+e.error,4,!1))},async unmountPersonality(n){if(!n)return;console.log(`Unmounting ${JSON.stringify(n.personality)}`);const e=await this.unmount_personality(n.personality);if(e.status){console.log("unmount response",e),this.configFile.active_personality_id=e.active_personality_id,this.configFile.personalities=e.personalities;const t=this.configFile.personalities[this.configFile.active_personality_id],s=this.personalities.findIndex(a=>a.full_path==t),i=this.$refs.personalitiesZoo.findIndex(a=>a.full_path==n.full_path),r=this.personalities[s];r.isMounted=!1,r.selected=!0,this.$refs.personalitiesZoo[i].isMounted=!1,this.getMountedPersonalities(),(await this.select_personality(r)).status&&Ge.replace(),this.$refs.toast.showToast("Personality unmounted",4,!0),this.onUnMounted(this)}else this.$refs.toast.showToast(`Could not unmount personality
2024-07-29 22:02:24 +00:00
Error: `+e.error,4,!1)},getMountedPersonalities(){this.isLoading=!0;let n=[];console.log(this.configFile.personalities.length);for(let e=0;e<this.configFile.personalities.length;e++){const t=this.configFile.personalities[e],s=this.personalities.findIndex(r=>r.full_path==t),i=this.personalities[s];if(i)console.log("adding from config"),n.push(i);else{console.log("adding default");const r=this.personalities.findIndex(a=>a.full_path=="english/generic/lollms"),o=this.personalities[r];n.push(o)}}if(this.mountedPersArr=[],this.mountedPersArr=n,console.log("discussionPersonalities",this.discussionPersonalities),this.discussionPersonalities!=null&&this.discussionPersonalities.length>0)for(let e=0;e<this.discussionPersonalities.length;e++){const t=this.discussionPersonalities[e];console.log("discussionPersonalities - per",t);const s=this.mountedPersArr.findIndex(i=>i.full_path==t);if(console.log("discussionPersonalities -includes",s),console.log("discussionPersonalities -mounted list",this.mountedPersArr),s==-1){const i=this.personalities.findIndex(o=>o.full_path==t),r=this.personalities[i];console.log("adding discucc121",r,t),r&&(this.mountedPersArr.push(r),console.log("adding discucc",r))}}this.isLoading=!1,console.log("getMountedPersonalities",this.mountedPersArr),console.log("fig",this.configFile)}}},nE=n=>(_r("data-v-de7bc8fe"),n=n(),hr(),n),xvt={class:"text-left overflow-visible text-base font-semibold cursor-pointer select-none items-center flex flex-col flex-grow w-full overflow-x-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Cvt={key:0,role:"status",class:"flex justify-center overflow-y-hidden"},wvt=nE(()=>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"})],-1)),Rvt=nE(()=>c("span",{class:"sr-only"},"Loading...",-1)),Avt=[wvt,Rvt],Nvt=nE(()=>c("i",{"data-feather":"chevron-down"},null,-1)),Ovt=[Nvt],Ivt={class:"block my-2 text-sm font-medium text-gray-900 dark:text-white"},Mvt={class:"overflow-y-auto no-scrollbar pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 max-h-96"};function Dvt(n,e,t,s,i,r){const o=ut("personality-entry"),a=ut("Toast"),l=ut("UniversalForm");return x(),R("div",xvt,[i.isLoading?(x(),R("div",Cvt,Avt)):G("",!0),c("div",null,[r.mountedPersArr.length>0?(x(),R("div",{key:0,class:Fe(i.isLoading?"pointer-events-none opacity-30 cursor-default":"")},[c("button",{class:"mt-0 w-full text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Close personality list",type:"button",onClick:e[0]||(e[0]=ae((...u)=>r.toggleShowPersList&&r.toggleShowPersList(...u),["stop"]))},Ovt),c("label",Ivt," Mounted Personalities: ("+ee(r.mountedPersArr.length)+") ",1),c("div",Mvt,[_e(Xs,{name:"bounce"},{default:qe(()=>[(x(!0),R(Ve,null,Je(this.$store.state.mountedPersArr,(u,
`+s.error,4,!1),this.loading=!1,He.off("file_received")}),He.emit("send_file",t)},e.readAsDataURL(this.selectedFile)},async constructor(){Ue(()=>{Ge.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)}},Pvt=n=>(_r("data-v-1a32c141"),n=n(),hr(),n),Uvt={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"},Fvt=Pvt(()=>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)),Bvt=[Fvt];function Gvt(n,e,t,s,i,r){const o=ut("InteractiveMenu");return i.loading?(x(),R("div",Uvt,Bvt)):(x(),St(o,{key:1,commands:t.commandsList,execute_cmd:r.execute_cmd},null,8,["commands","execute_cmd"]))}const Vvt=ct(Lvt,[["render",Gvt],["__scopeId","data-v-1a32c141"]]),zvt="/assets/loader_v0-16906488.svg";console.log("modelImgPlaceholder:",ws);const Hvt="/",qvt={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:{default:!1},onShowToastMessage:Function},components:{UniversalForm:Xl,MountedPersonalities:vvt,MountedPersonalitiesList:kvt,PersonalitiesCommands:Vvt},setup(){},data(){return{is_rt:!1,bindingHoveredIndex:null,modelHoveredIndex:null,personalityHoveredIndex:null,loader_v0:zvt,sendGlobe:NN,modelImgPlaceholder:ws,bUrl:Hvt,message:"",selecting_binding:!1,selecting_model:!1,selectedModel:"",isListeningToVoice:!1,filesList:[],isFileSentList:[],totalSize:0,showfilesList:!0,showPersonalities:!1,personalities_ready:!1,models_menu_icon:"",posts_headers:{accept:"application/json","Content-Type":"application/json"}}},computed:{isDataSourceNamesValid(){return console.log("dataSourceNames:",this.dataSourceNames),console.log("Type of dataSourceNames:",typeof this.dataSourceNames),Array.isArray(this.dataSourceNames)&&this.dataSourceNames.length>0},dataSourceNames(){console.log("dataSourceNames",this.$store.state.config.rag_databases);const n=this.$store.state.config.rag_databases.map(e=>{console.log("entry",e);const t=e.split("::");console.log("extracted",t[0]);const i=e.endsWith("mounted")?"feather:check":"";return console.log("icon decision",i),{name:t[0],value:t[0]||"default_value",icon:i,help:"mounts the database"}});return console.log("formatted data sources",n),n},currentBindingIcon(){return this.currentBinding.icon||this.modelImgPlaceholder},currentBinding(){return this.$store.state.currentBinding||{}},currentModel(){return this.$store.state.curre
2024-07-18 22:38:03 +00:00
`+t,4,!1),this.isLoading=!1)})}catch(t){this.$store.state.toast.showToast(`Did not get binding settings responses.
Endpoint error: `+t.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(n){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+n.message,4,!1)}},async remount_personality(n){if(console.log("Remounting personality ",n),!n)return{status:!1,error:"no personality - mount_personality"};try{console.log("before");const e={client_id:this.$store.state.client_id,category:n.category,folder:n.folder,language:n.language};console.log("after");const t=await de.post("/remount_personality",e);if(console.log("Remounting personality executed:",t),t)return console.log("Remounting personality res"),this.$store.state.toast.showToast("Personality remounted",4,!0),t.data;console.log("failed remount_personality")}catch(e){console.log(e.message,"remount_personality - settings");return}},async unmountPersonality(n){if(console.log("Unmounting personality:",n),!n)return;const e=await this.unmount_personality(n.personality||n);if(console.log(e),e.status){this.$store.state.config.personalities=e.personalities,this.$store.state.toast.showToast("Personality unmounted",4,!0),this.$store.dispatch("refreshMountedPersonalities");const t=this.$store.state.mountedPersArr[this.$store.state.mountedPersArr.length-1];console.log(t,this.$store.state.mountedPersArr.length),(await this.select_personality(n.personality)).status&&this.$store.state.toast.showToast(`Selected personality:
`+t.name,4,!0)}else this.$store.state.toast.showToast(`Could not unmount personality
Error: `+e.error,4,!1)},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={client_id:this.$store.state.client_id,language:n.language,category:n.category,folder:n.folder};try{const t=await de.post("/unmount_personality",e);if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},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(n){if(n.selected){this.$store.state.toast.showToast("Personality already selected",4,!0);return}const e=n.language===null?n.full_path:n.full_path+":"+n.language;if(console.log("pers_path",e),console.log("this.$store.state.config.personalities",this.$store.state.config.personalities),this.$store.state.config.personalities.includes(e)){const t=await this.select_personality(n);await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshBindings"),await this.$store.dispatch("refreshModelsZoo"),await this.$store.dispatch("refreshModels"),await this.$store.dispatch("refreshMountedPersonalities"),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("fetchLanguages"),await this.$store.dispatch("fetchLanguage"),await this.$store.dispatch("fetchisRTOn"),console.log("pers is mounted",t),t&&t.status&&t.active_personality_id>-1?this.$store.state.toast.showToast(`Selected personality:
`+n.name,4,!0):this.$store.state.toast.showToast(`Error on select personality:
2024-07-29 22:02:24 +00:00
`+n.name,4,!1)}else console.log("mounting pers");this.$emit("personalitySelected"),Ue(()=>{Ge.replace()})}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};const e=n.language===null?n.full_path:n.full_path+":"+n.language;console.log("Selecting personality ",e);const t=this.$store.state.config.personalities.findIndex(i=>i===e),s={client_id:this.$store.state.client_id,id:t};try{const i=await de.post("/select_personality",s);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}},emitloaded(){this.$emit("loaded")},showModels(n){n.preventDefault();const e=this.$refs.modelsSelectionList;console.log(e);const t=new MouseEvent("click");e.dispatchEvent(t)},setBinding(n){console.log("Setting binding to "+n.name),this.selecting_binding=!0,this.selectedBinding=n,this.$store.state.messageBox.showBlockingMessage("Loading binding"),de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"binding_name",setting_value:n.name}).then(async e=>{this.$store.state.messageBox.hideMessage(),console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshBindings"),await this.$store.dispatch("refreshModelsZoo"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Binding changed to ${this.currentBinding.name}`,4,!0),this.selecting_binding=!1}).catch(e=>{this.$store.state.messageBox.hideMessage(),this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_binding=!1})},setModel(n){console.log("Setting model to "+n.name),this.selecting_model=!0,this.selectedModel=n,this.$store.state.messageBox.showBlockingMessage("Loading model"),de.post("/update_setting",{client_id:this.$store.state.client_id,setting_name:"model_name",setting_value:n.name}).then(async e=>{this.$store.state.messageBox.hideMessage(),console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Model changed to ${this.currentModel.name}`,4,!0),this.selecting_model=!1}).catch(e=>{this.$store.state.messageBox.hideMessage(),this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_model=!1})},download_files(){de.get("/download_files")},remove_file(n){de.get("/remove_discussion_file",{client_id:this.$store.state.client_id,name:n}).then(e=>{console.log(e)})},clear_files(){de.post("/clear_discussion_files_list",{client_id:this.$store.state.client_id}).then(n=>{console.log(n),n.data.state?(this.$store.state.toast.showToast("File removed successfully",4,!0),this.filesList.length=0,this.isFileSentList.length=0,this.totalSize=0):this.$store.state.toast.showToast("Files couldn't be removed",4,!1)})},send_file(n,e){console.log("Send file triggered");const t=new FileReader,s=24*1024;let i=0,r=0;t.onloadend=()=>{if(t.error){console.error("Error reading file:",t.error);return}const a=t.result,l=i+a.byteLength>=n.size;He.emit("send_file_chunk",{filename:n.name,chunk:a,offset:i,isLastChunk:l,chunkIndex:r}),i+=a.byteLength,r++,l?(console.log("File sent successfully"),this.isFileSentList[this.filesList.length-1]=!0,console.log(this.isFileSentList),this.$store.state.toast.showToast("File uploaded successfully",4,!0),e()):o()};function o(){const a=n.slice(i,i+s);t.readAsArrayBuffer(a)}console.log("Uploading file"),o()},makeAnEmptyUserMessage(){this.$emit("createEmptyUserMessage",this.message),this.message=""},makeAnEmptyAIMessage(){this.$emit("createEmptyAIMessage")},startRTCom(){this.is_rt=!0,console.log("is_rt:",this.is_rt),He.emit("start_bidirectional_audio_stream"),Ue(()=>{Ge.replace()})},stopRTCom(){this.is_rt=!1,console.log("is_rt:",this.is_rt),He.emit("stop_bidirectional_audio_stream"),Ue(()=>{Ge.replace()})},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecogniti
`,544),[[he,i.message]])]),t.loading?(x(),R("button",{key:4,type:"button",class:"bg-red-500 dark:bg-red-800 hover:bg-red-600 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:hover:bg-bg-dark-tone focus:outline-none dark:focus:ring-blue-800",onClick:e[14]||(e[14]=ae((...d)=>r.stopGenerating&&r.stopGenerating(...d),["stop"]))}," Stop generating ")):G("",!0),c("div",_0t,[t.loading?G("",!0):(x(),R("button",{key:0,type:"button",onClick:e[15]||(e[15]=(...d)=>r.submit&&r.submit(...d)),title:"Send",class:"w-6 text-panel hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},f0t)),m0t]),c("div",g0t,[t.loading?G("",!0):(x(),R("button",{key:0,type:"button",onClick:e[16]||(e[16]=(...d)=>r.submitWithInternetSearch&&r.submitWithInternetSearch(...d)),title:"Send With internet",class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},[c("img",{src:i.sendGlobe,width:"50",height:"50",style:{stroke:"currentColor",fill:"currentColor"}},null,8,b0t)])),E0t]),c("div",y0t,[t.loading?G("",!0):(x(),R("button",{key:0,type:"button",onClick:e[17]||(e[17]=(...d)=>r.startSpeechRecognition&&r.startSpeechRecognition(...d)),class:Fe([{"text-red-500":i.isListeningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"])},S0t,2)),T0t]),n.$store.state.config.active_tts_service!="None"?(x(),R("div",x0t,[i.is_rt?(x(),R("button",{key:0,type:"button",onClick:e[18]||(e[18]=(...d)=>r.stopRTCom&&r.stopRTCom(...d)),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90 bg-red-500 border borderred700 rounded-md"},w0t)):(x(),R("button",{key:1,type:"button",onClick:e[19]||(e[19]=(...d)=>r.startRTCom&&r.startRTCom(...d)),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90 bg-green-500 border border-green-700 rounded-md"},A0t)),N0t])):G("",!0),t.loading?G("",!0):(x(),R("div",O0t,[c("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:e[20]||(e[20]=(...d)=>r.addFiles&&r.addFiles(...d)),multiple:""},null,544),c("button",{type:"button",onClick:e[21]||(e[21]=ae((...d)=>r.add_file&&r.add_file(...d),["prevent"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},M0t),D0t])),c("div",k0t,[t.loading?G("",!0):(x(),R("button",{key:0,type:"button",onClick:e[22]||(e[22]=ae((...d)=>r.takePicture&&r.takePicture(...d),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},P0t)),U0t]),c("div",F0t,[t.loading?G("",!0):(x(),R("button",{key:0,type:"button",onClick:e[23]||(e[23]=ae((...d)=>r.addWebLink&&r.addWebLink(...d),["stop"])),class:"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90"},G0t)),V0t]),c("div",z0t,[t.loading?G("",!0):(x(),R("button",{key:0,type:"button",onClick:e[24]||(e[24]=ae((...d)=>r.makeAnEmptyUserMessage&&r.makeAnEmptyUserMessage(...d),["stop"])),class:"w-6 text-gray-800 hover:text-secondary duration-75 active:scale-90 hover:translate-y-[-5px]"},q0t)),Y0t]),c("div",$0t,[t.loading?G("",!0):(x(),R("button",{key:0,type:"button",onClick:e[25]||(e[25]=ae((...d)=>r.makeAnEmptyAIMessage&&r.makeAnEmptyAIMessage(...d),["stop"])),class:"w-6 text-red-400 hover:text-secondary duration-75 active:scale-90 hover:translate-y-[-5px]"},K0t)),j0t])]),Q0t])])]),_e(u,{ref:"universalForm",class:"z-20"},null,512)],64)}const IN=ct(qvt,[["render",X0t],["__scopeId","data-v-64fb461b"]]),Z0t={name:"WelcomeComponent",computed:{storeLogo(){return this.$store.state.con
2024-07-18 22:38:03 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Default Render Panel</title>
<style>
body, html {
margin: 0;
padding: 0;
height: 100%;
font-family: Arial, sans-serif;
background-color: #f0f0f0;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
padding: 20px;
box-sizing: border-box;
}
.message {
text-align: center;
padding: 30px;
background-color: white;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
max-width: 600px;
width: 100%;
}
h1 {
color: #2c3e50;
margin-bottom: 20px;
font-size: 28px;
}
p {
color: #34495e;
margin: 0 0 15px;
line-height: 1.6;
}
.highlight {
color: #e74c3c;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<div class="message">
<h1>Welcome to the Interactive Render Panel</h1>
<p>This space is designed to bring your ideas to life! Currently, it's empty because no HTML has been generated yet.</p>
<p>To see something amazing here, try asking the AI to <span class="highlight">create a specific web component or application</span>. For example:</p>
<p>"Create a responsive image gallery" or "Build a simple todo list app"</p>
<p>Once you request a web component, the AI will generate the necessary HTML, CSS, and JavaScript, and it will be rendered right here in this panel!</p>
</div>
</div>
</body>
</html>
2024-07-29 22:02:24 +00:00
`,memory_icon:fxt,active_skills:mxt,inactive_skills:gxt,skillsRegistry:bxt,robot:Ext,posts_headers:{accept:"application/json","Content-Type":"application/json"},host:"",progress_visibility_val:!0,progress_value:0,msgTypes:{MSG_TYPE_CHUNK:0,MSG_TYPE_FULL:1,MSG_TYPE_FULL_INVISIBLE_TO_AI:2,MSG_TYPE_FULL_INVISIBLE_TO_USER:3,MSG_TYPE_EXCEPTION:4,MSG_TYPE_WARNING:5,MSG_TYPE_INFO:6,MSG_TYPE_STEP:7,MSG_TYPE_STEP_START:8,MSG_TYPE_STEP_PROGRESS:9,MSG_TYPE_STEP_END:10,MSG_TYPE_JSON_INFOS:11,MSG_TYPE_REF:12,MSG_TYPE_CODE:13,MSG_TYPE_UI:14,MSG_TYPE_NEW_MESSAGE:15,MSG_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,isSearch:!1,isDiscussionBottom:!1,personalityAvatars:[],fileList:[],database_selectorDialogVisible:!1,isDragOverDiscussion:!1,isDragOverChat:!1,leftPanelCollapsed:!1,rightPanelCollapsed:!0,isOpen:!1,discussion_id:0}},methods:{selectPrompt(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 s=n.indexOf(e);if(s===-1)return this.lastMessageHtml=this.defaultMessageHtml,this.renderIsolatedContent(),this.defaultMessageHtml;s+=e.length;let i=n.indexOf(t,s);i===-1?this.lastMessageHtml=n.slice(s).trim():this.lastMessageHtml=n.slice(s,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(`
2024-07-18 22:38:03 +00:00
${this.lastMessageHtml}
2024-07-27 23:19:18 +00:00
`),e.close()}},async triggerRobotAction(){this.rightPanelCollapsed=!this.rightPanelCollapsed,this.rightPanelCollapsed||(this.leftPanelCollapsed=!0,this.$nextTick(()=>{this.extractHtml()})),console.log(this.rightPanelCollapsed)},add_webpage(){console.log("addWebLink received"),this.$refs.web_url_input_box.showPanel()},addWebpage(){de.post("/add_webpage",{client_id:this.client_id,url:this.$refs.web_url_input_box.inputText},{headers:this.posts_headers}).then(n=>{n&&n.status&&(console.log("Done"),this.recoverFiles())})},show_progress(n){this.progress_visibility_val=!0},hide_progress(n){this.progress_visibility_val=!1},update_progress(n){console.log("Progress update"),this.progress_value=n.value},onSettingsBinding(){try{this.isLoading=!0,de.get("/get_active_binding_settings").then(n=>{if(this.isLoading=!1,n)if(n.data&&Object.keys(n.data).length>0){const e=this.$store.state.bindingsZoo.find(t=>t.name==this.state.config.binding_name);this.$store.state.universalForm.showForm(n.data,"Binding settings - "+e.binding.name,"Save changes","Cancel").then(t=>{try{de.post("/set_active_binding_settings",{client_id:this.$store.state.client_id,settings:t}).then(s=>{s&&s.data?(console.log("binding set with new settings",s.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses.
`+s,4,!1),this.isLoading=!1)})}catch(s){this.$store.state.toast.showToast(`Did not get binding settings responses.
Endpoint error: `+s.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_selectorDialogSelected(n){console.log("Selected:",n)},onclosedatabase_selectorDialog(){this.database_selectorDialogVisible=!1},async onvalidatedatabase_selectorChoice(n){if(this.database_selectorDialogVisible=!1,(await de.post("/select_database",{client_id:this.client_id,name:n},{headers:this.posts_headers})).status){console.log("Selected database"),this.$store.state.config=await de.post("/get_config",{client_id:this.client_id}),console.log("new config loaded :",this.$store.state.config);let t=await de.get("/list_databases").data;console.log("New list of database: ",t),this.$store.state.databases=t,console.log("New list of database: ",this.$store.state.databases),location.reload()}},async addDiscussion2SkillsLibrary(){(await de.post("/add_discussion_to_skills_library",{client_id:this.client_id},{headers:this.posts_headers})).status&&console.log("done")},async toggleSkillsLib(){this.$store.state.config.activate_skills_lib=!this.$store.state.config.activate_skills_lib,await this.applyConfiguration()},async showSkillsLib(){this.$refs.skills_lib.showSkillsLibrary()},async applyConfiguration(){this.loading=!0;const n=await de.post("/apply_settings",{client_id:this.$store.state.client_id,config:this.$store.state.config});this.loading=!1,n.data.status?this.$store.state.toast.showToast("Configuration changed successfully.",4,!0):this.$store.state.toast.showToast("Configuration change failed.",4,!1),Ue(()=>{Ge.replace()})},save_configuration(){this.showConfirmation=!1,de.post("/save_settings",{}).then(n=>{if(n)return n.status?this.$store.state.toast.showToast("Settings saved!",4,!0):this.$store.state.messageBox.showMessage("Error: Couldn't save settings!"),n.data}).catch(n=>(console.log(n.message,"save_configuration"),this.$store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},showToastMessage(n,e,t){console.log("sending",n),this.$store.state.toast.showToast(n,e,t)},togglePanel(){this.leftPanelCollapsed=!this.leftPanelCollapsed,this.leftPanelCollapsed||(this.rightPanelCollapsed=!0)},toggleDropdown(){this.isOpen=!this.isOpen},importChatGPT(){},async api_get_req(n){try{const e=await de.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req");return}},async list_discussions(){try{const n=await de.get("/list_discussions");if(n)return this.createDiscussionList(n.data),n.data}catch(n){return console.log("Error: Could not list discussions",n.message),[]}},load_discussion(n,e){n&&(console.log("Loading discussion",n),this.loading=!0,this.discussionArr=[],this.setDiscussionLoading(n,this.loading),He.on("discussion",t=>{console.log("Discussion recovered"),this.loading=!1,this.setDiscussionLoading(n,this.loading),t&&(this.discussionArr=t.filter(s=>s.message_type==this.msgTypes.MSG_TYPE_CHUNK||s.message_type==this.msgTypes.MSG_TYPE_FULL||s.message_type==this.msgTypes.MSG_TYPE_FULL_INVISIBLE_TO_AI||s.message_type==this.msgTypes.MSG_TYPE_CODE||s.message_type==this.msgTypes.MSG_TYPE_JSON_INFOS||s.message_type==this.msgTypes.MSG_TYPE_UI),console.log("this.discussionArr"),console.log(this.discussionArr),e&&e()),He.off("discussion"),this.extractHtml()}),He.emit("load_discussion",{id:n}))},recoverFiles(){console.log("Recovering files"),de.post("/get_discussion_files_list",{client_id:this.$store.state.client_id}).then(n=>{this.$refs.chatBox.filesList=n.data.files,this.$refs.chatBox.isFileSentList=n.data.files.map(e=>!0),console.log(`Files recovered: ${this.$refs.chatBox.filesList}`)})},new_discussion(n){try{this.loading=!0,He.on("discussion_created",e=>{He.off("discussion_created"),this.list_discussions().then(()=>{const t=this.list.findIndex(i=>i.id==e.id),s=this.list[t];this.selectDiscussion(s),this.load_discussion(e.id,()=>{this.loading=!1,this.recoverFi
2024-07-18 22:38:03 +00:00
Personality: ${n.message.personality}`);let i="";n.created_at_parsed&&(i=`
Created: ${n.created_at_parsed}`);let r="";n.message.model&&(r=`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} ${r} ${o} ${a}`.trim();const u=`${n.message.sender}${s}${i}
${e}
${l}`;navigator.clipboard.writeText(u)}else navigator.clipboard.writeText(e);this.$store.state.toast.showToast("Copied to clipboard successfully",4,!0),Ue(()=>{Ge.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 s=new FileReader;s.onload=i=>e(this.parseJsonObj(i.target.result)),s.onerror=i=>t(i),s.readAsText(n)})},async exportDiscussionsAsMarkdown(){const n=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(n.length>0){console.log("export",n);let e=new Date;const t=e.getFullYear(),s=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),r=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),u="discussions_export_"+(t+"."+s+"."+i+"."+r+o+a)+".md";this.loading=!0;const d=await this.export_multiple_discussions(n,"markdown");d?(this.saveMarkdowntoFile(d,u),this.$store.state.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$store.state.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async exportDiscussions(){},async exportDiscussionsAsJson(){const n=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(n.length>0){console.log("export",n);let e=new Date;const t=e.getFullYear(),s=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),r=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),u="discussions_export_"+(t+"."+s+"."+i+"."+r+o+a)+".json";this.loading=!0;const d=await this.export_multiple_discussions(n,"json");d?(this.saveJSONtoFile(d,u),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(s=>s.name===n),t=this.personalityAvatars[e];if(t)return console.log("Avatar",t.avatar),t.avatar},setFileListChat(n){try{this.$refs.chatBox.fileList=this.$refs.chatBox.fileList.concat(n)}catch(e){this.$store.state.toast.showToast(`Failed to set filelist in chatbox
2024-07-29 22:02:24 +00:00
`+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(){console.log("Created discussions view");const e=(await de.get("/get_versionID")).data.versionId;He.onopen=()=>{console.log("WebSocket connection established."),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(()=>{Ge.replace()}),console.log("Connected to socket io");try{this.$store.state.loading_infos="Getting version",this.$store.state.loading_progress=30,await this.$store.dispatch("getVersion")}catch(t){console.log("Error cought:",t)}try{for(this.$store.state.loading_infos="Loading Configuration";He.id===void 0;)await new Promise(t=>setTimeout(t,100));this.$store.state.client_id=He.id,console.log(this.$store.state.client_id),await this.$store.dispatch("refreshConfig"),console.log("Config ready")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Loading Database",this.$store.state.loading_progress=20,await this.$store.dispatch("refreshDatabase")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting Bindings list",this.$store.state.loading_progress=40,await this.$store.dispatch("refreshBindings")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting personalities zoo",this.$store.state.loading_progress=70,await this.$store.dispatch("refreshPersonalitiesZoo")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting mounted personalities",this.$store.state.loading_progress=80,await this.$store.dispatch("refreshMountedPersonalities")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting models zoo",this.$store.state.loading_progress=90,await this.$store.dispatch("refreshModelsZoo")}catch(t){console.log("Error cought:",t)}try{this.$store.state.loading_infos="Getting active models",this.$store.state.loading_progress=100,await this.$store.dispatch("refreshModels"),await this.$store.dispatch("refreshModelStatus")}catch(t){console.log("Error cought:",t)}try{await this.$store.dispatch("fetchLanguages"),await this.$store.dispatch("fetchLanguage")}catch(t){console.log("Error cought:",t)}try{await this.$store.dispatch("fetchisRTOn")}catch(t){console.log("Error cought:",t)}this.$store.state.isConnected=!0,this.$store.state.client_id=He.id,console.log("Ready"),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),console.log("Added events"),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.streamMessageContent),He.on("close_message",this.finalMsgEvent),He.on("disucssion_renamed",t=>{console.log("Received new title",t.discussion_id,t.title);const s=this.list.findIndex(r=>r.id==t.discussion_id),i=this.list[s];i.title=t.title}),He.onclose=t=>{console.log("WebSocket connection closed:",t.code,t.reason),this.socketIODisconnected()},He.on("connect_error",t=>{t.message==="ERR_CONNECTION_REFUSED"?console.error("Connection refused. The server is not available."):console.error("Conn
2024-07-18 22:38:03 +00:00
* @license
* Copyright 2010-2023 Three.js Authors
* SPDX-License-Identifier: MIT
2024-07-29 22:02:24 +00:00
*/const SE="159",y1t=0,sC=1,v1t=2,JN=1,S1t=2,bi=3,Oi=0,Yn=1,Ys=2,ar=0,Yo=1,iC=2,rC=3,oC=4,T1t=5,Pr=100,x1t=101,C1t=102,aC=103,lC=104,w1t=200,R1t=201,A1t=202,N1t=203,kg=204,Lg=205,O1t=206,I1t=207,M1t=208,D1t=209,k1t=210,L1t=211,P1t=212,U1t=213,F1t=214,B1t=0,G1t=1,V1t=2,$d=3,z1t=4,H1t=5,q1t=6,Y1t=7,TE=0,$1t=1,W1t=2,lr=0,K1t=1,j1t=2,Q1t=3,X1t=4,Z1t=5,cC="attached",J1t="detached",eO=300,aa=301,la=302,Pg=303,Ug=304,zu=306,ca=1e3,as=1001,Wd=1002,mn=1003,Fg=1004,bd=1005,zn=1006,tO=1007,Jr=1008,cr=1009,ewt=1010,twt=1011,xE=1012,nO=1013,sr=1014,vi=1015,Fl=1016,sO=1017,iO=1018,Yr=1020,nwt=1021,ls=1023,swt=1024,iwt=1025,$r=1026,da=1027,rwt=1028,rO=1029,owt=1030,oO=1031,aO=1033,hm=33776,fm=33777,mm=33778,gm=33779,dC=35840,uC=35841,pC=35842,_C=35843,lO=36196,hC=37492,fC=37496,mC=37808,gC=37809,bC=37810,EC=37811,yC=37812,vC=37813,SC=37814,TC=37815,xC=37816,CC=37817,wC=37818,RC=37819,AC=37820,NC=37821,bm=36492,OC=36494,IC=36495,awt=36283,MC=36284,DC=36285,kC=36286,Bl=2300,ua=2301,Em=2302,LC=2400,PC=2401,UC=2402,lwt=2500,cwt=0,cO=1,Bg=2,dO=3e3,Wr=3001,dwt=3200,uwt=3201,CE=0,pwt=1,cs="",en="srgb",Cn="srgb-linear",wE="display-p3",Hu="display-p3-linear",Kd="linear",Wt="srgb",jd="rec709",Qd="p3",ho=7680,FC=519,_wt=512,hwt=513,fwt=514,uO=515,mwt=516,gwt=517,bwt=518,Ewt=519,Gg=35044,BC="300 es",Vg=1035,Si=2e3,Xd=2001;class Ma{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const s=this._listeners[e.type];if(s!==void 0){e.target=this;const i=s.slice(0);for(let r=0,o=i.length;r<o;r++)i[r].call(this,e);e.target=null}}}const wn=["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 GC=1234567;const ml=Math.PI/180,pa=180/Math.PI;function Ds(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(wn[n&255]+wn[n>>8&255]+wn[n>>16&255]+wn[n>>24&255]+"-"+wn[e&255]+wn[e>>8&255]+"-"+wn[e>>16&15|64]+wn[e>>24&255]+"-"+wn[t&63|128]+wn[t>>8&255]+"-"+wn[t>>16&255]+wn[t>>24&255]+wn[s&255]+wn[s>>8&255]+wn[s>>16&255]+wn[s>>24&255]).toLowerCase()}function Nn(n,e,t){return Math.max(e,Math.min(t,n))}function RE(n,e){return(n%e+e)%e}function ywt(n,e,t,s,i){return s+(n-e)*(i-s)/(t-e)}function vwt(n,e,t){return n!==e?(t-n)/(e-n):0}function gl(n,e,t){return(1-t)*n+t*e}function Swt(n,e,t,s){return gl(n,e,1-Math.exp(-t*s))}function Twt(n,e=1){return e-Math.abs(RE(n,e*2)-e)}function xwt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Cwt(n,e,t){return
2024-07-18 22:38:03 +00:00
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
2024-07-29 22:02:24 +00:00
}`,tRt=`void main() {
2024-07-18 22:38:03 +00:00
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
2024-07-29 22:02:24 +00:00
}`;class to extends ks{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=eRt,this.fragmentShader=tRt,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=_a(e.uniforms),this.uniformsGroups=Zwt(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 s={};for(const i in this.extensions)this.extensions[i]===!0&&(s[i]=!0);return Object.keys(s).length>0&&(t.extensions=s),t}}class vO extends Jt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new xt,this.projectionMatrix=new xt,this.projectionMatrixInverse=new xt,this.coordinateSystem=Si}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 Pn extends vO{constructor(e=50,t=1,s=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=s,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=pa*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ml*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return pa*2*Math.atan(Math.tan(ml*.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,s,i,r,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=s,this.view.offsetY=i,this.view.width=r,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(ml*.5*this.fov)/this.zoom,s=2*t,i=this.aspect*s,r=-
2024-07-18 22:38:03 +00:00
varying vec3 vWorldDirection;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
2024-07-29 22:02:24 +00:00
`},i=new dr(5,5,5),r=new to({name:"CubemapFromEquirect",uniforms:_a(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,side:Yn,blending:ar});r.uniforms.tEquirect.value=t;const o=new Un(i,r),a=t.minFilter;return t.minFilter===Jr&&(t.minFilter=zn),new nRt(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,s,i){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,s,i);e.setRenderTarget(r)}}const Pm=new ie,iRt=new ie,rRt=new Tt;class Or{constructor(e=new ie(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,s,i){return this.normal.set(e,t,s),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,s){const i=Pm.subVectors(s,t).cross(iRt.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 s=e.delta(Pm),i=this.normal.dot(s);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(s,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),s=this.distanceToPoint(e.end);return t<0&&s>0||s<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 s=t||rRt.getNormalMatrix(e),i=this.coplanarPoint(Pm).applyMatrix4(e),r=this.normal.applyMatrix3(s).normalize();return this.constant=-i.dot(r),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 Rr=new ri,jc=new ie;class AE{constructor(e=new Or,t=new Or,s=new Or,i=new Or,r=new Or,o=new Or){this.planes=[e,t,s,i,r,o]}set(e,t,s,i,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(s),a[3].copy(i),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let s=0;s<6;s++)t[s].copy(e.planes[s]);return this}setFromProjectionMatrix(e,t=Si){const s=this.planes,i=e.elements,r=i[0],o=i[1],a=i[2],l=i[3],u=i[4],d=i[5],h=i[6],f=i[7],_=i[8],m=i[9],E=i[10],b=i[11],g=i[12],y=i[13],v=i[14],S=i[15];if(s[0].setComponents(l-r,f-u,b-_,S-g).normalize(),s[1].setComponents(l+r,f+u,b+_,S+g).normalize(),s[2].setComponents(l+o,f+d,b+m,S+y).normalize(),s[3].setComponents(l-o,f-d,b-m,S-y).normalize(),s[4].setComponents(l-a,f-h,b-E,S-v).normalize(),t===Si)s[5].setComponents(l+a,f+h,b+E,S+v).normalize();else if(t===Xd)s[5].setComponents(a,h,E,v).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(),Rr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Rr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Rr)}intersectsSprite(e){return Rr.center.set(0,0,0),Rr.radius=.7071067811865476,Rr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Rr)}intersectsSphere(e){const t=this.planes,s=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(s)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let s=0;s<6;s++){const i=t[s];if(jc.x=i.normal.x>0?e.max.x:e.min.x,jc.y=i.normal.y>0?e.max.y:e.min.y,jc.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(jc)<0)return!1}ret
2024-07-18 22:38:03 +00:00
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
2024-07-29 22:02:24 +00:00
#endif`,lRt=`#ifdef USE_ALPHAHASH
2024-07-18 22:38:03 +00:00
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
}
float hash3D( vec3 value ) {
return hash2D( vec2( hash2D( value.xy ), value.z ) );
}
float getAlphaHashThreshold( vec3 position ) {
float maxDeriv = max(
length( dFdx( position.xyz ) ),
length( dFdy( position.xyz ) )
);
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
vec2 pixScales = vec2(
exp2( floor( log2( pixScale ) ) ),
exp2( ceil( log2( pixScale ) ) )
);
vec2 alpha = vec2(
hash3D( floor( pixScales.x * position.xyz ) ),
hash3D( floor( pixScales.y * position.xyz ) )
);
float lerpFactor = fract( log2( pixScale ) );
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
float a = min( lerpFactor, 1.0 - lerpFactor );
vec3 cases = vec3(
x * x / ( 2.0 * a * ( 1.0 - a ) ),
( x - 0.5 * a ) / ( 1.0 - a ),
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
);
float threshold = ( x < ( 1.0 - a ) )
? ( ( x < a ) ? cases.x : cases.y )
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
2024-07-23 23:35:50 +00:00
#endif`,cRt=`#ifdef USE_ALPHAMAP
2024-07-29 22:02:24 +00:00
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,dRt=`#ifdef USE_ALPHAMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D alphaMap;
2024-07-23 23:35:50 +00:00
#endif`,uRt=`#ifdef USE_ALPHATEST
2024-07-29 22:02:24 +00:00
if ( diffuseColor.a < alphaTest ) discard;
#endif`,pRt=`#ifdef USE_ALPHATEST
2024-07-18 22:38:03 +00:00
uniform float alphaTest;
2024-07-29 22:02:24 +00:00
#endif`,_Rt=`#ifdef USE_AOMAP
2024-07-18 22:38:03 +00:00
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
clearcoatSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_SHEEN )
sheenSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
2024-07-29 22:02:24 +00:00
#endif`,hRt=`#ifdef USE_AOMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D aoMap;
uniform float aoMapIntensity;
2024-07-29 22:02:24 +00:00
#endif`,fRt=`#ifdef USE_BATCHING
2024-07-18 22:38:03 +00:00
attribute float batchId;
uniform highp sampler2D batchingTexture;
mat4 getBatchingMatrix( const in float i ) {
int size = textureSize( batchingTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
2024-07-29 22:02:24 +00:00
#endif`,mRt=`#ifdef USE_BATCHING
2024-07-18 22:38:03 +00:00
mat4 batchingMatrix = getBatchingMatrix( batchId );
2024-07-29 22:02:24 +00:00
#endif`,gRt=`vec3 transformed = vec3( position );
2024-07-18 22:38:03 +00:00
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
2024-07-29 22:02:24 +00:00
#endif`,bRt=`vec3 objectNormal = vec3( normal );
2024-07-18 22:38:03 +00:00
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
2024-07-29 22:02:24 +00:00
#endif`,ERt=`float G_BlinnPhong_Implicit( ) {
2024-07-18 22:38:03 +00:00
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
2024-07-29 22:02:24 +00:00
} // validated`,yRt=`#ifdef USE_IRIDESCENCE
2024-07-18 22:38:03 +00:00
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
-0.4985314, 0.0415560, 1.0572252
);
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
vec3 sqrtF0 = sqrt( fresnel0 );
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
}
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
}
float IorToFresnel0( float transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
}
vec3 evalSensitivity( float OPD, vec3 shift ) {
float phase = 2.0 * PI * OPD * 1.0e-9;
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
xyz /= 1.0685e-7;
vec3 rgb = XYZ_TO_REC709 * xyz;
return rgb;
}
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
vec3 I;
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
float cosTheta2Sq = 1.0 - sinTheta2Sq;
if ( cosTheta2Sq < 0.0 ) {
return vec3( 1.0 );
}
float cosTheta2 = sqrt( cosTheta2Sq );
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
float T121 = 1.0 - R12;
float phi12 = 0.0;
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
float phi21 = PI - phi12;
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
vec3 phi23 = vec3( 0.0 );
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
vec3 phi = vec3( phi21 ) + phi23;
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
vec3 r123 = sqrt( R123 );
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
vec3 C0 = R12 + Rs;
I = C0;
vec3 Cm = Rs - T121;
for ( int m = 1; m <= 2; ++ m ) {
Cm *= r123;
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
I += Cm * Sm;
}
return max( I, vec3( 0.0 ) );
}
2024-07-29 22:02:24 +00:00
#endif`,vRt=`#ifdef USE_BUMPMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vBumpMapUv );
vec2 dSTdy = dFdy( vBumpMapUv );
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 ) * faceDirection;
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
2024-07-29 22:02:24 +00:00
#endif`,SRt=`#if NUM_CLIPPING_PLANES > 0
2024-07-18 22:38:03 +00:00
vec4 plane;
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
}
#pragma unroll_loop_end
if ( clipped ) discard;
#endif
2024-07-21 19:50:34 +00:00
#endif`,TRt=`#if NUM_CLIPPING_PLANES > 0
2024-07-23 23:35:50 +00:00
varying vec3 vClipPosition;
2024-07-29 22:02:24 +00:00
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
2024-07-23 23:35:50 +00:00
#endif`,xRt=`#if NUM_CLIPPING_PLANES > 0
2024-07-29 22:02:24 +00:00
varying vec3 vClipPosition;
#endif`,CRt=`#if NUM_CLIPPING_PLANES > 0
2024-07-18 22:38:03 +00:00
vClipPosition = - mvPosition.xyz;
2024-07-29 22:02:24 +00:00
#endif`,wRt=`#if defined( USE_COLOR_ALPHA )
2024-07-18 22:38:03 +00:00
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
2024-07-29 22:02:24 +00:00
#endif`,RRt=`#if defined( USE_COLOR_ALPHA )
2024-07-18 22:38:03 +00:00
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
2024-07-29 22:02:24 +00:00
#endif`,ARt=`#if defined( USE_COLOR_ALPHA )
2024-07-18 22:38:03 +00:00
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
varying vec3 vColor;
2024-07-29 22:02:24 +00:00
#endif`,NRt=`#if defined( USE_COLOR_ALPHA )
2024-07-18 22:38:03 +00:00
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
vColor.xyz *= instanceColor.xyz;
2024-07-29 22:02:24 +00:00
#endif`,ORt=`#define PI 3.141592653589793
2024-07-18 22:38:03 +00:00
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
float precisionSafeLength( vec3 v ) { return length( v ); }
#else
float precisionSafeLength( vec3 v ) {
float maxComponent = max3( abs( v ) );
return length( v / maxComponent ) * maxComponent;
}
#endif
struct IncidentLight {
vec3 color;
vec3 direction;
bool visible;
};
struct ReflectedLight {
vec3 directDiffuse;
vec3 directSpecular;
vec3 indirectDiffuse;
vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
mat3 tmp;
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
return tmp;
}
float luminance( const in vec3 rgb ) {
const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
return dot( weights, rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
2024-07-29 22:02:24 +00:00
} // validated`,IRt=`#ifdef ENVMAP_TYPE_CUBE_UV
2024-07-18 22:38:03 +00:00
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
vec3 absDirection = abs( direction );
float face = - 1.0;
if ( absDirection.x > absDirection.z ) {
if ( absDirection.x > absDirection.y )
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if ( absDirection.z > absDirection.y )
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}
vec2 getUV( vec3 direction, float face ) {
vec2 uv;
if ( face == 0.0 ) {
uv = vec2( direction.z, direction.y ) / abs( direction.x );
} else if ( face == 1.0 ) {
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
} else if ( face == 2.0 ) {
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
} else if ( face == 3.0 ) {
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
} else if ( face == 4.0 ) {
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
} else {
uv = vec2( direction.x, direction.y ) / abs( direction.z );
}
return 0.5 * ( uv + 1.0 );
}
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
float face = getFace( direction );
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
mipInt = max( mipInt, cubeUV_minMipLevel );
float faceSize = exp2( mipInt );
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
if ( face > 2.0 ) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
uv.x *= CUBEUV_TEXEL_WIDTH;
uv.y *= CUBEUV_TEXEL_HEIGHT;
#ifdef texture2DGradEXT
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
#else
return texture2D( envMap, uv ).rgb;
#endif
}
#define cubeUV_r0 1.0
#define cubeUV_v0 0.339
#define cubeUV_m0 - 2.0
#define cubeUV_r1 0.8
#define cubeUV_v1 0.276
#define cubeUV_m1 - 1.0
#define cubeUV_r4 0.4
#define cubeUV_v4 0.046
#define cubeUV_m4 2.0
#define cubeUV_r5 0.305
#define cubeUV_v5 0.016
#define cubeUV_m5 3.0
#define cubeUV_r6 0.21
#define cubeUV_v6 0.0038
#define cubeUV_m6 4.0
float roughnessToMip( float roughness ) {
float mip = 0.0;
if ( roughness >= cubeUV_r1 ) {
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
} else if ( roughness >= cubeUV_r4 ) {
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
} else if ( roughness >= cubeUV_r5 ) {
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
} else if ( roughness >= cubeUV_r6 ) {
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
} else {
mip = - 2.0 * log2( 1.16 * roughness ); }
return mip;
}
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
float mipF = fract( mip );
float mipInt = floor( mip );
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
if ( mipF == 0.0 ) {
return vec4( color0, 1.0 );
} else {
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
2024-07-29 22:02:24 +00:00
#endif`,MRt=`vec3 transformedNormal = objectNormal;
2024-07-18 22:38:03 +00:00
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
mat3 bm = mat3( batchingMatrix );
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
transformedNormal = bm * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = bm * transformedTangent;
#endif
#endif
#ifdef USE_INSTANCING
mat3 im = mat3( instanceMatrix );
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
transformedNormal = im * transformedNormal;
#ifdef USE_TANGENT
transformedTangent = im * transformedTangent;
#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
2024-07-29 22:02:24 +00:00
#endif`,DRt=`#ifdef USE_DISPLACEMENTMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
2024-07-29 22:02:24 +00:00
#endif`,kRt=`#ifdef USE_DISPLACEMENTMAP
2024-07-18 22:38:03 +00:00
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
2024-07-29 22:02:24 +00:00
#endif`,LRt=`#ifdef USE_EMISSIVEMAP
2024-07-18 22:38:03 +00:00
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
totalEmissiveRadiance *= emissiveColor.rgb;
2024-07-29 22:02:24 +00:00
#endif`,PRt=`#ifdef USE_EMISSIVEMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D emissiveMap;
2024-07-29 22:02:24 +00:00
#endif`,URt="gl_FragColor = linearToOutputTexel( gl_FragColor );",FRt=`
2024-07-18 22:38:03 +00:00
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
vec3( 0.8224621, 0.177538, 0.0 ),
vec3( 0.0331941, 0.9668058, 0.0 ),
vec3( 0.0170827, 0.0723974, 0.9105199 )
);
const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
vec3( 1.2249401, - 0.2249404, 0.0 ),
vec3( - 0.0420569, 1.0420571, 0.0 ),
vec3( - 0.0196376, - 0.0786361, 1.0982735 )
);
vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
}
vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
}
vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferOETF( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}
vec4 LinearToLinear( in vec4 value ) {
return value;
}
vec4 LinearTosRGB( in vec4 value ) {
return sRGBTransferOETF( value );
2024-07-29 22:02:24 +00:00
}`,BRt=`#ifdef USE_ENVMAP
2024-07-18 22:38:03 +00:00
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
#else
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
#endif
#else
vec3 reflectVec = vReflect;
#endif
#ifdef ENVMAP_TYPE_CUBE
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
#else
vec4 envColor = vec4( 0.0 );
#endif
#ifdef ENVMAP_BLENDING_MULTIPLY
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_MIX )
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
2024-07-29 22:02:24 +00:00
#endif`,GRt=`#ifdef USE_ENVMAP
2024-07-18 22:38:03 +00:00
uniform float envMapIntensity;
uniform float flipEnvMap;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
2024-07-29 22:02:24 +00:00
#endif`,VRt=`#ifdef USE_ENVMAP
2024-07-18 22:38:03 +00:00
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
uniform float refractionRatio;
#else
varying vec3 vReflect;
#endif
2024-07-29 22:02:24 +00:00
#endif`,zRt=`#ifdef USE_ENVMAP
2024-07-18 22:38:03 +00:00
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
#else
varying vec3 vReflect;
uniform float refractionRatio;
#endif
2024-07-29 22:02:24 +00:00
#endif`,HRt=`#ifdef USE_ENVMAP
2024-07-18 22:38:03 +00:00
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
vec3 cameraToVertex;
if ( isOrthographic ) {
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
2024-07-21 19:50:34 +00:00
#endif`,qRt=`#ifdef USE_FOG
2024-07-29 22:02:24 +00:00
vFogDepth = - mvPosition.z;
2024-07-23 23:35:50 +00:00
#endif`,YRt=`#ifdef USE_FOG
2024-07-29 22:02:24 +00:00
varying float vFogDepth;
#endif`,$Rt=`#ifdef USE_FOG
2024-07-18 22:38:03 +00:00
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
2024-07-29 22:02:24 +00:00
#endif`,WRt=`#ifdef USE_FOG
2024-07-18 22:38:03 +00:00
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
2024-07-29 22:02:24 +00:00
#endif`,KRt=`#ifdef USE_GRADIENTMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return vec3( texture2D( gradientMap, coord ).r );
#else
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
2024-07-29 22:02:24 +00:00
}`,jRt=`#ifdef USE_LIGHTMAP
2024-07-18 22:38:03 +00:00
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
reflectedLight.indirectDiffuse += lightMapIrradiance;
2024-07-29 22:02:24 +00:00
#endif`,QRt=`#ifdef USE_LIGHTMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D lightMap;
uniform float lightMapIntensity;
2024-07-29 22:02:24 +00:00
#endif`,XRt=`LambertMaterial material;
2024-07-18 22:38:03 +00:00
material.diffuseColor = diffuseColor.rgb;
2024-07-29 22:02:24 +00:00
material.specularStrength = specularStrength;`,ZRt=`varying vec3 vViewPosition;
2024-07-18 22:38:03 +00:00
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
2024-07-29 22:02:24 +00:00
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,JRt=`uniform bool receiveShadow;
2024-07-18 22:38:03 +00:00
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
float x = normal.x, y = normal.y, z = normal.z;
vec3 result = shCoefficients[ 0 ] * 0.886227;
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor;
return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
#if defined ( LEGACY_LIGHTS )
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
}
return 1.0;
#else
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if ( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
#endif
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
struct DirectionalLight {
vec3 direction;
vec3 color;
};
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
light.color = directionalLight.color;
light.direction = directionalLight.direction;
light.visible = true;
}
#endif
#if NUM_POINT_LIGHTS > 0
struct PointLight {
vec3 position;
vec3 color;
float distance;
float decay;
};
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = pointLight.position - geometryPosition;
light.direction = normalize( lVector );
float lightDistance = length( lVector );
light.color = pointLight.color;
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
}
#endif
#if NUM_SPOT_LIGHTS > 0
struct SpotLight {
vec3 position;
vec3 direction;
vec3 color;
float distance;
float decay;
float coneCos;
float penumbraCos;
};
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
vec3 lVector = spotLight.position - geometryPosition;
light.direction = normalize( lVector );
float angleCos = dot( light.direction, spotLight.direction );
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
if ( spotAttenuation > 0.0 ) {
float lightDistance = length( lVector );
light.color = spotLight.color * spotAttenuation;
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
light.visible = ( light.color != vec3( 0.0 ) );
} else {
light.color = vec3( 0.0 );
light.visible = false;
}
}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
struct RectAreaLight {
vec3 color;
vec3 position;
vec3 halfWidth;
vec3 halfHeight;
};
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
struct HemisphereLight {
vec3 direction;
vec3 skyColor;
vec3 groundColor;
};
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
float dotNL = dot( normal, hemiLight.direction );
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
return irradiance;
}
2024-07-29 22:02:24 +00:00
#endif`,eAt=`#ifdef USE_ENVMAP
2024-07-18 22:38:03 +00:00
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
return PI * envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 reflectVec = reflect( - viewDir, normal );
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
return envMapColor.rgb * envMapIntensity;
#else
return vec3( 0.0 );
#endif
}
#ifdef USE_ANISOTROPY
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 bentNormal = cross( bitangent, viewDir );
bentNormal = normalize( cross( bentNormal, bitangent ) );
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
return getIBLRadiance( viewDir, bentNormal, roughness );
#else
return vec3( 0.0 );
#endif
}
#endif
2024-07-29 22:02:24 +00:00
#endif`,tAt=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,nAt=`varying vec3 vViewPosition;
2024-07-18 22:38:03 +00:00
struct ToonMaterial {
vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
2024-07-29 22:02:24 +00:00
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,sAt=`BlinnPhongMaterial material;
2024-07-18 22:38:03 +00:00
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
2024-07-29 22:02:24 +00:00
material.specularStrength = specularStrength;`,iAt=`varying vec3 vViewPosition;
2024-07-18 22:38:03 +00:00
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
2024-07-29 22:02:24 +00:00
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,rAt=`PhysicalMaterial material;
2024-07-18 22:38:03 +00:00
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
material.ior = ior;
#ifdef USE_SPECULAR
float specularIntensityFactor = specularIntensity;
vec3 specularColorFactor = specularColor;
#ifdef USE_SPECULAR_COLORMAP
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
#endif
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
#else
float specularIntensityFactor = 1.0;
vec3 specularColorFactor = vec3( 1.0 );
material.specularF90 = 1.0;
#endif
material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
material.clearcoat = clearcoat;
material.clearcoatRoughness = clearcoatRoughness;
material.clearcoatF0 = vec3( 0.04 );
material.clearcoatF90 = 1.0;
#ifdef USE_CLEARCOATMAP
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
#endif
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
material.clearcoatRoughness += geometryRoughness;
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_IRIDESCENCE
material.iridescence = iridescence;
material.iridescenceIOR = iridescenceIOR;
#ifdef USE_IRIDESCENCEMAP
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
#else
material.iridescenceThickness = iridescenceThicknessMaximum;
#endif
#endif
#ifdef USE_SHEEN
material.sheenColor = sheenColor;
#ifdef USE_SHEEN_COLORMAP
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
#endif
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
#ifdef USE_SHEEN_ROUGHNESSMAP
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
#endif
#endif
#ifdef USE_ANISOTROPY
#ifdef USE_ANISOTROPYMAP
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
#else
vec2 anisotropyV = anisotropyVector;
#endif
material.anisotropy = length( anisotropyV );
if( material.anisotropy == 0.0 ) {
anisotropyV = vec2( 1.0, 0.0 );
} else {
anisotropyV /= material.anisotropy;
material.anisotropy = saturate( material.anisotropy );
}
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
2024-07-29 22:02:24 +00:00
#endif`,oAt=`struct PhysicalMaterial {
2024-07-18 22:38:03 +00:00
vec3 diffuseColor;
float roughness;
vec3 specularColor;
float specularF90;
#ifdef USE_CLEARCOAT
float clearcoat;
float clearcoatRoughness;
vec3 clearcoatF0;
float clearcoatF90;
#endif
#ifdef USE_IRIDESCENCE
float iridescence;
float iridescenceIOR;
float iridescenceThickness;
vec3 iridescenceFresnel;
vec3 iridescenceF0;
#endif
#ifdef USE_SHEEN
vec3 sheenColor;
float sheenRoughness;
#endif
#ifdef IOR
float ior;
#endif
#ifdef USE_TRANSMISSION
float transmission;
float transmissionAlpha;
float thickness;
float attenuationDistance;
vec3 attenuationColor;
#endif
#ifdef USE_ANISOTROPY
float anisotropy;
float alphaT;
vec3 anisotropyT;
vec3 anisotropyB;
#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
float x2 = x * x;
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
float a2 = pow2( alpha );
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
float v = 0.5 / ( gv + gl );
return saturate(v);
}
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
float a2 = alphaT * alphaB;
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
highp float v2 = dot( v, v );
float w2 = a2 / v2;
return RECIPROCAL_PI * a2 * pow2 ( w2 );
}
#endif
#ifdef USE_CLEARCOAT
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
vec3 f0 = material.clearcoatF0;
float f90 = material.clearcoatF90;
float roughness = material.clearcoatRoughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( V * D );
}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
vec3 f0 = material.specularColor;
float f90 = material.specularF90;
float roughness = material.roughness;
float alpha = pow2( roughness );
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotVH );
#ifdef USE_IRIDESCENCE
F = mix( F, material.iridescenceFresnel, material.iridescence );
#endif
#ifdef USE_ANISOTROPY
float dotTL = dot( material.anisotropyT, lightDir );
float dotTV = dot( material.anisotropyT, viewDir );
float dotTH = dot( material.anisotropyT, halfDir );
float dotBL = dot( material.anisotropyB, lightDir );
float dotBV = dot( material.anisotropyB, viewDir );
float dotBH = dot( material.anisotropyB, halfDir );
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
#else
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
#endif
return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
const float LUT_SIZE = 64.0;
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
const float LUT_BIAS = 0.5 / LUT_SIZE;
float dotNV = saturate( dot( N, V ) );
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
uv = uv * LUT_SCALE + LUT_BIAS;
return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
float l = length( f );
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
float x = dot( v1, v2 );
float y = abs( x );
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
float b = 3.4175940 + ( 4.1616724 + y ) * y;
float v = a / b;
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
vec3 lightNormal = cross( v1, v2 );
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
vec3 T1, T2;
T1 = normalize( V - N * dot( V, N ) );
T2 = - cross( N, T1 );
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
vec3 coords[ 4 ];
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
coords[ 0 ] = normalize( coords[ 0 ] );
coords[ 1 ] = normalize( coords[ 1 ] );
coords[ 2 ] = normalize( coords[ 2 ] );
coords[ 3 ] = normalize( coords[ 3 ] );
vec3 vectorFormFactor = vec3( 0.0 );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
float alpha = pow2( roughness );
float invAlpha = 1.0 / alpha;
float cos2h = dotNH * dotNH;
float sin2h = max( 1.0 - cos2h, 0.0078125 );
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNL = saturate( dot( normal, lightDir ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float D = D_Charlie( sheenRoughness, dotNH );
float V = V_Neubelt( dotNV, dotNL );
return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
float r2 = roughness * roughness;
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
vec4 r = roughness * c0 + c1;
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
vec2 fab = DFGApprox( normal, viewDir, roughness );
return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
vec2 fab = DFGApprox( normal, viewDir, roughness );
#ifdef USE_IRIDESCENCE
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
#else
vec3 Fr = specularColor;
#endif
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
float Ess = fab.x + fab.y;
float Ems = 1.0 - Ess;
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
singleScatter += FssEss;
multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometryNormal;
vec3 viewDir = geometryViewDir;
vec3 position = geometryPosition;
vec3 lightPos = rectAreaLight.position;
vec3 halfWidth = rectAreaLight.halfWidth;
vec3 halfHeight = rectAreaLight.halfHeight;
vec3 lightColor = rectAreaLight.color;
float roughness = material.roughness;
vec3 rectCoords[ 4 ];
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
vec2 uv = LTC_Uv( normal, viewDir, roughness );
vec4 t1 = texture2D( ltc_1, uv );
vec4 t2 = texture2D( ltc_2, uv );
mat3 mInv = mat3(
vec3( t1.x, 0, t1.y ),
vec3( 0, 1, 0 ),
vec3( t1.z, 0, t1.w )
);
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifdef USE_CLEARCOAT
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = dotNLcc * directLight.color;
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
#endif
#ifdef USE_SHEEN
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
#endif
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
#ifdef USE_CLEARCOAT
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
#endif
#ifdef USE_SHEEN
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
#endif
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
#ifdef USE_IRIDESCENCE
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
#else
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
#endif
vec3 totalScattering = singleScattering + multiScattering;
vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
reflectedLight.indirectSpecular += radiance * singleScattering;
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct RE_Direct_Physical
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
2024-07-29 22:02:24 +00:00
}`,aAt=`
2024-07-18 22:38:03 +00:00
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
float dotNVi = saturate( dot( normal, geometryViewDir ) );
if ( material.iridescenceThickness == 0.0 ) {
material.iridescence = 0.0;
} else {
material.iridescence = saturate( material.iridescence );
}
if ( material.iridescence > 0.0 ) {
material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
PointLight pointLight;
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
pointLight = pointLights[ i ];
getPointLightInfo( pointLight, geometryPosition, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
pointLightShadow = pointLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
SpotLight spotLight;
vec4 spotColor;
vec3 spotLightCoord;
bool inSpotLightMap;
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
spotLight = spotLights[ i ];
getSpotLightInfo( spotLight, geometryPosition, directLight );
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
#else
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
#endif
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
#endif
#undef SPOT_LIGHT_MAP_INDEX
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
DirectionalLight directionalLight;
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalLightInfo( directionalLight, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
RectAreaLight rectAreaLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
#if defined( USE_LIGHT_PROBES )
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
#endif
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
}
#pragma unroll_loop_end
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
2024-07-29 22:02:24 +00:00
#endif`,lAt=`#if defined( RE_IndirectDiffuse )
2024-07-18 22:38:03 +00:00
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
irradiance += lightMapIrradiance;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
iblIrradiance += getIBLIrradiance( geometryNormal );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
#ifdef USE_ANISOTROPY
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
#else
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
#endif
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
2024-07-29 22:02:24 +00:00
#endif`,cAt=`#if defined( RE_IndirectDiffuse )
2024-07-18 22:38:03 +00:00
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
2024-07-23 23:35:50 +00:00
#endif`,dAt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
2024-07-29 22:02:24 +00:00
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,uAt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
2024-07-18 22:38:03 +00:00
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
2024-07-29 22:02:24 +00:00
#endif`,pAt=`#ifdef USE_LOGDEPTHBUF
2024-07-18 22:38:03 +00:00
#ifdef USE_LOGDEPTHBUF_EXT
varying float vFragDepth;
varying float vIsPerspective;
#else
uniform float logDepthBufFC;
#endif
2024-07-29 22:02:24 +00:00
#endif`,_At=`#ifdef USE_LOGDEPTHBUF
2024-07-18 22:38:03 +00:00
#ifdef USE_LOGDEPTHBUF_EXT
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#else
if ( isPerspectiveMatrix( projectionMatrix ) ) {
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
gl_Position.z *= gl_Position.w;
}
#endif
2024-07-29 22:02:24 +00:00
#endif`,hAt=`#ifdef USE_MAP
2024-07-18 22:38:03 +00:00
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
#endif
diffuseColor *= sampledDiffuseColor;
2024-07-29 22:02:24 +00:00
#endif`,fAt=`#ifdef USE_MAP
2024-07-18 22:38:03 +00:00
uniform sampler2D map;
2024-07-29 22:02:24 +00:00
#endif`,mAt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
2024-07-18 22:38:03 +00:00
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#endif
#ifdef USE_MAP
diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
2024-07-29 22:02:24 +00:00
#endif`,gAt=`#if defined( USE_POINTS_UV )
2024-07-18 22:38:03 +00:00
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
uniform mat3 uvTransform;
#endif
#endif
#ifdef USE_MAP
uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
2024-07-29 22:02:24 +00:00
#endif`,bAt=`float metalnessFactor = metalness;
2024-07-18 22:38:03 +00:00
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
2024-07-29 22:02:24 +00:00
#endif`,EAt=`#ifdef USE_METALNESSMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D metalnessMap;
2024-07-29 22:02:24 +00:00
#endif`,yAt=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
2024-07-18 22:38:03 +00:00
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
#elif defined( USE_COLOR )
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
2024-07-29 22:02:24 +00:00
#endif`,vAt=`#ifdef USE_MORPHNORMALS
2024-07-18 22:38:03 +00:00
objectNormal *= morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
#else
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
#endif
2024-07-29 22:02:24 +00:00
#endif`,SAt=`#ifdef USE_MORPHTARGETS
2024-07-18 22:38:03 +00:00
uniform float morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
uniform sampler2DArray morphTargetsTexture;
uniform ivec2 morphTargetsTextureSize;
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
int y = texelIndex / morphTargetsTextureSize.x;
int x = texelIndex - y * morphTargetsTextureSize.x;
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
#else
#ifndef USE_MORPHNORMALS
uniform float morphTargetInfluences[ 8 ];
#else
uniform float morphTargetInfluences[ 4 ];
#endif
#endif
2024-07-29 22:02:24 +00:00
#endif`,TAt=`#ifdef USE_MORPHTARGETS
2024-07-18 22:38:03 +00:00
transformed *= morphTargetBaseInfluence;
#ifdef MORPHTARGETS_TEXTURE
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
#else
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
#ifndef USE_MORPHNORMALS
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
#endif
#endif
2024-07-29 22:02:24 +00:00
#endif`,xAt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
2024-07-18 22:38:03 +00:00
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
vec3 normal = normalize( cross( fdx, fdy ) );
#else
vec3 normal = normalize( vNormal );
#ifdef DOUBLE_SIDED
normal *= faceDirection;
#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
#ifdef USE_TANGENT
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn = getTangentFrame( - vViewPosition, normal,
#if defined( USE_NORMALMAP )
vNormalMapUv
#elif defined( USE_CLEARCOAT_NORMALMAP )
vClearcoatNormalMapUv
#else
vUv
#endif
);
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn[0] *= faceDirection;
tbn[1] *= faceDirection;
#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
#ifdef USE_TANGENT
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
#else
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
#endif
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
tbn2[0] *= faceDirection;
tbn2[1] *= faceDirection;
#endif
#endif
2024-07-29 22:02:24 +00:00
vec3 nonPerturbedNormal = normal;`,CAt=`#ifdef USE_NORMALMAP_OBJECTSPACE
2024-07-18 22:38:03 +00:00
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * faceDirection;
#endif
normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
2024-07-29 22:02:24 +00:00
#endif`,wAt=`#ifndef FLAT_SHADED
2024-07-18 22:38:03 +00:00
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
2024-07-29 22:02:24 +00:00
#endif`,RAt=`#ifndef FLAT_SHADED
2024-07-18 22:38:03 +00:00
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
2024-07-29 22:02:24 +00:00
#endif`,AAt=`#ifndef FLAT_SHADED
2024-07-18 22:38:03 +00:00
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
2024-07-29 22:02:24 +00:00
#endif`,NAt=`#ifdef USE_NORMALMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
vec3 q0 = dFdx( eye_pos.xyz );
vec3 q1 = dFdy( eye_pos.xyz );
vec2 st0 = dFdx( uv.st );
vec2 st1 = dFdy( uv.st );
vec3 N = surf_norm;
vec3 q1perp = cross( q1, N );
vec3 q0perp = cross( N, q0 );
vec3 T = q1perp * st0.x + q0perp * st1.x;
vec3 B = q1perp * st0.y + q0perp * st1.y;
float det = max( dot( T, T ), dot( B, B ) );
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
2024-07-29 22:02:24 +00:00
#endif`,OAt=`#ifdef USE_CLEARCOAT
2024-07-18 22:38:03 +00:00
vec3 clearcoatNormal = nonPerturbedNormal;
2024-07-29 22:02:24 +00:00
#endif`,IAt=`#ifdef USE_CLEARCOAT_NORMALMAP
2024-07-18 22:38:03 +00:00
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
2024-07-29 22:02:24 +00:00
#endif`,MAt=`#ifdef USE_CLEARCOATMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearcoatNormalMap;
uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
2024-07-29 22:02:24 +00:00
#endif`,DAt=`#ifdef USE_IRIDESCENCEMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
2024-07-29 22:02:24 +00:00
#endif`,kAt=`#ifdef OPAQUE
2024-07-18 22:38:03 +00:00
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
2024-07-29 22:02:24 +00:00
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,LAt=`vec3 packNormalToRGB( const in vec3 normal ) {
2024-07-18 22:38:03 +00:00
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
vec4 r = vec4( fract( v * PackFactors ), v );
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
return dot( v, UnpackFactors );
}
vec2 packDepthToRG( in highp float v ) {
return packDepthToRGBA( v ).yx;
}
float unpackRGToDepth( const in highp vec2 v ) {
return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
}
vec4 pack2HalfToRGBA( vec2 v ) {
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( vec4 v ) {
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * depth - far );
2024-07-29 22:02:24 +00:00
}`,PAt=`#ifdef PREMULTIPLIED_ALPHA
2024-07-18 22:38:03 +00:00
gl_FragColor.rgb *= gl_FragColor.a;
2024-07-29 22:02:24 +00:00
#endif`,UAt=`vec4 mvPosition = vec4( transformed, 1.0 );
2024-07-18 22:38:03 +00:00
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
2024-07-29 22:02:24 +00:00
gl_Position = projectionMatrix * mvPosition;`,FAt=`#ifdef DITHERING
2024-07-18 22:38:03 +00:00
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
2024-07-29 22:02:24 +00:00
#endif`,BAt=`#ifdef DITHERING
2024-07-18 22:38:03 +00:00
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
2024-07-29 22:02:24 +00:00
#endif`,GAt=`float roughnessFactor = roughness;
2024-07-18 22:38:03 +00:00
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
2024-07-29 22:02:24 +00:00
#endif`,VAt=`#ifdef USE_ROUGHNESSMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D roughnessMap;
2024-07-29 22:02:24 +00:00
#endif`,zAt=`#if NUM_SPOT_LIGHT_COORDS > 0
2024-07-18 22:38:03 +00:00
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
struct SpotLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
}
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
return unpackRGBATo2Half( texture2D( shadow, uv ) );
}
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
float occlusion = 1.0;
vec2 distribution = texture2DDistribution( shadow, uv );
float hard_shadow = step( compare , distribution.x );
if (hard_shadow != 1.0 ) {
float distance = compare - distribution.x ;
float variance = max( 0.00000, distribution.y * distribution.y );
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
}
return occlusion;
}
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
if ( frustumTest ) {
#if defined( SHADOWMAP_TYPE_PCF )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx0 = - texelSize.x * shadowRadius;
float dy0 = - texelSize.y * shadowRadius;
float dx1 = + texelSize.x * shadowRadius;
float dy1 = + texelSize.y * shadowRadius;
float dx2 = dx0 / 2.0;
float dy2 = dy0 / 2.0;
float dx3 = dx1 / 2.0;
float dy3 = dy1 / 2.0;
shadow = (
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
) * ( 1.0 / 17.0 );
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx = texelSize.x;
float dy = texelSize.y;
vec2 uv = shadowCoord.xy;
vec2 f = fract( uv * shadowMapSize + 0.5 );
uv -= f * texelSize;
shadow = (
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
f.x ),
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
f.x ),
f.y )
) * ( 1.0 / 9.0 );
#elif defined( SHADOWMAP_TYPE_VSM )
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
#else
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
#endif
}
return shadow;
}
vec2 cubeToUV( vec3 v, float texelSizeY ) {
vec3 absV = abs( v );
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
absV *= scaleToCube;
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
vec2 planar = v.xy;
float almostATexel = 1.5 * texelSizeY;
float almostOne = 1.0 - almostATexel;
if ( absV.z >= almostOne ) {
if ( v.z > 0.0 )
planar.x = 4.0 - v.x;
} else if ( absV.x >= almostOne ) {
float signX = sign( v.x );
planar.x = v.z * signX + 2.0 * signX;
} else if ( absV.y >= almostOne ) {
float signY = sign( v.y );
planar.x = v.x + 2.0 * signY + 2.0;
planar.y = v.z * signY - 2.0;
}
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
}
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
vec3 lightToPosition = shadowCoord.xyz;
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
vec3 bd3D = normalize( lightToPosition );
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
return (
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
) * ( 1.0 / 9.0 );
#else
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
#endif
}
2024-07-29 22:02:24 +00:00
#endif`,HAt=`#if NUM_SPOT_LIGHT_COORDS > 0
2024-07-18 22:38:03 +00:00
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
struct SpotLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
2024-07-29 22:02:24 +00:00
#endif`,qAt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2024-07-18 22:38:03 +00:00
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
#if NUM_DIR_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
shadowWorldPosition = worldPosition;
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
#endif
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
2024-07-29 22:02:24 +00:00
#endif`,YAt=`float getShadowMask() {
2024-07-18 22:38:03 +00:00
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
directionalLight = directionalLightShadows[ i ];
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
spotLight = spotLightShadows[ i ];
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
pointLight = pointLightShadows[ i ];
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#pragma unroll_loop_end
#endif
#endif
return shadow;
2024-07-29 22:02:24 +00:00
}`,$At=`#ifdef USE_SKINNING
2024-07-18 22:38:03 +00:00
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
2024-07-29 22:02:24 +00:00
#endif`,WAt=`#ifdef USE_SKINNING
2024-07-18 22:38:03 +00:00
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
mat4 getBoneMatrix( const in float i ) {
int size = textureSize( boneTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
2024-07-29 22:02:24 +00:00
#endif`,KAt=`#ifdef USE_SKINNING
2024-07-18 22:38:03 +00:00
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
2024-07-29 22:02:24 +00:00
#endif`,jAt=`#ifdef USE_SKINNING
2024-07-18 22:38:03 +00:00
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
2024-07-29 22:02:24 +00:00
#endif`,QAt=`float specularStrength;
2024-07-18 22:38:03 +00:00
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
2024-07-29 22:02:24 +00:00
#endif`,XAt=`#ifdef USE_SPECULARMAP
2024-07-18 22:38:03 +00:00
uniform sampler2D specularMap;
2024-07-29 22:02:24 +00:00
#endif`,ZAt=`#if defined( TONE_MAPPING )
2024-07-18 22:38:03 +00:00
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2024-07-29 22:02:24 +00:00
#endif`,JAt=`#ifndef saturate
2024-07-18 22:38:03 +00:00
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
const mat3 ACESInputMat = mat3(
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
vec3( 0.04823, 0.01566, 0.83777 )
);
const mat3 ACESOutputMat = mat3(
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
vec3( -0.07367, -0.00605, 1.07602 )
);
color *= toneMappingExposure / 0.6;
color = ACESInputMat * color;
color = RRTAndODTFit( color );
color = ACESOutputMat * color;
return saturate( color );
}
2024-07-29 22:02:24 +00:00
vec3 CustomToneMapping( vec3 color ) { return color; }`,eNt=`#ifdef USE_TRANSMISSION
2024-07-18 22:38:03 +00:00
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
material.attenuationDistance = attenuationDistance;
material.attenuationColor = attenuationColor;
#ifdef USE_TRANSMISSIONMAP
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
#endif
#ifdef USE_THICKNESSMAP
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
#endif
vec3 pos = vWorldPosition;
vec3 v = normalize( cameraPosition - pos );
vec3 n = inverseTransformDirection( normal, viewMatrix );
vec4 transmitted = getIBLVolumeRefraction(
n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2024-07-29 22:02:24 +00:00
#endif`,tNt=`#ifdef USE_TRANSMISSION
2024-07-18 22:38:03 +00:00
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
uniform vec3 attenuationColor;
#ifdef USE_TRANSMISSIONMAP
uniform sampler2D transmissionMap;
#endif
#ifdef USE_THICKNESSMAP
uniform sampler2D thicknessMap;
#endif
uniform vec2 transmissionSamplerSize;
uniform sampler2D transmissionSamplerMap;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
varying vec3 vWorldPosition;
float w0( float a ) {
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
}
float w1( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
}
float w2( float a ){
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
}
float w3( float a ) {
return ( 1.0 / 6.0 ) * ( a * a * a );
}
float g0( float a ) {
return w0( a ) + w1( a );
}
float g1( float a ) {
return w2( a ) + w3( a );
}
float h0( float a ) {
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
}
float h1( float a ) {
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
}
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
uv = uv * texelSize.zw + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
float g0x = g0( fuv.x );
float g1x = g1( fuv.x );
float h0x = h0( fuv.x );
float h1x = h1( fuv.x );
float h0y = h0( fuv.y );
float h1y = h1( fuv.y );
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
}
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
vec2 fLodSizeInv = 1.0 / fLodSize;
vec2 cLodSizeInv = 1.0 / cLodSize;
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
return mix( fSample, cSample, fract( lod ) );
}
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
vec3 modelScale;
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
return normalize( refractionVector ) * thickness * modelScale;
}
float applyIorToRoughness( const in float roughness, const in float ior ) {
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
}
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
}
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
if ( isinf( attenuationDistance ) ) {
return vec3( 1.0 );
} else {
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
}
}
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
const in vec3 attenuationColor, const in float attenuationDistance ) {
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
2024-07-29 22:02:24 +00:00
#endif`,nNt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2024-07-18 22:38:03 +00:00
varying vec2 vUv;
#endif
#ifdef USE_MAP
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
2024-07-29 22:02:24 +00:00
#endif`,sNt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2024-07-18 22:38:03 +00:00
varying vec2 vUv;
#endif
#ifdef USE_MAP
uniform mat3 mapTransform;
varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
uniform mat3 alphaMapTransform;
varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
uniform mat3 lightMapTransform;
varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
uniform mat3 aoMapTransform;
varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
uniform mat3 bumpMapTransform;
varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
uniform mat3 normalMapTransform;
varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
uniform mat3 displacementMapTransform;
varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
uniform mat3 emissiveMapTransform;
varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
uniform mat3 metalnessMapTransform;
varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
uniform mat3 roughnessMapTransform;
varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
uniform mat3 anisotropyMapTransform;
varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
uniform mat3 clearcoatMapTransform;
varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform mat3 clearcoatNormalMapTransform;
varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform mat3 clearcoatRoughnessMapTransform;
varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
uniform mat3 sheenColorMapTransform;
varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform mat3 sheenRoughnessMapTransform;
varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
uniform mat3 iridescenceMapTransform;
varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform mat3 iridescenceThicknessMapTransform;
varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
uniform mat3 specularMapTransform;
varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
uniform mat3 specularColorMapTransform;
varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform mat3 specularIntensityMapTransform;
varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
uniform mat3 transmissionMapTransform;
varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
2024-07-29 22:02:24 +00:00
#endif`,iNt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2024-07-18 22:38:03 +00:00
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2024-07-29 22:02:24 +00:00
#endif`,rNt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2024-07-18 22:38:03 +00:00
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
#endif
#ifdef USE_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
2024-07-29 22:02:24 +00:00
#endif`;const oNt=`varying vec2 vUv;
2024-07-18 22:38:03 +00:00
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
2024-07-29 22:02:24 +00:00
}`,aNt=`uniform sampler2D t2D;
2024-07-18 22:38:03 +00:00
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
#ifdef DECODE_VIDEO_TEXTURE
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
2024-07-29 22:02:24 +00:00
}`,lNt=`varying vec3 vWorldDirection;
2024-07-18 22:38:03 +00:00
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
2024-07-29 22:02:24 +00:00
}`,cNt=`#ifdef ENVMAP_TYPE_CUBE
2024-07-18 22:38:03 +00:00
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
#ifdef ENVMAP_TYPE_CUBE
vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
#else
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
texColor.rgb *= backgroundIntensity;
gl_FragColor = texColor;
#include <tonemapping_fragment>
#include <colorspace_fragment>
2024-07-29 22:02:24 +00:00
}`,dNt=`varying vec3 vWorldDirection;
2024-07-18 22:38:03 +00:00
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
2024-07-29 22:02:24 +00:00
}`,uNt=`uniform samplerCube tCube;
2024-07-18 22:38:03 +00:00
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
gl_FragColor = texColor;
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <colorspace_fragment>
2024-07-29 22:02:24 +00:00
}`,pNt=`#include <common>
2024-07-18 22:38:03 +00:00
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
2024-07-29 22:02:24 +00:00
}`,_Nt=`#if DEPTH_PACKING == 3200
2024-07-18 22:38:03 +00:00
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <logdepthbuf_fragment>
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
#if DEPTH_PACKING == 3200
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
#elif DEPTH_PACKING == 3201
gl_FragColor = packDepthToRGBA( fragCoordZ );
#endif
2024-07-29 22:02:24 +00:00
}`,hNt=`#define DISTANCE
2024-07-18 22:38:03 +00:00
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
2024-07-29 22:02:24 +00:00
}`,fNt=`#define DISTANCE
2024-07-18 22:38:03 +00:00
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
2024-07-29 22:02:24 +00:00
}`,mNt=`varying vec3 vWorldDirection;
2024-07-18 22:38:03 +00:00
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
2024-07-29 22:02:24 +00:00
}`,gNt=`uniform sampler2D tEquirect;
2024-07-18 22:38:03 +00:00
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
2024-07-29 22:02:24 +00:00
}`,bNt=`uniform float scale;
2024-07-18 22:38:03 +00:00
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
vLineDistance = scale * lineDistance;
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
2024-07-29 22:02:24 +00:00
}`,ENt=`uniform vec3 diffuse;
2024-07-18 22:38:03 +00:00
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
2024-07-29 22:02:24 +00:00
}`,yNt=`#include <common>
2024-07-18 22:38:03 +00:00
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
2024-07-29 22:02:24 +00:00
}`,vNt=`uniform vec3 diffuse;
2024-07-18 22:38:03 +00:00
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
#else
reflectedLight.indirectDiffuse += vec3( 1.0 );
#endif
#include <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-07-29 22:02:24 +00:00
}`,SNt=`#define LAMBERT
2024-07-18 22:38:03 +00:00
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
2024-07-29 22:02:24 +00:00
}`,TNt=`#define LAMBERT
2024-07-18 22:38:03 +00:00
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_lambert_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-07-29 22:02:24 +00:00
}`,xNt=`#define MATCAP
2024-07-18 22:38:03 +00:00
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
2024-07-29 22:02:24 +00:00
}`,CNt=`#define MATCAP
2024-07-18 22:38:03 +00:00
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
#ifdef USE_MATCAP
vec4 matcapColor = texture2D( matcap, uv );
#else
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
#endif
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-07-29 22:02:24 +00:00
}`,wNt=`#define NORMAL
2024-07-18 22:38:03 +00:00
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
2024-07-29 22:02:24 +00:00
}`,RNt=`#define NORMAL
2024-07-18 22:38:03 +00:00
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
2024-07-29 22:02:24 +00:00
}`,ANt=`#define PHONG
2024-07-18 22:38:03 +00:00
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
2024-07-29 22:02:24 +00:00
}`,NNt=`#define PHONG
2024-07-18 22:38:03 +00:00
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-07-29 22:02:24 +00:00
}`,ONt=`#define STANDARD
2024-07-18 22:38:03 +00:00
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
2024-07-29 22:02:24 +00:00
}`,INt=`#define STANDARD
2024-07-18 22:38:03 +00:00
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
uniform float ior;
#endif
#ifdef USE_SPECULAR
uniform float specularIntensity;
uniform vec3 specularColor;
#ifdef USE_SPECULAR_COLORMAP
uniform sampler2D specularColorMap;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
uniform sampler2D specularIntensityMap;
#endif
#endif
#ifdef USE_CLEARCOAT
uniform float clearcoat;
uniform float clearcoatRoughness;
#endif
#ifdef USE_IRIDESCENCE
uniform float iridescence;
uniform float iridescenceIOR;
uniform float iridescenceThicknessMinimum;
uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
uniform vec3 sheenColor;
uniform float sheenRoughness;
#ifdef USE_SHEEN_COLORMAP
uniform sampler2D sheenColorMap;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
uniform sampler2D sheenRoughnessMap;
#endif
#endif
#ifdef USE_ANISOTROPY
uniform vec2 anisotropyVector;
#ifdef USE_ANISOTROPYMAP
uniform sampler2D anisotropyMap;
#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
#include <transmission_fragment>
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
#ifdef USE_SHEEN
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
#endif
#ifdef USE_CLEARCOAT
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
#endif
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-07-29 22:02:24 +00:00
}`,MNt=`#define TOON
2024-07-18 22:38:03 +00:00
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
2024-07-29 22:02:24 +00:00
}`,DNt=`#define TOON
2024-07-18 22:38:03 +00:00
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
2024-07-29 22:02:24 +00:00
}`,kNt=`uniform float size;
2024-07-18 22:38:03 +00:00
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
varying vec2 vUv;
uniform mat3 uvTransform;
#endif
void main() {
#ifdef USE_POINTS_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif
#include <color_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
2024-07-29 22:02:24 +00:00
}`,LNt=`uniform vec3 diffuse;
2024-07-18 22:38:03 +00:00
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
2024-07-29 22:02:24 +00:00
}`,PNt=`#include <common>
2024-07-18 22:38:03 +00:00
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
2024-07-29 22:02:24 +00:00
}`,UNt=`uniform vec3 color;
2024-07-18 22:38:03 +00:00
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
#include <logdepthbuf_fragment>
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
2024-07-29 22:02:24 +00:00
}`,FNt=`uniform float rotation;
2024-07-18 22:38:03 +00:00
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
vec2 scale;
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
#ifndef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
#endif
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
2024-07-29 22:02:24 +00:00
}`,BNt=`uniform vec3 diffuse;
2024-07-18 22:38:03 +00:00
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
2024-07-29 22:02:24 +00:00
}`,vt={alphahash_fragment:aRt,alphahash_pars_fragment:lRt,alphamap_fragment:cRt,alphamap_pars_fragment:dRt,alphatest_fragment:uRt,alphatest_pars_fragment:pRt,aomap_fragment:_Rt,aomap_pars_fragment:hRt,batching_pars_vertex:fRt,batching_vertex:mRt,begin_vertex:gRt,beginnormal_vertex:bRt,bsdfs:ERt,iridescence_fragment:yRt,bumpmap_pars_fragment:vRt,clipping_planes_fragment:SRt,clipping_planes_pars_fragment:TRt,clipping_planes_pars_vertex:xRt,clipping_planes_vertex:CRt,color_fragment:wRt,color_pars_fragment:RRt,color_pars_vertex:ARt,color_vertex:NRt,common:ORt,cube_uv_reflection_fragment:IRt,defaultnormal_vertex:MRt,displacementmap_pars_vertex:DRt,displacementmap_vertex:kRt,emissivemap_fragment:LRt,emissivemap_pars_fragment:PRt,colorspace_fragment:URt,colorspace_pars_fragment:FRt,envmap_fragment:BRt,envmap_common_pars_fragment:GRt,envmap_pars_fragment:VRt,envmap_pars_vertex:zRt,envmap_physical_pars_fragment:eAt,envmap_vertex:HRt,fog_vertex:qRt,fog_pars_vertex:YRt,fog_fragment:$Rt,fog_pars_fragment:WRt,gradientmap_pars_fragment:KRt,lightmap_fragment:jRt,lightmap_pars_fragment:QRt,lights_lambert_fragment:XRt,lights_lambert_pars_fragment:ZRt,lights_pars_begin:JRt,lights_toon_fragment:tAt,lights_toon_pars_fragment:nAt,lights_phong_fragment:sAt,lights_phong_pars_fragment:iAt,lights_physical_fragment:rAt,lights_physical_pars_fragment:oAt,lights_fragment_begin:aAt,lights_fragment_maps:lAt,lights_fragment_end:cAt,logdepthbuf_fragment:dAt,logdepthbuf_pars_fragment:uAt,logdepthbuf_pars_vertex:pAt,logdepthbuf_vertex:_At,map_fragment:hAt,map_pars_fragment:fAt,map_particle_fragment:mAt,map_particle_pars_fragment:gAt,metalnessmap_fragment:bAt,metalnessmap_pars_fragment:EAt,morphcolor_vertex:yAt,morphnormal_vertex:vAt,morphtarget_pars_vertex:SAt,morphtarget_vertex:TAt,normal_fragment_begin:xAt,normal_fragment_maps:CAt,normal_pars_fragment:wAt,normal_pars_vertex:RAt,normal_vertex:AAt,normalmap_pars_fragment:NAt,clearcoat_normal_fragment_begin:OAt,clearcoat_normal_fragment_maps:IAt,clearcoat_pars_fragment:MAt,iridescence_pars_fragment:DAt,opaque_fragment:kAt,packing:LAt,premultiplied_alpha_fragment:PAt,project_vertex:UAt,dithering_fragment:FAt,dithering_pars_fragment:BAt,roughnessmap_fragment:GAt,roughnessmap_pars_fragment:VAt,shadowmap_pars_fragment:zAt,shadowmap_pars_vertex:HAt,shadowmap_vertex:qAt,shadowmask_pars_fragment:YAt,skinbase_vertex:$At,skinning_pars_vertex:WAt,skinning_vertex:KAt,skinnormal_vertex:jAt,specularmap_fragment:QAt,specularmap_pars_fragment:XAt,tonemapping_fragment:ZAt,tonemapping_pars_fragment:JAt,transmission_fragment:eNt,transmission_pars_fragment:tNt,uv_pars_fragment:nNt,uv_pars_vertex:sNt,uv_vertex:iNt,worldpos_vertex:rNt,background_vert:oNt,background_frag:aNt,backgroundCube_vert:lNt,backgroundCube_frag:cNt,cube_vert:dNt,cube_frag:uNt,depth_vert:pNt,depth_frag:_Nt,distanceRGBA_vert:hNt,distanceRGBA_frag:fNt,equirect_vert:mNt,equirect_frag:gNt,linedashed_vert:bNt,linedashed_frag:ENt,meshbasic_vert:yNt,meshbasic_frag:vNt,meshlambert_vert:SNt,meshlambert_frag:TNt,meshmatcap_vert:xNt,meshmatcap_frag:CNt,meshnormal_vert:wNt,meshnormal_frag:RNt,meshphong_vert:ANt,meshphong_frag:NNt,meshphysical_vert:ONt,meshphysical_frag:INt,meshtoon_vert:MNt,meshtoon_frag:DNt,points_vert:kNt,points_frag:LNt,shadow_vert:PNt,shadow_frag:UNt,sprite_vert:FNt,sprite_frag:BNt},$e={common:{diffuse:{value:new pt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Tt},alphaMap:{value:null},alphaMapTransform:{value:new Tt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Tt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Tt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Tt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Tt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Tt},normalScale:{value:new Rt(1,1)}},displacementmap:{displacementMap:{value:
2024-07-18 22:38:03 +00:00
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform int samples;
uniform float weights[ n ];
uniform bool latitudinal;
uniform float dTheta;
uniform float mipInt;
uniform vec3 poleAxis;
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
vec3 getSample( float theta, vec3 axis ) {
float cosTheta = cos( theta );
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross( axis, vOutputDirection ) * sin( theta )
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
return bilinearCubeUV( envMap, sampleDirection, mipInt );
}
void main() {
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
}
axis = normalize( axis );
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
for ( int i = 1; i < n; i++ ) {
if ( i >= samples ) {
break;
}
float theta = dTheta * float( i );
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
}
}
2024-07-27 23:19:18 +00:00
`,blending:ar,depthTest:!1,depthWrite:!1})}function l1(){return new to({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:IE(),fragmentShader:`
2024-07-18 22:38:03 +00:00
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
#include <common>
void main() {
vec3 outputDirection = normalize( vOutputDirection );
vec2 uv = equirectUv( outputDirection );
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
2024-07-27 23:19:18 +00:00
`,blending:ar,depthTest:!1,depthWrite:!1})}function c1(){return new to({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:IE(),fragmentShader:`
2024-07-18 22:38:03 +00:00
precision mediump float;
precision mediump int;
uniform float flipEnvMap;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
void main() {
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
}
`,blending:ar,depthTest:!1,depthWrite:!1})}function IE(){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 );
}
2024-07-29 22:02:24 +00:00
`}function KNt(n){let e=new WeakMap,t=null;function s(a){if(a&&a.isTexture){const l=a.mapping,u=l===Pg||l===Ug,d=l===aa||l===la;if(u||d)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new o1(n)),h=u?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(u&&h&&h.height>0||d&&h&&i(h)){t===null&&(t=new o1(n));const f=u?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",r),f.texture}else return null}}}return a}function i(a){let l=0;const u=6;for(let d=0;d<u;d++)a[d]!==void 0&&l++;return l===u}function r(a){const l=a.target;l.removeEventListener("dispose",r);const u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:s,dispose:o}}function jNt(n){const e={};function t(s){if(e[s]!==void 0)return e[s];let i;switch(s){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(s)}return e[s]=i,i}return{has:function(s){return t(s)!==null},init:function(s){s.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(s){const i=t(s);return i===null&&console.warn("THREE.WebGLRenderer: "+s+" extension not supported."),i}}}function QNt(n,e,t,s){const i={},r=new WeakMap;function o(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const m in f.attributes)e.remove(f.attributes[m]);for(const m in f.morphAttributes){const E=f.morphAttributes[m];for(let b=0,g=E.length;b<g;b++)e.remove(E[b])}f.removeEventListener("dispose",o),delete i[f.id];const _=r.get(f);_&&(e.remove(_),r.delete(f)),s.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(h,f){return i[f.id]===!0||(f.addEventListener("dispose",o),i[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const m in f)e.update(f[m],n.ARRAY_BUFFER);const _=h.morphAttributes;for(const m in _){const E=_[m];for(let b=0,g=E.length;b<g;b++)e.update(E[b],n.ARRAY_BUFFER)}}function u(h){const f=[],_=h.index,m=h.attributes.position;let E=0;if(_!==null){const y=_.array;E=_.version;for(let v=0,S=y.length;v<S;v+=3){const w=y[v+0],C=y[v+1],A=y[v+2];f.push(w,C,C,A,A,w)}}else if(m!==void 0){const y=m.array;E=m.version;for(let v=0,S=y.length/3-1;v<S;v+=3){const w=v+0,C=v+1,A=v+2;f.push(w,C,C,A,A,w)}}else return;const b=new(pO(f)?EO:bO)(f,1);b.version=E;const g=r.get(h);g&&e.remove(g),r.set(h,b)}function d(h){const f=r.get(h);if(f){const _=h.index;_!==null&&f.version<_.version&&u(h)}else u(h);return r.get(h)}return{get:a,update:l,getWireframeAttribute:d}}function XNt(n,e,t,s){const i=s.isWebGL2;let r;function o(_){r=_}let a,l;function u(_){a=_.type,l=_.bytesPerElement}function d(_,m){n.drawElements(r,m,a,_*l),t.update(m,r,1)}function h(_,m,E){if(E===0)return;let b,g;if(i)b=n,g="drawElementsInstanced";else if(b=e.get("ANGLE_instanced_arrays"),g="drawElementsInstancedANGLE",b===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support ex
2024-07-18 22:38:03 +00:00
`),s=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let o=i;o<r;o++){const a=o+1;s.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return s.join(`
2024-07-29 22:02:24 +00:00
`)}function QOt(n){const e=Ut.getPrimaries(Ut.workingColorSpace),t=Ut.getPrimaries(n);let s;switch(e===t?s="":e===Qd&&t===jd?s="LinearDisplayP3ToLinearSRGB":e===jd&&t===Qd&&(s="LinearSRGBToLinearDisplayP3"),n){case Cn:case Hu:return[s,"LinearTransferOETF"];case en:case wE:return[s,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[s,"LinearTransferOETF"]}}function g1(n,e,t){const s=n.getShaderParameter(e,n.COMPILE_STATUS),i=n.getShaderInfoLog(e).trim();if(s&&i==="")return"";const r=/ERROR: 0:(\d+)/.exec(i);if(r){const o=parseInt(r[1]);return t.toUpperCase()+`
2024-07-18 22:38:03 +00:00
`+i+`
2024-07-29 22:02:24 +00:00
`+jOt(n.getShaderSource(e),o)}else return i}function XOt(n,e){const t=QOt(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function ZOt(n,e){let t;switch(e){case K1t:t="Linear";break;case j1t:t="Reinhard";break;case Q1t:t="OptimizedCineon";break;case X1t:t="ACESFilmic";break;case Z1t:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function JOt(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(ol).join(`
`)}function eIt(n){const e=[];for(const t in n){const s=n[t];s!==!1&&e.push("#define "+t+" "+s)}return e.join(`
`)}function tIt(n,e){const t={},s=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i<s;i++){const r=n.getActiveAttrib(e,i),o=r.name;let a=1;r.type===n.FLOAT_MAT2&&(a=2),r.type===n.FLOAT_MAT3&&(a=3),r.type===n.FLOAT_MAT4&&(a=4),t[o]={type:r.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function ol(n){return n!==""}function b1(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 E1(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const nIt=/^[ \t]*#include +<([\w\d./]+)>/gm;function Hg(n){return n.replace(nIt,iIt)}const sIt=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function iIt(n,e){let t=vt[e];if(t===void 0){const s=sIt.get(e);if(s!==void 0)t=vt[s],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,s);else throw new Error("Can not resolve #include <"+e+">")}return Hg(t)}const rIt=/#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 y1(n){return n.replace(rIt,oIt)}function oIt(n,e,t,s){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=s.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function v1(n){let e="precision "+n.precision+` float;
2024-07-18 22:38:03 +00:00
precision `+n.precision+" int;";return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
2024-07-29 22:02:24 +00:00
#define LOW_PRECISION`),e}function aIt(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===JN?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===S1t?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===bi&&(e="SHADOWMAP_TYPE_VSM"),e}function lIt(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case aa:case la:e="ENVMAP_TYPE_CUBE";break;case zu:e="ENVMAP_TYPE_CUBE_UV";break}return e}function cIt(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case la:e="ENVMAP_MODE_REFRACTION";break}return e}function dIt(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case TE:e="ENVMAP_BLENDING_MULTIPLY";break;case $1t:e="ENVMAP_BLENDING_MIX";break;case W1t:e="ENVMAP_BLENDING_ADD";break}return e}function uIt(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,s=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:s,maxMip:t}}function pIt(n,e,t,s){const i=n.getContext(),r=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=aIt(t),u=lIt(t),d=cIt(t),h=dIt(t),f=uIt(t),_=t.isWebGL2?"":JOt(t),m=eIt(r),E=i.createProgram();let b,g,y=t.glslVersion?"#version "+t.glslVersion+`
2024-07-18 22:38:03 +00:00
`:"";t.isRawShaderMaterial?(b=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(ol).join(`
`),b.length>0&&(b+=`
`),g=[_,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(ol).join(`
`),g.length>0&&(g+=`
`)):(b=[v1(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,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 "+d:"",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(ol).join(`
2024-07-29 22:02:24 +00:00
`),g=[_,v1(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,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 "+u:"",t.envMap?"#define "+d:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==lr?"#define TONE_MAPPING":"",t.toneMapping!==lr?vt.tonemapping_pars_fragment:"",t.toneMapping!==lr?ZOt("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",vt.colorspace_pars_fragment,XOt("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
2024-07-18 22:38:03 +00:00
`].filter(ol).join(`
`)),o=Hg(o),o=b1(o,t),o=E1(o,t),a=Hg(a),a=b1(a,t),a=E1(a,t),o=y1(o),a=y1(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,g=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===BC?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===BC?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
2024-07-27 23:19:18 +00:00
`+g);const v=y+b+o,S=y+g+a,w=m1(i,i.VERTEX_SHADER,v),C=m1(i,i.FRAGMENT_SHADER,S);i.attachShader(E,w),i.attachShader(E,C),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E);function A(F){if(n.debug.checkShaderErrors){const z=i.getProgramInfoLog(E).trim(),Z=i.getShaderInfoLog(w).trim(),M=i.getShaderInfoLog(C).trim();let q=!0,H=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(q=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,E,w,C);else{const P=g1(i,w,"vertex"),$=g1(i,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+`
2024-07-18 22:38:03 +00:00
Program Info Log: `+z+`
`+P+`
2024-07-29 22:02:24 +00:00
`+$)}else z!==""?console.warn("THREE.WebGLProgram: Program Info Log:",z):(Z===""||M==="")&&(H=!1);H&&(F.diagnostics={runnable:q,programLog:z,vertexShader:{log:Z,prefix:b},fragmentShader:{log:M,prefix:g}})}i.deleteShader(w),i.deleteShader(C),D=new Ed(i,E),T=tIt(i,E)}let D;this.getUniforms=function(){return D===void 0&&A(this),D};let T;this.getAttributes=function(){return T===void 0&&A(this),T};let O=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return O===!1&&(O=i.getProgramParameter(E,WOt)),O},this.destroy=function(){s.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=KOt++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=w,this.fragmentShader=C,this}let _It=0;class hIt{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,s=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(s),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const s of t)s.usedTimes--,s.usedTimes===0&&this.shaderCache.delete(s.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 s=t.get(e);return s===void 0&&(s=new Set,t.set(e,s)),s}_getShaderStage(e){const t=this.shaderCache;let s=t.get(e);return s===void 0&&(s=new fIt(e),t.set(e,s)),s}}class fIt{constructor(e){this.id=_It++,this.code=e,this.usedTimes=0}}function mIt(n,e,t,s,i,r,o){const a=new mO,l=new hIt,u=[],d=i.isWebGL2,h=i.logarithmicDepthBuffer,f=i.vertexTextures;let _=i.precision;const m={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 E(T){return T===0?"uv":`uv${T}`}function b(T,O,F,z,Z){const M=z.fog,q=Z.geometry,H=T.isMeshStandardMaterial?z.environment:null,P=(T.isMeshStandardMaterial?t:e).get(T.envMap||H),$=P&&P.mapping===zu?P.image.height:null,J=m[T.type];T.precision!==null&&(_=i.getMaxPrecision(T.precision),_!==T.precision&&console.warn("THREE.WebGLProgram.getParameters:",T.precision,"not supported, using",_,"instead."));const re=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,me=re!==void 0?re.length:0;let Se=0;q.morphAttributes.position!==void 0&&(Se=1),q.morphAttributes.normal!==void 0&&(Se=2),q.morphAttributes.color!==void 0&&(Se=3);let le,Ee,Oe,Me;if(J){const bn=Hs[J];le=bn.vertexShader,Ee=bn.fragmentShader}else le=T.vertexShader,Ee=T.fragmentShader,l.update(T),Oe=l.getVertexShaderID(T),Me=l.getFragmentShaderID(T);const j=n.getRenderTarget(),pe=Z.isInstancedMesh===!0,ue=Z.isBatchedMesh===!0,Ce=!!T.map,ke=!!T.matcap,N=!!P,V=!!T.aoMap,Y=!!T.lightMap,oe=!!T.bumpMap,se=!!T.normalMap,Te=!!T.displacementMap,Ae=!!T.emissiveMap,ne=!!T.metalnessMap,we=!!T.roughnessMap,ge=T.anisotropy>0,De=T.clearcoat>0,k=T.iridescence>0,I=T.sheen>0,W=T.transmission>0,ye=ge&&!!T.anisotropyMap,K=De&&!!T.clearcoatMap,te=De&&!!T.clearcoatNormalMap,Re=De&&!!T.clearcoatRoughnessMap,xe=k&&!!T.iridescenceMap,Le=k&&!!T.iridescenceThicknessMap,Ze=I&&!!T.sheenColorMap,ft=I&&!!T.sheenRoughnessMap,Pe=!!T.specularMap,dt=!!T.specularColorMap,nt=!!T.specularIntensityMap,Ye=W&&!!T.transmissionMap,tt=W&&!!T.thicknessMap,We=!!T.gradientMap,Et=!!T.alphaMap,X=T.alphaTest>0,je=!!T.alphaHash,Be=!!T.extensions,Ne=!!q.attributes.uv1,ze=!!q.attributes.uv2,ot=!!q.attributes.uv3;let Nt=lr;return T.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(Nt=n.toneMapping),{isWebGL2:d,shaderI
2024-07-18 22:38:03 +00:00
gl_Position = vec4( position, 1.0 );
2024-07-29 22:02:24 +00:00
}`,NIt=`uniform sampler2D shadow_pass;
2024-07-18 22:38:03 +00:00
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
const float samples = float( VSM_SAMPLES );
float mean = 0.0;
float squared_mean = 0.0;
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
for ( float i = 0.0; i < samples; i ++ ) {
float uvOffset = uvStart + i * uvStride;
#ifdef HORIZONTAL_PASS
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
mean += distribution.x;
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
#else
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
mean += depth;
squared_mean += depth * depth;
#endif
}
mean = mean / samples;
squared_mean = squared_mean / samples;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
2024-07-29 22:02:24 +00:00
}`;function OIt(n,e,t){let s=new AE;const i=new Rt,r=new Rt,o=new Yt,a=new wIt({depthPacking:uwt}),l=new RIt,u={},d=t.maxTextureSize,h={[Oi]:Yn,[Yn]:Oi,[Ys]:Ys},f=new to({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Rt},radius:{value:4}},vertexShader:AIt,fragmentShader:NIt}),_=f.clone();_.defines.HORIZONTAL_PASS=1;const m=new oi;m.setAttribute("position",new Bn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new Un(m,f),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=JN;let g=this.type;this.render=function(w,C,A){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||w.length===0)return;const D=n.getRenderTarget(),T=n.getActiveCubeFace(),O=n.getActiveMipmapLevel(),F=n.state;F.setBlending(ar),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const z=g!==bi&&this.type===bi,Z=g===bi&&this.type!==bi;for(let M=0,q=w.length;M<q;M++){const H=w[M],P=H.shadow;if(P===void 0){console.warn("THREE.WebGLShadowMap:",H,"has no shadow.");continue}if(P.autoUpdate===!1&&P.needsUpdate===!1)continue;i.copy(P.mapSize);const $=P.getFrameExtents();if(i.multiply($),r.copy(P.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(r.x=Math.floor(d/$.x),i.x=r.x*$.x,P.mapSize.x=r.x),i.y>d&&(r.y=Math.floor(d/$.y),i.y=r.y*$.y,P.mapSize.y=r.y)),P.map===null||z===!0||Z===!0){const re=this.type!==bi?{minFilter:mn,magFilter:mn}:{};P.map!==null&&P.map.dispose(),P.map=new eo(i.x,i.y,re),P.map.texture.name=H.name+".shadowMap",P.camera.updateProjectionMatrix()}n.setRenderTarget(P.map),n.clear();const J=P.getViewportCount();for(let re=0;re<J;re++){const me=P.getViewport(re);o.set(r.x*me.x,r.y*me.y,r.x*me.z,r.y*me.w),F.viewport(o),P.updateMatrices(H,re),s=P.getFrustum(),S(C,A,P.camera,H,this.type)}P.isPointLightShadow!==!0&&this.type===bi&&y(P,A),P.needsUpdate=!1}g=this.type,b.needsUpdate=!1,n.setRenderTarget(D,T,O)};function y(w,C){const A=e.update(E);f.defines.VSM_SAMPLES!==w.blurSamples&&(f.defines.VSM_SAMPLES=w.blurSamples,_.defines.VSM_SAMPLES=w.blurSamples,f.needsUpdate=!0,_.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new eo(i.x,i.y)),f.uniforms.shadow_pass.value=w.map.texture,f.uniforms.resolution.value=w.mapSize,f.uniforms.radius.value=w.radius,n.setRenderTarget(w.mapPass),n.clear(),n.renderBufferDirect(C,null,A,f,E,null),_.uniforms.shadow_pass.value=w.mapPass.texture,_.uniforms.resolution.value=w.mapSize,_.uniforms.radius.value=w.radius,n.setRenderTarget(w.map),n.clear(),n.renderBufferDirect(C,null,A,_,E,null)}function v(w,C,A,D){let T=null;const O=A.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(O!==void 0)T=O;else if(T=A.isPointLight===!0?l:a,n.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0){const F=T.uuid,z=C.uuid;let Z=u[F];Z===void 0&&(Z={},u[F]=Z);let M=Z[z];M===void 0&&(M=T.clone(),Z[z]=M),T=M}if(T.visible=C.visible,T.wireframe=C.wireframe,D===bi?T.side=C.shadowSide!==null?C.shadowSide:C.side:T.side=C.shadowSide!==null?C.shadowSide:h[C.side],T.alphaMap=C.alphaMap,T.alphaTest=C.alphaTest,T.map=C.map,T.clipShadows=C.clipShadows,T.clippingPlanes=C.clippingPlanes,T.clipIntersection=C.clipIntersection,T.displacementMap=C.displacementMap,T.displacementScale=C.displacementScale,T.displacementBias=C.displacementBias,T.wireframeLinewidth=C.wireframeLinewidth,T.linewidth=C.linewidth,A.isPointLight===!0&&T.isMeshDistanceMaterial===!0){const F=n.properties.get(T);F.light=A}return T}function S(w,C,A,D,T){if(w.visible===!1)return;if(w.layers.test(C.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&T===bi)&&(!w.frustumCulled||s.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,w.matrixWorld);const z=e.update(w),Z=w.material;if(Array.isArray(Z)){const M=z.groups;for(let q=0,H=M.length;q<H;q++){const P=M[q],$=Z[P.materialIndex];if($&&$.visible){const J=v(w,$,D,T);w.onBeforeShadow(n,w,C,A,z,J,P),n.renderBufferDirect(A,null,z,J,w,P),w.onAfterShadow(n,w,C,A,z,J,P
2024-07-18 22:38:03 +00:00
Please check that you don't accidentally use the same token twice to register two different handlers for the same event/hook.`),this.unsubscribe(e)),this.listenerMap.set(e,t),this._listeners.push(t)}unsubscribe(e){if(this.listenerMap.has(e)){const t=this.listenerMap.get(e);this.listenerMap.delete(e);const s=this._listeners.indexOf(t);s>=0&&this._listeners.splice(s,1)}}registerProxy(e,t){this.proxyMap.has(e)&&(console.warn(`Already subscribed. Unsubscribing for you.
2024-07-29 22:02:24 +00:00
Please check that you don't accidentally use the same token twice to register two different proxies for the same event/hook.`),this.unregisterProxy(e)),this.proxyMap.set(e,t),this.proxies.push(t)}unregisterProxy(e){if(!this.proxyMap.has(e))return;const t=this.proxyMap.get(e);this.proxyMap.delete(e);const s=this.proxies.indexOf(t);s>=0&&this.proxies.splice(s,1)}}class zt extends Kr{constructor(e){super(),this.entity=e}emit(e){this.listeners.forEach(t=>t(e,this.entity))}}class In extends Kr{constructor(e){super(),this.entity=e}emit(e){let t=!1;const s=()=>[t=!0];for(const i of Array.from(this.listeners.values()))if(i(e,s,this.entity),t)return{prevented:!0};return{prevented:!1}}}class VO extends Kr{execute(e,t){let s=e;for(const i of this.listeners)s=i(s,t);return s}}class es extends VO{constructor(e){super(),this.entity=e}execute(e){return super.execute(e,this.entity)}}class B2t extends Kr{constructor(e){super(),this.entity=e}execute(e){const t=[];for(const s of this.listeners)t.push(s(e,this.entity));return t}}function Vs(){const n=Symbol(),e=new Map,t=new Set,s=(l,u)=>{u instanceof Kr&&u.registerProxy(n,()=>{var d,h;return(h=(d=e.get(l))===null||d===void 0?void 0:d.listeners)!==null&&h!==void 0?h:[]})},i=l=>{const u=new Kr;e.set(l,u),t.forEach(d=>s(l,d[l]))},r=l=>{t.add(l);for(const u of e.keys())s(u,l[u])},o=l=>{for(const u of e.keys())l[u]instanceof Kr&&l[u].unregisterProxy(n);t.delete(l)},a=()=>{t.forEach(l=>o(l)),e.clear()};return new Proxy({},{get(l,u){return u==="addTarget"?r:u==="removeTarget"?o:u==="destroy"?a:typeof u!="string"||u.startsWith("_")?l[u]:(e.has(u)||i(u),e.get(u))}})}class X1{constructor(e,t){if(this.destructed=!1,this.events={destruct:new zt(this)},!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Ci(),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 zO{constructor(e,t){if(!e||!t)throw new Error("Cannot initialize connection with null/undefined for 'from' or 'to' values");this.id=Ci(),this.from=e,this.to=t}}function Kg(n,e){return Object.fromEntries(Object.entries(n).map(([t,s])=>[t,e(s)]))}class HO{constructor(){this._title="",this.id=Ci(),this.events={loaded:new zt(this),beforeAddInput:new In(this),addInput:new zt(this),beforeRemoveInput:new In(this),removeInput:new zt(this),beforeAddOutput:new In(this),addOutput:new zt(this),beforeRemoveOutput:new In(this),removeOutput:new zt(this),beforeTitleChanged:new In(this),titleChanged:new zt(this),update:new zt(this)},this.hooks={beforeLoad:new es(this),afterSave:new es(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,s])=>{this.inputs[t]&&(this.inputs[t].load(s),this.inputs[t].nodeId=this.id)}),Object.entries(e.outputs).forEach(([t,s])=>{this.outputs[t]&&(this.outputs[t].load(s),this.outputs[t].nodeId=this.id)}),this.events.loaded.emit(this)}save(){const e=Kg(this.inputs,i=>i.save()),t=Kg(this.outputs,i=>i.save()),s={type:this.type,id:this.id,title:this.title,inputs:e,outputs:t};return this.hooks.afterSave.execute(s)}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,s){s.isInput=e==="input",s.nodeId=this.id,s.events.setValue.subscribe(this,()=>this.events.update.emit({type:e,name:t,intf:s}))}addInterface(e,t,s){const i=e==="input"?this.events.beforeAddInput:this.events.beforeAddOutput,r=e===
2024-07-18 22:38:03 +00:00
This is likely a Baklava internal issue. Please report it on GitHub.`);const _=this.hooks.transferData.execute(u[f],d);d.to.allowMultipleConnections?t.has(d.to.id)?t.get(d.to.id).push(_):t.set(d.to.id,[_]):t.set(d.to.id,_)})}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 s of e.nodes)Object.values(s.inputs).forEach(i=>{i.connectionCount===0&&t.set(i.id,i.value)}),s.calculate||Object.values(s.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}
2024-07-29 22:02:24 +00:00
This is likely a Baklava internal issue. Please report it on GitHub.`);return e.get(t)}}let jg=null;function W2t(n){jg=n}function ys(){if(!jg)throw new Error("providePlugin() must be called before usePlugin()");return{viewModel:jg}}function Fs(){const{viewModel:n}=ys();return{graph:Cd(n.value,"displayedGraph"),switchGraph:n.value.switchGraph}}function QO(n){const{graph:e}=Fs(),t=lt(null),s=lt(null);return{dragging:et(()=>!!t.value),onPointerDown:l=>{t.value={x:l.pageX,y:l.pageY},s.value={x:n.value.x,y:n.value.y}},onPointerMove:l=>{if(t.value){const u=l.pageX-t.value.x,d=l.pageY-t.value.y;n.value.x=s.value.x+u/e.value.scaling,n.value.y=s.value.y+d/e.value.scaling}},onPointerUp:()=>{t.value=null,s.value=null}}}function XO(n,e,t){if(!e.template)return!1;if(Ea(e.template)===t)return!0;const s=n.graphTemplates.find(r=>Ea(r)===t);return s?s.nodes.filter(r=>r.type.startsWith(Vl)).some(r=>XO(n,e,r.type)):!1}function ZO(n){return et(()=>{const e=Array.from(n.value.editor.nodeTypes.entries()),t=new Set(e.map(([,i])=>i.category)),s=[];for(const i of t.values()){let r=e.filter(([,o])=>o.category===i);n.value.displayedGraph.template?r=r.filter(([o])=>!XO(n.value.editor,n.value.displayedGraph,o)):r=r.filter(([o])=>![ga,ba].includes(o)),r.length>0&&s.push({name:i,nodeTypes:Object.fromEntries(r)})}return s.sort((i,r)=>i.name==="default"?-1:r.name==="default"||i.name>r.name?1:-1),s})}function JO(){const{graph:n}=Fs();return{transform:(t,s)=>{const i=t/n.value.scaling-n.value.panning.x,r=s/n.value.scaling-n.value.panning.y;return[i,r]}}}function K2t(){const{graph:n}=Fs();let e=[],t=-1,s={x:0,y:0};const i=et(()=>n.value.panning),r=QO(i),o=et(()=>({"transform-origin":"0 0",transform:`scale(${n.value.scaling}) translate(${n.value.panning.x}px, ${n.value.panning.y}px)`})),a=(_,m,E)=>{const b=[_/n.value.scaling-n.value.panning.x,m/n.value.scaling-n.value.panning.y],g=[_/E-n.value.panning.x,m/E-n.value.panning.y],y=[g[0]-b[0],g[1]-b[1]];n.value.panning.x+=y[0],n.value.panning.y+=y[1],n.value.scaling=E},l=_=>{_.preventDefault();let m=_.deltaY;_.deltaMode===1&&(m*=32);const E=n.value.scaling*(1-m/3e3);a(_.offsetX,_.offsetY,E)},u=()=>({ax:e[0].clientX,ay:e[0].clientY,bx:e[1].clientX,by:e[1].clientY});return{styles:o,...r,onPointerDown:_=>{if(e.push(_),r.onPointerDown(_),e.length===2){const{ax:m,ay:E,bx:b,by:g}=u();s={x:m+(b-m)/2,y:E+(g-E)/2}}},onPointerMove:_=>{for(let m=0;m<e.length;m++)if(_.pointerId==e[m].pointerId){e[m]=_;break}if(e.length==2){const{ax:m,ay:E,bx:b,by:g}=u(),y=m-b,v=E-g,S=Math.sqrt(y*y+v*v);if(t>0){const w=n.value.scaling*(1+(S-t)/500);a(s.x,s.y,w)}t=S}else r.onPointerMove(_)},onPointerUp:_=>{e=e.filter(m=>m.pointerId!==_.pointerId),t=-1,r.onPointerUp()},onMouseWheel:l}}var ds=(n=>(n[n.NONE=0]="NONE",n[n.ALLOWED=1]="ALLOWED",n[n.FORBIDDEN=2]="FORBIDDEN",n))(ds||{});const eI=Symbol();function j2t(){const{graph:n}=Fs(),e=lt(null),t=lt(null),s=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:ds.NONE,from:a.from},n.value.removeConnection(a)):e.value={status:ds.NONE,from:t.value},e.value.mx=void 0,e.value.my=void 0}},r=()=>{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?ds.ALLOWED:ds.FORBIDDEN,l.connectionAllowed){const u=l.connectionsInDanger.map(d=>d.id);n.value.connections.forEach(d=>{u.includes(d.id)&&(d.isInDanger=!0)})}}else!a&&e.value&&(e.value.to=void 0,e.value.status=ds.NONE,n.value.connections.forEach(l=>{l.isInDanger=!1}))};return zo(eI,{temporaryConnection:e,hoveredOver:o}),{temporaryConnection:e,onMouseMove:s,onMouseDown:i,onMouseUp:r,hoveredOver:o}}function Q2t(n){const e=lt(!1),t=lt(0),s=lt(0),i=ZO(n),{transform:r}=JO(),o=et(()=>{let d=[];const h={};for(const _ of i.value){const m=Object.entries(_.nodeTypes).m