lollms-webui/web/dist/assets/index-86f0c808.js

193 lines
1.8 MiB
JavaScript
Raw Normal View History

2023-12-04 00:40:36 +00:00
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function y_(t,e){const n=Object.create(null),r=t.split(",");for(let s=0;s<r.length;s++)n[r[s]]=!0;return e?s=>!!n[s.toLowerCase()]:s=>!!n[s]}const et={},Pr=[],Bt=()=>{},_C=()=>!1,pC=/^on[^a-z]/,Ti=t=>pC.test(t),v_=t=>t.startsWith("onUpdate:"),ot=Object.assign,T_=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},mC=Object.prototype.hasOwnProperty,ze=(t,e)=>mC.call(t,e),Ie=Array.isArray,Fr=t=>os(t)==="[object Map]",ss=t=>os(t)==="[object Set]",Jp=t=>os(t)==="[object Date]",gC=t=>os(t)==="[object RegExp]",Me=t=>typeof t=="function",rt=t=>typeof t=="string",Fs=t=>typeof t=="symbol",je=t=>t!==null&&typeof t=="object",hS=t=>je(t)&&Me(t.then)&&Me(t.catch),ES=Object.prototype.toString,os=t=>ES.call(t),fC=t=>os(t).slice(8,-1),bS=t=>os(t)==="[object Object]",C_=t=>rt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Yo=y_(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ci=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},hC=/-(\w)/g,nn=Ci(t=>t.replace(hC,(e,n)=>n?n.toUpperCase():"")),EC=/\B([A-Z])/g,fr=Ci(t=>t.replace(EC,"-$1").toLowerCase()),Ri=Ci(t=>t.charAt(0).toUpperCase()+t.slice(1)),Ta=Ci(t=>t?`on${Ri(t)}`:""),Us=(t,e)=>!Object.is(t,e),Ur=(t,e)=>{for(let n=0;n<t.length;n++)t[n](e)},ei=(t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})},ti=t=>{const e=parseFloat(t);return isNaN(e)?t:e},bC=t=>{const e=rt(t)?Number(t):NaN;return isNaN(e)?t:e};let em;const Lu=()=>em||(em=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ht(t){if(Ie(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],s=rt(r)?TC(r):ht(r);if(s)for(const o in s)e[o]=s[o]}return e}else{if(rt(t))return t;if(je(t))return t}}const SC=/;(?![^(]*\))/g,yC=/:([^]+)/,vC=/\/\*[^]*?\*\//g;function TC(t){const e={};return t.replace(vC,"").split(SC).forEach(n=>{if(n){const r=n.split(yC);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function Ne(t){let e="";if(rt(t))e=t;else if(Ie(t))for(let n=0;n<t.length;n++){const r=Ne(t[n]);r&&(e+=r+" ")}else if(je(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const CC="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",RC=y_(CC);function SS(t){return!!t||t===""}function xC(t,e){if(t.length!==e.length)return!1;let n=!0;for(let r=0;n&&r<t.length;r++)n=_r(t[r],e[r]);return n}function _r(t,e){if(t===e)return!0;let n=Jp(t),r=Jp(e);if(n||r)return n&&r?t.getTime()===e.getTime():!1;if(n=Fs(t),r=Fs(e),n||r)return t===e;if(n=Ie(t),r=Ie(e),n||r)return n&&r?xC(t,e):!1;if(n=je(t),r=je(e),n||r){if(!n||!r)return!1;const s=Object.keys(t).length,o=Object.keys(e).length;if(s!==o)return!1;for(const i in t){const a=t.hasOwnProperty(i),l=e.hasOwnProperty(i);if(a&&!l||!a&&l||!_r(t[i],e[i]))return!1}}return String(t)===String(e)}function R_(t,e){return t.findIndex(n=>_r(n,e))}const j=t=>rt(t)?t:t==null?"":Ie(t)||je(t)&&(t.toString===ES||!Me(t.toString))?JSON.stringify(t,yS,2):String(t),yS=(t,e)=>e&&e.__v_isRef?yS(t,e.value):Fr(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[r,s])=>(n[`${r} =>`]=s,n),{})}:ss(e)?{[`Set(${e.size})`]:[...e.values()]}:je(e)&&!Ie(e)&&!bS(e)?String(e):e;let Lt;class vS{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Lt,!e&&Lt&&(this.index=(Lt.scopes||(Lt.scopes=[])).pus
2023-11-09 23:31:56 +00:00
* vuex v4.1.0
* (c) 2022 Evan You
* @license MIT
2023-12-04 00:40:36 +00:00
*/var X1="store";function ls(t,e){Object.keys(t).forEach(function(n){return e(t[n],n)})}function J1(t){return t!==null&&typeof t=="object"}function eR(t){return t&&typeof t.then=="function"}function tR(t,e){return function(){return t(e)}}function xy(t,e,n){return e.indexOf(t)<0&&(n&&n.prepend?e.unshift(t):e.push(t)),function(){var r=e.indexOf(t);r>-1&&e.splice(r,1)}}function Oy(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var n=t.state;Li(t,n,[],t._modules.root,!0),$_(t,n,e)}function $_(t,e,n){var r=t._state,s=t._scope;t.getters={},t._makeLocalGettersCache=Object.create(null);var o=t._wrappedGetters,i={},a={},l=OC(!0);l.run(function(){ls(o,function(u,d){i[d]=tR(u,t),a[d]=Ot(function(){return i[d]()}),Object.defineProperty(t.getters,d,{get:function(){return a[d].value},enumerable:!0})})}),t._state=eo({data:e}),t._scope=l,t.strict&&iR(t),r&&n&&t._withCommit(function(){r.data=null}),s&&s.stop()}function Li(t,e,n,r,s){var o=!n.length,i=t._modules.getNamespace(n);if(r.namespaced&&(t._modulesNamespaceMap[i],t._modulesNamespaceMap[i]=r),!o&&!s){var a=W_(e,n.slice(0,-1)),l=n[n.length-1];t._withCommit(function(){a[l]=r.state})}var u=r.context=nR(t,i,n);r.forEachMutation(function(d,_){var p=i+_;rR(t,p,d,u)}),r.forEachAction(function(d,_){var p=d.root?_:i+_,g=d.handler||d;sR(t,p,g,u)}),r.forEachGetter(function(d,_){var p=i+_;oR(t,p,d,u)}),r.forEachChild(function(d,_){Li(t,e,n.concat(_),d,s)})}function nR(t,e,n){var r=e==="",s={dispatch:r?t.dispatch:function(o,i,a){var l=ii(o,i,a),u=l.payload,d=l.options,_=l.type;return(!d||!d.root)&&(_=e+_),t.dispatch(_,u)},commit:r?t.commit:function(o,i,a){var l=ii(o,i,a),u=l.payload,d=l.options,_=l.type;(!d||!d.root)&&(_=e+_),t.commit(_,u,d)}};return Object.defineProperties(s,{getters:{get:r?function(){return t.getters}:function(){return Ay(t,e)}},state:{get:function(){return W_(t.state,n)}}}),s}function Ay(t,e){if(!t._makeLocalGettersCache[e]){var n={},r=e.length;Object.keys(t.getters).forEach(function(s){if(s.slice(0,r)===e){var o=s.slice(r);Object.defineProperty(n,o,{get:function(){return t.getters[s]},enumerable:!0})}}),t._makeLocalGettersCache[e]=n}return t._makeLocalGettersCache[e]}function rR(t,e,n,r){var s=t._mutations[e]||(t._mutations[e]=[]);s.push(function(i){n.call(t,r.state,i)})}function sR(t,e,n,r){var s=t._actions[e]||(t._actions[e]=[]);s.push(function(i){var a=n.call(t,{dispatch:r.dispatch,commit:r.commit,getters:r.getters,state:r.state,rootGetters:t.getters,rootState:t.state},i);return eR(a)||(a=Promise.resolve(a)),t._devtoolHook?a.catch(function(l){throw t._devtoolHook.emit("vuex:error",l),l}):a})}function oR(t,e,n,r){t._wrappedGetters[e]||(t._wrappedGetters[e]=function(o){return n(r.state,r.getters,o.state,o.getters)})}function iR(t){zn(function(){return t._state.data},function(){},{deep:!0,flush:"sync"})}function W_(t,e){return e.reduce(function(n,r){return n[r]},t)}function ii(t,e,n){return J1(t)&&t.type&&(n=e,e=t,t=t.type),{type:t,payload:e,options:n}}var aR="vuex bindings",Bm="vuex:mutations",Da="vuex:actions",Ar="vuex",lR=0;function cR(t,e){Z1({id:"org.vuejs.vuex",app:t,label:"Vuex",homepage:"https://next.vuex.vuejs.org/",logo:"https://vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:[aR]},function(n){n.addTimelineLayer({id:Bm,label:"Vuex Mutations",color:Gm}),n.addTimelineLayer({id:Da,label:"Vuex Actions",color:Gm}),n.addInspector({id:Ar,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),n.on.getInspectorTree(function(r){if(r.app===t&&r.inspectorId===Ar)if(r.filter){var s=[];Dy(s,e._modules.root,r.filter,""),r.rootNodes=s}else r.rootNodes=[Iy(e._modules.root,"")]}),n.on.getInspectorState(function(r){if(r.app===t&&r.inspectorId===Ar){var s=r.nodeId;Ay(e,s),r.state=_R(mR(e._modules,s),s==="root"?e.getters:e._makeLocalGettersCache,s)}}),n.on.editInspectorState(function(r){if(r.app===t&&r.inspectorId===Ar){var s=r.nodeId,o=r.path;s!=="root"&&(o=s.split("/").filter(Boolean).concat(o)),e._withCommit(function(){r.set(e._st
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||e[n]&&dx[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},$m=Symbol("internals");function bs(t){return t&&String(t).trim().toLowerCase()}function Wo(t){return t===!1||t==null?t:de.isArray(t)?t.map(Wo):String(t)}function _x(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const px=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ma(t,e,n,r,s){if(de.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!de.isString(e)){if(de.isString(r))return e.indexOf(r)!==-1;if(de.isRegExp(r))return r.test(e)}}function mx(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function gx(t,e){const n=de.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,o,i){return this[r].call(this,e,s,o,i)},configurable:!0})})}class Gi{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function o(a,l,u){const d=bs(l);if(!d)throw new Error("header name must be a non-empty string");const _=de.findKey(s,d);(!_||s[_]===void 0||u===!0||u===void 0&&s[_]!==!1)&&(s[_||l]=Wo(a))}const i=(a,l)=>de.forEach(a,(u,d)=>o(u,d,l));return de.isPlainObject(e)||e instanceof this.constructor?i(e,n):de.isString(e)&&(e=e.trim())&&!px(e)?i(ux(e),n):e!=null&&o(n,e,r),this}get(e,n){if(e=bs(e),e){const r=de.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return _x(s);if(de.isFunction(n))return n.call(this,s,r);if(de.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=bs(e),e){const r=de.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Ma(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function o(i){if(i=bs(i),i){const a=de.findKey(r,i);a&&(!n||Ma(r,r[a],a,n))&&(delete r[a],s=!0)}}return de.isArray(e)?e.forEach(o):o(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!e||Ma(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){const n=this,r={};return de.forEach(this,(s,o)=>{const i=de.findKey(r,o);if(i){n[i]=Wo(s),delete n[o];return}const a=e?mx(o):String(o).trim();a!==o&&delete n[o],n[a]=Wo(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return de.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&de.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[$m]=this[$m]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=bs(i);r[a]||(gx(s,i),r[a]=!0)}return de.isArray(e)?e.forEach(o):o(e),this}}Gi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);de.reduceDescriptors(Gi.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});de.freezeMethods(Gi);const hn=Gi;function La(t,e){const n=this||X_,r=e||n,s=hn.from(r.headers);let o=r.data;return de.forEach(t,function(a){o=a.call(n,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function jy(t){return!!(t&&t.__CANCEL__)}function ro(t,e,n){Ve.call(this,t??"canceled",Ve.ERR_CANCELED,e,n),this.name="CanceledError"}de.inherits(ro,Ve,{__CANCEL__:!0});function fx(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Ve("Request failed with status code "+n.status,[Ve.ERR_BAD_REQUEST,Ve.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const hx=jt.isStandardBrowserEnv?function(){return{write:function(n,r,s,o,i,a){const l=[];l.push(n+"="+encodeURIComponent(r)),de.isNumber(s)&&l.push("expires="+new Date(s).toGMTString()),de.isString(o)&&l.push("path="+o),de.isString(i)&&l.push("domain="+i),a===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(n){const r=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function Ex(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function bx(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function Zy(t,e){return t&&!Ex(e)?bx(t,e):e}const Sx=jt.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function s(o){let i=o;return e&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=s(window.location.href),function(i){const a=de.isString(i)?s(i):i;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function yx(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function vx(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(l){const u=Date.now(),d=r[o];i||(i=u),n[s]=l,r[s]=u;let _=o,p=0;for(;_!==s;)p+=n[_++],_=_%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),u-i<e)return;const g=d&&u-d;return g?Math.round(p*1e3/g):void 0}}function Wm(t,e){let n=0;const r=vx(50,250);return s=>{const o=s.loaded,i=s.lengthComputable?s.total:void 0,a=o-n,l=r(a),u=o<=i;n=o;const d={loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:l||void 0,estimated:l&&i&&u?(i-o)/l:void 0,event:s};d[e?"download":"upload"]=!0,t(d)}}const Tx=typeof XMLHttpRequest<"u",Cx=Tx&&function(t){return new Promise(function(n,r){let s=t.data;const o=hn.from(t.headers).normalize(),i=t.responseType;let a;function l(){t.cancelToken&&t.cancelToken.unsubscribe(a),t.signal&&t.signal.removeEventListener("abort",a)}let u;de.isFormData(s)&&(jt.isStandardBrowserEnv||jt.isStandardBrowserWebWorkerEnv?o.setContentType(!1):o.getContentType(/^\s*multipart\/form-data/)?de.isString(u=o.getContentType())&&o.setContentType(u.replace(/^\s*(multipart\/form-data);+/,"$1")):o.setContentType("multipart/form-data"));let d=new XMLHttpRequest;if(t.auth){const f=t.auth.username||"",h=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.set("Authorization","Basic "+btoa(f+":"+h))}const _=Zy(t.baseURL,t.url);d.open(t.method.toUpperCase(),Wy(_,t.params,t.paramsSerializer),!0),d
`+o.map(Km).join(`
`):" "+Km(o[0]):"as no adapter specified";throw new Ve("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:Ju};function Pa(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ro(null,t)}function Qm(t){return Pa(t),t.headers=hn.from(t.headers),t.data=La.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Xy.getAdapter(t.adapter||X_.adapter)(t).then(function(r){return Pa(t),r.data=La.call(t,t.transformResponse,r),r.headers=hn.from(r.headers),r},function(r){return jy(r)||(Pa(t),r&&r.response&&(r.response.data=La.call(t,t.transformResponse,r.response),r.response.headers=hn.from(r.response.headers))),Promise.reject(r)})}const jm=t=>t instanceof hn?t.toJSON():t;function Qr(t,e){e=e||{};const n={};function r(u,d,_){return de.isPlainObject(u)&&de.isPlainObject(d)?de.merge.call({caseless:_},u,d):de.isPlainObject(d)?de.merge({},d):de.isArray(d)?d.slice():d}function s(u,d,_){if(de.isUndefined(d)){if(!de.isUndefined(u))return r(void 0,u,_)}else return r(u,d,_)}function o(u,d){if(!de.isUndefined(d))return r(void 0,d)}function i(u,d){if(de.isUndefined(d)){if(!de.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function a(u,d,_){if(_ in e)return r(u,d);if(_ in t)return r(void 0,u)}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,d)=>s(jm(u),jm(d),!0)};return de.forEach(Object.keys(Object.assign({},t,e)),function(d){const _=l[d]||s,p=_(t[d],e[d],d);de.isUndefined(p)&&_!==a||(n[d]=p)}),n}const Jy="1.5.1",J_={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{J_[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Zm={};J_.transitional=function(e,n,r){function s(o,i){return"[Axios v"+Jy+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,a)=>{if(e===!1)throw new Ve(s(i," has been removed"+(n?" in "+n:"")),Ve.ERR_DEPRECATED);return n&&!Zm[i]&&(Zm[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,i,a):!0}};function xx(t,e,n){if(typeof t!="object")throw new Ve("options must be an object",Ve.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const o=r[s],i=e[o];if(i){const a=t[o],l=a===void 0||i(a,o,t);if(l!==!0)throw new Ve("option "+o+" must be "+l,Ve.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ve("Unknown option "+o,Ve.ERR_BAD_OPTION)}}const e_={assertOptions:xx,validators:J_},wn=e_.validators;class ai{constructor(e){this.defaults=e,this.interceptors={request:new Hm,response:new Hm}}request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Qr(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&e_.assertOptions(r,{silentJSONParsing:wn.transitional(wn.boolean),forcedJSONParsing:wn.transitional(wn.boolean),clarifyTimeoutError:wn.transitional(wn.boolean)},!1),s!=null&&(de.isFunction(s)?n.paramsSerializer={serialize:s}:e_.assertOptions(s,{encode:wn.function,serialize:wn.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&de.merge(o.common,o[n.method]);o&&de.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),n.headers=hn.concat(i,o);const a=[];let l=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(l=l&&h.synchronous,a.unshift(h.fulfilled,h.rejected))});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,_=0,p;if(!l){const f=[Qm.bind(this),void 0];for(f.unshift.apply(f,a),f.push.apply(f,u),p=f.length,d=Promise.resolve(n);_<p;)d=d.then(f[_++],f[_++]);return d}p=a.length;let g=n;for(_=0;_<p;
2023-11-09 23:31:56 +00:00
* vue-router v4.2.5
* (c) 2023 Eduardo San Martin Morote
* @license MIT
2023-12-04 00:40:36 +00:00
*/const Dr=typeof window<"u";function Ix(t){return t.__esModule||t[Symbol.toStringTag]==="Module"}const Ke=Object.assign;function Fa(t,e){const n={};for(const r in e){const s=e[r];n[r]=Gt(s)?s.map(t):t(s)}return n}const Is=()=>{},Gt=Array.isArray,Dx=/\/$/,kx=t=>t.replace(Dx,"");function Ua(t,e,n="/"){let r,s={},o="",i="";const a=e.indexOf("#");let l=e.indexOf("?");return a<l&&a>=0&&(l=-1),l>-1&&(r=e.slice(0,l),o=e.slice(l+1,a>-1?a:e.length),s=t(o)),a>-1&&(r=r||e.slice(0,a),i=e.slice(a,e.length)),r=Fx(r??e,n),{fullPath:r+(o&&"?")+o+i,path:r,query:s,hash:i}}function Mx(t,e){const n=e.query?t(e.query):"";return e.path+(n&&"?")+n+(e.hash||"")}function Xm(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function Lx(t,e,n){const r=e.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&jr(e.matched[r],n.matched[s])&&tv(e.params,n.params)&&t(e.query)===t(n.query)&&e.hash===n.hash}function jr(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function tv(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(!Px(t[n],e[n]))return!1;return!0}function Px(t,e){return Gt(t)?Jm(t,e):Gt(e)?Jm(e,t):t===e}function Jm(t,e){return Gt(e)?t.length===e.length&&t.every((n,r)=>n===e[r]):t.length===1&&t[0]===e}function Fx(t,e){if(t.startsWith("/"))return t;if(!t)return e;const n=e.split("/"),r=t.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let o=n.length-1,i,a;for(i=0;i<r.length;i++)if(a=r[i],a!==".")if(a==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i-(i===r.length?1:0)).join("/")}var Ws;(function(t){t.pop="pop",t.push="push"})(Ws||(Ws={}));var Ds;(function(t){t.back="back",t.forward="forward",t.unknown=""})(Ds||(Ds={}));function Ux(t){if(!t)if(Dr){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),kx(t)}const Bx=/^[^#]+#/;function Gx(t,e){return t.replace(Bx,"#")+e}function qx(t,e){const n=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{behavior:e.behavior,left:r.left-n.left-(e.left||0),top:r.top-n.top-(e.top||0)}}const qi=()=>({left:window.pageXOffset,top:window.pageYOffset});function Yx(t){let e;if("el"in t){const n=t.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;e=qx(s,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.pageXOffset,e.top!=null?e.top:window.pageYOffset)}function eg(t,e){return(history.state?history.state.position-e:-1)+t}const n_=new Map;function Vx(t,e){n_.set(t,e)}function zx(t){const e=n_.get(t);return n_.delete(t),e}let Hx=()=>location.protocol+"//"+location.host;function nv(t,e){const{pathname:n,search:r,hash:s}=e,o=t.indexOf("#");if(o>-1){let a=s.includes(t.slice(o))?t.slice(o).length:1,l=s.slice(a);return l[0]!=="/"&&(l="/"+l),Xm(l,"")}return Xm(n,t)+r+s}function $x(t,e,n,r){let s=[],o=[],i=null;const a=({state:p})=>{const g=nv(t,location),f=n.value,h=e.value;let E=0;if(p){if(n.value=g,e.value=p,i&&i===f){i=null;return}E=h?p.position-h.position:0}else r(g);s.forEach(b=>{b(n.value,f,{delta:E,type:Ws.pop,direction:E?E>0?Ds.forward:Ds.back:Ds.unknown})})};function l(){i=n.value}function u(p){s.push(p);const g=()=>{const f=s.indexOf(p);f>-1&&s.splice(f,1)};return o.push(g),g}function d(){const{history:p}=window;p.state&&p.replaceState(Ke({},p.state,{scroll:qi()}),"")}function _(){for(const p of o)p();o=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",d)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",d,{passive:!0}),{pauseListeners:l,listen:u,destroy:_}}function tg(t,e,n,r=!1,s=!1){return{back:t,current:e,forward:n,replaced:r,position:window.history.length,scroll:s?qi():null}}function Wx(t){const{history:e,location:n}=window,r={value:nv(t,n)},s={value:e.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:e.length-1,replace
2023-11-09 23:31:56 +00:00
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
2023-12-04 00:40:36 +00:00
*/(function(){var a=function(){function l(){}l.prototype=Object.create(null);function u(b,m){for(var S=m.length,T=0;T<S;++T)h(b,m[T])}var d={}.hasOwnProperty;function _(b,m){b[m]=!0}function p(b,m){for(var S in m)d.call(m,S)&&(b[S]=!!m[S])}var g=/\s+/;function f(b,m){for(var S=m.split(g),T=S.length,A=0;A<T;++A)b[S[A]]=!0}function h(b,m){if(m){var S=typeof m;S==="string"?f(b,m):Array.isArray(m)?u(b,m):S==="object"?p(b,m):S==="number"&&_(b,m)}}function E(){for(var b=arguments.length,m=Array(b),S=0;S<b;S++)m[S]=arguments[S];var T=new l;u(T,m);var A=[];for(var x in T)T[x]&&A.push(x);return A.join(" ")}return E}();typeof n<"u"&&n.exports?n.exports=a:(o=[],i=(function(){return a}).apply(r,o),i!==void 0&&(n.exports=i))})()},"./node_modules/core-js/es/array/from.js":function(n,r,s){s("./node_modules/core-js/modules/es.string.iterator.js"),s("./node_modules/core-js/modules/es.array.from.js");var o=s("./node_modules/core-js/internals/path.js");n.exports=o.Array.from},"./node_modules/core-js/internals/a-function.js":function(n,r){n.exports=function(s){if(typeof s!="function")throw TypeError(String(s)+" is not a function");return s}},"./node_modules/core-js/internals/an-object.js":function(n,r,s){var o=s("./node_modules/core-js/internals/is-object.js");n.exports=function(i){if(!o(i))throw TypeError(String(i)+" is not an object");return i}},"./node_modules/core-js/internals/array-from.js":function(n,r,s){var o=s("./node_modules/core-js/internals/bind-context.js"),i=s("./node_modules/core-js/internals/to-object.js"),a=s("./node_modules/core-js/internals/call-with-safe-iteration-closing.js"),l=s("./node_modules/core-js/internals/is-array-iterator-method.js"),u=s("./node_modules/core-js/internals/to-length.js"),d=s("./node_modules/core-js/internals/create-property.js"),_=s("./node_modules/core-js/internals/get-iterator-method.js");n.exports=function(g){var f=i(g),h=typeof this=="function"?this:Array,E=arguments.length,b=E>1?arguments[1]:void 0,m=b!==void 0,S=0,T=_(f),A,x,k,y;if(m&&(b=o(b,E>2?arguments[2]:void 0,2)),T!=null&&!(h==Array&&l(T)))for(y=T.call(f),x=new h;!(k=y.next()).done;S++)d(x,S,m?a(y,b,[k.value,S],!0):k.value);else for(A=u(f.length),x=new h(A);A>S;S++)d(x,S,m?b(f[S],S):f[S]);return x.length=S,x}},"./node_modules/core-js/internals/array-includes.js":function(n,r,s){var o=s("./node_modules/core-js/internals/to-indexed-object.js"),i=s("./node_modules/core-js/internals/to-length.js"),a=s("./node_modules/core-js/internals/to-absolute-index.js");n.exports=function(l){return function(u,d,_){var p=o(u),g=i(p.length),f=a(_,g),h;if(l&&d!=d){for(;g>f;)if(h=p[f++],h!=h)return!0}else for(;g>f;f++)if((l||f in p)&&p[f]===d)return l||f||0;return!l&&-1}}},"./node_modules/core-js/internals/bind-context.js":function(n,r,s){var o=s("./node_modules/core-js/internals/a-function.js");n.exports=function(i,a,l){if(o(i),a===void 0)return i;switch(l){case 0:return function(){return i.call(a)};case 1:return function(u){return i.call(a,u)};case 2:return function(u,d){return i.call(a,u,d)};case 3:return function(u,d,_){return i.call(a,u,d,_)}}return function(){return i.apply(a,arguments)}}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(n,r,s){var o=s("./node_modules/core-js/internals/an-object.js");n.exports=function(i,a,l,u){try{return u?a(o(l)[0],l[1]):a(l)}catch(_){var d=i.return;throw d!==void 0&&o(d.call(i)),_}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(n,r,s){var o=s("./node_modules/core-js/internals/well-known-symbol.js"),i=o("iterator"),a=!1;try{var l=0,u={next:function(){return{done:!!l++}},return:function(){a=!0}};u[i]=function(){return this},Array.from(u,function(){throw 2})}catch{}n.exports=function(d,_){if(!_&&!a)return!1;var p=!1;try{var g={};g[i]=function(){return{next:function(){return{done:p=!0}}}},d(g)}catch{}return p}},"./node_modules/core-js/internals/classof-raw.js":function(n,r){var s={}.toString;n.exports=function(o){return s.call(o).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":function(n,r,s){var o=s("./node_modules/core-js/internals/classof
2023-12-06 00:28:13 +00:00
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),iA=[oA],aA=c("i",{"data-feather":"sun"},null,-1),lA=[aA],cA=c("i",{"data-feather":"moon"},null,-1),dA=[cA],uA=c("body",null,null,-1),_A={name:"TopBar",computed:{isGenerating(){return this.$store.state.isGenerating},isConnected(){return this.$store.state.isConnected}},watch:{isConnected(){ve(()=>{Ce.replace()})}},data(){return{codeBlockStylesheet:"",sunIcon:document.querySelector(".sun"),moonIcon:document.querySelector(".moon"),userTheme:localStorage.getItem("theme"),systemTheme:window.matchMedia("prefers-color-scheme: dark").matches}},mounted(){this.sunIcon=document.querySelector(".sun"),this.moonIcon=document.querySelector(".moon"),this.userTheme=localStorage.getItem("theme"),this.systemTheme=window.matchMedia("prefers-color-scheme: dark").matches,this.themeCheck(),ve(()=>{Ce.replace()})},created(){this.sunIcon=document.querySelector(".sun"),this.moonIcon=document.querySelector(".moon"),this.userTheme=localStorage.getItem("theme"),this.systemTheme=window.matchMedia("prefers-color-scheme: dark").matches},methods:{themeCheck(){if(this.userTheme=="dark"||!this.userTheme&&this.systemTheme){document.documentElement.classList.add("dark"),this.moonIcon.classList.add("display-none"),ve(()=>{Ga(()=>Promise.resolve({}),["assets/stackoverflow-dark-57af98f5.css"])});return}ve(()=>{Ga(()=>Promise.resolve({}),["assets/stackoverflow-light-077a2b3c.css"])}),this.sunIcon.classList.add("display-none")},themeSwitch(){if(document.documentElement.classList.contains("dark")){document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"),this.userTheme=="light",this.iconToggle();return}Ga(()=>Promise.resolve({}),["assets/tokyo-night-dark-f9656fc4.css"]),document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark"),this.userTheme=="dark",this.iconToggle()},iconToggle(){this.sunIcon.classList.toggle("display-none"),this.moonIcon.classList.toggle("display-none")}},components:{Navigation:gv}},pA=Object.assign(_A,{setup(t){return(e,n)=>(v(),C(we,null,[c("header",BO,[c("nav",GO,[fe(ct(pn),{to:{name:"discussions"}},{default:ke(()=>[qO]),_:1}),c("div",YO,[e.isGenerating?U("",!0):(v(),C("div",VO,HO)),e.isGenerating?(v(),C("div",$O,KO)):U("",!0),e.isConnected?(v(),C("div",QO,ZO)):U("",!0),e.isConnected?U("",!0):(v(),C("div",XO,eA)),tA,c("a",nA,[c("div",rA,[(v(),C("svg",sA,iA))])]),c("div",{class:"sun text-2xl w-6 hover:text-primary duration-150",title:"Swith to Light theme",onClick:n[0]||(n[0]=r=>e.themeSwitch())},lA),c("div",{class:"moon text-2xl w-6 hover:text-primary duration-150",title:"Swith to Dark theme",onClick:n[1]||(n[1]=r=>e.themeSwitch())},dA)])]),fe(gv)]),uA],64))}}),mA={class:"flex flex-col h-screen font-sans bg-bg-light text-slate-950 dark:bg-bg-dark dark:text-slate-50 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"},gA={class:"flex overflow-hidden flex-grow"},fA={__name:"App",setup(t){return(e,n)=>(v(),C("div",mA,[fe(pA),c("div",gA,[fe(ct(_v),null,{default:ke(({Component:r})=>[(v(),st(v0,null,[(v(),st(D0(r)))],1024))]),_:1})])]))}},rn=Object.create(null);rn.open="0";rn.close="1";rn.ping="2";rn.pong="3";rn.message="4";rn.upgrade="5";rn.noop="6";const Qo=Object.create(null);Object.keys(rn).forEach(t=>{Qo[rn[t]]=t});const o_={type:"error",data:"parser error"},fv=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",hv=typeof ArrayBuffer=="function",Ev=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,rp=({type:t,data:e},n,r)=>fv&&e instanceof Blob?n?r(e):gg(e,r):hv&&(e instanceof ArrayBuffer||Ev(e))?n?r(e):gg(new Blob([e]),r):r(rn[t]+(e||"")),gg=(t,e)=>{const n=new FileReader;return n.onload=function(){const r
`,sY="∄",oY="∄",iY="𝔑",aY="𝔫",lY="≧̸",cY="≱",dY="≱",uY="≧̸",_Y="⩾̸",pY="⩾̸",mY="⋙̸",gY="≵",fY="≫⃒",hY="≯",EY="≯",bY="≫̸",SY="↮",yY="⇎",vY="⫲",TY="∋",CY="⋼",RY="⋺",xY="∋",OY="Њ",AY="њ",NY="↚",wY="⇍",IY="‥",DY="≦̸",kY="≰",MY="↚",LY="⇍",PY="↮",FY="⇎",UY="≰",BY="≦̸",GY="⩽̸",qY="⩽̸",YY="≮",VY="⋘̸",zY="≴",HY="≪⃒",$Y="≮",WY="⋪",KY="⋬",QY="≪̸",jY="∤",ZY="",XY=" ",JY="𝕟",eV="",tV="⫬",nV="¬",rV="≢",sV="≭",oV="∦",iV="∉",aV="≠",lV="≂̸",cV="∄",dV="≯",uV="≱",_V="≧̸",pV="≫̸",mV="≹",gV="⩾̸",fV="≵",hV="≎̸",EV="≏̸",bV="∉",SV="⋵̸",yV="⋹̸",vV="∉",TV="⋷",CV="⋶",RV="⧏̸",xV="⋪",OV="⋬",AV="≮",NV="≰",wV="≸",IV="≪̸",DV="⩽̸",kV="≴",MV="⪢̸",LV="⪡̸",PV="∌",FV="∌",UV="⋾",BV="⋽",GV="⊀",qV="⪯̸",YV="⋠",VV="∌",zV="⧐̸",HV="⋫",$V="⋭",WV="⊏̸",KV="⋢",QV="⊐̸",jV="⋣",ZV="⊂⃒",XV="⊈",JV="⊁",ez="⪰̸",tz="⋡",nz="≿̸",rz="⊃⃒",sz="⊉",oz="≁",iz="≄",az="≇",lz="≉",cz="∤",dz="∦",uz="∦",_z="⫽⃥",pz="∂̸",mz="⨔",gz="⊀",fz="⋠",hz="⊀",Ez="⪯̸",bz="⪯̸",Sz="⤳̸",yz="↛",vz="⇏",Tz="↝̸",Cz="↛",Rz="⇏",xz="⋫",Oz="⋭",Az="⊁",Nz="⋡",wz="⪰̸",Iz="𝒩",Dz="𝓃",kz="∤",Mz="∦",Lz="≁",Pz="≄",Fz="≄",Uz="∤",Bz="∦",Gz="⋢",qz="⋣",Yz="⊄",Vz="⫅̸",zz="⊈",Hz="⊂⃒",$z="⊈",Wz="⫅̸",Kz="⊁",Qz="⪰̸",jz="⊅",Zz="⫆̸",Xz="⊉",Jz="⊃⃒",eH="⊉",tH="⫆̸",nH="≹",rH="Ñ",sH="ñ",oH="≸",iH="⋪",aH="⋬",lH="⋫",cH="⋭",dH="Ν",uH="ν",_H="#",pH="№",mH="",gH="≍⃒",fH="⊬",hH="⊭",EH="⊮",bH="⊯",SH="≥⃒",yH=">⃒",vH="⤄",TH="⧞",CH="⤂",RH="≤⃒",xH="<⃒",OH="⊴⃒",AH="⤃",NH="⊵⃒",wH="∼⃒",IH="⤣",DH="↖",kH="⇖",MH="↖",LH="⤧",PH="Ó",FH="ó",UH="⊛",BH="Ô",GH="ô",qH="⊚",YH="О",VH="о",zH="⊝",HH="Ő",$H="ő",WH="⨸",KH="⊙",QH="⦼",jH="Œ",ZH="œ",XH="⦿",JH="𝔒",e$="𝔬",t$="˛",n$="Ò",r$="ò",s$="⧁",o$="⦵",i$="Ω",a$="∮",l$="↺",c$="⦾",d$="⦻",u$="‾",_$="⧀",p$="Ō",m$="ō",g$="Ω",f$="ω",h$="Ο",E$="ο",b$="⦶",S$="⊖",y$="𝕆",v$="𝕠",T$="⦷",C$="“",R$="",x$="⦹",O$="⊕",A$="↻",N$="⩔",w$="",I$="⩝",D$="",k$="",M$="ª",L$="º",P$="⊶",F$="⩖",U$="⩗",B$="⩛",G$="Ⓢ",q$="𝒪",Y$="",V$="Ø",z$="ø",H$="⊘",$$="Õ",W$="õ",K$="⨶",Q$="⨷",j$="⊗",Z$="Ö",X$="ö",J$="⌽",eW="‾",tW="⏞",nW="⎴",rW="⏜",sW="¶",oW="∥",iW="∥",aW="⫳",lW="⫽",cW="∂",dW="∂",uW="П",_W="п",pW="%",mW=".",gW="‰",fW="⊥",hW="‱",EW="𝔓",bW="𝔭",SW="Φ",yW="φ",vW="ϕ",TW="",CW="☎",RW="Π",xW="π",OW="⋔",AW="ϖ",NW="ℏ",wW="",IW="ℏ",DW="⨣",kW="⊞",MW="⨢",LW="+",PW="∔",FW="⨥",UW="⩲",BW="±",GW="±",qW="⨦",YW="⨧",VW="±",zW="",HW="⨕",$W="𝕡",WW="",KW="£",QW="⪷",jW="⪻",ZW="≺",XW="≼",JW="⪷",eK="≺",tK="≼",nK="≺",rK="⪯",sK="≼",oK="≾",iK="⪯",aK="⪹",lK="⪵",cK="⋨",dK="⪯",uK="⪳",_K="≾",pK="",mK="″",gK="",fK="⪹",hK="⪵",EK="⋨",bK="∏",SK="∏",yK="⌮",vK="⌒",TK="⌓",CK="∝",RK="∝",xK="∷",OK="∝",AK="≾",NK="⊰",wK="𝒫",IK="𝓅",DK="Ψ",kK="ψ",MK="",LK="𝔔",PK="𝔮",FK="⨌",UK="𝕢",BK="",GK="⁗",qK="𝒬",YK="𝓆",VK="",zK="⨖",HK="?",$K="≟",WK='"',KK='"',QK="⇛",jK="∽̱",ZK="Ŕ",XK="ŕ",JK="√",eQ="⦳",tQ="⟩",nQ="⟫",rQ="⦒",sQ="⦥",oQ="⟩",iQ="»",aQ="⥵",lQ="⇥",cQ="⤠",dQ="⤳",uQ="→",_Q="↠",pQ="⇒",mQ="⤞",gQ="↪",fQ="↬",hQ="⥅",EQ="⥴",bQ="⤖",SQ="↣",yQ="↝",vQ="⤚",TQ="⤜",CQ="",RQ="",xQ="⤍",OQ="⤏",AQ="⤐",NQ="",wQ="}",IQ="]",DQ="⦌",kQ="⦎",MQ="⦐",LQ="Ř",PQ="ř",FQ="Ŗ",UQ="ŗ",BQ="⌉",GQ="}",qQ="Р",YQ="р",VQ="⤷",zQ="⥩",HQ="”",$Q="”",WQ="↳",KQ="",QQ="",jQ="",ZQ="",XQ="",JQ="▭",ej="®",tj="®",nj="∋",rj="⇋",sj="⥯",oj="⥽",ij="⌋",aj="𝔯",lj="",cj="⥤",dj="⇁",uj="⇀",_j="⥬",pj="Ρ",mj="ρ",gj="ϱ",fj="⟩",hj="⇥",Ej="→",bj="→
2023-12-04 00:40:36 +00:00
`," "],rae=["{","}","|","\\","^","`"].concat(nae),sae=["'"].concat(rae),Og=["%","/","?",";","#"].concat(sae),Ag=["/","?","#"],oae=255,Ng=/^[+a-z0-9A-Z_-]{0,63}$/,iae=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,wg={javascript:!0,"javascript:":!0},Ig={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function aae(t,e){if(t&&t instanceof ci)return t;var n=new ci;return n.parse(t,e),n}ci.prototype.parse=function(t,e){var n,r,s,o,i,a=t;if(a=a.trim(),!e&&t.split("#").length===1){var l=tae.exec(a);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}var u=Jie.exec(a);if(u&&(u=u[0],s=u.toLowerCase(),this.protocol=u,a=a.substr(u.length)),(e||u||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)==="//",i&&!(u&&wg[u])&&(a=a.substr(2),this.slashes=!0)),!wg[u]&&(i||u&&!Ig[u])){var d=-1;for(n=0;n<Ag.length;n++)o=a.indexOf(Ag[n]),o!==-1&&(d===-1||o<d)&&(d=o);var _,p;for(d===-1?p=a.lastIndexOf("@"):p=a.lastIndexOf("@",d),p!==-1&&(_=a.slice(0,p),a=a.slice(p+1),this.auth=_),d=-1,n=0;n<Og.length;n++)o=a.indexOf(Og[n]),o!==-1&&(d===-1||o<d)&&(d=o);d===-1&&(d=a.length),a[d-1]===":"&&d--;var g=a.slice(0,d);a=a.slice(d),this.parseHost(g),this.hostname=this.hostname||"";var f=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!f){var h=this.hostname.split(/\./);for(n=0,r=h.length;n<r;n++){var E=h[n];if(E&&!E.match(Ng)){for(var b="",m=0,S=E.length;m<S;m++)E.charCodeAt(m)>127?b+="x":b+=E[m];if(!b.match(Ng)){var T=h.slice(0,n),A=h.slice(n+1),x=E.match(iae);x&&(T.push(x[1]),A.unshift(x[2])),A.length&&(a=A.join(".")+a),this.hostname=T.join(".");break}}}}this.hostname.length>oae&&(this.hostname=""),f&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var k=a.indexOf("#");k!==-1&&(this.hash=a.substr(k),a=a.slice(0,k));var y=a.indexOf("?");return y!==-1&&(this.search=a.substr(y),a=a.slice(0,y)),a&&(this.pathname=a),Ig[s]&&this.hostname&&!this.pathname&&(this.pathname=""),this};ci.prototype.parseHost=function(t){var e=eae.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var lae=aae;us.encode=Qie;us.decode=Zie;us.format=Xie;us.parse=lae;var er={},Va,Dg;function Iv(){return Dg||(Dg=1,Va=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),Va}var za,kg;function Dv(){return kg||(kg=1,za=/[\0-\x1F\x7F-\x9F]/),za}var Ha,Mg;function cae(){return Mg||(Mg=1,Ha=/[\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]/),Ha}var $a,Lg;function kv(){return Lg||(Lg=1,$a=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),$a}var Pg;function dae(){return Pg||(Pg=1,er.Any=Iv(),er.Cc=Dv(),er.Cf=cae(),er.P=cp,er.Z=kv()),er}(function(t){function e(B){return Object.prototype.toString.call(B)}function n(B){return e(B)==="[object String]"}var r=Object.prototype.hasOwnProperty;function s(B,se){return r.call(B,se)}function o(B){var se=Array.prototype.slice.call(arguments,1);return se.forEach(function(H){if(H){if(typeof H!="object")throw new TypeError(H+"must be object");Object.keys(H).forEach(function(I){B[I]=H[I]})}}),B}function i(B,se,H){return[].concat(B.slice(0,se),H,B.slice(se+1))}function a(B){return!(B>=55296&&B<=57343||B>=64976&&B<=65007||(B&65535)===65535||(B&65535)===65534||B>=0&&B<=8||B===11||B>=14&&B<=31||B>=127&&B<=159||B>1114111)}function l(B){if(B>65535){B-=65536;var se=55296+(B>>10),H=56320+(B&1023);return String.fromCharCode(se,H)}return String.fromCharCode(B)}var u=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,d=/&([a-z#][a-z0-9]{1,31});/gi,_=new RegExp(u.source+"|"+d.source,"gi"),p=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i,g=wv;function f(B,se){var H;return s(g,se)?g[se]:se.charCodeAt(0)===35&&p.test(se)&&(H=se[1].toLowerCase()==="x"?parseInt(se.slice(2),16):parseInt(se.slice(1),10),a(H))?l(H):B}function h(B){return B.indexOf("\\")<0?B:B.replace(u,"$1")}function E(B){return B.indexOf("\\")
2023-11-26 22:19:08 +00:00
`};an.fence=function(t,e,n,r,s){var o=t[e],i=o.info?fae(o.info).trim():"",a="",l="",u,d,_,p,g;return i&&(_=i.split(/(\s+)/g),a=_[0],l=_.slice(2).join("")),n.highlight?u=n.highlight(o.content,a,l)||pr(o.content):u=pr(o.content),u.indexOf("<pre")===0?u+`
2023-11-11 23:16:13 +00:00
`:i?(d=o.attrIndex("class"),p=o.attrs?o.attrs.slice():[],d<0?p.push(["class",n.langPrefix+a]):(p[d]=p[d].slice(),p[d][1]+=" "+n.langPrefix+a),g={attrs:p},"<pre><code"+s.renderAttrs(g)+">"+u+`</code></pre>
2023-11-09 23:31:56 +00:00
`):"<pre><code"+s.renderAttrs(o)+">"+u+`</code></pre>
2023-11-26 18:54:09 +00:00
`};an.image=function(t,e,n,r,s){var o=t[e];return o.attrs[o.attrIndex("alt")][1]=s.renderInlineAsText(o.children,n,r),s.renderToken(t,e,n)};an.hardbreak=function(t,e,n){return n.xhtmlOut?`<br />
2023-11-09 23:31:56 +00:00
`:`<br>
2023-11-26 18:54:09 +00:00
`};an.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?`<br />
2023-11-09 23:31:56 +00:00
`:`<br>
`:`
2023-11-26 22:19:08 +00:00
`};an.text=function(t,e){return pr(t[e].content)};an.html_block=function(t,e){return t[e].content};an.html_inline=function(t,e){return t[e].content};function _s(){this.rules=gae({},an)}_s.prototype.renderAttrs=function(e){var n,r,s;if(!e.attrs)return"";for(s="",n=0,r=e.attrs.length;n<r;n++)s+=" "+pr(e.attrs[n][0])+'="'+pr(e.attrs[n][1])+'"';return s};_s.prototype.renderToken=function(e,n,r){var s,o="",i=!1,a=e[n];return a.hidden?"":(a.block&&a.nesting!==-1&&n&&e[n-1].hidden&&(o+=`
2023-11-09 23:31:56 +00:00
`),o+=(a.nesting===-1?"</":"<")+a.tag,o+=this.renderAttrs(a),a.nesting===0&&r.xhtmlOut&&(o+=" /"),a.block&&(i=!0,a.nesting===1&&n+1<e.length&&(s=e[n+1],(s.type==="inline"||s.hidden||s.nesting===-1&&s.tag===a.tag)&&(i=!1))),o+=i?`>
`:">",o)};_s.prototype.renderInline=function(t,e,n){for(var r,s="",o=this.rules,i=0,a=t.length;i<a;i++)r=t[i].type,typeof o[r]<"u"?s+=o[r](t,i,e,n,this):s+=this.renderToken(t,i,e);return s};_s.prototype.renderInlineAsText=function(t,e,n){for(var r="",s=0,o=t.length;s<o;s++)t[s].type==="text"?r+=t[s].content:t[s].type==="image"?r+=this.renderInlineAsText(t[s].children,e,n):t[s].type==="softbreak"&&(r+=`
2023-12-04 00:40:36 +00:00
`);return r};_s.prototype.render=function(t,e,n){var r,s,o,i="",a=this.rules;for(r=0,s=t.length;r<s;r++)o=t[r].type,o==="inline"?i+=this.renderInline(t[r].children,e,n):typeof a[o]<"u"?i+=a[o](t,r,e,n,this):i+=this.renderToken(t,r,e,n);return i};var hae=_s;function Yt(){this.__rules__=[],this.__cache__=null}Yt.prototype.__find__=function(t){for(var e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1};Yt.prototype.__compile__=function(){var t=this,e=[""];t.__rules__.forEach(function(n){n.enabled&&n.alt.forEach(function(r){e.indexOf(r)<0&&e.push(r)})}),t.__cache__={},e.forEach(function(n){t.__cache__[n]=[],t.__rules__.forEach(function(r){r.enabled&&(n&&r.alt.indexOf(n)<0||t.__cache__[n].push(r.fn))})})};Yt.prototype.at=function(t,e,n){var r=this.__find__(t),s=n||{};if(r===-1)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=s.alt||[],this.__cache__=null};Yt.prototype.before=function(t,e,n,r){var s=this.__find__(t),o=r||{};if(s===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(s,0,{name:e,enabled:!0,fn:n,alt:o.alt||[]}),this.__cache__=null};Yt.prototype.after=function(t,e,n,r){var s=this.__find__(t),o=r||{};if(s===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(s+1,0,{name:e,enabled:!0,fn:n,alt:o.alt||[]}),this.__cache__=null};Yt.prototype.push=function(t,e,n){var r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null};Yt.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);var n=[];return t.forEach(function(r){var s=this.__find__(r);if(s<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[s].enabled=!0,n.push(r)},this),this.__cache__=null,n};Yt.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(n){n.enabled=!1}),this.enable(t,e)};Yt.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);var n=[];return t.forEach(function(r){var s=this.__find__(r);if(s<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[s].enabled=!1,n.push(r)},this),this.__cache__=null,n};Yt.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};var dp=Yt,Eae=/\r\n?|\n/g,bae=/\0/g,Sae=function(e){var n;n=e.src.replace(Eae,`
`),n=n.replace(bae,"<22>"),e.src=n},yae=function(e){var n;e.inlineMode?(n=new e.Token("inline","",0),n.content=e.src,n.map=[0,1],n.children=[],e.tokens.push(n)):e.md.block.parse(e.src,e.md,e.env,e.tokens)},vae=function(e){var n=e.tokens,r,s,o;for(s=0,o=n.length;s<o;s++)r=n[s],r.type==="inline"&&e.md.inline.parse(r.content,e.md,e.env,r.children)},Tae=$e.arrayReplaceAt;function Cae(t){return/^<a[>\s]/i.test(t)}function Rae(t){return/^<\/a\s*>/i.test(t)}var xae=function(e){var n,r,s,o,i,a,l,u,d,_,p,g,f,h,E,b,m=e.tokens,S;if(e.md.options.linkify){for(r=0,s=m.length;r<s;r++)if(!(m[r].type!=="inline"||!e.md.linkify.pretest(m[r].content)))for(o=m[r].children,f=0,n=o.length-1;n>=0;n--){if(a=o[n],a.type==="link_close"){for(n--;o[n].level!==a.level&&o[n].type!=="link_open";)n--;continue}if(a.type==="html_inline"&&(Cae(a.content)&&f>0&&f--,Rae(a.content)&&f++),!(f>0)&&a.type==="text"&&e.md.linkify.test(a.content)){for(d=a.content,S=e.md.linkify.match(d),l=[],g=a.level,p=0,S.length>0&&S[0].index===0&&n>0&&o[n-1].type==="text_special"&&(S=S.slice(1)),u=0;u<S.length;u++)h=S[u].url,E=e.md.normalizeLink(h),e.md.validateLink(E)&&(b=S[u].text,S[u].schema?S[u].schema==="mailto:"&&!/^mailto:/i.test(b)?b=e.md.normalizeLinkText("mailto:"+b).replace(/^mailto:/,""):b=e.md.normalizeLinkText(b):b=e.md.normalizeLinkText("http://"+b).replace(/^http:\/\//,""),_=S[u].index,_>p&&(i=new e.Token("text","",0),i.content=d.slice(p,_),i.level=g,l.push(i)),i=new e.Token("link_open","a",1),i.attrs=[["href",E]],i.level=g++,i.markup="linkify",i.info="auto",l.push(i),i=new e.Token("text","",0),i.content=b,i.level=g,l.push(i),i=new e.Token("link_close","a",-1),i.level=--g,i.markup="linkify",i.info="auto",l.push(i),p=S[u].lastIndex);p<d.length&&(i=new e.Token("text","",0),i.content=d.slice(p),i.level=g,l.push(i)),m[r].children=o=Tae(o,n,l)}}}},Mv=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Oae=/\((c|tm|r)\)/i,Aae=/\((c|tm|r)\)/ig,Nae={c:"©",r:"®",tm:"™"};function wae(t,e){return Nae[e.toLowerCase()]}function Iae(t){var e,n,r=0;for(e=t.length-1;e>=0;e--)n=t[e],n.type==="text"&&!r&&(n.content=n.content.replace(Aae,wae)),n.type==="link_open"&&n.info==="auto"&&r--,n.type==="link_close"&&n.info==="auto"&&r++}function Dae(t){var e,n,r=0;for(e=t.length-1;e>=0;e--)n=t[e],n.type==="text"&&!r&&Mv.test(n.content)&&(n.content=n.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")),n.type==="link_open"&&n.info==="auto"&&r--,n.type==="link_close"&&n.info==="auto"&&r++}var kae=function(e){var n;if(e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type==="inline"&&(Oae.test(e.tokens[n].content)&&Iae(e.tokens[n].children),Mv.test(e.tokens[n].content)&&Dae(e.tokens[n].children))},Ug=$e.isWhiteSpace,Bg=$e.isPunctChar,Gg=$e.isMdAsciiPunct,Mae=/['"]/,qg=/['"]/g,Yg="";function Do(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function Lae(t,e){var n,r,s,o,i,a,l,u,d,_,p,g,f,h,E,b,m,S,T,A,x;for(T=[],n=0;n<t.length;n++){for(r=t[n],l=t[n].level,m=T.length-1;m>=0&&!(T[m].level<=l);m--);if(T.length=m+1,r.type==="text"){s=r.content,i=0,a=s.length;e:for(;i<a&&(qg.lastIndex=i,o=qg.exec(s),!!o);){if(E=b=!0,i=o.index+1,S=o[0]==="'",d=32,o.index-1>=0)d=s.charCodeAt(o.index-1);else for(m=n-1;m>=0&&!(t[m].type==="softbreak"||t[m].type==="hardbreak");m--)if(t[m].content){d=t[m].content.charCodeAt(t[m].content.length-1);break}if(_=32,i<a)_=s.charCodeAt(i);else for(m=n+1;m<t.length&&!(t[m].type==="softbreak"||t[m].type==="hardbreak");m++)if(t[m].content){_=t[m].content.charCodeAt(0);break}if(p=Gg(d)||Bg(String.fromCharCode(d)),g=Gg(_)||Bg(String.fromCharCode(_)),f=Ug(d),h=Ug(_),h?E=!1:g&&(f||p||(E=!1)),f?b=!1:p&&(h||g||(b=!1)),_===34&&o[0]==='"'&&d>=48&&d<=57&&(b=E=!1),E&&b&&(E=p,b=g),!E&&!b){S&&(r.content=Do(r.content,o.index,Yg));continue}if(b){for(m=T.length-1;m>=0&&(u=T[m],!(T[m].level<l));m--)if(u.single===S&&T[m].level===l){u=T[m],S?(A=e.md.options.quotes[2],x=e.md.options.quotes[
`,i.map=[n,e.line],!0},zae=function(e,n,r,s){var o,i,a,l,u,d,_,p=!1,g=e.bMarks[n]+e.tShift[n],f=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||g+3>f||(o=e.src.charCodeAt(g),o!==126&&o!==96)||(u=g,g=e.skipChars(g,o),i=g-u,i<3)||(_=e.src.slice(u,g),a=e.src.slice(g,f),o===96&&a.indexOf(String.fromCharCode(o))>=0))return!1;if(s)return!0;for(l=n;l++,!(l>=r||(g=u=e.bMarks[l]+e.tShift[l],f=e.eMarks[l],g<f&&e.sCount[l]<e.blkIndent));)if(e.src.charCodeAt(g)===o&&!(e.sCount[l]-e.blkIndent>=4)&&(g=e.skipChars(g,o),!(g-u<i)&&(g=e.skipSpaces(g),!(g<f)))){p=!0;break}return i=e.sCount[n],e.line=l+(p?1:0),d=e.push("fence","code",0),d.info=a,d.content=e.getLines(n+1,l,i,!0),d.markup=_,d.map=[n,e.line],!0},Hae=$e.isSpace,$ae=function(e,n,r,s){var o,i,a,l,u,d,_,p,g,f,h,E,b,m,S,T,A,x,k,y,R=e.lineMax,w=e.bMarks[n]+e.tShift[n],L=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(w)!==62)return!1;if(s)return!0;for(f=[],h=[],m=[],S=[],x=e.md.block.ruler.getRules("blockquote"),b=e.parentType,e.parentType="blockquote",p=n;p<r&&(y=e.sCount[p]<e.blkIndent,w=e.bMarks[p]+e.tShift[p],L=e.eMarks[p],!(w>=L));p++){if(e.src.charCodeAt(w++)===62&&!y){for(l=e.sCount[p]+1,e.src.charCodeAt(w)===32?(w++,l++,o=!1,T=!0):e.src.charCodeAt(w)===9?(T=!0,(e.bsCount[p]+l)%4===3?(w++,l++,o=!1):o=!0):T=!1,g=l,f.push(e.bMarks[p]),e.bMarks[p]=w;w<L&&(i=e.src.charCodeAt(w),Hae(i));){i===9?g+=4-(g+e.bsCount[p]+(o?1:0))%4:g++;w++}d=w>=L,h.push(e.bsCount[p]),e.bsCount[p]=e.sCount[p]+1+(T?1:0),m.push(e.sCount[p]),e.sCount[p]=g-l,S.push(e.tShift[p]),e.tShift[p]=w-e.bMarks[p];continue}if(d)break;for(A=!1,a=0,u=x.length;a<u;a++)if(x[a](e,p,r,!0)){A=!0;break}if(A){e.lineMax=p,e.blkIndent!==0&&(f.push(e.bMarks[p]),h.push(e.bsCount[p]),S.push(e.tShift[p]),m.push(e.sCount[p]),e.sCount[p]-=e.blkIndent);break}f.push(e.bMarks[p]),h.push(e.bsCount[p]),S.push(e.tShift[p]),m.push(e.sCount[p]),e.sCount[p]=-1}for(E=e.blkIndent,e.blkIndent=0,k=e.push("blockquote_open","blockquote",1),k.markup=">",k.map=_=[n,0],e.md.block.tokenize(e,n,p),k=e.push("blockquote_close","blockquote",-1),k.markup=">",e.lineMax=R,e.parentType=b,_[1]=e.line,a=0;a<S.length;a++)e.bMarks[a+n]=f[a],e.tShift[a+n]=S[a],e.sCount[a+n]=m[a],e.bsCount[a+n]=h[a];return e.blkIndent=E,!0},Wae=$e.isSpace,Kae=function(e,n,r,s){var o,i,a,l,u=e.bMarks[n]+e.tShift[n],d=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||(o=e.src.charCodeAt(u++),o!==42&&o!==45&&o!==95))return!1;for(i=1;u<d;){if(a=e.src.charCodeAt(u++),a!==o&&!Wae(a))return!1;a===o&&i++}return i<3?!1:(s||(e.line=n+1,l=e.push("hr","hr",0),l.map=[n,e.line],l.markup=Array(i+1).join(String.fromCharCode(o))),!0)},Pv=$e.isSpace;function zg(t,e){var n,r,s,o;return r=t.bMarks[e]+t.tShift[e],s=t.eMarks[e],n=t.src.charCodeAt(r++),n!==42&&n!==45&&n!==43||r<s&&(o=t.src.charCodeAt(r),!Pv(o))?-1:r}function Hg(t,e){var n,r=t.bMarks[e]+t.tShift[e],s=r,o=t.eMarks[e];if(s+1>=o||(n=t.src.charCodeAt(s++),n<48||n>57))return-1;for(;;){if(s>=o)return-1;if(n=t.src.charCodeAt(s++),n>=48&&n<=57){if(s-r>=10)return-1;continue}if(n===41||n===46)break;return-1}return s<o&&(n=t.src.charCodeAt(s),!Pv(n))?-1:s}function Qae(t,e){var n,r,s=t.level+2;for(n=e+2,r=t.tokens.length-2;n<r;n++)t.tokens[n].level===s&&t.tokens[n].type==="paragraph_open"&&(t.tokens[n+2].hidden=!0,t.tokens[n].hidden=!0,n+=2)}var jae=function(e,n,r,s){var o,i,a,l,u,d,_,p,g,f,h,E,b,m,S,T,A,x,k,y,R,w,L,M,Z,B,se,H=n,I=!1,Q=!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(s&&e.parentType==="paragraph"&&e.sCount[H]>=e.blkIndent&&(I=!0),(w=Hg(e,H))>=0){if(_=!0,M=e.bMarks[H]+e.tShift[H],b=Number(e.src.slice(M,w-1)),I&&b!==1)return!1}else if((w=zg(e,H))>=0)_=!1;else return!1;if(I&&e.skipSpaces(w)>=e.eMarks[H])return!1;if(s)return!0;for(E=e.src.charCodeAt(w-1),h=e.tokens.length,_?(se=e.push("ordered_list_open","ol",1),b!==1&&(se.attrs=[["start",b]])):se=e.push("bullet_list_open","ul",1),se.map=f=[H,0],se.markup=String.fromCharCode(E),L=!1,B=e.md.block.ruler.getRules("list"),A=e.parentType,e.parentType="list";H<r;){for(R=w,m=e.eMarks[H],d=S=e.sCount[H]+w-(e.bMarks[H]+e.tShift[H]);
2023-11-11 23:16:13 +00:00
`})),r.tokens.splice(s+3+d.length+1,0,Object.assign(new r.Token("html_block","",0),{content:e.wrapper[1]+`
2023-12-04 00:40:36 +00:00
`})))});function df(t,e,n,r){var s=t,o=r;if(n&&Object.prototype.hasOwnProperty.call(e,s))throw new Error("User defined `id` attribute `"+t+"` is not unique. Please fix it in your Markdown to continue.");for(;Object.prototype.hasOwnProperty.call(e,s);)s=t+"-"+o,o+=1;return e[s]=!0,s}function Mr(t,e){e=Object.assign({},Mr.defaults,e),t.core.ruler.push("anchor",function(n){for(var r,s={},o=n.tokens,i=Array.isArray(e.level)?(r=e.level,function(_){return r.includes(_)}):function(_){return function(p){return p>=_}}(e.level),a=0;a<o.length;a++){var l=o[a];if(l.type==="heading_open"&&i(Number(l.tag.substr(1)))){var u=e.getTokensText(o[a+1].children),d=l.attrGet("id");d=d==null?df(e.slugify(u),s,!1,e.uniqueSlugStartIndex):df(d,s,!0,e.uniqueSlugStartIndex),l.attrSet("id",d),e.tabIndex!==!1&&l.attrSet("tabindex",""+e.tabIndex),typeof e.permalink=="function"?e.permalink(d,e,n,a):(e.permalink||e.renderPermalink&&e.renderPermalink!==p_)&&e.renderPermalink(d,e,n,a),a=o.indexOf(l),e.callback&&e.callback(l,{slug:d,title:u})}}})}Object.assign(cf.defaults,{style:"visually-hidden",space:!0,placement:"after",wrapper:null}),Mr.permalink={__proto__:null,legacy:p_,renderHref:Zv,renderAttrs:Xv,makePermalink:io,linkInsideHeader:Xi,ariaHidden:tr,headerLink:Jv,linkAfterHeader:cf},Mr.defaults={level:1,slugify:function(t){return encodeURIComponent(String(t).trim().toLowerCase().replace(/\s+/g,"-"))},uniqueSlugStartIndex:1,tabIndex:"-1",getTokensText:function(t){return t.filter(function(e){return["text","code_inline"].includes(e.type)}).map(function(e){return e.content}).join("")},permalink:!1,renderPermalink:p_,permalinkClass:tr.defaults.class,permalinkSpace:tr.defaults.space,permalinkSymbol:"¶",permalinkBefore:tr.defaults.placement==="before",permalinkHref:tr.defaults.renderHref,permalinkAttrs:tr.defaults.renderAttrs},Mr.default=Mr;Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(typeof t>"u"||t===null)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),n=1;n<arguments.length;n++){var r=arguments[n];if(!(typeof r>"u"||r===null))for(var s=Object.keys(Object(r)),o=0,i=s.length;o<i;o++){var a=s[o],l=Object.getOwnPropertyDescriptor(r,a);typeof l<"u"&&l.enumerable&&(e[a]=r[a])}}return e}});var wr={},vs={},Ts={},gt={},uf;function eT(){if(uf)return gt;uf=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.accents=gt.fonts=gt.groupings=gt.operators=gt.identifiers=gt.numbers=void 0;var t={};gt.numbers=t;var e="[0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↋①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿零一二三四五六七八九十百千万億兆京垓𥝱秭穣溝澗正載割分厘毛糸忽微繊沙塵埃꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-]",n=new RegExp(e);Object.defineProperties(t,{digitRange:{value:e},digitRE:{value:n},isdigit:{value:function(_){return _.match(n)}}});var r=["sin","cos","tan","csc","sec","cot","sinh","cosh","tanh","log","ln","det","dim","lim","mod","gcd","lcm","min","max"],s={Gamma:"Γ",Delta:"Δ",Theta:"Θ",Lambda:"Λ",Xi:"Ξ",Pi:"Π",Sigma:"Σ",Phi:"Φ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ɛ",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",pi:"π",rho:"ρ",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",oo:"∞","O/":"∅",CC:"",NN:"",QQ:"",RR:"",ZZ:""};gt.identifiers=s,r.forEach(function(d){s[d]=d}),Object.defineProperty(s,"contains",{value:function(_){return typeof s[_]<"u"}}),Object.defineProperty(s,"funs",{value:r}),Object.defineProperty(s,"isfun",{value:function(_){return r.indexOf(_)>=0}});var o={"*":"·","**":"","***":"⋆","//":"/","|":"|",":":":","'":"","''":"″","'''":"‴","''''":"⁗",xx:"×","-:":"÷","|><":"⋉","><|
`);function Ee(D){return function(K){for(var G=[],q=0,V=0,ne=0;ne<K.length;ne+=1){var oe=K.slice(ne),ge=K[ne];oe.startsWith(D)&&!K.slice(0,ne).match(/\\(\\{2})*$/)?q===0&&(G.push(K.slice(V,ne)),V=ne+D.length):ge.match(e.groupings.open.regexp)?q+=1:ge.match(e.groupings.close.regexp)&&(q-=1)}return G.push(K.slice(V)),G}}var z=function D(K,G,q,V){if(!K)return G;if(K.match(/^\s/)){if(K.match(/^\s+(\/[^\/]|^[^\^]|_[^_|])/))return D(K.trim(),G);var ne=K.match(/^ +/),oe=ne?ne[0].length:0;if(oe>1){var ge='<mspace width="'.concat(oe-1,'ex" />');return D(K.trim(),G+ge)}return D(K.trim(),G)}var J=Y(K,V),ce=r(J,2),Se=ce[0],Oe=ce[1];if((Oe&&Oe.trimLeft().startsWith("/")||Oe.trimLeft().startsWith("./"))&&!Oe.trimLeft().match(/^\.?\/\//)){var Le=F(Se,Oe),Be=r(Le,2);Se=Be[0],Oe=Be[1]}return D(Oe,G+Se)};function te(D){if(D.trim().length===0)return"";var K=z(D,"",!1,!0);return K===Z(K)?K:S(K)}function Y(D,K,G){if(!D)return["",""];var q,V,ne=D[0],oe=D.slice(1),ge=ne+(oe.match(/^[A-Za-z]+/)||"");if(D.startsWith("sqrt")){var J=Y(D.slice(4).trim(),K);q=T(J[0]?M(J[0]):S("")),V=J[1]}else if(D.startsWith("root")){var ce=Y(D.slice(4).trimLeft(),K),Se=ce[0]?M(ce[0]):S(""),Oe=Y(ce[1].trimLeft(),K),Le=Oe[0]?M(Oe[0]):S("");q=A(Le+Se),V=Oe[1]}else if(ne==="\\"&&D.length>1)if(D[1].match(/[(\[]/)){var Be=B(oe);q=d(D.slice(2,Be)),V=D.slice(Be+1)}else q=d(D[1]),V=D.slice(2);else if(e.accents.contains(ge)){var nt=e.accents.get(ge),Xe=D.slice(ge.length).trimLeft(),tt=Xe.match(/^\s*\(?([ij])\)?/),Je=Y(Xe);switch(nt.type){case"over":tt?(q=E(l(tt[1]==="i"?"ı":"ȷ")+d(nt.accent,{accent:!0})),V=Xe.slice(tt[0].length)):(q=E(M(Je[0])+d(nt.accent,{accent:!0})),V=Je[1]);break;case"under":q=h(M(Je[0])+d(nt.accent)),V=Je[1];break;case"enclose":q=m(M(Je[0]),nt.attrs),V=Je[1];break;default:throw new Error("Invalid config for accent "+ge)}}else if(t.default.isfontCommand(D)){var Fe=t.default.splitfont(D);q=a(Fe.tagname)(Fe.text,Fe.font&&{mathvariant:Fe.font}),V=Fe.rest}else if(e.groupings.complex.contains(ge)){var Rn=e.groupings.complex.get(ge),cn=D.slice(ge.length).trimLeft(),vr=Y(cn);q=x(M(vr[0]),Rn),V=vr[1]}else if(t.default.isgroupStart(D)||t.default.isvertGroupStart(D)){var ra=t.default.isgroupStart(D)?t.default.splitNextGroup(D):t.default.splitNextVert(D),Tr=r(ra,5),xn=Tr[1],Vt=Tr[2],On=Tr[3],sa=Tr[4];V=e.groupings.open.get(sa);var Cr=function(){var Rr=he(Vt);return Rr.length>1?Rr:Re(Vt)}();if(t.default.ismatrixInterior(Vt.trim(),X.colSep,X.rowSep)){Vt.trim().endsWith(X.colSep)&&(Vt=Vt.trimRight().slice(0,-1));var oa=xn==="{"&&On==="",ia=W(Vt,oa&&{columnalign:"center left"});q=x(ia,{open:xn,close:On})}else if(Cr.length>1)if(Cr.length===2&&xn==="("&&On===")"){var aa=_(Cr.map(te).join(""),{linethickness:0});q=x(aa,{open:xn,close:On})}else{var jn=Cr.map(be);I(jn).length===1&&I(jn)[0].match(/^\s*$/)&&(jn=jn.slice(0,-1));var la=jn.map(function(Rr){return y(Rr.map(Q(R,te)).join(""))}).join("");q=x(k(la),{open:xn,close:On})}else{var ca=be(Vt),da=ca.map(te).join(""),_o={open:xn,close:On};X.colSep!==","&&(_o.separators=X.colSep),q=x(da,_o)}}else if(!K&&t.default.isgroupable(D,X)){var po=$(D);q=te(po[0]),V=po[1]}else if(e.numbers.isdigit(ne)){var mo=D.match(ee)[0];q=u(mo),V=oe.slice(mo.length-1)}else if(D.match(/^#`[^`]+`/)){var go=D.match(/^#`([^`]+)`/)[1];q=u(go),V=D.slice(go.length+3)}else if(D.match(new RegExp("^"+e.operators.regexp.source))&&!e.identifiers.contains(ge)){var ua=t.default.splitNextOperator(D),fo=r(ua,2),gs=fo[0],_a=fo[1],pa=D.startsWith("'"),ma=H(["∂","∇"],gs),ga=H(["|"],gs),fa=D.startsWith("| "),zt={};pa&&(zt.lspace=0,zt.rspace=0),ma&&(zt.rspace=0),ga&&(zt.stretchy=!0),fa&&(zt.lspace="veryverythickmathspace",zt.rspace="veryverythickmathspace"),q=d(gs,!se(zt)&&zt),V=_a}else if(e.identifiers.contains(ge)){var fs=e.identifiers[ge],ha=fs.match(/[\u0391-\u03A9\u2100-\u214F\u2200-\u22FF]/);q=ha?l(fs,{mathvariant:"normal"}):l(fs),V=oe.slice(ge.length-1)}else ne==="O"&&oe[0]==="/"?(q=l(e.identifiers["O/"],{mathvariant:"normal"}),V=oe.slice(1)):(q=l(ne),V=oe);if(V&&V.trimLeft().match(/\.?[\^_]/)){if((!G||!G.match(/m(sup|over)/))&&V.trim().startsWith("_")&&(
`:"")+r.getLines(s+1,d,l,!0)+(g&&g.trim()?g:""),_.info=u,_.map=[s,r.line],_.markup=t,!0}}function ff(t){if(rl===null)try{rl=$5e().default}catch{return t&&t.display==="block"?function(r,s){return'<div class="math block">'+r[s].content+"</div>"}:function(r,s){return'<span class="math inline">'+r[s].content+"</span>"}}var e=rl(Object.assign({},t));return t&&t.display==="block"?function(n,r){return e(n[r].content)+`
`}:function(n,r){return e(n[r].content)}}var Q5e=function(e,n){n=typeof n=="object"?n:{};var r=n.inlineOpen||"$$",s=n.inlineClose||"$$",o=n.blockOpen||"$$$",i=n.blockClose||"$$$",a=n.inlineRenderer?function(_,p){return n.inlineRenderer(_[p].content,_[p])}:ff(n.renderingOptions),l=n.blockRenderer?function(_,p){return n.blockRenderer(_[p].content,_[p])+`
`}:ff(Object.assign({display:"block"},n.renderingOptions)),u=W5e(r,s),d=K5e(o,i);e.inline.ruler.before("escape","math_inline",u),e.block.ruler.after("blockquote","math_block",d,{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules.math_inline=a,e.renderer.rules.math_block=l};const j5e=vn(Q5e);function Tn(){this.__highest_alphabet__=0,this.__match_alphabets__={},this.__initial_state__=0,this.__accept_states__={},this.__transitions__={},this.__actions__={}}Tn.prototype.set_highest_alphabet=function(t){this.__highest_alphabet__=t};Tn.prototype.set_match_alphabets=function(t){this.__match_alphabets__=t};Tn.prototype.set_initial_state=function(t){this.__initial_state__=t};Tn.prototype.set_accept_states=function(t){for(var e=0;e<t.length;e++)this.__accept_states__[t[e]]=!0};Tn.prototype.set_transitions=function(t){this.__transitions__=t};Tn.prototype.set_actions=function(t){this.__actions__=t};Tn.prototype.update_transition=function(t,e){this.__transitions__[t]=Object.assign(this.__transitions__[t]||Object(),e)};Tn.prototype.execute=function(t,e){var n,r,s;for(n=this.__initial_state__,r=t;n&&r<e;r++){for(s=this.__highest_alphabet__;s>0&&!(n&s&&this.__match_alphabets__[s].call(this,r,n,s));s>>=4);if(this.__actions__(r,n,s),s===0)break;n=this.__transitions__[n][s]||0}return!!this.__accept_states__[n]};var Z5e=Tn,X5e=Z5e,J5e=function(e,n){var r={multiline:!1,rowspan:!1,headerless:!1,multibody:!0,autolabel:!0};n=e.utils.assign({},r,n||{});function s(d,_){var p=d.bMarks[_]+d.sCount[_],g=d.bMarks[_]+d.blkIndent,f=d.skipSpacesBack(d.eMarks[_],g),h=[],E,b,m=!1,S=!1,T=0;for(E=p;E<f;E++)switch(d.src.charCodeAt(E)){case 92:m=!0;break;case 96:b=d.skipChars(E,96)-1,b>E?(S||(T===0?T=b-E:T===b-E&&(T=0)),E=b):(S||!m&&!T)&&(S=!S),m=!1;break;case 124:!S&&!m&&h.push(E),m=!1;break;default:m=!1;break}return h.length===0||(h[0]>g&&h.unshift(g-1),h[h.length-1]<f-1&&h.push(f)),h}function o(d,_,p){var g={text:null,label:null},f=d.bMarks[p]+d.sCount[p],h=d.eMarks[p],E=/^\[(.+?)\](\[([^\[\]]+)\])?\s*$/,b=d.src.slice(f,h).match(E);return b?_?!0:(g.text=b[1],!n.autolabel&&!b[2]||(g.label=b[2]||b[1],g.label=g.label.toLowerCase().replace(/\W+/g,"")),g):!1}function i(d,_,p){var g={bounds:null,multiline:null},f=s(d,p),h,E,b;return f.length<2?!1:_?!0:(g.bounds=f,n.multiline&&(h=d.bMarks[p]+d.sCount[p],E=d.eMarks[p]-1,g.multiline=d.src.charCodeAt(E)===92,g.multiline&&(b=d.eMarks[p],d.eMarks[p]=d.skipSpacesBack(E,h),g.bounds=s(d,p),d.eMarks[p]=b)),g)}function a(d,_,p){var g={aligns:[],wraps:[]},f=s(d,p),h=/^:?(-+|=+):?\+?$/,E,b,m;if(d.sCount[p]-d.blkIndent>=4||f.length===0)return!1;for(E=0;E<f.length-1;E++){if(b=d.src.slice(f[E]+1,f[E+1]).trim(),!h.test(b))return!1;switch(g.wraps.push(b.charCodeAt(b.length-1)===43),m=(b.charCodeAt(0)===58)<<4|b.charCodeAt(b.length-1-g.wraps[E])===58,m){case 0:g.aligns.push("");break;case 1:g.aligns.push("right");break;case 16:g.aligns.push("left");break;case 17:g.aligns.push("center");break}}return _?!0:g}function l(d,_,p){return d.isEmpty(p)}function u(d,_,p,g){var f=new X5e,h=16,E=-1,b,m,S,T,A,x,k=[],y,R,w,L,M,Z,B,se,H,I;if(_+2>p||(m=new d.Token("table_open","table",1),m.meta={sep:null,cap:null,tr:[]},f.set_highest_alphabet(65536),f.set_initial_state(65792),f.set_accept_states([65552,65553,0]),f.set_match_alphabets({65536:o.bind(this,d,!0),4096:a.bind(this,d,!0),256:i.bind(this,d,!0),16:i.bind(this,d,!0),1:l.bind(this,d,!0)}),f.set_transitions({65792:{65536:256,256:4352},256:{256:4352},4352:{4096:65552,256:4352},65552:{65536:0,16:65553},65553:{65536:0,16:65553,1:65552}}),n.headerless&&(f.set_initial_state(69888),f.update_transition(69888,{65536:4352,4096:65552,256:4352}),S=new d.Token("tr_placeholder","tr",0),S.meta=Object()),n.multibody||f.update_transition(65552,{65536:0,16:65552}),f.set_actions(function(X,pe,ee){switch(ee){case 65536:if(m.meta.cap)break;m.meta.cap=o(d,!1,X),m.meta.cap.map=[X,X+1],m.meta.cap.first=X===_;break;case 4096:m.meta.sep=a(d,!1,X),m.meta.sep.map=[X,X+1],S.meta.grp|=1,h=16;break;case 256:case 16:S=new d.Token("tr_open","tr",1),S.map=[X,X+1],S.meta=i(d,!1,X),S.meta.type=ee,S.meta.grp=
2023-12-06 00:28:13 +00:00
`),d.md,d.env,[]),I.level=S.level+1,d.md.block.tokenize(I,S.map[0],I.lineMax),H=0;H<I.tokens.length;H++)d.tokens.push(I.tokens[H])}else b=d.push("inline","",0),b.content=L.trim(),b.map=S.map,b.level=S.level+1,b.children=[];b=d.push(w+"_close",w,-1)}d.push("tr_close","tr",-1),S.meta.grp&1&&(w=S.meta.type===256?"thead":"tbody",b=d.push(w+"_close",w,-1),R[1]=S.map[1])}return y[1]=Math.max(R[1],m.meta.sep.map[1],m.meta.cap?m.meta.cap.map[1]:-1),b=d.push("table_close","table",-1),d.line=y[1],!0}e.block.ruler.at("table",u,{alt:["paragraph","reference"]})};const e3e=vn(J5e);var t3e=function(e,n){n=n||{};function r(s){for(var o=1,i=1,a=s.tokens.length;i<a-1;++i){var l=s.tokens[i];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"))&&!(i!==0&&s.tokens[i-1].type!=="paragraph_open")&&!(i!==a-1&&s.tokens[i+1].type!=="paragraph_close")){var u=s.tokens[i-1];u.type="figure_open",u.tag="figure",s.tokens[i+1].type="figure_close",s.tokens[i+1].tag="figure",n.dataType==!0&&s.tokens[i-1].attrPush(["data-type","image"]);var d;if(n.link==!0&&l.children.length===1&&(d=l.children[0],l.children.unshift(new s.Token("link_open","a",1)),l.children[0].attrPush(["href",d.attrGet("src")]),l.children.push(new s.Token("link_close","a",-1))),d=l.children.length===1?l.children[0]:l.children[1],n.figcaption==!0&&d.children&&d.children.length&&(l.children.push(new s.Token("figcaption_open","figcaption",1)),l.children.splice(l.children.length,0,...d.children),l.children.push(new s.Token("figcaption_close","figcaption",-1)),d.children.length=0),n.copyAttrs&&d.attrs){const _=n.copyAttrs===!0?"":n.copyAttrs;u.attrs=d.attrs.filter(([p,g])=>p.match(_))}n.tabindex==!0&&(s.tokens[i-1].attrPush(["tabindex",o]),o++),n.lazyLoading==!0&&d.attrPush(["loading","lazy"])}}}e.core.ruler.before("linkify","implicit_figures",r)};const n3e=vn(t3e);var Kn={};Kn.getAttrs=function(t,e,n){const r=/[^\t\n\f />"'=]/,s=" ",o="=",i=".",a="#",l=[];let u="",d="",_=!0,p=!1;for(let g=e+n.leftDelimiter.length;g<t.length;g++){if(t.slice(g,g+n.rightDelimiter.length)===n.rightDelimiter){u!==""&&l.push([u,d]);break}const f=t.charAt(g);if(f===o&&_){_=!1;continue}if(f===i&&u===""){t.charAt(g+1)===i?(u="css-module",g+=1):u="class",_=!1;continue}if(f===a&&u===""){u="id",_=!1;continue}if(f==='"'&&d===""&&!p){p=!0;continue}if(f==='"'&&p){p=!1;continue}if(f===s&&!p){if(u==="")continue;l.push([u,d]),u="",d="",_=!0;continue}if(!(_&&f.search(r)===-1)){if(_){u+=f;continue}d+=f}}if(n.allowedAttributes&&n.allowedAttributes.length){const g=n.allowedAttributes;return l.filter(function(f){const h=f[0];function E(b){return h===b||b instanceof RegExp&&b.test(h)}return g.some(E)})}return l};Kn.addAttrs=function(t,e){for(let n=0,r=t.length;n<r;++n){const s=t[n][0];s==="class"?e.attrJoin("class",t[n][1]):s==="css-module"?e.attrJoin("css-module",t[n][1]):e.attrPush(t[n])}return e};Kn.hasDelimiters=function(t,e){if(!t)throw new Error('Parameter `where` not passed. Should be "start", "end" or "only".');return function(n){const r=e.leftDelimiter.length+1+e.rightDelimiter.length;if(!n||typeof n!="string"||n.length<r)return!1;function s(d){const _=d.charAt(e.leftDelimiter.length)===".",p=d.charAt(e.leftDelimiter.length)==="#";return _||p?d.length>=r+1:d.length>=r}let o,i,a,l;const u=r-e.rightDelimiter.length;switch(t){case"start":a=n.slice(0,e.leftDelimiter.length),o=a===e.leftDelimiter?0:-1,i=o===-1?-1:n.indexOf(e.rightDelimiter,u),l=n.charAt(i+e.rightDelimiter.length),l&&e.rightDelimiter.indexOf(l)!==-1&&(i=-1);break;case"end":o=n.lastIndexOf(e.leftDelimiter),i=o===-1?-1:n.indexOf(e.rightDelimiter,o+u),i=i===n.length-e.rightDelimiter.length?i:-1;break;case"only":a=n.slice(0,e.leftDelimiter.length),o=a===e.leftDelimiter?0:-1,a=n.slice(n.length-e.rightDelimiter.length),i=a===e.rightDelimiter?n.length-e.rightDelimiter.length:-1;break;default:throw new Error(`Unexpected case ${t}, 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:Ue.hasDelimiters("only",t)}]}],transform:(n,r,s)=>{const o=n[r].children[s],i=Ue.getAttrs(o.content,0,t);let a=r+1;for(;n[a+1]&&n[a+1].nesting===-1;)a++;const l=Ue.getMatchingOpeningToken(n,a);Ue.addAttrs(i,l),n[r].children=n[r].children.slice(0,-2)}},{name:"horizontal rule",tests:[{shift:0,type:"paragraph_open"},{shift:1,type:"inline",children:n=>n.length===1,content:n=>n.match(e)!==null},{shift:2,type:"paragraph_close"}],transform:(n,r)=>{const s=n[r];s.type="hr",s.tag="hr",s.nesting=0;const o=n[r+1].content,i=o.lastIndexOf(t.leftDelimiter),a=Ue.getAttrs(o,i,t);Ue.addAttrs(a,s),s.markup=o,n.splice(r+1,2)}},{name:"end of block",tests:[{shift:0,type:"inline",children:[{position:-1,content:Ue.hasDelimiters("end",t),type:n=>n!=="code_inline"&&n!=="math_inline"}]}],transform:(n,r,s)=>{const o=n[r].children[s],i=o.content,a=Ue.getAttrs(i,i.lastIndexOf(t.leftDelimiter),t);let l=r+1;for(;n[l+1]&&n[l+1].nesting===-1;)l++;const u=Ue.getMatchingOpeningToken(n,l);Ue.addAttrs(a,u);const d=i.slice(0,i.lastIndexOf(t.leftDelimiter));o.content=hf(d)!==" "?d:d.slice(0,-1)}}]};function hf(t){return t.slice(-1)[0]}const l3e=a3e,c3e={leftDelimiter:"{",rightDelimiter:"}",allowedAttributes:[]};var d3e=function(e,n){let r=Object.assign({},c3e);r=Object.assign(r,n);const s=l3e(r);function o(i){const a=i.tokens;for(let l=0;l<a.length;l++)for(let u=0;u<s.length;u++){const d=s[u];let _=null;d.tests.every(g=>{const f=g_(a,l,g);return f.j!==null&&(_=f.j),f.match})&&(d.transform(a,l,_),(d.name==="inline attributes"||d.name==="inline nesting 0")&&u--)}}e.core.ruler.before("linkify","curly_attributes",o)};function g_(t,e,n){const r={match:!1,j:null},s=n.shift!==void 0?e+n.shift:n.position;if(n.shift!==void 0&&s<0)return r;const o=p3e(t,s);if(o===void 0)return r;for(const i of Object.keys(n))if(!(i==="shift"||i==="position")){if(o[i]===void 0)return r;if(i==="children"&&u3e(n.children)){if(o.children.length===0)return r;let a;const l=n.children,u=o.children;if(l.every(d=>d.position!==void 0)){if(a=l.every(d=>g_(u,d.position,d).match),a){const d=m3e(l).position;r.j=d>=0?d:u.length+d}}else for(let d=0;d<u.length;d++)if(a=l.every(_=>g_(u,d,_).match),a){r.j=d;break}if(a===!1)return r;continue}switch(typeof n[i]){case"boolean":case"number":case"string":if(o[i]!==n[i])return r;break;case"function":if(!n[i](o[i]))return r;break;case"object":if(_3e(n[i])){if(n[i].every(l=>l(o[i]))===!1)return r;break}default:throw new Error(`Unknown type of pattern test (key: ${i}). Test should be of type boolean, number, string, function or array of functions.`)}}return r.match=!0,r}function u3e(t){return Array.isArray(t)&&t.length&&t.every(e=>typeof e=="object")}function _3e(t){return Array.isArray(t)&&t.length&&t.every(e=>typeof e=="function")}function p3e(t,e){return e>=0?t[e]:t[t.length+e]}function m3e(t){return t.slice(-1)[0]||{}}const g3e=vn(d3e);function tT(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&tT(n)}),t}class Ef{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function nT(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function qn(t,...e){const n=Object.create(null);for(const r in t)n[r]=t[r];return e.forEach(function(r){for(const s in r)n[s]=r[s]}),n}const f3e="</span>",bf=t=>!!t.scope,h3e=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,s)=>`${r}${"_".repeat(s+1)}`)].join(" ")}return`${e}${t}`};class E3e{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText
https://github.com/highlightjs/highlight.js/issues/2277`),pe=I,X=Q),re===void 0&&(re=!0);const ee={code:X,language:pe};se("before:highlight",ee);const be=ee.result?ee.result:_(ee.language,ee.code,re);return be.code=ee.code,se("after:highlight",be),be}function _(I,Q,re,X){const pe=Object.create(null);function ee(J,ce){return J.keywords[ce]}function be(){if(!D.keywords){G.addText(q);return}let J=0;D.keywordPatternRe.lastIndex=0;let ce=D.keywordPatternRe.exec(q),Se="";for(;ce;){Se+=q.substring(J,ce.index);const Oe=W.case_insensitive?ce[0].toLowerCase():ce[0],Le=ee(D,Oe);if(Le){const[Be,nt]=Le;if(G.addText(Se),Se="",pe[Oe]=(pe[Oe]||0)+1,pe[Oe]<=a4e&&(V+=nt),Be.startsWith("_"))Se+=ce[0];else{const Xe=W.classNameAliases[Be]||Be;Ee(ce[0],Xe)}}else Se+=ce[0];J=D.keywordPatternRe.lastIndex,ce=D.keywordPatternRe.exec(q)}Se+=q.substring(J),G.addText(Se)}function Re(){if(q==="")return;let J=null;if(typeof D.subLanguage=="string"){if(!e[D.subLanguage]){G.addText(q);return}J=_(D.subLanguage,q,!0,K[D.subLanguage]),K[D.subLanguage]=J._top}else J=g(q,D.subLanguage.length?D.subLanguage:null);D.relevance>0&&(V+=J.relevance),G.__addSublanguage(J._emitter,J.language)}function he(){D.subLanguage!=null?Re():be(),q=""}function Ee(J,ce){J!==""&&(G.startScope(ce),G.addText(J),G.endScope())}function z(J,ce){let Se=1;const Oe=ce.length-1;for(;Se<=Oe;){if(!J._emit[Se]){Se++;continue}const Le=W.classNameAliases[J[Se]]||J[Se],Be=ce[Se];Le?Ee(Be,Le):(q=Be,be(),q=""),Se++}}function te(J,ce){return J.scope&&typeof J.scope=="string"&&G.openNode(W.classNameAliases[J.scope]||J.scope),J.beginScope&&(J.beginScope._wrap?(Ee(q,W.classNameAliases[J.beginScope._wrap]||J.beginScope._wrap),q=""):J.beginScope._multi&&(z(J.beginScope,ce),q="")),D=Object.create(J,{parent:{value:D}}),D}function Y(J,ce,Se){let Oe=T3e(J.endRe,Se);if(Oe){if(J["on:end"]){const Le=new Ef(J);J["on:end"](ce,Le),Le.isMatchIgnored&&(Oe=!1)}if(Oe){for(;J.endsParent&&J.parent;)J=J.parent;return J}}if(J.endsWithParent)return Y(J.parent,ce,Se)}function ue(J){return D.matcher.regexIndex===0?(q+=J[0],1):(ge=!0,0)}function ye(J){const ce=J[0],Se=J.rule,Oe=new Ef(Se),Le=[Se.__beforeBegin,Se["on:begin"]];for(const Be of Le)if(Be&&(Be(J,Oe),Oe.isMatchIgnored))return ue(ce);return Se.skip?q+=ce:(Se.excludeBegin&&(q+=ce),he(),!Se.returnBegin&&!Se.excludeBegin&&(q=ce)),te(Se,J),Se.returnBegin?0:ce.length}function O(J){const ce=J[0],Se=Q.substring(J.index),Oe=Y(D,J,Se);if(!Oe)return Cf;const Le=D;D.endScope&&D.endScope._wrap?(he(),Ee(ce,D.endScope._wrap)):D.endScope&&D.endScope._multi?(he(),z(D.endScope,J)):Le.skip?q+=ce:(Le.returnEnd||Le.excludeEnd||(q+=ce),he(),Le.excludeEnd&&(q=ce));do D.scope&&G.closeNode(),!D.skip&&!D.subLanguage&&(V+=D.relevance),D=D.parent;while(D!==Oe.parent);return Oe.starts&&te(Oe.starts,J),Le.returnEnd?0:ce.length}function N(){const J=[];for(let ce=D;ce!==W;ce=ce.parent)ce.scope&&J.unshift(ce.scope);J.forEach(ce=>G.openNode(ce))}let F={};function $(J,ce){const Se=ce&&ce[0];if(q+=J,Se==null)return he(),0;if(F.type==="begin"&&ce.type==="end"&&F.index===ce.index&&Se===""){if(q+=Q.slice(ce.index,ce.index+1),!s){const Oe=new Error(`0 width match regex (${I})`);throw Oe.languageName=I,Oe.badRule=F.rule,Oe}return 1}if(F=ce,ce.type==="begin")return ye(ce);if(ce.type==="illegal"&&!re){const Oe=new Error('Illegal lexeme "'+Se+'" for mode "'+(D.scope||"<unnamed>")+'"');throw Oe.mode=D,Oe}else if(ce.type==="end"){const Oe=O(ce);if(Oe!==Cf)return Oe}if(ce.type==="illegal"&&Se==="")return 1;if(oe>1e5&&oe>ce.index*3)throw new Error("potential infinite loop, way more iterations than matches");return q+=Se,Se.length}const W=R(I);if(!W)throw dr(o.replace("{}",I)),new Error('Unknown language: "'+I+'"');const ae=r4e(W);let me="",D=X||ae;const K={},G=new a.__emitter(a);N();let q="",V=0,ne=0,oe=0,ge=!1;try{if(W.__emitTokens)W.__emitTokens(Q,G);else{for(D.matcher.considerAll();;){oe++,ge?ge=!1:D.matcher.considerAll(),D.matcher.lastIndex=ne;const J=D.matcher.exec(Q);if(!J)break;const ce=Q.substring(ne,J.index),Se=$(ce,J);ne=J.index+Se}$(Q.substring(ne))}return G.finalize(),me=G.toHTML(),{language:I,valu
2023-12-04 00:40:36 +00:00
`},f]}}return Vc=s,Vc}var zc,dE;function K9e(){if(dE)return zc;dE=1;function t(e){const n="[a-zA-Z_][\\w.]*",r="<\\?(lasso(script)?|=)",s="\\]|\\?>",o={$pattern:n+"|&[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"},i=e.COMMENT("<!--","-->",{relevance:0}),a={className:"meta",begin:"\\[noprocess\\]",starts:{end:"\\[/noprocess\\]",returnEnd:!0,contains:[i]}},l={className:"meta",begin:"\\[/noprocess|"+r},u={className:"symbol",begin:"'"+n+"'"},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:"[#$]"+n},{begin:"#",end:"\\d+",illegal:"\\W"}]},{className:"type",begin:"::\\s*",end:n,illegal:"\\W"},{className:"params",variants:[{begin:"-(?!infinity)"+n,relevance:0},{begin:"(\\.\\.\\.)"}]},{begin:/(->|\.)\s*/,relevance:0,contains:[u]},{className:"class",beginKeywords:"define",returnEnd:!0,end:"\\(|=>",contains:[e.inherit(e.TITLE_MODE,{begin:n+"(=(?!>))?|[-+*/%](?!>)"})]}];return{name:"Lasso",aliases:["ls","lassoscript"],case_insensitive:!0,keywords:o,contains:[{className:"meta",begin:s,relevance:0,starts:{end:"\\[|"+r,returnEnd:!0,relevance:0,contains:[i]}},a,l,{className:"meta",begin:"\\[no_square_brackets",starts:{end:"\\[/no_square_brackets\\]",keywords:o,contains:[{className:"meta",begin:s,relevance:0,starts:{end:"\\[noprocess\\]|"+r,returnEnd:!0,contains:[i]}},a,l].concat(d)}},{className:"meta",begin:"\\[",relevance:0},{className:"meta",begin:"^#!",end:"lasso9$",relevance:10}].concat(d)}}return zc=t,zc}var Hc,uE;function Q9e(){if(uE)return Hc;uE=1;function t(e){const r=e.regex.either(...["(?:NeedsTeXFormat|RequirePackage|GetIdInfo)","Provides(?:Expl)?(?:Package|Class|File)","(?:DeclareOption|ProcessOptions)","(?:documentclass|usepackage|input|include)","makeat(?:letter|other)","ExplSyntax(?:On|Off)","(?:new|renew|provide)?command","(?:re)newenvironment","(?:New|Renew|Provide|Declare)(?:Expandable)?DocumentCommand","(?:New|Renew|Provide|Declare)DocumentEnvironment","(?:(?:e|g|x)?def|let)","(?:begin|end)","(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph)","caption","(?:label|(?:eq|page|name)?ref|(?:paren|foot|super)?cite)","(?:alpha|beta|[Gg]amma|[Dd]elta|(?:var)?epsilon|zeta|eta|[Tt]heta|vartheta)","(?:iota|(?:var)?kappa|[Ll]ambda|mu|nu|[Xx]i|[Pp]i|varpi|(?:var)rho)","(?:[Ss]igma|varsigma|tau|[Uu]psilon|[Pp]hi|varphi|chi|[Pp]si|[Oo]mega)","(?:frac|sum|prod|lim|infty|times|sqrt|leq|geq|left|right|middle|[bB]igg?)","(?:[lr]angle|q?quad|[lcvdi]?dots|d?dot|hat|tilde|bar)"].map(L=>L+"(?![a-zA-Z@:_])")),s=new RegExp(["(?:__)?[a-zA-Z]{2,}_[a-zA-Z](?:_?[a-zA-Z])+:[a-zA-Z]*","[lgc]__?[a-zA-Z](?:_?[a-zA-
2023-12-05 21:32:14 +00:00
]`,f={scope:"string",variants:[d,u,_,p]},h={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},E=["false","null","true"],b=["__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"],m=["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"],T={keyword:b,literal:(B=>{const se=[];return B.forEach(H=>{se.push(H),H.toLowerCase()===H?se.push(H.toUpperCase()):se.push(H.toLowerCase())}),se})(E),built_in:m},A=B=>B.map(se=>se.replace(/\|\d+$/,"")),x={variants:[{match:[/new/,n.concat(g,"+"),n.concat("(?!",A(m).join("\\b|"),"\\b)"),o],scope:{1:"keyword",4:"title.class"}}]},k=n.concat(s,"\\b(?!\\()"),y={variants:[{match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),k],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[o,n.concat(/::/,n.lookahead(/(?!class\b)/)),k],scope:{1:"title.class",3:"variable.constant"}},{match:[o,n.concat("::",n.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[o,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},R={scope:"attr",match:n.concat(s,n.lookahead(":"),n.lookahead(/(?!::)/))},w={relevance:0,begin:/\(/,end:/\)/,keywords:T,contains:[R,i,y,e.C_BLOCK_COMMENT_MODE,f,h,x]},L={relevance:0,match:[/\b/,n.concat("(?!fn\\b|function\\b|",A(b).join("\\b|"),"|",A(m).join("\\b|"),"\\b)"),s,n.concat(g,"*"),n.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[w]};w.contains.push(L);const M=[R,y,e.C_BLOCK_COMMENT_MODE,f,h,x],Z={begin:n.concat(/#\[\s*/,o),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:E,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:E,keyword:["new","array"]},contains:["self",...M]},
]*;`,relevance:0},{begin:"[vp][0-9]+"}]}}return ru=t,ru}var su,Cb;function l6e(){if(Cb)return su;Cb=1;function t(e){const n="[a-z][a-zA-Z0-9_]*",r={className:"string",begin:"\\$.{1}"},s={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:n+":",relevance:0},e.C_NUMBER_MODE,s,r,{begin:"\\|[ ]*"+n+"([ ]+"+n+")*[ ]*\\|",returnBegin:!0,end:/\|/,illegal:/\S/,contains:[{begin:"(\\|[ ]*)?"+n}]},{begin:"#\\(",end:"\\)",contains:[e.APOS_STRING_MODE,r,e.C_NUMBER_MODE,s]}]}}return su=t,su}var ou,Rb;function c6e(){if(Rb)return ou;Rb=1;function t(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 ou=t,ou}var iu,xb;function d6e(){if(xb)return iu;xb=1;function t(e){const n={className:"variable",begin:/\b_+[a-zA-Z]\w*/},r={className:"title",begin:/[a-zA-Z][a-zA-Z_0-9]*_fnc_[a-zA-Z_0-9]+/},s={className:"string",variants:[{begin:'"',end:'"',contains:[{begin:'""',relevance:0}]},{begin:"'",end:"'",contains:[{begin:"''",relevance:0}]}]},o=["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"],i=["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
2023-11-09 23:31:56 +00:00
]*?"'`},{begin:`"[^\r
2023-12-05 21:32:14 +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 cu=t,cu}var du,wb;function m6e(){if(wb)return du;wb=1;function t(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 du=t,du}var uu,Ib;function g6e(){if(Ib)return uu;Ib=1;const t=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"],n=["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"],r=["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","
2023-11-09 23:31:56 +00:00
(multipart)?`,end:`\\]
2023-12-06 00:28:13 +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 _u=t,_u}var pu,kb;function h6e(){if(kb)return pu;kb=1;function t(y){return y?typeof y=="string"?y:y.source:null}function e(y){return n("(?=",y,")")}function n(...y){return y.map(w=>t(w)).join("")}function r(y){const R=y[y.length-1];return typeof R=="object"&&R.constructor===Object?(y.splice(y.length-1,1),R):{}}function s(...y){return"("+(r(y).capture?"":"?:")+y.map(L=>t(L)).join("|")+")"}const o=y=>n(/\b/,y,/\w$/.test(y)?/\b/:/\B/),i=["Protocol","Type"].map(o),a=["init","self"].map(o),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"],_=["assignment","associativity","higherThan","left","lowerThan","none","right"],p=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],g=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],f=s(/[/=\-+!*%<>&|^~?]/,/[\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]/),h=s(f,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),E=n(f,h,"*"),b=s(/[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]/),m=s(b,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),S=n(b,m,"*"),T=n(/[A-Z]/,m,"*"),A=["attached","autoclosure",n(/convention\(/,s("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",n(/objc\(/,S,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain",
2023-12-05 21:32:14 +00:00
`),r=n.length.toString().length,s=n.map((u,d)=>(d+1).toString().padStart(r," ")),o=document.createElement("div");o.classList.add("line-numbers"),o.innerHTML=s.join("<br>");const i=document.createElement("div");i.classList.add("code-container");const a=document.createElement("pre"),l=document.createElement("code");return l.classList.add("code-content"),l.innerHTML=mr.highlight(t,e).value,a.appendChild(l),i.appendChild(o),i.appendChild(a),i.outerHTML}},methods:{copyCode(){this.isCopied=!0,console.log("Copying code");const t=document.createElement("textarea");t.value=this.code,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),ve(()=>{Ce.replace()})},executeCode(){const t=JSON.stringify({code:this.code,discussion_id:this.discussion_id,message_id:this.message_id,language:this.language});console.log(t),fetch(`${this.host}/execute_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:t}).then(e=>e.json()).then(e=>{console.log(e),this.executionOutput=e.output}).catch(e=>{console.error("Fetch error:",e)})},openFolder(){const t=JSON.stringify({discussion_id:this.discussion_id});console.log(t),fetch(`${this.host}/open_code_folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:t}).then(e=>e.json()).then(e=>{console.log(e)}).catch(e=>{console.error("Fetch error:",e)})}}},q6e={class:"bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},Y6e={class:"flex flex-row bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm"},V6e={class:"text-2xl"},z6e=c("i",{"data-feather":"copy"},null,-1),H6e=[z6e],$6e=c("i",{"data-feather":"play-circle"},null,-1),W6e=[$6e],K6e=c("i",{"data-feather":"folder"},null,-1),Q6e=[K6e],j6e={class:"hljs p-1 rounded-md break-all grid grid-cols-1"},Z6e={class:"code-container"},X6e=["innerHTML"],J6e={key:0,class:"text-2xl"},e8e={key:1,class:"hljs mt-0 p-1 rounded-md break-all grid grid-cols-1"},t8e={class:"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"},n8e=["innerHTML"];function r8e(t,e,n,r,s,o){return v(),C("div",q6e,[c("div",Y6e,[c("span",V6e,j(n.language),1),c("button",{onClick:e[0]||(e[0]=(...i)=>o.copyCode&&o.copyCode(...i)),title:"copy",class:Ne([s.isCopied?"bg-green-500":"bg-bg-dark-tone-panel dark:bg-bg-dark-tone","px-2 py-1 ml-2 text-left p-2 text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"])},H6e,2),["python","shell","bash","cmd","powershell"].includes(n.language)?(v(),C("button",{key:0,ref:"btn_code_exec",onClick:e[1]||(e[1]=(...i)=>o.executeCode&&o.executeCode(...i)),title:"execute",class:"px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"},W6e,512)):U("",!0),["python"].includes(n.language)?(v(),C("button",{key:1,onClick:e[2]||(e[2]=(...i)=>o.openFolder&&o.openFolder(...i)),title:"open code project folder",class:"px-2 py-1 ml-2 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary text-white text-xs transition-colors duration-200"},Q6e)):U("",!0)]),c("pre",j6e,[xe(" "),c("div",Z6e,[xe(`
`),c("code",{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:o.highlightedCode},null,8,X6e),xe(`
2023-11-09 23:31:56 +00:00
`)]),xe(`
2023-12-05 21:32:14 +00:00
`)]),s.executionOutput?(v(),C("span",J6e,"Execution output")):U("",!0),s.executionOutput?(v(),C("pre",e8e,[xe(" "),c("div",t8e,[xe(`
`),c("div",{ref:"execution_output",innerHTML:s.executionOutput},null,8,n8e),xe(`
2023-11-09 23:31:56 +00:00
`)]),xe(`
2023-12-06 00:28:13 +00:00
`)])):U("",!0)])}const s8e=qe(G6e,[["render",r8e]]);function o8e(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const i8e={name:"MarkdownRenderer",props:{host:{type:String,required:!1,default:"http://localhost:9600"},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:s8e},setup(t){const e=new Uce({html:!0,highlight:(s,o)=>{const i=o&&mr.getLanguage(o)?o:"plaintext";return mr.highlight(i,s).value},renderInline:!0,breaks:!0}).use(Y5e).use(Mr).use(n3e,{figcaption:!0}).use(g3e).use(j5e,{inlineOpen:"$",inlineClose:"$",blockOpen:"$$",blockClose:"$$"}).use(e3e,{enableRowspan:!0,enableColspan:!0,enableGridTables:!0,enableGridTablesExtra:!0,enableTableIndentation:!0,tableCellPadding:" ",tableCellJoiner:"|",multilineCellStartMarker:"|>",multilineCellEndMarker:"<|",multilineCellPadding:" ",multilineCellJoiner:`
2023-12-05 21:32:14 +00:00
`}),n=BS([]),r=()=>{if(t.markdownText){let s=e.parse(t.markdownText,{}),o=[];n.value=[];for(let i=0;i<s.length;i++)s[i].type!=="fence"?o.push(s[i]):(o.length>0&&(n.value.push({type:"html",html:e.renderer.render(o,e.options,{})}),o=[]),n.value.push({type:"code",language:o8e(s[i].info),code:s[i].content}));o.length>0&&(n.value.push({type:"html",html:e.renderer.render(o,e.options,{})}),o=[])}else n.value=[];ve(()=>{Ce.replace()})};return zn(()=>t.markdownText,r),to(r),{markdownItems:n}}},a8e={class:"break-all"},l8e={ref:"mdRender",class:"markdown-content"},c8e=["innerHTML"];function d8e(t,e,n,r,s,o){const i=Pe("code-block");return v(),C("div",a8e,[c("div",l8e,[(v(!0),C(we,null,Ge(r.markdownItems,(a,l)=>(v(),C("div",{key:l},[a.type==="code"?(v(),st(i,{key:0,host:n.host,language:a.language,code:a.code,discussion_id:n.discussion_id,message_id:n.message_id},null,8,["host","language","code","discussion_id","message_id"])):(v(),C("div",{key:1,innerHTML:a.html},null,8,c8e))]))),128))],512)])}const pT=qe(i8e,[["render",d8e]]);const u8e={props:{value:String,inputType:{type:String,default:"text",validator:t=>["text","email","password","file","path","integer","float"].includes(t)},fileAccept:String},data(){return{inputValue:this.value,placeholderText:this.getPlaceholderText()}},watch:{value(t){console.log("Changing value to ",t),this.inputValue=t}},mounted(){ve(()=>{Ce.replace()}),console.log("Changing value to ",this.value),this.inputValue=this.value},methods:{handleSliderInput(t){this.inputValue=t.target.value,this.$emit("input",t.target.value)},getPlaceholderText(){switch(this.inputType){case"text":return"Enter text here";case"email":return"Enter your email";case"password":return"Enter your password";case"file":case"path":return"Choose a file";case"integer":return"Enter an integer";case"float":return"Enter a float";default:return"Enter value here"}},handleInput(t){if(this.inputType==="integer"){const e=t.target.value.replace(/[^0-9]/g,"");this.inputValue=e}console.log("handling input : ",t.target.value),this.$emit("input",t.target.value)},async pasteFromClipboard(){try{const t=await navigator.clipboard.readText();this.handleClipboardData(t)}catch(t){console.error("Failed to read from clipboard:",t)}},handlePaste(t){const e=t.clipboardData.getData("text");this.handleClipboardData(e)},handleClipboardData(t){switch(this.inputType){case"email":this.inputValue=this.isValidEmail(t)?t:"";break;case"password":this.inputValue=t;break;case"file":case"path":this.inputValue="";break;case"integer":this.inputValue=this.parseInteger(t);break;case"float":this.inputValue=this.parseFloat(t);break;default:this.inputValue=t;break}},isValidEmail(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)},parseInteger(t){const e=parseInt(t);return isNaN(e)?"":e},parseFloat(t){const e=parseFloat(t);return isNaN(e)?"":e},openFileInput(){this.$refs.fileInput.click()},handleFileInputChange(t){const e=t.target.files[0];e&&(this.inputValue=e.name)}}},_8e={class:"flex items-center space-x-2"},p8e=["value","type","placeholder"],m8e=["value","min","max"],g8e=c("i",{"data-feather":"clipboard"},null,-1),f8e=[g8e],h8e=c("i",{"data-feather":"upload"},null,-1),E8e=[h8e],b8e=["accept"];function S8e(t,e,n,r,s,o){return v(),C("div",_8e,[t.useSlider?(v(),C("input",{key:1,type:"range",value:parseInt(s.inputValue),min:t.minSliderValue,max:t.maxSliderValue,onInput:e[2]||(e[2]=(...i)=>o.handleSliderInput&&o.handleSliderInput(...i)),class:"flex-1 px-4 py-2 text-lg border dark:bg-gray-600 border-gray-300 rounded-md focus:outline-none focus:ring focus:border-blue-500"},null,40,m8e)):(v(),C("input",{key:0,value:s.inputValue,type:n.inputType,placeholder:s.placeholderText,onInput:e[0]||(e[0]=(...i)=>o.handleInput&&o.handleInput(...i)),onPaste:e[1]||(e[1]=(...i)=>o.handlePaste&&o.handlePaste(...i)),class:"flex-1 px-4 py-2 text-lg dark:bg-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring focus:border-blue-500"},null,40,p8e)),c("button",{onClick:e[3]||(e[3]=(...i)=>o.pasteFromClipboard&&o.pasteFromClipboard(...i)),class:"p-2 bg-blue-500 dark:bg-gray-600 text-white rounded-
2023-11-09 23:31:56 +00:00
<div class="bg-white p-6 rounded-md shadow-md w-80">
<h2 class="text-lg font-semibold mb-3">${t}</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>
`:o.innerHTML=`
<div class="bg-white p-6 rounded-md shadow-md w-80">
<h2 class="text-lg font-semibold mb-3">${t}</h2>
<select id="options_selector" class="form-control w-full h-25 border rounded p-2 mb-3">
${n.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>
2023-12-05 21:32:14 +00:00
`,document.body.appendChild(o);const i=o.querySelector("#cancelButton"),a=o.querySelector("#okButton");i.addEventListener("click",()=>{document.body.removeChild(o),r(null)}),a.addEventListener("click",()=>{if(n.length===0){const u=o.querySelector("#replacementInput").value.trim();document.body.removeChild(o),r(u)}else{const u=o.querySelector("#options_selector").value.trim();document.body.removeChild(o),r(u)}})})}function R8e(t,e){console.log(t);let n={},r=/@<([^>]+)>@/g,s=[],o;for(;(o=r.exec(t))!==null;)s.push("@<"+o[1]+">@");console.log("matches"),console.log(s),s=[...new Set(s)];async function i(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(([E,b])=>{console.log(`Key: ${E}, Value: ${b}`);function m(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const S=m(E),T=new RegExp(S,"g");u=u.replace(T,b)});let _=u.split(":"),p=_[0],g=_[1]||"",f=[];_.length>2&&(f=_.slice(1));let h=await tS(p,g,f);h!==null&&(n[l]=h)}else{let d=await tS(u);d!==null&&(n[l]=d)}}let a=Promise.resolve();s.forEach(l=>{a=a.then(()=>i(l)).then(u=>{console.log(u)})}),a.then(()=>{Object.entries(n).forEach(([l,u])=>{console.log(`Key: ${l}, Value: ${u}`);function d(g){return g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const _=d(l),p=new RegExp(_,"g");t=t.replace(p,u)}),e(t)})}const x8e={name:"PlayGroundView",data(){return{mdRenderHeight:300,selecting_model:!1,tab_id:"source",generating:!1,isSpeaking:!1,voices:[],isLesteningToVoice:!1,presets:[],selectedPreset:"",cursorPosition:0,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:Sr,MarkdownRenderer:pT,ClipBoardTextInput:Tp,Card:ao},mounted(){Te.get("./get_presets").then(t=>{console.log(t.data),this.presets=t.data,this.selectedPreset=this.presets[0]}).catch(t=>{this.$refs.toast.showToast(`Error: ${t}`,4,!1)}),Ae.on("text_chunk",t=>{this.appendToOutput(t.chunk)}),Ae.on("text_generated",t=>{this.generating=!1}),Ae.on("generation_error",t=>{console.log("generation_error:",t),this.$refs.toast.showToast(`Error: ${t}`,4,!1),this.generating=!1}),Ae.on("connect",()=>{console.log("Connected to LoLLMs server"),this.$store.state.isConnected=!0,this.generating=!1}),Ae.on("buzzy",t=>{conso
`];let a=-1;return i.forEach(l=>{const u=o.lastIndexOf(l);u>a&&(a=u)}),a==-1&&(a=o.length),console.log(a),a+s+1},r=()=>{const s=n(t),o=this.text.substring(t,s);this.msg.text=o,t=s+1,this.msg.onend=i=>{t<this.text.length-2?setTimeout(()=>{r()},1):(this.isSpeaking=!1,console.log("voice off :",this.text.length," ",s))},this.speechSynthesis.speak(this.msg)};r()},getCursorPosition(){return this.$refs.mdTextarea.selectionStart},appendToOutput(t){this.pre_text+=t,this.text=this.pre_text+this.post_text},generate_in_placeholder(){console.log("Finding cursor position");let t=this.text.indexOf("@<generation_placeholder>@");if(t<0){this.$refs.toast.showToast("No generation placeholder found",4,!1);return}this.text=this.text.substring(0,t)+this.text.substring(t+26,this.text.length),this.pre_text=this.text.substring(0,t),this.post_text=this.text.substring(t,this.text.length);var e=this.text.substring(0,t);console.log(e),Ae.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},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 t=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:${t}`),Ae.emit("generate_text",{prompt:t,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(){Ae.emit("cancel_text_generation",{})},exportText(){const t=this.text,e=document.createElement("a"),n=new Blob([t],{type:"text/plain"});e.href=URL.createObjectURL(n),e.download="exported_text.txt",document.body.appendChild(e),e.click(),document.body.removeChild(e)},importText(){const t=document.getElementById("import-input");t&&(t.addEventListener("change",e=>{if(e.target.files&&e.target.files[0]){const n=new FileReader;n.onload=()=>{this.text=n.result},n.readAsText(e.target.files[0])}else alert("Please select a file.")}),t.click())},setPreset(){console.log("Setting preset"),console.log(this.selectedPreset),this.tab_id="render",this.text=R8e(this.selectedPreset.content,t=>{console.log("Done"),console.log(t),this.text=t})},addPreset(){let t=prompt("Enter the title of the preset:");this.presets[t]={name:t,content:this.text},Te.post("./add_preset",this.presets[t]).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(){Te.get("./get_presets").then(t=>{console.log(t.data),this.presets=t.data,this.selectedPreset=this.presets[0]}).catch(t=>{this.$refs.toast.showToast(`Error: ${t}`,4,!1)})},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this.$store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.pre_text=this.text.substring(0,this.getCursorPosition()),this.post_text=this.text.substring(this.getCursorPosition(),this.text.length),this.recognition.onresult=t=>{this.generated="";for(let e=t.resultIndex;e<t.results.length;e++)this.generated+=t.results[e][0].transcript;this.text=this.pre_text+this.generated+this.post_text,this.cursorPosition=this.pre_text.length+this.generated.length,clearTimeout(this.silenceTimer),this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)
`,36),[[De,s.text]]),c("span",null,"Cursor position "+j(s.cursorPosition),1)])):U("",!0),s.tab_id==="render"?(v(),C("div",Q8e,[fe(i,{ref:"mdRender","markdown-text":s.text,class:"mt-4 p-2 rounded shadow-lg dark:bg-bg-dark"},null,8,["markdown-text"])])):U("",!0)],2)]),fe(a,{title:"settings",class:"slider-container ml-0 mr-0 max-width",isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:ke(()=>[fe(a,{title:"Model",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:ke(()=>[le(c("select",{"onUpdate:modelValue":e[13]||(e[13]=u=>o.selectedModel=u),onChange:e[14]||(e[14]=(...u)=>o.setModel&&o.setModel(...u)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(v(!0),C(we,null,Ge(o.models,u=>(v(),C("option",{key:u,value:u},j(u),9,j8e))),128))],544),[[Qt,o.selectedModel]]),s.selecting_model?(v(),C("div",Z8e,J8e)):U("",!0)]),_:1}),fe(a,{title:"Presets",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:ke(()=>[le(c("select",{"onUpdate:modelValue":e[15]||(e[15]=u=>s.selectedPreset=u),class:"bg-white dark:bg-black mb-2 border-2 rounded-md shadow-sm w-full"},[(v(!0),C(we,null,Ge(s.presets,u=>(v(),C("option",{key:u,value:u},j(u.name),9,eqe))),128))],512),[[Qt,s.selectedPreset]]),tqe,c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[16]||(e[16]=(...u)=>o.setPreset&&o.setPreset(...u)),title:"Use preset"},rqe),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[17]||(e[17]=(...u)=>o.addPreset&&o.addPreset(...u)),title:"Add this text as a preset"},oqe),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[18]||(e[18]=(...u)=>o.removePreset&&o.removePreset(...u)),title:"Remove preset"},aqe),c("button",{class:"w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer",onClick:e[19]||(e[19]=(...u)=>o.reloadPresets&&o.reloadPresets(...u)),title:"Reload presets list"},cqe)]),_:1}),fe(a,{title:"Generation params",class:"slider-container ml-0 mr-0",is_subcard:!0,isHorizontal:!1,disableHoverAnimation:!0,disableFocus:!0},{default:ke(()=>[c("div",dqe,[uqe,le(c("input",{type:"range","onUpdate:modelValue":e[20]||(e[20]=u=>s.temperature=u),min:"0",max:"5",step:"0.1",class:"w-full"},null,512),[[De,s.temperature]]),c("span",_qe,"Current value: "+j(s.temperature),1)]),c("div",pqe,[mqe,le(c("input",{type:"range","onUpdate:modelValue":e[21]||(e[21]=u=>s.top_k=u),min:"1",max:"100",step:"1",class:"w-full"},null,512),[[De,s.top_k]]),c("span",gqe,"Current value: "+j(s.top_k),1)]),c("div",fqe,[hqe,le(c("input",{type:"range","onUpdate:modelValue":e[22]||(e[22]=u=>s.top_p=u),min:"0",max:"1",step:"0.1",class:"w-full"},null,512),[[De,s.top_p]]),c("span",Eqe,"Current value: "+j(s.top_p),1)]),c("div",bqe,[Sqe,le(c("input",{type:"range","onUpdate:modelValue":e[23]||(e[23]=u=>s.repeat_penalty=u),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),[[De,s.repeat_penalty]]),c("span",yqe,"Current value: "+j(s.repeat_penalty),1)]),c("div",vqe,[Tqe,le(c("input",{type:"range","onUpdate:modelValue":e[24]||(e[24]=u=>s.repeat_last_n=u),min:"0",max:"100",step:"1",class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[De,s.repeat_last_n]]),c("span",Cqe,"Current value: "+j(s.repeat_last_n),1)]),c("div",Rqe,[xqe,le(c("input",{type:"number","onUpdate:modelValue":e[25]||(e[25]=u=>s.n_crop=u),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[De,s.n_crop]]),c("span",Oqe,"Current value: "+j(s.n_crop),1)]),c("div",Aqe,[Nqe,le(c("input",{type:"number","onUpdate:modelValue":e[26]||(e[26]=u=>s.n_predicts=u),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},null,512),[[De,s.n_predicts]]),c("span",wqe,"Current value: "+j(s.n_predicts),1)]),c("div",Iqe,[Dqe,le(c("input",{type:"number","onUpdate:modelValue":
2023-11-09 23:31:56 +00:00
Papa Parse
v5.4.1
https://github.com/mholt/PapaParse
License: MIT
2023-12-04 00:40:36 +00:00
*/(function(t,e){(function(n,r){t.exports=r()})(pv,function n(){var r=typeof self<"u"?self:typeof window<"u"?window:r!==void 0?r:{},s=!r.document&&!!r.postMessage,o=r.IS_PAPA_WORKER||!1,i={},a=0,l={parse:function(y,R){var w=(R=R||{}).dynamicTyping||!1;if(k(w)&&(R.dynamicTypingFunction=w,w={}),R.dynamicTyping=w,R.transform=!!k(R.transform)&&R.transform,R.worker&&l.WORKERS_SUPPORTED){var L=function(){if(!l.WORKERS_SUPPORTED)return!1;var Z=(se=r.URL||r.webkitURL||null,H=n.toString(),l.BLOB_URL||(l.BLOB_URL=se.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",H,")();"],{type:"text/javascript"})))),B=new r.Worker(Z),se,H;return B.onmessage=m,B.id=a++,i[B.id]=B}();return L.userStep=R.step,L.userChunk=R.chunk,L.userComplete=R.complete,L.userError=R.error,R.step=k(R.step),R.chunk=k(R.chunk),R.complete=k(R.complete),R.error=k(R.error),delete R.worker,void L.postMessage({input:y,config:R,workerId:L.id})}var M=null;return l.NODE_STREAM_INPUT,typeof y=="string"?(y=function(Z){return Z.charCodeAt(0)===65279?Z.slice(1):Z}(y),M=R.download?new _(R):new g(R)):y.readable===!0&&k(y.read)&&k(y.on)?M=new f(R):(r.File&&y instanceof File||y instanceof Object)&&(M=new p(R)),M.stream(y)},unparse:function(y,R){var w=!1,L=!0,M=",",Z=`\r
`,B='"',se=B+B,H=!1,I=null,Q=!1;(function(){if(typeof R=="object"){if(typeof R.delimiter!="string"||l.BAD_DELIMITERS.filter(function(ee){return R.delimiter.indexOf(ee)!==-1}).length||(M=R.delimiter),(typeof R.quotes=="boolean"||typeof R.quotes=="function"||Array.isArray(R.quotes))&&(w=R.quotes),typeof R.skipEmptyLines!="boolean"&&typeof R.skipEmptyLines!="string"||(H=R.skipEmptyLines),typeof R.newline=="string"&&(Z=R.newline),typeof R.quoteChar=="string"&&(B=R.quoteChar),typeof R.header=="boolean"&&(L=R.header),Array.isArray(R.columns)){if(R.columns.length===0)throw new Error("Option columns is empty");I=R.columns}R.escapeChar!==void 0&&(se=R.escapeChar+B),(typeof R.escapeFormulae=="boolean"||R.escapeFormulae instanceof RegExp)&&(Q=R.escapeFormulae instanceof RegExp?R.escapeFormulae:/^[=+\-@\t\r].*$/)}})();var re=new RegExp(E(B),"g");if(typeof y=="string"&&(y=JSON.parse(y)),Array.isArray(y)){if(!y.length||Array.isArray(y[0]))return X(null,y,H);if(typeof y[0]=="object")return X(I||Object.keys(y[0]),y,H)}else if(typeof y=="object")return typeof y.data=="string"&&(y.data=JSON.parse(y.data)),Array.isArray(y.data)&&(y.fields||(y.fields=y.meta&&y.meta.fields||I),y.fields||(y.fields=Array.isArray(y.data[0])?y.fields:typeof y.data[0]=="object"?Object.keys(y.data[0]):[]),Array.isArray(y.data[0])||typeof y.data[0]=="object"||(y.data=[y.data])),X(y.fields||[],y.data||[],H);throw new Error("Unable to serialize unrecognized input");function X(ee,be,Re){var he="";typeof ee=="string"&&(ee=JSON.parse(ee)),typeof be=="string"&&(be=JSON.parse(be));var Ee=Array.isArray(ee)&&0<ee.length,z=!Array.isArray(be[0]);if(Ee&&L){for(var te=0;te<ee.length;te++)0<te&&(he+=M),he+=pe(ee[te],te);0<be.length&&(he+=Z)}for(var Y=0;Y<be.length;Y++){var ue=Ee?ee.length:be[Y].length,ye=!1,O=Ee?Object.keys(be[Y]).length===0:be[Y].length===0;if(Re&&!Ee&&(ye=Re==="greedy"?be[Y].join("").trim()==="":be[Y].length===1&&be[Y][0].length===0),Re==="greedy"&&Ee){for(var N=[],F=0;F<ue;F++){var $=z?ee[F]:F;N.push(be[Y][$])}ye=N.join("").trim()===""}if(!ye){for(var W=0;W<ue;W++){0<W&&!O&&(he+=M);var ae=Ee&&z?ee[W]:W;he+=pe(be[Y][ae],W)}Y<be.length-1&&(!Re||0<ue&&!O)&&(he+=Z)}}return he}function pe(ee,be){if(ee==null)return"";if(ee.constructor===Date)return JSON.stringify(ee).slice(1,25);var Re=!1;Q&&typeof ee=="string"&&Q.test(ee)&&(ee="'"+ee,Re=!0);var he=ee.toString().replace(re,se);return(Re=Re||w===!0||typeof w=="function"&&w(ee,be)||Array.isArray(w)&&w[be]||function(Ee,z){for(var te=0;te<z.length;te++)if(-1<Ee.indexOf(z[te]))return!0;return!1}(he,l.BAD_DELIMITERS)||-1<he.indexOf(M)||he.charAt(0)===" "||he.charAt(he.length-1)===" ")?B+he+B:he}}};if(l.RECORD_SEP=String.fromCharCode(30),l.UNIT_SEP=String.fromCharCode(31),l.BYTE_ORDER_MARK="\uFEFF",l.BAD_DELIMITERS=["\r",`
`,'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!s&&!!r.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=10485760,l.RemoteChunkSize=5242880,l.DefaultDelimiter=",",l.Parser=b,l.ParserHandle=h,l.NetworkStreamer=_,l.FileStreamer=p,l.StringStreamer=g,l.ReadableStreamStreamer=f,r.jQuery){var u=r.jQuery;u.fn.parse=function(y){var R=y.config||{},w=[];return this.each(function(Z){if(!(u(this).prop("tagName").toUpperCase()==="INPUT"&&u(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var B=0;B<this.files.length;B++)w.push({file:this.files[B],inputElem:this,instanceConfig:u.extend({},R)})}),L(),this;function L(){if(w.length!==0){var Z,B,se,H,I=w[0];if(k(y.before)){var Q=y.before(I.file,I.inputElem);if(typeof Q=="object"){if(Q.action==="abort")return Z="AbortError",B=I.file,se=I.inputElem,H=Q.reason,void(k(y.error)&&y.error({name:Z},B,se,H));if(Q.action==="skip")return void M();typeof Q.config=="object"&&(I.instanceConfig=u.extend(I.instanceConfig,Q.config))}else if(Q==="skip")return void M()}var re=I.instanceConfig.complete;I.instanceConfig.complete=function(X){k(re)&&re(X,I.file,I.inputElem),M()},l.parse(I.file,I.instanceConfig)}else k(y.complete)&&y.complete()}function M(){w.splice(0,1),L()}}}function d(y){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(R){var w=A(R);w.chunkSize=parseInt(w.chunkSize),R.step||R.chunk||(w.chunkSize=null),this._handle=new h(w),(this._handle.streamer=this)._config=w}).call(this,y),this.parseChunk=function(R,w){if(this.isFirstChunk&&k(this._config.beforeFirstChunk)){var L=this._config.beforeFirstChunk(R);L!==void 0&&(R=L)}this.isFirstChunk=!1,this._halted=!1;var M=this._partialLine+R;this._partialLine="";var Z=this._handle.parse(M,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var B=Z.meta.cursor;this._finished||(this._partialLine=M.substring(B-this._baseIndex),this._baseIndex=B),Z&&Z.data&&(this._rowCount+=Z.data.length);var se=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(o)r.postMessage({results:Z,workerId:l.WORKER_ID,finished:se});else if(k(this._config.chunk)&&!w){if(this._config.chunk(Z,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);Z=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(Z.data),this._completeResults.errors=this._completeResults.errors.concat(Z.errors),this._completeResults.meta=Z.meta),this._completed||!se||!k(this._config.complete)||Z&&Z.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),se||Z&&Z.meta.paused||this._nextChunk(),Z}this._halted=!0},this._sendError=function(R){k(this._config.error)?this._config.error(R):o&&this._config.error&&r.postMessage({workerId:l.WORKER_ID,error:R,finished:!1})}}function _(y){var R;(y=y||{}).chunkSize||(y.chunkSize=l.RemoteChunkSize),d.call(this,y),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(w){this._input=w,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(R=new XMLHttpRequest,this._config.withCredentials&&(R.withCredentials=this._config.withCredentials),s||(R.onload=x(this._chunkLoaded,this),R.onerror=x(this._chunkError,this)),R.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var w=this._config.downloadRequestHeaders;for(var L in w)R.setRequestHeader(L,w[L])}if(this._config.chunkSize){var M=this._start+this._config.chunkSize-1;R.setRequestHeader("Range","bytes="+this._start+"-"+M)}try{R.send(this._config.downloadRequestBody)}catch(Z){this._chunkError(Z.message)}s&&R.status===0&&this._chunkError()}},this._chunkLoaded=function(){R.readyState===4&&(R.status<200||400<=R.status
2023-11-09 23:31:56 +00:00
`),K=1<D.length&&D[0].length<me[0].length;if(me.length===1||K)return`
`;for(var G=0,q=0;q<me.length;q++)me[q][0]===`
`&&G++;return G>=me.length/2?`\r
2023-12-04 00:40:36 +00:00
`:"\r"}(Y,O)),L=!1,y.delimiter)k(y.delimiter)&&(y.delimiter=y.delimiter(Y),ee.meta.delimiter=y.delimiter);else{var N=function($,W,ae,me,D){var K,G,q,V;D=D||[","," ","|",";",l.RECORD_SEP,l.UNIT_SEP];for(var ne=0;ne<D.length;ne++){var oe=D[ne],ge=0,J=0,ce=0;q=void 0;for(var Se=new b({comments:me,delimiter:oe,newline:W,preview:10}).parse($),Oe=0;Oe<Se.data.length;Oe++)if(ae&&Re(Se.data[Oe]))ce++;else{var Le=Se.data[Oe].length;J+=Le,q!==void 0?0<Le&&(ge+=Math.abs(Le-q),q=Le):q=Le}0<Se.data.length&&(J/=Se.data.length-ce),(G===void 0||ge<=G)&&(V===void 0||V<J)&&1.99<J&&(G=ge,K=oe,V=J)}return{successful:!!(y.delimiter=K),bestDelimiter:K}}(Y,y.newline,y.skipEmptyLines,y.comments,y.delimitersToGuess);N.successful?y.delimiter=N.bestDelimiter:(L=!0,y.delimiter=l.DefaultDelimiter),ee.meta.delimiter=y.delimiter}var F=A(y);return y.preview&&y.header&&F.preview++,R=Y,w=new b(F),ee=w.parse(R,ue,ye),he(),re?{meta:{paused:!0}}:ee||{meta:{paused:!1}}},this.paused=function(){return re},this.pause=function(){re=!0,w.abort(),R=k(y.chunk)?"":R.substring(w.getCharIndex())},this.resume=function(){H.streamer._halted?(re=!1,H.streamer.parseChunk(R,!0)):setTimeout(H.resume,3)},this.aborted=function(){return X},this.abort=function(){X=!0,w.abort(),ee.meta.aborted=!0,k(y.complete)&&y.complete(ee),R=""}}function E(y){return y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b(y){var R,w=(y=y||{}).delimiter,L=y.newline,M=y.comments,Z=y.step,B=y.preview,se=y.fastMode,H=R=y.quoteChar===void 0||y.quoteChar===null?'"':y.quoteChar;if(y.escapeChar!==void 0&&(H=y.escapeChar),(typeof w!="string"||-1<l.BAD_DELIMITERS.indexOf(w))&&(w=","),M===w)throw new Error("Comment character same as delimiter");M===!0?M="#":(typeof M!="string"||-1<l.BAD_DELIMITERS.indexOf(M))&&(M=!1),L!==`
2023-11-09 23:31:56 +00:00
`&&L!=="\r"&&L!==`\r
`&&(L=`
2023-12-06 00:28:13 +00:00
`);var I=0,Q=!1;this.parse=function(re,X,pe){if(typeof re!="string")throw new Error("Input must be a string");var ee=re.length,be=w.length,Re=L.length,he=M.length,Ee=k(Z),z=[],te=[],Y=[],ue=I=0;if(!re)return Be();if(y.header&&!X){var ye=re.split(L)[0].split(w),O=[],N={},F=!1;for(var $ in ye){var W=ye[$];k(y.transformHeader)&&(W=y.transformHeader(W,$));var ae=W,me=N[W]||0;for(0<me&&(F=!0,ae=W+"_"+me),N[W]=me+1;O.includes(ae);)ae=ae+"_"+me;O.push(ae)}if(F){var D=re.split(L);D[0]=O.join(w),re=D.join(L)}}if(se||se!==!1&&re.indexOf(R)===-1){for(var K=re.split(L),G=0;G<K.length;G++){if(Y=K[G],I+=Y.length,G!==K.length-1)I+=L.length;else if(pe)return Be();if(!M||Y.substring(0,he)!==M){if(Ee){if(z=[],ce(Y.split(w)),nt(),Q)return Be()}else ce(Y.split(w));if(B&&B<=G)return z=z.slice(0,B),Be(!0)}}return Be()}for(var q=re.indexOf(w,I),V=re.indexOf(L,I),ne=new RegExp(E(H)+E(R),"g"),oe=re.indexOf(R,I);;)if(re[I]!==R)if(M&&Y.length===0&&re.substring(I,I+he)===M){if(V===-1)return Be();I=V+Re,V=re.indexOf(L,I),q=re.indexOf(w,I)}else if(q!==-1&&(q<V||V===-1))Y.push(re.substring(I,q)),I=q+be,q=re.indexOf(w,I);else{if(V===-1)break;if(Y.push(re.substring(I,V)),Le(V+Re),Ee&&(nt(),Q))return Be();if(B&&z.length>=B)return Be(!0)}else for(oe=I,I++;;){if((oe=re.indexOf(R,oe+1))===-1)return pe||te.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:z.length,index:I}),Oe();if(oe===ee-1)return Oe(re.substring(I,oe).replace(ne,R));if(R!==H||re[oe+1]!==H){if(R===H||oe===0||re[oe-1]!==H){q!==-1&&q<oe+1&&(q=re.indexOf(w,oe+1)),V!==-1&&V<oe+1&&(V=re.indexOf(L,oe+1));var ge=Se(V===-1?q:Math.min(q,V));if(re.substr(oe+1+ge,be)===w){Y.push(re.substring(I,oe).replace(ne,R)),re[I=oe+1+ge+be]!==R&&(oe=re.indexOf(R,I)),q=re.indexOf(w,I),V=re.indexOf(L,I);break}var J=Se(V);if(re.substring(oe+1+J,oe+1+J+Re)===L){if(Y.push(re.substring(I,oe).replace(ne,R)),Le(oe+1+J+Re),q=re.indexOf(w,I),oe=re.indexOf(R,I),Ee&&(nt(),Q))return Be();if(B&&z.length>=B)return Be(!0);break}te.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:z.length,index:I}),oe++}}else oe++}return Oe();function ce(Xe){z.push(Xe),ue=I}function Se(Xe){var tt=0;if(Xe!==-1){var Je=re.substring(oe+1,Xe);Je&&Je.trim()===""&&(tt=Je.length)}return tt}function Oe(Xe){return pe||(Xe===void 0&&(Xe=re.substring(I)),Y.push(Xe),I=ee,ce(Y),Ee&&nt()),Be()}function Le(Xe){I=Xe,ce(Y),Y=[],V=re.indexOf(L,I)}function Be(Xe){return{data:z,errors:te,meta:{delimiter:w,linebreak:L,aborted:Q,truncated:!!Xe,cursor:ue+(X||0)}}}function nt(){Z(Be()),z=[],te=[]}},this.abort=function(){Q=!0},this.getCharIndex=function(){return I}}function m(y){var R=y.data,w=i[R.workerId],L=!1;if(R.error)w.userError(R.error,R.file);else if(R.results&&R.results.data){var M={abort:function(){L=!0,S(R.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:T,resume:T};if(k(w.userStep)){for(var Z=0;Z<R.results.data.length&&(w.userStep({data:R.results.data[Z],errors:R.results.errors,meta:R.results.meta},M),!L);Z++);delete R.results}else k(w.userChunk)&&(w.userChunk(R.results,M,R.file),delete R.results)}R.finished&&!L&&S(R.workerId,R.results)}function S(y,R){var w=i[y];k(w.userComplete)&&w.userComplete(R),w.terminate(),delete i[y]}function T(){throw new Error("Not implemented.")}function A(y){if(typeof y!="object"||y===null)return y;var R=Array.isArray(y)?[]:{};for(var w in y)R[w]=A(y[w]);return R}function x(y,R){return function(){y.apply(R,arguments)}}function k(y){return typeof y=="function"}return o&&(r.onmessage=function(y){var R=y.data;if(l.WORKER_ID===void 0&&R&&(l.WORKER_ID=R.workerId),typeof R.input=="string")r.postMessage({workerId:l.WORKER_ID,results:l.parse(R.input,R.config),finished:!0});else if(r.File&&R.input instanceof File||R.input instanceof Object){var w=l.parse(R.input,R.config);w&&r.postMessage({workerId:l.WORKER_ID,results:w,finished:!0})}}),(_.prototype=Object.create(d.prototype)).constructor=_,(p.prototype=Object.create(d.prototype)).constructor=p,(g.prototype=Object.create(g.prototype)).constructor=g,(f.prototype=Object.create(d.prototype)).constructor=f,
2023-11-09 23:31:56 +00:00
`+e.model.name+`
2023-12-04 00:40:36 +00:00
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage")}}else Ae.off("install_progress",r),console.log("Install failed"),e.installing=!1,this.showProgress=!1,console.error("Installation failed:",s.error),this.$refs.toast.showToast(`Model:
2023-11-09 23:31:56 +00:00
`+e.model.name+`
2023-12-04 00:40:36 +00:00
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage");console.log("Here")};Ae.on("install_progress",r),Ae.emit("install_model",{path:n,type:e.model.type}),console.log("Started installation, please wait")},uploadAvatar(t){const e=t.target.files[0],n=new FormData;n.append("avatar",e),console.log("Uploading avatar"),Te.post("/upload_avatar",n).then(r=>{console.log("Avatar uploaded successfully"),this.$refs.toast.showToast("Avatar uploaded successfully!",4,!0);const s=r.data.fileName;console.log("response",r),this.user_avatar=s,this.update_setting("user_avatar",s,()=>{}).then(()=>{})}).catch(r=>{console.error("Error uploading avatar:",r)})},async update_software(){console.log("Posting");const t=await this.api_get_req("update_software");console.log("Posting done"),t.status?this.$refs.toast.showToast("Success!",4,!0):this.$refs.toast.showToast("Failure!",4,!1)},async restart_software(){console.log("Posting");const t=await this.api_get_req("restart_program");console.log("Posting done"),t.status?this.$refs.toast.showToast("Success!",4,!0):this.$refs.toast.showToast("Failure!",4,!1)},on_loading_text(t){console.log("Loading text",t),this.loading_text=t},async load_everything(){for(this.isLoading=!0,ve(()=>{Ce.replace()});this.isReady===!1;)await new Promise(t=>setTimeout(t,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");try{this.extCatgArr=await this.api_get_req("list_extensions_categories"),console.log(this.extCatgArr)}catch{console.log("Couldn't list catergories"),this.extCatgArr=[]}try{console.log("Loading extension category content"),this.extArr=await this.api_get_req("list_extensions?category="+this.extension_category),console.log(this.extArr)}catch{console.log("Couldn't list extensions"),this.extCatgArr=[]}this.personality_category=this.configFile.personality_category,this.personalitiesFiltered=this.personalities.filter(t=>t.category===this.configFile.personality_category),this.modelsFiltered=[],this.extension_category=this.configFile.extension_category,this.extensionsFiltererd=this.$store.state.extensionsZoo.filter(t=>t.category===this.configFile.extension_category),this.updateModelsZoo(),this.isLoading=!1,this.isMounted=!0,this.extension_category=this.configFile.extension_category,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(t){if(console.log("received something"),t.status==="progress"){if(this.$refs.modelZoo){const e=this.$refs.modelZoo.findIndex(r=>r.model.name==t.model_name&&this.configFile.binding_name==t.binding_folder),n=this.models_zoo[e];n&&(console.log("model entry",n),n.installing=!0,n.progress=t.progress,console.log(`Progress = ${t.progress}`),t.progress>=100&&(n.installing=!1,n.isInstalled=!0))}}else if(t.status==="succeeded"){if(console.log("Received succeeded"),console.log("Installed successfully"),this.$refs.modelZoo){const e=this.$refs.modelZoo.findIndex(r=>r.model.name==t.model_name&&this.configFile.binding_name==t.binding_folder),n=this.models_zoo[e];n&&(n.installing=!1,n.isInstalled=!0)}this.$refs.toast.showToast(`Model:
2023-11-09 23:31:56 +00:00
`+model_object.name+`
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage")}else if(t.status==="failed"&&(console.log("Install failed"),this.$refs.modelZoo)){const e=this.$refs.modelZoo.findIndex(r=>r.model.name==t.model_name&&this.configFile.binding_name==t.binding_folder),n=this.models_zoo[e];n&&(n.installing=!1,n.isInstalled=!1),console.error("Installation failed:",t.error),this.$refs.toast.showToast(`Model:
`+model_object.name+`
2023-12-04 00:40:36 +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 t=this.$refs.addmodeldialog.model_path;Ae.emit("install_model",{path:t,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(t){this.minconf_collapsed=t,this.bec_collapsed=t,this.mzc_collapsed=t,this.pzc_collapsed=t,this.bzc_collapsed=t,this.pc_collapsed=t,this.mc_collapsed=t,this.sc_collapsed=t,this.mzdc_collapsed=t},fetchPersonalities(){this.api_get_req("list_personalities_categories").then(t=>{this.persCatgArr=t,this.persCatgArr.sort()}),this.api_get_req("list_personalities").then(t=>{this.persArr=t,this.persArr.sort(),console.log(`Listed personalities:
2023-11-09 23:31:56 +00:00
${t}`)})},fetchExtensions(){this.api_get_req("list_extensions_categories").then(t=>{this.extCatgArr=t,this.extCatgArr.sort()}),this.api_get_req("list_extensions").then(t=>{this.extArr=t,this.extArr.sort(),console.log(`Listed extensions:
${t}`)})},fetchHardwareInfos(){this.$store.dispatch("refreshDiskUsage"),this.$store.dispatch("refreshRamUsage")},async onPersonalitySelected(t){if(console.log("on pers",t),this.isLoading&&this.$refs.toast.showToast("Loading... please wait",4,!1),this.isLoading=!0,console.log("selecting ",t),t){if(t.selected){this.$refs.toast.showToast("Personality already selected",4,!0),this.isLoading=!1;return}if(t.isMounted&&this.configFile.personalities.includes(t.full_path)){const e=await this.select_personality(t);console.log("pers is mounted",e),e&&e.status&&e.active_personality_id>-1?this.$refs.toast.showToast(`Selected personality:
`+t.name,4,!0):this.$refs.toast.showToast(`Error on select personality:
2023-11-26 22:19:08 +00:00
`+t.name,4,!1),this.isLoading=!1}else console.log("mounting pers"),this.mountPersonality(t);ve(()=>{Ce.replace()})}},async onExtensionSelected(t){if(console.log("on ext",t),this.isLoading&&this.$refs.toast.showToast("Loading... please wait",4,!1),this.isLoading=!0,console.log("extension",t),t){if(t.selected){this.$refs.toast.showToast("Extension already selected",4,!0),this.isLoading=!1;return}t.isMounted&&this.configFile.extensions.includes(t.full_path)?this.isLoading=!1:(console.log("mounting ext"),this.mountPersonality(t)),ve(()=>{Ce.replace()})}},onSelected(t,e=!1){if(this.isLoading){this.$refs.toast.showToast("Loading... please wait",4,!1);return}t&&(t.isInstalled?(this.configFile.model_name!=t.model.name||e)&&this.update_model(t.model.name).then(n=>{console.log("update_model",n),this.configFile.model_name=t.model.name,n.status?(this.$refs.toast.showToast(`Selected model:
`+t.name,4,!0),ve(()=>{Ce.replace(),this.is_loading_zoo=!1}),self.updateModelsZoo()):(this.$refs.toast.showToast(`Couldn't select model:
`+t.name,4,!1),ve(()=>{Ce.replace()})),this.settingsChanged=!0,this.isModelSelected=!0}):this.$refs.toast.showToast(`Model:
2023-11-09 23:31:56 +00:00
`+t.model.name+`
2023-11-26 22:19:08 +00:00
is not installed`,4,!1),ve(()=>{Ce.replace()}))},onCopy(t){let e;t.model.isCustomModel?e=`Model name: ${t.name}
2023-11-09 23:31:56 +00:00
File size: ${t.fileSize}
Manually downloaded model `:e=`Model name: ${t.name}
File size: ${t.fileSize}
Download: ${"https://huggingface.co/"+t.quantizer+"/"+t.name}
License: ${t.license}
Owner: ${t.quantizer}
Website: ${"https://huggingface.co/"+t.quantizer}
2023-12-04 00:40:36 +00:00
Description: ${t.description}`,this.$refs.toast.showToast("Copied model info to clipboard!",4,!0),navigator.clipboard.writeText(e.trim())},onCopyLink(t){this.$refs.toast.showToast("Copied link to clipboard!",4,!0),navigator.clipboard.writeText("https://huggingface.co/"+t.model.quantizer+"/"+t.model.name)},onCopyPersonalityName(t){this.$refs.toast.showToast("Copied name to clipboard!",4,!0),navigator.clipboard.writeText(t.name)},onCancelInstall(){const t=this.addModel;console.log("cancel install",t),this.modelDownlaodInProgress=!1,this.addModel={},Ae.emit("cancel_install",{model_name:t.model_name,binding_folder:t.binding_folder,model_url:t.model_url,patreon:model.patreon?model.patreon:"None"}),this.$refs.toast.showToast("Model installation aborted",4,!1)},onInstall(t){this.variant_choices=t.model.variants,this.currenModelToInstall=t,console.log("variant_choices"),console.log(this.variant_choices),console.log(t),this.variantSelectionDialogVisible=!0},onCreateReference(){Te.post("/add_reference_to_local_model",{path:this.reference_path}).then(t=>{t.status?(this.$refs.toast.showToast("Reference created",4,!0),this.is_loading_zoo=!0,this.refreshModelsZoo().then(()=>{this.updateModelsZoo(),this.is_loading_zoofalse})):this.$refs.toast.showToast("Couldn't create reference",4,!1)})},onInstallAddModel(){if(!this.addModel.url){this.$refs.toast.showToast("Link is empty",4,!1);return}let t=this.addModel.url;this.addModel.progress=0,console.log("installing..."),console.log("value ",this.addModel.url),this.modelDownlaodInProgress=!0;const e=n=>{console.log("received something"),n.status&&n.progress<=100?(console.log("Progress",n),this.addModel=n,this.addModel.url=t,this.addModel.progress==100&&(this.modelDownlaodInProgress=!1,console.log("Received succeeded"),Ae.off("install_progress",e),console.log("Installed successfully"),this.addModel={},this.$refs.toast.showToast(`Model:
2023-11-09 23:31:56 +00:00
`+this.addModel.model_name+`
2023-12-04 00:40:36 +00:00
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage"))):(Ae.off("install_progress",e),console.log("Install failed"),this.modelDownlaodInProgress=!1,console.error("Installation failed:",n.error),this.$refs.toast.showToast(`Model:
2023-11-09 23:31:56 +00:00
`+this.addModel.model_name+`
2023-12-04 00:40:36 +00:00
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage"))};Ae.on("install_progress",e),Ae.emit("install_model",{path:t,type:this.models_zoo[0].type}),console.log("Started installation, please wait")},uploadLocalModel(){if(this.uploadData.length==0){this.$refs.toast.showToast("No files to upload",4,!1);return}let t=this.addModel.url;this.addModel.progress=0,console.log("installing..."),console.log("value ",this.addModel.url),this.modelDownlaodInProgress=!0;const e=n=>{console.log("received something"),n.status&&n.progress<=100?(console.log("Progress",n),this.addModel=n,this.addModel.url=t,this.addModel.progress==100&&(this.modelDownlaodInProgress=!1,console.log("Received succeeded"),Ae.off("progress",e),console.log("Installed successfully"),this.addModel={},this.$refs.toast.showToast(`Model:
2023-11-09 23:31:56 +00:00
`+this.addModel.model_name+`
2023-12-04 00:40:36 +00:00
installed!`,4,!0),this.$store.dispatch("refreshDiskUsage"))):(Ae.off("progress",e),console.log("Install failed"),this.modelDownlaodInProgress=!1,console.error("Installation failed:",n.error),this.$refs.toast.showToast(`Model:
2023-11-09 23:31:56 +00:00
`+this.addModel.model_name+`
2023-12-04 00:40:36 +00:00
failed to install!`,4,!1),this.$store.dispatch("refreshDiskUsage"))};Ae.on("progress",e),console.log("Started installation, please wait")},setFileList(t){this.uploadData=t.target.files,console.log("set file list",this.uploadData)},onUninstall(t){this.$refs.yesNoDialog.askQuestion(`Are you sure you want to delete this model?
[`+t.name+"]","Yes","Cancel").then(e=>{if(e){console.log("uninstalling model...");const n=r=>{console.log("uninstalling res",r),r.status?(console.log("uninstalling success",r),t.uninstalling=!1,Ae.off("install_progress",n),this.showProgress=!1,this.is_loading_zoo=!0,this.refreshModelsZoo().then(()=>{this.updateModelsZoo(),this.is_loading_zoo=!1}),this.modelsFiltered=this.models_zoo,this.$refs.toast.showToast(`Model:
2023-11-09 23:31:56 +00:00
`+t.model.name+`
2023-12-04 00:40:36 +00:00
was uninstalled!`,4,!0),this.$store.dispatch("refreshDiskUsage")):(console.log("uninstalling failed",r),t.uninstalling=!1,this.showProgress=!1,Ae.off("uninstall_progress",n),console.error("Uninstallation failed:",r.error),this.$refs.toast.showToast(`Model:
2023-11-09 23:31:56 +00:00
`+t.model.name+`
2023-12-04 00:40:36 +00:00
failed to uninstall!`,4,!1),this.$store.dispatch("refreshDiskUsage"))};Ae.on("uninstall_progress",n),self.selected_variant!=null?Ae.emit("uninstall_model",{path:"https://huggingface.co/"+t.model.quantizer+"/"+t.model.name+"/resolve/main/"+this.selected_variant.name,type:t.model.type}):Ae.emit("uninstall_model",{path:"https://huggingface.co/"+t.model.quantizer+"/"+t.model.name,type:t.model.type})}})},onSelectedBinding(t){if(console.log("Binding selected"),!t.binding.installed){this.$refs.toast.showToast(`Binding is not installed:
2023-12-06 00:28:13 +00:00
`+t.binding.name,4,!1);return}this.mzc_collapsed=!0,this.configFile.binding_name!=t.binding.folder&&(this.update_binding(t.binding.folder),this.binding_changed=!0)},onInstallBinding(t){this.configFile.binding_name!=t.binding.folder?(this.isLoading=!0,t.disclaimer&&this.$refs.yesNoDialog.askQuestion(t.disclaimer,"Proceed","Cancel"),Te.post("/install_binding",{name:t.binding.folder}).then(e=>{if(e)return this.isLoading=!1,console.log("install_binding",e),e.data.status?(this.$refs.toast.showToast("Installed binding successfully!",4,!0),this.update_binding(t.binding.folder)):this.$refs.toast.showToast("Could not reinstall binding",4,!1),this.isLoading=!1,e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not reinstall binding
`+e.message,4,!1),{status:!1}))):this.update_binding(t.binding.folder)},onUnInstallBinding(t){this.isLoading=!0,Te.post("/unInstall_binding",{name:t.binding.folder}).then(e=>{if(e){if(this.isLoading=!1,console.log("unInstall_binding",e),e.data.status){const n=this.bindingsZoo.findIndex(s=>s.folder==t.binding.folder),r=this.bindingsZoo[n];r?r.installed=!0:r.installed=!1,this.settingsChanged=!0,this.binding_changed=!0,this.$refs.toast.showToast("Binding uninstalled successfully!",4,!0)}else this.$refs.toast.showToast("Could not uninstall binding",4,!1);return e.data}this.isLoading=!1,t.isInstalled=False}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not uninstall binding
2023-11-11 23:16:13 +00:00
`+e.message,4,!1),{status:!1}))},onReinstallBinding(t){this.isLoading=!0,Te.post("/reinstall_binding",{name:t.binding.folder}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_binding",e),e.data.status?this.$refs.toast.showToast("Reinstalled binding successfully!",4,!0):this.$refs.toast.showToast("Could not reinstall binding",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not reinstall binding
`+e.message,4,!1),{status:!1}))},upgrade2GPU(){this.isLoading=!0;try{Te.get("/upgrade_to_gpu").then(t=>{this.isLoading=!1,t&&(t.status?(this.$refs.toast.showToast("Upgraded to GPU",4,!0),this.configFile.enable_gpu=!0):this.$refs.toast.showToast("Could not upgrade to GPU. Endpoint error: "+t.error,4,!1))})}catch(t){this.isLoading=!1,this.$refs.toast.showToast("Could not open binding settings. Endpoint error: "+t.message,4,!1)}},onSettingsBinding(t){try{this.isLoading=!0,Te.get("/get_active_binding_settings").then(e=>{this.isLoading=!1,e&&(console.log("binding sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Binding settings - "+t.binding.name,"Save changes","Cancel").then(n=>{try{Te.post("/set_active_binding_settings",n).then(r=>{r&&r.data?(console.log("binding set with new settings",r.data),this.$refs.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$refs.toast.showToast(`Did not get binding settings responses.
2023-11-09 23:31:56 +00:00
`+r,4,!1),this.isLoading=!1)})}catch(r){this.$refs.toast.showToast(`Did not get binding settings responses.
2023-11-11 23:16:13 +00:00
Endpoint error: `+r.message,4,!1),this.isLoading=!1}}):(this.$refs.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(e){this.isLoading=!1,this.$refs.toast.showToast("Could not open binding settings. Endpoint error: "+e.message,4,!1)}},onReloadBinding(t){this.isLoading=!0,Te.post("/reload_binding",{name:t.binding.folder}).then(e=>{if(e)return this.isLoading=!1,console.log("reload_binding",e),e.data.status?this.$refs.toast.showToast("Binding reloaded successfully!",4,!0):this.$refs.toast.showToast("Could not reinstall binding",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not reinstall binding
`+e.message,4,!1),{status:!1}))},onSettingsPersonality(t){try{this.isLoading=!0,Te.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.$refs.universalForm.showForm(e.data,"Personality settings - "+t.personality.name,"Save changes","Cancel").then(n=>{try{Te.post("/set_active_personality_settings",n).then(r=>{r&&r.data?(console.log("personality set with new settings",r.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):(this.$refs.toast.showToast(`Did not get Personality settings responses.
2023-11-09 23:31:56 +00:00
`+r,4,!1),this.isLoading=!1)})}catch(r){this.$refs.toast.showToast(`Did not get Personality settings responses.
2023-11-11 23:16:13 +00:00
Endpoint error: `+r.message,4,!1),this.isLoading=!1}}):(this.$refs.toast.showToast("Personality has no settings",4,!1),this.isLoading=!1))})}catch(e){this.isLoading=!1,this.$refs.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},onMessageBoxOk(){console.log("OK button clicked")},update_personality_category(t,e){this.personality_category=t,e()},update_extension_category(t,e){this.extension_category=t,e()},refresh(){console.log("Refreshing"),this.$store.dispatch("refreshConfig").then(()=>{console.log(this.personality_category),this.api_get_req("list_personalities_categories").then(t=>{console.log("cats",t),this.persCatgArr=t,this.personalitiesFiltered=this.personalities.filter(e=>e.category===this.personality_category),this.personalitiesFiltered.sort()}),this.api_get_req("list_extensions_categories").then(t=>{console.log("cats",t),this.extCatgArr=t,this.extensionsFiltererd=this.$store.state.extensionsZoo.filter(e=>e.category===this.extension_category),this.extensionsFiltererd.sort()})})},toggleAccordion(){this.showAccordion=!this.showAccordion},async update_setting(t,e,n){console.log("Updating setting",t,":",e),this.isLoading=!0;const r={setting_name:t,setting_value:e};let s=await Te.post("/update_setting",r);if(s)return this.isLoading=!1,console.log("update_setting",s),s.status?this.$refs.toast.showToast(`Setting updated successfully.
2023-12-06 00:28:13 +00:00
`,4,!0):this.$refs.toast.showToast(`Setting update failed.
Please view the console for more details.`,4,!1),n!==void 0&&n(s),s.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 t=this.$store.state.modelsZoo;if(t.length==0)return;let e=t.findIndex(n=>n.name==this.configFile.model_name);e>0?this.imgModel=t[e].icon:this.imgModel=Kt,console.log(`REFRESHING models using sorting ${this.sort_type}`),t.length>1?(this.sort_type==0?(t.sort((n,r)=>{const s=new Date(n.last_commit_time);return new Date(r.last_commit_time)-s}),console.log("Sorted")):this.sort_type==1?t.sort((n,r)=>r.rank-n.rank):this.sort_type==2?t.sort((n,r)=>n.name.localeCompare(r.name)):this.sort_type==3&&t.sort((n,r)=>n.name.localeCompare(r.name)),console.log("Sorted")):console.log("No sorting needed"),t.forEach(n=>{n.name==this.$store.state.config.model_name?n.selected=!0:n.selected=!1}),console.log("Selected models");for(let n=0;n<this.$store.state.modelsArr.length;n++){const r=this.$store.state.modelsArr[n];let s=t.findIndex(o=>o.name==r);if(s==-1)for(let o=0;o<t.length;o++){let i=t[o].variants;if(i!=null&&(s=i.findIndex(a=>a.name==r),s!=-1)){s=o,console.log(`Found ${r} at index ${s}`);break}}if(s==-1){let o={};o.name=r,o.icon=this.imgBinding,o.isCustomModel=!0,o.isInstalled=!0,t.push(o)}else t[s].isInstalled=!0}console.log("Determined models"),t.sort((n,r)=>n.isInstalled&&!r.isInstalled?-1:!n.isInstalled&&r.isInstalled?1:0),console.log("Done"),this.models_zoo=this.$store.state.modelsZoo},update_binding(t){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",t,async e=>{console.log("updated binding_name"),await this.$store.dispatch("refreshConfig"),this.models_zoo=[],this.mzc_collapsed=!0;const n=this.bindingsZoo.findIndex(s=>s.folder==t),r=this.bindingsZoo[n];r?r.installed=!0:r.installed=!1,this.settingsChanged=!0,this.isLoading=!1,ve(()=>{Ce.replace()}),console.log("updating model"),this.update_model(null).then(()=>{}),ve(()=>{Ce.replace()})}),ve(()=>{Ce.replace()})},async update_model(t){t||(this.isModelSelected=!1),this.isLoading=!0;let e=await this.update_setting("model_name",t);return this.isLoading=!1,ve(()=>{Ce.replace()}),e},applyConfiguration(){this.isLoading=!0,Te.post("/apply_settings",{config:this.configFile}).then(t=>{this.isLoading=!1,t.data.status?(this.$refs.toast.showToast("Configuration changed successfully.",4,!0),this.settingsChanged=!1):this.$refs.toast.showToast("Configuration change failed.",4,!1),ve(()=>{Ce.replace()})})},save_configuration(){this.showConfirmation=!1,Te.post("/save_settings",{}).then(t=>{if(t)return t.status||this.$refs.messageBox.showMessage("Error: Couldn't save settings!"),t.data}).catch(t=>(console.log(t.message,"save_configuration"),this.$refs.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},reset_configuration(){this.$refs.yesNoDialog.askQuestion(`Are you sure?
2023-11-26 22:19:08 +00:00
This will delete all your configurations and get back to default configuration.`).then(t=>{t&&Te.post("/reset_settings",{}).then(e=>{if(e)return e.status?this.$refs.messageBox.showMessage("Settings have been reset correctly"):this.$refs.messageBox.showMessage("Couldn't reset settings!"),e.data}).catch(e=>(console.log(e.message,"reset_configuration"),this.$refs.messageBox.showMessage("Couldn't reset settings!"),{status:!1}))})},async api_get_req(t){try{const e=await Te.get("/"+t);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - settings");return}},closeToast(){this.showToast=!1},async getPersonalitiesArr(){this.isLoading=!0,this.personalities=[];const t=await this.api_get_req("get_all_personalities"),e=this.$store.state.config,n=Object.keys(t);for(let r=0;r<n.length;r++){const s=n[r],i=catdictionary[s].map(a=>{const l=e.personalities.includes(s+"/"+a.folder);let u={};return u=a,u.category=s,u.language=langkey,u.full_path=s+"/"+a.folder,u.isMounted=l,u});this.personalities.length==0?this.personalities=i:this.personalities=this.personalities.concat(i)}this.personalities.sort((r,s)=>r.name.localeCompare(s.name)),this.personalitiesFiltered=this.personalities.filter(r=>r.category===this.configFile.personality_category),this.personalitiesFiltered.sort(),console.log("per filtered",this.personalitiesFiltered),this.isLoading=!1},async filterPersonalities(){if(!this.searchPersonality){this.personalitiesFiltered=this.personalities.filter(n=>n.category===this.configFile.personality_category),this.personalitiesFiltered.sort(),this.searchPersonalityInProgress=!1;return}const t=this.searchPersonality.toLowerCase(),e=this.personalities.filter(n=>{if(n.name&&n.name.toLowerCase().includes(t)||n.description&&n.description.toLowerCase().includes(t)||n.full_path&&n.full_path.toLowerCase().includes(t))return n});e.length>0?this.personalitiesFiltered=e.sort():(this.personalitiesFiltered=this.personalities.filter(n=>n.category===this.configFile.personality_category),this.personalitiesFiltered.sort()),this.searchPersonalityInProgress=!1},async filterExtensions(){if(!this.searchExtension){this.personalitiesFiltered=this.extensions.filter(n=>n.category===this.extension_category),this.personalitiesFiltered.sort(),this.searchExtensionInProgress=!1;return}const t=this.searchExtension.toLowerCase(),e=this.personalities.filter(n=>{if(n.name&&n.name.toLowerCase().includes(t)||n.description&&n.description.toLowerCase().includes(t)||n.full_path&&n.full_path.toLowerCase().includes(t))return n});e.length>0?this.personalitiesFiltered=e.sort():(this.personalitiesFiltered=this.personalities.filter(n=>n.category===this.configFile.personality_category),this.personalitiesFiltered.sort()),this.searchExtensionInProgress=!1},async filterModels(){const t=this.searchModel.toLowerCase();this.is_loading_zoo=!0,console.log("filtering models"),console.log(this.models_zoo);const e=this.models_zoo.filter(n=>{if(n.name&&n.name.toLowerCase().includes(t)||n.description&&n.description.toLowerCase().includes(t)||n.category&&n.category.toLowerCase().includes(t))return n});this.is_loading_zoo=!1,e.length>0?this.modelsFiltered=e:this.modelsFiltered=[],this.searchModelInProgress=!1},computedFileSize(t){return Jt(t)},async mount_personality(t){if(!t)return{status:!1,error:"no personality - mount_personality"};try{const e={language:t.language,category:t.category,folder:t.folder},n=await Te.post("/mount_personality",e);if(n)return n.data}catch(e){console.log(e.message,"mount_personality - settings");return}},async unmount_personality(t){if(!t)return{status:!1,error:"no personality - unmount_personality"};const e={language:t.language,category:t.category,folder:t.folder};try{const n=await Te.post("/unmount_personality",e);if(n)return n.data}catch(n){console.log(n.message,"unmount_personality - settings");return}},async select_personality(t){if(!t)return{status:!1,error:"no personality - select_personality"};const n={id:this.configFile.personalities.findIndex(r=>r===t.full_path)};try{const r=await Te.post("/select_personality",n);if(r)return this.$store.dispatch("refreshCo
2023-11-09 23:31:56 +00:00
`+t.personality.name,4,!0),this.$store.dispatch("refreshMountedPersonalities")):(t.isMounted=!1,this.$refs.toast.showToast(`Could not mount personality
Error: `+e.error+`
Response:
`+e,4,!1)),this.isLoading=!1},async unmountPersonality(t){if(this.isLoading=!0,!t)return;const e=await this.unmount_personality(t.personality||t);if(e.status){this.configFile.personalities=e.personalities,this.$refs.toast.showToast("Personality unmounted",4,!0);const n=this.personalities.findIndex(a=>a.full_path==t.full_path),r=this.personalitiesFiltered.findIndex(a=>a.full_path==t.full_path),s=this.$refs.personalitiesZoo.findIndex(a=>a.full_path==t.full_path);console.log("ppp",this.personalities[n]),this.personalities[n].isMounted=!1,r>-1&&(this.personalitiesFiltered[r].isMounted=!1),s>-1&&(this.$refs.personalitiesZoo[s].isMounted=!1),this.$store.dispatch("refreshMountedPersonalities");const o=this.mountedPersArr[this.mountedPersArr.length-1];console.log(o,this.mountedPersArr.length),(await this.select_personality(t.personality)).status&&this.$refs.toast.showToast(`Selected personality:
`+o.name,4,!0)}else this.$refs.toast.showToast(`Could not unmount personality
Error: `+e.error,4,!1);this.isLoading=!1},async remountPersonality(t){await this.unmountPersonality(t),await this.mountPersonality(t)},async mountExtension(t){if(this.isLoading=!0,console.log("mount ext",t),!t)return;if(this.configFile.personalities.includes(t.extension.full_path)){this.isLoading=!1,this.$refs.toast.showToast("Extension already mounted",4,!1);return}const e=await this.mount_extension(t.extension);console.log("mount_extension res",e),e&&e.status&&e.extensions.includes(t.extension.full_path)?(this.configFile.extensions=e.extensions,this.$refs.toast.showToast("Extension mounted",4,!0),t.isMounted=!0,this.$store.dispatch("refreshMountedExtensions")):(t.isMounted=!1,this.$refs.toast.showToast(`Could not mount extension
Error: `+e.error+`
Response:
2023-11-22 19:35:48 +00:00
`+e,4,!1)),this.isLoading=!1},async unmountExtension(t){if(this.isLoading=!0,!t)return;const e=await this.p_unmount_extension(t.extension||t);if(e.status){this.configFile.extensions=e.extensions,this.$refs.toast.showToast("Extension unmounted",4,!0);const n=this.extensions.findIndex(i=>i.full_path==t.full_path),r=this.extensionsFiltered.findIndex(i=>i.full_path==t.full_path),s=this.$refs.extensionsZoo.findIndex(i=>i.full_path==t.full_path);console.log("ext",this.extensions[n]),this.extensions[n].isMounted=!1,r>-1&&(this.extensionsFiltered[r].isMounted=!1),s>-1&&(this.$refs.extensionsZoo[s].isMounted=!1),this.$store.dispatch("refreshMountedPersonalities");const o=this.mountedExtensions[this.mountedExtensions.length-1];console.log(o,this.mountedExtensions.length)}else this.$refs.toast.showToast(`Could not unmount extension
Error: `+e.error,4,!1);this.isLoading=!1},async remountExtension(t){await this.unmountExtension(t),await this.mountExtension(t)},onExtensionReinstall(t){console.log("on reinstall ",t),this.isLoading=!0,console.log(t),Te.post("/reinstall_extension",{name:t.extension.full_path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_extension",e),e.data.status?this.$refs.toast.showToast("Extension reinstalled successfully!",4,!0):this.$refs.toast.showToast("Could not reinstall extension",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not reinstall personality
`+e.message,4,!1),{status:!1}))},onPersonalityReinstall(t){console.log("on reinstall ",t),this.isLoading=!0,Te.post("/reinstall_personality",{name:t.personality.path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$refs.toast.showToast("Personality reinstalled successfully!",4,!0):this.$refs.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not reinstall personality
2023-11-26 22:19:08 +00:00
`+e.message,4,!1),{status:!1}))},personalityImgPlacehodler(t){t.target.src=ms},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()},activated(){},computed:{rendered_models_zoo:{get(){return this.searchModel?this.show_only_installed_models?this.modelsFiltered.filter(t=>t.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(t=>t.isInstalled===!0):this.models_zoo.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)))}},imgBinding:{get(){if(!this.isMounted)return Kt;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(t=>t.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return Kt}}},imgModel:{get(){try{if(idx=this.$store.state.modelsZoo.findIndex(t=>t.name==this.$store.state.selectedModel),idx>=0)return this.$store.state.modelsZoo[idx].avatar}catch{}if(!this.isMounted)return Kt;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(t=>t.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return Kt}}},isReady:{get(){return this.$store.state.ready}},audio_out_voice:{get(){return this.$store.state.config.audio_out_voice},set(t){this.$store.state.config.audio_out_voice=t}},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(t){this.$store.commit("setConfig",t)}},userName:{get(){return this.$store.state.config.user_name},set(t){this.$store.state.config.user_name=t}},user_avatar:{get(){return"/user_infos/"+this.$store.state.config.user_avatar},set(t){this.$store.state.config.user_avatar=t}},enable_gpu:{get(){return this
2023-12-06 00:28:13 +00:00
You need to apply changes before you leave, or else.`,"Apply configuration","Cancel")&&this.applyConfiguration(),!1}},ie=t=>(hr("data-v-2fd6cc26"),t=t(),Er(),t),bWe={class:"container overflow-y-scroll flex flex-col 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"},SWe={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"},yWe={key:0,class:"flex gap-3 flex-1 items-center duration-75"},vWe=ie(()=>c("i",{"data-feather":"x"},null,-1)),TWe=[vWe],CWe=ie(()=>c("i",{"data-feather":"check"},null,-1)),RWe=[CWe],xWe={key:1,class:"flex gap-3 flex-1 items-center"},OWe=ie(()=>c("i",{"data-feather":"save"},null,-1)),AWe=[OWe],NWe=ie(()=>c("i",{"data-feather":"refresh-ccw"},null,-1)),wWe=[NWe],IWe=ie(()=>c("i",{"data-feather":"list"},null,-1)),DWe=[IWe],kWe={class:"flex gap-3 flex-1 items-center justify-end"},MWe=ie(()=>c("i",{"data-feather":"trash-2"},null,-1)),LWe=[MWe],PWe=ie(()=>c("i",{"data-feather":"refresh-ccw"},null,-1)),FWe=[PWe],UWe=ie(()=>c("i",{"data-feather":"arrow-up-circle"},null,-1)),BWe={key:0},GWe=ie(()=>c("i",{"data-feather":"alert-circle"},null,-1)),qWe=[GWe],YWe={class:"flex gap-3 items-center"},VWe={key:0,class:"flex gap-3 items-center"},zWe=ie(()=>c("p",{class:"text-red-600 font-bold"},"Apply changes:",-1)),HWe=ie(()=>c("i",{"data-feather":"check"},null,-1)),$We=[HWe],WWe={key:1,role:"status"},KWe=ie(()=>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)),QWe=ie(()=>c("span",{class:"sr-only"},"Loading...",-1)),jWe={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"},ZWe={class:"flex flex-row p-3"},XWe=ie(()=>c("i",{"data-feather":"chevron-right"},null,-1)),JWe=[XWe],eKe=ie(()=>c("i",{"data-feather":"chevron-down"},null,-1)),tKe=[eKe],nKe=ie(()=>c("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," System status",-1)),rKe=ie(()=>c("div",{class:"mr-2"},"|",-1)),sKe={class:"text-base font-semibold cursor-pointer select-none items-center"},oKe={class:"flex gap-2 items-center"},iKe={key:0},aKe={class:"flex gap-2 items-center"},lKe=["src"],cKe={class:"font-bold font-large text-lg"},dKe={key:1},uKe={class:"flex gap-2 items-center"},_Ke=["src"],pKe={class:"font-bold font-large text-lg"},mKe=ie(()=>c("i",{"data-feather":"cpu",title:"CPU Ram",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),gKe={class:"font-bold font-large text-lg"},fKe=ie(()=>c("i",{"data-feather":"hard-drive",title:"Hard drive",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),hKe={class:"font-bold font-large text-lg"},EKe={class:"mb-2"},bKe=ie(()=>c("label",{class:"flex items-center gap-1 ml-2 mb-2 te
2023-12-05 21:32:14 +00:00
`];let a=-1;return i.forEach(l=>{const u=o.lastIndexOf(l);u>a&&(a=u)}),a==-1&&(a=o.length),console.log(a),a+s+1},r=()=>{if(this.message.content.includes(".")){const s=n(t),o=this.message.content.substring(t,s);this.msg.text=o,t=s+1,this.msg.onend=i=>{t<this.message.content.length-2?setTimeout(()=>{r()},1):(this.isSpeaking=!1,console.log("voice off :",this.message.content.length," ",s))},this.speechSynthesis.speak(this.msg)}else setTimeout(()=>{r()},1)};r()},toggleModel(){this.expanded=!this.expanded},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.editMsgMode=!1},resendMessage(t){this.$emit("resendMessage",this.message.id,this.message.content,t)},continueMessage(){this.$emit("continueMessage",this.message.id,this.message.content)},getImgUrl(){return this.avatar?(console.log("Avatar:",nS+this.avatar),nS+this.avatar):(console.log("No avatar found"),Ks)},defaultImg(t){t.target.src=Ks},parseDate(t){let e=new Date(Date.parse(t)),r=Math.floor((new Date-e)/1e3);return r<=1?"just now":r<20?r+" seconds ago":r<40?"half a minute ago":r<60?"less than a minute ago":r<=90?"one minute ago":r<=3540?Math.round(r/60)+" minutes ago":r<=5400?"1 hour ago":r<=86400?Math.round(r/3600)+" hours ago":r<=129600?"1 day ago":r<604800?Math.round(r/86400)+" days ago":r<=777600?"1 week ago":t},prettyDate(t){let e=new Date((t||"").replace(/-/g,"/").replace(/[TZ]/g," ")),n=(new Date().getTime()-e.getTime())/1e3,r=Math.floor(n/86400);if(!(isNaN(r)||r<0||r>=31))return r==0&&(n<60&&"just now"||n<120&&"1 minute ago"||n<3600&&Math.floor(n/60)+" minutes ago"||n<7200&&"1 hour ago"||n<86400&&Math.floor(n/3600)+" hours ago")||r==1&&"Yesterday"||r<7&&r+" days ago"||r<31&&Math.ceil(r/7)+" weeks ago"},checkForFullSentence(){if(this.message.content.trim().split(" ").length>3){this.speak();return}}},watch:{"message.content":function(t){this.$store.state.config.auto_speak&&(this.isSpeaking||this.checkForFullSentence())},"message.ui":function(t){console.log("ui changed"),console.log(this.message.ui)},showConfirmation(){ve(()=>{Ce.replace()})},deleteMsgMode(){ve(()=>{Ce.replace()})}},computed:{editMsgMode:{get(){return this.message.hasOwnProperty("open")?this.editMsgMode_||this.message.open:this.editMsgMode_},set(t){this.message.open=t,this.editMsgMode_=t,ve(()=>{Ce.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 t=new Date(Date.parse(this.message.created_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(e.getTime()===t.getTime()||!e.getTime())return;let r=e.getTime()-t.getTime();const s=Math.floor(r/(1e3*60*60));r-=s*(1e3*60*60);const o=Math.floor(r/(1e3*60));r-=o*(1e3*60);const i=Math.floor(r/1e3);r-=i*1e3;function a(u){return u<10&&(u="0"+u),u}return a(s)+"h:"+a(o)+"m:"+a(i)+"s"}}},Vtt={class:"relative 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"},ztt={class:"flex flex-row gap-2"},Htt={class:"flex-shrink-0"},$tt={class:"group/avatar"},Wtt=["src","data-popover-target"],Ktt={class:"flex flex-col w-full flex-grow-0"},Qtt={class:"flex flex-row flex-grow items-start"},jtt={class:"flex flex-col mb-2"},Ztt={class:"drop-shadow-sm text-lg text-opacity-95 font-bold grow"},Xtt=["title"],Jtt=c("div",{class:"flex-grow"},null,-1),ent={class:"flex-row justify-end mx-2"},tnt={class:"invisible group-hover:visible flex flex-row"},nnt={key:0,class:"flex items-center duration-75"},rnt=c("i",{"data-feather"
`,36)),[[De,n.message.content]]):U("",!0)]),n.message.metadata!==null?(v(),C("div",Lnt,[(v(!0),C(we,null,Ge(n.message.metadata,(_,p)=>(v(),C("div",{key:"json-"+n.message.id+"-"+p,class:"json font-bold"},[fe(u,{jsonFormText:_.title,jsonData:_.content},null,8,["jsonFormText","jsonData"])]))),128))])):U("",!0),n.message.ui!==null&&n.message.ui!==void 0&&n.message.ui!==""?(v(),st(d,{key:2,class:"w-full h-full",code:n.message.ui},null,8,["code"])):U("",!0)]),c("div",Pnt,[c("div",Fnt,[n.message.binding?(v(),C("p",Unt,[xe("Binding: "),c("span",Bnt,j(n.message.binding),1)])):U("",!0),n.message.model?(v(),C("p",Gnt,[xe("Model: "),c("span",qnt,j(n.message.model),1)])):U("",!0),n.message.seed?(v(),C("p",Ynt,[xe("Seed: "),c("span",Vnt,j(n.message.seed),1)])):U("",!0),o.time_spent?(v(),C("p",znt,[xe("Time spent: "),c("span",{class:"font-thin",title:"Finished generating: "+o.finished_generating_at_parsed},j(o.time_spent),9,Hnt)])):U("",!0)])])])])])}const ET=qe(Ytt,[["render",$nt]]),Wnt="/";Te.defaults.baseURL="/";const Knt={name:"MountedPersonalities",props:{onShowPersList:Function,onReady:Function},components:{Toast:Sr,UniversalForm:ea},data(){return{bUrl:Wnt,isMounted:!1,show:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(t){this.$store.commit("setConfig",t)}},mountedPers:{get(){return this.$store.state.mountedPers},set(t){this.$store.commit("setMountedPers",t)}},personalities:{get(){return this.$store.state.personalities},set(t){this.$store.commit("setPersonalities",t)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(t){this.$store.commit("setMountedPers",t)}}},methods:{onSettingsPersonality(t){try{Te.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 - "+t.name,"Save changes","Cancel").then(n=>{try{Te.post("/set_active_personality_settings",n).then(r=>{r&&r.data?(console.log("personality set with new settings",r.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses.
2023-11-09 23:31:56 +00:00
`+r,4,!1)})}catch(r){this.$refs.toast.showToast(`Did not get Personality settings responses.
2023-12-05 21:32:14 +00:00
Endpoint error: `+r.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(ve(()=>{Ce.replace()});this.$store.state.ready===!1;)await new Promise(t=>setTimeout(t,100));this.onReady()},async api_get_req(t){try{const e=await Te.get("/"+t);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(t){t.target.src=ms}}},Qnt={class:"w-fit select-none"},jnt={key:0,class:"flex -space-x-4"},Znt=["src","title"],Xnt={key:1,class:"flex -space-x-4"},Jnt=["src","title"],ert={key:2,title:"Loading personalities"},trt=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),nrt=[trt];function rrt(t,e,n,r,s,o){const i=Pe("UniversalForm");return v(),C(we,null,[c("div",Qnt,[o.mountedPersArr.length>1?(v(),C("div",jnt,[c("img",{src:s.bUrl+o.mountedPers.avatar,onError:e[0]||(e[0]=(...a)=>o.personalityImgPlacehodler&&o.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-secondary cursor-pointer",title:"Active personality: "+o.mountedPers.name,onClick:e[1]||(e[1]=a=>o.onSettingsPersonality(o.mountedPers))},null,40,Znt),c("div",{class:"flex items-center justify-center w-8 h-8 cursor-pointer text-xs font-medium bg-bg-light dark:bg-bg-dark border-2 hover:border-secondary rounded-full hover:bg-bg-light-tone dark:hover:bg-bg-dark-tone dark:border-gray-800 hover:z-20 hover:-translate-y-2 duration-150 active:scale-90",onClick:e[2]||(e[2]=_e((...a)=>o.toggleShowPersList&&o.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+j(o.mountedPersArr.length-1),1)])):U("",!0),o.mountedPersArr.length==1?(v(),C("div",Xnt,[c("img",{src:s.bUrl+this.$store.state.mountedPers.avatar,onError:e[3]||(e[3]=(...a)=>o.personalityImgPlacehodler&&o.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 cursor-pointer border-secondary",title:"Active personality: "+this.$store.state.mountedPers.name,onClick:e[4]||(e[4]=_e((...a)=>o.toggleShowPersList&&o.toggleShowPersList(...a),["stop"]))},null,40,Jnt)])):U("",!0),o.mountedPersArr.length==0?(v(),C("div",ert,nrt)):U("",!0)]),fe(i,{ref:"universalForm",class:"z-20"},null,512)],64)}const srt=qe(Knt,[["render",rrt]]);const ort="/";Te.defaults.baseURL="/";const irt={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:gT,Toast:Sr,UniversalForm:ea},name:"MountedPersonalitiesList",data(){return{bUrl:ort,isMounted:!1,isLoading:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activa
2023-11-26 22:19:08 +00:00
`+e.message,4,!1),{status:!1}))},onPersonalityMounted(t){this.mountPersonality(t)},onPersonalityUnMounted(t){this.unmountPersonality(t)},onPersonalityRemount(t){this.reMountPersonality(t)},async handleOnTalk(t){if(Ce.replace(),console.log("ppa",t),t){if(t.isMounted){const e=await this.select_personality(t);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality:
`+t.name,4,!0))}else this.onPersonalityMounted(t);this.onTalk(t)}},async onPersonalitySelected(t){if(Ce.replace(),console.log("Selected personality : ",JSON.stringify(t.personality)),t){if(t.selected){this.$refs.toast.showToast("Personality already selected",4,!0);return}if(t.isMounted){const e=await this.select_personality(t);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality:
2023-11-11 23:16:13 +00:00
`+t.name,4,!0))}else this.onPersonalityMounted(t)}},onSettingsPersonality(t){try{Te.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 - "+t.personality.name,"Save changes","Cancel").then(n=>{try{Te.post("/set_active_personality_settings",n).then(r=>{r&&r.data?(console.log("personality set with new settings",r.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses.
2023-11-09 23:31:56 +00:00
`+r,4,!1)})}catch(r){this.$refs.toast.showToast(`Did not get Personality settings responses.
2023-11-11 23:16:13 +00:00
Endpoint error: `+r.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(t){if(!t)return{status:!1,error:"no personality - mount_personality"};try{const e={category:t.category,folder:t.folder,language:t.language},n=await Te.post("/mount_personality",e);if(n)return n.data}catch(e){console.log(e.message,"mount_personality - settings");return}},async remount_personality(t){if(!t)return{status:!1,error:"no personality - mount_personality"};try{const e={category:t.category,folder:t.folder,language:t.language},n=await Te.post("/remount_personality",e);if(n)return n.data}catch(e){console.log(e.message,"remount_personality - settings");return}},async unmount_personality(t){if(!t)return{status:!1,error:"no personality - unmount_personality"};const e={category:t.category,folder:t.folder,language:t.language};try{const n=await Te.post("/unmount_personality",e);if(n)return n.data}catch(n){console.log(n.message,"unmount_personality - settings");return}},async select_personality(t){if(!t)return{status:!1,error:"no personality - select_personality"};let e=-1;if(console.log("Personality full path : ",t.full_path),console.log("Personality language : ",t.personality.language),t.personality.language!=null&&t.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: ",t.full_path+":"+t.personality.language),e=this.configFile.personalities.findIndex(n=>n===t.full_path+":"+t.personality.language)):(console.log("Mounted personalities :",JSON.stringify(this.configFile.personalities)),e=this.configFile.personalities.findIndex(n=>n===t.full_path)),e>-1){console.log("Selecting personality with id:",JSON.stringify(e));const n={id:e};try{const r=await Te.post("/select_personality",n);if(r)return this.$store.dispatch("refreshConfig").then(()=>{console.log("recovered config",this.configFile.active_personality_id),this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),r.data}catch(r){console.log(r,"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(t){if(console.log("mount pers",t),!t)return;if(this.configFile.personalities.includes(t.personality.full_path)){this.$refs.toast.showToast("Personality already mounted",4,!1);return}const e=await this.mount_personality(t.personality);console.log("mount_personality res",e),e.status?(this.configFile.personalities=e.personalities,this.$refs.toast.showToast("Personality mounted",4,!0),t.isMounted=!0,this.onMounted(this),(await this.select_personality(t.personality)).status&&this.$refs.toast.showToast(`Selected personality:
2023-11-09 23:31:56 +00:00
`+t.personality.name,4,!0),this.getMountedPersonalities()):(t.isMounted=!1,this.$refs.toast.showToast(`Could not mount personality
Error: `+e.error,4,!1))},async reMountPersonality(t){if(console.log("remount pers",t),!t)return;if(!this.configFile.personalities.includes(t.personality.full_path)){this.$refs.toast.showToast("Personality not mounted",4,!1);return}const e=await this.remount_personality(t.personality);console.log("remount_personality res",e),e.status?(this.configFile.personalities=e.personalities,this.$refs.toast.showToast("Personality remounted",4,!0),t.isMounted=!0,this.onMounted(this),(await this.select_personality(t.personality)).status&&this.$refs.toast.showToast(`Selected personality:
`+t.personality.name,4,!0),this.getMountedPersonalities()):(t.isMounted=!1,this.$refs.toast.showToast(`Could not mount personality
2023-11-26 22:19:08 +00:00
Error: `+e.error,4,!1))},async unmountPersonality(t){if(!t)return;console.log(`Unmounting ${JSON.stringify(t.personality)}`);const e=await this.unmount_personality(t.personality);if(e.status){console.log("unmount response",e),this.configFile.active_personality_id=e.active_personality_id,this.configFile.personalities=e.personalities;const n=this.configFile.personalities[this.configFile.active_personality_id],r=this.personalities.findIndex(a=>a.full_path==n),s=this.$refs.personalitiesZoo.findIndex(a=>a.full_path==t.full_path),o=this.personalities[r];o.isMounted=!1,o.selected=!0,this.$refs.personalitiesZoo[s].isMounted=!1,this.getMountedPersonalities(),(await this.select_personality(o)).status&&Ce.replace(),this.$refs.toast.showToast("Personality unmounted",4,!0),this.onUnMounted(this)}else this.$refs.toast.showToast(`Could not unmount personality
2023-12-05 21:32:14 +00:00
Error: `+e.error,4,!1)},getMountedPersonalities(){this.isLoading=!0;let t=[];console.log(this.configFile.personalities.length);for(let e=0;e<this.configFile.personalities.length;e++){const n=this.configFile.personalities[e],r=this.personalities.findIndex(o=>o.full_path==n),s=this.personalities[r];if(s)console.log("adding from config"),t.push(s);else{console.log("adding default");const o=this.personalities.findIndex(a=>a.full_path=="english/generic/lollms"),i=this.personalities[o];t.push(i)}}if(this.mountedPersArr=[],this.mountedPersArr=t,console.log("discussionPersonalities",this.discussionPersonalities),this.discussionPersonalities!=null&&this.discussionPersonalities.length>0)for(let e=0;e<this.discussionPersonalities.length;e++){const n=this.discussionPersonalities[e];console.log("discussionPersonalities - per",n);const r=this.mountedPersArr.findIndex(s=>s.full_path==n);if(console.log("discussionPersonalities -includes",r),console.log("discussionPersonalities -mounted list",this.mountedPersArr),r==-1){const s=this.personalities.findIndex(i=>i.full_path==n),o=this.personalities[s];console.log("adding discucc121",o,n),o&&(this.mountedPersArr.push(o),console.log("adding discucc",o))}}this.isLoading=!1,console.log("getMountedPersonalities",this.mountedPersArr),console.log("fig",this.configFile)}}},xp=t=>(hr("data-v-d16a58b9"),t=t(),Er(),t),art={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"},lrt={key:0,role:"status",class:"flex justify-center overflow-y-hidden"},crt=xp(()=>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)),drt=xp(()=>c("span",{class:"sr-only"},"Loading...",-1)),urt=[crt,drt],_rt=xp(()=>c("i",{"data-feather":"chevron-down"},null,-1)),prt=[_rt],mrt={class:"block my-2 text-sm font-medium text-gray-900 dark:text-white"},grt={class:"overflow-y-auto no-scrollbar pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 max-h-96"};function frt(t,e,n,r,s,o){const i=Pe("personality-entry"),a=Pe("Toast"),l=Pe("UniversalForm");return v(),C("div",art,[s.isLoading?(v(),C("div",lrt,urt)):U("",!0),c("div",null,[o.mountedPersArr.length>0?(v(),C("div",{key:0,class:Ne(s.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]=_e((...u)=>o.toggleShowPersList&&o.toggleShowPersList(...u),["stop"]))},prt),c("label",mrt," Mounted Personalities: ("+j(o.mountedPersArr.length)+") ",1),c("div",grt,[fe(gn,{name:"bounce"},{default:ke(()=>[(v(!0),C(we,null,Ge(this.$store.state.mountedPersArr,(u,d
`+r.error,4,!1),this.loading=!1,Ae.off("file_received")}),Ae.emit("send_file",n)},e.readAsDataURL(this.selectedFile)},async constructor(){nextTick(()=>{Ce.replace()})},toggleMenu(){this.showMenu=!this.showMenu},execute_cmd(t){this.showMenu=!this.showMenu,t.hasOwnProperty("is_file")?(console.log("Need to send a file."),this.selectFile(t.hasOwnProperty("file_types")?t.file_types:"*",()=>{this.selectedFile!=null&&this.uploadFile()})):this.sendCommand(t.value)},handleClickOutside(t){const e=this.$el.querySelector(".commands-menu-items-wrapper");e&&!e.contains(t.target)&&(this.showMenu=!1)}},mounted(){this.commands=this.commandsList,document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},brt=t=>(hr("data-v-52cfa09c"),t=t(),Er(),t),Srt={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"},yrt=brt(()=>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)),vrt=[yrt];function Trt(t,e,n,r,s,o){const i=Pe("InteractiveMenu");return s.loading?(v(),C("div",Srt,vrt)):(v(),st(i,{key:1,commands:n.commandsList,execute_cmd:o.execute_cmd},null,8,["commands","execute_cmd"]))}const Crt=qe(Ert,[["render",Trt],["__scopeId","data-v-52cfa09c"]]);console.log("modelImgPlaceholder:",Kt);const Rrt="/",xrt={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage"],props:{onTalk:Function,discussionList:Array,loading:!1,onShowToastMessage:Function},components:{Toast:Sr,UniversalForm:ea,MountedPersonalities:srt,MountedPersonalitiesList:hrt,PersonalitiesCommands:Crt,InteractiveMenu:lo},setup(){},data(){return{modelImgPlaceholder:Kt,bUrl:Rrt,message:"",selecting_model:!1,selectedModel:"",isLesteningToVoice:!1,filesList:[],isFileSentList:[],totalSize:0,showfilesList:!0,showPersonalities:!1,personalities_ready:!1,models_menu_icon:""}},computed:{currentModel(){if(this.$store.state.currentModel!=null)return console.log("Model found"),this.$store.state.currentModel;{console.log("No model found");let t={};return t.name="unknown",t}},installedModels(){return this.$store.state.installedModels},model_name(){return this.$store.state.config.model_name},config(){return this.$store.state.config},mountedPers(){return this.$store.state.mountedPers},allDiscussionPersonalities(){if(this.discussionList.length>0){let t=[];for(let e=0;e<this.discussionList.length;e++)!t.includes(this.discussionList[e].personality)&&!this.discussionList[e].personality==""&&t.push(this.discussionList[e].personality);return console.log("conputer pers",t),console.log("dis conputer pers",this.discussionList),t}}},methods:{showModelConfig(){try{this.isLoading=!0,Te.get("/get_active_binding_settings").then(t=>{this.isLoading=!1,t&&(console.log("binding sett",t),t.data&&Object.keys(t.data).length>0?this.$refs.universalForm.showForm(t.data,"Binding settings ","Sav
2023-11-11 23:16:13 +00:00
`+n,4,!1),this.isLoading=!1)})}catch(n){this.$refs.toast.showToast(`Did not get binding settings responses.
Endpoint error: `+n.message,4,!1),this.isLoading=!1}}):(this.$refs.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(t){this.isLoading=!1,this.$refs.toast.showToast("Could not open binding settings. Endpoint error: "+t.message,4,!1)}},async unmountPersonality(t){if(this.loading=!0,!t)return;const e=await this.unmount_personality(t.personality||t);if(e.status){this.$store.state.config.personalities=e.personalities,this.$refs.toast.showToast("Personality unmounted",4,!0),this.$store.dispatch("refreshMountedPersonalities");const n=this.$store.state.mountedPersArr[this.$store.state.mountedPersArr.length-1];console.log(n,this.$store.state.mountedPersArr.length),(await this.select_personality(t.personality)).status&&this.$refs.toast.showToast(`Selected personality:
2023-11-09 23:31:56 +00:00
`+n.name,4,!0)}else this.$refs.toast.showToast(`Could not unmount personality
2023-11-11 23:16:13 +00:00
Error: `+e.error,4,!1);this.loading=!1},async unmount_personality(t){if(!t)return{status:!1,error:"no personality - unmount_personality"};const e={language:t.language,category:t.category,folder:t.folder};try{const n=await Te.post("/unmount_personality",e);if(n)return n.data}catch(n){console.log(n.message,"unmount_personality - settings");return}},async onPersonalitySelected(t){if(console.log("on pers",t),console.log("selecting ",t),t){if(t.selected){this.$refs.toast.showToast("Personality already selected",4,!0);return}if(t.isMounted&&this.$store.state.config.personalities.includes(t.full_path)){const e=await this.select_personality(t);console.log("pers is mounted",e),e&&e.status&&e.active_personality_id>-1?this.$refs.toast.showToast(`Selected personality:
2023-11-09 23:31:56 +00:00
`+t.name,4,!0):this.$refs.toast.showToast(`Error on select personality:
2023-12-05 21:32:14 +00:00
`+t.name,4,!1)}else console.log("mounting pers"),this.mountPersonality(t);ve(()=>{Ce.replace()})}},async select_personality(t){if(!t)return{status:!1,error:"no personality - select_personality"};const n={id:this.$store.state.config.personalities.findIndex(r=>r===t.full_path)};try{const r=await Te.post("/select_personality",n);if(r)return this.$store.dispatch("refreshConfig").then(()=>{this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),r.data}catch(r){console.log(r.message,"select_personality - settings");return}},emitloaded(){this.$emit("loaded")},showModels(t){t.preventDefault();const e=this.$refs.modelsSelectionList;console.log(e);const n=new MouseEvent("click");e.dispatchEvent(n)},setModel(t){console.log("Setting model to "+t.name),this.selecting_model=!0,this.selectedModel=t,Te.post("/update_setting",{setting_name:"model_name",setting_value:t.name}).then(async e=>{console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshModels"),this.$refs.toast.showToast(`Model changed to ${this.currentModel.name}`,4,!0),this.selecting_model=!1}).catch(e=>{this.$refs.toast.showToast(`Error ${e}`,4,!0),this.selecting_model=!1})},clear_files(){Te.get("/clear_personality_files_list").then(t=>{t.data.status?console.log("Files removed"):console.log("Files couldn't be removed")}),this.filesList=[],this.isFileSentList=[]},send_file(t,e){const n=new FileReader,r=24*1024;let s=0,o=0;n.onloadend=()=>{if(n.error){console.error("Error reading file:",n.error);return}const a=n.result,l=s+a.byteLength>=t.size;Ae.emit("send_file_chunk",{filename:t.name,chunk:a,offset:s,isLastChunk:l,chunkIndex:o}),s+=a.byteLength,o++,l?(console.log("File sent successfully"),this.isFileSentList[this.filesList.length-1]=!0,console.log(this.isFileSentList),this.onShowToastMessage("File uploaded successfully",4,!0),this.loading=!1,e()):i()};function i(){const a=t.slice(s,s+r);n.readAsArrayBuffer(a)}console.log("Uploading file"),i()},makeAnEmptyUserMessage(){this.$emit("createEmptyUserMessage")},makeAnEmptyAIMessage(){this.$emit("createEmptyAIMessage")},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this.$store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.recognition.onresult=t=>{let e="";for(let n=t.resultIndex;n<t.results.length;n++)e+=t.results[n][0].transcript;this.message=e,clearTimeout(this.silenceTimer),this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.recognition.onerror=t=>{console.error("Speech recognition error:",t.error),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer),this.submit()},this.recognition.start()):console.error("Speech recognition is not supported in this browser.")},onPersonalitiesReadyFun(){this.personalities_ready=!0},onShowPersListFun(t){this.showPersonalities=!this.showPersonalities},handleOnTalk(t){this.showPersonalities=!1,this.onTalk(t)},onMountFun(t){console.log("Mounting personality"),this.$refs.mountedPers.constructor()},onUnmountFun(t){console.log("Unmounting personality"),this.$refs.mountedPers.constructor()},onRemount(t){console.log("Remounting chat"),this.$refs.mountedPers.constructor()},computedFileSize(t){return ve(()=>{Ce.replace()}),Jt(t)},removeItem(t){this.filesList=this.filesList.filter(e=>e!=t)},sendMessageEvent(t){this.filesList=[],this.$emit("messageSentEvent",t)},sendCMDEvent(t){this.$emit("sendCMDEvent",t)},submitOnEnter(t){this.loading||t.which===13&&(t.preventDefault(),t.repeat||(this.sendMessageEvent(this.message),this.message=""))},submit(){this.message&&(this.sendMessageEvent(this.message),this.message="")},stopGenerat
2023-11-09 23:31:56 +00:00
\r
\r
2023-12-06 00:28:13 +00:00
`,544),[[De,s.message]]),c("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:e[9]||(e[9]=(..._)=>o.addFiles&&o.addFiles(..._)),multiple:""},null,544),c("button",{type:"button",onClick:e[10]||(e[10]=_e(_=>t.$refs.fileDialog.click(),["stop"])),title:"Add files",class:"absolute inset-y-0 right-0 flex items-center mr-2 w-6 hover:text-secondary duration-75 active:scale-90"},Ost)]),c("div",Ast,[n.loading?U("",!0):(v(),C("button",{key:0,type:"button",onClick:e[11]||(e[11]=(..._)=>o.startSpeechRecognition&&o.startSpeechRecognition(..._)),class:Ne([{"text-red-500":s.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},wst,2)),n.loading?U("",!0):(v(),C("button",{key:1,type:"button",onClick:e[12]||(e[12]=(..._)=>o.makeAnEmptyUserMessage&&o.makeAnEmptyUserMessage(..._)),title:"New empty user message",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},kst)),n.loading?U("",!0):(v(),C("button",{key:2,type:"button",onClick:e[13]||(e[13]=(..._)=>o.makeAnEmptyAIMessage&&o.makeAnEmptyAIMessage(..._)),title:"New empty ai message",class:"w-6 text-red-400 hover:text-secondary duration-75 active:scale-90"},Pst)),n.loading?U("",!0):(v(),C("button",{key:3,type:"button",onClick:e[14]||(e[14]=(..._)=>o.submit&&o.submit(..._)),class:"w-6 hover:text-secondary duration-75 active:scale-90"},Bst)),n.loading?(v(),C("div",Gst,Yst)):U("",!0)])])])])])]),fe(u,{ref:"toast"},null,512),fe(d,{ref:"universalForm",class:"z-20"},null,512)],64)}const bT=qe(xrt,[["render",Vst],["__scopeId","data-v-84cf73cd"]]),zst={name:"WelcomeComponent",setup(){return{}}},Hst={class:"flex flex-col text-center"},$st=q_('<div class="flex flex-col text-center items-center"><div class="flex items-center gap-3 text-5xl drop-shadow-md align-middle pt-24"><img class="w-24 animate-bounce" title="LoLLMS WebUI" src="'+Ks+'" alt="Logo"><div class="flex flex-col items-start"><p class="text-2xl">Lord of Large Language Models</p><p class="text-gray-400 text-base">One tool to rule them all</p></div></div><hr class="mt-1 w-96 h-1 mx-auto my-2 md:my-2 dark:bg-bg-dark-tone-panel bg-bg-light-tone-panel border-0 rounded"><p class="text-2xl">Welcome</p><p class="text-lg">Please create a new discussion or select existing one to start</p></div>',1),Wst=[$st];function Kst(t,e,n,r,s,o){return v(),C("div",Hst,Wst)}const ST=qe(zst,[["render",Kst]]);const Qst={props:{progress:{type:Number,required:!0}}},jst={class:"progress-bar-container"};function Zst(t,e,n,r,s,o){return v(),C("div",jst,[c("div",{class:"progress-bar",style:ht({width:`${n.progress}%`})},null,4)])}const f_=qe(Qst,[["render",Zst]]);var Xst=function(){function t(e,n){n===void 0&&(n=[]),this._eventType=e,this._eventFunctions=n}return t.prototype.init=function(){var e=this;this._eventFunctions.forEach(function(n){typeof window<"u"&&window.addEventListener(e._eventType,n)})},t}(),pi=globalThis&&globalThis.__assign||function(){return pi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},pi.apply(this,arguments)},mi={alwaysOpen:!1,activeClasses:"bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white",inactiveClasses:"text-gray-500 dark:text-gray-400",onOpen:function(){},onClose:function(){},onToggle:function(){}},yT=function(){function t(e,n){e===void 0&&(e=[]),n===void 0&&(n=mi),this._items=e,this._options=pi(pi({},mi),n),this._init()}return t.prototype._init=function(){var e=this;this._items.length&&this._items.map(function(n){n.active&&e.open(n.id),n.triggerEl.addEventListener("click",function(){e.toggle(n.id)})})},t.prototype.getItem=function(e){return this._items.filter(function(n){return n.id===e})[0]},t.prototype.open=function(e){var n,r,s=this,o=this.getItem(e);this._options.alwaysOpen||this._items.map(function(i){var a,l;i!==o&&((a=i.triggerEl.classList).remove.apply(a,s._options.activeClasses.split(" ")),(l=i.triggerEl.classList).add.apply(l,s._options.inactiveClasses.split(" ")),i.targetEl.classList.add("hidden
2023-11-11 23:16:13 +00:00
`+n,4,!1),this.isLoading=!1)})}catch(n){this.$refs.toast.showToast(`Did not get binding settings responses.
2023-12-06 00:28:13 +00:00
Endpoint error: `+n.message,4,!1),this.isLoading=!1}}):(this.$refs.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(t){this.isLoading=!1,this.$refs.toast.showToast("Could not open binding settings. Endpoint error: "+t.message,4,!1)}},showDatabaseSelector(){this.database_selectorDialogVisible=!0},async ondatabase_selectorDialogSelected(t){console.log("Selected:",t)},onclosedatabase_selectorDialog(){this.database_selectorDialogVisible=!1},async onvalidatedatabase_selectorChoice(t){if(this.database_selectorDialogVisible=!1,(await Te.post("/select_database",{name:t})).status){console.log("Selected database"),this.$store.state.config=await Te.get("/get_config"),console.log("new config loaded :",this.$store.state.config);let n=await Te.get("/list_databases").data;console.log("New list of database: ",n),this.$store.state.databases=n,console.log("New list of database: ",this.$store.state.databases),location.reload()}},async toggleLTM(){this.$store.state.config.use_discussions_history=!this.$store.state.config.use_discussions_history,await this.applyConfiguration(),Ae.emit("upgrade_vectorization")},async applyConfiguration(){this.loading=!0;const t=await Te.post("/apply_settings",{config:this.$store.state.config});this.loading=!1,t.data.status?this.$refs.toast.showToast("Configuration changed successfully.",4,!0):this.$refs.toast.showToast("Configuration change failed.",4,!1),ve(()=>{Ce.replace()})},save_configuration(){this.showConfirmation=!1,Te.post("/save_settings",{}).then(t=>{if(t)return t.status?this.$refs.toast.showToast("Settings saved!",4,!0):this.$refs.messageBox.showMessage("Error: Couldn't save settings!"),t.data}).catch(t=>(console.log(t.message,"save_configuration"),this.$refs.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},showToastMessage(t,e,n){console.log("sending",t),this.$refs.toast.showToast(t,e,n)},togglePanel(){this.panelCollapsed=!this.panelCollapsed},toggleDropdown(){this.isOpen=!this.isOpen},importChatGPT(){},async api_get_req(t){try{const e=await Te.get("/"+t);if(e)return e.data}catch(e){console.log(e.message,"api_get_req");return}},async list_discussions(){try{const t=await Te.get("/list_discussions");if(t)return this.createDiscussionList(t.data),t.data}catch(t){return console.log("Error: Could not list discussions",t.message),[]}},load_discussion(t,e){t&&(console.log("Loading discussion",t),this.loading=!0,this.discussionArr=[],this.setDiscussionLoading(t,this.loading),Ae.on("discussion",n=>{this.loading=!1,this.setDiscussionLoading(t,this.loading),n&&(this.discussionArr=n.filter(r=>r.message_type==this.msgTypes.MSG_TYPE_CHUNK||r.message_type==this.msgTypes.MSG_TYPE_FULL||r.message_type==this.msgTypes.MSG_TYPE_FULL_INVISIBLE_TO_AI||r.message_type==this.msgTypes.MSG_TYPE_CODE||r.message_type==this.msgTypes.MSG_TYPE_JSON_INFOS||r.message_type==this.msgTypes.MSG_TYPE_UI),console.log("this.discussionArr"),console.log(this.discussionArr),e&&e()),Ae.off("discussion")}),Ae.emit("load_discussion",{id:t}))},recoverFiles(){console.log("Recovering files"),Te.get("/get_current_personality_files_list").then(t=>{this.$refs.chatBox.filesList=t.data.files,this.$refs.chatBox.isFileSentList=t.data.files.map(e=>!0),console.log(`Files recovered: ${this.$refs.chatBox.filesList}`)})},new_discussion(t){try{this.loading=!0,Ae.on("discussion_created",e=>{Ae.off("discussion_created"),this.list_discussions().then(()=>{const n=this.list.findIndex(s=>s.id==e.id),r=this.list[n];this.selectDiscussion(r),this.load_discussion(e.id,()=>{this.loading=!1,Te.get("/get_current_personality_files_list").then(s=>{console.log("Files recovered"),this.fileList=s.files}),ve(()=>{const s=document.getElementById("dis-"+e.id);this.scrollToElement(s),console.log("Scrolling tp "+s)})})})}),console.log("new_discussion ",t),Ae.emit("new_discussion",{title:t})}catch(e){return console.log("Error: Could not create new discussion",e.message),{}}},async delete_discussion(t){try{t&&(this.loading=!0,this.setDiscussionLoading(t,this.loading),await Te.post("/delete_discussion",{client_id:this.client_id,id:t}),this.
2023-11-09 23:31:56 +00:00
Personality: ${t.message.personality}`);let r="";t.created_at_parsed&&(r=`
Created: ${t.created_at_parsed}`);let s="";t.message.content&&(s=t.message.content);let o="";t.message.model&&(o=`Model: ${t.message.model}`);let i="";t.message.seed&&(i=`Seed: ${t.message.seed}`);let a="";t.time_spent&&(a=`
Time spent: ${t.time_spent}`);let l="";l=`${e} ${o} ${i} ${a}`.trim();const u=`${t.message.sender}${n}${r}
${s}
2023-11-26 22:19:08 +00:00
${l}`;navigator.clipboard.writeText(u),ve(()=>{Ce.replace()})},closeToast(){this.showToast=!1},saveJSONtoFile(t,e){e=e||"data.json";const n=document.createElement("a");n.href=URL.createObjectURL(new Blob([JSON.stringify(t,null,2)],{type:"text/plain"})),n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)},saveMarkdowntoFile(t,e){e=e||"data.md";const n=document.createElement("a");n.href=URL.createObjectURL(new Blob([t],{type:"text/plain"})),n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)},parseJsonObj(t){try{return JSON.parse(t)}catch(e){return this.$refs.toast.showToast(`Could not parse JSON.
2023-11-22 19:49:54 +00:00
`+e.message,4,!1),null}},async parseJsonFile(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=s=>e(this.parseJsonObj(s.target.result)),r.onerror=s=>n(s),r.readAsText(t)})},async exportDiscussionsAsMarkdown(){const t=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(t.length>0){console.log("export",t);let e=new Date;const n=e.getFullYear(),r=(e.getMonth()+1).toString().padStart(2,"0"),s=e.getDate().toString().padStart(2,"0"),o=e.getHours().toString().padStart(2,"0"),i=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),u="discussions_export_"+(n+"."+r+"."+s+"."+o+i+a)+".md";this.loading=!0;const d=await this.export_multiple_discussions(t,"markdown");d?(this.saveMarkdowntoFile(d,u),this.$refs.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$refs.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async exportDiscussionsAsJson(){const t=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(t.length>0){console.log("export",t);let e=new Date;const n=e.getFullYear(),r=(e.getMonth()+1).toString().padStart(2,"0"),s=e.getDate().toString().padStart(2,"0"),o=e.getHours().toString().padStart(2,"0"),i=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),u="discussions_export_"+(n+"."+r+"."+s+"."+o+i+a)+".json";this.loading=!0;const d=await this.export_multiple_discussions(t,"json");d?(this.saveJSONtoFile(d,u),this.$refs.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$refs.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async importDiscussions(t){const e=await this.parseJsonFile(t.target.files[0]);await this.import_multiple_discussions(e)?(this.$refs.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$refs.toast.showToast("Failed to import discussions",4,!1)},async getPersonalityAvatars(){for(;this.$store.state.personalities===null;)await new Promise(e=>setTimeout(e,100));let t=this.$store.state.personalities;this.personalityAvatars=t.map(e=>({name:e.name,avatar:e.avatar}))},getAvatar(t){if(t.toLowerCase().trim()==this.$store.state.config.user_name.toLowerCase().trim())return"user_infos/"+this.$store.state.config.user_avatar;const e=this.personalityAvatars.findIndex(r=>r.name===t),n=this.personalityAvatars[e];if(n)return console.log("Avatar",n.avatar),n.avatar},setFileListChat(t){try{this.$refs.chatBox.fileList=this.$refs.chatBox.fileList.concat(t)}catch(e){this.$refs.toast.showToast(`Failed to set filelist in chatbox
2023-12-06 00:28:13 +00:00
`+e.message,4,!1)}this.isDragOverChat=!1},async setFileListDiscussion(t){if(t.length>1){this.$refs.toast.showToast("Failed to import discussions. Too many files",4,!1);return}const e=await this.parseJsonFile(t[0]);await this.import_multiple_discussions(e)?(this.$refs.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$refs.toast.showToast("Failed to import discussions",4,!1),this.isDragOverDiscussion=!1}},async created(){for(this.$nextTick(()=>{Ce.replace()}),Ae.on("disucssion_renamed",t=>{console.log("Received new title",t.discussion_id,t.title);const e=this.list.findIndex(r=>r.id==t.discussion_id),n=this.list[e];n.title=t.title}),Ae.onclose=t=>{console.log("WebSocket connection closed:",t.code,t.reason),this.socketIODisconnected()},Ae.on("connect_error",t=>{t.message==="ERR_CONNECTION_REFUSED"?console.error("Connection refused. The server is not available."):console.error("Connection error:",t),this.$store.state.isConnected=!1}),Ae.onerror=t=>{console.log("WebSocket connection error:",t.code,t.reason),this.socketIODisconnected(),Ae.disconnect()},Ae.on("connected",this.socketIOConnected),Ae.on("disconnected",this.socketIODisconnected),console.log("Added events"),console.log("Waiting to be ready");this.$store.state.ready===!1;)await new Promise(t=>setTimeout(t,100)),console.log(this.$store.state.ready);console.log("Ready"),this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),Ae.on("show_progress",this.show_progress),Ae.on("hide_progress",this.hide_progress),Ae.on("update_progress",this.update_progress),Ae.on("notification",this.notify),Ae.on("new_message",this.new_message),Ae.on("update_message",this.streamMessageContent),Ae.on("close_message",this.finalMsgEvent),Ae.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.isCreated=!0},async mounted(){let t="http://localhost:9600/";try{t=await(await fetch("/get_server_address")).text(),t.includes("<")&&(console.log("Server address not found"),t="http://localhost:9600/"),console.log(`Server address: ${t}`)}catch(e){console.error("Error fetching server address:",e),t="http://localhost:9600/"}this.host=`${t}`,Te.defaults.baseURL=t,this.$nextTick(()=>{Ce.replace()})},async activated(){for(;this.isReady===!1;)await new Promise(t=>setTimeout(t,100));await this.getPersonalityAvatars(),console.log("Avatars found:",this.personalityAvatars),this.isCreated&&ve(()=>{const t=document.getElementById("messages-list");this.scrollBottom(t)})},components:{Discussion:hT,Message:ET,ChatBox:bT,WelcomeComponent:ST,Toast:Sr,ChoiceDialog:Rp,MessageBox:Cp,ProgressBar:f_},watch:{progress_visibility_val(t){console.log("progress_visibility changed")},filterTitle(t){t==""&&(this.filterInProgress=!0,this.list=this.tempList,this.filterInProgress=!1)},isCheckbox(t){ve(()=>{Ce.replace()}),t||(this.isSelectAll=!1)},socketConnected(t){console.log("Websocket connected (watch)",t)},showConfirmation(){ve(()=>{Ce.replace()})},isSearch(){ve(()=>{Ce.replace()})}},computed:{progress_visibility:{get(){return self.progress_visibility_val}},version_info:{get(){return this.$store.state.version!=null&&this.$store.state.version!="unknown"?" v"+this.$store.state.version:""}},loading_infos:{get(){return this.$store.state.loading_infos}},loading_progress:{get(){return this.$store.state.loading_progress}},isGenerating:{get(){return this.$store.state.isGenerating},set(t){this.$store.state.isGenerating=t}},formatted_database_name(){const t=this.$store.state.config.db_path;return t.slice(0,t.length-3)},UseDiscussionHistory(){return this.$store.state.config.use_discussions_history},isReady:{get(){return this.$store.state.ready}},databases(){return this.$store.state.databases},client_id(){return Ae.i