texlite 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +7 -4
- package/NPM_TESTING.md +8 -2
- package/OPERATIONS.md +21 -6
- package/README.md +6 -1
- package/README.zh-CN.md +5 -1
- package/dist/client/assets/{GitDialog-DdLrbz_H.js → GitDialog-CZRQPg3O.js} +1 -1
- package/dist/client/assets/{HistoryDialog-AlF9iozX.js → HistoryDialog-BQtr58Co.js} +1 -1
- package/dist/client/assets/{LatexEditor-DH9v1wgS.js → LatexEditor-XLwZxO6_.js} +1 -1
- package/dist/client/assets/{PdfPreview-CanYnyfJ.js → PdfPreview-D5CC-vqV.js} +1 -1
- package/dist/client/assets/{ProjectNavigationDialogs-DiXtkTj1.js → ProjectNavigationDialogs-BdtTldSa.js} +1 -1
- package/dist/client/assets/{SystemMetricsDialog-DimBI7er.js → SystemMetricsDialog-CEbYJdj7.js} +1 -1
- package/dist/client/assets/index-BAFR6u6_.js +64 -0
- package/dist/client/assets/index-g5CaToD6.css +1 -0
- package/dist/client/assets/{minus-DR-ttrx3.js → minus-KzdrD7TK.js} +1 -1
- package/dist/client/assets/{spellCheck-Wn7_eF9j.js → spellCheck-CDZ9ZXo6.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/app.js +5 -0
- package/dist/server/cli.js +170 -32
- package/dist/server/environment.js +168 -38
- package/dist/server/i18n.js +8 -0
- package/dist/server/routes/wordCount.js +83 -0
- package/dist/server/texcount.js +244 -0
- package/package.json +3 -2
- package/preview-1.png +0 -0
- package/preview-2.png +0 -0
- package/dist/client/assets/index-CdiutUgf.css +0 -1
- package/dist/client/assets/index-vpWlpUOr.js +0 -64
- package/preview.png +0 -0
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfPreview-CanYnyfJ.js","assets/react-BoEjKzFZ.js","assets/pdf-BB1XvBIF.js","assets/minus-DR-ttrx3.js","assets/SystemMetricsDialog-DimBI7er.js","assets/spellCheck-Wn7_eF9j.js","assets/LatexEditor-DH9v1wgS.js","assets/editor-DMLs-XWi.js","assets/GitDialog-DdLrbz_H.js","assets/HistoryDialog-AlF9iozX.js","assets/ProjectNavigationDialogs-DiXtkTj1.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as xp,u as ot,j as i,r as f,R as Pr,a as vu,b as vp,P as Oi,c as Ta,d as Ap,e as kp}from"./react-BoEjKzFZ.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();var Do={};const Be=t=>typeof t=="string",ur=()=>{let t,e;const n=new Promise((s,r)=>{t=s,e=r});return n.resolve=t,n.reject=e,n},nl=t=>t==null?"":""+t,Sp=(t,e,n)=>{t.forEach(s=>{e[s]&&(n[s]=e[s])})},jp=/###/g,sl=t=>t&&t.indexOf("###")>-1?t.replace(jp,"."):t,rl=t=>!t||Be(t),gr=(t,e,n)=>{const s=Be(e)?e.split("."):e;let r=0;for(;r<s.length-1;){if(rl(t))return{};const o=sl(s[r]);!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++r}return rl(t)?{}:{obj:t,k:sl(s[r])}},il=(t,e,n)=>{const{obj:s,k:r}=gr(t,e,Object);if(s!==void 0||e.length===1){s[r]=n;return}let o=e[e.length-1],a=e.slice(0,e.length-1),c=gr(t,a,Object);for(;c.obj===void 0&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),c=gr(t,a,Object),c?.obj&&typeof c.obj[`${c.k}.${o}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${o}`]=n},Bp=(t,e,n,s)=>{const{obj:r,k:o}=gr(t,e,Object);r[o]=r[o]||[],r[o].push(n)},fi=(t,e)=>{const{obj:n,k:s}=gr(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,s))return n[s]},Tp=(t,e,n)=>{const s=fi(t,n);return s!==void 0?s:fi(e,n)},Au=(t,e,n)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in t?Be(t[s])||t[s]instanceof String||Be(e[s])||e[s]instanceof String?n&&(t[s]=e[s]):Au(t[s],e[s],n):t[s]=e[s]);return t},Qn=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Lp={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Np=t=>Be(t)?t.replace(/[&<>"'\/]/g,e=>Lp[e]):t;class Rp{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const Op=[" ",",","?","!",";"],Pp=new Rp(20),_p=(t,e,n)=>{e=e||"",n=n||"";const s=Op.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(s.length===0)return!0;const r=Pp.getRegExp(`(${s.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!r.test(t);if(!o){const a=t.indexOf(n);a>0&&!r.test(t.substring(0,a))&&(o=!0)}return o},Wo=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const s=e.split(n);let r=t;for(let o=0;o<s.length;){if(!r||typeof r!="object")return;let a,c="";for(let l=o;l<s.length;++l)if(l!==o&&(c+=n),c+=s[l],a=r[c],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&l<s.length-1)continue;o+=l-o+1;break}r=a}return r},Er=t=>t?.replace(/_/g,"-"),Ip={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class pi{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||Ip,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,s,r){return r&&!this.debug?null:(Be(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new pi(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new pi(this.logger,e)}}var Fn=new pi;class Pi{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const r=this.observers[s].get(n)||0;this.observers[s].set(n,r+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([r,o])=>{for(let a=0;a<o;a++)r(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([r,o])=>{for(let a=0;a<o;a++)r.apply(r,[e,...n])})}}class ol extends Pi{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,s,r={}){const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;e.indexOf(".")>-1?c=e.split("."):(c=[e,n],s&&(Array.isArray(s)?c.push(...s):Be(s)&&o?c.push(...s.split(o)):c.push(s)));const l=fi(this.data,c);return!l&&!n&&!s&&e.indexOf(".")>-1&&(e=c[0],n=c[1],s=c.slice(2).join(".")),l||!a||!Be(s)?l:Wo(this.data?.[e]?.[n],s,o)}addResource(e,n,s,r,o={silent:!1}){const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let c=[e,n];s&&(c=c.concat(a?s.split(a):s)),e.indexOf(".")>-1&&(c=e.split("."),r=n,n=c[1]),this.addNamespaces(n),il(this.data,c,r),o.silent||this.emit("added",e,n,s,r)}addResources(e,n,s,r={silent:!1}){for(const o in s)(Be(s[o])||Array.isArray(s[o]))&&this.addResource(e,n,o,s[o],{silent:!0});r.silent||this.emit("added",e,n,s)}addResourceBundle(e,n,s,r,o,a={silent:!1,skipCopy:!1}){let c=[e,n];e.indexOf(".")>-1&&(c=e.split("."),r=s,s=n,n=c[1]),this.addNamespaces(n);let l=fi(this.data,c)||{};a.skipCopy||(s=JSON.parse(JSON.stringify(s))),r?Au(l,s,o):l={...l,...s},il(this.data,c,l),a.silent||this.emit("added",e,n,s)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(r=>n[r]&&Object.keys(n[r]).length>0)}toJSON(){return this.data}}var ku={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,s,r){return t.forEach(o=>{e=this.processors[o]?.process(e,n,s,r)??e}),e}};const Su=Symbol("i18next/PATH_KEY");function Mp(){const t=[],e=Object.create(null);let n;return e.get=(s,r)=>(n?.revoke?.(),r===Su?t:(t.push(r),n=Proxy.revocable(s,e),n.proxy)),Proxy.revocable(Object.create(null),e).proxy}function Bs(t,e){const{[Su]:n}=t(Mp()),s=e?.keySeparator??".",r=e?.nsSeparator??":";if(n.length>1&&r){const o=e?.ns,a=Array.isArray(o)?o:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${r}${n.slice(1).join(s)}`}return n.join(s)}const al={},go=t=>!Be(t)&&typeof t!="boolean"&&typeof t!="number";class mi extends Pi{constructor(e,n={}){super(),Sp(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Fn.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const s={...n};if(e==null)return!1;const r=this.resolve(e,s);if(r?.res===void 0)return!1;const o=go(r.res);return!(s.returnObjects===!1&&o)}extractFromKey(e,n){let s=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=s&&e.indexOf(s)>-1,c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!_p(e,s,r);if(a&&!c){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:Be(o)?[o]:o};const u=e.split(s);(s!==r||s===r&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),e=u.join(r)}return{key:e,namespaces:Be(o)?[o]:o}}translate(e,n,s){let r=typeof n=="object"?{...n}:n;if(typeof r!="object"&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),typeof r=="object"&&(r={...r}),r||(r={}),e==null)return"";typeof e=="function"&&(e=Bs(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]),e=e.map(K=>typeof K=="function"?Bs(K,{...this.options,...r}):String(K));const o=r.returnDetails!==void 0?r.returnDetails:this.options.returnDetails,a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,{key:c,namespaces:l}=this.extractFromKey(e[e.length-1],r),u=l[l.length-1];let d=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;d===void 0&&(d=":");const h=r.lng||this.language,D=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h?.toLowerCase()==="cimode")return D?o?{res:`${u}${d}${c}`,usedKey:c,exactUsedKey:c,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(r)}:`${u}${d}${c}`:o?{res:c,usedKey:c,exactUsedKey:c,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(r)}:c;const m=this.resolve(e,r);let g=m?.res;const y=m?.usedKey||c,b=m?.exactUsedKey||c,w=["[object Number]","[object Function]","[object RegExp]"],x=r.joinArrays!==void 0?r.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,N=r.count!==void 0&&!Be(r.count),$=mi.hasDefaultValue(r),V=N?this.pluralResolver.getSuffix(h,r.count,r):"",U=r.ordinal&&N?this.pluralResolver.getSuffix(h,r.count,{ordinal:!1}):"",G=N&&!r.ordinal&&r.count===0,Y=G&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${V}`]||r[`defaultValue${U}`]||r.defaultValue;let W=g;j&&!g&&$&&(W=Y);const ue=go(W),P=Object.prototype.toString.apply(W);if(j&&W&&ue&&w.indexOf(P)<0&&!(Be(x)&&Array.isArray(W))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const K=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,W,{...r,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return o?(m.res=K,m.usedParams=this.getUsedParamsDetails(r),m):K}if(a){const K=Array.isArray(W),B=K?[]:{},S=K?b:y;for(const R in W)if(Object.prototype.hasOwnProperty.call(W,R)){const he=`${S}${a}${R}`;$&&!g?B[R]=this.translate(he,{...r,defaultValue:go(Y)?Y[R]:void 0,joinArrays:!1,ns:l}):B[R]=this.translate(he,{...r,joinArrays:!1,ns:l}),B[R]===he&&(B[R]=W[R])}g=B}}else if(j&&Be(x)&&Array.isArray(g))g=g.join(x),g&&(g=this.extendTranslation(g,e,r,s));else{let K=!1,B=!1;!this.isValidLookup(g)&&$&&(K=!0,g=Y),this.isValidLookup(g)||(B=!0,g=c);const R=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&B?void 0:g,he=$&&Y!==g&&this.options.updateMissing;if(B||K||he){if(this.logger.log(he?"updateKey":"missingKey",h,u,c,he?Y:g),a){const Z=this.resolve(c,{...r,keySeparator:!1});Z&&Z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let be=[];const Fe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Fe&&Fe[0])for(let Z=0;Z<Fe.length;Z++)be.push(Fe[Z]);else this.options.saveMissingTo==="all"?be=this.languageUtils.toResolveHierarchy(r.lng||this.language):be.push(r.lng||this.language);const Ne=(Z,T,ge)=>{const I=$&&ge!==g?ge:R;this.options.missingKeyHandler?this.options.missingKeyHandler(Z,u,T,I,he,r):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(Z,u,T,I,he,r),this.emit("missingKey",Z,u,T,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?be.forEach(Z=>{const T=this.pluralResolver.getSuffixes(Z,r);G&&r[`defaultValue${this.options.pluralSeparator}zero`]&&T.indexOf(`${this.options.pluralSeparator}zero`)<0&&T.push(`${this.options.pluralSeparator}zero`),T.forEach(ge=>{Ne([Z],c+ge,r[`defaultValue${ge}`]||Y)})}):Ne(be,c,Y))}g=this.extendTranslation(g,e,r,m,s),B&&g===c&&this.options.appendNamespaceToMissingKey&&(g=`${u}${d}${c}`),(B||K)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${d}${c}`:c,K?g:void 0,r))}return o?(m.res=g,m.usedParams=this.getUsedParamsDetails(r),m):g}extendTranslation(e,n,s,r,o){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const l=Be(e)&&(s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(l){const h=e.match(this.interpolator.nestingRegexp);u=h&&h.length}let d=s.replace&&!Be(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,s.lng||this.language||r.usedLng,s),l){const h=e.match(this.interpolator.nestingRegexp),D=h&&h.length;u<D&&(s.nest=!1)}!s.lng&&r&&r.res&&(s.lng=this.language||r.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,(...h)=>o?.[0]===h[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):this.translate(...h,n),s)),s.interpolation&&this.interpolator.reset()}const a=s.postProcess||this.options.postProcess,c=Be(a)?[a]:a;return e!=null&&c?.length&&s.applyPostProcessor!==!1&&(e=ku.handle(c,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,n={}){let s,r,o,a,c;return Be(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(l=>typeof l=="function"?Bs(l,{...this.options,...n}):l)),e.forEach(l=>{if(this.isValidLookup(s))return;const u=this.extractFromKey(l,n),d=u.key;r=d;let h=u.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const D=n.count!==void 0&&!Be(n.count),m=D&&!n.ordinal&&n.count===0,g=n.context!==void 0&&(Be(n.context)||typeof n.context=="number")&&n.context!=="",y=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(b=>{this.isValidLookup(s)||(c=b,!al[`${y[0]}-${b}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(al[`${y[0]}-${b}`]=!0,this.logger.warn(`key "${r}" for languages "${y.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(w=>{if(this.isValidLookup(s))return;a=w;const x=[d];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(x,d,w,b,n);else{let N;D&&(N=this.pluralResolver.getSuffix(w,n.count,n));const $=`${this.options.pluralSeparator}zero`,V=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(D&&(n.ordinal&&N.indexOf(V)===0&&x.push(d+N.replace(V,this.options.pluralSeparator)),x.push(d+N),m&&x.push(d+$)),g){const U=`${d}${this.options.contextSeparator||"_"}${n.context}`;x.push(U),D&&(n.ordinal&&N.indexOf(V)===0&&x.push(U+N.replace(V,this.options.pluralSeparator)),x.push(U+N),m&&x.push(U+$))}}let j;for(;j=x.pop();)this.isValidLookup(s)||(o=j,s=this.getResource(w,b,j,n))}))})}),{res:s,usedKey:r,exactUsedKey:o,usedLng:a,usedNS:c}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,s,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,n,s,r):this.resourceStore.getResource(e,n,s,r)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!Be(e.replace);let r=s?e.replace:e;if(s&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!s){r={...r};for(const o of n)delete r[o]}return r}static hasDefaultValue(e){const n="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&n===s.substring(0,n.length)&&e[s]!==void 0)return!0;return!1}}class cl{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Fn.create("languageUtils")}getScriptPartFromCode(e){if(e=Er(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=Er(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Be(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(s=>{if(n)return;const r=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(r))&&(n=r)}),!n&&this.options.supportedLngs&&e.forEach(s=>{if(n)return;const r=this.getScriptPartFromCode(s);if(this.isSupportedCode(r))return n=r;const o=this.getLanguagePartFromCode(s);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(a=>{if(a===o)return a;if(!(a.indexOf("-")<0&&o.indexOf("-")<0)&&(a.indexOf("-")>0&&o.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===o||a.indexOf(o)===0&&o.length>1))return a})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),Be(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let s=e[n];return s||(s=e[this.getScriptPartFromCode(n)]),s||(s=e[this.formatLanguageCode(n)]),s||(s=e[this.getLanguagePartFromCode(n)]),s||(s=e.default),s||[]}toResolveHierarchy(e,n){const s=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),r=[],o=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return Be(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):Be(e)&&o(this.formatLanguageCode(e)),s.forEach(a=>{r.indexOf(a)<0&&o(this.formatLanguageCode(a))}),r}}const ll={zero:0,one:1,two:2,few:3,many:4,other:5},ul={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class $p{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=Fn.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const s=Er(e==="dev"?"en":e),r=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:s,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let a;try{a=new Intl.PluralRules(s,{type:r})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),ul;if(!e.match(/-|_/))return ul;const l=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(l,n)}return this.pluralRulesCache[o]=a,a}needsPlural(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,n,s={}){return this.getSuffixes(e,s).map(r=>`${n}${r}`)}getSuffixes(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?s.resolvedOptions().pluralCategories.sort((r,o)=>ll[r]-ll[o]).map(r=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(e,n,s={}){const r=this.getRule(e,s);return r?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${r.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,s))}}const dl=(t,e,n,s=".",r=!0)=>{let o=Tp(t,e,n);return!o&&r&&Be(n)&&(o=Wo(t,n,s),o===void 0&&(o=Wo(e,n,s))),o},Fo=t=>t.replace(/\$/g,"$$$$");class hl{constructor(e={}){this.logger=Fn.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(n=>n),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:s,useRawValueToEscape:r,prefix:o,prefixEscaped:a,suffix:c,suffixEscaped:l,formatSeparator:u,unescapeSuffix:d,unescapePrefix:h,nestingPrefix:D,nestingPrefixEscaped:m,nestingSuffix:g,nestingSuffixEscaped:y,nestingOptionsSeparator:b,maxReplaces:w,alwaysFormat:x}=e.interpolation;this.escape=n!==void 0?n:Np,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=o?Qn(o):a||"{{",this.suffix=c?Qn(c):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=D?Qn(D):m||Qn("$t("),this.nestingSuffix=g?Qn(g):y||Qn(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=w||1e3,this.alwaysFormat=x!==void 0?x:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,s)=>n?.source===s?(n.lastIndex=0,n):new RegExp(s,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,s,r){let o,a,c;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=m=>{if(m.indexOf(this.formatSeparator)<0){const w=dl(n,l,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(w,void 0,s,{...r,...n,interpolationkey:m}):w}const g=m.split(this.formatSeparator),y=g.shift().trim(),b=g.join(this.formatSeparator).trim();return this.format(dl(n,l,y,this.options.keySeparator,this.options.ignoreJSONStructure),b,s,{...r,...n,interpolationkey:y})};this.resetRegExp();const d=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>Fo(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?Fo(this.escape(m)):Fo(m)}].forEach(m=>{for(c=0;o=m.regex.exec(e);){const g=o[1].trim();if(a=u(g),a===void 0)if(typeof d=="function"){const b=d(e,o,r);a=Be(b)?b:""}else if(r&&Object.prototype.hasOwnProperty.call(r,g))a="";else if(h){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),a="";else!Be(a)&&!this.useRawValueToEscape&&(a=nl(a));const y=m.safeValue(a);if(e=e.replace(o[0],y),h?(m.regex.lastIndex+=a.length,m.regex.lastIndex-=o[0].length):m.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,n,s={}){let r,o,a;const c=(l,u)=>{const d=this.nestingOptionsSeparator;if(l.indexOf(d)<0)return l;const h=l.split(new RegExp(`${Qn(d)}[ ]*{`));let D=`{${h[1]}`;l=h[0],D=this.interpolate(D,a);const m=D.match(/'/g),g=D.match(/"/g);((m?.length??0)%2===0&&!g||(g?.length??0)%2!==0)&&(D=D.replace(/'/g,'"'));try{a=JSON.parse(D),u&&(a={...u,...a})}catch(y){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,y),`${l}${d}${D}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];a={...s},a=a.replace&&!Be(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const u=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(u!==-1&&(l=r[1].slice(u).split(this.formatSeparator).map(d=>d.trim()).filter(Boolean),r[1]=r[1].slice(0,u)),o=n(c.call(this,r[1].trim(),a),a),o&&r[0]===e&&!Be(o))return o;Be(o)||(o=nl(o)),o||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),o=""),l.length&&(o=l.reduce((d,h)=>this.format(d,h,s.lng,{...s,interpolationkey:r[1].trim()}),o.trim())),e=e.replace(r[0],o),this.regexp.lastIndex=0}return e}}const Up=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const s=t.split("(");e=s[0].toLowerCase().trim();const r=s[1].substring(0,s[1].length-1);e==="currency"&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach(a=>{if(a){const[c,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),d=c.trim();n[d]||(n[d]=u),u==="false"&&(n[d]=!1),u==="true"&&(n[d]=!0),isNaN(u)||(n[d]=parseInt(u,10))}})}return{formatName:e,formatOptions:n}},fl=t=>{const e={};return(n,s,r)=>{let o=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(o={...o,[r.interpolationkey]:void 0});const a=s+JSON.stringify(o);let c=e[a];return c||(c=t(Er(s),r),e[a]=c),c(n)}},zp=t=>(e,n,s)=>t(Er(n),s)(e);class Hp{constructor(e={}){this.logger=Fn.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const s=n.cacheInBuiltFormats?fl:zp;this.formats={number:s((r,o)=>{const a=new Intl.NumberFormat(r,{...o});return c=>a.format(c)}),currency:s((r,o)=>{const a=new Intl.NumberFormat(r,{...o,style:"currency"});return c=>a.format(c)}),datetime:s((r,o)=>{const a=new Intl.DateTimeFormat(r,{...o});return c=>a.format(c)}),relativetime:s((r,o)=>{const a=new Intl.RelativeTimeFormat(r,{...o});return c=>a.format(c,o.range||"day")}),list:s((r,o)=>{const a=new Intl.ListFormat(r,{...o});return c=>a.format(c)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=fl(n)}format(e,n,s,r={}){const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(c=>c.indexOf(")")>-1)){const c=o.findIndex(l=>l.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,c)].join(this.formatSeparator)}return o.reduce((c,l)=>{const{formatName:u,formatOptions:d}=Up(l);if(this.formats[u]){let h=c;try{const D=r?.formatParams?.[r.interpolationkey]||{},m=D.locale||D.lng||r.locale||r.lng||s;h=this.formats[u](c,m,{...d,...r,...D})}catch(D){this.logger.warn(D)}return h}else this.logger.warn(`there was no format function for ${u}`);return c},e)}}const Vp=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class qp extends Pi{constructor(e,n,s,r={}){super(),this.backend=e,this.store=n,this.services=s,this.languageUtils=s.languageUtils,this.options=r,this.logger=Fn.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(s,r.backend,r)}queueLoad(e,n,s,r){const o={},a={},c={},l={};return e.forEach(u=>{let d=!0;n.forEach(h=>{const D=`${u}|${h}`;!s.reload&&this.store.hasResourceBundle(u,h)?this.state[D]=2:this.state[D]<0||(this.state[D]===1?a[D]===void 0&&(a[D]=!0):(this.state[D]=1,d=!1,a[D]===void 0&&(a[D]=!0),o[D]===void 0&&(o[D]=!0),l[h]===void 0&&(l[h]=!0)))}),d||(c[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(l)}}loaded(e,n,s){const r=e.split("|"),o=r[0],a=r[1];n&&this.emit("failedLoading",o,a,n),!n&&s&&this.store.addResourceBundle(o,a,s,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&s&&(this.state[e]=0);const c={};this.queue.forEach(l=>{Bp(l.loaded,[o],a),Vp(l,e),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{c[u]||(c[u]={});const d=l.loaded[u];d.length&&d.forEach(h=>{c[u][h]===void 0&&(c[u][h]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(l=>!l.done)}read(e,n,s,r=0,o=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:s,tried:r,wait:o,callback:a});return}this.readingCalls++;const c=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(u&&d&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,s,r+1,o*2,a)},o);return}a(u,d)},l=this.backend[s].bind(this.backend);if(l.length===2){try{const u=l(e,n);u&&typeof u.then=="function"?u.then(d=>c(null,d)).catch(c):c(null,u)}catch(u){c(u)}return}return l(e,n,c)}prepareLoading(e,n,s={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();Be(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Be(n)&&(n=[n]);const o=this.queueLoad(e,n,s,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(e,n,s){this.prepareLoading(e,n,{},s)}reload(e,n,s){this.prepareLoading(e,n,{reload:!0},s)}loadOne(e,n=""){const s=e.split("|"),r=s[0],o=s[1];this.read(r,o,"read",void 0,void 0,(a,c)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${r} failed`,a),!a&&c&&this.logger.log(`${n}loaded namespace ${o} for language ${r}`,c),this.loaded(e,a,c)})}saveMissing(e,n,s,r,o,a={},c=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${s}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if(this.backend?.create){const l={...a,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(e,n,s,r,l):d=u(e,n,s,r),d&&typeof d.then=="function"?d.then(h=>c(null,h)).catch(c):c(null,d)}catch(d){c(d)}else u(e,n,s,r,c,l)}!e||!e[0]||this.store.addResource(e[0],n,s,r)}}}const bo=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),Be(t[1])&&(e.defaultValue=t[1]),Be(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(s=>{e[s]=n[s]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),pl=t=>(Be(t.ns)&&(t.ns=[t.ns]),Be(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Be(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),Xr=()=>{},Kp=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})},ju="__i18next_supportNoticeShown",Wp=()=>!!(typeof globalThis<"u"&&globalThis[ju]||typeof process<"u"&&Do&&Do.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&Do),Gp=()=>{typeof globalThis<"u"&&(globalThis[ju]=!0)},Yp=t=>!!(t?.modules?.backend?.name?.indexOf("Locize")>0||t?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||t?.options?.backend?.backends&&t.options.backend.backends.some(e=>e?.name?.indexOf("Locize")>0||e?.constructor?.name?.indexOf("Locize")>0)||t?.options?.backend?.projectId||t?.options?.backend?.backendOptions&&t.options.backend.backendOptions.some(e=>e?.projectId));class Fr extends Pi{constructor(e={},n){if(super(),this.options=pl(e),this.services={},this.logger=Fn,this.modules={external:[]},Kp(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(Be(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const s=bo();this.options={...s,...this.options,...pl(e)},this.options.interpolation={...s.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Yp(this)&&!Wp()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),Gp());const r=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Fn.init(r(this.modules.logger),this.options):Fn.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=Hp;const d=new cl(this.options);this.store=new ol(this.options.resources,this.options);const h=this.services;h.logger=Fn,h.resourceStore=this.store,h.languageUtils=d,h.pluralResolver=new $p(d,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==s.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),u&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(h.formatter=r(u),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new hl(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new qp(r(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(m,...g)=>{this.emit(m,...g)}),this.modules.languageDetector&&(h.languageDetector=r(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=r(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new mi(this.services,this.options),this.translator.on("*",(m,...g)=>{this.emit(m,...g)}),this.modules.external.forEach(m=>{m.init&&m.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Xr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=(...d)=>this.store[u](...d)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...d)=>(this.store[u](...d),this)});const c=ur(),l=()=>{const u=(d,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(h),n(d,h)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),c}loadResources(e,n=Xr){let s=n;const r=Be(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const o=[],a=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(u=>{u!=="cimode"&&o.indexOf(u)<0&&o.push(u)})};r?a(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload?.forEach?.(c=>a(c)),this.services.backendConnector.load(o,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(c)})}else s(null)}reloadResources(e,n,s){const r=ur();return typeof e=="function"&&(s=e,e=void 0),typeof n=="function"&&(s=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),s||(s=Xr),this.services.backendConnector.reload(e,n,o=>{r.resolve(),s(o)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&ku.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let n=0;n<this.languages.length;n++){const s=this.languages[n];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const s=ur();this.emit("languageChanging",e);const r=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},o=(c,l)=>{l?this.isLanguageChangingTo===e&&(r(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,s.resolve((...u)=>this.t(...u)),n&&n(c,(...u)=>this.t(...u))},a=c=>{!e&&!c&&this.services.languageDetector&&(c=[]);const l=Be(c)?c:c&&c[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(Be(c)?[c]:c);u&&(this.language||r(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,d=>{o(d,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),s}getFixedT(e,n,s){const r=(o,a,...c)=>{let l;typeof a!="object"?l=this.options.overloadTranslationOptionHandler([o,a].concat(c)):l={...a},l.lng=l.lng||r.lng,l.lngs=l.lngs||r.lngs,l.ns=l.ns||r.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||s||r.keyPrefix);const u={...this.options,...l};typeof l.keyPrefix=="function"&&(l.keyPrefix=Bs(l.keyPrefix,u));const d=this.options.keySeparator||".";let h;return l.keyPrefix&&Array.isArray(o)?h=o.map(D=>(typeof D=="function"&&(D=Bs(D,u)),`${l.keyPrefix}${d}${D}`)):(typeof o=="function"&&(o=Bs(o,u)),h=l.keyPrefix?`${l.keyPrefix}${d}${o}`:o),this.t(h,l)};return Be(e)?r.lng=e:r.lngs=e,r.ns=n,r.keyPrefix=s,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=n.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const a=(c,l)=>{const u=this.services.backendConnector.state[`${c}|${l}`];return u===-1||u===0||u===2};if(n.precheck){const c=n.precheck(this,a);if(c!==void 0)return c}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(s,e)&&(!r||a(o,e)))}loadNamespaces(e,n){const s=ur();return this.options.ns?(Be(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{s.resolve(),n&&n(r)}),s):(n&&n(),Promise.resolve())}loadLanguages(e,n){const s=ur();Be(e)&&(e=[e]);const r=this.options.preload||[],o=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return o.length?(this.options.preload=r.concat(o),this.loadResources(a=>{s.resolve(),n&&n(a)}),s):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const r=new Intl.Locale(e);if(r&&r.getTextInfo){const o=r.getTextInfo();if(o&&o.direction)return o.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=this.services?.languageUtils||new cl(bo());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const s=new Fr(e,n);return s.createInstance=Fr.createInstance,s}cloneInstance(e={},n=Xr){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new Fr(r);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(c=>{o[c]=this[c]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},s){const c=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},l[u]=Object.keys(l[u]).reduce((d,h)=>(d[h]={...l[u][h]},d),l[u]),l),{});o.store=new ol(c,r),o.services.resourceStore=o.store}if(e.interpolation){const l={...bo().interpolation,...this.options.interpolation,...e.interpolation},u={...r,interpolation:l};o.services.interpolator=new hl(u)}return o.translator=new mi(o.services,r),o.translator.on("*",(c,...l)=>{o.emit(c,...l)}),o.init(r,n),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ke=Fr.createInstance();Ke.createInstance;Ke.dir;Ke.init;Ke.loadResources;Ke.reloadResources;Ke.use;Ke.changeLanguage;Ke.getFixedT;Ke.t;Ke.exists;Ke.setDefaultNamespace;Ke.hasLoadedNamespace;Ke.loadNamespaces;Ke.loadLanguages;const{slice:Xp,forEach:Jp}=[];function Zp(t){return Jp.call(Xp.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function Qp(t){return typeof t!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(t))}const ml=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,em=function(t,e){const s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},r=encodeURIComponent(e);let o=`${t}=${r}`;if(s.maxAge>0){const a=s.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(a)}`}if(s.domain){if(!ml.test(s.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${s.domain}`}if(s.path){if(!ml.test(s.path))throw new TypeError("option path is invalid");o+=`; Path=${s.path}`}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${s.expires.toUTCString()}`}if(s.httpOnly&&(o+="; HttpOnly"),s.secure&&(o+="; Secure"),s.sameSite)switch(typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return s.partitioned&&(o+="; Partitioned"),o},Dl={create(t,e,n,s){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+n*60*1e3)),s&&(r.domain=s),document.cookie=em(t,e,r)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let s=0;s<n.length;s++){let r=n[s];for(;r.charAt(0)===" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return r.substring(e.length,r.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var tm={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return Dl.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:s,cookieDomain:r,cookieOptions:o}=e;n&&typeof document<"u"&&Dl.create(n,t,s,r,o)}},nm={name:"querystring",lookup(t){let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:s}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(s=window.location.hash.substring(window.location.hash.indexOf("?")));const o=s.substring(1).split("&");for(let a=0;a<o.length;a++){const c=o[a].indexOf("=");c>0&&o[a].substring(0,c)===e&&(n=o[a].substring(c+1))}}return n}},sm={name:"hash",lookup(t){let{lookupHash:e,lookupFromHashIndex:n}=t,s;if(typeof window<"u"){const{hash:r}=window.location;if(r&&r.length>2){const o=r.substring(1);if(e){const a=o.split("&");for(let c=0;c<a.length;c++){const l=a[c].indexOf("=");l>0&&a[c].substring(0,l)===e&&(s=a[c].substring(l+1))}}if(s)return s;if(!s&&n>-1){const a=r.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?a[typeof n=="number"?n:0]?.replace("/",""):void 0}}}return s}};let bs=null;const gl=()=>{if(bs!==null)return bs;try{if(bs=typeof window<"u"&&window.localStorage!==null,!bs)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{bs=!1}return bs};var rm={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&gl())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&gl()&&window.localStorage.setItem(n,t)}};let ys=null;const Fl=()=>{if(ys!==null)return ys;try{if(ys=typeof window<"u"&&window.sessionStorage!==null,!ys)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{ys=!1}return ys};var im={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&Fl())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&Fl()&&window.sessionStorage.setItem(n,t)}},om={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:s,language:r}=navigator;if(n)for(let o=0;o<n.length;o++)e.push(n[o]);s&&e.push(s),r&&e.push(r)}return e.length>0?e:void 0}},am={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const s=e||(typeof document<"u"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(n=s.getAttribute("lang")),n}},cm={name:"path",lookup(t){let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?n[typeof e=="number"?e:0]?.replace("/",""):void 0}},lm={name:"subdomain",lookup(t){let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,s=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(s)return s[n]}};let Bu=!1;try{document.cookie,Bu=!0}catch{}const Tu=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Bu||Tu.splice(1,1);const um=()=>({order:Tu,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class Lu{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=Zp(n,this.options||{},um()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=r=>r.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(tm),this.addDetector(nm),this.addDetector(rm),this.addDetector(im),this.addDetector(om),this.addDetector(am),this.addDetector(cm),this.addDetector(lm),this.addDetector(sm)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(s=>{if(this.detectors[s]){let r=this.detectors[s].lookup(this.options);r&&typeof r=="string"&&(r=[r]),r&&(n=n.concat(r))}}),n=n.filter(s=>s!=null&&!Qp(s)).map(s=>this.options.convertDetectedLanguage(s)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(s=>{this.detectors[s]&&this.detectors[s].cacheUserLanguage(e,this.options)}))}}Lu.type="languageDetector";const dm={cancel:"Cancel",create:"Create",add:"Add",remove:"Remove",delete:"Delete",close:"Close",user:"User",permission:"Permission",readOnly:"Read only",readWrite:"Read & write",settings:"Settings",comments:"Comments",files:"Files",outline:"Outline",version:"Version",loading:"Loading…",enabled:"Enabled",disabled:"Disabled",normal:"Active",admin:"Administrator",language:"Language",save:"Save",edit:"Edit",retry:"Retry",reload:"Reload page",languageEnglish:"English",languageChinese:"中文"},hm={tagline:"A lightweight LaTeX writing environment",username:"Username",password:"Password",login:"Sign in",contact:"Need an account? Contact {{email}}",firstLogin:"Change your temporary password to continue",currentPassword:"Current password",newPassword:"New password",confirmPassword:"Confirm new password",updatePassword:"Update password",mismatch:"The new passwords do not match",passwordMinimum:"At least {{count}} characters",sessionExpired:"Your session has expired. Please sign in again.",logout:"Sign out"},fm={title:"Projects",subtitle:"Create, edit and share LaTeX documents",restricted:"You can access projects shared with you. Project creation requires administrator permission.",new:"New project",newDescription:"The project will use the configured default LaTeX engine.",name:"Project name",emptyTitle:"Let’s build something great",emptyDescription:"Create a project or upload an existing LaTeX archive to get started.",emptyRestricted:"Projects shared with you will appear here.",noMatches:"No projects match the current search or tag filter.",upload:"Upload project",uploadDescription:"Upload a ZIP archive. A single top-level folder is removed automatically. Maximum file size: {{size}} MB.",zipFile:"ZIP archive",import:"Import project",importing:"Importing…",search:"Search projects…",grid:"Grid",list:"List",scope:"Project status",active:"Active",archived:"Archived",archive:"Archive",unarchive:"Restore",noArchived:"No archived projects.",allTags:"All tags",sortBy:"Sort",sortModified:"Last modified",sortCreated:"Created",pagination:"Project pages",pageOf:"Page {{page}} of {{totalPages}} · {{count}} projects",previousPage:"Previous",nextPage:"Next",owner:"Owner",created:"Created",modified:"Last modified",relativeHoursPast:"{{hours}}h ago",relativeHoursMinutesPast:"{{hours}}h {{minutes}}m ago",relativeHoursFuture:"in {{hours}}h",relativeHoursMinutesFuture:"in {{hours}}h {{minutes}}m",relativeDaysPast:"{{days}}d ago",relativeDaysHoursPast:"{{days}}d {{hours}}h ago",relativeDaysFuture:"in {{days}}d",relativeDaysHoursFuture:"in {{days}}d {{hours}}h",comments:"Comments",unresolvedComments:"{{count}} unresolved comments",unresolvedCommentsTooltip:"{{unresolved}} unresolved / {{total}} total comments",allResolved:"All resolved ({{count}})",allCommentsResolvedTooltip:"All {{count}} comments resolved",noComments:"No comments",unresolvedCount:"{{count}} unresolved",modifiedBy:"Modified by",byUser:"By {{user}}",modifiedByUser:"{{time}} · By {{user}}",deletedUser:"Deleted user",filterTags:"Filter by tag",rename:"Rename",renameTitle:"Rename project",duplicate:"Duplicate",duplicating:"Duplicating…",duplicateTitle:"Duplicate project",duplicateDescription:"Create an independent copy of {{project}}. Files and project settings are copied; members, comments, Git history and compile output are not.",transfer:"Transfer",transferOwnership:"Transfer ownership",transferDescription:"Choose a new owner for {{project}}.",newOwner:"New owner",chooseNewOwner:"Choose a user",noTransferUsers:"No other active users",transferWarning:"You will keep read/write access. Source files, history, comments and members remain; the saved GitHub token is removed so the new owner can add their own credential.",transferForbidden:"Only the current project owner can transfer ownership.",transferTargetInvalid:"Choose a new project owner.",transferSelf:"You already own this project.",download:"Download",deleteTitle:"Delete project",deleteDescription:"Permanently delete {{project}} and all of its files? This cannot be undone.",chooseZip:"Choose a ZIP project",dropZip:"Drag and drop a ZIP archive here",browse:"Browse files",selectedFileSize:"Selected · {{size}}",clearFile:"Clear selected file"},pm={manage:"User management",back:"Back to projects",onlyAdmin:"Only administrators can create users",add:"Add user",role:"Role",createProjects:"Create projects",ownedProjects:"Owned projects",status:"Status",actions:"Actions",adminRequired:"Administrator permission is required.",allow:"Allow",deny:"Deny",enable:"Enable",disable:"Disable",promote:"Make administrator",demote:"Make user",allowCreate:"Allow creation",denyCreate:"Deny creation",resetPassword:"Reset password",initialPassword:"Login password",displayName:"Display name",addDescription:"Set a login password or generate a secure random one.",createUser:"Create user",randomPassword:"Random password",generatePassword:"Generate a random password",resetDescription:"Set a temporary password for {{username}}. Existing sessions will be signed out.",reset:"Reset",deleteTitle:"Delete user",deleteDescription:"Delete {{username}}? This cannot be undone.",ownedChoice:"{{count}} owned projects",transferProjects:"Transfer them to the current administrator",deleteProjects:"Permanently delete projects and files"},mm=JSON.parse(`{"saved":"Saved","savedAt":"Saved to server at {{time}}","loading":"Loading","pending":"Waiting to save","saving":"Saving to server","saveFailed":"Save failed","offlineDraft":"Offline · local draft retained","harperRecoveryTitle":"Harper is unavailable.","harperFallbackHint":" The browser's built-in spellchecker is being used instead.","texFmtRecoveryTitle":"tex-fmt could not load.","texFmtOptionsRecoveryTitle":"tex-fmt rejected the source or options.","texFmtRuntimeRecoveryTitle":"tex-fmt returned an unexpected result.","clientToolRecoveryHint":" Retry now, or reload the page to use the latest browser assets.","resetFormatterOptions":"Clear options and retry","texFmtDiagnosticsTitle":"tex-fmt produced diagnostics.","texFmtDiagnosticsHint":" The formatted text was applied; review the details below.","viewFormatterDiagnostics":"View diagnostics","dismissFormatterDiagnostics":"Dismiss formatter diagnostics","formattingBy":"{{name}} is formatting this file. Please wait…","compile":"Compile · {{engine}}","compiling":"Compiling…","compileQueued":"Compile queued…","compileFailedRetained":"Compilation failed; showing the last successful PDF from {{time}}.","compileFailedNoPdf":"Compilation failed and no successful PDF is available.","upToDate":"Files are up to date; no compilation was needed.","compileSnapshotStale":"PDF compiled from a consistent earlier snapshot; newer source changes are not included.","addComment":"Add comment","sourceComments":"Source comments","projectSettings":"Project settings","uploadAttachment":"Upload attachment","newFile":"New text file","binary":"The binary attachment is stored but cannot be opened in the text editor.","noOutline":"No sections in this file","preview":"PDF preview","previewHint":"Compile to generate the document","loadingPdf":"Loading PDF…","pdfCompiledAt":"Compiled successfully at {{time}}","pdfCompiledAtFor":"{{file}} compiled successfully at {{time}}","currentMainDocument":"Current document compiled as the root: {{path}}","mainDocumentCandidate":"LaTeX root document candidate: {{path}}","currentMainShort":"root","deletedUser":"Deleted User","orphaned":"Anchor lost","line":"Line {{line}}","reopen":"Reopen","resolve":"Mark resolved","noComments":"No comments in this file","newFileDescription":"Directories are allowed, for example chapters/introduction.tex.","filePath":"File path","commentDescription":"Selected {{count}} characters","pointComment":"No text selected; the comment will be anchored at the cursor.","commentContent":"Comment","backToProjects":"Back to projects","outputTabs":"Compile output","log":"Log","warnings":"Warnings","errors":"Errors","artifacts":"Artifacts","clean":"Recovery","noLog":"Compile to see the log.","noWarnings":"No warnings in the latest compile.","noErrors":"No errors in the latest compile.","projectRoot":"Project root","uploadTo":"Upload to {{folder}}","dropFiles":"Drop files to upload","newFolder":"New folder","folderName":"Folder name","noArtifacts":"Compile to see generated artifacts.","selectArtifact":"Select a text artifact to preview it.","viewArtifact":"View artifact","downloadArtifact":"Download artifact","downloadToView":"Download this artifact to view it","cleanTitle":"Compilation recovery","cleanDescription":"Use these advanced actions only when compilation is stuck, a previous error is left behind, or generated output is inconsistent. They do not change source files, project settings, comments, history, or Git data.","cleanCache":"Force a clean rebuild","cleanCacheDescription":"Use after a compilation failure or stale latexmk state. Removes the incremental cache while keeping the current successful PDF.","cleanArtifacts":"Remove generated output","cleanArtifactsDescription":"Use when generated files are inconsistent. Removes the PDF, SyncTeX, logs, and intermediate files for this root document.","cleanCacheConfirmTitle":"Force a clean rebuild?","cleanCacheConfirmDescription":"This recovery action removes the incremental latexmk cache. The current PDF remains visible, and the next compilation starts from a clean cache.","cleanArtifactsConfirmTitle":"Remove generated output?","cleanArtifactsConfirmDescription":"This recovery action removes the current PDF and all generated files for this root document. Source files are not affected.","cleanConfirm":"Run recovery","cleanCacheComplete":"Recovery cache cleared. The next compilation will be a full rebuild.","cleanArtifactsComplete":"Generated compilation output removed.","cleanBusy":"This root document is compiling. Try recovery again after it finishes.","folderDestination":"The folder will be created in {{folder}}.","uploadOverwriteTitle":"File already exists","uploadOverwriteDescription":"These files already exist: {{files}}. Replace them?","uploadOverwrite":"Replace files","collapseFiles":"Collapse file panel","showFileSizes":"Show file sizes","hideFileSizes":"Hide file sizes","move":"Move","moveTitle":"Move or rename {{name}}","moveDescription":"Choose a destination folder and name. Files, comments and project paths stay linked.","pathName":"Name","moveApply":"Move / rename","deletePath":"Delete file or folder","deletePathTitle":"Delete {{name}}","deletePathDescription":"Delete {{path}}? This cannot be undone.","deletePathActiveDescription":"Delete {{path}}? It is currently open for {{users}} and will close in those sessions.","deletePathWillClose":"Any late edits to this path will be rejected to prevent silent data loss.","fileDeletedByCollaborator":"{{path}} was deleted in another session. A safe fallback file has been opened.","destinationFolder":"Destination folder","compileShortcut":"Save and compile (Ctrl+S / Cmd+S)","compilingBy":"{{name}} is compiling","format":"Format","formatFile":"File","formatFileHint":"Format the current file","formatFileComplete":"Current file formatted.","formatFileFailed":"Unable to format the current file: {{message}}","formatSelected":"Selected","commentsAdd":"Add","commentsAll":"View","formatSelection":"Format selection","formatting":"Formatting…","formatSelectionHint":"Select LaTeX source to format","formatSelectionRequired":"Select LaTeX source before formatting.","formatSelectionComplete":"Selected LaTeX source formatted.","formatFailedContinue":"Formatting failed; compilation will continue: {{message}}","formatFailed":"Unable to format the selection: {{message}}","formatSourceChanged":"The source changed during formatting, so formatting was skipped.","formatSelectionChanged":"The selected source changed during formatting. Select it again and retry.","writingSuggestions":"Writing suggestions","noWritingSuggestions":"No suggestions available","removeText":"Remove text","replaceWith":"Replace with {{word}}","spellCheckReadOnly":"Read-only: choose a suggestion in an editor with write permission.","spellCheckSourceChanged":"The source changed before the writing correction could be applied.","vimOn":"Vim ON","vimOnHint":"Vim keybindings are enabled for this editor.","reply":"Reply","replyPlaceholder":"Write a reply…","sendReply":"Send reply","editComment":"Edit comment","deleteComment":"Delete comment","saveChanges":"Save changes","deleteCommentTitle":"Delete comment","deleteCommentDescription":"Delete this comment and its {{count}} replies? This cannot be undone.","editReply":"Edit reply","deleteReply":"Delete reply","deleteReplyTitle":"Delete reply","deleteReplyDescription":"Delete this reply? This cannot be undone.","editedAt":"Edited {{time}}","outlineJump":"Go to source line {{line}} and locate it in the PDF","lineNumber":"line {{line}}","showInSource":"Show the visible PDF location in source","showInPdf":"Show the source cursor location in PDF","syncTexOnlyForTex":"PDF sync is only available for TeX (.tex) files","syncTexOnlyForMain":"PDF sync is only available for the current main TeX document","openFiles":"Open files","pdfLoadFailed":"The PDF preview could not be loaded","pdfZoomControls":"PDF zoom controls","downloadPdf":"Download PDF","downloadResource":"Download file","resourceTooLarge":"This file is {{size}} and exceeds the direct preview limit of {{limit}}.","resourceTooLargeTitle":"File is too large to preview","resourceTooLargeDescription":"Download the file to open it locally.","resourceUnsupportedTitle":"Preview unavailable","resourceUnsupportedDescription":"This file type cannot be rendered in the browser. Download it to open it locally.","resourcePreview":{"image":"Image preview","pdf":"PDF preview","text":"Text preview","unsupported":"File preview"},"pdfZoomOut":"Zoom out","pdfZoomIn":"Zoom in","pdfFitWidth":"Fit width","pdfLink":"PDF link","pdfLinks":"PDF links","layout":{"label":"Layout","choose":"Choose layout","current":"Current layout: {{layout}}","editor-pdf":{"name":"Editor & PDF","description":"Show the source editor and PDF preview side by side"},"editor-only":{"name":"Editor only","description":"Use the workspace for source editing"},"pdf-only":{"name":"PDF only","description":"Use the workspace for the PDF and compile output"}},"collaboration":{"connecting":"Connecting collaboration…","connected":"Live collaboration connected","disconnected":"Collaboration disconnected","editing":"Editing","viewing":"Viewing","joining":"Joining project","reconnect":"Reconnect","permissionDowngradeTitle":"Edit permission changed","permissionDowngradeDescription":"Your access changed from {{previous}} to read-only. Any unsaved local draft is still retained in this tab and cannot be saved. Keep it visible, or discard it and reload the latest server version.","permissionDowngradeKeep":"Keep local draft","permissionDowngradeDiscard":"Discard draft and reload","permissionDowngradeReload":"Reload server version","permissionDowngradeNoDraft":"Your access changed to read-only. Reload to use the latest server version, or continue viewing this tab.","permissionDowngradeOtherTab":"Your access changed to read-only. Another browser tab still has an unsaved draft; return to that tab to handle it. This page cannot clear the shared local draft safely.","permissionDowngradeMultipleDrafts":"Your access changed to read-only. This tab and another browser tab both have unsaved drafts. Handle the other tab first; this page will not clear shared local data.","permissionDowngradeOtherTabBlocked":"Another browser tab just created an unsaved draft, so cleanup was cancelled to protect it.","activeSessions":"{{count}} active sessions","showMoreSessions":"Show {{count}} more sessions","showFewerSessions":"Collapse session list","sessionTooltip":"{{name}} (@{{username}}) · {{file}} · {{activity}} · {{permission}}"},"search":{"button":"Find","title":"Find and replace (Ctrl+F / Cmd+F)","find":"Find","replace":"Replace","next":"Next","previous":"Previous","all":"Select all","matchCase":"Match case","regexp":"Regular expression","wholeWord":"Whole word","replaceNext":"Replace","replaceAll":"Replace all","currentMatch":"Current match","onLine":"on line","replacedMatchOnLine":"replaced match on line $","replacedMatches":"replaced $ matches","goToLine":"Go to line","go":"Go","matchCount":"{{count}} matches","noMatches":"No matches","invalidQuery":"Invalid regular expression"}}`),Dm={title:"Citation library",description:"Save references from {{file}} and import them into this BibTeX file. Your library and its tags are private to your account.",myLibrary:"My library",currentFile:"Current file",searchPlaceholder:"Search citations…",searchHint:"Search key, title, author, or year",emptyTitle:"Your library is empty",emptyDescription:"Open the current-file tab to save a BibTeX entry.",noEntries:"No BibTeX entries found",noEntriesDescription:"Add a valid @article, @inproceedings, or similar entry to this file.",currentFileTitle:"Entries from the current file",currentFileDescription:"Select an entry to save it to your citation library.",backToLibrary:"Back to library",save:"Save",update:"Update",saving:"Saving…",saved:"Citation saved to your library.",updated:"Citation updated.",deleted:"Citation deleted.",deleteTitle:"Delete citation",deleteDescription:"Delete the citation {{key}} from your private library? This cannot be undone.",fileTooLarge:"This BibTeX file exceeds the {{size}} limit.",fileTooLargeHint:"The file is too large to parse in the browser. Save individual entries from a smaller file or split it first.",fileInvalid:"The current BibTeX file contains syntax errors.",fileInvalidHint:"Fix the current file before formatting it or importing another citation.",savedLabel:"Saved",import:"Import",importToFile:"Import into the current BibTeX file",importRequiresWrite:"Import requires write permission for this project.",imported:"Imported {{key}} into the current file.",untitled:"Untitled citation",authorUnknown:"Author not specified",allTags:"All tags",noTags:"No tags yet",noTagMatches:"No citations match this tag.",newTagPlaceholder:"New tag name",tagColor:"Tag color",createTag:"Create tag",tagCreated:"Tag created.",tags:"Tags",tagsTitle:"Tags for {{key}}",noTagsToAssign:"Create a tag first.",saveTags:"Save tags",tagsUpdated:"Tags updated.",editTitle:"Edit {{key}}"},gm={invalid:"Enter one valid BibTeX entry.",tooLarge:"This BibTeX entry is too large.",notFound:"The citation does not exist.",keyExists:"That citation key already exists. Review the existing entry before replacing it.",tagNotFound:"The citation tag does not exist.",conflict:"This citation changed elsewhere. Refresh the library and try again.",alreadyInFile:"{{key}} is already present in this BibTeX file."},Fm="Manage your private BibTeX references and tags from the homepage. Open a .bib file to save or import entries.",bm={addEntry:"Add entry",addEntryTitle:"Add a BibTeX entry",addEntryDescription:"Paste one complete BibTeX entry. It will be validated before it is saved.",addEntryPlaceholder:`@article{key,
|
|
3
|
-
author = {Author},
|
|
4
|
-
title = {Title},
|
|
5
|
-
year = {2026}
|
|
6
|
-
}`,added:"Citation added to your library."},ym={pageOf:"Page {{page}} of {{totalPages}} · {{count}} entries",previous:"Previous",next:"Next"},Cm={quickOpen:"Quick open",quickOpenDescription:"Open a project file by name (Ctrl/Cmd+P).",filePlaceholder:"Type a file name…",noFiles:"No matching files.",projectSearch:"Project search",projectSearchDescription:"Search and replace across project source files (Ctrl/Cmd+Shift+F).",searchPlaceholder:"Search all source files…",replacePlaceholder:"Replace with…",matchSummary:"{{count}} matches",truncated:"Showing the first {{count}} matches.",replaceAll:"Replace all {{count}}",replaceConfirmTitle:"Replace across the project",replaceConfirmDescription:"Replace all {{count}} matches? Automatic history records every changed file first.",replaced:"Replaced {{count}} matches in {{files}} files."},Em={title:"History",description:"Browse automatic project versions, compare files and safely restore earlier work.",empty:"No history versions yet.",changedCount:"{{count}} changed files",fileCount:"{{count}} files",changed:"changed",labelPlaceholder:"Name this version",saveLabel:"Save label",compareCurrent:"Compare with current",comparingCurrent:"Earlier version compared with the current file",chooseFile:"Choose a file, then compare it with the current source.",restore:"Restore",restoreFile:"Restore file",restoreProject:"Restore project",restoreFileTitle:"Restore this file",restoreProjectTitle:"Restore this project version",restoreFileDescription:"Restore {{path}} from this version? The current project is checkpointed first.",restoreProjectDescription:"Restore all source files and compiler settings from this version? The current project is checkpointed first.",storage:"History storage",storageUsage:"{{used}} of {{limit}}",versionUsage:"{{count}} of {{limit}} ordinary versions",protectedVersions:"{{count}} labeled",storageExceeded:"Protected or current data exceeds the soft storage limit.",deleteVersion:"Delete version",deleteVersionTitle:"Delete this history version",deleteVersionDescription:"Permanently delete {{name}}? Current project files are not changed.",clearAll:"Clear history",clearAllTitle:"Clear all project history",clearAllDescription:"Permanently delete every history version and its unreferenced stored data? Current project files are not changed.",reasons:{initial:"Project created",autosave:"Automatic save",file:"File operation",settings:"Compiler settings",git:"Git operation",restore:"Restored version",checkpoint:"Safety checkpoint"}},wm={mainFile:"Main document",invalidMainFileOption:"{{path}} (not a root document)",engine:"Compiler",latexmkrc:"Project latexmkrc",save:"Save project settings",members:"Shared members",recentLog:"Latest compile log",share:"Share",shareDescription:"Projects can only be shared with users created by an administrator.",chooseUser:"Choose a user",latexmkrcPlaceholder:`# Empty disables the project rc file
|
|
7
|
-
$pdf_mode = 1;`,addMember:"Add member",noMembers:"This project has not been shared with anyone.",removeTitle:"Remove shared member",removeDescription:"Remove {{username}}? Their account and other projects are unaffected.",editorTab:"Editor appearance",compilerTab:"LaTeX compiler",compilerDescription:"Choose the main document and compiler options shared by everyone in this project.",editorAppearance:"Editor appearance",editorAppearanceDescription:"These preferences are private to this user and project on this browser. The project dictionary is shared.",browserTools:"Formatting tools",toolStatus:{loading:"Loading",working:"Working",error:"Error"},reloadTool:"Reload",saveAppearance:"Save appearance",saveCompiler:"Save compiler settings",writingCheckDescription:"TexLite uses the optional host-installed Harper CLI. If it is unavailable, the browser spellchecker takes over. Spelling issues use a red wavy underline; grammar issues use yellow. Right-click an issue for suggestions.",projectConfiguration:"Project configuration",fontFamily:"English font",fontSize:"Font size",lineHeight:"Line spacing",dictionary:"Project dictionary",dictionaryDescription:"Words added here are ignored after Harper returns this project's spelling diagnostics. Editors can maintain this list.",dictionaryPlaceholder:"Add a custom word",addWord:"Add word",dictionaryEmpty:"No custom words yet.",lineWrapping:"Wrap long lines",spellCheck:"Spelling and grammar checking",vimMode:"Vim keybindings",vimModeDescription:"Use Vim normal/insert/visual modes in this editor.",vimHelp:"View help",formatOnCompile:"Format LaTeX before compiling",formatOnCompileDescription:"Off by default. Formatting runs before compilation.",formatRequiresWrite:"Formatting requires permission to edit this project.",formatterDescription:"Tex, cls, and sty files use the bundled browser-side tex-fmt WASM formatter; BibTeX files use browser-side bibtex-tidy.",formatterInstall:"View tex-fmt",bibtexTidyInstall:"View bibtex-tidy",texFmtOptions:"tex-fmt options (TOML)",texFmtOptionsPlaceholder:`wrap = true
|
|
8
|
-
wraplen = 80`,texFmtOptionsDescription:"These options are stored only in this browser and isolated by the current user and project. They are passed directly to tex-fmt.",openFilesInTabs:"Open LaTeX files in editor tabs",openFilesInTabsDescription:"Open .tex, .bib, .sty and other source files in tabs at the top of the editor.",writingIssues:"{{count}} writing issues ({{uniqueCount}} unique)",noWritingIssues:"No spelling or grammar issues found.",spellCheckFirst:"First writing issue",spellCheckPrevious:"Previous writing issue",spellCheckNext:"Next writing issue",spellCheckLast:"Last writing issue",spellCheckPosition:"{{current}}/{{total}}",fontJetBrains:"JetBrains Mono",fontSourceCode:"Source Code Pro",fontIbmPlex:"IBM Plex Mono",fontFiraCode:"Fira Code",fontIosevka:"Iosevka",lineHeightCompact:"Compact",lineHeightNormal:"Normal",lineHeightRelaxed:"Relaxed"},xm={title:"Git backup",description:"Manage the local Git history and its GitHub backup. Only the project owner can use these actions.",ownerOnly:"Only the project owner can use Git backup.",authentication:"GitHub authentication",authenticationHint:"Use a token with repository Administration and Contents write access. It is encrypted at rest and never written to the repository or remote URL.",recommendedAccessTitle:"Recommended repository access: All repositories",recommendedAccess:"texLite is intended for trusted users. Select All repositories so this token can create a repository and access repositories created later. Grant Administration and Contents read and write permissions.",token:"Personal access token",tokenPlaceholder:"Paste your GitHub token",replaceToken:"Replace personal access token",saveToken:"Save and verify token",createToken:"Create a fine-grained token",connectedAs:"Connected as @{{login}}",removeToken:"Remove token",tokenSaved:"GitHub token saved; the local repository is ready.",tokenRemoved:"GitHub token removed.",repository:"Repository",localReady:"The project source is managed by a local Git repository.",localPending:"Saving a valid token initializes the local Git repository.",repositoryName:"GitHub repository name",privateRepository:"Create as a private repository",createRepository:"Create GitHub repository",repositoryCreated:"GitHub repository created.",origin:"origin",openGitHub:"Open GitHub",clean:"Working tree clean",changedFiles:"{{count}} changed files",commitAndPush:"Commit and push",identity:"Commits use {{username}} <{{username}}@texlite.com> for this command only.",detachedHead:"Detached HEAD: return to the default branch before committing or pushing.",detachedAt:"detached at {{revision}}",commitMessage:"Commit message",commitPlaceholder:"Describe this backup…",commit:"Commit",committed:"Changes committed.",noChangesToCommit:"There are no new changes to commit.",push:"Push",pushed:"Push succeeded. The backup is up to date on GitHub.",pushFailed:"Push failed",workingDiff:"Working diff",refresh:"Refresh",diffTitle:"Diff",diffTruncated:"output truncated",diffFontSize:"Diff font size",diffFontDecrease:"Decrease diff font size",diffFontIncrease:"Increase diff font size",fullscreenDiff:"View diff full screen",exitFullscreenDiff:"Exit full screen",noChanges:"No differences to display.",history:"History",historyHint:"Up to 100 recent commits",noCommits:"No commits yet.",viewCommitDiff:"View this commit's diff",checkoutVersion:"Checkout this version",checkoutTitle:"Checkout version",checkout:"Checkout",checkoutDescription:"Checkout {{revision}} — {{message}}. By default Git preserves compatible uncommitted changes and refuses conflicts.",forceCheckout:"Force overwrite",forceCheckoutDescription:"Explicitly discard tracked and untracked working changes before checkout. This cannot be undone.",returnToBranch:"Return to {{branch}}",returnTitle:"Return to default branch",returnDescription:"Checkout {{branch}}. By default Git preserves compatible uncommitted changes and refuses conflicts.",discardChanges:"Discard changes",noChangesToDiscard:"There are no changes to discard.",discardTitle:"Discard uncommitted changes",discardDescription:"Restore all tracked files to the current HEAD commit. Untracked files are unaffected.",discardConfirm:"Discard changes"},vm={title:"System status",description:"Live server health and recent operation latency. Values refresh every five seconds.",refresh:"Refresh",uptime:"Uptime",memory:"Memory",heap:"heap",compileQueue:"Compile jobs",pending:"{{count}} pending",collaboration:"Collaboration",sessions:"{{count}} sessions",roomsAndDirty:"{{rooms}} rooms · {{dirty}} dirty files",eventLoop:"Event-loop latency",latencySummary:"P50 {{p50Ms}} ms · P95 {{p95Ms}} ms · max {{maxMs}} ms",operationDurations:"Recent operation durations",noSamples:"No operation samples have been collected yet.",operation:"Operation",samples:"Samples",last:"Last",max:"Max",operations:{collaboration:{connect:"Open collaboration room",persist:"Save collaboration changes"},workspace:{project:"Load project metadata",files:"Load project files",compileState:"Load retained PDF state"},compile:{snapshot:"Prepare compile snapshot",request:"Compile request total",cacheSync:"Update compiler cache",latexmk:"Run latexmk",artifactCopy:"Publish compile artifacts"},outline:{build:"Build project outline"},search:{project:"Search project"},completions:{build:"Build completion index"}}},Am={title:"Tags",add:"Add tag",create:"Create tag",createDescription:"Create a private reusable colored tag for organizing your projects.",assign:"Tags",assignTitle:"Tags for {{project}}",assignDescription:"Select your private tags for this project. Other users have their own tags.",empty:"Create a tag first.",allAssigned:"All available tags are already assigned.",name:"Tag name",color:"Color",filter:"Filter",red:"Red",orange:"Orange",yellow:"Yellow",green:"Green",blue:"Blue",purple:"Purple",gray:"Gray"},km={generic:"Operation failed",request:"Request failed ({{status}})",upload:"Upload failed",boundaryTitle:"Something went wrong",boundaryDescription:"An unexpected error occurred while rendering the page. You can try recovering, or reload the page.",boundaryRetry:"Retry",boundaryReload:"Reload page",fileExists:"A file or folder with this name already exists.",pathConflict:"The destination path is already used by a folder or file.",duplicateUploadNames:"The selected files contain duplicate names: {{files}}.",fileTooLarge:"The file exceeds the {{size}} MB limit.",zipOnly:"Please choose a ZIP archive.",collaborationUnavailable:"Live collaboration is not connected. Reconnect before saving or compiling.",codes:{AUTH_INVALID:"The username or password is incorrect.",CURRENT_PASSWORD_INVALID:"The current password is incorrect.",USER_NOT_FOUND:"The user no longer exists.",LAST_ADMIN:"At least one administrator must remain active.",SELF_DELETE_FORBIDDEN:"You cannot delete the currently signed-in administrator.",PROJECT_CREATE_FORBIDDEN:"You do not have permission to create projects.",PROJECT_NOT_FOUND:"The project does not exist or is no longer accessible.",PROJECT_OWNER_ONLY:"Only the project owner can change this setting.",PROJECT_EDIT_FORBIDDEN:"You do not have edit permission for this project.",DICTIONARY_EDIT_FORBIDDEN:"You do not have permission to maintain this project's dictionary.",TAG_NOT_FOUND:"The selected tag does not exist.",GIT_TOKEN_INVALID:"Enter a GitHub token.",GIT_REPOSITORY_NAME_INVALID:"Enter a GitHub repository name.",GIT_REVISION_INVALID:"Choose a Git revision to check out.",PROJECT_DELETE_FORBIDDEN:"Only the project owner can delete this project.",MEMBERS_MANAGE_FORBIDDEN:"Only the project owner can manage project members.",OWNER_MEMBER_FORBIDDEN:"The project owner cannot be added as a member.",INVALID_PATH:"The file path is invalid.",RESERVED_PATH:"This path is reserved by TexLite.",PATH_EXISTS:"The destination path is already used by a file or folder.",FILE_EXISTS:"A file with this name already exists.",PATH_NOT_FOUND:"The file or folder does not exist.",FILE_NOT_FOUND:"The file does not exist.",DIRECTORY_NOT_FOUND:"The destination folder does not exist.",MOVE_INTO_SELF:"A folder cannot be moved into itself.",MAIN_FILE_DELETE_FORBIDDEN:"The main document cannot be deleted.",FILE_TOO_LARGE:"This file is too large to open or upload.",UPLOAD_EMPTY:"No file was selected for upload.",COMMENT_FILE_NOT_FOUND:"The file for this comment does not exist.",COMMENT_RANGE_INVALID:"The comment source range is invalid.",COMMENT_NOT_FOUND:"The comment does not exist.",COMMENT_EDIT_FORBIDDEN:"You can only edit your own comments.",COMMENT_DELETE_FORBIDDEN:"You can only delete your own comments.",REPLY_NOT_FOUND:"The reply does not exist.",REPLY_EDIT_FORBIDDEN:"You can only edit your own replies.",REPLY_DELETE_FORBIDDEN:"You can only delete your own replies.",COMMENT_UPDATE_EMPTY:"There is no comment content to update.",MAIN_FILE_NOT_FOUND:"The selected main document does not exist.",LATEXMKRC_DISABLED:"Project latexmkrc files are disabled by the administrator.",LATEXMKRC_NOT_FOUND:"The selected latexmkrc file does not exist.",COMPILE_ARTIFACTS_NOT_FOUND:"No compiled artifacts are available yet.",COMPILE_ARTIFACT_NOT_FOUND:"The compiled artifact does not exist.",ARTIFACT_PREVIEW_UNSUPPORTED:"This artifact cannot be previewed as text; download it instead.",SYNC_SOURCE_INVALID:"The source location is invalid.",SOURCE_FILE_NOT_FOUND:"The source file does not exist.",SYNCTEX_NOT_AVAILABLE:"No SyncTeX data is available. Compile the project again.",SYNC_PDF_INVALID:"The PDF location is invalid.",SYNCTEX_EXTERNAL_PATH:"SyncTeX returned a source path outside the project.",COMPILE_FORBIDDEN:"You do not have permission to compile this project.",PDF_NOT_FOUND:"No PDF has been generated yet.",API_NOT_FOUND:"The API endpoint does not exist.",SERVER_ERROR:"The server could not complete the request.",REQUEST_INVALID:"The request is invalid."}},Sm={historyVersionNotFound:"The selected history version no longer exists.",historyFileNotFound:"This file does not exist in the selected history version.",historyTargetConflict:"The current restore target is a directory or another non-file path.",historyPreviewUnsupported:"This historical file cannot be compared as text.",searchInvalid:"Enter valid text to search for.",gitUnavailable:"Git integration is unavailable. Install Git on the host or correct git.binary in the configuration, then try again.",formatFailed:"tex-fmt could not format this source.",mainDocumentInvalid:"The selected file is not a valid LaTeX root document.",compileSnapshotBusy:"The source has not finished saving durably. Wait a moment and try compiling again."},jm={requestFailed:"Network request failed. Check your connection and retry.",invalidResponse:"The server returned an invalid response. Please retry."},Bm={protocolUpgrade:"This workspace needs an update. Your local draft is retained; refresh when you are ready to reconnect."},Tm={disableTitle:"Disable user",disableDescription:"Disable @{{username}}? Their active sessions will end and they will no longer be able to sign in.",disableConfirm:"Disable user",demoteTitle:"Remove administrator access",demoteDescription:"Make @{{username}} a regular user? They will no longer be able to manage users.",demoteConfirm:"Make user",denyProjectCreationTitle:"Remove project creation",denyProjectCreationDescription:"Remove @{{username}}’s permission to create new projects? Their existing project access is unchanged.",denyProjectCreationConfirm:"Remove permission"},Lm={cancel:"Cancel compile",cancelling:"Cancelling…",cancelled:"Compilation cancelled."},Nm={copyright:"© {{year}}",credit:"Designed and developed by CHEN Zhongpu"},Rm={section:"Section",subsection:"Subsection",bold:"Bold",emphasis:"Emphasis",citation:"Citation",reference:"Cross-reference",label:"Label",image:"Image",unordered:"Unordered list",ordered:"Ordered list",equation:"Equation",figure:"Figure",projectCommand:"Project command",projectCommandArgs:"Project command ({{count}} arguments)",projectMacro:"Project macro",expl3Command:"Expl3 project command",mathOperator:"Project math operator",mathDelimiter:"Project math delimiter",projectEnvironment:"Project environment",projectFile:"Project file",package:"Package",documentClass:"Document class",currentFile:"Current file",project:"Project",latex:"LaTeX",standard:"LaTeX command"},Om={common:dm,auth:hm,projects:fm,users:pm,editor:mm,citationLibrary:Dm,citationErrors:gm,citationLibraryHomeDescription:Fm,citationLibraryActions:bm,citationLibraryPagination:ym,navigation:Cm,history:Em,projectSettings:wm,git:xm,metrics:vm,tags:Am,errors:km,apiErrors:Sm,network:jm,workspaceUpdates:Bm,userConfirmations:Tm,compileControls:Lm,footer:Nm,completions:Rm},Pm={cancel:"取消",create:"创建",add:"添加",remove:"移除",delete:"删除",close:"关闭",user:"用户",permission:"权限",readOnly:"只读",readWrite:"读写",settings:"设置",comments:"批注",files:"文件",outline:"大纲",version:"版本",loading:"正在载入…",enabled:"允许",disabled:"禁止",normal:"正常",admin:"管理员",language:"语言",save:"保存",edit:"编辑",retry:"重试",reload:"刷新页面",languageEnglish:"English",languageChinese:"中文"},_m={tagline:"轻量 LaTeX 写作环境",username:"用户名",password:"密码",login:"登录",contact:"需要账号?请联系 {{email}}",firstLogin:"首次登录,请修改初始密码",currentPassword:"当前密码",newPassword:"新密码",confirmPassword:"确认新密码",updatePassword:"更新密码",mismatch:"两次输入的新密码不一致",passwordMinimum:"至少 {{count}} 位",sessionExpired:"登录状态已过期,请重新登录。",logout:"退出"},Im={title:"项目",subtitle:"创建、编辑和分享 LaTeX 文档",restricted:"你可以访问别人共享给你的项目;创建权限由管理员授予",new:"新建项目",newDescription:"项目会使用配置文件中的默认 LaTeX 引擎。",name:"项目名称",emptyTitle:"一起创造出色的作品",emptyDescription:"创建新项目,或上传已有的 LaTeX 压缩包开始写作。",emptyRestricted:"共享给你的项目会显示在这里。",noMatches:"没有符合当前搜索或标签筛选条件的项目。",upload:"上传项目",uploadDescription:"上传 ZIP 压缩包;若只有一个顶层目录会自动去除。单文件最大 {{size}} MB。",zipFile:"ZIP 压缩包",import:"导入项目",importing:"正在导入…",search:"搜索项目…",grid:"网格",list:"列表",allTags:"全部标签",sortBy:"排序",sortModified:"最后修改时间",sortCreated:"创建时间",scope:"项目状态",active:"活跃项目",archived:"已归档",archive:"归档",unarchive:"取消归档",noArchived:"还没有归档项目。",pagination:"项目分页",pageOf:"第 {{page}} / {{totalPages}} 页 · 共 {{count}} 个项目",previousPage:"上一页",nextPage:"下一页",owner:"所有者",created:"创建时间",modified:"最后修改",relativeHoursPast:"{{hours}}小时前",relativeHoursMinutesPast:"{{hours}}小时{{minutes}}分钟前",relativeHoursFuture:"{{hours}}小时后",relativeHoursMinutesFuture:"{{hours}}小时{{minutes}}分钟后",relativeDaysPast:"{{days}}天前",relativeDaysHoursPast:"{{days}}天{{hours}}小时前",relativeDaysFuture:"{{days}}天后",relativeDaysHoursFuture:"{{days}}天{{hours}}小时后",modifiedBy:"最后修改人",byUser:"由 {{user}} 修改",modifiedByUser:"{{time}} · 由 {{user}} 修改",deletedUser:"已删除用户",comments:"批注",unresolvedComments:"{{count}} 条未解决批注",unresolvedCommentsTooltip:"{{unresolved}} 条未解决批注 / 共 {{total}} 条",allResolved:"全部已解决 ({{count}})",allCommentsResolvedTooltip:"全部 {{count}} 条批注已解决",noComments:"暂无批注",unresolvedCount:"{{count}} 条待解决",filterTags:"按标签过滤",rename:"重命名",renameTitle:"重命名项目",duplicate:"复制项目",duplicating:"正在复制…",duplicateTitle:"复制项目",duplicateDescription:"创建“{{project}}”的独立副本。会复制文件和项目设置,但不会复制成员、批注、Git 历史和编译产物。",download:"下载",transfer:"转让",transferOwnership:"转让项目",transferDescription:"为“{{project}}”选择新的所有者。",newOwner:"新所有者",chooseNewOwner:"请选择用户",noTransferUsers:"没有其他可用用户",transferWarning:"转让后你仍保留读写权限。源码、历史、批注和成员不会改变;已保存的 GitHub token 会被移除,由新所有者配置自己的凭据。",transferForbidden:"只有当前项目所有者可以转让项目。",transferTargetInvalid:"请选择新的项目所有者。",transferSelf:"你已经是该项目的所有者。",deleteTitle:"删除项目",deleteDescription:"确定永久删除“{{project}}”及其全部文件吗?此操作不可撤销。",chooseZip:"选择 ZIP 项目",dropZip:"将 ZIP 压缩包拖放到这里",browse:"浏览文件",selectedFileSize:"已选择 · {{size}}",clearFile:"清除已选文件"},Mm={manage:"用户管理",back:"返回项目",onlyAdmin:"仅管理员可以创建用户",add:"添加用户",role:"角色",createProjects:"创建项目",ownedProjects:"拥有项目",status:"状态",actions:"操作",adminRequired:"需要管理员权限。",allow:"允许",deny:"禁止",enable:"启用",disable:"禁用",promote:"设为管理员",demote:"降为用户",allowCreate:"允许创建",denyCreate:"禁止创建",resetPassword:"重置密码",initialPassword:"登录密码",displayName:"显示名称",addDescription:"设置登录密码,或生成一个安全的随机密码。",createUser:"创建用户",randomPassword:"随机密码",generatePassword:"生成随机密码",resetDescription:"为 {{username}} 设置初始密码;其现有会话会被注销。",reset:"重置",deleteTitle:"删除用户",deleteDescription:"确认删除 {{username}}?此操作不可撤销。",ownedChoice:"其拥有的 {{count}} 个项目",transferProjects:"转移给当前管理员",deleteProjects:"永久删除项目及全部文件"},$m={saved:"已保存",savedAt:"已于 {{time}} 保存到服务器",loading:"载入中",pending:"等待保存",saving:"正在保存到服务器",saveFailed:"保存失败",offlineDraft:"离线 · 本地草稿已保留",harperRecoveryTitle:"Harper 暂不可用。",harperFallbackHint:" 已自动改用浏览器内置拼写检查。",texFmtRecoveryTitle:"tex-fmt 无法加载。",texFmtOptionsRecoveryTitle:"tex-fmt 无法处理当前源码或参数。",texFmtRuntimeRecoveryTitle:"tex-fmt 返回了异常结果。",clientToolRecoveryHint:" 可立即重试;如果页面在系统更新前已经打开,请刷新页面加载最新资源。",resetFormatterOptions:"清空参数并重试",texFmtDiagnosticsTitle:"tex-fmt 生成了诊断信息。",texFmtDiagnosticsHint:" 格式化内容已应用,请查看下方详情。",viewFormatterDiagnostics:"查看诊断",dismissFormatterDiagnostics:"关闭格式化诊断",formattingBy:"{{name}} 正在格式化此文件,请稍候…",compile:"编译 · {{engine}}",compiling:"编译中…",compileQueued:"编译已排队…",compileFailedRetained:"编译失败,当前显示上一次成功生成的 PDF({{time}})。",compileFailedNoPdf:"编译失败,且没有可用的成功 PDF。",upToDate:"文件已是最新,无需重新编译。",compileSnapshotStale:"PDF 基于较早的一致快照编译,未包含之后的源码修改。",addComment:"添加批注",sourceComments:"源码批注",projectSettings:"项目设置",uploadAttachment:"上传附件",newFile:"新建文本文件",binary:"二进制附件已保存,但不能在文本编辑器中打开。",noOutline:"当前文件没有章节",preview:"PDF 预览",previewHint:"点击“编译”生成文档",loadingPdf:"正在加载 PDF…",pdfCompiledAt:"成功编译于 {{time}}",pdfCompiledAtFor:"{{file}} 成功编译于 {{time}}",currentMainDocument:"当前作为主文档编译:{{path}}",mainDocumentCandidate:"LaTeX 主文档候选:{{path}}",currentMainShort:"主文档",deletedUser:"已删除用户",orphaned:"锚点已丢失",line:"第 {{line}} 行",reopen:"重新打开",resolve:"标记为已解决",noComments:"当前文件没有批注",newFileDescription:"可以包含目录,例如 chapters/introduction.tex。",filePath:"文件路径",commentDescription:"已选择 {{count}} 个字符",pointComment:"未选择文本,将在当前光标位置添加批注。",commentContent:"批注内容",backToProjects:"返回项目列表",outputTabs:"编译输出",log:"日志",warnings:"警告",errors:"错误",artifacts:"产物",clean:"故障恢复",noLog:"编译后将在此显示日志。",noWarnings:"最近一次编译没有警告。",noErrors:"最近一次编译没有错误。",projectRoot:"项目根目录",uploadTo:"上传到 {{folder}}",dropFiles:"拖放文件以上传",newFolder:"新建文件夹",folderName:"文件夹名称",folderDestination:"文件夹将创建在 {{folder}} 中。",uploadOverwriteTitle:"文件已存在",uploadOverwriteDescription:"以下文件已经存在:{{files}}。要覆盖它们吗?",uploadOverwrite:"覆盖文件",noArtifacts:"编译后将在此显示输出产物。",selectArtifact:"选择一个文本产物进行预览。",viewArtifact:"查看产物",downloadArtifact:"下载产物",downloadToView:"该产物需要下载后查看",cleanTitle:"编译故障恢复",cleanDescription:"这里只提供高级故障恢复操作:仅在编译卡住、历史错误状态残留或生成产物异常时使用。不会修改源码、项目设置、批注、历史或 Git 数据。",cleanCache:"强制完整重编译",cleanCacheDescription:"仅在编译失败或 latexmk 缓存状态异常时使用。删除增量缓存,但保留当前成功的 PDF。",cleanArtifacts:"删除生成输出",cleanArtifactsDescription:"仅在生成产物状态异常时使用。删除该主文档的 PDF、SyncTeX、日志和中间文件。",cleanCacheConfirmTitle:"强制完整重编译?",cleanCacheConfirmDescription:"此故障恢复操作会删除 latexmk 增量缓存。当前 PDF 会保留,下一次编译将从干净缓存开始。",cleanArtifactsConfirmTitle:"删除生成输出?",cleanArtifactsConfirmDescription:"此故障恢复操作会删除当前 PDF 以及该主文档的全部生成文件,但不会影响源码。",cleanConfirm:"执行恢复",cleanCacheComplete:"故障恢复缓存已清理,下一次编译将完整执行。",cleanArtifactsComplete:"编译生成输出已删除。",cleanBusy:"当前主文档正在编译,请完成后再执行故障恢复。",collapseFiles:"折叠文件面板",showFileSizes:"显示文件大小",hideFileSizes:"隐藏文件大小",move:"移动",moveTitle:"移动或重命名 {{name}}",moveDescription:"选择目标文件夹和名称;源码、批注和项目路径会保持关联。",pathName:"名称",moveApply:"移动/重命名",destinationFolder:"目标文件夹",deletePath:"删除文件或文件夹",deletePathTitle:"删除 {{name}}",deletePathDescription:"确定删除 {{path}}?此操作不可撤销。",deletePathActiveDescription:"确定删除 {{path}}?{{users}} 当前正在打开它,删除后这些会话将关闭该文件。",deletePathWillClose:"系统会拒绝该路径上迟到的修改,避免内容被静默丢失。",fileDeletedByCollaborator:"{{path}} 已在其他会话中删除,现已打开安全的备用文件。",compileShortcut:"保存并编译(Ctrl+S / Cmd+S)",compilingBy:"{{name}} 正在编译",format:"格式化",formatFile:"文件",formatFileHint:"格式化当前文件",formatFileComplete:"当前文件已格式化。",formatFileFailed:"无法格式化当前文件:{{message}}",formatSelected:"选区",commentsAdd:"添加",commentsAll:"查看",formatSelection:"格式化选区",formatting:"正在格式化…",formatSelectionHint:"选择一段 LaTeX 源码后格式化",formatSelectionRequired:"请先选择 LaTeX 源码,再进行格式化。",formatSelectionComplete:"所选 LaTeX 源码已格式化。",formatFailedContinue:"格式化失败,仍将继续编译:{{message}}",formatFailed:"无法格式化选区:{{message}}",formatSourceChanged:"格式化期间源码已发生变化,已跳过本次格式化。",formatSelectionChanged:"格式化期间所选源码已发生变化,请重新选择后再试。",writingSuggestions:"写作建议",noWritingSuggestions:"没有可用的修改建议",removeText:"删除文本",replaceWith:"替换为 {{word}}",spellCheckReadOnly:"当前为只读,需要编辑权限才能替换。",spellCheckSourceChanged:"源码在应用写作修正前发生了变化。",vimOn:"Vim 已开启",vimOnHint:"当前编辑器已启用 Vim 键位。",reply:"回复",replyPlaceholder:"输入回复内容…",sendReply:"发送回复",editComment:"编辑批注",deleteComment:"删除批注",saveChanges:"保存修改",deleteCommentTitle:"删除批注",deleteCommentDescription:"确定删除这条批注及其 {{count}} 条回复吗?此操作不可撤销。",editReply:"编辑回复",deleteReply:"删除回复",deleteReplyTitle:"删除回复",deleteReplyDescription:"确定删除这条回复吗?此操作不可撤销。",editedAt:"编辑于 {{time}}",outlineJump:"跳转到源码第 {{line}} 行并定位 PDF",lineNumber:"第 {{line}} 行",showInSource:"在源码中显示当前 PDF 位置",showInPdf:"在 PDF 中显示当前源码光标位置",syncTexOnlyForTex:"PDF 跳转仅支持 TeX 源文件(.tex)",syncTexOnlyForMain:"PDF 跳转仅支持当前主 TeX 文档",openFiles:"打开的文件",pdfLoadFailed:"无法载入 PDF 预览",pdfZoomControls:"PDF 缩放控件",downloadPdf:"下载 PDF",downloadResource:"下载文件",resourceTooLarge:"该文件大小为 {{size}},超过 {{limit}} 的直接预览上限。",resourceTooLargeTitle:"文件过大,无法直接预览",resourceTooLargeDescription:"请下载文件后在本地打开。",resourceUnsupportedTitle:"无法预览",resourceUnsupportedDescription:"浏览器不能直接渲染此文件类型,请下载后在本地打开。",resourcePreview:{image:"图片预览",pdf:"PDF 预览",text:"文本预览",unsupported:"文件预览"},pdfZoomOut:"缩小",pdfZoomIn:"放大",pdfFitWidth:"适合宽度",pdfLink:"PDF 链接",pdfLinks:"PDF 链接",layout:{label:"布局",choose:"选择布局",current:"当前布局:{{layout}}","editor-pdf":{name:"编辑器与 PDF",description:"并排显示源码编辑器和 PDF 预览"},"editor-only":{name:"仅编辑器",description:"将工作区用于源码编辑"},"pdf-only":{name:"仅 PDF",description:"将工作区用于 PDF 和编译输出"}},collaboration:{connecting:"正在连接协作服务…",connected:"实时协作已连接",disconnected:"实时协作连接已断开",editing:"正在编辑",viewing:"正在查看",joining:"正在进入项目",reconnect:"重新连接",permissionDowngradeTitle:"编辑权限已变更",permissionDowngradeDescription:"您的权限已从{{previous}}变为只读。任何尚未保存的本地草稿仍保留在当前标签页中,但无法保存。您可以继续查看草稿,或放弃草稿并重新加载服务器上的最新版本。",permissionDowngradeKeep:"保留本地草稿",permissionDowngradeDiscard:"放弃草稿并重新加载",permissionDowngradeReload:"重新加载服务器版本",permissionDowngradeNoDraft:"您的权限已变为只读。您可以继续查看当前标签页,或重新加载服务器上的最新版本。",permissionDowngradeOtherTab:"您的权限已变为只读。另一个浏览器标签页中仍有尚未保存的草稿,请返回该标签页处理。为避免误删,该页面不能清理共享的本地草稿。",permissionDowngradeMultipleDrafts:"您的权限已变为只读。当前标签页和其他浏览器标签页都存在尚未保存的草稿。请先在其他标签页中处理草稿;当前页面不会清理共享数据。",permissionDowngradeOtherTabBlocked:"另一个浏览器标签页刚刚产生了尚未保存的草稿,已取消清理以保护该草稿。",activeSessions:"{{count}} 个活跃会话",showMoreSessions:"展开另外 {{count}} 个会话",showFewerSessions:"收起会话列表",sessionTooltip:"{{name}}(@{{username}})· {{file}} · {{activity}} · {{permission}}"},search:{button:"查找",title:"查找和替换(Ctrl+F / Cmd+F)",find:"查找",replace:"替换为",next:"下一个",previous:"上一个",all:"选择全部",matchCase:"区分大小写",regexp:"正则表达式",wholeWord:"全字匹配",replaceNext:"替换",replaceAll:"全部替换",currentMatch:"当前匹配",onLine:"位于行",replacedMatchOnLine:"已替换第 $ 行的匹配项",replacedMatches:"已替换 $ 个匹配项",goToLine:"跳转到行",go:"跳转",matchCount:"共 {{count}} 个匹配",noMatches:"没有匹配项",invalidQuery:"正则表达式无效"}},Um={title:"引用库",description:"从 {{file}} 保存文献,并将它们导入当前 BibTeX 文件。引用库及其标签仅属于你自己。",myLibrary:"我的引用库",currentFile:"当前文件",searchPlaceholder:"搜索引用…",searchHint:"可搜索 key、标题、作者或年份",emptyTitle:"引用库还是空的",emptyDescription:"打开“当前文件”标签页,保存一个 BibTeX 文献条目。",noEntries:"没有找到 BibTeX 条目",noEntriesDescription:"请在当前文件中添加有效的 @article、@inproceedings 或其他文献条目。",currentFileTitle:"当前文件中的条目",currentFileDescription:"选择一个条目保存到你的引用库。",backToLibrary:"返回引用库",save:"保存",update:"更新",saving:"正在保存…",saved:"引用已保存到你的引用库。",updated:"引用已更新。",deleted:"引用已删除。",deleteTitle:"删除引用",deleteDescription:"确定从你的私有引用库中删除引用 {{key}}?此操作不可撤销。",fileTooLarge:"该 BibTeX 文件超过 {{size}} 限制。",fileTooLargeHint:"文件过大,浏览器不会解析其中的条目。请拆分文件后再保存单条引用。",fileInvalid:"当前 BibTeX 文件存在语法错误。",fileInvalidHint:"请先修复当前文件,再格式化或导入新的引用。",savedLabel:"已保存",import:"导入",importToFile:"导入到当前 BibTeX 文件",importRequiresWrite:"导入需要当前项目的写权限。",imported:"已将 {{key}} 导入当前文件。",untitled:"未命名引用",authorUnknown:"未填写作者",allTags:"全部标签",noTags:"还没有标签",noTagMatches:"没有匹配此标签的引用。",newTagPlaceholder:"新标签名称",tagColor:"标签颜色",createTag:"创建标签",tagCreated:"标签已创建。",tags:"标签",tagsTitle:"{{key}} 的标签",noTagsToAssign:"请先创建标签。",saveTags:"保存标签",tagsUpdated:"标签已更新。",editTitle:"编辑 {{key}}"},zm={invalid:"请输入一个有效的 BibTeX 条目。",tooLarge:"BibTeX 条目过大。",notFound:"引用条目不存在。",keyExists:"引用 key 已经存在,请检查现有条目后再决定是否替换。",tagNotFound:"引用标签不存在。",conflict:"该引用已在其他位置发生修改,请刷新引用库后重试。",alreadyInFile:"{{key}} 已经存在于当前 BibTeX 文件中。"},Hm="在首页管理属于你自己的 BibTeX 文献和标签。打开 .bib 文件后即可保存或导入条目。",Vm={addEntry:"添加条目",addEntryTitle:"添加 BibTeX 条目",addEntryDescription:"粘贴一个完整的 BibTeX 文献条目,保存前会进行校验。",addEntryPlaceholder:`@article{key,
|
|
9
|
-
author = {Author},
|
|
10
|
-
title = {Title},
|
|
11
|
-
year = {2026}
|
|
12
|
-
}`,added:"引用已添加到你的引用库。"},qm={pageOf:"第 {{page}} / {{totalPages}} 页 · {{count}} 条引用",previous:"上一页",next:"下一页"},Km={quickOpen:"快速打开",quickOpenDescription:"按名称打开项目文件(Ctrl/Cmd+P)。",filePlaceholder:"输入文件名…",noFiles:"没有匹配的文件。",projectSearch:"项目搜索",projectSearchDescription:"在项目源码文件中搜索和替换(Ctrl/Cmd+Shift+F)。",searchPlaceholder:"搜索全部源码文件…",replacePlaceholder:"替换为…",matchSummary:"共 {{count}} 个匹配",truncated:"仅显示前 {{count}} 个匹配。",replaceAll:"替换全部 {{count}} 项",replaceConfirmTitle:"在项目中批量替换",replaceConfirmDescription:"确定替换全部 {{count}} 个匹配?自动历史会记录所有修改文件。",replaced:"已在 {{files}} 个文件中替换 {{count}} 项。"},Wm={title:"历史",description:"浏览自动项目版本、比较文件,并安全恢复较早的工作。",empty:"尚无历史版本。",changedCount:"{{count}} 个文件有变化",fileCount:"{{count}} 个文件",changed:"有修改",labelPlaceholder:"为此版本命名",saveLabel:"保存标签",compareCurrent:"与当前版本比较",comparingCurrent:"历史版本与当前文件的比较",chooseFile:"选择文件后,可与当前源码进行比较。",restore:"恢复",restoreFile:"恢复文件",restoreProject:"恢复项目",restoreFileTitle:"恢复此文件",restoreProjectTitle:"恢复此项目版本",restoreFileDescription:"从此版本恢复 {{path}}?系统会先为当前项目创建安全检查点。",restoreProjectDescription:"恢复此版本的全部源码和编译器设置?系统会先为当前项目创建安全检查点。",storage:"历史存储",storageUsage:"已使用 {{used}},上限 {{limit}}",versionUsage:"普通版本 {{count}} / {{limit}}",protectedVersions:"{{count}} 个已标记版本",storageExceeded:"受保护版本或当前基线已超过存储软上限。",deleteVersion:"删除版本",deleteVersionTitle:"删除此历史版本",deleteVersionDescription:"永久删除“{{name}}”?当前项目文件不会改变。",clearAll:"清空历史",clearAllTitle:"清空全部项目历史",clearAllDescription:"永久删除全部历史版本及不再引用的存储数据?当前项目文件不会改变。",reasons:{initial:"项目创建",autosave:"自动保存",file:"文件操作",settings:"编译器设置",git:"Git 操作",restore:"恢复版本",checkpoint:"安全检查点"}},Gm={mainFile:"主文档",invalidMainFileOption:"{{path}}(不是主文档)",engine:"编译引擎",latexmkrc:"项目 latexmkrc",save:"保存项目设置",members:"共享成员",recentLog:"最近编译日志",share:"共享",shareDescription:"仅可共享给管理员已创建的用户。",chooseUser:"请选择用户",latexmkrcPlaceholder:`# 留空表示不使用项目 rc 文件
|
|
13
|
-
$pdf_mode = 1;`,addMember:"添加成员",noMembers:"该项目尚未分享给其他成员。",removeTitle:"移除共享成员",removeDescription:"确认移除 {{username}}?其账号和其他项目不会受到影响。",editorTab:"编辑器外观",compilerTab:"LaTeX 编译器",compilerDescription:"选择本项目所有成员共享的主文档和 LaTeX 编译选项。",editorAppearance:"编辑器外观",editorAppearanceDescription:"这些偏好仅作用于当前浏览器中的当前用户和项目;项目词典是共享的。",browserTools:"格式化工具",toolStatus:{loading:"加载中",working:"运行正常",error:"错误"},reloadTool:"重新加载",saveAppearance:"保存外观设置",saveCompiler:"保存编译器设置",writingCheckDescription:"TexLite 使用宿主机上可选的 Harper CLI。若其不可用,将自动改用浏览器内置拼写检查。拼写问题使用红色波浪线,语法问题使用黄色波浪线;右键问题可以查看修改建议。",projectConfiguration:"项目配置",fontFamily:"英文字体",fontSize:"字体大小",lineHeight:"行间距",dictionary:"项目词典",dictionaryDescription:"添加到这里的词会在 Harper 返回本项目诊断后被忽略;具有编辑权限的用户可以维护此列表。",dictionaryPlaceholder:"添加自定义词",addWord:"添加词",dictionaryEmpty:"暂未添加自定义词。",lineWrapping:"自动换行",spellCheck:"拼写和语法检查",vimMode:"Vim 键位",vimModeDescription:"在当前编辑器中使用 Vim 的普通、插入和可视模式。",vimHelp:"查看帮助",formatOnCompile:"编译前自动格式化 LaTeX",formatOnCompileDescription:"默认关闭;格式化会在编译前执行。",formatRequiresWrite:"需要项目编辑权限才能使用格式化。",formatterDescription:"tex、cls、sty 使用内置的浏览器 tex-fmt WASM 格式化器;BibTeX 使用浏览器中的 bibtex-tidy。",formatterInstall:"查看 tex-fmt",bibtexTidyInstall:"查看 bibtex-tidy",texFmtOptions:"tex-fmt 参数(TOML)",texFmtOptionsPlaceholder:`wrap = true
|
|
14
|
-
wraplen = 80`,texFmtOptionsDescription:"这些参数仅保存在当前浏览器中,并按当前用户和项目隔离;它们会直接传递给 tex-fmt。",openFilesInTabs:"使用新 Tab 打开 LaTeX 文件",openFilesInTabsDescription:"在编辑器顶部通过标签页管理打开的 .tex、.bib、.sty 等源码文件。",writingIssues:"发现 {{count}} 个写作问题(去重后 {{uniqueCount}} 个)",noWritingIssues:"未发现拼写或语法问题。",spellCheckFirst:"第一个写作问题",spellCheckPrevious:"上一个写作问题",spellCheckNext:"下一个写作问题",spellCheckLast:"最后一个写作问题",spellCheckPosition:"第 {{current}}/{{total}} 个",fontJetBrains:"JetBrains Mono",fontSourceCode:"Source Code Pro",fontIbmPlex:"IBM Plex Mono",fontFiraCode:"Fira Code",fontIosevka:"Iosevka",lineHeightCompact:"紧凑",lineHeightNormal:"标准",lineHeightRelaxed:"宽松"},Ym={title:"Git 备份",description:"管理本地 Git 历史及 GitHub 备份;只有项目创建者可以执行这些操作。",ownerOnly:"只有项目所有者可以使用 Git 备份。",authentication:"GitHub 身份验证",authenticationHint:"token 需要仓库 Administration 与 Contents 写权限;它会加密保存,不会写入项目仓库或远程地址。",recommendedAccessTitle:"建议的仓库访问范围:All repositories(所有仓库)",recommendedAccess:"texLite 面向相互信任的用户。请选择 All repositories,使该 token 能创建仓库,并访问之后新建的仓库;同时授予 Administration 和 Contents 的 Read and write 权限。",token:"个人访问 token",tokenPlaceholder:"在此粘贴 GitHub token",replaceToken:"替换个人访问 token",saveToken:"保存并验证 token",createToken:"创建细粒度 token",connectedAs:"已连接为 @{{login}}",removeToken:"移除 token",tokenSaved:"GitHub token 已保存,本地仓库已就绪。",tokenRemoved:"GitHub token 已移除。",repository:"仓库",localReady:"项目源码已由本地 Git 仓库管理。",localPending:"保存有效 token 后将自动初始化本地 Git 仓库。",repositoryName:"GitHub 仓库名称",privateRepository:"创建为私有仓库",createRepository:"创建 GitHub 仓库",repositoryCreated:"GitHub 仓库创建成功。",origin:"远程仓库",openGitHub:"打开 GitHub",clean:"工作区干净",changedFiles:"{{count}} 个文件有修改",commitAndPush:"提交与推送",identity:"本次提交临时使用 {{username}} <{{username}}@texlite.com>,不会写入 Git 配置。",detachedHead:"当前处于 detached HEAD;请先返回默认分支再提交或推送。",detachedAt:"detached 于 {{revision}}",commitMessage:"提交说明",commitPlaceholder:"说明本次备份的内容…",commit:"提交",committed:"修改已提交。",noChangesToCommit:"当前没有新的修改可以提交。",push:"推送",pushed:"推送成功,GitHub 备份已是最新。",pushFailed:"推送失败",workingDiff:"当前差异",refresh:"刷新",diffTitle:"差异",diffTruncated:"输出已截断",diffFontSize:"差异字体大小",diffFontDecrease:"减小差异字体",diffFontIncrease:"增大差异字体",fullscreenDiff:"全屏查看差异",exitFullscreenDiff:"退出全屏",noChanges:"没有可显示的差异。",history:"提交历史",historyHint:"最多显示最近 100 次提交",noCommits:"尚无提交。",viewCommitDiff:"查看该提交的差异",checkoutVersion:"checkout 到该版本",checkoutTitle:"Checkout 版本",checkout:"Checkout",checkoutDescription:"将 checkout 到 {{revision}} — {{message}}。默认由 Git 保留兼容的未提交修改,发生冲突时拒绝操作。",forceCheckout:"强制覆盖",forceCheckoutDescription:"明确丢弃所有已跟踪及未跟踪的工作区修改后再 checkout;此操作不可撤销。",returnToBranch:"返回 {{branch}}",returnTitle:"返回默认分支",returnDescription:"将 checkout 到 {{branch}}。默认由 Git 保留兼容的未提交修改,发生冲突时拒绝操作。",discardChanges:"撤销修改",noChangesToDiscard:"当前没有可以撤销的修改。",discardTitle:"撤销未提交修改",discardDescription:"把所有已跟踪文件恢复到当前 HEAD(上次 commit)。未跟踪文件不受影响。",discardConfirm:"确认撤销"},Xm={title:"系统状态",description:"服务器实时健康状态和近期操作耗时,每五秒自动刷新。",refresh:"刷新",uptime:"运行时间",memory:"内存",heap:"堆内存",compileQueue:"编译任务",pending:"{{count}} 个等待中",collaboration:"协作",sessions:"{{count}} 个会话",roomsAndDirty:"{{rooms}} 个房间 · {{dirty}} 个待保存文件",eventLoop:"事件循环延迟",latencySummary:"P50 {{p50Ms}} ms · P95 {{p95Ms}} ms · 最大 {{maxMs}} ms",operationDurations:"近期操作耗时",noSamples:"尚未采集到操作样本。",operation:"操作",samples:"样本",last:"最近",max:"最大",operations:{collaboration:{connect:"打开协作房间",persist:"保存协作修改"},workspace:{project:"加载项目元数据",files:"加载项目文件",compileState:"加载保留的 PDF 状态"},compile:{snapshot:"准备编译快照",request:"编译请求总耗时",cacheSync:"更新编译缓存",latexmk:"运行 latexmk",artifactCopy:"发布编译产物"},outline:{build:"生成项目大纲"},search:{project:"项目内搜索"},completions:{build:"生成补全索引"}}},Jm={title:"标签",add:"添加标签",create:"新建标签",createDescription:"创建仅自己可见的可复用彩色标签,用于整理项目。",assign:"标签",assignTitle:"“{{project}}”的标签",assignDescription:"勾选你为此项目设置的私有标签;其他用户拥有各自的标签。",empty:"请先创建标签。",allAssigned:"所有可用标签均已添加。",name:"标签名称",color:"颜色",filter:"筛选",red:"红色",orange:"橙色",yellow:"黄色",green:"绿色",blue:"蓝色",purple:"紫色",gray:"灰色"},Zm={generic:"操作失败",request:"请求失败({{status}})",upload:"上传失败",boundaryTitle:"页面遇到问题",boundaryDescription:"渲染组件时发生异常。你可以尝试恢复,或刷新页面重新载入。",boundaryRetry:"重试",boundaryReload:"刷新页面",fileExists:"同名文件或文件夹已经存在。",pathConflict:"目标路径已经被文件或文件夹占用。",duplicateUploadNames:"所选文件中存在重复名称:{{files}}。",fileTooLarge:"文件超过 {{size}} MB 限制。",zipOnly:"请选择 ZIP 压缩包。",collaborationUnavailable:"实时协作尚未连接,请在重新连接后保存或编译。",codes:{AUTH_INVALID:"用户名或密码错误。",CURRENT_PASSWORD_INVALID:"当前密码错误。",USER_NOT_FOUND:"用户不存在或已被删除。",LAST_ADMIN:"系统必须保留至少一名可用管理员。",SELF_DELETE_FORBIDDEN:"不能删除当前登录的管理员。",PROJECT_CREATE_FORBIDDEN:"管理员尚未授予你创建项目的权限。",PROJECT_NOT_FOUND:"项目不存在或你已无法访问。",PROJECT_OWNER_ONLY:"只有项目所有者可以修改此设置。",PROJECT_EDIT_FORBIDDEN:"你没有此项目的编辑权限。",DICTIONARY_EDIT_FORBIDDEN:"你没有维护本项目词典的权限。",TAG_NOT_FOUND:"所选标签不存在。",GIT_TOKEN_INVALID:"请输入 GitHub token。",GIT_REPOSITORY_NAME_INVALID:"请输入 GitHub 仓库名称。",GIT_REVISION_INVALID:"请选择要 checkout 的 Git 版本。",PROJECT_DELETE_FORBIDDEN:"只有项目所有者可以删除项目。",MEMBERS_MANAGE_FORBIDDEN:"只有项目所有者可以管理项目成员。",OWNER_MEMBER_FORBIDDEN:"项目所有者不能作为成员添加。",INVALID_PATH:"文件路径无效。",RESERVED_PATH:"此路径由 TexLite 保留。",PATH_EXISTS:"目标路径已被文件或文件夹占用。",FILE_EXISTS:"同名文件已经存在。",PATH_NOT_FOUND:"文件或文件夹不存在。",FILE_NOT_FOUND:"文件不存在。",DIRECTORY_NOT_FOUND:"目标文件夹不存在。",MOVE_INTO_SELF:"不能把文件夹移动到自身内部。",MAIN_FILE_DELETE_FORBIDDEN:"不能删除主文档。",FILE_TOO_LARGE:"文件过大,无法打开或上传。",UPLOAD_EMPTY:"没有选择要上传的文件。",COMMENT_FILE_NOT_FOUND:"批注对应的文件不存在。",COMMENT_RANGE_INVALID:"批注的源码区间无效。",COMMENT_NOT_FOUND:"批注不存在。",COMMENT_EDIT_FORBIDDEN:"只能编辑自己的批注。",COMMENT_DELETE_FORBIDDEN:"只能删除自己的批注。",REPLY_NOT_FOUND:"回复不存在。",REPLY_EDIT_FORBIDDEN:"只能编辑自己的回复。",REPLY_DELETE_FORBIDDEN:"只能删除自己的回复。",COMMENT_UPDATE_EMPTY:"没有可更新的批注内容。",MAIN_FILE_NOT_FOUND:"所选主文档不存在。",LATEXMKRC_DISABLED:"管理员已禁用项目级 latexmkrc。",LATEXMKRC_NOT_FOUND:"所选 latexmkrc 文件不存在。",COMPILE_ARTIFACTS_NOT_FOUND:"尚无可用的编译产物。",COMPILE_ARTIFACT_NOT_FOUND:"编译产物不存在。",ARTIFACT_PREVIEW_UNSUPPORTED:"该产物不能作为文本预览,请下载后查看。",SYNC_SOURCE_INVALID:"源码位置无效。",SOURCE_FILE_NOT_FOUND:"源码文件不存在。",SYNCTEX_NOT_AVAILABLE:"尚无可用的 SyncTeX 数据,请重新编译。",SYNC_PDF_INVALID:"PDF 位置无效。",SYNCTEX_EXTERNAL_PATH:"SyncTeX 返回了项目外部的源码路径。",COMPILE_FORBIDDEN:"你没有编译此项目的权限。",PDF_NOT_FOUND:"尚未生成 PDF。",API_NOT_FOUND:"接口不存在。",SERVER_ERROR:"服务器无法完成请求。",REQUEST_INVALID:"请求格式无效。"}},Qm={historyVersionNotFound:"所选历史版本已不存在。",historyFileNotFound:"所选历史版本中没有这个文件。",historyTargetConflict:"当前恢复目标是目录或其他非普通文件路径。",historyPreviewUnsupported:"这个历史文件不能作为文本比较。",searchInvalid:"请输入有效的搜索内容。",gitUnavailable:"Git 集成功能不可用。请在宿主机安装 Git,或修正配置中的 git.binary 后重试。",formatFailed:"tex-fmt 无法格式化这段源码。",mainDocumentInvalid:"所选文件不是有效的 LaTeX 主文档。",compileSnapshotBusy:"源码尚未完成稳定保存,请稍后再试编译。"},eD={requestFailed:"网络请求失败,请检查连接后重试。",invalidResponse:"服务器返回了无效响应,请重试。"},tD={protocolUpgrade:"工作区需要更新。本地草稿已保留;请在准备好重新连接时刷新页面。"},nD={disableTitle:"禁用用户",disableDescription:"确定禁用 @{{username}} 吗?其活跃会话将结束,且无法再登录。",disableConfirm:"禁用用户",demoteTitle:"移除管理员权限",demoteDescription:"确定将 @{{username}} 降为普通用户吗?其将无法再管理用户。",demoteConfirm:"设为普通用户",denyProjectCreationTitle:"移除项目创建权限",denyProjectCreationDescription:"确定移除 @{{username}} 创建新项目的权限吗?其已有项目访问权限不受影响。",denyProjectCreationConfirm:"移除权限"},sD={cancel:"取消编译",cancelling:"正在取消…",cancelled:"编译已取消。"},rD={copyright:"© {{year}}",credit:"Designed and developed by CHEN Zhongpu"},iD={section:"章节",subsection:"小节",bold:"粗体",emphasis:"强调",citation:"引用文献",reference:"交叉引用",label:"标签",image:"插入图片",unordered:"无序列表",ordered:"有序列表",equation:"公式",figure:"图片环境",projectCommand:"项目命令",projectCommandArgs:"项目命令({{count}} 个参数)",projectMacro:"项目宏",expl3Command:"Expl3 项目命令",mathOperator:"项目数学算子",mathDelimiter:"项目数学定界符",projectEnvironment:"项目环境",projectFile:"项目文件",package:"宏包",documentClass:"文档类",currentFile:"当前文件",project:"项目",latex:"LaTeX",standard:"LaTeX 命令"},oD={common:Pm,auth:_m,projects:Im,users:Mm,editor:$m,citationLibrary:Um,citationErrors:zm,citationLibraryHomeDescription:Hm,citationLibraryActions:Vm,citationLibraryPagination:qm,navigation:Km,history:Wm,projectSettings:Gm,git:Ym,metrics:Xm,tags:Jm,errors:Zm,apiErrors:Qm,network:eD,workspaceUpdates:tD,userConfirmations:nD,compileControls:sD,footer:rD,completions:iD};Ke.use(Lu).use(xp).init({resources:{en:{translation:Om},zh:{translation:oD}},fallbackLng:"en",supportedLngs:["en","zh"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});class Un extends Error{constructor(e,n,s=null){super(e),this.status=n,this.code=s}status;code}function Nu(t){return t instanceof Error&&t.name==="AbortError"}function Ru(t){return Nu(t)||t instanceof Un?t:new Un(Ke.t("network.requestFailed"),0,"NETWORK_ERROR")}function aD(t){return typeof FormData<"u"&&t instanceof FormData}async function ne(t,e={}){const{suppressSessionExpired:n=!1,...s}=e,r=new Headers(s.headers);r.has("Accept-Language")||r.set("Accept-Language",Ke.resolvedLanguage?.startsWith("zh")?"zh":"en"),s.body&&!aD(s.body)&&!r.has("Content-Type")&&r.set("Content-Type","application/json");let o;try{o=await fetch(t,{...s,headers:r})}catch(l){throw Ru(l)}const a=o.headers.get("content-type")??"";let c=null;if(a.includes("application/json"))try{c=await o.json()}catch(l){throw Nu(l)?l:new Un(Ke.t("network.invalidResponse"),o.status,"INVALID_RESPONSE")}else if(o.ok)throw new Un(Ke.t("network.invalidResponse"),o.status,"INVALID_RESPONSE");if(!o.ok)throw o.status===401&&!n&&typeof window<"u"&&window.dispatchEvent(new Event("texlite:session-expired")),new Un(Ou(c,o.status),o.status,La(c));return c}function Ou(t,e,n="errors.request"){const s=typeof t=="object"&&t!==null&&"error"in t&&typeof t.error=="string"?t.error:"",r=La(t);if(r){const o={AUTH_REQUIRED:"auth.sessionExpired",ADMIN_REQUIRED:"users.adminRequired",HISTORY_VERSION_NOT_FOUND:"apiErrors.historyVersionNotFound",HISTORY_FILE_NOT_FOUND:"apiErrors.historyFileNotFound",HISTORY_TARGET_CONFLICT:"apiErrors.historyTargetConflict",HISTORY_FILE_PREVIEW_UNSUPPORTED:"apiErrors.historyPreviewUnsupported",SEARCH_QUERY_INVALID:"apiErrors.searchInvalid",GIT_UNAVAILABLE:"apiErrors.gitUnavailable",FORMAT_FAILED:"apiErrors.formatFailed",PROJECT_TRANSFER_FORBIDDEN:"projects.transferForbidden",PROJECT_TRANSFER_TARGET_INVALID:"projects.transferTargetInvalid",PROJECT_TRANSFER_SELF:"projects.transferSelf",MAIN_DOCUMENT_INVALID:"apiErrors.mainDocumentInvalid",COMPILE_SNAPSHOT_BUSY:"apiErrors.compileSnapshotBusy",COMPILE_CLEAN_BUSY:"editor.cleanBusy",CITATION_INVALID:"citationErrors.invalid",CITATION_TOO_LARGE:"citationErrors.tooLarge",CITATION_NOT_FOUND:"citationErrors.notFound",CITATION_KEY_EXISTS:"citationErrors.keyExists",CITATION_TAG_NOT_FOUND:"citationErrors.tagNotFound",CITATION_CONFLICT:"citationErrors.conflict"}[r]??`errors.codes.${r}`;if(Ke.exists(o))return Ke.t(o,{status:e,...typeof t=="object"&&t!==null?t:{}})}return s||Ke.t(n,{status:e})}function La(t){return typeof t!="object"||t===null||!("code"in t)||typeof t.code!="string"?null:t.code}const cD=/^\/projects?\/([^/]+)\/?$/;function fr(t){return`/project/${encodeURIComponent(t)}`}function xs(t){const e=cD.exec(t);if(!e)return null;try{const n=decodeURIComponent(e[1]);return n&&!n.includes("/")?n:null}catch{return null}}function lD(t){return"/?"+new URLSearchParams({return:fr(t)}).toString()}function uD(t){const e=new URLSearchParams(t).get("return");return e?xs(e):null}function dD(t){if(!t||typeof t!="object")return!1;const e=t;return e.texliteRoute==="project"&&typeof e.projectId=="string"&&typeof e.fromDashboard=="boolean"}const hD="modulepreload",fD=function(t){return"/"+t},bl={},Gn=function(e,n,s){let r=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");r=l(n.map(u=>{if(u=fD(u),u in bl)return;bl[u]=!0;const d=u.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${h}`))return;const D=document.createElement("link");if(D.rel=d?"stylesheet":hD,d||(D.as="script"),D.crossOrigin="",D.href=u,c&&D.setAttribute("nonce",c),document.head.appendChild(D),d)return new Promise((m,g)=>{D.addEventListener("load",m),D.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return r.then(a=>{for(const c of a||[])c.status==="rejected"&&o(c.reason);return e().catch(o)})},_i=()=>Gn(()=>import("./PdfPreview-CanYnyfJ.js"),__vite__mapDeps([0,1,2,3])),Jr=new Map,yl=2e3;function Zr(t,e={}){const n=Date.now(),s=Jr.get(t);if(!e.force&&s&&n-s.createdAt<yl)return s.preload;const r=ne(`/api/projects/${t}`,{suppressSessionExpired:!0}),o=ne(`/api/projects/${t}/compile/latest`,{suppressSessionExpired:!0}),a=_i(),c={projectId:t,project:r,latestCompile:o};return Jr.set(t,{preload:c,createdAt:n}),r.catch(()=>{}),Promise.all([a,o]).then(([l,u])=>{u.pdfUrl&&l.preloadPdf(u.pdfUrl,u.pdfLoadingMode??"full")}).catch(()=>{}),window.setTimeout(()=>{Jr.get(t)?.preload===c&&Jr.delete(t)},yl),c}function de(t){return t instanceof Error?t.message:Ke.t("errors.generic")}function Na({compact:t=!1}){const{i18n:e,t:n}=ot(),s=e.resolvedLanguage?.startsWith("zh")?"zh":"en";return i.jsxs("label",{className:`language-switcher${t?" compact":""}`,title:n("common.language"),children:[i.jsx("span",{children:"文/A"}),i.jsxs("select",{value:s,"aria-label":n("common.language"),onChange:r=>{e.changeLanguage(r.target.value)},children:[i.jsx("option",{value:"en",children:n("common.languageEnglish")}),i.jsx("option",{value:"zh",children:n("common.languageChinese")})]})]})}const pD="0.8.0";function Ii({siteName:t,compact:e=!1,auth:n=!1}){return i.jsx("span",{className:`site-logo${e?" compact":""}${n?" auth-logo":""}`,children:i.jsx("img",{src:"/logo.svg",alt:t})})}function Ra(){const{t}=ot();return i.jsxs("footer",{className:"site-footer",children:[i.jsxs("span",{children:[t("footer.copyright",{year:new Date().getFullYear()})," ",i.jsxs("a",{href:"https://github.com/SWUFE-DB-Group/TexLite",target:"_blank",rel:"noreferrer",children:["TexLite v",pD]})]}),i.jsx("span",{children:t("footer.credit")})]})}function mD({site:t,user:e,onChanged:n}){const{t:s}=ot(),[r,o]=f.useState(""),[a,c]=f.useState(""),[l,u]=f.useState(""),[d,h]=f.useState(""),D=async m=>{if(m.preventDefault(),a!==l)return h(s("auth.mismatch"));if(a.length<t.minPasswordLength)return h(s("auth.passwordMinimum",{count:t.minPasswordLength}));try{await ne("/api/me/password",{method:"PUT",body:JSON.stringify({currentPassword:r,newPassword:a})}),n({...e,mustChangePassword:!1})}catch(g){h(de(g))}};return i.jsxs("main",{className:"login-page",children:[i.jsx(Na,{}),i.jsxs("form",{className:"login-card",onSubmit:D,children:[i.jsx(Ii,{siteName:t.siteName,auth:!0}),i.jsx("h1",{className:"sr-only",children:t.siteName}),i.jsx("p",{className:"muted",children:s("auth.firstLogin")}),i.jsxs("label",{children:[s("auth.currentPassword"),i.jsx("input",{type:"password",value:r,onChange:m=>o(m.target.value)})]}),i.jsxs("label",{children:[s("auth.newPassword"),i.jsx("input",{type:"password",minLength:t.minPasswordLength,autoComplete:"new-password",value:a,onChange:m=>c(m.target.value)}),i.jsx("small",{className:"field-hint",children:s("auth.passwordMinimum",{count:t.minPasswordLength})})]}),i.jsxs("label",{children:[s("auth.confirmPassword"),i.jsx("input",{type:"password",minLength:t.minPasswordLength,autoComplete:"new-password",value:l,onChange:m=>u(m.target.value)})]}),d&&i.jsx("p",{className:"error",children:d}),i.jsx("button",{className:"primary",children:s("auth.updatePassword")})]}),i.jsx(Ra,{})]})}function DD({site:t,onLogin:e}){const{t:n}=ot(),[s,r]=f.useState(""),[o,a]=f.useState(""),[c,l]=f.useState(""),u=async d=>{d.preventDefault(),l("");try{const h=await ne("/api/auth/login",{method:"POST",body:JSON.stringify({username:s,password:o}),suppressSessionExpired:!0});e(h.user)}catch(h){l(de(h))}};return i.jsxs("main",{className:"login-page",children:[i.jsx(Na,{}),i.jsxs("form",{className:"login-card",onSubmit:u,children:[i.jsx(Ii,{siteName:t.siteName,auth:!0}),i.jsx("h1",{className:"sr-only",children:t.siteName}),i.jsx("p",{className:"muted",children:n("auth.tagline")}),i.jsxs("label",{children:[n("auth.username"),i.jsx("input",{autoFocus:!0,value:s,onChange:d=>r(d.target.value)})]}),i.jsxs("label",{children:[n("auth.password"),i.jsx("input",{type:"password",value:o,onChange:d=>a(d.target.value)})]}),c&&i.jsx("p",{className:"error",children:c}),i.jsx("button",{className:"primary",type:"submit",children:n("auth.login")}),t.adminEmail&&i.jsx("small",{className:"support",children:n("auth.contact",{email:t.adminEmail})})]}),i.jsx(Ra,{})]})}var gD=Object.defineProperty,Js=(t,e)=>gD(t,"name",{value:e,configurable:!0}),Pu=!!(typeof window<"u"&&window.document&&window.document.createElement);function zn(t,e,{checkForDefaultPrevented:n=!0}={}){return Js(function(r){if(t?.(r),n===!1||!r||!r.defaultPrevented)return e?.(r)},"handleEvent")}Js(zn,"composeEventHandlers");function FD(t){if(!Pu)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}Js(FD,"getOwnerWindow");function Go(t){if(!Pu)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}Js(Go,"getOwnerDocument");function _u(t,e=!1){const{activeElement:n}=Go(t);if(!n?.nodeName)return null;if(Iu(n)&&n.contentDocument)return _u(n.contentDocument.body,e);if(e){const s=n.getAttribute("aria-activedescendant");if(s){const r=Go(n).getElementById(s);if(r)return r}}return n}Js(_u,"getActiveElement");function Iu(t){return t.tagName==="IFRAME"}Js(Iu,"isFrame");var bD=Object.defineProperty,Oa=(t,e)=>bD(t,"name",{value:e,configurable:!0});function Yo(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Oa(Yo,"setRef");function Mu(...t){return e=>{let n=!1;const s=t.map(r=>{const o=Yo(r,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let r=0;r<s.length;r++){const o=s[r];typeof o=="function"?o():Yo(t[r],null)}}}}Oa(Mu,"composeRefs");function Zs(...t){return f.useCallback(Mu(...t),t)}Oa(Zs,"useComposedRefs");var yD=Object.defineProperty,Qt=(t,e)=>yD(t,"name",{value:e,configurable:!0});function CD(t,e){const n=f.createContext(e);n.displayName=t+"Context";const s=Qt(o=>{const{children:a,...c}=o,l=f.useMemo(()=>c,Object.values(c));return i.jsx(n.Provider,{value:l,children:a})},"Provider");s.displayName=t+"Provider";function r(o,a={}){const{optional:c=!1}=a,l=f.useContext(n);if(l)return l;if(e!==void 0)return e;if(!c)throw new Error(`\`${o}\` must be used within \`${t}\``)}return Qt(r,"useContext"),[s,r]}Qt(CD,"createContext");function $u(t,e=[]){let n=[];function s(o,a){const c=f.createContext(a);c.displayName=o+"Context";const l=n.length;n=[...n,a];const u=Qt(h=>{const{scope:D,children:m,...g}=h,y=D?.[t]?.[l]||c,b=f.useMemo(()=>g,Object.values(g));return i.jsx(y.Provider,{value:b,children:m})},"Provider");u.displayName=o+"Provider";function d(h,D,m={}){const{optional:g=!1}=m,y=D?.[t]?.[l]||c,b=f.useContext(y);if(b)return b;if(a!==void 0)return a;if(!g)throw new Error(`\`${h}\` must be used within \`${o}\``)}return Qt(d,"useContext"),[u,d]}Qt(s,"createContext");const r=Qt(()=>{const o=n.map(a=>f.createContext(a));return Qt(function(c){const l=c?.[t]||o;return f.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])},"useScope")},"createScope");return r.scopeName=t,[s,Uu(r,...e)]}Qt($u,"createContextScope");function Uu(...t){const e=t[0];if(t.length===1)return e;const n=Qt(()=>{const s=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return Qt(function(o){const a=s.reduce((c,{useScope:l,scopeName:u})=>{const h=l(o)[`__scope${u}`];return{...c,...h}},{});return f.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}Qt(Uu,"composeContextScopes");var Hn=globalThis?.document?f.useLayoutEffect:()=>{},ED=Object.defineProperty,wD=(t,e)=>ED(t,"name",{value:e,configurable:!0}),xD=Pr[" useId ".trim().toString()]||(()=>{}),vD=0;function ai(t){const[e,n]=f.useState(xD());return Hn(()=>{t||n(s=>s??String(vD++))},[t]),t||(e?`radix-${e}`:"")}wD(ai,"useId");var AD=Object.defineProperty,kD=(t,e)=>AD(t,"name",{value:e,configurable:!0}),Cl=Pr[" useEffectEvent ".trim().toString()],El=Pr[" useInsertionEffect ".trim().toString()];function zu(t){if(typeof Cl=="function")return Cl(t);const e=f.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof El=="function"?El(()=>{e.current=t}):Hn(()=>{e.current=t}),f.useMemo(()=>((...n)=>e.current?.(...n)),[])}kD(zu,"useEffectEvent");var SD=Object.defineProperty,_r=(t,e)=>SD(t,"name",{value:e,configurable:!0}),jD=Pr[" useInsertionEffect ".trim().toString()]||Hn;function Hu({prop:t,defaultProp:e,onChange:n=_r(()=>{},"onChange"),caller:s}){const[r,o,a]=Vu({defaultProp:e,onChange:n}),c=t!==void 0,l=c?t:r,u=f.useCallback(d=>{if(c){const h=qu(d)?d(t):d;h!==t&&a.current?.(h)}else o(d)},[c,t,o,a]);return[l,u]}_r(Hu,"useControllableState");function Vu({defaultProp:t,onChange:e}){const[n,s]=f.useState(t),r=f.useRef(n),o=f.useRef(e);return jD(()=>{o.current=e},[e]),f.useEffect(()=>{r.current!==n&&(o.current?.(n),r.current=n)},[n,r]),[n,s,o]}_r(Vu,"useUncontrolledState");function qu(t){return typeof t=="function"}_r(qu,"isFunction");var wl=Symbol("RADIX:SYNC_STATE");function BD(t,e,n,s){const{prop:r,defaultProp:o,onChange:a,caller:c}=e,l=r!==void 0,u=zu(a),d=[{...n,state:o}];s&&d.push(s);const[h,D]=f.useReducer((b,w)=>{if(w.type===wl)return{...b,state:w.state};const x=t(b,w);return l&&!Object.is(x.state,b.state)&&u(x.state),x},...d),m=h.state,g=f.useRef(m);f.useEffect(()=>{g.current!==m&&(g.current=m,l||u(m))},[m,g,l]);const y=f.useMemo(()=>r!==void 0?{...h,state:r}:h,[h,r]);return f.useEffect(()=>{l&&!Object.is(r,h.state)&&D({type:wl,state:r})},[r,h.state,l]),[y,D]}_r(BD,"useControllableStateReducer");var TD=Object.defineProperty,fn=(t,e)=>TD(t,"name",{value:e,configurable:!0});function Pa(t){const e=f.forwardRef((n,s)=>{let{children:r,...o}=n,a=null,c=!1;const l=[];Xo(r)&&typeof Qr=="function"&&(r=Qr(r._payload)),f.Children.forEach(r,D=>{if(Yu(D)){c=!0;const m=D;let g="child"in m.props?m.props.child:m.props.children;Xo(g)&&typeof Qr=="function"&&(g=Qr(g._payload)),a=ND(m,g),l.push(a?.props?.children)}else l.push(D)}),a?a=f.cloneElement(a,void 0,l):!c&&f.Children.count(r)===1&&f.isValidElement(r)&&(a=r);const u=a?Gu(a):void 0,d=Zs(s,u);if(!a){if(r||r===0)throw new Error(c?PD(t):OD(t));return r}const h=Wu(o,a.props??{});return a.type!==f.Fragment&&(h.ref=s?d:u),f.cloneElement(a,h)});return e.displayName=`${t}.Slot`,e}fn(Pa,"createSlot");var Ku=Symbol.for("radix.slottable");function LD(t){const e=fn(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=Ku,e}fn(LD,"createSlottable");var ND=fn((t,e)=>{if("child"in t.props){const n=t.props.child;return f.isValidElement(n)?f.cloneElement(n,void 0,t.props.children(n.props.children)):null}return f.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function Wu(t,e){const n={...e};for(const s in e){const r=t[s],o=e[s];/^on[A-Z]/.test(s)?r&&o?n[s]=(...c)=>{const l=o(...c);return r(...c),l}:r&&(n[s]=r):s==="style"?n[s]={...r,...o}:s==="className"&&(n[s]=[r,o].filter(Boolean).join(" "))}return{...t,...n}}fn(Wu,"mergeProps");function Gu(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}fn(Gu,"getElementRef");function Yu(t){return f.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ku}fn(Yu,"isSlottable");var RD=Symbol.for("react.lazy");function Xo(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===RD&&"_payload"in t&&Xu(t._payload)}fn(Xo,"isLazyComponent");function Xu(t){return typeof t=="object"&&t!==null&&"then"in t}fn(Xu,"isPromiseLike");var OD=fn(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),PD=fn(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Qr=Pr[" use ".trim().toString()],_D=Object.defineProperty,ID=(t,e)=>_D(t,"name",{value:e,configurable:!0}),MD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],us=MD.reduce((t,e)=>{const n=Pa(`Primitive.${e}`),s=f.forwardRef((r,o)=>{const{asChild:a,...c}=r,l=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(l,{...c,ref:o})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function Ju(t,e){t&&vu.flushSync(()=>t.dispatchEvent(e))}ID(Ju,"dispatchDiscreteCustomEvent");var $D=Object.defineProperty,UD=(t,e)=>$D(t,"name",{value:e,configurable:!0});function $s(t){const e=f.useRef(t);return f.useEffect(()=>{e.current=t}),f.useMemo(()=>((...n)=>e.current?.(...n)),[])}UD($s,"useCallbackRef");var zD=Object.defineProperty,Tt=(t,e)=>zD(t,"name",{value:e,configurable:!0}),Jo="dismissableLayer.update",HD="dismissableLayer.pointerDownOutside",VD="dismissableLayer.focusOutside",xl,Zu=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),qD=f.forwardRef(Tt(function(e,n){const{disableOutsidePointerEvents:s=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:l,onDismiss:u,...d}=e,h=f.useContext(Zu),[D,m]=f.useState(null),g=D?.ownerDocument??globalThis?.document,[,y]=f.useState({}),b=Zs(n,m),w=Array.from(h.layers),[x]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),j=x?w.indexOf(x):-1,N=D?w.indexOf(D):-1,$=h.layersWithOutsidePointerEventsDisabled.size>0,V=N>=j,U=f.useRef(!1),G=ed(P=>{a?.(P),l?.(P),P.defaultPrevented||u?.()},{ownerDocument:g,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:U,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:f.useCallback(P=>{if(!(P instanceof Node))return!1;const K=[...h.branches].some(B=>B.contains(P));return V&&!K},[h.branches,V])}),Y=td(P=>{if(r&&U.current)return;const K=P.target;[...h.branches].some(S=>S.contains(K))||(c?.(P),l?.(P),P.defaultPrevented||u?.())},g),W=D?N===w.length-1:!1,ue=$s(P=>{P.key==="Escape"&&(o?.(P),!P.defaultPrevented&&u&&(P.preventDefault(),u()))});return f.useEffect(()=>{if(W)return g.addEventListener("keydown",ue,{capture:!0}),()=>g.removeEventListener("keydown",ue,{capture:!0})},[g,W,ue]),f.useEffect(()=>{if(D)return s&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(xl=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(D)),h.layers.add(D),Zo(),()=>{s&&(h.layersWithOutsidePointerEventsDisabled.delete(D),h.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=xl))}},[D,g,s,h]),f.useEffect(()=>()=>{D&&(h.layers.delete(D),h.layersWithOutsidePointerEventsDisabled.delete(D),Zo())},[D,h]),f.useEffect(()=>{const P=Tt(()=>y({}),"handleUpdate");return document.addEventListener(Jo,P),()=>document.removeEventListener(Jo,P)},[]),i.jsx(us.div,{...d,ref:b,style:{pointerEvents:$?V?"auto":"none":void 0,...e.style},onFocusCapture:zn(e.onFocusCapture,Y.onFocusCapture),onBlurCapture:zn(e.onBlurCapture,Y.onBlurCapture),onPointerDownCapture:zn(e.onPointerDownCapture,G.onPointerDownCapture)})},"DismissableLayer"));function Qu(){const t=f.useContext(Zu),[e,n]=f.useState(null);return f.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}Tt(Qu,"useDismissableLayerSurface");var KD=Tt(()=>!0,"IS_TRUE");function ed(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:o,shouldHandlePointerDownOutside:a=KD}=e,c=$s(t),l=f.useRef(!1),u=f.useRef(!1),d=f.useRef(new Map),h=f.useRef(()=>{});return f.useEffect(()=>{function D(){u.current=!1,r.current=!1,d.current.clear()}Tt(D,"resetOutsideInteraction");function m(){return Array.from(d.current.values()).some(Boolean)}Tt(m,"isOutsideInteractionIntercepted");function g(j){if(!u.current)return;const N=j.target;N instanceof Node&&[...o].some(V=>V.contains(N))||d.current.set(j.type,!0),j.type==="click"&&window.setTimeout(()=>{u.current&&h.current()},0)}Tt(g,"handleInteractionCapture");function y(j){u.current&&d.current.set(j.type,!1)}Tt(y,"handleInteractionBubble");const b=Tt(j=>{if(j.target&&!l.current){let N=function(){n.removeEventListener("click",h.current);const V=m();D(),V||_a(HD,c,$,{discrete:!0})};if(Tt(N,"handleAndDispatchPointerDownOutsideEvent"),!a(j.target)){n.removeEventListener("click",h.current),D(),l.current=!1;return}const $={originalEvent:j};u.current=!0,r.current=s&&j.button===0,d.current.clear(),!s||j.button!==0?N():(n.removeEventListener("click",h.current),h.current=N,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),D();l.current=!1},"handlePointerDown"),w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const j of w)n.addEventListener(j,g,!0),n.addEventListener(j,y);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",b)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",b),n.removeEventListener("click",h.current);for(const j of w)n.removeEventListener(j,g,!0),n.removeEventListener(j,y)}},[n,c,s,r,o,a]),{onPointerDownCapture:Tt(()=>l.current=!0,"onPointerDownCapture")}}Tt(ed,"usePointerDownOutside");function td(t,e=globalThis?.document){const n=$s(t),s=f.useRef(!1);return f.useEffect(()=>{const r=Tt(o=>{o.target&&!s.current&&_a(VD,n,{originalEvent:o},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,n]),{onFocusCapture:Tt(()=>s.current=!0,"onFocusCapture"),onBlurCapture:Tt(()=>s.current=!1,"onBlurCapture")}}Tt(td,"useFocusOutside");function Zo(){const t=new CustomEvent(Jo);document.dispatchEvent(t)}Tt(Zo,"dispatchUpdate");function _a(t,e,n,{discrete:s}){const r=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),s?Ju(r,o):r.dispatchEvent(o)}Tt(_a,"handleAndDispatchCustomEvent");var WD=Object.defineProperty,zt=(t,e)=>WD(t,"name",{value:e,configurable:!0}),yo="focusScope.autoFocusOnMount",Co="focusScope.autoFocusOnUnmount",vl={bubbles:!1,cancelable:!0},GD=f.forwardRef(zt(function(e,n){const{loop:s=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...c}=e,[l,u]=f.useState(null),d=$s(o),h=$s(a),D=f.useRef(null),m=Zs(n,u),g=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let b=function(N){if(g.paused||!l)return;const $=N.target;l.contains($)?D.current=$:jn(D.current,{select:!0})},w=function(N){if(g.paused||!l)return;const $=N.relatedTarget;$!==null&&(l.contains($)||jn(D.current,{select:!0}))},x=function(N){if(document.activeElement===document.body)for(const V of N)V.removedNodes.length>0&&jn(l)};zt(b,"handleFocusIn"),zt(w,"handleFocusOut"),zt(x,"handleMutations"),document.addEventListener("focusin",b),document.addEventListener("focusout",w);const j=new MutationObserver(x);return l&&j.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",w),j.disconnect()}}},[r,l,g.paused]),f.useEffect(()=>{if(l){Al.add(g);const b=document.activeElement;if(!l.contains(b)){const x=new CustomEvent(yo,vl);l.addEventListener(yo,d),l.dispatchEvent(x),x.defaultPrevented||(nd(ad(Ia(l)),{select:!0}),document.activeElement===b&&jn(l))}return()=>{l.removeEventListener(yo,d),setTimeout(()=>{const x=new CustomEvent(Co,vl);l.addEventListener(Co,h),l.dispatchEvent(x),x.defaultPrevented||jn(b??document.body,{select:!0}),l.removeEventListener(Co,h),Al.remove(g)},0)}}},[l,d,h,g]);const y=f.useCallback(b=>{if(!s&&!r||g.paused)return;const w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,x=document.activeElement;if(w&&x){const j=b.currentTarget,[N,$]=sd(j);N&&$?!b.shiftKey&&x===$?(b.preventDefault(),s&&jn(N,{select:!0})):b.shiftKey&&x===N&&(b.preventDefault(),s&&jn($,{select:!0})):x===j&&b.preventDefault()}},[s,r,g.paused]);return i.jsx(us.div,{tabIndex:-1,...c,ref:m,onKeyDown:y})},"FocusScope"));function nd(t,{select:e=!1}={}){const n=document.activeElement;for(const s of t)if(jn(s,{select:e}),document.activeElement!==n)return}zt(nd,"focusFirst");function sd(t){const e=Ia(t),n=Qo(e,t),s=Qo(e.reverse(),t);return[n,s]}zt(sd,"getTabbableEdges");function Ia(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:zt(s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}zt(Ia,"getTabbableCandidates");function Qo(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const s of t)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):rd(s,{upTo:e})))return s}zt(Qo,"findVisible");function rd(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}zt(rd,"isHidden");function id(t){return t instanceof HTMLInputElement&&"select"in t}zt(id,"isSelectableInput");function jn(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&id(t)&&e&&t.select()}}zt(jn,"focus");var Al=od();function od(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=ea(t,e),t.unshift(e)},remove(e){t=ea(t,e),t[0]?.resume()}}}zt(od,"createFocusScopesStack");function ea(t,e){const n=[...t],s=n.indexOf(e);return s!==-1&&n.splice(s,1),n}zt(ea,"arrayRemove");function ad(t){return t.filter(e=>e.tagName!=="A")}zt(ad,"removeLinks");var YD=Object.defineProperty,XD=(t,e)=>YD(t,"name",{value:e,configurable:!0}),JD=f.forwardRef(XD(function(e,n){const{container:s,...r}=e,[o,a]=f.useState(!1);Hn(()=>a(!0),[]);const c=s||o&&globalThis?.document?.body;return c?vu.createPortal(i.jsx(us.div,{...r,ref:n}),c):null},"Portal")),ZD=Object.defineProperty,Ln=(t,e)=>ZD(t,"name",{value:e,configurable:!0});function cd(t,e){return f.useReducer((n,s)=>e[n][s]??n,t)}Ln(cd,"useStateMachine");var Ma=Ln(t=>{const{present:e,children:n}=t,s=ld(e),r=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),o=ud(s.ref,dd(r));return typeof n=="function"||s.isPresent?f.cloneElement(r,{ref:o}):null},"Presence");function ld(t){const[e,n]=f.useState(),s=f.useRef(null),r=f.useRef(t),o=f.useRef("none"),a=f.useRef(void 0),c=t?"mounted":"unmounted",[l,u]=cd(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{l==="mounted"?(o.current=a.current??vs(s.current),a.current=void 0):o.current="none"},[l]),Hn(()=>{const d=s.current,h=r.current;if(h!==t){const m=o.current,g=vs(d);t?(a.current=g,u("MOUNT")):g==="none"||d?.display==="none"?u("UNMOUNT"):u(h&&m!==g?"ANIMATION_OUT":"UNMOUNT"),r.current=t}},[t,u]),Hn(()=>{if(e){let d;const h=e.ownerDocument.defaultView??window,D=Ln(g=>{const b=vs(s.current).includes(CSS.escape(g.animationName));if(g.target===e&&b&&(u("ANIMATION_END"),!r.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",d=h.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},"handleAnimationEnd"),m=Ln(g=>{g.target===e&&(o.current=vs(s.current))},"handleAnimationStart");return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",D),e.addEventListener("animationend",D),()=>{h.clearTimeout(d),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",D),e.removeEventListener("animationend",D)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(d=>{if(d){const h=getComputedStyle(d);s.current=h,a.current=vs(h)}else s.current=null;n(d)},[])}}Ln(ld,"usePresence");function ta(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Ln(ta,"setRef");function ud(...t){const e=f.useRef(t);return e.current=t,f.useCallback(n=>{const s=e.current;let r=!1;const o=s.map(a=>{const c=ta(a,n);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let a=0;a<o.length;a++){const c=o[a];typeof c=="function"?c():ta(s[a],null)}}},[])}Ln(ud,"useStableComposedRefs");function vs(t){return t?.animationName||"none"}Ln(vs,"getAnimationName");function dd(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Ln(dd,"getElementRef");var QD=Object.defineProperty,$a=(t,e)=>QD(t,"name",{value:e,configurable:!0}),ei=0,Cs=null;function e0(t){return Ua(),t.children}$a(e0,"FocusGuards");function Ua(){f.useEffect(()=>{Cs||(Cs={start:na(),end:na()});const{start:t,end:e}=Cs;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),ei++,()=>{ei===1&&(Cs?.start.remove(),Cs?.end.remove(),Cs=null),ei=Math.max(0,ei-1)}},[])}$a(Ua,"useFocusGuards");function na(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}$a(na,"createFocusGuard");var t0=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Es=new WeakMap,ti=new WeakMap,ni={},Eo=0,hd=function(t){return t&&(t.host||hd(t.parentNode))},n0=function(t,e){return e.map(function(n){if(t.contains(n))return n;var s=hd(n);return s&&t.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},s0=function(t,e,n,s){var r=n0(e,Array.isArray(t)?t:[t]);ni[n]||(ni[n]=new WeakMap);var o=ni[n],a=[],c=new Set,l=new Set(r),u=function(h){!h||c.has(h)||(c.add(h),u(h.parentNode))};r.forEach(u);var d=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(D){if(c.has(D))d(D);else try{var m=D.getAttribute(s),g=m!==null&&m!=="false",y=(Es.get(D)||0)+1,b=(o.get(D)||0)+1;Es.set(D,y),o.set(D,b),a.push(D),y===1&&g&&ti.set(D,!0),b===1&&D.setAttribute(n,"true"),g||D.setAttribute(s,"true")}catch(w){console.error("aria-hidden: cannot operate on ",D,w)}})};return d(e),c.clear(),Eo++,function(){a.forEach(function(h){var D=Es.get(h)-1,m=o.get(h)-1;Es.set(h,D),o.set(h,m),D||(ti.has(h)||h.removeAttribute(s),ti.delete(h)),m||h.removeAttribute(n)}),Eo--,Eo||(Es=new WeakMap,Es=new WeakMap,ti=new WeakMap,ni={})}},r0=function(t,e,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),r=t0(t);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),s0(s,r,n,"aria-hidden")):function(){return null}},i0=Object.defineProperty,rn=(t,e)=>i0(t,"name",{value:e,configurable:!0}),za="Dialog",[fd,q2]=$u(za),[o0,Cn]=fd(za),a0=rn(t=>{const{__scopeDialog:e,children:n,open:s,defaultOpen:r,onOpenChange:o,modal:a=!0}=t,c=f.useRef(null),l=f.useRef(null),[u,d]=Hu({prop:s,defaultProp:r??!1,onChange:o,caller:za}),[h,D]=f.useState(0),[m,g]=f.useState(0);return i.jsx(o0,{scope:e,triggerRef:c,contentRef:l,contentId:ai(),titleId:ai(),descriptionId:ai(),titlePresent:h>0,descriptionPresent:m>0,setTitleCount:D,setDescriptionCount:g,open:u,onOpenChange:d,onOpenToggle:f.useCallback(()=>d(y=>!y),[d]),modal:a,children:n})},"Dialog"),pd="DialogPortal",[c0,md]=fd(pd,{forceMount:void 0}),l0=rn(t=>{const{__scopeDialog:e,forceMount:n,children:s,container:r}=t,o=Cn(pd,e);return i.jsx(c0,{scope:e,forceMount:n,children:f.Children.map(s,a=>i.jsx(Ma,{present:n||o.open,children:i.jsx(JD,{asChild:!0,container:r,children:a})}))})},"DialogPortal"),sa="DialogOverlay",u0=f.forwardRef(rn(function(e,n){const s=md(sa,e.__scopeDialog),{forceMount:r=s.forceMount,...o}=e,a=Cn(sa,e.__scopeDialog);return a.modal?i.jsx(Ma,{present:r||a.open,children:i.jsx(h0,{...o,ref:n})}):null},"DialogOverlay")),d0=Pa("DialogOverlay.RemoveScroll"),h0=f.forwardRef(rn(function(e,n){const{__scopeDialog:s,...r}=e,o=Cn(sa,s),a=Qu(),c=Zs(n,a);return i.jsx(vp,{as:d0,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(us.div,{"data-state":Ha(o.open),...r,ref:c,style:{pointerEvents:"auto",...r.style}})})},"DialogOverlayImpl")),wr="DialogContent",f0=f.forwardRef(rn(function(e,n){const s=md(wr,e.__scopeDialog),{forceMount:r=s.forceMount,...o}=e,a=Cn(wr,e.__scopeDialog);return i.jsx(Ma,{present:r||a.open,children:a.modal?i.jsx(p0,{...o,ref:n}):i.jsx(m0,{...o,ref:n})})},"DialogContent")),p0=f.forwardRef(rn(function(e,n){const s=Cn(wr,e.__scopeDialog),r=f.useRef(null),o=Zs(n,s.contentRef,r);return f.useEffect(()=>{const a=r.current;if(a)return r0(a)},[]),i.jsx(Dd,{...e,ref:o,trapFocus:s.open,disableOutsidePointerEvents:s.open,onCloseAutoFocus:zn(e.onCloseAutoFocus,a=>{a.preventDefault(),s.triggerRef.current?.focus()}),onPointerDownOutside:zn(e.onPointerDownOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0;(c.button===2||l)&&a.preventDefault()}),onFocusOutside:zn(e.onFocusOutside,a=>a.preventDefault())})},"DialogContentModal")),m0=f.forwardRef(rn(function(e,n){const s=Cn(wr,e.__scopeDialog),r=f.useRef(!1),o=f.useRef(!1);return i.jsx(Dd,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||s.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=a.target;s.triggerRef.current?.contains(c)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})},"DialogContentNonModal")),Dd=f.forwardRef(rn(function(e,n){const{__scopeDialog:s,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...c}=e,l=Cn(wr,s);return Ua(),i.jsx(i.Fragment,{children:i.jsx(GD,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:i.jsx(qD,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionPresent?l.descriptionId:void 0,"aria-labelledby":l.titlePresent?l.titleId:void 0,"data-state":Ha(l.open),...c,ref:n,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})},"DialogContentImpl")),D0="DialogTitle",g0=f.forwardRef(rn(function(e,n){const{__scopeDialog:s,...r}=e,o=Cn(D0,s),{setTitleCount:a}=o;return Hn(()=>(a(c=>c+1),()=>a(c=>c-1)),[a]),i.jsx(us.h2,{id:o.titleId,...r,ref:n})},"DialogTitle")),F0="DialogDescription",b0=f.forwardRef(rn(function(e,n){const{__scopeDialog:s,...r}=e,o=Cn(F0,s),{setDescriptionCount:a}=o;return Hn(()=>(a(c=>c+1),()=>a(c=>c-1)),[a]),i.jsx(us.p,{id:o.descriptionId,...r,ref:n})},"DialogDescription")),y0="DialogClose",C0=f.forwardRef(rn(function(e,n){const{__scopeDialog:s,...r}=e,o=Cn(y0,s);return i.jsx(us.button,{type:"button",...r,ref:n,onClick:zn(e.onClick,()=>o.onOpenChange(!1))})},"DialogClose"));function Ha(t){return t?"open":"closed"}rn(Ha,"getState");const E0=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),gd=(...t)=>t.filter((e,n,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===n).join(" ").trim();var w0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const x0=f.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:o,iconNode:a,...c},l)=>f.createElement("svg",{ref:l,...w0,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:gd("lucide",r),...c},[...a.map(([u,d])=>f.createElement(u,d)),...Array.isArray(o)?o:[o]]));const oe=(t,e)=>{const n=f.forwardRef(({className:s,...r},o)=>f.createElement(x0,{ref:o,iconNode:e,className:gd(`lucide-${E0(t)}`,s),...r}));return n.displayName=`${t}`,n};const v0=oe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);const Fd=oe("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const A0=oe("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);const kl=oe("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const k0=oe("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);const ra=oe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const wo=oe("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);const Ss=oe("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);const Va=oe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);const S0=oe("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const is=oe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const bd=oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const br=oe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const Mi=oe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const j0=oe("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);const B0=oe("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);const T0=oe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const yd=oe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const qa=oe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const Sl=oe("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);const L0=oe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const N0=oe("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);const xr=oe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const ia=oe("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);const oa=oe("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);const R0=oe("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);const O0=oe("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);const Us=oe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const P0=oe("FolderCheck",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);const aa=oe("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const Cd=oe("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const _0=oe("FolderX",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);const I0=oe("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const M0=oe("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);const Ed=oe("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);const $0=oe("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const U0=oe("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);const jl=oe("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const z0=oe("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);const H0=oe("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);const ut=oe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const wd=oe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);const Bl=oe("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);const xd=oe("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);const vd=oe("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);const V0=oe("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);const q0=oe("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);const K0=oe("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const W0=oe("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);const G0=oe("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);const ca=oe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const Y0=oe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const ci=oe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const la=oe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const X0=oe("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);const J0=oe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const Di=oe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const ua=oe("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);const Ad=oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const Z0=oe("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);const da=oe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Q0=oe("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const eg=oe("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);const tg=oe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const ng=oe("SpellCheck2",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M4 21c1.1 0 1.1-1 2.3-1s1.1 1 2.3 1c1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1",key:"8mdmtu"}]]);const ha=oe("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);const sn=oe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const nn=oe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Tl=oe("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);const gi=oe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const sg=oe("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);const fa=oe("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);const rg=oe("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);const vr=oe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);const ig=oe("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]]);const Ht=oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function bt({open:t,title:e,description:n,onOpenChange:s,children:r,footer:o,wide:a,extraWide:c,className:l}){const{t:u}=ot();return i.jsx(a0,{open:t,onOpenChange:s,children:i.jsxs(l0,{children:[i.jsx(u0,{className:"dialog-overlay"}),i.jsxs(f0,{className:`dialog-content${a?" dialog-wide":""}${c?" dialog-extra-wide":""}${l?` ${l}`:""}`,children:[i.jsxs("div",{className:"dialog-header",children:[i.jsxs("div",{children:[i.jsx(g0,{children:e}),n&&i.jsx(b0,{children:n})]}),i.jsx(C0,{className:"dialog-close","aria-label":u("common.close"),children:"×"})]}),i.jsx("div",{className:"dialog-body",children:r}),o&&i.jsx("div",{className:"dialog-footer",children:o})]})]})})}function Vn({open:t,title:e,description:n,confirmLabel:s,danger:r,onCancel:o,onConfirm:a,error:c,busy:l=!1}){const{t:u}=ot();return i.jsx(bt,{open:t,title:e,description:n,onOpenChange:d=>{!d&&!l&&o()},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:l,onClick:o,children:u("common.cancel")}),i.jsxs("button",{className:r?"danger":"primary",disabled:l,"aria-busy":l,onClick:a,children:[l&&i.jsx(ut,{className:"spin",size:14}),s??u("common.remove")]})]}),children:i.jsxs(i.Fragment,{children:[c&&i.jsx("p",{className:"error dialog-error",children:c}),i.jsx("div",{})]})})}var xo,Ll;function og(){if(Ll)return xo;Ll=1;var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,r=(p,E)=>t(p,"name",{value:E,configurable:!0}),o=(p,E)=>{for(var F in E)t(p,F,{get:E[F],enumerable:!0})},a=(p,E,F,O)=>{if(E&&typeof E=="object"||typeof E=="function")for(let H of n(E))!s.call(p,H)&&H!==F&&t(p,H,{get:()=>E[H],enumerable:!(O=e(E,H))||O.enumerable});return p},c=p=>a(t({},"__esModule",{value:!0}),p),l={};o(l,{getEntries:()=>jt,tidy:()=>Te}),xo=c(l);var u=class{constructor(p=[]){this.children=p,this.type="root"}static{r(this,"RootNode")}},d=class{constructor(p,E){this.parent=p,this.text=E,this.type="text",p.children.push(this)}static{r(this,"TextNode")}},h=class{constructor(p){this.parent=p,this.type="block",this.command="",p.children.push(this)}static{r(this,"BlockNode")}},D=class{constructor(p,E,F,O){this.parent=p,this.raw=E,this.braces=F,this.parens=O,this.type="comment",p.block=this}static{r(this,"CommentNode")}},m=class{constructor(p,E,F,O){this.parent=p,this.raw=E,this.braces=F,this.parens=O,this.type="preamble",p.block=this}static{r(this,"PreambleNode")}},g=class{constructor(p,E,F,O){this.parent=p,this.raw=E,this.braces=F,this.parens=O,this.type="string",p.block=this}static{r(this,"StringNode")}},y=class{constructor(p,E){this.parent=p,this.wrapType=E,this.type="entry",p.block=this,this.fields=[]}static{r(this,"EntryNode")}},b=class{constructor(p,E=""){this.parent=p,this.name=E,this.type="field",this.value=new w(this)}static{r(this,"FieldNode")}},w=class{constructor(p){this.parent=p,this.type="concat",this.canConsumeValue=!0,this.concat=[]}static{r(this,"ConcatNode")}},x=class{constructor(p,E){this.parent=p,this.value=E,this.type="literal",p.concat.push(this)}static{r(this,"LiteralNode")}},j=class{constructor(p){this.parent=p,this.type="braced",this.value="",this.depth=0,p.concat.push(this)}static{r(this,"BracedNode")}},N=class{constructor(p){this.parent=p,this.type="quoted",this.value="",this.depth=0,p.concat.push(this)}static{r(this,"QuotedNode")}};function $(p){const E=new u;let F=E,O=1,H=0;for(let ee=0;ee<p.length;ee++){const L=p[ee]??"",we=p[ee-1]??"";switch(L===`
|
|
15
|
-
`&&(O++,H=0),H++,F.type){case"root":{F=L==="@"?new h(F):new d(F,L);break}case"text":{L==="@"&&/[\s\r\n}]/.test(we)?F=new h(F.parent):F.text+=L;break}case"block":{if(L==="@"){const ae=F.parent.children[F.parent.children.length-2];ae?.type==="text"?ae.text+=`@${F.command}`:(F.parent.children.pop(),new d(F.parent,`@${F.command}`),F.parent.children.push(F)),F.command=""}else if(L==="{"||L==="("){const ae=F.command.trim();if(ae===""||/\s/.test(ae))F.parent.children.pop(),F=new d(F.parent,`@${F.command}${L}`);else{F.command=ae;const Re=F.command.toLowerCase(),[Ae,je]=L==="{"?[1,0]:[0,1],Ze=`@${Re}${L}`;switch(Re){case"string":F=new g(F,Ze,Ae,je);break;case"preamble":F=new m(F,Ze,Ae,je);break;case"comment":F=new D(F,Ze,Ae,je);break;default:F=new y(F,L);break}}}else L.match(/[=#,})[\]]/)?(F.parent.children.pop(),F=new d(F.parent,`@${F.command}${L}`)):F.command+=L;break}case"comment":case"string":case"preamble":L==="{"?F.braces++:L==="}"?F.braces--:L==="("?F.parens++:L===")"&&F.parens--,F.raw+=L,F.braces===0&&F.parens===0&&(F=F.parent.parent);break;case"entry":{if(V(L))F.key&&(F.keyEnded=!0);else if(L===",")F=new b(F);else if(F.wrapType==="{"&&L==="}"||F.wrapType==="("&&L===")")F=F.parent.parent;else if(L==="="&&F.key&&G(F.key)){const ae=new b(F,F.key);F.fields.push(ae),F.key=void 0,F=ae.value}else{if(F.keyEnded)throw new Y(p,F,ee,O,H,"The entry key cannot contain whitespace");if(U(L))F.key=(F.key??"")+L;else throw new Y(p,F,ee,O,H,`The entry key cannot contain the character (${L})`)}break}case"field":{if(L==="}"||L===")")F.name=F.name.trim(),F=F.parent.parent.parent;else if(L==="=")F.name=F.name.trim(),F=F.value;else if(L===",")F.name=F.name.trim(),F=new b(F.parent);else if(G(L))F.name?F.name+=L:V(L)||(F.parent.fields.push(F),F.name=L);else throw new Y(p,F,ee,O,H);break}case"concat":{if(V(L))break;if(F.canConsumeValue){if(/[#=,}()[\]]/.test(L))throw new Y(p,F,ee,O,H);F.canConsumeValue=!1,L==="{"?F=new j(F):L==='"'?F=new N(F):F=new x(F,L)}else if(L===",")F=new b(F.parent.parent);else if(L==="}"||L===")")F=F.parent.parent.parent.parent;else if(L==="#")F.canConsumeValue=!0;else throw new Y(p,F,ee,O,H);break}case"literal":V(L)?F=F.parent:L===","?F=new b(F.parent.parent.parent):L==="}"?F=F.parent.parent.parent.parent.parent:L==="#"?(F=F.parent,F.canConsumeValue=!0):F.value+=L;break;case"braced":if(L==="}"&&F.depth===0){F=F.parent;break}L==="{"?F.depth++:L==="}"&&F.depth--,F.value+=L;break;case"quoted":if(L==='"'&&F.depth===0){F=F.parent;break}if(L==="{")F.depth++;else if(L==="}"&&(F.depth--,F.depth<0))throw new Y(p,F,ee,O,H);F.value+=L;break}}return E}r($,"generateAST");function V(p){return/^[ \t\n\r]*$/.test(p)}r(V,"isWhitespace");function U(p){return!/[#%{}~$,]/.test(p)}r(U,"isValidKeyCharacter");function G(p){return!/[=,{}()[\]]/.test(p)}r(G,"isValidFieldName");var Y=class extends Error{constructor(p,E,F,O,H,ee){super(`Line ${O}:${H}: Syntax Error in ${E.type} (${ee})
|
|
16
|
-
${p.slice(Math.max(0,F-20),F)}>>${p[F]}<<${p.slice(F+1,F+20)}`),this.node=E,this.line=O,this.column=H,this.hint=ee,this.name="Syntax Error",this.char=p[F]??""}static{r(this,"BibTeXSyntaxError")}};function W(p,E){return p.replace(/\s+/g," ").split(/ and /i).map(F=>{let O=F.trim();E&&(O=O.replace(/["{}]/g,""));const H=O.indexOf(",");if(H>-1)return{firstNames:O.slice(H+1).trim(),lastName:O.slice(0,H).trim()};const ee=O.lastIndexOf(" ");return{firstNames:O.slice(0,ee).trim(),lastName:O.slice(ee).trim()}})}r(W,"parseAuthors");var ue=class kd{constructor(E,F,O=[]){this.kind=E,this.parent=F,this.children=O,this.type="block",F instanceof kd?F.children.push(this):F instanceof K&&F.args.push(this)}static{r(this,"BlockNode")}},P=class{constructor(p,E=""){this.parent=p,this.text=E,this.type="text",p.children.push(this)}static{r(this,"TextNode")}},K=class{constructor(p,E="",F=[]){this.parent=p,this.command=E,this.args=F,this.type="command",p.children.push(this)}static{r(this,"CommandNode")}};function B(p){const E=new ue("root");let F=E;for(let O=0;O<p.length;O++){const H=p[O];if(!H)break;switch(F.type){case"block":{H==="\\"?F=new K(F):H==="{"?F=new ue("curly",F):(H==="}"&&F.kind==="curly"||H==="]"&&F.kind==="square")&&F.parent?F=F.parent:F=new P(F,H);break}case"text":{H==="\\"||H==="{"||H==="}"&&F.parent.kind==="curly"||H==="]"&&F.parent.kind==="square"?(F=F.parent,O--):F.text+=H;break}case"command":H==="{"?F=new ue("curly",F):H==="["?F=new ue("square",F):H==="}"&&F.parent.kind==="curly"||H==="]"&&F.parent.kind==="square"||/\s/.test(H)||F.args.length>0?(F=F.parent,O--):F.command+=H}}return E}r(B,"parseLaTeX");function S(p){return R(p)}r(S,"stringifyLaTeX");function R(p){const E=p.children.map(F=>{switch(F.type){case"block":return R(F);case"command":return he(F);case"text":return F.text}}).join("");switch(p.kind){case"root":return E;case"curly":return`{${E}}`;case"square":return`[${E}]`}}r(R,"stringifyBlock");function he(p){return`\\${p.command}${p.args.map(R).join("")}`}r(he,"stringifyCommand");function be(p){const E={...p,children:[]};for(const F of p.children)if(F.type==="block"&&F.kind==="curly"&&F.children.every(O=>O.type!=="command")){const O=be(F);E.children.push(...O.children)}else E.children.push(F);return E}r(be,"flattenLaTeX");var Fe=new Map([["0023","\\#"],["0024","\\$"],["0025","\\%"],["0026","\\&"],["0027","'"],["0040","\\@"],["002a","\\textasteriskcentered"],["005f","\\_"],["007c","\\vert{}"],["00a0","~"],["00a1","\\textexclamdown{}"],["00a2","\\textcent{}"],["00a3","\\textsterling{}"],["00a4","\\textcurrency{}"],["00a5","\\textyen{}"],["00a6","\\textbrokenbar{}"],["00a7","\\textsection{}"],["00a8","\\textasciidieresis{}"],["00a9","\\textcopyright{}"],["00aa","\\textordfeminine{}"],["00ab","\\guillemotleft{}"],["00ac","\\lnot{}"],["00ad","\\-"],["00ae","\\textregistered{}"],["00af","\\textasciimacron{}"],["00b0","\\textdegree{}"],["00b1","\\pm{}"],["00b2","\\ensuremath{^2}"],["00b3","\\ensuremath{^3}"],["00b4","\\textasciiacute{}"],["00b5","\\mathrm{\\mu}"],["00b6","\\textparagraph{}"],["00b7","\\cdot{}"],["00b8","\\c{}"],["00b9","\\ensuremath{^1}"],["00ba","\\textordmasculine{}"],["00bb","\\guillemotright{}"],["00bc","\\textonequarter{}"],["00bd","\\textonehalf{}"],["00be","\\textthreequarters{}"],["00bf","\\textquestiondown{}"],["00c0","\\`{A}"],["00c1","\\'{A}"],["00c2","\\^{A}"],["00c3","\\~{A}"],["00c4",'\\"{A}'],["00c5","\\AA{}"],["00c6","\\AE{}"],["00c7","\\c{C}"],["00c8","\\`{E}"],["00c9","\\'{E}"],["00ca","\\^{E}"],["00cb",'\\"{E}'],["00cc","\\`{I}"],["00cd","\\'{I}"],["00ce","\\^{I}"],["00cf",'\\"{I}'],["00d0","\\DH{}"],["00d1","\\~{N}"],["00d2","\\`{O}"],["00d3","\\'{O}"],["00d4","\\^{O}"],["00d5","\\~{O}"],["00d6",'\\"{O}'],["00d7","\\texttimes{}"],["00d8","\\O{}"],["00d9","\\`{U}"],["00da","\\'{U}"],["00db","\\^{U}"],["00dc",'\\"{U}'],["00dd","\\'{Y}"],["00de","\\TH{}"],["00df","\\ss{}"],["00e0","\\`{a}"],["00e1","\\'{a}"],["00e2","\\^{a}"],["00e3","\\~{a}"],["00e4",'\\"{a}'],["00e5","\\aa{}"],["00e6","\\ae{}"],["00e7","\\c{c}"],["00e8","\\`{e}"],["00e9","\\'{e}"],["00ea","\\^{e}"],["00eb",'\\"{e}'],["00ec","\\`{\\i}"],["00ed","\\'{\\i}"],["00ee","\\^{\\i}"],["00ef",'\\"{\\i}'],["00f0","\\dh{}"],["00f1","\\~{n}"],["00f2","\\`{o}"],["00f3","\\'{o}"],["00f4","\\^{o}"],["00f5","\\~{o}"],["00f6",'\\"{o}'],["00f7","\\div{}"],["00f8","\\o{}"],["00f9","\\`{u}"],["00fa","\\'{u}"],["00fb","\\^{u}"],["00fc",'\\"{u}'],["00fd","\\'{y}"],["00fe","\\th{}"],["00ff",'\\"{y}'],["0100","\\={A}"],["0101","\\={a}"],["0102","\\u{A}"],["0103","\\u{a}"],["0104","\\k{A}"],["0105","\\k{a}"],["0106","\\'{C}"],["0107","\\'{c}"],["0108","\\^{C}"],["0109","\\^{c}"],["010a","\\.{C}"],["010b","\\.{c}"],["010c","\\v{C}"],["010d","\\v{c}"],["010e","\\v{D}"],["010f","\\v{d}"],["0110","\\DJ{}"],["0111","\\dj{}"],["0112","\\={E}"],["0113","\\={e}"],["0114","\\u{E}"],["0115","\\u{e}"],["0116","\\.{E}"],["0117","\\.{e}"],["0118","\\k{E}"],["0119","\\k{e}"],["011a","\\v{E}"],["011b","\\v{e}"],["011c","\\^{G}"],["011d","\\^{g}"],["011e","\\u{G}"],["011f","\\u{g}"],["0120","\\.{G}"],["0121","\\.{g}"],["0122","\\c{G}"],["0123","\\c{g}"],["0124","\\^{H}"],["0125","\\^{h}"],["0126","{\\fontencoding{LELA}\\selectfont\\char40}"],["0127","\\Elzxh{}"],["0128","\\~{I}"],["0129","\\~{\\i}"],["012a","\\={I}"],["012b","\\={\\i}"],["012c","\\u{I}"],["012d","\\u{\\i}"],["012e","\\k{I}"],["012f","\\k{i}"],["0130","\\.{I}"],["0131","\\i{}"],["0132","IJ"],["0133","ij"],["0134","\\^{J}"],["0135","\\^{\\j}"],["0136","\\c{K}"],["0137","\\c{k}"],["0138","{\\fontencoding{LELA}\\selectfont\\char91}"],["0139","\\'{L}"],["013a","\\'{l}"],["013b","\\c{L}"],["013c","\\c{l}"],["013d","\\v{L}"],["013e","\\v{l}"],["013f","{\\fontencoding{LELA}\\selectfont\\char201}"],["0140","{\\fontencoding{LELA}\\selectfont\\char202}"],["0141","\\L{}"],["0142","\\l{}"],["0143","\\'{N}"],["0144","\\'{n}"],["0145","\\c{N}"],["0146","\\c{n}"],["0147","\\v{N}"],["0148","\\v{n}"],["0149","'n"],["014a","\\NG{}"],["014b","\\ng{}"],["014c","\\={O}"],["014d","\\={o}"],["014e","\\u{O}"],["014f","\\u{o}"],["0150","\\H{O}"],["0151","\\H{o}"],["0152","\\OE{}"],["0153","\\oe{}"],["0154","\\'{R}"],["0155","\\'{r}"],["0156","\\c{R}"],["0157","\\c{r}"],["0158","\\v{R}"],["0159","\\v{r}"],["015a","\\'{S}"],["015b","\\'{s}"],["015c","\\^{S}"],["015d","\\^{s}"],["015e","\\c{S}"],["015f","\\c{s}"],["0160","\\v{S}"],["0161","\\v{s}"],["0162","\\c{T}"],["0163","\\c{t}"],["0164","\\v{T}"],["0165","\\v{t}"],["0166","{\\fontencoding{LELA}\\selectfont\\char47}"],["0167","{\\fontencoding{LELA}\\selectfont\\char63}"],["0168","\\~{U}"],["0169","\\~{u}"],["016a","\\={U}"],["016b","\\={u}"],["016c","\\u{U}"],["016d","\\u{u}"],["016e","\\r{U}"],["016f","\\r{u}"],["0170","\\H{U}"],["0171","\\H{u}"],["0172","\\k{U}"],["0173","\\k{u}"],["0174","\\^{W}"],["0175","\\^{w}"],["0176","\\^{Y}"],["0177","\\^{y}"],["0178",'\\"{Y}'],["0179","\\'{Z}"],["017a","\\'{z}"],["017b","\\.{Z}"],["017c","\\.{z}"],["017d","\\v{Z}"],["017e","\\v{z}"],["0195","\\texthvlig{}"],["019e","\\textnrleg{}"],["01aa","\\eth{}"],["01ba","{\\fontencoding{LELA}\\selectfont\\char195}"],["01c2","\\textdoublepipe{}"],["01f5","\\'{g}"],["0250","\\Elztrna{}"],["0252","\\Elztrnsa{}"],["0254","\\Elzopeno{}"],["0256","\\Elzrtld{}"],["0258","{\\fontencoding{LEIP}\\selectfont\\char61}"],["0259","\\Elzschwa{}"],["025b","\\varepsilon{}"],["0263","\\Elzpgamma{}"],["0264","\\Elzpbgam{}"],["0265","\\Elztrnh{}"],["026c","\\Elzbtdl{}"],["026d","\\Elzrtll{}"],["026f","\\Elztrnm{}"],["0270","\\Elztrnmlr{}"],["0271","\\Elzltlmr{}"],["0272","\\Elzltln{}"],["0273","\\Elzrtln{}"],["0277","\\Elzclomeg{}"],["0278","\\textphi{}"],["0279","\\Elztrnr{}"],["027a","\\Elztrnrl{}"],["027b","\\Elzrttrnr{}"],["027c","\\Elzrl{}"],["027d","\\Elzrtlr{}"],["027e","\\Elzfhr{}"],["027f","{\\fontencoding{LEIP}\\selectfont\\char202}"],["0282","\\Elzrtls{}"],["0283","\\Elzesh{}"],["0287","\\Elztrnt{}"],["0288","\\Elzrtlt{}"],["028a","\\Elzpupsil{}"],["028b","\\Elzpscrv{}"],["028c","\\Elzinvv{}"],["028d","\\Elzinvw{}"],["028e","\\Elztrny{}"],["0290","\\Elzrtlz{}"],["0292","\\Elzyogh{}"],["0294","\\Elzglst{}"],["0295","\\Elzreglst{}"],["0296","\\Elzinglst{}"],["029e","\\textturnk{}"],["02a4","\\Elzdyogh{}"],["02a7","\\Elztesh{}"],["02c7","\\textasciicaron{}"],["02c8","\\Elzverts{}"],["02cc","\\Elzverti{}"],["02d0","\\Elzlmrk{}"],["02d1","\\Elzhlmrk{}"],["02d2","\\Elzsbrhr{}"],["02d3","\\Elzsblhr{}"],["02d4","\\Elzrais{}"],["02d5","\\Elzlow{}"],["02d8","\\textasciibreve{}"],["02d9","\\textperiodcentered{}"],["02da","\\r{}"],["02db","\\k{}"],["02dc","\\texttildelow{}"],["02dd","\\H{}"],["02e5","\\tone{55}"],["02e6","\\tone{44}"],["02e7","\\tone{33}"],["02e8","\\tone{22}"],["02e9","\\tone{11}"],["0300","\\`"],["0301","\\'"],["0302","\\^"],["0303","\\~"],["0304","\\="],["0306","\\u"],["0307","\\."],["0308",'\\"'],["030a","\\r"],["030b","\\H"],["030c","\\v"],["030f","\\cyrchar\\C"],["0311","{\\fontencoding{LECO}\\selectfont\\char177}"],["0318","{\\fontencoding{LECO}\\selectfont\\char184}"],["0319","{\\fontencoding{LECO}\\selectfont\\char185}"],["0321","\\Elzpalh{}"],["0322","\\Elzrh{}"],["0327","\\c"],["0328","\\k"],["032a","\\Elzsbbrg{}"],["032b","{\\fontencoding{LECO}\\selectfont\\char203}"],["032f","{\\fontencoding{LECO}\\selectfont\\char207}"],["0335","\\Elzxl{}"],["0336","\\Elzbar{}"],["0337","{\\fontencoding{LECO}\\selectfont\\char215}"],["0338","{\\fontencoding{LECO}\\selectfont\\char216}"],["033a","{\\fontencoding{LECO}\\selectfont\\char218}"],["033b","{\\fontencoding{LECO}\\selectfont\\char219}"],["033c","{\\fontencoding{LECO}\\selectfont\\char220}"],["033d","{\\fontencoding{LECO}\\selectfont\\char221}"],["0361","{\\fontencoding{LECO}\\selectfont\\char225}"],["0386","\\'{A}"],["0388","\\'{E}"],["0389","\\'{H}"],["038a","\\'{}{I}"],["038c","\\'{}O"],["038e","\\mathrm{'Y}"],["038f","\\mathrm{'\\Omega}"],["0390","\\acute{\\ddot{\\iota}}"],["0391","\\ensuremath{\\Alpha}"],["0392","\\ensuremath{\\Beta}"],["0393","\\ensuremath{\\Gamma}"],["0394","\\ensuremath{\\Delta}"],["0395","\\ensuremath{\\Epsilon}"],["0396","\\ensuremath{\\Zeta}"],["0397","\\ensuremath{\\Eta}"],["0398","\\ensuremath{\\Theta}"],["0399","\\ensuremath{\\Iota}"],["039a","\\ensuremath{\\Kappa}"],["039b","\\ensuremath{\\Lambda}"],["039e","\\ensuremath{\\Xi}"],["03a0","\\ensuremath{\\Pi}"],["03a1","\\ensuremath{\\Rho}"],["03a3","\\ensuremath{\\Sigma}"],["03a4","\\ensuremath{\\Tau}"],["03a5","\\ensuremath{\\Upsilon}"],["03a6","\\ensuremath{\\Phi}"],["03a7","\\ensuremath{\\Chi}"],["03a8","\\ensuremath{\\Psi}"],["03a9","\\ensuremath{\\Omega}"],["03aa","\\mathrm{\\ddot{I}}"],["03ab","\\mathrm{\\ddot{Y}}"],["03ac","\\'{$\\alpha$}"],["03ad","\\acute{\\epsilon}"],["03ae","\\acute{\\eta}"],["03af","\\acute{\\iota}"],["03b0","\\acute{\\ddot{\\upsilon}}"],["03b1","\\ensuremath{\\alpha}"],["03b2","\\ensuremath{\\beta}"],["03b3","\\ensuremath{\\gamma}"],["03b4","\\ensuremath{\\delta}"],["03b5","\\ensuremath{\\epsilon}"],["03b6","\\ensuremath{\\zeta}"],["03b7","\\ensuremath{\\eta}"],["03b8","\\texttheta{}"],["03b9","\\ensuremath{\\iota}"],["03ba","\\ensuremath{\\kappa}"],["03bb","\\ensuremath{\\lambda}"],["03bc","\\ensuremath{\\mu}"],["03bd","\\ensuremath{\\nu}"],["03be","\\ensuremath{\\xi}"],["03c0","\\ensuremath{\\pi}"],["03c1","\\ensuremath{\\rho}"],["03c2","\\ensuremath{\\varsigma}"],["03c3","\\ensuremath{\\sigma}"],["03c4","\\ensuremath{\\tau}"],["03c5","\\ensuremath{\\upsilon}"],["03c6","\\ensuremath{\\varphi}"],["03c7","\\ensuremath{\\chi}"],["03c8","\\ensuremath{\\psi}"],["03c9","\\ensuremath{\\omega}"],["03ca","\\ensuremath{\\ddot{\\iota}}"],["03cb","\\ensuremath{\\ddot{\\upsilon}}"],["03cc","\\'{o}"],["03cd","\\acute{\\upsilon}"],["03ce","\\acute{\\omega}"],["03d0","\\Pisymbol{ppi022}{87}"],["03d1","\\textvartheta{}"],["03d2","\\ensuremath{\\Upsilon}"],["03d5","\\ensuremath{\\phi}"],["03d6","\\ensuremath{\\varpi}"],["03da","\\Stigma{}"],["03dc","\\Digamma{}"],["03dd","\\digamma{}"],["03de","\\Koppa{}"],["03e0","\\Sampi{}"],["03f0","\\varkappa{}"],["03f1","\\varrho{}"],["03f4","\\textTheta{}"],["03f6","\\backepsilon{}"],["0401","\\cyrchar\\CYRYO{}"],["0402","\\cyrchar\\CYRDJE{}"],["0403","\\cyrchar{\\'\\CYRG}"],["0404","\\cyrchar\\CYRIE{}"],["0405","\\cyrchar\\CYRDZE{}"],["0406","\\cyrchar\\CYRII{}"],["0407","\\cyrchar\\CYRYI{}"],["0408","\\cyrchar\\CYRJE{}"],["0409","\\cyrchar\\CYRLJE{}"],["040a","\\cyrchar\\CYRNJE{}"],["040b","\\cyrchar\\CYRTSHE{}"],["040c","\\cyrchar{\\'\\CYRK}"],["040e","\\cyrchar\\CYRUSHRT{}"],["040f","\\cyrchar\\CYRDZHE{}"],["0410","\\cyrchar\\CYRA{}"],["0411","\\cyrchar\\CYRB{}"],["0412","\\cyrchar\\CYRV{}"],["0413","\\cyrchar\\CYRG{}"],["0414","\\cyrchar\\CYRD{}"],["0415","\\cyrchar\\CYRE{}"],["0416","\\cyrchar\\CYRZH{}"],["0417","\\cyrchar\\CYRZ{}"],["0418","\\cyrchar\\CYRI{}"],["0419","\\cyrchar\\CYRISHRT{}"],["041a","\\cyrchar\\CYRK{}"],["041b","\\cyrchar\\CYRL{}"],["041c","\\cyrchar\\CYRM{}"],["041d","\\cyrchar\\CYRN{}"],["041e","\\cyrchar\\CYRO{}"],["041f","\\cyrchar\\CYRP{}"],["0420","\\cyrchar\\CYRR{}"],["0421","\\cyrchar\\CYRS{}"],["0422","\\cyrchar\\CYRT{}"],["0423","\\cyrchar\\CYRU{}"],["0424","\\cyrchar\\CYRF{}"],["0425","\\cyrchar\\CYRH{}"],["0426","\\cyrchar\\CYRC{}"],["0427","\\cyrchar\\CYRCH{}"],["0428","\\cyrchar\\CYRSH{}"],["0429","\\cyrchar\\CYRSHCH{}"],["042a","\\cyrchar\\CYRHRDSN{}"],["042b","\\cyrchar\\CYRERY{}"],["042c","\\cyrchar\\CYRSFTSN{}"],["042d","\\cyrchar\\CYREREV{}"],["042e","\\cyrchar\\CYRYU{}"],["042f","\\cyrchar\\CYRYA{}"],["0430","\\cyrchar\\cyra{}"],["0431","\\cyrchar\\cyrb{}"],["0432","\\cyrchar\\cyrv{}"],["0433","\\cyrchar\\cyrg{}"],["0434","\\cyrchar\\cyrd{}"],["0435","\\cyrchar\\cyre{}"],["0436","\\cyrchar\\cyrzh{}"],["0437","\\cyrchar\\cyrz{}"],["0438","\\cyrchar\\cyri{}"],["0439","\\cyrchar\\cyrishrt{}"],["043a","\\cyrchar\\cyrk{}"],["043b","\\cyrchar\\cyrl{}"],["043c","\\cyrchar\\cyrm{}"],["043d","\\cyrchar\\cyrn{}"],["043e","\\cyrchar\\cyro{}"],["043f","\\cyrchar\\cyrp{}"],["0440","\\cyrchar\\cyrr{}"],["0441","\\cyrchar\\cyrs{}"],["0442","\\cyrchar\\cyrt{}"],["0443","\\cyrchar\\cyru{}"],["0444","\\cyrchar\\cyrf{}"],["0445","\\cyrchar\\cyrh{}"],["0446","\\cyrchar\\cyrc{}"],["0447","\\cyrchar\\cyrch{}"],["0448","\\cyrchar\\cyrsh{}"],["0449","\\cyrchar\\cyrshch{}"],["044a","\\cyrchar\\cyrhrdsn{}"],["044b","\\cyrchar\\cyrery{}"],["044c","\\cyrchar\\cyrsftsn{}"],["044d","\\cyrchar\\cyrerev{}"],["044e","\\cyrchar\\cyryu{}"],["044f","\\cyrchar\\cyrya{}"],["0451","\\cyrchar\\cyryo{}"],["0452","\\cyrchar\\cyrdje{}"],["0453","\\cyrchar{\\'\\cyrg}"],["0454","\\cyrchar\\cyrie{}"],["0455","\\cyrchar\\cyrdze{}"],["0456","\\cyrchar\\cyrii{}"],["0457","\\cyrchar\\cyryi{}"],["0458","\\cyrchar\\cyrje{}"],["0459","\\cyrchar\\cyrlje{}"],["045a","\\cyrchar\\cyrnje{}"],["045b","\\cyrchar\\cyrtshe{}"],["045c","\\cyrchar{\\'\\cyrk}"],["045e","\\cyrchar\\cyrushrt{}"],["045f","\\cyrchar\\cyrdzhe{}"],["0460","\\cyrchar\\CYROMEGA{}"],["0461","\\cyrchar\\cyromega{}"],["0462","\\cyrchar\\CYRYAT{}"],["0464","\\cyrchar\\CYRIOTE{}"],["0465","\\cyrchar\\cyriote{}"],["0466","\\cyrchar\\CYRLYUS{}"],["0467","\\cyrchar\\cyrlyus{}"],["0468","\\cyrchar\\CYRIOTLYUS{}"],["0469","\\cyrchar\\cyriotlyus{}"],["046a","\\cyrchar\\CYRBYUS{}"],["046c","\\cyrchar\\CYRIOTBYUS{}"],["046d","\\cyrchar\\cyriotbyus{}"],["046e","\\cyrchar\\CYRKSI{}"],["046f","\\cyrchar\\cyrksi{}"],["0470","\\cyrchar\\CYRPSI{}"],["0471","\\cyrchar\\cyrpsi{}"],["0472","\\cyrchar\\CYRFITA{}"],["0474","\\cyrchar\\CYRIZH{}"],["0478","\\cyrchar\\CYRUK{}"],["0479","\\cyrchar\\cyruk{}"],["047a","\\cyrchar\\CYROMEGARND{}"],["047b","\\cyrchar\\cyromegarnd{}"],["047c","\\cyrchar\\CYROMEGATITLO{}"],["047d","\\cyrchar\\cyromegatitlo{}"],["047e","\\cyrchar\\CYROT{}"],["047f","\\cyrchar\\cyrot{}"],["0480","\\cyrchar\\CYRKOPPA{}"],["0481","\\cyrchar\\cyrkoppa{}"],["0482","\\cyrchar\\cyrthousands{}"],["0488","\\cyrchar\\cyrhundredthousands{}"],["0489","\\cyrchar\\cyrmillions{}"],["048c","\\cyrchar\\CYRSEMISFTSN{}"],["048d","\\cyrchar\\cyrsemisftsn{}"],["048e","\\cyrchar\\CYRRTICK{}"],["048f","\\cyrchar\\cyrrtick{}"],["0490","\\cyrchar\\CYRGUP{}"],["0491","\\cyrchar\\cyrgup{}"],["0492","\\cyrchar\\CYRGHCRS{}"],["0493","\\cyrchar\\cyrghcrs{}"],["0494","\\cyrchar\\CYRGHK{}"],["0495","\\cyrchar\\cyrghk{}"],["0496","\\cyrchar\\CYRZHDSC{}"],["0497","\\cyrchar\\cyrzhdsc{}"],["0498","\\cyrchar\\CYRZDSC{}"],["0499","\\cyrchar\\cyrzdsc{}"],["049a","\\cyrchar\\CYRKDSC{}"],["049b","\\cyrchar\\cyrkdsc{}"],["049c","\\cyrchar\\CYRKVCRS{}"],["049d","\\cyrchar\\cyrkvcrs{}"],["049e","\\cyrchar\\CYRKHCRS{}"],["049f","\\cyrchar\\cyrkhcrs{}"],["04a0","\\cyrchar\\CYRKBEAK{}"],["04a1","\\cyrchar\\cyrkbeak{}"],["04a2","\\cyrchar\\CYRNDSC{}"],["04a3","\\cyrchar\\cyrndsc{}"],["04a4","\\cyrchar\\CYRNG{}"],["04a5","\\cyrchar\\cyrng{}"],["04a6","\\cyrchar\\CYRPHK{}"],["04a7","\\cyrchar\\cyrphk{}"],["04a8","\\cyrchar\\CYRABHHA{}"],["04a9","\\cyrchar\\cyrabhha{}"],["04aa","\\cyrchar\\CYRSDSC{}"],["04ab","\\cyrchar\\cyrsdsc{}"],["04ac","\\cyrchar\\CYRTDSC{}"],["04ad","\\cyrchar\\cyrtdsc{}"],["04ae","\\cyrchar\\CYRY{}"],["04af","\\cyrchar\\cyry{}"],["04b0","\\cyrchar\\CYRYHCRS{}"],["04b1","\\cyrchar\\cyryhcrs{}"],["04b2","\\cyrchar\\CYRHDSC{}"],["04b3","\\cyrchar\\cyrhdsc{}"],["04b4","\\cyrchar\\CYRTETSE{}"],["04b5","\\cyrchar\\cyrtetse{}"],["04b6","\\cyrchar\\CYRCHRDSC{}"],["04b7","\\cyrchar\\cyrchrdsc{}"],["04b8","\\cyrchar\\CYRCHVCRS{}"],["04b9","\\cyrchar\\cyrchvcrs{}"],["04ba","\\cyrchar\\CYRSHHA{}"],["04bb","\\cyrchar\\cyrshha{}"],["04bc","\\cyrchar\\CYRABHCH{}"],["04bd","\\cyrchar\\cyrabhch{}"],["04be","\\cyrchar\\CYRABHCHDSC{}"],["04bf","\\cyrchar\\cyrabhchdsc{}"],["04c0","\\cyrchar\\CYRpalochka{}"],["04c3","\\cyrchar\\CYRKHK{}"],["04c4","\\cyrchar\\cyrkhk{}"],["04c7","\\cyrchar\\CYRNHK{}"],["04c8","\\cyrchar\\cyrnhk{}"],["04cb","\\cyrchar\\CYRCHLDSC{}"],["04cc","\\cyrchar\\cyrchldsc{}"],["04d4","\\cyrchar\\CYRAE{}"],["04d5","\\cyrchar\\cyrae{}"],["04d8","\\cyrchar\\CYRSCHWA{}"],["04d9","\\cyrchar\\cyrschwa{}"],["04e0","\\cyrchar\\CYRABHDZE{}"],["04e1","\\cyrchar\\cyrabhdze{}"],["04e8","\\cyrchar\\CYROTLD{}"],["04e9","\\cyrchar\\cyrotld{}"],["2002","\\hspace{0.6em}"],["2003","\\hspace{1em}"],["2004","\\hspace{0.33em}"],["2005","\\hspace{0.25em}"],["2006","\\hspace{0.166em}"],["2007","\\hphantom{0}"],["2008","\\hphantom{,}"],["2009","\\hspace{0.167em}"],["200a","\\mkern1mu{}"],["2010","-"],["2014","--"],["2015","\\rule{1em}{1pt}"],["2016","\\Vert{}"],["2018","`"],["2019","'"],["201b","\\Elzreapos{}"],["201c","``"],["201d","''"],["201e",",,"],["2020","\\textdagger{}"],["2021","\\textdaggerdbl{}"],["2022","\\textbullet{}"],["2025",".."],["2026","\\ldots{}"],["2030","\\textperthousand{}"],["2031","\\textpertenthousand{}"],["2032","\\ensuremath{'}"],["2033","\\ensuremath{''}"],["2034","\\ensuremath{'''}"],["2035","\\backprime{}"],["2039","\\guilsinglleft{}"],["203a","\\guilsinglright{}"],["2057","''''"],["205f","\\mkern4mu{}"],["2060","\\nolinebreak{}"],["20a7","\\ensuremath{\\Elzpes}"],["20ac","\\mbox{\\texteuro}{}"],["20db","\\dddot{}"],["20dc","\\ddddot{}"],["2102","\\mathbb{C}"],["210a","\\mathscr{g}"],["210b","\\mathscr{H}"],["210c","\\mathfrak{H}"],["210d","\\mathbb{H}"],["210f","\\hslash{}"],["2110","\\mathscr{I}"],["2111","\\mathfrak{I}"],["2112","\\mathscr{L}"],["2113","\\mathscr{l}"],["2115","\\mathbb{N}"],["2116","\\cyrchar\\textnumero{}"],["2118","\\wp{}"],["2119","\\mathbb{P}"],["211a","\\mathbb{Q}"],["211b","\\mathscr{R}"],["211c","\\mathfrak{R}"],["211d","\\mathbb{R}"],["211e","\\Elzxrat{}"],["2122","\\texttrademark{}"],["2124","\\mathbb{Z}"],["2126","\\Omega{}"],["2127","\\mho{}"],["2128","\\mathfrak{Z}"],["2129","\\ElsevierGlyph{2129}"],["212b","\\AA{}"],["212c","\\mathscr{B}"],["212d","\\mathfrak{C}"],["212f","\\mathscr{e}"],["2130","\\mathscr{E}"],["2131","\\mathscr{F}"],["2133","\\mathscr{M}"],["2134","\\mathscr{o}"],["2135","\\aleph{}"],["2136","\\beth{}"],["2137","\\gimel{}"],["2138","\\daleth{}"],["2153","\\textfrac{1}{3}"],["2154","\\textfrac{2}{3}"],["2155","\\textfrac{1}{5}"],["2156","\\textfrac{2}{5}"],["2157","\\textfrac{3}{5}"],["2158","\\textfrac{4}{5}"],["2159","\\textfrac{1}{6}"],["215a","\\textfrac{5}{6}"],["215b","\\textfrac{1}{8}"],["215c","\\textfrac{3}{8}"],["215d","\\textfrac{5}{8}"],["215e","\\textfrac{7}{8}"],["2190","\\leftarrow{}"],["2191","\\uparrow{}"],["2192","\\rightarrow{}"],["2193","\\downarrow{}"],["2194","\\leftrightarrow{}"],["2195","\\updownarrow{}"],["2196","\\nwarrow{}"],["2197","\\nearrow{}"],["2198","\\searrow{}"],["2199","\\swarrow{}"],["219a","\\nleftarrow{}"],["219b","\\nrightarrow{}"],["219c","\\arrowwaveright{}"],["219d","\\arrowwaveright{}"],["219e","\\twoheadleftarrow{}"],["21a0","\\twoheadrightarrow{}"],["21a2","\\leftarrowtail{}"],["21a3","\\rightarrowtail{}"],["21a6","\\mapsto{}"],["21a9","\\hookleftarrow{}"],["21aa","\\hookrightarrow{}"],["21ab","\\looparrowleft{}"],["21ac","\\looparrowright{}"],["21ad","\\leftrightsquigarrow{}"],["21ae","\\nleftrightarrow{}"],["21b0","\\Lsh{}"],["21b1","\\Rsh{}"],["21b3","\\ElsevierGlyph{21B3}"],["21b6","\\curvearrowleft{}"],["21b7","\\curvearrowright{}"],["21ba","\\circlearrowleft{}"],["21bb","\\circlearrowright{}"],["21bc","\\leftharpoonup{}"],["21bd","\\leftharpoondown{}"],["21be","\\upharpoonright{}"],["21bf","\\upharpoonleft{}"],["21c0","\\rightharpoonup{}"],["21c1","\\rightharpoondown{}"],["21c2","\\downharpoonright{}"],["21c3","\\downharpoonleft{}"],["21c4","\\rightleftarrows{}"],["21c5","\\dblarrowupdown{}"],["21c6","\\leftrightarrows{}"],["21c7","\\leftleftarrows{}"],["21c8","\\upuparrows{}"],["21c9","\\rightrightarrows{}"],["21ca","\\downdownarrows{}"],["21cb","\\leftrightharpoons{}"],["21cc","\\rightleftharpoons{}"],["21cd","\\nLeftarrow{}"],["21ce","\\nLeftrightarrow{}"],["21cf","\\nRightarrow{}"],["21d0","\\Leftarrow{}"],["21d1","\\Uparrow{}"],["21d2","\\Rightarrow{}"],["21d3","\\Downarrow{}"],["21d4","\\Leftrightarrow{}"],["21d5","\\Updownarrow{}"],["21da","\\Lleftarrow{}"],["21db","\\Rrightarrow{}"],["21dd","\\rightsquigarrow{}"],["21f5","\\DownArrowUpArrow{}"],["2200","\\forall{}"],["2201","\\complement{}"],["2202","\\partial{}"],["2203","\\exists{}"],["2204","\\nexists{}"],["2205","\\varnothing{}"],["2207","\\nabla{}"],["2208","\\in{}"],["2209","\\not\\in{}"],["220b","\\ni{}"],["220c","\\not\\ni{}"],["220f","\\prod{}"],["2210","\\coprod{}"],["2211","\\sum{}"],["2212","-"],["2213","\\mp{}"],["2214","\\dotplus{}"],["2216","\\setminus{}"],["2217","{\\_\\ast}"],["2218","\\circ{}"],["2219","\\bullet{}"],["221a","\\surd{}"],["221d","\\propto{}"],["221e","\\infty{}"],["221f","\\rightangle{}"],["2220","\\angle{}"],["2221","\\measuredangle{}"],["2222","\\sphericalangle{}"],["2223","\\mid{}"],["2224","\\nmid{}"],["2225","\\parallel{}"],["2226","\\nparallel{}"],["2227","\\wedge{}"],["2228","\\vee{}"],["2229","\\cap{}"],["222a","\\cup{}"],["222b","\\int{}"],["222c","\\int\\!\\int{}"],["222d","\\int\\!\\int\\!\\int{}"],["222e","\\oint{}"],["222f","\\surfintegral{}"],["2230","\\volintegral{}"],["2231","\\clwintegral{}"],["2232","\\ElsevierGlyph{2232}"],["2233","\\ElsevierGlyph{2233}"],["2234","\\therefore{}"],["2235","\\because{}"],["2237","\\Colon{}"],["2238","\\ElsevierGlyph{2238}"],["223a","\\mathbin{{:}\\!\\!{-}\\!\\!{:}}"],["223b","\\homothetic{}"],["223c","\\sim{}"],["223d","\\backsim{}"],["223e","\\lazysinv{}"],["2240","\\wr{}"],["2241","\\not\\sim{}"],["2242","\\ElsevierGlyph{2242}"],["2243","\\simeq{}"],["2244","\\not\\simeq{}"],["2245","\\cong{}"],["2246","\\approxnotequal{}"],["2247","\\not\\cong{}"],["2248","\\approx{}"],["2249","\\not\\approx{}"],["224a","\\approxeq{}"],["224b","\\tildetrpl{}"],["224c","\\allequal{}"],["224d","\\asymp{}"],["224e","\\Bumpeq{}"],["224f","\\bumpeq{}"],["2250","\\doteq{}"],["2251","\\doteqdot{}"],["2252","\\fallingdotseq{}"],["2253","\\risingdotseq{}"],["2254",":="],["2255","=:"],["2256","\\eqcirc{}"],["2257","\\circeq{}"],["2259","\\estimates{}"],["225a","\\ElsevierGlyph{225A}"],["225b","\\starequal{}"],["225c","\\triangleq{}"],["225f","\\ElsevierGlyph{225F}"],["2260","\\not ="],["2261","\\equiv{}"],["2262","\\not\\equiv{}"],["2264","\\leq{}"],["2265","\\geq{}"],["2266","\\leqq{}"],["2267","\\geqq{}"],["2268","\\lneqq{}"],["2269","\\gneqq{}"],["226a","\\ll{}"],["226b","\\gg{}"],["226c","\\between{}"],["226d","\\not\\kern-0.3em\\times{}"],["226e","\\not<"],["226f","\\not>"],["2270","\\not\\leq{}"],["2271","\\not\\geq{}"],["2272","\\lessequivlnt{}"],["2273","\\greaterequivlnt{}"],["2274","\\ElsevierGlyph{2274}"],["2275","\\ElsevierGlyph{2275}"],["2276","\\lessgtr{}"],["2277","\\gtrless{}"],["2278","\\notlessgreater{}"],["2279","\\notgreaterless{}"],["227a","\\prec{}"],["227b","\\succ{}"],["227c","\\preccurlyeq{}"],["227d","\\succcurlyeq{}"],["227e","\\precapprox{}"],["227f","\\succapprox{}"],["2280","\\not\\prec{}"],["2281","\\not\\succ{}"],["2282","\\subset{}"],["2283","\\supset{}"],["2284","\\not\\subset{}"],["2285","\\not\\supset{}"],["2286","\\subseteq{}"],["2287","\\supseteq{}"],["2288","\\not\\subseteq{}"],["2289","\\not\\supseteq{}"],["228a","\\subsetneq{}"],["228b","\\supsetneq{}"],["228e","\\uplus{}"],["228f","\\sqsubset{}"],["2290","\\sqsupset{}"],["2291","\\sqsubseteq{}"],["2292","\\sqsupseteq{}"],["2293","\\sqcap{}"],["2294","\\sqcup{}"],["2295","\\oplus{}"],["2296","\\ominus{}"],["2297","\\otimes{}"],["2298","\\oslash{}"],["2299","\\odot{}"],["229a","\\circledcirc{}"],["229b","\\circledast{}"],["229d","\\circleddash{}"],["229e","\\boxplus{}"],["229f","\\boxminus{}"],["22a0","\\boxtimes{}"],["22a1","\\boxdot{}"],["22a2","\\vdash{}"],["22a3","\\dashv{}"],["22a4","\\top{}"],["22a5","\\perp{}"],["22a7","\\truestate{}"],["22a8","\\forcesextra{}"],["22a9","\\Vdash{}"],["22aa","\\Vvdash{}"],["22ab","\\VDash{}"],["22ac","\\nvdash{}"],["22ad","\\nvDash{}"],["22ae","\\nVdash{}"],["22af","\\nVDash{}"],["22b2","\\vartriangleleft{}"],["22b3","\\vartriangleright{}"],["22b4","\\trianglelefteq{}"],["22b5","\\trianglerighteq{}"],["22b6","\\original{}"],["22b7","\\image{}"],["22b8","\\multimap{}"],["22b9","\\hermitconjmatrix{}"],["22ba","\\intercal{}"],["22bb","\\veebar{}"],["22be","\\rightanglearc{}"],["22c0","\\ElsevierGlyph{22C0}"],["22c1","\\ElsevierGlyph{22C1}"],["22c2","\\bigcap{}"],["22c3","\\bigcup{}"],["22c4","\\diamond{}"],["22c5","\\cdot{}"],["22c6","\\star{}"],["22c7","\\divideontimes{}"],["22c8","\\bowtie{}"],["22c9","\\ltimes{}"],["22ca","\\rtimes{}"],["22cb","\\leftthreetimes{}"],["22cc","\\rightthreetimes{}"],["22cd","\\backsimeq{}"],["22ce","\\curlyvee{}"],["22cf","\\curlywedge{}"],["22d0","\\Subset{}"],["22d1","\\Supset{}"],["22d2","\\Cap{}"],["22d3","\\Cup{}"],["22d4","\\pitchfork{}"],["22d6","\\lessdot{}"],["22d7","\\gtrdot{}"],["22d8","\\verymuchless{}"],["22d9","\\verymuchgreater{}"],["22da","\\lesseqgtr{}"],["22db","\\gtreqless{}"],["22de","\\curlyeqprec{}"],["22df","\\curlyeqsucc{}"],["22e2","\\not\\sqsubseteq{}"],["22e3","\\not\\sqsupseteq{}"],["22e5","\\Elzsqspne{}"],["22e6","\\lnsim{}"],["22e7","\\gnsim{}"],["22e8","\\precedesnotsimilar{}"],["22e9","\\succnsim{}"],["22ea","\\ntriangleleft{}"],["22eb","\\ntriangleright{}"],["22ec","\\ntrianglelefteq{}"],["22ed","\\ntrianglerighteq{}"],["22ee","\\vdots{}"],["22ef","\\cdots{}"],["22f0","\\upslopeellipsis{}"],["22f1","\\downslopeellipsis{}"],["2305","\\barwedge{}"],["2306","\\perspcorrespond{}"],["2308","\\lceil{}"],["2309","\\rceil{}"],["230a","\\lfloor{}"],["230b","\\rfloor{}"],["2315","\\recorder{}"],["2316",'\\mathchar"2208'],["231c","\\ulcorner{}"],["231d","\\urcorner{}"],["231e","\\llcorner{}"],["231f","\\lrcorner{}"],["2322","\\frown{}"],["2323","\\smile{}"],["2329","\\langle{}"],["232a","\\rangle{}"],["233d","\\ElsevierGlyph{E838}"],["23a3","\\Elzdlcorn{}"],["23b0","\\lmoustache{}"],["23b1","\\rmoustache{}"],["2423","\\textvisiblespace{}"],["2460","\\ding{172}"],["2461","\\ding{173}"],["2462","\\ding{174}"],["2463","\\ding{175}"],["2464","\\ding{176}"],["2465","\\ding{177}"],["2466","\\ding{178}"],["2467","\\ding{179}"],["2468","\\ding{180}"],["2469","\\ding{181}"],["24c8","\\circledS{}"],["2506","\\Elzdshfnc{}"],["2519","\\Elzsqfnw{}"],["2571","\\diagup{}"],["25a0","\\ding{110}"],["25a1","\\square{}"],["25aa","\\blacksquare{}"],["25ad","\\fbox{~~}"],["25af","\\Elzvrecto{}"],["25b1","\\ElsevierGlyph{E381}"],["25b2","\\ding{115}"],["25b3","\\bigtriangleup{}"],["25b4","\\blacktriangle{}"],["25b5","\\vartriangle{}"],["25b8","\\blacktriangleright{}"],["25b9","\\triangleright{}"],["25bc","\\ding{116}"],["25bd","\\bigtriangledown{}"],["25be","\\blacktriangledown{}"],["25bf","\\triangledown{}"],["25c2","\\blacktriangleleft{}"],["25c3","\\triangleleft{}"],["25c6","\\ding{117}"],["25ca","\\lozenge{}"],["25cb","\\bigcirc{}"],["25cf","\\ding{108}"],["25d0","\\Elzcirfl{}"],["25d1","\\Elzcirfr{}"],["25d2","\\Elzcirfb{}"],["25d7","\\ding{119}"],["25d8","\\Elzrvbull{}"],["25e7","\\Elzsqfl{}"],["25e8","\\Elzsqfr{}"],["25ea","\\Elzsqfse{}"],["25ef","\\bigcirc{}"],["2605","\\ding{72}"],["2606","\\ding{73}"],["260e","\\ding{37}"],["261b","\\ding{42}"],["261e","\\ding{43}"],["263e","\\rightmoon{}"],["263f","\\mercury{}"],["2640","\\venus{}"],["2642","\\male{}"],["2643","\\jupiter{}"],["2644","\\saturn{}"],["2645","\\uranus{}"],["2646","\\neptune{}"],["2647","\\pluto{}"],["2648","\\aries{}"],["2649","\\taurus{}"],["264a","\\gemini{}"],["264b","\\cancer{}"],["264c","\\leo{}"],["264d","\\virgo{}"],["264e","\\libra{}"],["264f","\\scorpio{}"],["2650","\\sagittarius{}"],["2651","\\capricornus{}"],["2652","\\aquarius{}"],["2653","\\pisces{}"],["2660","\\ding{171}"],["2662","\\diamond{}"],["2663","\\ding{168}"],["2665","\\ding{170}"],["2666","\\ding{169}"],["2669","\\quarternote{}"],["266a","\\eighthnote{}"],["266d","\\flat{}"],["266e","\\natural{}"],["266f","\\sharp{}"],["2701","\\ding{33}"],["2702","\\ding{34}"],["2703","\\ding{35}"],["2704","\\ding{36}"],["2706","\\ding{38}"],["2707","\\ding{39}"],["2708","\\ding{40}"],["2709","\\ding{41}"],["270c","\\ding{44}"],["270d","\\ding{45}"],["270e","\\ding{46}"],["270f","\\ding{47}"],["2710","\\ding{48}"],["2711","\\ding{49}"],["2712","\\ding{50}"],["2713","\\ding{51}"],["2714","\\ding{52}"],["2715","\\ding{53}"],["2716","\\ding{54}"],["2717","\\ding{55}"],["2718","\\ding{56}"],["2719","\\ding{57}"],["271a","\\ding{58}"],["271b","\\ding{59}"],["271c","\\ding{60}"],["271d","\\ding{61}"],["271e","\\ding{62}"],["271f","\\ding{63}"],["2720","\\ding{64}"],["2721","\\ding{65}"],["2722","\\ding{66}"],["2723","\\ding{67}"],["2724","\\ding{68}"],["2725","\\ding{69}"],["2726","\\ding{70}"],["2727","\\ding{71}"],["2729","\\ding{73}"],["272a","\\ding{74}"],["272b","\\ding{75}"],["272c","\\ding{76}"],["272d","\\ding{77}"],["272e","\\ding{78}"],["272f","\\ding{79}"],["2730","\\ding{80}"],["2731","\\ding{81}"],["2732","\\ding{82}"],["2733","\\ding{83}"],["2734","\\ding{84}"],["2735","\\ding{85}"],["2736","\\ding{86}"],["2737","\\ding{87}"],["2738","\\ding{88}"],["2739","\\ding{89}"],["273a","\\ding{90}"],["273b","\\ding{91}"],["273c","\\ding{92}"],["273d","\\ding{93}"],["273e","\\ding{94}"],["273f","\\ding{95}"],["2740","\\ding{96}"],["2741","\\ding{97}"],["2742","\\ding{98}"],["2743","\\ding{99}"],["2744","\\ding{100}"],["2745","\\ding{101}"],["2746","\\ding{102}"],["2747","\\ding{103}"],["2748","\\ding{104}"],["2749","\\ding{105}"],["274a","\\ding{106}"],["274b","\\ding{107}"],["274d","\\ding{109}"],["274f","\\ding{111}"],["2750","\\ding{112}"],["2751","\\ding{113}"],["2752","\\ding{114}"],["2756","\\ding{118}"],["2758","\\ding{120}"],["2759","\\ding{121}"],["275a","\\ding{122}"],["275b","\\ding{123}"],["275c","\\ding{124}"],["275d","\\ding{125}"],["275e","\\ding{126}"],["2761","\\ding{161}"],["2762","\\ding{162}"],["2763","\\ding{163}"],["2764","\\ding{164}"],["2765","\\ding{165}"],["2766","\\ding{166}"],["2767","\\ding{167}"],["2776","\\ding{182}"],["2777","\\ding{183}"],["2778","\\ding{184}"],["2779","\\ding{185}"],["277a","\\ding{186}"],["277b","\\ding{187}"],["277c","\\ding{188}"],["277d","\\ding{189}"],["277e","\\ding{190}"],["277f","\\ding{191}"],["2780","\\ding{192}"],["2781","\\ding{193}"],["2782","\\ding{194}"],["2783","\\ding{195}"],["2784","\\ding{196}"],["2785","\\ding{197}"],["2786","\\ding{198}"],["2787","\\ding{199}"],["2788","\\ding{200}"],["2789","\\ding{201}"],["278a","\\ding{202}"],["278b","\\ding{203}"],["278c","\\ding{204}"],["278d","\\ding{205}"],["278e","\\ding{206}"],["278f","\\ding{207}"],["2790","\\ding{208}"],["2791","\\ding{209}"],["2792","\\ding{210}"],["2793","\\ding{211}"],["2794","\\ding{212}"],["2798","\\ding{216}"],["2799","\\ding{217}"],["279a","\\ding{218}"],["279b","\\ding{219}"],["279c","\\ding{220}"],["279d","\\ding{221}"],["279e","\\ding{222}"],["279f","\\ding{223}"],["27a0","\\ding{224}"],["27a1","\\ding{225}"],["27a2","\\ding{226}"],["27a3","\\ding{227}"],["27a4","\\ding{228}"],["27a5","\\ding{229}"],["27a6","\\ding{230}"],["27a7","\\ding{231}"],["27a8","\\ding{232}"],["27a9","\\ding{233}"],["27aa","\\ding{234}"],["27ab","\\ding{235}"],["27ac","\\ding{236}"],["27ad","\\ding{237}"],["27ae","\\ding{238}"],["27af","\\ding{239}"],["27b1","\\ding{241}"],["27b2","\\ding{242}"],["27b3","\\ding{243}"],["27b4","\\ding{244}"],["27b5","\\ding{245}"],["27b6","\\ding{246}"],["27b7","\\ding{247}"],["27b8","\\ding{248}"],["27b9","\\ding{249}"],["27ba","\\ding{250}"],["27bb","\\ding{251}"],["27bc","\\ding{252}"],["27bd","\\ding{253}"],["27be","\\ding{254}"],["27f5","\\longleftarrow{}"],["27f6","\\longrightarrow{}"],["27f7","\\longleftrightarrow{}"],["27f8","\\Longleftarrow{}"],["27f9","\\Longrightarrow{}"],["27fa","\\Longleftrightarrow{}"],["27fc","\\longmapsto{}"],["27ff","\\sim\\joinrel\\leadsto"],["2905","\\ElsevierGlyph{E212}"],["2912","\\UpArrowBar{}"],["2913","\\DownArrowBar{}"],["2923","\\ElsevierGlyph{E20C}"],["2924","\\ElsevierGlyph{E20D}"],["2925","\\ElsevierGlyph{E20B}"],["2926","\\ElsevierGlyph{E20A}"],["2927","\\ElsevierGlyph{E211}"],["2928","\\ElsevierGlyph{E20E}"],["2929","\\ElsevierGlyph{E20F}"],["292a","\\ElsevierGlyph{E210}"],["2933","\\ElsevierGlyph{E21C}"],["2936","\\ElsevierGlyph{E21A}"],["2937","\\ElsevierGlyph{E219}"],["2940","\\Elolarr{}"],["2941","\\Elorarr{}"],["2942","\\ElzRlarr{}"],["2944","\\ElzrLarr{}"],["2947","\\Elzrarrx{}"],["294e","\\LeftRightVector{}"],["294f","\\RightUpDownVector{}"],["2950","\\DownLeftRightVector{}"],["2951","\\LeftUpDownVector{}"],["2952","\\LeftVectorBar{}"],["2953","\\RightVectorBar{}"],["2954","\\RightUpVectorBar{}"],["2955","\\RightDownVectorBar{}"],["2956","\\DownLeftVectorBar{}"],["2957","\\DownRightVectorBar{}"],["2958","\\LeftUpVectorBar{}"],["2959","\\LeftDownVectorBar{}"],["295a","\\LeftTeeVector{}"],["295b","\\RightTeeVector{}"],["295c","\\RightUpTeeVector{}"],["295d","\\RightDownTeeVector{}"],["295e","\\DownLeftTeeVector{}"],["295f","\\DownRightTeeVector{}"],["2960","\\LeftUpTeeVector{}"],["2961","\\LeftDownTeeVector{}"],["296e","\\UpEquilibrium{}"],["296f","\\ReverseUpEquilibrium{}"],["2970","\\RoundImplies{}"],["297c","\\ElsevierGlyph{E214}"],["297d","\\ElsevierGlyph{E215}"],["2980","\\Elztfnc{}"],["2985","\\ElsevierGlyph{3018}"],["2986","\\Elroang{}"],["2993","<\\kern-0.58em("],["2994","\\ElsevierGlyph{E291}"],["2999","\\Elzddfnc{}"],["299c","\\Angle{}"],["29a0","\\Elzlpargt{}"],["29b5","\\ElsevierGlyph{E260}"],["29b6","\\ElsevierGlyph{E61B}"],["29ca","\\ElzLap{}"],["29cb","\\Elzdefas{}"],["29cf","\\LeftTriangleBar{}"],["29d0","\\RightTriangleBar{}"],["29dc","\\ElsevierGlyph{E372}"],["29eb","\\blacklozenge{}"],["29f4","\\RuleDelayed{}"],["2a04","\\Elxuplus{}"],["2a05","\\ElzThr{}"],["2a06","\\Elxsqcup{}"],["2a07","\\ElzInf{}"],["2a08","\\ElzSup{}"],["2a0d","\\ElzCint{}"],["2a0f","\\clockoint{}"],["2a10","\\ElsevierGlyph{E395}"],["2a16","\\sqrint{}"],["2a25","\\ElsevierGlyph{E25A}"],["2a2a","\\ElsevierGlyph{E25B}"],["2a2d","\\ElsevierGlyph{E25C}"],["2a2e","\\ElsevierGlyph{E25D}"],["2a2f","\\ElzTimes{}"],["2a34","\\ElsevierGlyph{E25E}"],["2a35","\\ElsevierGlyph{E25E}"],["2a3c","\\ElsevierGlyph{E259}"],["2a3f","\\amalg{}"],["2a53","\\ElzAnd{}"],["2a54","\\ElzOr{}"],["2a55","\\ElsevierGlyph{E36E}"],["2a56","\\ElOr{}"],["2a5e","\\perspcorrespond{}"],["2a5f","\\Elzminhat{}"],["2a63","\\ElsevierGlyph{225A}"],["2a6e","\\stackrel{*}{=}"],["2a75","\\Equal{}"],["2a7d","\\leqslant{}"],["2a7e","\\geqslant{}"],["2a85","\\lessapprox{}"],["2a86","\\gtrapprox{}"],["2a87","\\lneq{}"],["2a88","\\gneq{}"],["2a89","\\lnapprox{}"],["2a8a","\\gnapprox{}"],["2a8b","\\lesseqqgtr{}"],["2a8c","\\gtreqqless{}"],["2a95","\\eqslantless{}"],["2a96","\\eqslantgtr{}"],["2a9d","\\Pisymbol{ppi020}{117}"],["2a9e","\\Pisymbol{ppi020}{105}"],["2aa1","\\NestedLessLess{}"],["2aa2","\\NestedGreaterGreater{}"],["2aaf","\\preceq{}"],["2ab0","\\succeq{}"],["2ab5","\\precneqq{}"],["2ab6","\\succneqq{}"],["2ab7","\\precapprox{}"],["2ab8","\\succapprox{}"],["2ab9","\\precnapprox{}"],["2aba","\\succnapprox{}"],["2ac5","\\subseteqq{}"],["2ac6","\\supseteqq{}"],["2acb","\\subsetneqq{}"],["2acc","\\supsetneqq{}"],["2aeb","\\ElsevierGlyph{E30D}"],["2af6","\\Elztdcol{}"],["2afd","{{/}\\!\\!{/}}"],["300a","\\ElsevierGlyph{300A}"],["300b","\\ElsevierGlyph{300B}"],["3018","\\ElsevierGlyph{3018}"],["3019","\\ElsevierGlyph{3019}"],["301a","\\openbracketleft{}"],["301b","\\openbracketright{}"],["fb00","ff"],["fb01","fi"],["fb02","fl"],["fb03","ffi"],["fb04","ffl"],["d400","\\mathbf{A}"],["d401","\\mathbf{B}"],["d402","\\mathbf{C}"],["d403","\\mathbf{D}"],["d404","\\mathbf{E}"],["d405","\\mathbf{F}"],["d406","\\mathbf{G}"],["d407","\\mathbf{H}"],["d408","\\mathbf{I}"],["d409","\\mathbf{J}"],["d40a","\\mathbf{K}"],["d40b","\\mathbf{L}"],["d40c","\\mathbf{M}"],["d40d","\\mathbf{N}"],["d40e","\\mathbf{O}"],["d40f","\\mathbf{P}"],["d410","\\mathbf{Q}"],["d411","\\mathbf{R}"],["d412","\\mathbf{S}"],["d413","\\mathbf{T}"],["d414","\\mathbf{U}"],["d415","\\mathbf{V}"],["d416","\\mathbf{W}"],["d417","\\mathbf{X}"],["d418","\\mathbf{Y}"],["d419","\\mathbf{Z}"],["d41a","\\mathbf{a}"],["d41b","\\mathbf{b}"],["d41c","\\mathbf{c}"],["d41d","\\mathbf{d}"],["d41e","\\mathbf{e}"],["d41f","\\mathbf{f}"],["d420","\\mathbf{g}"],["d421","\\mathbf{h}"],["d422","\\mathbf{i}"],["d423","\\mathbf{j}"],["d424","\\mathbf{k}"],["d425","\\mathbf{l}"],["d426","\\mathbf{m}"],["d427","\\mathbf{n}"],["d428","\\mathbf{o}"],["d429","\\mathbf{p}"],["d42a","\\mathbf{q}"],["d42b","\\mathbf{r}"],["d42c","\\mathbf{s}"],["d42d","\\mathbf{t}"],["d42e","\\mathbf{u}"],["d42f","\\mathbf{v}"],["d430","\\mathbf{w}"],["d431","\\mathbf{x}"],["d432","\\mathbf{y}"],["d433","\\mathbf{z}"],["d434","\\mathsl{A}"],["d435","\\mathsl{B}"],["d436","\\mathsl{C}"],["d437","\\mathsl{D}"],["d438","\\mathsl{E}"],["d439","\\mathsl{F}"],["d43a","\\mathsl{G}"],["d43b","\\mathsl{H}"],["d43c","\\mathsl{I}"],["d43d","\\mathsl{J}"],["d43e","\\mathsl{K}"],["d43f","\\mathsl{L}"],["d440","\\mathsl{M}"],["d441","\\mathsl{N}"],["d442","\\mathsl{O}"],["d443","\\mathsl{P}"],["d444","\\mathsl{Q}"],["d445","\\mathsl{R}"],["d446","\\mathsl{S}"],["d447","\\mathsl{T}"],["d448","\\mathsl{U}"],["d449","\\mathsl{V}"],["d44a","\\mathsl{W}"],["d44b","\\mathsl{X}"],["d44c","\\mathsl{Y}"],["d44d","\\mathsl{Z}"],["d44e","\\mathsl{a}"],["d44f","\\mathsl{b}"],["d450","\\mathsl{c}"],["d451","\\mathsl{d}"],["d452","\\mathsl{e}"],["d453","\\mathsl{f}"],["d454","\\mathsl{g}"],["d456","\\mathsl{i}"],["d457","\\mathsl{j}"],["d458","\\mathsl{k}"],["d459","\\mathsl{l}"],["d45a","\\mathsl{m}"],["d45b","\\mathsl{n}"],["d45c","\\mathsl{o}"],["d45d","\\mathsl{p}"],["d45e","\\mathsl{q}"],["d45f","\\mathsl{r}"],["d460","\\mathsl{s}"],["d461","\\mathsl{t}"],["d462","\\mathsl{u}"],["d463","\\mathsl{v}"],["d464","\\mathsl{w}"],["d465","\\mathsl{x}"],["d466","\\mathsl{y}"],["d467","\\mathsl{z}"],["d468","\\mathbit{A}"],["d469","\\mathbit{B}"],["d46a","\\mathbit{C}"],["d46b","\\mathbit{D}"],["d46c","\\mathbit{E}"],["d46d","\\mathbit{F}"],["d46e","\\mathbit{G}"],["d46f","\\mathbit{H}"],["d470","\\mathbit{I}"],["d471","\\mathbit{J}"],["d472","\\mathbit{K}"],["d473","\\mathbit{L}"],["d474","\\mathbit{M}"],["d475","\\mathbit{N}"],["d476","\\mathbit{O}"],["d477","\\mathbit{P}"],["d478","\\mathbit{Q}"],["d479","\\mathbit{R}"],["d47a","\\mathbit{S}"],["d47b","\\mathbit{T}"],["d47c","\\mathbit{U}"],["d47d","\\mathbit{V}"],["d47e","\\mathbit{W}"],["d47f","\\mathbit{X}"],["d480","\\mathbit{Y}"],["d481","\\mathbit{Z}"],["d482","\\mathbit{a}"],["d483","\\mathbit{b}"],["d484","\\mathbit{c}"],["d485","\\mathbit{d}"],["d486","\\mathbit{e}"],["d487","\\mathbit{f}"],["d488","\\mathbit{g}"],["d489","\\mathbit{h}"],["d48a","\\mathbit{i}"],["d48b","\\mathbit{j}"],["d48c","\\mathbit{k}"],["d48d","\\mathbit{l}"],["d48e","\\mathbit{m}"],["d48f","\\mathbit{n}"],["d490","\\mathbit{o}"],["d491","\\mathbit{p}"],["d492","\\mathbit{q}"],["d493","\\mathbit{r}"],["d494","\\mathbit{s}"],["d495","\\mathbit{t}"],["d496","\\mathbit{u}"],["d497","\\mathbit{v}"],["d498","\\mathbit{w}"],["d499","\\mathbit{x}"],["d49a","\\mathbit{y}"],["d49b","\\mathbit{z}"],["d49c","\\mathscr{A}"],["d49e","\\mathscr{C}"],["d49f","\\mathscr{D}"],["d4a2","\\mathscr{G}"],["d4a5","\\mathscr{J}"],["d4a6","\\mathscr{K}"],["d4a9","\\mathscr{N}"],["d4aa","\\mathscr{O}"],["d4ab","\\mathscr{P}"],["d4ac","\\mathscr{Q}"],["d4ae","\\mathscr{S}"],["d4af","\\mathscr{T}"],["d4b0","\\mathscr{U}"],["d4b1","\\mathscr{V}"],["d4b2","\\mathscr{W}"],["d4b3","\\mathscr{X}"],["d4b4","\\mathscr{Y}"],["d4b5","\\mathscr{Z}"],["d4b6","\\mathscr{a}"],["d4b7","\\mathscr{b}"],["d4b8","\\mathscr{c}"],["d4b9","\\mathscr{d}"],["d4bb","\\mathscr{f}"],["d4bd","\\mathscr{h}"],["d4be","\\mathscr{i}"],["d4bf","\\mathscr{j}"],["d4c0","\\mathscr{k}"],["d4c1","\\mathscr{l}"],["d4c2","\\mathscr{m}"],["d4c3","\\mathscr{n}"],["d4c5","\\mathscr{p}"],["d4c6","\\mathscr{q}"],["d4c7","\\mathscr{r}"],["d4c8","\\mathscr{s}"],["d4c9","\\mathscr{t}"],["d4ca","\\mathscr{u}"],["d4cb","\\mathscr{v}"],["d4cc","\\mathscr{w}"],["d4cd","\\mathscr{x}"],["d4ce","\\mathscr{y}"],["d4cf","\\mathscr{z}"],["d4d0","\\mathmit{A}"],["d4d1","\\mathmit{B}"],["d4d2","\\mathmit{C}"],["d4d3","\\mathmit{D}"],["d4d4","\\mathmit{E}"],["d4d5","\\mathmit{F}"],["d4d6","\\mathmit{G}"],["d4d7","\\mathmit{H}"],["d4d8","\\mathmit{I}"],["d4d9","\\mathmit{J}"],["d4da","\\mathmit{K}"],["d4db","\\mathmit{L}"],["d4dc","\\mathmit{M}"],["d4dd","\\mathmit{N}"],["d4de","\\mathmit{O}"],["d4df","\\mathmit{P}"],["d4e0","\\mathmit{Q}"],["d4e1","\\mathmit{R}"],["d4e2","\\mathmit{S}"],["d4e3","\\mathmit{T}"],["d4e4","\\mathmit{U}"],["d4e5","\\mathmit{V}"],["d4e6","\\mathmit{W}"],["d4e7","\\mathmit{X}"],["d4e8","\\mathmit{Y}"],["d4e9","\\mathmit{Z}"],["d4ea","\\mathmit{a}"],["d4eb","\\mathmit{b}"],["d4ec","\\mathmit{c}"],["d4ed","\\mathmit{d}"],["d4ee","\\mathmit{e}"],["d4ef","\\mathmit{f}"],["d4f0","\\mathmit{g}"],["d4f1","\\mathmit{h}"],["d4f2","\\mathmit{i}"],["d4f3","\\mathmit{j}"],["d4f4","\\mathmit{k}"],["d4f5","\\mathmit{l}"],["d4f6","\\mathmit{m}"],["d4f7","\\mathmit{n}"],["d4f8","\\mathmit{o}"],["d4f9","\\mathmit{p}"],["d4fa","\\mathmit{q}"],["d4fb","\\mathmit{r}"],["d4fc","\\mathmit{s}"],["d4fd","\\mathmit{t}"],["d4fe","\\mathmit{u}"],["d4ff","\\mathmit{v}"],["d500","\\mathmit{w}"],["d501","\\mathmit{x}"],["d502","\\mathmit{y}"],["d503","\\mathmit{z}"],["d504","\\mathfrak{A}"],["d505","\\mathfrak{B}"],["d507","\\mathfrak{D}"],["d508","\\mathfrak{E}"],["d509","\\mathfrak{F}"],["d50a","\\mathfrak{G}"],["d50d","\\mathfrak{J}"],["d50e","\\mathfrak{K}"],["d50f","\\mathfrak{L}"],["d510","\\mathfrak{M}"],["d511","\\mathfrak{N}"],["d512","\\mathfrak{O}"],["d513","\\mathfrak{P}"],["d514","\\mathfrak{Q}"],["d516","\\mathfrak{S}"],["d517","\\mathfrak{T}"],["d518","\\mathfrak{U}"],["d519","\\mathfrak{V}"],["d51a","\\mathfrak{W}"],["d51b","\\mathfrak{X}"],["d51c","\\mathfrak{Y}"],["d51e","\\mathfrak{a}"],["d51f","\\mathfrak{b}"],["d520","\\mathfrak{c}"],["d521","\\mathfrak{d}"],["d522","\\mathfrak{e}"],["d523","\\mathfrak{f}"],["d524","\\mathfrak{g}"],["d525","\\mathfrak{h}"],["d526","\\mathfrak{i}"],["d527","\\mathfrak{j}"],["d528","\\mathfrak{k}"],["d529","\\mathfrak{l}"],["d52a","\\mathfrak{m}"],["d52b","\\mathfrak{n}"],["d52c","\\mathfrak{o}"],["d52d","\\mathfrak{p}"],["d52e","\\mathfrak{q}"],["d52f","\\mathfrak{r}"],["d530","\\mathfrak{s}"],["d531","\\mathfrak{t}"],["d532","\\mathfrak{u}"],["d533","\\mathfrak{v}"],["d534","\\mathfrak{w}"],["d535","\\mathfrak{x}"],["d536","\\mathfrak{y}"],["d537","\\mathfrak{z}"],["d538","\\mathbb{A}"],["d539","\\mathbb{B}"],["d53b","\\mathbb{D}"],["d53c","\\mathbb{E}"],["d53d","\\mathbb{F}"],["d53e","\\mathbb{G}"],["d540","\\mathbb{I}"],["d541","\\mathbb{J}"],["d542","\\mathbb{K}"],["d543","\\mathbb{L}"],["d544","\\mathbb{M}"],["d546","\\mathbb{O}"],["d54a","\\mathbb{S}"],["d54b","\\mathbb{T}"],["d54c","\\mathbb{U}"],["d54d","\\mathbb{V}"],["d54e","\\mathbb{W}"],["d54f","\\mathbb{X}"],["d550","\\mathbb{Y}"],["d552","\\mathbb{a}"],["d553","\\mathbb{b}"],["d554","\\mathbb{c}"],["d555","\\mathbb{d}"],["d556","\\mathbb{e}"],["d557","\\mathbb{f}"],["d558","\\mathbb{g}"],["d559","\\mathbb{h}"],["d55a","\\mathbb{i}"],["d55b","\\mathbb{j}"],["d55c","\\mathbb{k}"],["d55d","\\mathbb{l}"],["d55e","\\mathbb{m}"],["d55f","\\mathbb{n}"],["d560","\\mathbb{o}"],["d561","\\mathbb{p}"],["d562","\\mathbb{q}"],["d563","\\mathbb{r}"],["d564","\\mathbb{s}"],["d565","\\mathbb{t}"],["d566","\\mathbb{u}"],["d567","\\mathbb{v}"],["d568","\\mathbb{w}"],["d569","\\mathbb{x}"],["d56a","\\mathbb{y}"],["d56b","\\mathbb{z}"],["d56c","\\mathslbb{A}"],["d56d","\\mathslbb{B}"],["d56e","\\mathslbb{C}"],["d56f","\\mathslbb{D}"],["d570","\\mathslbb{E}"],["d571","\\mathslbb{F}"],["d572","\\mathslbb{G}"],["d573","\\mathslbb{H}"],["d574","\\mathslbb{I}"],["d575","\\mathslbb{J}"],["d576","\\mathslbb{K}"],["d577","\\mathslbb{L}"],["d578","\\mathslbb{M}"],["d579","\\mathslbb{N}"],["d57a","\\mathslbb{O}"],["d57b","\\mathslbb{P}"],["d57c","\\mathslbb{Q}"],["d57d","\\mathslbb{R}"],["d57e","\\mathslbb{S}"],["d57f","\\mathslbb{T}"],["d580","\\mathslbb{U}"],["d581","\\mathslbb{V}"],["d582","\\mathslbb{W}"],["d583","\\mathslbb{X}"],["d584","\\mathslbb{Y}"],["d585","\\mathslbb{Z}"],["d586","\\mathslbb{a}"],["d587","\\mathslbb{b}"],["d588","\\mathslbb{c}"],["d589","\\mathslbb{d}"],["d58a","\\mathslbb{e}"],["d58b","\\mathslbb{f}"],["d58c","\\mathslbb{g}"],["d58d","\\mathslbb{h}"],["d58e","\\mathslbb{i}"],["d58f","\\mathslbb{j}"],["d590","\\mathslbb{k}"],["d591","\\mathslbb{l}"],["d592","\\mathslbb{m}"],["d593","\\mathslbb{n}"],["d594","\\mathslbb{o}"],["d595","\\mathslbb{p}"],["d596","\\mathslbb{q}"],["d597","\\mathslbb{r}"],["d598","\\mathslbb{s}"],["d599","\\mathslbb{t}"],["d59a","\\mathslbb{u}"],["d59b","\\mathslbb{v}"],["d59c","\\mathslbb{w}"],["d59d","\\mathslbb{x}"],["d59e","\\mathslbb{y}"],["d59f","\\mathslbb{z}"],["d5a0","\\mathsf{A}"],["d5a1","\\mathsf{B}"],["d5a2","\\mathsf{C}"],["d5a3","\\mathsf{D}"],["d5a4","\\mathsf{E}"],["d5a5","\\mathsf{F}"],["d5a6","\\mathsf{G}"],["d5a7","\\mathsf{H}"],["d5a8","\\mathsf{I}"],["d5a9","\\mathsf{J}"],["d5aa","\\mathsf{K}"],["d5ab","\\mathsf{L}"],["d5ac","\\mathsf{M}"],["d5ad","\\mathsf{N}"],["d5ae","\\mathsf{O}"],["d5af","\\mathsf{P}"],["d5b0","\\mathsf{Q}"],["d5b1","\\mathsf{R}"],["d5b2","\\mathsf{S}"],["d5b3","\\mathsf{T}"],["d5b4","\\mathsf{U}"],["d5b5","\\mathsf{V}"],["d5b6","\\mathsf{W}"],["d5b7","\\mathsf{X}"],["d5b8","\\mathsf{Y}"],["d5b9","\\mathsf{Z}"],["d5ba","\\mathsf{a}"],["d5bb","\\mathsf{b}"],["d5bc","\\mathsf{c}"],["d5bd","\\mathsf{d}"],["d5be","\\mathsf{e}"],["d5bf","\\mathsf{f}"],["d5c0","\\mathsf{g}"],["d5c1","\\mathsf{h}"],["d5c2","\\mathsf{i}"],["d5c3","\\mathsf{j}"],["d5c4","\\mathsf{k}"],["d5c5","\\mathsf{l}"],["d5c6","\\mathsf{m}"],["d5c7","\\mathsf{n}"],["d5c8","\\mathsf{o}"],["d5c9","\\mathsf{p}"],["d5ca","\\mathsf{q}"],["d5cb","\\mathsf{r}"],["d5cc","\\mathsf{s}"],["d5cd","\\mathsf{t}"],["d5ce","\\mathsf{u}"],["d5cf","\\mathsf{v}"],["d5d0","\\mathsf{w}"],["d5d1","\\mathsf{x}"],["d5d2","\\mathsf{y}"],["d5d3","\\mathsf{z}"],["d5d4","\\mathsfbf{A}"],["d5d5","\\mathsfbf{B}"],["d5d6","\\mathsfbf{C}"],["d5d7","\\mathsfbf{D}"],["d5d8","\\mathsfbf{E}"],["d5d9","\\mathsfbf{F}"],["d5da","\\mathsfbf{G}"],["d5db","\\mathsfbf{H}"],["d5dc","\\mathsfbf{I}"],["d5dd","\\mathsfbf{J}"],["d5de","\\mathsfbf{K}"],["d5df","\\mathsfbf{L}"],["d5e0","\\mathsfbf{M}"],["d5e1","\\mathsfbf{N}"],["d5e2","\\mathsfbf{O}"],["d5e3","\\mathsfbf{P}"],["d5e4","\\mathsfbf{Q}"],["d5e5","\\mathsfbf{R}"],["d5e6","\\mathsfbf{S}"],["d5e7","\\mathsfbf{T}"],["d5e8","\\mathsfbf{U}"],["d5e9","\\mathsfbf{V}"],["d5ea","\\mathsfbf{W}"],["d5eb","\\mathsfbf{X}"],["d5ec","\\mathsfbf{Y}"],["d5ed","\\mathsfbf{Z}"],["d5ee","\\mathsfbf{a}"],["d5ef","\\mathsfbf{b}"],["d5f0","\\mathsfbf{c}"],["d5f1","\\mathsfbf{d}"],["d5f2","\\mathsfbf{e}"],["d5f3","\\mathsfbf{f}"],["d5f4","\\mathsfbf{g}"],["d5f5","\\mathsfbf{h}"],["d5f6","\\mathsfbf{i}"],["d5f7","\\mathsfbf{j}"],["d5f8","\\mathsfbf{k}"],["d5f9","\\mathsfbf{l}"],["d5fa","\\mathsfbf{m}"],["d5fb","\\mathsfbf{n}"],["d5fc","\\mathsfbf{o}"],["d5fd","\\mathsfbf{p}"],["d5fe","\\mathsfbf{q}"],["d5ff","\\mathsfbf{r}"],["d600","\\mathsfbf{s}"],["d601","\\mathsfbf{t}"],["d602","\\mathsfbf{u}"],["d603","\\mathsfbf{v}"],["d604","\\mathsfbf{w}"],["d605","\\mathsfbf{x}"],["d606","\\mathsfbf{y}"],["d607","\\mathsfbf{z}"],["d608","\\mathsfsl{A}"],["d609","\\mathsfsl{B}"],["d60a","\\mathsfsl{C}"],["d60b","\\mathsfsl{D}"],["d60c","\\mathsfsl{E}"],["d60d","\\mathsfsl{F}"],["d60e","\\mathsfsl{G}"],["d60f","\\mathsfsl{H}"],["d610","\\mathsfsl{I}"],["d611","\\mathsfsl{J}"],["d612","\\mathsfsl{K}"],["d613","\\mathsfsl{L}"],["d614","\\mathsfsl{M}"],["d615","\\mathsfsl{N}"],["d616","\\mathsfsl{O}"],["d617","\\mathsfsl{P}"],["d618","\\mathsfsl{Q}"],["d619","\\mathsfsl{R}"],["d61a","\\mathsfsl{S}"],["d61b","\\mathsfsl{T}"],["d61c","\\mathsfsl{U}"],["d61d","\\mathsfsl{V}"],["d61e","\\mathsfsl{W}"],["d61f","\\mathsfsl{X}"],["d620","\\mathsfsl{Y}"],["d621","\\mathsfsl{Z}"],["d622","\\mathsfsl{a}"],["d623","\\mathsfsl{b}"],["d624","\\mathsfsl{c}"],["d625","\\mathsfsl{d}"],["d626","\\mathsfsl{e}"],["d627","\\mathsfsl{f}"],["d628","\\mathsfsl{g}"],["d629","\\mathsfsl{h}"],["d62a","\\mathsfsl{i}"],["d62b","\\mathsfsl{j}"],["d62c","\\mathsfsl{k}"],["d62d","\\mathsfsl{l}"],["d62e","\\mathsfsl{m}"],["d62f","\\mathsfsl{n}"],["d630","\\mathsfsl{o}"],["d631","\\mathsfsl{p}"],["d632","\\mathsfsl{q}"],["d633","\\mathsfsl{r}"],["d634","\\mathsfsl{s}"],["d635","\\mathsfsl{t}"],["d636","\\mathsfsl{u}"],["d637","\\mathsfsl{v}"],["d638","\\mathsfsl{w}"],["d639","\\mathsfsl{x}"],["d63a","\\mathsfsl{y}"],["d63b","\\mathsfsl{z}"],["d63c","\\mathsfbfsl{A}"],["d63d","\\mathsfbfsl{B}"],["d63e","\\mathsfbfsl{C}"],["d63f","\\mathsfbfsl{D}"],["d640","\\mathsfbfsl{E}"],["d641","\\mathsfbfsl{F}"],["d642","\\mathsfbfsl{G}"],["d643","\\mathsfbfsl{H}"],["d644","\\mathsfbfsl{I}"],["d645","\\mathsfbfsl{J}"],["d646","\\mathsfbfsl{K}"],["d647","\\mathsfbfsl{L}"],["d648","\\mathsfbfsl{M}"],["d649","\\mathsfbfsl{N}"],["d64a","\\mathsfbfsl{O}"],["d64b","\\mathsfbfsl{P}"],["d64c","\\mathsfbfsl{Q}"],["d64d","\\mathsfbfsl{R}"],["d64e","\\mathsfbfsl{S}"],["d64f","\\mathsfbfsl{T}"],["d650","\\mathsfbfsl{U}"],["d651","\\mathsfbfsl{V}"],["d652","\\mathsfbfsl{W}"],["d653","\\mathsfbfsl{X}"],["d654","\\mathsfbfsl{Y}"],["d655","\\mathsfbfsl{Z}"],["d656","\\mathsfbfsl{a}"],["d657","\\mathsfbfsl{b}"],["d658","\\mathsfbfsl{c}"],["d659","\\mathsfbfsl{d}"],["d65a","\\mathsfbfsl{e}"],["d65b","\\mathsfbfsl{f}"],["d65c","\\mathsfbfsl{g}"],["d65d","\\mathsfbfsl{h}"],["d65e","\\mathsfbfsl{i}"],["d65f","\\mathsfbfsl{j}"],["d660","\\mathsfbfsl{k}"],["d661","\\mathsfbfsl{l}"],["d662","\\mathsfbfsl{m}"],["d663","\\mathsfbfsl{n}"],["d664","\\mathsfbfsl{o}"],["d665","\\mathsfbfsl{p}"],["d666","\\mathsfbfsl{q}"],["d667","\\mathsfbfsl{r}"],["d668","\\mathsfbfsl{s}"],["d669","\\mathsfbfsl{t}"],["d66a","\\mathsfbfsl{u}"],["d66b","\\mathsfbfsl{v}"],["d66c","\\mathsfbfsl{w}"],["d66d","\\mathsfbfsl{x}"],["d66e","\\mathsfbfsl{y}"],["d66f","\\mathsfbfsl{z}"],["d670","\\mathtt{A}"],["d671","\\mathtt{B}"],["d672","\\mathtt{C}"],["d673","\\mathtt{D}"],["d674","\\mathtt{E}"],["d675","\\mathtt{F}"],["d676","\\mathtt{G}"],["d677","\\mathtt{H}"],["d678","\\mathtt{I}"],["d679","\\mathtt{J}"],["d67a","\\mathtt{K}"],["d67b","\\mathtt{L}"],["d67c","\\mathtt{M}"],["d67d","\\mathtt{N}"],["d67e","\\mathtt{O}"],["d67f","\\mathtt{P}"],["d680","\\mathtt{Q}"],["d681","\\mathtt{R}"],["d682","\\mathtt{S}"],["d683","\\mathtt{T}"],["d684","\\mathtt{U}"],["d685","\\mathtt{V}"],["d686","\\mathtt{W}"],["d687","\\mathtt{X}"],["d688","\\mathtt{Y}"],["d689","\\mathtt{Z}"],["d68a","\\mathtt{a}"],["d68b","\\mathtt{b}"],["d68c","\\mathtt{c}"],["d68d","\\mathtt{d}"],["d68e","\\mathtt{e}"],["d68f","\\mathtt{f}"],["d690","\\mathtt{g}"],["d691","\\mathtt{h}"],["d692","\\mathtt{i}"],["d693","\\mathtt{j}"],["d694","\\mathtt{k}"],["d695","\\mathtt{l}"],["d696","\\mathtt{m}"],["d697","\\mathtt{n}"],["d698","\\mathtt{o}"],["d699","\\mathtt{p}"],["d69a","\\mathtt{q}"],["d69b","\\mathtt{r}"],["d69c","\\mathtt{s}"],["d69d","\\mathtt{t}"],["d69e","\\mathtt{u}"],["d69f","\\mathtt{v}"],["d6a0","\\mathtt{w}"],["d6a1","\\mathtt{x}"],["d6a2","\\mathtt{y}"],["d6a3","\\mathtt{z}"],["d6a8","\\mathbf{\\Alpha}"],["d6a9","\\mathbf{\\Beta}"],["d6aa","\\mathbf{\\Gamma}"],["d6ab","\\mathbf{\\Delta}"],["d6ac","\\mathbf{\\Epsilon}"],["d6ad","\\mathbf{\\Zeta}"],["d6ae","\\mathbf{\\Eta}"],["d6af","\\mathbf{\\Theta}"],["d6b0","\\mathbf{\\Iota}"],["d6b1","\\mathbf{\\Kappa}"],["d6b2","\\mathbf{\\Lambda}"],["d6b5","\\mathbf{\\Xi}"],["d6b7","\\mathbf{\\Pi}"],["d6b8","\\mathbf{\\Rho}"],["d6b9","\\mathbf{\\vartheta}"],["d6ba","\\mathbf{\\Sigma}"],["d6bb","\\mathbf{\\Tau}"],["d6bc","\\mathbf{\\Upsilon}"],["d6bd","\\mathbf{\\Phi}"],["d6be","\\mathbf{\\Chi}"],["d6bf","\\mathbf{\\Psi}"],["d6c0","\\mathbf{\\Omega}"],["d6c1","\\mathbf{\\nabla}"],["d6c2","\\mathbf{\\Alpha}"],["d6c3","\\mathbf{\\Beta}"],["d6c4","\\mathbf{\\Gamma}"],["d6c5","\\mathbf{\\Delta}"],["d6c6","\\mathbf{\\Epsilon}"],["d6c7","\\mathbf{\\Zeta}"],["d6c8","\\mathbf{\\Eta}"],["d6c9","\\mathbf{\\theta}"],["d6ca","\\mathbf{\\Iota}"],["d6cb","\\mathbf{\\Kappa}"],["d6cc","\\mathbf{\\Lambda}"],["d6cf","\\mathbf{\\Xi}"],["d6d1","\\mathbf{\\Pi}"],["d6d2","\\mathbf{\\Rho}"],["d6d3","\\mathbf{\\varsigma}"],["d6d4","\\mathbf{\\Sigma}"],["d6d5","\\mathbf{\\Tau}"],["d6d6","\\mathbf{\\Upsilon}"],["d6d7","\\mathbf{\\Phi}"],["d6d8","\\mathbf{\\Chi}"],["d6d9","\\mathbf{\\Psi}"],["d6da","\\mathbf{\\Omega}"],["d6db","\\partial{}"],["d6dc","\\in"],["d6dd","\\mathbf{\\vartheta}"],["d6de","\\mathbf{\\varkappa}"],["d6df","\\mathbf{\\phi}"],["d6e0","\\mathbf{\\varrho}"],["d6e1","\\mathbf{\\varpi}"],["d6e2","\\mathsl{\\Alpha}"],["d6e3","\\mathsl{\\Beta}"],["d6e4","\\mathsl{\\Gamma}"],["d6e5","\\mathsl{\\Delta}"],["d6e6","\\mathsl{\\Epsilon}"],["d6e7","\\mathsl{\\Zeta}"],["d6e8","\\mathsl{\\Eta}"],["d6e9","\\mathsl{\\Theta}"],["d6ea","\\mathsl{\\Iota}"],["d6eb","\\mathsl{\\Kappa}"],["d6ec","\\mathsl{\\Lambda}"],["d6ef","\\mathsl{\\Xi}"],["d6f1","\\mathsl{\\Pi}"],["d6f2","\\mathsl{\\Rho}"],["d6f3","\\mathsl{\\vartheta}"],["d6f4","\\mathsl{\\Sigma}"],["d6f5","\\mathsl{\\Tau}"],["d6f6","\\mathsl{\\Upsilon}"],["d6f7","\\mathsl{\\Phi}"],["d6f8","\\mathsl{\\Chi}"],["d6f9","\\mathsl{\\Psi}"],["d6fa","\\mathsl{\\Omega}"],["d6fb","\\mathsl{\\nabla}"],["d6fc","\\mathsl{\\Alpha}"],["d6fd","\\mathsl{\\Beta}"],["d6fe","\\mathsl{\\Gamma}"],["d6ff","\\mathsl{\\Delta}"],["d700","\\mathsl{\\Epsilon}"],["d701","\\mathsl{\\Zeta}"],["d702","\\mathsl{\\Eta}"],["d703","\\mathsl{\\Theta}"],["d704","\\mathsl{\\Iota}"],["d705","\\mathsl{\\Kappa}"],["d706","\\mathsl{\\Lambda}"],["d709","\\mathsl{\\Xi}"],["d70b","\\mathsl{\\Pi}"],["d70c","\\mathsl{\\Rho}"],["d70d","\\mathsl{\\varsigma}"],["d70e","\\mathsl{\\Sigma}"],["d70f","\\mathsl{\\Tau}"],["d710","\\mathsl{\\Upsilon}"],["d711","\\mathsl{\\Phi}"],["d712","\\mathsl{\\Chi}"],["d713","\\mathsl{\\Psi}"],["d714","\\mathsl{\\Omega}"],["d715","\\partial{}"],["d716","\\in"],["d717","\\mathsl{\\vartheta}"],["d718","\\mathsl{\\varkappa}"],["d719","\\mathsl{\\phi}"],["d71a","\\mathsl{\\varrho}"],["d71b","\\mathsl{\\varpi}"],["d71c","\\mathbit{\\Alpha}"],["d71d","\\mathbit{\\Beta}"],["d71e","\\mathbit{\\Gamma}"],["d71f","\\mathbit{\\Delta}"],["d720","\\mathbit{\\Epsilon}"],["d721","\\mathbit{\\Zeta}"],["d722","\\mathbit{\\Eta}"],["d723","\\mathbit{\\Theta}"],["d724","\\mathbit{\\Iota}"],["d725","\\mathbit{\\Kappa}"],["d726","\\mathbit{\\Lambda}"],["d729","\\mathbit{\\Xi}"],["d72b","\\mathbit{\\Pi}"],["d72c","\\mathbit{\\Rho}"],["d72d","\\mathbit{O}"],["d72e","\\mathbit{\\Sigma}"],["d72f","\\mathbit{\\Tau}"],["d730","\\mathbit{\\Upsilon}"],["d731","\\mathbit{\\Phi}"],["d732","\\mathbit{\\Chi}"],["d733","\\mathbit{\\Psi}"],["d734","\\mathbit{\\Omega}"],["d735","\\mathbit{\\nabla}"],["d736","\\mathbit{\\Alpha}"],["d737","\\mathbit{\\Beta}"],["d738","\\mathbit{\\Gamma}"],["d739","\\mathbit{\\Delta}"],["d73a","\\mathbit{\\Epsilon}"],["d73b","\\mathbit{\\Zeta}"],["d73c","\\mathbit{\\Eta}"],["d73d","\\mathbit{\\Theta}"],["d73e","\\mathbit{\\Iota}"],["d73f","\\mathbit{\\Kappa}"],["d740","\\mathbit{\\Lambda}"],["d743","\\mathbit{\\Xi}"],["d745","\\mathbit{\\Pi}"],["d746","\\mathbit{\\Rho}"],["d747","\\mathbit{\\varsigma}"],["d748","\\mathbit{\\Sigma}"],["d749","\\mathbit{\\Tau}"],["d74a","\\mathbit{\\Upsilon}"],["d74b","\\mathbit{\\Phi}"],["d74c","\\mathbit{\\Chi}"],["d74d","\\mathbit{\\Psi}"],["d74e","\\mathbit{\\Omega}"],["d74f","\\partial{}"],["d750","\\in"],["d751","\\mathbit{\\vartheta}"],["d752","\\mathbit{\\varkappa}"],["d753","\\mathbit{\\phi}"],["d754","\\mathbit{\\varrho}"],["d755","\\mathbit{\\varpi}"],["d756","\\mathsfbf{\\Alpha}"],["d757","\\mathsfbf{\\Beta}"],["d758","\\mathsfbf{\\Gamma}"],["d759","\\mathsfbf{\\Delta}"],["d75a","\\mathsfbf{\\Epsilon}"],["d75b","\\mathsfbf{\\Zeta}"],["d75c","\\mathsfbf{\\Eta}"],["d75d","\\mathsfbf{\\Theta}"],["d75e","\\mathsfbf{\\Iota}"],["d75f","\\mathsfbf{\\Kappa}"],["d760","\\mathsfbf{\\Lambda}"],["d763","\\mathsfbf{\\Xi}"],["d765","\\mathsfbf{\\Pi}"],["d766","\\mathsfbf{\\Rho}"],["d767","\\mathsfbf{\\vartheta}"],["d768","\\mathsfbf{\\Sigma}"],["d769","\\mathsfbf{\\Tau}"],["d76a","\\mathsfbf{\\Upsilon}"],["d76b","\\mathsfbf{\\Phi}"],["d76c","\\mathsfbf{\\Chi}"],["d76d","\\mathsfbf{\\Psi}"],["d76e","\\mathsfbf{\\Omega}"],["d76f","\\mathsfbf{\\nabla}"],["d770","\\mathsfbf{\\Alpha}"],["d771","\\mathsfbf{\\Beta}"],["d772","\\mathsfbf{\\Gamma}"],["d773","\\mathsfbf{\\Delta}"],["d774","\\mathsfbf{\\Epsilon}"],["d775","\\mathsfbf{\\Zeta}"],["d776","\\mathsfbf{\\Eta}"],["d777","\\mathsfbf{\\Theta}"],["d778","\\mathsfbf{\\Iota}"],["d779","\\mathsfbf{\\Kappa}"],["d77a","\\mathsfbf{\\Lambda}"],["d77d","\\mathsfbf{\\Xi}"],["d77f","\\mathsfbf{\\Pi}"],["d780","\\mathsfbf{\\Rho}"],["d781","\\mathsfbf{\\varsigma}"],["d782","\\mathsfbf{\\Sigma}"],["d783","\\mathsfbf{\\Tau}"],["d784","\\mathsfbf{\\Upsilon}"],["d785","\\mathsfbf{\\Phi}"],["d786","\\mathsfbf{\\Chi}"],["d787","\\mathsfbf{\\Psi}"],["d788","\\mathsfbf{\\Omega}"],["d789","\\partial{}"],["d78a","\\in"],["d78b","\\mathsfbf{\\vartheta}"],["d78c","\\mathsfbf{\\varkappa}"],["d78d","\\mathsfbf{\\phi}"],["d78e","\\mathsfbf{\\varrho}"],["d78f","\\mathsfbf{\\varpi}"],["d790","\\mathsfbfsl{\\Alpha}"],["d791","\\mathsfbfsl{\\Beta}"],["d792","\\mathsfbfsl{\\Gamma}"],["d793","\\mathsfbfsl{\\Delta}"],["d794","\\mathsfbfsl{\\Epsilon}"],["d795","\\mathsfbfsl{\\Zeta}"],["d796","\\mathsfbfsl{\\Eta}"],["d797","\\mathsfbfsl{\\vartheta}"],["d798","\\mathsfbfsl{\\Iota}"],["d799","\\mathsfbfsl{\\Kappa}"],["d79a","\\mathsfbfsl{\\Lambda}"],["d79d","\\mathsfbfsl{\\Xi}"],["d79f","\\mathsfbfsl{\\Pi}"],["d7a0","\\mathsfbfsl{\\Rho}"],["d7a1","\\mathsfbfsl{\\vartheta}"],["d7a2","\\mathsfbfsl{\\Sigma}"],["d7a3","\\mathsfbfsl{\\Tau}"],["d7a4","\\mathsfbfsl{\\Upsilon}"],["d7a5","\\mathsfbfsl{\\Phi}"],["d7a6","\\mathsfbfsl{\\Chi}"],["d7a7","\\mathsfbfsl{\\Psi}"],["d7a8","\\mathsfbfsl{\\Omega}"],["d7a9","\\mathsfbfsl{\\nabla}"],["d7aa","\\mathsfbfsl{\\Alpha}"],["d7ab","\\mathsfbfsl{\\Beta}"],["d7ac","\\mathsfbfsl{\\Gamma}"],["d7ad","\\mathsfbfsl{\\Delta}"],["d7ae","\\mathsfbfsl{\\Epsilon}"],["d7af","\\mathsfbfsl{\\Zeta}"],["d7b0","\\mathsfbfsl{\\Eta}"],["d7b1","\\mathsfbfsl{\\vartheta}"],["d7b2","\\mathsfbfsl{\\Iota}"],["d7b3","\\mathsfbfsl{\\Kappa}"],["d7b4","\\mathsfbfsl{\\Lambda}"],["d7b7","\\mathsfbfsl{\\Xi}"],["d7b9","\\mathsfbfsl{\\Pi}"],["d7ba","\\mathsfbfsl{\\Rho}"],["d7bb","\\mathsfbfsl{\\varsigma}"],["d7bc","\\mathsfbfsl{\\Sigma}"],["d7bd","\\mathsfbfsl{\\Tau}"],["d7be","\\mathsfbfsl{\\Upsilon}"],["d7bf","\\mathsfbfsl{\\Phi}"],["d7c0","\\mathsfbfsl{\\Chi}"],["d7c1","\\mathsfbfsl{\\Psi}"],["d7c2","\\mathsfbfsl{\\Omega}"],["d7c3","\\partial{}"],["d7c4","\\in"],["d7c5","\\mathsfbfsl{\\vartheta}"],["d7c6","\\mathsfbfsl{\\varkappa}"],["d7c7","\\mathsfbfsl{\\phi}"],["d7c8","\\mathsfbfsl{\\varrho}"],["d7c9","\\mathsfbfsl{\\varpi}"],["d7ce","\\mathbf{0}"],["d7cf","\\mathbf{1}"],["d7d0","\\mathbf{2}"],["d7d1","\\mathbf{3}"],["d7d2","\\mathbf{4}"],["d7d3","\\mathbf{5}"],["d7d4","\\mathbf{6}"],["d7d5","\\mathbf{7}"],["d7d6","\\mathbf{8}"],["d7d7","\\mathbf{9}"],["d7d8","\\mathbb{0}"],["d7d9","\\mathbb{1}"],["d7da","\\mathbb{2}"],["d7db","\\mathbb{3}"],["d7dc","\\mathbb{4}"],["d7dd","\\mathbb{5}"],["d7de","\\mathbb{6}"],["d7df","\\mathbb{7}"],["d7e0","\\mathbb{8}"],["d7e1","\\mathbb{9}"],["d7e2","\\mathsf{0}"],["d7e3","\\mathsf{1}"],["d7e4","\\mathsf{2}"],["d7e5","\\mathsf{3}"],["d7e6","\\mathsf{4}"],["d7e7","\\mathsf{5}"],["d7e8","\\mathsf{6}"],["d7e9","\\mathsf{7}"],["d7ea","\\mathsf{8}"],["d7eb","\\mathsf{9}"],["d7ec","\\mathsfbf{0}"],["d7ed","\\mathsfbf{1}"],["d7ee","\\mathsfbf{2}"],["d7ef","\\mathsfbf{3}"],["d7f0","\\mathsfbf{4}"],["d7f1","\\mathsfbf{5}"],["d7f2","\\mathsfbf{6}"],["d7f3","\\mathsfbf{7}"],["d7f4","\\mathsfbf{8}"],["d7f5","\\mathsfbf{9}"],["d7f6","\\mathtt{0}"],["d7f7","\\mathtt{1}"],["d7f8","\\mathtt{2}"],["d7f9","\\mathtt{3}"],["d7fa","\\mathtt{4}"],["d7fb","\\mathtt{5}"],["d7fc","\\mathtt{6}"],["d7fd","\\mathtt{7}"],["d7fe","\\mathtt{8}"],["d7ff","\\mathtt{9}"]]);function Ne(p){let E=p;const F=[];E=E.replace(/\$[^$]+\$/g,ee=>(F.push(ee),`MATH.EXP.${F.length-1}`));let O="",H=!1;for(let ee=0;ee<E.length;ee++){if(H){H=!1,O+=E[ee];continue}if(E[ee]==="\\"){H=!0,O+=E[ee];continue}const L=E.charCodeAt(ee).toString(16).padStart(4,"0");O+=Fe.get(L)??E[ee]}return O.replace(/MATH\.EXP\.(\d+)/g,(ee,L)=>F[Number(L)]??"")}r(Ne,"escapeSpecialCharacters");function Z(p){return p.replace(/(\w)(\S*)/g,(E,F,O)=>{const H=F+O;return T(H)?H:F.toLocaleUpperCase()+O.toLocaleLowerCase()})}r(Z,"titleCase");function T(p){return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/.test(p)}r(T,"isRomanNumeral");function ge(p){return p.replace(/[^0-9A-Za-z]/g,"").toLocaleLowerCase()}r(ge,"alphaNum");function I(p){return p.replace(/\r\n?/g,`
|
|
17
|
-
`)}r(I,"convertCRLF");function X(p,E){const F=p.split(" "),O=[];let H="";for(const[ee,L]of F.entries())H.length+L.length+1>E&&ee>0&&(O.push(H.trim()),H=""),H+=`${L} `;return[...O,H.trim()]}r(X,"wrapText");function ce(p){return p.replace(/\s*\n\s*\n\s*/g,"<<BIBTEX_TIDY_PARA>>").replace(/\s*\n\s*/g," ").replace(/<<BIBTEX_TIDY_PARA>>/g,`
|
|
18
|
-
|
|
19
|
-
`)}r(ce,"unwrapText");function Ce(p){const E=B(p),F=E.children.length===1&&E.children[0]?.type==="block"&&E.children[0]?.kind==="curly"&&E.children[0].children.length===1&&E.children[0].children[0]?.type==="block"&&E.children[0].children[0]?.kind==="curly",O=S(E);return F?O:`{${O}}`}r(Ce,"doubleEnclose");function se(p){return p.replace(/^\{([^{}]*)\}$/g,"$1")}r(se,"removeEnclosingBraces");function A(p){return p.replace(/\\?_/g,"\\%5F")}r(A,"escapeURL");function fe(p,E){const F=p.split(" and ");return F.length>E?[...F.slice(0,E),"others"].join(" and "):p}r(fe,"limitAuthors");function ve(p){let E=p;for(let F=0;F<4;F++)E=E.replace(/(\d)\s*-\s*(\d)/g,"$1--$2");return E}r(ve,"formatPageRange");function qe(p){return p.type!=="text"&&p.block?.type==="entry"}r(qe,"isEntryNode");function yt(p,E,F,O){const H=new Map;if(F)for(const je of F)H.set(je,!!O);H.has("key")||H.set("key",!1);const ee=new Set,L=[],we=new Map,ae=new Map,Re=new Map,Ae=new Map;for(const je of jt(p)){const Ze=E.get(je);if(Ze)for(const[Dt,Jt]of H){let Pe,et;switch(Dt){case"key":{if(!je.key)continue;const ze=je.key.toLocaleLowerCase();Pe=we.get(ze),Pe?et=`The citation key ${je.key} has already been used.`:we.set(ze,je);break}case"doi":{const ze=ge(Ze.get("doi")??"");if(!ze)continue;Pe=ae.get(ze),Pe?et=`Entry ${je.key} has an identical DOI to entry ${Pe.key}.`:ae.set(ze,je);break}case"citation":{const ze=Ze.get("title"),kt=Ze.get("author"),Ut=Ze.get("number");if(!ze||!kt)continue;const ft=[ge(W(kt)[0]?.lastName??kt),ge(ze),ge(Ut??"0")].join(":");Pe=Re.get(ft),Pe?et=`Entry ${je.key} has similar content to entry ${Pe.key}.`:Re.set(ft,je);break}case"abstract":{const kt=ge(Ze.get("abstract")??"").slice(0,100);if(!kt)continue;Pe=Ae.get(kt),Pe?et=`Entry ${je.key} has a similar abstract to entry ${Pe.key}.`:Ae.set(kt,je);break}}Pe&&Jt&&(ee.add(je),Qe(O,Pe,je)),et&&L.push({code:"DUPLICATE_ENTRY",rule:Dt,message:`Duplicate ${Jt?"removed":"detected"}. ${et}`})}}return{entries:ee,warnings:L}}r(yt,"checkForDuplicates");function Qe(p,E,F){if(p)switch(p){case"last":E.key=F.key,E.fields=F.fields;break;case"combine":case"overwrite":for(const O of F.fields){const H=E.fields.find(ee=>ee.name.toLocaleLowerCase()===O.name.toLocaleLowerCase());H?p==="overwrite"&&(H.value=O.value):E.fields.push(O)}break;case"first":return}}r(Qe,"mergeEntries");var Xe=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],ye=new Set(Xe),We={1:"jan",2:"feb",3:"mar",4:"apr",5:"may",6:"jun",7:"jul",8:"aug",9:"sep",10:"oct",11:"nov",12:"dec",jan:"jan",feb:"feb",mar:"mar",apr:"apr",may:"may",jun:"jun",jul:"jul",aug:"aug",sep:"sep",oct:"oct",nov:"nov",dec:"dec",january:"jan",february:"feb",march:"mar",april:"apr",june:"jun",july:"jul",august:"aug",september:"sep",october:"oct",november:"nov",december:"dec"},Je=["url","doi","eprint","file","verba","verbb","verbc","pdf"];function pt(p,E,F){const{omit:O,tab:H,space:ee}=E,L=H?" ":" ".repeat(ee),we=new Set(O);let ae=p.children.map(Re=>De(Re,E,L,we,F)).join("").trimEnd();return ae.endsWith(`
|
|
20
|
-
`)||(ae+=`
|
|
21
|
-
`),ae}r(pt,"formatBibtex");function De(p,E,F,O,H){if(p.type==="text")return le(p.text,E);if(!p.block)throw new Error("FATAL!");switch(p.block.type){case"preamble":case"string":return`${p.block.raw}
|
|
22
|
-
${E.blankLines?`
|
|
23
|
-
`:""}`;case"comment":return le(p.block.raw,E);case"entry":return Et(p.command,p.block,E,F,O,H?.get(p.block))+(E.blankLines?`
|
|
24
|
-
`:"")}}r(De,"formatNode");function Et(p,E,F,O,H,ee){const{align:L,trailingCommas:we,removeDuplicateFields:ae,removeEmptyFields:Re,lowercase:Ae}=F;let je="";const Ze=Ae?p.toLocaleLowerCase():p;je+=`@${Ze}{`;const Dt=ee??E.key;Dt&&(je+=`${Dt},`);const Jt=new Set;for(const[Pe,et]of E.fields.entries()){const ze=et.name.toLocaleLowerCase(),kt=Ae?ze:et.name;if(et.name!==""&&!H.has(ze)&&!(ae&&Jt.has(ze))){if(Jt.add(ze),et.value.concat.length===0){if(Re)continue;je+=`
|
|
25
|
-
${O}${kt}`}else{const Ut=ke(et,F);if(Re&&(Ut==="{}"||Ut==='""'))continue;je+=`
|
|
26
|
-
${O}${kt.trim().padEnd(L-1)} = ${Ut}`}(Pe<E.fields.length-1||we)&&(je+=",")}}return je+=`
|
|
27
|
-
}
|
|
28
|
-
`,je}r(Et,"formatEntry");function le(p,{stripComments:E,tidyComments:F}){if(E)return"";if(F){const O=p.trim();return O===""?"":`${O}
|
|
29
|
-
`}return p.replace(/^[ \t]*\n|[ \t]*$/g,"")}r(le,"formatComment");function ke(p,E){const{curly:F,numeric:O,align:H,stripEnclosingBraces:ee,dropAllCaps:L,escape:we,encodeUrls:ae,wrap:Re,maxAuthors:Ae,tab:je,space:Ze,enclosingBraces:Dt,removeBraces:Jt,months:Pe}=E,et=p.name.toLocaleLowerCase(),ze=je?" ":" ".repeat(Ze),kt=new Set((Dt??[]).map(ft=>ft.toLocaleLowerCase())),Ut=new Set((Jt??[]).map(ft=>ft.toLocaleLowerCase()));return p.value.concat.map(({type:ft,value:He})=>{const tt=He.match(/^[1-9][0-9]*$/);if(tt&&F&&(ft="braced"),Pe&&et==="month"){const pn=We[He.toLowerCase()];if(pn)return pn}if(ft==="literal"||O&&tt)return He;const Xn=He.slice(0,3).toLowerCase(),ms=et==="month"&&ye.has(Xn);if(!F&&O&&ms)return Xn;if(He=ce(He),ee&&(He=se(He)),L&&!He.match(/[a-z]/)&&(He=Z(He)),et==="url"&&ae&&(He=A(He)),!Je.includes(et)&&we&&(He=Ne(He)),et==="pages"&&(He=ve(He)),et==="author"&&Ae&&(He=fe(He,Ae)),Ut.has(et)&&(He=S(be(B(He)))),kt.has(et)&&(ft==="braced"||F)&&(He=Ce(He)),ft==="braced"&&p.value.concat.length===1&&(He=He.trim()),ft==="braced"||F){const pn=`${ze}${H}{${He}}`.length,On=He.includes(`
|
|
30
|
-
|
|
31
|
-
`);if(Re&&pn>Re||On){let Pn=He.split(`
|
|
32
|
-
|
|
33
|
-
`);const vn=ze.repeat(2);if(Re){const Jn=Re;Pn=Pn.map(sr=>X(sr,Jn-vn.length).join(`
|
|
34
|
-
${vn}`))}He=`
|
|
35
|
-
${vn}${Pn.join(`
|
|
36
|
-
|
|
37
|
-
${vn}`)}
|
|
38
|
-
${ze}`}return Ce(He)}return`"${He}"`}).join(" # ")}r(ke,"formatValue");var Oe={auth:{description:"Last name of first authors",callback:r(p=>{const F=W(p.get("author")??"",!0)[0]?.lastName.replace(/(?:[\0-@\[-`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87C\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF])+/g,"_");return F?[F]:[]},"callback")},authEtAl:{description:"If 1 or 2 authors, both authors, otherwise first author and EtAl",callback:r(p=>{const E=W(p.get("author")??"",!0);return[...E.slice(0,2).map(F=>F.lastName.replace(/(?:[\0-@\[-`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87C\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF])+/g,"_")),...E.length>2?["Et","Al"]:[]]},"callback")},authors:{description:"Last name all authors",callback:r(p=>W(p.get("author")??"",!0).map(F=>F.lastName.replace(/(?:[\0-@\[-`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87C\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF])+/g,"_")),"callback")},authorsN:{description:"Last name N authors, with EtAl if more",callback:r((p,E=0)=>{const F=W(p.get("author")??"",!0);return[...F.slice(0,E).map(O=>O.lastName.replace(/(?:[\0-@\[-`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87C\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF])+/g,"_")),...F.length>E?["Et","Al"]:[]]},"callback")},veryshorttitle:{description:"First non-function word of the title",callback:r(p=>Ve(Ee(p)).slice(0,1),"callback")},shorttitle:{description:"First three non-function words of the title",callback:r(p=>Ve(Ee(p)).slice(0,3),"callback")},title:{description:"Full title, capitalized",callback:r(p=>st(Ge(Ee(p))),"callback")},fulltitle:{description:"Full title, verbatim",callback:r(p=>Ge(Ee(p)),"callback")},year:{description:"Year",callback:r(p=>{const E=p.get("year")?.replace(/[^0-9]/g,"");return E?[E]:[]},"callback")},duplicateLetter:{description:"If the multiple entries end up with the same key, then insert a letter a-z. By default this will be inserted at the end.",callback:r(()=>["[duplicateLetter]"],"callback")},duplicateNumber:{description:"If the multiple entries end up with the same key, then insert a number.",callback:r(()=>["[duplicateNumber]"],"callback")}},mt={required:{description:"If data is missing, revert to existing key",callback:r(p=>{if(p.length===0)throw new Ue;return p},"callback")},lower:{description:"Convert to lowercase",callback:r(p=>p.map(E=>E.toLocaleLowerCase()),"callback")},upper:{description:"Convert to uppercase",callback:r(p=>p.map(E=>E.toLocaleUpperCase()),"callback")},capitalize:{description:"Capitalize first letter of each word",callback:st}},Ue=class extends Error{static{r(this,"MissingRequiredData")}};function z(p,E,F){let O=F;!F.includes("[duplicateLetter]")&&!F.includes("[duplicateNumber]")&&(O=`${F}[duplicateLetter]`);const H=new Map;for(const L of p.children)if(qe(L)){const we=E.get(L.block);if(!we)continue;const ae=pe(we,O);if(!ae)continue;const Re=H.get(ae)??[];H.set(ae,[...Re,L.block])}const ee=new Map;for(const[L,we]of H)for(const[ae,Re]of we.entries()){const Ae=we.length>1?String.fromCharCode(97+ae):"",je=we.length>1?String(ae+1):"";Re.key=L.replace(/\[duplicateLetter\]/g,Ae).replace(/\[duplicateNumber\]/g,je)}return ee}r(z,"generateKeys");function pe(p,E){try{const F=E.replace(/\[[^:\]]+(?::[^:\]]+)*\]/g,O=>{const[H,...ee]=O.slice(1,-1).split(":");if(!H)throw new Error("Token parse error");let L;const we=H.replace(/[0-9]+/g,Ae=>(L=Number(Ae),"N")),ae=Oe[we];let Re;if(ae)Re=ae.callback(p,L);else if(we===we.toLocaleUpperCase()){const Ae=p.get(we.toLocaleLowerCase());Re=Ae?Ge(Ae):[]}else throw new Error(`Invalid citation key token ${we}`);for(const Ae of ee){const je=mt[Ae];if(je)Re=je.callback(Re);else throw new Error(`Invalid modifier ${Ae}`)}return Re.join("")});return F===""?void 0:F}catch(F){if(F instanceof Ue)return;throw F}}r(pe,"generateKey");var q=new Set(["a","about","above","across","against","along","among","an","and","around","at","before","behind","below","beneath","beside","between","beyond","but","by","down","during","except","for","for","from","in","inside","into","like","near","nor","of","off","on","onto","or","since","so","the","through","to","toward","under","until","up","upon","with","within","without","yet"]);function Ve(p){return Ge(p).filter(E=>!q.has(E.toLocaleLowerCase()))}r(Ve,"nonFunctionWords");function Ge(p){return p.split(/(?:[\0-\/:-@\[-`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87C\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF])+/).filter(E=>E.length>0)}r(Ge,"words");function st(p){return p.map(E=>E.slice(0,1).toLocaleUpperCase()+E.slice(1).toLocaleLowerCase())}r(st,"capitalize");function Ee(p){return p.get("title")??p.get("booktitle")??""}r(Ee,"title");var dt=["doi","citation","abstract"],Q=14,_=2,Ye=80,wt=["title","shorttitle","author","year","month","day","journal","booktitle","location","on","publisher","address","series","volume","number","pages","doi","isbn","issn","url","urldate","copyright","category","note","metadata"],At=["key"],ht="[auth:required:lower][year:required][veryshorttitle:lower][duplicateNumber]",on=[{key:"help",cli:{"--help":!0,"-h":!0},title:"Help",description:["Show help"],type:"boolean"},{key:"v2",cli:{"--v2":!0},title:"Enable planned v2 CLI changes",description:["Input files will no longer be modified by default. Instead, you will need to specify `--modify`/`-m` option to overwrite the file, or `--output`/`-o` to output to a different file."],type:"string",defaultValue:void 0},{key:"outputPath",cli:{"--output":r(p=>p[0],"--output"),"-o":r(p=>p[0],"-o")},title:"Output path",description:["Write output to specified path. When omitted (and -m/--modify is not used), the result will be printed to stdout."],type:"string",defaultValue:void 0},{key:"modify",cli:{"--modify":!0,"-m":!0,"--no-modify":!1},title:"Modify input files",description:["Overwrite the original input files with the tidied result. This is enabled by default but will be disabled by default in v2. For v1, use --no-modify to output to stdout instead of overwriting the input files."],type:"boolean",defaultValue:!0},{key:"omit",cli:{"--omit":r(p=>(p.length===0&&(console.error("Expected a omit list"),process.exit(1)),p),"--omit")},toCLI:r(p=>Array.isArray(p)&&p.length>0?`--omit=${p.join(",")}`:void 0,"toCLI"),title:"Remove fields",description:["Remove specified fields from bibliography entries."],examples:["--omit=id,name"],type:"string[]",defaultValue:[]},{key:"curly",cli:{"--curly":!0,"--no-curly":!1},toCLI:r(p=>p?"--curly":void 0,"toCLI"),title:"Enclose values in braces",description:['Enclose all property values in braces. Quoted values will be converted to braces. For example, "Journal of Tea" will become {Journal of Tea}.'],type:"boolean",defaultValue:!1},{key:"numeric",cli:{"--numeric":!0,"--no-numeric":!1},toCLI:r(p=>p?"--numeric":void 0,"toCLI"),title:"Use numeric values where possible",description:["Strip quotes and braces from numeric/month values. For example, {1998} will become 1998."],type:"boolean",defaultValue:!1},{key:"months",cli:{"--months":!0},toCLI:r(p=>p?"--months":void 0,"toCLI"),title:"Abbreviate months",description:["Convert all months to three letter abbreviations (jan, feb, etc)."],type:"boolean",defaultValue:!1},{key:"space",cli:{"--space":r(p=>p.length>0?Number(p[0]):!0,"--space")},toCLI:r((p,E)=>{if(!E.tab){if(typeof p=="number"&&p!==_)return`--space=${p}`;if(p&&p!==_)return"--space"}},"toCLI"),title:"Indent with spaces",description:["Indent all fields with the specified number of spaces. Ignored if tab is set."],examples:["--space=2 (default)","--space=4"],type:"boolean | number",convertBoolean:{true:_,false:void 0},defaultValue:_},{key:"tab",cli:{"--tab":!0,"--no-tab":!1},toCLI:r(p=>p?"--tab":void 0,"toCLI"),title:"Indent with tabs",description:["Indent all fields with a tab."],type:"boolean",defaultValue:!1},{key:"align",cli:{"--align":r(p=>Number(p[0]),"--align"),"--no-align":!1},toCLI:r(p=>{if(p===!1||p===1||p===0)return"--no-align";if(typeof p=="number"&&p!==Q)return`--align=${p}`},"toCLI"),title:"Align values",description:["Insert whitespace between fields and values so that values are visually aligned."],examples:["--align=14 (default)"],type:"boolean | number",convertBoolean:{true:Q,false:1},defaultValue:Q},{key:"blankLines",cli:{"--blank-lines":!0,"--no-blank-lines":!1},toCLI:r(p=>p?"--blank-lines":void 0,"toCLI"),title:"Insert blank lines",description:["Insert an empty line between each entry."],type:"boolean"},{key:"sort",cli:{"--sort":r(p=>p.length>0?p:!0,"--sort"),"--no-sort":!1},toCLI:r(p=>{if(Array.isArray(p)&&p.length>0)return`--sort=${p.join(",")}`;if(p===!0)return"--sort"},"toCLI"),title:"Sort bibliography entries",description:["Sort entries by the specified field names (citation key is used if no fields are specified). For descending order, prefix the field with a dash (-).","Multiple fields may be specified to sort everything by first field, then by the second field whenever the first field for entries are equal, etc.","The following additional fields are also permitted: key (entry citation key), type (sorts by the type of entry, e.g. article), and special (ensures that @string, @preamble, @set, and @xdata entries are first). "],examples:["--sort (sort by citation key)","--sort=-year,name (sort year descending then name ascending)","--sort=name,year"],type:"boolean | string[]",convertBoolean:{true:At,false:void 0}},{key:"duplicates",cli:{"--duplicates":r(p=>{if(p.length===0)return!0;for(const E of p)E!=="doi"&&E!=="key"&&E!=="abstract"&&E!=="citation"&&(console.error(`Invalid key for merge option: "${E}"`),process.exit(1));return p},"--duplicates")},toCLI:r(p=>{if(Array.isArray(p)&&p.length>0)return`--duplicates=${p.join(",")}`;if(p===!0)return"--duplicates"},"toCLI"),title:"Check for duplicates",description:["Warn if duplicates are found, which are entries where DOI, abstract, or author and title are the same."],examples:["--duplicates doi (same DOIs)","--duplicates key (same IDs)","--duplicates abstract (similar abstracts)","--duplicates citation (similar author and titles)","--duplicates doi, key (identical DOI or keys)","--duplicates (same DOI, key, abstract, or citation)"],type:"boolean | ('doi' | 'key' | 'abstract' | 'citation')[]",convertBoolean:{true:dt,false:void 0},defaultValue:r(p=>p.merge?dt:void 0,"defaultValue")},{key:"merge",cli:{"--merge":r(p=>p.length===0?!0:(p[0]!=="first"&&p[0]!=="last"&&p[0]!=="combine"&&p[0]!=="overwrite"&&(console.error(`Invalid merge strategy: "${p[0]}"`),process.exit(1)),p[0]),"--merge"),"--no-merge":!1},toCLI:r(p=>{if(typeof p=="string")return`--merge=${p}`;if(p)return"--merge"},"toCLI"),title:"Merge duplicate entries",description:["Merge duplicates entries. Use the duplicates option to determine how duplicates are identified. There are different ways to merge:","- first: only keep the original entry","- last: only keep the last found duplicate","- combine: keep original entry and merge in fields of duplicates if they do not already exist","- overwrite: keep original entry and merge in fields of duplicates, overwriting existing fields if they exist"],type:"boolean | 'first' | 'last' | 'combine' | 'overwrite'",convertBoolean:{true:"combine",false:void 0}},{key:"stripEnclosingBraces",cli:{"--strip-enclosing-braces":!0},toCLI:r(p=>p?"--strip-enclosing-braces":void 0,"toCLI"),title:"Strip double-braced values",description:["Where an entire value is enclosed in double braces, remove the extra braces. For example, {{Journal of Tea}} will become {Journal of Tea}."],type:"boolean",defaultValue:!1},{key:"dropAllCaps",cli:{"--drop-all-caps":!0},toCLI:r(p=>p?"--drop-all-caps":void 0,"toCLI"),title:"Drop all caps",description:["Where values are all caps, make them title case. For example, {JOURNAL OF TEA} will become {Journal of Tea}. Roman numerals will be left unchanged."],type:"boolean",defaultValue:!1},{key:"escape",cli:{"--escape":!0,"--no-escape":!1},toCLI:r(p=>p===!1?"--no-escape":void 0,"toCLI"),title:"Escape special characters",description:["Escape special characters, such as umlaut. This ensures correct typesetting with latex. Enabled by default."],type:"boolean",defaultValue:!0},{key:"sortFields",cli:{"--sort-fields":r(p=>p.length>0?p:!0,"--sort-fields")},toCLI:r(p=>{if(Array.isArray(p)&&p.length>0)return JSON.stringify(p)===JSON.stringify(wt)?"--sort-fields":`--sort-fields=${p.join(",")}`;if(p===!0)return"--sort-fields"},"toCLI"),title:"Sort fields",description:["Sort the fields within entries.","If no fields are specified fields will be sorted by: title, shorttitle, author, year, month, day, journal, booktitle, location, on, publisher, address, series, volume, number, pages, doi, isbn, issn, url, urldate, copyright, category, note, metadata"],examples:["--sort-fields=name,author"],type:"boolean | string[]",convertBoolean:{true:wt,false:void 0},defaultValue:void 0},{key:"sortProperties",cli:{"--sort-properties":r(p=>p.length>0?p:!0,"--sort-properties")},title:"Sort properties",description:["Alias of sort fields (legacy)"],type:"boolean | string[]",deprecated:!0},{key:"stripComments",cli:{"--strip-comments":!0,"--no-strip-comments":!1},toCLI:r(p=>p?"--strip-comments":void 0,"toCLI"),title:"Remove comments",description:["Remove all comments from the bibtex source."],type:"boolean",defaultValue:!1},{key:"trailingCommas",cli:{"--trailing-commas":!0,"--no-trailing-commas":!0},toCLI:r(p=>p?"--trailing-commas":void 0,"toCLI"),title:"Trailing commas",description:["End the last key value pair in each entry with a comma."],type:"boolean",defaultValue:!1},{key:"encodeUrls",cli:{"--encode-urls":!0,"--no-encode-urls":!0},toCLI:r(p=>p?"--encode-urls":void 0,"toCLI"),title:"Encode URLs",description:["Replace invalid URL characters with percent encoded values."],type:"boolean",defaultValue:!1},{key:"tidyComments",cli:{"--tidy-comments":!0,"--no-tidy-comments":!1},toCLI:r(p=>p===!1?"--no-tidy-comments":void 0,"toCLI"),title:"Tidy comments",description:["Remove whitespace surrounding comments."],type:"boolean",defaultValue:!0},{key:"removeEmptyFields",cli:{"--remove-empty-fields":!0,"--no-remove-empty-fields":!1},toCLI:r(p=>p?"--remove-empty-fields":void 0,"toCLI"),title:"Remove empty fields",description:["Remove any fields that have empty values."],type:"boolean",defaultValue:!1},{key:"removeDuplicateFields",cli:{"--remove-dupe-fields":!0,"--no-remove-dupe-fields":!1},toCLI:r(p=>p===!1?"--no-remove-dupe-fields":void 0,"toCLI"),title:"Remove duplicate fields",description:["Only allow one of each field in each entry. Enabled by default."],type:"boolean",defaultValue:!0},{key:"generateKeys",cli:{"--generate-keys":r(p=>p.length>0?p:!0,"--generate-keys")},toCLI:r(p=>{if(p===!0||p===ht)return"--generate-keys";if(typeof p=="string")return`--generate-keys="${p.replace(/"/g,'\\"')}"`},"toCLI"),title:"Generate citation keys [Experimental]",description:["For all entries replace the key with a new key of the form <author><year><title>. A JabRef citation pattern can be provided. This is an experimental option that may change without warning."],type:"boolean | string",convertBoolean:{true:ht,false:void 0},defaultValue:void 0},{key:"maxAuthors",cli:{"--max-authors":r(p=>Number(p[0]),"--max-authors")},toCLI:r(p=>p?`--max-authors=${p}`:void 0,"toCLI"),title:"Maximum authors",description:['Truncate authors if above a given number into "and others".'],type:"number"},{key:"lowercase",cli:{"--no-lowercase":!1},toCLI:r(p=>p===!1?"--no-lowercase":void 0,"toCLI"),title:"Lowercase fields",description:["Lowercase field names and entry type. Enabled by default."],type:"boolean",defaultValue:!0},{key:"enclosingBraces",cli:{"--enclosing-braces":r(p=>p.length>0?p:!0,"--enclosing-braces")},toCLI:r(p=>{if(Array.isArray(p)&&p.length>0)return`--enclosing-braces=${p.join(",")}`;if(p===!0)return"--enclosing-braces"},"toCLI"),title:"Enclose values in double braces",description:["Enclose the given fields in double braces, such that case is preserved during BibTeX compilation."],examples:["--enclosing-braces=title,journal (output title and journal fields will be of the form {{This is a title}})","--enclosing-braces (equivalent to ---enclosing-braces=title)"],type:"boolean | string[]",convertBoolean:{true:["title"],false:void 0}},{key:"removeBraces",cli:{"--remove-braces":r(p=>p.length>0?p:!0,"--remove-braces")},toCLI:r(p=>{if(Array.isArray(p)&&p.length>0)return`--remove-braces=${p.join(",")}`;if(p===!0)return"--remove-braces"},"toCLI"),title:"Remove braces",description:["Remove any curly braces within the value, unless they are part of a command."],examples:["--remove-braces=title,journal","--remove-braces (equivalent to ---remove-braces=title)"],type:"boolean | string[]",convertBoolean:{true:["title"],false:void 0}},{key:"wrap",cli:{"--wrap":r(p=>p.length>0?Number(p[0]):!0,"--wrap"),"--no-wrap":!1},toCLI:r(p=>p?`--wrap=${p}`:void 0,"toCLI"),title:"Wrap values",description:["Wrap long values at the given column"],examples:["--wrap (80 by default)","--wrap=82"],type:"boolean | number",convertBoolean:{true:Ye,false:void 0}},{key:"version",cli:{"--version":!0,"-v":!0},title:"Version",description:["Show bibtex-tidy version."],type:"boolean"},{key:"quiet",cli:{"--quiet":!0},title:"Quiet",description:["Suppress logs on stdout."],type:"boolean"},{key:"backup",cli:{"--backup":!0,"--no-backup":!1},title:"Backup",description:["Make a backup <filename>.original. Enabled by default (unless --modify is explicitly provided or outputting to a different file/stdio). Deprecated but provided for backward compatibility."],type:"boolean",defaultValue:!0,deprecated:!0}];function at(p){return Object.fromEntries(on.map(E=>{const F=E.key,O=p[F];return E.convertBoolean&&typeof O=="boolean"?[F,O?E.convertBoolean.true:E.convertBoolean.false]:typeof O>"u"&&E.defaultValue!==void 0?typeof E.defaultValue=="function"?[F,E.defaultValue(p)]:[F,E.defaultValue]:[F,O]}))}r(at,"normalizeOptions");function an(p,E,F){const O=new Map,H=[];for(const ee of p.children){if(ee.type==="text"||ee.block?.type!=="entry"&&!F.includes("special")){H.push(ee);continue}const L=new Map;for(let we of F){we.startsWith("-")&&(we=we.slice(1));let ae;switch(we){case"key":if(ee.block?.type!=="entry")continue;ae=ee.block.key??"";break;case"type":ae=ee.command;break;case"month":{if(ee.block?.type!=="entry")continue;const Re=E.get(ee.block)?.get(we),Ae=Re?Xe.indexOf(Re):-1;ae=Ae>-1?Ae:"";break}case"special":ae=re(ee)?0:1;break;default:if(ee.block?.type!=="entry")continue;ae=E.get(ee.block)?.get(we)??""}L.set(we,typeof ae=="string"?ae.toLowerCase():ae)}for(O.set(ee,L);H.length>0;){const we=H.pop();if(!we)break;O.set(we,L)}}for(const ee of[...F].reverse()){const L=ee.startsWith("-"),we=L?ee.slice(1):ee;p.children.sort((ae,Re)=>{let Ae=O.get(ae)?.get(we)??"",je=O.get(Re)?.get(we)??"";return typeof Ae=="number"&&(Ae=String(Ae).padStart(50,"0")),typeof je=="number"&&(je=String(je).padStart(50,"0")),(L?je:Ae).localeCompare(L?Ae:je)})}}r(an,"sortEntries");var k=new Set(["string","preamble","set","xdata"]);function re(p){return k.has(p.command.toLowerCase())}r(re,"isBibLaTeXSpecialEntry");function te(p,E){for(const F of jt(p))F.fields.sort((O,H)=>{const ee=E.indexOf(O.name.toLocaleLowerCase()),L=E.indexOf(H.name.toLocaleLowerCase());return ee===-1&&L===-1?0:ee===-1?1:L===-1?-1:L<ee?1:L>ee?-1:0})}r(te,"sortEntryFields");function Te(p,E={}){const F=at(E),O=I(p),H=$(O),ee=jt(H).filter(Ae=>!Ae.key).map(Ae=>({code:"MISSING_KEY",message:`${Ae.parent.command} entry does not have a citation key.`})),L=Rt(H,F),we=yt(H,L,F.duplicates,F.merge);ee.push(...we.warnings),H.children=H.children.filter(Ae=>!qe(Ae)||!we.entries.has(Ae.block)),F.sort&&an(H,L,F.sort),F.sortFields&&te(H,F.sortFields);const ae=F.generateKeys?z(H,L,F.generateKeys):void 0;return{bibtex:pt(H,F,ae),warnings:ee,count:jt(H).length}}r(Te,"tidy");function Rt(p,E){return new Map(jt(p).map(F=>[F,new Map(F.fields.map(O=>[O.name.toLocaleLowerCase(),ke(O,E)??""]))]))}r(Rt,"generateValueLookup");function jt(p){return p.children.filter(qe).map(E=>E.block)}return r(jt,"getEntries"),xo}var ag=og();class pa extends Error{constructor(e){super(e==="too-large"?"BibTeX input is too large to format":"BibTeX input is invalid"),this.kind=e,this.name="BibtexFormatError"}kind}const cg=new Set(["comment","string","preamble"]),lg={lowercase:!1,removeDuplicateFields:!1};function ug(t){return new TextEncoder().encode(t).byteLength}function Sd(t){if(!Number.isSafeInteger(t)||t<1)throw new RangeError("Citation BibTeX limit must be a positive integer.");return t}function ma(t){return`${Math.round(Sd(t)/1024)} KB`}function Ka(t,e){return ug(t)>Sd(e)}function Wa(t,e){if(!t.trim()||Ka(t,e))return null;try{const n=ag.tidy(t,lg);return{bibtex:n.bibtex,count:n.count}}catch{return null}}function dg(t,e){if(!t.trim())return t;if(Ka(t,e))throw new pa("too-large");const n=Wa(t,e);if(!n)throw new pa("invalid");return n.bibtex}function jd(t,e){if(!t.trim())return{status:"empty",entries:[]};if(Ka(t,e))return{status:"too-large",entries:[]};const n=Wa(t,e);if(!n)return{status:"invalid",entries:[]};if(n.count===0)return{status:"empty",entries:[]};const s=[];let r=0;for(;r<t.length;){const o=t.indexOf("@",r);if(o<0)break;r=o+1;const a=t.lastIndexOf(`
|
|
39
|
-
`,o-1)+1;if(fg(t,a,o))continue;const c=t.slice(o).match(/^@([A-Za-z][A-Za-z0-9_-]*)\s*([\{\(])/);if(!c||c.index===void 0)continue;const l=o+c[0].length-1,u=Ga(t,l,c[2]==="{"?"}":")");if(u<0)continue;const d=Bd(t.slice(o,u+1));d&&s.push(d),r=u+1}return{status:"ok",entries:s}}function Nl(t,e){const n=t.trim(),s=Wa(n,e);return!s||s.count!==1?null:Bd(n)}function hg(t){const e=t.bibtex.match(/^@([A-Za-z][A-Za-z0-9_-]*)\s*([\{\(])\s*[^,\s\}\)]+\s*,/s);if(!e||e.index===void 0)return null;const n=t.bibtex.indexOf(e[2],e.index);if(Ga(t.bibtex,n,e[2]==="{"?"}":")")<0)return null;const r=Td(t.bibtex.slice(e[0].length,-1));if(!r)return null;const o=e[1].toLowerCase();return(/inproceedings|conference|incollection/.test(o)?r.booktitle??r.journal:r.journal??r.booktitle)?.trim()||null}function Bd(t){const e=t.match(/^@([A-Za-z][A-Za-z0-9_-]*)\s*([\{\(])\s*([^,\s\}\)]+)\s*,/s);if(!e)return null;const n=t.indexOf(e[2],e.index??0);if(Ga(t,n,e[2]==="{"?"}":")")!==t.length-1)return null;const r=e[1];if(cg.has(r.toLowerCase()))return null;const o=Td(t.slice(e[0].length,-1));return o?{citationKey:e[3],entryType:r,bibtex:t,title:o.title??null,authors:o.author??null,year:o.year??null}:null}function fg(t,e,n){let s=!1;for(let r=e;r<n;r+=1){const o=t[r];if(o==="%"&&!s)return!0;o==="\\"?s=!s:s=!1}return!1}function Ga(t,e,n){let s=0,r=0,o=!1,a=!1;for(let c=e;c<t.length;c+=1){const l=t[c];if(a){a=!1;continue}if(l==="\\"){a=!0;continue}if(n==="}"){if(l==='"'&&s===1&&(o=!o),l==="{")s+=1;else if(l==="}"&&--s===0)return c;continue}if(l==="{"&&!o){r+=1;continue}if(l==="}"&&!o&&r>0){r-=1;continue}if(!(r>0)){if(l==='"'){o=!o;continue}if(!o){if(l==="(")s+=1;else if(l===")"&&--s===0)return c}}}return-1}function Td(t){const e={};for(const n of pg(t,",")){if(!n.trim())continue;const s=n.replace(/(^|[\r\n])\s*%[^\r\n]*/g,"$1").trim();if(!s)continue;const r=s.match(/^\s*([A-Za-z][A-Za-z0-9_-]*)\s*=\s*([\s\S]*)$/);if(!r||!r[2].trim())return null;const o=mg(r[2]);o&&(e[r[1].toLowerCase()]=o)}return e}function pg(t,e){const n=[];let s=0,r=0,o=!1,a=!1;for(let c=0;c<t.length;c+=1){const l=t[c];if(a){a=!1;continue}if(l==="\\"){a=!0;continue}if(l==='"'){o=!o;continue}o||(l==="{"?r+=1:l==="}"?r=Math.max(0,r-1):l===e&&r===0&&(n.push(t.slice(s,c)),s=c+1))}return n.push(t.slice(s)),n}function mg(t){let e=t.trim();return(e.startsWith("{")&&e.endsWith("}")||e.startsWith('"')&&e.endsWith('"'))&&(e=e.slice(1,-1)),e.replace(/\s+/g," ").trim()}const Dg=[],gg={status:"empty",entries:Dg};function Ld({open:t,onOpenChange:e,page:n=!1,onBack:s,currentFile:r="",currentSource:o="",readOnly:a=!1,currentUserId:c,maxBibtexBytes:l,onInsert:u}){const{t:d}=ot(),[h,D]=f.useState("library"),[m,g]=f.useState(""),[y,b]=f.useState(""),[w,x]=f.useState([]),[j,N]=f.useState(1),[$,V]=f.useState({page:1,pageSize:60,total:0,totalPages:0}),[U,G]=f.useState(0),[Y,W]=f.useState([]),[ue,P]=f.useState(""),[K,B]=f.useState("green"),[S,R]=f.useState(null),[he,be]=f.useState([]),[Fe,Ne]=f.useState(!1),[Z,T]=f.useState(!1),[ge,I]=f.useState(null),[X,ce]=f.useState(null),[Ce,se]=f.useState(""),[A,fe]=f.useState(!1),[ve,qe]=f.useState(""),[yt,Qe]=f.useState(null),[Xe,ye]=f.useState(null),[We,Je]=f.useState(""),[pt,De]=f.useState(""),[Et,le]=f.useState(""),[ke,Oe]=f.useState(new Map),[mt,Ue]=f.useState(!1),[z,pe]=f.useState(0),q=!!(/\.bib$/i.test(r)&&u),Ve=f.useMemo(()=>t&&q?jd(o,l):gg,[t,o,q,l]),Ge=Ve.status==="too-large",st=Ve.status==="invalid",Ee=Ve.entries,dt=f.useMemo(()=>new Set(Ee.map(k=>k.citationKey.toLowerCase())),[Ee]);f.useEffect(()=>{if(!t)return;const k=new AbortController,re=window.setTimeout(()=>{T(!0),De("");const te=new URLSearchParams;m.trim()&&te.set("q",m.trim()),y&&te.set("tag",y),te.set("page",String(j)),te.set("pageSize","60"),ne(`/api/citations?${te.toString()}`,{signal:k.signal}).then(Te=>{x(Te.entries),V(Te.pagination),Te.pagination.page!==j&&N(Te.pagination.page)}).catch(Te=>{Te instanceof Error&&Te.name==="AbortError"||De(de(Te))}).finally(()=>{k.signal.aborted||T(!1)})},m.trim()?180:0);return()=>{window.clearTimeout(re),k.abort()}},[t,m,y,j,U]),f.useEffect(()=>{if(!t)return;const k=new AbortController;return ne("/api/citations/tags",{signal:k.signal}).then(re=>W(re.tags)).catch(re=>{re instanceof Error&&re.name==="AbortError"||De(de(re))}),()=>k.abort()},[t]),f.useEffect(()=>{if(!t||!q){Oe(new Map),Ue(!1);return}const k=new AbortController,re=[...new Set(Ee.map(te=>te.citationKey))];return re.length?(Ue(!0),ne("/api/citations/lookup",{method:"POST",body:JSON.stringify({keys:re}),signal:k.signal}).then(te=>{Oe(new Map(te.matches.map(Te=>[Te.citationKey.toLowerCase(),Te])))}).catch(te=>{te instanceof Error&&te.name==="AbortError"||De(de(te))}).finally(()=>{k.signal.aborted||Ue(!1)}),()=>k.abort()):(Oe(new Map),Ue(!1),()=>k.abort())},[t,q,Ee,z]),f.useEffect(()=>{t&&(D("library"),g(""),b(""),N(1),V({page:1,pageSize:60,total:0,totalPages:0}),ce(null),fe(!1),qe(""),R(null),Qe(null),ye(null),Je(""),De(""),le(""),Oe(new Map))},[t,q]);const Q=async k=>{I(k.citationKey),De("");try{const re=ke.get(k.citationKey.toLowerCase()),te=await ne("/api/citations",{method:"POST",body:JSON.stringify({bibtex:k.bibtex,citationKey:k.citationKey,entryType:k.entryType,title:k.title,authors:k.authors,year:k.year,overwrite:!!re,expectedRevision:re?.revision})});x(Te=>[te.entry,...Te.filter(Rt=>Rt.id!==te.entry.id&&Rt.citationKey.toLowerCase()!==te.entry.citationKey.toLowerCase())]),Oe(Te=>new Map(Te).set(te.entry.citationKey.toLowerCase(),{id:te.entry.id,citationKey:te.entry.citationKey,revision:te.entry.revision})),R(te.entry),be(te.entry.tags.map(Te=>Te.id)),le(te.updated?d("citationLibrary.updated"):d("citationLibrary.saved")),N(1),G(Te=>Te+1)}catch(re){De(de(re)),pe(te=>te+1)}finally{I(null)}},_=async()=>{if(X){I(X.citationKey),De("");try{const k=Nl(Ce,l);if(!k){De(d("citationErrors.invalid"));return}const re=await ne(`/api/citations/${encodeURIComponent(X.id)}`,{method:"PATCH",body:JSON.stringify({bibtex:k.bibtex,citationKey:k.citationKey,entryType:k.entryType,title:k.title,authors:k.authors,year:k.year,expectedRevision:X.revision})});x(te=>[re.entry,...te.filter(Te=>Te.id!==re.entry.id)]),Oe(te=>{const Te=new Map(te);return Te.delete(X.citationKey.toLowerCase()),Te.set(re.entry.citationKey.toLowerCase(),{id:re.entry.id,citationKey:re.entry.citationKey,revision:re.entry.revision}),Te}),ce(null),le(d("citationLibrary.updated")),N(1),G(te=>te+1)}catch(k){De(de(k))}finally{I(null)}}},Ye=async()=>{if(ve.trim()){I("__new__"),De("");try{const k=Nl(ve,l);if(!k){De(d("citationErrors.invalid"));return}const re=await ne("/api/citations",{method:"POST",body:JSON.stringify({bibtex:k.bibtex,citationKey:k.citationKey,entryType:k.entryType,title:k.title,authors:k.authors,year:k.year})});x(te=>[re.entry,...te.filter(Te=>Te.id!==re.entry.id&&Te.citationKey.toLowerCase()!==re.entry.citationKey.toLowerCase())]),Oe(te=>new Map(te).set(re.entry.citationKey.toLowerCase(),{id:re.entry.id,citationKey:re.entry.citationKey,revision:re.entry.revision})),fe(!1),qe(""),le(re.updated?d("citationLibrary.updated"):d("citationLibraryActions.added")),R(re.entry),be(re.entry.tags.map(te=>te.id)),N(1),G(te=>te+1)}catch(k){De(de(k))}finally{I(null)}}},wt=async()=>{if(ue.trim()){De("");try{const k=await ne("/api/citations/tags",{method:"POST",body:JSON.stringify({name:ue.trim(),color:K})});W(re=>[...re.filter(te=>te.id!==k.tag.id),k.tag].sort((te,Te)=>te.name.localeCompare(Te.name))),P(""),le(d("citationLibrary.tagCreated"))}catch(k){De(de(k))}}},At=k=>{ce(null),fe(!1),R(k),be(k.tags.map(re=>re.id))},ht=async()=>{if(S){Ne(!0),De("");try{const k=await ne(`/api/citations/${encodeURIComponent(S.id)}/tags`,{method:"PATCH",body:JSON.stringify({tagIds:he,expectedRevision:S.revision})});x(re=>re.map(te=>te.id===k.entry.id?k.entry:te)),Oe(re=>new Map(re).set(k.entry.citationKey.toLowerCase(),{id:k.entry.id,citationKey:k.entry.citationKey,revision:k.entry.revision})),R(k.entry),be(k.entry.tags.map(re=>re.id)),le(d("citationLibrary.tagsUpdated")),G(re=>re+1)}catch(k){De(de(k))}finally{Ne(!1)}}},on=async k=>{Qe(k.id),Je("");try{await ne(`/api/citations/${encodeURIComponent(k.id)}`,{method:"DELETE"}),x(re=>re.filter(te=>te.id!==k.id)),Oe(re=>{const te=new Map(re);return te.delete(k.citationKey.toLowerCase()),te}),X?.id===k.id&&ce(null),S?.id===k.id&&R(null),le(d("citationLibrary.deleted")),N(1),G(re=>re+1),ye(null)}catch(re){Je(de(re))}finally{Qe(null)}},at=i.jsxs("div",{className:"citation-library-dialog",children:[i.jsxs("div",{className:"citation-library-tabs",role:"tablist","aria-label":d("citationLibrary.title"),children:[i.jsxs("button",{type:"button",role:"tab","aria-selected":h==="library",className:h==="library"?"active":"",onClick:()=>D("library"),children:[i.jsx(Ss,{size:15}),d("citationLibrary.myLibrary"),i.jsx("span",{children:$.total})]}),q&&i.jsxs("button",{type:"button",role:"tab","aria-selected":h==="current",className:h==="current"?"active":"",onClick:()=>D("current"),children:[i.jsx(ci,{size:15}),d("citationLibrary.currentFile"),i.jsx("span",{children:Ee.length})]})]}),pt&&!(n&&(S||X))&&i.jsx("p",{className:"error dialog-error",children:pt}),Et&&i.jsxs("p",{className:"citation-library-notice",role:"status",children:[i.jsx(is,{size:14}),Et,i.jsx("button",{type:"button","aria-label":d("common.close"),onClick:()=>le(""),children:i.jsx(Ht,{size:13})})]}),h==="library"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"citation-library-search-row",children:[i.jsxs("label",{className:"citation-library-search",children:[i.jsx(Ad,{size:15}),i.jsx("input",{autoFocus:!0,placeholder:d("citationLibrary.searchPlaceholder"),value:m,onChange:k=>{g(k.target.value),N(1)}}),i.jsx("span",{children:d("citationLibrary.searchHint")})]}),i.jsxs("button",{type:"button",className:"citation-add-entry-button",onClick:()=>{fe(!0),ce(null),R(null)},children:[i.jsx(ci,{size:14}),d("citationLibraryActions.addEntry")]})]}),i.jsxs("div",{className:"citation-tag-bar",children:[i.jsxs("div",{className:"citation-tag-filters",children:[i.jsx("button",{type:"button",className:y?"":"active",onClick:()=>{b(""),N(1)},children:d("citationLibrary.allTags")}),Y.map(k=>i.jsxs("button",{type:"button",className:y===k.id?"active":"",onClick:()=>{b(y===k.id?"":k.id),N(1)},children:[i.jsx("span",{className:`citation-tag-dot tag-${k.color}`}),k.name]},k.id)),Y.length===0&&i.jsx("span",{className:"muted",children:d("citationLibrary.noTags")})]}),i.jsxs("div",{className:"citation-tag-create",children:[i.jsx("input",{value:ue,placeholder:d("citationLibrary.newTagPlaceholder"),onChange:k=>P(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),wt())}}),i.jsx("select",{"aria-label":d("citationLibrary.tagColor"),value:K,onChange:k=>B(k.target.value),children:["red","orange","yellow","green","blue","purple","gray"].map(k=>i.jsx("option",{value:k,children:d(`tags.${k}`)},k))}),i.jsxs("button",{type:"button",disabled:!ue.trim(),title:d("citationLibrary.createTag"),onClick:()=>{wt()},children:[i.jsx(ci,{size:13}),d("citationLibrary.createTag")]})]})]}),A&&i.jsxs("div",{className:"citation-edit-panel",children:[i.jsxs("div",{className:"citation-edit-header",children:[i.jsxs("div",{children:[i.jsx("strong",{children:d("citationLibraryActions.addEntryTitle")}),i.jsx("small",{children:d("citationLibraryActions.addEntryDescription")})]}),i.jsx("button",{type:"button","aria-label":d("common.close"),onClick:()=>fe(!1),children:i.jsx(Ht,{size:15})})]}),i.jsx("textarea",{autoFocus:!0,value:ve,onChange:k=>qe(k.target.value),placeholder:d("citationLibraryActions.addEntryPlaceholder"),spellCheck:!1,rows:9}),i.jsxs("div",{className:"citation-edit-actions",children:[i.jsx("button",{type:"button",onClick:()=>fe(!1),children:d("common.cancel")}),i.jsxs("button",{type:"button",className:"primary",disabled:!ve.trim()||ge==="__new__",onClick:()=>{Ye()},children:[ge==="__new__"?i.jsx(ut,{className:"spin",size:14}):i.jsx(is,{size:14}),d("citationLibraryActions.addEntry")]})]})]}),Z?i.jsxs("div",{className:"citation-library-empty",children:[i.jsx(ut,{className:"spin",size:22}),i.jsx("span",{children:d("common.loading")})]}):w.length===0?i.jsxs("div",{className:"citation-library-empty",children:[i.jsx(Ss,{size:28}),i.jsx("strong",{children:d("citationLibrary.emptyTitle")}),i.jsx("span",{children:d(y?"citationLibrary.noTagMatches":"citationLibrary.emptyDescription")})]}):i.jsx("div",{className:"citation-entry-list",children:w.map(k=>i.jsxs("div",{className:"citation-entry-item",children:[i.jsx(Rl,{entry:k,currentUserId:c,selected:S?.id===k.id||X?.id===k.id,alreadyInFile:!n&&dt.has(k.citationKey.toLowerCase()),importDisabled:a,deleting:yt===k.id,onImport:u?async()=>{await u(k)&&e(!1)}:void 0,onEdit:k.ownerId===c?()=>{R(null),fe(!1),ce(k),se(k.bibtex)}:void 0,onTags:k.ownerId===c?()=>At(k):void 0,onDelete:k.ownerId===c?()=>{ye(k),Je("")}:void 0,t:d}),!n&&S?.id===k.id&&i.jsx(vo,{entry:S,tags:Y,selectedIds:he,saving:Fe,onClose:()=>R(null),onToggle:re=>be(te=>te.includes(re)?te.filter(Te=>Te!==re):[...te,re]),onSave:()=>{ht()},t:d}),!n&&X?.id===k.id&&i.jsx(Ol,{title:d("citationLibrary.editTitle",{key:X.citationKey}),value:Ce,saving:ge===X.citationKey,onChange:se,onClose:()=>ce(null),onSave:()=>{_()},t:d})]},k.id))}),$.totalPages>1&&i.jsxs("nav",{className:"citation-library-pagination","aria-label":d("citationLibraryPagination.pageOf",{page:$.page,totalPages:$.totalPages,count:$.total}),children:[i.jsxs("button",{type:"button",disabled:$.page<=1,onClick:()=>N(k=>Math.max(1,k-1)),children:[i.jsx(br,{size:14}),d("citationLibraryPagination.previous")]}),i.jsx("span",{children:d("citationLibraryPagination.pageOf",{page:$.page,totalPages:$.totalPages,count:$.total})}),i.jsxs("button",{type:"button",disabled:$.page>=$.totalPages,onClick:()=>N(k=>Math.min($.totalPages,k+1)),children:[d("citationLibraryPagination.next"),i.jsx(Mi,{size:14})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"citation-current-heading",children:[i.jsxs("div",{children:[i.jsx("strong",{children:d("citationLibrary.currentFileTitle")}),i.jsx("span",{children:d("citationLibrary.currentFileDescription")})]}),i.jsxs("button",{type:"button",onClick:()=>D("library"),children:[i.jsx(br,{size:14}),d("citationLibrary.backToLibrary")]})]}),Ge&&i.jsxs("p",{className:"warning citation-library-warning",children:[i.jsx(nn,{size:15}),d("citationLibrary.fileTooLarge",{size:ma(l)})]}),st&&i.jsxs("p",{className:"warning citation-library-warning",children:[i.jsx(nn,{size:15}),d("citationLibrary.fileInvalid")]}),Ee.length===0?i.jsxs("div",{className:"citation-library-empty",children:[i.jsx(Ss,{size:28}),i.jsx("strong",{children:d("citationLibrary.noEntries")}),i.jsx("span",{children:d(Ge?"citationLibrary.fileTooLargeHint":st?"citationLibrary.fileInvalidHint":"citationLibrary.noEntriesDescription")})]}):i.jsx("div",{className:"citation-entry-list",children:Ee.map((k,re)=>i.jsxs("div",{className:"citation-entry-item",children:[i.jsx(Rl,{entry:k,saved:ke.has(k.citationKey.toLowerCase()),saving:ge===k.citationKey,saveDisabled:mt,onSave:()=>{Q(k)},t:d}),!n&&S?.citationKey.toLowerCase()===k.citationKey.toLowerCase()&&i.jsx(vo,{entry:S,tags:Y,selectedIds:he,saving:Fe,onClose:()=>R(null),onToggle:te=>be(Te=>Te.includes(te)?Te.filter(Rt=>Rt!==te):[...Te,te]),onSave:()=>{ht()},t:d})]},`${k.citationKey}-${re}`))})]})]}),an=i.jsx(Vn,{open:!!Xe,title:d("citationLibrary.deleteTitle"),description:d("citationLibrary.deleteDescription",{key:Xe?.citationKey??""}),confirmLabel:d("common.delete"),danger:!0,error:We,busy:!!yt,onCancel:()=>{ye(null),Je("")},onConfirm:()=>{const k=Xe;k&&on(k)}});return n?i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"citation-library-page",children:[i.jsxs("header",{className:"citation-library-page-header",children:[i.jsxs("div",{children:[i.jsxs("h1",{children:[i.jsx(Ss,{"aria-hidden":!0,size:26}),d("citationLibrary.title")]}),i.jsx("p",{children:d("citationLibraryHomeDescription")})]}),s&&i.jsxs("button",{type:"button",onClick:s,children:[i.jsx(br,{size:15}),d("projects.title")]})]}),at]}),S&&i.jsx(bt,{open:!0,title:d("citationLibrary.tagsTitle",{key:S.citationKey}),description:d("citationLibrary.tags"),onOpenChange:k=>{k||(R(null),De(""))},children:i.jsxs(i.Fragment,{children:[pt&&i.jsx("p",{className:"error dialog-error",children:pt}),i.jsx(vo,{entry:S,tags:Y,selectedIds:he,saving:Fe,modal:!0,onClose:()=>{R(null),De("")},onToggle:k=>be(re=>re.includes(k)?re.filter(te=>te!==k):[...re,k]),onSave:()=>{ht()},t:d})]})}),X&&i.jsx(bt,{open:!0,extraWide:!0,title:d("citationLibrary.editTitle",{key:X.citationKey}),description:d("citationLibrary.title"),onOpenChange:k=>{k||(ce(null),De(""))},children:i.jsxs(i.Fragment,{children:[pt&&i.jsx("p",{className:"error dialog-error",children:pt}),i.jsx(Ol,{title:d("citationLibrary.editTitle",{key:X.citationKey}),value:Ce,saving:ge===X.citationKey,modal:!0,onChange:se,onClose:()=>{ce(null),De("")},onSave:()=>{_()},t:d})]})}),an]}):i.jsxs(i.Fragment,{children:[i.jsx(bt,{open:t,extraWide:!0,className:"citation-library-modal",title:d("citationLibrary.title"),description:d(q?"citationLibrary.description":"citationLibraryHomeDescription",{file:r}),onOpenChange:e,footer:i.jsx("button",{onClick:()=>e(!1),children:d("common.close")}),children:at}),an]})}function Rl({entry:t,currentUserId:e,selected:n,alreadyInFile:s,saved:r,saving:o,saveDisabled:a,importDisabled:c,deleting:l,onSave:u,onImport:d,onEdit:h,onTags:D,onDelete:m,t:g}){const y="id"in t,b=y?t:null,w=hg(t);return i.jsxs("article",{className:`citation-entry-card${n?" selected":""}${s?" already-in-file":""}`,title:s?g("citationErrors.alreadyInFile",{key:t.citationKey}):void 0,children:[i.jsxs("div",{className:"citation-entry-main",children:[i.jsxs("div",{className:"citation-entry-heading",children:[i.jsx("code",{children:t.citationKey}),i.jsxs("span",{children:["@",t.entryType]}),w&&i.jsx("span",{className:"citation-entry-venue",title:w,children:w}),r&&i.jsxs("em",{children:[i.jsx(is,{size:11}),g("citationLibrary.savedLabel")]})]}),i.jsx("strong",{children:t.title||g("citationLibrary.untitled")}),i.jsxs("p",{children:[t.authors||g("citationLibrary.authorUnknown"),t.year&&i.jsxs("span",{children:[" · ",t.year]})]}),b&&b.tags.length>0&&i.jsx("div",{className:"citation-entry-tags",children:b.tags.map(x=>i.jsxs("span",{className:`citation-tag-pill tag-${x.color}`,children:[i.jsx("span",{className:"citation-tag-dot"}),x.name]},x.id))})]}),i.jsxs("div",{className:"citation-entry-actions",children:[u&&i.jsxs("button",{type:"button",className:r?"saved":"primary",disabled:o||a,onClick:u,children:[o||a?i.jsx(ut,{className:"spin",size:13}):r?i.jsx(is,{size:13}):i.jsx(ci,{size:13}),g(o?"citationLibrary.saving":r?"citationLibrary.update":"citationLibrary.save")]}),d&&i.jsxs("button",{type:"button",disabled:c||s,title:s?g("citationErrors.alreadyInFile",{key:t.citationKey}):g(c?"citationLibrary.importRequiresWrite":"citationLibrary.importToFile"),onClick:()=>{d()},children:[i.jsx(U0,{size:13}),g("citationLibrary.import")]}),b&&D&&i.jsxs("button",{type:"button",onClick:D,children:[i.jsx(ha,{size:13}),g("citationLibrary.tags")]}),y&&h&&i.jsxs("button",{type:"button",onClick:h,children:[i.jsx(G0,{size:13}),g("common.edit")]}),y&&m&&i.jsxs("button",{type:"button",className:"danger-text",disabled:l,onClick:m,children:[l?i.jsx(ut,{className:"spin",size:13}):i.jsx(sn,{size:13}),g("common.delete")]})]})]})}function vo({entry:t,tags:e,selectedIds:n,saving:s,modal:r=!1,onClose:o,onToggle:a,onSave:c,t:l}){const u=i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"citation-tag-choice-list",children:e.length===0?i.jsx("span",{className:"muted",children:l("citationLibrary.noTagsToAssign")}):e.map(d=>i.jsxs("label",{children:[i.jsx("input",{type:"checkbox",checked:n.includes(d.id),onChange:()=>a(d.id)}),i.jsx("span",{className:`citation-tag-dot tag-${d.color}`}),d.name]},d.id))}),i.jsxs("div",{className:"citation-edit-actions",children:[i.jsx("button",{type:"button",onClick:o,children:l("common.cancel")}),i.jsxs("button",{type:"button",className:"primary",disabled:s||e.length===0,onClick:c,children:[s?i.jsx(ut,{className:"spin",size:14}):i.jsx(is,{size:14}),l("citationLibrary.saveTags")]})]})]});return r?i.jsx("div",{className:"citation-modal-form",children:u}):i.jsxs("div",{className:"citation-tag-editor",children:[i.jsxs("div",{className:"citation-edit-header",children:[i.jsx("strong",{children:l("citationLibrary.tagsTitle",{key:t.citationKey})}),i.jsx("button",{type:"button","aria-label":l("common.close"),onClick:o,children:i.jsx(Ht,{size:15})})]}),u]})}function Ol({title:t,value:e,saving:n,modal:s=!1,onChange:r,onClose:o,onSave:a,t:c}){const l=i.jsxs(i.Fragment,{children:[i.jsx("textarea",{autoFocus:!s,value:e,onChange:u=>r(u.target.value),spellCheck:!1,rows:12}),i.jsxs("div",{className:"citation-edit-actions",children:[i.jsx("button",{type:"button",onClick:o,children:c("common.cancel")}),i.jsxs("button",{type:"button",className:"primary",disabled:!e.trim()||n,onClick:a,children:[n?i.jsx(ut,{className:"spin",size:14}):i.jsx(is,{size:14}),c("common.save")]})]})]});return s?i.jsx("div",{className:"citation-modal-form citation-edit-panel",children:l}):i.jsxs("div",{className:"citation-edit-panel",children:[i.jsxs("div",{className:"citation-edit-header",children:[i.jsx("strong",{children:t}),i.jsx("button",{type:"button","aria-label":c("common.close"),onClick:o,children:i.jsx(Ht,{size:15})})]}),l]})}function Fg(t=10){const e="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%",n=crypto.getRandomValues(new Uint8Array(t));return Array.from(n,s=>e[s%e.length]).join("")}function bg({currentUser:t,minPasswordLength:e}){const{t:n}=ot(),[s,r]=f.useState([]),[o,a]=f.useState(""),[c,l]=f.useState(!1),[u,d]=f.useState({username:"",displayName:"",password:"",role:"user",canCreateProjects:!1}),[h,D]=f.useState(null),[m,g]=f.useState(""),[y,b]=f.useState(null),[w,x]=f.useState(!1),[j,N]=f.useState(!1),[$,V]=f.useState(""),[U,G]=f.useState(null),[Y,W]=f.useState(!1),[ue,P]=f.useState(""),K=()=>ne("/api/admin/users").then(({users:T})=>r(T)).catch(T=>a(de(T)));f.useEffect(()=>{K()},[]);const B=async()=>{if(u.password.length<e)return a(n("auth.passwordMinimum",{count:e}));try{await ne("/api/admin/users",{method:"POST",body:JSON.stringify({username:u.username,displayName:u.displayName||u.username,password:u.password,role:u.role,canCreateProjects:u.canCreateProjects})}),l(!1),d({username:"",displayName:"",password:"",role:"user",canCreateProjects:!1}),await K()}catch(T){a(de(T))}},S=async(T,ge)=>{try{await ne(`/api/admin/users/${T.id}`,{method:"PATCH",body:JSON.stringify(ge)}),await K()}catch(I){a(de(I))}},R=async T=>{if(!T.disabled){G({target:T,setting:"disable"}),P("");return}await S(T,{disabled:!1})},he=async T=>{if(T.role==="admin"){G({target:T,setting:"demote"}),P("");return}await S(T,{role:"admin"})},be=async T=>{if(T.canCreateProjects){G({target:T,setting:"denyProjectCreation"}),P("");return}await S(T,{canCreateProjects:!0})},Fe=async()=>{if(!U)return;const{target:T,setting:ge}=U,I=ge==="disable"?{disabled:!0}:ge==="demote"?{role:"user"}:{canCreateProjects:!1};W(!0),P("");try{await ne(`/api/admin/users/${T.id}`,{method:"PATCH",body:JSON.stringify(I)}),await K(),G(null)}catch(X){P(de(X))}finally{W(!1)}},Ne=async()=>{if(!(!h||!m)){if(m.length<e)return a(n("auth.passwordMinimum",{count:e}));try{await ne(`/api/admin/users/${h.id}`,{method:"PATCH",body:JSON.stringify({password:m})}),D(null),g("")}catch(T){a(de(T))}}},Z=async()=>{if(!(!y||j)){N(!0),V("");try{await ne(`/api/admin/users/${y.id}`,{method:"DELETE",body:JSON.stringify({deleteProjects:w})}),b(null),x(!1),await K()}catch(T){V(de(T))}finally{N(!1)}}};return i.jsxs("main",{className:"dashboard",children:[i.jsxs("div",{className:"section-title",children:[i.jsxs("div",{children:[i.jsxs("h1",{children:[i.jsx(vr,{"aria-hidden":!0,size:25}),n("users.manage")]}),i.jsx("p",{className:"muted",children:n("users.onlyAdmin")})]}),i.jsxs("button",{className:"primary icon-button",onClick:()=>l(!0),children:[i.jsx(fa,{"aria-hidden":!0,size:15}),n("users.add")]})]}),o&&i.jsx("p",{className:"error",children:o}),i.jsx("div",{className:"table-card",children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:n("common.user")}),i.jsx("th",{children:n("users.role")}),i.jsx("th",{children:n("users.createProjects")}),i.jsx("th",{children:n("users.ownedProjects")}),i.jsx("th",{children:n("users.status")}),i.jsx("th",{children:n("users.actions")})]})}),i.jsx("tbody",{children:s.map(T=>i.jsxs("tr",{children:[i.jsxs("td",{children:[i.jsx("strong",{children:T.displayName}),i.jsxs("small",{children:["@",T.username]})]}),i.jsx("td",{children:T.role==="admin"?n("common.admin"):n("common.user")}),i.jsx("td",{children:T.canCreateProjects?n("users.allow"):n("users.deny")}),i.jsx("td",{children:T.ownedProjects}),i.jsx("td",{children:T.disabled?n("common.disabled"):n("common.normal")}),i.jsxs("td",{children:[i.jsxs("button",{className:"icon-button",disabled:T.id===t.id,onClick:()=>R(T),children:[T.disabled?i.jsx(sg,{"aria-hidden":!0,size:13}):i.jsx(rg,{"aria-hidden":!0,size:13}),T.disabled?n("users.enable"):n("users.disable")]}),i.jsxs("button",{className:"icon-button",disabled:T.id===t.id,onClick:()=>he(T),children:[T.role==="admin"?i.jsx(eg,{"aria-hidden":!0,size:13}):i.jsx(Q0,{"aria-hidden":!0,size:13}),T.role==="admin"?n("users.demote"):n("users.promote")]}),i.jsxs("button",{className:"icon-button",disabled:T.role==="admin",onClick:()=>be(T),children:[T.canCreateProjects?i.jsx(_0,{"aria-hidden":!0,size:13}):i.jsx(P0,{"aria-hidden":!0,size:13}),T.canCreateProjects?n("users.denyCreate"):n("users.allowCreate")]}),i.jsxs("button",{className:"icon-button",onClick:()=>{D(T),g("")},children:[i.jsx(jl,{"aria-hidden":!0,size:13}),n("users.resetPassword")]}),i.jsxs("button",{className:"icon-button danger-text",disabled:T.id===t.id,onClick:()=>{b(T),x(!1),V("")},children:[i.jsx(sn,{"aria-hidden":!0,size:13}),n("common.delete")]})]})]},T.id))})]})}),i.jsx(bt,{open:c,title:n("users.add"),description:n("users.addDescription"),onOpenChange:l,footer:i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"icon-button",onClick:()=>l(!1),children:[i.jsx(Ht,{"aria-hidden":!0,size:14}),n("common.cancel")]}),i.jsxs("button",{className:"primary icon-button",disabled:u.password.length<e,onClick:()=>{B()},children:[i.jsx(fa,{"aria-hidden":!0,size:14}),n("users.createUser")]})]}),children:i.jsxs("div",{className:"form-stack",children:[i.jsxs("label",{className:"form-field",children:[n("auth.username"),i.jsx("input",{value:u.username,onChange:T=>d({...u,username:T.target.value})})]}),i.jsxs("label",{className:"form-field",children:[n("users.displayName"),i.jsx("input",{value:u.displayName,onChange:T=>d({...u,displayName:T.target.value})})]}),i.jsxs("label",{className:"form-field",children:[n("users.initialPassword"),i.jsxs("span",{className:"password-generator",children:[i.jsx("input",{minLength:e,autoComplete:"new-password",value:u.password,onChange:T=>d({...u,password:T.target.value})}),i.jsxs("button",{type:"button",title:n("users.generatePassword"),onClick:()=>d({...u,password:Fg()}),children:[i.jsx(N0,{size:15}),n("users.randomPassword")]})]}),i.jsx("small",{className:"field-hint",children:n("auth.passwordMinimum",{count:e})})]}),i.jsxs("label",{className:"form-field",children:[n("users.role"),i.jsxs("select",{value:u.role,onChange:T=>d({...u,role:T.target.value}),children:[i.jsx("option",{value:"user",children:n("common.user")}),i.jsx("option",{value:"admin",children:n("common.admin")})]})]}),i.jsxs("label",{className:"checkbox-field",children:[i.jsx("input",{type:"checkbox",checked:u.canCreateProjects||u.role==="admin",disabled:u.role==="admin",onChange:T=>d({...u,canCreateProjects:T.target.checked})})," ",n("users.allowCreate")]})]})}),i.jsx(bt,{open:!!h,title:n("users.resetPassword"),description:n("users.resetDescription",{username:h?.username??""}),onOpenChange:T=>{T||D(null)},footer:i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"icon-button",onClick:()=>D(null),children:[i.jsx(Ht,{"aria-hidden":!0,size:14}),n("common.cancel")]}),i.jsxs("button",{className:"primary icon-button",disabled:m.length<e,onClick:()=>{Ne()},children:[i.jsx(jl,{"aria-hidden":!0,size:14}),n("users.reset")]})]}),children:i.jsxs("label",{className:"form-field",children:[n("auth.newPassword"),i.jsx("input",{autoFocus:!0,type:"password",minLength:e,autoComplete:"new-password",value:m,onChange:T=>g(T.target.value)}),i.jsx("small",{className:"field-hint",children:n("auth.passwordMinimum",{count:e})})]})}),i.jsx(bt,{open:!!y,title:n("users.deleteTitle"),description:n("users.deleteDescription",{username:y?.username??""}),onOpenChange:T=>{!T&&!j&&(b(null),V(""))},footer:i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"icon-button",disabled:j,onClick:()=>{b(null),V("")},children:[i.jsx(Ht,{"aria-hidden":!0,size:14}),n("common.cancel")]}),i.jsxs("button",{className:"danger icon-button",disabled:j,"aria-busy":j,onClick:()=>{Z()},children:[j?i.jsx(ut,{className:"spin","aria-hidden":!0,size:14}):i.jsx(sn,{"aria-hidden":!0,size:14}),n(j?"common.loading":"users.deleteTitle")]})]}),children:i.jsxs(i.Fragment,{children:[$&&i.jsx("p",{className:"error dialog-error",children:$}),i.jsxs("fieldset",{className:"choice-group",disabled:j,children:[i.jsx("legend",{children:n("users.ownedChoice",{count:y?.ownedProjects??0})}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",checked:!w,onChange:()=>x(!1)})," ",n("users.transferProjects")]}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",checked:w,onChange:()=>x(!0)})," ",n("users.deleteProjects")]})]})]})}),i.jsx(Vn,{open:!!U,title:n(`userConfirmations.${U?.setting??"disable"}Title`),description:n(`userConfirmations.${U?.setting??"disable"}Description`,{username:U?.target.username??""}),confirmLabel:n(`userConfirmations.${U?.setting??"disable"}Confirm`),danger:!0,busy:Y,error:ue,onCancel:()=>{Y||(G(null),P(""))},onConfirm:()=>{Fe()}})]})}const yg=f.lazy(()=>Gn(()=>import("./SystemMetricsDialog-DimBI7er.js"),__vite__mapDeps([4,1])).then(t=>({default:t.SystemMetricsDialog})));function Cg(t){return t instanceof Error&&t.name==="AbortError"}function Eg(t,e,n,s){const r=new Date(t).getTime();if(!Number.isFinite(r))return t;const o=r-n,a=Math.abs(o),c=60*1e3,l=60*c,u=24*l,d=3*u;if(a>d){const g=Math.floor(a/u),y=o<0?"Past":"Future";return s(`projects.relativeDays${y}`,{days:g,hours:0,minutes:0})}if(a>=u){const g=Math.floor(a/u),y=Math.floor(a%u/l),b=o<0?"Past":"Future",w=y>0?"DaysHours":"Days";return s(`projects.relative${w}${b}`,{days:g,hours:y,minutes:0})}if(a>=l){const g=Math.floor(a/l),y=Math.floor(a%l/c),b=o<0?"Past":"Future",w=y>0?"HoursMinutes":"Hours";return s(`projects.relative${w}${b}`,{days:0,hours:g,minutes:y})}const h="minute",D=c,m=Math.sign(o)*Math.max(1,Math.floor(a/D));return new Intl.RelativeTimeFormat(e,{numeric:"always"}).format(m,h)}function wg(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function xg({site:t,user:e,initialData:n,onDataChange:s,onUser:r,onOpenProject:o}){const{t:a}=ot(),[c,l]=f.useState(()=>n?.projects??[]),[u,d]=f.useState(()=>n?.tags??[]),[h,D]=f.useState(()=>n?.pagination??{page:1,pageSize:20,total:n?.projects.length??0,totalPages:n?.projects.length?1:0}),[m,g]=f.useState(!!n),[y,b]=f.useState(!1),[w,x]=f.useState(!1),[j,N]=f.useState(!1),[$,V]=f.useState(""),[U,G]=f.useState(""),[Y,W]=f.useState(""),[ue,P]=f.useState(""),[K,B]=f.useState(""),[S,R]=f.useState(""),[he,be]=f.useState(""),[Fe,Ne]=f.useState(!1),[Z,T]=f.useState(""),[ge,I]=f.useState(!1),[X,ce]=f.useState(!1),[Ce,se]=f.useState(""),[A,fe]=f.useState(null),[ve,qe]=f.useState(""),yt=f.useRef(null),[Qe,Xe]=f.useState(!1),[ye,We]=f.useState(""),[Je,pt]=f.useState(""),[De,Et]=f.useState(!1),[le,ke]=f.useState(""),[Oe,mt]=f.useState("blue"),[Ue,z]=f.useState(null),[pe,q]=f.useState(null),[Ve,Ge]=f.useState(""),[st,Ee]=f.useState(!1),[dt,Q]=f.useState(null),[_,Ye]=f.useState(""),[wt,At]=f.useState(!1),[ht,on]=f.useState(null),[at,an]=f.useState(!1),[k,re]=f.useState(null),[te,Te]=f.useState([]),[Rt,jt]=f.useState(""),[p,E]=f.useState(!1),[F,O]=f.useState(""),[H,ee]=f.useState(()=>localStorage.getItem("texlite-project-view")==="list"?"list":"grid"),[L,we]=f.useState(()=>localStorage.getItem("texlite-project-sort")==="created"?"created":"updated"),[ae,Re]=f.useState(!1),[Ae,je]=f.useState(""),[Ze,Dt]=f.useState(1),[Jt,Pe]=f.useState(()=>Date.now()),[et,ze]=f.useState(""),kt=f.useRef(0),Ut=f.useRef(null),ft=(C,Ie,Me,ct,xt)=>`${C?"archived":"active"}|${Ie}|${Me}|${ct}|${xt}`,He=ft(ae,Ze,ye,Je,L),tt=(C,Ie,Me,ct,xt)=>{const Ot=new URLSearchParams({page:String(Ie),pageSize:"20",sort:xt});C&&Ot.set("archived","1"),Me.trim()&&Ot.set("search",Me.trim()),ct&&Ot.set("tag",ct);const Zn=ft(C,Ie,Me,ct,xt),Ds=++kt.current;Ut.current?.abort();const gs=new AbortController;return Ut.current=gs,Promise.all([ne(`/api/projects?${Ot.toString()}`,{signal:gs.signal}),ne("/api/tags",{signal:gs.signal})]).then(([An,so])=>{Ds===kt.current&&(l(An.projects),d(so.tags),D(An.pagination),Dt(An.pagination.page),g(!0),ze(Zn))}).catch(An=>{!Cg(An)&&Ds===kt.current&&V(de(An))}).finally(()=>{Ut.current===gs&&(Ut.current=null)})};f.useEffect(()=>(tt(ae,Ze,ye,Je,L),()=>Ut.current?.abort()),[ae,Ze,ye,Je,L]),f.useEffect(()=>{m&&!ae&&et===He&&s(c,u,h)},[c,u,h,m,et,He,ae]),f.useEffect(()=>{const C=window.setInterval(()=>Pe(Date.now()),6e4);return()=>window.clearInterval(C)},[]);const Xn=C=>{ee(C),localStorage.setItem("texlite-project-view",C)},ms=C=>{we(C),Dt(1),localStorage.setItem("texlite-project-sort",C)},pn=C=>{Re(C),Dt(1)},On=C=>{pt(C),Dt(1)},Pn=async()=>{if(!(!Z.trim()||ge)){I(!0),G("");try{const{project:C}=await ne("/api/projects",{method:"POST",body:JSON.stringify({name:Z})});Ne(!1),T("");const Ie=ae||Ze!==1?c:[C,...c].slice(0,h.pageSize),Me=ae?h:{...h,total:h.total+1,totalPages:Math.ceil((h.total+1)/h.pageSize)};l(Ie),D(Me),ae||s(Ie,u,Me),o(C.id)}catch(C){G(de(C))}finally{I(!1)}}},vn=async()=>{if(!A)return;const C=t.maxUploadSizeMB;if(A.size>C*1024*1024)return qe(a("errors.fileTooLarge",{size:C}));Xe(!0),qe("");const Ie=new FormData;Ie.append("file",A);try{const{project:Me}=await ne(`/api/projects/import?name=${encodeURIComponent(Ce.trim())}`,{method:"POST",body:Ie}),ct=ae||Ze!==1?c:[Me,...c].slice(0,h.pageSize),xt=ae?h:{...h,total:h.total+1,totalPages:Math.ceil((h.total+1)/h.pageSize)};l(ct),D(xt),ae||s(ct,u,xt),ce(!1),fe(null),se(""),o(Me.id)}catch(Me){qe(de(Me))}finally{Xe(!1)}},Jn=C=>{if(C&&!C.name.toLocaleLowerCase().endsWith(".zip")){qe(a("errors.zipOnly"));return}qe(""),fe(C),C&&!Ce&&se(C.name.replace(/\.zip$/i,""))},sr=async()=>{await ne("/api/auth/logout",{method:"POST"}),r(null)},Qi=async()=>{if(le.trim()){W("");try{const C=await ne("/api/tags",{method:"POST",body:JSON.stringify({name:le,color:Oe})});d(Ie=>[...Ie,C.tag].sort((Me,ct)=>Me.name.localeCompare(ct.name))),Et(!1),ke(""),mt("blue")}catch(C){W(de(C))}}},eo=async C=>{if(!Ue)return;const Ie=Ue.tags.some(Me=>Me.id===C.id);P("");try{const ct=(await ne(Ie?`/api/projects/${Ue.id}/tags/${C.id}`:`/api/projects/${Ue.id}/tags`,Ie?{method:"DELETE"}:{method:"POST",body:JSON.stringify({tagId:C.id})})).project;z(ct),l(xt=>xt.map(Ot=>Ot.id===ct.id?ct:Ot))}catch(Me){P(de(Me))}},qr=async()=>{if(!(!pe||!Ve.trim()||st)){Ee(!0),B("");try{const C=await ne(`/api/projects/${pe.id}`,{method:"PATCH",body:JSON.stringify({name:Ve})});l(Ie=>Ie.map(Me=>Me.id===C.project.id?C.project:Me)),q(null),Ge("")}catch(C){B(de(C))}finally{Ee(!1)}}},Kr=async()=>{if(!(!dt||!_.trim())){At(!0),R("");try{await ne(`/api/projects/${dt.id}/duplicate`,{method:"POST",body:JSON.stringify({name:_})}),Q(null),Ye(""),tt(ae,Ze,ye,Je,L)}catch(C){R(de(C))}finally{At(!1)}}},to=async()=>{if(!(!ht||at)){an(!0),be("");try{await ne(`/api/projects/${ht.id}`,{method:"DELETE"}),l(xt=>xt.filter(Ot=>Ot.id!==ht.id));const C=Math.max(0,h.total-1),Ie=Math.ceil(C/h.pageSize),Me=Ie===0?1:Math.min(Ze,Ie),ct={...h,page:Me,total:C,totalPages:Ie};D(ct),on(null),Me!==Ze?Dt(Me):tt(ae,Ze,ye,Je,L)}catch(C){be(de(C))}finally{an(!1)}}},rr=async C=>{re(C),jt(""),Te([]),O(""),E(!0);try{const Ie=await ne("/api/users");Te(Ie.users.filter(Me=>Me.id!==C.ownerId))}catch(Ie){O(de(Ie))}finally{E(!1)}},ir=async()=>{if(!(!k||!Rt)){E(!0),O("");try{await ne(`/api/projects/${k.id}/owner`,{method:"PUT",body:JSON.stringify({userId:Rt})}),re(null),jt(""),tt(ae,Ze,ye,Je,L)}catch(C){O(de(C))}finally{E(!1)}}},or=async C=>{const Ie=!ae;je(C.id),V("");try{await ne(`/api/projects/${C.id}/archive`,{method:Ie?"PUT":"DELETE"});const Me=c.filter(Ds=>Ds.id!==C.id);l(Me);const ct=Math.max(0,h.total-1),xt=Math.ceil(ct/h.pageSize),Ot=xt===0?1:Math.min(Ze,xt),Zn={...h,page:Ot,total:ct,totalPages:xt};D(Zn),ae||s(Me,u,Zn),Ot!==Ze?Dt(Ot):tt(ae,Ze,ye,Je,L)}catch(Me){V(de(Me))}finally{je("")}},Wr=c,no=["red","orange","yellow","green","blue","purple","gray"],It=C=>new Date(C).toLocaleString(Ke.resolvedLanguage),ar=C=>Eg(C,Ke.resolvedLanguage??"en",Jt,(Ie,Me)=>a(Ie,Me));return i.jsxs("div",{className:"page",children:[i.jsxs("header",{className:"topbar",children:[i.jsxs("a",{className:"brand-link",href:"/","aria-label":t.siteName,children:[i.jsx("span",{className:"site-title",children:t.siteName}),i.jsx(Ii,{siteName:t.siteName})]}),i.jsxs("div",{className:"top-actions",children:[e.role==="admin"&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"ghost",onClick:()=>x(!0),children:[i.jsx(v0,{"aria-hidden":!0,size:14}),a("metrics.title")]}),i.jsxs("button",{className:`ghost${y?" top-return-action":""}`,onClick:()=>{b(C=>!C),N(!1)},children:[y?i.jsx(ra,{"aria-hidden":!0,size:14}):i.jsx(vr,{"aria-hidden":!0,size:14}),a(y?"users.back":"users.manage")]})]}),i.jsxs("button",{className:`ghost${j?" top-return-action":""}`,onClick:()=>{b(!1),N(C=>!C)},children:[j?i.jsx(ra,{"aria-hidden":!0,size:14}):i.jsx(Ss,{"aria-hidden":!0,size:14}),a(j?"users.back":"citationLibrary.title")]}),i.jsx(Na,{compact:!0}),i.jsxs("span",{className:"top-user-identity",children:[i.jsx("strong",{children:e.displayName}),i.jsxs("small",{children:["@",e.username]})]}),i.jsx("button",{className:"ghost",onClick:sr,children:a("auth.logout")})]})]}),y?i.jsx(bg,{currentUser:e,minPasswordLength:t.minPasswordLength}):j?i.jsx("main",{className:"dashboard citation-library-page-shell",children:i.jsx(Ld,{page:!0,open:!0,onOpenChange:N,onBack:()=>N(!1),currentUserId:e.id,maxBibtexBytes:t.maxCitationBibtexBytes})}):i.jsxs("main",{className:"dashboard",children:[i.jsxs("div",{className:"section-title",children:[i.jsxs("div",{children:[i.jsxs("h1",{children:[i.jsx(aa,{"aria-hidden":!0,size:25}),a("projects.title")]}),i.jsx("p",{className:"muted",children:e.canCreateProjects?a("projects.subtitle"):a("projects.restricted")})]}),i.jsxs("div",{className:"section-actions",children:[i.jsxs("button",{onClick:()=>{W(""),Et(!0)},children:[i.jsx(ha,{"aria-hidden":!0,size:15}),a("tags.create")]}),e.canCreateProjects&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:()=>{qe(""),ce(!0)},children:[i.jsx(gi,{"aria-hidden":!0,size:15}),a("projects.upload")]}),i.jsxs("button",{className:"primary",onClick:()=>{G(""),Ne(!0)},children:[i.jsx(Cd,{"aria-hidden":!0,size:15}),a("projects.new")]})]})]})]}),$&&i.jsx("p",{className:"error",children:$}),i.jsxs("div",{className:"project-toolbar",children:[i.jsx("input",{type:"search",placeholder:a("projects.search"),value:ye,onChange:C=>{We(C.target.value),Dt(1)}}),i.jsxs("div",{className:"project-scope",role:"tablist","aria-label":a("projects.scope"),children:[i.jsxs("button",{className:ae?"":"active",onClick:()=>pn(!1),role:"tab","aria-selected":!ae,children:[i.jsx(aa,{size:14}),a("projects.active")]}),i.jsxs("button",{className:ae?"active":"",onClick:()=>pn(!0),role:"tab","aria-selected":ae,children:[i.jsx(kl,{size:14}),a("projects.archived")]})]}),i.jsxs("div",{className:"tag-filters",children:[i.jsx("button",{className:Je?"":"active",onClick:()=>On(""),children:a("projects.allTags")}),u.map(C=>i.jsxs("button",{className:Je===C.id?"active":"",onClick:()=>On(Je===C.id?"":C.id),children:[i.jsx(Ao,{color:C.color}),C.name]},C.id))]}),i.jsxs("label",{className:"project-sort",children:[i.jsx(k0,{size:14}),i.jsx("span",{children:a("projects.sortBy")}),i.jsxs("select",{value:L,onChange:C=>ms(C.target.value),children:[i.jsx("option",{value:"updated",children:a("projects.sortModified")}),i.jsx("option",{value:"created",children:a("projects.sortCreated")})]})]}),i.jsxs("div",{className:"view-toggle",children:[i.jsx("button",{className:H==="grid"?"active":"",onClick:()=>Xn("grid"),title:a("projects.grid"),children:"▦"}),i.jsx("button",{className:H==="list"?"active":"",onClick:()=>Xn("list"),title:a("projects.list"),children:"☷"})]})]}),i.jsxs("div",{className:`project-grid ${H==="list"?"list-view":""}`,children:[Wr.map(C=>i.jsxs("article",{className:`project-card${C.ownerId===e.id?" owned-project":""}`,children:[H==="grid"&&C.ownerId===e.id&&i.jsxs("button",{className:"project-transfer-action",title:a("projects.transferOwnership"),onClick:()=>{rr(C)},children:[i.jsx(wo,{"aria-hidden":!0,size:13}),a("projects.transfer")]}),i.jsxs("button",{className:"project-card-open",onClick:()=>o(C.id),children:[i.jsx("span",{className:"owner-badge",title:C.ownerDisplayName??C.ownerUsername,children:C.ownerDisplayName??C.ownerUsername}),i.jsxs("span",{className:"project-card-main",children:[i.jsx("strong",{children:C.name}),i.jsxs("span",{className:"project-tags",children:[C.tags?.map(Ie=>i.jsx("span",{className:`tag tag-${Ie.color}`,children:Ie.name},Ie.id)),!!(C.unresolvedCommentCount&&C.unresolvedCommentCount>0)&&i.jsxs("span",{className:"project-comments-badge unresolved",title:a("projects.unresolvedCommentsTooltip",{unresolved:C.unresolvedCommentCount,total:C.commentCount??C.unresolvedCommentCount}),children:[i.jsx(wd,{"aria-hidden":!0,size:10}),i.jsx("span",{children:a("projects.unresolvedCount",{count:C.unresolvedCommentCount})})]})]})]}),i.jsxs("dl",{className:"project-meta",children:[i.jsxs("div",{children:[i.jsxs("dt",{children:[i.jsx(S0,{"aria-hidden":!0,size:13}),a("projects.created")]}),i.jsx("dd",{children:i.jsx("time",{dateTime:C.createdAt,children:It(C.createdAt)})})]}),i.jsxs("div",{children:[i.jsxs("dt",{children:[i.jsx($0,{"aria-hidden":!0,size:13}),a("projects.modified")]}),i.jsxs("dd",{title:a("projects.modifiedByUser",{time:It(C.updatedAt),user:C.lastModifiedDisplayName??C.lastModifiedUsername??a("projects.deletedUser")}),children:[i.jsx("time",{dateTime:C.updatedAt,children:ar(C.updatedAt)}),i.jsxs("span",{className:"project-modified-by",children:[" · ",a("projects.byUser",{user:C.lastModifiedDisplayName??C.lastModifiedUsername??a("projects.deletedUser")})]})]})]})]})]}),i.jsxs("div",{className:"project-card-actions",children:[i.jsxs("button",{onClick:()=>{P(""),z(C)},children:[i.jsx(ha,{"aria-hidden":!0,size:14}),a("tags.assign")]}),C.permission==="owner"&&i.jsxs("button",{onClick:()=>{B(""),q(C),Ge(C.name)},children:[i.jsx(ca,{"aria-hidden":!0,size:14}),a("projects.rename")]}),(e.role==="admin"||e.canCreateProjects)&&i.jsxs("button",{onClick:()=>{R(""),Q(C),Ye(`${C.name} (1)`)},children:[i.jsx(L0,{"aria-hidden":!0,size:14}),a("projects.duplicate")]}),i.jsxs("a",{href:`/api/projects/${C.id}/download`,download:!0,children:[i.jsx(xr,{"aria-hidden":!0,size:14}),a("projects.download")]}),i.jsxs("button",{disabled:Ae===C.id,onClick:()=>{or(C)},children:[ae?i.jsx(A0,{"aria-hidden":!0,size:14}):i.jsx(kl,{"aria-hidden":!0,size:14}),a(ae?"projects.unarchive":"projects.archive")]}),H==="list"&&C.ownerId===e.id&&i.jsxs("button",{onClick:()=>{rr(C)},children:[i.jsx(wo,{"aria-hidden":!0,size:14}),a("projects.transfer")]}),C.permission==="owner"&&i.jsxs("button",{className:"danger-text",onClick:()=>{on(C),be("")},children:[i.jsx(sn,{"aria-hidden":!0,size:14}),a("common.delete")]})]})]},C.id)),Wr.length===0&&(c.length===0?ae?i.jsx("div",{className:"empty",children:a("projects.noArchived")}):i.jsxs("div",{className:"project-empty",children:[i.jsx("span",{className:"project-empty-icon",children:i.jsx(tg,{size:28})}),i.jsx("h2",{children:a("projects.emptyTitle")}),i.jsx("p",{children:e.canCreateProjects?a("projects.emptyDescription"):a("projects.emptyRestricted")})]}):i.jsx("div",{className:"empty",children:a("projects.noMatches")}))]}),h.totalPages>1&&i.jsxs("nav",{className:"project-pagination","aria-label":a("projects.pagination"),children:[i.jsxs("button",{disabled:h.page<=1,onClick:()=>Dt(C=>Math.max(1,C-1)),title:a("projects.previousPage"),children:[i.jsx(br,{size:15}),a("projects.previousPage")]}),i.jsx("span",{children:a("projects.pageOf",{page:h.page,totalPages:h.totalPages,count:h.total})}),i.jsxs("button",{disabled:h.page>=h.totalPages,onClick:()=>Dt(C=>Math.min(h.totalPages,C+1)),title:a("projects.nextPage"),children:[i.jsx(Mi,{size:15}),a("projects.nextPage")]})]}),i.jsx(bt,{open:Fe,title:a("projects.new"),description:a("projects.newDescription"),onOpenChange:C=>{!C&&ge||(Ne(C),C||G(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:ge,onClick:()=>Ne(!1),children:a("common.cancel")}),i.jsxs("button",{className:"primary",disabled:ge||!Z.trim(),"aria-busy":ge,onClick:()=>{Pn()},children:[ge&&i.jsx(ut,{className:"spin",size:14}),a(ge?"common.loading":"common.create")]})]}),children:i.jsxs(i.Fragment,{children:[U&&i.jsx("p",{className:"error dialog-error",children:U}),i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{autoFocus:!0,value:Z,onChange:C=>{T(C.target.value),G("")},onKeyDown:C=>{C.key==="Enter"&&Pn()}})]})]})}),i.jsx(bt,{open:X,title:a("projects.upload"),description:a("projects.uploadDescription",{size:t.maxUploadSizeMB}),onOpenChange:C=>{ce(C),C||qe("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>{ce(!1),qe("")},children:a("common.cancel")}),i.jsx("button",{className:"primary",disabled:!A||Qe,onClick:()=>{vn()},children:a(Qe?"projects.importing":"projects.import")})]}),children:i.jsxs("div",{className:"form-stack",children:[ve&&i.jsx("p",{className:"error import-error",children:ve}),i.jsxs("div",{className:`upload-picker${A?" has-file":""}`,onDragOver:C=>{C.preventDefault(),C.dataTransfer.dropEffect="copy"},onDrop:C=>{C.preventDefault(),Jn(C.dataTransfer.files[0]??null)},children:[i.jsx("input",{ref:yt,className:"sr-only",type:"file",accept:".zip,application/zip",onChange:C=>Jn(C.target.files?.[0]??null)}),i.jsx(oa,{size:34}),i.jsxs("div",{className:"upload-picker-copy",children:[i.jsx("strong",{children:A?.name??a("projects.chooseZip")}),i.jsx("span",{children:A?a("projects.selectedFileSize",{size:wg(A.size)}):a("projects.dropZip")})]}),i.jsxs("button",{type:"button",onClick:()=>yt.current?.click(),children:[i.jsx(gi,{size:15}),a("projects.browse")]}),A&&i.jsx("button",{className:"upload-clear",type:"button",title:a("projects.clearFile"),"aria-label":a("projects.clearFile"),onClick:()=>{Jn(null),yt.current&&(yt.current.value="")},children:i.jsx(Ht,{size:14})})]}),i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{value:Ce,onChange:C=>se(C.target.value)})]})]})}),i.jsx(bt,{open:De,title:a("tags.create"),description:a("tags.createDescription"),onOpenChange:C=>{Et(C),C||W("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Et(!1),children:a("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{Qi()},children:a("common.create")})]}),children:i.jsxs("div",{className:"form-stack",children:[Y&&i.jsx("p",{className:"error dialog-error",children:Y}),i.jsxs("label",{className:"form-field",children:[a("tags.name"),i.jsx("input",{autoFocus:!0,value:le,onChange:C=>{ke(C.target.value),W("")}})]}),i.jsxs("fieldset",{className:"color-picker",children:[i.jsx("legend",{children:a("tags.color")}),no.map(C=>i.jsxs("label",{className:Oe===C?"active":"",children:[i.jsx("input",{type:"radio",name:"dashboard-tag-color",checked:Oe===C,onChange:()=>mt(C)}),i.jsx(Ao,{color:C}),a(`tags.${C}`)]},C))]})]})}),i.jsx(bt,{open:!!Ue,title:a("tags.assignTitle",{project:Ue?.name??""}),description:a("tags.assignDescription"),onOpenChange:C=>{C||(z(null),P(""))},footer:i.jsx("button",{onClick:()=>{z(null),P("")},children:a("common.close")}),children:i.jsxs("div",{className:"tag-assignment-list",children:[ue&&i.jsx("p",{className:"error dialog-error",children:ue}),u.map(C=>i.jsxs("label",{children:[i.jsx("input",{type:"checkbox",checked:!!Ue?.tags.some(Ie=>Ie.id===C.id),onChange:()=>{eo(C)}}),i.jsx(Ao,{color:C.color}),i.jsx("span",{children:C.name})]},C.id)),u.length===0&&i.jsx("p",{className:"muted",children:a("tags.empty")})]})}),i.jsx(bt,{open:!!pe,title:a("projects.renameTitle"),onOpenChange:C=>{!C&&st||C||(q(null),B(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:st,onClick:()=>{q(null),B("")},children:a("common.cancel")}),i.jsxs("button",{className:"primary",disabled:st||!Ve.trim(),"aria-busy":st,onClick:()=>{qr()},children:[st&&i.jsx(ut,{className:"spin",size:14}),a(st?"common.loading":"projects.rename")]})]}),children:i.jsxs(i.Fragment,{children:[K&&i.jsx("p",{className:"error dialog-error",children:K}),i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{autoFocus:!0,value:Ve,onChange:C=>{Ge(C.target.value),B("")},onKeyDown:C=>{C.key==="Enter"&&qr()}})]})]})}),i.jsx(bt,{open:!!dt,title:a("projects.duplicateTitle"),description:a("projects.duplicateDescription",{project:dt?.name??""}),onOpenChange:C=>{!C&&!wt&&(Q(null),Ye(""),R(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:wt,onClick:()=>{Q(null),Ye(""),R("")},children:a("common.cancel")}),i.jsx("button",{className:"primary",disabled:wt||!_.trim(),onClick:()=>{Kr()},children:a(wt?"projects.duplicating":"projects.duplicate")})]}),children:i.jsxs(i.Fragment,{children:[S&&i.jsx("p",{className:"error dialog-error",children:S}),i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{autoFocus:!0,value:_,onChange:C=>{Ye(C.target.value),R("")},onKeyDown:C=>{C.key==="Enter"&&Kr()}})]})]})}),i.jsx(bt,{open:!!k,title:a("projects.transferOwnership"),description:a("projects.transferDescription",{project:k?.name??""}),onOpenChange:C=>{!C&&!p&&(re(null),jt(""),O(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:p,onClick:()=>{re(null),jt(""),O("")},children:a("common.cancel")}),i.jsxs("button",{className:"primary",disabled:p||!Rt,onClick:()=>{ir()},children:[p?i.jsx(ut,{className:"spin",size:14}):i.jsx(wo,{size:14}),a("projects.transfer")]})]}),children:i.jsxs("div",{className:"form-stack",children:[F&&i.jsx("p",{className:"error dialog-error",children:F}),i.jsxs("label",{className:"form-field",children:[a("projects.newOwner"),i.jsxs("select",{disabled:p||te.length===0,value:Rt,onChange:C=>jt(C.target.value),children:[i.jsx("option",{value:"",children:p?a("common.loading"):te.length>0?a("projects.chooseNewOwner"):a("projects.noTransferUsers")}),te.map(C=>i.jsxs("option",{value:C.id,children:[C.displayName??C.username," (@",C.username,")"]},C.id))]})]}),i.jsxs("p",{className:"warning",children:[i.jsx(nn,{size:15}),a("projects.transferWarning")]})]})}),i.jsx(Vn,{open:!!ht,title:a("projects.deleteTitle"),description:a("projects.deleteDescription",{project:ht?.name??""}),confirmLabel:a(at?"common.loading":"common.delete"),danger:!0,busy:at,error:he,onCancel:()=>{at||(on(null),be(""))},onConfirm:()=>{to()}})]}),w&&i.jsx(f.Suspense,{fallback:null,children:i.jsx(yg,{open:!0,onOpenChange:x})}),i.jsx(Ra,{})]})}function Ao({color:t}){return i.jsx("span",{className:`tag-dot tag-${t}`})}const Fi=[{id:"jetbrains",labelKey:"projectSettings.fontJetBrains",stack:'"JetBrains Mono", ui-monospace, monospace'},{id:"source-code",labelKey:"projectSettings.fontSourceCode",stack:'"Source Code Pro", ui-monospace, monospace'},{id:"ibm-plex",labelKey:"projectSettings.fontIbmPlex",stack:'"IBM Plex Mono", ui-monospace, monospace'},{id:"fira-code",labelKey:"projectSettings.fontFiraCode",stack:'"Fira Code", ui-monospace, monospace'},{id:"iosevka",labelKey:"projectSettings.fontIosevka",stack:'"Iosevka", ui-monospace, monospace'}],Dn={font:"jetbrains",fontSize:14,lineHeight:1.65,lineWrapping:!0,spellCheck:!0,vimMode:!1,formatOnCompile:!1,texFmtConfig:"",openFilesInTabs:!1},vg="texlite-editor-preferences";function Nd(t,e){return`${vg}:${encodeURIComponent(t)}:${encodeURIComponent(e)}`}function K2(t){return Fi.find(e=>e.id===t)?.stack??Fi[0].stack}function Pl(t,e){try{const n=JSON.parse(localStorage.getItem(Nd(t,e))??"{}");return{font:Fi.some(s=>s.id===n.font)?n.font:Dn.font,fontSize:[12,13,14,15,16,18,20].includes(Number(n.fontSize))?Number(n.fontSize):Dn.fontSize,lineHeight:[1.45,1.65,1.85].includes(Number(n.lineHeight))?Number(n.lineHeight):Dn.lineHeight,lineWrapping:typeof n.lineWrapping=="boolean"?n.lineWrapping:Dn.lineWrapping,spellCheck:typeof n.spellCheck=="boolean"?n.spellCheck:Dn.spellCheck,vimMode:typeof n.vimMode=="boolean"?n.vimMode:Dn.vimMode,formatOnCompile:typeof n.formatOnCompile=="boolean"?n.formatOnCompile:Dn.formatOnCompile,texFmtConfig:typeof n.texFmtConfig=="string"&&n.texFmtConfig.length<=16*1024?n.texFmtConfig:Dn.texFmtConfig,openFilesInTabs:typeof n.openFilesInTabs=="boolean"?n.openFilesInTabs:Dn.openFilesInTabs}}catch{return Dn}}function Ag(t,e,n){localStorage.setItem(Nd(t,e),JSON.stringify(n))}function kg(){let t={status:"loading",error:""};const e=new Set,n=(s,r="")=>{if(!(t.status===s&&t.error===r)){t={status:s,error:r};for(const o of e)o()}};return{getSnapshot:()=>t,subscribe:s=>(e.add(s),()=>e.delete(s)),loading:()=>n("loading"),working:()=>n("working"),failed:s=>n("error",s instanceof Error?s.message:String(s))}}const Gt=kg(),Sg=/\.(?:tex|bib|cls|sty)$/i,Rd=3e4;let ln=null,bi=!1,ns=null,jg=1;const os=new Map,yi=[];let Ts=null,pr=null;class Wt extends Error{constructor(e,n){super(n),this.kind=e,this.name="TexFmtError"}kind}function ko(t){return t instanceof Wt}function Bn(t){ln?.terminate(),ln=null,bi=!1,ns!==null&&window.clearTimeout(ns),ns=null,Ts=null,yi.length=0,pr=null,Gt.failed(t);for(const e of os.values())e.timeout!==null&&window.clearTimeout(e.timeout),e.reject(t);os.clear()}function yr(){if(Ts!==null||yi.length===0)return;let t;try{t=Bg()}catch(s){Bn(s instanceof Wt?s:new Wt("load","The bundled tex-fmt formatter could not be loaded."));return}if(!bi)return;const e=yi.shift();if(e===void 0)return;const n=os.get(e);if(!n){yr();return}Ts=e,n.timeout=window.setTimeout(()=>{Ts===e&&Bn(new Wt("result","The formatter did not respond within 30 seconds."))},Rd);try{t.postMessage({...n.request,id:e})}catch{Bn(new Wt("load","The formatter worker could not receive the source."))}}function Bg(){if(ln)return ln;if(typeof Worker>"u"){const t=new Wt("load","This browser does not support formatter workers.");throw Gt.failed(t),t}Gt.loading();try{ln=new Worker(new URL("/assets/latexFormatterWorker-DYkYtcFy.js",import.meta.url),{type:"module",name:"texlite-latex-formatter"}),ns=window.setTimeout(()=>{bi||Bn(new Wt("load","The formatter did not finish loading within 30 seconds."))},Rd)}catch{const t=new Wt("load","The bundled tex-fmt formatter could not be loaded.");throw Gt.failed(t),t}return ln.onmessage=t=>{const e=t.data;if(e&&"type"in e){e.type==="ready"&&(bi=!0,ns!==null&&window.clearTimeout(ns),ns=null,yr());return}if(!e||typeof e.id!="number"){Bn(new Wt("result","The formatter worker returned an invalid response."));return}const n=os.get(e.id);if(n)if(os.delete(e.id),n.timeout!==null&&window.clearTimeout(n.timeout),Ts===e.id&&(Ts=null),e.ok)Gt.working(),n.resolve(e.result),yr();else{const s=new Wt(e.kind,e.message);e.kind==="format"?(Gt.working(),n.reject(s),yr()):(n.reject(s),Bn(s))}},ln.onerror=()=>{Bn(new Wt("load","The bundled tex-fmt formatter could not be loaded."))},ln.onmessageerror=()=>{Bn(new Wt("result","The formatter worker returned an unreadable response."))},ln}function Ya(t){const e=jg++;return new Promise((n,s)=>{os.set(e,{request:t,resolve:n,reject:s,timeout:null}),yi.push(e),yr()})}function Tg(t,e=""){return Ya({action:"format",source:t,config:e})}async function Od(){ln&&Gt.getSnapshot().status==="working"||(pr||(pr=Ya({action:"probe"}).then(()=>{}).finally(()=>{pr=null})),await pr)}async function Lg(){(ln||os.size)&&Bn(new Wt("load","The formatter runtime was reloaded.")),Gt.loading(),await Od()}function si(t){return Sg.test(t)}function Ng(t){return t.match(/(?:\r?\n)+$/)?.[0]??""}function Rg(t,e){const n=Ng(t),a=(n?t.slice(0,-n.length):t).split(/\r?\n/).find(u=>u.trim())?.match(/^[\t ]*/)?.[0]??"",c=e.replace(/(?:\r?\n)+$/,"");return`${a?c.split(`
|
|
40
|
-
`).map(u=>u&&`${a}${u}`).join(`
|
|
41
|
-
`):c}${n}`}async function So(t,e,n=0){return Ya({action:"diff",source:t,formatted:e,baseOffset:n})}function Og(t,e=null){const n=_l(t),r=e==="succeeded"||e===null&&_g(t)?[]:Il(n.filter(Ml)),o=_l(Pg(t));return{warnings:Il(o.filter(c=>!Ml(c)&&Ig(c))),errors:r}}function _l(t){return t.split(`
|
|
42
|
-
`).map(e=>e.trim()).filter(Boolean)}function Il(t){return[...new Set(t)]}function Pg(t){const e=/^Running ['"][^\n]*(?:pdf|xe|lua)latex(?:\s|['"])[^\n]*$/gim;let n=-1;for(const s of t.matchAll(e))n=s.index;return n>=0?t.slice(n):t}function _g(t){return/Latexmk: All targets .* are up-to-date/i.test(t)&&/Output written on .*\.pdf/i.test(t)}function Ml(t){return/^!\s/.test(t)||/(?:^|:\s)(?:LaTeX|Package|Class|pdfTeX|XeTeX|LuaTeX)?\s*Error:/i.test(t)||/^Latexmk:.*(?:\bErrors?,|did not complete making targets|failure)/i.test(t)||/^Collected error summary/i.test(t)||/\b(?:fatal error|emergency stop|undefined control sequence|no output pdf|no pages of output)\b/i.test(t)||/\b(?:bibtex|biber) errors?:/i.test(t)||/^error, and then rerun latexmk/i.test(t)}function Ig(t){return/\bwarnings?\b|overfull|underfull|badness/i.test(t)}function Mg(t){return t instanceof Error&&t.name==="AbortError"}function $g({projectId:t,activeFile:e,permission:n,revision:s,selection:r,save:o,onError:a,onAdded:c}){const[l,u]=f.useState([]),[d,h]=f.useState(null),[D,m]=f.useState(!1),[g,y]=f.useState(""),b=f.useRef(null),w=f.useRef(e),x=f.useRef(o),j=f.useRef(a),N=f.useRef(c);w.current=e,x.current=o,j.current=a,N.current=c;const $=async K=>{b.current?.abort();const B=new AbortController;b.current=B;try{const S=await ne(`/api/projects/${t}/comments?path=${encodeURIComponent(K)}`,{signal:B.signal});w.current===K&&u(S.comments)}catch(S){!Mg(S)&&w.current===K&&u([])}finally{b.current===B&&(b.current=null)}};return f.useEffect(()=>{h(null)},[t,e]),f.useEffect(()=>(e?$(e):u([]),()=>{b.current?.abort(),b.current=null}),[t,e,s]),{comments:l,focusComment:d,setFocusComment:h,commentOpen:D,setCommentOpen:m,commentText:g,setCommentText:y,addComment:async()=>{if(!(!g.trim()||!e))try{if(n!=="read"&&!await x.current())return;await ne(`/api/projects/${t}/comments`,{method:"POST",body:JSON.stringify({path:e,content:g,...r})}),await $(e),m(!1),y(""),N.current()}catch(K){j.current(de(K))}},toggleComment:async K=>{try{await ne(`/api/projects/${t}/comments/${K.id}`,{method:"PATCH",body:JSON.stringify({resolved:!K.resolved})}),await $(e)}catch(B){j.current(de(B))}},replyToComment:async(K,B)=>{try{return await ne(`/api/projects/${t}/comments/${K.id}/replies`,{method:"POST",body:JSON.stringify({content:B})}),await $(e),!0}catch(S){return j.current(de(S)),!1}},editComment:async(K,B)=>{try{return await ne(`/api/projects/${t}/comments/${K.id}`,{method:"PATCH",body:JSON.stringify({content:B})}),await $(e),!0}catch(S){return j.current(de(S)),!1}},deleteComment:async K=>{try{return await ne(`/api/projects/${t}/comments/${K.id}`,{method:"DELETE"}),await $(e),h(B=>B?.id===K.id?null:B),!0}catch(B){return j.current(de(B)),!1}},editCommentReply:async(K,B,S)=>{try{return await ne(`/api/projects/${t}/comments/${K.id}/replies/${B}`,{method:"PATCH",body:JSON.stringify({content:S})}),await $(e),!0}catch(R){return j.current(de(R)),!1}},deleteCommentReply:async(K,B)=>{try{return await ne(`/api/projects/${t}/comments/${K.id}/replies/${B}`,{method:"DELETE"}),await $(e),!0}catch(S){return j.current(de(S)),!1}}}}const Kt=()=>new Map,Da=t=>{const e=Kt();return t.forEach((n,s)=>{e.set(s,n)}),e},En=(t,e,n)=>{let s=t.get(e);return s===void 0&&t.set(e,s=n()),s},Ug=(t,e)=>{const n=[];for(const[s,r]of t)n.push(e(r,s));return n},zg=(t,e)=>{for(const[n,s]of t)if(e(s,n))return!0;return!1},qn=()=>new Set,jo=t=>t[t.length-1],Hg=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},Nn=Array.from,Xa=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},Ja=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},Vg=(t,e)=>{const n=new Array(t);for(let s=0;s<t;s++)n[s]=e(s,n);return n},zs=Array.isArray;class Za{constructor(){this._observers=Kt()}on(e,n){return En(this._observers,e,qn).add(n),n}once(e,n){const s=(...r)=>{this.off(e,s),n(...r)};this.on(e,s)}off(e,n){const s=this._observers.get(e);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(e))}emit(e,n){return Nn((this._observers.get(e)||Kt()).values()).forEach(s=>s(...n))}destroy(){this._observers=Kt()}}class Pd{constructor(){this._observers=Kt()}on(e,n){En(this._observers,e,qn).add(n)}once(e,n){const s=(...r)=>{this.off(e,s),n(...r)};this.on(e,s)}off(e,n){const s=this._observers.get(e);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(e))}emit(e,n){return Nn((this._observers.get(e)||Kt()).values()).forEach(s=>s(...n))}destroy(){this._observers=Kt()}}const dn=Math.floor,li=Math.abs,Qa=(t,e)=>t<e?t:e,ds=(t,e)=>t>e?t:e,qg=Math.pow,_d=t=>t!==0?t<0:1/t<0,$l=1,Ul=2,Bo=4,To=8,Ar=32,Tn=64,Yt=128,$i=31,ga=63,rs=127,Kg=2147483647,Ci=Number.MAX_SAFE_INTEGER,zl=Number.MIN_SAFE_INTEGER,Wg=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&dn(t)===t),Id=String.fromCharCode,Gg=t=>t.toLowerCase(),Yg=/^\s*/g,Xg=t=>t.replace(Yg,""),Jg=/([A-Z])/g,Hl=(t,e)=>Xg(t.replace(Jg,n=>`${e}${Gg(n)}`)),Zg=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,s=new Uint8Array(n);for(let r=0;r<n;r++)s[r]=e.codePointAt(r);return s},kr=typeof TextEncoder<"u"?new TextEncoder:null,Qg=t=>kr.encode(t),e1=kr?Qg:Zg;let Cr=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Cr&&Cr.decode(new Uint8Array).length===1&&(Cr=null);const t1=(t,e)=>Vg(e,()=>t).join("");class Ir{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Ft=()=>new Ir,ec=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},nt=t=>{const e=new Uint8Array(ec(t));let n=0;for(let s=0;s<t.bufs.length;s++){const r=t.bufs[s];e.set(r,n),n+=r.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},n1=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(ds(n,e)*2),t.cpos=0)},Bt=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Fa=Bt,me=(t,e)=>{for(;e>rs;)Bt(t,Yt|rs&e),e=dn(e/128);Bt(t,rs&e)},tc=(t,e)=>{const n=_d(e);for(n&&(e=-e),Bt(t,(e>ga?Yt:0)|(n?Tn:0)|ga&e),e=dn(e/64);e>0;)Bt(t,(e>rs?Yt:0)|rs&e),e=dn(e/128)},ba=new Uint8Array(3e4),s1=ba.length/3,r1=(t,e)=>{if(e.length<s1){const n=kr.encodeInto(e,ba).written||0;me(t,n);for(let s=0;s<n;s++)Bt(t,ba[s])}else gt(t,e1(e))},i1=(t,e)=>{const n=unescape(encodeURIComponent(e)),s=n.length;me(t,s);for(let r=0;r<s;r++)Bt(t,n.codePointAt(r))},_t=kr&&kr.encodeInto?r1:i1,Ui=(t,e)=>{const n=t.cbuf.length,s=t.cpos,r=Qa(n-s,e.length),o=e.length-r;t.cbuf.set(e.subarray(0,r),s),t.cpos+=r,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(ds(n*2,o)),t.cbuf.set(e.subarray(r)),t.cpos=o)},gt=(t,e)=>{me(t,e.byteLength),Ui(t,e)},nc=(t,e)=>{n1(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},o1=(t,e)=>nc(t,4).setFloat32(0,e,!1),a1=(t,e)=>nc(t,8).setFloat64(0,e,!1),c1=(t,e)=>nc(t,8).setBigInt64(0,e,!1),Vl=new DataView(new ArrayBuffer(4)),l1=t=>(Vl.setFloat32(0,t),Vl.getFloat32(0)===t),Sr=(t,e)=>{switch(typeof e){case"string":Bt(t,119),_t(t,e);break;case"number":Wg(e)&&li(e)<=Kg?(Bt(t,125),tc(t,e)):l1(e)?(Bt(t,124),o1(t,e)):(Bt(t,123),a1(t,e));break;case"bigint":Bt(t,122),c1(t,e);break;case"object":if(e===null)Bt(t,126);else if(zs(e)){Bt(t,117),me(t,e.length);for(let n=0;n<e.length;n++)Sr(t,e[n])}else if(e instanceof Uint8Array)Bt(t,116),gt(t,e);else{Bt(t,118);const n=Object.keys(e);me(t,n.length);for(let s=0;s<n.length;s++){const r=n[s];_t(t,r),Sr(t,e[r])}}break;case"boolean":Bt(t,e?120:121);break;default:Bt(t,127)}};class ql extends Ir{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&me(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const Kl=t=>{t.count>0&&(tc(t.encoder,t.count===1?t.s:-t.s),t.count>1&&me(t.encoder,t.count-2))};class ui{constructor(){this.encoder=new Ir,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Kl(this),this.count=1,this.s=e)}toUint8Array(){return Kl(this),nt(this.encoder)}}const Wl=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);tc(t.encoder,e),t.count>1&&me(t.encoder,t.count-2)}};class Lo{constructor(){this.encoder=new Ir,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Wl(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Wl(this),nt(this.encoder)}}class u1{constructor(){this.sarr=[],this.s="",this.lensE=new ui}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Ir;return this.sarr.push(this.s),this.s="",_t(e,this.sarr.join("")),Ui(e,this.lensE.toUint8Array()),nt(e)}}const hn=t=>new Error(t),un=()=>{throw hn("Method unimplemented")},Xt=()=>{throw hn("Unexpected case")},Md=hn("Unexpected end of array"),$d=hn("Integer out of Range");class zi{constructor(e){this.arr=e,this.pos=0}}const Yn=t=>new zi(t),ya=t=>t.pos!==t.arr.length,d1=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Mt=t=>d1(t,Se(t)),Hs=t=>t.arr[t.pos++],Se=t=>{let e=0,n=1;const s=t.arr.length;for(;t.pos<s;){const r=t.arr[t.pos++];if(e=e+(r&rs)*n,n*=128,r<Yt)return e;if(e>Ci)throw $d}throw Md},sc=t=>{let e=t.arr[t.pos++],n=e&ga,s=64;const r=(e&Tn)>0?-1:1;if((e&Yt)===0)return r*n;const o=t.arr.length;for(;t.pos<o;){if(e=t.arr[t.pos++],n=n+(e&rs)*s,s*=128,e<Yt)return r*n;if(n>Ci)throw $d}throw Md},h1=t=>{let e=Se(t);if(e===0)return"";{let n=String.fromCodePoint(Hs(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Hs(t));else for(;e>0;){const s=e<1e4?e:1e4,r=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,n+=String.fromCodePoint.apply(null,r),e-=s}return decodeURIComponent(escape(n))}},f1=t=>Cr.decode(Mt(t)),lt=Cr?f1:h1,rc=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},p1=t=>rc(t,4).getFloat32(0,!1),m1=t=>rc(t,8).getFloat64(0,!1),D1=t=>rc(t,8).getBigInt64(0,!1),g1=[t=>{},t=>null,sc,p1,m1,D1,t=>!1,t=>!0,lt,t=>{const e=Se(t),n={};for(let s=0;s<e;s++){const r=lt(t);n[r]=jr(t)}return n},t=>{const e=Se(t),n=[];for(let s=0;s<e;s++)n.push(jr(t));return n},Mt],jr=t=>g1[127-Hs(t)](t);class Gl extends zi{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),ya(this)?this.count=Se(this)+1:this.count=-1),this.count--,this.s}}class di extends zi{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=sc(this);const e=_d(this.s);this.count=1,e&&(this.s=-this.s,this.count=Se(this)+2)}return this.count--,this.s}}class No extends zi{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=sc(this),n=e&1;this.diff=dn(e/2),this.count=1,n&&(this.count=Se(this)+2)}return this.s+=this.diff,this.count--,this.s}}class F1{constructor(e){this.decoder=new di(e),this.str=lt(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const b1=crypto.getRandomValues.bind(crypto),Ud=()=>b1(new Uint32Array(1))[0],y1="10000000-1000-4000-8000"+-1e11,C1=()=>y1.replace(/[018]/g,t=>(t^Ud()&15>>t/4).toString(16)),Kn=Date.now,Vs=t=>new Promise(t);Promise.all.bind(Promise);const Yl=t=>t===void 0?null:t;class E1{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let zd=new E1,ic=!0;try{typeof localStorage<"u"&&localStorage&&(zd=localStorage,ic=!1)}catch{}const Hd=zd,w1=t=>ic||addEventListener("storage",t),x1=t=>ic||removeEventListener("storage",t),Br=Symbol("Equality"),Vd=(t,e)=>t===e||!!t?.[Br]?.(e)||!1,v1=t=>typeof t=="object",A1=Object.assign,k1=Object.keys,S1=(t,e)=>{for(const n in t)e(t[n],n)},j1=(t,e)=>{const n=[];for(const s in t)n.push(e(t[s],s));return n},Ei=t=>k1(t).length,B1=t=>{for(const e in t)return!1;return!0},Mr=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},oc=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),T1=(t,e)=>t===e||Ei(t)===Ei(e)&&Mr(t,(n,s)=>(n!==void 0||oc(e,s))&&Vd(e[s],n)),L1=Object.freeze,qd=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&qd(t[e])}return L1(t)},ac=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&ac(t,e,n+1)}},N1=t=>t,Ls=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[Br]!=null)return t[Br](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Ls(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Ei(t)!==Ei(e))return!1;for(const n in t)if(!oc(t,n)||!Ls(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Ls(t[n],e[n]))return!1;break;default:return!1}return!0},R1=(t,e)=>e.includes(t);var Kd={};const Wn=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",Wd=typeof window<"u"&&typeof document<"u"&&!Wn;let gn;const O1=()=>{if(gn===void 0)if(Wn){gn=Kt();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const s=t[n];s[0]==="-"?(e!==null&&gn.set(e,""),e=s):e!==null&&(gn.set(e,s),e=null)}e!==null&&gn.set(e,"")}else typeof location=="object"?(gn=Kt(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");gn.set(`--${Hl(e,"-")}`,n),gn.set(`-${Hl(e,"-")}`,n)}})):gn=Kt();return gn},Ca=t=>O1().has(t),wi=t=>Yl(Wn?Kd[t.toUpperCase().replaceAll("-","_")]:Hd.getItem(t)),Gd=t=>Ca("--"+t)||wi(t)!==null,P1=Gd("production"),_1=Wn&&R1(Kd.FORCE_COLOR,["true","1","2"]),I1=_1||!Ca("--no-colors")&&!Gd("no-color")&&(!Wn||process.stdout.isTTY)&&(!Wn||Ca("--color")||wi("COLORTERM")!==null||(wi("TERM")||"").includes("color")),Yd=t=>new Uint8Array(t),M1=(t,e,n)=>new Uint8Array(t,e,n),$1=t=>new Uint8Array(t),U1=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=Id(t[n]);return btoa(e)},z1=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),H1=t=>{const e=atob(t),n=Yd(e.length);for(let s=0;s<e.length;s++)n[s]=e.charCodeAt(s);return n},V1=t=>{const e=Buffer.from(t,"base64");return M1(e.buffer,e.byteOffset,e.byteLength)},q1=Wd?U1:z1,K1=Wd?H1:V1,W1=t=>{const e=Yd(t.byteLength);return e.set(t),e};class G1{constructor(e,n){this.left=e,this.right=n}}const Sn=(t,e)=>new G1(t,e),Y1=(t,e)=>t.forEach(n=>e(n.left,n.right)),Xl=t=>t.next()>=.5,Ro=(t,e,n)=>dn(t.next()*(n+1-e)+e),Xd=(t,e,n)=>dn(t.next()*(n+1-e)+e),cc=(t,e,n)=>Xd(t,e,n),X1=t=>Id(cc(t,97,122)),J1=(t,e=0,n=20)=>{const s=cc(t,e,n);let r="";for(let o=0;o<s;o++)r+=X1(t);return r},Oo=(t,e)=>e[cc(t,0,e.length-1)],Z1=Symbol("0schema");class Q1{constructor(){this._rerrs=[]}extend(e,n,s,r=null){this._rerrs.push({path:e,expected:n,has:s,message:r})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const s=this._rerrs[n];e.push(t1(" ",(this._rerrs.length-n)*2)+`${s.path!=null?`[${s.path}] `:""}${s.has} doesn't match ${s.expected}. ${s.message}`)}return e.join(`
|
|
43
|
-
`)}}const Ea=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[Br]?Vd(t,e):zs(t)?Xa(t,n=>Ja(e,s=>Ea(n,s))):v1(t)?Mr(t,(n,s)=>Ea(n,e[s])):!1;class Vt{static _dilutes=!1;extends(e){let[n,s]=[this.shape,e.shape];return this.constructor._dilutes&&([s,n]=[n,s]),Ea(n,s)}equals(e){return this.constructor===e.constructor&&Ls(this.shape,e.shape)}[Z1](){return!0}[Br](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){un()}get nullable(){return Qs(this,Wi)}get optional(){return new Qd(this)}cast(e){return Jl(e,this),e}expect(e){return Jl(e,this),e}}class lc extends Vt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const s=e?.constructor===this.shape&&(this._c==null||this._c(e));return!s&&n?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),s}}const vt=(t,e=null)=>new lc(t,e);vt(lc);class uc extends Vt{constructor(e){super(),this.shape=e}check(e,n){const s=this.shape(e);return!s&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),s}}const Nt=t=>new uc(t);vt(uc);class Hi extends Vt{constructor(e){super(),this.shape=e}check(e,n){const s=this.shape.some(r=>r===e);return!s&&n?.extend(null,this.shape.join(" | "),e.toString()),s}}const Vi=(...t)=>new Hi(t),Jd=vt(Hi),eF=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),Zd=t=>{if(qs.check(t))return[eF(t)];if(Jd.check(t))return t.shape.map(e=>e+"");if(ch.check(t))return["[+-]?\\d+.?\\d*"];if(lh.check(t))return[".*"];if(xi.check(t))return t.shape.map(Zd).flat(1);Xt()};class tF extends Vt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(Zd).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const s=this._r.exec(e)!=null;return!s&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),s}}vt(tF);const nF=Symbol("optional");class Qd extends Vt{constructor(e){super(),this.shape=e}check(e,n){const s=e===void 0||this.shape.check(e);return!s&&n?.extend(null,"undefined (optional)","()"),s}get[nF](){return!0}}const sF=vt(Qd);class rF extends Vt{check(e,n){return n?.extend(null,"never",typeof e),!1}}vt(rF);class qi extends Vt{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new qi(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):Mr(this.shape,(s,r)=>{const o=this._isPartial&&!oc(e,r)||s.check(e[r],n);return!o&&n?.extend(r.toString(),s.toString(),typeof e[r],"Object property does not match"),o})}}const iF=t=>new qi(t),oF=vt(qi),aF=Nt(t=>t!=null&&(t.constructor===Object||t.constructor==null));class eh extends Vt{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Mr(e,(s,r)=>{const o=this.shape.keys.check(r,n);return!o&&n?.extend(r+"","Record",typeof e,o?"Key doesn't match schema":"Value doesn't match value"),o&&this.shape.values.check(s,n)})}}const th=(t,e)=>new eh(t,e),cF=vt(eh);class nh extends Vt{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Mr(this.shape,(s,r)=>{const o=s.check(e[r],n);return!o&&n?.extend(r.toString(),"Tuple",typeof s),o})}}const lF=(...t)=>new nh(t);vt(nh);class sh extends Vt{constructor(e){super(),this.shape=e.length===1?e[0]:new dc(e)}check(e,n){const s=zs(e)&&Xa(e,r=>this.shape.check(r));return!s&&n?.extend(null,"Array",""),s}}const rh=(...t)=>new sh(t),uF=vt(sh),dF=Nt(t=>zs(t));class ih extends Vt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const s=e instanceof this.shape&&(this._c==null||this._c(e));return!s&&n?.extend(null,this.shape.name,e?.constructor.name),s}}const hF=(t,e=null)=>new ih(t,e);vt(ih);const fF=hF(Vt);class pF extends Vt{constructor(e){super(),this.len=e.length-1,this.args=lF(...e.slice(-1)),this.res=e[this.len]}check(e,n){const s=e.constructor===Function&&e.length<=this.len;return!s&&n?.extend(null,"function",typeof e),s}}const mF=vt(pF),DF=Nt(t=>typeof t=="function");class gF extends Vt{constructor(e){super(),this.shape=e}check(e,n){const s=Xa(this.shape,r=>r.check(e,n));return!s&&n?.extend(null,"Intersectinon",typeof e),s}}vt(gF,t=>t.shape.length>0);class dc extends Vt{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){const s=Ja(this.shape,r=>r.check(e,n));return n?.extend(null,"Union",typeof e),s}}const Qs=(...t)=>t.findIndex(e=>xi.check(e))>=0?Qs(...t.map(e=>Tr(e)).map(e=>xi.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new dc(t),xi=vt(dc),oh=()=>!0,vi=Nt(oh),FF=vt(uc,t=>t.shape===oh),hc=Nt(t=>typeof t=="bigint"),bF=Nt(t=>t===hc),ah=Nt(t=>typeof t=="symbol");Nt(t=>t===ah);const Ns=Nt(t=>typeof t=="number"),ch=Nt(t=>t===Ns),qs=Nt(t=>typeof t=="string"),lh=Nt(t=>t===qs),Ki=Nt(t=>typeof t=="boolean"),yF=Nt(t=>t===Ki),uh=Vi(void 0);vt(Hi,t=>t.shape.length===1&&t.shape[0]===void 0);Vi(void 0);const Wi=Vi(null),CF=vt(Hi,t=>t.shape.length===1&&t.shape[0]===null);vt(Uint8Array);vt(lc,t=>t.shape===Uint8Array);const EF=Qs(Ns,qs,Wi,uh,hc,Ki,ah);(()=>{const t=rh(vi),e=th(qs,vi),n=Qs(Ns,qs,Wi,Ki,t,e);return t.shape=n,e.shape.values=n,n})();const Tr=t=>{if(fF.check(t))return t;if(aF.check(t)){const e={};for(const n in t)e[n]=Tr(t[n]);return iF(e)}else{if(dF.check(t))return Qs(...t.map(Tr));if(EF.check(t))return Vi(t);if(DF.check(t))return vt(t)}Xt()},Jl=P1?()=>{}:(t,e)=>{const n=new Q1;if(!e.check(t,n))throw hn(`Expected value to be of type ${e.constructor.name}.
|
|
44
|
-
${n.toString()}`)};class wF{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Tr(e),h:n}),this}else(e){return this.if(vi,e)}done(){return(e,n)=>{for(let s=0;s<this.patterns.length;s++){const r=this.patterns[s];if(r.if.check(e))return r.h(e,n)}throw hn("Unhandled pattern")}}}const xF=t=>new wF(t),dh=xF(vi).if(ch,(t,e)=>Ro(e,zl,Ci)).if(lh,(t,e)=>J1(e)).if(yF,(t,e)=>Xl(e)).if(bF,(t,e)=>BigInt(Ro(e,zl,Ci))).if(xi,(t,e)=>ws(e,Oo(e,t.shape))).if(oF,(t,e)=>{const n={};for(const s in t.shape){let r=t.shape[s];if(sF.check(r)){if(Xl(e))continue;r=r.shape}n[s]=dh(r,e)}return n}).if(uF,(t,e)=>{const n=[],s=Xd(e,0,42);for(let r=0;r<s;r++)n.push(ws(e,t.shape));return n}).if(Jd,(t,e)=>Oo(e,t.shape)).if(CF,(t,e)=>null).if(mF,(t,e)=>{const n=ws(e,t.res);return()=>n}).if(FF,(t,e)=>ws(e,Oo(e,[Ns,qs,Wi,uh,hc,Ki,rh(Ns),th(Qs("a","b","c"),Ns)]))).if(cF,(t,e)=>{const n={},s=Ro(e,0,3);for(let r=0;r<s;r++){const o=ws(e,t.shape.keys),a=ws(e,t.shape.values);n[o]=a}return n}).done(),ws=(t,e)=>dh(Tr(e),t),wn=typeof document<"u"?document:{},vF=t=>wn.createElement(t),AF=()=>wn.createDocumentFragment();Nt(t=>t.nodeType===OF);const kF=t=>wn.createTextNode(t);typeof DOMParser<"u"&&new DOMParser;const SF=(t,e)=>(Y1(e,(n,s)=>{s===!1?t.removeAttribute(n):s===!0?t.setAttribute(n,""):t.setAttribute(n,s)}),t),jF=t=>{const e=AF();for(let n=0;n<t.length;n++)hh(e,t[n]);return e},BF=(t,e)=>(hh(t,jF(e)),t),W2=(t,e=[],n=[])=>BF(SF(vF(t),e),n);Nt(t=>t.nodeType===LF);const G2=kF;Nt(t=>t.nodeType===NF);const TF=t=>Ug(t,(e,n)=>`${n}:${e};`).join(""),hh=(t,e)=>t.appendChild(e),LF=wn.ELEMENT_NODE,NF=wn.TEXT_NODE;wn.CDATA_SECTION_NODE;wn.COMMENT_NODE;const RF=wn.DOCUMENT_NODE;wn.DOCUMENT_TYPE_NODE;const OF=wn.DOCUMENT_FRAGMENT_NODE;Nt(t=>t.nodeType===RF);const Rn=Symbol,fh=Rn(),ph=Rn(),PF=Rn(),_F=Rn(),IF=Rn(),mh=Rn(),MF=Rn(),fc=Rn(),$F=Rn(),UF=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let s=0;for(;s<t.length;s++){const r=t[s];if(r===void 0)break;if(r.constructor===String||r.constructor===Number)e.push(r);else if(r.constructor===Object)break}for(s>0&&n.push(e.join(""));s<t.length;s++){const r=t[s];r instanceof Symbol||n.push(r)}return n},zF={[fh]:Sn("font-weight","bold"),[ph]:Sn("font-weight","normal"),[PF]:Sn("color","blue"),[IF]:Sn("color","green"),[_F]:Sn("color","grey"),[mh]:Sn("color","red"),[MF]:Sn("color","purple"),[fc]:Sn("color","orange"),[$F]:Sn("color","black")},HF=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],s=Kt();let r=[],o=0;for(;o<t.length;o++){const a=t[o],c=zF[a];if(c!==void 0)s.set(c.left,c.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const l=TF(s);o>0||l.length>0?(e.push("%c"+a),n.push(l)):e.push(a)}else break}}for(o>0&&(r=n,r.unshift(e.join("")));o<t.length;o++){const a=t[o];a instanceof Symbol||r.push(a)}return r},Dh=I1?HF:UF,VF=(...t)=>{console.log(...Dh(t)),Fh.forEach(e=>e.print(t))},gh=(...t)=>{console.warn(...Dh(t)),t.unshift(fc),Fh.forEach(e=>e.print(t))},Fh=qn(),bh=t=>({[Symbol.iterator](){return this},next:t}),qF=(t,e)=>bh(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Po=(t,e)=>bh(()=>{const{done:n,value:s}=t.next();return{done:n,value:n?void 0:e(s)}});class Gi{constructor(e,n){this.clock=e,this.len=n}}class er{constructor(){this.clients=new Map}}const Ks=(t,e,n)=>e.clients.forEach((s,r)=>{const o=t.doc.store.clients.get(r);if(o!=null){const a=o[o.length-1],c=a.id.clock+a.length;for(let l=0,u=s[l];l<s.length&&u.clock<c;u=s[++l])Rh(t,o,u.clock,u.len,n)}}),KF=(t,e)=>{let n=0,s=t.length-1;for(;n<=s;){const r=dn((n+s)/2),o=t[r],a=o.clock;if(a<=e){if(e<a+o.len)return r;n=r+1}else s=r-1}return null},$r=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&KF(n,e.clock)!==null},pc=t=>{t.clients.forEach(e=>{e.sort((r,o)=>r.clock-o.clock);let n,s;for(n=1,s=1;n<e.length;n++){const r=e[s-1],o=e[n];r.clock+r.len>=o.clock?e[s-1]=new Gi(r.clock,ds(r.len,o.clock+o.len-r.clock)):(s<n&&(e[s]=o),s++)}e.length=s})},wa=t=>{const e=new er;for(let n=0;n<t.length;n++)t[n].clients.forEach((s,r)=>{if(!e.clients.has(r)){const o=s.slice();for(let a=n+1;a<t.length;a++)Hg(o,t[a].clients.get(r)||[]);e.clients.set(r,o)}});return pc(e),e},Lr=(t,e,n,s)=>{En(t.clients,e,()=>[]).push(new Gi(n,s))},WF=()=>new er,GF=t=>{const e=WF();return t.clients.forEach((n,s)=>{const r=[];for(let o=0;o<n.length;o++){const a=n[o];if(a.deleted){const c=a.id.clock;let l=a.length;if(o+1<n.length)for(let u=n[o+1];o+1<n.length&&u.deleted;u=n[++o+1])l+=u.length;r.push(new Gi(c,l))}}r.length>0&&e.clients.set(s,r)}),e},tr=(t,e)=>{me(t.restEncoder,e.clients.size),Nn(e.clients.entries()).sort((n,s)=>s[0]-n[0]).forEach(([n,s])=>{t.resetDsCurVal(),me(t.restEncoder,n);const r=s.length;me(t.restEncoder,r);for(let o=0;o<r;o++){const a=s[o];t.writeDsClock(a.clock),t.writeDsLen(a.len)}})},mc=t=>{const e=new er,n=Se(t.restDecoder);for(let s=0;s<n;s++){t.resetDsCurVal();const r=Se(t.restDecoder),o=Se(t.restDecoder);if(o>0){const a=En(e.clients,r,()=>[]);for(let c=0;c<o;c++)a.push(new Gi(t.readDsClock(),t.readDsLen()))}}return e},Zl=(t,e,n)=>{const s=new er,r=Se(t.restDecoder);for(let o=0;o<r;o++){t.resetDsCurVal();const a=Se(t.restDecoder),c=Se(t.restDecoder),l=n.clients.get(a)||[],u=Ct(n,a);for(let d=0;d<c;d++){const h=t.readDsClock(),D=h+t.readDsLen();if(h<u){u<D&&Lr(s,a,u,D-u);let m=bn(l,h),g=l[m];for(!g.deleted&&g.id.clock<h&&(l.splice(m+1,0,Ni(e,g,h-g.id.clock)),m++);m<l.length&&(g=l[m++],g.id.clock<D);)g.deleted||(D<g.id.clock+g.length&&l.splice(m,0,Ni(e,g,D-g.id.clock)),g.delete(e))}else Lr(s,a,h,D-h)}}if(s.clients.size>0){const o=new as;return me(o.restEncoder,0),tr(o,s),o.toUint8Array()}return null},yh=Ud;class hs extends Za{constructor({guid:e=C1(),collectionid:n=null,gc:s=!0,gcFilter:r=()=>!0,meta:o=null,autoLoad:a=!1,shouldLoad:c=!0}={}){super(),this.gc=s,this.gcFilter=r,this.clientID=yh(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new Lh,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=a,this.meta=o,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Vs(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>Vs(u=>{const d=h=>{(h===void 0||h===!0)&&(this.off("sync",d),u())};this.on("sync",d)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&rt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Nn(this.subdocs).map(e=>e.guid))}transact(e,n=null){return rt(this,e,n)}get(e,n=Lt){const s=En(this.share,e,()=>{const o=new n;return o._integrate(this,null),o}),r=s.constructor;if(n!==Lt&&r!==n)if(r===Lt){const o=new n;o._map=s._map,s._map.forEach(a=>{for(;a!==null;a=a.left)a.parent=o}),o._start=s._start;for(let a=o._start;a!==null;a=a.right)a.parent=o;return o._length=s._length,this.share.set(e,o),o._integrate(this,null),o}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return s}getArray(e=""){return this.get(e,Ps)}getText(e=""){return this.get(e,Ys)}getMap(e=""){return this.get(e,Gs)}getXmlElement(e=""){return this.get(e,Xs)}getXmlFragment(e=""){return this.get(e,cs)}toJSON(){const e={};return this.share.forEach((n,s)=>{e[s]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,Nn(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new hs({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,rt(e.parent.doc,s=>{const r=n.doc;e.deleted||s.subdocsAdded.add(r),s.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Ch{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Se(this.restDecoder)}readDsLen(){return Se(this.restDecoder)}}class Eh extends Ch{readLeftID(){return _e(Se(this.restDecoder),Se(this.restDecoder))}readRightID(){return _e(Se(this.restDecoder),Se(this.restDecoder))}readClient(){return Se(this.restDecoder)}readInfo(){return Hs(this.restDecoder)}readString(){return lt(this.restDecoder)}readParentInfo(){return Se(this.restDecoder)===1}readTypeRef(){return Se(this.restDecoder)}readLen(){return Se(this.restDecoder)}readAny(){return jr(this.restDecoder)}readBuf(){return W1(Mt(this.restDecoder))}readJSON(){return JSON.parse(lt(this.restDecoder))}readKey(){return lt(this.restDecoder)}}class YF{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Se(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Se(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Ws extends YF{constructor(e){super(e),this.keys=[],Se(e),this.keyClockDecoder=new No(Mt(e)),this.clientDecoder=new di(Mt(e)),this.leftClockDecoder=new No(Mt(e)),this.rightClockDecoder=new No(Mt(e)),this.infoDecoder=new Gl(Mt(e),Hs),this.stringDecoder=new F1(Mt(e)),this.parentInfoDecoder=new Gl(Mt(e),Hs),this.typeRefDecoder=new di(Mt(e)),this.lenDecoder=new di(Mt(e))}readLeftID(){return new Rs(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Rs(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return jr(this.restDecoder)}readBuf(){return Mt(this.restDecoder)}readJSON(){return jr(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class wh{constructor(){this.restEncoder=Ft()}toUint8Array(){return nt(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){me(this.restEncoder,e)}writeDsLen(e){me(this.restEncoder,e)}}class Ur extends wh{writeLeftID(e){me(this.restEncoder,e.client),me(this.restEncoder,e.clock)}writeRightID(e){me(this.restEncoder,e.client),me(this.restEncoder,e.clock)}writeClient(e){me(this.restEncoder,e)}writeInfo(e){Fa(this.restEncoder,e)}writeString(e){_t(this.restEncoder,e)}writeParentInfo(e){me(this.restEncoder,e?1:0)}writeTypeRef(e){me(this.restEncoder,e)}writeLen(e){me(this.restEncoder,e)}writeAny(e){Sr(this.restEncoder,e)}writeBuf(e){gt(this.restEncoder,e)}writeJSON(e){_t(this.restEncoder,JSON.stringify(e))}writeKey(e){_t(this.restEncoder,e)}}class xh{constructor(){this.restEncoder=Ft(),this.dsCurrVal=0}toUint8Array(){return nt(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,me(this.restEncoder,n)}writeDsLen(e){e===0&&Xt(),me(this.restEncoder,e-1),this.dsCurrVal+=e}}class as extends xh{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Lo,this.clientEncoder=new ui,this.leftClockEncoder=new Lo,this.rightClockEncoder=new Lo,this.infoEncoder=new ql(Fa),this.stringEncoder=new u1,this.parentInfoEncoder=new ql(Fa),this.typeRefEncoder=new ui,this.lenEncoder=new ui}toUint8Array(){const e=Ft();return me(e,0),gt(e,this.keyClockEncoder.toUint8Array()),gt(e,this.clientEncoder.toUint8Array()),gt(e,this.leftClockEncoder.toUint8Array()),gt(e,this.rightClockEncoder.toUint8Array()),gt(e,nt(this.infoEncoder)),gt(e,this.stringEncoder.toUint8Array()),gt(e,nt(this.parentInfoEncoder)),gt(e,this.typeRefEncoder.toUint8Array()),gt(e,this.lenEncoder.toUint8Array()),Ui(e,nt(this.restEncoder)),nt(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Sr(this.restEncoder,e)}writeBuf(e){gt(this.restEncoder,e)}writeJSON(e){Sr(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const XF=(t,e,n,s)=>{s=ds(s,e[0].id.clock);const r=bn(e,s);me(t.restEncoder,e.length-r),t.writeClient(n),me(t.restEncoder,s);const o=e[r];o.write(t,s-o.id.clock);for(let a=r+1;a<e.length;a++)e[a].write(t,0)},Dc=(t,e,n)=>{const s=new Map;n.forEach((r,o)=>{Ct(e,o)>r&&s.set(o,r)}),Yi(e).forEach((r,o)=>{n.has(o)||s.set(o,0)}),me(t.restEncoder,s.size),Nn(s.entries()).sort((r,o)=>o[0]-r[0]).forEach(([r,o])=>{XF(t,e.clients.get(r),r,o)})},JF=(t,e)=>{const n=Kt(),s=Se(t.restDecoder);for(let r=0;r<s;r++){const o=Se(t.restDecoder),a=new Array(o),c=t.readClient();let l=Se(t.restDecoder);n.set(c,{i:0,refs:a});for(let u=0;u<o;u++){const d=t.readInfo();switch($i&d){case 0:{const h=t.readLen();a[u]=new en(_e(c,l),h),l+=h;break}case 10:{const h=Se(t.restDecoder);a[u]=new tn(_e(c,l),h),l+=h;break}default:{const h=(d&(Tn|Yt))===0,D=new it(_e(c,l),null,(d&Yt)===Yt?t.readLeftID():null,null,(d&Tn)===Tn?t.readRightID():null,h?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,h&&(d&Ar)===Ar?t.readString():null,ef(t,d));a[u]=D,l+=D.length}}}}return n},ZF=(t,e,n)=>{const s=[];let r=Nn(n.keys()).sort((m,g)=>m-g);if(r.length===0)return null;const o=()=>{if(r.length===0)return null;let m=n.get(r[r.length-1]);for(;m.refs.length===m.i;)if(r.pop(),r.length>0)m=n.get(r[r.length-1]);else return null;return m};let a=o();if(a===null)return null;const c=new Lh,l=new Map,u=(m,g)=>{const y=l.get(m);(y==null||y>g)&&l.set(m,g)};let d=a.refs[a.i++];const h=new Map,D=()=>{for(const m of s){const g=m.id.client,y=n.get(g);y?(y.i--,c.clients.set(g,y.refs.slice(y.i)),n.delete(g),y.i=0,y.refs=[]):c.clients.set(g,[m]),r=r.filter(b=>b!==g)}s.length=0};for(;;){if(d.constructor!==tn){const g=En(h,d.id.client,()=>Ct(e,d.id.client))-d.id.clock;if(g<0)s.push(d),u(d.id.client,d.id.clock-1),D();else{const y=d.getMissing(t,e);if(y!==null){s.push(d);const b=n.get(y)||{refs:[],i:0};if(b.refs.length===b.i)u(y,Ct(e,y)),D();else{d=b.refs[b.i++];continue}}else(g===0||g<d.length)&&(d.integrate(t,g),h.set(d.id.client,d.id.clock+d.length))}}if(s.length>0)d=s.pop();else if(a!==null&&a.i<a.refs.length)d=a.refs[a.i++];else{if(a=o(),a===null)break;d=a.refs[a.i++]}}if(c.clients.size>0){const m=new as;return Dc(m,c,new Map),me(m.restEncoder,0),{missing:l,update:m.toUint8Array()}}return null},QF=(t,e)=>Dc(t,e.doc.store,e.beforeState),eb=(t,e,n,s=new Ws(t))=>rt(e,r=>{r.local=!1;let o=!1;const a=r.doc,c=a.store,l=JF(s,a),u=ZF(r,c,l),d=c.pendingStructs;if(d){for(const[D,m]of d.missing)if(m<Ct(c,D)){o=!0;break}if(u){for(const[D,m]of u.missing){const g=d.missing.get(D);(g==null||g>m)&&d.missing.set(D,m)}d.update=ki([d.update,u.update])}}else c.pendingStructs=u;const h=Zl(s,r,c);if(c.pendingDs){const D=new Ws(Yn(c.pendingDs));Se(D.restDecoder);const m=Zl(D,r,c);h&&m?c.pendingDs=ki([h,m]):c.pendingDs=h||m}else c.pendingDs=h;if(o){const D=c.pendingStructs.update;c.pendingStructs=null,vh(r.doc,D)}},n,!1),vh=(t,e,n,s=Ws)=>{const r=Yn(e);eb(r,t,n,new s(r))},Ah=(t,e,n)=>vh(t,e,n,Eh),tb=(t,e,n=new Map)=>{Dc(t,e.store,n),tr(t,GF(e.store))},nb=(t,e=new Uint8Array([0]),n=new as)=>{const s=kh(e);tb(n,t,s);const r=[n.toUint8Array()];if(t.store.pendingDs&&r.push(t.store.pendingDs),t.store.pendingStructs&&r.push(Cb(t.store.pendingStructs.update,e)),r.length>1){if(n.constructor===Ur)return bb(r.map((o,a)=>a===0?o:wb(o)));if(n.constructor===as)return ki(r)}return r[0]},gc=(t,e)=>nb(t,e,new Ur),sb=t=>{const e=new Map,n=Se(t.restDecoder);for(let s=0;s<n;s++){const r=Se(t.restDecoder),o=Se(t.restDecoder);e.set(r,o)}return e},kh=t=>sb(new Ch(Yn(t))),Sh=(t,e)=>(me(t.restEncoder,e.size),Nn(e.entries()).sort((n,s)=>s[0]-n[0]).forEach(([n,s])=>{me(t.restEncoder,n),me(t.restEncoder,s)}),t),rb=(t,e)=>Sh(t,Yi(e.store)),ib=(t,e=new xh)=>(t instanceof Map?Sh(e,t):rb(e,t),e.toUint8Array()),ob=t=>ib(t,new wh);class ab{constructor(){this.l=[]}}const Ql=()=>new ab,eu=(t,e)=>t.l.push(e),tu=(t,e)=>{const n=t.l,s=n.length;t.l=n.filter(r=>e!==r),s===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},jh=(t,e,n)=>ac(t.l,[e,n]);class Rs{constructor(e,n){this.client=e,this.clock=n}}const js=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,_e=(t,e)=>new Rs(t,e),Bh=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Xt()},Ai=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Th{constructor(e,n,s,r=0){this.type=e,this.tname=n,this.item=s,this.assoc=r}}const Y2=t=>{const e={};return t.type&&(e.type=t.type),t.tname&&(e.tname=t.tname),t.item&&(e.item=t.item),t.assoc!=null&&(e.assoc=t.assoc),e},X2=t=>new Th(t.type==null?null:_e(t.type.client,t.type.clock),t.tname??null,t.item==null?null:_e(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class cb{constructor(e,n,s=0){this.type=e,this.index=n,this.assoc=s}}const lb=(t,e,n=0)=>new cb(t,e,n),ri=(t,e,n)=>{let s=null,r=null;return t._item===null?r=Bh(t):s=_e(t._item.id.client,t._item.id.clock),new Th(s,r,e,n)},J2=(t,e,n=0)=>{let s=t._start;if(n<0){if(e===0)return ri(t,null,n);e--}for(;s!==null;){if(!s.deleted&&s.countable){if(s.length>e)return ri(t,_e(s.id.client,s.id.clock+e),n);e-=s.length}if(s.right===null&&n<0)return ri(t,s.lastId,n);s=s.right}return ri(t,null,n)},ub=(t,e)=>{const n=Os(t,e),s=e.clock-n.id.clock;return{item:n,diff:s}},Z2=(t,e,n=!0)=>{const s=e.store,r=t.item,o=t.type,a=t.tname,c=t.assoc;let l=null,u=0;if(r!==null){if(Ct(s,r.client)<=r.clock)return null;const d=n?ka(s,r):ub(s,r),h=d.item;if(!(h instanceof it))return null;if(l=h.parent,l._item===null||!l._item.deleted){u=h.deleted||!h.countable?0:d.diff+(c>=0?0:1);let D=h.left;for(;D!==null;)!D.deleted&&D.countable&&(u+=D.length),D=D.left}}else{if(a!==null)l=e.get(a);else if(o!==null){if(Ct(s,o.client)<=o.clock)return null;const{item:d}=n?ka(s,o):{item:Os(s,o)};if(d instanceof it&&d.content instanceof xn)l=d.content.type;else return null}else throw Xt();c>=0?u=l._length:u=0}return lb(l,u,t.assoc)},Q2=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&js(t.item,e.item)&&js(t.type,e.type)&&t.assoc===e.assoc,As=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!$r(e.ds,t.id),xa=(t,e)=>{const n=En(t.meta,xa,qn),s=t.doc.store;n.has(e)||(e.sv.forEach((r,o)=>{r<Ct(s,o)&&qt(t,_e(o,r))}),Ks(t,e.ds,r=>{}),n.add(e))};class Lh{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Yi=t=>{const e=new Map;return t.clients.forEach((n,s)=>{const r=n[n.length-1];e.set(s,r.id.clock+r.length)}),e},Ct=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const s=n[n.length-1];return s.id.clock+s.length},Nh=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const s=n[n.length-1];if(s.id.clock+s.length!==e.id.clock)throw Xt()}n.push(e)},bn=(t,e)=>{let n=0,s=t.length-1,r=t[s],o=r.id.clock;if(o===e)return s;let a=dn(e/(o+r.length-1)*s);for(;n<=s;){if(r=t[a],o=r.id.clock,o<=e){if(e<o+r.length)return a;n=a+1}else s=a-1;a=dn((n+s)/2)}throw Xt()},db=(t,e)=>{const n=t.clients.get(e.client);return n[bn(n,e.clock)]},Os=db,va=(t,e,n)=>{const s=bn(e,n),r=e[s];return r.id.clock<n&&r instanceof it?(e.splice(s+1,0,Ni(t,r,n-r.id.clock)),s+1):s},qt=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[va(t,n,e.clock)]},nu=(t,e,n)=>{const s=e.clients.get(n.client),r=bn(s,n.clock),o=s[r];return n.clock!==o.id.clock+o.length-1&&o.constructor!==en&&s.splice(r+1,0,Ni(t,o,n.clock-o.id.clock+1)),o},hb=(t,e,n)=>{const s=t.clients.get(e.id.client);s[bn(s,e.id.clock)]=n},Rh=(t,e,n,s,r)=>{if(s===0)return;const o=n+s;let a=va(t,e,n),c;do c=e[a++],o<c.id.clock+c.length&&va(t,e,o),r(c);while(a<e.length&&e[a].id.clock<o)};class fb{constructor(e,n,s){this.doc=e,this.deleteSet=new er,this.beforeState=Yi(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=s,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const su=(t,e)=>e.deleteSet.clients.size===0&&!zg(e.afterState,(n,s)=>e.beforeState.get(s)!==n)?!1:(pc(e.deleteSet),QF(t,e),tr(t,e.deleteSet),!0),ru=(t,e,n)=>{const s=e._item;(s===null||s.id.clock<(t.beforeState.get(s.id.client)||0)&&!s.deleted)&&En(t.changed,e,qn).add(n)},hi=(t,e)=>{let n=t[e],s=t[e-1],r=e;for(;r>0;n=s,s=t[--r-1]){if(s.deleted===n.deleted&&s.constructor===n.constructor&&s.mergeWith(n)){n instanceof it&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,s);continue}break}const o=e-r;return o&&t.splice(e+1-o,o),o},pb=(t,e,n)=>{for(const[s,r]of t.clients.entries()){const o=e.clients.get(s);for(let a=r.length-1;a>=0;a--){const c=r[a],l=c.clock+c.len;for(let u=bn(o,c.clock),d=o[u];u<o.length&&d.id.clock<l;d=o[++u]){const h=o[u];if(c.clock+c.len<=h.id.clock)break;h instanceof it&&h.deleted&&!h.keep&&n(h)&&h.gc(e,!1)}}}},mb=(t,e)=>{t.clients.forEach((n,s)=>{const r=e.clients.get(s);for(let o=n.length-1;o>=0;o--){const a=n[o],c=Qa(r.length-1,1+bn(r,a.clock+a.len-1));for(let l=c,u=r[l];l>0&&u.id.clock>=a.clock;u=r[l])l-=1+hi(r,l)}})},Oh=(t,e)=>{if(e<t.length){const n=t[e],s=n.doc,r=s.store,o=n.deleteSet,a=n._mergeStructs;try{pc(o),n.afterState=Yi(n.doc.store),s.emit("beforeObserverCalls",[n,s]);const c=[];n.changed.forEach((l,u)=>c.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),c.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=u,d._path=null}),l.sort((d,h)=>d.path.length-h.path.length),c.push(()=>{jh(u._dEH,l,n)}))}),c.push(()=>s.emit("afterTransaction",[n,s])),c.push(()=>{n._needFormattingCleanup&&_b(n)})}),ac(c,[])}finally{s.gc&&pb(o,r,s.gcFilter),mb(o,r),n.afterState.forEach((d,h)=>{const D=n.beforeState.get(h)||0;if(D!==d){const m=r.clients.get(h),g=ds(bn(m,D),1);for(let y=m.length-1;y>=g;)y-=1+hi(m,y)}});for(let d=a.length-1;d>=0;d--){const{client:h,clock:D}=a[d].id,m=r.clients.get(h),g=bn(m,D);g+1<m.length&&hi(m,g+1)>1||g>0&&hi(m,g)}if(!n.local&&n.afterState.get(s.clientID)!==n.beforeState.get(s.clientID)&&(VF(fc,fh,"[yjs] ",ph,mh,"Changed the client-id because another client seems to be using it."),s.clientID=yh()),s.emit("afterTransactionCleanup",[n,s]),s._observers.has("update")){const d=new Ur;su(d,n)&&s.emit("update",[d.toUint8Array(),n.origin,s,n])}if(s._observers.has("updateV2")){const d=new as;su(d,n)&&s.emit("updateV2",[d.toUint8Array(),n.origin,s,n])}const{subdocsAdded:c,subdocsLoaded:l,subdocsRemoved:u}=n;(c.size>0||u.size>0||l.size>0)&&(c.forEach(d=>{d.clientID=s.clientID,d.collectionid==null&&(d.collectionid=s.collectionid),s.subdocs.add(d)}),u.forEach(d=>s.subdocs.delete(d)),s.emit("subdocs",[{loaded:l,added:c,removed:u},s,n]),u.forEach(d=>d.destroy())),t.length<=e+1?(s._transactionCleanups=[],s.emit("afterAllTransactions",[s,t])):Oh(t,e+1)}}},rt=(t,e,n=null,s=!0)=>{const r=t._transactionCleanups;let o=!1,a=null;t._transaction===null&&(o=!0,t._transaction=new fb(t,n,s),r.push(t._transaction),r.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{a=e(t._transaction)}finally{if(o){const c=t._transaction===r[0];t._transaction=null,c&&Oh(r,0)}}return a};class Db{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const iu=(t,e,n)=>{Ks(t,n.deletions,s=>{s instanceof it&&e.scope.some(r=>r===t.doc||Ai(r,s))&&vc(s,!1)})},ou=(t,e,n)=>{let s=null;const r=t.doc,o=t.scope;rt(r,c=>{for(;e.length>0&&t.currStackItem===null;){const l=r.store,u=e.pop(),d=new Set,h=[];let D=!1;Ks(c,u.insertions,m=>{if(m instanceof it){if(m.redone!==null){let{item:g,diff:y}=ka(l,m.id);y>0&&(g=qt(c,_e(g.id.client,g.id.clock+y))),m=g}!m.deleted&&o.some(g=>g===c.doc||Ai(g,m))&&h.push(m)}}),Ks(c,u.deletions,m=>{m instanceof it&&o.some(g=>g===c.doc||Ai(g,m))&&!$r(u.insertions,m.id)&&d.add(m)}),d.forEach(m=>{D=Qh(c,m,d,u.insertions,t.ignoreRemoteMapChanges,t)!==null||D});for(let m=h.length-1;m>=0;m--){const g=h[m];t.deleteFilter(g)&&(g.delete(c),D=!0)}t.currStackItem=D?u:null}c.changed.forEach((l,u)=>{l.has(null)&&u._searchMarker&&(u._searchMarker.length=0)}),s=c},t);const a=t.currStackItem;if(a!=null){const c=s.changedParentTypes;t.emit("stack-item-popped",[{stackItem:a,type:n,changedParentTypes:c,origin:t},t]),t.currStackItem=null}return a};class gb extends Za{constructor(e,{captureTimeout:n=500,captureTransaction:s=l=>!0,deleteFilter:r=()=>!0,trackedOrigins:o=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:c=zs(e)?e[0].doc:e instanceof hs?e:e.doc}={}){super(),this.scope=[],this.doc=c,this.addToScope(e),this.deleteFilter=r,o.add(this),this.trackedOrigins=o,this.captureTransaction=s,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(b=>l.changedParentTypes.has(b)||b===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const u=this.undoing,d=this.redoing,h=u?this.redoStack:this.undoStack;u?this.stopCapturing():d||this.clear(!1,!0);const D=new er;l.afterState.forEach((b,w)=>{const x=l.beforeState.get(w)||0,j=b-x;j>0&&Lr(D,w,x,j)});const m=Kn();let g=!1;if(this.lastChange>0&&m-this.lastChange<this.captureTimeout&&h.length>0&&!u&&!d){const b=h[h.length-1];b.deletions=wa([b.deletions,l.deleteSet]),b.insertions=wa([b.insertions,D])}else h.push(new Db(l.deleteSet,D)),g=!0;!u&&!d&&(this.lastChange=m),Ks(l,l.deleteSet,b=>{b instanceof it&&this.scope.some(w=>w===l.doc||Ai(w,b))&&vc(b,!0)});const y=[{stackItem:h[h.length-1],origin:l.origin,type:u?"redo":"undo",changedParentTypes:l.changedParentTypes},this];g?this.emit("stack-item-added",y):this.emit("stack-item-updated",y)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=zs(e)?e:[e],e.forEach(s=>{n.has(s)||(n.add(s),(s instanceof Lt?s.doc!==this.doc:s!==this.doc)&&gh("[yjs#509] Not same Y.Doc"),this.scope.push(s))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(s=>{e&&(this.undoStack.forEach(r=>iu(s,this,r)),this.undoStack=[]),n&&(this.redoStack.forEach(r=>iu(s,this,r)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=ou(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=ou(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*Fb(t){const e=Se(t.restDecoder);for(let n=0;n<e;n++){const s=Se(t.restDecoder),r=t.readClient();let o=Se(t.restDecoder);for(let a=0;a<s;a++){const c=t.readInfo();if(c===10){const l=Se(t.restDecoder);yield new tn(_e(r,o),l),o+=l}else if(($i&c)!==0){const l=(c&(Tn|Yt))===0,u=new it(_e(r,o),null,(c&Yt)===Yt?t.readLeftID():null,null,(c&Tn)===Tn?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(c&Ar)===Ar?t.readString():null,ef(t,c));yield u,o+=u.length}else{const l=t.readLen();yield new en(_e(r,o),l),o+=l}}}}class Fc{constructor(e,n){this.gen=Fb(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===tn);return this.curr}}class bc{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const bb=t=>ki(t,Eh,Ur),yb=(t,e)=>{if(t.constructor===en){const{client:n,clock:s}=t.id;return new en(_e(n,s+e),t.length-e)}else if(t.constructor===tn){const{client:n,clock:s}=t.id;return new tn(_e(n,s+e),t.length-e)}else{const n=t,{client:s,clock:r}=n.id;return new it(_e(s,r+e),null,_e(s,r+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},ki=(t,e=Ws,n=as)=>{if(t.length===1)return t[0];const s=t.map(d=>new e(Yn(d)));let r=s.map(d=>new Fc(d,!0)),o=null;const a=new n,c=new bc(a);for(;r=r.filter(D=>D.curr!==null),r.sort((D,m)=>{if(D.curr.id.client===m.curr.id.client){const g=D.curr.id.clock-m.curr.id.clock;return g===0?D.curr.constructor===m.curr.constructor?0:D.curr.constructor===tn?1:-1:g}else return m.curr.id.client-D.curr.id.client}),r.length!==0;){const d=r[0],h=d.curr.id.client;if(o!==null){let D=d.curr,m=!1;for(;D!==null&&D.id.clock+D.length<=o.struct.id.clock+o.struct.length&&D.id.client>=o.struct.id.client;)D=d.next(),m=!0;if(D===null||D.id.client!==h||m&&D.id.clock>o.struct.id.clock+o.struct.length)continue;if(h!==o.struct.id.client)Mn(c,o.struct,o.offset),o={struct:D,offset:0},d.next();else if(o.struct.id.clock+o.struct.length<D.id.clock)if(o.struct.constructor===tn)o.struct.length=D.id.clock+D.length-o.struct.id.clock;else{Mn(c,o.struct,o.offset);const g=D.id.clock-o.struct.id.clock-o.struct.length;o={struct:new tn(_e(h,o.struct.id.clock+o.struct.length),g),offset:0}}else{const g=o.struct.id.clock+o.struct.length-D.id.clock;g>0&&(o.struct.constructor===tn?o.struct.length-=g:D=yb(D,g)),o.struct.mergeWith(D)||(Mn(c,o.struct,o.offset),o={struct:D,offset:0},d.next())}}else o={struct:d.curr,offset:0},d.next();for(let D=d.curr;D!==null&&D.id.client===h&&D.id.clock===o.struct.id.clock+o.struct.length&&D.constructor!==tn;D=d.next())Mn(c,o.struct,o.offset),o={struct:D,offset:0}}o!==null&&(Mn(c,o.struct,o.offset),o=null),yc(c);const l=s.map(d=>mc(d)),u=wa(l);return tr(a,u),a.toUint8Array()},Cb=(t,e,n=Ws,s=as)=>{const r=kh(e),o=new s,a=new bc(o),c=new n(Yn(t)),l=new Fc(c,!1);for(;l.curr;){const d=l.curr,h=d.id.client,D=r.get(h)||0;if(l.curr.constructor===tn){l.next();continue}if(d.id.clock+d.length>D)for(Mn(a,d,ds(D-d.id.clock,0)),l.next();l.curr&&l.curr.id.client===h;)Mn(a,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===h&&l.curr.id.clock+l.curr.length<=D;)l.next()}yc(a);const u=mc(c);return tr(o,u),o.toUint8Array()},Ph=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:nt(t.encoder.restEncoder)}),t.encoder.restEncoder=Ft(),t.written=0)},Mn=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&Ph(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),me(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},yc=t=>{Ph(t);const e=t.encoder.restEncoder;me(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const s=t.clientStructs[n];me(e,s.written),Ui(e,s.restEncoder)}},Eb=(t,e,n,s)=>{const r=new n(Yn(t)),o=new Fc(r,!1),a=new s,c=new bc(a);for(let u=o.curr;u!==null;u=o.next())Mn(c,e(u),0);yc(c);const l=mc(r);return tr(a,l),a.toUint8Array()},wb=t=>Eb(t,N1,Ws,Ur),au="You must not compute changes after the event-handler fired.";class Xi{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=xb(this.currentTarget,this.target))}deletes(e){return $r(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw hn(au);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(r=>{if(r!==null){const o=n._map.get(r);let a,c;if(this.adds(o)){let l=o.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(o))if(l!==null&&this.deletes(l))a="delete",c=jo(l.content.getContent());else return;else l!==null&&this.deletes(l)?(a="update",c=jo(l.content.getContent())):(a="add",c=void 0)}else if(this.deletes(o))a="delete",c=jo(o.content.getContent());else return;e.set(r,{action:a,oldValue:c})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw hn(au);const n=this.target,s=qn(),r=qn(),o=[];if(e={added:s,deleted:r,delta:o,keys:this.keys},this.transaction.changed.get(n).has(null)){let c=null;const l=()=>{c&&o.push(c)};for(let u=n._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((c===null||c.delete===void 0)&&(l(),c={delete:0}),c.delete+=u.length,r.add(u)):this.adds(u)?((c===null||c.insert===void 0)&&(l(),c={insert:[]}),c.insert=c.insert.concat(u.content.getContent()),s.add(u)):((c===null||c.retain===void 0)&&(l(),c={retain:0}),c.retain+=u.length);c!==null&&c.retain===void 0&&l()}this._changes=e}return e}}const xb=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let s=0,r=e._item.parent._start;for(;r!==e._item&&r!==null;)!r.deleted&&r.countable&&(s+=r.length),r=r.right;n.unshift(s)}e=e._item.parent}return n},$t=()=>{gh("Invalid access: Add Yjs type to a document before reading data.")},_h=80;let Cc=0;class vb{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Cc++}}const Ab=t=>{t.timestamp=Cc++},Ih=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Cc++},kb=(t,e,n)=>{if(t.length>=_h){const s=t.reduce((r,o)=>r.timestamp<o.timestamp?r:o);return Ih(s,e,n),s}else{const s=new vb(e,n);return t.push(s),s}},Ji=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((o,a)=>li(e-o.index)<li(e-a.index)?o:a);let s=t._start,r=0;for(n!==null&&(s=n.p,r=n.index,Ab(n));s.right!==null&&r<e;){if(!s.deleted&&s.countable){if(e<r+s.length)break;r+=s.length}s=s.right}for(;s.left!==null&&r>e;)s=s.left,!s.deleted&&s.countable&&(r-=s.length);for(;s.left!==null&&s.left.id.client===s.id.client&&s.left.id.clock+s.left.length===s.id.clock;)s=s.left,!s.deleted&&s.countable&&(r-=s.length);return n!==null&&li(n.index-r)<s.parent.length/_h?(Ih(n,s,r),n):kb(t._searchMarker,s,r)},Nr=(t,e,n)=>{for(let s=t.length-1;s>=0;s--){const r=t[s];if(n>0){let o=r.p;for(o.marker=!1;o&&(o.deleted||!o.countable);)o=o.left,o&&!o.deleted&&o.countable&&(r.index-=o.length);if(o===null||o.marker===!0){t.splice(s,1);continue}r.p=o,o.marker=!0}(e<r.index||n>0&&e===r.index)&&(r.index=ds(e,r.index+n))}},Zi=(t,e,n)=>{const s=t,r=e.changedParentTypes;for(;En(r,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;jh(s._eH,n,e)};class Lt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Ql(),this._dEH=Ql(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw un()}clone(){throw un()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){eu(this._eH,e)}observeDeep(e){eu(this._dEH,e)}unobserve(e){tu(this._eH,e)}unobserveDeep(e){tu(this._dEH,e)}toJSON(){}}const Mh=(t,e,n)=>{t.doc??$t(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let s=n-e;const r=[];let o=t._start;for(;o!==null&&s>0;){if(o.countable&&!o.deleted){const a=o.content.getContent();if(a.length<=e)e-=a.length;else{for(let c=e;c<a.length&&s>0;c++)r.push(a[c]),s--;e=0}}o=o.right}return r},$h=t=>{t.doc??$t();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const s=n.content.getContent();for(let r=0;r<s.length;r++)e.push(s[r])}n=n.right}return e},Rr=(t,e)=>{let n=0,s=t._start;for(t.doc??$t();s!==null;){if(s.countable&&!s.deleted){const r=s.content.getContent();for(let o=0;o<r.length;o++)e(r[o],n++,t)}s=s.right}},Uh=(t,e)=>{const n=[];return Rr(t,(s,r)=>{n.push(e(s,r,t))}),n},Sb=t=>{let e=t._start,n=null,s=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),s=0,e=e.right}const r=n[s++];return n.length<=s&&(n=null),{done:!1,value:r}}}},zh=(t,e)=>{t.doc??$t();const n=Ji(t,e);let s=t._start;for(n!==null&&(s=n.p,e-=n.index);s!==null;s=s.right)if(!s.deleted&&s.countable){if(e<s.length)return s.content.getContent()[e];e-=s.length}},Si=(t,e,n,s)=>{let r=n;const o=t.doc,a=o.clientID,c=o.store,l=n===null?e._start:n.right;let u=[];const d=()=>{u.length>0&&(r=new it(_e(a,Ct(c,a)),r,r&&r.lastId,l,l&&l.id,e,null,new ls(u)),r.integrate(t,0),u=[])};s.forEach(h=>{if(h===null)u.push(h);else switch(h.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(h);break;default:switch(d(),h.constructor){case Uint8Array:case ArrayBuffer:r=new it(_e(a,Ct(c,a)),r,r&&r.lastId,l,l&&l.id,e,null,new zr(new Uint8Array(h))),r.integrate(t,0);break;case hs:r=new it(_e(a,Ct(c,a)),r,r&&r.lastId,l,l&&l.id,e,null,new Hr(h)),r.integrate(t,0);break;default:if(h instanceof Lt)r=new it(_e(a,Ct(c,a)),r,r&&r.lastId,l,l&&l.id,e,null,new xn(h)),r.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},Hh=()=>hn("Length exceeded!"),Vh=(t,e,n,s)=>{if(n>e._length)throw Hh();if(n===0)return e._searchMarker&&Nr(e._searchMarker,n,s.length),Si(t,e,null,s);const r=n,o=Ji(e,n);let a=e._start;for(o!==null&&(a=o.p,n-=o.index,n===0&&(a=a.prev,n+=a&&a.countable&&!a.deleted?a.length:0));a!==null;a=a.right)if(!a.deleted&&a.countable){if(n<=a.length){n<a.length&&qt(t,_e(a.id.client,a.id.clock+n));break}n-=a.length}return e._searchMarker&&Nr(e._searchMarker,r,s.length),Si(t,e,a,s)},jb=(t,e,n)=>{let r=(e._searchMarker||[]).reduce((o,a)=>a.index>o.index?a:o,{index:0,p:e._start}).p;if(r)for(;r.right;)r=r.right;return Si(t,e,r,n)},qh=(t,e,n,s)=>{if(s===0)return;const r=n,o=s,a=Ji(e,n);let c=e._start;for(a!==null&&(c=a.p,n-=a.index);c!==null&&n>0;c=c.right)!c.deleted&&c.countable&&(n<c.length&&qt(t,_e(c.id.client,c.id.clock+n)),n-=c.length);for(;s>0&&c!==null;)c.deleted||(s<c.length&&qt(t,_e(c.id.client,c.id.clock+s)),c.delete(t),s-=c.length),c=c.right;if(s>0)throw Hh();e._searchMarker&&Nr(e._searchMarker,r,-o+s)},ji=(t,e,n)=>{const s=e._map.get(n);s!==void 0&&s.delete(t)},Ec=(t,e,n,s)=>{const r=e._map.get(n)||null,o=t.doc,a=o.clientID;let c;if(s==null)c=new ls([s]);else switch(s.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new ls([s]);break;case Uint8Array:c=new zr(s);break;case hs:c=new Hr(s);break;default:if(s instanceof Lt)c=new xn(s);else throw new Error("Unexpected content type")}new it(_e(a,Ct(o.store,a)),r,r&&r.lastId,null,null,e,n,c).integrate(t,0)},wc=(t,e)=>{t.doc??$t();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},Kh=t=>{const e={};return t.doc??$t(),t._map.forEach((n,s)=>{n.deleted||(e[s]=n.content.getContent()[n.length-1])}),e},Wh=(t,e)=>{t.doc??$t();const n=t._map.get(e);return n!==void 0&&!n.deleted},Bb=(t,e)=>{const n={};return t._map.forEach((s,r)=>{let o=s;for(;o!==null&&(!e.sv.has(o.id.client)||o.id.clock>=(e.sv.get(o.id.client)||0));)o=o.left;o!==null&&As(o,e)&&(n[r]=o.content.getContent()[o.length-1])}),n},ii=t=>(t.doc??$t(),qF(t._map.entries(),e=>!e[1].deleted));class Tb extends Xi{}class Ps extends Lt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Ps;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Ps}clone(){const e=new Ps;return e.insert(0,this.toArray().map(n=>n instanceof Lt?n.clone():n)),e}get length(){return this.doc??$t(),this._length}_callObserver(e,n){super._callObserver(e,n),Zi(this,e,new Tb(this,e))}insert(e,n){this.doc!==null?rt(this.doc,s=>{Vh(s,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?rt(this.doc,n=>{jb(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?rt(this.doc,s=>{qh(s,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return zh(this,e)}toArray(){return $h(this)}slice(e=0,n=this.length){return Mh(this,e,n)}toJSON(){return this.map(e=>e instanceof Lt?e.toJSON():e)}map(e){return Uh(this,e)}forEach(e){Rr(this,e)}[Symbol.iterator](){return Sb(this)}_write(e){e.writeTypeRef(ny)}}const Lb=t=>new Ps;class Nb extends Xi{constructor(e,n,s){super(e,n),this.keysChanged=s}}class Gs extends Lt{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((s,r)=>{this.set(r,s)}),this._prelimContent=null}_copy(){return new Gs}clone(){const e=new Gs;return this.forEach((n,s)=>{e.set(s,n instanceof Lt?n.clone():n)}),e}_callObserver(e,n){Zi(this,e,new Nb(this,e,n))}toJSON(){this.doc??$t();const e={};return this._map.forEach((n,s)=>{if(!n.deleted){const r=n.content.getContent()[n.length-1];e[s]=r instanceof Lt?r.toJSON():r}}),e}get size(){return[...ii(this)].length}keys(){return Po(ii(this),e=>e[0])}values(){return Po(ii(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Po(ii(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??$t(),this._map.forEach((n,s)=>{n.deleted||e(n.content.getContent()[n.length-1],s,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?rt(this.doc,n=>{ji(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?rt(this.doc,s=>{Ec(s,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return wc(this,e)}has(e){return Wh(this,e)}clear(){this.doc!==null?rt(this.doc,e=>{this.forEach(function(n,s,r){ji(e,r,s)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(sy)}}const Rb=t=>new Gs,$n=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&T1(t,e);class Aa{constructor(e,n,s,r){this.left=e,this.right=n,this.index=s,this.currentAttributes=r}forward(){this.right===null&&Xt(),this.right.content.constructor===St?this.right.deleted||nr(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const cu=(t,e,n)=>{for(;e.right!==null&&n>0;)e.right.content.constructor===St?e.right.deleted||nr(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&qt(t,_e(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length),e.left=e.right,e.right=e.right.right;return e},oi=(t,e,n,s)=>{const r=new Map,o=s?Ji(e,n):null;if(o){const a=new Aa(o.p.left,o.p,o.index,r);return cu(t,a,n-o.index)}else{const a=new Aa(null,e._start,0,r);return cu(t,a,n)}},Gh=(t,e,n,s)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===St&&$n(s.get(n.right.content.key),n.right.content.value));)n.right.deleted||s.delete(n.right.content.key),n.forward();const r=t.doc,o=r.clientID;s.forEach((a,c)=>{const l=n.left,u=n.right,d=new it(_e(o,Ct(r.store,o)),l,l&&l.lastId,u,u&&u.id,e,null,new St(c,a));d.integrate(t,0),n.right=d,n.forward()})},nr=(t,e)=>{const{key:n,value:s}=e;s===null?t.delete(n):t.set(n,s)},Yh=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===St&&$n(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},Xh=(t,e,n,s)=>{const r=t.doc,o=r.clientID,a=new Map;for(const c in s){const l=s[c],u=n.currentAttributes.get(c)??null;if(!$n(u,l)){a.set(c,u);const{left:d,right:h}=n;n.right=new it(_e(o,Ct(r.store,o)),d,d&&d.lastId,h,h&&h.id,e,null,new St(c,l)),n.right.integrate(t,0),n.forward()}}return a},_o=(t,e,n,s,r)=>{n.currentAttributes.forEach((D,m)=>{r[m]===void 0&&(r[m]=null)});const o=t.doc,a=o.clientID;Yh(n,r);const c=Xh(t,e,n,r),l=s.constructor===String?new yn(s):s instanceof Lt?new xn(s):new fs(s);let{left:u,right:d,index:h}=n;e._searchMarker&&Nr(e._searchMarker,n.index,l.getLength()),d=new it(_e(a,Ct(o.store,a)),u,u&&u.lastId,d,d&&d.id,e,null,l),d.integrate(t,0),n.right=d,n.index=h,n.forward(),Gh(t,e,n,c)},lu=(t,e,n,s,r)=>{const o=t.doc,a=o.clientID;Yh(n,r);const c=Xh(t,e,n,r);e:for(;n.right!==null&&(s>0||c.size>0&&(n.right.deleted||n.right.content.constructor===St));){if(!n.right.deleted)switch(n.right.content.constructor){case St:{const{key:l,value:u}=n.right.content,d=r[l];if(d!==void 0){if($n(d,u))c.delete(l);else{if(s===0)break e;c.set(l,u)}n.right.delete(t)}else n.currentAttributes.set(l,u);break}default:s<n.right.length&&qt(t,_e(n.right.id.client,n.right.id.clock+s)),s-=n.right.length;break}n.forward()}if(s>0){let l="";for(;s>0;s--)l+=`
|
|
45
|
-
`;n.right=new it(_e(a,Ct(o.store,a)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new yn(l)),n.right.integrate(t,0),n.forward()}Gh(t,e,n,c)},Jh=(t,e,n,s,r)=>{let o=e;const a=Kt();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===St){const u=o.content;a.set(u.key,u)}o=o.right}let c=0,l=!1;for(;e!==o;){if(n===e&&(l=!0),!e.deleted){const u=e.content;if(u.constructor===St){const{key:d,value:h}=u,D=s.get(d)??null;(a.get(d)!==u||D===h)&&(e.delete(t),c++,!l&&(r.get(d)??null)===h&&D!==h&&(D===null?r.delete(d):r.set(d,D))),!l&&!e.deleted&&nr(r,u)}}e=e.right}return c},Ob=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===St){const s=e.content.key;n.has(s)?e.delete(t):n.add(s)}e=e.left}},Pb=t=>{let e=0;return rt(t.doc,n=>{let s=t._start,r=t._start,o=Kt();const a=Da(o);for(;r;)r.deleted===!1&&(r.content.constructor===St?nr(a,r.content):(e+=Jh(n,s,r,o,a),o=Da(a),s=r)),r=r.right}),e},_b=t=>{const e=new Set,n=t.doc;for(const[s,r]of t.afterState.entries()){const o=t.beforeState.get(s)||0;r!==o&&Rh(t,n.store.clients.get(s),o,r,a=>{!a.deleted&&a.content.constructor===St&&a.constructor!==en&&e.add(a.parent)})}rt(n,s=>{Ks(t,t.deleteSet,r=>{if(r instanceof en||!r.parent._hasFormatting||e.has(r.parent))return;const o=r.parent;r.content.constructor===St?e.add(o):Ob(s,r)});for(const r of e)Pb(r)})},uu=(t,e,n)=>{const s=n,r=Da(e.currentAttributes),o=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case xn:case fs:case yn:n<e.right.length&&qt(t,_e(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}o&&Jh(t,o,e.right,r,e.currentAttributes);const a=(e.left||e.right).parent;return a._searchMarker&&Nr(a._searchMarker,e.index,-s+n),e};class Ib extends Xi{constructor(e,n,s){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,s.forEach(r=>{r===null?this.childListChanged=!0:this.keysChanged.add(r)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];rt(e,s=>{const r=new Map,o=new Map;let a=this.target._start,c=null;const l={};let u="",d=0,h=0;const D=()=>{if(c!==null){let m=null;switch(c){case"delete":h>0&&(m={delete:h}),h=0;break;case"insert":(typeof u=="object"||u.length>0)&&(m={insert:u},r.size>0&&(m.attributes={},r.forEach((g,y)=>{g!==null&&(m.attributes[y]=g)}))),u="";break;case"retain":d>0&&(m={retain:d},B1(l)||(m.attributes=A1({},l))),d=0;break}m&&n.push(m),c=null}};for(;a!==null;){switch(a.content.constructor){case xn:case fs:this.adds(a)?this.deletes(a)||(D(),c="insert",u=a.content.getContent()[0],D()):this.deletes(a)?(c!=="delete"&&(D(),c="delete"),h+=1):a.deleted||(c!=="retain"&&(D(),c="retain"),d+=1);break;case yn:this.adds(a)?this.deletes(a)||(c!=="insert"&&(D(),c="insert"),u+=a.content.str):this.deletes(a)?(c!=="delete"&&(D(),c="delete"),h+=a.length):a.deleted||(c!=="retain"&&(D(),c="retain"),d+=a.length);break;case St:{const{key:m,value:g}=a.content;if(this.adds(a)){if(!this.deletes(a)){const y=r.get(m)??null;$n(y,g)?g!==null&&a.delete(s):(c==="retain"&&D(),$n(g,o.get(m)??null)?delete l[m]:l[m]=g)}}else if(this.deletes(a)){o.set(m,g);const y=r.get(m)??null;$n(y,g)||(c==="retain"&&D(),l[m]=y)}else if(!a.deleted){o.set(m,g);const y=l[m];y!==void 0&&($n(y,g)?y!==null&&a.delete(s):(c==="retain"&&D(),g===null?delete l[m]:l[m]=g))}a.deleted||(c==="insert"&&D(),nr(r,a.content));break}}a=a.right}for(D();n.length>0;){const m=n[n.length-1];if(m.retain!==void 0&&m.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class Ys extends Lt{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??$t(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(s=>s())}catch(s){console.error(s)}this._pending=null}_copy(){return new Ys}clone(){const e=new Ys;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const s=new Ib(this,e,n);Zi(this,e,s),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??$t();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===yn&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?rt(this.doc,s=>{const r=new Aa(null,this._start,0,new Map);for(let o=0;o<e.length;o++){const a=e[o];if(a.insert!==void 0){const c=!n&&typeof a.insert=="string"&&o===e.length-1&&r.right===null&&a.insert.slice(-1)===`
|
|
46
|
-
`?a.insert.slice(0,-1):a.insert;(typeof c!="string"||c.length>0)&&_o(s,this,r,c,a.attributes||{})}else a.retain!==void 0?lu(s,this,r,a.retain,a.attributes||{}):a.delete!==void 0&&uu(s,r,a.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,s){this.doc??$t();const r=[],o=new Map,a=this.doc;let c="",l=this._start;function u(){if(c.length>0){const h={};let D=!1;o.forEach((g,y)=>{D=!0,h[y]=g});const m={insert:c};D&&(m.attributes=h),r.push(m),c=""}}const d=()=>{for(;l!==null;){if(As(l,e)||n!==void 0&&As(l,n))switch(l.content.constructor){case yn:{const h=o.get("ychange");e!==void 0&&!As(l,e)?(h===void 0||h.user!==l.id.client||h.type!=="removed")&&(u(),o.set("ychange",s?s("removed",l.id):{type:"removed"})):n!==void 0&&!As(l,n)?(h===void 0||h.user!==l.id.client||h.type!=="added")&&(u(),o.set("ychange",s?s("added",l.id):{type:"added"})):h!==void 0&&(u(),o.delete("ychange")),c+=l.content.str;break}case xn:case fs:{u();const h={insert:l.content.getContent()[0]};if(o.size>0){const D={};h.attributes=D,o.forEach((m,g)=>{D[g]=m})}r.push(h);break}case St:As(l,e)&&(u(),nr(o,l.content));break}l=l.right}u()};return e||n?rt(a,h=>{e&&xa(h,e),n&&xa(h,n),d()},"cleanup"):d(),r}insert(e,n,s){if(n.length<=0)return;const r=this.doc;r!==null?rt(r,o=>{const a=oi(o,this,e,!s);s||(s={},a.currentAttributes.forEach((c,l)=>{s[l]=c})),_o(o,this,a,n,s)}):this._pending.push(()=>this.insert(e,n,s))}insertEmbed(e,n,s){const r=this.doc;r!==null?rt(r,o=>{const a=oi(o,this,e,!s);_o(o,this,a,n,s||{})}):this._pending.push(()=>this.insertEmbed(e,n,s||{}))}delete(e,n){if(n===0)return;const s=this.doc;s!==null?rt(s,r=>{uu(r,oi(r,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,s){if(n===0)return;const r=this.doc;r!==null?rt(r,o=>{const a=oi(o,this,e,!1);a.right!==null&&lu(o,this,a,n,s)}):this._pending.push(()=>this.format(e,n,s))}removeAttribute(e){this.doc!==null?rt(this.doc,n=>{ji(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?rt(this.doc,s=>{Ec(s,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return wc(this,e)}getAttributes(){return Kh(this)}_write(e){e.writeTypeRef(ry)}}const Mb=t=>new Ys;class Io{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??$t()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===Xs||n.constructor===cs)&&n._start!==null)e=n._start;else for(;e!==null;){const s=e.next;if(s!==null){e=s;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class cs extends Lt{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new cs}clone(){const e=new cs;return e.insert(0,this.toArray().map(n=>n instanceof Lt?n.clone():n)),e}get length(){return this.doc??$t(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Io(this,e)}querySelector(e){e=e.toUpperCase();const s=new Io(this,r=>r.nodeName&&r.nodeName.toUpperCase()===e).next();return s.done?null:s.value}querySelectorAll(e){return e=e.toUpperCase(),Nn(new Io(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Zi(this,e,new zb(this,n,e))}toString(){return Uh(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},s){const r=e.createDocumentFragment();return s!==void 0&&s._createAssociation(r,this),Rr(this,o=>{r.insertBefore(o.toDOM(e,n,s),null)}),r}insert(e,n){this.doc!==null?rt(this.doc,s=>{Vh(s,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)rt(this.doc,s=>{const r=e&&e instanceof Lt?e._item:e;Si(s,this,r,n)});else{const s=this._prelimContent,r=e===null?0:s.findIndex(o=>o===e)+1;if(r===0&&e!==null)throw hn("Reference item not found");s.splice(r,0,...n)}}delete(e,n=1){this.doc!==null?rt(this.doc,s=>{qh(s,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return $h(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return zh(this,e)}slice(e=0,n=this.length){return Mh(this,e,n)}forEach(e){Rr(this,e)}_write(e){e.writeTypeRef(oy)}}const $b=t=>new cs;class Xs extends cs{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((s,r)=>{this.setAttribute(r,s)}),this._prelimAttrs=null}_copy(){return new Xs(this.nodeName)}clone(){const e=new Xs(this.nodeName),n=this.getAttributes();return S1(n,(s,r)=>{e.setAttribute(r,s)}),e.insert(0,this.toArray().map(s=>s instanceof Lt?s.clone():s)),e}toString(){const e=this.getAttributes(),n=[],s=[];for(const c in e)s.push(c);s.sort();const r=s.length;for(let c=0;c<r;c++){const l=s[c];n.push(l+'="'+e[l]+'"')}const o=this.nodeName.toLocaleLowerCase(),a=n.length>0?" "+n.join(" "):"";return`<${o}${a}>${super.toString()}</${o}>`}removeAttribute(e){this.doc!==null?rt(this.doc,n=>{ji(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?rt(this.doc,s=>{Ec(s,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return wc(this,e)}hasAttribute(e){return Wh(this,e)}getAttributes(e){return e?Bb(this,e):Kh(this)}toDOM(e=document,n={},s){const r=e.createElement(this.nodeName),o=this.getAttributes();for(const a in o){const c=o[a];typeof c=="string"&&r.setAttribute(a,c)}return Rr(this,a=>{r.appendChild(a.toDOM(e,n,s))}),s!==void 0&&s._createAssociation(r,this),r}_write(e){e.writeTypeRef(iy),e.writeKey(this.nodeName)}}const Ub=t=>new Xs(t.readKey());class zb extends Xi{constructor(e,n,s){super(e,s),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(r=>{r===null?this.childListChanged=!0:this.attributesChanged.add(r)})}}class Bi extends Gs{constructor(e){super(),this.hookName=e}_copy(){return new Bi(this.hookName)}clone(){const e=new Bi(this.hookName);return this.forEach((n,s)=>{e.set(s,n)}),e}toDOM(e=document,n={},s){const r=n[this.hookName];let o;return r!==void 0?o=r.createDom(this):o=document.createElement(this.hookName),o.setAttribute("data-yjs-hook",this.hookName),s!==void 0&&s._createAssociation(o,this),o}_write(e){e.writeTypeRef(ay),e.writeKey(this.hookName)}}const Hb=t=>new Bi(t.readKey());class Ti extends Ys{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Ti}clone(){const e=new Ti;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,s){const r=e.createTextNode(this.toString());return s!==void 0&&s._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{const n=[];for(const r in e.attributes){const o=[];for(const a in e.attributes[r])o.push({key:a,value:e.attributes[r][a]});o.sort((a,c)=>a.key<c.key?-1:1),n.push({nodeName:r,attrs:o})}n.sort((r,o)=>r.nodeName<o.nodeName?-1:1);let s="";for(let r=0;r<n.length;r++){const o=n[r];s+=`<${o.nodeName}`;for(let a=0;a<o.attrs.length;a++){const c=o.attrs[a];s+=` ${c.key}="${c.value}"`}s+=">"}s+=e.insert;for(let r=n.length-1;r>=0;r--)s+=`</${n[r].nodeName}>`;return s}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(cy)}}const Vb=t=>new Ti;class xc{constructor(e,n){this.id=e,this.length=n}get deleted(){throw un()}mergeWith(e){return!1}write(e,n,s){throw un()}integrate(e,n){throw un()}}const qb=0;class en extends xc{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),Nh(e.doc.store,this)}write(e,n){e.writeInfo(qb),e.writeLen(this.length-n)}getMissing(e,n){return null}}class zr{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new zr(this.content)}splice(e){throw un()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const Kb=t=>new zr(t.readBuf());class Or{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Or(this.len)}splice(e){const n=new Or(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Lr(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const Wb=t=>new Or(t.readLen()),Zh=(t,e)=>new hs({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Hr{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Hr(Zh(this.doc.guid,this.opts))}splice(e){throw un()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const Gb=t=>new Hr(Zh(t.readString(),t.readAny()));class fs{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new fs(this.embed)}splice(e){throw un()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const Yb=t=>new fs(t.readJSON());class St{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new St(this.key,this.value)}splice(e){throw un()}mergeWith(e){return!1}integrate(e,n){const s=n.parent;s._searchMarker=null,s._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const Xb=t=>new St(t.readKey(),t.readJSON());class Li{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Li(this.arr)}splice(e){const n=new Li(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const s=this.arr.length;e.writeLen(s-n);for(let r=n;r<s;r++){const o=this.arr[r];e.writeString(o===void 0?"undefined":JSON.stringify(o))}}getRef(){return 2}}const Jb=t=>{const e=t.readLen(),n=[];for(let s=0;s<e;s++){const r=t.readString();r==="undefined"?n.push(void 0):n.push(JSON.parse(r))}return new Li(n)},Zb=wi("node_env")==="development";class ls{constructor(e){this.arr=e,Zb&&qd(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ls(this.arr)}splice(e){const n=new ls(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const s=this.arr.length;e.writeLen(s-n);for(let r=n;r<s;r++){const o=this.arr[r];e.writeAny(o)}}getRef(){return 8}}const Qb=t=>{const e=t.readLen(),n=[];for(let s=0;s<e;s++)n.push(t.readAny());return new ls(n)};class yn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new yn(this.str)}splice(e){const n=new yn(this.str.slice(e));this.str=this.str.slice(0,e);const s=this.str.charCodeAt(e-1);return s>=55296&&s<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const ey=t=>new yn(t.readString()),ty=[Lb,Rb,Mb,Ub,$b,Hb,Vb],ny=0,sy=1,ry=2,iy=3,oy=4,ay=5,cy=6;class xn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new xn(this.type._copy())}splice(e){throw un()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(s=>{s.deleted?s.id.clock<(e.beforeState.get(s.id.client)||0)&&e._mergeStructs.push(s):s.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(s=>{for(;s!==null;)s.gc(e,!0),s=s.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const ly=t=>new xn(ty[t.readTypeRef()](t)),ka=(t,e)=>{let n=e,s=0,r;do s>0&&(n=_e(n.client,n.clock+s)),r=Os(t,n),s=n.clock-r.id.clock,n=r.redone;while(n!==null&&r instanceof it);return{item:r,diff:s}},vc=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Ni=(t,e,n)=>{const{client:s,clock:r}=e.id,o=new it(_e(s,r+n),e,_e(s,r+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&o.markDeleted(),e.keep&&(o.keep=!0),e.redone!==null&&(o.redone=_e(e.redone.client,e.redone.clock+n)),e.right=o,o.right!==null&&(o.right.left=o),t._mergeStructs.push(o),o.parentSub!==null&&o.right===null&&o.parent._map.set(o.parentSub,o),e.length=n,o},du=(t,e)=>Ja(t,n=>$r(n.deletions,e)),Qh=(t,e,n,s,r,o)=>{const a=t.doc,c=a.store,l=a.clientID,u=e.redone;if(u!==null)return qt(t,u);let d=e.parent._item,h=null,D;if(d!==null&&d.deleted===!0){if(d.redone===null&&(!n.has(d)||Qh(t,d,n,s,r,o)===null))return null;for(;d.redone!==null;)d=qt(t,d.redone)}const m=d===null?e.parent:d.content.type;if(e.parentSub===null){for(h=e.left,D=e;h!==null;){let w=h;for(;w!==null&&w.parent._item!==d;)w=w.redone===null?null:qt(t,w.redone);if(w!==null&&w.parent._item===d){h=w;break}h=h.left}for(;D!==null;){let w=D;for(;w!==null&&w.parent._item!==d;)w=w.redone===null?null:qt(t,w.redone);if(w!==null&&w.parent._item===d){D=w;break}D=D.right}}else{if(D=null,e.right&&!r){for(h=e;h!==null&&h.right!==null&&(h.right.redone||$r(s,h.right.id)||du(o.undoStack,h.right.id)||du(o.redoStack,h.right.id));)for(h=h.right;h.redone;)h=qt(t,h.redone);if(h&&h.right!==null)return null}else h=m._map.get(e.parentSub)||null;h!==null&&h.parent._item!==d&&(h=m._map.get(e.parentSub)||null)}const g=Ct(c,l),y=_e(l,g),b=new it(y,h,h&&h.lastId,D,D&&D.id,m,e.parentSub,e.content.copy());return e.redone=y,vc(b,!0),b.integrate(t,0),b};class it extends xc{constructor(e,n,s,r,o,a,c,l){super(e,l.getLength()),this.origin=s,this.left=n,this.right=r,this.rightOrigin=o,this.parent=a,this.parentSub=c,this.redone=null,this.content=l,this.info=this.content.isCountable()?Ul:0}set marker(e){(this.info&To)>0!==e&&(this.info^=To)}get marker(){return(this.info&To)>0}get keep(){return(this.info&$l)>0}set keep(e){this.keep!==e&&(this.info^=$l)}get countable(){return(this.info&Ul)>0}get deleted(){return(this.info&Bo)>0}set deleted(e){this.deleted!==e&&(this.info^=Bo)}markDeleted(){this.info|=Bo}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ct(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ct(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Rs&&this.id.client!==this.parent.client&&this.parent.clock>=Ct(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=nu(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=qt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===en||this.right&&this.right.constructor===en)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===it?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===it&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Rs){const s=Os(n,this.parent);s.constructor===en?this.parent=null:this.parent=s.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=nu(e,e.doc.store,_e(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let s=this.left,r;if(s!==null)r=s.right;else if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start;const o=new Set,a=new Set;for(;r!==null&&r!==this.right;){if(a.add(r),o.add(r),js(this.origin,r.origin)){if(r.id.client<this.id.client)s=r,o.clear();else if(js(this.rightOrigin,r.rightOrigin))break}else if(r.origin!==null&&a.has(Os(e.doc.store,r.origin)))o.has(Os(e.doc.store,r.origin))||(s=r,o.clear());else break;r=r.right}this.left=s}if(this.left!==null){const s=this.left.right;this.right=s,this.left.right=this}else{let s;if(this.parentSub!==null)for(s=this.parent._map.get(this.parentSub)||null;s!==null&&s.left!==null;)s=s.left;else s=this.parent._start,this.parent._start=this;this.right=s}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Nh(e.doc.store,this),this.content.integrate(e,this),ru(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new en(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:_e(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&js(e.origin,this.lastId)&&this.right===e&&js(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(s=>{s.p===e&&(s.p=this,!this.deleted&&this.countable&&(s.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Lr(e.deleteSet,this.id.client,this.id.clock,this.length),ru(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Xt();this.content.gc(e),n?hb(e,this,new en(this.id,this.length)):this.content=new Or(this.length)}write(e,n){const s=n>0?_e(this.id.client,this.id.clock+n-1):this.origin,r=this.rightOrigin,o=this.parentSub,a=this.content.getRef()&$i|(s===null?0:Yt)|(r===null?0:Tn)|(o===null?0:Ar);if(e.writeInfo(a),s!==null&&e.writeLeftID(s),r!==null&&e.writeRightID(r),s===null&&r===null){const c=this.parent;if(c._item!==void 0){const l=c._item;if(l===null){const u=Bh(c);e.writeParentInfo(!0),e.writeString(u)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===Rs?(e.writeParentInfo(!1),e.writeLeftID(c)):Xt();o!==null&&e.writeString(o)}this.content.write(e,n)}}const ef=(t,e)=>uy[e&$i](t),uy=[()=>{Xt()},Wb,Jb,Kb,ey,Yb,Xb,ly,Qb,Gb,()=>{Xt()}],dy=10;class tn extends xc{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Xt()}write(e,n){e.writeInfo(dy),me(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const tf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},nf="__ $YJS$ __";tf[nf]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");tf[nf]=!0;const sf=new Map;class hy{constructor(e){this.room=e,this.onmessage=null,this._onChange=n=>n.key===e&&this.onmessage!==null&&this.onmessage({data:K1(n.newValue||"")}),w1(this._onChange)}postMessage(e){Hd.setItem(this.room,q1($1(e)))}close(){x1(this._onChange)}}const fy=typeof BroadcastChannel>"u"?hy:BroadcastChannel,Ac=t=>En(sf,t,()=>{const e=qn(),n=new fy(t);return n.onmessage=s=>e.forEach(r=>r(s.data,"broadcastchannel")),{bc:n,subs:e}}),py=(t,e)=>(Ac(t).subs.add(e),e),my=(t,e)=>{const n=Ac(t),s=n.subs.delete(e);return s&&n.subs.size===0&&(n.bc.close(),sf.delete(t)),s},ks=(t,e,n=null)=>{const s=Ac(t);s.bc.postMessage(e),s.subs.forEach(r=>r(e,n))},rf=0,kc=1,of=2,Ri=(t,e)=>{me(t,rf);const n=ob(e);gt(t,n)},af=(t,e,n)=>{me(t,kc),gt(t,gc(e,n))},Dy=(t,e,n)=>af(e,n,Mt(t)),cf=(t,e,n,s)=>{try{Ah(e,Mt(t),n)}catch(r){s?.(r),console.error("Caught error while handling a Yjs update",r)}},gy=(t,e)=>{me(t,of),gt(t,e)},Fy=cf,by=(t,e,n,s,r)=>{const o=Se(t);switch(o){case rf:Dy(t,e,n);break;case kc:cf(t,n,s,r);break;case of:Fy(t,n,s,r);break;default:throw new Error("Unknown message type")}return o},yy=0,Cy=(t,e,n)=>{Se(t)===yy&&n(e,lt(t))},Mo=3e4;class Ey extends Pd{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=Kn();this.getLocalState()!==null&&Mo/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const s=[];this.meta.forEach((r,o)=>{o!==this.clientID&&Mo<=n-r.lastUpdated&&this.states.has(o)&&s.push(o)}),s.length>0&&Sc(this,s,"timeout")},dn(Mo/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,s=this.meta.get(n),r=s===void 0?0:s.clock+1,o=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:r,lastUpdated:Kn()});const a=[],c=[],l=[],u=[];e===null?u.push(n):o==null?e!=null&&a.push(n):(c.push(n),Ls(o,e)||l.push(n)),(a.length>0||l.length>0||u.length>0)&&this.emit("change",[{added:a,updated:l,removed:u},"local"]),this.emit("update",[{added:a,updated:c,removed:u},"local"])}setLocalStateField(e,n){const s=this.getLocalState();s!==null&&this.setLocalState({...s,[e]:n})}getStates(){return this.states}}const Sc=(t,e,n)=>{const s=[];for(let r=0;r<e.length;r++){const o=e[r];if(t.states.has(o)){if(t.states.delete(o),o===t.clientID){const a=t.meta.get(o);t.meta.set(o,{clock:a.clock+1,lastUpdated:Kn()})}s.push(o)}}s.length>0&&(t.emit("change",[{added:[],updated:[],removed:s},n]),t.emit("update",[{added:[],updated:[],removed:s},n]))},_s=(t,e,n=t.states)=>{const s=e.length,r=Ft();me(r,s);for(let o=0;o<s;o++){const a=e[o],c=n.get(a)||null,l=t.meta.get(a).clock;me(r,a),me(r,l),_t(r,JSON.stringify(c))}return nt(r)},wy=(t,e,n)=>{const s=Yn(e),r=Kn(),o=[],a=[],c=[],l=[],u=Se(s);for(let d=0;d<u;d++){const h=Se(s);let D=Se(s);const m=JSON.parse(lt(s)),g=t.meta.get(h),y=t.states.get(h),b=g===void 0?0:g.clock;(b<D||b===D&&m===null&&t.states.has(h))&&(m===null?h===t.clientID&&t.getLocalState()!=null?D++:t.states.delete(h):t.states.set(h,m),t.meta.set(h,{clock:D,lastUpdated:r}),g===void 0&&m!==null?o.push(h):g!==void 0&&m===null?l.push(h):m!==null&&(Ls(m,y)||c.push(h),a.push(h)))}(o.length>0||c.length>0||l.length>0)&&t.emit("change",[{added:o,updated:c,removed:l},n]),(o.length>0||a.length>0||l.length>0)&&t.emit("update",[{added:o,updated:a,removed:l},n])},xy=t=>j1(t,(e,n)=>`${encodeURIComponent(n)}=${encodeURIComponent(e)}`).join("&"),ss=0,lf=3,Is=1,vy=2,Vr=[];Vr[ss]=(t,e,n,s,r)=>{me(t,ss);const o=by(e,t,n.doc,n);s&&o===kc&&!n.synced&&(n.synced=!0)};Vr[lf]=(t,e,n,s,r)=>{me(t,Is),gt(t,_s(n.awareness,Array.from(n.awareness.getStates().keys())))};Vr[Is]=(t,e,n,s,r)=>{wy(n.awareness,Mt(e),n)};Vr[vy]=(t,e,n,s,r)=>{Cy(e,n.doc,(o,a)=>Ay(n,a))};const hu=3e4,Ay=(t,e)=>console.warn(`Permission denied to access ${t.url}.
|
|
47
|
-
${e}`),uf=(t,e,n)=>{const s=Yn(e),r=Ft(),o=Se(s),a=t.messageHandlers[o];return a?a(r,s,t,n,o):console.error("Unable to compute message"),r},Sa=(t,e,n)=>{e===t.ws&&(t.emit("connection-close",[n,t]),t.ws=null,e.close(),t.wsconnecting=!1,t.wsconnected?(t.wsconnected=!1,t.synced=!1,Sc(t.awareness,Array.from(t.awareness.getStates().keys()).filter(s=>s!==t.doc.clientID),t),t.emit("status",[{status:"disconnected"}])):t.wsUnsuccessfulReconnects++,setTimeout(df,Qa(qg(2,t.wsUnsuccessfulReconnects)*100,t.maxBackoffTime),t))},df=t=>{if(t.shouldConnect&&t.ws===null){const e=new t._WS(t.url,t.protocols);e.binaryType="arraybuffer",t.ws=e,t.wsconnecting=!0,t.wsconnected=!1,t.synced=!1,e.onmessage=n=>{t.wsLastMessageReceived=Kn();const s=uf(t,new Uint8Array(n.data),!0);ec(s)>1&&e.send(nt(s))},e.onerror=n=>{t.emit("connection-error",[n,t])},e.onclose=n=>{Sa(t,e,n)},e.onopen=()=>{t.wsLastMessageReceived=Kn(),t.wsconnecting=!1,t.wsconnected=!0,t.wsUnsuccessfulReconnects=0,t.emit("status",[{status:"connected"}]);const n=Ft();if(me(n,ss),Ri(n,t.doc),e.send(nt(n)),t.awareness.getLocalState()!==null){const s=Ft();me(s,Is),gt(s,_s(t.awareness,[t.doc.clientID])),e.send(nt(s))}},t.emit("status",[{status:"connecting"}])}},$o=(t,e)=>{const n=t.ws;t.wsconnected&&n&&n.readyState===n.OPEN&&n.send(e),t.bcconnected&&ks(t.bcChannel,e,t)};class ky extends Za{constructor(e,n,s,{connect:r=!0,awareness:o=new Ey(s),params:a={},protocols:c=[],WebSocketPolyfill:l=WebSocket,resyncInterval:u=-1,maxBackoffTime:d=2500,disableBc:h=!1}={}){for(super();e[e.length-1]==="/";)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+"/"+n,this.maxBackoffTime=d,this.params=a,this.protocols=c,this.roomname=n,this.doc=s,this._WS=l,this.awareness=o,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=h,this.wsUnsuccessfulReconnects=0,this.messageHandlers=Vr.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=r,this._resyncInterval=0,u>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const D=Ft();me(D,ss),Ri(D,s),this.ws.send(nt(D))}},u)),this._bcSubscriber=(D,m)=>{if(m!==this){const g=uf(this,new Uint8Array(D),!1);ec(g)>1&&ks(this.bcChannel,nt(g),this)}},this._updateHandler=(D,m)=>{if(m!==this){const g=Ft();me(g,ss),gy(g,D),$o(this,nt(g))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:D,updated:m,removed:g},y)=>{const b=D.concat(m).concat(g),w=Ft();me(w,Is),gt(w,_s(o,b)),$o(this,nt(w))},this._exitHandler=()=>{Sc(this.awareness,[s.clientID],"app closed")},Wn&&typeof process<"u"&&process.on("exit",this._exitHandler),o.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&hu<Kn()-this.wsLastMessageReceived&&Sa(this,this.ws,null)},hu/10),r&&this.connect()}get url(){const e=xy(this.params);return this.serverUrl+"/"+this.roomname+(e.length===0?"":"?"+e)}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]))}destroy(){this._resyncInterval!==0&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),Wn&&typeof process<"u"&&process.off("exit",this._exitHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||(py(this.bcChannel,this._bcSubscriber),this.bcconnected=!0);const e=Ft();me(e,ss),Ri(e,this.doc),ks(this.bcChannel,nt(e),this);const n=Ft();me(n,ss),af(n,this.doc),ks(this.bcChannel,nt(n),this);const s=Ft();me(s,lf),ks(this.bcChannel,nt(s),this);const r=Ft();me(r,Is),gt(r,_s(this.awareness,[this.doc.clientID])),ks(this.bcChannel,nt(r),this)}disconnectBc(){const e=Ft();me(e,Is),gt(e,_s(this.awareness,[this.doc.clientID],new Map)),$o(this,nt(e)),this.bcconnected&&(my(this.bcChannel,this._bcSubscriber),this.bcconnected=!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&Sa(this,this.ws,null)}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(df(this),this.connectBc())}}const ps=t=>Vs((e,n)=>{t.onerror=s=>n(new Error(s.target.error)),t.onsuccess=s=>e(s.target.result)}),Sy=(t,e)=>Vs((n,s)=>{const r=indexedDB.open(t);r.onupgradeneeded=o=>e(o.target.result),r.onerror=o=>s(hn(o.target.error)),r.onsuccess=o=>{const a=o.target.result;a.onversionchange=()=>{a.close()},n(a)}}),jy=t=>ps(indexedDB.deleteDatabase(t)),By=(t,e)=>e.forEach(n=>t.createObjectStore.apply(t,n)),mr=(t,e,n="readwrite")=>{const s=t.transaction(e,n);return e.map(r=>Iy(s,r))},hf=(t,e)=>ps(t.count(e)),Ty=(t,e)=>ps(t.get(e)),ff=(t,e)=>ps(t.delete(e)),Ly=(t,e,n)=>ps(t.put(e,n)),ja=(t,e)=>ps(t.add(e)),Ny=(t,e,n)=>ps(t.getAll(e,n)),Ry=(t,e,n)=>{let s=null;return _y(t,e,r=>(s=r,!1),n).then(()=>s)},Oy=(t,e=null)=>Ry(t,e,"prev"),Py=(t,e)=>Vs((n,s)=>{t.onerror=s,t.onsuccess=async r=>{const o=r.target.result;if(o===null||await e(o)===!1)return n();o.continue()}}),_y=(t,e,n,s="next")=>Py(t.openKeyCursor(e,s),r=>n(r.key)),Iy=(t,e)=>t.objectStore(e),My=(t,e)=>IDBKeyRange.upperBound(t,e),$y=(t,e)=>IDBKeyRange.lowerBound(t,e),Uo="custom",pf="updates",mf=500,Df=(t,e=()=>{},n=()=>{})=>{const[s]=mr(t.db,[pf]);return Ny(s,$y(t._dbref,!1)).then(r=>{t._destroyed||(e(s),rt(t.doc,()=>{r.forEach(o=>Ah(t.doc,o))},t,!1),n(s))}).then(()=>Oy(s).then(r=>{t._dbref=r+1})).then(()=>hf(s).then(r=>{t._dbsize=r})).then(()=>s)},Uy=(t,e=!0)=>Df(t).then(n=>{(e||t._dbsize>=mf)&&ja(n,gc(t.doc)).then(()=>ff(n,My(t._dbref,!0))).then(()=>hf(n).then(s=>{t._dbsize=s}))});class zy extends Pd{constructor(e,n){super(),this.doc=n,this.name=e,this._dbref=0,this._dbsize=0,this._destroyed=!1,this.db=null,this.synced=!1,this._db=Sy(e,s=>By(s,[["updates",{autoIncrement:!0}],["custom"]])),this.whenSynced=Vs(s=>this.on("synced",()=>s(this))),this._db.then(s=>{this.db=s,Df(this,a=>ja(a,gc(n)),()=>{if(this._destroyed)return this;this.synced=!0,this.emit("synced",[this])})}),this._storeTimeout=1e3,this._storeTimeoutId=null,this._storeUpdate=(s,r)=>{if(this.db&&r!==this){const[o]=mr(this.db,[pf]);ja(o,s),++this._dbsize>=mf&&(this._storeTimeoutId!==null&&clearTimeout(this._storeTimeoutId),this._storeTimeoutId=setTimeout(()=>{Uy(this,!1),this._storeTimeoutId=null},this._storeTimeout))}},n.on("update",this._storeUpdate),this.destroy=this.destroy.bind(this),n.on("destroy",this.destroy)}destroy(){return this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this.doc.off("update",this._storeUpdate),this.doc.off("destroy",this.destroy),this._destroyed=!0,this._db.then(e=>{e.close()})}clearData(){return this.destroy().then(()=>{jy(this.name)})}get(e){return this._db.then(n=>{const[s]=mr(n,[Uo],"readonly");return Ty(s,e)})}set(e,n){return this._db.then(s=>{const[r]=mr(s,[Uo]);return Ly(r,n,e)})}del(e){return this._db.then(n=>{const[s]=mr(n,[Uo]);return ff(s,e)})}}const fu=[["#1677c8","#1677c833"],["#d65745","#d6574533"],["#16866a","#16866a33"],["#9a58b5","#9a58b533"],["#d27b18","#d27b1833"],["#3f7d20","#3f7d2033"],["#be3e7b","#be3e7b33"],["#4964c6","#4964c633"],["#8a6a14","#8a6a1433"],["#087f8c","#087f8c33"]],pu=4,mu=5,Hy=6,Vy=7,qy=8,zo=9,Ho=3,Ky=6e4,Wy=720*60*60*1e3,Gy=15e3,Yy=5*6e4;function Xy(t){if(!t||typeof t!="object")return null;const e=t,n=e.requestedBy;return typeof e.mainFile!="string"||typeof e.runId!="string"||!["queued","running","succeeded","failed","cleaned"].includes(e.status??"")||e.status==="cleaned"&&e.cleanMode!=="cache"&&e.cleanMode!=="artifacts"||e.stale!==void 0&&typeof e.stale!="boolean"||typeof e.updatedAt!="string"||!n||typeof n.id!="string"||typeof n.username!="string"||typeof n.name!="string"?null:e}function Du(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e={};for(const[n,s]of Object.entries(t)){const r=Xy(s);r&&r.mainFile===n&&(e[n]=r)}return e}function Jy(t,e,n){return t<=n&&e<=n}function gu(t,e,n){const s=r=>r>0&&n-r<=Yy;return{recoverable:t.some(r=>r.tabId===e||!s(r.activeAt)),otherActive:t.some(r=>r.tabId!==e&&s(r.activeAt))}}class Zy{constructor(e,n){this.projectId=e,this.user=n;const s=window.location.protocol==="https:"?"wss:":"ws:";this.draftTabId=n2(`texlite:collaboration-tab:${n.id}:${e}`);const r=this.readOwnWritableDraftMarker();this.draftGeneration=r?.generation??0,this.draftUpdatedAt=r?.updatedAt??0,this.draftMarkerPresent=r!==null,this.markDraftTabInactive=()=>this.setOwnDraftActivity(!1),this.markDraftTabActive=()=>this.resumeOwnDraftActivity(),window.addEventListener("pagehide",this.markDraftTabInactive),window.addEventListener("pageshow",this.markDraftTabActive),r&&(this.setOwnDraftActivity(!0),this.startDraftHeartbeat()),this.persistence=new zy(`texlite:${n.id}:${e}`,this.doc),this.localDraftTransactionObserver=a=>{if(a.local){for(const[c,l]of this.doc.share)if(c.startsWith("source:")&&(a.changed.has(l)||a.changedParentTypes.has(l))){this.markWritableDraft();return}}},this.doc.on("afterTransaction",this.localDraftTransactionObserver),this.persistence.on("synced",()=>{this.localDraftReady=!0;for(const a of this.draftListeners)a()}),this.provider=new ky(`${s}//${window.location.host}/api/collaboration`,e,this.doc,{connect:!1,disableBc:!0,maxBackoffTime:2500}),this.awareness=this.provider.awareness;const o=this.doc.getMap("texlite:meta");this.metaObserver=(a,c)=>{c.origin===this.provider&&a.keysChanged.has("compileStates")&&(this.authoritativeCompileStates=null,this.notifyCompileStateListeners())},o.observe(this.metaObserver),this.provider.messageHandlers[pu]=(a,c)=>{const l=lt(c),u=this.flushRequests.get(l);if(!u)return;const d=Se(c)===1,h=Se(c),D=lt(c),m=Se(c),g=[];for(let y=0;y<m;y++)g.push(lt(c));if(window.clearTimeout(u.timer),this.flushRequests.delete(l),d)this.clearOwnWritableDraftMarker(u.draftGeneration),u.resolve({revision:h,persistedAt:D,ok:!0,failedPaths:[]});else{const y=Object.assign(new Error(g.length?`保存失败:${g.join(", ")}`:"源码保存到服务器磁盘失败"),{failedPaths:g});u.reject(y)}},this.provider.messageHandlers[mu]=(a,c)=>{const l=lt(c),u=this.epochStorageKey(),d=Fu(u),h=/^([0-9]+):/.exec(l)?.[1]??null,D=d?/^([0-9]+):/.exec(d)?.[1]??null:null,m=!this.epoch&&h===String(Ho)&&D!==null&&D!==h;if((this.epoch&&this.epoch!==l||d&&d!==l)&&!m){this.provider.disconnect(),this.rejectFlushes(new Error("Collaboration state changed"));const x=l.endsWith(":reload")||h!==null&&h!==String(Ho),j=()=>{Vo(u,l.replace(/:reload$/,"")),window.location.reload()};if(x)for(const N of this.protocolUpgradeListeners)N();else this.persistence.clearData().then(()=>{this.clearWritableDraftMarkers(),j()});return}this.epoch=l,Vo(u,l);const g=this.provider.ws;if(!g||g.readyState!==WebSocket.OPEN)return;const y=Ft();me(y,mu),_t(y,l),me(y,Ho),g.send(nt(y));const b=Ft();me(b,0),Ri(b,this.doc),g.send(nt(b));const w=Ft();me(w,1),gt(w,_s(this.awareness,[this.doc.clientID])),g.send(nt(w))},this.provider.messageHandlers[Vy]=(a,c)=>{const l=lt(c),u=lt(c);if(l!==this.user.id)return;if(u==="revoked"){this.rejectFlushes(new Error("Project access revoked")),this.provider.disconnect();for(const h of this.permissionListeners)h("revoked",this.permission);return}if(u!=="read"&&u!=="edit"&&u!=="owner")return;const d=this.permission;if(this.setPermission(u),d!==u){u==="read"&&this.rejectFlushes(new Error("Project permission changed to read-only"));for(const h of this.permissionListeners)h(u,d)}},this.provider.messageHandlers[Hy]=(a,c)=>{lt(c)},this.provider.messageHandlers[qy]=(a,c)=>{let l={};try{l=Du(JSON.parse(lt(c)))}catch{}this.authoritativeCompileStates=l,this.notifyCompileStateListeners()},this.provider.messageHandlers[zo]=(a,c)=>{const l=lt(c),u=lt(c),d=lt(c),h=lt(c),D=lt(c),m=lt(c);if(l==="state"){const y=ya(c)?lt(c):"",b=ya(c)?lt(c):"",w=Number(D);if(!y||!Number.isFinite(w)||w<=Date.now())this.removeFormatLeaseState(d),this.notifyFormatLeaseListeners(null);else{const x={path:d,holderUserId:y,holderName:b,expiresAt:w};this.formatLeaseStatesByPath.set(d,x);const j=this.formatLeaseExpiryTimers.get(d);j!==void 0&&window.clearTimeout(j);const N=window.setTimeout(()=>{const $=this.formatLeaseStatesByPath.get(d);!$||$.expiresAt>Date.now()||(this.removeFormatLeaseState(d),this.notifyFormatLeaseListeners(null))},Math.max(0,w-Date.now())+25);this.formatLeaseExpiryTimers.set(d,N),this.notifyFormatLeaseListeners(x)}return}const g=this.formatLeaseRequests.get(u);g&&(window.clearTimeout(g.timer),this.formatLeaseRequests.delete(u),l==="denied"?g.reject(new Error(m||"Format lease request was denied")):g.resolve({status:l,filePath:d,token:h,expiresAt:Number(D)}))},this.provider.on("status",({status:a})=>{a==="disconnected"&&(this.authoritativeCompileStates=null,this.notifyCompileStateListeners(),this.rejectFlushes(new Error("Collaboration connection closed")),this.rejectFormatLeaseRequests(new Error("Collaboration connection closed")),this.clearFormatLeaseStates())}),this.updateLocalAwareness()}projectId;user;doc=new hs;provider;awareness;persistence;permission="read";activeFile="";epoch=null;destroyed=!1;localDraftReady=!1;draftListeners=new Set;permissionListeners=new Set;protocolUpgradeListeners=new Set;compileStateListeners=new Set;flushRequests=new Map;formatLeaseRequests=new Map;formatLeaseListeners=new Set;formatLeaseStatesByPath=new Map;formatLeaseExpiryTimers=new Map;draftTabId;draftGeneration=0;draftUpdatedAt=0;draftMarkerPresent=!1;draftHeartbeatTimer=null;markDraftTabInactive;markDraftTabActive;undoManagers=new Map;authoritativeCompileStates=null;metaObserver;localDraftTransactionObserver;connect(){this.destroyed||(this.provider.connect(),this.updateLocalAwareness())}getText(e){return this.doc.getText(`source:${e}`)}getUndoManager(e){const n=this.undoManagers.get(e);if(n)return n;const s=new gb(this.getText(e));return this.undoManagers.set(e,s),s}applyTextEdits(e,n){if(this.permission==="read")throw new Error("Read-only collaborators cannot edit source files");const s=this.getText(e);let r=0;for(const o of n){if(!Number.isInteger(o.from)||!Number.isInteger(o.to)||o.from<r||o.to<o.from||o.to>s.length)throw new RangeError("Invalid collaborative text edits");r=o.to}this.doc.transact(()=>{for(let o=n.length-1;o>=0;o-=1){const a=n[o];a.to>a.from&&s.delete(a.from,a.to-a.from),a.replacement&&s.insert(a.from,a.replacement)}})}get meta(){return this.doc.getMap("texlite:meta")}compileStates(){return this.authoritativeCompileStates??Du(this.meta.get("compileStates"))}onCompileStates(e){return this.compileStateListeners.add(e),()=>this.compileStateListeners.delete(e)}get synced(){return this.provider.synced}get connected(){return this.provider.wsconnected}get draftReady(){return this.localDraftReady}get currentPermission(){return this.permission}onDraftReady(e){return this.draftListeners.add(e),this.localDraftReady&&e(),()=>this.draftListeners.delete(e)}onPermissionChanged(e){return this.permissionListeners.add(e),()=>this.permissionListeners.delete(e)}onProtocolUpgrade(e){return this.protocolUpgradeListeners.add(e),()=>this.protocolUpgradeListeners.delete(e)}async discardLocalDraft(){return this.hasOtherWritableDraft?!1:(await this.persistence.clearData(),this.localDraftReady=!1,this.clearWritableDraftMarkers(),!0)}get hasWritableDraft(){const e=this.readWritableDraftMarkers();return gu(e.map(({tabId:n,marker:s})=>({tabId:n,activeAt:s.activeAt})),this.draftTabId,Date.now()).recoverable}get hasOtherWritableDraft(){const e=this.readWritableDraftMarkers();return gu(e.map(({tabId:n,marker:s})=>({tabId:n,activeAt:s.activeAt})),this.draftTabId,Date.now()).otherActive}setPermission(e,n=!1){const s=this.permission;if(this.permission=e,e==="read"&&(s!=="read"&&this.rejectFlushes(new Error("Project permission changed to read-only")),this.destroyUndoManagers(),this.clearFormatLeaseStates()),this.updateLocalAwareness(),n&&s!==e)for(const r of this.permissionListeners)r(e,s)}setActiveFile(e){this.activeFile!==e&&(this.activeFile=e,this.awareness.setLocalStateField("cursor",null),this.updateLocalAwareness())}sessions(){const e=[];return this.awareness.getStates().forEach((n,s)=>{const r=n?.user;!r||typeof r.id!="string"||typeof r.name!="string"||e.push({clientId:s,userId:r.id,username:typeof r.username=="string"?r.username:r.name,name:r.name,color:typeof r.color=="string"?r.color:"#1677c8",colorLight:typeof r.colorLight=="string"?r.colorLight:"#1677c833",permission:r.permission==="owner"||r.permission==="edit"?r.permission:"read",filePath:typeof n.filePath=="string"?n.filePath:"",editing:!!n.cursor,local:s===this.doc.clientID})}),e.sort((n,s)=>Number(s.local)-Number(n.local)||n.name.localeCompare(s.name))}flush(){const e=this.provider.ws;if(!this.provider.synced||!e||e.readyState!==WebSocket.OPEN)return Promise.reject(new Error("Collaboration connection is unavailable"));const n=crypto.randomUUID(),s=this.draftGeneration,r=Ft();return me(r,pu),_t(r,n),new Promise((o,a)=>{const c=window.setTimeout(()=>{this.flushRequests.delete(n),a(new Error("Collaboration save timed out"))},5e3);this.flushRequests.set(n,{resolve:o,reject:a,timer:c,draftGeneration:s}),e.send(nt(r))})}onFormatLeaseState(e){this.formatLeaseListeners.add(e);for(const n of this.formatLeaseStatesByPath.values())e(n);return()=>this.formatLeaseListeners.delete(e)}formatLeaseStates(){const e=Date.now();for(const[n,s]of this.formatLeaseStatesByPath)s.expiresAt<=e&&this.removeFormatLeaseState(n);return[...this.formatLeaseStatesByPath.values()]}async acquireFormatLease(e){if(this.permission==="read")throw new Error("Formatting requires write permission");const n=await this.requestFormatLease("acquire",e);if(n.status!=="grant"||!n.token||!Number.isFinite(n.expiresAt))throw new Error("Format lease was not granted");let s=n.token,r=n.expiresAt,o=!1;const a=async()=>{if(o)throw new Error("Format lease has already been released");const l=await this.requestFormatLease("renew",e,s);if(l.status!=="renewed"||!Number.isFinite(l.expiresAt))throw new Error("Format lease renewal failed");s=l.token||s,r=l.expiresAt};return{path:e,get token(){return s},get expiresAt(){return r},confirm:a,renew:a,release:async()=>{if(o)return;o=!0;const l=this.provider.ws;if(!(!l||l.readyState!==WebSocket.OPEN))try{await this.requestFormatLease("release",e,s)}catch{}}}}reconnect(){this.destroyed||(this.rejectFlushes(new Error("Collaboration connection reset")),this.provider.disconnect(),this.provider.connect(),this.updateLocalAwareness())}destroy(){this.destroyed=!0,this.setOwnDraftActivity(!1),this.stopDraftHeartbeat(),window.removeEventListener("pagehide",this.markDraftTabInactive),window.removeEventListener("pageshow",this.markDraftTabActive),this.rejectFlushes(new Error("Collaboration connection closed")),this.provider.destroy(),this.persistence.destroy(),this.draftListeners.clear(),this.protocolUpgradeListeners.clear(),this.compileStateListeners.clear(),this.rejectFormatLeaseRequests(new Error("Collaboration connection closed")),this.clearFormatLeaseStates(),this.formatLeaseListeners.clear(),this.meta.unobserve(this.metaObserver),this.doc.off("afterTransaction",this.localDraftTransactionObserver),this.destroyUndoManagers(),this.doc.destroy()}destroyUndoManagers(){for(const e of this.undoManagers.values())e.destroy();this.undoManagers.clear()}notifyCompileStateListeners(){for(const e of this.compileStateListeners)e()}rejectFlushes(e){for(const n of this.flushRequests.values())window.clearTimeout(n.timer),n.reject(e);this.flushRequests.clear()}requestFormatLease(e,n,s=""){const r=this.provider.ws;if(!this.provider.synced||!r||r.readyState!==WebSocket.OPEN)return Promise.reject(new Error("Collaboration connection is unavailable"));const o=crypto.randomUUID(),a=Ft();return me(a,zo),_t(a,e),_t(a,o),_t(a,n),_t(a,s),new Promise((c,l)=>{const u=window.setTimeout(()=>{if(this.formatLeaseRequests.delete(o),e==="acquire"){const d=this.provider.ws;if(d?.readyState===WebSocket.OPEN){const h=Ft();me(h,zo),_t(h,"cancel"),_t(h,o),_t(h,n),_t(h,""),d.send(nt(h))}}l(new Error("Format lease request timed out"))},e==="acquire"?Ky:5e3);this.formatLeaseRequests.set(o,{resolve:c,reject:l,timer:u}),r.send(nt(a))})}rejectFormatLeaseRequests(e){for(const n of this.formatLeaseRequests.values())window.clearTimeout(n.timer),n.reject(e);this.formatLeaseRequests.clear()}clearFormatLeaseStates(){for(const e of this.formatLeaseExpiryTimers.values())window.clearTimeout(e);this.formatLeaseExpiryTimers.clear(),this.formatLeaseStatesByPath.size&&(this.formatLeaseStatesByPath.clear(),this.notifyFormatLeaseListeners(null))}removeFormatLeaseState(e){const n=this.formatLeaseExpiryTimers.get(e);n!==void 0&&window.clearTimeout(n),this.formatLeaseExpiryTimers.delete(e),this.formatLeaseStatesByPath.delete(e)}notifyFormatLeaseListeners(e){for(const n of this.formatLeaseListeners)n(e)}updateLocalAwareness(){const[e,n]=fu[Math.abs(this.doc.clientID)%fu.length];this.awareness.setLocalStateField("user",{id:this.user.id,username:this.user.username,name:this.user.displayName,color:e,colorLight:n,permission:this.permission,sessionId:String(this.doc.clientID)}),this.awareness.setLocalStateField("filePath",this.activeFile)}epochStorageKey(){return`texlite:collaboration-epoch:${this.user.id}:${this.projectId}`}writableDraftStoragePrefix(){return`texlite:collaboration-writable:${this.user.id}:${this.projectId}:`}ownWritableDraftStorageKey(){return`${this.writableDraftStoragePrefix()}${this.draftTabId}`}markWritableDraft(){this.draftGeneration+=1,this.draftUpdatedAt=Date.now(),this.draftMarkerPresent||this.writeOwnWritableDraftMarker(!0),this.startDraftHeartbeat()}clearWritableDraftMarkers(){for(const{key:e}of this.readWritableDraftMarkers())dr(e);this.draftMarkerPresent=!1,this.stopDraftHeartbeat(),dr(this.writableDraftStoragePrefix().slice(0,-1))}clearOwnWritableDraftMarker(e){const n=this.readOwnWritableDraftMarker();!n||!Jy(n.generation,this.draftGeneration,e)||(dr(this.ownWritableDraftStorageKey()),this.draftMarkerPresent=!1,this.stopDraftHeartbeat())}readOwnWritableDraftMarker(){return this.readWritableDraftMarker(this.ownWritableDraftStorageKey())}readWritableDraftMarkers(){const e=this.writableDraftStoragePrefix(),n=[];for(const s of Qy()){if(!s.startsWith(e))continue;const r=this.readWritableDraftMarker(s);r&&n.push({key:s,tabId:s.slice(e.length),marker:r})}return n}readWritableDraftMarker(e){const n=Fu(e);if(!n)return null;try{const s=JSON.parse(n);if(!s||typeof s!="object"||Array.isArray(s))return null;const r=s,o=Date.now();if(!Number.isInteger(r.generation)||(r.generation??0)<0||typeof r.updatedAt!="number"||!Number.isFinite(r.updatedAt)||r.updatedAt<=0||o-r.updatedAt>Wy)return dr(e),null;const a=typeof r.activeAt=="number"&&Number.isFinite(r.activeAt)?Math.max(0,r.activeAt):0;return{generation:r.generation,updatedAt:r.updatedAt,activeAt:a}}catch{return dr(e),null}}writeOwnWritableDraftMarker(e){if(!this.draftMarkerPresent&&this.draftUpdatedAt<=0)return;const n={generation:this.draftGeneration,updatedAt:this.draftUpdatedAt||Date.now(),activeAt:e?Date.now():0};Vo(this.ownWritableDraftStorageKey(),JSON.stringify(n)),this.draftMarkerPresent=!0}setOwnDraftActivity(e){this.draftMarkerPresent&&(this.writeOwnWritableDraftMarker(e),e?this.startDraftHeartbeat():this.stopDraftHeartbeat())}resumeOwnDraftActivity(){const e=this.readOwnWritableDraftMarker();if(!e){this.draftMarkerPresent=!1,this.stopDraftHeartbeat();return}this.draftGeneration=Math.max(this.draftGeneration,e.generation),this.draftUpdatedAt=e.updatedAt,this.draftMarkerPresent=!0,this.setOwnDraftActivity(!0)}startDraftHeartbeat(){this.draftHeartbeatTimer!==null||!this.draftMarkerPresent||(this.draftHeartbeatTimer=window.setInterval(()=>{this.writeOwnWritableDraftMarker(!0)},Gy))}stopDraftHeartbeat(){this.draftHeartbeatTimer!==null&&(window.clearInterval(this.draftHeartbeatTimer),this.draftHeartbeatTimer=null)}}function Fu(t){try{return window.localStorage.getItem(t)}catch{return null}}function Vo(t,e){try{window.localStorage.setItem(t,e)}catch{}}function dr(t){try{window.localStorage.removeItem(t)}catch{}}function Qy(){try{const t=[];for(let e=0;e<window.localStorage.length;e+=1){const n=window.localStorage.key(e);n&&t.push(n)}return t}catch{return[]}}function e2(t){try{return window.sessionStorage.getItem(t)}catch{return null}}function t2(t,e){try{window.sessionStorage.setItem(t,e)}catch{}}function n2(t){const e=e2(t);if(e)return e;const n=typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`;return t2(t,n),n}function s2(t,e){return Array.from(t.trim()||e.trim()||"?")[0]?.toLocaleUpperCase()??"?"}function r2(t){if(!t||typeof t!="object")return!1;const e=t;return(e.kind==="update"||e.kind==="move"||e.kind==="delete")&&typeof e.revision=="string"}function i2(t,e,n,s,r,o){const[a]=f.useState(()=>new Zy(t,e)),[c,l]=f.useState("connecting"),[u,d]=f.useState(!1),[h,D]=f.useState([]),[m,g]=f.useState(null),[y,b]=f.useState(null),[w,x]=f.useState(""),[j,N]=f.useState(""),[$,V]=f.useState([]),[U,G]=f.useState(!1),[Y,W]=f.useState(s),[ue,P]=f.useState(null),[K,B]=f.useState(!1),S=f.useRef(n),R=f.useRef(o),he=f.useRef(r);S.current=n,R.current=o,he.current=r,f.useEffect(()=>{const T=a.compileStates();g(T[n]??null)},[n,a]),f.useEffect(()=>{const T=()=>D(a.sessions()),ge=()=>{d(!1),D([]),g(null),b(null),x(""),N(""),V([]),R.current()},I=({status:ye})=>{l(ye),ye!=="connected"&&ge()},X=ye=>{d(ye),ye||ge()},ce=()=>{l("disconnected"),ge()},Ce=()=>{const ye=a.meta.get("filesEvent");r2(ye)&&b(ye);const We=a.meta.get("commentsRevision");typeof We=="string"&&x(We);const Je=a.meta.get("dictionaryRevision");typeof Je=="string"&&N(Je);const pt=a.compileStates();g(pt[S.current]??null)},se=()=>{const ye=a.compileStates();g(ye[S.current]??null)};a.awareness.on("change",T),a.provider.on("status",I),a.provider.on("sync",X),a.provider.on("connection-close",ce),a.provider.on("connection-error",ce),a.meta.observe(Ce);const A=a.onCompileStates(se),fe=a.onProtocolUpgrade(()=>{B(!0),l("disconnected"),ge()}),ve=()=>V(a.formatLeaseStates()),qe=a.onFormatLeaseState(ve),yt=()=>{if(!he.current||a.currentPermission!=="read")return;const ye=a.hasWritableDraft,We=a.hasOtherWritableDraft;!ye&&!We||P({previous:"edit",localDraftReady:ye,otherTabDraft:We})},Qe=a.onDraftReady(()=>{G(!0),yt()}),Xe=a.onPermissionChanged((ye,We)=>{if(ye==="revoked"){l("disconnected"),d(!1),R.current();return}W(ye),ye==="read"&&We!=="read"?P({previous:We,localDraftReady:a.hasWritableDraft,otherTabDraft:a.hasOtherWritableDraft}):ye!=="read"&&P(null)});return T(),Ce(),l(a.connected?"connected":"connecting"),d(a.synced),()=>{a.awareness.off("change",T),a.provider.off("status",I),a.provider.off("sync",X),a.provider.off("connection-close",ce),a.provider.off("connection-error",ce),a.meta.unobserve(Ce),A(),fe(),qe(),Qe(),Xe(),a.destroy()}},[a]),f.useEffect(()=>{r&&a.connect()},[a,r]),f.useEffect(()=>{a.setPermission(s),W(s),r&&s==="read"&&(a.hasWritableDraft||a.hasOtherWritableDraft)?P({previous:"edit",localDraftReady:a.hasWritableDraft,otherTabDraft:a.hasOtherWritableDraft}):s!=="read"&&P(null)},[a,s,r]);const be=ue!==null;return f.useEffect(()=>{if(!be)return;const T=()=>{if(a.currentPermission!=="read")return;const I=a.hasWritableDraft,X=a.hasOtherWritableDraft;P(ce=>!ce||ce.localDraftReady===I&&ce.otherTabDraft===X?ce:{...ce,localDraftReady:I,otherTabDraft:X})};T();const ge=window.setInterval(T,2e3);return()=>window.clearInterval(ge)},[a,be]),{collaboration:a,status:c,synced:u,activeSessions:h,compileState:m,setCompileState:g,formatLeaseStates:$,filesEvent:y,commentsRevision:w,dictionaryRevision:j,localDraftReady:U,permission:Y,protocolUpgradeRequired:K,reconnect:()=>{K||(l("connecting"),d(!1),D([]),g(null),V([]),a.reconnect())},permissionDowngrade:ue,dismissPermissionDowngrade:()=>P(null),discardLocalDraft:async()=>await a.discardLocalDraft()?(P(null),window.location.reload(),!0):(P(ge=>ge&&{...ge,otherTabDraft:!0}),!1)}}function bu(t){return t?.status==="succeeded"?"succeeded":t?.log.includes("Compilation was cancelled.")?"cancelled":t?.status==="failed"?"failed":null}function es(t){return t instanceof Error&&t.name==="AbortError"}function o2(t){return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement}function a2({projectId:t,project:e,mainFile:n,initialLatest:s,collaborationSynced:r,sharedState:o,onSharedState:a,save:c,loadOutline:l,onPreviewTab:u,onError:d,onCompileStart:h,onCompileSuccess:D,onPdfChanged:m}){const{t:g}=ot(),[y,b]=f.useState(""),[w,x]=f.useState(!0),[j,N]=f.useState(null),[$,V]=f.useState("full"),[U,G]=f.useState(""),[Y,W]=f.useState(null),[ue,P]=f.useState(null),[K,B]=f.useState([]),[S,R]=f.useState(null),[he,be]=f.useState(!1),[Fe,Ne]=f.useState(!1),[Z,T]=f.useState(()=>new Set),[ge,I]=f.useState(()=>new Set),[X,ce]=f.useState(""),Ce=f.useRef(n),se=f.useRef(""),A=f.useRef(null),fe=f.useRef(null),ve=f.useRef(null),qe=f.useRef(s),yt=f.useRef(!1),Qe=f.useRef(null),Xe=f.useRef(null),ye=f.useRef(new Set),We=f.useRef(new Map),Je=f.useRef(null),pt=f.useRef(()=>{}),De=f.useRef({onSharedState:a,save:c,loadOutline:l,onPreviewTab:u,onError:d,onCompileStart:h,onCompileSuccess:D,onPdfChanged:m});Ce.current=n,De.current={onSharedState:a,save:c,loadOutline:l,onPreviewTab:u,onError:d,onCompileStart:h,onCompileSuccess:D,onPdfChanged:m};const Et=z=>{Je.current!==z&&(Je.current=z,De.current.onCompileSuccess())},le=async(z,pe)=>{pe||(Qe.current?.abort(),Qe.current=new AbortController,pe=Qe.current.signal);try{const q=z?`?mainFile=${encodeURIComponent(z)}`:"",Ve=await ne(`/api/projects/${t}/compile/artifacts${q}`,{signal:pe});Ce.current===z&&(B(Ve.artifacts),R(null))}catch(q){!es(q)&&Ce.current===z&&(B([]),R(null))}finally{Qe.current?.signal===pe&&(Qe.current=null)}};f.useEffect(()=>{if(A.current?.abort(),!n){x(!1),b(""),N(null),V("full"),G(""),W(null),P(null),B([]),R(null),ve.current=null,De.current.onPdfChanged();return}ve.current?.mainFile!==n&&(ve.current=null);const z=new AbortController;A.current=z,x(!0),G(""),W(null),P(null),y&&n&&se.current===n||(b(""),N(null),V("full")),B([]),R(null),De.current.onPdfChanged();let q=null;const Ve=`?mainFile=${encodeURIComponent(n)}`,Ge=yt.current?null:qe.current;Ge&&(yt.current=!0);const st=()=>ne(`/api/projects/${t}/compile/latest${Ve}`,{signal:z.signal}),Ee=Ge?Ge.then(_=>_.mainFile!==n?st():_,()=>st()):st();let dt=!1;const Q=()=>{if(dt||z.signal.aborted||!n)return;dt=!0;const _=new AbortController;ye.current.add(_),le(n,_.signal).finally(()=>{ye.current.delete(_)}),De.current.loadOutline(z.signal,n).catch(()=>{})};return Ee.then(_=>{if(z.signal.aborted||n&&_.mainFile!==Ce.current)return;const Ye=ve.current;Ye&&Ye.mainFile===n&&_.latestRun?.id!==Ye.runId||(G(_.latestRun?.log??""),W(_.latestRun?.diagnostics??null),P(bu(_.latestRun)),n&&_.latestRun?.requestedBy&&(_.latestRun.status==="queued"||_.latestRun.status==="running")&&De.current.onSharedState({mainFile:n,runId:_.latestRun.id,status:_.latestRun.status,requestedBy:_.latestRun.requestedBy,updatedAt:new Date().toISOString()}),_.pdfUrl&&(se.current=_.mainFile,b(_.pdfUrl),N(_.pdfCompiledAt),V(_.pdfLoadingMode??"full"),De.current.onPreviewTab("pdf")))}).catch(_=>{!es(_)&&Ce.current===n&&De.current.onError(de(_))}).finally(()=>{A.current===z&&(A.current=null),z.signal.aborted||(x(!1),q=window.setTimeout(Q,0))}),()=>{q!==null&&window.clearTimeout(q),z.abort(),Xe.current?.abort();for(const _ of ye.current)_.abort();ye.current.clear()}},[t,n]),f.useEffect(()=>{if(!(!o||o.mainFile!==n||o.status!=="cleaned"||!o.cleanMode)){A.current?.abort(),fe.current?.abort(),Qe.current?.abort(),Xe.current?.abort();for(const z of ye.current)z.abort();ye.current.clear(),o.cleanMode==="artifacts"?(ve.current=null,G(""),W(null),P(null),b(""),N(null),V("full"),B([]),R(null),De.current.onPdfChanged(),De.current.onPreviewTab("pdf"),ce(g("editor.cleanArtifactsComplete"))):ce(g("editor.cleanCacheComplete"))}},[o?.runId,o?.status,o?.cleanMode,o?.mainFile,n,g]),f.useEffect(()=>{!n||o?.mainFile===n&&(o.status==="queued"||o.status==="running")||I(z=>{if(!z.has(n))return z;const pe=new Set(z);return pe.delete(n),pe})},[n,o?.mainFile,o?.status]),f.useEffect(()=>{if(!o||o.mainFile!==n||o.status!=="succeeded"&&o.status!=="failed")return;let z=!1;fe.current?.abort(),Xe.current?.abort();const pe=new AbortController;return fe.current=pe,x(!0),ne(`/api/projects/${t}/compile/latest?mainFile=${encodeURIComponent(n)}`,{signal:pe.signal}).then(q=>{z||q.mainFile!==Ce.current||q.latestRun?.id!==o.runId||(G(q.latestRun.log),W(q.latestRun.diagnostics),P(bu(q.latestRun)),o.status==="succeeded"&&o.stale&&ce(g("editor.compileSnapshotStale")),o.status==="succeeded"&&q.pdfUrl?(ve.current={mainFile:n,runId:o.runId},De.current.onPdfChanged(),b(q.pdfUrl),N(q.pdfCompiledAt),V(q.pdfLoadingMode??"full"),De.current.onPreviewTab("pdf"),Et(o.runId),le(n)):o.status==="failed"&&De.current.onPreviewTab(q.latestRun.diagnostics.errors.length?"errors":"log"))}).catch(q=>{!es(q)&&!z&&De.current.onError(de(q))}).finally(()=>{fe.current===pe&&(fe.current=null),z||x(!1)}),()=>{z=!0,pe.abort(),fe.current===pe&&(fe.current=null)}},[o?.runId,o?.status,o?.mainFile,o?.stale,n,t,g]);const ke=async()=>{if(!e||!n||e.permission==="read"||!r||We.current.has(n)||o?.mainFile===n&&(o.status==="queued"||o.status==="running"))return;const z=n;T(q=>new Set([...q,z])),De.current.onCompileStart(),ce(""),Xe.current?.abort(),Xe.current=null,G(""),W(null),P(null),De.current.onPreviewTab(y?"pdf":"log");const pe=new AbortController;We.current.set(z,pe);try{if(!await De.current.save())return;const q=await ne(`/api/projects/${t}/compile`,{method:"POST",signal:pe.signal,body:JSON.stringify({mainFile:z})});if(q.mainFile!==Ce.current)return;G(q.log),W(q.diagnostics),P(q.cancelled?"cancelled":q.ok?"succeeded":"failed"),q.cancelled&&ce(g("compileControls.cancelled")),q.skipped&&ce(g("editor.upToDate")),q.ok&&q.stale&&ce(g("editor.compileSnapshotStale")),q.pdfUrl?(q.ok&&(ve.current={mainFile:z,runId:q.runId}),De.current.onPdfChanged(),b(q.pdfUrl),N(q.pdfCompiledAt),V(q.pdfLoadingMode??"full"),De.current.onPreviewTab("pdf"),q.ok&&(q.skipped?De.current.onCompileSuccess():Et(q.runId))):De.current.onPreviewTab(q.diagnostics.errors.length?"errors":"log")}catch(q){!es(q)&&Ce.current===z&&De.current.onError(de(q))}finally{We.current.get(z)===pe&&(We.current.delete(z),T(q=>{const Ve=new Set(q);return Ve.delete(z),Ve}),I(q=>{if(!q.has(z))return q;const Ve=new Set(q);return Ve.delete(z),Ve}))}},Oe=async()=>{if(!e||!n||e.permission==="read"||!r)return;const z=n;I(pe=>new Set([...pe,z]));try{(await ne(`/api/projects/${t}/compile/cancel`,{method:"POST",body:JSON.stringify({mainFile:z})})).cancelled||I(q=>{const Ve=new Set(q);return Ve.delete(z),Ve})}catch(pe){I(q=>{const Ve=new Set(q);return Ve.delete(z),Ve}),!es(pe)&&Ce.current===z&&De.current.onError(de(pe))}},mt=async z=>{if(!e||!n||e.permission==="read"||!r||Fe||We.current.has(n)||o?.mainFile===n&&(o.status==="queued"||o.status==="running"))return;const pe=n;Ne(!0),A.current?.abort(),fe.current?.abort(),Qe.current?.abort(),Xe.current?.abort();try{if((await ne(`/api/projects/${t}/compile/clean`,{method:"POST",body:JSON.stringify({mainFile:pe,mode:z})})).mainFile!==Ce.current)return;De.current.onSharedState(null),z==="artifacts"&&(ve.current=null,G(""),W(null),P(null),b(""),N(null),V("full"),B([]),R(null),De.current.onPdfChanged()),ce(g(z==="cache"?"editor.cleanCacheComplete":"editor.cleanArtifactsComplete"))}catch(q){!es(q)&&Ce.current===pe&&De.current.onError(de(q))}finally{Ne(!1)}};pt.current=()=>{ke()},f.useEffect(()=>{if(!X)return;const z=window.setTimeout(()=>ce(""),3e3);return()=>window.clearTimeout(z)},[X]),f.useEffect(()=>{const z=pe=>{if(!(!(pe.ctrlKey||pe.metaKey)||pe.key.toLocaleLowerCase()!=="s")){if(o2(pe.target)){pe.preventDefault();return}pe.preventDefault(),pe.stopPropagation(),pe.repeat||pt.current()}};return window.addEventListener("keydown",z,!0),()=>window.removeEventListener("keydown",z,!0)},[]),f.useEffect(()=>()=>{A.current?.abort(),fe.current?.abort(),Qe.current?.abort(),Xe.current?.abort();for(const z of ye.current)z.abort();ye.current.clear();for(const z of We.current.values())z.abort();We.current.clear()},[]);const Ue=async z=>{if(!z.viewable)return;Xe.current?.abort();const pe=new AbortController;Xe.current=pe,be(!0);try{const q=await ne(`/api/projects/${t}/compile/artifacts?mainFile=${encodeURIComponent(n)}&path=${encodeURIComponent(z.path)}`,{signal:pe.signal});!pe.signal.aborted&&Xe.current===pe&&Ce.current===n&&R(q)}catch(q){es(q)||De.current.onError(de(q))}finally{Xe.current===pe&&(Xe.current=null,be(!1))}};return{pdfUrl:y,pdfCompiledAt:j,pdfLoadingMode:$,pdfLoading:w,compileLog:U,compileDiagnostics:Y,compileOutcome:ue,artifacts:K,artifactPreview:S,artifactLoading:he,editorNotice:X,localCompiling:Z.has(n),cancelling:ge.has(n),cleaning:Fe,compile:ke,cancelCompile:Oe,cleanCompile:mt,viewArtifact:Ue}}const Ba=10*1024*1024,c2=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".avif",".pdf",".zip",".gz",".bz2",".xz",".tar",".rar",".7z",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".odt",".ods",".odp",".mp3",".mp4",".wav",".ogg",".webm",".mov",".avi",".wasm",".exe",".bin",".so",".dll",".class",".jar"]);function yu(t){return t instanceof Error&&t.name==="AbortError"}function Dr(t){const e=t.split("/").filter(Boolean);return e.pop(),e.map((n,s)=>e.slice(0,s+1).join("/"))}function ts(t,e){return!!(t&&e)&&(e===t||e.startsWith(`${t}/`))}function l2(t){const e=`.${t.split(".").at(-1)?.toLocaleLowerCase()??""}`;return!c2.has(e)}function Ms(t){return/(?:\.(?:tex|bib|sty|cls|txt|md)|latexmkrc)$/i.test(t)}function Cu(t){const e=t.split(".").at(-1)?.toLocaleLowerCase()??"";return e==="pdf"?"pdf":["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"].includes(e)?"image":l2(t)?"text":"unsupported"}function u2(t,e){return`/api/projects/${t}/file/raw?path=${encodeURIComponent(e)}`}function d2({projectId:t,site:e,activeFile:n,dirty:s,save:r,onError:o,onProject:a,onActiveFile:c,onActiveMainFile:l,onRootDocuments:u}){const{t:d}=ot(),[h,D]=f.useState([]),[m,g]=f.useState(!1),[y,b]=f.useState(""),[w,x]=f.useState(null),[j,N]=f.useState(!1),[$,V]=f.useState(!1),[U,G]=f.useState(""),[Y,W]=f.useState(""),[ue,P]=f.useState(""),[K,B]=f.useState(new Set),[S,R]=f.useState(null),[he,be]=f.useState(""),[Fe,Ne]=f.useState(""),[Z,T]=f.useState(null),[ge,I]=f.useState(!1),[X,ce]=f.useState(null),[Ce,se]=f.useState(!1),A=f.useRef(null),fe=f.useRef(null),ve=async(le={})=>{A.current?.abort(),A.current=null;const ke=le.signal?null:new AbortController;ke&&(A.current=ke);try{const Oe=await ne(`/api/projects/${t}/files`,{signal:le.signal??ke?.signal});return(!le.isCurrent||le.isCurrent())&&D(Oe.files),Oe.files}catch(Oe){if(!yu(Oe))throw Oe;return}finally{ke&&A.current===ke&&(A.current=null)}},qe=async()=>{if(!(!y.trim()||y.trim().endsWith("/"))){W("");try{await ne(`/api/projects/${t}/file`,{method:"POST",body:JSON.stringify({path:y,content:""})}),await ve(),c(y),B(le=>new Set([...le,...Dr(y)])),g(!1),b("")}catch(le){W(de(le))}}},yt=async()=>{if(!U.trim())return;W("");const le=ue?`${ue}/${U.trim()}`:U.trim();try{const ke=await ne(`/api/projects/${t}/folders`,{method:"POST",body:JSON.stringify({path:le})});await ve(),B(Oe=>new Set([...Oe,...Dr(ke.path),ke.path])),P(ke.path),V(!1),G("")}catch(ke){W(de(ke))}},Qe=async(le,ke=new Set,Oe=ue)=>{if(!le.length)return;const mt=e.maxUploadSizeMB;if(le.find(Ee=>Ee.size>mt*1024*1024))return o(d("errors.fileTooLarge",{size:mt}));const z=Oe,pe=le.map(Ee=>z?`${z}/${Ee.name}`:Ee.name),q=new Map;for(const Ee of pe)q.set(Ee,(q.get(Ee)??0)+1);const Ve=[...q.entries()].filter(([,Ee])=>Ee>1).map(([Ee])=>Ee);if(Ve.length)return o(d("errors.duplicateUploadNames",{files:Ve.join(", ")}));const Ge=new Set(h.map(Ee=>Ee.path)),st=[...new Set(pe.filter(Ee=>Ge.has(Ee)&&!ke.has(Ee)))];if(st.length){ce({files:le,directory:z,collisions:st});return}ce(null),se(!0);try{const Ee=new URLSearchParams;z&&Ee.set("directory",z);let dt="";for(const[Q,_]of le.entries()){const Ye=pe[Q];Ee.delete("overwrite"),ke.has(Ye)&&Ee.set("overwrite","1");const wt=Ee.toString()?`?${Ee.toString()}`:"",At=new FormData;At.append("file",_);try{const ht=await ne(`/api/projects/${t}/upload${wt}`,{method:"POST",body:At});typeof ht.path=="string"&&Ms(ht.path)&&(dt=ht.path)}catch(ht){if(ht instanceof Un&&ht.status===409&&!ke.has(Ye)&&ht.code==="FILE_EXISTS"){Q>0&&await ve(),ce({files:le.slice(Q),directory:z,collisions:[Ye]});return}throw ht}}await ve(),dt&&c(dt)}catch(Ee){o(de(Ee))}finally{se(!1)}},Xe=async le=>{await Qe(Array.from(le.target.files??[])),le.target.value=""},ye=async le=>{fe.current?.abort(),fe.current=null,N(!1);const ke=u2(t,le.path);if((le.size??0)>Ba){x({path:le.path,kind:"large",size:le.size??0,url:ke});return}const Oe=Cu(le.path);if(Oe!=="text"){x({path:le.path,kind:Oe,size:le.size??0,url:ke});return}x({path:le.path,kind:Oe,size:le.size??0,url:ke,content:""}),N(!0);const mt=new AbortController;fe.current=mt;try{let Ue;try{Ue=await fetch(ke,{signal:mt.signal})}catch(q){throw Ru(q)}const z=Ue.headers.get("content-type")??"";if(!Ue.ok){let q=null;try{q=z.includes("application/json")?await Ue.json():await Ue.text()}catch{}throw new Un(Ou(q,Ue.status),Ue.status,La(q))}const pe=await Ue.text();x(q=>q?.path===le.path?{...q,content:pe}:q)}catch(Ue){yu(Ue)||(x(null),o(de(Ue)))}finally{fe.current===mt&&(fe.current=null,N(!1))}},We=le=>{const ke=Cu(le.path),Oe=e.maxCollaborativeFileSizeMB*1024*1024;(le.size??0)>Ba||Ms(le.path)&&(le.size??0)>Oe||ke!=="text"||!Ms(le.path)?ye(le):c(le.path)},Je=async()=>{if(!S)return;const le=he.trim();if(le){W("");try{if(!await r())return;const ke=await ne(`/api/projects/${t}/path`,{method:"PATCH",body:JSON.stringify({source:S.path,destinationDirectory:Fe,destinationName:le})}),Oe=z=>z===S.path?ke.path:z.startsWith(`${S.path}/`)?`${ke.path}${z.slice(S.path.length)}`:z;c(z=>Oe(z)),l(z=>Oe(z)),u(z=>new Set([...z].map(Oe))),P(z=>z&&Oe(z));const[mt,Ue]=await Promise.all([ne(`/api/projects/${t}/files`),ne(`/api/projects/${t}`)]);D(mt.files),a(Ue.project),B(z=>new Set([...z,...Dr(ke.path),Fe].filter(Boolean))),R(null),be(""),Ne("")}catch(ke){W(de(ke))}}},pt=async()=>{if(Z){W("");try{if(s&&!await r())return;await ne(`/api/projects/${t}/file?path=${encodeURIComponent(Z.path)}`,{method:"DELETE"}),T(null)}catch(le){W(de(le))}}};f.useEffect(()=>()=>{A.current?.abort(),fe.current?.abort()},[]),f.useEffect(()=>{fe.current?.abort(),fe.current=null,N(!1)},[n]);const De=h.filter(le=>le.type==="directory"),Et=h.filter(le=>Dr(le.path).every(ke=>K.has(ke)));return{files:h,setFiles:D,loadFiles:ve,newFileOpen:m,setNewFileOpen:g,newFilePath:y,setNewFilePath:b,resourcePreview:w,setResourcePreview:x,resourcePreviewLoading:j,setResourcePreviewLoading:N,newFolderOpen:$,setNewFolderOpen:V,newFolderName:U,setNewFolderName:G,fileDialogError:Y,setFileDialogError:W,selectedFolder:ue,setSelectedFolder:P,expandedFolders:K,setExpandedFolders:B,moveEntry:S,setMoveEntry:R,moveName:he,setMoveName:be,moveDestination:Fe,setMoveDestination:Ne,deleteEntry:Z,setDeleteEntry:T,fileDragActive:ge,setFileDragActive:I,uploadConflict:X,setUploadConflict:ce,uploadingFiles:Ce,directoryEntries:De,visibleEntries:Et,createFile:qe,createFolder:yt,uploadFiles:Qe,upload:Xe,openFile:We,movePath:Je,removePath:pt}}function h2({active:t,projectId:e,activeFile:n,content:s,dictionaryWords:r}){const[o,a]=f.useState([]),[c,l]=f.useState(""),[u,d]=f.useState(""),[h,D]=f.useState(0),[m,g]=f.useState(null),[y,b]=f.useState(null),[w,x]=f.useState(!1),[j,N]=f.useState(0),$=f.useRef(0),V=f.useRef(!1),U=f.useRef(!1),G=f.useRef(s),Y=f.useRef(n),W=f.useRef(0);G.current=s,Y.current=n,U.current=w,f.useEffect(()=>{a([]),l(""),d(""),g(null),b(null),x(!1)},[n,r]),f.useEffect(()=>{b(null),x(!1)},[e]),f.useEffect(()=>{D(B=>o.length?Math.min(B,o.length-1):0)},[o]),f.useEffect(()=>{const B=++$.current;if(!t||!n){a([]),l(""),d(""),g(null);return}if(y){a([]),l(""),d("");return}const S=s,R=n;let he=!1;const be=window.setTimeout(()=>{b(null),(async()=>{try{const{lintLatex:Fe,isHarperLintSupersededError:Ne}=await Gn(async()=>{const{lintLatex:T,isHarperLintSupersededError:ge}=await import("./spellCheck-Wn7_eF9j.js");return{lintLatex:T,isHarperLintSupersededError:ge}},__vite__mapDeps([5,1]));if(he||B!==$.current||G.current!==S||Y.current!==R)return;let Z;try{Z=await Fe(e,R,S,r)}catch(T){if(Ne(T))return;throw T}if(he||B!==$.current||G.current!==S||Y.current!==R)return;V.current=!1,x(!1),a(Z),l(S),d(R),D(0),g(null)}catch(Fe){if(he||B!==$.current||G.current!==S||Y.current!==R)return;a([]),l(""),d(""),b(Fe instanceof Error?Fe.message:String(Fe));const Ne=V.current;V.current=!1,x(Ne?U.current:!1)}})()},700);return()=>{he=!0,window.clearTimeout(be)}},[t,e,n,s,r,j,y]),f.useEffect(()=>{if(!y||!t)return;let B=!1;const S=()=>{B||(B=!0,V.current=!0,b(null),N(he=>he+1))},R=window.setTimeout(S,15e3);return window.addEventListener("online",S,{once:!0}),()=>{window.clearTimeout(R),window.removeEventListener("online",S)}},[y,t]);const ue=u===n&&c===s,P=f.useMemo(()=>ue?{total:o.length,unique:new Set(o.map(B=>`${B.kind}:${B.word.toLocaleLowerCase("en-US")}`)).size}:null,[ue,o]);return{issues:ue?o:[],jump:ue?m:null,index:h,summary:P,jumpToIssue:B=>{if(!o.length)return;const S=Math.max(0,Math.min(B,o.length-1)),R=o[S];D(S),g({from:R.from,to:R.to,nonce:++W.current})},error:w?null:y,nativeFallback:t&&!!y,retry:()=>{V.current=!1,b(null),x(!1),N(B=>B+1)},dismissError:()=>{V.current=!1,x(!0)}}}function Eu(t){return t instanceof Error&&t.name==="AbortError"}function f2({projectId:t,mainFile:e,activeFile:n,onActiveFile:s,onError:r,onShowPdf:o}){const[a,c]=f.useState(null),[l,u]=f.useState(null),[d,h]=f.useState(null),D=f.useRef(null),m=f.useRef(0),g=f.useRef(n),y=f.useRef(s),b=f.useRef(r),w=f.useRef(o),x=U=>U===e&&/\.tex$/i.test(U);g.current=n,y.current=s,b.current=r,w.current=o,f.useEffect(()=>(D.current?.abort(),D.current=null,c(null),u(null),h(null),()=>D.current?.abort()),[t,e]);const j=(U,G,Y)=>{h({path:U,line:G,column:Y,nonce:++m.current}),g.current!==U&&y.current(U)},N=async(U,G,Y,W={})=>{if(!x(U))return;D.current?.abort();const ue=new AbortController;D.current=ue;try{const P=await ne(`/api/projects/${t}/sync/pdf?mainFile=${encodeURIComponent(e)}&path=${encodeURIComponent(U)}&line=${G}&column=${Y}`,{signal:ue.signal});if(D.current!==ue||!P)return;c({...P,nonce:++m.current}),w.current()}catch(P){!Eu(P)&&!W.silent&&b.current(de(P))}finally{D.current===ue&&(D.current=null)}},$=async(U,G,Y)=>{if(!x(g.current))return;const W=g.current;D.current?.abort();const ue=new AbortController;D.current=ue;try{const P=await ne(`/api/projects/${t}/sync/source?mainFile=${encodeURIComponent(e)}&page=${U}&x=${G}&y=${Y}`,{signal:ue.signal});if(D.current!==ue||g.current!==W||!x(g.current))return;j(P.path,P.line,P.column)}catch(P){Eu(P)||b.current(de(P))}finally{D.current===ue&&(D.current=null)}};return{pdfTarget:a,pdfViewport:l,sourceJump:d,setPdfViewport:u,clearPdfViewport:()=>u(null),jumpToSource:j,syncSourceToPdf:N,syncPdfToSource:$,syncVisiblePdfToSource:()=>{l&&$(l.page,l.x,l.y)}}}function gf(t,e){return`texlite.workspaceLayout:${encodeURIComponent(t)}:${encodeURIComponent(e)}`}function wu(t,e){try{const n=window.localStorage.getItem(gf(t,e));if(n==="editor-pdf"||n==="editor-only"||n==="pdf-only")return n}catch{}return"editor-pdf"}function p2(t,e){const[n,s]=f.useState(()=>wu(t,e));return f.useEffect(()=>{s(wu(t,e))},[t,e]),{workspaceLayout:n,setWorkspaceLayout:o=>{s(o);try{window.localStorage.setItem(gf(t,e),o)}catch{}}}}function m2(t){const n=t.split(/(?<=\n)/).map(s=>{for(let r=0;r<s.length;r+=1){if(s[r]!=="%")continue;let o=0;for(let a=r-1;a>=0&&s[a]==="\\";a-=1)o+=1;if(o%2===0)return s.slice(0,r)+(s.endsWith(`
|
|
48
|
-
`)?`
|
|
49
|
-
`:"")}return s}).join("").replace(/\\verb\*?([^\s]).*?\1/g,"").replace(/\\begin\{(?:verbatim\*?|Verbatim|lstlisting|minted)\}(?:\[[^\]]*\])?[\s\S]*?\\end\{(?:verbatim\*?|Verbatim|lstlisting|minted)\}/g,"");return/\\documentclass\s*(?:\[[^\]]*\]\s*)?\{/.test(n)}function D2({sessions:t,status:e}){const{t:n}=ot(),[s,r]=f.useState(!1),o=Math.max(0,t.length-5),a=s&&o>0,c=a?t:t.slice(0,5);return f.useEffect(()=>{t.length<=5&&r(!1)},[t.length]),t.length<=1?null:i.jsxs("div",{className:`collaboration-presence collaboration-${e}`,title:n(`editor.collaboration.${e}`),children:[i.jsx("span",{className:"collaboration-status-dot","aria-label":n(`editor.collaboration.${e}`)}),i.jsxs("div",{className:"collaboration-avatars","aria-label":n("editor.collaboration.activeSessions",{count:t.length}),children:[c.map(l=>{const u=l.editing?n("editor.collaboration.editing"):n("editor.collaboration.viewing"),d=l.permission==="read"?n("common.readOnly"):n("common.readWrite"),h=n("editor.collaboration.sessionTooltip",{name:l.name,username:l.username,file:l.filePath||n("editor.collaboration.joining"),activity:u,permission:d});return i.jsxs("span",{className:`collaboration-avatar${l.editing?" editing":""}${l.local?" local":""}`,style:{"--session-color":l.color},title:h,"aria-label":h,tabIndex:0,children:[s2(l.name,l.username),i.jsxs("span",{className:"collaboration-avatar-tooltip",role:"tooltip",children:[i.jsx("strong",{children:l.name}),i.jsxs("span",{children:["@",l.username]}),i.jsxs("small",{children:[l.filePath||n("editor.collaboration.joining")," · ",u," · ",d]})]})]},l.clientId)}),o>0&&i.jsx("button",{type:"button",className:"collaboration-avatar collaboration-avatar-overflow","aria-expanded":a,"aria-label":a?n("editor.collaboration.showFewerSessions"):n("editor.collaboration.showMoreSessions",{count:o}),title:a?n("editor.collaboration.showFewerSessions"):n("editor.collaboration.showMoreSessions",{count:o}),onClick:()=>r(l=>!l),children:a?"−":`+${o}`})]})]})}function g2({value:t,onChange:e}){const{t:n}=ot(),[s,r]=f.useState(!1),o=f.useRef(null),a=[{value:"editor-pdf",icon:Sl},{value:"editor-only",icon:q0},{value:"pdf-only",icon:K0}];return f.useEffect(()=>{if(!s)return;const c=u=>{o.current?.contains(u.target)||r(!1)},l=u=>{u.key==="Escape"&&r(!1)};return document.addEventListener("pointerdown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("pointerdown",c),document.removeEventListener("keydown",l)}},[s]),i.jsxs("div",{className:"layout-menu",ref:o,children:[i.jsxs("button",{type:"button",className:`layout-trigger${s?" active":""}`,"aria-haspopup":"menu","aria-expanded":s,title:n("editor.layout.current",{layout:n(`editor.layout.${t}.name`)}),onClick:()=>r(c=>!c),children:[i.jsx(Sl,{size:15}),i.jsxs("span",{children:[i.jsx("small",{children:n("editor.layout.label")}),n(`editor.layout.${t}.name`)]}),i.jsx(bd,{size:13})]}),s&&i.jsxs("div",{className:"layout-popover",role:"menu","aria-label":n("editor.layout.label"),children:[i.jsx("div",{className:"layout-popover-title",children:n("editor.layout.choose")}),a.map(c=>{const l=c.icon,u=c.value===t;return i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":u,className:`layout-option${u?" selected":""}`,onClick:()=>{e(c.value),r(!1)},children:[i.jsx(l,{size:19}),i.jsxs("span",{children:[i.jsx("strong",{children:n(`editor.layout.${c.value}.name`)}),i.jsx("small",{children:n(`editor.layout.${c.value}.description`)})]}),u&&i.jsx(is,{size:16})]},c.value)})]})]})}function F2({site:t,project:e,activeFile:n,saveStateLabel:s,editorPreferences:r,activeSessions:o,collaborationStatus:a,reconnectCollaboration:c,protocolUpgradeRequired:l,showEditor:u,filesCollapsed:d,toggleFilesPanel:h,workspaceLayout:D,changeWorkspaceLayout:m,onBack:g,onShare:y,showCitationLibrary:b,citationLibraryOpen:w,onCitationLibrary:x,onHistory:j,onGit:N,canManageGit:$,formatting:V,readOnly:U,collaborationSynced:G,canFormat:Y,activeFormatLease:W,onFormatFile:ue,onFormatSelection:P,hasSelection:K,onAddComment:B,onToggleComments:S,commentsOpen:R,unresolvedCommentCount:he,hasActiveFile:be,onToggleSettings:Fe,settingsOpen:Ne,compileBusy:Z,sharedCompiling:T,localCompiling:ge,cancelling:I,compileState:X,onCompile:ce,onCancelCompile:Ce}){const{t:se}=ot();return i.jsxs("header",{className:"editor-topbar",children:[i.jsx("button",{className:"back",title:se("editor.backToProjects"),"aria-label":se("editor.backToProjects"),onClick:g,children:i.jsx(ra,{size:18})}),i.jsx("a",{className:"brand-link compact-brand-link",href:"/","aria-label":t.siteName,onClick:A=>{A.preventDefault(),g()},children:i.jsx(Ii,{siteName:t.siteName,compact:!0})}),i.jsxs("div",{className:"project-heading",children:[i.jsx("strong",{children:e.name}),i.jsxs("small",{children:[n," · ",s]})]}),r.vimMode&&i.jsxs("span",{className:"vim-status-badge",title:se("editor.vimOnHint"),children:[i.jsx(z0,{size:14}),se("editor.vimOn")]}),i.jsx(D2,{sessions:o,status:a}),a==="disconnected"&&!l&&i.jsxs("div",{className:"collaboration-recovery",role:"status",children:[i.jsx("span",{children:se("editor.collaboration.disconnected")}),i.jsx("button",{type:"button",onClick:c,children:se("editor.collaboration.reconnect")})]}),i.jsxs("div",{className:"editor-actions",children:[u&&i.jsxs("button",{className:d?"":"active",onClick:h,children:[d?i.jsx(V0,{size:15}):i.jsx(vd,{size:15}),se("common.files")]}),i.jsx(g2,{value:D,onChange:m}),i.jsxs("button",{onClick:y,children:[i.jsx(vr,{size:15}),se("projectSettings.share")]}),b&&i.jsxs("button",{className:w?"active":"",onClick:x,children:[i.jsx(Ss,{size:15}),se("citationLibrary.title")]}),i.jsxs("div",{className:"version-action",role:"group","aria-label":se("common.version"),children:[i.jsxs("div",{className:"version-action-label",children:[i.jsx(M0,{size:14}),i.jsx("span",{children:se("common.version")})]}),i.jsxs("div",{className:"version-action-options",children:[i.jsx("button",{type:"button",className:"version-action-history",title:se("history.title"),onClick:j,children:se("history.title")}),i.jsx("button",{type:"button",className:"version-action-git",title:se($?"git.title":"git.ownerOnly"),disabled:!$,onClick:N,children:"Git"})]})]}),u&&e.permission!=="read"&&Y&&i.jsxs("div",{className:"format-action",role:"group","aria-label":se("editor.format"),"aria-busy":V,children:[i.jsxs("div",{className:"format-action-label",children:[i.jsx(Fd,{size:14}),i.jsx("span",{children:se("editor.format")})]}),i.jsxs("div",{className:"format-action-options",children:[i.jsx("button",{type:"button",className:"format-action-file",title:se("editor.formatFileHint"),onMouseDown:A=>A.preventDefault(),onClick:ue,disabled:V||W||!G,children:se("editor.formatFile")}),i.jsx("button",{type:"button",className:"format-action-selected",title:se(K?"editor.formatSelection":"editor.formatSelectionHint"),onMouseDown:A=>A.preventDefault(),onClick:P,disabled:V||W||!G||!K,children:se("editor.formatSelected")})]})]}),i.jsxs("div",{className:"comments-action",role:"group","aria-label":se("common.comments"),children:[i.jsxs("div",{className:"comments-action-label",children:[i.jsx(wd,{size:14}),i.jsx("span",{children:se("common.comments")})]}),i.jsxs("div",{className:"comments-action-options",children:[i.jsx("button",{type:"button",className:"comments-action-add",title:se("editor.addComment"),"aria-label":se("editor.addComment"),onMouseDown:A=>A.preventDefault(),onClick:B,disabled:!be,children:se("editor.commentsAdd")}),i.jsxs("button",{type:"button",className:`comments-action-all${R?" active":""}`,title:se("editor.commentsAll"),onClick:S,children:[se("editor.commentsAll")," ",he||""]})]})]}),i.jsxs("button",{className:Ne?"active":"",onClick:Fe,children:[i.jsx(da,{size:15}),se("common.settings")]}),T||ge?i.jsxs("button",{className:"compile cancel-compile",title:se("compileControls.cancel"),onClick:Ce,disabled:I||V||U||!G,children:[I?i.jsx(ut,{className:"spin",size:15}):i.jsx(Ht,{size:15}),se(I?"compileControls.cancelling":"compileControls.cancel")]}):i.jsxs("button",{className:"compile",title:se("editor.compileShortcut"),onClick:ce,disabled:Z||V||U||!G,children:[Z?i.jsx(ut,{className:"spin",size:15}):i.jsx(Y0,{size:15}),se("editor.compile",{engine:e.engine})]})]})]})}function b2({project:t,filesPanel:e,files:n,visibleEntries:s,activeFile:r,activeMainFile:o,rootDocuments:a,selectedFolder:c,expandedFolders:l,fileDragActive:u,uploadingFiles:d,readOnly:h,editorFontSize:D,outline:m,sourceCursor:g,uploadInput:y,setSelectedFolder:b,setExpandedFolders:w,setMoveEntry:x,setMoveName:j,setMoveDestination:N,setDeleteEntry:$,setFileDialogError:V,setNewFolderName:U,setNewFolderOpen:G,setNewFilePath:Y,setNewFileOpen:W,setQuickOpen:ue,setProjectSearchOpen:P,setFileDragActive:K,setFilesCollapsed:B,toggleFilesPanel:S,uploadFiles:R,upload:he,openFile:be,jumpToSource:Fe,syncSourceToPdf:Ne}){const{t:Z}=ot(),[T,ge]=f.useState(!1);return i.jsx(Oi,{id:"files",order:1,ref:e,defaultSize:16,minSize:12,maxSize:30,collapsible:!0,collapsedSize:0,onCollapse:()=>B(!0),onExpand:()=>B(!1),children:i.jsxs("aside",{className:"left-panel",children:[i.jsxs("section",{className:`files-panel${u?" drop-active":""}`,onDragEnter:I=>{I.dataTransfer.types.includes("Files")&&(I.preventDefault(),!h&&!d&&K(!0))},onDragOver:I=>{I.dataTransfer.types.includes("Files")&&(I.preventDefault(),I.dataTransfer.dropEffect=h||d?"none":"copy")},onDragLeave:I=>{I.currentTarget.contains(I.relatedTarget)||K(!1)},onDrop:I=>{I.preventDefault(),K(!1),!h&&!d&&R(Array.from(I.dataTransfer.files))},children:[i.jsxs("div",{className:"panel-title",children:[i.jsx("button",{className:"file-size-toggle",type:"button","aria-pressed":T,title:Z(T?"editor.hideFileSizes":"editor.showFileSizes"),onClick:()=>ge(I=>!I),children:Z("common.files")}),i.jsxs("span",{className:"file-tools",children:[i.jsx("button",{"aria-label":Z("navigation.quickOpen"),title:`${Z("navigation.quickOpen")} (Ctrl/Cmd+P)`,onClick:()=>ue(!0),children:i.jsx(O0,{size:15})}),i.jsx("button",{"aria-label":Z("navigation.projectSearch"),title:`${Z("navigation.projectSearch")} (Ctrl/Cmd+Shift+F)`,onClick:()=>P(!0),children:i.jsx(Ad,{size:15})}),!h&&i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:d,"aria-label":Z("editor.uploadAttachment"),title:Z("editor.uploadTo",{folder:c||Z("editor.projectRoot")}),onClick:()=>y.current?.click(),children:i.jsx(gi,{size:15})}),i.jsx("button",{"aria-label":Z("editor.newFolder"),title:Z("editor.newFolder"),onClick:()=>{U(""),G(!0)},children:i.jsx(Cd,{size:15})}),i.jsx("button",{"aria-label":Z("editor.newFile"),title:Z("editor.newFile"),onClick:()=>{Y(c?`${c}/`:""),W(!0)},children:i.jsx(R0,{size:15})}),i.jsx("input",{ref:y,type:"file",multiple:!0,hidden:!0,onChange:I=>{he(I)}})]}),i.jsx("button",{"aria-label":Z("editor.collapseFiles"),title:Z("editor.collapseFiles"),onClick:S,children:i.jsx(vd,{size:15})})]})]}),u&&i.jsxs("div",{className:"file-drop-overlay",children:[i.jsx(gi,{size:24}),i.jsx("strong",{children:Z("editor.dropFiles")}),i.jsx("span",{children:Z("editor.uploadTo",{folder:c||Z("editor.projectRoot")})})]}),i.jsxs("div",{className:"file-list",style:{fontSize:`${D}px`},children:[i.jsx("div",{className:`file-entry folder-entry root-entry${c===""?" selected":""}`,children:i.jsxs("button",{className:"file-entry-main",onClick:()=>b(""),children:[i.jsx(aa,{size:15}),i.jsx("span",{children:Z("editor.projectRoot")})]})}),s.map(I=>{const X=I.path.split("/").length-1,ce=I.path.split("/").at(-1),Ce=l.has(I.path),se=a.has(I.path),A=o===I.path,fe=I.path!==t.mainFile&&!t.mainFile.startsWith(`${I.path}/`);return I.type==="directory"?i.jsxs("div",{className:`file-entry folder-entry${c===I.path?" selected":""}`,style:{paddingLeft:`${X*13+5}px`},children:[i.jsxs("button",{className:"file-entry-main",title:I.path,onClick:()=>{b(I.path),w(ve=>{const qe=new Set(ve);return qe.has(I.path)?qe.delete(I.path):qe.add(I.path),qe})},children:[Ce?i.jsx(bd,{size:13}):i.jsx(Mi,{size:13}),i.jsx(I0,{size:14}),i.jsx("span",{children:ce})]}),!h&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"file-entry-action",title:Z("editor.move"),"aria-label":Z("editor.move"),onClick:()=>{x(I),j(ce??""),N("")},children:i.jsx(Bl,{size:13})}),fe&&i.jsx("button",{className:"file-entry-action danger-text",title:Z("editor.deletePath"),"aria-label":Z("editor.deletePath"),onClick:()=>{$(I),V("")},children:i.jsx(sn,{size:13})})]})]},I.path):i.jsxs("div",{className:`file-entry${r===I.path?" active":""}${se?" root-document":""}${A?" compile-target":""}`,style:{paddingLeft:`${X*13+18}px`},children:[i.jsxs("button",{className:"file-entry-main",title:A?Z("editor.currentMainDocument",{path:I.path}):se?Z("editor.mainDocumentCandidate",{path:I.path}):I.path,onClick:()=>be(I),children:[se?i.jsx(Va,{size:13}):i.jsx(Us,{size:13}),i.jsx("span",{children:ce}),A&&i.jsx("small",{children:Z("editor.currentMainShort")})]}),T&&typeof I.size=="number"&&i.jsx("span",{className:"file-entry-size",title:`${I.size.toLocaleString()} B`,children:y2(I.size)}),!h&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"file-entry-action",title:Z("editor.move"),"aria-label":Z("editor.move"),onClick:()=>{x(I),j(ce??""),N("")},children:i.jsx(Bl,{size:13})}),fe&&i.jsx("button",{className:"file-entry-action danger-text",title:Z("editor.deletePath"),"aria-label":Z("editor.deletePath"),onClick:()=>{$(I),V("")},children:i.jsx(sn,{size:13})})]})]},I.path)})]})]}),i.jsxs("section",{className:"outline-panel",children:[i.jsx("div",{className:"panel-title",children:i.jsxs("span",{children:[i.jsx(H0,{size:14}),Z("common.outline")]})}),i.jsxs("div",{className:"outline",children:[m.map((I,X)=>i.jsxs("button",{className:`outline-item${r===I.path&&g.line===I.line?" current":""}`,title:`${I.path}:${I.line}`,onClick:()=>{Fe(I.path,I.line,1),Ne(I.path,I.line,1)},children:[i.jsx("span",{className:"outline-guides","aria-hidden":!0,style:{width:`${I.level*12}px`}}),i.jsx("small",{children:I.path===r?I.line:I.path.split("/").at(-1)}),i.jsx("span",{className:"outline-title",children:I.title})]},`${I.path}-${I.line}-${X}`)),m.length===0&&i.jsx("p",{className:"muted padded",children:Z("editor.noOutline")})]})]})]})})}function y2(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/1024/1024).toFixed(1)} MB`:`${(t/1024/1024/1024).toFixed(1)} GB`}const C2=f.lazy(()=>Gn(()=>import("./LatexEditor-DH9v1wgS.js"),__vite__mapDeps([6,1,7])).then(t=>({default:t.LatexEditor})));function E2({project:t,activeFile:e,activeMainFile:n,openTabs:s,content:r,loadedFile:o,readOnly:a,comments:c,focusComment:l,editorPreferences:u,completionIndex:d,nativeSpellCheck:h,spellCheckIssues:D,spellCheckJump:m,sourceJump:g,collaborativeText:y,collaborationAwareness:b,undoManager:w,editorNotice:x,activateTab:j,closeTab:N,handleTabKeyDown:$,updateEditorContent:V,setSelection:U,onCommentClick:G,onSpellCheckReplace:Y,onCursor:W}){const{t:ue}=ot();return i.jsx(Oi,{id:"source",order:2,defaultSize:42,minSize:22,children:i.jsxs("main",{className:"source-panel",children:[u.openFilesInTabs&&s.length>0&&i.jsx("div",{className:"editor-tabs-bar",role:"tablist","aria-label":ue("editor.openFiles"),children:i.jsx("div",{className:"editor-tabs-scroll",children:s.map((P,K)=>{const B=P===e,S=P===(n||t.mainFile),R=P.split("/").at(-1)||P;return i.jsxs("div",{className:`editor-tab-item${B?" active":""}`,role:"presentation",children:[i.jsxs("button",{id:`editor-tab-${encodeURIComponent(P)}`,type:"button",role:"tab","aria-selected":B,"aria-controls":"editor-source-content",tabIndex:B?0:-1,className:`editor-tab${B?" active":""}${S?" main-tab":""}`,onClick:()=>j(P),onKeyDown:he=>$(he,K),title:P,children:[i.jsx("span",{className:"editor-tab-icon",children:S?i.jsx(Va,{size:13}):i.jsx(Us,{size:13})}),i.jsx("span",{className:"editor-tab-title",children:R}),S&&i.jsx("small",{className:"editor-tab-badge",children:ue("editor.currentMainShort")})]}),i.jsx("button",{type:"button",className:"editor-tab-close",title:ue("common.close"),"aria-label":`${ue("common.close")} ${R}`,onClick:()=>N(P),children:i.jsx(Ht,{size:12})})]},P)})})}),i.jsxs("div",{id:"editor-source-content",className:"editor-content-container",children:[i.jsx(f.Suspense,{fallback:i.jsxs("div",{className:"preview-empty",children:[i.jsx(ut,{className:"spin",size:22}),i.jsx("span",{children:ue("common.loading")})]}),children:i.jsx(C2,{value:r,filePath:e,readOnly:a,comments:c,focusComment:l,preferences:u,nativeSpellCheck:h,completionIndex:d,spellCheckIssues:D,spellCheckJump:m,jumpTo:o===e&&g?.path===e?g:null,searchRequest:0,collaboration:y?{text:y,awareness:b,undoManager:a?void 0:w}:void 0,onChange:V,onSelection:U,onCommentClick:G,onSpellCheckReplace:Y,onCursor:W},e)}),x&&i.jsx("div",{className:"editor-centered-notice",role:"status","aria-live":"polite",children:x})]})]})})}function xu({diagnostics:t,files:e,empty:n,tone:s,onJump:r}){const{t:o}=ot(),a=s==="error"?qa:nn;return t.length?i.jsx("div",{className:`compile-diagnostic-list compile-${s}`,children:t.map((c,l)=>{const u=v2(c.file,e),d=!!(u&&c.line);return i.jsxs("button",{type:"button",disabled:!d,className:"compile-diagnostic-row",onClick:()=>{u&&c.line&&r(u,c.line,c.column??1)},children:[i.jsx(a,{size:15}),i.jsxs("span",{children:[i.jsx("strong",{children:c.message}),i.jsxs("small",{children:[c.phase,u?` · ${u}${c.line?`:${c.line}`:""}`:c.line?` · ${o("editor.lineNumber",{line:c.line})}`:""]})]})]},`${c.phase}-${c.file??""}-${c.line??0}-${l}`)})}):i.jsxs("div",{className:`compile-empty compile-${s}`,children:[i.jsx(a,{size:26}),i.jsx("span",{children:n})]})}function qo({lines:t,empty:e,tone:n="log"}){const s=n==="error"?qa:n==="warning"?nn:ua;return t.length?i.jsx("pre",{className:`compile-output compile-${n}`,children:t.join(`
|
|
50
|
-
`)}):i.jsxs("div",{className:`compile-empty compile-${n}`,children:[i.jsx(s,{size:26}),i.jsx("span",{children:e})]})}function w2({projectId:t,mainFile:e,artifacts:n,preview:s,loading:r,onView:o}){const{t:a}=ot(),c=l=>`/api/projects/${t}/compile/artifacts?mainFile=${encodeURIComponent(e)}&path=${encodeURIComponent(l)}&download=1`;return n.length?i.jsxs("div",{className:"artifact-browser",children:[i.jsx("div",{className:"artifact-list",children:n.map(l=>i.jsxs("div",{className:`artifact-row${s?.path===l.path?" active":""}`,children:[i.jsxs("button",{type:"button",disabled:!l.viewable,title:l.viewable?a("editor.viewArtifact"):a("editor.downloadToView"),onClick:()=>o(l),children:[i.jsx(Us,{size:14}),i.jsxs("span",{children:[i.jsx("strong",{children:l.path}),i.jsx("small",{children:A2(l.size)})]})]}),i.jsx("a",{href:c(l.path),title:a("editor.downloadArtifact"),"aria-label":a("editor.downloadArtifact"),children:i.jsx(xr,{size:14})})]},l.path))}),i.jsx("div",{className:"artifact-preview",children:r?i.jsxs("div",{className:"compile-empty",children:[i.jsx(ut,{className:"spin",size:24}),i.jsx("span",{children:a("common.loading")})]}):s?i.jsxs(i.Fragment,{children:[i.jsxs("header",{children:[i.jsx("strong",{children:s.path}),i.jsxs("a",{href:c(s.path),children:[i.jsx(xr,{size:13}),a("projects.download")]})]}),i.jsx("pre",{children:s.content})]}):i.jsxs("div",{className:"compile-empty",children:[i.jsx(Us,{size:24}),i.jsx("span",{children:a("editor.selectArtifact")})]})})]}):i.jsxs("div",{className:"compile-empty",children:[i.jsx(xd,{size:26}),i.jsx("span",{children:a("editor.noArtifacts")})]})}function x2({mainFile:t,disabled:e,cleaning:n,onCleanCache:s,onCleanArtifacts:r}){const{t:o}=ot();return i.jsxs("div",{className:"compile-clean-panel",children:[i.jsxs("div",{className:"compile-clean-intro",children:[i.jsx(nn,{size:28}),i.jsxs("div",{children:[i.jsx("strong",{children:o("editor.cleanTitle")}),i.jsx("p",{children:o("editor.cleanDescription",{file:t})})]})]}),i.jsxs("div",{className:"compile-clean-actions",children:[i.jsxs("article",{children:[i.jsx("div",{className:"compile-clean-action-icon",children:i.jsx(ia,{size:19})}),i.jsxs("div",{children:[i.jsx("strong",{children:o("editor.cleanCache")}),i.jsx("p",{children:o("editor.cleanCacheDescription")}),i.jsxs("button",{type:"button",disabled:e||n,onClick:s,children:[n?i.jsx(ut,{className:"spin",size:14}):i.jsx(ia,{size:14}),o("editor.cleanCache")]})]})]}),i.jsxs("article",{className:"danger",children:[i.jsx("div",{className:"compile-clean-action-icon",children:i.jsx(sn,{size:19})}),i.jsxs("div",{children:[i.jsx("strong",{children:o("editor.cleanArtifacts")}),i.jsx("p",{children:o("editor.cleanArtifactsDescription")}),i.jsxs("button",{type:"button",className:"danger",disabled:e||n,onClick:r,children:[n?i.jsx(ut,{className:"spin",size:14}):i.jsx(sn,{size:14}),o("editor.cleanArtifacts")]})]})]})]})]})}function v2(t,e){if(!t)return null;const n=e.filter(c=>c.type==="file").map(c=>c.path),s=t.replaceAll("\\","/").replace(/^\.\//,"");if(n.includes(s))return s;const r=n.filter(c=>s.endsWith(`/${c}`));if(r.length===1)return r[0];const o=s.split("/").at(-1),a=n.filter(c=>c.split("/").at(-1)===o);return a.length===1?a[0]:null}function A2(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}const k2=f.lazy(()=>_i().then(t=>({default:t.PdfPreview})));function S2({projectId:t,activeMainFile:e,previewTab:n,diagnosticTab:s,pdfUrl:r,pdfLoadingMode:o,pdfLoading:a,pdfCompiledAt:c,pdfCompiledLabel:l,pdfTargetLabel:u,pdfDownloadUrl:d,pdfTarget:h,pdfViewport:D,activeFile:m,sourceCursor:g,compileBusy:y,compileLog:b,compileDiagnostics:w,compileMessages:x,artifacts:j,artifactPreview:N,artifactLoading:$,cleaning:V,readOnly:U,collaborationSynced:G,workspaceLayout:Y,showSyncResize:W,diagnosticCount:ue,selectPreviewTab:P,changeWorkspaceLayout:K,onSetNotice:B,onSetPdfViewport:S,syncVisiblePdfToSource:R,syncSourceToPdf:he,syncPdfToSource:be,canSyncWithPdf:Fe,files:Ne,jumpToSource:Z,onSetCleanMode:T,cleanCompile:ge,viewArtifact:I}){const{t:X}=ot();return i.jsxs(i.Fragment,{children:[W&&i.jsxs(Ta,{className:"resize-handle sync-resize-handle",children:[i.jsx(Ed,{className:"resize-grip",size:12}),i.jsxs("span",{className:"sync-direction-buttons",onPointerDown:ce=>ce.stopPropagation(),children:[i.jsx("button",{disabled:!D||!Fe,title:X(Fe?"editor.showInSource":"editor.syncTexOnlyForMain"),"aria-label":X("editor.showInSource"),onClick:()=>{if(!Fe){B(X("editor.syncTexOnlyForMain"));return}R()},children:i.jsx("span",{"aria-hidden":!0,children:"←"})}),i.jsx("button",{disabled:!m||!r||!Fe,title:X(Fe?"editor.showInPdf":"editor.syncTexOnlyForMain"),"aria-label":X("editor.showInPdf"),onClick:()=>{if(!Fe){B(X("editor.syncTexOnlyForMain"));return}he(m,g.line,g.column)},children:i.jsx("span",{"aria-hidden":!0,children:"→"})})]})]}),i.jsx(Oi,{id:"preview",order:3,defaultSize:42,minSize:22,children:i.jsxs("section",{className:"preview-panel",children:[i.jsxs("div",{className:"preview-tabs",children:[i.jsxs("div",{className:"preview-tab-list",role:"tablist","aria-label":X("editor.outputTabs"),children:[i.jsxs("button",{role:"tab","aria-selected":n==="pdf",className:`pdf-tab${n==="pdf"?" active":""}`,onClick:()=>P("pdf"),title:c?X("editor.pdfCompiledAtFor",{file:e,time:new Date(c).toLocaleString(Ke.resolvedLanguage)}):X("editor.currentMainDocument",{path:e}),children:[i.jsx(Us,{size:16}),i.jsxs("span",{className:"pdf-tab-label",children:["PDF · ",u,l&&i.jsx("small",{children:l})]})]}),i.jsxs("button",{role:"tab","aria-selected":n==="diagnostics",className:`diagnostics-tab${n==="diagnostics"?" active":""}`,onClick:()=>P("diagnostics"),children:[i.jsx(ua,{size:14}),X("editor.outputTabs"),i.jsx("span",{children:ue})]})]}),d&&i.jsxs("a",{className:"pdf-download-top",href:d,download:!0,title:X("editor.downloadPdf"),"aria-label":X("editor.downloadPdf"),children:[i.jsx(xr,{size:15}),i.jsx("span",{children:X("editor.downloadPdf")})]})]}),n==="diagnostics"&&i.jsxs("div",{className:"preview-subtabs",role:"tablist","aria-label":X("editor.outputTabs"),children:[i.jsxs("button",{role:"tab","aria-selected":s==="log",className:s==="log"?"active":"",onClick:()=>P("log"),children:[i.jsx(ua,{size:13}),X("editor.log")]}),i.jsxs("button",{role:"tab","aria-selected":s==="warnings",className:s==="warnings"?"active":"",onClick:()=>P("warnings"),children:[i.jsx(nn,{size:13}),X("editor.warnings"),i.jsx("span",{children:x.warnings.length})]}),i.jsxs("button",{role:"tab","aria-selected":s==="errors",className:s==="errors"?"active":"",onClick:()=>P("errors"),children:[i.jsx(qa,{size:13}),X("editor.errors"),i.jsx("span",{children:x.errors.length})]}),i.jsxs("button",{role:"tab","aria-selected":s==="artifacts",className:s==="artifacts"?"active":"",onClick:()=>P("artifacts"),children:[i.jsx(xd,{size:13}),X("editor.artifacts"),i.jsx("span",{children:j.length})]}),i.jsxs("button",{role:"tab","aria-selected":s==="clean",className:s==="clean"?"active":"",onClick:()=>P("clean"),children:[i.jsx(ia,{size:13}),X("editor.clean")]})]}),i.jsxs("div",{className:`preview-content preview-${n} ${n==="diagnostics"?`preview-${s}`:""}`,children:[n==="pdf"&&(r?i.jsx(f.Suspense,{fallback:i.jsxs("div",{className:"pdf-loading-state",role:"status","aria-live":"polite",children:[i.jsx(ut,{className:"spin",size:24}),i.jsx("span",{children:X("editor.loadingPdf")})]}),children:i.jsx(k2,{url:r,loadingMode:o,target:h,compiling:y,onViewportLocation:(ce,Ce,se)=>S({page:ce,x:Ce,y:se}),onDoubleClickLocation:(ce,Ce,se)=>{if(S({page:ce,x:Ce,y:se}),!Fe){B(X("editor.syncTexOnlyForMain"));return}be(ce,Ce,se)}})}):a?i.jsxs("div",{className:"pdf-loading-state",role:"status","aria-live":"polite",children:[i.jsx(ut,{className:"spin",size:24}),i.jsx("span",{children:X("editor.loadingPdf")})]}):i.jsxs("div",{className:"preview-empty",children:[i.jsx(Us,{size:28}),i.jsx("strong",{children:X("editor.preview")}),i.jsx("span",{children:X("editor.previewHint")})]})),n==="diagnostics"&&s==="log"&&i.jsx(qo,{lines:b?b.split(`
|
|
51
|
-
`):[],empty:X(y?"editor.compiling":"editor.noLog")}),n==="diagnostics"&&s==="warnings"&&(w?i.jsx(xu,{tone:"warning",diagnostics:w.warnings,files:Ne,empty:X("editor.noWarnings"),onJump:(ce,Ce,se)=>{Y==="pdf-only"&&K("editor-pdf"),Z(ce,Ce,se)}}):i.jsx(qo,{tone:"warning",lines:x.warnings,empty:X("editor.noWarnings")})),n==="diagnostics"&&s==="errors"&&(w?i.jsx(xu,{tone:"error",diagnostics:w.errors,files:Ne,empty:X("editor.noErrors"),onJump:(ce,Ce,se)=>{Y==="pdf-only"&&K("editor-pdf"),Z(ce,Ce,se)}}):i.jsx(qo,{tone:"error",lines:x.errors,empty:X("editor.noErrors")})),n==="diagnostics"&&s==="artifacts"&&i.jsx(w2,{projectId:t,mainFile:e,artifacts:j,preview:N,loading:$,onView:ce=>{I(ce)}}),n==="diagnostics"&&s==="clean"&&i.jsx(x2,{mainFile:e,disabled:U||!G||y,cleaning:V,onCleanCache:()=>T("cache"),onCleanArtifacts:()=>T("artifacts")})]})]})})]})}function Ko(t,e){!(t.ctrlKey||t.metaKey)||t.key!=="Enter"||t.nativeEvent.isComposing||(t.preventDefault(),t.stopPropagation(),e())}function j2({comment:t,currentUserId:e,onFocus:n,onToggle:s,onReply:r,onEdit:o,onDelete:a,onEditReply:c,onDeleteReply:l}){const{t:u}=ot(),[d,h]=f.useState(!1),[D,m]=f.useState(""),[g,y]=f.useState(!1),[b,w]=f.useState(t.content),[x,j]=f.useState(!1),[N,$]=f.useState(null),[V,U]=f.useState(""),[G,Y]=f.useState(null),W=async S=>{S?.preventDefault(),D.trim()&&await r(D)&&(m(""),h(!1))},ue=async S=>{S?.preventDefault(),b.trim()&&await o(b)&&y(!1)},P=async S=>{S?.preventDefault(),!(!N||!V.trim())&&await c(N,V)&&$(null)},K=t.authorUsername,B=S=>new Date(S).toLocaleString(Ke.resolvedLanguage);return i.jsxs(i.Fragment,{children:[i.jsxs("article",{className:`comment-thread${t.resolved?" resolved":""}${t.orphaned?" orphaned":""}`,onClick:()=>{window.getSelection()?.toString()||n()},children:[i.jsxs("header",{className:"comment-header",children:[i.jsxs("span",{className:"comment-author",children:[i.jsx("strong",{children:t.authorDisplayName??K??u("editor.deletedUser")}),K&&i.jsxs("small",{children:["@",K]})]}),i.jsxs("span",{className:"comment-times",children:[i.jsx("time",{dateTime:t.createdAt,title:new Date(t.createdAt).toISOString(),children:B(t.createdAt)}),t.editedAt&&i.jsx("small",{children:u("editor.editedAt",{time:B(t.editedAt)})})]})]}),i.jsx("div",{className:"comment-location",children:t.orphaned?u("editor.orphaned"):u("editor.line",{line:t.startLine})}),t.selectedText&&i.jsx("blockquote",{className:"comment-selected-text",children:t.selectedText}),g?i.jsxs("form",{className:"comment-reply-form comment-edit-form",onSubmit:S=>{ue(S)},onClick:S=>S.stopPropagation(),children:[i.jsx("textarea",{autoFocus:!0,rows:4,value:b,onChange:S=>w(S.target.value),onKeyDown:S=>Ko(S,ue)}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>y(!1),children:u("common.cancel")}),i.jsxs("button",{className:"primary",type:"submit",disabled:!b.trim(),children:[i.jsx(Di,{size:13}),u("editor.saveChanges")]})]})]}):i.jsx("p",{className:"comment-content",children:t.content}),t.replies.length>0&&i.jsx("div",{className:"comment-replies",children:t.replies.map(S=>i.jsxs("div",{className:"comment-reply",children:[i.jsxs("header",{children:[i.jsxs("span",{className:"comment-author",children:[i.jsx("strong",{children:S.authorDisplayName??S.authorUsername??u("editor.deletedUser")}),S.authorUsername&&i.jsxs("small",{children:["@",S.authorUsername]})]}),i.jsxs("span",{className:"comment-times",children:[i.jsx("time",{dateTime:S.createdAt,title:new Date(S.createdAt).toISOString(),children:B(S.createdAt)}),S.editedAt&&i.jsx("small",{children:u("editor.editedAt",{time:B(S.editedAt)})})]})]}),N===S.id?i.jsxs("form",{className:"comment-reply-form comment-edit-form",onSubmit:R=>{P(R)},onClick:R=>R.stopPropagation(),children:[i.jsx("textarea",{autoFocus:!0,rows:3,value:V,onChange:R=>U(R.target.value),onKeyDown:R=>Ko(R,P)}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>$(null),children:u("common.cancel")}),i.jsxs("button",{className:"primary",type:"submit",disabled:!V.trim(),children:[i.jsx(Di,{size:13}),u("editor.saveChanges")]})]})]}):i.jsx("p",{className:"comment-content",children:S.content}),S.authorId===e&&N!==S.id&&i.jsxs("div",{className:"comment-owner-actions",children:[i.jsx("button",{title:u("editor.editReply"),"aria-label":u("editor.editReply"),onClick:R=>{R.stopPropagation(),$(S.id),U(S.content)},children:i.jsx(ca,{size:12})}),i.jsx("button",{className:"danger-text",title:u("editor.deleteReply"),"aria-label":u("editor.deleteReply"),onClick:R=>{R.stopPropagation(),Y(S.id)},children:i.jsx(sn,{size:12})})]})]},S.id))}),i.jsxs("div",{className:"comment-actions",children:[i.jsxs("button",{className:"resolve",onClick:S=>{S.stopPropagation(),s()},children:[t.resolved?i.jsx(J0,{size:13}):i.jsx(yd,{size:13}),t.resolved?u("editor.reopen"):u("editor.resolve")]}),i.jsxs("button",{className:"reply-action",onClick:S=>{S.stopPropagation(),h(R=>!R)},children:[i.jsx(X0,{size:13}),u("editor.reply")]}),t.authorId===e&&!g&&i.jsxs("span",{className:"comment-owner-actions",children:[i.jsx("button",{title:u("editor.editComment"),"aria-label":u("editor.editComment"),onClick:S=>{S.stopPropagation(),w(t.content),y(!0)},children:i.jsx(ca,{size:13})}),i.jsx("button",{className:"danger-text",title:u("editor.deleteComment"),"aria-label":u("editor.deleteComment"),onClick:S=>{S.stopPropagation(),j(!0)},children:i.jsx(sn,{size:13})})]})]}),d&&i.jsxs("form",{className:"comment-reply-form",onSubmit:S=>{W(S)},onClick:S=>S.stopPropagation(),children:[i.jsx("textarea",{autoFocus:!0,rows:3,value:D,placeholder:u("editor.replyPlaceholder"),onChange:S=>m(S.target.value),onKeyDown:S=>Ko(S,W)}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>{h(!1),m("")},children:u("common.cancel")}),i.jsxs("button",{className:"primary",type:"submit",disabled:!D.trim(),children:[i.jsx(Z0,{size:13}),u("editor.sendReply")]})]})]})]}),i.jsx(Vn,{open:x,title:u("editor.deleteCommentTitle"),description:u("editor.deleteCommentDescription",{count:t.replies.length}),confirmLabel:u("common.delete"),danger:!0,onCancel:()=>j(!1),onConfirm:()=>{a().then(S=>{S&&j(!1)})}}),i.jsx(Vn,{open:!!G,title:u("editor.deleteReplyTitle"),description:u("editor.deleteReplyDescription"),confirmLabel:u("common.delete"),danger:!0,onCancel:()=>Y(null),onConfirm:()=>{G&&l(G).then(S=>{S&&Y(null)})}})]})}function B2({open:t,onOpenChange:e,project:n,projectId:s}){const{t:r}=ot(),[o,a]=f.useState([]),[c,l]=f.useState([]),[u,d]=f.useState(""),[h,D]=f.useState("read"),[m,g]=f.useState(null),[y,b]=f.useState(""),w=n.permission==="owner",x=async()=>{try{const[U,G]=await Promise.all([ne(`/api/projects/${s}/members`),ne("/api/users")]);a(U.members),l(G.users.filter(Y=>Y.id!==n.ownerId))}catch(U){b(de(U))}};f.useEffect(()=>{t&&x()},[t,s]);const j=async()=>{if(u)try{await ne(`/api/projects/${s}/members/${u}`,{method:"PUT",body:JSON.stringify({permission:h})}),d(""),D("read"),await x()}catch(U){b(de(U))}},N=async(U,G)=>{try{await ne(`/api/projects/${s}/members/${U.id}`,{method:"PUT",body:JSON.stringify({permission:G})}),await x()}catch(Y){b(de(Y))}},$=async()=>{if(m)try{await ne(`/api/projects/${s}/members/${m.id}`,{method:"DELETE"}),g(null),await x()}catch(U){b(de(U))}},V=c.filter(U=>!o.some(G=>G.id===U.id));return i.jsxs(i.Fragment,{children:[i.jsx(bt,{open:t,wide:!0,title:r("projectSettings.share"),description:r("projectSettings.shareDescription"),onOpenChange:e,footer:i.jsx("button",{onClick:()=>e(!1),children:r("common.close")}),children:i.jsxs("div",{className:"share-dialog",children:[y&&i.jsx("p",{className:"error",children:y}),i.jsxs("div",{className:"share-owner",children:[i.jsx(vr,{size:17}),i.jsxs("span",{children:[i.jsx("small",{children:r("projects.owner")}),i.jsx("strong",{children:n.ownerDisplayName??n.ownerUsername})]})]}),w&&i.jsxs("div",{className:"share-add",children:[i.jsxs("label",{className:"form-field",children:[r("common.user"),i.jsxs("select",{value:u,onChange:U=>d(U.target.value),children:[i.jsx("option",{value:"",children:r("projectSettings.chooseUser")}),V.map(U=>i.jsx("option",{value:U.id,children:U.displayName??U.username},U.id))]})]}),i.jsxs("label",{className:"form-field",children:[r("common.permission"),i.jsxs("select",{value:h,onChange:U=>D(U.target.value),children:[i.jsx("option",{value:"read",children:r("common.readOnly")}),i.jsx("option",{value:"edit",children:r("common.readWrite")})]})]}),i.jsxs("button",{className:"primary icon-button",disabled:!u,onClick:()=>{j()},children:[i.jsx(fa,{size:15}),r("projectSettings.addMember")]})]}),i.jsxs("div",{className:"shared-members-heading",children:[i.jsx("strong",{children:r("projectSettings.members")}),i.jsx("span",{children:o.length})]}),i.jsxs("div",{className:"shared-members",children:[o.map(U=>i.jsxs("div",{className:"shared-member",children:[i.jsxs("span",{className:"member-identity",children:[i.jsx("span",{className:"member-avatar",children:(U.displayName??U.username).slice(0,1).toLocaleUpperCase()}),i.jsxs("span",{children:[i.jsx("strong",{children:U.displayName??U.username}),i.jsxs("small",{children:["@",U.username]})]})]}),i.jsxs("span",{className:"member-controls",children:[i.jsxs("select",{"aria-label":r("common.permission"),disabled:!w,value:U.permission,onChange:G=>{N(U,G.target.value)},children:[i.jsx("option",{value:"read",children:r("common.readOnly")}),i.jsx("option",{value:"edit",children:r("common.readWrite")})]}),w&&i.jsx("button",{className:"icon-only danger-text",title:r("common.remove"),"aria-label":r("common.remove"),onClick:()=>g(U),children:i.jsx(sn,{size:15})})]})]},U.id)),o.length===0&&i.jsxs("div",{className:"share-empty",children:[i.jsx(vr,{size:24}),i.jsx("span",{children:r("projectSettings.noMembers")})]})]})]})}),i.jsx(Vn,{open:!!m,title:r("projectSettings.removeTitle"),description:r("projectSettings.removeDescription",{username:m?.username??""}),confirmLabel:r("common.remove"),danger:!0,onCancel:()=>g(null),onConfirm:()=>{$()}})]})}const T2=f.lazy(()=>Gn(()=>import("./GitDialog-DdLrbz_H.js"),__vite__mapDeps([8,1,3])).then(t=>({default:t.GitDialog}))),L2=f.lazy(()=>Gn(()=>import("./HistoryDialog-AlF9iozX.js"),__vite__mapDeps([9,1])).then(t=>({default:t.HistoryDialog}))),N2=f.lazy(()=>Gn(()=>import("./ProjectNavigationDialogs-DiXtkTj1.js"),__vite__mapDeps([10,1])).then(t=>({default:t.ProjectSearchDialog}))),R2=f.lazy(()=>Gn(()=>import("./ProjectNavigationDialogs-DiXtkTj1.js"),__vite__mapDeps([10,1])).then(t=>({default:t.QuickOpenDialog})));function O2({user:t,project:e,projectId:n,activeFile:s,content:r,maxCitationBibtexBytes:o,files:a,directoryEntries:c,readOnly:l,workspaceLayout:u,changeWorkspaceLayout:d,resourcePreview:h,resourcePreviewLoading:D,setResourcePreview:m,setResourcePreviewLoading:g,uploadConflict:y,setUploadConflict:b,uploadFiles:w,cleanMode:x,setCleanMode:j,cleanCompile:N,newFileOpen:$,setNewFileOpen:V,newFilePath:U,setNewFilePath:G,newFolderOpen:Y,setNewFolderOpen:W,newFolderName:ue,setNewFolderName:P,selectedFolder:K,fileDialogError:B,setFileDialogError:S,createFile:R,createFolder:he,moveEntry:be,setMoveEntry:Fe,moveName:Ne,setMoveName:Z,moveDestination:T,setMoveDestination:ge,movePath:I,deleteEntry:X,setDeleteEntry:ce,deleteActiveSessions:Ce,removePath:se,commentOpen:A,setCommentOpen:fe,selection:ve,commentText:qe,setCommentText:yt,addComment:Qe,shareOpen:Xe,setShareOpen:ye,citationLibraryOpen:We,setCitationLibraryOpen:Je,insertCitationAtCursor:pt,quickOpen:De,setQuickOpen:Et,projectSearchOpen:le,setProjectSearchOpen:ke,openFile:Oe,jumpToSource:mt,historyOpen:Ue,setHistoryOpen:z,gitOpen:pe,setGitOpen:q,save:Ve,permissionDowngrade:Ge,permissionDowngradeBusy:st,dismissPermissionDowngrade:Ee,discardPermissionDraft:dt}){const{t:Q}=ot();return i.jsxs(i.Fragment,{children:[Ge&&i.jsx(bt,{open:!0,title:Q("editor.collaboration.permissionDowngradeTitle"),description:Ge.localDraftReady&&Ge.otherTabDraft?Q("editor.collaboration.permissionDowngradeMultipleDrafts"):Ge.otherTabDraft?Q("editor.collaboration.permissionDowngradeOtherTab"):Ge.localDraftReady?Q("editor.collaboration.permissionDowngradeDescription",{previous:Q("common.readWrite")}):Q("editor.collaboration.permissionDowngradeNoDraft"),onOpenChange:_=>{!_&&!st&&Ee()},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:st,onClick:Ee,children:Ge.localDraftReady?Q("editor.collaboration.permissionDowngradeKeep"):Q("common.close")}),!Ge.otherTabDraft&&i.jsxs("button",{type:"button",className:"danger",disabled:st,onClick:()=>{dt()},children:[st?i.jsx(ut,{className:"spin",size:14}):Ge.localDraftReady?i.jsx(sn,{size:14}):i.jsx(la,{size:14}),Ge.localDraftReady?Q("editor.collaboration.permissionDowngradeDiscard"):Q("editor.collaboration.permissionDowngradeReload")]})]}),children:i.jsx("div",{})}),i.jsxs(bt,{open:!!h,extraWide:h?.kind==="image"||h?.kind==="pdf"||h?.kind==="text",title:h?.path??"",description:h?.kind==="large"?Q("editor.resourceTooLarge",{size:P2(h.size),limit:`${Ba/1024/1024} MB`}):Q(`editor.resourcePreview.${h?.kind??"text"}`),onOpenChange:_=>{_||(m(null),g(!1))},footer:h&&i.jsxs("a",{className:"primary resource-download",href:`${h.url}&download=1`,download:!0,children:[i.jsx(xr,{size:14}),Q("editor.downloadResource")]}),children:[h?.kind==="large"&&i.jsxs("div",{className:"resource-preview-message",children:[i.jsx(oa,{size:34}),i.jsx("strong",{children:Q("editor.resourceTooLargeTitle")}),i.jsx("span",{children:Q("editor.resourceTooLargeDescription")})]}),h?.kind==="unsupported"&&i.jsxs("div",{className:"resource-preview-message",children:[i.jsx(oa,{size:34}),i.jsx("strong",{children:Q("editor.resourceUnsupportedTitle")}),i.jsx("span",{children:Q("editor.resourceUnsupportedDescription")})]}),h?.kind==="image"&&i.jsx("div",{className:"resource-image-wrap",children:i.jsx("img",{className:"resource-image",src:h.url,alt:h.path})}),h?.kind==="pdf"&&i.jsx("iframe",{className:"resource-pdf",src:h.url,title:h.path}),h?.kind==="text"&&(D?i.jsxs("div",{className:"resource-preview-message",children:[i.jsx(ut,{className:"spin",size:24}),i.jsx("span",{children:Q("common.loading")})]}):i.jsx("pre",{className:"resource-text",children:h.content}))]}),i.jsx(Vn,{open:!!y,title:Q("editor.uploadOverwriteTitle"),description:Q("editor.uploadOverwriteDescription",{files:y?.collisions.join(", ")??""}),confirmLabel:Q("editor.uploadOverwrite"),danger:!0,onCancel:()=>b(null),onConfirm:()=>{const _=y;b(null),_&&w(_.files,new Set(_.collisions),_.directory)}}),i.jsx(Vn,{open:!!x,title:Q(x==="cache"?"editor.cleanCacheConfirmTitle":"editor.cleanArtifactsConfirmTitle"),description:Q(x==="cache"?"editor.cleanCacheConfirmDescription":"editor.cleanArtifactsConfirmDescription"),confirmLabel:Q("editor.cleanConfirm"),danger:x==="artifacts",onCancel:()=>j(null),onConfirm:()=>{const _=x;j(null),_&&N(_)}}),i.jsx(bt,{open:$,title:Q("editor.newFile"),description:Q("editor.newFileDescription"),onOpenChange:_=>{V(_),_||S("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>V(!1),children:Q("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{R()},children:Q("common.create")})]}),children:i.jsxs(i.Fragment,{children:[B&&i.jsx("p",{className:"error dialog-error",children:B}),i.jsxs("label",{className:"form-field",children:[Q("editor.filePath"),i.jsx("input",{autoFocus:!0,value:U,onChange:_=>G(_.target.value),onKeyDown:_=>{_.key==="Enter"&&!_.nativeEvent.isComposing&&(_.preventDefault(),R())}})]})]})}),i.jsx(bt,{open:Y,title:Q("editor.newFolder"),description:Q("editor.folderDestination",{folder:K||Q("editor.projectRoot")}),onOpenChange:_=>{W(_),_||S("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>W(!1),children:Q("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{he()},children:Q("common.create")})]}),children:i.jsxs(i.Fragment,{children:[B&&i.jsx("p",{className:"error dialog-error",children:B}),i.jsxs("label",{className:"form-field",children:[Q("editor.folderName"),i.jsx("input",{autoFocus:!0,value:ue,onChange:_=>P(_.target.value),onKeyDown:_=>{_.key==="Enter"&&he()}})]})]})}),i.jsx(bt,{open:!!be,title:Q("editor.moveTitle",{name:be?.path.split("/").at(-1)??""}),description:Q("editor.moveDescription"),onOpenChange:_=>{_||(Fe(null),Z(""),S(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Fe(null),children:Q("common.cancel")}),i.jsx("button",{className:"primary",disabled:!Ne.trim(),onClick:()=>{I()},children:Q("editor.moveApply")})]}),children:i.jsxs(i.Fragment,{children:[B&&i.jsx("p",{className:"error dialog-error",children:B}),i.jsxs("label",{className:"form-field",children:[Q("editor.pathName"),i.jsx("input",{autoFocus:!0,value:Ne,onChange:_=>Z(_.target.value),onKeyDown:_=>{_.key==="Enter"&&I()}})]}),i.jsxs("label",{className:"form-field",children:[Q("editor.destinationFolder"),i.jsxs("select",{value:T,onChange:_=>ge(_.target.value),children:[i.jsx("option",{value:"",children:Q("editor.projectRoot")}),c.filter(_=>be?.type!=="directory"||_.path!==be.path&&!_.path.startsWith(`${be.path}/`)).map(_=>i.jsx("option",{value:_.path,children:_.path},_.path))]})]})]})}),i.jsx(bt,{open:!!X,title:Q("editor.deletePathTitle",{name:X?.path.split("/").at(-1)??""}),description:Ce.length?Q("editor.deletePathActiveDescription",{path:X?.path??"",users:[...new Set(Ce.map(_=>_.name))].join(", ")}):Q("editor.deletePathDescription",{path:X?.path??""}),onOpenChange:_=>{_||(ce(null),S(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>ce(null),children:Q("common.cancel")}),i.jsx("button",{className:"danger",onClick:()=>{se()},children:Q("common.delete")})]}),children:i.jsxs(i.Fragment,{children:[B&&i.jsx("p",{className:"error dialog-error",children:B}),Ce.length>0&&i.jsxs("p",{className:"warning",children:[i.jsx(nn,{size:15}),Q("editor.deletePathWillClose")]})]})}),i.jsxs(bt,{open:A,title:Q("editor.addComment"),description:ve.selectedText?Q("editor.commentDescription",{count:ve.endOffset-ve.startOffset}):Q("editor.pointComment"),onOpenChange:fe,footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>fe(!1),children:Q("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{Qe()},children:Q("editor.addComment")})]}),children:[i.jsxs("label",{className:"form-field",children:[Q("editor.commentContent"),i.jsx("textarea",{autoFocus:!0,rows:5,value:qe,onChange:_=>yt(_.target.value),onKeyDown:_=>{(_.ctrlKey||_.metaKey)&&_.key==="Enter"&&!_.nativeEvent.isComposing&&(_.preventDefault(),_.stopPropagation(),Qe())}})]}),ve.selectedText&&i.jsx("blockquote",{className:"selection-preview",children:ve.selectedText})]}),i.jsx(B2,{open:Xe,onOpenChange:ye,project:e,projectId:n}),i.jsx(Ld,{open:We,onOpenChange:Je,currentFile:s,currentSource:r,readOnly:l,currentUserId:t.id,maxBibtexBytes:o,onInsert:pt}),De&&i.jsx(f.Suspense,{fallback:null,children:i.jsx(R2,{open:!0,files:a,onOpenChange:Et,onOpenFile:_=>{const Ye=a.find(wt=>wt.path===_);Ye&&Oe(Ye)}})}),le&&i.jsx(f.Suspense,{fallback:null,children:i.jsx(N2,{open:!0,project:e,onOpenChange:ke,onJump:(_,Ye,wt)=>{u==="pdf-only"&&d("editor-pdf"),mt(_,Ye,wt)}})}),Ue&&i.jsx(f.Suspense,{fallback:null,children:i.jsx(L2,{open:!0,onOpenChange:z,project:e,onBeforeMutation:e.permission==="read"?async()=>!0:Ve})}),e.ownerId===t.id&&pe&&i.jsx(f.Suspense,{fallback:null,children:i.jsx(T2,{open:!0,onOpenChange:q,project:e,onBeforeMutation:Ve})})]})}function P2(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function _2({name:t,state:e,label:n,reloadLabel:s,onReload:r,compact:o=!1}){const a=e.status==="loading"?i.jsx(ut,{className:"spin",size:14}):e.status==="working"?i.jsx(yd,{size:14}):i.jsx(T0,{size:14}),c=i.jsxs(i.Fragment,{children:[a,i.jsx("strong",{children:t}),i.jsx("span",{children:n}),e.status==="error"&&i.jsxs("button",{type:"button",className:"browser-tool-reload",title:s,"aria-label":s,onClick:r,children:[i.jsx(la,{size:12}),s]})]});return o?i.jsxs("span",{className:`browser-tool-status compact ${e.status}`,role:"status","aria-live":"polite","aria-label":`${t}: ${n}`,title:e.error||void 0,children:[a,i.jsx("span",{children:n}),e.status==="error"&&i.jsx("button",{type:"button",className:"browser-tool-reload",title:s,"aria-label":s,onClick:r,children:i.jsx(la,{size:12})})]}):i.jsx("div",{className:`browser-tool-status ${e.status}`,title:e.error||void 0,children:c})}function I2({project:t,projectId:e,site:n,files:s,dictionaryWords:r,onDictionaryChange:o,editorPreferences:a,onEditorPreferences:c,spellCheckCount:l,spellCheckUniqueCount:u,spellCheckIndex:d,onSpellCheckNavigate:h,onProject:D}){const{t:m}=ot(),[g,y]=f.useState(t.engine),[b,w]=f.useState(""),[x,j]=f.useState(t.name),[N,$]=f.useState(t.mainFile),[V,U]=f.useState(null),[G,Y]=f.useState(""),[W,ue]=f.useState(""),[P,K]=f.useState(""),[B,S]=f.useState("appearance"),[R,he]=f.useState(a),be=f.useSyncExternalStore(Gt.subscribe,Gt.getSnapshot,Gt.getSnapshot),Fe=t.permission==="owner",Ne=t.permission!=="read",Z=t.permission!=="read";f.useEffect(()=>he(a),[a]),f.useEffect(()=>{Od().catch(Gt.failed)},[e]);const T=()=>{Lg().catch(Gt.failed)};f.useEffect(()=>{if(!t.latexmkrc)return w("");ne(`/api/projects/${e}/file?path=${encodeURIComponent(t.latexmkrc)}`).then(({content:A})=>w(A)).catch(A=>Y(de(A)))},[t.latexmkrc]),f.useEffect(()=>{if(B!=="compiler")return;const A=new AbortController;return U(null),ne(`/api/projects/${e}/main-files`,{signal:A.signal}).then(fe=>U(fe.mainFiles)).catch(fe=>{fe instanceof Error&&fe.name==="AbortError"||Y(de(fe))}),()=>A.abort()},[e,s,B]);const ge=V??[t.mainFile],I=V!==null&&!V.includes(N),X=async()=>{try{const A=b.trim()&&n.allowProjectLatexmkrc!==!1?".latexmkrc":null;A&&await ne(`/api/projects/${e}/file`,{method:"PUT",body:JSON.stringify({path:A,content:b})});const fe=await ne(`/api/projects/${e}`,{method:"PATCH",body:JSON.stringify({name:x,mainFile:N,engine:g,latexmkrc:A})});D(fe.project)}catch(A){Y(de(A))}},ce=()=>c(R),Ce=async()=>{const A=W.trim();if(A)try{const fe=await ne(`/api/projects/${e}/dictionary`,{method:"POST",body:JSON.stringify({word:A})});o(fe.words),ue(""),K("")}catch(fe){K(de(fe))}},se=async A=>{try{const fe=await ne(`/api/projects/${e}/dictionary/${encodeURIComponent(A)}`,{method:"DELETE"});o(fe.words),K("")}catch(fe){K(de(fe))}};return i.jsxs("div",{className:"settings padded",children:[G&&i.jsx("p",{className:"error",children:G}),i.jsxs("div",{className:"settings-tabs",role:"tablist","aria-label":m("common.settings"),children:[i.jsxs("button",{id:"settings-tab-appearance",type:"button",role:"tab","aria-selected":B==="appearance","aria-controls":"settings-panel-appearance",className:`settings-tab${B==="appearance"?" active":""}`,onClick:()=>S("appearance"),children:[i.jsx(Tl,{size:15}),m("projectSettings.editorTab")]}),i.jsxs("button",{id:"settings-tab-compiler",type:"button",role:"tab","aria-selected":B==="compiler","aria-controls":"settings-panel-compiler",className:`settings-tab${B==="compiler"?" active":""}`,onClick:()=>S("compiler"),children:[i.jsx(da,{size:15}),m("projectSettings.compilerTab")]})]}),B==="appearance"?i.jsxs("section",{id:"settings-panel-appearance",role:"tabpanel","aria-labelledby":"settings-tab-appearance",children:[i.jsxs("div",{className:"settings-section-title",children:[i.jsx(Tl,{size:15}),i.jsx("strong",{children:m("projectSettings.editorAppearance")})]}),i.jsx("p",{className:"settings-description appearance-description",children:m("projectSettings.editorAppearanceDescription")}),i.jsxs("label",{children:[m("projectSettings.fontFamily"),i.jsx("select",{value:R.font,onChange:A=>he({...R,font:A.target.value}),children:Fi.map(A=>i.jsx("option",{value:A.id,children:m(A.labelKey)},A.id))})]}),i.jsxs("label",{children:[m("projectSettings.fontSize"),i.jsx("select",{value:R.fontSize,onChange:A=>he({...R,fontSize:Number(A.target.value)}),children:[12,13,14,15,16,18,20].map(A=>i.jsxs("option",{value:A,children:[A," px"]},A))})]}),i.jsxs("label",{children:[m("projectSettings.lineHeight"),i.jsxs("select",{value:R.lineHeight,onChange:A=>he({...R,lineHeight:Number(A.target.value)}),children:[i.jsx("option",{value:1.45,children:m("projectSettings.lineHeightCompact")}),i.jsx("option",{value:1.65,children:m("projectSettings.lineHeightNormal")}),i.jsx("option",{value:1.85,children:m("projectSettings.lineHeightRelaxed")})]})]}),i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:R.lineWrapping,onChange:A=>he({...R,lineWrapping:A.target.checked})}),i.jsx(ig,{size:15}),i.jsx("span",{children:m("projectSettings.lineWrapping")})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:R.spellCheck,onChange:A=>he({...R,spellCheck:A.target.checked})}),i.jsx("span",{children:m("projectSettings.spellCheck")})]}),i.jsxs("p",{className:"field-hint",children:[m("projectSettings.writingCheckDescription")," ",i.jsx("a",{href:"https://writewithharper.com/docs/integrations/language-server",target:"_blank",rel:"noreferrer",children:"Harper"})]})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:R.vimMode,onChange:A=>he({...R,vimMode:A.target.checked})}),i.jsx("span",{children:m("projectSettings.vimMode")})]}),i.jsxs("p",{className:"field-hint",children:[m("projectSettings.vimModeDescription")," ",i.jsx("a",{href:"https://replit-codemirror-vim.mintlify.app/",target:"_blank",rel:"noreferrer",children:m("projectSettings.vimHelp")})]})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:R.openFilesInTabs,onChange:A=>he({...R,openFilesInTabs:A.target.checked})}),i.jsx(W0,{size:15}),i.jsx("span",{children:m("projectSettings.openFilesInTabs")})]}),i.jsx("p",{className:"field-hint",children:m("projectSettings.openFilesInTabsDescription")})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",disabled:!Ne,checked:R.formatOnCompile,onChange:A=>he({...R,formatOnCompile:A.target.checked})}),i.jsx(Fd,{size:15}),i.jsx("span",{children:m("projectSettings.formatOnCompile")})]}),i.jsxs("p",{className:"field-hint",children:[m(Ne?"projectSettings.formatOnCompileDescription":"projectSettings.formatRequiresWrite")," ",m("projectSettings.formatterDescription")," ",i.jsx("a",{href:"https://www.npmjs.com/package/tex-fmt",target:"_blank",rel:"noreferrer",children:m("projectSettings.formatterInstall")})," · ",i.jsx("a",{href:"https://github.com/FlamingTempura/bibtex-tidy",target:"_blank",rel:"noreferrer",children:m("projectSettings.bibtexTidyInstall")})]})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"tex-fmt-options-field",children:[i.jsxs("span",{className:"tex-fmt-options-heading",children:[i.jsx("span",{children:m("projectSettings.texFmtOptions")}),i.jsx(_2,{compact:!0,name:"tex-fmt",state:be,label:m(`projectSettings.toolStatus.${be.status}`),reloadLabel:m("projectSettings.reloadTool"),onReload:T})]}),i.jsx("textarea",{className:"tex-fmt-options-editor",rows:6,maxLength:16*1024,spellCheck:!1,value:R.texFmtConfig,placeholder:m("projectSettings.texFmtOptionsPlaceholder"),onChange:A=>he({...R,texFmtConfig:A.target.value})})]}),i.jsx("p",{className:"field-hint",children:m("projectSettings.texFmtOptionsDescription")})]}),l!==null&&i.jsxs("div",{className:`spell-check-result${l?" has-issues":""}`,role:"status","aria-live":"polite",children:[i.jsx(ng,{size:14}),i.jsx("span",{children:l?m("projectSettings.writingIssues",{count:l,uniqueCount:u??0}):m("projectSettings.noWritingIssues")}),l>0&&i.jsxs("span",{className:"spell-check-controls",children:[i.jsx("button",{type:"button",title:m("projectSettings.spellCheckFirst"),"aria-label":m("projectSettings.spellCheckFirst"),disabled:d<=0,onClick:()=>h(0),children:i.jsx(j0,{size:14})}),i.jsx("button",{type:"button",title:m("projectSettings.spellCheckPrevious"),"aria-label":m("projectSettings.spellCheckPrevious"),disabled:d<=0,onClick:()=>h(d-1),children:i.jsx(br,{size:14})}),i.jsx("span",{className:"spell-check-position",children:m("projectSettings.spellCheckPosition",{current:Math.min(d+1,l),total:l})}),i.jsx("button",{type:"button",title:m("projectSettings.spellCheckNext"),"aria-label":m("projectSettings.spellCheckNext"),disabled:d>=l-1,onClick:()=>h(d+1),children:i.jsx(Mi,{size:14})}),i.jsx("button",{type:"button",title:m("projectSettings.spellCheckLast"),"aria-label":m("projectSettings.spellCheckLast"),disabled:d>=l-1,onClick:()=>h(l-1),children:i.jsx(B0,{size:14})})]})]}),i.jsxs("div",{className:"settings-section-title",children:[i.jsx(Va,{size:15}),i.jsx("strong",{children:m("projectSettings.dictionary")})]}),i.jsx("p",{className:"settings-description",children:m("projectSettings.dictionaryDescription")}),P&&i.jsx("p",{className:"error dictionary-error",children:P}),Z&&i.jsxs("div",{className:"dictionary-add",children:[i.jsx("input",{value:W,placeholder:m("projectSettings.dictionaryPlaceholder"),onChange:A=>ue(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),Ce())}}),i.jsx("button",{type:"button",disabled:!W.trim(),onClick:()=>{Ce()},children:m("projectSettings.addWord")})]}),i.jsxs("div",{className:"dictionary-words",children:[r.map(A=>i.jsxs("span",{className:"dictionary-word",children:[i.jsx("code",{children:A}),Z&&i.jsx("button",{type:"button",title:m("common.delete"),"aria-label":`${m("common.delete")} ${A}`,onClick:()=>{se(A)},children:i.jsx(Ht,{size:13})})]},A)),r.length===0&&i.jsx("span",{className:"dictionary-empty",children:m("projectSettings.dictionaryEmpty")})]}),i.jsx("div",{className:"settings-actions",children:i.jsxs("button",{className:"settings-save",onClick:ce,children:[i.jsx(Di,{size:15}),m("projectSettings.saveAppearance")]})})]}):i.jsxs("section",{id:"settings-panel-compiler",role:"tabpanel","aria-labelledby":"settings-tab-compiler",children:[i.jsxs("div",{className:"settings-section-title",children:[i.jsx(da,{size:15}),i.jsx("strong",{children:m("projectSettings.compilerTab")})]}),i.jsx("p",{className:"settings-description compiler-description",children:m("projectSettings.compilerDescription")}),i.jsxs("label",{children:[m("projects.name"),i.jsx("input",{disabled:!Fe,value:x,onChange:A=>j(A.target.value)})]}),i.jsxs("label",{children:[m("projectSettings.mainFile"),i.jsxs("select",{disabled:!Fe||V===null||V.length===0,value:N,onChange:A=>$(A.target.value),children:[I&&i.jsx("option",{value:N,disabled:!0,children:m("projectSettings.invalidMainFileOption",{path:N})}),ge.map(A=>i.jsx("option",{value:A,children:A},A))]})]}),i.jsxs("label",{children:[m("projectSettings.engine"),i.jsx("select",{disabled:!Fe,value:g,onChange:A=>y(A.target.value),children:(n.allowedEngines??["pdflatex","xelatex","lualatex"]).map(A=>i.jsx("option",{children:A},A))})]}),i.jsxs("label",{children:[m("projectSettings.latexmkrc"),i.jsx("textarea",{className:"latexmkrc-editor",rows:10,spellCheck:!1,disabled:!Fe||n.allowProjectLatexmkrc===!1,value:b,placeholder:m("projectSettings.latexmkrcPlaceholder"),onChange:A=>w(A.target.value)})]}),i.jsx("div",{className:"settings-actions",children:Fe&&i.jsxs("button",{className:"settings-save",onClick:()=>{X()},children:[i.jsx(Di,{size:15}),m("projectSettings.saveCompiler")]})})]})]})}function M2({sidePanel:t,onClose:e,project:n,projectId:s,site:r,files:o,currentUserId:a,comments:c,onFocusComment:l,onToggleComment:u,onReplyComment:d,onEditComment:h,onDeleteComment:D,onEditCommentReply:m,onDeleteCommentReply:g,dictionaryWords:y,onDictionaryChange:b,editorPreferences:w,onEditorPreferences:x,spellCheckCount:j,spellCheckUniqueCount:N,spellCheckIndex:$,onSpellCheckNavigate:V,onProject:U}){const{t:G}=ot();return t?i.jsxs(i.Fragment,{children:[i.jsx(Ta,{className:"resize-handle"}),i.jsx(Oi,{id:"context",order:4,defaultSize:20,minSize:15,maxSize:38,children:i.jsxs("aside",{className:"context-panel",children:[i.jsxs("div",{className:"drawer-title",children:[i.jsx("strong",{children:G(t==="comments"?"editor.sourceComments":"editor.projectSettings")}),i.jsx("button",{"aria-label":G("common.close"),onClick:e,children:i.jsx(Ht,{size:17})})]}),t==="comments"&&i.jsxs("div",{className:"comments",children:[c.map(Y=>i.jsx(j2,{comment:Y,currentUserId:a,onFocus:()=>l(Y),onToggle:()=>{u(Y)},onReply:W=>d(Y,W),onEdit:W=>h(Y,W),onDelete:()=>D(Y),onEditReply:(W,ue)=>m(Y,W,ue),onDeleteReply:W=>g(Y,W)},Y.id)),c.length===0&&i.jsx("p",{className:"muted padded",children:G("editor.noComments")})]}),t==="settings"&&i.jsx(I2,{project:n,projectId:s,site:r,files:o,dictionaryWords:y,onDictionaryChange:b,editorPreferences:w,onEditorPreferences:x,spellCheckCount:j,spellCheckUniqueCount:N,spellCheckIndex:$,onSpellCheckNavigate:V,onProject:U})]})})]}):null}function hr(t){return t instanceof Error&&t.name==="AbortError"}function $2({site:t,user:e,projectId:n,preload:s,onBack:r}){const{t:o}=ot(),[a,c]=f.useState(null),[l,u]=f.useState(!1),[d,h]=f.useState([]),[D,m]=f.useState(null),[g,y]=f.useState([]),[b,w]=f.useState(""),[x,j]=f.useState(""),[N,$]=f.useState(new Set),[V,U]=f.useState(""),[G,Y]=f.useState(""),[W,ue]=f.useState(!1),[P,K]=f.useState("editor.saved"),[B,S]=f.useState(null),R=f.useRef(B);R.current=B;const[he,be]=f.useState({line:1,column:1}),Fe=f.useRef(he),Ne=f.useRef(0),[Z,T]=f.useState("pdf"),[ge,I]=f.useState("log"),X=v=>{if(v==="pdf"){T("pdf");return}if(v==="diagnostics"){T("diagnostics");return}I(v),T("diagnostics")},{workspaceLayout:ce,setWorkspaceLayout:Ce}=p2(e.id,n),[se,A]=f.useState(""),[fe,ve]=f.useState(""),[qe,yt]=f.useState({selectedText:"",startOffset:0,endOffset:0}),Qe=f.useRef({selectedText:"",startOffset:0,endOffset:0}),Xe=v=>{Qe.current=v,yt(v)},[ye,We]=f.useState(null),[Je,pt]=f.useState(!1),[De,Et]=f.useState(!1),[le,ke]=f.useState(!1),[Oe,mt]=f.useState(!1),[Ue,z]=f.useState(!1),[pe,q]=f.useState(null),[Ve,Ge]=f.useState(!1),[st,Ee]=f.useState(!1),[dt,Q]=f.useState(!1),[_,Ye]=f.useState(null),[wt,At]=f.useState(""),[ht,on]=f.useState(!1),[at,an]=f.useState(()=>Pl(e.id,n)),[k,re]=f.useState([]),te=f.useRef([]);te.current=k;const Te=f.useRef(null),Rt=f.useRef(null),jt=f.useRef(0),p=f.useRef(0),E=f.useRef(""),F=f.useRef(""),O=f.useRef(""),H=f.useRef(0),ee=f.useRef(null),L=f.useRef(null),we=f.useRef(null),ae=f.useRef(null),Re=f.useRef(!1),Ae=f.useRef(null),je=f.useRef(r);je.current=r,O.current=x,f.useEffect(()=>{if(!fe)return;const v=window.setTimeout(()=>ve(""),3e3);return()=>window.clearTimeout(v)},[fe]);const Ze=(v,M,ie=0)=>{const J={line:v,column:M};Fe.current=J,Ne.current=ie,be(J)},Dt=v=>{const M=te.current,ie=v(M);ie!==M&&(te.current=ie,re(ie))};f.useEffect(()=>{te.current=[],re([]),Ye(null),At("")},[n]);const Jt=v=>{const M=te.current,ie=M.indexOf(v);if(ie<0)return;const J=M.filter($e=>$e!==v);if(te.current=J,re(J),F.current!==v)return;const Le=J.length>0?J[Math.min(ie,J.length-1)]:a?.mainFile??"";w(Le)},{collaboration:Pe,status:et,synced:ze,activeSessions:kt,formatLeaseStates:Ut,compileState:ft,setCompileState:He,filesEvent:tt,commentsRevision:Xn,dictionaryRevision:ms,localDraftReady:pn,permission:On,reconnect:Pn,protocolUpgradeRequired:vn,permissionDowngrade:Jn,dismissPermissionDowngrade:sr,discardLocalDraft:Qi}=i2(n,e,x,a?.permission??"read",l,()=>K("editor.offlineDraft")),{pdfTarget:eo,pdfViewport:qr,sourceJump:Kr,setPdfViewport:to,clearPdfViewport:rr,jumpToSource:ir,syncSourceToPdf:or,syncPdfToSource:Wr,syncVisiblePdfToSource:no}=f2({projectId:n,mainFile:x,activeFile:b,onActiveFile:w,onError:A,onShowPdf:()=>X("pdf")}),It=h2({active:!!(a&&b&&ze&&at.spellCheck),projectId:n,activeFile:b,content:V,dictionaryWords:d});f.useEffect(()=>{an(Pl(e.id,n))},[e.id,n]);const ar=v=>{E.current=v,U(v)};f.useEffect(()=>{if(F.current=b,Fe.current={line:1,column:1},Ne.current=0,be({line:1,column:1}),Xe({selectedText:"",startOffset:0,endOffset:0}),!at.openFilesInTabs){te.current.length>0&&(te.current=[],re([]));return}b&&Dt(v=>v.includes(b)?v:[...v,b])},[b,at.openFilesInTabs,n]),f.useEffect(()=>{if(!W)return;const v=M=>{M.preventDefault(),M.returnValue=""};return window.addEventListener("beforeunload",v),()=>window.removeEventListener("beforeunload",v)},[W]),f.useEffect(()=>{if(et!=="disconnected")return;const v=new AbortController;return ne(`/api/projects/${n}`,{signal:v.signal}).then(({project:M})=>{v.signal.aborted||(c(M),A(""))}).catch(M=>{if(!hr(M)){if(M instanceof Un&&[401,403,404].includes(M.status)){A(de(M)),je.current();return}A(o("errors.collaborationUnavailable"))}}),()=>v.abort()},[et,n,o]);const C=async(v={})=>{ee.current?.abort(),ee.current=null;const M=v.signal?null:new AbortController;M&&(ee.current=M);try{const ie=await ne(`/api/projects/${n}/completions`,{signal:v.signal??M?.signal});(!v.isCurrent||v.isCurrent())&&m(ie.index)}catch(ie){if(hr(ie))return;(!v.isCurrent||v.isCurrent())&&m(null)}finally{M&&ee.current===M&&(ee.current=null)}},Ie=async(v={},M=O.current)=>{L.current?.abort(),L.current=null;const ie=v.signal?null:new AbortController;ie&&(L.current=ie);try{const J=M?`?mainFile=${encodeURIComponent(M)}`:"",Le=await ne(`/api/projects/${n}/outline${J}`,{signal:v.signal??ie?.signal});(!v.isCurrent||v.isCurrent())&&y(Le.outline)}catch(J){!hr(J)&&(!v.isCurrent||v.isCurrent())&&y([])}finally{ie&&L.current===ie&&(L.current=null)}},Me=async(v={})=>{we.current?.abort(),we.current=null;const M=v.signal?null:new AbortController;M&&(we.current=M);try{const ie=await ne(`/api/projects/${n}/dictionary`,{signal:v.signal??M?.signal});(!v.isCurrent||v.isCurrent())&&h(ie.words)}catch(ie){if(hr(ie))return;(!v.isCurrent||v.isCurrent())&&h([])}finally{M&&we.current===M&&(we.current=null)}};f.useEffect(()=>{let v=!1;const M=++H.current,ie=new AbortController,J=()=>!v&&H.current===M;let Le=!1;c(null),jc([]),y([]),w(""),j(""),$(new Set),U(""),Y(""),He(null),rr(),m(null),h([]),_i();const $e=(s?.projectId===n?s.project:ne(`/api/projects/${n}`,{signal:ie.signal})).then(Pt=>{J()&&(Le=!0,c(Pt.project),w(Pt.project.mainFile),j(Pt.project.mainFile),$(new Set),_c(new Set(Dr(Pt.project.mainFile))))}).catch(Pt=>{J()&&A(de(Pt))}),xe=ne(`/api/projects/${n}/files`,{signal:ie.signal}).then(Pt=>{J()&&jc(Pt.files)}).catch(Pt=>{J()&&A(de(Pt))});let Zt=null;return Promise.allSettled([$e,xe]).then(()=>{!J()||!Le||(Zt=window.setTimeout(()=>{J()&&Promise.all([C({signal:ie.signal,isCurrent:J}),Me({signal:ie.signal,isCurrent:J})])},0))}),()=>{v=!0,Zt!==null&&window.clearTimeout(Zt),ie.abort(),ee.current?.abort(),ee.current=null,L.current?.abort(),L.current=null,we.current?.abort(),we.current=null,ae.current?.abort(),ae.current=null}},[n,s]),f.useEffect(()=>{ms&&Me()},[ms,n]),f.useEffect(()=>{!a||et!=="connected"||On===a.permission||c(v=>v&&{...v,permission:On})},[On,a?.permission]),f.useEffect(()=>{if(!tt)return;const v=tt.kind==="delete"&&!!tt.path&&ts(tt.path,F.current),M=tt.kind==="delete"&&!!tt.path&&ts(tt.path,O.current);if(tt.kind==="move"&&tt.source&&tt.destination){const J=tt.source,Le=tt.destination,$e=xe=>xe===J?Le:xe.startsWith(`${J}/`)?`${Le}${xe.slice(J.length)}`:xe;w(xe=>$e(xe)),j(xe=>$e(xe)),$(xe=>new Set([...xe].map($e))),ro(xe=>xe&&$e(xe)),Dt(xe=>xe.map($e))}v&&(w(""),Y(""),ar(""),ve(o("editor.fileDeletedByCollaborator",{path:tt.path}))),tt.kind==="delete"&&tt.path&&($(J=>new Set([...J].filter(Le=>!ts(tt.path,Le)))),ro(J=>ts(tt.path,J)?"":J),Lc(J=>J&&ts(tt.path,J.path)?null:J),Dt(J=>J.filter(Le=>!ts(tt.path,Le)))),ae.current?.abort();const ie=new AbortController;ae.current=ie,Promise.all([Ff({signal:ie.signal}),ne(`/api/projects/${n}`,{signal:ie.signal})]).then(([J,Le])=>{if(c(Le.project),M&&j(Le.project.mainFile),v&&J){const $e=J.find(xe=>xe.type==="file"&&xe.path===Le.project.mainFile)??J.find(xe=>xe.type==="file"&&Ms(xe.path));w($e?.path??"")}C({signal:ie.signal}),Ie({signal:ie.signal},M?Le.project.mainFile:O.current)}).catch(J=>{hr(J)}).finally(()=>{ae.current===ie&&(ae.current=null)})},[tt?.revision]),f.useEffect(()=>{if(Pe.setActiveFile(b),!b)return;Y(""),K("editor.loading");const v=Pe.getText(b),M=(ie,J)=>{ar(v.toString()),Y(b),J?.local&&a?.permission!=="read"?(jt.current+=1,ue(!0),K("editor.pending")):jt.current<=p.current&&K(R.current?"editor.savedAt":"editor.saved")};return v.observe(M),(ze||pn)&&M(),()=>{v.unobserve(M)}},[b,Pe,ze,pn,a?.permission]);const ct=async()=>{if(!ze)throw new Error("Collaboration is not synchronized");const v=jt.current,M=await Pe.flush();return p.current=Math.max(p.current,v),S(M.persistedAt),/\.tex$/i.test(F.current)&&Ie(),jt.current===v?(ue(!1),K("editor.savedAt")):K("editor.pending"),M};f.useEffect(()=>{if(!W||!b)return;if(!ze){K("editor.offlineDraft");return}K("editor.pending");const v=window.setTimeout(()=>{K("editor.saving"),ct().catch(()=>{K(Pe.connected?"editor.saveFailed":"editor.offlineDraft")})},750);return()=>window.clearTimeout(v)},[V,W,b,ze]);const xt=async()=>{if(!a||a.permission==="read"||!ze||!b)return!1;K("editor.saving");try{return await ct(),C(),!0}catch(v){return K("editor.saveFailed"),A(de(v)||o("errors.collaborationUnavailable")),!1}},Ot=async(v,M,ie=at.texFmtConfig)=>{if(/\.bib$/i.test(v))try{return{formatted:dg(M,t.maxCitationBibtexBytes),diagnostics:""}}catch(Le){throw Le instanceof pa?Le.kind==="too-large"?new Error(o("citationLibrary.fileTooLarge",{size:ma(t.maxCitationBibtexBytes)})):new Error(o("citationLibrary.fileInvalid")):Le}const J=await Tg(M,ie);return{formatted:J.output,diagnostics:J.logs.trim()}},Zn=async v=>{if(!a||a.permission==="read"||!ze||Re.current||!si(F.current))return;const M=F.current,ie=Pe.getText(M);Re.current=!0,Q(!0);let J=()=>{};const Le=new Promise(xe=>{J=xe});Ae.current=Le,At("");let $e=null;try{$e=await Pe.acquireFormatLease(M);const xe=ie.toString(),{formatted:Zt,diagnostics:Pt}=await Ot(M,xe,v);if(F.current!==M||ie.toString()!==xe){A(o("editor.formatSourceChanged"));return}await $e.confirm();const cn=await So(xe,Zt);if(F.current!==M||ie.toString()!==xe){A(o("editor.formatSourceChanged"));return}if(await $e.confirm(),F.current!==M||ie.toString()!==xe){A(o("editor.formatSourceChanged"));return}cn.length&&Pe.applyTextEdits(M,cn),cn.length&&await ct(),Ye(null),At(Pt),A(""),ve(o("editor.formatFileComplete"))}catch(xe){ko(xe)?(Ye({action:"file",kind:xe.kind,detail:xe.message}),A("")):A(o("editor.formatFileFailed",{message:de(xe)}))}finally{$e&&await $e.release(),Re.current=!1,Q(!1),J(),Ae.current===Le&&(Ae.current=null)}},Ds=async()=>{if(!at.formatOnCompile||!a||a.permission==="read"||!ze||!si(F.current)||Re.current)return;const v=F.current,M=Pe.getText(v);Re.current=!0,Q(!0),At("");let ie=null;try{ie=await Pe.acquireFormatLease(v);const J=M.toString(),{formatted:Le,diagnostics:$e}=await Ot(v,J);await ie.confirm();const xe=await So(J,Le);if(F.current!==v||M.toString()!==J)throw new Error(o("editor.formatSourceChanged"));if(await ie.confirm(),F.current!==v||M.toString()!==J)throw new Error(o("editor.formatSourceChanged"));xe.length&&Pe.applyTextEdits(v,xe),xe.length&&await Pe.flush(),Ye(null),At($e)}catch(J){ko(J)?(Ye({action:"file",kind:J.kind,detail:J.message}),A("")):A(o("editor.formatFailedContinue",{message:de(J)}))}finally{ie&&await ie.release(),Re.current=!1,Q(!1)}},gs=async()=>(Ae.current&&await Ae.current,await Ds(),xt()),An=async v=>{if(!a||a.permission==="read"||!ze||Re.current||!si(F.current))return;const M=Qe.current;if(!M.selectedText.trim()){ve(o("editor.formatSelectionRequired"));return}const ie=F.current,{startOffset:J,endOffset:Le,selectedText:$e}=M,xe=Pe.getText(ie);if(xe.toString().slice(J,Le)!==$e){A(o("editor.formatSelectionChanged"));return}Re.current=!0,Q(!0);let Zt=()=>{};const Pt=new Promise(kn=>{Zt=kn});Ae.current=Pt,At("");let cn=null;try{if(cn=await Pe.acquireFormatLease(ie),xe.toString().slice(J,Le)!==$e){A(o("editor.formatSelectionChanged"));return}const tl=await Ot(ie,$e,v),wp=Rg($e,tl.formatted);await cn.confirm();const mo=await So($e,wp,J);if(F.current!==ie||xe.toString().slice(J,Le)!==$e){A(o("editor.formatSelectionChanged"));return}if(await cn.confirm(),F.current!==ie||xe.toString().slice(J,Le)!==$e){A(o("editor.formatSelectionChanged"));return}mo.length&&Pe.applyTextEdits(ie,mo),mo.length&&await ct(),Ye(null),At(tl.diagnostics),A(""),ve(o("editor.formatSelectionComplete"))}catch(kn){ko(kn)?(Ye({action:"selection",kind:kn.kind,detail:kn.message}),A("")):A(o("editor.formatFailed",{message:de(kn)}))}finally{cn&&await cn.release(),Re.current=!1,Q(!1),Zt(),Ae.current===Pt&&(Ae.current=null)}},so=v=>{const M=F.current;if(!/\.bib$/i.test(M)||a?.permission==="read"||!ze)return ve(o("citationLibrary.importRequiresWrite")),!1;const J=Pe.getText(M).toString(),Le=jd(J,t.maxCitationBibtexBytes);if(Le.status==="too-large")return ve(o("citationLibrary.fileTooLarge",{size:ma(t.maxCitationBibtexBytes)})),!1;if(Le.status==="invalid")return ve(o("citationLibrary.fileInvalid")),!1;if(Le.entries.some(kn=>kn.citationKey.toLowerCase()===v.citationKey.toLowerCase()))return ve(o("citationErrors.alreadyInFile",{key:v.citationKey})),!1;const $e=Math.max(0,Math.min(J.length,Ne.current)),xe=J.slice(0,$e),Zt=J.slice($e),Pt=xe?xe.endsWith(`
|
|
52
|
-
|
|
53
|
-
`)?"":xe.endsWith(`
|
|
54
|
-
`)?`
|
|
55
|
-
`:`
|
|
56
|
-
|
|
57
|
-
`:"",cn=Zt?Zt.startsWith(`
|
|
58
|
-
|
|
59
|
-
`)?"":Zt.startsWith(`
|
|
60
|
-
`)?`
|
|
61
|
-
`:`
|
|
62
|
-
|
|
63
|
-
`:"";return Pe.applyTextEdits(M,[{from:$e,to:$e,replacement:`${Pt}${v.bibtex.trim()}${cn}`}]),ve(o("citationLibrary.imported",{key:v.citationKey})),!0},{files:mn,setFiles:jc,loadFiles:Ff,newFileOpen:bf,setNewFileOpen:Bc,newFilePath:yf,setNewFilePath:Tc,resourcePreview:Cf,setResourcePreview:Lc,resourcePreviewLoading:Ef,setResourcePreviewLoading:wf,newFolderOpen:xf,setNewFolderOpen:Nc,newFolderName:vf,setNewFolderName:Rc,fileDialogError:Af,setFileDialogError:Oc,selectedFolder:Pc,setSelectedFolder:ro,expandedFolders:kf,setExpandedFolders:_c,moveEntry:Sf,setMoveEntry:Ic,moveName:jf,setMoveName:Mc,moveDestination:Bf,setMoveDestination:$c,deleteEntry:io,setDeleteEntry:Uc,fileDragActive:Tf,setFileDragActive:Lf,uploadConflict:Nf,setUploadConflict:Rf,uploadingFiles:Of,directoryEntries:Pf,visibleEntries:_f,createFile:If,createFolder:Mf,uploadFiles:zc,upload:$f,openFile:oo,movePath:Uf,removePath:zf}=d2({projectId:n,site:t,activeFile:b,dirty:W,save:xt,onError:A,onProject:c,onActiveFile:w,onActiveMainFile:j,onRootDocuments:$});f.useEffect(()=>{if(!b||G!==b||!b.toLocaleLowerCase().endsWith(".tex"))return;const v=mn.filter(Le=>Le.type==="file"&&/\.tex$/i.test(Le.path)).length;if(v===0)return;const M=b===a?.mainFile,J=m2(V)||v===1;$(Le=>{if(Le.has(b)===J)return Le;const $e=new Set(Le);return J?$e.add(b):$e.delete(b),$e}),J&&!M&&O.current!==b?j(b):!J&&O.current===b&&a?.mainFile&&j(a.mainFile)},[b,G,V,mn,a?.mainFile]),f.useEffect(()=>{if(!at.openFilesInTabs||mn.length===0)return;const v=new Set(mn.filter(M=>M.type==="file"&&Ms(M.path)).map(M=>M.path));Dt(M=>{const ie=M.filter(J=>v.has(J));return ie.length===M.length?M:ie})},[mn,at.openFilesInTabs]);const{comments:Gr,focusComment:Hf,setFocusComment:Hc,commentOpen:Vf,setCommentOpen:Vc,commentText:qf,setCommentText:Kf,addComment:Wf,toggleComment:Gf,replyToComment:Yf,editComment:Xf,deleteComment:Jf,editCommentReply:Zf,deleteCommentReply:Qf}=$g({projectId:n,activeFile:b,permission:a?.permission,revision:Xn,selection:qe,save:xt,onError:A,onAdded:()=>We("comments")}),{pdfUrl:_n,pdfCompiledAt:cr,pdfLoadingMode:ep,pdfLoading:ao,compileLog:co,compileDiagnostics:tp,compileOutcome:lr,artifacts:qc,artifactPreview:np,artifactLoading:sp,editorNotice:rp,localCompiling:Kc,cancelling:ip,cleaning:Wc,compile:op,cancelCompile:ap,cleanCompile:Gc,viewArtifact:cp}=a2({projectId:n,project:a,mainFile:x,initialLatest:s?.projectId===n?s.latestCompile:null,collaborationSynced:ze,sharedState:ft,onSharedState:He,save:gs,loadOutline:(v,M)=>Ie({signal:v},M),onPreviewTab:X,onError:A,onCompileStart:()=>{A(""),ve("")},onCompileSuccess:()=>{const v=F.current;v&&or(v,Fe.current.line,Fe.current.column,{silent:!0})},onPdfChanged:rr});f.useEffect(()=>{if(!a||!x||!_n&&ao)return;const v=window.setTimeout(()=>u(!0),_n?150:0);return()=>window.clearTimeout(v)},[a,ao,_n]),f.useEffect(()=>{const v=M=>{(M.ctrlKey||M.metaKey)&&(!M.shiftKey&&M.key.toLocaleLowerCase()==="p"?(M.preventDefault(),Ge(!0)):M.shiftKey&&M.key.toLocaleLowerCase()==="f"&&(M.preventDefault(),Ee(!0)))};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[]);const Yc=v=>{an(v),Ag(e.id,n,v)},Xc=(v=!1)=>{const M=_;if(!M)return;Ye(null),At(""),A(""),v&&Yc({...at,texFmtConfig:""});const ie=v?"":void 0;M.action==="selection"?An(ie):Zn(ie)},lp=async()=>{on(!0);try{await Qi()||(A(o("editor.collaboration.permissionDowngradeOtherTabBlocked")),on(!1))}catch(v){A(de(v)),on(!1)}},Jc=()=>{Rt.current?.isCollapsed()?Rt.current.expand():Rt.current?.collapse()},up=f.useMemo(()=>g.length?g:U2(V).map(v=>({...v,path:b})),[g,V,b]),lo=f.useMemo(()=>Og(co,lr),[co,lr]),Fs=ce!=="pdf-only",Zc=ce!=="editor-only",uo=v=>{Ce(v),v==="pdf-only"&&X("pdf")},dp=io?kt.filter(v=>v.filePath&&ts(io.path,v.filePath)):[];if(!a)return i.jsxs("div",{className:"center-card",children:[i.jsx("p",{children:se||o("common.loading")}),se&&i.jsx("button",{className:"primary",onClick:r,children:o("editor.backToProjects")})]});const In=a.permission==="read"||!ze,ho=Ut.find(v=>v.path===b),fo=ho&&!dt?ho:null,hp=(v,M)=>{if(In)return;const ie=F.current;if(!ie)return;if(Pe.getText(ie).toString().slice(v.from,v.to)!==v.word){A(o("editor.spellCheckSourceChanged"));return}try{Pe.applyTextEdits(ie,[{from:v.from,to:v.to,replacement:M}])}catch($e){A(de($e))}},po=ft?.mainFile===x&&(ft.status==="queued"||ft.status==="running"),Yr=Kc||po||Wc,fp=b?Pe.getText(b):null,pp=cr?new Date(cr).toLocaleString(Ke.resolvedLanguage,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"",mp=x.split("/").at(-1)??x,Dp=lo.warnings.length+lo.errors.length+qc.length,gp=_n?`${_n}${_n.includes("?")?"&":"?"}download=1`:"",Fp=x||a.mainFile,bp=!!(b&&b===Fp&&/\.tex$/i.test(b)),Qc=v=>{const M=mn.find(ie=>ie.path===v);M&&Ms(M.path)?oo(M):Jt(v)},yp=v=>{document.getElementById(`editor-tab-${encodeURIComponent(v)}`)?.focus()},Cp=(v,M)=>{if(!["ArrowLeft","ArrowRight","Home","End"].includes(v.key))return;v.preventDefault();const ie=v.key==="Home"?0:v.key==="End"?k.length-1:(M+(v.key==="ArrowLeft"?-1:1)+k.length)%k.length,J=k[ie];J&&(Qc(J),window.requestAnimationFrame(()=>yp(J)))},el=Yr?po?ft?.status==="queued"?o("editor.compileQueued"):o("editor.compilingBy",{name:ft?.requestedBy.name??o("common.user")}):o("editor.compiling"):lr==="failed"?_n&&cr?o("editor.compileFailedRetained",{time:new Date(cr).toLocaleString(Ke.resolvedLanguage)}):o("editor.compileFailedNoPdf"):lr==="cancelled"?o("compileControls.cancelled"):"",Ep=P==="editor.savedAt"&&B?o("editor.savedAt",{time:new Date(B).toLocaleTimeString(Ke.resolvedLanguage,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}):o(P);return i.jsxs("div",{className:"workspace",children:[i.jsx(F2,{site:t,project:a,activeFile:b,saveStateLabel:Ep,editorPreferences:at,activeSessions:kt,collaborationStatus:et,reconnectCollaboration:Pn,protocolUpgradeRequired:vn,showEditor:Fs,filesCollapsed:Je,toggleFilesPanel:Jc,workspaceLayout:ce,changeWorkspaceLayout:uo,onBack:r,onShare:()=>Et(!0),showCitationLibrary:Fs&&/\.bib$/i.test(b),citationLibraryOpen:Ue,onCitationLibrary:()=>z(!0),onHistory:()=>mt(!0),onGit:()=>ke(!0),canManageGit:a.ownerId===e.id,formatting:dt,canFormat:si(b),readOnly:In,collaborationSynced:ze,activeFormatLease:!!ho,onFormatFile:()=>{Zn()},onFormatSelection:()=>{An()},hasSelection:!!qe.selectedText.trim(),onAddComment:()=>Vc(!0),onToggleComments:()=>We(ye==="comments"?null:"comments"),commentsOpen:ye==="comments",unresolvedCommentCount:Gr.filter(v=>!v.resolved).length,hasActiveFile:!!b,onToggleSettings:()=>We(ye==="settings"?null:"settings"),settingsOpen:ye==="settings",compileBusy:Yr,sharedCompiling:po,localCompiling:Kc,cancelling:ip,compileState:ft,onCompile:op,onCancelCompile:()=>{ap()}}),vn&&i.jsxs("div",{className:"workspace-update-banner",role:"alert",children:[i.jsx(nn,{size:15}),i.jsx("span",{children:o("workspaceUpdates.protocolUpgrade")}),i.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:o("common.reload")})]}),el&&i.jsxs("div",{className:`compile-status-strip${lr==="failed"?" failed":""}`,role:"status","aria-live":"polite",children:[i.jsx(ut,{className:Yr?"spin":"",size:14}),i.jsx("span",{children:el})]}),(It.error||_||wt||fo)&&i.jsxs("div",{className:"client-tool-recoveries",children:[It.error&&i.jsxs("div",{className:"client-tool-recovery",role:"alert",title:It.error,children:[i.jsx(nn,{size:15}),i.jsxs("span",{children:[i.jsx("strong",{children:o("editor.harperRecoveryTitle")}),o("editor.harperFallbackHint")]}),i.jsx("div",{className:"client-tool-recovery-actions",children:i.jsx("button",{type:"button",onClick:It.retry,children:o("common.retry")})}),i.jsx("button",{type:"button",className:"formatter-diagnostics-dismiss",title:o("common.close"),"aria-label":o("common.close"),onClick:It.dismissError,children:i.jsx(Ht,{size:13})})]}),_&&i.jsxs("div",{className:"client-tool-recovery",role:"alert",title:_.detail,children:[i.jsx(nn,{size:15}),i.jsxs("span",{children:[i.jsx("strong",{children:o(_.kind==="format"?"editor.texFmtOptionsRecoveryTitle":_.kind==="load"?"editor.texFmtRecoveryTitle":"editor.texFmtRuntimeRecoveryTitle")}),o("editor.clientToolRecoveryHint")]}),i.jsxs("div",{className:"client-tool-recovery-actions",children:[i.jsx("button",{type:"button",disabled:dt||In,onClick:()=>Xc(),children:o("common.retry")}),_.kind==="format"&&at.texFmtConfig.trim()&&i.jsx("button",{type:"button",disabled:dt||In,onClick:()=>Xc(!0),children:o("editor.resetFormatterOptions")}),i.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:o("common.reload")})]}),i.jsx("button",{type:"button",className:"formatter-diagnostics-dismiss",title:o("common.close"),"aria-label":o("common.close"),onClick:()=>Ye(null),children:i.jsx(Ht,{size:13})})]}),wt&&i.jsxs("div",{className:"client-tool-recovery formatter-diagnostics",role:"status",children:[i.jsx(nn,{size:15}),i.jsxs("span",{children:[i.jsx("strong",{children:o("editor.texFmtDiagnosticsTitle")}),o("editor.texFmtDiagnosticsHint")]}),i.jsxs("details",{children:[i.jsx("summary",{children:o("editor.viewFormatterDiagnostics")}),i.jsx("pre",{children:wt})]}),i.jsx("button",{type:"button",className:"formatter-diagnostics-dismiss",title:o("editor.dismissFormatterDiagnostics"),"aria-label":o("editor.dismissFormatterDiagnostics"),onClick:()=>At(""),children:i.jsx(Ht,{size:13})})]}),fo&&i.jsxs("div",{className:"client-tool-recovery format-lease-status",role:"status",children:[i.jsx(ut,{className:"spin",size:15}),i.jsx("span",{children:o("editor.formattingBy",{name:fo.holderName})})]})]}),se&&i.jsx("div",{className:"toast",onClick:()=>A(""),children:se}),fe&&i.jsx("div",{className:"toast success",onClick:()=>ve(""),children:fe}),i.jsxs(Ap,{autoSaveId:"texlite-workspace-layout",direction:"horizontal",className:"work-grid",children:[Fs&&i.jsx(b2,{project:a,filesPanel:Rt,files:mn,visibleEntries:_f,activeFile:b,activeMainFile:x,rootDocuments:N,selectedFolder:Pc,expandedFolders:kf,fileDragActive:Tf,uploadingFiles:Of,readOnly:In,editorFontSize:at.fontSize,outline:up,sourceCursor:he,uploadInput:Te,setSelectedFolder:ro,setExpandedFolders:_c,setMoveEntry:Ic,setMoveName:Mc,setMoveDestination:$c,setDeleteEntry:Uc,setFileDialogError:Oc,setNewFolderName:Rc,setNewFolderOpen:Nc,setNewFilePath:Tc,setNewFileOpen:Bc,setQuickOpen:Ge,setProjectSearchOpen:Ee,setFileDragActive:Lf,setFilesCollapsed:pt,toggleFilesPanel:Jc,uploadFiles:zc,upload:$f,openFile:oo,jumpToSource:ir,syncSourceToPdf:or}),Fs&&i.jsx(Ta,{className:"resize-handle",children:i.jsx(Ed,{size:12})}),Fs&&i.jsx(E2,{project:a,activeFile:b,activeMainFile:x,openTabs:k,content:V,loadedFile:G,readOnly:In,comments:Gr,focusComment:Hf,editorPreferences:at,completionIndex:D,nativeSpellCheck:It.nativeFallback,spellCheckIssues:It.issues,spellCheckJump:It.jump,sourceJump:Kr,collaborativeText:fp,collaborationAwareness:Pe.awareness,undoManager:b?Pe.getUndoManager(b):void 0,editorNotice:rp,activateTab:Qc,closeTab:Jt,handleTabKeyDown:Cp,updateEditorContent:ar,setSelection:(v,M,ie)=>Xe({selectedText:v,startOffset:M,endOffset:ie}),onCommentClick:v=>{const M=Gr.find(ie=>ie.id===v);M&&(Hc({...M}),We("comments"))},onSpellCheckReplace:hp,onCursor:Ze}),Zc&&i.jsx(S2,{projectId:n,activeMainFile:x,previewTab:Z,diagnosticTab:ge,pdfUrl:_n,pdfLoadingMode:ep,pdfLoading:ao,pdfCompiledAt:cr,pdfCompiledLabel:pp,pdfTargetLabel:mp,pdfDownloadUrl:gp,pdfTarget:eo,pdfViewport:qr,activeFile:b,sourceCursor:he,compileBusy:Yr,compileLog:co,compileDiagnostics:tp,compileMessages:lo,artifacts:qc,artifactPreview:np,artifactLoading:sp,cleaning:Wc,readOnly:In,collaborationSynced:ze,workspaceLayout:ce,showSyncResize:Fs&&Zc,diagnosticCount:Dp,selectPreviewTab:X,changeWorkspaceLayout:uo,onSetNotice:ve,onSetPdfViewport:to,syncVisiblePdfToSource:no,syncSourceToPdf:or,syncPdfToSource:Wr,canSyncWithPdf:bp,files:mn,jumpToSource:ir,onSetCleanMode:q,cleanCompile:Gc,viewArtifact:cp}),i.jsx(M2,{sidePanel:ye,onClose:()=>We(null),project:a,projectId:n,site:t,files:mn,currentUserId:e.id,comments:Gr,onFocusComment:v=>Hc({...v}),onToggleComment:Gf,onReplyComment:Yf,onEditComment:Xf,onDeleteComment:Jf,onEditCommentReply:Zf,onDeleteCommentReply:Qf,dictionaryWords:d,onDictionaryChange:h,editorPreferences:at,onEditorPreferences:Yc,spellCheckCount:It.summary?.total??null,spellCheckUniqueCount:It.summary?.unique??null,spellCheckIndex:It.summary?It.index:-1,onSpellCheckNavigate:It.jumpToIssue,onProject:c})]}),i.jsx(O2,{user:e,project:a,projectId:n,activeFile:b,content:V,maxCitationBibtexBytes:t.maxCitationBibtexBytes,files:mn,directoryEntries:Pf,readOnly:In,workspaceLayout:ce,changeWorkspaceLayout:uo,resourcePreview:Cf,resourcePreviewLoading:Ef,setResourcePreview:Lc,setResourcePreviewLoading:wf,uploadConflict:Nf,setUploadConflict:Rf,uploadFiles:zc,cleanMode:pe,setCleanMode:q,cleanCompile:Gc,newFileOpen:bf,setNewFileOpen:Bc,newFilePath:yf,setNewFilePath:Tc,newFolderOpen:xf,setNewFolderOpen:Nc,newFolderName:vf,setNewFolderName:Rc,selectedFolder:Pc,fileDialogError:Af,setFileDialogError:Oc,createFile:If,createFolder:Mf,moveEntry:Sf,setMoveEntry:Ic,moveName:jf,setMoveName:Mc,moveDestination:Bf,setMoveDestination:$c,movePath:Uf,deleteEntry:io,setDeleteEntry:Uc,deleteActiveSessions:dp,removePath:zf,commentOpen:Vf,setCommentOpen:Vc,selection:qe,commentText:qf,setCommentText:Kf,addComment:Wf,shareOpen:De,setShareOpen:Et,citationLibraryOpen:Ue,setCitationLibraryOpen:z,insertCitationAtCursor:so,quickOpen:Ve,setQuickOpen:Ge,projectSearchOpen:st,setProjectSearchOpen:Ee,openFile:oo,jumpToSource:ir,historyOpen:Oe,setHistoryOpen:mt,gitOpen:le,setGitOpen:ke,save:xt,permissionDowngrade:Jn,permissionDowngradeBusy:ht,dismissPermissionDowngrade:sr,discardPermissionDraft:lp})]})}function U2(t){const e=[],n=/^\s*\\(part|chapter|section|subsection|subsubsection)\*?(?:\[[^\]]*\])?\{([^}]*)\}/,s={part:0,chapter:0,section:1,subsection:2,subsubsection:3};return t.split(`
|
|
64
|
-
`).forEach((r,o)=>{const a=r.match(n);a&&e.push({level:s[a[1]],title:a[2],line:o+1})}),e}function z2(){const{t}=ot(),[e,n]=f.useState(null),[s,r]=f.useState(),[o,a]=f.useState(()=>typeof window>"u"?null:xs(window.location.pathname)),[c,l]=f.useState(()=>{if(typeof window>"u")return null;const b=xs(window.location.pathname);return b?Zr(b):null}),[u,d]=f.useState(null),h=()=>{const b=xs(window.location.pathname);if(!b)return;const w={texliteRoute:"dashboard"};window.history.replaceState(w,"",lD(b)),a(null),l(null)},D=b=>{const w=uD(window.location.search);if(w){const x={texliteRoute:"project",projectId:w,fromDashboard:!1};window.history.replaceState(x,"",fr(w)),l(Zr(w,{force:!0})),a(w)}else if(new URLSearchParams(window.location.search).has("return")){const x={texliteRoute:"dashboard"};window.history.replaceState(x,"","/")}r(b)};f.useEffect(()=>{const b=xs(window.location.pathname);if(b&&window.location.pathname!==fr(b)){const j={texliteRoute:"project",projectId:b,fromDashboard:!1};window.history.replaceState(j,"",fr(b))}const w=()=>{const j=xs(window.location.pathname);a(j),l(j?Zr(j):null)},x=()=>{d(null),r(null),h()};return window.addEventListener("popstate",w),window.addEventListener("texlite:session-expired",x),()=>{window.removeEventListener("popstate",w),window.removeEventListener("texlite:session-expired",x)}},[]);const m=b=>{const w=fr(b);if(window.location.pathname!==w){const x={texliteRoute:"project",projectId:b,fromDashboard:!0};window.history.pushState(x,"",w)}l(Zr(b)),a(b)},g=()=>{const b=window.history.state;if(dD(b)&&b.fromDashboard){window.history.back();return}const w={texliteRoute:"dashboard"};window.history.replaceState(w,"","/"),a(null),l(null)};if(f.useEffect(()=>{ne("/api/config").then(b=>{n(b),document.title=b.siteName}),ne("/api/me",{suppressSessionExpired:!0}).then(({user:b})=>D(b)).catch(()=>{h(),r(null)})},[]),f.useEffect(()=>{if(!s||s.mustChangePassword||o)return;let b=!1,w=null,x=null;const j=()=>{b||_i().then($=>$.preloadPdfRuntime()).catch(()=>{})},N=window;return N.requestIdleCallback?x=N.requestIdleCallback(j,{timeout:1200}):w=window.setTimeout(j,400),()=>{b=!0,w!==null&&window.clearTimeout(w),x!==null&&N.cancelIdleCallback?.(x)}},[s?.id,s?.mustChangePassword,o]),s===void 0||!e)return i.jsx("div",{className:"center-card",children:t("common.loading")});if(!s)return i.jsx(DD,{site:e,onLogin:D});if(s.mustChangePassword)return i.jsx(mD,{site:e,user:s,onChanged:b=>r(b)});if(o)return i.jsx($2,{site:e,user:s,projectId:o,preload:c?.projectId===o?c:null,onBack:g},o);const y=u?.userId===s.id?u:null;return i.jsx(xg,{site:e,user:s,initialData:y?{projects:y.projects,tags:y.tags,pagination:y.pagination}:null,onDataChange:(b,w,x)=>d({userId:s.id,projects:b,tags:w,pagination:x}),onUser:b=>{(!b||b.id!==s.id)&&d(null),r(b),b||g()},onOpenProject:m})}class H2 extends f.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("Uncaught error in component tree:",e,n)}handleReset=()=>{this.setState({hasError:!1,error:null}),this.props.onReset?.()};render(){return this.state.hasError?typeof this.props.fallback=="function"?this.props.fallback(this.state.error??new Error("Unknown error"),this.handleReset):this.props.fallback?this.props.fallback:i.jsxs("div",{role:"alert",style:{padding:"2rem",margin:"1rem",borderRadius:"8px",backgroundColor:"var(--bg-secondary, #f8f9fa)",border:"1px solid var(--border-color, #e9ecef)",color:"var(--text-primary, #212529)",fontFamily:"system-ui, -apple-system, sans-serif"},children:[i.jsx("h2",{style:{fontSize:"1.25rem",fontWeight:600,marginBottom:"0.5rem",color:"#dc3545"},children:this.props.title??Ke.t("errors.boundaryTitle")}),i.jsx("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary, #6c757d)",marginBottom:"1rem"},children:Ke.t("errors.boundaryDescription")}),i.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[i.jsx("button",{type:"button",onClick:this.handleReset,className:"primary",style:{padding:"0.4rem 0.8rem",borderRadius:"4px",cursor:"pointer"},children:Ke.t("errors.boundaryRetry")}),i.jsx("button",{type:"button",onClick:()=>window.location.reload(),style:{padding:"0.4rem 0.8rem",borderRadius:"4px",cursor:"pointer"},children:Ke.t("errors.boundaryReload")})]})]}):this.props.children}}kp.createRoot(document.getElementById("root")).render(i.jsx(f.StrictMode,{children:i.jsx(H2,{children:i.jsx(z2,{})})}));export{v0 as A,bd as C,Us as F,M0 as G,jl as K,ut as L,bt as M,ci as P,la as R,Di as S,sn as T,gb as U,ne as a,J2 as b,X2 as c,Z2 as d,Q2 as e,ds as f,W2 as g,Sn as h,K2 as i,oe as j,Mi as k,J0 as l,Qa as m,Vn as n,Ad as o,O0 as p,is as q,Y2 as r,G2 as t};
|